//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0x10033ff40 to 0x100340098 (344 bytes)
//
// 2 xrefs:
// > ??> @ 0x100b1e080
// > ??> @ 0x100b52768
//
// 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 12:28:43 +0000
//
__int64 __fastcall cocos2d::extension::CCControlButton::setBackgroundSpriteForState(
float *a1,
__int64 a2,
unsigned int a3)
{
float *v4; // r12
__int64 v5; // rax
__int64 result; // rax
__int64 v7; // [rsp+8h] [rbp-38h] BYREF
_QWORD v8[6]; // [rsp+10h] [rbp-30h] BYREF
v4 = a1 + 126;
sub_100278630(v8, (_QWORD *)a1 + 63);
v5 = cocos2d::CCDictionary::objectForKey_1(*((_QWORD *)a1 + 69), a3);
if ( v5 )
{
(*(void (__fastcall **)(float *, __int64, __int64))(*(_QWORD *)a1 + 552LL))(a1, v5, 1);
cocos2d::CCDictionary::removeObjectForKey_1(*((_QWORD *)a1 + 69), a3);
}
cocos2d::CCDictionary::setObject_1(*((_QWORD *)a1 + 69), a2, a3);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
sub_100278250((float *)&v7, 0.5, 0.5);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)a2 + 296LL))(a2, &v7);
result = (*(__int64 (__fastcall **)(float *, __int64))(*(_QWORD *)a1 + 456LL))(a1, a2);
if ( a1[126] != 0.0 || a1[127] != 0.0 )
{
if ( sub_100278730((float *)v8, v4) )
{
sub_100278260((float *)&v7, *(float *)v8 + 1.0, *((float *)v8 + 1) + 1.0);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)a2 + 1016LL))(a2, &v7);
}
sub_100278630(&v7, v4);
result = (*(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)a2 + 1016LL))(a2, &v7);
}
if ( *((_DWORD *)a1 + 107) == a3 )
return (*(__int64 (__fastcall **)(float *))(*(_QWORD *)a1 + 1312LL))(a1);
return result;
}