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

Disassembly:
push rbx
push rdi
sub rsp, 0x58
mov rbx, rcx
mov rdi, rdx
mov ecx, dword [rcx + 0x94]
call qword [sym.imp.KERNEL32.dll_TlsGetValue]
test rax, rax
je 0x14000529a
mov eax, 0xfffffffa
add rsp, 0x58
pop rdi
pop rbx
ret
mov ecx, dword [rbx + 0x94]
mov rdx, rbx
mov qword [rsp + 0x50], rsi
mov qword [rsp + 0x48], r12
mov qword [rsp + 0x38], r14
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
lea rsi, [rbx + 0xc0]
test rsi, rsi
je 0x1400052d0
mov rcx, qword [rsi]
or edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
xor r12d, r12d
test byte [rbx + 0xc8], 1
je 0x1400053fd
lea r9, str.poll_fds_modified__reallocating
xor ecx, ecx
lea r8, str.handle_events
lea edx, [r12 + 4]
call fcn.140003000
mov rcx, qword [rbx + 0xe0]
test rcx, rcx
je 0x140005312
call fcn.14008f86c
mov qword [rbx + 0xe0], r12
cmp dword [rbx + 0xe8], 1
jae 0x140005334
mov r8d, 0x832
lea rdx, str...libusbio.c
lea rcx, str.ctx__pollfds_cnt___internal_nfds
call fcn.14009dd00
mov ecx, dword [rbx + 0xe8]
mov edx, 8
call fcn.14008f864
mov qword [rbx + 0xe0], rax
test rax, rax
jne 0x140005369
test rsi, rsi
je 0x14000535e
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov r14d, 0xfffffff5
jmp 0x1400057d0
mov rdx, qword [rbx + 0xd8]
lea r9, [rbx + 0xd0]
sub rdx, 8
lea rax, [rdx + 8]
cmp rax, r9
je 0x1400053c3
mov r8, 0xfffffffffffffff8
nop dword [rax + rax]
mov eax, dword [rdx]
lea r8, [r8 + 8]
mov rcx, qword [rbx + 0xe0]
mov dword [r8 + rcx], eax
movzx eax, word [rdx + 4]
mov rcx, qword [rbx + 0xe0]
mov word [r8 + rcx + 4], ax
mov rdx, qword [rdx + 0x10]
sub rdx, 8
lea rax, [rdx + 8]
cmp rax, r9
jne 0x140005390
and dword [rbx + 0xc8], 0xfffffffe
jne 0x1400053fd
cmp dword [rbx + 0xcc], r12d
jne 0x1400053fd
lea rax, [rbx + 0xf0]
cmp qword [rbx + 0xf8], rax
jne 0x1400053fd
lea rax, [rbx + 0x100]
cmp qword [rbx + 0x108], rax
jne 0x1400053fd
mov rcx, rbx
call fcn.140001e50
mov qword [rsp + 0x78], rbp
mov rbp, qword [rbx + 0xe0]
mov qword [rsp + 0x30], r15
mov r15d, dword [rbx + 0xe8]
mov qword [rsp + 0x88], rbp
mov dword [rsp + 0x70], r15d
test rsi, rsi
je 0x140005430
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov r8d, dword [rdi + 4]
lea r9, str.poll____d_fds_with_timeout_in__dms
imul ecx, dword [rdi], 0x3e8
mov eax, 0x10624dd3
imul r8d
mov qword [rsp + 0x40], r13
sar edx, 6
mov eax, edx
shr eax, 0x1f
add edx, eax
add ecx, edx
imul eax, edx, 0x3e8
mov edx, 4
lea edi, [rcx + 1]
cmp r8d, eax
lea r8, str.handle_events
cmove edi, ecx
xor ecx, ecx
mov dword [rsp + 0x28], edi
mov dword [rsp + 0x20], r15d
call fcn.140003000
mov r8d, edi
mov edx, r15d
mov rcx, rbp
call fcn.140006ff0
lea r9, str.poll___returned__d
mov dword [rsp + 0x20], eax
lea r8, str.handle_events
mov edx, 4
xor ecx, ecx
mov r14d, eax
call fcn.140003000
test r14d, r14d
je 0x1400057b6
nop dword [rax]
cmp r14d, 0xffffffff
je 0x1400057fc
test r14d, r14d
js 0x140005806
cmp word [rbp + 6], 0
mov dword [rsp + 0x80], r12d
je 0x140005712
lea r9, str.caught_a_fish_on_the_event_pipe
mov edx, 4
lea r8, str.handle_events
xor ecx, ecx
mov r15, r12
mov ebp, r12d
call fcn.140003000
test rsi, rsi
je 0x140005517
mov rcx, qword [rsi]
or edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test byte [rbx + 0xc8], 1
je 0x14000553a
lea r9, str.someone_updated_the_poll_fds
mov edx, 4
lea r8, str.handle_events
xor ecx, ecx
call fcn.140003000
test byte [rbx + 0xc8], 2
je 0x140005564
lea r9, str.someone_purposely_interrupted
mov edx, 4
lea r8, str.handle_events
xor ecx, ecx
call fcn.140003000
and dword [rbx + 0xc8], 0xfffffffd
cmp dword [rbx + 0xcc], 0
je 0x140005587
lea r9, str.someone_is_closing_a_device
mov edx, 4
lea r8, str.handle_events
xor ecx, ecx
call fcn.140003000
lea r13, [rbx + 0xf0]
cmp qword [rbx + 0xf8], r13
je 0x1400055e6
lea r9, str.hotplug_message_received
mov edx, 4
lea r8, str.handle_events
xor ecx, ecx
call fcn.140003000
mov r15, qword [rbx + 0xf8]
sub r15, 0x10
mov dword [rsp + 0x80], 1
mov rcx, qword [r15 + 0x18]
mov rax, qword [r15 + 0x10]
mov qword [rcx], rax
mov rcx, qword [r15 + 0x10]
mov rax, qword [r15 + 0x18]
mov qword [rcx + 8], rax
mov qword [r15 + 0x10], r12
mov qword [r15 + 0x18], r12
lea r12, [rbx + 0x100]
xor r13d, r13d
mov rdi, qword [rbx + 0x108]
cmp rdi, r12
je 0x140005667
mov rdx, qword [rdi + 8]
mov rax, qword [rdi]
mov qword [rdx], rax
mov rdx, qword [rdi]
mov rax, qword [rdi + 8]
mov qword [rdx + 8], rax
mov qword [rdi], r13
mov qword [rdi + 8], r13
test rsi, rsi
je 0x140005626
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
lea rcx, [rdi - 0x18]
call r13
mov ebp, eax
test eax, eax
je 0x140005652
lea r9, str.backend_handle_transfer_completion_failed_with_error__d
mov dword [rsp + 0x20], eax
lea r8, str.handle_events
mov edx, 1
mov rcx, rbx
call fcn.140003000
test rsi, rsi
je 0x140005663
mov rcx, qword [rsi]
or edx, 0xffffffff
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test ebp, ebp
je 0x1400055f0
cmp dword [rbx + 0xc8], r13d
lea r13, [rbx + 0xf0]
jne 0x1400056bb
cmp dword [rbx + 0xcc], 0
jne 0x1400056bb
cmp qword [rbx + 0xf8], r13
jne 0x1400056bb
cmp qword [rbx + 0x108], r12
jne 0x1400056bb
mov ecx, dword [rbx + 8]
call fcn.140007500
cmp rax, 1
je 0x1400056bb
lea r9, str.internal_signalling_read_failed
mov edx, 2
lea r8, str.usbi_clear_event
mov rcx, rbx
call fcn.140003000
test rsi, rsi
je 0x1400056c9
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
test r15, r15
je 0x1400056f4
mov r8d, dword [r15]
mov rcx, rbx
mov rdx, qword [r15 + 8]
call fcn.140007600
cmp dword [r15], 2
jne 0x1400056ec
mov rcx, qword [r15 + 8]
call fcn.140001d90
mov rcx, r15
call fcn.14008f86c
test ebp, ebp
jne 0x1400057f7
mov rbp, qword [rsp + 0x88]
mov r15d, dword [rsp + 0x70]
sub r14d, 1
je 0x14000574d
xor r12d, r12d
lea r8d, [r15 - 1]
mov r9d, r14d
lea rdx, [rbp + 8]
mov rcx, rbx
call fcn.1400119a0
mov r14d, eax
test eax, eax
je 0x140005750
lea r9, str.backend_handle_events_failed_with_error__d
mov dword [rsp + 0x20], eax
lea r8, str.handle_events
mov edx, 1
mov rcx, rbx
call fcn.140003000
jmp 0x1400057c1
xor r12d, r12d
cmp dword [rsp + 0x80], 0
je 0x1400057c1
mov dword [rsp + 0x28], r12d
lea r9, str.poll____d_fds_with_timeout_in__dms
lea r8, str.handle_events
mov dword [rsp + 0x20], r15d
mov edx, 4
xor ecx, ecx
call fcn.140003000
xor r8d, r8d
mov edx, r15d
mov rcx, rbp
call fcn.140006ff0
lea r9, str.poll___returned__d
mov dword [rsp + 0x20], eax
lea r8, str.handle_events
mov edx, 4
xor ecx, ecx
mov r14d, eax
call fcn.140003000
test r14d, r14d
jne 0x1400054c0
mov rcx, rbx
call fcn.140005210
mov r14d, eax
mov r13, qword [rsp + 0x40]
mov rbp, qword [rsp + 0x78]
mov r15, qword [rsp + 0x30]
mov ecx, dword [rbx + 0x94]
xor edx, edx
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
mov r12, qword [rsp + 0x48]
mov eax, r14d
mov r14, qword [rsp + 0x38]
mov rsi, qword [rsp + 0x50]
add rsp, 0x58
pop rdi
pop rbx
ret
mov r14d, ebp
jmp 0x1400057c1
call fcn.1400927fc
cmp dword [rax], 4
je 0x140005837
call fcn.1400927fc
lea r9, str.poll_failed__d_err_d
mov edx, 1
lea r8, str.handle_events
mov ecx, dword [rax]
mov dword [rsp + 0x28], ecx
mov rcx, rbx
mov dword [rsp + 0x20], r14d
call fcn.140003000
or r14d, 0xffffffff
jmp 0x1400057c1
mov r14d, 0xfffffff6
jmp 0x1400057c1