//
// png_write_finish_row from 0x875de0 to 0x875ebe (222 bytes)
//
// 2 xrefs:
// > png_write_row @ 0x872104
// > png_write_find_filter @ 0x876328
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:03:02 +0000
//
_DWORD *__fastcall png_write_finish_row(_DWORD *result)
{
unsigned int v1; // r2
unsigned int v2; // r3
int v3; // r4
int v4; // r3
unsigned int v5; // r5
unsigned int v6; // r1
unsigned int v7; // r3
unsigned int v8; // r8
int v9; // r0
unsigned int v10; // r0
bool v11; // zf
unsigned __int8 *v12; // r7
unsigned int v13; // r3
int v14; // r2
int v15; // r3
bool v16; // cc
unsigned int v17; // r2
v1 = result[114];
v2 = result[118] + 1;
result[118] = v2;
if ( v2 >= v1 )
{
v3 = (int)result;
if ( !*((_BYTE *)result + 532) )
return (_DWORD *)png_compress_IDAT(v3, 0, 0, 4);
v4 = result[79];
result[118] = 0;
if ( (v4 & 2) == 0 )
{
LOBYTE(v5) = *((_BYTE *)result + 533);
while ( 1 )
{
v5 = (unsigned __int8)(v5 + 1);
v12 = (unsigned __int8 *)&dword_C21A48 + v5;
if ( v5 > 6 )
break;
v6 = v12[24];
v7 = *(_DWORD *)(v3 + 452) - 1 + v6;
v8 = (*(_DWORD *)(v3 + 448) - 1 + v12[8] - (unsigned int)v12[16]) / v12[8];
v9 = v12[32];
*(_DWORD *)(v3 + 460) = v8;
v10 = (v7 - v9) / v6;
v11 = v10 == 0;
if ( v10 )
v11 = v8 == 0;
*(_DWORD *)(v3 + 456) = v10;
if ( !v11 )
{
*(_BYTE *)(v3 + 533) = v5;
goto LABEL_14;
}
}
*(_BYTE *)(v3 + 533) = v5;
return (_DWORD *)png_compress_IDAT(v3, 0, 0, 4);
}
v13 = (unsigned __int8)(*((_BYTE *)result + 533) + 1);
*((_BYTE *)result + 533) = v13;
if ( v13 > 6 )
return (_DWORD *)png_compress_IDAT(v3, 0, 0, 4);
LABEL_14:
result = *(_DWORD **)(v3 + 480);
if ( result )
{
v14 = *(unsigned __int8 *)(v3 + 540) * *(unsigned __int8 *)(v3 + 537);
v15 = *(_DWORD *)(v3 + 448);
v16 = v14 <= 7;
if ( v14 > 7 )
v17 = ((unsigned int)v14 >> 3) * v15;
else
v17 = v14 * v15;
if ( v16 )
v17 = (v17 + 7) >> 3;
return j_memset(result, 0, v17 + 1);
}
}
return result;
}