//
// sub_C681A0 from 0xc681a0 to 0xc682f0 (336 bytes)
//
// 1 xrefs:
// > sub_C68714 @ 0xc68d08
//
// 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_C681A0(int **a1, int a2, int a3)
{
__int64 v3; // x21
__int64 v4; // x22
unsigned int v5; // w20
int v6; // w19
int v7; // w25
_BYTE *v8; // x27
int **v9; // x28
int v12; // w23
int v13; // w26
_BYTE *v14; // x6
__int64 v15; // x5
unsigned int v16; // w4
v3 = (__int64)(*a1 + 4);
v4 = *(_QWORD *)v3 + a2 * (*a1)[6];
v5 = 0;
v6 = **a1;
v7 = *((_DWORD *)a1 + 103);
v8 = (_BYTE *)(v4 + 1);
if ( *((_DWORD *)a1 + 104) > *((_DWORD *)a1 + 106) )
{
if ( a3 <= 0 )
return 0;
v9 = a1 + 45;
if ( *((int *)a1 + 96) > 0 )
{
return 0;
}
else
{
v12 = 15;
v13 = 0;
do
{
sub_C8B3B8(v9);
if ( v7 > 0 )
{
v14 = v8;
v15 = 0;
do
{
v16 = *((unsigned __int8 *)a1[54] + v15++);
v16 >>= 4;
*v14 = v16 | *v14 & 0xF0;
v14 += 2;
v12 &= v16;
}
while ( v7 > (int)v15 );
}
++v13;
v8 += *(int *)(v3 + 8);
}
while ( *((_DWORD *)a1 + 104) > *((_DWORD *)a1 + 106) && a3 > v13 && *((int *)v9 + 6) <= 0 );
v5 = v13;
if ( v12 != 15 && (unsigned int)(v6 - 7) <= 3 )
off_1260220(v4);
}
}
return v5;
}