//
// sub_6239F4 from 0x6239f4 to 0x623a88 (148 bytes)
//
// 3 xrefs:
// > sub_618F58 @ 0x61922c
// > sub_62CC48 @ 0x62d05e
// > sub_62CC48 @ 0x62d25e
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_6239F4(int a1, int a2, int a3, char *a4, char *buf, socklen_t len)
{
_BOOL4 v6; // r0
int v7; // r4
size_t v9; // r6
int v11; // r7
void *v12; // r0
int cp; // [sp+4h] [bp-28h] BYREF
int v14[4]; // [sp+8h] [bp-24h] BYREF
int af; // [sp+18h] [bp-14h]
int v16; // [sp+1Ch] [bp-10h]
int v17; // [sp+20h] [bp-Ch]
int v18; // [sp+24h] [bp-8h]
v6 = a1 != 2;
if ( a4 )
v7 = v6;
else
v7 = v6 | 1;
if ( v7 )
return 0;
v9 = strlen(a4);
if ( v9 > 0xF )
return 0;
v11 = socket(2, 1, 0);
if ( v11 == -1 )
return 0;
memset(v14, 0, sizeof(v14));
af = 0;
v16 = 0;
v17 = 0;
v18 = 0;
v12 = memcpy(v14, a4, v9 + 1);
LOWORD(af) = 2;
if ( ioctl(v11, 0x8915u, v12) < 0 )
{
close(v11);
return 0;
}
else
{
cp = v16;
inet_ntop((unsigned __int16)af, &cp, buf, len);
close(v11);
return 2;
}
}