//
// sub_DBDAF0 from 0xdbdaf0 to 0xdbdcd4 (484 bytes)
//
// 5 xrefs:
// > CRYPTO_ocb128_aad @ 0xdbe4f8
// > CRYPTO_ocb128_encrypt @ 0xdbe6cc
// > CRYPTO_ocb128_encrypt @ 0xdbe764
// > CRYPTO_ocb128_decrypt @ 0xdbebc4
// > CRYPTO_ocb128_decrypt @ 0xdbec5c
//
// 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
//
_BYTE *__fastcall sub_DBDAF0(_QWORD *a1, unsigned __int64 a2)
{
unsigned __int64 v2; // x19
unsigned __int64 v4; // x1
_BYTE *v6; // x4
__int64 v7; // x6
_BYTE *v8; // x2
unsigned int v9; // w1
char v10; // w7
char v11; // w10
char v12; // w5
unsigned int v13; // w0
char v14; // w5
unsigned int v15; // w7
unsigned int v16; // w8
unsigned int v17; // w7
unsigned int v18; // w8
unsigned int v19; // w7
unsigned int v20; // w8
unsigned int v21; // w7
unsigned int v22; // w8
unsigned int v23; // w7
unsigned int v24; // w8
unsigned int v25; // w7
unsigned int v26; // w3
__int64 v27; // x0
_BYTE *result; // x0
void *v29; // x0
unsigned __int64 v30; // x1
v2 = a1[5];
if ( v2 >= a2 )
return (_BYTE *)(a1[11] + 16 * a2);
v4 = a1[6];
if ( a2 >= v4 )
{
v29 = (void *)a1[11];
v30 = ((a2 - v4 + 4) & 0xFFFFFFFFFFFFFFFCLL) + v4;
a1[6] = v30;
result = CRYPTO_realloc(v29, (void *)(16 * v30), (__int64)"crypto/modes/ocb128.c", 122);
if ( !result )
return result;
a1[11] = result;
v6 = result;
}
else
{
v6 = (_BYTE *)a1[11];
}
v7 = 16 * v2;
while ( 1 )
{
v8 = &v6[v7 + 16];
++v2;
v9 = (unsigned __int8)v6[v7 + 14];
v10 = 9 * (v6[v7] >> 7);
v11 = 2 * (v6[v7 + 15] & 0x7F);
v12 = -112 * (v6[v7] >> 7);
v8[14] = (2 * v9) | (v6[v7 + 15] >> 7);
v13 = (unsigned __int8)v6[v7 + 13];
v14 = v11 ^ (v12 - v10);
v8[13] = (2 * v13) | (v9 >> 7);
v15 = (unsigned __int8)v6[v7 + 12];
v8[12] = (2 * v15) | (v13 >> 7);
v16 = (unsigned __int8)v6[v7 + 11];
v8[11] = (2 * v16) | (v15 >> 7);
v17 = (unsigned __int8)v6[v7 + 10];
v8[10] = (2 * v17) | (v16 >> 7);
v18 = (unsigned __int8)v6[v7 + 9];
v8[9] = (2 * v18) | (v17 >> 7);
v19 = (unsigned __int8)v6[v7 + 8];
v8[8] = (2 * v19) | (v18 >> 7);
v20 = (unsigned __int8)v6[v7 + 7];
v8[7] = (2 * v20) | (v19 >> 7);
v21 = (unsigned __int8)v6[v7 + 6];
v8[6] = (2 * v21) | (v20 >> 7);
v22 = (unsigned __int8)v6[v7 + 5];
v8[5] = (2 * v22) | (v21 >> 7);
v23 = (unsigned __int8)v6[v7 + 4];
v8[4] = (2 * v23) | (v22 >> 7);
v24 = (unsigned __int8)v6[v7 + 3];
v8[3] = (2 * v24) | (v23 >> 7);
v25 = (unsigned __int8)v6[v7 + 2];
v8[2] = (2 * v25) | (v24 >> 7);
v26 = (unsigned __int8)v6[v7 + 1];
v8[1] = (2 * v26) | (v25 >> 7);
LOBYTE(v13) = v6[v7];
v7 += 16;
v6[v7] = (2 * v13) | (v26 >> 7);
v8[15] = v14;
if ( v2 == a2 )
break;
v6 = (_BYTE *)a1[11];
}
v27 = a1[11];
a1[5] = v2;
return (_BYTE *)(v27 + 16 * v2);
}