//
// png_set_iCCP from 0x870108 to 0x8701f6 (238 bytes)
//
// 0 xrefs:
//
// 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:57 +0000
//
int __fastcall png_set_iCCP(int result, int a2, const char *a3, int a4, unsigned __int8 *a5, unsigned int a6)
{
bool v6; // zf
bool v7; // zf
int v8; // r6
int v11; // r9
size_t v12; // r10
void *v13; // r0
void *v14; // r9
void *v15; // r0
void *v16; // r5
int v17; // r3
int v18; // r2
_DWORD *v19; // r0
const char *v20; // r1
v6 = a2 == 0;
if ( a2 )
v6 = result == 0;
if ( !v6 )
{
v7 = a5 == nullptr;
if ( a5 )
v7 = a3 == nullptr;
if ( !v7 )
{
v8 = result;
if ( a4 )
png_app_error(result, "Invalid iCCP compression method");
v11 = png_colorspace_set_ICC(v8, a2 + 40, (int)a3, a6, a5, *(_BYTE *)(a2 + 25));
result = png_colorspace_sync_info(v8, a2);
if ( v11 )
{
*(_WORD *)(a2 + 114) |= 0x18u;
v12 = strlen(a3) + 1;
v13 = png_malloc_warn(v8, v12);
v14 = v13;
if ( v13 )
{
memcpy(v13, a3, v12);
v15 = png_malloc_warn(v8, a6);
v16 = v15;
if ( v15 )
{
memcpy(v15, a5, a6);
result = png_free_data(v8, a2, 16, 0);
v17 = *(_DWORD *)(a2 + 8);
v18 = *(_DWORD *)(a2 + 232) | 0x10;
*(_DWORD *)(a2 + 124) = a6;
*(_DWORD *)(a2 + 116) = v14;
*(_DWORD *)(a2 + 120) = v16;
*(_DWORD *)(a2 + 232) = v18;
*(_DWORD *)(a2 + 8) = v17 | 0x1000;
return result;
}
png_free(v8, v14);
v19 = (_DWORD *)v8;
v20 = "Insufficient memory to process iCCP profile";
}
else
{
v19 = (_DWORD *)v8;
v20 = "Insufficient memory to process iCCP chunk";
}
return png_benign_error(v19, v20);
}
}
}
return result;
}