// // sub_515C54 from 0x515c54 to 0x515f62 (782 bytes) // // 3 xrefs: // > sub_515C54 @ 0x515efc // > sub_515C54 @ 0x515f28 // > GameStatsManager::tryFixPathBug @ 0x524578 // // 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:51:40 +0000 // int __fastcall sub_515C54(int result, char *a2, int a3) { char *v3; // r4 int v5; // r3 int v6; // r3 int v7; // r3 int *v8; // r5 int *v9; // r9 int *v10; // r7 int v11; // r1 int *v12; // r3 char *v13; // r5 char *v14; // r7 int v15; // r0 int v16; // r11 char *v17; // r10 char *v18; // r7 int v19; // r2 int v20; // r2 int v21; // r3 int v22; // r3 int v23; // r3 int v24; // r3 char *v25; // r10 _DWORD *i; // r9 char *v27; // r3 _BOOL4 v28; // r0 int v29; // r1 int v30; // r1 _BOOL4 v31; // r7 int v32; // r3 int v33; // r2 int v34; // r3 char *v36; // [sp+Ch] [bp-18h] int v37; // [sp+14h] [bp-10h] BYREF int v38; // [sp+18h] [bp-Ch] v3 = (char *)result; while ( 2 ) { v5 = (a2 - v3) >> 3; switch ( v5 ) { case 0: case 1: return result; case 2: result = sub_51589C((_DWORD *)a2 - 2, v3); if ( result ) { v6 = *(_DWORD *)v3; *(_DWORD *)v3 = *((_DWORD *)a2 - 2); *((_DWORD *)a2 - 2) = v6; v7 = *((_DWORD *)v3 + 1); *((_DWORD *)v3 + 1) = *((_DWORD *)a2 - 1); *((_DWORD *)a2 - 1) = v7; } return result; case 3: return sub_51596C((int *)v3, (int *)v3 + 2, (int *)a2 - 2); case 4: return sub_515A02((int *)v3, (int *)v3 + 2, (int *)v3 + 4, (int *)a2 - 2); case 5: return sub_515A7A((int *)v3, (int *)v3 + 2, (int *)v3 + 4, (int *)v3 + 6, (int *)a2 - 2); default: if ( v5 > 6 ) { v13 = a2 - 8; v14 = &v3[8 * ((a2 - v3) >> 4)]; if ( v5 < 1000 ) v15 = sub_51596C((int *)v3, (int *)&v3[8 * ((a2 - v3) >> 4)], (int *)a2 - 2); else v15 = sub_515A7A( (int *)v3, (int *)&v3[8 * ((a2 - v3) >> 5)], (int *)&v3[8 * ((a2 - v3) >> 4)], (int *)&v14[8 * ((a2 - v3) >> 5)], (int *)a2 - 2); v16 = v15; if ( sub_51589C(v3, v14) ) { LABEL_37: v25 = v3 + 8; if ( v3 + 8 < v13 ) { for ( i = v3 + 16; ; i += 2 ) { v25 = (char *)(i - 2); if ( !sub_51589C(i - 2, v14) ) { v27 = v13; do { v36 = v27 - 8; v28 = sub_51589C((_DWORD *)v27 - 2, v14); v27 = v36; } while ( !v28 ); v13 = v36; if ( v25 > v36 ) break; v29 = *(i - 2); ++v16; if ( v14 == v25 ) v14 = v36; *(i - 2) = *(_DWORD *)v36; *(_DWORD *)v36 = v29; v30 = *(i - 1); *(i - 1) = *((_DWORD *)v36 + 1); *((_DWORD *)v36 + 1) = v30; } } } if ( v25 != v14 && sub_51589C(v14, v25) ) { ++v16; v32 = *(_DWORD *)v25; *(_DWORD *)v25 = *(_DWORD *)v14; v33 = *((_DWORD *)v14 + 1); *(_DWORD *)v14 = v32; v34 = *((_DWORD *)v25 + 1); *((_DWORD *)v25 + 1) = v33; *((_DWORD *)v14 + 1) = v34; } if ( !v16 ) { v31 = sub_515B20((int *)v3, v25); result = sub_515B20((int *)v25 + 2, a2); if ( result ) { if ( v31 ) return result; goto LABEL_60; } if ( v31 ) goto LABEL_53; } if ( (a2 - v25) >> 3 > (v25 - v3) >> 3 ) { result = sub_515C54(v3, v25, a3); LABEL_53: v3 = v25 + 8; continue; } result = sub_515C54(v25 + 8, a2, a3); LABEL_60: a2 = v25; } else { v17 = a2 - 8; while ( 1 ) { v17 -= 8; if ( v3 == v17 ) break; if ( sub_51589C(v17, v14) ) { v23 = *(_DWORD *)v3; ++v16; v13 = v17; *(_DWORD *)v3 = *(_DWORD *)v17; *(_DWORD *)v17 = v23; v24 = *((_DWORD *)v3 + 1); *((_DWORD *)v3 + 1) = *((_DWORD *)v17 + 1); *((_DWORD *)v17 + 1) = v24; goto LABEL_37; } } v18 = v3 + 8; result = sub_51589C(v3, (_DWORD *)a2 - 2); if ( !result ) { while ( 1 ) { if ( v18 == v13 ) return result; result = sub_51589C(v3, v18); if ( result ) break; v18 += 8; } v19 = *(_DWORD *)v18; *(_DWORD *)v18 = *((_DWORD *)a2 - 2); *((_DWORD *)a2 - 2) = v19; v20 = *((_DWORD *)v18 + 1); *((_DWORD *)v18 + 1) = *((_DWORD *)a2 - 1); v18 += 8; *((_DWORD *)a2 - 1) = v20; } if ( v18 == v13 ) return result; while ( 1 ) { do v18 += 8; while ( !sub_51589C(v3, (_DWORD *)v18 - 2) ); do { v13 -= 8; result = sub_51589C(v3, v13); } while ( result ); if ( v18 - 8 >= v13 ) break; v21 = *((_DWORD *)v18 - 2); *((_DWORD *)v18 - 2) = *(_DWORD *)v13; *(_DWORD *)v13 = v21; v22 = *((_DWORD *)v18 - 1); *((_DWORD *)v18 - 1) = *((_DWORD *)v13 + 1); *((_DWORD *)v13 + 1) = v22; } v3 = v18 - 8; } continue; } v8 = (int *)(v3 + 16); v9 = (int *)(v3 + 24); result = sub_51596C((int *)v3, (int *)v3 + 2, (int *)v3 + 4); while ( 1 ) { v10 = v8; if ( v9 == (int *)a2 ) break; result = sub_51589C(v9, v8); if ( result ) { result = *v9; v11 = v9[1]; v12 = v9; v37 = *v9; v38 = v11; while ( 1 ) { *v12 = *v10; v12[1] = v10[1]; if ( v10 == (int *)v3 ) break; result = sub_51589C(&v37, v10 - 2); v12 = v10; if ( !result ) break; v10 -= 2; } *v10 = v37; v10[1] = v38; } v9 += 2; v8 += 2; } return result; } } }
GD Web Decomp Icon

GD Web Decomp

Raw Source