Function at 0x140040c90
Capabilities:
Allocate thread local storage
Get thread local storage value
Set thread local storage value
Write file on windows

Disassembly:
mov qword [rsp + 8], rcx
mov qword [rsp + 0x10], rdx
mov qword [rsp + 0x18], r8
mov qword [rsp + 0x20], r9
push rbp
push rbx
push rdi
push r12
push r14
push r15
lea rbp, [rsp - 0x7d8]
sub rsp, 0x8d8
mov rax, qword [0x140116008]
xor rax, rsp
mov qword [rbp + 0x7b0], rax
lea rbx, [rsp + 0x71]
lea rcx, [rsp + 0x40]
mov qword [rsp + 0x38], rbx
call fcn.140052f0c
mov eax, dword [0x140117128]
cmp eax, 0xffffffff
jne 0x140040cf8
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x140117128], eax
mov ecx, eax
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov r12, rax
test rax, rax
jne 0x140040d29
mov r12d, dword [reloc.WS2_32.dll_accept]
mov ecx, dword [0x140117128]
mov edx, r12d
lea eax, [r12 + 1]
mov dword [reloc.WS2_32.dll_accept], eax
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
lea rdx, [rsp + 0x40]
lea rcx, [rsp + 0x48]
call fcn.14005a500
lea r9, [rsp + 0x48]
mov edx, 0x40
lea r8, str.__Y__m__d__H:_M:_S_
lea rcx, [rsp + 0x71]
call fcn.14005a8f8
mov r14, 0xffffffffffffffff
lea rcx, [rsp + 0x71]
mov rax, r14
inc rax
cmp byte [rcx + rax], 0
jne 0x140040d62
lea rcx, [rsp + 0x71]
mov r9d, r12d
add rcx, rax
lea rdx, [rbp - 0x50]
sub rdx, rcx
lea r8, str.__02x_
lea rdi, [rbp + 0x818]
call fcn.140040c30
call fcn.14000a500
mov r9, qword [rbp + 0x810]
lea rdx, [rbp - 0x50]
mov qword [rsp + 0x28], rdi
mov r8d, 0x800
xor edi, edi
mov rcx, qword [rax]
mov qword [rsp + 0x20], rdi
call fcn.14005940c
lea rax, [rbp - 0x50]
mov r15, r14
inc r15
cmp byte [rax + r15], dil
jne 0x140040dc1
test r15, r15
je 0x140041091
mov rcx, qword [0x1409641f8]
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [0x1401186bc]
cmp eax, r12d
jne 0x140040df5
mov byte [rsp + 0x71], dil
jmp 0x140040e78
test eax, eax
je 0x140040e78
lea rbx, [rsp + 0x70]
mov byte [rsp + 0x70], 0xa
mov qword [rsp + 0x38], rbx
lea rax, [rsp + 0x70]
mov ecx, edi
nop
cmp ecx, 0x800
jae 0x140040e22
inc rax
inc ecx
cmp byte [rax], dil
jne 0x140040e10
lea eax, [rcx + 1]
cmp eax, 0x800
jbe 0x140040e55
lea r9, str.ymemory
mov dword [rsp + 0x20], 0x164
lea r8, str.YPANIC:_s:_d_n
mov edx, 0x164
lea rcx, str.ymemory
call fcn.14000a9a0
jmp 0x140040e78
mov eax, ecx
lea r8, str._..._
mov edx, 0x800
mov r9d, 0x800
sub edx, ecx
lea rcx, [rsp + 0x70]
add rcx, rax
call fcn.1400217c0
mov rdx, qword [0x1401186c0]
test rdx, rdx
je 0x140040f02
lea r8, [0x14010cd3c]
lea rcx, [rsp + 0x30]
call fcn.140059800
test eax, eax
jne 0x140040edd
mov r8, r14
nop dword [rax]
inc r8
cmp byte [rbx + r8], dil
jne 0x140040ea0
mov r9, qword [rsp + 0x30]
mov edx, 1
mov rcx, rbx
call fcn.1400596c0
mov r9, qword [rsp + 0x30]
lea rcx, [rbp - 0x50]
mov r8, r15
mov edx, 1
call fcn.1400596c0
mov rcx, qword [rsp + 0x30]
call fcn.140056f18
jmp 0x140040f02
call fcn.140059eec
mov ecx, dword [rax]
call fcn.14005a914
mov r8, qword [0x1401186c0]
lea rcx, str._sUnable_to_save_log_to_file__s___s__n
mov r9, rax
mov rdx, rbx
call fcn.140021b20
lea rax, [rbp - 0x50]
inc r14
cmp byte [rax + r14], dil
jne 0x140040f06
mov rcx, qword [0x140964240]
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
movzx r8d, word [0x140964220]
movzx edx, word [0x140964222]
movzx eax, r8w
sub ax, dx
cmp r14w, r8w
jbe 0x140040f40
movzx eax, di
jmp 0x14004103a
mov qword [rsp + 0x8c8], r13
mov r13, qword [0x140964228]
movzx r9d, r8w
cmp r14w, ax
jbe 0x140040fab
mov rbx, qword [0x140964230]
lea r10, [r9 + r13]
movzx ecx, r14w
sub cx, ax
movzx eax, dx
cmp cx, dx
cmovbe ax, cx
movzx r11d, ax
lea rcx, [r11 + rbx]
cmp rcx, r10
jbe 0x140040f94
sub r10, rbx
mov ecx, r11d
movzx eax, r10w
sub rcx, rax
add rcx, r13
jmp 0x140040f99
jne 0x140040f99
sub rcx, r9
sub dx, r11w
mov qword [0x140964230], rcx
mov word [0x140964222], dx
mov rcx, qword [0x140964238]
lea rbx, [r9 + r13]
sub r8w, dx
cmp r14w, r8w
jbe 0x140040fc4
mov eax, edi
jmp 0x140041032
movzx r8d, r14w
lea rdx, [rbp - 0x50]
lea rdi, [r8 + rcx]
cmp rdi, rbx
ja 0x140040fe3
call fcn.140050fe0
cmp rdi, rbx
cmovne r13, rdi
jmp 0x14004101d
sub bx, cx
mov qword [rsp + 0x8d0], rsi
movzx esi, bx
mov r8d, esi
call fcn.140050fe0
movzx ebx, r14w
lea rdx, [rbp - 0x50]
sub rbx, rsi
add rdx, rsi
mov r8, rbx
mov rcx, r13
call fcn.140050fe0
mov rsi, qword [rsp + 0x8d0]
add r13, rbx
add word [0x140964222], r14w
movzx eax, r14w
xor edi, edi
mov qword [0x140964238], r13
mov r13, qword [rsp + 0x8c8]
mov rcx, qword [0x140964240]
movzx eax, ax
add dword [0x140964200], eax
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov rdx, qword [rsp + 0x38]
lea r8, [rbp - 0x50]
lea rcx, str._s_s
call fcn.140021b20
movzx eax, byte [rbp + r15 - 0x51]
cmp al, 0xd
je 0x140041073
cmp al, 0xa
jne 0x14004107d
or byte [0x14095e5bf], 0x10
mov r12d, edi
mov rcx, qword [0x1409641f8]
mov dword [0x1401186bc], r12d
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov rcx, qword [rbp + 0x7b0]
xor rcx, rsp
call fcn.14004ee60
add rsp, 0x8d8
pop r15
pop r14
pop r12
pop rdi
pop rbx
pop rbp
ret