//
// cocos2d::CCLabelAtlas::setString from 0xd54c9c to 0xd54e60 (452 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'cocos2d::CCLabelAtlas::setString @ 0xd54e64
// > ??> @ 0x89158
// > ??> @ 0x1517658
//
// 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:07:43 +0000
//
__int64 __fastcall cocos2d::CCLabelAtlas::setString(cocos2d::CCTextureAtlas **this, const char *a2)
{
unsigned int v4; // w22
unsigned __int8 v5; // w23
size_t v6; // x6
__int64 v7; // x3
unsigned __int64 v8; // x1
char *v10; // x3
size_t v11; // x0
_BYTE *v12; // x3
size_t v13; // [xsp+48h] [xbp+48h]
float v14; // [xsp+50h] [xbp+50h] BYREF
v4 = strlen(a2);
if ( (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 47) + 80LL))(*(this + 47)) < v4 )
cocos2d::CCTextureAtlas::resizeCapacity(*(this + 47), v4);
v5 = *(_BYTE *)(this + 52) & 1;
if ( v5 )
{
*(_BYTE *)*(this + 54) = 0;
*(this + 53) = nullptr;
v11 = strlen(a2);
v5 = *((_BYTE *)this + 416);
v6 = v11;
if ( (v5 & 1) != 0 )
{
v8 = ((unsigned __int64)*(this + 52) & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v11 > v8 )
{
v7 = 0;
goto LABEL_6;
}
v10 = (char *)*(this + 54);
if ( !v11 )
{
LABEL_10:
v10[v6] = 0;
if ( (*(_BYTE *)(this + 52) & 1) != 0 )
{
LABEL_11:
*(this + 53) = (cocos2d::CCTextureAtlas *)v6;
goto LABEL_7;
}
LABEL_16:
*((_BYTE *)this + 416) = 2 * v6;
goto LABEL_7;
}
LABEL_15:
v13 = v6;
v12 = memmove(v10, a2, v6);
v6 = v13;
v12[v13] = 0;
if ( (*(_BYTE *)(this + 52) & 1) != 0 )
goto LABEL_11;
goto LABEL_16;
}
if ( v11 > 0x16 )
goto LABEL_5;
LABEL_9:
v10 = (char *)this + 417;
if ( !v6 )
goto LABEL_10;
goto LABEL_15;
}
*((_BYTE *)this + 417) = 0;
*((_BYTE *)this + 416) = 0;
v6 = strlen(a2);
if ( v6 <= 0x16 )
goto LABEL_9;
LABEL_5:
v7 = v5 >> 1;
v8 = 22;
LABEL_6:
std::string::__grow_by_and_replace((__int64)(this + 52), v8, v6 - v8, v7, 0, v7, v6, a2);
LABEL_7:
(*((void (__fastcall **)(cocos2d::CCTextureAtlas **))*this + 132))(this);
cocos2d::CCSize::CCSize(&v14, (float)(*((_DWORD *)this + 90) * v4), (float)*((unsigned int *)this + 91));
(*((void (__fastcall **)(cocos2d::CCTextureAtlas **, float *))*this + 40))(this, &v14);
*((_DWORD *)this + 99) = v4;
return _stack_chk_guard;
}