Function at 0x180143010
Capabilities:
Connect socket
Get thread local storage value

Disassembly:
mov qword [rsp + 0x18], rbp
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x30
mov r15d, dword [rdx + 0x10]
mov r12, rcx
mov rax, qword [0x1801902f8]
mov ebp, r15d
mov rdi, rdx
and ebp, 2
and r15d, 0x10
mov ecx, dword [rax]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
movsxd rcx, dword [0x180190508]
xor r14d, r14d
test rax, rax
je 0x180143064
test ecx, ecx
jle 0x180143064
cmp ecx, dword [rax + 8]
jge 0x180143064
mov rax, qword [rax]
mov r14, qword [rax + rcx*8]
mov qword [rsp + 0x60], rbx
lea r13, [0x180000000]
mov qword [rsp + 0x68], rsi
test r15d, r15d
je 0x1801430a8
and dword [rdi + 0x10], 0xffffffef
mov edx, 0xffffffff
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov ecx, dword [rdi + 0x60]
call sym.tcl86t.dll_hclWinConvertError
and dword [rdi + 0x1c], 0xffffffef
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_SetEvent]
jmp 0x1801432b1
mov rax, qword [rdi + 0x38]
mov qword [rdi + 0x40], rax
test rax, rax
je 0x1801432e5
mov rcx, qword [rdi + 0x48]
mov rax, qword [rdi + 0x40]
mov qword [rdi + 0x50], rcx
test rcx, rcx
je 0x1801432d1
mov eax, dword [rax + 4]
cmp dword [rcx + 4], eax
jne 0x1801432c4
mov rax, qword [rdi + 8]
mov rcx, qword [rax + 8]
cmp rcx, 0xffffffffffffffff
je 0x1801430ee
call qword [sym.imp.WS2_32.dll_closesocket]
mov rcx, qword [r14 + 0x20]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov dword [rdi + 0x60], 0
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
xor r8d, r8d
mov dword [rax], 0
mov rax, qword [rdi + 0x50]
lea edx, [r8 + 1]
mov ecx, dword [rax + 4]
call qword [sym.imp.WS2_32.dll_socket]
mov rcx, qword [rdi + 8]
mov qword [rcx + 8], rax
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rax, qword [rdi + 8]
mov rcx, qword [rax + 8]
cmp rcx, 0xffffffffffffffff
jne 0x1801431b2
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x10c
jb 0x180143192
add eax, 0xffffd8cd
cmp eax, 0x25
jb 0x180143174
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [rax], reloc.WS2_32.dll_shutdown
mov rax, qword [rdi + 0x50]
mov rcx, qword [rax + 0x28]
jmp 0x1801430bd
movzx ebx, byte [rax + r13 + 0x15ea88]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [rax], ebx
mov rax, qword [rdi + 0x50]
mov rcx, qword [rax + 0x28]
jmp 0x1801430bd
mov eax, eax
movzx ebx, byte [rax + r13 + 0x15f8f0]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [rax], ebx
mov rax, qword [rdi + 0x50]
mov rcx, qword [rax + 0x28]
jmp 0x1801430bd
xor r8d, r8d
lea edx, [r8 + 1]
call qword [sym.imp.KERNEL32.dll_SetHandleInformation]
mov rcx, qword [rdi + 8]
mov edx, 0x1000
mov rcx, qword [rcx + 8]
call sym.tcl86t.dll_hclSockMinimumBuffers
mov rdx, qword [rdi + 0x50]
mov rcx, qword [rdi + 8]
mov r8d, dword [rdx + 0x10]
mov rdx, qword [rdx + 0x20]
mov rcx, qword [rcx + 8]
call qword [sym.imp.WS2_32.dll_bind]
cmp eax, 0xffffffff
je 0x180143144
test ebp, ebp
je 0x180143247
mov rcx, qword [r14 + 0x20]
mov edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov rax, qword [r14 + 0x30]
test rax, rax
je 0x18014321e
cmp rax, rdi
je 0x180143222
mov rax, qword [rax + 0x68]
test rax, rax
jne 0x180143210
mov qword [r14 + 0x28], rdi
or dword [rdi + 0x1c], 0x10
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_SetEvent]
mov rcx, qword [r14]
mov r9, rdi
mov edx, 0x402
mov r8d, 1
call qword [sym.imp.USER32.dll_SendMessageW]
mov rdx, qword [rdi + 0x40]
mov rcx, qword [rdi + 8]
mov r8d, dword [rdx + 0x10]
mov rdx, qword [rdx + 0x20]
mov rcx, qword [rcx + 8]
call qword [sym.imp.WS2_32.dll_connect]
call qword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
cmp eax, 0x10c
jb 0x180143294
lea eax, [rsi - 0x2733]
cmp eax, 0x25
jb 0x180143289
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [rax], reloc.WS2_32.dll_shutdown
jmp 0x1801432a5
movzx ebx, byte [rax + r13 + 0x15ea88]
jmp 0x18014329d
movzx ebx, byte [rsi + r13 + 0x15f8f0]
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [rax], ebx
test ebp, ebp
je 0x1801432b1
cmp esi, 0x2733
je 0x1801432da
mov qword [r14 + 0x28], 0
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [rax], 0
je 0x1801432e5
mov rax, qword [rdi + 0x50]
mov rcx, qword [rax + 0x28]
jmp 0x1801430bd
mov rax, qword [rax + 0x28]
jmp 0x1801430ac
or dword [rdi + 0x10], 0x10
xor eax, eax
jmp 0x1801433ad
and dword [rdi + 0x10], 0xfffffffd
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [rax], 0
jne 0x180143319
mov dword [rdi + 0x1c], 0x23
mov r9, rdi
mov rcx, qword [r14]
mov edx, 0x402
mov r8d, 1
call qword [sym.imp.USER32.dll_SendMessageW]
xor eax, eax
jmp 0x1801433ad
test r15d, r15d
je 0x180143356
mov dword [rdi + 0x1c], 3
mov edx, 0xffffffff
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [rdi + 0x18]
or dword [rdi + 0x10], 0x20
or eax, 3
mov dword [rdi + 0x18], eax
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [rax]
mov dword [rdi + 0x58], ecx
mov rcx, qword [r14 + 0x20]
call qword [sym.imp.KERNEL32.dll_SetEvent]
test r12, r12
je 0x1801433a8
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [rax]
call sym.tcl86t.dll_hcl_ErrnoMsg
mov rbx, rax
call sym.tcl86t.dll_hcl_ErrnoId
mov r9, rbx
mov qword [rsp + 0x20], 0
mov r8, rax
lea rdx, str.POSIX
mov rcx, r12
call sym.tcl86t.dll_hcl_SetErrorCode
mov rdx, rbx
lea rcx, str.couldnt_open_socket:__s
call sym.tcl86t.dll_hcl_ObjPrintf
mov rdx, rax
mov rcx, r12
call sym.tcl86t.dll_hcl_SetObjResult
mov eax, 1
mov rsi, qword [rsp + 0x68]
mov rbx, qword [rsp + 0x60]
mov rbp, qword [rsp + 0x70]
add rsp, 0x30
pop r15
pop r14
pop r13
pop r12
pop rdi
ret