server-re/decomp/DBCServer_Release_x64/full/functions/0x1401d6280.c

172 lines
5.1 KiB
C

/* DBCServer_Release_x64.exe sha256 d9e4fccdf3482e50247686d4452c0b13c75a53efc4bd7320668eece8d1ce828c
* Ghidra 12.1.2 decompiler output for 0x1401d6280 FUN_1401d6280
* Pseudocode, not original source. */
void FUN_1401d6280(longlong *param_1,undefined8 param_2)
{
longlong lVar1;
ulonglong *puVar2;
int iVar3;
uint uVar4;
uint uVar5;
uint uVar6;
uint *puVar7;
undefined8 uVar8;
ulonglong uVar9;
uint *puVar10;
uint uVar11;
ulonglong uVar12;
uint uVar13;
undefined4 local_res8 [2];
uint *local_res18;
undefined1 local_res20 [8];
undefined **local_50;
undefined8 local_48;
undefined8 local_40;
undefined8 local_38;
undefined8 local_30;
FUN_1401a7d90(param_2,0);
(**(code **)(param_1[0xf] + 0x10))();
uVar12 = 0;
if (((longlong *)param_1[699] == (longlong *)0x0) ||
(lVar1 = *(longlong *)param_1[699], uVar9 = lVar1 - 0x40, lVar1 == 0)) {
uVar9 = uVar12;
}
iVar3 = FUN_1401bfd60(uVar9 + 0x130,param_2,1,*(undefined4 *)((longlong)param_1 + 0x6a4),
local_res8);
if (-1 < iVar3) {
return;
}
FUN_14016d8c0();
local_res18 = (uint *)PTR_DAT_1403440a0;
uVar4 = FUN_14016d740(L"Received stream from TCP server became inconsistent!");
uVar6 = 0;
uVar9 = uVar12;
if ((local_res18 != (uint *)0x0) && (uVar9 = 0, local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar9 = (ulonglong)local_res18[-2];
}
uVar5 = uVar4;
if ((((int)uVar4 <= (int)uVar9) && (uVar5 = uVar6, local_res18 != (uint *)0x0)) &&
(local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar5 = local_res18[-2];
}
uVar11 = 1;
if (1 < (int)uVar5) {
uVar11 = uVar5;
}
uVar5 = uVar6;
if ((local_res18 != (uint *)0x0) && (local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar5 = local_res18[-2];
}
uVar13 = 0;
if ((int)uVar5 < (int)uVar11) {
if (local_res18 == (uint *)0x0) {
local_res18 = (uint *)PTR_DAT_1403440a0;
}
if ((int)uVar11 < 0) {
/* WARNING: Subroutine does not return */
FUN_14016d6b0();
}
if (uVar11 == 0) {
FUN_14004eb70(&local_res18);
}
else {
uVar5 = uVar6;
if ((local_res18 != (uint *)0x0) && (local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar5 = local_res18[-2];
}
if (uVar11 != uVar5) {
puVar7 = (uint *)FUN_14016d940((longlong)(int)uVar11 * 2 + 10);
if (puVar7 != (uint *)0x0) {
*puVar7 = 0;
puVar7[1] = 1;
}
*puVar7 = uVar11;
uVar5 = uVar13;
if ((local_res18 != (uint *)0x0) && (local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar5 = local_res18[-2];
}
puVar10 = (uint *)PTR_DAT_1403440a0;
if ((int)uVar11 < (int)uVar5) {
LAB_1401d63fb:
if (local_res18 != (uint *)0x0) {
puVar10 = local_res18;
}
}
else {
uVar11 = uVar6;
if (local_res18 != (uint *)0x0) {
if (local_res18 != (uint *)PTR_DAT_1403440a0) {
uVar11 = local_res18[-2];
}
goto LAB_1401d63fb;
}
}
FUN_14016d770(puVar7 + 2,puVar10,uVar11);
FUN_14004eb70(&local_res18);
local_res18 = puVar7 + 2;
}
}
}
FUN_14004e850(&local_res18);
puVar7 = local_res18;
if (local_res18 == (uint *)0x0) {
puVar7 = (uint *)PTR_DAT_1403440a0;
}
FUN_14016d770(puVar7,L"Received stream from TCP server became inconsistent!",uVar4);
puVar7 = local_res18;
if (local_res18 == (uint *)0x0) {
puVar7 = (uint *)PTR_DAT_1403440a0;
}
uVar6 = FUN_14016d740(puVar7);
uVar4 = 0;
if (0 < (int)uVar6) {
uVar4 = uVar6;
}
uVar6 = uVar13;
if ((local_res18 != (uint *)0x0) && (local_res18 != (uint *)PTR_DAT_1403440a0)) {
uVar6 = local_res18[-2];
}
if (((int)uVar6 <= (int)uVar4) && (uVar4 = uVar13, local_res18 != (uint *)0x0)) {
if (local_res18 == (uint *)PTR_DAT_1403440a0) goto LAB_1401d64ab;
uVar4 = local_res18[-2];
}
if (((local_res18 != (uint *)PTR_DAT_1403440a0) && (local_res18 != (uint *)0x0)) &&
(local_res18 + -2 != (uint *)0x0)) {
local_res18[-2] = uVar4;
*(undefined2 *)((longlong)local_res18 + (longlong)(int)uVar4 * 2) = 0;
}
LAB_1401d64ab:
local_48 = 0;
local_40 = 0;
local_38 = 0;
local_30 = 0;
local_50 = Proud::ByteArray::vftable;
uVar8 = FUN_140198f80(local_res20,local_res8[0],1,&local_res18,&local_50);
(**(code **)(*param_1 + 0x80))(param_1,uVar8);
FUN_14019a9e0(&local_50);
puVar7 = local_res18;
if (((local_res18 != (uint *)0x0) && (local_res18 != (uint *)PTR_DAT_1403440a0)) &&
(puVar10 = local_res18 + -2, puVar10 != (uint *)0x0)) {
uVar8 = FUN_14016d8c0();
FUN_14016db50(uVar8);
puVar7 = puVar7 + -1;
*puVar7 = *puVar7 - 1;
if (*puVar7 == 0) {
FUN_14016d970(puVar10);
}
FUN_14016dbe0(uVar8);
}
if ((((longlong *)param_1[699] != (longlong *)0x0) &&
(lVar1 = *(longlong *)param_1[699], lVar1 != 0)) &&
((puVar2 = *(ulonglong **)(lVar1 + 0xe8), puVar2 != (ulonglong *)0x0 && (*puVar2 != 0)))) {
if (puVar2 != (ulonglong *)0x0) {
uVar12 = *puVar2;
}
FUN_14019c630(uVar12);
}
return;
}