//
// sub_C76948 from 0xc76948 to 0xc76d40 (1016 bytes)
//
// 1 xrefs:
// > sub_C76D40 @ 0xc76e08
//
// 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_C76948(_BYTE *a1, _BYTE *a2, int a3, int a4, int a5, int a6)
{
int v6; // w3
__int64 v7; // x18
__int64 v8; // x21
__int64 v9; // x19
__int64 v10; // x13
__int64 v11; // x16
__int64 v12; // x22
_BYTE *v13; // x28
int v14; // w11
int v15; // w17
int v16; // w9
int v17; // w10
__int64 v18; // x6
int v19; // w14
int v20; // w15
int v21; // w8
int v22; // w12
int v23; // w20
int v24; // w12
int v25; // w6
int v26; // w8
_BYTE *v27; // x12
int v28; // w10
int v29; // w23
int v30; // w8
int v31; // w9
__int64 result; // x0
int v33; // w25
int v34; // w15
int v35; // w6
int v36; // w14
int v37; // w0
int v38; // w24
int v39; // w26
int v40; // w6
int v41; // w8
int v42; // w10
int v43; // w6
int v44; // w9
v6 = 2 * a4 + 1;
v7 = -3 * a3;
v8 = -4 * a3;
v9 = -2 * a3;
v10 = -a3;
v11 = 2 * a3;
v12 = 3 * a3;
v13 = a1 + 8;
do
{
while ( 1 )
{
v14 = (unsigned __int8)a1[v9];
v15 = (unsigned __int8)a1[a3];
v16 = (unsigned __int8)a1[v10];
v17 = (unsigned __int8)*a1;
v18 = v14 - v15;
v19 = (unsigned __int8)a1[v7];
v20 = (unsigned __int8)a1[v11];
if ( v6 < byte_F54BCF[v18] + 4 * byte_F54BCF[v16 - v17] )
goto LABEL_12;
if ( a5 < byte_F54BCF[(unsigned __int8)a1[v8] - v19] )
goto LABEL_12;
if ( a5 < byte_F54BCF[v19 - v14] )
goto LABEL_12;
v21 = byte_F54BCF[v14 - v16];
if ( a5 < v21 )
goto LABEL_12;
if ( a5 < byte_F54BCF[(unsigned __int8)a1[v12] - v20] )
goto LABEL_12;
if ( a5 < byte_F54BCF[v20 - v15] )
goto LABEL_12;
v22 = byte_F54BCF[v15 - v17];
if ( a5 < v22 )
goto LABEL_12;
if ( a6 < v21 || a6 < v22 )
break;
v23 = byte_F546CC[3 * (v17 - v16) + byte_F546CC[v18]];
v24 = (9 * v23 + 63) >> 7;
v25 = (18 * v23 + 63) >> 7;
v26 = (27 * v23 + 63) >> 7;
a1[v7] = byte_F53FDF[v19 + v24];
a1[v9] = byte_F53FDF[v14 + v25];
a1[v10] = byte_F53FDF[v16 + v26];
*a1 = byte_F53FDF[v17 - v26];
a1[a3] = byte_F53FDF[v15 - v25];
a1[v11] = byte_F53FDF[v20 - v24];
LABEL_12:
if ( ++a1 == v13 )
goto LABEL_13;
}
v41 = 3 * (v17 - v16) + byte_F546CC[v18];
v42 = v17 - byte_F54250[(v41 + 4) >> 3];
a1[v10] = byte_F53FDF[v16 + byte_F54250[(v41 + 3) >> 3]];
*a1++ = byte_F53FDF[v42];
}
while ( a1 != v13 );
LABEL_13:
v27 = a2 + 8;
while ( 1 )
{
LABEL_14:
v28 = (unsigned __int8)a2[v9];
v29 = (unsigned __int8)a2[a3];
v30 = (unsigned __int8)a2[v10];
v31 = (unsigned __int8)*a2;
result = v28 - v29;
v33 = (unsigned __int8)a2[v7];
v34 = (unsigned __int8)a2[v11];
if ( v6 < byte_F54BCF[result] + 4 * byte_F54BCF[v30 - v31] )
goto LABEL_24;
if ( a5 < byte_F54BCF[(unsigned __int8)a2[v8] - v33] )
goto LABEL_24;
if ( a5 < byte_F54BCF[v33 - v28] )
goto LABEL_24;
v35 = byte_F54BCF[v28 - v30];
if ( a5 < v35 )
goto LABEL_24;
if ( a5 < byte_F54BCF[(unsigned __int8)a2[v12] - v34] )
goto LABEL_24;
if ( a5 < byte_F54BCF[v34 - v29] )
goto LABEL_24;
v36 = byte_F54BCF[v29 - v31];
if ( a5 < v36 )
goto LABEL_24;
if ( a6 < v35 || a6 < v36 )
break;
v37 = byte_F546CC[3 * (v31 - v30) + byte_F546CC[result]];
v38 = (9 * v37 + 63) >> 7;
v39 = (18 * v37 + 63) >> 7;
v40 = (27 * v37 + 63) >> 7;
a2[v7] = byte_F53FDF[v33 + v38];
a2[v9] = byte_F53FDF[v28 + v39];
a2[v10] = byte_F53FDF[v30 + v40];
*a2 = byte_F53FDF[v31 - v40];
a2[a3] = byte_F53FDF[v29 - v39];
result = (unsigned __int8)byte_F53FDF[v34 - v38];
a2[v11] = result;
LABEL_24:
if ( ++a2 == v27 )
return result;
}
v43 = 3 * (v31 - v30) + byte_F546CC[result];
v44 = v31 - byte_F54250[(v43 + 4) >> 3];
a2[v10] = byte_F53FDF[v30 + byte_F54250[(v43 + 3) >> 3]];
++a2;
result = (unsigned __int8)byte_F53FDF[v44];
*(a2 - 1) = result;
if ( a2 != v27 )
goto LABEL_14;
return result;
}