//
// jpeg_simple_progression from 0xc01ac0 to 0xc01f30 (1136 bytes)
//
// 1 xrefs:
// > ??> @ 0xbf490
//
// 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 jpeg_simple_progression(__int64 a1)
{
int v1; // w1
int v3; // w19
void (__fastcall **v4)(__int64); // x2
int v5; // w21
__int64 v6; // x3
int v7; // w2
__int64 (__fastcall **v8)(__int64, _QWORD, __int64); // x3
int *result; // x0
int *v10; // x1
int v11; // w2
int v12; // w3
__int64 v13; // x1
int *v14; // x0
int *v15; // x2
int v16; // w1
int v17; // w1
_OWORD *v18; // x1
int v19; // w1
__int64 v20; // x1
int v21; // w2
v1 = *(_DWORD *)(a1 + 36);
v3 = *(_DWORD *)(a1 + 92);
if ( v1 != 100 )
{
v4 = *(void (__fastcall ***)(__int64))a1;
*((_DWORD *)v4 + 11) = v1;
*((_DWORD *)v4 + 10) = 21;
(**(void (__fastcall ***)(__int64))a1)(a1);
}
if ( v3 == 3 )
{
v5 = 10;
if ( (*(_DWORD *)(a1 + 96) & 0xFFFFFFFB) == 3 )
goto LABEL_6;
LABEL_36:
v5 = 4 * v3 + 2;
goto LABEL_6;
}
if ( v3 <= 4 )
goto LABEL_36;
v5 = 6 * v3;
LABEL_6:
v6 = *(_QWORD *)(a1 + 568);
if ( !v6 || v5 > *(_DWORD *)(a1 + 576) )
{
if ( v5 < 10 )
v7 = 10;
else
v7 = v5;
v8 = *(__int64 (__fastcall ***)(__int64, _QWORD, __int64))(a1 + 8);
*(_DWORD *)(a1 + 576) = v7;
v6 = (*v8)(a1, 0, 36LL * v7);
*(_QWORD *)(a1 + 568) = v6;
}
*(_QWORD *)(a1 + 280) = v6;
*(_DWORD *)(a1 + 272) = v5;
if ( v3 == 3 )
{
if ( (*(_DWORD *)(a1 + 96) & 0xFFFFFFFB) == 3 )
{
*(_DWORD *)v6 = 3;
*(_DWORD *)(v6 + 4) = 0;
*(_DWORD *)(v6 + 8) = 1;
*(_DWORD *)(v6 + 12) = 2;
*(_DWORD *)(v6 + 24) = 0;
*(_DWORD *)(v6 + 20) = 0;
*(_DWORD *)(v6 + 28) = 0;
*(_DWORD *)(v6 + 32) = 1;
*(_QWORD *)(v6 + 36) = 1;
*(_DWORD *)(v6 + 56) = 1;
*(_QWORD *)(v6 + 60) = 5;
*(_DWORD *)(v6 + 68) = 2;
*(_DWORD *)(v6 + 72) = 1;
*(_DWORD *)(v6 + 76) = 2;
*(_DWORD *)(v6 + 92) = 1;
*(_QWORD *)(v6 + 96) = 63;
*(_DWORD *)(v6 + 104) = 1;
*(_DWORD *)(v6 + 108) = 1;
*(_DWORD *)(v6 + 112) = 1;
*(_DWORD *)(v6 + 128) = 1;
*(_QWORD *)(v6 + 132) = 63;
*(_DWORD *)(v6 + 140) = 1;
*(_QWORD *)(v6 + 144) = 1;
*(_DWORD *)(v6 + 164) = 6;
*(_QWORD *)(v6 + 168) = 63;
*(_DWORD *)(v6 + 176) = 2;
*(_QWORD *)(v6 + 180) = 1;
*(_DWORD *)(v6 + 216) = 3;
*(_DWORD *)(v6 + 200) = 1;
*(_DWORD *)(v6 + 204) = 63;
*(_DWORD *)(v6 + 208) = 2;
*(_DWORD *)(v6 + 212) = 1;
*(_DWORD *)(v6 + 220) = 0;
*(_DWORD *)(v6 + 224) = 1;
*(_DWORD *)(v6 + 228) = 2;
*(_DWORD *)(v6 + 240) = 0;
*(_DWORD *)(v6 + 236) = 0;
*(_QWORD *)(v6 + 244) = 1;
*(_DWORD *)(v6 + 252) = 1;
*(_DWORD *)(v6 + 256) = 2;
*(_DWORD *)(v6 + 272) = 1;
*(_DWORD *)(v6 + 276) = 63;
*(_QWORD *)(v6 + 280) = 1;
*(_DWORD *)(v6 + 288) = 1;
*(_DWORD *)(v6 + 292) = 1;
*(_DWORD *)(v6 + 308) = 1;
*(_DWORD *)(v6 + 312) = 63;
*(_QWORD *)(v6 + 316) = 1;
*(_QWORD *)(v6 + 324) = 1;
*(_DWORD *)(v6 + 344) = 1;
*(_DWORD *)(v6 + 348) = 63;
*(_QWORD *)(v6 + 352) = 1;
return &dword_0 + 1;
}
*(_DWORD *)v6 = 3;
*(_DWORD *)(v6 + 4) = 0;
*(_DWORD *)(v6 + 8) = 1;
goto LABEL_15;
}
v20 = v6;
v21 = 0;
if ( v3 <= 4 )
{
*(_DWORD *)v6 = v3;
if ( v3 <= 0 || (*(_DWORD *)(v6 + 4) = 0, v3 == 1) || (*(_DWORD *)(v6 + 8) = 1, v3 <= 2) )
{
LABEL_17:
result = (int *)(v6 + 36);
*(_OWORD *)(v6 + 20) = xmmword_C01F30;
goto LABEL_18;
}
LABEL_15:
*(_DWORD *)(v6 + 12) = 2;
if ( v3 != 3 )
*(_DWORD *)(v6 + 16) = 3;
goto LABEL_17;
}
do
{
*(_DWORD *)(v20 + 4) = v21;
v20 += 36;
*(_DWORD *)(v20 - 36) = 1;
++v21;
*(_DWORD *)(v20 - 16) = 0;
*(_DWORD *)(v20 - 12) = 0;
*(_DWORD *)(v20 - 8) = 0;
*(_DWORD *)(v20 - 4) = 1;
}
while ( v21 != v3 );
result = (int *)(v6 + 36 * ((unsigned int)(v3 - 1) + 1LL));
LABEL_18:
v10 = result;
v11 = 0;
if ( v3 <= 0 )
{
*result = v3;
LABEL_29:
v18 = result + 5;
result += 9;
*v18 = xmmword_C01F40;
goto LABEL_30;
}
do
{
v10[1] = v11;
v10 += 9;
*(v10 - 9) = 1;
++v11;
*(v10 - 4) = 1;
*(_QWORD *)(v10 - 3) = 5;
*(v10 - 1) = 2;
}
while ( v11 != v3 );
v12 = 0;
v13 = 9 * ((unsigned int)(v3 - 1) + 1LL);
v14 = &result[v13];
v15 = v14;
do
{
v15[1] = v12;
v15 += 9;
*(v15 - 9) = 1;
++v12;
*(v15 - 4) = 6;
*(_QWORD *)(v15 - 3) = 63;
*(v15 - 1) = 2;
}
while ( v12 != v3 );
result = &v14[v13];
v16 = 0;
do
{
result[1] = v16;
result += 9;
*(result - 9) = 1;
++v16;
*(result - 4) = 1;
*(result - 3) = 63;
*(result - 2) = 2;
*(result - 1) = 1;
}
while ( v3 > v16 );
v17 = 0;
if ( v3 <= 4 )
{
*result = v3;
result[1] = 0;
if ( v3 > 1 )
{
result[2] = 1;
if ( v3 != 2 )
{
result[3] = 2;
if ( v3 == 4 )
result[4] = 3;
}
}
goto LABEL_29;
}
do
{
result[1] = v17;
result += 9;
*(result - 9) = 1;
++v17;
*(result - 4) = 0;
*(result - 3) = 0;
*((_QWORD *)result - 1) = 1;
}
while ( v3 > v17 );
LABEL_30:
v19 = 0;
if ( v3 > 0 )
{
do
{
result[1] = v19;
result += 9;
*(result - 9) = 1;
++v19;
*(result - 4) = 1;
*(result - 3) = 63;
*((_QWORD *)result - 1) = 1;
}
while ( v19 != v3 );
}
return result;
}