//
// sub_761114 from 0x761114 to 0x761172 (94 bytes)
//
// 1 xrefs:
// > sub_76DEE8 @ 0x76df68
//
// 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
//
int __fastcall sub_761114(int a1, unsigned __int8 *a2, int a3)
{
int v6; // r5
signed int v7; // r4
int v8; // r3
int v9; // r1
if ( a3 > 0 )
{
v6 = 0;
while ( 1 )
{
v7 = a3 - v6;
v8 = *(_DWORD *)(a1 + 24) - *(_DWORD *)(a1 + 20);
if ( v8 )
{
if ( v7 >= v8 )
v7 = *(_DWORD *)(a1 + 24) - *(_DWORD *)(a1 + 20);
v6 += v7;
memcpy(*(void **)(a1 + 20), a2, v7);
*(_DWORD *)(a1 + 20) += v7;
if ( a3 <= v6 )
return v6;
a2 += v7;
}
v9 = *a2++;
if ( (*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 52))(a1, v9) != -1 && a3 > ++v6 )
continue;
return v6;
}
}
return 0;
}