Function at 0x1400053f0
Capabilities:
Check mutex on windows
Move file
Write file on windows

Disassembly:
mov qword [rsp + 8], rcx
sub rsp, 0x5c8
mov rax, qword [0x1400380d0]
xor rax, rsp
mov qword [rsp + 0x5b0], rax
lea rcx, [rsp + 0x60]
call qword [sym.imp.KERNEL32.dll_GetLocalTime]
cmp qword [0x140038030], 0xffffffffffffffff
jne 0x140005685
lea r8, str.KHAL_LogFileMutex
mov edx, 1
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_CreateMutexA]
mov qword [0x1400396e8], rax
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
je 0x140005466
cmp qword [0x1400396e8], 0
je 0x140005466
mov dword [rsp + 0x5a4], 1
jmp 0x140005471
mov dword [rsp + 0x5a4], 0
mov eax, dword [rsp + 0x5a4]
mov dword [rsp + 0x484], eax
mov eax, dword [0x140039814]
and eax, 4
test eax, eax
jne 0x14000552f
cmp dword [rsp + 0x484], 0
je 0x14000552f
mov dword [rsp + 0x488], 2
mov eax, dword [0x140039814]
and eax, 8
test eax, eax
je 0x14000552d
movzx r10d, word [rsp + 0x6c]
movzx r9d, word [rsp + 0x6a]
movzx r8d, word [rsp + 0x68]
movzx edx, word [rsp + 0x60]
movzx ecx, word [rsp + 0x66]
movzx eax, word [rsp + 0x62]
mov dword [rsp + 0x48], r10d
mov dword [rsp + 0x40], r9d
mov dword [rsp + 0x38], r8d
mov dword [rsp + 0x30], edx
mov dword [rsp + 0x28], ecx
mov dword [rsp + 0x20], eax
lea r9, [0x1400395e0]
lea r8, str._s__02d__02d__04d__02d__02d__02d.txt
mov edx, 0x104
lea rcx, [rsp + 0x490]
call fcn.140013094
mov r8d, 1
lea rdx, [rsp + 0x490]
lea rcx, [0x1400395e0]
call qword [sym.imp.KERNEL32.dll_MoveFileExA]
jmp 0x14000553a
mov dword [rsp + 0x488], 4
mov qword [rsp + 0x30], 0
mov dword [rsp + 0x28], 0x80
mov eax, dword [rsp + 0x488]
mov dword [rsp + 0x20], eax
xor r9d, r9d
mov r8d, 7
mov edx, 0x1f01ff
lea rcx, [0x1400395e0]
call qword [sym.imp.KERNEL32.dll_CreateFileA]
mov qword [0x140038030], rax
cmp qword [0x140038030], 0xffffffffffffffff
je 0x140005678
cmp dword [rsp + 0x488], 2
jne 0x140005660
cmp qword [0x140039818], 0
je 0x1400055b4
mov rax, qword [0x140039818]
mov eax, dword [rax + 0x28dc8]
mov dword [rsp + 0x5a8], eax
jmp 0x1400055c1
mov eax, dword [0x1400380a0]
mov dword [rsp + 0x5a8], eax
movzx r11d, word [rsp + 0x6c]
movzx r10d, word [rsp + 0x6a]
movzx r8d, word [rsp + 0x68]
movzx edx, word [rsp + 0x60]
movzx ecx, word [rsp + 0x66]
movzx r9d, word [rsp + 0x62]
mov eax, dword [rsp + 0x5a8]
mov dword [rsp + 0x50], eax
mov eax, dword [0x140039814]
mov dword [rsp + 0x48], eax
mov dword [rsp + 0x40], r11d
mov dword [rsp + 0x38], r10d
mov dword [rsp + 0x30], r8d
mov dword [rsp + 0x28], edx
mov dword [rsp + 0x20], ecx
lea r8, str._r_nLogFile_started_on__02d__02d__04d_at__02d:_02d:_02d___g_dwDebugFlags:0x_X___g_dwDebugLevel:_X_r_n_r_n
mov edx, 0x400
lea rcx, [rsp + 0x80]
call fcn.140013094
lea rcx, [rsp + 0x80]
call fcn.1400128f0
mov qword [rsp + 0x20], 0
lea r9, [rsp + 0x480]
mov r8d, eax
lea rdx, [rsp + 0x80]
mov rcx, qword [0x140038030]
call qword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x140005678
mov r9d, 2
xor r8d, r8d
xor edx, edx
mov rcx, qword [0x140038030]
call qword [sym.imp.KERNEL32.dll_SetFilePointer]
mov rcx, qword [0x1400396e8]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
cmp qword [0x140038030], 0xffffffffffffffff
je 0x1400057bc
mov rcx, qword [rsp + 0x5d0]
call fcn.1400128f0
mov dword [rsp + 0x5a0], eax
mov eax, dword [rsp + 0x5a0]
sub eax, 1
movsxd rcx, eax
mov rax, qword [rsp + 0x5d0]
mov byte [rax + rcx], 0xd
movsxd rcx, dword [rsp + 0x5a0]
mov rax, qword [rsp + 0x5d0]
mov byte [rax + rcx], 0xa
mov eax, dword [rsp + 0x5a0]
add eax, 1
movsxd rcx, eax
mov rax, qword [rsp + 0x5d0]
mov byte [rax + rcx], 0
call qword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov r11d, eax
movzx r8d, word [rsp + 0x6e]
movzx edx, word [rsp + 0x6c]
movzx ecx, word [rsp + 0x6a]
movzx r9d, word [rsp + 0x68]
mov rax, qword [rsp + 0x5d0]
mov qword [rsp + 0x40], rax
mov dword [rsp + 0x38], r11d
mov dword [rsp + 0x30], r8d
mov dword [rsp + 0x28], edx
mov dword [rsp + 0x20], ecx
lea r8, str._02d:_02d:_02d._03d___d___s
mov edx, 0x400
lea rcx, [rsp + 0x80]
call fcn.140013094
cmp qword [0x1400396e8], 0
je 0x14000576f
mov edx, 0x3e8
mov rcx, qword [0x1400396e8]
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x14000576f
mov qword [0x1400396e8], 0
lea rcx, [rsp + 0x80]
call fcn.1400128f0
mov qword [rsp + 0x20], 0
lea r9, [rsp + 0x480]
mov r8d, eax
lea rdx, [rsp + 0x80]
mov rcx, qword [0x140038030]
call qword [sym.imp.KERNEL32.dll_WriteFile]
cmp qword [0x1400396e8], 0
je 0x1400057bc
mov rcx, qword [0x1400396e8]
call qword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov rcx, qword [rsp + 0x5b0]
xor rcx, rsp
call fcn.140012840
add rsp, 0x5c8
ret