//
// lws_interface_to_sa from 0x64c220 to 0x64c2e2 (194 bytes)
//
// 1 xrefs:
// > interface_to_sa @ 0x646564
//
// 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 lws_interface_to_sa(int a1, const char *a2, int a3)
{
int *v6; // r8
int **v7; // r4
int *v8; // r5
int v9; // r3
_DWORD *v10; // r5
int v11; // t1
int *v12; // r0
int v13; // r4
int v14; // r1
int v15; // r2
int result; // r0
int v17; // r1
int v18; // r2
int v19; // r3
int *v20; // [sp+4h] [bp-8h] BYREF
sub_64CDE0(&v20);
v6 = v20;
if ( v20 )
{
v7 = (int **)v20;
do
{
v8 = v7[3];
if ( v8 && !strcmp((const char *)v7[1], a2) )
{
v9 = *(unsigned __int16 *)v8;
if ( v9 == 2 )
{
if ( a1 )
{
memset((void *)(a3 + 8), 0, 0x10u);
*(_BYTE *)(a3 + 18) = -1;
*(_BYTE *)(a3 + 19) = -1;
v12 = v20;
*(_DWORD *)(a3 + 20) = v7[3][1];
}
else
{
v12 = v6;
v17 = v8[1];
v18 = v8[2];
v19 = v8[3];
*(_DWORD *)a3 = *v8;
*(_DWORD *)(a3 + 4) = v17;
*(_DWORD *)(a3 + 8) = v18;
*(_DWORD *)(a3 + 12) = v19;
}
LABEL_8:
sub_64CF8C(v12);
return 0;
}
if ( v9 == 10 )
{
v11 = v8[2];
v10 = v8 + 2;
v12 = v6;
v13 = v10[1];
v14 = v10[2];
v15 = v10[3];
*(_DWORD *)(a3 + 8) = v11;
*(_DWORD *)(a3 + 12) = v13;
*(_DWORD *)(a3 + 16) = v14;
*(_DWORD *)(a3 + 20) = v15;
goto LABEL_8;
}
}
v7 = (int **)*v7;
}
while ( v7 );
}
sub_64CF8C(v6);
if ( inet_pton(10, a2, (void *)(a3 + 8)) == 1 )
return 0;
result = inet_pton(2, a2, (void *)(a3 + 4)) - 1;
if ( result )
return -1;
return result;
}