Skip to content

Instantly share code, notes, and snippets.

@xyzz
Created April 16, 2017 15:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyzz/457305ed049e45df183f95515c2345d0 to your computer and use it in GitHub Desktop.
Save xyzz/457305ed049e45df183f95515c2345d0 to your computer and use it in GitHub Desktop.
int __fastcall bnet_socket_sanity_check(int sock)
{
int sock_; // r4@1
int result; // r0@1
unsigned int vptr; // r3@4
unsigned int v4; // r1@5
unsigned int v5; // r2@5
int v6; // r1@5
int v7; // r2@6
int v8; // r0@9
const char *v9; // r1@9
unsigned int v10; // r2@10
unsigned int v11; // r0@11
int v12; // r1@12
int v13; // r0@15
const char *v14; // r1@15
unsigned int v15; // r2@16
unsigned int v16; // r0@17
int v17; // r1@18
int v18; // r0@21
const char *v19; // r1@21
unsigned int v20; // r2@22
unsigned int v21; // r1@23
bool v22; // r1@23
int v23; // r3@24
int v24; // r0@27
const char *v25; // r1@27
int v26; // r0@30
const char *v27; // r1@30
int v28; // r0@31
const char *v29; // r1@31
int v30; // r0@32
const char *v31; // r1@32
sock_ = sock;
result = sub_1EC5CD4(sock);
if ( !result )
{
LOWORD(v28) = -19088;
LOWORD(v29) = -18400;
HIWORD(v28) = (unsigned int)&loc_1EEB570;
HIWORD(v29) = (unsigned int)"bnet_socket_sanity_check";
crash(v28, v29);
}
if ( *(int (**)(int, int))(sock_ + 180) != sub_1ECD414 )
{
LOWORD(v26) = -18372;
LOWORD(v27) = -18400;
HIWORD(v26) = (unsigned int)dword_1EEB83C;
HIWORD(v27) = (unsigned int)"bnet_socket_sanity_check";
crash(v26, v27);
}
if ( *(int (**)(int, int))(sock_ + 0xB8) != sub_1ECD918 )
{
LOWORD(v30) = -18432;
LOWORD(v31) = -18400;
HIWORD(v30) = (unsigned int)dword_1EEB800;
HIWORD(v31) = (unsigned int)"bnet_socket_sanity_check";
crash(v30, v31);
}
vptr = *(_DWORD *)(sock_ + 24);
if ( vptr )
{
LOWORD(v4) = -32768;
LOWORD(v5) = -28580;
HIWORD(v4) = (unsigned int)&dword_1EA8000;
v6 = vptr < v4;
HIWORD(v5) = (unsigned int)&unk_1EA905C;
v7 = vptr > v5 ? v6 | 1 : v6;
if ( v7 )
{
LOWORD(v8) = -19084;
LOWORD(v9) = -18424;
HIWORD(v8) = (unsigned int)&loc_1EEB574;
HIWORD(v9) = (unsigned int)"bnet_protosw_check";
crash(v8, v9);
}
}
v10 = *(_DWORD *)(vptr + 28);
if ( v10 )
{
LOWORD(v11) = 0;
HIWORD(v11) = (unsigned int)sub_1EC0000;
result = v10 < v11;
v12 = v10 > 0x1F159C0 ? result | 1 : result;
if ( v12 )
{
LOWORD(v13) = -19096;
LOWORD(v14) = -18424;
HIWORD(v13) = (unsigned int)&loc_1EEB568;
HIWORD(v14) = (unsigned int)"bnet_protosw_check";
crash(v13, v14);
}
}
v15 = *(_DWORD *)(vptr + 16);
if ( v15 )
{
LOWORD(v16) = 0;
HIWORD(v16) = (unsigned int)sub_1EC0000;
result = v15 < v16;
v17 = v15 > 0x1F159C0 ? result | 1 : result;
if ( v17 )
{
LOWORD(v18) = -18404;
LOWORD(v19) = -18424;
HIWORD(v18) = (unsigned int)&unk_1EEB81C;
HIWORD(v19) = (unsigned int)"bnet_protosw_check";
crash(v18, v19);
}
}
v20 = *(_DWORD *)(vptr + 24);
if ( v20 )
{
LOWORD(v21) = 0;
HIWORD(v21) = (unsigned int)sub_1EC0000;
v22 = v20 < v21;
if ( v20 > 0x1F159C0 )
v23 = v22 | 1;
else
v23 = v22;
if ( v23 )
{
LOWORD(v24) = -18428;
LOWORD(v25) = -18424;
HIWORD(v24) = (unsigned int)&dword_1EEB800[1];
HIWORD(v25) = (unsigned int)"bnet_protosw_check";
crash(v24, v25);
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment