Function at 0x598f00
Capabilities:
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
lea edi, [eax + 0xd8]
mov ebx, eax
mov esi, edx
sub esp, 0x6c
mov eax, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [esp], edi
mov dword [ebp - 0x40], eax
call eax
sub esp, 4
test byte [ebx + 0xf0], 1
je 0x598f70
mov dword [esp + 0xc], str.event_sources_modified__reallocating_event_data
mov dword [esp + 8], str.handle_events
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov eax, ebx
call sym._cleanup_removed_event_sources
mov dword [esp], ebx
call sym._usbi_alloc_event_data
test eax, eax
jne 0x599090
and dword [ebx + 0xf0], 0xfffffffe
je 0x599080
mov eax, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [esp], edi
mov dword [ebp - 0x44], eax
call eax
mov ecx, dword [esi + 4]
mov edx, 0x10624dd3
sub esp, 4
imul esi, dword [esi], 0x3e8
mov dword [esp + 4], ebx
mov dword [ebp - 0x28], 0
mov eax, ecx
imul edx
mov eax, ecx
sar eax, 0x1f
sar edx, 6
sub edx, eax
mov eax, dword [ebx + 0xb8]
add esi, edx
imul edx, edx, 0x3e8
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_TlsSetValue]
sub ecx, edx
cmp ecx, 1
mov dword [ebp - 0x3c], eax
sbb esi, 0xffffffff
call eax
sub esp, 8
test eax, eax
jne 0x598fee
mov dword [esp + 8], 0x65
mov dword [esp + 4], str.os_threads_windows.h
mov dword [esp], str.TlsSetValue_key__ptr____0
call dword [sym.imp.msvcrt.dll__assert]
lea eax, [ebp - 0x28]
mov dword [esp + 8], esi
mov dword [esp], ebx
mov dword [esp + 4], eax
call sym._usbi_wait_for_events
test eax, eax
mov esi, eax
jne 0x599070
movzx eax, byte [ebp - 0x28]
test al, 1
jne 0x5990b0
test al, 2
jne 0x599292
mov eax, dword [ebp - 0x1c]
test eax, eax
jne 0x5992d0
mov dword [esp + 4], 0
mov eax, dword [ebx + 0xb8]
mov ebx, esi
mov dword [esp], eax
call dword [ebp - 0x3c]
sub esp, 8
test eax, eax
jne 0x599060
mov dword [esp + 8], 0x65
mov dword [esp + 4], str.os_threads_windows.h
mov dword [esp], str.TlsSetValue_key__ptr____0
call dword [sym.imp.msvcrt.dll__assert]
lea esp, [ebp - 0xc]
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
cmp eax, 0xfffffff9
jne 0x599026
mov eax, ebx
xor esi, esi
call sym._handle_timeouts
jmp 0x599026
lea eax, [ebx + 0xc]
mov dword [esp], eax
call sym._usbi_clear_event
jmp 0x598f70
mov dword [ebp - 0x3c], eax
mov dword [esp], edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0x3c]
sub esp, 4
lea esp, [ebp - 0xc]
mov ebx, eax
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 0xc], str.event_triggered
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
lea eax, [ebp - 0x38]
mov dword [esp], edi
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x38], eax
call dword [ebp - 0x40]
mov edx, dword [ebx + 0xf0]
sub esp, 4
test dl, 1
jne 0x599460
test dl, 2
jne 0x599410
test dl, 4
mov dword [ebp - 0x48], 0
jne 0x5993d0
test dl, 0x20
jne 0x5993a0
test dl, 8
jne 0x599330
xor eax, eax
test dl, 0x10
je 0x59924e
mov eax, dword [ebx + 0x11c]
lea ecx, [ebx + 0x118]
mov dword [ebp - 0x50], ecx
cmp eax, ecx
je 0x5994bd
lea ecx, [ebp - 0x30]
mov dword [ebp - 0x2c], eax
mov dword [eax], ecx
mov eax, dword [ebx + 0x118]
mov dword [ebp - 0x4c], ecx
mov dword [eax + 4], ecx
mov dword [ebp - 0x30], eax
mov eax, dword [ebp - 0x50]
mov dword [ebx + 0x11c], eax
mov dword [ebx + 0x118], eax
mov dword [esp], edi
call dword [ebp - 0x44]
mov ecx, dword [ebp - 0x2c]
sub esp, 4
lea eax, [ecx - 0xc]
mov edx, dword [eax + 0x10]
mov dword [ebp - 0x54], ecx
lea ecx, [edx - 0xc]
mov dword [ebp - 0x58], ecx
mov ecx, dword [ebp - 0x54]
cmp dword [ebp - 0x4c], ecx
je 0x599496
mov dword [ebp - 0x54], edi
mov dword [ebp - 0x58], esi
lea edi, [edx - 0xc]
mov esi, dword [ebp - 0x4c]
jmp 0x5991b5
mov edx, dword [edi + 0x10]
mov eax, edi
lea edi, [edi + 0xc]
cmp esi, edi
lea ecx, [edx - 0xc]
je 0x599490
mov edi, ecx
mov ecx, dword [eax + 0xc]
mov dword [edx], ecx
mov ecx, dword [eax + 0xc]
mov dword [ecx + 4], edx
mov dword [eax + 0xc], 0
mov dword [eax + 0x10], 0
mov dword [esp], eax
call dword [0x72a4c0]
test eax, eax
je 0x5991a0
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.backend_handle_transfer_completion_failed_with_error__d
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 1
mov dword [esp], ebx
mov edi, dword [ebp - 0x54]
mov esi, dword [ebp - 0x58]
mov dword [ebp - 0x54], eax
call sym._usbi_log
mov eax, dword [ebp - 0x54]
mov dword [ebp - 0x54], eax
mov dword [esp], edi
call dword [ebp - 0x40]
mov edx, dword [ebp - 0x2c]
sub esp, 4
cmp edx, dword [ebp - 0x4c]
mov ecx, dword [ebp - 0x50]
mov eax, dword [ebp - 0x54]
je 0x59949d
mov dword [edx], ecx
mov ecx, dword [ebx + 0x11c]
mov edx, dword [ebp - 0x30]
mov dword [edx + 4], ecx
mov ecx, dword [ebx + 0x11c]
mov dword [ecx], edx
mov edx, dword [ebp - 0x2c]
mov dword [ebx + 0x11c], edx
mov edx, dword [ebx + 0xf0]
test edx, edx
je 0x599444
mov dword [ebp - 0x4c], eax
mov dword [esp], edi
call dword [ebp - 0x44]
mov eax, dword [ebp - 0x48]
sub esp, 4
test eax, eax
mov eax, dword [ebp - 0x4c]
je 0x599281
mov dword [ebp - 0x48], eax
lea eax, [ebp - 0x38]
mov dword [esp], ebx
mov dword [esp + 4], eax
call sym._usbi_hotplug_process
mov eax, dword [ebp - 0x48]
test eax, eax
jne 0x599320
movzx eax, byte [ebp - 0x28]
jmp 0x599013
lea edx, [ebx + 0x84]
mov dword [esp], edx
mov dword [ebp - 0x48], edx
call dword [ebp - 0x40]
mov eax, ebx
sub esp, 4
call sym._handle_timeouts_locked
mov eax, ebx
call sym._arm_timer_for_next_timeout
mov edx, dword [ebp - 0x48]
mov edi, eax
mov dword [esp], edx
call dword [ebp - 0x44]
sub esp, 4
test edi, edi
je 0x59901b
mov esi, edi
jmp 0x599026
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x20]
mov dword [esp], ebx
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x24]
mov dword [esp + 4], eax
call dword [0x72a4bc]
test eax, eax
mov esi, eax
je 0x599026
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.backend_handle_events_failed_with_error__d
mov dword [esp + 8], str.handle_events
mov dword [esp + 4], 1
mov dword [esp], ebx
call sym._usbi_log
jmp 0x599026
mov esi, eax
jmp 0x599026
mov dword [esp + 0xc], str.hotplug_message_received
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov eax, dword [ebx + 0x114]
lea edx, [ebx + 0x110]
and dword [ebx + 0xf0], 0xfffffff7
cmp eax, edx
je 0x5994fa
lea ecx, [ebp - 0x38]
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x48], 1
mov dword [eax], ecx
mov eax, dword [ebx + 0x110]
mov dword [eax + 4], ecx
mov dword [ebp - 0x38], eax
mov dword [ebx + 0x114], edx
mov dword [ebx + 0x110], edx
mov edx, dword [ebx + 0xf0]
jmp 0x59911c
mov dword [esp + 0xc], str.someone_is_closing_a_device
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov edx, dword [ebx + 0xf0]
jmp 0x599113
mov dword [esp + 0xc], str.someone_unregistered_a_hotplug_cb
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov edx, dword [ebx + 0xf0]
mov dword [ebp - 0x48], 1
and edx, 0xfffffffb
mov dword [ebx + 0xf0], edx
jmp 0x59910a
mov dword [esp + 0xc], str.someone_purposefully_interrupted
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov edx, dword [ebx + 0xf0]
and edx, 0xfffffffd
mov dword [ebx + 0xf0], edx
jmp 0x5990fa
lea edx, [ebx + 0xc]
mov dword [ebp - 0x4c], eax
mov dword [esp], edx
call sym._usbi_clear_event
mov eax, dword [ebp - 0x4c]
jmp 0x599256
mov dword [esp + 0xc], str.someone_updated_the_event_sources
mov dword [esp + 8], str.handle_event_trigger
mov dword [esp + 4], 4
mov dword [esp], ebx
call sym._usbi_log
mov edx, dword [ebx + 0xf0]
jmp 0x5990f1
mov edi, dword [ebp - 0x54]
mov esi, dword [ebp - 0x58]
xor eax, eax
jmp 0x59920b
cmp ecx, dword [ebx + 0x11c]
mov edx, dword [ebx + 0xf0]
jne 0x59924e
and edx, 0xffffffef
mov dword [ebx + 0xf0], edx
jmp 0x59924e
mov dword [esp + 8], 0x85e
mov dword [esp + 4], str.io.c
mov dword [esp], str._list_empty_ctx__completed_transfers_
call dword [sym.imp.msvcrt.dll__assert]
mov eax, dword [ebx + 0x11c]
cmp dword [ebp - 0x50], eax
jne 0x59913e
lea eax, [ebp - 0x30]
mov dword [ebp - 0x4c], eax
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x30], eax
jmp 0x599164
mov dword [ebp - 0x48], edx
mov dword [esp + 8], 0x855
mov dword [esp + 4], str.io.c
mov dword [esp], str._list_empty_ctx__hotplug_msgs_
call dword [sym.imp.msvcrt.dll__assert]
mov eax, dword [ebx + 0x114]
mov edx, dword [ebp - 0x48]
cmp edx, eax
jne 0x59936b
lea eax, [ebp - 0x38]
mov edx, dword [ebx + 0xf0]
mov dword [ebp - 0x48], 1
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x38], eax
jmp 0x59911c