//
// sub_64763C from 0x64763c to 0x647720 (228 bytes)
//
// 1 xrefs:
// > sub_64A6CC @ 0x64a994
//
// 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_64763C(_DWORD *a1, _DWORD *a2)
{
int v2; // r2
int v3; // r3
int v5; // r1
int v7; // r7
_DWORD v9[3]; // [sp+Ch] [bp-Ch] BYREF
v2 = a2[57];
v3 = a1[1139];
v5 = a1[1138];
v9[0] = v2;
v9[1] = 1;
v9[2] = 0;
if ( v5 >= v3 )
{
lws_log(1, "Too many fds (%d)\n", v3);
return 1;
}
else if ( v2 >= v3 )
{
lws_log(1, "Socket fd %d is too high (%d)\n", v2, v3);
return 1;
}
else
{
if ( (*(int (__fastcall **)(_DWORD *, int, _DWORD, _DWORD *, int))(a1[11] + 4))(a2, 35, a2[48], v9, 1) )
return -1;
*(_DWORD *)(a1[7] + 4 * a2[57]) = a2;
v7 = a2[57];
a2[59] = a1[1138];
*(_DWORD *)(a1[6] + 8 * a1[1138]) = v7;
*(_WORD *)(a1[6] + 8 * a1[1138] + 4) = 1;
lws_plat_insert_socket_into_fds(a1, a2);
if ( (*(int (__fastcall **)(_DWORD *, int, _DWORD, _DWORD *, _DWORD))(a1[11] + 4))(a2, 32, a2[48], v9, 0) )
return -1;
else
return -((*(int (__fastcall **)(_DWORD *, int, _DWORD, _DWORD *, int))(a1[11] + 4))(a2, 36, a2[48], v9, 1) != 0);
}
}