// File: /workspace/github_cpp_makefile_star2_O2/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_DMAC_prefetch_management(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_DMAC_prefetch_management(string dmacPrefetchManageFileName)
{
	uint8_t operand_number;	uint16_t SPM_pass_number;
	uint32_t offset_base_addr_SPM,	burst_width_bytes, offset_base_addr_DRAM;
	uint16_t it=0;
	ifstream inFile(dmacPrefetchManageFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << dmacPrefetchManageFileName.c_str() << endl;
		exit (EXIT_FAILURE);
	}

	string line;
 	while (getline(inFile, line)) {
		// skip reading first two lines of the file
		if(it < 2) {
			it++; continue;
		}
		istringstream tokenStream(line);
		string token1, token2, token3, token4, token5;
		tokenStream >> token1 >> token2 >> token3 >> token4 >> token5;
		SPM_pass_number = stoul(token1);
		operand_number = stoul(token2);
		offset_base_addr_SPM = stoul(token3);
		burst_width_bytes = stoul(token4);
		offset_base_addr_DRAM = stoul(token5);

		assert((operand_number >= 0 && operand_number < total_operands) && "invalid operand number!");
		assert((SPM_pass_number >= 0 && SPM_pass_number < SPM_passes) && "invalid number for an SPM pass!");
		assert(offset_base_addr_SPM >= 0 && offset_base_addr_SPM < SPM_size &&
			"invalid SPM address specified for setting offset for an operand for an SPM pass!");
		assert(burst_width_bytes > 0 && burst_width_bytes < SPM_size &&
			"invalid burst width specified for managing data in SPM!");
		assert(offset_base_addr_DRAM >= 0 && offset_base_addr_DRAM < SPM_size &&
			"invalid offset specified for accessing operand from DRAM in SPM pass!");

		read_operand_SPM_pass[SPM_pass_number][operand_number] = true;
		read_operand_offset_base_addr_SPM[SPM_pass_number][operand_number].push_back(offset_base_addr_SPM);
		read_operand_burst_width_bytes_SPM_pass[SPM_pass_number][operand_number].push_back(burst_width_bytes);
		read_operand_offset_base_addr_DRAM[SPM_pass_number][operand_number].push_back(offset_base_addr_DRAM);
		it++;
	}

	inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0xd0(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x45cbc0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xf0(%rsp,%rax)
jne 0x4069a5
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xd0(%rsp), %rbx
pushq $0xa
popq %r12
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x493470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4068d1
cmpw $0x1, %r14w
jbe 0x4068c9
leaq 0x2d8(%rsp), %r15
movq %r15, %rdi
leaq 0xb0(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x488420
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
andq $0x0, 0x98(%rsp)
xorl %ecx, %ecx
movb %cl, 0xa0(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
andq $0x0, 0x78(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb %cl, 0x80(%rsp)
movb %cl, 0x60(%rsp)
movb %cl, 0x40(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movb %cl, 0x20(%rsp)
movq %r15, %rdi
leaq 0x90(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x70(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x415af0
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x40a485
movq %rax, %r13
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x40a485
movq %rax, %rbp
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x40a485
movl %eax, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x40a485
movl %eax, 0x4(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x40a485
movl %eax, 0xc(%rsp)
movzbl %bpl, %ecx
movzbl 0x201d81(%rip), %edx    # 0x608556
cmpl %edx, %ecx
jae 0x406986
movzwl %r13w, %ecx
movzwl 0x201d6c(%rip), %edx    # 0x608554
cmpl %edx, %ecx
jae 0x406929
movl 0x201dbe(%rip), %ecx    # 0x6085b4
cmpl %ecx, 0x8(%rsp)
jae 0x406948
movl 0x4(%rsp), %edx
testl %edx, %edx
je 0x406967
cmpl %ecx, %edx
jae 0x406967
cmpl %eax, %ecx
jbe 0x40690a
movq 0x201e25(%rip), %rax    # 0x608648
movzwl %r13w, %r15d
leal (,%r15,8), %ecx
movq (%rax,%rcx), %rax
movzbl %bpl, %edx
movb $0x1, (%rax,%rdx)
movq 0x201e0e(%rip), %rax    # 0x608650
imulq $0x18, %rdx, %r13
movq (%rax,%rcx), %rdi
addq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x40a4a2
movq 0x201dfa(%rip), %rax    # 0x608658
movq (%rax,%r15,8), %rdi
addq %r13, %rdi
leaq 0x4(%rsp), %rsi
callq 0x40a4a2
movq 0x201dea(%rip), %rax    # 0x608660
addq (%rax,%r15,8), %r13
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0x40a4a2
leaq 0x10(%rsp), %rdi
callq 0x490a30
leaq 0x30(%rsp), %rdi
callq 0x490a30
leaq 0x50(%rsp), %rdi
callq 0x490a30
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x490a30
leaq 0x2d8(%rsp), %rdi
callq 0x485d10
incl %r14d
jmp 0x406666
leaq 0xd0(%rsp), %rdi
callq 0x45d170
leaq 0xb0(%rsp), %rdi
callq 0x490a30
leaq 0xd0(%rsp), %rdi
callq 0x45d520
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18a444(%rip), %rdi    # 0x590d55
leaq 0x189761(%rip), %rsi    # 0x590079
leaq 0x18a296(%rip), %rcx    # 0x590bb5
movl $0x125, %edx            # imm = 0x125
callq 0x4d36d0
leaq 0x18a2c3(%rip), %rdi    # 0x590bf3
leaq 0x189742(%rip), %rsi    # 0x590079
leaq 0x18a277(%rip), %rcx    # 0x590bb5
movl $0x11f, %edx            # imm = 0x11F
callq 0x4d36d0
leaq 0x18a300(%rip), %rdi    # 0x590c4f
leaq 0x189723(%rip), %rsi    # 0x590079
leaq 0x18a258(%rip), %rcx    # 0x590bb5
movl $0x121, %edx            # imm = 0x121
callq 0x4d36d0
leaq 0x18a374(%rip), %rdi    # 0x590ce2
leaq 0x189704(%rip), %rsi    # 0x590079
leaq 0x18a239(%rip), %rcx    # 0x590bb5
movl $0x123, %edx            # imm = 0x123
callq 0x4d36d0
leaq 0x18a0d8(%rip), %rdi    # 0x590a65
leaq 0x1896e5(%rip), %rsi    # 0x590079
leaq 0x18a21a(%rip), %rcx    # 0x590bb5
movl $0x11e, %edx            # imm = 0x11E
callq 0x4d36d0
movq $0x609900, %rdi         # imm = 0x609900
leaq 0x18966d(%rip), %rsi    # 0x590020
callq 0x480750
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x480750
movq %rax, %rdi
callq 0x480030
pushq $0x1
popq %rdi
callq 0x4da4e0
movq %rax, %rbx
jmp 0x406a33
jmp 0x4069dc
jmp 0x4069dc
movq %rax, %rbx
jmp 0x406a26
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x490a30
leaq 0x30(%rsp), %rdi
callq 0x490a30
leaq 0x50(%rsp), %rdi
callq 0x490a30
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x490a30
leaq 0x2d8(%rsp), %rdi
callq 0x485d10
leaq 0xb0(%rsp), %rdi
callq 0x490a30
leaq 0xd0(%rsp), %rdi
callq 0x45d520
movq %rbx, %rdi
callq 0x4bea70