Function at 0x140004fe0
Capabilities:
Check mutex on windows
Create thread
Log keystrokes via application hook

Disassembly:
mov qword [rsp + 8], rbx
push rdi
sub rsp, 0x390
mov rax, qword [0x140034040]
xor rax, rsp
mov qword [rsp + 0x380], rax
call qword [sym.imp.KERNEL32.dll_AllocConsole]
xor edi, edi
test eax, eax
je 0x14000507f
mov ecx, 1
call fcn.140008dfc
mov r8, rax
lea rdx, [0x14002dbec]
lea rcx, str.CONOUT_
call fcn.140008b88
mov ecx, 2
call fcn.140008dfc
mov r8, rax
lea rdx, [0x14002dbec]
lea rcx, str.CONOUT_
call fcn.140008b88
mov ecx, 0xfffffff5
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
lea rdx, [rsp + 0x30]
mov dword [rsp + 0x30], edi
mov rcx, rax
mov rbx, rax
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov edx, dword [rsp + 0x30]
mov rcx, rbx
or edx, 4
mov dword [rsp + 0x30], edx
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
lea r8, str.1.1.1
lea rdx, str._keyboard_remapper__s__n_n
lea rcx, str.e_32m
call fcn.140004a10
lea r8, str.keyboard_remapper.single_instance
mov edx, 1
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateMutexA]
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x1400050cb
lea rcx, str.keyboard_remapper.exe_is_already_running__n
call fcn.140001020
jmp 0x14000521e
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_GetModuleHandleW]
mov r8d, 0x104
lea rdx, [rsp + 0x170]
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea rcx, [rsp + 0x170]
mov rax, 0xffffffffffffffff
nop dword [rax]
cmp word [rcx + rax*2 + 2], di
lea rax, [rax + 1]
jne 0x140005100
lea rcx, [rsp + 0x170]
mov word [rsp + rax*2 + 0x146], di
sub rcx, 2
nop
cmp word [rcx + 2], di
lea rcx, [rcx + 2]
jne 0x140005120
mov eax, dword [0x14002dc80]
lea r8, [0x14002dbf8]
movups xmm0, xmmword [str.config.txt]
lea rdx, [rsp + 0x170]
movups xmmword [rcx], xmm0
mov dword [rcx + 0x10], eax
movzx eax, word [0x14002dc84]
mov word [rcx + 0x14], ax
lea rcx, [rsp + 0x30]
call fcn.140008c84
test eax, eax
jle 0x14000517e
lea rdx, [rsp + 0x170]
lea rcx, str.Cannot_open_configuration_file__ws._Make_sure_it_is_in_the_same_directory_as_keyboard_remapper.exe._n
call fcn.140001020
jmp 0x14000521e
mov r8, qword [rsp + 0x30]
lea rcx, [rsp + 0x70]
mov edx, 0xff
mov ebx, 1
call fcn.14000b6ec
test rax, rax
je 0x1400051cf
nop dword [rax]
mov edx, ebx
lea rcx, [rsp + 0x70]
call fcn.1400030e0
inc ebx
test eax, eax
jne 0x140005255
mov r8, qword [rsp + 0x30]
lea rcx, [rsp + 0x70]
mov edx, 0xff
call fcn.14000b6ec
test rax, rax
jne 0x1400051a0
mov rcx, qword [rsp + 0x30]
call fcn.1400090a8
mov edx, ebx
xor ecx, ecx
call fcn.1400030e0
test eax, eax
jne 0x14000521e
cmp dword [0x140034ce0], edi
je 0x14000528a
call qword [sym.imp.KERNEL32.dll_GetCurrentProcess]
mov rcx, rax
mov edx, 0x80
call qword [sym.imp.KERNEL32.dll_SetPriorityClass]
test eax, eax
jne 0x140005261
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, str.Error_setting_process_priority:__d_n
call fcn.140001020
lea rcx, str._nPress_any_key_to_exit..._n
call fcn.140001020
call fcn.140012724
mov eax, 1
mov rcx, qword [rsp + 0x380]
xor rcx, rsp
call fcn.140005700
mov rbx, qword [rsp + 0x3a0]
add rsp, 0x390
pop rdi
ret
mov rcx, qword [rsp + 0x30]
call fcn.1400090a8
jmp 0x14000521e
call qword [sym.imp.KERNEL32.dll_GetCurrentThread]
mov rcx, rax
mov edx, 2
call qword [sym.imp.KERNEL32.dll_SetThreadPriority]
test eax, eax
jne 0x14000528a
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, str.Error_setting_thread_priority:__d_n
jmp 0x140005219
xor r9d, r9d
xor r8d, r8d
mov edx, 1
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateEventA]
mov qword [0x140037550], rax
test rax, rax
jne 0x1400052bd
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, str.CreateEvent_error:__d_n
jmp 0x140005219
lea rax, [rsp + 0x38]
mov qword [0x140036510], rdi
mov qword [rsp + 0x28], rax
lea r9, [0x140036060]
lea r8, [0x140004ec0]
mov dword [rsp + 0x20], edi
xor edx, edx
mov qword [0x140036518], rdi
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateThread]
test rax, rax
jne 0x14000530a
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, str.Error_creating_the_thread:__d_n
jmp 0x140005219
call qword [sym.imp.KERNEL32.dll_CreateTimerQueue]
cmp dword [0x140036040], edi
mov qword [0x140036048], rax
jne 0x140005332
lea rcx, str.DEBUG
call fcn.140010f7c
test rax, rax
mov eax, edi
je 0x140005337
mov eax, 1
xor r9d, r9d
mov dword [0x140036040], eax
xor r8d, r8d
lea rdx, [0x140004bd0]
mov ecx, 0xe
call qword [sym.imp.USER32.dll_SetWindowsHookExA]
xor r9d, r9d
lea rdx, [0x140004dd0]
xor r8d, r8d
mov qword [0x140037548], rax
mov ecx, 0xd
call qword [sym.imp.USER32.dll_SetWindowsHookExA]
cmp dword [0x140036040], edi
mov qword [0x140037558], rax
je 0x140005391
lea rcx, str.___DEBUG_MODE____n
call fcn.140001020
jmp 0x1400053bb
mov ecx, 1
call fcn.140008dfc
mov rcx, rax
call fcn.1400090a8
mov ecx, 2
call fcn.140008dfc
mov rcx, rax
call fcn.1400090a8
call qword [sym.imp.KERNEL32.dll_FreeConsole]
xor r9d, r9d
lea rcx, [rsp + 0x40]
xor r8d, r8d
xor edx, edx
call qword [sym.imp.USER32.dll_GetMessageA]
test eax, eax
jle 0x1400053ff
lea rcx, [rsp + 0x40]
call qword [sym.imp.USER32.dll_TranslateMessage]
lea rcx, [rsp + 0x40]
call qword [sym.imp.USER32.dll_DispatchMessageA]
xor r9d, r9d
lea rcx, [rsp + 0x40]
xor r8d, r8d
xor edx, edx
call qword [sym.imp.USER32.dll_GetMessageA]
test eax, eax
jg 0x1400053d2
mov rcx, qword [0x140037558]
call qword [sym.imp.USER32.dll_UnhookWindowsHookEx]
mov rcx, qword [0x140037548]
call qword [sym.imp.USER32.dll_UnhookWindowsHookEx]
cmp dword [0x140036010], edi
je 0x140005427
mov dword [0x140036010], edi
mov rdx, qword [0x140036038]
test rdx, rdx
je 0x140005443
mov rcx, qword [0x140036048]
xor r8d, r8d
call qword [sym.imp.KERNEL32.dll_DeleteTimerQueueTimer]
mov rcx, qword [0x140037550]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rcx, qword [0x140036048]
call qword [sym.imp.KERNEL32.dll_DeleteTimerQueue]
lea rcx, [0x140036060]
call fcn.140002270
call fcn.140001ab0
xor eax, eax
jmp 0x140005234