Function at 0x140178920
Capabilities:
Allocate thread local storage
Get thread local storage value

Disassembly:
push rsi
push rdi
push rbx
sub rsp, 0x30
mov rax, qword [0x14031d040]
xor rax, rsp
mov qword [rsp + 0x28], rax
mov eax, dword [0x140341320]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178de0
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov ecx, dword [0x1403412d8]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rsi, rax
test edi, edi
je 0x14017897e
mov ecx, edi
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rsi, rsi
je 0x140178d72
cmp qword [rsi], 0
jne 0x140178d0a
mov ecx, 0x38
call fcn.1401ef3e0
mov rsi, rax
mov qword [rax], 0
mov byte [rax + 8], 0
xorps xmm0, xmm0
movups xmmword [rax + 0x10], xmm0
movups xmmword [rax + 0x20], xmm0
mov dword [rax + 0x30], 0x3f800000
mov ecx, 3
call fcn.1401a7290
mov rbx, qword [rsi + 0x18]
mov rdx, rax
cmp rax, rbx
ja 0x140178ad3
jae 0x140178adf
mov rdi, rax
mov rax, qword [rsi + 0x28]
test rax, rax
jns 0x140178a01
mov rcx, rax
shr rcx, 1
and eax, 1
or rax, rcx
xorps xmm0, xmm0
cvtsi2ss xmm0, rax
addss xmm0, xmm0
jmp 0x140178a09
xorps xmm0, xmm0
cvtsi2ss xmm0, rax
divss xmm0, dword [rsi + 0x30]
call fcn.1402199e0
cvttss2si rcx, xmm0
mov rdx, rcx
subss xmm0, dword [0x14029f8fc]
cvttss2si rax, xmm0
sar rdx, 0x3f
and rax, rdx
or rax, rcx
cmp rbx, 3
jb 0x140178abc
mov rcx, rbx
shr rcx, 1
movabs rdx, 0x5555555555555555
and rdx, rcx
mov rcx, rbx
sub rcx, rdx
movabs rdx, 0x3333333333333333
mov r8, rcx
shr r8, 2
and rcx, rdx
and r8, rdx
add r8, rcx
mov rcx, r8
shr rcx, 4
add rcx, r8
movabs rdx, 0xf0f0f0f0f0f0f0f
and rdx, rcx
movabs rcx, 0x101010101010101
imul rcx, rdx
shr rcx, 0x38
cmp ecx, 1
ja 0x140178abc
lea rcx, [rax - 1]
bsr rcx, rcx
xor ecx, 0x3f
neg cl
mov edx, 1
shl rdx, cl
cmp rax, 2
cmovb rdx, rax
jmp 0x140178ac7
mov rcx, rax
call fcn.1401a7290
mov rdx, rax
cmp rdi, rdx
cmova rdx, rdi
cmp rdx, rbx
jae 0x140178adf
mov rcx, rsi
add rcx, 0x10
call fcn.140082ea0
mov eax, dword [0x140341320]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178f40
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov ecx, dword [0x1403412d8]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rdi, rax
test ebx, ebx
je 0x140178b27
mov ecx, ebx
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rdi, rdi
je 0x140178c45
mov qword [rdi], rsi
mov eax, dword [0x140341350]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178efc
lea rcx, [0x140341328]
call sub.KERNEL32.dll_EnterCriticalSection
mov eax, dword [0x140341370]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178ec6
mov eax, dword [0x140341320]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178fb3
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov ecx, dword [0x1403412d8]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rsi, rax
test edi, edi
je 0x140178bd1
mov ecx, edi
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rsi, rsi
je 0x140178c7d
mov rsi, qword [rsi]
mov qword [rsp + 0x20], 0
test rsi, rsi
je 0x140178c41
mov ecx, 0x18
call fcn.1401ef3e0
lea rcx, fcn.140036770
mov qword [rax], rcx
mov qword [rax + 8], rsi
mov dword [rax + 0x10], 1
mov qword [rsp + 0x20], rax
mov rcx, qword [0x140341360]
cmp rcx, qword [0x140341368]
jae 0x140178cb5
test rcx, rcx
je 0x140178dde
mov qword [rcx], rax
test rax, rax
je 0x140178c38
lock inc dword [rax + 0x10]
add rcx, 8
jmp 0x140178cc9
xor eax, eax
jmp 0x140178c0f
mov ecx, 1
mov edx, 8
call fcn.140072030
mov rdi, rax
lea rcx, [0x1403412d0]
mov rdx, rax
call fcn.140179100
test al, al
jne 0x140178b30
mov rcx, rdi
call fcn.140071eb0
xor edi, edi
jmp 0x140178b30
mov ecx, 1
mov edx, 8
call fcn.140072030
mov rsi, rax
lea rcx, [0x1403412d0]
mov rdx, rax
call fcn.140179100
test al, al
jne 0x140178bda
mov rcx, rsi
call fcn.140071eb0
xor esi, esi
jmp 0x140178bda
lea rcx, [0x140341358]
lea rdx, [rsp + 0x20]
call fcn.1401793e0
mov rcx, rax
mov qword [0x140341360], rcx
mov rax, qword [rsp + 0x20]
test rax, rax
je 0x140178cfe
lock dec dword [rax + 0x10]
jne 0x140178cfe
mov rcx, qword [rsp + 0x20]
call fcn.140179550
mov rcx, qword [rsp + 0x20]
test rcx, rcx
je 0x140178cfe
mov edx, 1
call fcn.140036770
lea rcx, [0x140341328]
call sub.KERNEL32.dll_LeaveCriticalSection
mov eax, dword [0x140341320]
mov ecx, dword [0x14032bc90]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140178e53
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
mov ecx, dword [0x1403412d8]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
mov rsi, rax
test edi, edi
je 0x140178d52
mov ecx, edi
call qword [sym.imp.KERNEL32.dll_SetLastError]
test rsi, rsi
je 0x140178daa
mov rsi, qword [rsi]
mov rcx, qword [rsp + 0x28]
xor rcx, rsp
call fcn.1401f08b0
mov rax, rsi
add rsp, 0x30
pop rbx
pop rdi
pop rsi
ret
mov ecx, 1
mov edx, 8
call fcn.140072030
mov rsi, rax
lea rcx, [0x1403412d0]
mov rdx, rax
call fcn.140179100
test al, al
jne 0x140178987
mov rcx, rsi
call fcn.140071eb0
xor esi, esi
jmp 0x140178987
mov ecx, 1
mov edx, 8
call fcn.140072030
mov rsi, rax
lea rcx, [0x1403412d0]
mov rdx, rax
call fcn.140179100
test al, al
jne 0x140178d57
mov rcx, rsi
call fcn.140071eb0
xor esi, esi
jmp 0x140178d57
ud2
lea rcx, [0x140341320]
call fcn.1401ef46c
cmp dword [0x140341320], 0xffffffff
jne 0x14017895b
xorps xmm0, xmm0
movups xmmword [0x1403412e0], xmm0
mov qword [0x1403412f0], 0
lea rcx, [0x1403412f8]
xor edx, edx
call fcn.14012ae20
lea rax, [fcn.140071eb0]
mov qword [0x1403412d0], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x1403412d8], eax
lea rcx, [0x140179030]
call fcn.1401ef638
lea rcx, [0x140341320]
call fcn.1401ef520
jmp 0x14017895b
lea rcx, [0x140341320]
call fcn.1401ef46c
cmp dword [0x140341320], 0xffffffff
jne 0x140178d2f
xorps xmm0, xmm0
movups xmmword [0x1403412e0], xmm0
mov qword [0x1403412f0], 0
lea rcx, [0x1403412f8]
xor edx, edx
call fcn.14012ae20
lea rax, [fcn.140071eb0]
mov qword [0x1403412d0], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x1403412d8], eax
lea rcx, [0x140179030]
call fcn.1401ef638
lea rcx, [0x140341320]
call fcn.1401ef520
jmp 0x140178d2f
lea rcx, [0x140341370]
call fcn.1401ef46c
cmp dword [0x140341370], 0xffffffff
jne 0x140178b89
lea rcx, [0x140179350]
call fcn.1401ef638
lea rcx, [0x140341370]
call fcn.1401ef520
jmp 0x140178b89
lea rcx, [0x140341350]
call fcn.1401ef46c
cmp dword [0x140341350], 0xffffffff
jne 0x140178b58
lea rcx, [0x140341328]
xor edx, edx
call fcn.14012ae20
lea rcx, [0x140179340]
call fcn.1401ef638
lea rcx, [0x140341350]
call fcn.1401ef520
jmp 0x140178b58
lea rcx, [0x140341320]
call fcn.1401ef46c
cmp dword [0x140341320], 0xffffffff
jne 0x140178b04
xorps xmm0, xmm0
movups xmmword [0x1403412e0], xmm0
mov qword [0x1403412f0], 0
lea rcx, [0x1403412f8]
xor edx, edx
call fcn.14012ae20
lea rax, [fcn.140071eb0]
mov qword [0x1403412d0], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x1403412d8], eax
lea rcx, [0x140179030]
call fcn.1401ef638
lea rcx, [0x140341320]
call fcn.1401ef520
jmp 0x140178b04
lea rcx, [0x140341320]
call fcn.1401ef46c
cmp dword [0x140341320], 0xffffffff
jne 0x140178bae
xorps xmm0, xmm0
movups xmmword [0x1403412e0], xmm0
mov qword [0x1403412f0], 0
lea rcx, [0x1403412f8]
xor edx, edx
call fcn.14012ae20
lea rax, [fcn.140071eb0]
mov qword [0x1403412d0], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov dword [0x1403412d8], eax
lea rcx, [0x140179030]
call fcn.1401ef638
lea rcx, [0x140341320]
call fcn.1401ef520
jmp 0x140178bae