//
// cocos2d::CCProfilingBeginTimingBlock from 0x1004ec650 to 0x1004ec7a9 (345 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::CCProfilingBeginTimingBlock(const char *a1)
{
double v1; // xmm0_8
const char *v2; // rbx
cocos2d::CCProfiler *v3; // r14
_OWORD *v4; // r14
void *v5; // r15
__int64 v6; // r15
size_t v7; // rax
size_t v8; // r12
char *v9; // r13
size_t v10; // rbx
__int64 v11; // rax
const char *v12; // r15
__int64 v13; // rbx
cocos2d::CCProfiler_vtbl *v14; // [rsp+8h] [rbp-48h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v2 = a1;
v3 = (cocos2d::CCProfiler *)qword_1009A21F0;
if ( !qword_1009A21F0 )
{
v4 = operator new(0x40u);
v1 = 0.0;
*v4 = 0;
v4[1] = 0;
v4[2] = 0;
v4[3] = 0;
cocos2d::CCObject::CCObject((__int64)v4);
*(_QWORD *)v4 = off_100957E80;
qword_1009A21F0 = (__int64)v4;
v5 = operator new(0x48u);
cocos2d::CCDictionary::CCDictionary((__int64)v5);
*((_QWORD *)v4 + 7) = v5;
v3 = (cocos2d::CCProfiler *)qword_1009A21F0;
}
v6 = (__int64)v3[1].__vftable;
v7 = strlen(a1);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v8 = v7;
if ( v7 >= 0x17 )
{
v14 = v3[1].__vftable;
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst[0] = v10 + 1;
v2 = a1;
v6 = (__int64)v14;
__dst[1] = v8;
goto LABEL_10;
}
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( v7 )
LABEL_10:
memcpy(v9, v2, v8);
v9[v8] = 0;
v11 = cocos2d::CCDictionary::objectForKey_1(v6, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
{
v12 = v2;
v13 = v11;
operator delete(__p);
v11 = v13;
v2 = v12;
}
if ( !v11 )
v11 = (__int64)cocos2d::CCProfiler::createAndAddTimerWithName(v3, v2);
++*(_DWORD *)(v11 + 80);
gettimeofday((timeval *)(v11 + 112), nullptr);
}