//
// sub_18007F840 from 0x18007f840 to 0x18007f89d (93 bytes)
//
// 1 xrefs:
// > cocos2d::CCImage::_initWithTiffData @ 0x18007ec31
//
// This function is hookable on this platform (idp: pc, 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 11:22:01 +0000
//
__int64 __fastcall sub_18007F840(__int64 a1, unsigned __int64 a2, int a3)
{
unsigned __int64 v3; // rax
__int64 v5; // r8
_DWORD *v6; // rcx
int v7; // edx
_DWORD *v8; // rcx
v3 = *(int *)(a1 + 8);
if ( !a3 )
{
if ( a2 < v3 )
{
*(_DWORD *)(a1 + 12) = a2;
return (int)a2;
}
return -1;
}
if ( a3 == 1 )
{
v5 = *(int *)(a1 + 12);
v6 = (_DWORD *)(a1 + 12);
if ( a2 + v5 < v3 )
{
v7 = v5 + a2;
*v6 = v7;
return v7;
}
return -1;
}
if ( a2 >= v3 )
return -1;
v8 = (_DWORD *)(a1 + 12);
if ( a3 == 2 )
LODWORD(a2) = v3 - a2 - 1;
*v8 = a2;
return (int)a2;
}