Function at 0x405d07
Capabilities:
Check mutex and terminate process on windows
Check mutex on windows
Create directory
Terminate process

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30
mov eax, dword [0x410004]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [sym.imp.getopt.dll_getopt_long_a]
push esi
mov esi, dword [ebp + 0xc]
push edi
mov edi, dword [ebp + 8]
push 0
push 0x410020
push str.hfvVwtaU:xXnzl:p
push esi
push edi
call ebx
add esp, 0x14
cmp eax, 0xffffffff
je 0x405c9e
nop dword [eax + eax]
add eax, 0xffffffab
cmp eax, 0x25
ja case.0x405bb3.87
movzx eax, byte [eax + 0x406394]
jmp dword [eax*4 + 0x406364]
inc dword [0x4104ac]
jmp case.0x405bb3.85
mov dword [0x4104b0], 0xff
jmp case.0x405bb3.85
mov dword [0x4104a4], 1
jmp case.0x405bb3.85
mov dword [0x4104b4], 1
jmp case.0x405bb3.85
mov dword [0x410480], 1
jmp case.0x405bb3.85
mov dword [0x4104b8], 1
jmp case.0x405bb3.85
mov dword [0x4104a8], 1
jmp case.0x405bb3.85
mov eax, dword [sym.imp.getopt.dll_optarg_a]
mov eax, dword [eax]
cmp byte [eax], 0
je 0x405cde
cmp dword [0x410484], 0
jne 0x405cc7
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push eax
mov eax, dword [sym.imp.getopt.dll_optarg_a]
push 0x40c23c
push dword [eax]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_freopen]
add esp, 0x10
test eax, eax
jne 0x405c78
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
push eax
push str.ERROR:_fdreopen:__s
push 0
call fcn.004052a0
add esp, 0x10
jmp case.0x405bb3.85
mov dword [0x410484], 1
push 0
push 0x410020
push str.hfvVwtaU:xXnzl:p
push esi
push edi
call ebx
add esp, 0x14
cmp eax, 0xffffffff
jne 0x405ba0
mov eax, dword [0x4104ac]
add eax, 3
mov dword [0x4104ac], eax
mov dword [0x410018], eax
je 0x405d31
push str.enabling_libimobiledevice_logging
push 3
cmp eax, 1
jne 0x405d21
call fcn.004052a0
push 1
jmp 0x405d28
push str.ERROR:___logfile_cannot_be_used_multiple_times
push 0
call fcn.004052a0
add esp, 8
push 2
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
push str.ERROR:___logfile_requires_a_non_empty_filename
push 0
call fcn.004052a0
add esp, 8
call fcn.00405a60
push 2
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
call fcn.00405a60
push 0
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
push str.usbmuxd_1.1.1
push 0x40c1d8
call fcn.00405360
add esp, 8
push 0
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
call fcn.004052a0
push 2
call dword [sym.imp.imobiledevice.dll_idevice_set_debug_level]
add esp, 0xc
cmp dword [0x4104a4], 0
je 0x405d45
push 2
call dword [sym.imp.imobiledevice.dll_idevice_set_socket_type]
add esp, 4
push str.1.1.1
push str.usbmuxd_v_s_starting_up
push 3
call fcn.004052a0
add esp, 0xc
mov dword [0x4104f8], 0
mov dword [0x4104fc], 0
push str.usbmuxd
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov edi, eax
mov dword [ebp - 0x2c], edi
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x405dbc
push str.Another_instance_is_already_running._Exiting.
push 1
call fcn.004052a0
add esp, 8
or ebx, 0xffffffff
push edi
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
neg ebx
pop esi
mov eax, ebx
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00408942
mov esp, ebp
pop ebp
ret
push str.Creating_socket
push 4
call fcn.004052a0
add esp, 8
call fcn.004053a0
mov edi, eax
mov ebx, edi
test edi, edi
js 0x4062e1
call fcn.00402ea0
mov ebx, dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__stat32]
mov esi, eax
lea eax, [ebp - 0x28]
mov dword [ebp - 8], 0
xorps xmm0, xmm0
push eax
push esi
movups xmmword [ebp - 0x28], xmm0
movups xmmword [ebp - 0x18], xmm0
call ebx
add esp, 8
test eax, eax
jns 0x405e80
push esi
call dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__mkdir]
add esp, 4
test eax, eax
jns 0x405e59
mov eax, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
call eax
push dword [eax]
mov eax, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
call eax
push eax
push esi
push str.Failed_to_create_required_directory__s:__s
push 0
call fcn.004052a0
add esp, 0x14
push dword [ebp - 0x2c]
or ebx, 0xffffffff
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
neg ebx
pop esi
mov eax, ebx
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00408942
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x28]
push eax
push esi
call ebx
add esp, 8
test eax, eax
jns 0x405e80
mov eax, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
call eax
push dword [eax]
mov eax, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
call eax
push eax
push esi
push str.stat___failed_after_creating_directory__s:__s
jmp 0x405e2e
push str.client_init
push 5
call fcn.004052a0
mov ebx, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
push 0x20
call ebx
mov esi, dword [sym.imp.pthreadVC3.dll_pthread_mutex_init]
xorps xmm0, xmm0
mov dword [0x41048c], eax
push 0
movups xmmword [eax], xmm0
mov eax, dword [0x41048c]
push 0x410510
movups xmmword [eax + 0x10], xmm0
mov dword [0x410490], 8
call esi
push str.device_init
push 5
call fcn.004052a0
push 0x20
call ebx
mov dword [0x41049c], eax
xorps xmm0, xmm0
push 0
push 0x410500
movups xmmword [eax], xmm0
mov eax, dword [0x41049c]
movups xmmword [eax + 0x10], xmm0
mov dword [0x4104a0], 8
call esi
push str.Initializing_USB
push 4
mov dword [0x410504], 1
call fcn.004052a0
mov eax, dword [0x4104b0]
add esp, 0x30
mov dword [0x410488], eax
call dword [sym.imp.libusb_1.0.dll_libusb_get_version]
movzx ecx, word [eax + 4]
push ecx
movzx ecx, word [eax + 2]
movzx eax, word [eax]
push ecx
push eax
push str.Using_libusb__d._d._d
push 3
call fcn.004052a0
add esp, 0x14
mov dword [0x4104d4], 0
mov dword [0x4104c4], 1
push 0
call dword [sym.imp.libusb_1.0.dll_libusb_init]
mov esi, eax
mov eax, dword [0x410018]
cmp eax, 5
jb 0x405f6f
mov ecx, 4
jmp 0x405f7a
cmp eax, 2
sbb ecx, ecx
and ecx, 0xfffffffe
add ecx, 2
push ecx
push 0
push 0
call dword [sym.imp.libusb_1.0.dll_libusb_set_option]
add esp, 0xc
call dword [sym.imp.libusb0.dll_usb_init]
mov eax, dword [0x410488]
test eax, eax
jle 0x405fa1
push eax
call dword [sym.imp.libusb0.dll_usb_set_debug]
add esp, 4
call dword [sym.imp.libusb0.dll_usb_find_busses]
call dword [sym.imp.libusb0.dll_usb_find_devices]
push 0x4104e0
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
test esi, esi
je 0x405fd8
push esi
call dword [sym.imp.libusb_1.0.dll_libusb_error_name]
push eax
push str.libusb_init_failed:__s
push 0
call fcn.004052a0
add esp, 0xc
jmp 0x405e38
push 0x20
call ebx
mov dword [0x4104cc], eax
xorps xmm0, xmm0
add esp, 4
movups xmmword [eax], xmm0
mov eax, dword [0x4104cc]
push 1
movups xmmword [eax + 0x10], xmm0
mov dword [0x4104d0], 8
call dword [sym.imp.libusb_1.0.dll_libusb_has_capability]
test eax, eax
je 0x40631c
push str.Registering_for_libusb_hotplug_events
push 4
call fcn.004052a0
add esp, 8
push 0x4104c8
push 0
push 0x408180
push 0
push 0xffffffffffffffff
push 0x5ac
push 1
push 3
push 0
call dword [sym.imp.libusb_1.0.dll_libusb_hotplug_register_callback]
test eax, eax
jne 0x406303
mov dword [0x4104c4], eax
mov ecx, 0x4104cc
call fcn.00408470
mov ebx, eax
test ebx, ebx
js 0x4062e1
mov ecx, 0x40c34c
cmp ebx, 1
mov eax, 0x40c349
cmovne eax, ecx
push eax
push ebx
push str._d_device_s_detected
push 4
call fcn.004052a0
push str.Initialization_complete
push 3
call fcn.004052a0
add esp, 0x18
cmp dword [0x4104b8], 0
je 0x4060c5
push str.Automatic_device_discovery_on_hotplug_disabled.
push 3
call fcn.004052a0
push 0
push str.usb_polling_enable:__d
push 5
call fcn.004052a0
add esp, 0x14
mov dword [0x4104c4], 0
mov dword [0x41001c], 0
cmp dword [0x4104a8], 0
je 0x4060dd
push str.Enabled_exit_on_SIGUSR1_if_no_devices_are_attached._Start_a_new_instance_with____exit__to_trigger.
push 3
call fcn.004052a0
add esp, 8
mov ecx, edi
call fcn.004055b0
mov dword [ebp - 0x30], eax
test eax, eax
jns 0x4060fa
push str.main_loop_failed
push 0
call fcn.004052a0
add esp, 8
push str.usbmuxd_shutting_down
push 3
call fcn.004052a0
call fcn.00405090
push str.usb_shutdown
push 5
call fcn.004052a0
add esp, 0x10
push dword [0x4104c8]
push 0
call dword [sym.imp.libusb_1.0.dll_libusb_hotplug_deregister_callback]
mov ecx, dword [0x4104d0]
xor esi, esi
test ecx, ecx
jle 0x406159
mov eax, dword [0x4104cc]
mov edi, dword [eax + esi*4]
test edi, edi
je 0x406154
mov ecx, edi
call fcn.00404c20
mov ecx, edi
call fcn.00406d60
mov ecx, dword [0x4104d0]
inc esi
cmp esi, ecx
jl 0x406134
push dword [0x4104cc]
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call edi
add esp, 4
mov dword [0x4104cc], 0
mov dword [0x4104d0], 0
push 0
call dword [sym.imp.libusb_1.0.dll_libusb_exit]
push str.device_shutdown
push 5
call fcn.004052a0
push 0x410500
call dword [sym.imp.pthreadVC3.dll_pthread_mutex_lock]
mov ecx, dword [0x4104a0]
add esp, 0xc
xor ebx, ebx
test ecx, ecx
jle 0x40623f
mov eax, dword [0x41049c]
mov esi, dword [eax + ebx*4]
test esi, esi
je 0x406236
xor edi, edi
cmp dword [esi + 0x14], edi
jle 0x4061d8
mov eax, dword [esi + 0x10]
mov ecx, dword [eax + edi*4]
test ecx, ecx
je 0x4061d2
call fcn.00403930
inc edi
cmp edi, dword [esi + 0x14]
jl 0x4061c3
push dword [esi + 0x10]
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call edi
mov dword [esi + 0x10], 0
add esp, 4
mov dword [esi + 0x14], 0
xor eax, eax
mov ecx, dword [0x4104a0]
test ecx, ecx
jle 0x406214
mov edx, dword [0x41049c]
cmp dword [edx + eax*4], esi
je 0x406342
inc eax
cmp eax, ecx
jl 0x406206
push ecx
push 0x41049c
push esi
push str.collection_remove:_element__p_not_present_in_collection__p__cap__d_
push 1
call fcn.004052a0
add esp, 0x14
push esi
call edi
mov ecx, dword [0x4104a0]
add esp, 4
inc ebx
cmp ebx, ecx
jl 0x4061b0
push 0x410500
call dword [sym.imp.pthreadVC3.dll_pthread_mutex_unlock]
mov ebx, dword [sym.imp.pthreadVC3.dll_pthread_mutex_destroy]
push 0x410500
call ebx
push dword [0x41049c]
call edi
push str.client_shutdown
push 5
mov dword [0x41049c], 0
mov dword [0x4104a0], 0
call fcn.004052a0
mov edx, dword [0x410490]
add esp, 0x14
xor esi, esi
test edx, edx
jle 0x4062ac
nop
mov eax, dword [0x41048c]
mov ecx, dword [eax + esi*4]
test ecx, ecx
je 0x4062a7
call fcn.00401100
mov edx, dword [0x410490]
inc esi
cmp esi, edx
jl 0x406290
push 0x410510
call ebx
push dword [0x41048c]
call edi
push str.Shutdown_complete
push 3
mov dword [0x41048c], 0
mov dword [0x410490], 0
call fcn.004052a0
mov ebx, dword [ebp - 0x30]
add esp, 0x10
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test ebx, ebx
jns 0x40634e
pop edi
neg ebx
pop esi
mov eax, ebx
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00408942
mov esp, ebp
pop ebp
ret
push eax
call dword [sym.imp.libusb_1.0.dll_libusb_error_name]
push eax
push str.ERROR:_Could_not_register_for_libusb_hotplug_events.__s
push 1
call fcn.004052a0
add esp, 0xc
jmp 0x40632b
push str.libusb_does_not_support_hotplug_events
push 1
call fcn.004052a0
add esp, 8
cmp dword [0x4104c4], 0
je 0x40604a
call fcn.00407e20
jmp 0x406054
mov dword [edx + eax*4], 0
jmp 0x40622a
mov ecx, dword [ebp - 4]
xor ebx, ebx
pop edi
pop esi
mov eax, ebx
xor ecx, ebp
pop ebx
call fcn.00408942
mov esp, ebp
pop ebp
ret