LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/PCIe_Root_Complex.cpp
// Function: Host_Components::PCIe_Root_Complex::Write_to_memory(unsigned long, void const*)
void PCIe_Root_Complex::Write_to_memory(const uint64_t address, const void* payload)
	{
		//This is a request to write back a read request data into memory (in modern systems the write is done to LLC)
		if (address >= DATA_MEMORY_REGION) {
			//nothing to do
		} else {
			switch (SSD_device_type) {
				case HostInterface_Types::NVME:
				{
					unsigned int flow_id = QUEUE_ID_TO_FLOW_ID(((Completion_Queue_Entry*)payload)->SQ_ID);
					((*IO_flows)[flow_id])->NVMe_consume_io_request((Completion_Queue_Entry*)payload);
					break;
				}
				case HostInterface_Types::SATA:
					sata_hba->SATA_consume_io_request((Completion_Queue_Entry*)payload);
					break;
				default:
					PRINT_ERROR("Uknown Host Interface type in PCIe_Root_Complex")
			}
		}
	}

// Assembly:
shrq $0x28, %rsi
cmpl $0xfe, %esi
jbe 0x1cdbd
retq
movl 0x8(%rdi), %eax
testl %eax, %eax
je 0x1cde6
cmpl $0x1, %eax
jne 0x1cdf2
movzwl 0xa(%rdx), %eax
decl %eax
movq 0x18(%rdi), %rcx
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
movq %rdx, %rsi
jmpq *%rax
movq 0x10(%rdi), %rdi
movq %rdx, %rsi
jmp 0x1d636
pushq %rbx
movq 0x451f6(%rip), %rbx     # 0x61ff0
leaq 0x27787(%rip), %rsi     # 0x44588
movq %rbx, %rdi
callq 0x7360
leaq 0x290e2(%rip), %rsi     # 0x45ef2
movq %rbx, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x451a9(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/PCIe_Root_Complex.cpp
// Function: Host_Components::PCIe_Root_Complex::Write_to_device(unsigned long, unsigned short)
void PCIe_Root_Complex::Write_to_device(uint64_t address, uint16_t write_value)
	{
		PCIe_Message* pcie_message = new Host_Components::PCIe_Message;
		pcie_message->Type = PCIe_Message_Type::WRITE_REQ;
		pcie_message->Destination = Host_Components::PCIe_Destination_Type::DEVICE;
		pcie_message->Address = address;
		pcie_message->Payload = (void*)(intptr_t)write_value;
		pcie_message->Payload_size = sizeof(write_value);
		pcie_link->Deliver(pcie_message);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x20
popq %rdi
callq 0x7370
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, (%rax)
movq %r14, 0x18(%rax)
movl %ebx, %ecx
movq %rcx, 0x8(%rax)
movl $0x2, 0x10(%rax)
movq (%r15), %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x1c6b6
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/PCIe_Root_Complex.cpp
// Function: Host_Components::PCIe_Root_Complex::Read_from_memory(unsigned long, unsigned int)
void PCIe_Root_Complex::Read_from_memory(const uint64_t address, const unsigned int read_size)
	{
		PCIe_Message* new_pcie_message = new Host_Components::PCIe_Message;
		new_pcie_message->Type = PCIe_Message_Type::READ_COMP;
		new_pcie_message->Destination = Host_Components::PCIe_Destination_Type::DEVICE;
		new_pcie_message->Address = address;

		//This is a request to read the data of a write request
		if (address >= DATA_MEMORY_REGION) {
			//nothing to do
			new_pcie_message->Payload_size = read_size;
			new_pcie_message->Payload = NULL;//No need to transfer data in the standalone mode of MQSim
		} else {
			switch (SSD_device_type) {
				case HostInterface_Types::NVME:
				{
					uint16_t flow_id = QUEUE_ID_TO_FLOW_ID(uint16_t(address >> NVME_COMP_Q_MEMORY_REGION));
					new_pcie_message->Payload = (*IO_flows)[flow_id]->NVMe_read_sqe(address);
					new_pcie_message->Payload_size = sizeof(Submission_Queue_Entry);
					break;
				}
				case HostInterface_Types::SATA:
					new_pcie_message->Payload = sata_hba->Read_ncq_entry(address);
					new_pcie_message->Payload_size = sizeof(Submission_Queue_Entry);
					break;
			}
		}

		pcie_link->Deliver(new_pcie_message);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x7370
movq %rax, %r14
movabsq $0x200000001, %rax      # imm = 0x200000001
movq %rax, (%r14)
movq %r15, 0x18(%r14)
movq %r15, %rax
shrq $0x28, %rax
cmpl $0xff, %eax
jb 0x1cebc
movl %ebp, 0x10(%r14)
andq $0x0, 0x8(%r14)
jmp 0x1cefa
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x1cee2
cmpl $0x1, %ecx
jne 0x1cefa
decl %eax
movq 0x18(%rbx), %rcx
movzwl %ax, %eax
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rdi
movq %r15, %rsi
callq 0x184e0
jmp 0x1ceee
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x1d698
movq %rax, 0x8(%r14)
movl $0x48, 0x10(%r14)
movq (%rbx), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1c6b6
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/SATA_HBA.cpp
// Function: Host_Components::SATA_HBA::~SATA_HBA()
SATA_HBA::~SATA_HBA()
	{
		for (auto &req : sata_ncq.queue) {
			if (req.second) {
				delete req.second;
			}
		}
		for (auto &req : waiting_requests_for_submission) {
			if (req) {
				delete req;
			}
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x43c13(%rip), %rax     # 0x60d70
movq %rax, (%rdi)
leaq 0x88(%rdi), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x1d17f
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x1d167
callq 0x7340
jmp 0x1d167
leaq 0xf8(%rbx), %r14
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x1d1a1
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x1d189
callq 0x7340
jmp 0x1d189
leaq 0x160(%rbx), %rdi
callq 0x1d7a8
leaq 0x110(%rbx), %rdi
callq 0x1d7f4
movq %r14, %rdi
callq 0x19a0a
leaq 0xe0(%rbx), %rdi
callq 0x19a76
leaq 0xb0(%rbx), %rdi
callq 0x19a2e
leaq 0x78(%rbx), %rdi
callq 0x19984
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x11c8c
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/SATA_HBA.cpp
// Function: Host_Components::SATA_HBA::Read_ncq_entry(unsigned long)
Submission_Queue_Entry* SATA_HBA::Read_ncq_entry(uint64_t address)
	{
		Submission_Queue_Entry* ncq_entry = new Submission_Queue_Entry;
		Host_IO_Request* request = request_queue_in_memory[(uint16_t)((address - sata_ncq.Submission_queue_memory_base_address) / sizeof(Submission_Queue_Entry))];
		
		if (request == NULL) {
			throw std::invalid_argument("SATA HBA: Request to access an NCQ entry that does not exist.");
		}

		ncq_entry->Command_Identifier = request->IO_queue_info;
		//For simplicity, MQSim's SATA host interface uses NVMe opcodes
		if (request->Type == Host_IO_Request_Type::READ) {
			ncq_entry->Opcode = NVME_READ_OPCODE;
			ncq_entry->Command_specific[0] = (uint32_t)request->Start_LBA;
			ncq_entry->Command_specific[1] = (uint32_t)(request->Start_LBA >> 32);
			ncq_entry->Command_specific[2] = ((uint32_t)((uint16_t)request->LBA_count)) & (uint32_t)(0x0000ffff);
			ncq_entry->PRP_entry_1 = (DATA_MEMORY_REGION);//Dummy addresses, just to emulate data read/write access
			ncq_entry->PRP_entry_2 = (DATA_MEMORY_REGION + 0x1000);//Dummy addresses
		} else {
			ncq_entry->Opcode = NVME_WRITE_OPCODE;
			ncq_entry->Command_specific[0] = (uint32_t)request->Start_LBA;
			ncq_entry->Command_specific[1] = (uint32_t)(request->Start_LBA >> 32);
			ncq_entry->Command_specific[2] = ((uint32_t)((uint16_t)request->LBA_count)) & (uint32_t)(0x0000ffff);
			ncq_entry->PRP_entry_1 = (DATA_MEMORY_REGION);//Dummy addresses, just to emulate data read/write access
			ncq_entry->PRP_entry_2 = (DATA_MEMORY_REGION + 0x1000);//Dummy addresses
		}

		return ncq_entry;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x48
popq %r15
movq %r15, %rdi
callq 0x7370
movq %rax, %rcx
subq 0x58(%r14), %rbx
movq %rbx, %rax
xorl %edx, %edx
divq %r15
movzwl %ax, %eax
movq 0xe0(%r14), %rdx
movq (%rdx,%rax,8), %rax
testq %rax, %rax
je 0x1d71a
movzwl 0x20(%rax), %edx
movw %dx, 0x2(%rcx)
xorl %edx, %edx
cmpl $0x1, 0x1c(%rax)
adcb $0x1, %dl
movzwl 0x18(%rax), %esi
movq 0x10(%rax), %rax
movb %dl, (%rcx)
movl %eax, 0x30(%rcx)
shrq $0x20, %rax
movl %eax, 0x34(%rcx)
movl %esi, 0x38(%rcx)
movabsq $0xff0000000000, %rax   # imm = 0xFF0000000000
movq %rax, 0x20(%rcx)
orq $0x1000, %rax           # imm = 0x1000
movq %rax, 0x28(%rcx)
movq %rcx, %rax
popq %rbx
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x28848(%rip), %rsi     # 0x45f74
movq %rax, %rdi
callq 0x7620
movq 0x4488d(%rip), %rsi     # 0x61fc8
movq 0x44866(%rip), %rdx     # 0x61fa8
movq %rbx, %rdi
callq 0x7590
movq %rax, %r14
movq %rbx, %rdi
callq 0x72a0
movq %r14, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::~Flash_Chip()
Flash_Chip::~Flash_Chip()
		{
			for (unsigned int dieID = 0; dieID < die_no; dieID++) {
				delete Dies[dieID];
			}
			delete[] Dies;
			delete[] _readLatency;
			delete[] _programLatency;
		}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x42a03(%rip), %rax     # 0x60dc8
movq %rax, (%rdi)
xorl %r15d, %r15d
movl 0x48(%rbx), %eax
movq 0x40(%rbx), %rdi
cmpq %rax, %r15
jae 0x1e3f5
movq (%rdi,%r15,8), %r14
testq %r14, %r14
je 0x1e3e8
movq %r14, %rdi
callq 0x1e1a6
movq %r14, %rdi
callq 0x7340
incq %r15
jmp 0x1e3cb
testq %rdi, %rdi
je 0x1e3ff
callq 0x7430
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x1e40d
callq 0x7430
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x1e41b
callq 0x7430
leaq 0xf0(%rbx), %rdi
callq 0x1f55e
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x11c8c
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::Validate_simulation_config()
void Flash_Chip::Validate_simulation_config()
		{
			if (Dies == NULL || die_no == 0) {
				PRINT_ERROR("Flash chip " << ID() << ": has no dies!")
			}

			for (unsigned int i = 0; i < die_no; i++) {
				if (Dies[i]->Planes == NULL) {
					PRINT_ERROR("Flash chip" << ID() << ": die (" + ID() + ") has no planes!")
				}
			}
		}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x1e551
movl 0x48(%rbx), %ecx
testq %rcx, %rcx
je 0x1e551
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x1e544
movq (%rax,%rdx,8), %rsi
incq %rdx
cmpq $0x0, (%rsi)
jne 0x1e478
movq 0x43b5b(%rip), %r14     # 0x61ff0
leaq 0x260ec(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x27b40(%rip), %rsi     # 0x45feb
movq %r14, %rdi
callq 0x7360
movq %rax, %r14
addq $0x8, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7480
movq %r14, %rdi
movq %r15, %rsi
callq 0x7310
movq %rax, %r14
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x7480
leaq 0x27b0c(%rip), %rsi     # 0x45ff6
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1f431
leaq 0x27afe(%rip), %rdx     # 0x45ffe
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9b29
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x7310
movq %rax, %rdi
callq 0x71a0
leaq 0x60(%rsp), %rdi
callq 0x7678
leaq 0x40(%rsp), %rdi
callq 0x7678
leaq 0x20(%rsp), %rdi
callq 0x7678
jmp 0x1e5ad
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x43a98(%rip), %r14     # 0x61ff0
leaq 0x26029(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x27a62(%rip), %rsi     # 0x45fd0
movq %r14, %rdi
callq 0x7360
movq %rax, %r14
addq $0x8, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7480
movq %r14, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x27a3f(%rip), %rsi     # 0x45fdc
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq %rsp, %rdi
callq 0x7678
movq 0x43a14(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x7678
jmp 0x1e5dd
jmp 0x1e5fa
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x7678
jmp 0x1e5ec
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x7678
jmp 0x1e5fd
jmp 0x1e5fa
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7678
movq %rbx, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::start_command_execution(NVM::FlashMemory::Flash_Command*)
void Flash_Chip::start_command_execution(Flash_Command* command)
		{
			Die* targetDie = Dies[command->Address[0].DieID];

			//If this is a simple command (not multiplane) then there should be only one address
			if (command->Address.size() > 1
				&& (command->CommandCode == CMD_READ_PAGE
					|| command->CommandCode == CMD_PROGRAM_PAGE
					|| command->CommandCode == CMD_ERASE_BLOCK)) {
				PRINT_ERROR("Flash chip " << ID() << ": executing a flash operation on a busy die!")
			}

			targetDie->Expected_finish_time = Simulator->Time() + Get_command_execution_latency(command->CommandCode, command->Address[0].PageID);
			targetDie->CommandFinishEvent = Simulator->Register_sim_event(targetDie->Expected_finish_time,
				this, command, static_cast<int>(Chip_Sim_Event_Type::COMMAND_FINISHED));
			targetDie->CurrentCMD = command;
			targetDie->Status = DieStatus::BUSY;
			idleDieNo--;

			if (status == Internal_Status::IDLE) {
				executionStartTime = Simulator->Time();
				expectedFinishTime = targetDie->Expected_finish_time;
				status = Internal_Status::BUSY;
			}

			DEBUG("Command execution started on channel: " << this->ChannelID << " chip: " << this->ChipID)
		}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x40(%rdi), %rcx
movq 0x8(%rsi), %rdx
movq 0x10(%rsi), %rax
movl 0x8(%rdx), %esi
movq (%rcx,%rsi,8), %r12
subq %rdx, %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
cmpq $0x2, %rax
jb 0x1e9b8
movq (%r14), %rax
cmpq $0x30, %rax
je 0x1ea49
cmpq $0x8010, %rax           # imm = 0x8010
je 0x1ea49
cmpq $0x60d0, %rax           # imm = 0x60D0
je 0x1ea49
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
movq %rax, %r15
movq (%r14), %rsi
movq 0x8(%r14), %rax
movl 0x14(%rax), %edx
movq %rbx, %rdi
callq 0x1f456
addq %r15, %rax
movq %rax, 0x18(%r12)
callq 0x1f784
movq 0x18(%r12), %rsi
movq %rax, %rdi
movq %rbx, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x1fb00
movq %rax, 0x10(%r12)
movq %r14, 0x28(%r12)
andl $0x0, 0xc(%r12)
decl 0x3c(%rbx)
cmpl $0x0, 0x38(%rbx)
jne 0x1ea3d
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
movq %rax, 0xa0(%rbx)
movq 0x18(%r12), %rax
movq %rax, 0xa8(%rbx)
movl $0x1, 0x38(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x435a0(%rip), %r14     # 0x61ff0
leaq 0x25b31(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x2756a(%rip), %rsi     # 0x45fd0
movq %r14, %rdi
callq 0x7360
movq %rax, %r14
addq $0x8, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7480
movq %r14, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x27578(%rip), %rsi     # 0x4600f
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
leaq 0x8(%rsp), %rdi
callq 0x7678
movq 0x43518(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7678
movq %rbx, %rdi
callq 0x75d0
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
subq 0xa0(%rbx), %rax
addq %rax, 0xd8(%rbx)
movq 0x40(%rbx), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %r15
cmpb $0x1, 0x38(%r15)
je 0x1ebc4
leaq 0xa0(%rbx), %r14
movq 0x18(%r15), %r12
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
subq %rax, %r12
movq %r12, 0x20(%r15)
callq 0x1f784
movq 0x10(%r15), %rsi
movq %rax, %rdi
callq 0x1fb5a
andq $0x0, 0x10(%r15)
movq 0x28(%r15), %rax
movq %rax, 0x30(%r15)
andq $0x0, 0x28(%r15)
movb $0x1, 0x38(%r15)
incq 0xc8(%rbx)
movl $0x1, 0xc(%r15)
movl 0x3c(%rbx), %eax
incl %eax
movl %eax, 0x3c(%rbx)
cmpl 0x48(%rbx), %eax
jne 0x1ebae
andl $0x0, 0x38(%rbx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%r14)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x43425(%rip), %r14     # 0x61ff0
leaq 0x259b6(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x2740a(%rip), %rsi     # 0x45feb
movq %r14, %rdi
callq 0x7360
movq %rax, %r14
addq $0x8, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7480
movq %r14, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x2744c(%rip), %rsi     # 0x4605c
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq %rsp, %rdi
callq 0x7678
movq 0x433a1(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7678
movq %rbx, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %r14
cmpb $0x0, 0x38(%r14)
je 0x1ecff
movq 0x30(%r14), %rax
movq %rax, 0x28(%r14)
andq $0x0, 0x30(%r14)
movb $0x0, 0x38(%r14)
incq 0xd0(%rbx)
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
addq 0x20(%r14), %rax
movq %rax, 0x18(%r14)
callq 0x1f784
movq 0x18(%r14), %rsi
movq 0x28(%r14), %rcx
movq %rax, %rdi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x1fb00
movq %rax, 0x10(%r14)
movq 0x18(%r14), %rax
cmpq 0xa8(%rbx), %rax
jbe 0x1ecd2
movq %rax, 0xa8(%rbx)
andl $0x0, 0xc(%r14)
decl 0x3c(%rbx)
movl $0x1, 0x38(%rbx)
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
movq %rax, 0xa0(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x432ea(%rip), %r14     # 0x61ff0
leaq 0x2587b(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x272b4(%rip), %rsi     # 0x45fd0
movq %r14, %rdi
callq 0x7360
movq %rax, %r14
addq $0x8, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7480
movq %r14, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x27352(%rip), %rsi     # 0x4609d
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq %rsp, %rdi
callq 0x7678
movq 0x43266(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7678
movq %rbx, %rdi
callq 0x75d0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.h
// Function: NVM::FlashMemory::Flash_Chip::Get_command_execution_latency(unsigned long, unsigned int)
sim_time_type Get_command_execution_latency(command_code_type CMDCode, flash_page_ID_type pageID)
			{
				int latencyType = 0;
				if (flash_technology == Flash_Technology_Type::MLC) {
					latencyType = pageID % 2;
				} else if (flash_technology == Flash_Technology_Type::TLC) {
					//From: Yaakobi et al., "Characterization and Error-Correcting Codes for TLC Flash Memories", ICNC 2012
					latencyType = (pageID <= 5) ? 0 : ((pageID <= 7) ? 1 : (((pageID - 8) >> 1) % 3));;
				}

				switch (CMDCode)
				{
					case CMD_READ_PAGE:
					case CMD_READ_PAGE_MULTIPLANE:
					case CMD_READ_PAGE_COPYBACK:
					case CMD_READ_PAGE_COPYBACK_MULTIPLANE:
						return _readLatency[latencyType] + _RBSignalDelayRead;
					case CMD_PROGRAM_PAGE:
					case CMD_PROGRAM_PAGE_MULTIPLANE:
					case CMD_PROGRAM_PAGE_COPYBACK:
					case CMD_PROGRAM_PAGE_COPYBACK_MULTIPLANE:
						return _programLatency[latencyType] + _RBSignalDelayWrite;
					case CMD_ERASE_BLOCK:
					case CMD_ERASE_BLOCK_MULTIPLANE:
						return _eraseLatency + _RBSignalDelayErase;
					default:
						throw std::invalid_argument("Unsupported command for flash chip.");
				}
			}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %eax
movl 0x34(%rdi), %ecx
xorl %edx, %edx
cmpl $0x3, %ecx
je 0x1f472
cmpl $0x2, %ecx
jne 0x1f48d
andl $0x1, %eax
movl %eax, %edx
jmp 0x1f48d
cmpl $0x6, %eax
jb 0x1f48d
cmpl $0x8, %eax
jae 0x1f481
pushq $0x1
popq %rdx
jmp 0x1f48d
addl $-0x8, %eax
shrl %eax
pushq $0x3
popq %rcx
xorl %edx, %edx
divl %ecx
cmpq $0x35, %rsi
jbe 0x1f50d
leaq -0x60d0(%rsi), %rax
cmpq $0x2, %rax
jb 0x1f532
leaq -0x8010(%rsi), %rax
cmpq $0x2, %rax
jb 0x1f4fc
cmpq $0x85111, %rsi          # imm = 0x85111
je 0x1f4fc
cmpq $0x8510, %rsi           # imm = 0x8510
je 0x1f4fc
cmpq $0x321, %rsi            # imm = 0x321
je 0x1f521
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x26c95(%rip), %rsi     # 0x46173
movq %rax, %rdi
callq 0x7620
movq 0x42adb(%rip), %rsi     # 0x61fc8
movq 0x42ab4(%rip), %rdx     # 0x61fa8
movq %rbx, %rdi
callq 0x7590
movl %edx, %ecx
shlq $0x3, %rcx
addq 0x60(%rdi), %rcx
movl $0x88, %eax
jmp 0x1f53b
movabsq $0x25000000000000, %rax # imm = 0x25000000000000
btq %rsi, %rax
jae 0x1f493
movl %edx, %ecx
shlq $0x3, %rcx
addq 0x58(%rdi), %rcx
movl $0x80, %eax
jmp 0x1f53b
leaq 0x68(%rdi), %rcx
movl $0x90, %eax
movq (%rdi,%rax), %rax
addq (%rcx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x72a0
movq %r14, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Plane.cpp
// Function: NVM::FlashMemory::Plane::Plane(unsigned int, unsigned int)
Plane::Plane(unsigned int BlocksNoPerPlane, unsigned int PagesNoPerBlock) :
			Read_count(0), Progam_count(0), Erase_count(0)
		{
			Healthy_block_no = BlocksNoPerPlane;
			Blocks = new Block*[BlocksNoPerPlane];
			for (unsigned int i = 0; i < BlocksNoPerPlane; i++) {
				Blocks[i] = new Block(PagesNoPerBlock, i);
			}
			Allocated_streams = NULL;
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movl %esi, 0x8(%rdi)
movl %esi, %ebp
leaq (,%rbp,8), %rdi
callq 0x7030
movq %rax, (%r14)
xorl %r15d, %r15d
pushq $0x10
popq %r12
cmpq %r15, %rbp
je 0x1f711
movq %r12, %rdi
callq 0x7370
movq %rax, %r13
movq %rax, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x1e0ac
movq (%r14), %rax
movq %r13, (%rax,%r15,8)
incq %r15
jmp 0x1f6e8
andq $0x0, 0x28(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r13, %rdi
callq 0x7340
movq %rbx, %rdi
callq 0x75d0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/Engine.cpp
// Function: MQSimEngine::Engine::Reset()
void Engine::Reset()
	{
		_EventList->Clear();
		_ObjectList.clear();
		_sim_time = 0;
		stop = false;
		started = false;
		Utils::Logical_Address_Partitioning_Unit::Reset();
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x2076c
leaq 0x10(%rbx), %rdi
callq 0x1fbf0
andq $0x0, (%rbx)
andw $0x0, 0x48(%rbx)
popq %rbx
jmp 0x40518
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/Engine.cpp
// Function: MQSimEngine::Engine::GetObject(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Sim_Object* Engine::GetObject(sim_object_id_type object_id)
	{
		auto itr = _ObjectList.find(object_id);
		if (itr == _ObjectList.end()) {
			return NULL;
		}

		return (*itr).second;
	}

// Assembly:
pushq %rax
addq $0x10, %rdi
callq 0x1fc7c
testq %rax, %rax
je 0x1f98d
movq 0x28(%rax), %rax
jmp 0x1f98f
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/Engine.cpp
// Function: MQSimEngine::Engine::RemoveObject(MQSimEngine::Sim_Object*)
void Engine::RemoveObject(Sim_Object* obj)
	{
		std::unordered_map<sim_object_id_type, Sim_Object*>::iterator it = _ObjectList.find(obj->ID());
		if (it == _ObjectList.end()) {
			throw std::invalid_argument("Removing an unregistered object.");
		}
		_ObjectList.erase(it);
	}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
addq $0x10, %rbx
addq $0x8, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7480
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1fc7c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x7678
testq %r14, %r14
je 0x1f9e1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x200b6
addq $0x28, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x267eb(%rip), %rsi     # 0x461de
movq %rax, %rdi
callq 0x7620
movq 0x425c6(%rip), %rsi     # 0x61fc8
movq 0x4259f(%rip), %rdx     # 0x61fa8
movq %rbx, %rdi
callq 0x7590
movq %rax, %r14
movq %rbx, %rdi
callq 0x72a0
jmp 0x1fa2b
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x7678
movq %r14, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/Engine.cpp
// Function: MQSimEngine::Engine::Start_simulation()
void Engine::Start_simulation()
	{
		started = true;

		for(std::unordered_map<sim_object_id_type, Sim_Object*>::iterator obj = _ObjectList.begin();
			obj != _ObjectList.end();
			++obj) {
			if (!obj->second->IsTriggersSetUp()) {
				obj->second->Setup_triggers();
			}
		}

		for (std::unordered_map<sim_object_id_type, Sim_Object*>::iterator obj = _ObjectList.begin();
			obj != _ObjectList.end();
			++obj) {
			obj->second->Validate_simulation_config();
		}
		
		for (std::unordered_map<sim_object_id_type, Sim_Object*>::iterator obj = _ObjectList.begin();
			obj != _ObjectList.end();
			++obj) {
			obj->second->Start_simulation();
		}
		
		Sim_Event* ev = NULL;
		while (true) {
			if (_EventList->Count == 0 || stop) {
				break;
			}

			EventTreeNode* minNode = _EventList->Get_min_node();
			ev = minNode->FirstSimEvent;

			_sim_time = ev->Fire_time;

			while (ev != NULL) {
				if(!ev->Ignore) {
					ev->Target_sim_object->Execute_simulator_event(ev);
				}
				Sim_Event* consumed_event = ev;
				ev = ev->Next_event;
				delete consumed_event;
			}
			_EventList->Remove(minNode);
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, 0x49(%rdi)
leaq 0x20(%rdi), %r14
movq %r14, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x1fa64
movq 0x28(%r15), %rdi
cmpb $0x0, 0x28(%rdi)
jne 0x1fa4a
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x1fa4a
movq %r14, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x1fa84
movq 0x28(%r15), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1fa67
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *(%rax)
movq (%r14), %r14
testq %r14, %r14
jne 0x1fa7b
jmp 0x1fadc
cmpb $0x0, 0x48(%rbx)
jne 0x1fae5
callq 0x2051e
movq %rax, %r14
movq 0x8(%rax), %r15
movq (%r15), %rax
movq %rax, (%rbx)
testq %r15, %r15
je 0x1fad0
cmpb $0x0, 0x28(%r15)
jne 0x1fabf
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x18(%rax)
movq 0x20(%r15), %r12
movq %r15, %rdi
callq 0x7340
movq %r12, %r15
jmp 0x1faa6
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x20604
movq 0x8(%rbx), %rdi
cmpl $0x0, (%rdi)
jne 0x1fa8e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/Engine.cpp
// Function: MQSimEngine::Engine::Register_sim_event(unsigned long, MQSimEngine::Sim_Object*, void*, int)
Sim_Event* Engine::Register_sim_event(sim_time_type fireTime, Sim_Object* targetObject, void* parameters, int type)
	{
		Sim_Event* ev = new Sim_Event(fireTime, targetObject, parameters, type);
		DEBUG("RegisterEvent " << fireTime << " " << targetObject)
		_EventList->Insert_sim_event(ev);
		return ev;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
pushq $0x30
popq %rdi
callq 0x7370
movq %rax, %rbp
movq %r12, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %ebx, 0x18(%rax)
andq $0x0, 0x20(%rax)
movb $0x0, 0x28(%rax)
movq 0x8(%r13), %rdi
movq %rax, %rsi
callq 0x20464
movq %rbp, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/EventTree.cpp
// Function: MQSimEngine::EventTree::EventTree()
EventTree::EventTree()
	{
		// set up the sentinel node. the sentinel node is the key to a successfull
		// implementation and for understanding the red-black tree properties.
		SentinelNode = new EventTreeNode();
		SentinelNode->Left = NULL;
		SentinelNode->Right = NULL;
		SentinelNode->Parent = NULL;
		SentinelNode->Color = 1;
		rbTree = SentinelNode;
		lastNodeFound = SentinelNode;
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x38
popq %rdi
callq 0x7370
movq %rax, 0x423f5(%rip)     # 0x625c0
xorps %xmm0, %xmm0
andq $0x0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movl $0x1, 0x18(%rax)
movq %rax, 0x8(%rbx)
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/EventTree.cpp
// Function: MQSimEngine::EventTree::Add(unsigned long, MQSimEngine::Sim_Event*)
void EventTree::Add(sim_time_type key, Sim_Event* data)
	{
		// traverse tree - find where node belongs
		// create new node
		EventTreeNode* node = new EventTreeNode();
		// grab the rbTree node of the tree
		EventTreeNode* temp = rbTree;

		while (temp != SentinelNode) {
			// find Parent
			node->Parent = temp;
			
			if (key > temp->Key)
				temp = temp->Right;
			else
				temp = temp->Left;
		}

		// setup node
		node->Key = key;
		node->FirstSimEvent = data;
		node->LastSimEvent = data;
		node->Left = SentinelNode;
		node->Right = SentinelNode;

		// insert node into tree starting at parent's location
		if (node->Parent != NULL) {
			if (node->Key > (node->Parent->Key)) {
				node->Parent->Right = node;
			} else {
				node->Parent->Left = node;
			}
		} else {
			// first node added
			rbTree = node;
		}

		// restore red-black properities
		RestoreAfterInsert(node);
		lastNodeFound = node;
		Count++;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x38
popq %rdi
callq 0x7370
movq %rax, %r14
andl $0x0, 0x18(%rax)
andq $0x0, 0x30(%rax)
leaq 0x8(%rbx), %rax
xorl %ecx, %ecx
movq 0x42394(%rip), %rdx     # 0x625c0
movq %rax, %rdi
movq (%rdi), %rsi
cmpq %rdx, %rsi
je 0x20250
movq %rsi, 0x30(%r14)
xorl %ecx, %ecx
cmpq %r15, (%rsi)
setb %cl
leaq (%rsi,%rcx,8), %rdi
addq $0x20, %rdi
movq %rsi, %rcx
jmp 0x2022f
movq %r15, (%r14)
movq %r12, 0x8(%r14)
movq %r12, 0x10(%r14)
movq %rdx, 0x20(%r14)
movq %rdx, 0x28(%r14)
testq %rcx, %rcx
je 0x2027a
cmpq %r15, (%rcx)
jae 0x20273
addq $0x28, %rcx
jmp 0x20277
addq $0x20, %rcx
movq %rcx, %rax
movq %r14, (%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2029a
movq %r14, 0x10(%rbx)
incl (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/EventTree.cpp
// Function: MQSimEngine::EventTree::RestoreAfterInsert(MQSimEngine::EventTreeNode*)
void EventTree::RestoreAfterInsert(EventTreeNode* x)
	{
		// x and y are used as variable names for brevity, in a more formal
		// implementation, you should probably change the names

		EventTreeNode* y;

		// maintain red-black tree properties after adding x
		while (x != rbTree && x->Parent->Color == 0) {
			// Parent node is .Colored red; 
			// determine traversal path
			// is it on the Left or Right subtree?
			if (x->Parent == x->Parent->Parent->Left) {	
				// get uncle
				y = x->Parent->Parent->Right;
				if (y != NULL && y->Color == 0)
				{	// uncle is red; change x's Parent and uncle to black
					x->Parent->Color = 1;
					y->Color = 1;
					// grandparent must be red. Why? Every red node that is not 
					// a leaf has only black children 
					x->Parent->Parent->Color = 0;
					x = x->Parent->Parent;	// continue loop with grandparent
				} else {
					// uncle is black; determine if x is greater than Parent
					if (x == x->Parent->Right)
					{	// yes, x is greater than Parent; rotate Left
						// make x a Left child
						x = x->Parent;
						RotateLeft(x);
					}
					// no, x is less than Parent
					x->Parent->Color = 1;	// make Parent black
					x->Parent->Parent->Color = 0;		// make grandparent black
					RotateRight(x->Parent->Parent);					// rotate right
				}
			} else {
				// x's Parent is on the Right subtree
				// this code is the same as above with "Left" and "Right" swapped
				y = x->Parent->Parent->Left;
				if (y != NULL && y->Color == 0) {
					x->Parent->Color = 1;
					y->Color = 1;
					x->Parent->Parent->Color = 0;
					x = x->Parent->Parent;
				} else {
					if (x == x->Parent->Left) {
						x = x->Parent;
						RotateRight(x);
					}
					x->Parent->Color = 1;
					x->Parent->Parent->Color = 0;
					RotateLeft(x->Parent->Parent);
				}
			}
		}

		// rbTree should always be black
		rbTree->Color = 1;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x1
popq %rbp
movq 0x8(%rbx), %rax
cmpq %rax, %r14
je 0x2036f
movq 0x30(%r14), %r15
cmpl $0x0, 0x18(%r15)
jne 0x2036f
movq 0x30(%r15), %rsi
movq 0x20(%rsi), %rax
cmpq %rax, %r15
je 0x202e9
testq %rax, %rax
je 0x202de
cmpl $0x0, 0x18(%rax)
je 0x20303
cmpq 0x20(%r15), %r14
je 0x20313
movq %r15, %rax
jmp 0x20329
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x202f8
cmpl $0x0, 0x18(%rax)
je 0x20303
cmpq 0x28(%r15), %r14
je 0x20341
movq %r15, %rax
jmp 0x20357
movl %ebp, 0x18(%r15)
movl %ebp, 0x18(%rax)
andl $0x0, 0x18(%rsi)
movq %rsi, %r14
jmp 0x202aa
movq %rbx, %rdi
movq %r15, %rsi
callq 0x203d8
movq 0x30(%r15), %rax
movq 0x30(%rax), %rsi
movq %r15, %r14
movl $0x1, 0x18(%rax)
andl $0x0, 0x18(%rsi)
movq %rbx, %rdi
callq 0x20382
jmp 0x202aa
movq %rbx, %rdi
movq %r15, %rsi
callq 0x20382
movq 0x30(%r15), %rax
movq 0x30(%rax), %rsi
movq %r15, %r14
movl $0x1, 0x18(%rax)
andl $0x0, 0x18(%rsi)
movq %rbx, %rdi
callq 0x203d8
jmp 0x202aa
movl $0x1, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/EventTree.cpp
// Function: MQSimEngine::EventTree::GetData(unsigned long)
Sim_Event* EventTree::GetData(sim_time_type key)
	{
		EventTreeNode* treeNode = rbTree;     // begin at root
		// traverse tree until node is found
		while (treeNode != SentinelNode)
		{
			if (key == treeNode->Key) {
				lastNodeFound = treeNode;
				return treeNode->FirstSimEvent;
			}
			if (key < (treeNode->Key)) {
				treeNode = treeNode->Left;
			} else {
				treeNode = treeNode->Right;
			}
		}
		return NULL;
	}

// Assembly:
leaq 0x8(%rdi), %rdx
movq 0x42187(%rip), %rcx     # 0x625c0
xorl %eax, %eax
movq (%rdx), %rdx
cmpq %rcx, %rdx
je 0x20462
cmpq %rsi, (%rdx)
je 0x2045a
setbe %r8b
movzbl %r8b, %r8d
leaq (%rdx,%r8,8), %rdx
addq $0x20, %rdx
jmp 0x2043b
movq %rdx, 0x10(%rdi)
movq 0x8(%rdx), %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/sim/EventTree.cpp
// Function: MQSimEngine::EventTree::Insert_sim_event(MQSimEngine::Sim_Event*)
void EventTree::Insert_sim_event(Sim_Event* event)
	{
		if (event->Fire_time < Engine::Instance()->Time()) {
			PRINT_ERROR("Illegal request to register a simulation event before Now!")
		}

		sim_time_type key = event->Fire_time;
		EventTreeNode* treeNode = rbTree;     // begin at root

												// traverse tree until node is found
		while (treeNode != SentinelNode)
		{
			if (key == treeNode->Key) {
				treeNode->LastSimEvent->Next_event = event;
				treeNode->LastSimEvent = event;
				return;
			}
			if (key < (treeNode->Key)) {
				treeNode = treeNode->Left;
			} else {
				treeNode = treeNode->Right;
			}
		}
		Add(event->Fire_time, event);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %r15
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
cmpq %rax, %r15
jb 0x204d1
movq (%rbx), %rsi
leaq 0x8(%r14), %rcx
movq 0x4212e(%rip), %rax     # 0x625c0
movq (%rcx), %rcx
cmpq %rax, %rcx
je 0x204af
cmpq (%rcx), %rsi
je 0x204bf
setae %dl
movzbl %dl, %edx
leaq (%rcx,%rdx,8), %rcx
addq $0x20, %rcx
jmp 0x20492
movq %r14, %rdi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x201fa
movq 0x10(%rcx), %rax
movq %rbx, 0x20(%rax)
movq %rbx, 0x10(%rcx)
popq %rbx
popq %r14
popq %r15
retq
movq 0x41b18(%rip), %rbx     # 0x61ff0
leaq 0x240a9(%rip), %rsi     # 0x44588
movq %rbx, %rdi
callq 0x7360
leaq 0x25d11(%rip), %rsi     # 0x461ff
movq %rbx, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x41acb(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::~Cached_Mapping_Table()
Cached_Mapping_Table::~Cached_Mapping_Table()
	{
		std::unordered_map<LPA_type, CMTSlotType*> addressMap;
		std::list<std::pair<LPA_type, CMTSlotType*>> lruList;

		auto entry = addressMap.begin();
		while (entry != addressMap.end()) {
			delete (*entry).second;
			addressMap.erase(entry++);
		}
	}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
leaq 0x48(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq %rsp, %rdi
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x270d6
leaq 0x18(%rsp), %rdi
callq 0x270fa
leaq 0x38(%rbx), %rdi
callq 0x270d6
movq %rbx, %rdi
callq 0x270fa
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Retrieve_ppa(unsigned short, unsigned long)
PPA_type Cached_Mapping_Table::Retrieve_ppa(const stream_id_type streamID, const LPA_type lpn)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpn);
		auto it = addressMap.find(key);
		assert(it != addressMap.end());
		assert(it->second->Status == CMTEntryStatus::VALID);
		lruList.splice(lruList.begin(), lruList, it->second->listPtr);
		
		return it->second->PPA;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
shlq $0x38, %rsi
orq %rdx, %rsi
movq %rsp, %rax
movq %rsi, (%rax)
movq %rax, %rsi
callq 0x279bc
testq %rax, %rax
je 0x20a9a
movq %rax, %r14
movq 0x10(%rax), %rax
cmpl $0x2, 0x14(%rax)
jne 0x20ab3
movq 0x38(%rbx), %rsi
addq $0x38, %rbx
movq 0x18(%rax), %rcx
movq %rbx, %rdi
movq %rbx, %rdx
callq 0x27a38
movq 0x10(%r14), %rax
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2596f(%rip), %rdi     # 0x46410
leaq 0x2597f(%rip), %rsi     # 0x46427
leaq 0x259a4(%rip), %rcx     # 0x46453
pushq $0x30
jmp 0x20aca
leaq 0x259fb(%rip), %rdi     # 0x464b5
leaq 0x25966(%rip), %rsi     # 0x46427
leaq 0x2598b(%rip), %rcx     # 0x46453
pushq $0x31
popq %rdx
callq 0x7260
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Get_bitmap_vector_of_written_sectors(unsigned short, unsigned long)
page_status_type Cached_Mapping_Table::Get_bitmap_vector_of_written_sectors(const stream_id_type streamID, const LPA_type lpn)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpn);
		auto it = addressMap.find(key);
		assert(it != addressMap.end());
		assert(it->second->Status == CMTEntryStatus::VALID);

		return it->second->WrittenStateBitmap;
	}

// Assembly:
pushq %rax
shlq $0x38, %rsi
orq %rdx, %rsi
movq %rsp, %rax
movq %rsi, (%rax)
movq %rax, %rsi
callq 0x279bc
testq %rax, %rax
je 0x20afb
movq 0x10(%rax), %rax
cmpl $0x2, 0x14(%rax)
jne 0x20b14
movq 0x8(%rax), %rax
popq %rcx
retq
leaq 0x2590e(%rip), %rdi     # 0x46410
leaq 0x2591e(%rip), %rsi     # 0x46427
leaq 0x259d1(%rip), %rcx     # 0x464e1
pushq $0x3b
jmp 0x20b2b
leaq 0x2599a(%rip), %rdi     # 0x464b5
leaq 0x25905(%rip), %rsi     # 0x46427
leaq 0x259b8(%rip), %rcx     # 0x464e1
pushq $0x3c
popq %rdx
callq 0x7260
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Update_mapping_info(unsigned short, unsigned long, unsigned long, unsigned long)
void Cached_Mapping_Table::Update_mapping_info(const stream_id_type streamID, const LPA_type lpa, const PPA_type ppa, const page_status_type pageWriteState)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpa);
		auto it = addressMap.find(key);
		assert(it != addressMap.end());
		assert(it->second->Status == CMTEntryStatus::VALID);
		it->second->PPA = ppa;
		it->second->WrittenStateBitmap = pageWriteState;
		it->second->Dirty = true;
		it->second->Stream_id = streamID;
		DEBUG("Address mapping table update entry - Stream ID:" << streamID << ", LPA:" << lpa << ", PPA:" << ppa)
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r15
movl %esi, %r14d
movq %r14, %rax
shlq $0x38, %rax
orq %rdx, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
callq 0x279bc
testq %rax, %rax
je 0x20b84
movq 0x10(%rax), %rax
cmpl $0x2, 0x14(%rax)
jne 0x20b9d
movq %r15, (%rax)
movq %rbx, 0x8(%rax)
movb $0x1, 0x10(%rax)
movw %r14w, 0x20(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x25885(%rip), %rdi     # 0x46410
leaq 0x25895(%rip), %rsi     # 0x46427
leaq 0x259ca(%rip), %rcx     # 0x46563
pushq $0x45
jmp 0x20bb4
leaq 0x25911(%rip), %rdi     # 0x464b5
leaq 0x2587c(%rip), %rsi     # 0x46427
leaq 0x259b1(%rip), %rcx     # 0x46563
pushq $0x46
popq %rdx
callq 0x7260
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Insert_new_mapping_info(unsigned short, unsigned long, unsigned long, unsigned long long)
void Cached_Mapping_Table::Insert_new_mapping_info(const stream_id_type streamID, const LPA_type lpa, const PPA_type ppa, const unsigned long long pageWriteState)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpa);
		auto it = addressMap.find(key);
		if (it == addressMap.end()) {
			throw std::logic_error("No slot is reserved!");
		}

		it->second->Status = CMTEntryStatus::VALID;
		it->second->PPA = ppa;
		it->second->WrittenStateBitmap = pageWriteState;
		it->second->Dirty = false;
		it->second->Stream_id = streamID;
		DEBUG("Address mapping table insert entry - Stream ID:" << streamID << ", LPA:" << lpa << ", PPA:" << ppa)
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r15
movl %esi, %r14d
movq %r14, %rax
shlq $0x38, %rax
orq %rdx, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
callq 0x279bc
testq %rax, %rax
je 0x20c0d
movq 0x10(%rax), %rax
movl $0x2, 0x14(%rax)
movq %r15, (%rax)
movq %rbx, 0x8(%rax)
movb $0x0, 0x10(%rax)
movw %r14w, 0x20(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x259d1(%rip), %rsi     # 0x465f0
movq %rax, %rdi
callq 0x74b0
movq 0x41392(%rip), %rsi     # 0x61fc0
movq 0x4133b(%rip), %rdx     # 0x61f70
movq %rbx, %rdi
callq 0x7590
movq %rax, %r14
movq %rbx, %rdi
callq 0x72a0
movq %r14, %rdi
callq 0x75d0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Is_slot_reserved_for_lpn_and_waiting(unsigned short, unsigned long)
bool Cached_Mapping_Table::Is_slot_reserved_for_lpn_and_waiting(const stream_id_type streamID, const LPA_type lpn)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpn);
		auto it = addressMap.find(key);
		if (it != addressMap.end()) {
			if (it->second->Status == CMTEntryStatus::WAITING) {
				return true;
			}
		}

		return false;
	}

// Assembly:
pushq %rax
shlq $0x38, %rsi
orq %rdx, %rsi
movq %rsp, %rax
movq %rsi, (%rax)
movq %rax, %rsi
callq 0x279bc
testq %rax, %rax
je 0x20c77
movq 0x10(%rax), %rcx
movb $0x1, %al
cmpl $0x1, 0x14(%rcx)
je 0x20c79
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Reserve_slot_for_lpn(unsigned short, unsigned long)
void Cached_Mapping_Table::Reserve_slot_for_lpn(const stream_id_type streamID, const LPA_type lpn)
	{
		LPA_type key = LPN_TO_UNIQUE_KEY(streamID, lpn);

		if (addressMap.find(key) != addressMap.end()) {
			throw std::logic_error("Duplicate lpa insertion into CMT!");
		}
		if (addressMap.size() >= capacity) {
			throw std::logic_error("CMT overfull!");
		}

		CMTSlotType* cmtEnt = new CMTSlotType();
		cmtEnt->Dirty = false;
		cmtEnt->Stream_id = streamID;
		lruList.push_front(std::pair<LPA_type, CMTSlotType*>(key, cmtEnt));
		cmtEnt->Status = CMTEntryStatus::WAITING;
		cmtEnt->listPtr = lruList.begin();
		addressMap[key] = cmtEnt;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movq %r14, %rax
shlq $0x38, %rax
orq %rdx, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
callq 0x279bc
testq %rax, %rax
jne 0x20d18
movl 0x50(%rbx), %eax
cmpq %rax, 0x18(%rbx)
jae 0x20d34
pushq $0x28
popq %rdi
callq 0x7370
movq %rax, %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
andq $0x0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movw %r14w, 0x20(%rax)
leaq 0x38(%rbx), %rdi
leaq 0x8(%rsp), %r14
movq (%r14), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, 0x8(%rsi)
callq 0x260de
movl $0x1, 0x14(%r15)
movq 0x38(%rbx), %rax
movq %rax, 0x18(%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27b1e
movq %r15, (%rax)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x258db(%rip), %rsi     # 0x46605
movq %rax, %rdi
callq 0x74b0
jmp 0x20d4e
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x258e1(%rip), %rsi     # 0x46627
movq %rax, %rdi
callq 0x74b0
movq 0x4126b(%rip), %rsi     # 0x61fc0
movq 0x41214(%rip), %rdx     # 0x61f70
movq %rbx, %rdi
callq 0x7590
jmp 0x20d66
movq %rax, %r14
movq %rbx, %rdi
callq 0x72a0
movq %r14, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Cached_Mapping_Table::Evict_one_slot(unsigned long&)
CMTSlotType Cached_Mapping_Table::Evict_one_slot(LPA_type& lpa)
	{
		assert(addressMap.size() > 0);
		addressMap.erase(lruList.back().first);
		lpa = UNIQUE_KEY_TO_LPN(lruList.back().second->Stream_id,lruList.back().first);
		CMTSlotType evictedItem = *lruList.back().second;
		delete lruList.back().second;
		lruList.pop_back();
	
		return evictedItem;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x18(%rsi)
je 0x20df2
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x38(%rsi), %r14
movq 0x40(%rsi), %rsi
addq $0x10, %rsi
movq %r12, %rdi
callq 0x27e04
movq 0x40(%r12), %rax
movq 0x18(%rax), %rdi
movl 0x20(%rdi), %ecx
shlq $0x38, %rcx
notq %rcx
andq 0x10(%rax), %rcx
movq %rcx, (%r15)
movq 0x20(%rdi), %rax
movq %rax, 0x20(%rbx)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
callq 0x7340
movq %r14, %rdi
callq 0x260ea
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2583c(%rip), %rdi     # 0x46635
leaq 0x25627(%rip), %rsi     # 0x46427
leaq 0x25844(%rip), %rcx     # 0x4664b
movl $0x85, %edx
callq 0x7260
nop