//
// sub_1005E4B94 from 0x1005e4b94 to 0x1005e4cc8 (308 bytes)
//
// 1 xrefs:
// > ??> @ 0x10083b898
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1005E4B94(__int64 a1, _BYTE *a2, int *a3, unsigned __int64 a4)
{
int *v4; // x21
_BYTE *v5; // x19
__int64 v7; // x8
void (__fastcall *v8)(int *, _BYTE *, unsigned __int64, __int64, __int64); // x9
unsigned __int64 v9; // x25
_BYTE *v10; // x23
int *v11; // x21
unsigned __int64 v12; // x24
int *v14; // [xsp+0h] [xbp-60h]
unsigned __int64 v15; // [xsp+8h] [xbp-58h]
v4 = a3;
v5 = a2;
v7 = *(_QWORD *)(a1 + 120);
v8 = *(void (__fastcall **)(int *, _BYTE *, unsigned __int64, __int64, __int64))(v7 + 128);
if ( v8 )
{
v8(a3, a2, a4, v7, a1 + 40);
}
else
{
if ( a4 >> 62 )
{
v9 = a4 - 0x4000000000000000LL;
v15 = (a4 - 0x4000000000000000LL) & 0xC000000000000000LL;
v14 = (int *)((char *)a3 + v15 + 0x4000000000000000LL);
sub_100599E54(a3, a2, 0x4000000000000000LL, (int *)v7, (unsigned __int8 *)(a1 + 40), *(_DWORD *)(a1 + 16));
if ( v9 >> 62 )
{
v10 = v5 + 0x4000000000000000LL;
v11 = v4 + 0x1000000000000000LL;
v12 = v9;
do
{
sub_100599E54(
v11,
v10,
0x4000000000000000LL,
*(int **)(a1 + 120),
(unsigned __int8 *)(a1 + 40),
*(_DWORD *)(a1 + 16));
v12 -= 0x4000000000000000LL;
v10 += 0x4000000000000000LL;
v11 += 0x1000000000000000LL;
}
while ( v12 >> 62 );
}
v5 += v15 + 0x4000000000000000LL;
v4 = v14;
a4 = v9 - v15;
}
if ( a4 )
sub_100599E54(v4, v5, a4, *(int **)(a1 + 120), (unsigned __int8 *)(a1 + 40), *(_DWORD *)(a1 + 16));
}
return 1;
}