//
// sub_C0663C from 0xc0663c to 0xc066ac (112 bytes)
//
// 2 xrefs:
// > jpeg_stdio_src @ 0xc06798
// > jpeg_mem_src @ 0xc06854
//
// 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_C0663C(__int64 result, __int64 a2)
{
__int64 v2; // x19
__int64 v3; // x21
__int64 *v4; // x20
__int64 i; // x1
v2 = a2;
v3 = result;
v4 = *(__int64 **)(result + 40);
if ( a2 > 0 )
{
for ( i = v4[1]; i < v2; i = v4[1] )
{
v2 -= i;
((void (__fastcall *)(__int64))v4[3])(v3);
}
result = *v4;
v4[1] = i - v2;
*v4 = result + v2;
}
return result;
}