// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Base.cpp
// Function: SSD_Components::Address_Mapping_Unit_Base::Address_Mapping_Unit_Base(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, SSD_Components::FTL*, SSD_Components::NVM_PHY_ONFI*, SSD_Components::Flash_Block_Manager_Base*, bool, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, double, SSD_Components::CMT_Sharing_Mode, bool)
Address_Mapping_Unit_Base::Address_Mapping_Unit_Base(const sim_object_id_type& id, FTL* ftl, NVM_PHY_ONFI* flash_controller, Flash_Block_Manager_Base* block_manager,
		bool ideal_mapping_table, unsigned int no_of_input_streams,
		unsigned int ChannelCount, unsigned int chip_no_per_channel, unsigned int DieNoPerChip, unsigned int PlaneNoPerDie,
		unsigned int Block_no_per_plane, unsigned int Page_no_per_block, unsigned int SectorsPerPage, unsigned int PageSizeInBytes,
		double Overprovisioning_ratio, CMT_Sharing_Mode sharing_mode, bool fold_large_addresses)
		: Sim_Object(id), ftl(ftl), flash_controller(flash_controller), block_manager(block_manager),
		ideal_mapping_table(ideal_mapping_table), no_of_input_streams(no_of_input_streams),
		channel_count(ChannelCount), chip_no_per_channel(chip_no_per_channel), die_no_per_chip(DieNoPerChip), plane_no_per_die(PlaneNoPerDie),
		block_no_per_plane(Block_no_per_plane), pages_no_per_block(Page_no_per_block), sector_no_per_page(SectorsPerPage), page_size_in_byte(PageSizeInBytes), 
		overprovisioning_ratio(Overprovisioning_ratio), sharing_mode(sharing_mode), fold_large_addresses(fold_large_addresses),
		mapping_table_stored_on_flash(false)
	{
		page_no_per_plane = pages_no_per_block * block_no_per_plane;
		page_no_per_die = page_no_per_plane * plane_no_per_die;
		page_no_per_chip = page_no_per_die * die_no_per_chip;
		page_no_per_channel = page_no_per_chip * chip_no_per_channel;
		total_physical_pages_no = page_no_per_channel * ChannelCount;
		total_logical_pages_no = (unsigned int)((double)total_physical_pages_no * (1 - overprovisioning_ratio));
		max_logical_sector_address = (LHA_type)(SectorsPerPage * total_logical_pages_no - 1);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movl %r9d, %ebp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
movl 0x70(%rsp), %r13d
callq 0x165ce
leaq 0x44bd4(%rip), %rax     # 0x6de90
movq %rax, (%rbx)
movq %r12, 0x30(%rbx)
movq %r15, 0x38(%rbx)
movq %r14, 0x40(%rbx)
movl 0x88(%rsp), %eax
movl %eax, 0x48(%rbx)
movb %bpl, 0x4c(%rbx)
movl 0x40(%rsp), %eax
movl %eax, 0x50(%rbx)
xorl %eax, %eax
movl %eax, 0x60(%rbx)
movl 0x48(%rsp), %edx
movl %edx, 0x64(%rbx)
movl 0x50(%rsp), %esi
movl %esi, 0x68(%rbx)
movl 0x58(%rsp), %edi
movl %edi, 0x6c(%rbx)
movl 0x60(%rsp), %r8d
movl %r8d, 0x70(%rbx)
movl 0x68(%rsp), %r9d
movl %r9d, 0x74(%rbx)
movl %r13d, 0x78(%rbx)
movl 0x78(%rsp), %ecx
movl %ecx, 0x7c(%rbx)
movl 0x80(%rsp), %r10d
movl %r10d, 0x80(%rbx)
movl %eax, 0x94(%rbx)
imull %r9d, %r13d
xorps %xmm0, %xmm0
movups %xmm0, 0x84(%rbx)
movsd (%rsp), %xmm2
movsd %xmm2, 0x98(%rbx)
movb 0x90(%rsp), %al
movb %al, 0xa0(%rbx)
movb $0x0, 0xa1(%rbx)
movl %r13d, 0x94(%rbx)
imull %r8d, %r13d
movl %r13d, 0x90(%rbx)
imull %edi, %r13d
movl %r13d, 0x8c(%rbx)
imull %esi, %r13d
movl %r13d, 0x88(%rbx)
imull %edx, %r13d
movl %r13d, 0x84(%rbx)
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
movsd 0x2e872(%rip), %xmm1    # 0x57c10
subsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movl %eax, 0x60(%rbx)
imull %ecx, %eax
decl %eax
movq %rax, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq