//
// sub_828470 from 0x828470 to 0x8284e6 (118 bytes)
//
// 5 xrefs:
// > sub_845000 @ 0x84518a
// > sub_845000 @ 0x845284
// > sub_84542C @ 0x845502
// > sub_84542C @ 0x8456dc
// > sub_84542C @ 0x845894
//
// 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:01:58 +0000
//
int __fastcall sub_828470(int *a1, int a2, void *a3, size_t a4, ssize_t *a5)
{
int v6; // r4
ssize_t v7; // r4
int result; // r0
_DWORD *v9; // r0
int v10; // r7
bool v11; // zf
int v12; // r3
int v13; // r6
const char *v14; // r0
if ( a1[105] == a2 )
v6 = 105;
else
v6 = 104;
v7 = send(a1[v6], a3, a4, 0x4000);
if ( v7 == -1 )
{
v9 = (_DWORD *)_errno();
v10 = *v9;
v11 = *v9 == 11;
if ( *v9 != 11 )
v11 = v10 == 4;
v12 = v11;
if ( v10 == 115 )
v12 |= 1u;
if ( v12 )
{
result = 81;
v7 = 0;
}
else
{
v13 = *a1;
v14 = (const char *)sub_842624(a1, *v9);
sub_828178(v13, "Send failure: %s", v14);
result = 55;
*(_DWORD *)(*a1 + 34488) = v10;
}
}
else
{
result = 0;
}
*a5 = v7;
return result;
}