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

Disassembly:
push ecx
push ebx
push ebp
mov ebp, dword [sym.imp.kernel32.dll_LeaveCriticalSection]
push esi
mov esi, dword [esp + 0x14]
push edi
push dword [esi + 0xc]
mov ebx, dword [sym.imp.kernel32.dll_EnterCriticalSection]
call ebx
cmp dword [esp + 0x20], 0
je 0x1009b251
mov eax, dword [esi + 0x18]
dec eax
mov dword [esp + 0x20], 0
mov dword [esi + 0x18], eax
mov eax, dword [esi + 0x18]
cmp eax, dword [esi + 0x28]
jg 0x1009b251
mov edi, dword [esi + 8]
push dword [edi]
call ebx
mov ebx, dword [edi + 4]
test ebx, ebx
je 0x1009b24d
push dword [ebx]
call dword [sym.imp.kernel32.dll_SetEvent]
mov eax, dword [ebx + 4]
push ebx
mov dword [edi + 4], eax
call sub.api_ms_win_crt_heap_l1_1_0.dll_free
add esp, 4
push dword [edi]
call ebp
cmp dword [esi + 0x10], 1
je 0x1009b38e
mov ebx, dword [esi + 0x14]
test ebx, ebx
jne 0x1009b39b
mov edi, dword [esp + 0x1c]
cmp dword [edi + 8], ebx
jne 0x1009b296
mov dword [edi + 8], 1
inc dword [esi + 0x20]
push 8
call fcn.1008aa70
add esp, 4
test eax, eax
je 0x1009b35a
mov dword [eax], edi
mov ecx, dword [esi + 0x1c]
mov dword [eax + 4], ecx
mov dword [esi + 0x1c], eax
mov ebx, dword [esi + 8]
push dword [ebx]
call dword [sym.imp.kernel32.dll_EnterCriticalSection]
mov edi, dword [ebx + 4]
test edi, edi
je 0x1009b2bf
push dword [edi]
call dword [sym.imp.kernel32.dll_SetEvent]
mov eax, dword [edi + 4]
push edi
mov dword [ebx + 4], eax
call sub.api_ms_win_crt_heap_l1_1_0.dll_free
add esp, 4
push dword [ebx]
call ebp
mov ebx, dword [esp + 0x1c]
push dword [ebx + 0xc]
call dword [sym.imp.kernel32.dll_EnterCriticalSection]
push dword [esi + 0xc]
call ebp
mov eax, dword [ebx + 0xc]
push dword [0x101ec1a0]
mov dword [esp + 0x14], eax
mov eax, dword [ebx + 0x10]
mov dword [esp + 0x1c], eax
call dword [sym.imp.kernel32.dll_TlsGetValue]
mov edi, eax
test edi, edi
jne 0x1009b30e
push eax
push eax
push eax
push eax
call dword [sym.imp.kernel32.dll_CreateEventA]
mov edi, eax
push edi
push dword [0x101ec1a0]
call dword [sym.imp.kernel32.dll_TlsSetValue]
mov eax, dword [esp + 0x18]
push dword [eax]
call dword [sym.imp.kernel32.dll_EnterCriticalSection]
push 8
call fcn.1008aa70
mov edx, dword [esp + 0x1c]
add esp, 4
mov dword [eax], edi
mov ecx, dword [edx + 4]
mov dword [eax + 4], ecx
push dword [edx]
mov dword [edx + 4], eax
call ebp
push dword [esp + 0x10]
call ebp
push 0xffffffffffffffff
push edi
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
push dword [esp + 0x10]
call dword [sym.imp.kernel32.dll_EnterCriticalSection]
push dword [ebx + 0xc]
call ebp
jmp 0x1009b1ff
mov ebx, dword [esi + 8]
mov dword [esi + 0x10], 2
push dword [ebx]
call dword [sym.imp.kernel32.dll_EnterCriticalSection]
mov edi, dword [ebx + 4]
test edi, edi
je 0x1009b38a
push dword [edi]
call dword [sym.imp.kernel32.dll_SetEvent]
mov eax, dword [edi + 4]
push edi
mov dword [ebx + 4], eax
call sub.api_ms_win_crt_heap_l1_1_0.dll_free
add esp, 4
push dword [ebx]
call ebp
push dword [esi + 0xc]
call ebp
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
pop ecx
ret
mov eax, dword [ebx + 4]
push dword [esi + 0xc]
mov dword [esi + 0x14], eax
mov edi, dword [ebx]
call ebp
push ebx
call sub.api_ms_win_crt_heap_l1_1_0.dll_free
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
pop ecx
ret