//
// cocos2d::cc_utf8_strlen from 0x1800989d0 to 0x180098b12 (322 bytes)
//
// 4 xrefs:
// > ??> @ 0x1801476c8
// > ??> @ 0x180147708
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c0a2c
//
// 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:10 +0000
//
__int64 __fastcall cocos2d::cc_utf8_strlen(cocos2d *this, const char *a2)
{
unsigned __int64 v3; // rbp
const char *v4; // rbx
char *v5; // rsi
size_t v6; // rax
unsigned int v7; // edi
const char *v8; // r10
__int64 v9; // r11
char *v10; // rax
char *Str[3]; // [rsp+30h] [rbp-48h] BYREF
unsigned __int64 v12; // [rsp+48h] [rbp-30h]
if ( !this )
return 0;
sub_180005A10(Str, (char *)this);
v3 = v12;
v4 = (const char *)Str;
v5 = Str[0];
if ( v12 > 0xF )
v4 = Str[0];
v6 = strlen(v4);
v7 = 0;
if ( v6 )
{
v8 = &v4[v6];
if ( v4 != &v4[v6] )
{
while ( byte_18010AA60[*(unsigned __int8 *)v4] + 1 <= v8 - v4 && (unsigned __int8)sub_180099120(v4) )
{
v4 += v9;
++v7;
if ( v4 == v8 )
goto LABEL_12;
}
v7 = 0;
}
}
LABEL_12:
if ( v3 > 0xF )
{
v10 = v5;
if ( v3 + 1 >= 0x1000 )
{
v5 = *((char **)v5 - 1);
if ( (unsigned __int64)(v10 - v5 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v5);
}
return v7;
}