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

107 lines
3 KiB
C

/* DBCServer_Release_x64.exe sha256 d9e4fccdf3482e50247686d4452c0b13c75a53efc4bd7320668eece8d1ce828c
* Ghidra 12.1.2 decompiler output for 0x1401f42e0 FUN_1401f42e0
* Pseudocode, not original source. */
/* WARNING: Function: __chkstk replaced with injection: alloca_probe */
/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */
int FUN_1401f42e0(short *param_1,longlong param_2,undefined4 *param_3,uint param_4)
{
short sVar1;
undefined1 *_Memory;
undefined1 *_Memory_00;
int iVar2;
int iVar3;
undefined1 *puVar4;
undefined1 *puVar5;
ulonglong uVar6;
uint uVar7;
short *psVar8;
undefined1 auStack_1208 [32];
undefined4 local_11e8 [2];
undefined1 *local_11e0;
longlong local_11d8;
undefined1 *local_11d0;
undefined4 *local_11c8;
undefined8 local_11c0;
undefined1 *local_11b8;
undefined1 local_11b0 [264];
undefined1 local_10a8 [2096];
undefined1 local_878 [2096];
ulonglong local_48;
undefined8 uStack_40;
uStack_40 = 0x1401f42f6;
local_11c0 = 0xfffffffffffffffe;
local_48 = DAT_1403463c0 ^ (ulonglong)auStack_1208;
iVar3 = 0;
local_11d8 = param_2;
local_11c8 = param_3;
if (param_1 == (short *)0x0) {
/* WARNING: Subroutine does not return */
FUN_14004dc60(0x80004005);
}
if (param_2 == 0) {
/* WARNING: Subroutine does not return */
FUN_14004dc60(0x80004005);
}
uVar6 = 0xffffffffffffffff;
psVar8 = param_1;
do {
if (uVar6 == 0) break;
uVar6 = uVar6 - 1;
sVar1 = *psVar8;
psVar8 = psVar8 + 1;
} while (sVar1 != 0);
local_11e0 = (undefined1 *)(~uVar6 - 1);
iVar2 = FUN_1401bc220(param_1,(ulonglong)local_11e0 & 0xffffffff,0,0);
if (iVar2 != 0) {
uVar7 = iVar2 + 1;
local_11d0 = (undefined1 *)0x0;
puVar4 = local_10a8;
if ((int)uVar7 < 1) {
free((void *)0x0);
iVar3 = 0;
}
else if ((uVar7 < 0x825) ||
(puVar4 = malloc((longlong)(int)uVar7), local_11d0 = puVar4, puVar4 != (undefined1 *)0x0
)) {
_Memory_00 = local_11d0;
iVar3 = FUN_1401bc220(param_1,(ulonglong)local_11e0 & 0xffffffff,puVar4,uVar7);
puVar4[iVar3] = 0;
puVar5 = local_878;
local_11e0 = (undefined1 *)0x0;
if ((param_4 < 0x825) ||
(puVar5 = malloc((ulonglong)param_4), local_11e0 = puVar5, puVar5 != (undefined1 *)0x0)) {
_Memory = local_11e0;
local_11e8[0] = 0;
iVar3 = FUN_1401f39c0(puVar4,puVar5,local_11e8,param_4);
if (iVar3 != 0) {
local_11b8 = local_11b0;
FUN_14015b060(&local_11b8,puVar5,3);
FUN_14016eca0(local_11d8,(ulonglong)param_4,local_11b8,local_11e8[0]);
if (local_11b8 != local_11b0) {
free(local_11b8);
}
}
if (param_3 != (undefined4 *)0x0) {
*param_3 = local_11e8[0];
}
free(_Memory);
free(_Memory_00);
}
else {
free((void *)0x0);
free(_Memory_00);
iVar3 = 0;
}
}
else {
free((void *)0x0);
iVar3 = 0;
}
}
return iVar3;
}