//
// sub_100040DF8 from 0x100040df8 to 0x100040e8c (148 bytes)
//
// 1 xrefs:
// > SetGroupIDLayer::init @ 0x10003f3cc
//
// This function is hookable on this platform (idp: arm, 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 10:57:36 +0000
//
__int64 __fastcall sub_100040DF8(__int64 a1)
{
__int64 result; // x0
__int64 v3; // x0
__int64 v4; // x0
__int64 v5; // x0
result = *(_QWORD *)(a1 + 672);
if ( result )
{
v3 = sub_1002FA758(result, *(unsigned int *)(a1 + 764));
if ( (v3 & 1) == 0 )
{
v3 = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 672) + 1600LL))(
*(_QWORD *)(a1 + 672),
*(unsigned int *)(a1 + 764));
if ( !(_DWORD)v3 )
return SetGroupIDLayer::updateGroupIDButtons(a1);
if ( (_DWORD)v3 == 1 )
{
v4 = GameManager::sharedState(v3);
v3 = (*(__int64 (__fastcall **)(_QWORD, _QWORD, _QWORD, _QWORD))(**(_QWORD **)(v4 + 552) + 1352LL))(
*(_QWORD *)(v4 + 552),
*(_QWORD *)(a1 + 672),
*(unsigned int *)(a1 + 764),
0);
}
}
v5 = GameManager::sharedState(v3);
GJBaseGameLayer::promoteGroupParent(*(_QWORD *)(v5 + 552), *(_QWORD *)(a1 + 672), *(unsigned int *)(a1 + 764));
return SetGroupIDLayer::updateGroupIDButtons(a1);
}
return result;
}