// File: CMU-SAFARI[P]MQSim/src/exec/SSD_Device.cpp
// Function: SSD_Device::Perform_preconditioning(std::vector<Utils::Workload_Statistics*, std::allocator<Utils::Workload_Statistics*>>)
void SSD_Device::Perform_preconditioning(std::vector<Utils::Workload_Statistics *> workload_stats)
{
	if (Preconditioning_required)
	{
		time_t start_time = time(0);
		PRINT_MESSAGE("SSD Device preconditioning started .........");
		this->Firmware->Perform_precondition(workload_stats);
		this->Cache_manager->Do_warmup(workload_stats);
		time_t end_time = time(0);
		uint64_t duration = (uint64_t)difftime(end_time, start_time);
		PRINT_MESSAGE("Finished preconditioning. Duration of preconditioning: " << duration / 3600 << ":" << (duration % 3600) / 60 << ":" << ((duration % 3600) % 60));
	}
}

// Assembly:
subq $0x98, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x28(%rsp)
testb $0x1, 0x38(%rax)
je 0x2cb3f
xorl %eax, %eax
movl %eax, %edi
callq 0x83f0
movq %rax, 0x80(%rsp)
movq 0xad61d(%rip), %rdi     # 0xd9f98
leaq 0x7ef6b(%rip), %rsi     # 0xab8ed
callq 0x8440
movq %rax, %rdi
movq 0xad5c7(%rip), %rsi     # 0xd9f58
callq 0x8480
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x68(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x20120
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
jmp 0x2c9cd
leaq 0x68(%rsp), %rdi
callq 0x20220
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rsi
movq 0x48(%rax), %rax
movq %rax, (%rsp)
leaq 0x40(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x20120
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
jmp 0x2ca0c
leaq 0x40(%rsp), %rdi
callq 0x20220
xorl %eax, %eax
movl %eax, %edi
callq 0x83f0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x8210
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x7c5bb(%rip), %xmm1    # 0xa9008
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0xad530(%rip), %rdi     # 0xd9f98
leaq 0x7eeab(%rip), %rsi     # 0xab91a
callq 0x8440
movq %rax, %rdi
movq 0x30(%rsp), %rax
movl $0xe10, %ecx            # imm = 0xE10
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x8100
movq %rax, %rdi
leaq 0x7de55(%rip), %rsi     # 0xaa8ed
callq 0x8440
movq %rax, %rdi
movq 0x30(%rsp), %rax
movl $0xe10, %ecx            # imm = 0xE10
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
movl $0x3c, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x8100
movq %rax, %rdi
leaq 0x7de1f(%rip), %rsi     # 0xaa8ed
callq 0x8440
movq %rax, %rdi
movq 0x30(%rsp), %rax
movl $0xe10, %ecx            # imm = 0xE10
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
movl $0x3c, %ecx
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x8100
movq %rax, %rdi
movq 0xad454(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x2cb3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x20220
jmp 0x2cb47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x20220
jmp 0x2cb47
addq $0x98, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x8770
nopw %cs:(%rax,%rax)