Function at 0x404580
Capabilities:
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x20
push esi
mov esi, ecx
push edi
push esi
mov dword [esp + 0x1c], esi
call fcn.00416bc3
add esp, 4
test eax, eax
jne 0x404922
cmp byte [esi + 0xea60e7], al
je 0x404913
lea eax, [esi + 0x58]
mov dword [esp + 0x1c], 5
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], eax
mov ecx, dword [eax]
mov eax, dword [ecx - 0x20]
lea esi, [ecx - 0x58]
test eax, eax
je 0x4045d2
mov eax, dword [eax + 4]
jmp 0x4045d4
xor eax, eax
push ecx
push str.transfer__p
push str.libusb_cancel_transfer
push 4
push eax
mov dword [esp + 0x20], eax
call fcn.00407c10
add esp, 0x14
lea eax, [esi + 0x3c]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 0x30]
and al, 3
cmp al, 1
jne 0x40465b
push esi
call fcn.0040b930
mov edi, eax
add esp, 4
test edi, edi
jns 0x404657
cmp edi, 0xfffffffb
je 0x404635
cmp edi, 0xfffffffc
je 0x404635
push edi
push str.cancel_transfer_failed_error__d
push str.libusb_cancel_transfer
push 1
push dword [esp + 0x1c]
call fcn.00407c10
add esp, 0x14
jmp 0x404657
push edi
push str.cancel_transfer_failed_error__d
push str.libusb_cancel_transfer
push 4
push dword [esp + 0x1c]
call fcn.00407c10
add esp, 0x14
cmp edi, 0xfffffffc
jne 0x404657
or dword [esi + 0x30], 4
or dword [esi + 0x30], 2
lea eax, [esi + 0x3c]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0x10]
add eax, 4
sub dword [esp + 0x1c], 1
mov dword [esp + 0x10], eax
jne 0x4045c1
mov esi, dword [esp + 0x18]
cmp byte [esi + 0xea60e7], 0
lea edi, [esi + 0x30]
je 0x4046a3
nop dword [eax + eax]
push esi
push edi
call fcn.00416192
add esp, 8
cmp byte [esi + 0xea60e7], 0
jne 0x404690
mov eax, dword [esp + 0x14]
mov ecx, 5
mov dword [esp + 0x1c], ecx
mov edi, dword [eax]
test edi, edi
je 0x404884
mov eax, dword [edi - 0x20]
test eax, eax
je 0x4046c6
mov eax, dword [eax + 4]
jmp 0x4046c8
xor eax, eax
push edi
push str.transfer__p
push str.libusb_free_transfer
push 4
push eax
call fcn.00407c10
add esp, 0x14
test byte [edi + 4], 2
je 0x4046ef
push dword [edi + 0x20]
call fcn.0041ffac
add esp, 4
lea eax, [edi - 0x1c]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
mov esi, dword [edi - 0x20]
mov dword [esp + 0x10], esi
test esi, esi
je 0x404867
or eax, 0xffffffff
lock xadd dword [esi], eax
dec eax
jne 0x404867
movzx eax, byte [esi + 0xe]
push eax
movzx eax, byte [esi + 0xc]
push eax
push str.destroy_device__d._d
push str.libusb_unref_device
push 4
push dword [esi + 4]
call fcn.00407c10
mov ecx, dword [esi + 8]
add esp, 0x18
call fcn.00406e20
mov eax, dword [esi + 4]
push esi
mov eax, dword [eax + 0x128]
mov eax, dword [eax + 0x3c]
call eax
mov eax, dword [esi + 4]
add esp, 4
mov dword [esi + 0x34], 0
mov dword [esp + 0xc], eax
lea esi, [eax + 0x1c]
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov edx, dword [esp + 0x10]
push esi
mov ecx, dword [edx + 0x18]
mov eax, dword [edx + 0x14]
mov dword [ecx], eax
mov ecx, dword [edx + 0x14]
mov eax, dword [edx + 0x18]
mov dword [ecx + 4], eax
mov dword [edx + 0x14], 0
mov dword [edx + 0x18], 0
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov esi, dword [esp + 0xc]
cmp dword [esi + 0x78], 0
je 0x40485b
push 0x10
push 1
call fcn.0041ffa1
mov ecx, eax
add esp, 8
mov dword [esp + 0x20], ecx
test ecx, ecx
jne 0x4047d1
push str.error_allocating_hotplug_message
push str.usbi_hotplug_notification
push 1
push esi
call fcn.00407c10
add esp, 0x10
jmp 0x40485b
mov eax, dword [esp + 0x10]
mov dword [ecx + 4], eax
lea eax, [esi + 0xd8]
push eax
mov dword [ecx], 2
mov dword [esp + 0x28], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov esi, dword [esi + 0xf0]
mov eax, esi
mov ecx, dword [esp + 0xc]
or eax, 8
lea edx, [ecx + 0x110]
mov dword [ecx + 0xf0], eax
mov ecx, dword [esp + 0x20]
add ecx, 8
mov dword [ecx + 4], edx
mov eax, dword [edx]
mov dword [ecx], eax
mov eax, dword [edx]
mov dword [eax + 4], ecx
mov dword [edx], ecx
test esi, esi
jne 0x404851
mov eax, dword [esp + 0xc]
push dword [eax + 0xc]
call dword [sym.imp.KERNEL32.dll_SetEvent]
test eax, eax
jne 0x404851
xor ecx, ecx
call fcn.0040a9e0
push eax
push str.SetEvent_failed:__s
push str.usbi_signal_event
push 2
push esi
call fcn.00407c10
add esp, 0x14
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push dword [esp + 0x10]
call fcn.0041ffac
add esp, 4
lea eax, [edi - 0xc8]
push eax
call fcn.0041ffac
mov eax, dword [esp + 0x18]
add esp, 4
mov ecx, dword [esp + 0x1c]
mov dword [eax], 0
add eax, 4
sub ecx, 1
mov dword [esp + 0x14], eax
mov dword [esp + 0x1c], ecx
jne 0x4046b0
mov eax, dword fs:[0x2c]
mov ecx, dword [eax]
mov eax, dword [0x44594c]
cmp eax, dword [ecx + 4]
jg 0x404928
mov eax, 0x445944
or esi, 0xffffffff
lock xadd dword [eax], esi
cmp esi, 1
jne 0x40490f
mov al, 1
mov esi, 0x445948
xchg byte [esi], al
cmp dword [0x445940], 0
je 0x4049ac
call sub.KERNEL32.dll_GetCurrentThreadId
mov ecx, dword [0x445940]
cmp ecx, eax
je 0x4049b3
push 0
push ecx
push dword [0x44593c]
call fcn.00415d7e
add esp, 0xc
test eax, eax
jne 0x4049ba
xorps xmm0, xmm0
xor al, al
movlpd qword [0x44593c], xmm0
xchg byte [esi], al
mov esi, dword [esp + 0x18]
push esi
call fcn.00416be8
add esp, 4
pop edi
pop esi
mov esp, ebp
pop ebp
ret
push eax
call fcn.0041678a
push 0x44594c
call fcn.0041719b
add esp, 4
cmp dword [0x44594c], 0xffffffff
jne 0x4048ad
xorps xmm0, xmm0
mov dword [0x445938], 0
push ecx
movq qword [0x44593c], xmm0
mov dword [0x445944], 0
mov byte [0x445948], 0
call fcn.00407530
movzx eax, byte [0x4448d0]
neg eax
sbb eax, eax
and eax, 3
push eax
push 0
push dword [0x445938]
call fcn.004073c0
add esp, 0xc
push 0x433a20
call fcn.004174ad
add esp, 4
push 0x44594c
call fcn.00417151
add esp, 4
jmp 0x4048ad
push 1
call fcn.004167b7
push 5
call fcn.004167b7
push 2
call fcn.004167b7
int3