Function at 0x14039a100
Capabilities:
Connect socket
Get socket status

Disassembly:
mov r11, rsp
push rbp
push rsi
push r12
push r13
push r14
push r15
sub rsp, 0x488
mov rax, qword [0x14041f010]
xor rax, rsp
mov qword [rsp + 0x460], rax
mov esi, 0xffffffff
mov qword [r11 - 0x38], rbx
mov r14, r9
mov dword [rsp + 0x30], 1
mov r12d, r8d
mov qword [r11 - 0x40], rdi
mov r15, rdx
mov rbp, rcx
lea r13d, [rsi + 0x33]
nop dword [rax + rax]
test esi, esi
js 0x14039a15d
movsxd rcx, esi
call qword [sym.imp.WSOCK32.dll_closesocket]
movzx ecx, word [r15]
xor r8d, r8d
lea edx, [r8 + 1]
call qword [sym.imp.WSOCK32.dll_socket]
mov rsi, rax
cmp eax, 0xffffffff
je 0x14039a408
cmp dword [r14], 0
movsxd rdi, esi
jl 0x14039a19e
lea r8, [rsp + 0x30]
mov edx, 0x8004667e
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_ioctlsocket]
test eax, eax
js 0x14039a2d2
lea rdx, str.Connecting...
mov rcx, rbp
call fcn.1401522a0
mov r8d, r12d
mov rdx, r15
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_connect]
test eax, eax
je 0x14039a3e3
call fcn.140013154
mov rbx, rax
call qword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [rbx], eax
cmp dword [r14], 0
jl 0x14039a393
call fcn.140013154
cmp dword [rax], 0x2733
je 0x14039a209
call fcn.140013154
cmp dword [rax], 0x274d
je 0x14039a209
call fcn.140013154
cmp dword [rax], 0x2734
jne 0x14039a393
call fcn.140013154
cmp dword [rax], 0x274d
je 0x14039a387
mov ebx, dword [r14]
mov eax, 0x10624dd3
cmp ebx, r13d
mov qword [rsp + 0x258], rdi
mov dword [rsp + 0x250], 1
cmovg ebx, r13d
mov qword [rsp + 0x48], rdi
imul ebx
mov ecx, ebx
mov dword [rsp + 0x40], 1
sar edx, 6
mov r8d, ebx
mov eax, edx
shr eax, 0x1f
add edx, eax
imul eax, edx, 0x3e8
mov dword [rsp + 0x38], edx
lea rdx, str.Waiting_for_connection__waiting__d_msec_...
sub ecx, eax
imul eax, ecx, 0x3e8
mov rcx, rbp
mov dword [rsp + 0x3c], eax
call fcn.1401522a0
lea rax, [rsp + 0x38]
xor r9d, r9d
lea ecx, [rsi + 1]
mov qword [rsp + 0x20], rax
lea r8, [rsp + 0x40]
lea rdx, [rsp + 0x250]
call qword [sym.imp.WSOCK32.dll_select]
test eax, eax
js 0x14039a324
lea rdx, [rsp + 0x40]
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll___WSAFDIsSet]
test eax, eax
jne 0x14039a3e3
mov eax, dword [r14]
cmp eax, 1
jle 0x14039a307
cmp ebx, eax
jge 0x14039a307
sub eax, ebx
mov dword [r14], eax
jmp 0x14039a150
call fcn.140013154
mov rbx, rax
call qword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [rbx], eax
call fcn.140013154
lea rdx, str.channel_connect:_Connect_failed_with_errno__d
mov rcx, rbp
mov r8d, dword [rax]
call fcn.140151b80
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x14039a445
lea rdx, str.Connection_timed_out
mov rcx, rbp
call fcn.140151b80
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x14039a445
call fcn.140013154
mov rbx, rax
call qword [sym.imp.WSOCK32.dll_WSAGetLastError]
mov dword [rbx], eax
call fcn.140013154
lea rdx, str.channel_connect:_Connect_failed_with_errno__d
mov rcx, rbp
mov r8d, dword [rax]
call fcn.140151b80
call fcn.140013154
mov ecx, dword [rax]
call fcn.14039a5e0
lea rcx, str.E902:_Cannot_connect_to_port
mov rbx, rax
call qword [case.0x1400407ae.0]
mov r8, rbx
lea rcx, str._s:__s
mov rdx, rax
call fcn.1401860c0
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x14039a445
lea rdx, str.channel_connect:_Connection_refused
jmp 0x14039a30e
call fcn.140013154
lea rdx, str.channel_connect:_Connect_failed_with_errno__d
mov rcx, rbp
mov r8d, dword [rax]
call fcn.140151b80
call fcn.140013154
mov ecx, dword [rax]
call fcn.14039a5e0
lea rcx, str.E902:_Cannot_connect_to_port
mov rbx, rax
call qword [case.0x1400407ae.0]
mov r8, rbx
lea rcx, str._s:__s
mov rdx, rax
call fcn.1401860c0
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_closesocket]
jmp 0x14039a445
cmp dword [r14], 0
jl 0x14039a404
lea r8, [rsp + 0x30]
mov dword [rsp + 0x30], 0
mov edx, 0x8004667e
mov rcx, rdi
call qword [sym.imp.WSOCK32.dll_ioctlsocket]
mov eax, esi
jmp 0x14039a44a
lea rdx, str.in_socket___in_channel_connect__.
mov rcx, rbp
call fcn.140151b80
call fcn.140013154
mov ecx, dword [rax]
call fcn.14039a5e0
lea rcx, str.E898:_socket___in_channel_connect__
mov rbx, rax
call qword [case.0x1400407ae.0]
mov r8, rbx
lea rcx, str._s:__s
mov rdx, rax
call fcn.1401860c0
mov eax, 0xffffffff
mov rdi, qword [rsp + 0x478]
mov rbx, qword [rsp + 0x480]
mov rcx, qword [rsp + 0x460]
xor rcx, rsp
call fcn.140001200
add rsp, 0x488
pop r15
pop r14
pop r13
pop r12
pop rsi
pop rbp
ret