Function at 0x140014ad0
Capabilities:
Allocate thread local storage

Disassembly:
sub rsp, 0x28
xor r9d, r9d
xor edx, edx
xor ecx, ecx
mov r8d, 0xffff
mov dword [0x1400dbc20], 0xffffffff
call qword [sym.imp.KERNEL32.dll_CreateSemaphoreW]
mov qword [0x1400dbc28], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
cmp eax, 0xffffffff
je 0x140014b20
lea rdx, [0x1400149f0]
mov ecx, eax
mov dword [0x1400dbc18], eax
call fcn.140021b80
test eax, eax
jne 0x140014b28
add rsp, 0x28
ret
call qword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x140014b17
call sub.msvcrt.dll_abort
nop
nop
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x28
mov rsi, qword [0x1400b45e0]
mov rbx, rcx
mov r11d, dword [rsi]
test r11d, r11d
jne 0x140014b64
mov rax, qword [rcx + 0x10]
test rax, rax
je 0x140014bc1
add rsp, 0x28
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
ret
mov rdi, qword [rcx + 0x10]
test rdi, rdi
je 0x140014c10
mov esi, dword [0x1400dbc18]
mov rbp, qword [sym.imp.KERNEL32.dll_GetLastError]
call rbp
mov r12d, eax
mov ecx, esi
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rsi, rax
mov ecx, r12d
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rsi, rsi
je 0x140014bd0
mov r12, qword [rsi]
cmp rdi, r12
ja 0x140014c80
lea rsi, [rsi + rdi*8]
mov rax, qword [rsi]
test rax, rax
jne 0x140014b57
mov rcx, rbx
call fcn.140014a30
mov qword [rsi], rax
jmp 0x140014b57
call fcn.140014a30
mov qword [rbx + 0x10], rax
jmp 0x140014b57
lea rcx, [rdi + 0x21]
mov edx, 8
lea r12, [rdi + 0x20]
call sub.msvcrt.dll_calloc
test rax, rax
mov rsi, rax
je 0x140014d6f
mov qword [rax], r12
mov rdx, rsi
mov ecx, dword [0x1400dbc18]
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
jne 0x140014ba8
call rbp
jmp 0x140014ba8
mov r10d, dword [rsi]
test r10d, r10d
je 0x140014c36
mov r9d, dword [0x1400ac090]
test r9d, r9d
je 0x140014d32
lock add dword [0x1400dbc20], 1
jne 0x140014d0b
mov rdi, qword [rbx + 0x10]
test rdi, rdi
je 0x140014cf0
mov eax, dword [rsi]
test eax, eax
je 0x140014b71
mov eax, 0xffffffff
lock xadd dword [0x1400dbc20], eax
sub eax, 1
js 0x140014b71
xor r8d, r8d
mov edx, 1
mov rcx, qword [0x1400dbc28]
call qword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
jmp 0x140014b71
lea r13, [r12 + r12]
lea rax, [rdi + 0x20]
mov rcx, rsi
cmp rdi, r13
cmova r13, rax
lea rdx, [r13*8 + 8]
call sub.msvcrt.dll_realloc
test rax, rax
mov rsi, rax
je 0x140014d6f
mov qword [rax], r13
sub r13, r12
lea rcx, [rax + r12*8 + 8]
lea r8, [r13*8]
xor edx, edx
call sub.msvcrt.dll_memset
jmp 0x140014bf1
call fcn.140014ad0
mov dword [0x1400ac090], 1
mov edx, dword [rsi]
test edx, edx
jne 0x140014c28
mov rdi, qword [rbx + 0x10]
test rdi, rdi
jne 0x140014b71
mov rax, qword [0x1400dbc10]
lea rdi, [rax + 1]
mov qword [0x1400dbc10], rdi
mov qword [rbx + 0x10], rdi
jmp 0x140014c43
mov edx, 0xffffffff
mov rcx, qword [0x1400dbc28]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x140014c36
lock sub dword [0x1400dbc20], 1
jmp 0x140014c36
lock add dword [0x1400ac094], 1
je 0x140014cca
mov r8d, dword [0x1400ac090]
mov rbp, qword [sym.imp.KERNEL32.dll_Sleep]
lea rdi, [0x1400ac090]
test r8d, r8d
jne 0x140014cd9
nop word cs:[rax + rax]
xor ecx, ecx
call rbp
mov ecx, dword [rdi]
test ecx, ecx
je 0x140014d60
jmp 0x140014cd9
call sub.msvcrt.dll_abort
nop
nop
nop word cs:[rax + rax]
cmp qword [rcx], rdx
jae 0x140014d90
mov qword [rcx], rdx
mov qword [rcx + 0x18], 0
cmp qword [rcx + 8], r8
jae 0x140014d9a
mov qword [rcx + 8], r8
test r9, r9
je 0x140014da4
cmp rdx, qword [rcx]
je 0x140014db0
repz ret
mov qword [rcx + 0x18], r9
ret