//
// cocos2d::cc_utf8_strlen from 0x180095110 to 0x180095255 (325 bytes)
//
// 4 xrefs:
// > ??> @ 0x18013e440
// > ??> @ 0x18013e450
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b67b0
//
// 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
//
__int64 __fastcall cocos2d::cc_utf8_strlen(cocos2d *this, const char *a2)
{
unsigned __int64 v3; // r14
void **v4; // r10
char *v5; // rbp
__int64 v6; // rax
unsigned int v7; // ebx
unsigned int v8; // r11d
void **v9; // rsi
signed __int64 v10; // rdi
__int64 v11; // r10
int v12; // r11d
char *v13; // rax
void *Block[3]; // [rsp+20h] [rbp-48h] BYREF
unsigned __int64 v15; // [rsp+38h] [rbp-30h]
if ( !this )
return 0;
sub_180005910(Block, this);
v3 = v15;
v4 = Block;
v5 = (char *)Block[0];
v6 = -1;
if ( v15 > 0xF )
v4 = (void **)Block[0];
do
++v6;
while ( *((_BYTE *)v4 + v6) );
v7 = 0;
if ( v6 )
{
v8 = 0;
v9 = (void **)((char *)v4 + v6);
if ( v4 == (void **)((char *)v4 + v6) )
{
LABEL_11:
v7 = v8;
}
else
{
while ( 1 )
{
v10 = byte_1801043C0[*(unsigned __int8 *)v4] + 1;
if ( v10 > (char *)v9 - (char *)v4 || !(unsigned __int8)sub_1800957E0(v4) )
break;
v4 = (void **)(v10 + v11);
v8 = v12 + 1;
if ( v4 == v9 )
goto LABEL_11;
}
}
}
if ( v3 > 0xF )
{
v13 = v5;
if ( v3 + 1 >= 0x1000 )
{
v5 = *((char **)v5 - 1);
if ( (unsigned __int64)(v13 - v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v5);
}
return v7;
}