LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Data_Cache_Manager_Flash_Simple.cpp
// Function: SSD_Components::Data_Cache_Manager_Flash_Simple::service_dram_access_request(SSD_Components::Memory_Transfer_Info*)
void Data_Cache_Manager_Flash_Simple::service_dram_access_request(Memory_Transfer_Info* request_info)
	{
		dram_execution_queue[request_info->Stream_id].push(request_info);
		if(dram_execution_queue[request_info->Stream_id].size() == 1) {
			Simulator->Register_sim_event(Simulator->Time() + estimate_dram_access_time(request_info->Size_in_bytes, dram_row_size,
				dram_busrt_size, dram_burst_transfer_time_ddr, dram_tRCD, dram_tCL, dram_tRP),
				this, request_info, static_cast<int>(request_info->next_event_type));
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %rsi, (%r14)
movzwl 0x14(%rsi), %eax
imulq $0x50, %rax, %rdi
addq 0xc8(%rbx), %rdi
movq %r14, %rsi
callq 0x2b262
movq (%r14), %rax
movzwl 0x14(%rax), %eax
imulq $0x50, %rax, %rdi
addq 0xc8(%rbx), %rdi
callq 0x2afbe
cmpq $0x1, %rax
jne 0x2bcbd
callq 0x1f784
movq %rax, %r14
callq 0x1f784
movq %rax, %rdi
callq 0x1fafc
movq %rax, %r15
movq 0x8(%rsp), %rax
movl (%rax), %edi
movl 0x40(%rbx), %esi
movl 0x48(%rbx), %edx
movsd 0x50(%rbx), %xmm0
movq 0x58(%rbx), %rcx
movq 0x60(%rbx), %r8
movq 0x68(%rbx), %r9
callq 0x2abb8
addq %rax, %r15
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %r8d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1fb00
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/FTL.cpp
// Function: SSD_Components::FTL::Validate_simulation_config()
void FTL::Validate_simulation_config()
	{
		NVM_Firmware::Validate_simulation_config();
		if (this->Data_cache_manager == NULL)
			throw std::logic_error("The cache manager is not set for FTL!");
		if (this->Address_Mapping_Unit == NULL)
			throw std::logic_error("The mapping module is not set for FTL!");
		if (this->BlockManager == NULL)
			throw std::logic_error("The block manager is not set for FTL!");
		if (this->GC_and_WL_Unit == NULL)
			throw std::logic_error("The garbage collector is not set for FTL!");
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x373f6
cmpq $0x0, 0x30(%rbx)
je 0x2c382
cmpq $0x0, 0x38(%rbx)
je 0x2c39e
cmpq $0x0, 0x40(%rbx)
je 0x2c3ba
cmpq $0x0, 0x48(%rbx)
je 0x2c3d6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x1ae6c(%rip), %rsi     # 0x47200
movq %rax, %rdi
callq 0x74b0
jmp 0x2c3f0
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x1ae76(%rip), %rsi     # 0x47226
movq %rax, %rdi
callq 0x74b0
jmp 0x2c3f0
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x1ae81(%rip), %rsi     # 0x4724d
movq %rax, %rdi
callq 0x74b0
jmp 0x2c3f0
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x1ae8b(%rip), %rsi     # 0x47273
movq %rax, %rdi
callq 0x74b0
movq 0x35bc9(%rip), %rsi     # 0x61fc0
movq 0x35b72(%rip), %rdx     # 0x61f70
movq %rbx, %rdi
callq 0x7590
jmp 0x2c40c
jmp 0x2c40c
jmp 0x2c40c
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/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Allocate_block_and_page_in_plane_for_user_write(unsigned short, NVM::FlashMemory::Physical_Page_Address&)
void Flash_Block_Manager::Allocate_block_and_page_in_plane_for_user_write(const stream_id_type stream_id, NVM::FlashMemory::Physical_Page_Address& page_address)
	{
		PlaneBookKeepingType *plane_record = &plane_manager[page_address.ChannelID][page_address.ChipID][page_address.DieID][page_address.PlaneID];
		plane_record->Valid_pages_count++;
		plane_record->Free_pages_count--;		
		page_address.BlockID = plane_record->Data_wf[stream_id]->BlockID;
		page_address.PageID = plane_record->Data_wf[stream_id]->Current_page_write_index++;
		program_transaction_issued(page_address);

		//The current write frontier block is written to the end
		if(plane_record->Data_wf[stream_id]->Current_page_write_index == pages_no_per_block) {
			//Assign a new write frontier block
			plane_record->Data_wf[stream_id] = plane_record->Get_a_free_block(stream_id, false);
			gc_and_wl_unit->Check_gc_required(plane_record->Get_free_block_pool_size(), page_address);
		}

		plane_record->Check_bookkeeping_correctness(page_address);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %rax
movl (%rdx), %ecx
movl 0x4(%rdx), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %r13
movl 0xc(%rbx), %eax
imulq $0xe0, %rax, %rbp
movq %r13, %r14
addq %rbp, %r14
movq 0x4(%r13,%rbp), %xmm0
paddd 0x16e5c(%rip), %xmm0    # 0x47830
movq %xmm0, 0x4(%r13,%rbp)
movq 0x48(%r13,%rbp), %rax
movq %rsi, (%rsp)
leal (,%rsi,8), %r12d
movq (%rax,%r12), %rax
movl (%rax), %ecx
movl %ecx, 0x10(%rbx)
movl 0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rax)
movl %ecx, 0x14(%rbx)
movq %rbx, %rsi
callq 0x31b56
movq 0x48(%r13,%rbp), %rax
movq (%rax,%r12), %rax
movl 0x4(%rax), %eax
cmpl 0x34(%r15), %eax
jne 0x30a51
movq (%rsp), %rax
movl %eax, %r12d
movzwl %ax, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x315c8
movq 0x48(%r14), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x10(%r15), %r15
movq %r14, %rdi
callq 0x31998
movq (%r15), %rcx
movq %r15, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq *0x28(%rcx)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31882
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Allocate_block_and_page_in_plane_for_gc_write(unsigned short, NVM::FlashMemory::Physical_Page_Address&)
void Flash_Block_Manager::Allocate_block_and_page_in_plane_for_gc_write(const stream_id_type stream_id, NVM::FlashMemory::Physical_Page_Address& page_address)
	{
		PlaneBookKeepingType *plane_record = &plane_manager[page_address.ChannelID][page_address.ChipID][page_address.DieID][page_address.PlaneID];
		plane_record->Valid_pages_count++;
		plane_record->Free_pages_count--;		
		page_address.BlockID = plane_record->GC_wf[stream_id]->BlockID;
		page_address.PageID = plane_record->GC_wf[stream_id]->Current_page_write_index++;

		
		//The current write frontier block is written to the end
		if (plane_record->GC_wf[stream_id]->Current_page_write_index == pages_no_per_block) {
			//Assign a new write frontier block
			plane_record->GC_wf[stream_id] = plane_record->Get_a_free_block(stream_id, false);
			gc_and_wl_unit->Check_gc_required(plane_record->Get_free_block_pool_size(), page_address);
		}
		plane_record->Check_bookkeeping_correctness(page_address);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x8(%rdi), %rax
movl (%rdx), %ecx
movl 0x4(%rdx), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rbx), %ecx
imulq $0xe0, %rcx, %rcx
leaq (%rax,%rcx), %r14
movq 0x4(%rax,%rcx), %xmm0
paddd 0x16d87(%rip), %xmm0    # 0x47830
movq %xmm0, 0x4(%rax,%rcx)
movq 0x50(%rax,%rcx), %rax
movl %esi, %r12d
movq (%rax,%r12,8), %rax
movl (%rax), %ecx
movl %ecx, 0x10(%rbx)
movl 0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rax)
movl %ecx, 0x14(%rbx)
cmpl 0x34(%rdi), %edx
jne 0x30b03
movq %rdi, %r15
movzwl %si, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x315c8
movq 0x50(%r14), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x10(%r15), %r15
movq %r14, %rdi
callq 0x31998
movq (%r15), %rcx
movq %r15, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq *0x28(%rcx)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x31882
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Allocate_block_and_page_in_plane_for_translation_write(unsigned short, NVM::FlashMemory::Physical_Page_Address&, bool)
void Flash_Block_Manager::Allocate_block_and_page_in_plane_for_translation_write(const stream_id_type streamID, NVM::FlashMemory::Physical_Page_Address& page_address, bool is_for_gc)
	{
		PlaneBookKeepingType *plane_record = &plane_manager[page_address.ChannelID][page_address.ChipID][page_address.DieID][page_address.PlaneID];
		plane_record->Valid_pages_count++;
		plane_record->Free_pages_count--;
		page_address.BlockID = plane_record->Translation_wf[streamID]->BlockID;
		page_address.PageID = plane_record->Translation_wf[streamID]->Current_page_write_index++;
		program_transaction_issued(page_address);

		//The current write frontier block for translation pages is written to the end
		if (plane_record->Translation_wf[streamID]->Current_page_write_index == pages_no_per_block) {
			//Assign a new write frontier block
			plane_record->Translation_wf[streamID] = plane_record->Get_a_free_block(streamID, true);
			if (!is_for_gc) {
				gc_and_wl_unit->Check_gc_required(plane_record->Get_free_block_pool_size(), page_address);
			}
		}
		plane_record->Check_bookkeeping_correctness(page_address);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %rax
movl (%rdx), %ecx
movl 0x4(%rdx), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %r13
movl 0xc(%rbx), %eax
imulq $0xe0, %rax, %rbp
movq %r13, %r12
addq %rbp, %r12
movq 0x4(%r13,%rbp), %xmm0
paddd 0x16b03(%rip), %xmm0    # 0x47830
movq %xmm0, 0x4(%r13,%rbp)
movq 0x58(%r13,%rbp), %rax
movq %rsi, 0x10(%rsp)
leal (,%rsi,8), %r14d
movq (%rax,%r14), %rax
movl (%rax), %ecx
movl %ecx, 0x10(%rbx)
movl 0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rax)
movl %ecx, 0x14(%rbx)
movq %rbx, %rsi
callq 0x31b56
movq 0x58(%r13,%rbp), %rax
movq (%rax,%r14), %rax
movl 0x4(%rax), %eax
cmpl 0x34(%r15), %eax
jne 0x30db5
movq 0x10(%rsp), %rax
movl %eax, %r14d
movzwl %ax, %esi
pushq $0x1
popq %rdx
movq %r12, %rdi
callq 0x315c8
movq 0x58(%r12), %rcx
movq %rax, (%rcx,%r14,8)
cmpb $0x0, 0xc(%rsp)
jne 0x30db5
movq 0x10(%r15), %r15
movq %r12, %rdi
callq 0x31998
movq (%r15), %rcx
movq %r15, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq *0x28(%rcx)
movq %r12, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31882
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Add_erased_block_to_pool(NVM::FlashMemory::Physical_Page_Address const&)
void Flash_Block_Manager::Add_erased_block_to_pool(const NVM::FlashMemory::Physical_Page_Address& block_address)
	{
		PlaneBookKeepingType *plane_record = &plane_manager[block_address.ChannelID][block_address.ChipID][block_address.DieID][block_address.PlaneID];
		Block_Pool_Slot_Type* block = &(plane_record->Blocks[block_address.BlockID]);
		plane_record->Free_pages_count += block->Invalid_page_count;
		plane_record->Invalid_pages_count -= block->Invalid_page_count;

		Stats::Block_erase_histogram[block_address.ChannelID][block_address.ChipID][block_address.DieID][block_address.PlaneID][block->Erase_count]--;
		block->Erase();
		Stats::Block_erase_histogram[block_address.ChannelID][block_address.ChipID][block_address.DieID][block_address.PlaneID][block->Erase_count]++;
		plane_record->Add_to_free_block_pool(block, gc_and_wl_unit->Use_dynamic_wearleveling());
		plane_record->Check_bookkeeping_correctness(block_address);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, (%rsp)
movq 0x8(%rdi), %rax
movl (%rsi), %ecx
movl 0x4(%rsi), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rsi), %esi
movq (%rax,%rsi,8), %rax
movl 0xc(%rbx), %edi
imulq $0xe0, %rdi, %r8
movq 0x10(%rax,%r8), %r13
movl 0x10(%rbx), %ebp
shlq $0x6, %rbp
movl 0xc(%r13,%rbp), %r9d
addl %r9d, 0x4(%rax,%r8)
subl %r9d, 0xc(%rax,%r8)
leaq (%rax,%r8), %r15
movq %r13, %r12
addq %rbp, %r12
leaq 0x328d2(%rip), %r14     # 0x63700
movq (%r14), %rax
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movq (%rax,%rsi,8), %rax
movq (%rax,%rdi,8), %rax
movl 0x10(%r13,%rbp), %ecx
decl (%rax,%rcx,4)
movq %r12, %rdi
callq 0x3184c
movq (%r14), %rax
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rbx), %ecx
movq (%rax,%rcx,8), %rax
movl 0x10(%r13,%rbp), %ecx
incl (%rax,%rcx,4)
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x337ac
movzbl %al, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x31596
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31882
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Invalidate_page_in_block(unsigned short, NVM::FlashMemory::Physical_Page_Address const&)
inline void Flash_Block_Manager::Invalidate_page_in_block(const stream_id_type stream_id, const NVM::FlashMemory::Physical_Page_Address& page_address)
	{
		PlaneBookKeepingType* plane_record = &plane_manager[page_address.ChannelID][page_address.ChipID][page_address.DieID][page_address.PlaneID];
		plane_record->Invalid_pages_count++;
		plane_record->Valid_pages_count--;
		if (plane_record->Blocks[page_address.BlockID].Stream_id != stream_id) {
			PRINT_ERROR("Inconsistent status in the Invalidate_page_in_block function! The accessed block is not allocated to stream " << stream_id)
		}
		plane_record->Blocks[page_address.BlockID].Invalid_page_count++;
		plane_record->Blocks[page_address.BlockID].Invalid_page_bitmap[page_address.PageID / 64] |= ((uint64_t)0x1) << (page_address.PageID % 64);
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq 0x8(%rdi), %rax
movl (%rdx), %ecx
movl 0x4(%rdx), %esi
movq (%rax,%rcx,8), %rax
movq (%rax,%rsi,8), %rax
movl 0x8(%rdx), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rdx), %ecx
imulq $0xe0, %rcx, %rcx
movq 0x8(%rax,%rcx), %xmm0
paddd 0x1694e(%rip), %xmm0    # 0x47830
movq %xmm0, 0x8(%rax,%rcx)
movq 0x10(%rax,%rcx), %rax
movl 0x10(%rdx), %esi
shlq $0x6, %rsi
cmpw %bx, 0x20(%rax,%rsi)
jne 0x30f1f
leaq (%rax,%rsi), %rcx
incl 0xc(%rcx)
movl 0x14(%rdx), %ecx
pushq $0x1
popq %rdx
shlq %cl, %rdx
movq 0x18(%rax,%rsi), %rax
shrl $0x6, %ecx
orq %rdx, (%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x310ca(%rip), %r14     # 0x61ff0
leaq 0x1365b(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x16a00(%rip), %rsi     # 0x4793c
movq %r14, %rdi
callq 0x7360
movzwl %bx, %esi
movq %rax, %rdi
callq 0x7570
movq %rax, %rdi
callq 0x71a0
movq 0x31072(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager.cpp
// Function: SSD_Components::Flash_Block_Manager::Invalidate_page_in_block_for_preconditioning(unsigned short, NVM::FlashMemory::Physical_Page_Address const&)
inline void Flash_Block_Manager::Invalidate_page_in_block_for_preconditioning(const stream_id_type stream_id, const NVM::FlashMemory::Physical_Page_Address& page_address)
	{
		PlaneBookKeepingType* plane_record = &plane_manager[page_address.ChannelID][page_address.ChipID][page_address.DieID][page_address.PlaneID];
		plane_record->Invalid_pages_count++;
		if (plane_record->Blocks[page_address.BlockID].Stream_id != stream_id) {
			PRINT_ERROR("Inconsistent status in the Invalidate_page_in_block function! The accessed block is not allocated to stream " << stream_id)
		}
		plane_record->Blocks[page_address.BlockID].Invalid_page_count++;
		plane_record->Blocks[page_address.BlockID].Invalid_page_bitmap[page_address.PageID / 64] |= ((uint64_t)0x1) << (page_address.PageID % 64);
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq 0x8(%rdi), %rax
movl (%rdx), %ecx
movl 0x4(%rdx), %esi
movq (%rax,%rcx,8), %rax
movq (%rax,%rsi,8), %rax
movl 0x8(%rdx), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rdx), %ecx
imulq $0xe0, %rcx, %rcx
incl 0xc(%rax,%rcx)
movq 0x10(%rax,%rcx), %rax
movl 0x10(%rdx), %esi
shlq $0x6, %rsi
cmpw %bx, 0x20(%rax,%rsi)
jne 0x30fcf
leaq (%rax,%rsi), %rcx
incl 0xc(%rcx)
movl 0x14(%rdx), %ecx
pushq $0x1
popq %rdx
shlq %cl, %rdx
movq 0x18(%rax,%rsi), %rax
shrl $0x6, %ecx
orq %rdx, (%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x3101a(%rip), %r14     # 0x61ff0
leaq 0x135ab(%rip), %rsi     # 0x44588
movq %r14, %rdi
callq 0x7360
leaq 0x16950(%rip), %rsi     # 0x4793c
movq %r14, %rdi
callq 0x7360
movzwl %bx, %esi
movq %rax, %rdi
callq 0x7570
movq %rax, %rdi
callq 0x71a0
movq 0x30fc2(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::PlaneBookKeepingType::Add_to_free_block_pool(SSD_Components::Block_Pool_Slot_Type*, bool)
void PlaneBookKeepingType::Add_to_free_block_pool(Block_Pool_Slot_Type* block, bool consider_dynamic_wl)
	{
		if (consider_dynamic_wl) {
			std::pair<unsigned int, Block_Pool_Slot_Type*> entry(block->Erase_count, block);
			Free_block_pool.insert(entry);
		} else {
			std::pair<unsigned int, Block_Pool_Slot_Type*> entry(0, block);
			Free_block_pool.insert(entry);
		}
	}

// Assembly:
subq $0x18, %rsp
testl %edx, %edx
je 0x315aa
movl 0x10(%rsi), %ecx
leaq 0x8(%rsp), %rax
movl %ecx, (%rax)
jmp 0x315b2
leaq 0x8(%rsp), %rax
andl $0x0, (%rax)
movq %rsi, 0x8(%rax)
addq $0x18, %rdi
movq %rax, %rsi
callq 0x32210
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::PlaneBookKeepingType::Get_a_free_block(unsigned short, bool)
Block_Pool_Slot_Type* PlaneBookKeepingType::Get_a_free_block(stream_id_type stream_id, bool for_mapping_data)
	{
		Block_Pool_Slot_Type* new_block = NULL;
		new_block = (*Free_block_pool.begin()).second;//Assign a new write frontier block
		if (Free_block_pool.size() == 0) {
			PRINT_ERROR("Requesting a free block from an empty pool!")
		}
		Free_block_pool.erase(Free_block_pool.begin());
		new_block->Stream_id = stream_id;
		new_block->Holds_mapping_data = for_mapping_data;
		Block_usage_history.push(new_block->BlockID);

		return new_block;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x40(%rdi)
je 0x31615
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
addq $0x18, %rdi
movq 0x30(%rbx), %rsi
movq 0x28(%rsi), %r15
callq 0x31f9c
movw %r14w, 0x20(%r15)
movb %bpl, 0x22(%r15)
addq $0x60, %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31fe8
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x309d4(%rip), %rbx     # 0x61ff0
leaq 0x12f65(%rip), %rsi     # 0x44588
movq %rbx, %rdi
callq 0x7360
leaq 0x1639f(%rip), %rsi     # 0x479d1
movq %rbx, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x30987(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::Block_Pool_Slot_Type::Erase()
void Block_Pool_Slot_Type::Erase()
	{
		Current_page_write_index = 0;
		Invalid_page_count = 0;
		Erase_count++;
		for (unsigned int i = 0; i < Block_Pool_Slot_Type::Page_vector_size; i++) {
			Invalid_page_bitmap[i] = All_VALID_PAGE;
		}
		Stream_id = NO_STREAM;
		Holds_mapping_data = false;
		Erase_transaction = NULL;
	}

// Assembly:
andl $0x0, 0x4(%rdi)
andl $0x0, 0xc(%rdi)
incl 0x10(%rdi)
movl 0x30dab(%rip), %eax     # 0x62608
movq 0x18(%rdi), %rcx
xorl %edx, %edx
cmpq %rax, %rdx
jae 0x31872
andq $0x0, (%rcx,%rdx,8)
incq %rdx
jmp 0x31863
movw $0xff, 0x20(%rdi)
movb $0x0, 0x22(%rdi)
andq $0x0, 0x28(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::PlaneBookKeepingType::Check_bookkeeping_correctness(NVM::FlashMemory::Physical_Page_Address const&)
void PlaneBookKeepingType::Check_bookkeeping_correctness(const NVM::FlashMemory::Physical_Page_Address& plane_address)
	{
		if (Total_pages_count != Free_pages_count + Valid_pages_count + Invalid_pages_count) {
			PRINT_ERROR("Inconsistent status in the plane bookkeeping record!")
		}
		if (Free_pages_count == 0) {
			PRINT_ERROR("Plane " << "@" << plane_address.ChannelID << "@" << plane_address.ChipID << "@" << plane_address.DieID << "@" << plane_address.PlaneID << " pool size: " << Get_free_block_pool_size() << " ran out of free pages! Bad resource management! It is not safe to continue simulation!");
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x4(%rdi), %eax
movl 0x8(%rdi), %ecx
addl %eax, %ecx
addl 0xc(%rdi), %ecx
cmpl %ecx, (%rdi)
jne 0x318a0
testl %eax, %eax
je 0x318c5
popq %rbx
popq %r14
popq %r15
retq
movq 0x30749(%rip), %rbx     # 0x61ff0
leaq 0x12cda(%rip), %rsi     # 0x44588
movq %rbx, %rdi
callq 0x7360
leaq 0x16140(%rip), %rsi     # 0x479fd
movq %rbx, %rdi
jmp 0x31976
movq %rsi, %r14
movq %rdi, %rbx
movq 0x3071e(%rip), %r15     # 0x61ff0
leaq 0x12caf(%rip), %rsi     # 0x44588
movq %r15, %rdi
callq 0x7360
leaq 0x1614a(%rip), %rsi     # 0x47a32
movq %r15, %rdi
callq 0x7360
leaq 0x16c31(%rip), %r15     # 0x48528
movq %rax, %rdi
movq %r15, %rsi
callq 0x7360
movl (%r14), %esi
movq %rax, %rdi
callq 0x7470
movq %rax, %rdi
movq %r15, %rsi
callq 0x7360
movl 0x4(%r14), %esi
movq %rax, %rdi
callq 0x7470
movq %rax, %rdi
movq %r15, %rsi
callq 0x7360
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x7470
movq %rax, %rdi
movq %r15, %rsi
callq 0x7360
movl 0xc(%r14), %esi
movq %rax, %rdi
callq 0x7470
leaq 0x160e0(%rip), %rsi     # 0x47a39
movq %rax, %rdi
callq 0x7360
movl 0x40(%rbx), %esi
movq %rax, %rdi
callq 0x7470
leaq 0x160d3(%rip), %rsi     # 0x47a46
movq %rax, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x30646(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::Flash_Block_Manager_Base::Get_min_max_erase_difference(NVM::FlashMemory::Physical_Page_Address const&)
unsigned int Flash_Block_Manager_Base::Get_min_max_erase_difference(const NVM::FlashMemory::Physical_Page_Address& plane_address)
	{
		unsigned int min_erased_block = 0;
		unsigned int max_erased_block = 0;
		PlaneBookKeepingType *plane_record = &plane_manager[plane_address.ChannelID][plane_address.ChipID][plane_address.DieID][plane_address.PlaneID];

		for (unsigned int i = 1; i < block_no_per_plane; i++) {
			if (plane_record->Blocks[i].Erase_count > plane_record->Blocks[max_erased_block].Erase_count) {
				max_erased_block = i;
			}
			if (plane_record->Blocks[i].Erase_count < plane_record->Blocks[min_erased_block].Erase_count) {
				min_erased_block = i;
			}
		}

		return max_erased_block - min_erased_block;
	}

// Assembly:
pushq %r14
pushq %rbx
movq 0x8(%rdi), %rax
movl (%rsi), %ecx
movl 0x4(%rsi), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rsi), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rsi), %edx
movl 0x30(%rdi), %ecx
imulq $0xe0, %rdx, %rdx
addq %rax, %rdx
addq $0x10, %rdx
xorl %eax, %eax
movabsq $0x1, %rsi
movabsq $0x50, %rdi
xorl %r8d, %r8d
cmpq %rcx, %rsi
jae 0x31a27
movq (%rdx), %r11
movl (%r11,%rdi), %ebx
movl %eax, %r14d
shlq $0x6, %r14
movl %esi, %r9d
movl %esi, %r10d
cmpl 0x10(%r11,%r14), %ebx
ja 0x31a07
movl %eax, %r10d
movl %r8d, %eax
shlq $0x6, %rax
cmpl 0x10(%r11,%rax), %ebx
jb 0x31a18
movl %r8d, %r9d
incq %rsi
addq $0x40, %rdi
movl %r10d, %eax
movl %r9d, %r8d
jmp 0x319e4
subl %r8d, %eax
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Flash_Block_Manager_Base.cpp
// Function: SSD_Components::Flash_Block_Manager_Base::Get_coldest_block_id(NVM::FlashMemory::Physical_Page_Address const&)
flash_block_ID_type Flash_Block_Manager_Base::Get_coldest_block_id(const NVM::FlashMemory::Physical_Page_Address& plane_address)
	{
		unsigned int min_erased_block = 0;
		PlaneBookKeepingType *plane_record = &plane_manager[plane_address.ChannelID][plane_address.ChipID][plane_address.DieID][plane_address.PlaneID];

		for (unsigned int i = 1; i < block_no_per_plane; i++) {
			if (plane_record->Blocks[i].Erase_count < plane_record->Blocks[min_erased_block].Erase_count) {
				min_erased_block = i;
			}
		}
		
		return min_erased_block;
	}

// Assembly:
movq 0x8(%rdi), %rax
movl (%rsi), %ecx
movl 0x4(%rsi), %edx
movq (%rax,%rcx,8), %rax
movq (%rax,%rdx,8), %rax
movl 0x8(%rsi), %ecx
movq (%rax,%rcx,8), %rax
movl 0xc(%rsi), %edx
movl 0x30(%rdi), %ecx
imulq $0xe0, %rdx, %rdx
addq %rax, %rdx
addq $0x10, %rdx
xorl %eax, %eax
pushq $0x1
popq %rsi
pushq $0x50
popq %rdi
cmpq %rcx, %rsi
jae 0x31a8e
movq (%rdx), %r9
movl (%r9,%rdi), %r10d
movl %eax, %r11d
shlq $0x6, %r11
movl %esi, %r8d
cmpl 0x10(%r9,%r11), %r10d
jb 0x31a82
movl %eax, %r8d
incq %rsi
addq $0x40, %rdi
movl %r8d, %eax
jmp 0x31a62
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/GC_and_WL_Unit_Base.cpp
// Function: SSD_Components::GC_and_WL_Unit_Base::Get_GC_policy_specific_parameter()
unsigned int GC_and_WL_Unit_Base::Get_GC_policy_specific_parameter()
	{
		switch (block_selection_policy) {
			case GC_Block_Selection_Policy_Type::RGA:
				return rga_set_size;
			case GC_Block_Selection_Policy_Type::RANDOM_PP:
				return random_pp_threshold;
		}

		return 0;
	}

// Assembly:
movl 0x2c(%rdi), %ecx
cmpl $0x4, %ecx
je 0x337a0
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0x337a6
movl 0x80(%rdi), %eax
retq
movl 0xf0(%rdi), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/GC_and_WL_Unit_Base.cpp
// Function: SSD_Components::GC_and_WL_Unit_Base::is_safe_gc_wl_candidate(SSD_Components::PlaneBookKeepingType const*, unsigned int)
bool GC_and_WL_Unit_Base::is_safe_gc_wl_candidate(const PlaneBookKeepingType* plane_record, const flash_block_ID_type gc_wl_candidate_block_id)
	{
		//The block shouldn't be a current write frontier
		for (unsigned int stream_id = 0; stream_id < address_mapping_unit->Get_no_of_input_streams(); stream_id++) {
			if ((&plane_record->Blocks[gc_wl_candidate_block_id]) == plane_record->Data_wf[stream_id]
				|| (&plane_record->Blocks[gc_wl_candidate_block_id]) == plane_record->Translation_wf[stream_id]
				|| (&plane_record->Blocks[gc_wl_candidate_block_id]) == plane_record->GC_wf[stream_id]) {
				return false;
			}
		}

		//The block shouldn't have an ongoing program request (all pages must already be written)
		if (plane_record->Blocks[gc_wl_candidate_block_id].Ongoing_user_program_count > 0) {
			return false;
		}

		if (plane_record->Blocks[gc_wl_candidate_block_id].Has_ongoing_gc_wl) {
			return false;
		}

		return true;
	}

// Assembly:
movq 0x30(%rdi), %rax
movl 0x50(%rax), %ecx
movl %edx, %eax
shlq $0x6, %rax
addq 0x10(%rsi), %rax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x337ef
movq 0x48(%rsi), %rdi
cmpq (%rdi,%rdx,8), %rax
je 0x337f5
movq 0x58(%rsi), %rdi
cmpq (%rdi,%rdx,8), %rax
je 0x337f5
movq 0x50(%rsi), %rdi
leaq 0x1(%rdx), %r8
cmpq (%rdi,%rdx,8), %rax
movq %r8, %rdx
jne 0x337c3
jmp 0x337f5
cmpl $0x0, 0x38(%rax)
jle 0x337f8
xorl %eax, %eax
retq
movb 0x23(%rax), %al
xorb $0x1, %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/GC_and_WL_Unit_Page_Level.cpp
// Function: SSD_Components::GC_and_WL_Unit_Page_Level::GC_is_in_urgent_mode(NVM::FlashMemory::Flash_Chip const*)
bool GC_and_WL_Unit_Page_Level::GC_is_in_urgent_mode(const NVM::FlashMemory::Flash_Chip* chip)
	{
		if (!preemptible_gc_enabled) {
			return true;
		}

		NVM::FlashMemory::Physical_Page_Address addr;
		addr.ChannelID = chip->ChannelID; addr.ChipID = chip->ChipID;
		for (unsigned int die_id = 0; die_id < die_no_per_chip; die_id++) {
			for (unsigned int plane_id = 0; plane_id < plane_no_per_die; plane_id++) {
				addr.DieID = die_id; addr.PlaneID = plane_id;
				if (block_manager->Get_pool_size(addr) < block_pool_gc_hard_threshold)
					return true;
			}
		}

		return false;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movb $0x1, %bpl
cmpb $0x1, 0x6c(%rdi)
jne 0x33cd5
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
andq $0x0, 0x10(%r14)
movq 0x2c(%rsi), %rax
movq %rax, (%r14)
xorl %r15d, %r15d
cmpl 0xfc(%rbx), %r15d
setb %bpl
jae 0x33cd5
xorl %r12d, %r12d
cmpl 0x100(%rbx), %r12d
jae 0x33cd0
movl %r15d, 0x10(%rsp)
movl %r12d, 0x14(%rsp)
movq 0x38(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x48(%rax)
incl %r12d
cmpl 0x78(%rbx), %eax
jae 0x33ca6
jmp 0x33cd5
incl %r15d
jmp 0x33c96
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_Base.cpp
// Function: SSD_Components::Host_Interface_Base::Send_read_message_to_host(unsigned long, unsigned int)
void Host_Interface_Base::Send_read_message_to_host(uint64_t addresss, unsigned int request_read_data_size)
	{
		Host_Components::PCIe_Message* pcie_message = new Host_Components::PCIe_Message;
		pcie_message->Type = Host_Components::PCIe_Message_Type::READ_REQ;
		pcie_message->Destination = Host_Components::PCIe_Destination_Type::HOST;
		pcie_message->Address = addresss;
		pcie_message->Payload = (void*)(intptr_t)request_read_data_size;
		pcie_message->Payload_size = sizeof(request_read_data_size);
		pcie_switch->Send_to_host(pcie_message);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x20
popq %rdi
callq 0x7370
andq $0x0, (%rax)
movq %r14, 0x18(%rax)
movl %ebx, %ecx
movq %rcx, 0x8(%rax)
movl $0x4, 0x10(%rax)
movq 0x80(%r15), %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x1cf2a
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_Base.cpp
// Function: SSD_Components::Host_Interface_Base::Send_write_message_to_host(unsigned long, void*, unsigned int)
void Host_Interface_Base::Send_write_message_to_host(uint64_t addresss, void* message, unsigned int message_size)
	{
		Host_Components::PCIe_Message* pcie_message = new Host_Components::PCIe_Message;
		pcie_message->Type = Host_Components::PCIe_Message_Type::WRITE_REQ;
		pcie_message->Destination = Host_Components::PCIe_Destination_Type::HOST;
		pcie_message->Address = addresss;
		COPYDATA(pcie_message->Payload, message, pcie_message->Payload_size);
		pcie_message->Payload_size = message_size;
		pcie_switch->Send_to_host(pcie_message);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x7370
movq %rax, %r15
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, (%r15)
movq %r13, 0x18(%r15)
callq 0x1f784
movq %rax, %rdi
callq 0x1fb60
testb %al, %al
je 0x3457d
xorl %edi, %edi
callq 0x7030
movq %rax, %r12
movq %r12, 0x8(%r15)
movl %ebx, 0x10(%r15)
movq 0x80(%r14), %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1cf2a
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_NVMe::~Input_Stream_NVMe()
Input_Stream_NVMe::~Input_Stream_NVMe()
{
	for (auto &user_request : Waiting_user_requests)
		delete user_request;
	for (auto &user_request : Completed_user_requests)
		delete user_request;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x2ceb9(%rip), %rax     # 0x616f0
movq %rax, (%rdi)
leaq 0x88(%rdi), %r14
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x34869
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x3485f
movq %r15, %rdi
callq 0x2ab0c
movq %r15, %rdi
callq 0x7340
jmp 0x34844
leaq 0xa0(%rbx), %r15
movq %r15, %r13
movq (%r13), %r13
cmpq %r15, %r13
je 0x34897
movq 0x10(%r13), %r12
testq %r12, %r12
je 0x3488d
movq %r12, %rdi
callq 0x2ab0c
movq %r12, %rdi
callq 0x7340
jmp 0x34873
leaq 0xb8(%rbx), %rdi
callq 0x2ada0
movq %r15, %rdi
callq 0x2ada0
movq %r14, %rdi
callq 0x2ada0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x343d2
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_Manager_NVMe::Create_new_stream(IO_Flow_Priority_Class::Priority, unsigned long, unsigned long, unsigned long, unsigned short, unsigned long, unsigned short)
stream_id_type Input_Stream_Manager_NVMe::Create_new_stream(IO_Flow_Priority_Class::Priority priority_class,
															LHA_type start_logical_sector_address,
															LHA_type end_logical_sector_address,
															uint64_t submission_queue_base_address,
															uint16_t submission_queue_size,
															uint64_t completion_queue_base_address,
															uint16_t completion_queue_size)
{
	if (end_logical_sector_address < start_logical_sector_address)
	{
		PRINT_ERROR("Error in allocating address range to a stream in host interface: the start address should be smaller than the end address.")
	}
	Input_Stream_NVMe *input_stream = new Input_Stream_NVMe(priority_class, start_logical_sector_address, end_logical_sector_address,
															submission_queue_base_address, submission_queue_size, completion_queue_base_address, completion_queue_size);
	this->input_streams.push_back(input_stream);

	return (stream_id_type)(this->input_streams.size() - 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x8(%rsp)
cmpq %rdx, %rcx
jb 0x3497f
movl %r9d, %ebp
movq %rcx, %r12
movq %rdx, %r13
movl %esi, %r15d
movq %rdi, %rbx
movl $0xd8, %edi
callq 0x7370
movq %rax, %r14
movzwl 0x58(%rsp), %eax
movzwl %bp, %r9d
movq %r14, %rdi
movl %r15d, %esi
movq %r13, %rdx
movq %r12, %rcx
movq 0x8(%rsp), %r8
pushq %rax
pushq 0x58(%rsp)
callq 0x35a66
popq %rax
popq %rcx
leaq 0x10(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r14, (%rsi)
callq 0x35eea
movl 0x18(%rbx), %eax
subl 0x10(%rbx), %eax
shrl $0x3, %eax
decl %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d66a(%rip), %rbx     # 0x61ff0
leaq 0xfbfb(%rip), %rsi      # 0x44588
movq %rbx, %rdi
callq 0x7360
leaq 0x13416(%rip), %rsi     # 0x47db2
movq %rbx, %rdi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x2d61d(%rip), %rdi     # 0x61fd0
callq 0x73d0
pushq $0x1
popq %rdi
callq 0x73e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x7340
movq %rbx, %rdi
callq 0x75d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Request_Fetch_Unit_NVMe::Fetch_next_request(unsigned short)
void Request_Fetch_Unit_NVMe::Fetch_next_request(stream_id_type stream_id)
{
	DMA_Req_Item *dma_req_item = new DMA_Req_Item;
	dma_req_item->Type = DMA_Req_Type::REQUEST_INFO;
	dma_req_item->object = (void *)(intptr_t)stream_id;
	dma_list.push_back(dma_req_item);

	Host_Interface_NVMe *hi = (Host_Interface_NVMe *)host_interface;
	Input_Stream_NVMe *im = ((Input_Stream_NVMe *)hi->input_stream_manager->input_streams[stream_id]);
	host_interface->Send_read_message_to_host(im->Submission_queue_base_address + im->Submission_head * sizeof(Submission_Queue_Entry), sizeof(Submission_Queue_Entry));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x7370
movq %rsp, %rsi
andl $0x0, (%rax)
movq %rax, (%rsi)
movl %ebx, %ebx
movq %rbx, 0x8(%rax)
leaq 0x10(%r14), %rdi
callq 0x35ca0
movq 0x8(%r14), %rdi
movq 0x50(%rdi), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %rax
movzwl 0x7a(%rax), %ecx
imulq $0x48, %rcx, %rsi
addq 0x60(%rax), %rsi
pushq $0x48
popq %rdx
callq 0x344f4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Request_Fetch_Unit_NVMe::Fetch_write_data(SSD_Components::User_Request*)
void Request_Fetch_Unit_NVMe::Fetch_write_data(User_Request *request)
{
	DMA_Req_Item *dma_req_item = new DMA_Req_Item;
	dma_req_item->Type = DMA_Req_Type::WRITE_DATA;
	dma_req_item->object = (void *)request;
	dma_list.push_back(dma_req_item);

	Submission_Queue_Entry *sqe = (Submission_Queue_Entry *)request->IO_command_info;
	host_interface->Send_read_message_to_host((sqe->PRP_entry_2 << 31) | sqe->PRP_entry_1, request->Size_in_byte);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x7370
movq %rsp, %rsi
movq %rax, (%rsi)
movl $0x1, (%rax)
movq %rbx, 0x8(%rax)
leaq 0x10(%r14), %rdi
callq 0x35ca0
movq 0x70(%rbx), %rax
movq 0x8(%r14), %rdi
movq 0x28(%rax), %rsi
shlq $0x1f, %rsi
orq 0x20(%rax), %rsi
movl 0x5c(%rbx), %edx
callq 0x344f4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Request_Fetch_Unit_NVMe::Send_completion_queue_element(SSD_Components::User_Request*, unsigned short)
void Request_Fetch_Unit_NVMe::Send_completion_queue_element(User_Request *request, uint16_t sq_head_value)
{
	Host_Interface_NVMe *hi = (Host_Interface_NVMe *)host_interface;
	Completion_Queue_Entry *cqe = new Completion_Queue_Entry;
	cqe->SQ_Head = sq_head_value;
	cqe->SQ_ID = FLOW_ID_TO_Q_ID(request->Stream_id);
	cqe->SF_P = 0x0001 & current_phase;
	cqe->Command_Identifier = ((Submission_Queue_Entry *)request->IO_command_info)->Command_Identifier;
	Input_Stream_NVMe *im = ((Input_Stream_NVMe *)hi->input_stream_manager->input_streams[request->Stream_id]);
	host_interface->Send_write_message_to_host(im->Completion_queue_base_address + im->Completion_tail * sizeof(Completion_Queue_Entry), cqe, sizeof(Completion_Queue_Entry));
	number_of_sent_cqe++;
	if (number_of_sent_cqe % im->Completion_queue_size == 0)
	{
		//According to protocol specification, the value of the Phase Tag is inverted each pass through the Completion Queue
		if (current_phase == 0xffff)
		{
			current_phase = 0xfffe;
		}
		else
		{
			current_phase = 0xffff;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %r14
pushq $0x10
popq %rdi
callq 0x7370
movw %bp, 0x8(%rax)
movzwl 0x68(%r15), %ecx
leal 0x1(%rcx), %edx
movw %dx, 0xa(%rax)
movzwl 0x28(%rbx), %edx
andl $0x1, %edx
movw %dx, 0xe(%rax)
movq 0x70(%r15), %rdx
movzwl 0x2(%rdx), %edx
movw %dx, 0xc(%rax)
movq 0x50(%r14), %rdx
movq 0x10(%rdx), %rdx
movq (%rdx,%rcx,8), %r15
movzwl 0x82(%r15), %esi
shll $0x4, %esi
addq 0x70(%r15), %rsi
pushq $0x10
popq %rcx
movq %r14, %rdi
movq %rax, %rdx
callq 0x34532
movl 0x2c(%rbx), %eax
incl %eax
movl %eax, 0x2c(%rbx)
movzwl 0x78(%r15), %ecx
xorl %edx, %edx
divl %ecx
testl %edx, %edx
jne 0x35096
xorl %eax, %eax
cmpw $-0x1, 0x28(%rbx)
sete %al
notl %eax
movw %ax, 0x28(%rbx)
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/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Host_Interface_NVMe::Validate_simulation_config()
void Host_Interface_NVMe::Validate_simulation_config()
{
	Host_Interface_Base::Validate_simulation_config();
	if (this->input_stream_manager == NULL)
	{
		throw std::logic_error("Input stream manager is not set for Host Interface");
	}
	if (this->request_fetch_unit == NULL)
	{
		throw std::logic_error("Request fetch unit is not set for Host Interface");
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x344f2
cmpq $0x0, 0x50(%rbx)
je 0x351c2
cmpq $0x0, 0x58(%rbx)
je 0x351de
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x12c95(%rip), %rsi     # 0x47e69
movq %rax, %rdi
callq 0x74b0
jmp 0x351f8
pushq $0x10
popq %rdi
callq 0x71b0
movq %rax, %rbx
leaq 0x12cac(%rip), %rsi     # 0x47e9c
movq %rax, %rdi
callq 0x74b0
movq 0x2cdc1(%rip), %rsi     # 0x61fc0
movq 0x2cd6a(%rip), %rdx     # 0x61f70
movq %rbx, %rdi
callq 0x7590
jmp 0x35210
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/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_Manager_NVMe::Handle_new_arrived_request(SSD_Components::User_Request*)
inline void Input_Stream_Manager_NVMe::Handle_new_arrived_request(User_Request *request)
{
	((Input_Stream_NVMe *)input_streams[request->Stream_id])->Submission_head_informed_to_host++;
	if (((Input_Stream_NVMe *)input_streams[request->Stream_id])->Submission_head_informed_to_host == ((Input_Stream_NVMe *)input_streams[request->Stream_id])->Submission_queue_size)
	{ //Circular queue implementation
		((Input_Stream_NVMe *)input_streams[request->Stream_id])->Submission_head_informed_to_host = 0;
	}
	if (request->Type == UserRequestType::READ)
	{
		((Input_Stream_NVMe *)input_streams[request->Stream_id])->Waiting_user_requests.push_back(request);
		((Input_Stream_NVMe *)input_streams[request->Stream_id])->STAT_number_of_read_requests++;
		segment_user_request(request);

		((Host_Interface_NVMe *)host_interface)->broadcast_user_request_arrival_signal(request);
	}
	else
	{ //This is a write request
		((Input_Stream_NVMe *)input_streams[request->Stream_id])->Waiting_user_requests.push_back(request);
		((Input_Stream_NVMe *)input_streams[request->Stream_id])->STAT_number_of_write_requests++;
		((Host_Interface_NVMe *)host_interface)->request_fetch_unit->Fetch_write_data(request);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %rsi, (%r14)
movzwl 0x68(%rsi), %eax
movq 0x10(%rdi), %rcx
movq (%rcx,%rax,8), %rdi
movl 0x7c(%rdi), %eax
incl %eax
xorl %ecx, %ecx
cmpw 0x68(%rdi), %ax
cmovnel %eax, %ecx
movw %cx, 0x7c(%rdi)
movl 0x64(%rsi), %ebp
addq $0x88, %rdi
movq %r14, %rsi
callq 0x2ab34
movq (%r14), %rsi
movzwl 0x68(%rsi), %eax
movq 0x10(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testl %ebp, %ebp
je 0x35b9d
incl 0xc(%rax)
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x35bb7
incl 0x8(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
movq 0x8(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0x35bc0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_Manager_NVMe::Submission_queue_tail_pointer_update(unsigned short, unsigned short)
inline void Input_Stream_Manager_NVMe::Submission_queue_tail_pointer_update(stream_id_type stream_id, uint16_t tail_pointer_value)
{
	((Input_Stream_NVMe *)input_streams[stream_id])->Submission_tail = tail_pointer_value;

	if (((Input_Stream_NVMe *)input_streams[stream_id])->On_the_fly_requests < Queue_fetch_size)
	{
		((Host_Interface_NVMe *)host_interface)->request_fetch_unit->Fetch_next_request(stream_id);
		((Input_Stream_NVMe *)input_streams[stream_id])->On_the_fly_requests++;
		((Input_Stream_NVMe *)input_streams[stream_id])->Submission_head++; //Update submission queue head after starting fetch request
		if (((Input_Stream_NVMe *)input_streams[stream_id])->Submission_head == ((Input_Stream_NVMe *)input_streams[stream_id])->Submission_queue_size)
		{ //Circular queue implementation
			((Input_Stream_NVMe *)input_streams[stream_id])->Submission_head = 0;
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq 0x10(%rdi), %rax
movq (%rax,%r14,8), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rdi)
jbe 0x35c3d
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movzwl %si, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rax
incw 0xd0(%rax)
movzwl 0x7a(%rax), %ecx
incl %ecx
xorl %edx, %edx
cmpw 0x68(%rax), %cx
cmovnel %ecx, %edx
movw %dx, 0x7a(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_Manager_NVMe::Completion_queue_head_pointer_update(unsigned short, unsigned short)
inline void Input_Stream_Manager_NVMe::Completion_queue_head_pointer_update(stream_id_type stream_id, uint16_t head_pointer_value)
{
	((Input_Stream_NVMe *)input_streams[stream_id])->Completion_head = head_pointer_value;

	//If this check is true, then the host interface couldn't send the completion queue entry, since the completion queue was full
	if (((Input_Stream_NVMe *)input_streams[stream_id])->Completed_user_requests.size() > 0)
	{
		User_Request *request = ((Input_Stream_NVMe *)input_streams[stream_id])->Completed_user_requests.front();
		((Input_Stream_NVMe *)input_streams[stream_id])->Completed_user_requests.pop_front();
		inform_host_request_completed(stream_id, request);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rdi
movw %dx, 0x80(%rdi)
cmpq $0x0, 0xb0(%rdi)
je 0x35c93
movl %esi, %ebp
movq 0xa0(%rdi), %rax
addq $0xa0, %rdi
movq 0x10(%rax), %r14
callq 0x35e8e
movzwl %bp, %esi
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x35e96
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Input_Stream_Manager_NVMe::inform_host_request_completed(unsigned short, SSD_Components::User_Request*)
inline void Input_Stream_Manager_NVMe::inform_host_request_completed(stream_id_type stream_id, User_Request *request)
{
	((Request_Fetch_Unit_NVMe *)((Host_Interface_NVMe *)host_interface)->request_fetch_unit)->Send_completion_queue_element(request, ((Input_Stream_NVMe *)input_streams[stream_id])->Submission_head_informed_to_host);
	((Input_Stream_NVMe *)input_streams[stream_id])->Completion_tail++; //Next free slot in the completion queue
	//Circular queue implementation
	if (((Input_Stream_NVMe *)input_streams[stream_id])->Completion_tail == ((Input_Stream_NVMe *)input_streams[stream_id])->Completion_queue_size)
	{
		((Input_Stream_NVMe *)input_streams[stream_id])->Completion_tail = 0;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
movq 0x58(%rax), %rdi
shll $0x3, %ebx
movq (%rcx,%rbx), %rax
movzwl 0x7c(%rax), %eax
movq %rdx, %rsi
movl %eax, %edx
callq 0x35006
movq 0x10(%r14), %rax
movq (%rax,%rbx), %rax
movzwl 0x82(%rax), %ecx
incl %ecx
xorl %edx, %edx
cmpw 0x78(%rax), %cx
cmovnel %ecx, %edx
movw %dx, 0x82(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_SATA.cpp
// Function: SSD_Components::Input_Stream_SATA::~Input_Stream_SATA()
Input_Stream_SATA::~Input_Stream_SATA()
	{
		for (auto &user_request : Waiting_user_requests) {
			delete user_request;
		}
		for (auto &user_request : Completed_user_requests) {
			delete user_request;
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x2b729(%rip), %rax     # 0x61858
movq %rax, (%rdi)
leaq 0x78(%rdi), %r14
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x3615e
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x36154
movq %r15, %rdi
callq 0x2ab0c
movq %r15, %rdi
callq 0x7340
jmp 0x36139
leaq 0x90(%rbx), %r15
movq %r15, %r13
movq (%r13), %r13
cmpq %r15, %r13
je 0x3618c
movq 0x10(%r13), %r12
testq %r12, %r12
je 0x36182
movq %r12, %rdi
callq 0x2ab0c
movq %r12, %rdi
callq 0x7340
jmp 0x36168
leaq 0xa8(%rbx), %rdi
callq 0x2ada0
movq %r15, %rdi
callq 0x2ada0
movq %r14, %rdi
callq 0x2ada0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x343d2
nop