server-re/decomp/AgentManager_Release_x64/full/functions/0x1400b82c0.c
2026-10-15 09:58:24 -04:00

40 lines
1 KiB
C

/* AgentManager_Release_x64.exe sha256 8fd8ca91725858651a7839d34257b10c2970ac16c97e60c523b8b0c983fcb186
* Ghidra 12.1.2 decompiler output for 0x1400b82c0 FUN_1400b82c0
* Pseudocode, not original source. */
int FUN_1400b82c0(void *param_1)
{
int iVar1;
longlong *plVar2;
int iVar3;
int iVar4;
if (param_1 == (void *)0x0) {
return 0x10;
}
EnterCriticalSection((LPCRITICAL_SECTION)&DAT_14017d400);
iVar4 = 0;
iVar3 = 0;
do {
iVar1 = memcmp(&DAT_140179f40 + (longlong)iVar3 * 0x10,param_1,0x80);
if (iVar1 == 0) {
LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_14017d400);
return iVar3;
}
iVar3 = iVar3 + 1;
} while (iVar3 < 0x20);
plVar2 = &DAT_140179f40;
do {
if (*plVar2 == 0) {
memcpy(&DAT_140179f40 + (longlong)iVar4 * 0x10,param_1,0x80);
LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_14017d400);
return iVar4;
}
plVar2 = plVar2 + 0x10;
iVar4 = iVar4 + 1;
} while ((longlong)plVar2 < 0x14017af40);
LeaveCriticalSection((LPCRITICAL_SECTION)&DAT_14017d400);
return -1;
}