//
// sub_10001237C from 0x10001237c to 0x100012d54 (2520 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::controlTriggersInGroup @ 0x100289a64
// > sub_1004030CC @ 0x10040318c
//
// 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:17 +0000
//
void __fastcall sub_10001237C(_QWORD *a1, _DWORD *a2, int a3, double a4, double a5)
{
int v5; // w23
int v8; // w8
char *v9; // x8
char *v10; // x21
__int64 v11; // x9
int v12; // w22
char *v13; // x10
char *v14; // x27
char *v15; // x28
char *v16; // x8
_OWORD *v17; // x26
char v18; // w9
void *v19; // x0
char *v20; // x21
char *v21; // x8
__int64 v22; // x9
int v23; // w22
char *v24; // x10
char *v25; // x27
char *v26; // x28
__int128 v27; // q1
char *v28; // x8
_OWORD *v29; // x26
char v30; // w9
void *v31; // x0
_QWORD *v32; // x20
char *v33; // x8
char *v34; // x24
__int64 v35; // x9
int v36; // w25
char *v37; // x10
char *v38; // x27
char *v39; // x28
char *v40; // x8
_OWORD *v41; // x26
char v42; // w9
void *v43; // x0
_WORD *v44; // x0
__int64 v45; // x8
__int64 k; // x9
__int64 *i; // x8
__int64 v48; // x8
__int64 v49; // x9
__int64 v50; // x10
int v51; // w24
__int64 v52; // x11
__int64 v53; // x21
__int64 v54; // x22
char v55; // w10
_QWORD *v56; // x22
__int64 v57; // x8
__int64 v58; // x9
__int64 v59; // x10
int v60; // w26
__int64 v61; // x11
__int64 v62; // x20
__int64 v63; // x21
char v64; // w10
__int64 v65; // x21
__int64 v66; // x8
__int64 v67; // x9
int v68; // w22
__int64 v69; // x10
__int64 v70; // x27
__int64 v71; // x28
__int64 v72; // x8
__int64 v73; // x26
char v74; // w9
void *v75; // x0
__int64 j; // x1
char v77; // w8
char *v78; // x21
char *v79; // x8
__int64 v80; // x9
int v81; // w22
char *v82; // x10
char *v83; // x27
char *v84; // x28
__int128 v85; // q1
char *v86; // x8
_OWORD *v87; // x26
char v88; // w9
void *v89; // x0
_QWORD *v90; // x20
__int64 v91; // x8
__int64 v92; // x21
__int64 v93; // x9
int v94; // w22
__int64 v95; // x24
__int64 v96; // x26
__int128 v97; // q1
__int64 v98; // x8
__int64 v99; // x25
char v100; // w9
void *v101; // x0
v5 = a2[229];
if ( v5 < 1 )
return;
v8 = a2[257];
if ( v8 <= 1345 )
{
if ( v8 <= 900 )
{
if ( v8 > 743 )
{
if ( (unsigned int)(v8 - 899) >= 2 && v8 != 744 )
return;
}
else if ( (unsigned int)(v8 - 29) >= 2 && v8 != 105 )
{
return;
}
goto LABEL_99;
}
if ( v8 <= 1005 )
{
if ( v8 == 901 )
goto LABEL_104;
if ( v8 != 915 )
return;
LABEL_99:
v44 = sub_10000F52C((__int64)a1, a2[256], a4, a5);
if ( *((_DWORD *)v44 + 32) == v5 )
{
switch ( a3 )
{
case 2:
*((_BYTE *)v44 + 57) = 0;
break;
case 1:
*((_BYTE *)v44 + 57) = 1;
break;
case 0:
*((_BYTE *)v44 + 56) = 1;
break;
}
}
return;
}
if ( v8 != 1006 )
{
if ( v8 == 1007 )
{
for ( i = (__int64 *)a1[53]; i; i = (__int64 *)*i )
{
if ( *((_DWORD *)i + 12) == v5 )
{
switch ( a3 )
{
case 2:
*((_BYTE *)i + 33) = 0;
break;
case 1:
*((_BYTE *)i + 33) = 1;
break;
case 0:
*((_BYTE *)i + 32) = 1;
break;
}
}
}
return;
}
if ( v8 != 1268 )
return;
v20 = (char *)a1[143];
v21 = (char *)a1[142];
if ( v20 == v21 )
return;
v22 = 0;
v23 = 0;
while ( 1 )
{
v24 = &v21[72 * v22];
if ( *((_DWORD *)v24 + 7) == v5 )
{
switch ( a3 )
{
case 2:
v30 = 0;
goto LABEL_53;
case 1:
v30 = 1;
LABEL_53:
v24[1] = v30;
break;
case 0:
v25 = &v21[72 * v22];
if ( v25 + 72 == v20 )
{
v29 = v20;
v20 = &v21[72 * v22];
}
else
{
do
{
v26 = v25 + 72;
v27 = *(_OWORD *)(v25 + 88);
*(_OWORD *)v25 = *(_OWORD *)(v25 + 72);
*((_OWORD *)v25 + 1) = v27;
*((_OWORD *)v25 + 2) = *(_OWORD *)(v25 + 104);
sub_10001817C(v25 + 48, v25 + 120);
v28 = v25 + 144;
v25 += 72;
}
while ( v28 != v20 );
v29 = (_OWORD *)a1[143];
v20 = v26;
}
while ( v29 != (_OWORD *)v20 )
{
v31 = *((void **)v29 - 3);
if ( v31 )
{
*((_QWORD *)v29 - 2) = v31;
operator delete(v31);
}
v29 = (_OWORD *)((char *)v29 - 72);
}
a1[143] = v20;
v21 = (char *)a1[142];
goto LABEL_55;
}
}
++v23;
LABEL_55:
v22 = v23;
if ( 0x8E38E38E38E38E39LL * ((v20 - v21) >> 3) <= v23 )
return;
}
}
v48 = a1[43];
v49 = a1[44];
if ( v49 != v48 )
{
v50 = 0;
v51 = 0;
do
{
v52 = v48 + 72 * v50;
if ( *(_DWORD *)(v52 + 60) == v5 )
{
switch ( a3 )
{
case 2:
v55 = 0;
goto LABEL_135;
case 1:
v55 = 1;
LABEL_135:
*(_BYTE *)v52 = v55;
break;
case 0:
v53 = v48 + 72 * v50;
v54 = v49 - (v53 + 72);
if ( v49 != v53 + 72 )
{
memmove((void *)(v48 + 72 * v50), (const void *)(v53 + 72), v49 - (v53 + 72));
v48 = a1[43];
}
v49 = v53 + v54;
a1[44] = v53 + v54;
goto LABEL_137;
}
}
++v51;
LABEL_137:
v50 = v51;
}
while ( 0x8E38E38E38E38E39LL * ((v49 - v48) >> 3) > v51 );
}
v56 = (_QWORD *)a1[48];
if ( !v56 )
return;
while ( 1 )
{
v57 = v56[3];
v58 = v56[4];
if ( v58 != v57 )
break;
LABEL_153:
v56 = (_QWORD *)*v56;
if ( !v56 )
return;
}
v59 = 0;
v60 = 0;
while ( 1 )
{
v61 = v57 + 72 * v59;
if ( *(_DWORD *)(v61 + 60) == v5 )
{
switch ( a3 )
{
case 2:
v64 = 0;
goto LABEL_150;
case 1:
v64 = 1;
LABEL_150:
*(_BYTE *)v61 = v64;
break;
case 0:
v62 = v57 + 72 * v59;
v63 = v58 - (v62 + 72);
if ( v58 != v62 + 72 )
{
memmove((void *)(v57 + 72 * v59), (const void *)(v62 + 72), v58 - (v62 + 72));
v57 = v56[3];
}
v58 = v62 + v63;
v56[4] = v62 + v63;
goto LABEL_152;
}
}
++v60;
LABEL_152:
v59 = v60;
if ( 0x8E38E38E38E38E39LL * ((v58 - v57) >> 3) <= v60 )
goto LABEL_153;
}
}
if ( v8 > 1814 )
{
if ( v8 <= 3032 )
{
if ( v8 != 1815 )
{
if ( v8 != 2067 && v8 != 3016 )
return;
goto LABEL_104;
}
v78 = (char *)a1[65];
v79 = (char *)a1[64];
if ( v78 == v79 )
return;
v80 = 0;
v81 = 0;
while ( 1 )
{
v82 = &v79[56 * v80];
if ( *((_DWORD *)v82 + 6) == v5 )
{
switch ( a3 )
{
case 2:
v88 = 0;
goto LABEL_198;
case 1:
v88 = 1;
LABEL_198:
*v82 = v88;
break;
case 0:
v83 = &v79[56 * v80];
if ( v83 + 56 == v78 )
{
v87 = v78;
v78 = &v79[56 * v80];
}
else
{
do
{
v84 = v83 + 56;
v85 = *(_OWORD *)(v83 + 72);
*(_OWORD *)v83 = *(_OWORD *)(v83 + 56);
*((_OWORD *)v83 + 1) = v85;
sub_10001817C(v83 + 32, v83 + 88);
v86 = v83 + 112;
v83 += 56;
}
while ( v86 != v78 );
v87 = (_OWORD *)a1[65];
v78 = v84;
}
while ( v87 != (_OWORD *)v78 )
{
v89 = *((void **)v87 - 3);
if ( v89 )
{
*((_QWORD *)v87 - 2) = v89;
operator delete(v89);
}
v87 = (_OWORD *)((char *)v87 - 56);
}
a1[65] = v78;
v79 = (char *)a1[64];
goto LABEL_200;
}
}
++v81;
LABEL_200:
v80 = v81;
if ( 0x6DB6DB6DB6DB6DB7LL * ((v78 - v79) >> 3) <= (unsigned __int64)v81 )
return;
}
}
if ( v8 != 3033 )
{
if ( v8 != 3614 )
{
if ( v8 != 3615 )
return;
v32 = (_QWORD *)a1[122];
if ( !v32 )
return;
while ( 1 )
{
v33 = (char *)v32[3];
v34 = (char *)v32[4];
if ( v34 != v33 )
break;
LABEL_92:
v32 = (_QWORD *)*v32;
if ( !v32 )
return;
}
v35 = 0;
v36 = 0;
while ( 1 )
{
v37 = &v33[56 * v35];
if ( *((_DWORD *)v37 + 4) == v5 )
{
switch ( a3 )
{
case 2:
v42 = 0;
goto LABEL_82;
case 1:
v42 = 1;
LABEL_82:
*v37 = v42;
break;
case 0:
v38 = &v33[56 * v35];
if ( v38 + 56 == v34 )
{
v41 = v34;
v34 = &v33[56 * v35];
}
else
{
do
{
v39 = v38 + 56;
*(_OWORD *)v38 = *(_OWORD *)(v38 + 56);
*(_OWORD *)(v38 + 13) = *(_OWORD *)(v38 + 69);
sub_10001817C(v38 + 32, v38 + 88);
v40 = v38 + 112;
v38 += 56;
}
while ( v40 != v34 );
v41 = (_OWORD *)v32[4];
v34 = v39;
}
while ( v41 != (_OWORD *)v34 )
{
v43 = *((void **)v41 - 3);
if ( v43 )
{
*((_QWORD *)v41 - 2) = v43;
operator delete(v43);
}
v41 = (_OWORD *)((char *)v41 - 56);
}
v32[4] = v34;
v33 = (char *)v32[3];
goto LABEL_84;
}
}
++v36;
LABEL_84:
v35 = v36;
if ( 0x6DB6DB6DB6DB6DB7LL * ((v34 - v33) >> 3) <= (unsigned __int64)v36 )
goto LABEL_92;
}
}
for ( j = a1[117]; ; j = sub_10001931C(a1 + 115, j) )
{
while ( 1 )
{
if ( !j )
return;
if ( *(_DWORD *)(j + 72) == v5 )
break;
LABEL_186:
j = *(_QWORD *)j;
}
if ( a3 == 2 )
break;
if ( a3 == 1 )
{
v77 = 1;
LABEL_185:
*(_BYTE *)(j + 104) = v77;
goto LABEL_186;
}
if ( a3 )
goto LABEL_186;
}
v77 = 0;
goto LABEL_185;
}
LABEL_104:
v45 = a1[154];
for ( k = a1[155]; v45 != k; v45 += 520 )
{
if ( *(_DWORD *)(v45 + 344) == v5 )
{
switch ( a3 )
{
case 2:
*(_BYTE *)(v45 + 113) = 0;
break;
case 1:
*(_BYTE *)(v45 + 113) = 1;
break;
case 0:
*(_BYTE *)(v45 + 114) = 1;
break;
}
}
}
return;
}
if ( v8 > 1610 )
{
if ( v8 != 1611 )
{
if ( v8 != 1812 )
{
if ( v8 != 1814 )
return;
goto LABEL_104;
}
v65 = a1[68];
v66 = a1[67];
if ( v65 == v66 )
return;
v67 = 0;
v68 = 0;
while ( 1 )
{
v69 = v66 + 48 * v67;
if ( *(_DWORD *)(v69 + 12) == v5 )
{
switch ( a3 )
{
case 2:
v74 = 0;
goto LABEL_166;
case 1:
v74 = 1;
LABEL_166:
*(_BYTE *)v69 = v74;
break;
case 0:
v70 = v66 + 48 * v67;
if ( v70 + 48 == v65 )
{
v73 = v65;
v65 = v66 + 48 * v67;
}
else
{
do
{
v71 = v70 + 48;
*(_OWORD *)v70 = *(_OWORD *)(v70 + 48);
*(_DWORD *)(v70 + 16) = *(_DWORD *)(v70 + 64);
sub_10001817C(v70 + 24, v70 + 72);
v72 = v70 + 96;
v70 += 48;
}
while ( v72 != v65 );
v73 = a1[68];
v65 = v71;
}
while ( v73 != v65 )
{
v75 = *(void **)(v73 - 24);
if ( v75 )
{
*(_QWORD *)(v73 - 16) = v75;
operator delete(v75);
}
v73 -= 48;
}
a1[68] = v65;
v66 = a1[67];
goto LABEL_168;
}
}
++v68;
LABEL_168:
v67 = v68;
if ( 0xAAAAAAAAAAAAAAABLL * ((v65 - v66) >> 4) <= v68 )
return;
}
}
v90 = (_QWORD *)a1[61];
if ( !v90 )
return;
while ( 1 )
{
v91 = v90[3];
v92 = v90[4];
if ( v92 != v91 )
break;
LABEL_230:
v90 = (_QWORD *)*v90;
if ( !v90 )
return;
}
v93 = 0;
v94 = 0;
while ( 1 )
{
v95 = v91 + (v93 << 6);
if ( *(_DWORD *)(v95 + 20) == v5 )
{
switch ( a3 )
{
case 2:
v100 = 0;
goto LABEL_220;
case 1:
v100 = 1;
LABEL_220:
*(_BYTE *)v95 = v100;
break;
case 0:
if ( v95 + 64 == v92 )
{
v99 = v92;
v92 = v91 + (v93 << 6);
}
else
{
do
{
v96 = v95 + 64;
v97 = *(_OWORD *)(v95 + 80);
*(_OWORD *)v95 = *(_OWORD *)(v95 + 64);
*(_OWORD *)(v95 + 16) = v97;
*(_BYTE *)(v95 + 32) = *(_BYTE *)(v95 + 96);
sub_10001817C(v95 + 40, v95 + 104);
v98 = v95 + 128;
v95 += 64;
}
while ( v98 != v92 );
v99 = v90[4];
v92 = v96;
}
while ( v99 != v92 )
{
v101 = *(void **)(v99 - 24);
if ( v101 )
{
*(_QWORD *)(v99 - 16) = v101;
operator delete(v101);
}
v99 -= 64;
}
v90[4] = v92;
v91 = v90[3];
goto LABEL_222;
}
}
++v94;
LABEL_222:
v93 = v94;
if ( v94 >= (unsigned __int64)((v92 - v91) >> 6) )
goto LABEL_230;
}
}
if ( (unsigned int)(v8 - 1346) < 2 )
goto LABEL_104;
if ( v8 == 1595 )
{
v9 = (char *)a1[56];
v10 = (char *)a1[57];
if ( v10 != v9 )
{
v11 = 0;
v12 = 0;
do
{
v13 = &v9[56 * v11];
if ( *((_DWORD *)v13 + 5) == v5 )
{
switch ( a3 )
{
case 2:
v18 = 0;
goto LABEL_18;
case 1:
v18 = 1;
LABEL_18:
*v13 = v18;
break;
case 0:
v14 = &v9[56 * v11];
if ( v14 + 56 == v10 )
{
v17 = v10;
v10 = &v9[56 * v11];
}
else
{
do
{
v15 = v14 + 56;
*(_OWORD *)v14 = *(_OWORD *)(v14 + 56);
*(_OWORD *)(v14 + 13) = *(_OWORD *)(v14 + 69);
sub_10001817C(v14 + 32, v14 + 88);
v16 = v14 + 112;
v14 += 56;
}
while ( v16 != v10 );
v17 = (_OWORD *)a1[57];
v10 = v15;
}
while ( v17 != (_OWORD *)v10 )
{
v19 = *((void **)v17 - 3);
if ( v19 )
{
*((_QWORD *)v17 - 2) = v19;
operator delete(v19);
}
v17 = (_OWORD *)((char *)v17 - 56);
}
a1[57] = v10;
v9 = (char *)a1[56];
goto LABEL_20;
}
}
++v12;
LABEL_20:
v11 = v12;
}
while ( 0x6DB6DB6DB6DB6DB7LL * ((v10 - v9) >> 3) > (unsigned __int64)v12 );
}
}
}