//
// sub_100691AF0 from 0x100691af0 to 0x100691c0c (284 bytes)
//
// 1 xrefs:
// > sub_10067D2FC @ 0x10067d4a8
//
// 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:32 +0000
//
__int64 __fastcall sub_100691AF0(__int64 *a1, __int64 a2, int *a3, int *a4)
{
__int64 v6; // x24
int *v7; // x21
int v8; // w8
int v9; // w8
unsigned int v10; // w8
size_t v11; // x2
__int64 (__fastcall *v12)(_QWORD, _QWORD, int *); // x8
int v13; // w0
int v14; // w8
__int64 result; // x0
char v16; // [xsp+8h] [xbp-C8h] BYREF
v6 = *a1;
if ( a3 )
v7 = a3;
else
v7 = (int *)&v16;
*v7 = *(_DWORD *)(a2 + 4);
v8 = *((_DWORD *)a1 + 43);
v7[1] = v8;
if ( v8 == 2 )
v9 = 17;
else
v9 = *(_DWORD *)(a2 + 12);
v7[2] = v9;
v10 = *(_DWORD *)(a2 + 16);
if ( v10 <= 0x80 )
v11 = v10;
else
v11 = 128;
v7[3] = v11;
memcpy(v7 + 4, *(const void **)(a2 + 32), v11);
v12 = *(__int64 (__fastcall **)(_QWORD, _QWORD, int *))(v6 + 776);
if ( v12 )
v13 = v12(*(_QWORD *)(v6 + 784), 0, v7);
else
v13 = socket(*v7, v7[1], v7[2]);
*a4 = v13;
if ( v13 == -1 )
return 7;
v14 = *((_DWORD *)a1 + 42);
if ( !v14 )
return 0;
result = 0;
if ( *v7 == 30 )
v7[10] = v14;
return result;
}