//
// cocos2d::CCProfiler::createAndAddTimerWithName from 0x1004ec120 to 0x1004ec244 (292 bytes)
//
// 1 xrefs:
// > cocos2d::CCProfilingBeginTimingBlock @ 0x1004ec77f
//
// 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
//
cocos2d::CCProfilingTimer *__fastcall cocos2d::CCProfiler::createAndAddTimerWithName(
cocos2d::CCProfiler *a1,
const char *a2)
{
char *v2; // rbx
cocos2d::CCProfiler_vtbl *v3; // r15
size_t v4; // rax
size_t v5; // r12
char *v6; // r13
size_t v7; // r15
cocos2d::CCProfiler_vtbl *v9; // [rsp+8h] [rbp-48h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v2 = (char *)operator new(0x80u);
cocos2d::CCObject::CCObject((__int64)v2);
*(_QWORD *)v2 = off_100957EE0;
*((_QWORD *)v2 + 12) = 0;
*(_OWORD *)(v2 + 56) = 0;
*(_OWORD *)(v2 + 72) = 0;
*((_DWORD *)v2 + 22) = 0;
*((_QWORD *)v2 + 13) = 100000000;
std::string::assign((std::string *)(v2 + 56), a2);
v3 = a1[1].__vftable;
v4 = strlen(a2);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v5 = v4;
if ( v4 >= 0x17 )
{
v9 = a1[1].__vftable;
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
__p = v6;
__dst[0] = v7 + 1;
v3 = v9;
__dst[1] = v5;
goto LABEL_8;
}
LOBYTE(__dst[0]) = 2 * v4;
v6 = (char *)__dst + 1;
if ( v4 )
LABEL_8:
memcpy(v6, a2, v5);
v6[v5] = 0;
cocos2d::CCDictionary::setObject_1((__int64)v3, (cocos2d::CCObject *)v2, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
cocos2d::CCObject::release((cocos2d::CCObject *)v2);
return (cocos2d::CCProfilingTimer *)v2;
}