Function at 0x40fbd0
Capabilities:
Allocate thread local storage
Check mutex on windows
Get thread local storage value
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x1c
mov ebx, dword [ebp + 8]
mov eax, dword [ebx + 8]
test eax, eax
je 0x40fc90
mov dword [esp + 4], 0xffffffff
mov dword [esp], eax
call sub.kernel32.dll_WaitForSingleObject
sub esp, 8
cmp eax, 0x80
je 0x40fc2b
cmp eax, 0x102
je 0x40fd43
test eax, eax
je 0x40fc2b
call sub.msvcrt.dll__errno
mov esi, eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [esi], eax
call sub.msvcrt.dll__errno
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x40fd50
mov eax, dword [ebx + 8]
mov dword [esp], eax
call sub.kernel32.dll_ReleaseMutex
sub esp, 4
test eax, eax
jne 0x40fc63
call sub.msvcrt.dll__errno
mov esi, eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [esi], eax
call sub.msvcrt.dll__errno
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x40fd70
mov eax, dword [ebx + 0xc]
mov dword [esp], eax
call sub.kernel32.dll_TlsGetValue
sub esp, 4
test eax, eax
mov esi, eax
je 0x40fd80
lea esp, [ebp - 0xc]
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 8], 0x477868
mov dword [esp + 4], 0
mov dword [esp], 0
call sub.kernel32.dll_CreateMutexA
sub esp, 0xc
test eax, eax
mov esi, eax
je 0x40fd28
mov dword [esp + 4], 0xffffffff
mov dword [esp], esi
call sub.kernel32.dll_WaitForSingleObject
sub esp, 8
cmp eax, 0x80
je 0x40fcfb
cmp eax, 0x102
je 0x40fcb5
test eax, eax
je 0x40fcfb
call sub.msvcrt.dll__errno
mov edi, eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [edi], eax
call sub.msvcrt.dll__errno
mov eax, dword [eax]
test eax, eax
jne 0x40fd43
mov eax, dword [ebx + 8]
test eax, eax
je 0x40fe55
mov dword [esp], esi
call sub.kernel32.dll_ReleaseMutex
sub esp, 4
test eax, eax
je 0x40fe23
mov dword [esp], esi
call sub.kernel32.dll_CloseHandle
sub esp, 4
test eax, eax
jne 0x40fd43
call sub.msvcrt.dll__errno
mov esi, eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [esi], eax
call sub.msvcrt.dll__errno
mov eax, dword [ebx + 8]
jmp 0x40fbe7
call sub.kernel32.dll_TlsAlloc
cmp eax, 0xffffffff
je 0x40fde5
mov dword [ebx + 0xc], eax
mov dword [ebx + 0x10], 1
jmp 0x40fc36
lea esp, [ebp - 0xc]
xor esi, esi
pop ebx
mov eax, esi
pop esi
pop edi
pop ebp
ret
call dword [ebx]
test eax, eax
mov edi, eax
je 0x40fd70
mov dword [esp + 4], eax
mov eax, dword [ebx + 0xc]
mov dword [esp], eax
call sub.kernel32.dll_TlsSetValue
sub esp, 8
test eax, eax
je 0x40fda5
mov esi, edi
jmp 0x40fc86
call sub.msvcrt.dll__errno
mov dword [ebp - 0x1c], eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov edx, dword [ebp - 0x1c]
mov dword [edx], eax
call sub.msvcrt.dll__errno
mov eax, dword [eax]
test eax, eax
je 0x40fd9e
mov dword [esp + 4], str.pthread_setspecific
mov dword [esp], eax
call sym.brltty.exe_logActionError
mov dword [esp], edi
call dword [ebx + 4]
jmp 0x40fc86
call sub.msvcrt.dll__errno
mov esi, eax
lea esi, [esi]
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [esi], eax
call sub.msvcrt.dll__errno
mov eax, dword [eax]
test eax, eax
je 0x40fd61
mov dword [esp + 4], str.pthread_key_create
mov dword [esp], eax
call sym.brltty.exe_logActionError
jmp 0x40fc36
call sub.msvcrt.dll__errno
mov edi, eax
lea esi, [esi]
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [edi], eax
call sub.msvcrt.dll__errno
mov eax, dword [eax]
test eax, eax
jne 0x40fd43
nop
jmp 0x40fd19
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], 0
call sub.kernel32.dll_CreateMutexA
sub esp, 0xc
test eax, eax
mov dword [ebx + 8], eax
jne 0x40fd06
call sub.msvcrt.dll__errno
mov edi, eax
call sub.kernel32.dll_GetLastError
mov dword [esp], eax
call sym.brltty.exe_win_toErrno
mov dword [edi], eax
call sub.msvcrt.dll__errno
cmp dword [eax], 0
jne 0x40fd43
jmp 0x40fd06