//
// sub_1006976F8 from 0x1006976f8 to 0x100697884 (396 bytes)
//
// 2 xrefs:
// > sub_1006974D8 @ 0x100697504
// > ??> @ 0x1009b1b08
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 11:11:35 +0000
//
__int64 __fastcall sub_1006976F8(__int64 *a1, _BYTE *a2)
{
_QWORD *v4; // x0
_QWORD *v5; // x21
__int64 v6; // x22
void *v8; // x0
void *v9; // x0
__int64 v10; // x19
int *v11; // x0
const char *v12; // x0
v4 = off_1009E5FF0(1u, 0x170u);
v5 = v4;
a1[167] = (__int64)v4;
if ( !v4 )
return 27;
v6 = *(_QWORD *)(*a1 + 888);
if ( v6 )
{
if ( (unsigned int)(v6 - 8) > 0xFFB0 )
return 71;
}
else
{
LODWORD(v6) = 512;
}
if ( !v4[44] )
{
v8 = off_1009E5FF0(1u, (int)v6 + 4);
v5[44] = v8;
if ( !v8 )
return 27;
}
if ( !v5[45] )
{
v9 = off_1009E5FF0(1u, (int)v6 + 4);
v5[45] = v9;
if ( !v9 )
return 27;
}
*((_BYTE *)a1 + 737) = 1;
v5[2] = a1;
*((_DWORD *)v5 + 6) = *((_DWORD *)a1 + 116);
*(_DWORD *)v5 = 0;
*((_DWORD *)v5 + 2) = -100;
*((_DWORD *)v5 + 85) = 512;
*((_DWORD *)v5 + 86) = v6;
*((_BYTE *)v5 + 73) = *(_DWORD *)(a1[12] + 4);
sub_1006980F8(v5);
if ( !*((_BYTE *)a1 + 759) )
{
if ( bind(*((_DWORD *)v5 + 6), (const sockaddr *)(v5 + 9), *(_DWORD *)(a1[12] + 16)) )
{
v10 = *a1;
v11 = __error();
v12 = (const char *)sub_1006962D0((__int64)a1, *v11);
sub_10067889C(v10, "bind() failed; %s", v12);
return 7;
}
*((_BYTE *)a1 + 759) = 1;
}
sub_1006709DC(*a1);
*a2 = 1;
return 0;
}