//
// cocos2d::CCLabelBMFont::kerningAmountForFirst from 0x180048d40 to 0x180048e55 (277 bytes)
//
// 2 xrefs:
// > cocos2d::CCLabelBMFont::createFontChars @ 0x1800480e6
// > ??> @ 0x1801438a8
//
// 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::CCLabelBMFont::kerningAmountForFirst(
cocos2d::CCLabelBMFont *this,
unsigned __int16 a2,
unsigned __int16 a3)
{
int v3; // r9d
cocos2d::tCCKerningHashElement *m_pKerningDictionary; // r11
UT_hash_table *tbl; // r10
unsigned int v6; // edx
unsigned int v7; // r8d
unsigned int v8; // ecx
int v9; // edx
unsigned int v10; // r8d
unsigned int v11; // ecx
int v12; // edx
UT_hash_handle *hh_head; // rax
std::ptrdiff_t hho; // rdx
__int64 v15; // rax
__int64 v16; // rax
v3 = a3 | (a2 << 16);
m_pKerningDictionary = this->m_pConfiguration->m_pKerningDictionary;
if ( !m_pKerningDictionary )
return 0;
tbl = m_pKerningDictionary->hh.tbl;
v6 = ((v3 & 0xFF000000) + ((BYTE1(v3) + ((unsigned __int8)a2 << 8)) << 8) + (unsigned __int8)v3 + 17973517) ^ 0x7F76D;
v7 = (v6 << 8) ^ (-1622558010 - v6);
v8 = (v7 >> 13) ^ (-17973517 - v7 - v6);
v9 = (v8 >> 12) ^ (v6 - v7 - v8);
v10 = (v9 << 16) ^ (v7 - v9 - v8);
v11 = (v10 >> 5) ^ (v8 - v10 - v9);
v12 = (v11 >> 3) ^ (v9 - v10 - v11);
hh_head = tbl->buckets[(tbl->num_buckets - 1)
& (((unsigned __int64)((v12 << 10) ^ (v10 - v12 - v11)) >> 15)
^ (v11 - ((v12 << 10) ^ (v10 - v12 - v11)) - v12))].hh_head;
if ( !hh_head )
return 0;
hho = tbl->hho;
v15 = (__int64)hh_head - hho;
if ( !v15 )
return 0;
while ( *(_DWORD *)(v15 + 56) != 4 || **(_DWORD **)(v15 + 48) != v3 )
{
v16 = *(_QWORD *)(v15 + 40);
if ( v16 )
{
v15 = v16 - hho;
if ( v15 )
continue;
}
return 0;
}
return *(unsigned int *)(v15 + 4);
}