// File: CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Address_Mapping_Unit_Page_Level::Address_Mapping_Unit_Page_Level(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, SSD_Components::Flash_Plane_Allocation_Scheme_Type, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>>, std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>>, std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>>, std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>>, unsigned int, unsigned int, unsigned int, unsigned int, double, SSD_Components::CMT_Sharing_Mode, bool)
Address_Mapping_Unit_Page_Level::Address_Mapping_Unit_Page_Level(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 cmt_capacity_in_byte, Flash_Plane_Allocation_Scheme_Type PlaneAllocationScheme,
		unsigned int concurrent_stream_no,
		unsigned int channel_count, unsigned int chip_no_per_channel, unsigned int die_no_per_chip, unsigned int plane_no_per_die,
		std::vector<std::vector<flash_channel_ID_type>> stream_channel_ids, std::vector<std::vector<flash_chip_ID_type>> stream_chip_ids,
		std::vector<std::vector<flash_die_ID_type>> stream_die_ids, std::vector<std::vector<flash_plane_ID_type>> stream_plane_ids,
		unsigned int Block_no_per_plane, unsigned int Page_no_per_block, unsigned int SectorsPerPage, unsigned int PageSizeInByte,
		double Overprovisioning_ratio, CMT_Sharing_Mode sharing_mode, bool fold_large_addresses)
		: Address_Mapping_Unit_Base(id, ftl, flash_controller, block_manager, ideal_mapping_table,
			concurrent_stream_no, channel_count, chip_no_per_channel, die_no_per_chip, plane_no_per_die,
			Block_no_per_plane, Page_no_per_block, SectorsPerPage, PageSizeInByte, Overprovisioning_ratio, sharing_mode, fold_large_addresses)
	{
		_my_instance = this;
		domains = new AddressMappingDomain*[no_of_input_streams];

		Write_transactions_for_overfull_planes = new std::set<NVM_Transaction_Flash_WR*>***[channel_count];
		for (unsigned int channel_id = 0; channel_id < channel_count; channel_id++) {
			Write_transactions_for_overfull_planes[channel_id] = new std::set<NVM_Transaction_Flash_WR*>**[chip_no_per_channel];
			for (unsigned int chip_id = 0; chip_id < chip_no_per_channel; chip_id++) {
				Write_transactions_for_overfull_planes[channel_id][chip_id] = new std::set<NVM_Transaction_Flash_WR*>*[die_no_per_chip];
				for (unsigned int die_id = 0; die_id < die_no_per_chip; die_id++) {
					Write_transactions_for_overfull_planes[channel_id][chip_id][die_id] = new std::set<NVM_Transaction_Flash_WR*>[plane_no_per_die];
				}
			}
		}

		flash_channel_ID_type* channel_ids = NULL;
		flash_channel_ID_type* chip_ids = NULL;
		flash_channel_ID_type* die_ids = NULL;
		flash_channel_ID_type* plane_ids = NULL;
		for (unsigned int domainID = 0; domainID < no_of_input_streams; domainID++) {
			/* Since we want to have the same mapping table entry size for all streams, the entry size
			*  is calculated at this level and then pass it to the constructors of mapping domains
			* entry size = sizeOf(lpa) + sizeOf(ppn) + sizeOf(bit vector that shows written sectors of a page)
			*/
			CMT_entry_size = (unsigned int)std::ceil(((2 * std::log2(total_physical_pages_no)) + sector_no_per_page) / 8);
			//In GTD we do not need to store lpa
			GTD_entry_size = (unsigned int)std::ceil((std::log2(total_physical_pages_no) + sector_no_per_page) / 8);
			no_of_translation_entries_per_page = (SectorsPerPage * SECTOR_SIZE_IN_BYTE) / GTD_entry_size;

			Cached_Mapping_Table* sharedCMT = NULL;
			unsigned int per_stream_cmt_capacity = 0;
			cmt_capacity = cmt_capacity_in_byte / CMT_entry_size;
			switch (sharing_mode) {
				case CMT_Sharing_Mode::SHARED:
					per_stream_cmt_capacity = cmt_capacity;
					sharedCMT = new Cached_Mapping_Table(cmt_capacity);
					break;
				case CMT_Sharing_Mode::EQUAL_SIZE_PARTITIONING:
					per_stream_cmt_capacity = cmt_capacity / no_of_input_streams;
					break;
			}


			channel_ids = new flash_channel_ID_type[stream_channel_ids[domainID].size()];
			for (unsigned int i = 0; i < stream_channel_ids[domainID].size(); i++) {
				if (stream_channel_ids[domainID][i] < channel_count) {
					channel_ids[i] = stream_channel_ids[domainID][i];
				} else {
					PRINT_ERROR("Invalid channel ID specified for I/O flow " << domainID);
				}
			}

			chip_ids = new flash_channel_ID_type[stream_chip_ids[domainID].size()];
			for (unsigned int i = 0; i < stream_chip_ids[domainID].size(); i++) {
				if (stream_chip_ids[domainID][i] < chip_no_per_channel) {
					chip_ids[i] = stream_chip_ids[domainID][i];
				} else {
					PRINT_ERROR("Invalid chip ID specified for I/O flow " << domainID);
				}
			}

			die_ids = new flash_channel_ID_type[stream_die_ids[domainID].size()];
			for (unsigned int i = 0; i < stream_die_ids[domainID].size(); i++) {
				if (stream_die_ids[domainID][i] < die_no_per_chip) {
					die_ids[i] = stream_die_ids[domainID][i];
				} else {
					PRINT_ERROR("Invalid die ID specified for I/O flow " << domainID);
				}
			}

			plane_ids = new flash_channel_ID_type[stream_plane_ids[domainID].size()];
			for (unsigned int i = 0; i < stream_plane_ids[domainID].size(); i++) {
				if (stream_plane_ids[domainID][i] < plane_no_per_die) {
					plane_ids[i] = stream_plane_ids[domainID][i];
				} else {
					PRINT_ERROR("Invalid plane ID specified for I/O flow " << domainID);
				}
			}

			domains[domainID] = new AddressMappingDomain(per_stream_cmt_capacity, CMT_entry_size, no_of_translation_entries_per_page,
				sharedCMT,
				PlaneAllocationScheme,
				channel_ids, (unsigned int)(stream_channel_ids[domainID].size()), chip_ids, (unsigned int)(stream_chip_ids[domainID].size()), die_ids, 
				(unsigned int)(stream_die_ids[domainID].size()), plane_ids, (unsigned int)(stream_plane_ids[domainID].size()),
				Utils::Logical_Address_Partitioning_Unit::PDA_count_allocate_to_flow(domainID), Utils::Logical_Address_Partitioning_Unit::LHA_count_allocate_to_flow_from_device_view(domainID),
				sector_no_per_page);
			delete[] channel_ids;
			delete[] chip_ids;
			delete[] die_ids;
			delete[] plane_ids;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movl %r9d, %eax
movq %rcx, 0x1e8(%rsp)
movq %rdx, %rcx
movq 0x1e8(%rsp), %rdx
movq %rcx, 0x1f0(%rsp)
movq %rsi, %rcx
movq 0x1f0(%rsp), %rsi
movq %rcx, 0x1f8(%rsp)
movq %rdi, %r9
movq 0x1f8(%rsp), %rdi
movb %al, %cl
movb 0x3a0(%rsp), %al
movl 0x398(%rsp), %r10d
movl 0x390(%rsp), %r10d
movl 0x388(%rsp), %r10d
movl 0x380(%rsp), %r10d
movl 0x378(%rsp), %r10d
movq 0x370(%rsp), %r10
movq %r10, 0x200(%rsp)
movq 0x368(%rsp), %r10
movq %r10, 0x208(%rsp)
movq 0x360(%rsp), %r10
movq %r10, 0x210(%rsp)
movq 0x358(%rsp), %r10
movq %r10, 0x218(%rsp)
movl 0x350(%rsp), %r10d
movl 0x348(%rsp), %r10d
movl 0x340(%rsp), %r10d
movl 0x338(%rsp), %r10d
movl 0x330(%rsp), %r10d
movl 0x328(%rsp), %r10d
movl 0x320(%rsp), %r10d
movq %r9, 0x2e0(%rsp)
movq %rdi, 0x2d8(%rsp)
movq %rsi, 0x2d0(%rsp)
movq %rdx, 0x2c8(%rsp)
movq %r8, 0x2c0(%rsp)
andb $0x1, %cl
movb %cl, 0x2bf(%rsp)
movsd %xmm0, 0x2b0(%rsp)
andb $0x1, %al
movb %al, 0x2af(%rsp)
movq 0x2e0(%rsp), %rax
movq %rax, 0x238(%rsp)
movq 0x2d8(%rsp), %rsi
movq 0x2d0(%rsp), %rdx
movq 0x2c8(%rsp), %rax
movq %rax, 0x230(%rsp)
movq 0x2c0(%rsp), %r8
movl 0x330(%rsp), %r10d
movl 0x338(%rsp), %r11d
movl 0x340(%rsp), %ebx
movl 0x348(%rsp), %ebp
movl 0x350(%rsp), %r14d
movl 0x378(%rsp), %r15d
movl 0x380(%rsp), %r12d
movl 0x388(%rsp), %r13d
movl 0x390(%rsp), %edi
movsd 0x2b0(%rsp), %xmm0
movl 0x398(%rsp), %eax
movl %eax, 0x22c(%rsp)
movzbl 0x2bf(%rsp), %r9d
movzbl 0x2af(%rsp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movq %rax, 0x220(%rsp)
movl %ecx, 0x50(%rax)
movl 0x22c(%rsp), %ecx
movl %ecx, 0x48(%rax)
movq 0x230(%rsp), %rcx
movl %edi, 0x40(%rax)
movq 0x238(%rsp), %rdi
movl %r13d, 0x38(%rax)
movl %r12d, 0x30(%rax)
movl %r15d, 0x28(%rax)
movl %r14d, 0x20(%rax)
movl %ebp, 0x18(%rax)
movl %ebx, 0x10(%rax)
movl %r11d, 0x8(%rax)
movl %r10d, (%rax)
andl $0x1, %r9d
callq 0x49ac0
movq 0x238(%rsp), %rax
leaq 0x8d5fe(%rip), %rcx     # 0xd90d0
movq %rcx, (%rax)
movq %rax, 0x8ebec(%rip)     # 0xda6c8
movl 0x50(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x8030
movq %rax, 0x240(%rsp)
jmp 0x4baf4
movq 0x238(%rsp), %rax
movq 0x240(%rsp), %rcx
movq %rcx, 0xa8(%rax)
movl 0x338(%rsp), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x8030
movq %rax, 0x1e0(%rsp)
jmp 0x4bb27
movq 0x238(%rsp), %rax
movq 0x1e0(%rsp), %rcx
movq %rcx, 0xb8(%rax)
movl $0x0, 0x298(%rsp)
movl 0x298(%rsp), %eax
cmpl 0x338(%rsp), %eax
jae 0x4bd65
movl 0x340(%rsp), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x8030
movq %rax, 0x1d8(%rsp)
jmp 0x4bb79
movq 0x1d8(%rsp), %rdx
movq 0x238(%rsp), %rax
movq 0xb8(%rax), %rax
movl 0x298(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0x294(%rsp)
movl 0x294(%rsp), %eax
cmpl 0x340(%rsp), %eax
jae 0x4bd4d
movl 0x348(%rsp), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x8030
movq %rax, 0x1d0(%rsp)
jmp 0x4bbd6
movq 0x1d0(%rsp), %rdx
movq 0x238(%rsp), %rax
movq 0xb8(%rax), %rax
movl 0x298(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x294(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0x290(%rsp)
movl 0x290(%rsp), %eax
cmpl 0x348(%rsp), %eax
jae 0x4bd35
movl 0x350(%rsp), %eax
movq %rax, 0x1c0(%rsp)
shlq $0x4, %rax
leaq 0x8(%rax,%rax,2), %rdi
callq 0x8030
movq %rax, 0x1c8(%rsp)
jmp 0x4bc49
movq 0x1c0(%rsp), %rax
movq 0x1c8(%rsp), %rcx
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x1b8(%rsp)
cmpq $0x0, %rax
je 0x4bcce
movq 0x1b8(%rsp), %rax
movq 0x1c0(%rsp), %rcx
imulq $0x30, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x1a8(%rsp)
movq %rax, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rdi
movq %rdi, 0x1a0(%rsp)
callq 0x58f30
movq 0x1a0(%rsp), %rax
movq 0x1a8(%rsp), %rcx
addq $0x30, %rax
cmpq %rcx, %rax
movq %rax, 0x1b0(%rsp)
jne 0x4bc98
movq 0x1b8(%rsp), %rdx
movq 0x238(%rsp), %rax
movq 0xb8(%rax), %rax
movl 0x298(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x294(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x290(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movl 0x290(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x290(%rsp)
jmp 0x4bc0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a0(%rsp)
movl %eax, 0x29c(%rsp)
jmp 0x4c92a
jmp 0x4bd37
movl 0x294(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x294(%rsp)
jmp 0x4bba6
jmp 0x4bd4f
movl 0x298(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x298(%rsp)
jmp 0x4bb49
movq $0x0, 0x288(%rsp)
movq $0x0, 0x280(%rsp)
movq $0x0, 0x278(%rsp)
movq $0x0, 0x270(%rsp)
movl $0x0, 0x26c(%rsp)
movq 0x238(%rsp), %rcx
movl 0x26c(%rsp), %eax
cmpl 0x50(%rcx), %eax
jae 0x4c918
movq 0x238(%rsp), %rax
movl 0x84(%rax), %edi
callq 0x58f40
movsd %xmm0, 0x198(%rsp)
jmp 0x4bdd6
movq 0x238(%rsp), %rax
movsd 0x198(%rsp), %xmm0
movl 0x7c(%rax), %eax
cvtsi2sd %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x60639(%rip), %xmm1    # 0xac438
mulsd %xmm1, %xmm0
callq 0x8090
movq 0x238(%rsp), %rax
cvttsd2si %xmm0, %rcx
movl %ecx, 0xb0(%rax)
movl 0x84(%rax), %edi
callq 0x58f40
movsd %xmm0, 0x190(%rsp)
jmp 0x4be31
movq 0x238(%rsp), %rax
movsd 0x190(%rsp), %xmm0
movl 0x7c(%rax), %eax
cvtsi2sd %rax, %xmm1
addsd %xmm1, %xmm0
movsd 0x605e2(%rip), %xmm1    # 0xac438
mulsd %xmm1, %xmm0
callq 0x8090
movq 0x238(%rsp), %rcx
cvttsd2si %xmm0, %rax
movl %eax, 0xb4(%rcx)
movl 0x388(%rsp), %eax
shll $0x9, %eax
movl 0xb4(%rcx), %esi
xorl %edx, %edx
movl %edx, 0x188(%rsp)
divl %esi
movl 0x188(%rsp), %edx
movl %eax, 0xc0(%rcx)
movq $0x0, 0x260(%rsp)
movl $0x0, 0x25c(%rsp)
movl 0x320(%rsp), %eax
movl 0xb0(%rcx), %ecx
divl %ecx
movl %eax, %ecx
movq 0x238(%rsp), %rax
movl %ecx, 0xa4(%rax)
movl 0x398(%rsp), %eax
movl %eax, 0x18c(%rsp)
testl %eax, %eax
je 0x4bef9
jmp 0x4bee4
movl 0x18c(%rsp), %eax
subl $0x1, %eax
je 0x4bf77
jmp 0x4bf91
movq 0x238(%rsp), %rax
movl 0xa4(%rax), %eax
movl %eax, 0x25c(%rsp)
movl $0x58, %edi
callq 0x8450
movq %rax, 0x180(%rsp)
jmp 0x4bf22
movq 0x180(%rsp), %rdi
movq 0x238(%rsp), %rax
movl 0xa4(%rax), %esi
callq 0x4a2b0
jmp 0x4bf3f
movq 0x180(%rsp), %rax
movq %rax, 0x260(%rsp)
jmp 0x4bf91
movq 0x180(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a0(%rsp)
movl %eax, 0x29c(%rsp)
callq 0x8410
jmp 0x4c92a
movq 0x238(%rsp), %rcx
movl 0xa4(%rcx), %eax
xorl %edx, %edx
divl 0x50(%rcx)
movl %eax, 0x25c(%rsp)
movq 0x218(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x8030
movq %rax, 0x178(%rsp)
jmp 0x4bfd4
movq 0x178(%rsp), %rax
movq %rax, 0x288(%rsp)
movl $0x0, 0x258(%rsp)
movq 0x218(%rsp), %rdi
movl 0x258(%rsp), %eax
movq %rax, 0x170(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq %rax, %rcx
movq 0x170(%rsp), %rax
cmpq %rcx, %rax
jae 0x4c135
movq 0x218(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x258(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %eax
cmpl 0x338(%rsp), %eax
jae 0x4c09f
movq 0x218(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x258(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %edx
movq 0x288(%rsp), %rax
movl 0x258(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x4c11d
movq 0x8df4a(%rip), %rdi     # 0xd9ff0
leaq 0x5e83b(%rip), %rsi     # 0xaa8e8
callq 0x8440
jmp 0x4c0b4
movq 0x8df35(%rip), %rdi     # 0xd9ff0
leaq 0x60799(%rip), %rsi     # 0xac85b
callq 0x8440
movq %rax, 0x168(%rsp)
jmp 0x4c0d1
movq 0x168(%rsp), %rdi
movl 0x26c(%rsp), %esi
callq 0x85b0
movq %rax, 0x160(%rsp)
jmp 0x4c0ef
movq 0x160(%rsp), %rdi
movq 0x8de5a(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x4c105
movq 0x8dec4(%rip), %rdi     # 0xd9fd0
callq 0x84f0
jmp 0x4c113
movl $0x1, %edi
callq 0x8500
jmp 0x4c11f
movl 0x258(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x258(%rsp)
jmp 0x4bfef
movq 0x210(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x8030
movq %rax, 0x158(%rsp)
jmp 0x4c178
movq 0x158(%rsp), %rax
movq %rax, 0x280(%rsp)
movl $0x0, 0x254(%rsp)
movq 0x210(%rsp), %rdi
movl 0x254(%rsp), %eax
movq %rax, 0x150(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq %rax, %rcx
movq 0x150(%rsp), %rax
cmpq %rcx, %rax
jae 0x4c2d9
movq 0x210(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x254(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %eax
cmpl 0x340(%rsp), %eax
jae 0x4c243
movq 0x210(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x254(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %edx
movq 0x280(%rsp), %rax
movl 0x254(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x4c2c1
movq 0x8dda6(%rip), %rdi     # 0xd9ff0
leaq 0x5e697(%rip), %rsi     # 0xaa8e8
callq 0x8440
jmp 0x4c258
movq 0x8dd91(%rip), %rdi     # 0xd9ff0
leaq 0x60620(%rip), %rsi     # 0xac886
callq 0x8440
movq %rax, 0x148(%rsp)
jmp 0x4c275
movq 0x148(%rsp), %rdi
movl 0x26c(%rsp), %esi
callq 0x85b0
movq %rax, 0x140(%rsp)
jmp 0x4c293
movq 0x140(%rsp), %rdi
movq 0x8dcb6(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x4c2a9
movq 0x8dd20(%rip), %rdi     # 0xd9fd0
callq 0x84f0
jmp 0x4c2b7
movl $0x1, %edi
callq 0x8500
jmp 0x4c2c3
movl 0x254(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x254(%rsp)
jmp 0x4c193
movq 0x208(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x8030
movq %rax, 0x138(%rsp)
jmp 0x4c31c
movq 0x138(%rsp), %rax
movq %rax, 0x278(%rsp)
movl $0x0, 0x250(%rsp)
movq 0x208(%rsp), %rdi
movl 0x250(%rsp), %eax
movq %rax, 0x130(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq %rax, %rcx
movq 0x130(%rsp), %rax
cmpq %rcx, %rax
jae 0x4c47d
movq 0x208(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x250(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %eax
cmpl 0x348(%rsp), %eax
jae 0x4c3e7
movq 0x208(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x250(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %edx
movq 0x278(%rsp), %rax
movl 0x250(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x4c465
movq 0x8dc02(%rip), %rdi     # 0xd9ff0
leaq 0x5e4f3(%rip), %rsi     # 0xaa8e8
callq 0x8440
jmp 0x4c3fc
movq 0x8dbed(%rip), %rdi     # 0xd9ff0
leaq 0x604a4(%rip), %rsi     # 0xac8ae
callq 0x8440
movq %rax, 0x128(%rsp)
jmp 0x4c419
movq 0x128(%rsp), %rdi
movl 0x26c(%rsp), %esi
callq 0x85b0
movq %rax, 0x120(%rsp)
jmp 0x4c437
movq 0x120(%rsp), %rdi
movq 0x8db12(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x4c44d
movq 0x8db7c(%rip), %rdi     # 0xd9fd0
callq 0x84f0
jmp 0x4c45b
movl $0x1, %edi
callq 0x8500
jmp 0x4c467
movl 0x250(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x250(%rsp)
jmp 0x4c337
movq 0x200(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x8030
movq %rax, 0x118(%rsp)
jmp 0x4c4c0
movq 0x118(%rsp), %rax
movq %rax, 0x270(%rsp)
movl $0x0, 0x24c(%rsp)
movq 0x200(%rsp), %rdi
movl 0x24c(%rsp), %eax
movq %rax, 0x110(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq %rax, %rcx
movq 0x110(%rsp), %rax
cmpq %rcx, %rax
jae 0x4c621
movq 0x200(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x24c(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %eax
cmpl 0x350(%rsp), %eax
jae 0x4c58b
movq 0x200(%rsp), %rdi
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
movl 0x24c(%rsp), %eax
movl %eax, %esi
callq 0x3b3e0
movl (%rax), %edx
movq 0x270(%rsp), %rax
movl 0x24c(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x4c609
movq 0x8da5e(%rip), %rdi     # 0xd9ff0
leaq 0x5e34f(%rip), %rsi     # 0xaa8e8
callq 0x8440
jmp 0x4c5a0
movq 0x8da49(%rip), %rdi     # 0xd9ff0
leaq 0x60327(%rip), %rsi     # 0xac8d5
callq 0x8440
movq %rax, 0x108(%rsp)
jmp 0x4c5bd
movq 0x108(%rsp), %rdi
movl 0x26c(%rsp), %esi
callq 0x85b0
movq %rax, 0x100(%rsp)
jmp 0x4c5db
movq 0x100(%rsp), %rdi
movq 0x8d96e(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x4c5f1
movq 0x8d9d8(%rip), %rdi     # 0xd9fd0
callq 0x84f0
jmp 0x4c5ff
movl $0x1, %edi
callq 0x8500
jmp 0x4c60b
movl 0x24c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24c(%rsp)
jmp 0x4c4db
movl $0x270, %edi            # imm = 0x270
callq 0x8450
movq %rax, 0xf8(%rsp)
jmp 0x4c635
movq 0x218(%rsp), %rdi
movq 0x238(%rsp), %rax
movl 0x25c(%rsp), %ecx
movl %ecx, 0x94(%rsp)
movl 0xb0(%rax), %ecx
movl %ecx, 0x98(%rsp)
movl 0xc0(%rax), %eax
movl %eax, 0x9c(%rsp)
movq 0x260(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl 0x328(%rsp), %eax
movl %eax, 0xac(%rsp)
movq 0x288(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq 0x210(%rsp), %rdi
movl %eax, 0xbc(%rsp)
movq 0x280(%rsp), %rax
movq %rax, 0xc0(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq 0x208(%rsp), %rdi
movl %eax, 0xcc(%rsp)
movq 0x278(%rsp), %rax
movq %rax, 0xd0(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movq 0x200(%rsp), %rdi
movl %eax, 0xdc(%rsp)
movq 0x270(%rsp), %rax
movq %rax, 0xe0(%rsp)
movl 0x26c(%rsp), %eax
movl %eax, %esi
callq 0x2d040
movq %rax, %rdi
callq 0x2e770
movl %eax, 0xec(%rsp)
movzwl 0x26c(%rsp), %edi
callq 0xa6c10
movq %rax, 0xf0(%rsp)
jmp 0x4c76e
movzwl 0x26c(%rsp), %edi
callq 0xa6b30
movq %rax, 0x88(%rsp)
jmp 0x4c785
movl 0xac(%rsp), %r9d
movq 0xa0(%rsp), %r8
movl 0x98(%rsp), %edx
movl 0x94(%rsp), %esi
movq 0xf8(%rsp), %rdi
movq 0xb0(%rsp), %r10
movl 0xbc(%rsp), %r11d
movq 0xc0(%rsp), %rbx
movl 0xcc(%rsp), %ebp
movq 0xd0(%rsp), %r14
movl 0xdc(%rsp), %r15d
movq 0xe0(%rsp), %r12
movl 0xec(%rsp), %r13d
movq 0x238(%rsp), %rax
movl 0x7c(%rax), %ecx
movq %rsp, %rax
movq %rax, 0x80(%rsp)
movl %ecx, 0x50(%rax)
movq 0x88(%rsp), %rcx
movq %rcx, 0x48(%rax)
movq 0xf0(%rsp), %rcx
movq %rcx, 0x40(%rax)
movl 0x9c(%rsp), %ecx
movl %r13d, 0x38(%rax)
movq %r12, 0x30(%rax)
movl %r15d, 0x28(%rax)
movq %r14, 0x20(%rax)
movl %ebp, 0x18(%rax)
movq %rbx, 0x10(%rax)
movl %r11d, 0x8(%rax)
movq %r10, (%rax)
callq 0x4ae50
jmp 0x4c847
movq 0xf8(%rsp), %rdx
movq 0x238(%rsp), %rax
movq 0xa8(%rax), %rax
movl 0x26c(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x288(%rsp), %rax
movq %rax, 0x78(%rsp)
cmpq $0x0, %rax
je 0x4c886
movq 0x78(%rsp), %rdi
callq 0x8570
movq 0x280(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x4c8a3
movq 0x70(%rsp), %rdi
callq 0x8570
movq 0x278(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, %rax
je 0x4c8c0
movq 0x68(%rsp), %rdi
callq 0x8570
movq 0x270(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x4c8dd
movq 0x60(%rsp), %rdi
callq 0x8570
jmp 0x4c8df
movl 0x26c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x26c(%rsp)
jmp 0x4bda0
movq 0xf8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a0(%rsp)
movl %eax, 0x29c(%rsp)
callq 0x8410
jmp 0x4c92a
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x238(%rsp), %rdi
callq 0x49d20
movq 0x2a0(%rsp), %rdi
callq 0x8770
nopw %cs:(%rax,%rax)