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

55 lines
1.5 KiB
C

/* AgentManager_Release_x64.exe sha256 8fd8ca91725858651a7839d34257b10c2970ac16c97e60c523b8b0c983fcb186
* Ghidra 12.1.2 decompiler output for 0x140001920 FUN_140001920
* Pseudocode, not original source. */
void FUN_140001920(undefined8 *param_1,ulonglong param_2,longlong param_3)
{
ulonglong uVar1;
undefined8 *_Dst;
ulonglong uVar2;
undefined8 *_Src;
ulonglong uVar3;
char *local_res20;
undefined **local_40 [3];
uVar3 = param_2 | 7;
if (uVar3 < 0x7fffffffffffffff) {
uVar1 = param_1[3];
uVar2 = uVar1 >> 1;
param_2 = uVar3;
if ((uVar3 / 3 < uVar2) && (param_2 = uVar2 + uVar1, 0x7ffffffffffffffe - uVar2 < uVar1)) {
param_2 = 0x7ffffffffffffffe;
}
}
uVar3 = param_2 + 1;
_Dst = (undefined8 *)0x0;
if ((uVar3 != 0) &&
((0x7fffffffffffffff < uVar3 || (_Dst = operator_new(uVar3 * 2), _Dst == (undefined8 *)0x0))))
{
local_res20 = (char *)0x0;
std::exception::exception((exception *)local_40,&local_res20);
local_40[0] = std::bad_alloc::vftable;
/* WARNING: Subroutine does not return */
_CxxThrowException(local_40,(ThrowInfo *)&DAT_14016c158);
}
if (param_3 != 0) {
_Src = param_1;
if (7 < (ulonglong)param_1[3]) {
_Src = (undefined8 *)*param_1;
}
memcpy(_Dst,_Src,param_3 * 2);
}
if (7 < (ulonglong)param_1[3]) {
operator_delete((void *)*param_1);
}
*param_1 = _Dst;
param_1[3] = param_2;
param_1[2] = param_3;
if (7 < param_2) {
param_1 = _Dst;
}
*(undefined2 *)((longlong)param_1 + param_3 * 2) = 0;
return;
}