//
// sub_B70C74 from 0xb70c74 to 0xb70e70 (508 bytes)
//
// 2 xrefs:
// > sub_B71094 @ 0xb7109c
// > sub_B710A0 @ 0xb710ac
//
// 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_B70C74(__int64 a1, char *a2, size_t a3, const char **a4, size_t *a5)
{
size_t v7; // x21
char *v9; // x22
const char *v10; // x23
const char *v11; // x19
const char *v12; // x0
unsigned __int8 v13; // w5
bool v14; // zf
char v15; // w4
__int64 v16; // x3
unsigned __int8 v17; // w6
__int64 v18; // x4
unsigned __int8 v19; // w7
size_t v21; // x19
const char *v22; // x0
*a4 = nullptr;
*a5 = 0;
v7 = a3;
v9 = a2;
if ( a3 )
{
v10 = (const char *)off_1231000(4 * a3 / 3 + 4);
if ( v10 )
goto LABEL_3;
}
else
{
v21 = strlen(a2);
v7 = v21;
v22 = (const char *)off_1231000(4 * v21 / 3 + 4);
v10 = v22;
if ( v22 )
{
if ( !v21 )
{
v11 = v22;
LABEL_9:
*v11 = 0;
*a4 = v10;
off_1231008(nullptr);
*a5 = strlen(v10);
return 0;
}
LABEL_3:
v11 = v10;
v12 = v10;
v13 = *v9;
if ( v7 == 1 )
{
LABEL_7:
sub_B8C278(v11, 5, "%c%c==", *(unsigned __int8 *)(a1 + (v13 >> 2)), *(unsigned __int8 *)(a1 + 16LL * (v13 & 3)));
}
else
{
while ( 1 )
{
v14 = v7 == 2;
v15 = 16 * (v13 & 3);
v7 -= 3LL;
v16 = v13 >> 2;
if ( v14 )
break;
v17 = v15 | ((unsigned __int8)v9[1] >> 4);
v18 = v9[2] & 0x3F;
v11 += 4;
v19 = (4 * (v9[1] & 0xF)) | ((unsigned __int8)v9[2] >> 6);
v9 += 3;
sub_B8C278(
v12,
5,
"%c%c%c%c",
*(unsigned __int8 *)(a1 + v16),
*(unsigned __int8 *)(a1 + v17),
*(unsigned __int8 *)(a1 + v19),
*(unsigned __int8 *)(a1 + v18));
if ( !v7 )
goto LABEL_9;
v12 = v11;
v13 = *v9;
if ( v7 == 1 )
goto LABEL_7;
}
sub_B8C278(
v12,
5,
"%c%c%c=",
*(unsigned __int8 *)(a1 + v16),
*(unsigned __int8 *)(a1 + (unsigned __int8)(v15 | ((unsigned __int8)v9[1] >> 4))),
*(unsigned __int8 *)(a1 + 4LL * (v9[1] & 0xF)));
}
v11 += 4;
goto LABEL_9;
}
}
return 27;
}