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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
push ebx
push esi
mov ebx, ecx
mov esi, edx
push edi
mov dword [ebp - 4], esi
push dword [ebx + 0x54]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
je 0x100379a9
mov eax, 0xfffffffa
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push ebx
push dword [ebx + 0x54]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
lea edi, [ebx + 0x6c]
test edi, edi
je 0x100379c4
push 0xffffffffffffffff
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test byte [ebx + 0x70], 1
je 0x10037adc
push str.poll_fds_modified__reallocating
push str.handle_events
push 4
push 0
call fcn.10036f50
mov eax, dword [ebx + 0x80]
add esp, 0x10
test eax, eax
je 0x10037a01
push eax
call fcn.10053caa
add esp, 4
mov dword [ebx + 0x80], 0
mov eax, dword [ebx + 0x84]
cmp eax, 1
jae 0x10037a29
push 0x843
push str.C:DevProjectsVPlibusblibusb_170728libusbio.c
push str.ctx__pollfds_cnt___internal_nfds
call fcn.100557e2
mov eax, dword [ebx + 0x84]
add esp, 0xc
push 8
push eax
call fcn.100539fa
add esp, 8
mov dword [ebx + 0x80], eax
test eax, eax
jne 0x10037a63
test edi, edi
je 0x10037a4a
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push 0
push dword [ebx + 0x54]
mov esi, 0xfffffff5
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebx + 0x7c]
lea ecx, [ebx + 0x78]
lea esi, [eax - 8]
cmp eax, ecx
je 0x10037aaa
mov edx, 0xfffffff8
lea edi, [ebx + 0x78]
nop dword [eax + eax]
mov ecx, dword [ebx + 0x80]
lea edx, [edx + 8]
mov eax, dword [esi]
mov dword [edx + ecx], eax
mov ecx, dword [ebx + 0x80]
mov ax, word [esi + 4]
mov word [ecx + edx + 4], ax
mov eax, dword [esi + 0xc]
lea esi, [eax - 8]
cmp eax, edi
jne 0x10037a80
lea edi, [ebx + 0x6c]
and dword [ebx + 0x70], 0xfffffffe
jne 0x10037ad9
cmp dword [ebx + 0x74], 0
jne 0x10037ad9
lea eax, [ebx + 0x88]
cmp dword [ebx + 0x8c], eax
jne 0x10037ad9
lea eax, [ebx + 0x90]
cmp dword [ebx + 0x94], eax
jne 0x10037ad9
mov ecx, ebx
call fcn.10036100
mov esi, dword [ebp - 4]
mov eax, dword [ebx + 0x80]
mov dword [ebp - 8], eax
mov eax, dword [ebx + 0x84]
mov dword [ebp - 4], eax
test edi, edi
je 0x10037afa
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [esi + 4]
mov ecx, 0x3e8
cdq
idiv ecx
imul ecx, dword [esi], 0x3e8
add eax, ecx
test edx, edx
lea esi, [eax + 1]
cmove esi, eax
push esi
push dword [ebp - 4]
push str.poll____d_fds_with_timeout_in__dms
push str.handle_events
push 4
push 0
call fcn.10036f50
mov edx, dword [ebp - 4]
mov ecx, dword [ebp - 8]
push esi
call fcn.100405e0
add esp, 0x1c
mov esi, eax
mov dword [ebp - 0x24], esi
push esi
push str.poll___returned__d
push str.handle_events
push 4
push 0
call fcn.10036f50
add esp, 0x14
test esi, esi
jne 0x10037b78
mov ecx, ebx
call fcn.10037860
push 0
push dword [ebx + 0x54]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp esi, 0xffffffff
jne 0x10037ba0
call fcn.1004eea8
cmp dword [eax], 4
jne 0x10037ba4
push 0
push dword [ebx + 0x54]
mov esi, 0xfffffff6
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
test esi, esi
jns 0x10037bd8
call fcn.1004eea8
push dword [eax]
push esi
push str.poll_failed__d_err_d
push str.handle_events
push 1
push ebx
call fcn.10036f50
add esp, 0x18
or esi, 0xffffffff
push 0
push dword [ebx + 0x54]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 8]
cmp word [eax + 6], 0
je 0x10037ee4
push str.caught_a_fish_on_the_event_pipe
push str.handle_events
xor esi, esi
lea eax, [ebp - 0x2c]
push 4
push esi
mov dword [ebp - 0x18], esi
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x2c], eax
call fcn.10036f50
add esp, 0x10
test edi, edi
je 0x10037c17
push 0xffffffffffffffff
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [ebx + 0x70]
test al, 1
je 0x10037c37
push str.someone_updated_the_poll_fds
push str.handle_events
push 4
push 0
call fcn.10036f50
mov eax, dword [ebx + 0x70]
add esp, 0x10
test al, 2
je 0x10037c55
push str.someone_purposely_interrupted
push str.handle_events
push 4
push 0
call fcn.10036f50
add esp, 0x10
and dword [ebx + 0x70], 0xfffffffd
cmp dword [ebx + 0x74], esi
je 0x10037c70
push str.someone_is_closing_a_device
push str.handle_events
push 4
push 0
call fcn.10036f50
add esp, 0x10
lea esi, [ebx + 0x88]
cmp dword [ebx + 0x8c], esi
je 0x10037cb0
push str.hotplug_message_received
push str.handle_events
push 4
push 0
call fcn.10036f50
mov eax, dword [esi + 4]
add esp, 0x10
cmp eax, esi
je 0x10037cb0
mov dword [ebp - 0x28], eax
lea ecx, [ebp - 0x2c]
mov dword [eax], ecx
mov eax, dword [esi]
mov dword [ebp - 0x2c], eax
mov dword [eax + 4], ecx
mov dword [esi + 4], esi
mov dword [esi], esi
lea ecx, [ebx + 0x90]
mov edx, dword [ebx + 0x94]
cmp edx, ecx
je 0x10037d2a
mov ecx, dword [edx + 4]
lea esi, [edx - 0xc]
mov eax, dword [edx]
mov dword [ecx], eax
mov ecx, dword [edx]
mov eax, dword [edx + 4]
mov dword [ecx + 4], eax
mov dword [edx], 0
mov dword [edx + 4], 0
test edi, edi
je 0x10037ceb
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push esi
xor eax, eax
call eax
mov esi, eax
add esp, 4
mov dword [ebp - 0x18], esi
test esi, esi
je 0x10037d12
push esi
push str.backend_handle_transfer_completion_failed_with_error__d
push str.handle_events
push 1
push ebx
call fcn.10036f50
add esp, 0x14
test edi, edi
je 0x10037d20
push 0xffffffffffffffff
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea ecx, [ebx + 0x90]
test esi, esi
je 0x10037cb6
cmp dword [ebx + 0x70], 0
jne 0x10037d53
cmp dword [ebx + 0x74], 0
jne 0x10037d53
lea eax, [ebx + 0x88]
cmp dword [ebx + 0x8c], eax
jne 0x10037d53
cmp dword [ebx + 0x94], ecx
jne 0x10037d53
mov ecx, ebx
call fcn.10036100
test edi, edi
je 0x10037d5f
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [ebp - 0x28]
lea ecx, [ebp - 0x2c]
cmp eax, ecx
je 0x10037ed5
lea edi, [ebx + 0x30]
lea ecx, [eax - 8]
mov dword [ebp - 0x20], ecx
mov ecx, dword [eax - 8]
mov eax, dword [eax - 4]
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0xc], eax
test edi, edi
je 0x10037d90
push 0xffffffffffffffff
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [ebx + 0x2c]
mov ecx, dword [eax + 4]
lea esi, [eax - 0x28]
sub ecx, 0x28
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x10], ecx
lea ecx, [ebx + 0x28]
cmp eax, ecx
je 0x10037e83
nop dword [eax]
test edi, edi
je 0x10037dbc
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
cmp dword [esi + 0x24], 0
je 0x10037dc9
mov edi, 1
jmp 0x10037e21
mov edi, dword [ebp - 0x1c]
test dword [esi + 0x14], edi
jne 0x10037dd5
xor edi, edi
jmp 0x10037e21
mov ecx, dword [esi + 4]
mov edx, dword [ebp - 0xc]
cmp ecx, 0xffffffff
je 0x10037dec
movzx eax, word [edx + 0x30]
cmp ecx, eax
je 0x10037dec
xor edi, edi
jmp 0x10037e21
mov ecx, dword [esi + 8]
cmp ecx, 0xffffffff
je 0x10037e00
movzx eax, word [edx + 0x32]
cmp ecx, eax
je 0x10037e00
xor edi, edi
jmp 0x10037e21
mov ecx, dword [esi + 0xc]
cmp ecx, 0xffffffff
je 0x10037e14
movzx eax, byte [edx + 0x2c]
cmp ecx, eax
je 0x10037e14
xor edi, edi
jmp 0x10037e21
push dword [esi + 0x20]
mov eax, dword [esi + 0x18]
push edi
push edx
push ebx
call eax
mov edi, eax
lea eax, [ebx + 0x30]
test eax, eax
je 0x10037e32
push 0xffffffffffffffff
push dword [eax]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test edi, edi
je 0x10037e5e
mov edx, dword [ebp - 0x14]
push esi
mov ecx, dword [edx + 4]
mov eax, dword [edx]
mov dword [ecx], eax
mov ecx, dword [edx]
mov eax, dword [edx + 4]
mov dword [ecx + 4], eax
mov dword [edx], 0
mov dword [edx + 4], 0
call fcn.10053caa
add esp, 4
mov ecx, dword [ebp - 0x10]
lea edi, [ebx + 0x30]
mov esi, ecx
mov ecx, dword [ecx + 0x2c]
sub ecx, 0x28
lea eax, [esi + 0x28]
mov dword [ebp - 0x10], ecx
lea ecx, [ebx + 0x28]
mov dword [ebp - 0x14], eax
cmp eax, ecx
jne 0x10037db0
lea edi, [ebx + 0x30]
test edi, edi
je 0x10037e8f
push dword [edi]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov esi, dword [ebp - 0x20]
cmp dword [esi], 2
jne 0x10037e9f
mov ecx, dword [esi + 4]
call fcn.10035f70
mov ecx, dword [esi + 0xc]
mov eax, dword [esi + 8]
push esi
mov dword [ecx], eax
mov ecx, dword [esi + 8]
mov eax, dword [esi + 0xc]
mov dword [ecx + 4], eax
mov dword [esi + 8], 0
mov dword [esi + 0xc], 0
call fcn.10053caa
mov eax, dword [ebp - 0x28]
lea ecx, [ebp - 0x2c]
add esp, 4
cmp eax, ecx
jne 0x10037d70
mov esi, dword [ebp - 0x18]
test esi, esi
jne 0x10037f16
mov esi, dword [ebp - 0x24]
sub esi, 1
je 0x10037f16
mov eax, dword [ebp - 4]
dec eax
push esi
push eax
mov eax, dword [ebp - 8]
add eax, 8
push eax
push ebx
call fcn.100414c0
mov esi, eax
add esp, 0x10
test esi, esi
je 0x10037f16
push esi
push str.backend_handle_events_failed_with_error__d
push str.handle_events
push 1
push ebx
call fcn.10036f50
add esp, 0x14
push 0
push dword [ebx + 0x54]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
pop edi
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret