// File: CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::Resume(unsigned int)
void Flash_Chip::Resume(flash_die_ID_type dieID)
		{
			Die* targetDie = Dies[dieID];
			if (!targetDie->Suspended) {
				PRINT_ERROR("Flash chip " << ID() << ": resume flash command is requested, but there is no suspended flash command!")
			}

			targetDie->CurrentCMD = targetDie->SuspendedCMD;
			targetDie->SuspendedCMD = NULL;
			targetDie->Suspended = false;
			STAT_totalResumeCount++;

			targetDie->Expected_finish_time = Simulator->Time() + targetDie->RemainingSuspendedExecTime;
			targetDie->CommandFinishEvent = Simulator->Register_sim_event(targetDie->Expected_finish_time,
				this, targetDie->CurrentCMD, static_cast<int>(Chip_Sim_Event_Type::COMMAND_FINISHED));
			if (targetDie->Expected_finish_time > this->expectedFinishTime) {
				this->expectedFinishTime = targetDie->Expected_finish_time;
			}

			targetDie->Status = DieStatus::BUSY;
			this->idleDieNo--;
			this->status = Internal_Status::BUSY;
			executionStartTime = Simulator->Time();
		}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movl %esi, 0x6c(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rax), %rax
movl 0x6c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
testb $0x1, 0x38(%rax)
jne 0x44a25
movq 0x95682(%rip), %rdi     # 0xd9ff0
movq %rdi, 0x8(%rsp)
leaq 0x65f6e(%rip), %rsi     # 0xaa8e8
callq 0x8440
movq 0x8(%rsp), %rdi
leaq 0x677e5(%rip), %rsi     # 0xac170
callq 0x8440
movq 0x28(%rsp), %rsi
movq %rax, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xcdf0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x83e0
movq %rax, 0x20(%rsp)
jmp 0x449bf
movq 0x20(%rsp), %rdi
leaq 0x67872(%rip), %rsi     # 0xac23d
callq 0x8440
movq %rax, (%rsp)
jmp 0x449d6
movq (%rsp), %rdi
movq 0x95577(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x449e8
leaq 0x40(%rsp), %rdi
callq 0x8848
movq 0x955d7(%rip), %rdi     # 0xd9fd0
callq 0x84f0
movl $0x1, %edi
callq 0x8500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x8848
jmp 0x44b27
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movq 0x30(%rcx), %rdx
movq 0x60(%rsp), %rcx
movq %rdx, 0x28(%rcx)
movq 0x60(%rsp), %rcx
movq $0x0, 0x30(%rcx)
movq 0x60(%rsp), %rcx
movb $0x0, 0x38(%rcx)
movq 0xd0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xd0(%rax)
callq 0x46500
movq %rax, %rdi
callq 0x46c50
movq %rax, %rcx
movq 0x60(%rsp), %rax
addq 0x20(%rax), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x18(%rax)
callq 0x46500
movq 0x28(%rsp), %rdx
movq %rax, %rdi
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x60(%rsp), %rax
movq 0x28(%rax), %rcx
xorl %r8d, %r8d
callq 0x46c60
movq 0x28(%rsp), %rcx
movq %rax, %rdx
movq 0x60(%rsp), %rax
movq %rdx, 0x10(%rax)
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0xa8(%rcx), %rax
jbe 0x44ae5
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0xa8(%rax)
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
movl $0x0, 0xc(%rcx)
movl 0x3c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x3c(%rax)
movl $0x1, 0x38(%rax)
callq 0x46500
movq %rax, %rdi
callq 0x46c50
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0xa0(%rax)
addq $0x78, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x8770
nopw %cs:(%rax,%rax)