//
// sub_634F0C from 0x634f0c to 0x634f80 (116 bytes)
//
// 4 xrefs:
// > sub_6353AC @ 0x6355a4
// > sub_6353AC @ 0x63585a
// > sub_6353AC @ 0x6358a4
// > sub_6353AC @ 0x635a08
//
// 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_634F0C(_DWORD **a1, int a2, char *a3, size_t a4, _DWORD *a5)
{
int v9; // r9
int v10; // r3
int result; // r0
ssize_t v12; // [sp+4h] [bp-4h] BYREF
v9 = 0;
*a5 = 0;
while ( 1 )
{
do
{
v10 = sub_62D584(*a1, nullptr, 1);
if ( v10 < 0 )
return 28;
if ( sub_632D88(a2, -1, -1, v10) <= 0 )
return -1;
result = sub_618894(a2, a3, a4, &v12);
}
while ( result == 81 );
if ( result )
return result;
a3 += v12;
if ( a4 == v12 )
break;
if ( !v12 )
return -1;
a4 -= v12;
v9 += v12;
}
*a5 = a4 + v9;
return result;
}