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

Disassembly:
push ebx
mov ebx, esp
sub esp, 8
and esp, 0xfffffff8
add esp, 4
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], ebp
mov ebp, esp
sub esp, 0x20
push esi
mov esi, ecx
push edi
mov dword [ebp - 4], esi
call fcn.004099e0
mov edi, dword [esi + 4]
push dword [edi + 0x14]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0x10], eax
test eax, eax
jne 0x40b1e5
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b1e2
mov eax, dword [edi + 0x2c]
push eax
push dword [edi + 0x14]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
je 0x40b1e2
mov ecx, edi
call fcn.0040c3ef
cmp eax, dword [ebp - 0x1c]
je 0x40b1f8
push 0x1c1449
call fcn.00404f88
mov eax, dword [ebp - 0x10]
mov edi, dword [ebx + 8]
cmp eax, edi
je 0x40b200
push 0x1c139c
call fcn.00404f88
jmp 0x40b200
mov eax, dword [edi + 0x2c]
jmp 0x40b1e5
mov esi, dword [ebp - 4]
mov ecx, dword [esi + 8]
mov eax, dword [esi + 0xc]
mov dword [ebp - 0x1c], eax
mov eax, ecx
shr eax, 0x13
or edx, 0xffffffff
and eax, 0x7ff
test ecx, ecx
jns 0x40b21f
test eax, eax
je 0x40b21f
dec eax
shr ecx, 0xc
and ecx, 0x7f
sub eax, ecx
sub eax, 4
test eax, eax
jle 0x40b2d5
cmp eax, 4
jbe 0x40b2d0
lea eax, [ebp - 0x18]
push eax
mov dword [ebp - 0x18], 0
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
push eax
call dword [sym.imp.KERNEL32.dll_GetThreadIOPendingFlag]
test eax, eax
je 0x40b25d
cmp dword [ebp - 0x18], 0
jne 0x40b26f
push edi
push 1
mov ecx, esi
call fcn.0040b7d1
test al, al
jne 0x40b3a2
mov esi, dword [esi + 4]
push dword [esi + 0x14]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edi, eax
test edi, edi
jne 0x40b2be
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b2be
mov eax, dword [esi + 0x2c]
push eax
push dword [esi + 0x14]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
je 0x40b2be
mov ecx, esi
call fcn.0040c3ef
cmp eax, dword [ebp - 0x1c]
je 0x40b2bb
push 0x1c1449
call fcn.00404f88
jmp 0x40b2be
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
je 0x40b2cd
push 0x1c139a
call fcn.00404f88
mov esi, dword [ebp - 4]
mov edx, 0x1770
push edx
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x10]
push eax
push dword [esi + 0x50]
mov dword [ebp - 8], 0
mov dword [ebp - 0xc], 0
call dword [sym.imp.KERNEL32.dll_GetQueuedCompletionStatus]
mov edi, eax
test edi, edi
je 0x40b303
xor esi, esi
jmp 0x40b30b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0xc]
cmp ecx, 4
setae al
test edi, edi
jne 0x40b41f
test edx, edx
jne 0x40b41f
test byte [0x421b00], 0x20
je 0x40b34d
push dword [ebp - 0x10]
push ecx
push 0x401810
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cb22
mov ecx, dword [ebp - 8]
test ecx, ecx
je 0x40b35b
push 0x1c13a3
call fcn.00404f88
cmp esi, 0x102
je 0x40b36d
push 0x1c13c0
call fcn.00404f88
lea eax, [ebp - 0x1c]
push eax
mov dword [ebp - 0x1c], 0
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
push eax
call dword [sym.imp.KERNEL32.dll_GetThreadIOPendingFlag]
test eax, eax
je 0x40b38f
cmp dword [ebp - 0x1c], 0
jne 0x40b3af
push dword [ebx + 8]
mov esi, dword [ebp - 4]
push 1
mov ecx, esi
call fcn.0040b7d1
test al, al
je 0x40b3b2
xor eax, eax
pop edi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 4
mov esi, dword [ebp - 4]
mov esi, dword [esi + 4]
push dword [esi + 0x14]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edi, eax
test edi, edi
jne 0x40b401
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b401
mov eax, dword [esi + 0x2c]
push eax
push dword [esi + 0x14]
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
je 0x40b401
mov ecx, esi
call fcn.0040c3ef
cmp eax, dword [ebp - 0x18]
je 0x40b3fe
push 0x1c1449
call fcn.00404f88
jmp 0x40b401
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
mov esi, dword [ebp - 4]
mov edi, dword [ebx + 8]
je 0x40b200
push 0x1c139a
call fcn.00404f88
jmp 0x40b200
test al, al
je 0x40b4f4
test edx, edx
jne 0x40b43b
push 0x1c13c3
call fcn.00404f88
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0xc]
test byte [0x421b00], 0x10
je 0x40b464
push dword [ebp - 0x10]
push ecx
push 0x4017b0
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cb22
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0xc]
push dword [ebx + 8]
push esi
push dword [ebp - 0x10]
mov esi, dword [ebp - 4]
push ecx
push edx
mov ecx, esi
call fcn.0040ac31
mov edi, dword [esi + 4]
push dword [edi + 0x14]
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov dword [ebp - 0x14], eax
test eax, eax
jne 0x40b4c8
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b4c5
mov eax, dword [edi + 0x2c]
push eax
push dword [edi + 0x14]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
je 0x40b4c5
mov ecx, edi
call fcn.0040c3ef
cmp eax, dword [ebp - 0x1c]
je 0x40b4ef
push 0x1c1449
call fcn.00404f88
mov eax, dword [ebp - 0x14]
mov edi, dword [ebx + 8]
cmp eax, edi
je 0x40b4d9
push 0x1c13c7
call fcn.00404f88
mov eax, dword [ebp - 0x18]
cmp eax, 1
je 0x40b200
test eax, eax
je 0x40b3a2
jmp 0x40b542
mov eax, dword [edi + 0x2c]
jmp 0x40b4c8
test byte [0x421b00], 0x10
je 0x40b51d
push dword [ebp - 0x10]
push ecx
push 0x4017c0
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cb22
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0xc]
mov edi, dword [ebx + 8]
push edi
push ecx
mov ecx, dword [ebp - 4]
push edx
call fcn.0040ae6a
mov esi, eax
cmp esi, 1
je 0x40b1fd
cmp esi, 2
jne 0x40b5de
mov esi, dword [ebp - 4]
lea ecx, [ebp - 0x14]
lea eax, [esi + 0x58]
push ecx
mov ecx, eax
mov dword [ebp - 0x14], 0
call fcn.00408417
mov ecx, dword [ebp - 0x14]
test ecx, ecx
je 0x40b5d1
mov eax, dword [ecx]
push edi
call dword [eax + 0x78]
mov esi, dword [esi + 4]
push dword [esi + 0x14]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edi, eax
test edi, edi
jne 0x40b5b3
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b5b3
mov eax, dword [esi + 0x2c]
push eax
push dword [esi + 0x14]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
test eax, eax
je 0x40b5b3
mov ecx, esi
call fcn.0040c3ef
cmp eax, dword [ebp - 0x1c]
je 0x40b5b0
push 0x1c1449
call fcn.00404f88
jmp 0x40b5b3
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
je 0x40b5c2
push 0x1c13d4
call fcn.00404f88
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
push eax
call dword [ecx + 8]
mov esi, dword [ebp - 4]
mov edi, dword [ebx + 8]
push edi
mov ecx, esi
call fcn.0040b078
jmp 0x40b4dc
test esi, esi
je 0x40b5f1
cmp esi, 3
je 0x40b5f1
push 0x1c13ce
call fcn.00404f88
pop edi
mov eax, esi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 4