//
// sub_B70E70 from 0xb70e70 to 0xb71094 (548 bytes)
//
// 4 xrefs:
// > sub_BB23D8 @ 0xbb2420
// > sub_BB276C @ 0xbb2860
// > sub_BB3B38 @ 0xbb3bac
// > sub_BBACE4 @ 0xbbb0e4
//
// 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_B70E70(const char *a1, _QWORD *a2, size_t *a3)
{
const char *v5; // x19
size_t v6; // x0
unsigned int v7; // w4
size_t v9; // x3
int v10; // w1
int v11; // w4
__int64 v12; // x1
__int64 v13; // x1
size_t v14; // x20
size_t v15; // d8
void *v16; // x0
void *v17; // x27
const char *v18; // x20
_BYTE *v19; // x28
unsigned __int64 v20; // x24
const char *v21; // x25
unsigned __int64 v22; // x1
int v23; // w5
__int64 v24; // x3
unsigned __int64 v25; // x19
unsigned __int64 v26; // x24
*a2 = 0;
*a3 = 0;
v5 = a1;
v6 = strlen(a1);
v7 = 61;
if ( !v6 )
return v7;
v9 = v6 & 3;
if ( (v6 & 3) != 0 )
return v7;
v10 = *(unsigned __int8 *)v5;
if ( *v5 && v10 != 61 )
{
do
v11 = (unsigned __int8)v5[++v9];
while ( v5[v9] && v11 != 61 );
v12 = v9 + 1;
if ( v11 != 61 )
{
v13 = 0;
goto LABEL_11;
}
}
else
{
if ( v10 != 61 )
return 61;
v12 = 1;
v9 = 0;
}
if ( v5[v12] == 61 )
{
v9 += 2LL;
v13 = 2;
}
else
{
v9 = v12;
v13 = 1;
}
LABEL_11:
v7 = 61;
if ( v6 == v9 )
{
v14 = v6 >> 2;
v15 = 3 * (v6 >> 2) - v13;
v16 = off_1231000(v15 + 1);
v17 = v16;
if ( !v16 )
return 27;
if ( !v14 )
{
v19 = v16;
LABEL_28:
*v19 = 0;
v7 = 0;
*a2 = v17;
*a3 = v15;
return v7;
}
v18 = &v5[4 * v14];
v19 = v16;
while ( 2 )
{
v20 = 0;
v21 = v5 + 4;
v22 = 0;
do
{
v23 = *(unsigned __int8 *)v5;
if ( v23 == 61 )
{
v22 <<= 6;
++v20;
}
else
{
v24 = 0;
if ( v23 != 65 )
{
while ( aAbcdefghijklmn[++v24] )
{
if ( v23 == (unsigned __int8)aAbcdefghijklmn[v24] )
goto LABEL_22;
}
if ( *v5 )
goto LABEL_29;
}
LABEL_22:
v22 = v24 + (v22 << 6);
}
++v5;
}
while ( v5 != v21 );
if ( v20 )
{
v25 = v22 >> 8;
if ( v20 > 1 )
{
LABEL_26:
*v19 = nullsub_9(BYTE1(v25));
v26 = 3 - v20;
if ( !v26 )
{
LABEL_29:
off_1231008(v17);
return 61;
}
v5 = v21;
v19 += v26;
if ( v18 != v21 )
continue;
goto LABEL_28;
}
}
else
{
v25 = v22 >> 8;
v19[2] = nullsub_9((unsigned __int8)v22);
}
break;
}
v19[1] = nullsub_9((unsigned __int8)v25);
goto LABEL_26;
}
return v7;
}