Function at 0x412375
Capabilities:
Check mutex on windows
Check os version
Create thread
Terminate thread

Disassembly:
push rbp
sub rsp, 0x100
lea rbp, [rsp + 0x80]
mov qword [rbp + 0x90], rcx
mov dword [rbp + 0x78], 0xffffff9d
mov rax, qword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
call rax
mov edx, eax
lea rax, [rbp - 0x50]
mov r8d, edx
lea rdx, str.libusb_init_08X
mov rcx, rax
call sym.sprintf
lea rax, [rbp - 0x50]
mov r9, rax
mov r8d, 1
mov edx, 1
mov ecx, 0
mov rax, qword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
call rax
mov qword [rbp + 0x70], rax
cmp qword [rbp + 0x70], 0
jne 0x412417
mov ecx, 0
call sym.windows_error_str
mov qword [rsp + 0x20], rax
lea r9, str.could_not_create_semaphore:__s
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
mov eax, 0xfffffff5
jmp 0x412975
mov rax, qword [rbp + 0x70]
mov edx, 0xffffffff
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
call rax
test eax, eax
je 0x412478
mov ecx, 0
call sym.windows_error_str
mov qword [rsp + 0x20], rax
lea r9, str.failure_to_access_semaphore:__s
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
mov rax, qword [rbp + 0x70]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov eax, 0xfffffff5
jmp 0x412975
mov eax, dword [0x004f1c40]
add eax, 1
mov dword [0x004f1c40], eax
mov eax, dword [0x004f1c40]
test eax, eax
jne 0x4127b6
lea rax, [rbp - 0x30]
mov r8d, 0x94
mov edx, 0
mov rcx, rax
call sym.memset
mov dword [rbp - 0x30], 0x94
mov dword [0x00528f40], 0
lea rax, [rbp - 0x30]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_GetVersionExA]
call rax
test eax, eax
je 0x412523
mov eax, dword [rbp - 0x20]
cmp eax, 2
jne 0x412523
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jne 0x4124f5
mov eax, dword [rbp - 0x28]
cmp eax, 1
jne 0x4124f5
mov dword [0x00528f40], 1
jmp 0x412523
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jne 0x412511
mov eax, dword [rbp - 0x28]
cmp eax, 2
jne 0x412511
mov dword [0x00528f40], 2
jmp 0x412523
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jbe 0x412523
mov dword [0x00528f40], 3
mov eax, dword [0x00528f40]
test eax, eax
jne 0x412558
lea r9, str.This_version_of_Windows_is_NOT_supported
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
mov dword [rbp + 0x78], 0xfffffff4
jmp 0x4127bd
mov edx, 0
lea rax, [0x005319d0]
mov rcx, rax
call sym.usbi_mutex_init
call sym.init_polling
call sym.init_dlls
test eax, eax
je 0x4125a3
lea r9, str.could_not_resolve_DLL_functions
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
mov eax, 0xfffffffb
jmp 0x412975
mov dword [rbp + 0x7c], 0
jmp 0x4125db
mov eax, dword [rbp + 0x7c]
movsxd rdx, eax
mov rax, rdx
shl rax, 2
add rax, rdx
shl rax, 5
mov rdx, rax
lea rax, sym.unsupported_init
mov rax, qword [rdx + rax]
mov rcx, qword [rbp + 0x90]
call rax
add dword [rbp + 0x7c], 1
cmp dword [rbp + 0x7c], 3
jle 0x4125ac
mov dword [rbp + 0x78], 0xfffffff5
mov dword [rbp + 0x7c], 0
jmp 0x412678
mov r9d, 0
mov r8d, 0
mov edx, 1
mov ecx, 0
mov rax, qword [sym.imp.KERNEL32.dll_CreateEventA]
call rax
mov edx, dword [rbp + 0x7c]
movsxd rdx, edx
lea rcx, [rdx*8]
lea rdx, [0x00528f60]
mov qword [rcx + rdx], rax
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x00528f60]
mov rax, qword [rdx + rax]
test rax, rax
jne 0x412674
mov eax, dword [rbp + 0x7c]
mov dword [rsp + 0x20], eax
lea r9, str.could_not_create_timer_request_event__d___aborting
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
jmp 0x4127bd
add dword [rbp + 0x7c], 1
cmp dword [rbp + 0x7c], 1
jle 0x4125f4
mov r9d, 0
mov r8d, pe_nt_image_headers64
mov edx, 0
mov ecx, 0
mov rax, qword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
call rax
mov qword [0x00528f70], rax
mov rax, qword [0x00528f70]
test rax, rax
jne 0x4126d8
lea r9, str.could_not_create_timer_response_semaphore___aborting
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
jmp 0x4127bd
mov r8d, 0
mov edx, 0
mov ecx, 0
mov rax, qword [sym.imp.KERNEL32.dll_CreateMutexA]
call rax
mov qword [0x00528f50], rax
mov rax, qword [0x00528f50]
test rax, rax
jne 0x412728
lea r9, str.could_not_create_timer_mutex___aborting
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
jmp 0x4127bd
mov qword [rsp + 0x28], 0
mov dword [rsp + 0x20], 0
mov r9d, 0
lea r8, [sym.windows_clock_gettime_threaded]
mov edx, 0
mov ecx, 0
mov rax, qword [sym.imp.msvcrt.dll__beginthreadex]
call rax
mov qword [0x00528f48], rax
mov rax, qword [0x00528f48]
test rax, rax
jne 0x41278d
lea r9, str.Unable_to_create_timer_thread___aborting
lea r8, str.windows_init
mov edx, 3
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
jmp 0x4127bd
mov rax, qword [0x00528f48]
mov edx, 0
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_SetThreadAffinityMask]
call rax
mov edx, 0x3fd
mov rcx, qword [rbp + 0x90]
call sym.htab_create
mov dword [rbp + 0x78], 0
mov eax, dword [0x004f1c40]
test eax, eax
jne 0x412932
cmp dword [rbp + 0x78], 0
je 0x412932
mov rax, qword [0x00528f48]
test rax, rax
je 0x412869
mov rax, qword [0x00528f68]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_SetEvent]
call rax
mov rax, qword [0x00528f48]
mov edx, 0xffffffff
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
call rax
test eax, eax
je 0x41284b
lea r9, str.could_not_wait_for_timer_thread_to_quit
lea r8, str.windows_init
mov edx, 2
mov rcx, qword [rbp + 0x90]
call sym.usbi_log
mov rax, qword [0x00528f48]
mov edx, 1
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_TerminateThread]
call rax
mov rax, qword [0x00528f48]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x00528f48], 0
mov dword [rbp + 0x7c], 0
jmp 0x4128d3
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x00528f60]
mov rax, qword [rdx + rax]
test rax, rax
je 0x4128cf
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x00528f60]
mov rax, qword [rdx + rax]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x00528f60]
mov qword [rdx + rax], 0
add dword [rbp + 0x7c], 1
cmp dword [rbp + 0x7c], 1
jle 0x412872
mov rax, qword [0x00528f70]
test rax, rax
je 0x412903
mov rax, qword [0x00528f70]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x00528f70], 0
mov rax, qword [0x00528f50]
test rax, rax
je 0x41292d
mov rax, qword [0x00528f50]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x00528f50], 0
call sym.htab_destroy
cmp dword [rbp + 0x78], 0
je 0x412947
mov eax, dword [0x004f1c40]
sub eax, 1
mov dword [0x004f1c40], eax
mov rax, qword [rbp + 0x70]
mov r8d, 0
mov edx, 1
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
call rax
mov rax, qword [rbp + 0x70]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov eax, dword [rbp + 0x78]
add rsp, 0x100
pop rbp
ret