//
// sub_100221554 from 0x100221554 to 0x100221674 (288 bytes)
//
// 4 xrefs:
// > sub_100220E68 @ 0x100221248
// > sub_10022172C @ 0x10022178c
// > GJColorSetupLayer::colorSelectClosed @ 0x100221824
// > sub_100221828 @ 0x10022182c
//
// 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 11:01:08 +0000
//
__int64 __fastcall sub_100221554(__int64 a1)
{
int v2; // w21
int v3; // w22
__int64 result; // x0
__int64 v5; // x20
int v6; // w23
__int64 v7; // x21
__int64 v8; // x22
__int64 v9; // x0
v2 = *(_DWORD *)(a1 + 720);
v3 = *(_DWORD *)(a1 + 724);
result = sub_1002E757C(*(_QWORD *)(a1 + 712));
if ( (_DWORD)result )
{
v5 = 0;
v6 = v3 * v2;
do
{
v7 = sub_1002E75A0(*(_QWORD *)(a1 + 712), v5);
v8 = sub_1002E75A0(*(_QWORD *)(a1 + 704), v5);
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 512LL))(v7);
if ( v6 + (int)v5 > 998 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v9 + 1056LL))(v9, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 344LL))(v7, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v8 + 344LL))(v8, 0);
}
else
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 1056LL))(v9, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 344LL))(v7, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 344LL))(v8, 1);
sub_100221790(a1, v7, v8, (unsigned int)(v6 + v5 + 1));
}
v5 = (unsigned int)(v5 + 1);
result = sub_1002E757C(*(_QWORD *)(a1 + 712));
}
while ( (unsigned int)v5 < (unsigned int)result );
}
return result;
}