Function at 0x40b19a
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.00409a03
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 0x40b20d
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b20a
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 0x40b20a
mov ecx, edi
call fcn.0040c417
cmp eax, dword [ebp - 0x1c]
je 0x40b220
push 0x1c1449
call fcn.00404f88
mov eax, dword [ebp - 0x10]
mov edi, dword [ebx + 8]
cmp eax, edi
je 0x40b228
push 0x1c139c
call fcn.00404f88
jmp 0x40b228
mov eax, dword [edi + 0x2c]
jmp 0x40b20d
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 0x40b247
test eax, eax
je 0x40b247
dec eax
shr ecx, 0xc
and ecx, 0x7f
sub eax, ecx
sub eax, 4
test eax, eax
jle 0x40b2fd
cmp eax, 4
jbe 0x40b2f8
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 0x40b285
cmp dword [ebp - 0x18], 0
jne 0x40b297
push edi
push 1
mov ecx, esi
call fcn.0040b7f9
test al, al
jne 0x40b3ca
mov esi, dword [esi + 4]
push dword [esi + 0x14]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
mov edi, eax
test edi, edi
jne 0x40b2e6
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b2e6
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 0x40b2e6
mov ecx, esi
call fcn.0040c417
cmp eax, dword [ebp - 0x1c]
je 0x40b2e3
push 0x1c1449
call fcn.00404f88
jmp 0x40b2e6
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
je 0x40b2f5
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 0x40b32b
xor esi, esi
jmp 0x40b333
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 0x40b447
test edx, edx
jne 0x40b447
test byte [0x421b00], 0x20
je 0x40b375
push dword [ebp - 0x10]
push ecx
push 0x401810
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cba9
mov ecx, dword [ebp - 8]
test ecx, ecx
je 0x40b383
push 0x1c13a3
call fcn.00404f88
cmp esi, 0x102
je 0x40b395
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 0x40b3b7
cmp dword [ebp - 0x1c], 0
jne 0x40b3d7
push dword [ebx + 8]
mov esi, dword [ebp - 4]
push 1
mov ecx, esi
call fcn.0040b7f9
test al, al
je 0x40b3da
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 0x40b429
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b429
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 0x40b429
mov ecx, esi
call fcn.0040c417
cmp eax, dword [ebp - 0x18]
je 0x40b426
push 0x1c1449
call fcn.00404f88
jmp 0x40b429
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
mov esi, dword [ebp - 4]
mov edi, dword [ebx + 8]
je 0x40b228
push 0x1c139a
call fcn.00404f88
jmp 0x40b228
test al, al
je 0x40b51c
test edx, edx
jne 0x40b463
push 0x1c13c3
call fcn.00404f88
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0xc]
test byte [0x421b00], 0x10
je 0x40b48c
push dword [ebp - 0x10]
push ecx
push 0x4017b0
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cba9
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.0040ac59
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 0x40b4f0
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b4ed
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 0x40b4ed
mov ecx, edi
call fcn.0040c417
cmp eax, dword [ebp - 0x1c]
je 0x40b517
push 0x1c1449
call fcn.00404f88
mov eax, dword [ebp - 0x14]
mov edi, dword [ebx + 8]
cmp eax, edi
je 0x40b501
push 0x1c13c7
call fcn.00404f88
mov eax, dword [ebp - 0x18]
cmp eax, 1
je 0x40b228
test eax, eax
je 0x40b3ca
jmp 0x40b56a
mov eax, dword [edi + 0x2c]
jmp 0x40b4f0
test byte [0x421b00], 0x10
je 0x40b545
push dword [ebp - 0x10]
push ecx
push 0x4017c0
push dword [0x421b0c]
push dword [0x421b08]
call fcn.0040cba9
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.0040ae92
mov esi, eax
cmp esi, 1
je 0x40b225
cmp esi, 2
jne 0x40b606
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 0x40b5f9
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 0x40b5db
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
cmp eax, dword [0x421ac0]
jne 0x40b5db
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 0x40b5db
mov ecx, esi
call fcn.0040c417
cmp eax, dword [ebp - 0x1c]
je 0x40b5d8
push 0x1c1449
call fcn.00404f88
jmp 0x40b5db
mov edi, dword [esi + 0x2c]
cmp edi, dword [ebx + 8]
je 0x40b5ea
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.0040b0a0
jmp 0x40b504
test esi, esi
je 0x40b619
cmp esi, 3
je 0x40b619
push 0x1c13ce
call fcn.00404f88
pop edi
mov eax, esi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 4