Function at 0x3981226c0
Capabilities:
Connect socket
Get local ipv4 addresses
Get socket information

Disassembly:
push rbp
sub ecx, 1
mov rbp, rsp
push r15
push r14
xor r14d, r14d
push r13
push r12
push rdi
push rsi
push rbx
and rsp, 0xfffffffffffffff0
sub rsp, 0x60
cmp ecx, 1
seta r14b
or r14d, r8d
jne 0x398122978
mov rbx, r9
test r9, r9
je 0x39812298e
mov rsi, qword [sym.imp.WS2_32.dll_socket]
mov r13d, edx
xor r8d, r8d
mov ecx, 2
call rsi
mov r12, rax
test rax, rax
js 0x398122940
mov eax, 2
mov ecx, 0x7f000001
mov qword [rsp + 0x40], 0
lea r15, [rsp + 0x40]
mov qword [rsp + 0x48], 0
mov word [rsp + 0x40], ax
call qword [sym.imp.WS2_32.dll_htonl]
xor edx, edx
mov r8d, 0x10
mov rcx, r12
mov word [rsp + 0x42], dx
mov rdx, r15
mov dword [rsp + 0x44], eax
call qword [sym.imp.WS2_32.dll_bind]
cmp eax, 0xffffffff
je 0x398122908
mov edx, 1
mov rcx, r12
call qword [sym.imp.WS2_32.dll_listen]
cmp eax, 0xffffffff
je 0x398122908
mov edx, r13d
xor r8d, r8d
mov ecx, 2
call rsi
mov r13, rax
test rax, rax
js 0x398122950
mov rax, qword [sym.imp.WS2_32.dll_getsockname]
lea rsi, [rsp + 0x50]
mov rcx, r12
lea rdi, [rsp + 0x3c]
mov qword [rsp + 0x50], 0
mov r8, rdi
mov rdx, rsi
mov qword [rsp + 0x58], 0
mov dword [rsp + 0x3c], 0x10
mov qword [rsp + 0x28], rax
call rax
cmp eax, 0xffffffff
je 0x398122920
cmp dword [rsp + 0x3c], 0x10
jne 0x3981228c8
mov r8d, 0x10
mov rdx, rsi
mov rcx, r13
call qword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x398122920
mov rdx, r15
mov dword [rsp + 0x3c], 0x10
mov r8, rdi
mov rcx, r12
call qword [sym.imp.WS2_32.dll_accept]
mov r15, rax
test rax, rax
js 0x3981228e1
cmp dword [rsp + 0x3c], 0x10
jne 0x398122898
mov rax, qword [rsp + 0x28]
mov r8, rdi
mov rdx, rsi
mov rcx, r13
call rax
cmp eax, 0xffffffff
je 0x3981229a4
cmp dword [rsp + 0x3c], 0x10
jne 0x398122898
movzx eax, word [rsp + 0x50]
cmp word [rsp + 0x40], ax
jne 0x398122898
mov eax, dword [rsp + 0x54]
cmp dword [rsp + 0x44], eax
jne 0x398122898
movzx eax, word [rsp + 0x52]
cmp word [rsp + 0x42], ax
jne 0x398122898
mov rcx, r12
call qword [sym.imp.WS2_32.dll_closesocket]
mov qword [rbx], r13
mov qword [rbx + 8], r15
lea rsp, [rbp - 0x38]
mov eax, r14d
pop rbx
pop rsi
pop rdi
pop r12
pop r13
pop r14
pop r15
pop rbp
ret
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov rcx, r12
mov r14d, 0x2745
call rbx
mov rcx, r13
call rbx
mov rcx, r15
call rbx
mov ecx, r14d
mov r14d, 0xffffffff
call qword [sym.imp.WS2_32.dll_WSASetLastError]
jmp 0x398122881
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov rcx, r12
mov r14d, 0x2745
call rbx
mov rcx, r13
call rbx
jmp 0x3981228b4
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rcx, r12
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov r14d, eax
call rbx
mov rcx, r13
call rbx
cmp r15, 0xffffffffffffffff
je 0x3981228b4
jmp 0x3981228af
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rcx, r12
mov r14d, eax
call qword [sym.imp.WS2_32.dll_closesocket]
jmp 0x3981228b4
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov rcx, r12
mov r14d, eax
call rbx
mov rcx, r13
call rbx
jmp 0x3981228b4
mov r14d, 0xffffffff
jmp 0x398122881
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov rcx, r12
mov r14d, eax
call rbx
cmp r13, 0xffffffffffffffff
je 0x3981228b4
jmp 0x398122935
mov ecx, 0x273f
mov r14d, 0xffffffff
call qword [sym.imp.WS2_32.dll_WSASetLastError]
jmp 0x398122881
mov ecx, 0x2726
mov r14d, 0xffffffff
call qword [sym.imp.WS2_32.dll_WSASetLastError]
jmp 0x398122881
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov rcx, r12
mov rbx, qword [sym.imp.WS2_32.dll_closesocket]
mov r14d, eax
call rbx
mov rcx, r13
call rbx
jmp 0x3981228af