//
// sub_84B9FC from 0x84b9fc to 0x84bb44 (328 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:02:28 +0000
//
int __fastcall sub_84B9FC(int *a1, _BYTE *a2)
{
int v2; // r10
int v3; // r8
const char *v5; // r5
int v6; // r0
void *v7; // r11
int v8; // r5
int v9; // r4
int result; // r0
size_t v11; // r0
char *v12; // r3
int v13; // t1
void *v14; // [sp+14h] [bp-10h] BYREF
size_t v15; // [sp+18h] [bp-Ch] BYREF
int v16; // [sp+1Ch] [bp-8h] BYREF
v2 = *a1;
v3 = a1[104];
v5 = *(const char **)(*a1 + 34676);
*a2 = 1;
if ( strlen(v5) > 2 )
{
v11 = strlen(v5 + 2);
v12 = (char *)(v5 + 1);
if ( v11 )
{
do
{
v13 = (unsigned __int8)*++v12;
if ( v13 == 63 )
*v12 = 9;
}
while ( v12 != &v5[v11 + 1] );
}
sub_833E74(v2, (char *)v5 + 2, 0, &v14, &v16, 0);
v7 = v14;
v6 = v16;
if ( !v14 )
return 27;
}
else
{
v6 = 0;
v7 = nullptr;
v16 = 0;
v14 = &byte_BF4ECA;
}
v8 = sub_84B880(v6);
while ( 1 )
{
v9 = sub_82839C((int)a1, v3, (int)v14, v8, (int *)&v15);
if ( v9 )
goto LABEL_8;
v9 = sub_8287C8((int)a1, 2, (const char *)v14, v15);
if ( v9 )
goto LABEL_8;
v8 -= v15;
v14 = (char *)v14 + v15;
if ( v8 <= 0 )
break;
if ( sub_842E08(-1, -1, v3, 100) < 0 )
{
v9 = 55;
LABEL_8:
off_D200B0(v7);
LABEL_9:
sub_828178(v2, "Failed sending Gopher request");
return v9;
}
}
off_D200B0(v7);
v9 = sub_828234(v3, a1, (int)&word_BF5394);
if ( v9 )
goto LABEL_9;
result = sub_8287C8((int)a1, 2, (const char *)&word_BF5394, 2u);
if ( !result )
{
sub_83AA00(a1, 0, -1, -1, 0, v2 + 112, -1, nullptr);
return 0;
}
return result;
}