//
// png_set_background_fixed from 0x8689b8 to 0x868a44 (140 bytes)
//
// 5 xrefs:
// > sub_8644A4 @ 0x86485a
// > sub_8644A4 @ 0x8652a6
// > sub_8644A4 @ 0x865382
// > sub_865DE8 @ 0x866172
// > png_set_background @ 0x868a7c
//
// 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:02:49 +0000
//
int __fastcall png_set_background_fixed(int result, int a2, int a3, int a4, int a5)
{
int v5; // r5
int v6; // r4
int v8; // r0
unsigned int v9; // r5
unsigned int v10; // r12
int v11; // r1
if ( result )
{
v5 = *(_DWORD *)(result + 312);
v6 = result;
if ( (v5 & 0x40) != 0 )
{
return png_app_error(result, "invalid after png_start_read_image or png_read_update_info");
}
else
{
*(_DWORD *)(result + 312) = v5 | 0x4000;
if ( a2 )
{
if ( a3 )
{
v8 = *(_DWORD *)(result + 316);
*(_DWORD *)(v6 + 312) = v5 & 0xFFFF9FFF | 0x4000;
v9 = v8 & 0xFF7FFFFF;
v10 = v8 & 0xFF7BFFFF | 0x40000;
*(_DWORD *)(v6 + 316) = v8 & 0xFF7BFF7F | 0x40080;
v11 = *(_DWORD *)(a2 + 4);
result = *(_DWORD *)a2;
*(_DWORD *)(v6 + 552) = *(_DWORD *)a2;
*(_DWORD *)(v6 + 556) = v11;
*(_WORD *)(v6 + 560) = *(_WORD *)(a2 + 8);
*(_DWORD *)(v6 + 548) = a5;
*(_BYTE *)(v6 + 546) = a3;
if ( a4 )
*(_DWORD *)(v6 + 316) = v10 | 0x180;
else
*(_DWORD *)(v6 + 316) = v9 & 0xFFFBFE7F | 0x40080;
}
else
{
return png_warning(result, "Application must supply a known background gamma");
}
}
}
}
return result;
}