//
// png_set_IHDR from 0xe59b54 to 0xe59c4c (248 bytes)
//
// 5 xrefs:
// > cocos2d::CCImage::_saveImageToPNG @ 0xd7d90c
// > png_handle_IHDR @ 0xe55464
// > sub_E5EAE4 @ 0xe5ebcc
// > sub_E5EAE4 @ 0xe5ed3c
// > ??> @ 0x68698
//
// 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:20 +0000
//
unsigned __int64 __fastcall png_set_IHDR(
unsigned __int64 result,
__int64 a2,
unsigned int a3,
int a4,
unsigned __int8 a5,
unsigned __int8 a6,
unsigned __int8 a7,
unsigned __int8 a8,
unsigned __int8 a9)
{
int v11; // w0
char v12; // w1
char v13; // w2
unsigned __int8 v14; // w1
if ( result && a2 )
{
*(_DWORD *)a2 = a3;
*(_DWORD *)(a2 + 4) = a4;
*(_BYTE *)(a2 + 36) = a5;
*(_BYTE *)(a2 + 37) = a6;
*(_BYTE *)(a2 + 38) = a8;
*(_BYTE *)(a2 + 39) = a9;
*(_BYTE *)(a2 + 40) = a7;
png_check_IHDR((unsigned int *)result, a3, a4, a5, a6, a7, a8, a9);
v11 = *(unsigned __int8 *)(a2 + 37);
if ( v11 == 3 )
{
v12 = 1;
*(_BYTE *)(a2 + 41) = 1;
}
else
{
if ( (v11 & 2) != 0 )
{
v12 = 4;
*(_BYTE *)(a2 + 41) = 3;
v13 = 3;
}
else
{
v12 = 2;
*(_BYTE *)(a2 + 41) = 1;
v13 = 1;
}
if ( (v11 & 4) != 0 )
*(_BYTE *)(a2 + 41) = v12;
else
v12 = v13;
}
v14 = v12 * *(_BYTE *)(a2 + 36);
*(_BYTE *)(a2 + 42) = v14;
if ( v14 <= 7u )
result = (a3 * (unsigned __int64)v14 + 7) >> 3;
else
result = a3 * (unsigned __int64)(v14 >> 3);
*(_QWORD *)(a2 + 16) = result;
}
return result;
}