Function at 0x140046380
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x58
mov qword [rsp + 0x50], rcx
mov r13, qword [0x14010e138]
lea r14, [0x14010e0d0]
xor ebx, ebx
lea r15, [rsp + 0x40]
lea r12, [0x14192afa8]
jmp 0x1400463c7
mov r13, qword [0x14010e138]
mov rbp, r13
and rbp, 3
je 0x1400463e0
cmp ebp, 1
je 0x140046410
jmp 0x1400467d6
cmp qword [rsp + 0x50], 0
je 0x140046410
lea rcx, [r13 + 1]
mov rax, r13
lock cmpxchg qword [0x14010e138], rcx
mov r13, rax
jne 0x1400463c7
jmp 0x1400467f2
lea rsi, [rsp + rbp]
add rsi, 0x28
nop dword [rax + rax]
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x140046463
dec ecx
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jb 0x140046442
cmp qword [rax + 8], 0
jne 0x140046520
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x14004647a
dec ecx
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
je 0x140046490
cmp rax, 1
jne 0x1400464d5
jmp 0x140046889
mov rcx, r14
call fcn.1400e0490
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jae 0x140046437
jmp 0x140046442
mov rcx, r14
call fcn.1400e0490
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
jne 0x140046458
nop
movzx eax, byte [0x141936118]
mov edx, 0x18
xor ecx, ecx
call fcn.1400dee70
test rax, rax
je 0x140046889
mov rdi, rax
mov qword [rax], r14
mov qword [rax + 8], 0
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x1400465ba
dec ecx
mov rdx, rdi
call sub.KERNEL32.dll_TlsSetValue
mov rax, rdi
mov rdx, qword [rax + 8]
mov rcx, qword [rax + 0x10]
mov qword [rsp + 0x40], rdx
mov qword [rsp + 0x48], rcx
mov qword [rax + 8], 1
mov qword [rax + 0x10], 0
test rdx, rdx
je 0x140046520
test rcx, rcx
je 0x140046520
lock dec qword [rcx]
jne 0x140046520
lea rcx, [rsp + 0x48]
mov rdi, rax
call fcn.1400ed1a0
mov rax, rdi
nop word [rax + rax]
add rax, 0x10
mov rcx, qword [rax]
test rcx, rcx
je 0x140046594
lock inc qword [rcx]
jle 0x140046889
mov rax, r13
and rax, 0xfffffffffffffffc
mov qword [rsp + 0x28], rcx
mov byte [rsp + 0x38], 0
mov qword [rsp + 0x30], rax
mov rax, r13
lock cmpxchg qword [0x14010e138], rsi
je 0x140046770
mov r13, rax
and eax, 3
cmp rax, rbp
jne 0x1400467b0
mov rax, qword [rsp + 0x28]
test rax, rax
je 0x140046420
lock dec qword [rax]
jne 0x140046420
mov rcx, qword [rsp + 0x28]
call fcn.14004fd00
jmp 0x140046420
mov rdi, rax
call fcn.1400e5620
cmp qword [rdi], 0
jne 0x140046889
mov rcx, rax
mov rax, rdi
mov qword [rdi], rcx
lock inc qword [rcx]
jg 0x140046536
jmp 0x140046889
mov rcx, r14
call fcn.1400e0490
mov ecx, eax
jmp 0x1400464ca
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x140046613
dec ecx
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jb 0x1400465f2
cmp qword [rax + 8], 0
jne 0x1400466d0
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x14004662a
dec ecx
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
je 0x140046640
cmp rax, 1
jne 0x140046685
jmp 0x140046889
mov rcx, r14
call fcn.1400e0490
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
cmp rax, 2
jae 0x1400465e7
jmp 0x1400465f2
mov rcx, r14
call fcn.1400e0490
mov ecx, eax
call sub.KERNEL32.dll_TlsGetValue
test rax, rax
jne 0x140046608
nop
movzx eax, byte [0x141936118]
mov edx, 0x18
xor ecx, ecx
call fcn.1400dee70
test rax, rax
je 0x140046889
mov qword [rax], r14
mov qword [rax + 8], 0
mov ecx, dword [0x14010e0e8]
test ecx, ecx
je 0x140046758
dec ecx
mov rdx, rax
mov rsi, rax
call sub.KERNEL32.dll_TlsSetValue
mov rax, rsi
mov rdx, qword [rax + 8]
mov rcx, qword [rax + 0x10]
mov qword [rsp + 0x40], rdx
mov qword [rsp + 0x48], rcx
mov qword [rax + 8], 1
mov qword [rax + 0x10], 0
test rdx, rdx
je 0x1400466d0
test rcx, rcx
je 0x1400466d0
lock dec qword [rcx]
jne 0x1400466d0
lea rcx, [rsp + 0x48]
mov rsi, rax
call fcn.1400ed1a0
mov rax, rsi
nop word [rax + rax]
add rax, 0x10
mov r13, qword [rax]
test r13, r13
je 0x140046731
lock inc qword [r13]
jle 0x140046889
mov qword [rsp + 0x40], r13
lock dec byte [r13 + 0x28]
je 0x140046720
lea rbp, [r13 + 0x28]
nop word [rax + rax]
mov r8d, 1
mov rcx, rbp
mov rdx, r12
mov r9d, 0xffffffff
call sub.api_ms_win_core_synch_l1_2_0.dll_WaitOnAddress
mov al, 1
lock cmpxchg byte [rbp], bl
jne 0x140046700
lock dec qword [r13]
jne 0x140046770
mov rcx, r15
call fcn.1400ed1a0
jmp 0x140046770
mov rsi, rax
call fcn.1400e5620
cmp qword [rsi], 0
jne 0x140046889
mov r13, rax
mov rax, rsi
mov qword [rsi], r13
lock inc qword [r13]
jg 0x1400466e7
jmp 0x140046889
mov rcx, r14
mov rsi, rax
call fcn.1400e0490
mov ecx, eax
mov rax, rsi
jmp 0x140046677
movzx eax, byte [rsp + 0x38]
test al, al
je 0x1400465d0
mov rax, qword [rsp + 0x28]
test rax, rax
je 0x1400463c0
lock dec qword [rax]
jne 0x1400463c0
mov rcx, qword [rsp + 0x28]
call fcn.14004fd00
jmp 0x1400463c0
mov rax, qword [rsp + 0x28]
test rax, rax
je 0x1400467ca
lock dec qword [rax]
jne 0x1400467ca
mov rcx, qword [rsp + 0x28]
call fcn.14004fd00
mov r13, qword [0x14010e138]
jmp 0x1400463c7
cmp ebp, 2
jne 0x1400467f0
add rsp, 0x58
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
jmp 0x1400467f0
mov rsi, qword [rsp + 0x50]
mov rax, qword [rsi]
mov rcx, qword [rax]
mov qword [rax], 0
mov rax, qword [rcx + 0x10]
mov qword [rcx + 0x10], 0
test rax, rax
je 0x140046889
call rax
mov rcx, qword [rsi + 8]
mov rcx, qword [rcx]
mov byte [rcx], al
mov eax, 2
xchg qword [0x14010e138], rax
mov ecx, eax
and ecx, 3
cmp ecx, 1
jne 0x140046889
dec rax
jne 0x140046848
jmp 0x1400467db
mov rax, rdi
test rdi, rdi
je 0x1400467db
mov rsi, qword [rax]
mov rdi, qword [rax + 8]
mov qword [rax], 0
test rsi, rsi
je 0x140046889
mov byte [rax + 0x10], 1
mov al, 1
xchg byte [rsi + 0x28], al
cmp al, 0xff
je 0x140046870
lock dec qword [rsi]
jne 0x140046840
jmp 0x14004687f
lea rcx, [rsi + 0x28]
call fcn.14010bbb8
lock dec qword [rsi]
jne 0x140046840
mov rcx, rsi
call fcn.14004fd00
jmp 0x140046840
ud2