//
// SecretLayer4::selectAThread from 0x1003b43d0 to 0x1003b44bd (237 bytes)
//
// 3 xrefs:
// > SecretLayer4::init @ 0x1003b11ce
// > SecretLayer4::getMessage @ 0x1003b1dc4
// > SecretLayer4::onSubmit @ 0x1003b2688
//
// 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 SecretLayer4::selectAThread(SecretLayer4 *a1)
{
cocos2d::CCArray *v1; // rax
cocos2d::CCArray *v2; // r14
int m_threadTag; // r15d
unsigned int v4; // r15d
__m128 v5; // xmm0
__m128 v6; // xmm1
__int64 v7; // rax
cocos2d::CCObject *v8; // rax
float v9; // [rsp+0h] [rbp-1Ch]
v1 = cocos2d::CCDictionary::allKeys(a1->m_messageThreads);
v2 = v1;
m_threadTag = a1->m_threadTag;
if ( m_threadTag < 0 )
{
v9 = (float)(int)(sub_100720070(v1) - 1);
v5 = 0;
v5.f32[0] = (float)((float)rand() * 4.6566129e-10) * v9;
v6 = _mm_or_ps(_mm_and_ps((__m128)xmmword_1008150B0, v5), (__m128)xmmword_1008150C0);
v6.f32[0] = v6.f32[0] + v5.f32[0];
v4 = (int)_mm_round_ss((__m128)0LL, v6, 11).f32[0];
}
else
{
v4 = m_threadTag + 1;
}
a1->m_threadTag = v4;
if ( v4 >= (unsigned int)sub_100720070(v2) )
a1->m_threadTag = 0;
if ( cocos2d::CCDictionary::count(a1->m_messageThreads) )
{
v7 = sub_1007200C0(v2, (unsigned int)a1->m_threadTag);
v8 = cocos2d::CCDictionary::objectForKey(a1->m_messageThreads, *(int *)(v7 + 56));
a1->m_selectedThread = ((__int64 (__fastcall *)(cocos2d::CCObject *))v8->getTag)(v8);
}
a1->m_threadMessageIndex = 0;
}