//
// sub_843784 from 0x843784 to 0x843880 (252 bytes)
//
// 1 xrefs:
// > sub_844440 @ 0x84472a
//
// 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:22 +0000
//
int __fastcall sub_843784(_DWORD **a1, _BYTE *a2)
{
_DWORD *v4; // r0
_DWORD *v5; // r4
int v6; // r7
_DWORD *v7; // r1
void *v9; // r0
int v10; // r4
int *v11; // r0
char *v12; // r0
void *v13; // r0
v4 = off_D200BC(1u, 0x150u);
v5 = v4;
a1[272] = v4;
if ( !v4 )
return 27;
v6 = (*a1)[132];
if ( v6 )
{
if ( (unsigned int)(v6 - 8) > 0xFFB0 )
return 71;
}
else
{
v6 = 512;
}
if ( !v4[82] )
{
v9 = off_D200BC(1u, v6 + 4);
v5[82] = v9;
if ( !v9 )
return 27;
}
if ( !v5[83] )
{
v13 = off_D200BC(1u, v6 + 4);
v5[83] = v13;
if ( !v13 )
return 27;
}
sub_83E124((int)a1, 1);
v5[4] = a1;
v7 = a1[104];
v5[81] = v6;
*v5 = 0;
v5[5] = v7;
v5[2] = -100;
v5[80] = 512;
*((_WORD *)v5 + 26) = a1[19][1];
sub_8433B0(v5);
if ( *((_BYTE *)a1 + 639) )
{
LABEL_9:
sub_820CCC(*a1);
*a2 = 1;
return 0;
}
if ( !bind(v5[5], (const struct sockaddr *)(v5 + 13), a1[19][4]) )
{
*((_BYTE *)a1 + 639) = 1;
goto LABEL_9;
}
v10 = (int)*a1;
v11 = (int *)_errno();
v12 = sub_842624((int)a1, *v11);
sub_828178(v10, "bind() failed; %s", v12);
return 7;
}