//
// png_set_filler from 0xbe5298 to 0xbe533c (164 bytes)
//
// 4 xrefs:
// > png_set_add_alpha @ 0xbe5350
// > png_write_png @ 0xbe8ef4
// > png_write_png @ 0xbe8fc4
// > ??> @ 0x45138
//
// 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
//
__int64 __fastcall png_set_filler(__int64 result, __int16 a2, int a3)
{
__int64 v3; // x3
int v4; // w0
const char *v5; // x1
v3 = result;
if ( result )
{
if ( (*(_DWORD *)(result + 356) & 0x8000) != 0 )
{
*(_WORD *)(result + 696) = a2;
goto LABEL_4;
}
if ( *(_BYTE *)(result + 687) )
{
if ( *(_BYTE *)(result + 687) == 2 )
{
*(_BYTE *)(result + 692) = 4;
*(_DWORD *)(result + 364) |= 0x8000u;
v4 = *(_DWORD *)(result + 360);
if ( a3 != 1 )
goto LABEL_5;
goto LABEL_10;
}
v5 = "png_set_filler: inappropriate color type";
}
else
{
if ( *(unsigned __int8 *)(result + 688) > 7u )
{
*(_BYTE *)(result + 692) = 2;
LABEL_4:
*(_DWORD *)(result + 364) |= 0x8000u;
v4 = *(_DWORD *)(result + 360);
if ( a3 != 1 )
{
LABEL_5:
result = v4 & 0xFFFFFF7F;
*(_DWORD *)(v3 + 360) = result;
return result;
}
LABEL_10:
result = v4 | 0x80u;
*(_DWORD *)(v3 + 360) = result;
return result;
}
v5 = "png_set_filler is invalid for low bit depth gray output";
}
return png_app_error(result, v5);
}
return result;
}