{"type": "func", "start": 6443540832, "end": 6443541060, "name": "sub_18010A160", "pseudocode": "// \n// sub_18010A160 from 0x18010a160 to 0x18010a244 (228 bytes)\n// \n// 2 xrefs:\n// > sub_1800DA550 @ 0x1800da5a2\n// > <???> @ 0x18020179c\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 10:54:32 +0000\n// \n\n__int64 __fastcall sub_18010A160(u_short a1, __int64 a2, SOCKET *a3)\n{\n  SOCKET v5; // rax\n  SOCKET v6; // rbx\n  unsigned int v7; // edi\n  struct sockaddr name; // [rsp+20h] [rbp-48h] BYREF\n\n  v5 = socket(2, 1, 0);\n  v6 = v5;\n  if ( v5 == -1 )\n  {\nLABEL_6:\n    v7 = 43;\n    goto LABEL_7;\n  }\n  v7 = sub_18010A300(v5);\n  if ( !v7 )\n  {\n    *(_QWORD *)&name.sa_data[6] = 0;\n    name.sa_family = 2;\n    *(_WORD *)name.sa_data = htons(a1);\n    *(_DWORD *)&name.sa_data[2] = htonl(0);\n    if ( bind(v6, &name, 16) == -1 )\n    {\n      WSAGetLastError();\n    }\n    else if ( listen(v6, 3) != -1 )\n    {\n      *a3 = v6;\n      return 0;\n    }\n    goto LABEL_6;\n  }\nLABEL_7:\n  if ( v6 != -1 )\n    closesocket(v6);\n  return v7;\n}", "assembly": "; \n; sub_18010A160 from 0x18010a160 to 0x18010a244 (228 bytes)\n; \n; 2 xrefs:\n; > sub_1800DA550 @ 0x1800da5a2\n; > <???> @ 0x18020179c\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 10:54:32 +0000\n; \npush    rbx                                                            ; +0x0, 0x18010a160\npush    rbp                                                            ; +0x2, 0x18010a162\npush    rsi                                                            ; +0x3, 0x18010a163\npush    rdi                                                            ; +0x4, 0x18010a164\npush    r14                                                            ; +0x5, 0x18010a165\nsub     rsp, 40h                                                       ; +0x7, 0x18010a167\nmov     rax, cs:__security_cookie                                      ; +0xb, 0x18010a16b\nxor     rax, rsp                                                       ; +0x12, 0x18010a172\nmov     [rsp+68h+var_38], rax                                          ; +0x15, 0x18010a175\nmov     rsi, r8                                                        ; +0x1a, 0x18010a17a\nmovzx   edi, dl                                                        ; +0x1d, 0x18010a17d\nxor     r8d, r8d; protocol                                             ; +0x20, 0x18010a180\nmovzx   ebp, cx                                                        ; +0x23, 0x18010a183\nmov     r14d, 2                                                        ; +0x26, 0x18010a186\nmov     ecx, r14d; af                                                  ; +0x2c, 0x18010a18c\nlea     edx, [r8+1]; type                                              ; +0x2f, 0x18010a18f\ncall    cs:socket                                                      ; +0x33, 0x18010a193\nmov     rbx, rax                                                       ; +0x39, 0x18010a199\ncmp     rax, 0FFFFFFFFFFFFFFFFh                                        ; +0x3c, 0x18010a19c\njz      short loc_18010A20F                                            ; +0x40, 0x18010a1a0\nmovzx   edx, dil                                                       ; +0x42, 0x18010a1a2\nmov     rcx, rax; s                                                    ; +0x46, 0x18010a1a6\ncall    sub_18010A300                                                  ; +0x49, 0x18010a1a9\nmov     edi, eax                                                       ; +0x4e, 0x18010a1ae\ntest    eax, eax                                                       ; +0x50, 0x18010a1b0\njnz     short loc_18010A214                                            ; +0x52, 0x18010a1b2\nmovzx   ecx, bp; hostshort                                             ; +0x54, 0x18010a1b4\nmov     qword ptr [rsp+68h+name.sa_data+6], 0                          ; +0x57, 0x18010a1b7\nmov     [rsp+68h+name.sa_family], r14w                                 ; +0x60, 0x18010a1c0\ncall    cs:htons                                                       ; +0x66, 0x18010a1c6\nxor     ecx, ecx; hostlong                                             ; +0x6c, 0x18010a1cc\nmov     word ptr [rsp+68h+name.sa_data], ax                            ; +0x6e, 0x18010a1ce\ncall    cs:htonl                                                       ; +0x73, 0x18010a1d3\nlea     r8d, [r14+0Eh]; namelen                                        ; +0x79, 0x18010a1d9\nmov     rcx, rbx; s                                                    ; +0x7d, 0x18010a1dd\nlea     rdx, [rsp+68h+name]; name                                      ; +0x80, 0x18010a1e0\nmov     dword ptr [rsp+68h+name.sa_data+2], eax                        ; +0x85, 0x18010a1e5\ncall    cs:bind                                                        ; +0x89, 0x18010a1e9\ncmp     eax, 0FFFFFFFFh                                                ; +0x8f, 0x18010a1ef\njnz     short loc_18010A1FC                                            ; +0x92, 0x18010a1f2\ncall    cs:WSAGetLastError                                             ; +0x94, 0x18010a1f4\njmp     short loc_18010A20F                                            ; +0x9a, 0x18010a1fa\nmov     edx, 3; backlog                                                ; +0x9c, 0x18010a1fc\nmov     rcx, rbx; s                                                    ; +0xa1, 0x18010a201\ncall    cs:listen                                                      ; +0xa4, 0x18010a204\ncmp     eax, 0FFFFFFFFh                                                ; +0xaa, 0x18010a20a\njnz     short loc_18010A227                                            ; +0xad, 0x18010a20d\nmov     edi, 2Bh ; '+'                                                 ; +0xaf, 0x18010a20f\ncmp     rbx, 0FFFFFFFFFFFFFFFFh                                        ; +0xb4, 0x18010a214\njz      short loc_18010A223                                            ; +0xb8, 0x18010a218\nmov     rcx, rbx; s                                                    ; +0xba, 0x18010a21a\ncall    cs:closesocket                                                 ; +0xbd, 0x18010a21d\nmov     eax, edi                                                       ; +0xc3, 0x18010a223\njmp     short loc_18010A22C                                            ; +0xc5, 0x18010a225\nmov     [rsi], rbx                                                     ; +0xc7, 0x18010a227\nxor     eax, eax                                                       ; +0xca, 0x18010a22a\nmov     rcx, [rsp+68h+var_38]                                          ; +0xcc, 0x18010a22c\nxor     rcx, rsp; StackCookie                                          ; +0xd1, 0x18010a231\ncall    __security_check_cookie                                        ; +0xd4, 0x18010a234\nadd     rsp, 40h                                                       ; +0xd9, 0x18010a239\npop     r14                                                            ; +0xdd, 0x18010a23d\npop     rdi                                                            ; +0xdf, 0x18010a23f\npop     rsi                                                            ; +0xe0, 0x18010a240\npop     rbp                                                            ; +0xe1, 0x18010a241\npop     rbx                                                            ; +0xe2, 0x18010a242\nretn                                                                   ; +0xe3, 0x18010a243", "xrefs": ["sub_1800DA550 @ 0x1800da5a2", "<???> @ 0x18020179c"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}