//
// jinit_arith_decoder from 0xc06128 to 0xc0623c (276 bytes)
//
// 3 xrefs:
// > jinit_master_decompress @ 0xc13f48
// > jpeg_read_coefficients @ 0xc15d80
// > ??> @ 0x2ed88
//
// 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 jinit_arith_decoder(__int64 a1)
{
__int64 v2; // x0
__int64 result; // x0
char *v4; // x20
int v5; // w19
void *v6; // x0
v2 = (**(__int64 (***)(void))(a1 + 8))();
*(_QWORD *)(a1 + 624) = v2;
*(_QWORD *)v2 = sub_C04E90;
*(_QWORD *)(v2 + 16) = nullsub_16;
*(_QWORD *)(v2 + 80) = 0;
*(_QWORD *)(v2 + 88) = 0;
*(_QWORD *)(v2 + 96) = 0;
*(_QWORD *)(v2 + 104) = 0;
*(_QWORD *)(v2 + 112) = 0;
*(_QWORD *)(v2 + 120) = 0;
*(_QWORD *)(v2 + 128) = 0;
*(_QWORD *)(v2 + 136) = 0;
*(_QWORD *)(v2 + 144) = 0;
*(_QWORD *)(v2 + 152) = 0;
*(_QWORD *)(v2 + 160) = 0;
*(_QWORD *)(v2 + 168) = 0;
*(_QWORD *)(v2 + 176) = 0;
*(_QWORD *)(v2 + 184) = 0;
*(_QWORD *)(v2 + 192) = 0;
*(_QWORD *)(v2 + 200) = 0;
*(_QWORD *)(v2 + 208) = 0;
*(_QWORD *)(v2 + 216) = 0;
*(_QWORD *)(v2 + 224) = 0;
*(_QWORD *)(v2 + 232) = 0;
*(_QWORD *)(v2 + 240) = 0;
*(_QWORD *)(v2 + 248) = 0;
*(_QWORD *)(v2 + 256) = 0;
*(_QWORD *)(v2 + 264) = 0;
*(_QWORD *)(v2 + 272) = 0;
*(_QWORD *)(v2 + 280) = 0;
*(_QWORD *)(v2 + 288) = 0;
*(_QWORD *)(v2 + 296) = 0;
*(_QWORD *)(v2 + 304) = 0;
*(_QWORD *)(v2 + 312) = 0;
*(_QWORD *)(v2 + 320) = 0;
*(_QWORD *)(v2 + 328) = 0;
*(_BYTE *)(v2 + 336) = 113;
result = *(unsigned int *)(a1 + 316);
if ( (_DWORD)result )
{
result = (**(__int64 (__fastcall ***)(__int64, __int64, __int64))(a1 + 8))(
a1,
1,
4LL * (int)(*(_DWORD *)(a1 + 56) << 6));
*(_QWORD *)(a1 + 192) = result;
v4 = (char *)result;
if ( *(int *)(a1 + 56) > 0 )
{
v5 = 0;
do
{
v6 = v4;
v4 += 256;
++v5;
memset(v6, 255, 0x100u);
result = *(unsigned int *)(a1 + 56);
}
while ( (int)result > v5 );
}
}
return result;
}