Function at 0x140012255
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_7
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 0x1400122f7
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 0x140012855
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 0x140012358
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 0x140012855
mov eax, dword [0x1400f8c20]
add eax, 1
mov dword [0x1400f8c20], eax
mov eax, dword [0x1400f8c20]
test eax, eax
jne 0x140012696
lea rax, [rbp - 0x30]
mov r8d, 0x94
mov edx, 0
mov rcx, rax
call sym.memset
mov dword [rbp - 0x30], 0x94
mov dword [0x140130f40], 0
lea rax, [rbp - 0x30]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_GetVersionExA]
call rax
test eax, eax
je 0x140012403
mov eax, dword [rbp - 0x20]
cmp eax, 2
jne 0x140012403
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jne 0x1400123d5
mov eax, dword [rbp - 0x28]
cmp eax, 1
jne 0x1400123d5
mov dword [0x140130f40], 1
jmp 0x140012403
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jne 0x1400123f1
mov eax, dword [rbp - 0x28]
cmp eax, 2
jne 0x1400123f1
mov dword [0x140130f40], 2
jmp 0x140012403
mov eax, dword [rbp - 0x2c]
cmp eax, 5
jbe 0x140012403
mov dword [0x140130f40], 3
mov eax, dword [0x140130f40]
test eax, eax
jne 0x140012438
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 0x14001269d
mov edx, 0
lea rax, [0x140139190]
mov rcx, rax
call sym.usbi_mutex_init
call sym.init_polling
call sym.init_dlls
test eax, eax
je 0x140012483
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 0x140012855
mov dword [rbp + 0x7c], 0
jmp 0x1400124bb
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 0x14001248c
mov dword [rbp + 0x78], 0xfffffff5
mov dword [rbp + 0x7c], 0
jmp 0x140012558
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, [0x140130f60]
mov qword [rcx + rdx], rax
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x140130f60]
mov rax, qword [rdx + rax]
test rax, rax
jne 0x140012554
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 0x14001269d
add dword [rbp + 0x7c], 1
cmp dword [rbp + 0x7c], 1
jle 0x1400124d4
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 [0x140130f70], rax
mov rax, qword [0x140130f70]
test rax, rax
jne 0x1400125b8
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 0x14001269d
mov r8d, 0
mov edx, 0
mov ecx, 0
mov rax, qword [sym.imp.KERNEL32.dll_CreateMutexA]
call rax
mov qword [0x140130f50], rax
mov rax, qword [0x140130f50]
test rax, rax
jne 0x140012608
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 0x14001269d
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 [0x140130f48], rax
mov rax, qword [0x140130f48]
test rax, rax
jne 0x14001266d
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 0x14001269d
mov rax, qword [0x140130f48]
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 [0x1400f8c20]
test eax, eax
jne 0x140012812
cmp dword [rbp + 0x78], 0
je 0x140012812
mov rax, qword [0x140130f48]
test rax, rax
je 0x140012749
mov rax, qword [0x140130f68]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_SetEvent]
call rax
mov rax, qword [0x140130f48]
mov edx, 0xffffffff
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
call rax
test eax, eax
je 0x14001272b
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 [0x140130f48]
mov edx, 1
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_TerminateThread]
call rax
mov rax, qword [0x140130f48]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x140130f48], 0
mov dword [rbp + 0x7c], 0
jmp 0x1400127b3
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x140130f60]
mov rax, qword [rdx + rax]
test rax, rax
je 0x1400127af
mov eax, dword [rbp + 0x7c]
cdqe
lea rdx, [rax*8]
lea rax, [0x140130f60]
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, [0x140130f60]
mov qword [rdx + rax], 0
add dword [rbp + 0x7c], 1
cmp dword [rbp + 0x7c], 1
jle 0x140012752
mov rax, qword [0x140130f70]
test rax, rax
je 0x1400127e3
mov rax, qword [0x140130f70]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x140130f70], 0
mov rax, qword [0x140130f50]
test rax, rax
je 0x14001280d
mov rax, qword [0x140130f50]
mov rcx, rax
mov rax, qword [sym.imp.KERNEL32.dll_CloseHandle]
call rax
mov qword [0x140130f50], 0
call sym.htab_destroy
cmp dword [rbp + 0x78], 0
je 0x140012827
mov eax, dword [0x1400f8c20]
sub eax, 1
mov dword [0x1400f8c20], 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