//
// sub_769952 from 0x769952 to 0x769c1e (716 bytes)
//
// 3 xrefs:
// > sub_769952 @ 0x769bc6
// > sub_769952 @ 0x769bfc
// > DeathMarkerLayer::init @ 0x76d20a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:10 +0000
//
int __fastcall sub_769952(int result, int *a2, _DWORD *a3)
{
int *v3; // r4
int v6; // r3
int v7; // r8
int v8; // r7
int *v9; // r8
int *v10; // r9
int *v11; // r7
int *v12; // r11
int v13; // r10
int v14; // t1
int v15; // r2
int *v16; // r7
int *v17; // r8
int v18; // r0
int v19; // r9
int v20; // r10
int v21; // r11
int *v22; // r3
int v23; // r10
int *v24; // r8
int *v25; // r11
int *v26; // r8
int v27; // t1
int v28; // r3
int v29; // r11
int v30; // r9
int v31; // r10
int v32; // t1
_BOOL4 v33; // r0
int *v34; // r9
int *i; // r11
int v36; // t1
int v37; // r11
int v38; // r7
_BOOL4 v39; // r8
int *v40; // [sp+Ch] [bp-10h]
int v41; // [sp+Ch] [bp-10h]
int v42; // [sp+10h] [bp-Ch]
int v43; // [sp+10h] [bp-Ch]
int *v44; // [sp+14h] [bp-8h]
int v45; // [sp+14h] [bp-8h]
v3 = (int *)result;
LABEL_2:
while ( 2 )
{
v6 = a2 - v3;
switch ( v6 )
{
case 0:
case 1:
return result;
case 2:
v7 = *(a2 - 1);
v8 = *v3;
result = sub_769132(a3, v7, *v3);
if ( result )
{
*v3 = v7;
*(a2 - 1) = v8;
}
return result;
case 3:
return sub_7696C6(v3, v3 + 1, a2 - 1, a3);
case 4:
return sub_769752(v3, v3 + 1, v3 + 2, a2 - 1, a3);
case 5:
return sub_7697C6(v3, v3 + 1, v3 + 2, v3 + 3, a2 - 1, a3);
default:
if ( v6 <= 30 )
{
v9 = v3 + 2;
v10 = v3 + 3;
result = sub_7696C6(v3, v3 + 1, v3 + 2, a3);
while ( 1 )
{
v11 = v9;
v12 = v10;
if ( v10 == a2 )
break;
v14 = *v10++;
v13 = v14;
v15 = *v9++;
result = sub_769132(a3, v14, v15);
if ( result )
{
while ( 1 )
{
*v12 = *v11;
if ( v11 == v3 )
break;
result = sub_769132(a3, v13, *(v11 - 1));
v12 = v11;
if ( !result )
break;
--v11;
}
*v11 = v13;
}
}
return result;
}
v16 = a2 - 1;
v17 = &v3[((char *)a2 - (char *)v3) >> 3];
if ( v6 < 1000 )
v18 = sub_7696C6(v3, &v3[((char *)a2 - (char *)v3) >> 3], a2 - 1, a3);
else
v18 = sub_7697C6(
v3,
(int *)((char *)v3 + (v6 & 0xFFFFFFFC)),
v17,
(int *)((char *)v17 + (v6 & 0xFFFFFFFC)),
a2 - 1,
a3);
v19 = *v3;
v20 = v18;
v21 = *v17;
if ( sub_769132(a3, *v3, *v17) )
{
LABEL_35:
v34 = v3 + 1;
if ( v3 + 1 < v16 )
{
for ( i = v3 + 1; ; ++i )
{
v34 = i;
v41 = *i;
v43 = *v17;
if ( !sub_769132(a3, *i, *v17) )
{
do
{
v36 = *--v16;
v45 = v36;
}
while ( !sub_769132(a3, v36, v43) );
if ( i > v16 )
break;
*i = v45;
++v20;
if ( v17 == i )
v17 = v16;
*v16 = v41;
}
}
}
if ( v34 != v17 )
{
v37 = *v17;
v38 = *v34;
if ( sub_769132(a3, *v17, *v34) )
{
*v34 = v37;
++v20;
*v17 = v38;
}
}
if ( !v20 )
{
v39 = sub_769864(v3, v34, a3);
result = sub_769864(v34 + 1, a2, a3);
if ( result )
{
if ( v39 )
return result;
goto LABEL_57;
}
if ( v39 )
goto LABEL_50;
}
if ( a2 - v34 > v34 - v3 )
{
result = sub_769952(v3, v34, a3);
LABEL_50:
v3 = v34 + 1;
continue;
}
result = sub_769952(v34 + 1, a2, a3);
LABEL_57:
a2 = v34;
continue;
}
v22 = a2 - 2;
while ( 1 )
{
v40 = v22;
if ( v3 == v22 )
break;
v44 = v22 - 1;
v42 = *v22;
v33 = sub_769132(a3, *v22, v21);
v22 = v44;
if ( v33 )
{
v16 = v40;
++v20;
*v3 = v42;
*v40 = v19;
goto LABEL_35;
}
}
v23 = *(a2 - 1);
v24 = v3 + 1;
result = sub_769132(a3, v19, v23);
if ( result )
{
LABEL_26:
if ( v24 != v16 )
{
while ( 1 )
{
v29 = *v3;
v30 = *v24;
if ( sub_769132(a3, *v3, *v24) )
{
do
{
v32 = *--v16;
v31 = v32;
result = sub_769132(a3, v29, v32);
}
while ( result );
if ( v24 >= v16 )
{
v3 = v24;
goto LABEL_2;
}
*v24 = v31;
*v16 = v30;
}
++v24;
}
}
}
else
{
v25 = v3 + 1;
while ( 1 )
{
v26 = v25;
if ( v25 == v16 )
break;
v27 = *v25++;
result = sub_769132(a3, v19, v27);
v28 = v27;
if ( result )
{
*v26 = v23;
v24 = v26 + 1;
*(a2 - 1) = v28;
goto LABEL_26;
}
}
}
return result;
}
}
}