Function at 0x407180
Capabilities:
Get thread local storage value
Resolve function by parsing pe exports
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
push esi
mov esi, ecx
mov dword [ebp - 8], 0
push edi
mov edi, dword [esi + 0x10]
mov eax, dword [esi + 0x40]
and eax, 0x20000
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x1c], eax
mov ebx, dword [edi + 0x34]
mov dword [ebp - 0xc], ebx
je 0x407330
test ebx, ebx
jne 0x4071da
mov eax, dword [edi + 0x3c]
mov ecx, dword [eax + 0x4c]
mov eax, dword [edi + 0x38]
cmp dword [eax + 0x4c], ecx
sbb eax, eax
and eax, 4
mov ebx, dword [eax + edi + 0x38]
mov eax, dword [ebx + 0x4c]
mov dword [esi + 0xc], eax
mov dword [esi + 0x24], 0
jmp 0x4073e4
test dword [edi + 0xc], 0x200000
je 0x4071e8
mov ebx, dword [esi + 0x24]
jmp 0x4071f3
push dword [edi + 0x64]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov ebx, eax
test ebx, ebx
je 0x407214
mov ecx, dword [ebx + 4]
cmp ecx, dword [edi + 0x28]
jne 0x407208
cmp dword [ebx], 0xffffffff
je 0x40730c
pop edi
pop esi
mov eax, 0xffff87c1
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi + 0x28]
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp dword [edi + 0x88], 0
mov ebx, dword [edi + 0x90]
mov dword [ebp - 0x14], eax
mov dword [ebp - 8], ebx
jne 0x40723f
mov dword [edi + 0x88], 1
push 0xffffffffffffffff
push ebx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x407261
push eax
mov edx, ebx
mov ecx, edi
call fcn.00412070
add esp, 4
test eax, eax
jne 0x4074bb
mov eax, dword [ebp - 0xc]
xor ecx, ecx
mov edx, dword [eax + 0xc]
mov dword [ebp - 4], edx
test edx, edx
je 0x407288
mov ebx, dword [ebp - 4]
lea edx, [eax + 0x44]
cmp dword [edx], 0
je 0x407283
inc ecx
add edx, 0x40
cmp ecx, ebx
jb 0x407276
mov edx, ebx
mov ebx, dword [ebp - 8]
cmp ecx, dword [edi + 0x18]
jne 0x4072a0
push ebx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
pop esi
mov eax, 0xffff87ba
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp - 0x14]
lea ebx, [ecx + 1]
shl ebx, 6
add ebx, eax
mov dword [ebx + 4], 0
mov dword [ebx], 0xffffffff
mov dword [ebx + 8], edi
mov edi, dword [ebp - 0x10]
cmp ecx, edx
jne 0x4072c6
inc edx
mov dword [eax + 0xc], edx
mov eax, dword [ebp - 0x18]
push dword [ebp - 8]
mov dword [edi + 0x1c], edx
mov dword [ebx + 4], eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [edi + 0xc]
and edx, 0x200000
mov dword [ebp - 8], edx
jne 0x40730c
push ebx
push dword [edi + 0x64]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
jne 0x40730c
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x40730c
pop edi
pop esi
mov dword [ebx + 4], 0
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0xc]
nop
mov eax, dword [ecx + 8]
mov dword [ebx], eax
mov eax, dword [ebx]
cmp eax, dword [ecx + 8]
jne 0x407310
mov eax, dword [ebx]
mov dword [esi + 0xc], eax
and eax, 1
mov dword [esi + 0x24], ebx
mov ebx, dword [edi + eax*4 + 0x38]
jmp 0x4073e4
test ebx, ebx
je 0x407370
push 0xffffffffffffffff
push dword [edi + 0x94]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x40735f
mov edx, dword [edi + 0x94]
mov ecx, edi
push eax
call fcn.00412070
add esp, 4
test eax, eax
jne 0x4074bb
mov ecx, dword [ebx + 8]
mov eax, ecx
and eax, 1
mov dword [esi + 0xc], ecx
mov ebx, dword [edi + eax*4 + 0x38]
jmp 0x40738b
mov eax, dword [edi + 0x3c]
mov ecx, dword [eax + 0x4c]
mov eax, dword [edi + 0x38]
cmp dword [eax + 0x4c], ecx
sbb eax, eax
and eax, 4
mov ebx, dword [eax + edi + 0x38]
mov ecx, dword [ebx + 0x4c]
mov dword [esi + 0xc], ecx
mov dword [esi + 4], 0
lea eax, [ecx + 1]
mov dword [esi + 0xc], eax
mov dword [esi + 0x18], 0
mov dword [esi + 0x1c], 0
mov dword [esi + 0x44], 0x1ffff
mov eax, dword [edi + 0x7c]
mov dword [esi + 0x24], eax
mov dword [eax], 0
mov eax, dword [edi + 0x78]
mov dword [esi + 0x14], eax
mov dword [eax], 0
mov dword [esi + 0x20], 0
mov eax, dword [edi + 0x24]
shl eax, 2
push eax
push dword [edi + 0x60]
mov dword [edi + 0x44], esi
push dword [esi + 0x30]
call fcn.0046c5d0
add esp, 0xc
movups xmm0, xmmword [ebx + 0x10]
mov eax, dword [esi + 0x2c]
movups xmmword [eax], xmm0
movups xmm0, xmmword [ebx + 0x20]
movups xmmword [eax + 0x10], xmm0
movups xmm0, xmmword [ebx + 0x30]
movups xmmword [eax + 0x20], xmm0
movq xmm0, qword [ebx + 0x40]
movq qword [eax + 0x30], xmm0
mov eax, dword [ebx + 0x48]
mov ebx, 2
inc eax
mov dword [esi + 8], eax
mov eax, dword [ebp - 0x1c]
mov dword [esi + 0x40], eax
mov eax, dword [edi + 0x20]
mov dword [esi + 0x3c], eax
cmp eax, ebx
jbe 0x407468
mov dword [ebp - 4], 0x38
nop dword [eax + eax]
mov eax, dword [edi + 0x5c]
mov edi, dword [ebp - 4]
movzx edx, word [eax + ebx*2]
mov eax, dword [esi + 0x2c]
mov ecx, edx
and ecx, 0x7fff
test dx, dx
mov word [edi + eax + 4], cx
setns cl
mov eax, dword [esi + 0x38]
dec cl
add dword [ebp - 4], 0x1c
and cl, 0x1a
mov edi, dword [ebp - 0x10]
mov byte [ebx + eax], cl
inc ebx
cmp ebx, dword [esi + 0x3c]
jb 0x407430
mov eax, dword [esi + 0x38]
mov byte [eax + 1], 0x18
mov eax, dword [esi + 0x38]
mov byte [eax], 8
cmp dword [edi + 0xc], 0
jge 0x407496
mov edx, dword [ebp - 8]
mov ecx, esi
or edx, 5
mov edi, 0xffff87b5
call fcn.004076a0
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi + 0x54]
cmp eax, dword [esi + 8]
jae 0x4074b9
mov edx, dword [ebp - 8]
mov ecx, esi
or edx, 5
mov edi, 0xffff87bf
call fcn.004076a0
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret