//
// png_set_longjmp_fn from 0xe43520 to 0xe435e4 (196 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0xd7cef8
// > cocos2d::CCImage::_saveImageToPNG @ 0xd7d8a8
// > ??> @ 0x8b1b0
//
// 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:04 +0000
//
_QWORD *__fastcall png_set_longjmp_fn(_QWORD *a1, __int64 a2, unsigned __int64 a3)
{
_QWORD *v5; // x1
__int64 v7; // x3
__int64 v9; // x0
if ( !a1 )
return nullptr;
v5 = (_QWORD *)a1[33];
if ( !v5 )
{
a1[34] = 0;
if ( a3 > 0x100 )
{
v9 = png_malloc_warn(a1, a3);
a1[33] = v9;
if ( !v9 )
return nullptr;
a1[34] = a3;
v5 = (_QWORD *)v9;
}
else
{
v5 = a1;
a1[33] = a1;
}
LABEL_6:
a1[32] = a2;
return v5;
}
v7 = a1[34];
if ( !v7 )
{
v7 = 256;
if ( v5 != a1 )
png_error((__int64)a1, "Libpng jmp_buf still allocated");
}
if ( v7 == a3 )
goto LABEL_6;
png_warning((__int64)a1, "Application jmp_buf size changed");
return nullptr;
}