// File: CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::Suspend(unsigned int)
void Flash_Chip::Suspend(flash_die_ID_type dieID)
		{
			STAT_totalExecTime += Simulator->Time() - executionStartTime;

			Die* targetDie = Dies[dieID];
			if (targetDie->Suspended) {
				PRINT_ERROR("Flash chip" << ID() << ": suspending a previously suspended flash chip! This is illegal.")
			}

			/*if (targetDie->CurrentCMD & CMD_READ != 0)
			throw "Suspend is not supported for read operations!";*/

			targetDie->RemainingSuspendedExecTime = targetDie->Expected_finish_time - Simulator->Time();
			Simulator->Ignore_sim_event(targetDie->CommandFinishEvent);//The simulator engine should not execute the finish event for the suspended command
			targetDie->CommandFinishEvent = NULL;

			targetDie->SuspendedCMD = targetDie->CurrentCMD;
			targetDie->CurrentCMD = NULL;
			targetDie->Suspended = true;
			STAT_totalSuspensionCount++;

			targetDie->Status = DieStatus::IDLE;
			this->idleDieNo++;
			if (this->idleDieNo == die_no) {
				this->status = Internal_Status::IDLE;
			}

			executionStartTime = INVALID_TIME;
			expectedFinishTime = INVALID_TIME;
		}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x38(%rsp)
callq 0x46500
movq %rax, %rdi
callq 0x46c50
movq %rax, %rcx
movq 0x38(%rsp), %rax
subq 0xa0(%rax), %rcx
addq 0xd8(%rax), %rcx
movq %rcx, 0xd8(%rax)
movq 0x40(%rax), %rax
movl 0x7c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
testb $0x1, 0x38(%rax)
je 0x4484a
movq 0x9585f(%rip), %rdi     # 0xd9ff0
movq %rdi, 0x18(%rsp)
leaq 0x6614b(%rip), %rsi     # 0xaa8e8
callq 0x8440
movq 0x18(%rsp), %rdi
leaq 0x679dd(%rip), %rsi     # 0xac18b
callq 0x8440
movq 0x38(%rsp), %rsi
movq %rax, 0x20(%rsp)
leaq 0x50(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xcdf0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x83e0
movq %rax, 0x30(%rsp)
jmp 0x447e2
movq 0x30(%rsp), %rdi
leaq 0x67a0e(%rip), %rsi     # 0xac1fc
callq 0x8440
movq %rax, 0x10(%rsp)
jmp 0x447fa
movq 0x10(%rsp), %rdi
movq 0x95752(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x4480d
leaq 0x50(%rsp), %rdi
callq 0x8848
movq 0x957b2(%rip), %rdi     # 0xd9fd0
callq 0x84f0
movl $0x1, %edi
callq 0x8500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x8848
jmp 0x44924
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x46500
movq %rax, %rdi
callq 0x46c50
movq 0x8(%rsp), %rcx
subq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x20(%rax)
callq 0x46500
movq %rax, %rdi
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x46d00
movq 0x38(%rsp), %rcx
movq 0x70(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x70(%rsp), %rax
movq 0x28(%rax), %rdx
movq 0x70(%rsp), %rax
movq %rdx, 0x30(%rax)
movq 0x70(%rsp), %rax
movq $0x0, 0x28(%rax)
movq 0x70(%rsp), %rax
movb $0x1, 0x38(%rax)
movq 0xc8(%rcx), %rax
addq $0x1, %rax
movq %rax, 0xc8(%rcx)
movq 0x70(%rsp), %rax
movl $0x1, 0xc(%rax)
movl 0x3c(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rcx)
movl 0x3c(%rcx), %eax
cmpl 0x48(%rcx), %eax
jne 0x44901
movq 0x38(%rsp), %rax
movl $0x0, 0x38(%rax)
movq 0x38(%rsp), %rax
movq $-0x1, 0xa0(%rax)
movq $-0x1, 0xa8(%rax)
addq $0x88, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x8770
nop