//
// png_set_background_fixed from 0xe4d9e8 to 0xe4da94 (172 bytes)
//
// 6 xrefs:
// > sub_E47DAC @ 0xe48544
// > sub_E47DAC @ 0xe48990
// > sub_E47DAC @ 0xe49190
// > png_read_row @ 0xe49ff4
// > png_set_background @ 0xe4dad8
// > ??> @ 0x499c0
//
// 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:09 +0000
//
__int64 __fastcall png_set_background_fixed(__int64 result, __int64 a2, int a3, int a4, int a5)
{
__int64 v5; // x5
int v6; // w6
int v7; // w7
v5 = result;
if ( result )
{
v6 = *(_DWORD *)(result + 360);
if ( (v6 & 0x40) != 0 )
{
return png_app_error(result, "invalid after png_start_read_image or png_read_update_info");
}
else
{
*(_DWORD *)(result + 360) = v6 | 0x4000;
if ( a2 )
{
if ( a3 )
{
v7 = *(_DWORD *)(result + 364);
*(_DWORD *)(result + 360) = v6 & 0xFFFF9FFF | 0x4000;
*(_DWORD *)(result + 364) = v7 & 0xFF7BFF7F | 0x40080;
*(_QWORD *)(result + 704) = *(_QWORD *)a2;
*(_WORD *)(result + 712) = *(_WORD *)(a2 + 8);
*(_DWORD *)(result + 700) = a5;
*(_BYTE *)(result + 698) = a3;
if ( a4 )
{
result = v7 & 0xFF7BFE7F | 0x40180;
*(_DWORD *)(v5 + 364) = result;
}
else
{
result = v7 & 0xFF7BFE7F | 0x40080;
*(_DWORD *)(v5 + 364) = result;
}
}
else
{
return png_warning(result, "Application must supply a known background gamma");
}
}
}
}
return result;
}