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

Disassembly:
push ebp
mov ebp, esp
push esi
push ebx
sub esp, 0x20
cmp dword [ebp + 0xc], 3
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x10], 0xfeedbab1
mov dword [ebp - 0x14], 0
mov dword [ebp - 0xc], 1
je 0x40d248
lea esp, [ebp - 8]
mov eax, 1
pop ebx
pop esi
pop ebp
ret 0xc
mov eax, dword [0x41e40c]
test eax, eax
je 0x40d3d5
cmp dword [eax], 0xffffffff
je 0x40d23a
mov eax, dword [0x41e40c]
test eax, eax
je 0x40d426
mov eax, dword [eax]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
sub esp, 4
test eax, eax
mov ebx, eax
je 0x40d23a
test byte [eax + 0x20], 0x30
je 0x40d327
mov eax, dword [eax + 0xbc]
test eax, eax
jne 0x40d3c7
mov eax, dword [ebx + 0x14]
test eax, eax
je 0x40d2c5
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp], eax
call esi
mov eax, dword [ebx + 0x18]
sub esp, 4
test eax, eax
je 0x40d2b7
mov dword [esp], eax
call esi
sub esp, 4
mov dword [ebx + 0x18], 0
mov dword [ebx + 0x14], 0
lea eax, [ebx + 0x1c]
mov dword [esp], eax
call sym._pthread_mutex_destroy
mov eax, dword [ebp - 0x18]
mov esi, dword [ebx + 0xb8]
mov dword [ebx + 0x34], eax
mov eax, dword [ebp - 0x14]
test esi, esi
mov dword [ebx + 0x38], eax
mov eax, dword [ebp - 0x10]
mov dword [ebx + 0x3c], eax
mov eax, dword [ebp - 0xc]
mov dword [ebx + 0x40], eax
je 0x40d44c
mov eax, dword [0x41e40c]
test eax, eax
je 0x40d400
mov dword [esp + 4], 0
mov eax, dword [eax]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, 1
sub esp, 8
lea esp, [ebp - 8]
pop ebx
pop esi
pop ebp
ret 0xc
mov ecx, dword [eax + 0x70]
mov eax, dword [eax + 0x18]
test ecx, ecx
jne 0x40d381
test eax, eax
je 0x40d341
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 4
mov eax, dword [ebx + 0xbc]
mov dword [ebx + 0x18], 0
mov dword [ebx + 0x70], 1
test eax, eax
jne 0x40d3c0
test byte [ebx + 0x24], 4
je 0x40d398
mov eax, dword [ebx + 0x14]
mov dword [ebx], 0xdeadbeef
test eax, eax
je 0x40d2be
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 4
jmp 0x40d2be
test eax, eax
je 0x40d391
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 4
mov dword [ebx + 0x18], 0
lea eax, [ebx + 0x1c]
mov dword [esp], eax
call sym._pthread_mutex_destroy
mov eax, dword [ebp - 0x18]
mov dword [ebx + 0x34], eax
mov eax, dword [ebp - 0x14]
mov dword [ebx + 0x38], eax
mov eax, dword [ebp - 0x10]
mov dword [ebx + 0x3c], eax
mov eax, dword [ebp - 0xc]
mov dword [ebx + 0x40], eax
jmp 0x40d23a
call sym.__pthread_cleanup_dest.part.2
jmp 0x40d359
call sym.__pthread_cleanup_dest.part.2
lea esi, [esi]
jmp 0x40d293
mov dword [esp + 8], sym.___shmem_winpthreads_init__pthread_tls_shmem
mov dword [esp + 4], 4
mov dword [esp], str._pthread_tls_shmem
call sym.___shmem_winpthreads_grab
mov dword [0x41e40c], eax
jmp 0x40d255
mov dword [esp + 8], sym.___shmem_winpthreads_init__pthread_tls_shmem
mov dword [esp + 4], 4
mov dword [esp], str._pthread_tls_shmem
call sym.___shmem_winpthreads_grab
mov dword [0x41e40c], eax
jmp 0x40d303
mov dword [esp + 8], sym.___shmem_winpthreads_init__pthread_tls_shmem
mov dword [esp + 4], 4
mov dword [esp], str._pthread_tls_shmem
call sym.___shmem_winpthreads_grab
mov dword [0x41e40c], eax
jmp 0x40d267
mov eax, ebx
call sym._push_pthread_mem.part.0
jmp 0x40d2f6