//
// png_write_finish_row from 0xe642a4 to 0xe645ec (840 bytes)
//
// 3 xrefs:
// > png_write_row @ 0xe5d8e0
// > png_write_find_filter @ 0xe66cf4
// > ??> @ 0x5fc80
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:10:25 +0000
//
_DWORD *__fastcall png_write_finish_row(_DWORD *result)
{
unsigned int v1; // w2
unsigned int v2; // w1
int v3; // w1
int v4; // w6
unsigned int v5; // w1
int v6; // w5
unsigned int v7; // w4
unsigned int v8; // w9
int v9; // w8
unsigned int v10; // w3
unsigned int v11; // w7
unsigned int v12; // w9
int v13; // w8
unsigned int v14; // w3
unsigned int v15; // w7
unsigned int v16; // w9
int v17; // w8
unsigned int v18; // w3
unsigned int v19; // w7
unsigned int v20; // w9
int v21; // w8
unsigned int v22; // w3
unsigned int v23; // w7
unsigned int v24; // w9
int v25; // w8
unsigned int v26; // w3
unsigned int v27; // w7
unsigned int v28; // w9
unsigned int v29; // w2
unsigned int v30; // w3
int v31; // w3
unsigned int v32; // w4
void *v33; // x3
unsigned int v34; // w1
int v35; // w1
size_t v36; // x2
v1 = result[142];
v2 = result[147] + 1;
result[147] = v2;
if ( v2 < v1 )
return result;
if ( !*((_BYTE *)result + 684) )
return (_DWORD *)png_compress_IDAT((__int64)result, 0, 0, 4u);
v3 = result[91];
result[147] = 0;
if ( (v3 & 2) == 0 )
{
v4 = *((unsigned __int8 *)result + 685);
v5 = (unsigned __int8)(v4 + 1);
if ( v5 <= 6 )
{
v6 = result[140];
v7 = result[141];
v8 = byte_11BF6C0[(unsigned __int8)(v4 + 1) + 32];
v9 = byte_11BF6C0[(unsigned __int8)(v4 + 1) + 48];
v10 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 1)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 1) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 1)];
result[143] = v10;
v11 = (v7 - 1 + v8 - v9) / v8;
result[142] = v11;
if ( v10 && v11 )
goto LABEL_29;
v5 = (unsigned __int8)(v4 + 2);
if ( v5 != 7 )
{
v12 = byte_11BF6C0[(unsigned __int8)(v4 + 2) + 32];
v13 = byte_11BF6C0[(unsigned __int8)(v4 + 2) + 48];
v14 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 2)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 2) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 2)];
result[143] = v14;
v15 = (v7 - 1 + v12 - v13) / v12;
result[142] = v15;
if ( v14 && v15 )
goto LABEL_29;
v5 = (unsigned __int8)(v4 + 3);
if ( v5 != 7 )
{
v16 = byte_11BF6C0[(unsigned __int8)(v4 + 3) + 32];
v17 = byte_11BF6C0[(unsigned __int8)(v4 + 3) + 48];
v18 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 3)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 3) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 3)];
result[143] = v18;
v19 = (v7 - 1 + v16 - v17) / v16;
result[142] = v19;
if ( v18 && v19 )
goto LABEL_29;
v5 = (unsigned __int8)(v4 + 4);
if ( v5 != 7 )
{
v20 = byte_11BF6C0[(unsigned __int8)(v4 + 4) + 32];
v21 = byte_11BF6C0[(unsigned __int8)(v4 + 4) + 48];
v22 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 4)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 4) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 4)];
result[143] = v22;
v23 = (v7 - 1 + v20 - v21) / v20;
result[142] = v23;
if ( v22 && v23 )
goto LABEL_29;
v5 = (unsigned __int8)(v4 + 5);
if ( v5 != 7 )
{
v24 = byte_11BF6C0[(unsigned __int8)(v4 + 5) + 32];
v25 = byte_11BF6C0[(unsigned __int8)(v4 + 5) + 48];
v26 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 5)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 5) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 5)];
result[143] = v26;
v27 = (v7 - 1 + v24 - v25) / v24;
result[142] = v27;
if ( v26 && v27 )
goto LABEL_29;
v5 = (unsigned __int8)(v4 + 6);
if ( v5 != 7 )
{
v28 = byte_11BF6C0[(unsigned __int8)(v4 + 6) + 32];
v29 = (v6
- 1
+ byte_11BF6C0[(unsigned __int8)(v4 + 6)]
- (unsigned int)byte_11BF6C0[(unsigned __int8)(v4 + 6) + 16])
/ byte_11BF6C0[(unsigned __int8)(v4 + 6)];
v30 = v7 - 1 + v28 - byte_11BF6C0[(unsigned __int8)(v4 + 6) + 48];
result[143] = v29;
v31 = v30 / v28;
result[142] = v31;
if ( !v29 || !v31 )
{
if ( !v4 || (v32 = v7 >> 1, result[143] = v6, result[142] = v32, !v6) || !v32 )
{
LOBYTE(v5) = 7;
goto LABEL_26;
}
LOBYTE(v5) = 6;
}
LABEL_29:
v33 = *((void **)result + 75);
*((_BYTE *)result + 685) = v5;
if ( !v33 )
return result;
goto LABEL_33;
}
}
}
}
}
}
LABEL_26:
*((_BYTE *)result + 685) = v5;
return (_DWORD *)png_compress_IDAT((__int64)result, 0, 0, 4u);
}
v34 = (unsigned __int8)(*((_BYTE *)result + 685) + 1);
*((_BYTE *)result + 685) = v34;
if ( v34 > 6 )
return (_DWORD *)png_compress_IDAT((__int64)result, 0, 0, 4u);
v33 = *((void **)result + 75);
if ( v33 )
{
LABEL_33:
v35 = *((unsigned __int8 *)result + 692) * *((unsigned __int8 *)result + 689);
if ( v35 <= 7 )
v36 = ((v35 * (unsigned __int64)(unsigned int)result[140] + 7) >> 3) + 1;
else
v36 = ((unsigned __int64)v35 >> 3) * (unsigned int)result[140] + 1;
return memset(v33, 0, v36);
}
return result;
}