Function at 0x407830
Capabilities:
Move file

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x78
mov r10, qword [rdx + 8]
mov r9, qword [rdx]
mov rax, r10
sub rax, r9
sar rax, 3
mov r11, rax
movabs rax, 0xf02806abc74be1fb
imul rax, r11
test rax, rax
je 0x407d20
mov r13, rcx
mov rcx, qword [rcx]
mov qword [rsp + 0x48], rdx
mov rax, qword [r13 + 8]
movabs rdx, 0x66c6f436b052f9df
mov byte [rsp + 0x37], r8b
sub rax, rcx
sar rax, 4
imul rax, rdx
test rax, rax
je 0x407e7d
lea rax, [rsp + 0x5f]
xor edx, edx
xor r12d, r12d
mov qword [rsp + 0x40], rax
lea rax, [rsp + 0x60]
mov qword [rsp + 0x38], rax
nop word cs:[rax + rax]
imul rbp, rdx, 0x21f0
add rbp, rcx
mov rbx, qword [rbp + 0x28]
cmp qword [rbx - 0x18], 0
je 0x407cc8
imul rdx, rdx, 0x998
cmp byte [rsp + 0x37], 0
lea rdi, [r9 + rdx]
jne 0x4078f8
cmp byte [rdi + 0x560], 0
je 0x407cc8
mov r8, qword [rsp + 0x40]
mov rcx, qword [rsp + 0x38]
mov rdx, rbx
call fcn.004865a0
mov rax, qword [rsp + 0x60]
mov rdx, qword [rax - 0x18]
lea rsi, [rdx + 1]
cmp rsi, qword [rax - 0x10]
ja 0x407924
mov ecx, dword [rax - 8]
test ecx, ecx
jle 0x40793a
mov rcx, qword [rsp + 0x38]
mov rdx, rsi
call fcn.004862a0
mov rax, qword [rsp + 0x60]
mov rdx, qword [rax - 0x18]
mov byte [rax + rdx], 0x7e
mov rax, qword [rsp + 0x60]
mov dword [rax - 8], 0
mov qword [rax - 0x18], rsi
mov byte [rax + rsi], 0
mov rcx, qword [rsp + 0x60]
call sub.msvcrt.dll__unlink
mov rdx, qword [rsp + 0x60]
mov rcx, rbx
call sub.msvcrt.dll_rename
lea rdx, [0x004b45a2]
mov rcx, rbx
call sub.msvcrt.dll_fopen
test rax, rax
mov rsi, rax
je 0x407e49
lea rdx, str._smartd_state_file_n
mov rcx, rax
call fcn.0045e7f0
movzx r9d, byte [rdi]
test r9, r9
jne 0x407e09
movzx r9d, byte [rdi + 1]
test r9, r9
jne 0x407dee
movzx r9d, byte [rdi + 2]
test r9, r9
jne 0x407dd3
movzx r9d, word [rdi + 4]
test r9, r9
jne 0x407db8
mov r9, qword [rdi + 8]
test r9, r9
jne 0x407d67
mov r9, qword [rdi + 0x10]
test r9, r9
jne 0x407d4c
mov r9, qword [rdi + 0x18]
test r9, r9
jne 0x407d31
lea rbx, [rdi + 0x20]
mov r15d, 1
xor r14d, r14d
jmp 0x407a23
mov rax, qword [rbx + 0x10]
test rax, rax
jne 0x407a99
cmp r15d, 0xd
je 0x407ad0
add r14d, 1
add r15d, 1
add rbx, 0x18
test r14d, r14d
je 0x407a17
movsxd rdx, dword [rbx]
test edx, edx
je 0x407a0d
lea rax, str.count
mov qword [rsp + 0x28], rdx
lea r8, str.mail
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
mov rax, qword [rbx + 8]
test rax, rax
je 0x407a00
mov qword [rsp + 0x28], rax
lea rax, str.first_sent_time
lea r8, str.mail
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
mov rax, qword [rbx + 0x10]
test rax, rax
je 0x407a0d
mov qword [rsp + 0x28], rax
lea rax, str.last_sent_time
lea r8, str.mail
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
cmp r15d, 0xd
jne 0x407a17
nop dword [rax]
movsxd r9, dword [rdi + 0x158]
test r9, r9
jne 0x407d9d
lea rbx, [rdi + 0x160]
xor r14d, r14d
jmp 0x407b29
movzx eax, byte [rbx + 2]
test rax, rax
jne 0x407b9a
mov rax, qword [rbx + 8]
test rax, rax
jne 0x407bd1
movzx eax, byte [rbx + 0x10]
test rax, rax
jne 0x407c08
add r14d, 1
add rbx, 0x18
cmp r14d, 0x1e
je 0x407c44
movzx edx, byte [rbx]
test dl, dl
je 0x407b17
lea rax, [0x004b46db]
mov qword [rsp + 0x28], rdx
lea r8, str.ata_smart_attribute
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
movzx eax, byte [rbx + 1]
test rax, rax
je 0x407af0
mov qword [rsp + 0x28], rax
lea rax, [0x004b46de]
lea r8, str.ata_smart_attribute
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
movzx eax, byte [rbx + 2]
test rax, rax
je 0x407afd
mov qword [rsp + 0x28], rax
lea rax, str.worst
lea r8, str.ata_smart_attribute
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
mov rax, qword [rbx + 8]
test rax, rax
je 0x407b0a
mov qword [rsp + 0x28], rax
lea rax, [0x004b46e8]
lea r8, str.ata_smart_attribute
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
call fcn.0045e7f0
movzx eax, byte [rbx + 0x10]
test rax, rax
je 0x407b17
mov qword [rsp + 0x28], rax
lea rax, str.resvd
lea r8, str.ata_smart_attribute
lea rdx, str._s._d._s___llu_n
mov r9d, r14d
mov rcx, rsi
mov qword [rsp + 0x20], rax
add r14d, 1
add rbx, 0x18
call fcn.0045e7f0
cmp r14d, 0x1e
jne 0x407b29
mov r9, qword [rdi + 0x558]
test r9, r9
jne 0x407d82
mov rcx, rsi
call sub.msvcrt.dll_fclose
mov ebx, 1
mov rax, qword [0x004e0f00]
mov rdx, qword [rsp + 0x60]
mov eax, dword [rax]
test eax, eax
jne 0x407e24
mov eax, dword [rdx - 8]
lea ecx, [rax - 1]
test eax, eax
mov dword [rdx - 8], ecx
jle 0x407e36
test bl, bl
je 0x407cbc
cmp byte [rsp + 0x37], 0
mov byte [rdi + 0x560], 0
jne 0x407ca3
cmp byte [0x004ff1d0], 0
je 0x407cbc
mov r9, qword [rbp + 0x28]
mov r8, qword [rbp + 8]
lea rdx, str.Device:__s__state_written_to__s_n
mov ecx, 6
call fcn.004015e0
mov rax, qword [rsp + 0x48]
mov r9, qword [rax]
mov r10, qword [rax + 8]
mov rax, r10
movabs rcx, 0xf02806abc74be1fb
lea edx, [r12 + 1]
sub rax, r9
sar rax, 3
mov r12, rdx
imul rax, rcx
cmp rdx, rax
jae 0x407d20
mov rcx, qword [r13]
mov r8, qword [r13 + 8]
movabs rax, 0x66c6f436b052f9df
sub r8, rcx
sar r8, 4
imul r8, rax
cmp rdx, r8
jb 0x4078c0
jmp 0x407e82
add rsp, 0x78
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea r8, str.selective_test_last_end
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079f1
lea r8, str.selective_test_last_start
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079e4
lea r8, str.scheduled_test_next_check
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079d7
lea r8, str.nvme_err_log_entries
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x407c54
lea r8, str.ata_error_count
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x407ae0
lea r8, str.self_test_last_err_hour
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079ca
lea r8, str.self_test_errors
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079bc
lea r8, str.temperature_max
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079ae
lea r8, str.temperature_min
lea rdx, str._s___llu_n
mov rcx, rsi
call fcn.0045e7f0
jmp 0x4079a0
mov eax, 0xffffffff
lock xadd dword [rdx - 8], eax
test eax, eax
jg 0x407c88
lea rcx, [rdx - 0x18]
mov rdx, qword [rsp + 0x40]
call fcn.00485060
jmp 0x407c88
lea rcx, str.Cannot_create_state_file___s__n
mov rdx, rbx
call fcn.00405e40
xor ebx, ebx
jmp 0x407c61
xor r8d, r8d
xor edx, edx
lea rcx, [0x004b4558]
call fcn.00498a50
nop
nop