//
// sub_100550B34 from 0x100550b34 to 0x100550c00 (204 bytes)
//
// 2 xrefs:
// > sub_10054DB30 @ 0x10054f514
// > sub_10055090C @ 0x100550a90
//
// 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
//
signed __int64 __fastcall sub_100550B34(void *a1, __int64 a2, __int64 a3, __int64 *a4)
{
__int64 v6; // x21
signed __int64 v7; // x2
signed __int64 v8; // x19
const void *v9; // x1
signed __int64 v10; // x9
__int64 v11; // x8
__int64 v12; // x9
__int64 v13; // x9
v6 = *(_QWORD *)(*a4 + 536);
v7 = *(_QWORD *)(v6 + 8);
if ( !v7 )
return 0;
v8 = a3 * a2;
*(_BYTE *)(*a4 + 531) = *(_DWORD *)(v6 + 120) == 1;
v9 = *(const void **)(v6 + 16);
if ( v7 <= v8 )
{
memcpy(a1, v9, v7);
v8 = *(_QWORD *)(v6 + 8);
v11 = *(_QWORD *)(v6 + 112);
if ( v11 )
{
v12 = *(_QWORD *)(v6 + 104);
*(_QWORD *)(v6 + 8) = v11;
*(_QWORD *)(v6 + 16) = v12;
v13 = *a4;
*(_QWORD *)(v13 + 35656) = *(_QWORD *)(v6 + 88);
*(_QWORD *)(v13 + 35664) = *(_QWORD *)(v6 + 96);
++*(_DWORD *)(v6 + 120);
*(_QWORD *)(v6 + 112) = 0;
}
else
{
*(_QWORD *)(v6 + 8) = 0;
}
}
else
{
memcpy(a1, v9, v8);
v10 = *(_QWORD *)(v6 + 16) + v8;
*(_QWORD *)(v6 + 8) -= v8;
*(_QWORD *)(v6 + 16) = v10;
}
return v8;
}