//
// sub_C68FBC from 0xc68fbc to 0xc69514 (1368 bytes)
//
// 1 xrefs:
// > sub_C6B594 @ 0xc6bbe0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_C68FBC(__int64 a1)
{
__int64 v1; // x24
int v3; // w25
int v4; // w21
int v5; // w22
int v6; // w23
int v7; // w20
int v8; // w0
int v9; // w2
int v10; // w10
int v11; // w0
int v12; // w6
int v13; // w5
int v14; // w1
int v15; // w7
int v16; // w8
int v17; // w6
int v18; // w5
int v19; // w1
int v20; // w1
int v21; // w1
int v22; // w0
int v23; // w5
_QWORD *v24; // x0
_QWORD *v25; // x2
_QWORD *v26; // x1
_QWORD *v27; // x19
__int64 v28; // x5
__int64 v29; // x5
__int64 v30; // x3
__int64 v31; // x3
__int64 v32; // x3
__int64 result; // x0
__int64 v34; // x1
_QWORD *v35; // t2
int v36; // w0
int v37; // w8
int v38; // w5
int v39; // w1
int v40; // w10
int v41; // w1
int v42; // w1
int v43; // w0
int v44; // w5
int v45; // w0
int v46; // w6
int v47; // w5
int v48; // w1
int v49; // w9
int v50; // w1
int v51; // w24
int v52; // w0
int v53; // w6
int v54; // w24
int v55; // w25
int v56; // w21
int v57; // w22
int v58; // w0
int v59; // w4
int v60; // w0
int v61; // w0
int v62; // w2
int v63; // w1
v1 = a1 + 16;
v3 = sub_CB5EE8(a1 + 16, 7);
v4 = 0;
if ( (unsigned int)sub_CB5EE8(v1, 1) )
v4 = sub_CB6024(v1, 4);
v5 = 0;
if ( (unsigned int)sub_CB5EE8(v1, 1) )
v5 = sub_CB6024(v1, 4);
v6 = 0;
if ( (unsigned int)sub_CB5EE8(v1, 1) )
v6 = sub_CB6024(v1, 4);
v7 = 0;
if ( (unsigned int)sub_CB5EE8(v1, 1) )
v7 = sub_CB6024(v1, 4);
v8 = sub_CB5EE8(v1, 1);
v9 = 0;
if ( v8 )
v9 = sub_CB6024(v1, 4);
v10 = *(_DWORD *)(a1 + 128);
if ( v10 )
{
v11 = *(char *)(a1 + 140);
if ( !*(_DWORD *)(a1 + 136) )
v11 += v3;
}
else
{
v11 = v3;
}
v12 = v11 + v4;
v13 = v11 + v5;
if ( v11 + v4 > 127 )
v12 = 127;
v14 = v11 + v6;
if ( v12 < 0 )
v12 = 0;
if ( v11 > 127 )
v15 = 127;
else
v15 = v11;
if ( v15 < 0 )
v15 = 0;
if ( v13 > 127 )
v13 = 127;
if ( v13 < 0 )
v13 = 0;
if ( v14 > 127 )
v14 = 127;
v16 = byte_F51BF0[v12];
v17 = *(unsigned __int16 *)&byte_F51BF0[2 * v15 + 128];
if ( v14 < 0 )
v14 = 0;
v18 = byte_F51BF0[v13];
*(_DWORD *)(a1 + 1060) = v16;
*(_DWORD *)(a1 + 1064) = v17;
v19 = *(unsigned __int16 *)&byte_F51BF0[2 * v14 + 128];
*(_DWORD *)(a1 + 1068) = 2 * v18;
v20 = (101581 * v19) >> 16;
if ( v20 <= 7 )
*(_DWORD *)(a1 + 1072) = 8;
else
*(_DWORD *)(a1 + 1072) = v20;
v21 = v11 + v7;
v22 = v11 + v9;
if ( v21 > 117 )
v21 = 117;
if ( v21 < 0 )
v21 = 0;
if ( v22 > 127 )
v23 = 127;
else
v23 = v22;
*(_DWORD *)(a1 + 1084) = v22;
if ( v23 < 0 )
v23 = 0;
*(_DWORD *)(a1 + 1076) = byte_F51BF0[v21];
*(_DWORD *)(a1 + 1080) = *(unsigned __int16 *)&byte_F51BF0[2 * v23 + 128];
if ( v10 )
{
v36 = *(char *)(a1 + 141);
if ( !*(_DWORD *)(a1 + 136) )
v36 += v3;
v37 = v36 + v4;
v38 = v36 + v5;
v39 = v36 + v6;
if ( v36 + v4 > 127 )
v37 = 127;
if ( v37 < 0 )
v37 = 0;
if ( v36 > 127 )
v40 = 127;
else
v40 = v36;
if ( v40 < 0 )
v40 = 0;
if ( v38 > 127 )
v38 = 127;
*(_DWORD *)(a1 + 1092) = byte_F51BF0[v37];
if ( v38 < 0 )
v38 = 0;
if ( v39 > 127 )
v39 = 127;
*(_DWORD *)(a1 + 1096) = *(unsigned __int16 *)&byte_F51BF0[2 * v40 + 128];
if ( v39 < 0 )
v39 = 0;
*(_DWORD *)(a1 + 1100) = 2 * byte_F51BF0[v38];
v41 = (101581 * *(unsigned __int16 *)&byte_F51BF0[2 * v39 + 128]) >> 16;
if ( v41 > 7 )
*(_DWORD *)(a1 + 1104) = v41;
else
*(_DWORD *)(a1 + 1104) = 8;
v42 = v36 + v7;
if ( v36 + v7 > 117 )
v42 = 117;
v43 = v36 + v9;
if ( v42 < 0 )
v42 = 0;
if ( v43 > 127 )
v44 = 127;
else
v44 = v43;
*(_DWORD *)(a1 + 1116) = v43;
if ( v44 < 0 )
v44 = 0;
*(_DWORD *)(a1 + 1108) = byte_F51BF0[v42];
*(_DWORD *)(a1 + 1112) = *(unsigned __int16 *)&byte_F51BF0[2 * v44 + 128];
v45 = *(char *)(a1 + 142);
if ( !*(_DWORD *)(a1 + 136) )
v45 += v3;
v46 = v45 + v4;
v47 = v45 + v5;
v48 = v45 + v6;
if ( v45 + v4 > 127 )
v46 = 127;
if ( v46 < 0 )
v46 = 0;
if ( v45 > 127 )
v49 = 127;
else
v49 = v45;
if ( v49 < 0 )
v49 = 0;
if ( v47 > 127 )
v47 = 127;
*(_DWORD *)(a1 + 1124) = byte_F51BF0[v46];
if ( v47 < 0 )
v47 = 0;
if ( v48 > 127 )
v48 = 127;
*(_DWORD *)(a1 + 1128) = *(unsigned __int16 *)&byte_F51BF0[2 * v49 + 128];
if ( v48 < 0 )
v48 = 0;
*(_DWORD *)(a1 + 1132) = 2 * byte_F51BF0[v47];
v50 = (101581 * *(unsigned __int16 *)&byte_F51BF0[2 * v48 + 128]) >> 16;
if ( v50 > 7 )
*(_DWORD *)(a1 + 1136) = v50;
else
*(_DWORD *)(a1 + 1136) = 8;
v51 = v45 + v7;
if ( v45 + v7 > 117 )
v51 = 117;
v52 = v45 + v9;
if ( v51 < 0 )
v51 = 0;
if ( v52 > 127 )
v53 = 127;
else
v53 = v52;
*(_DWORD *)(a1 + 1148) = v52;
if ( v53 < 0 )
v53 = 0;
*(_DWORD *)(a1 + 1140) = byte_F51BF0[v51];
*(_DWORD *)(a1 + 1144) = *(unsigned __int16 *)&byte_F51BF0[2 * v53 + 128];
v54 = *(char *)(a1 + 143);
v55 = v54 + v3;
if ( !*(_DWORD *)(a1 + 136) )
v54 = v55;
v56 = v54 + v4;
v57 = v54 + v5;
v58 = v54 + v6;
if ( v56 > 127 )
v56 = 127;
if ( v56 < 0 )
v56 = 0;
if ( v54 > 127 )
v59 = 127;
else
v59 = v54;
if ( v59 < 0 )
v59 = 0;
if ( v57 > 127 )
v57 = 127;
*(_DWORD *)(a1 + 1156) = byte_F51BF0[v56];
if ( v57 < 0 )
v57 = 0;
if ( v58 > 127 )
v58 = 127;
*(_DWORD *)(a1 + 1160) = *(unsigned __int16 *)&byte_F51BF0[2 * v59 + 128];
if ( v58 < 0 )
v58 = 0;
*(_DWORD *)(a1 + 1164) = 2 * byte_F51BF0[v57];
v60 = (101581 * *(unsigned __int16 *)&byte_F51BF0[2 * v58 + 128]) >> 16;
if ( v60 <= 7 )
v60 = 8;
*(_DWORD *)(a1 + 1168) = v60;
v61 = v54 + v7;
if ( v54 + v7 > 117 )
v61 = 117;
v62 = v54 + v9;
if ( v61 < 0 )
v61 = 0;
if ( v62 > 127 )
v63 = 127;
else
v63 = v62;
if ( v63 < 0 )
v63 = 0;
*(_DWORD *)(a1 + 1180) = v62;
*(_DWORD *)(a1 + 1172) = byte_F51BF0[v61];
result = *(unsigned __int16 *)&byte_F51BF0[2 * v63 + 128];
*(_DWORD *)(a1 + 1176) = result;
}
else
{
v24 = (_QWORD *)(a1 + 1060);
v25 = (_QWORD *)(a1 + 1092);
v26 = (_QWORD *)(a1 + 1124);
v27 = (_QWORD *)(a1 + 1156);
v28 = v24[1];
*v25 = *v24;
v25[1] = v28;
v29 = v24[3];
v25[2] = v24[2];
v25[3] = v29;
v30 = v24[1];
*v26 = *v24;
v26[1] = v30;
v31 = v24[3];
v26[2] = v24[2];
v26[3] = v31;
v32 = v24[1];
*v27 = *v24;
v27[1] = v32;
v35 = v24 + 2;
result = v24[2];
v34 = v35[1];
v27[2] = result;
v27[3] = v34;
}
return result;
}