// File: /workspace/github_cpp_makefile_star2_O3/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 $0x468, %rsp            # imm = 0x468
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x461750
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x100(%rsp,%rax)
jne 0x407fff
leaq 0xd0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x50(%rsp), %r15
leaq 0x30(%rsp), %r13
leaq 0xe0(%rsp), %r14
leaq 0xc0(%rsp), %rbp
movl $0x0, 0x10(%rsp)
leaq (%rsp,%rax), %rdi
addq $0xe0, %rdi
movl $0xa, %esi
callq 0x465f00
movsbl %al, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x41aa00
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x407e9b
movl 0x10(%rsp), %eax
cmpw $0x1, %ax
jbe 0x407e84
leaq 0x2e8(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x8, %edx
callq 0x48cfb0
movq %r15, 0x40(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x48(%rsp)
movb %cl, 0x50(%rsp)
movq %r13, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movb %cl, 0x30(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %rcx, 0xa8(%rsp)
movb %cl, 0xb0(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %rcx, 0x88(%rsp)
movb %cl, 0x90(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movb %cl, 0x70(%rsp)
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x41a680
movq 0x40(%rsp), %r14
callq 0x4c85e0
movq %rax, %rbp
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r14, 0x8(%rsp)
je 0x407f6d
movq %rax, %r13
movl (%rbp), %r15d
testl %r15d, %r15d
je 0x407b7a
cmpl $0x22, %r15d
jne 0x407b80
jmp 0x407fcf
movl %ebx, (%rbp)
movl %ebx, %r15d
movq 0x20(%rsp), %r12
movl $0x0, (%rbp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x407f79
movq %rax, %r14
movl (%rbp), %ebx
testl %ebx, %ebx
je 0x407bbd
cmpl $0x22, %ebx
jne 0x407bc4
jmp 0x407fe7
movl %r15d, (%rbp)
movl %r15d, %ebx
movq 0xa0(%rsp), %r12
movl $0x0, (%rbp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x407f55
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407c01
cmpl $0x22, %ecx
jne 0x407c04
jmp 0x407fc3
movl %ebx, (%rbp)
movl %eax, 0x1c(%rsp)
movq 0x80(%rsp), %r12
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x407f61
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407c48
cmpl $0x22, %ecx
jne 0x407c4b
jmp 0x407ff3
movl %ebx, (%rbp)
movl %eax, 0x14(%rsp)
movq 0x60(%rsp), %r12
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x407f49
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407c8c
cmpl $0x22, %ecx
jne 0x407c8f
jmp 0x407fdb
movl %ebx, (%rbp)
movl %eax, 0x18(%rsp)
movzbl %r14b, %ecx
movzbl 0x2038b8(%rip), %edx    # 0x60b556
cmpl %edx, %ecx
jae 0x407f2a
movzwl %r13w, %ecx
movzwl 0x2038a3(%rip), %edx    # 0x60b554
cmpl %edx, %ecx
leaq 0xc0(%rsp), %rbp
jae 0x407fa4
movl 0x1c(%rsp), %ecx
movl 0x2038e9(%rip), %edx    # 0x60b5b4
cmpl %edx, %ecx
jae 0x407eec
movl 0x14(%rsp), %esi
testl %esi, %esi
je 0x407f85
cmpl %edx, %esi
jae 0x407f85
cmpl %eax, %edx
jbe 0x407f0b
movq 0x203952(%rip), %rax    # 0x60b648
movzwl %r13w, %r12d
leal (,%r12,8), %edx
movq (%rax,%rdx), %rax
movzbl %r14b, %esi
movb $0x1, (%rax,%rsi)
movq 0x20393b(%rip), %rax    # 0x60b650
movq (%rax,%rdx), %rax
leaq (%rsi,%rsi,2), %rbx
leaq (%rax,%rbx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407d49
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
leaq 0x50(%rsp), %r15
leaq 0x30(%rsp), %r13
leaq 0xe0(%rsp), %r14
jmp 0x407d65
leaq 0x1c(%rsp), %rdx
leaq 0x50(%rsp), %r15
leaq 0x30(%rsp), %r13
callq 0x40ea5c
leaq 0xe0(%rsp), %r14
movq 0x2038ec(%rip), %rax    # 0x60b658
movq (%rax,%r12,8), %rax
leaq (%rax,%rbx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407d8e
movl 0x14(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x407d98
leaq 0x14(%rsp), %rdx
callq 0x40ea5c
movq 0x2038c1(%rip), %rax    # 0x60b660
movq (%rax,%r12,8), %rax
leaq (%rax,%rbx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407dc1
movl 0x18(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x407dcb
leaq 0x18(%rsp), %rdx
callq 0x40ea5c
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x407de7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x407e0c
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x407e31
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x407e48
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x407e5f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x2e8(%rsp), %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48d260
leaq 0x360(%rsp), %rdi
callq 0x467320
movl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x10(%rsp)
movq 0xe0(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x407a20
leaq 0xe0(%rsp), %rdi
callq 0x461d00
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x407ecd
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0xe0(%rsp), %rdi
callq 0x4620b0
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18cd5c(%rip), %rdi    # 0x594c4f
leaq 0x18c17f(%rip), %rsi    # 0x594079
leaq 0x18ccb4(%rip), %rcx    # 0x594bb5
movl $0x121, %edx            # imm = 0x121
callq 0x4d8100
leaq 0x18ce43(%rip), %rdi    # 0x594d55
leaq 0x18c160(%rip), %rsi    # 0x594079
leaq 0x18cc95(%rip), %rcx    # 0x594bb5
movl $0x125, %edx            # imm = 0x125
callq 0x4d8100
leaq 0x18cb34(%rip), %rdi    # 0x594a65
leaq 0x18c141(%rip), %rsi    # 0x594079
leaq 0x18cc76(%rip), %rcx    # 0x594bb5
movl $0x11e, %edx            # imm = 0x11E
callq 0x4d8100
leaq 0x18da7b(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18da6f(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18da63(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18da57(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18da4b(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18cd56(%rip), %rdi    # 0x594ce2
leaq 0x18c0e6(%rip), %rsi    # 0x594079
leaq 0x18cc1b(%rip), %rcx    # 0x594bb5
movl $0x123, %edx            # imm = 0x123
callq 0x4d8100
leaq 0x18cc48(%rip), %rdi    # 0x594bf3
leaq 0x18c0c7(%rip), %rsi    # 0x594079
leaq 0x18cbfc(%rip), %rcx    # 0x594bb5
movl $0x11f, %edx            # imm = 0x11F
callq 0x4d8100
leaq 0x18da01(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18d9f5(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18d9e9(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18d9dd(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18d9d1(%rip), %rdi    # 0x5959cb
callq 0x402c01
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18c013(%rip), %rsi    # 0x594020
movl $0x1b, %edx
callq 0x484db0
movq (%rbx), %rsi
movq $0x60c900, %rdi         # imm = 0x60C900
callq 0x4852e0
movq %rax, %rdi
callq 0x484bc0
movl $0x1, %edi
callq 0x4def10
movq %rax, %r14
jmp 0x408156
jmp 0x408071
jmp 0x408071
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x408065
movl %r15d, (%rbp)
jmp 0x408065
jmp 0x408059
jmp 0x408059
jmp 0x408059
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x408065
movl %ebx, (%rbp)
leaq 0x50(%rsp), %r15
leaq 0x30(%rsp), %r13
jmp 0x40807c
movq %rax, %r14
jmp 0x408131
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x408098
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x4080bd
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x4080e2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x4080f9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x408110
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0x2e8(%rsp), %rdi
callq 0x48d260
leaq 0x360(%rsp), %rdi
callq 0x467320
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x408156
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0xe0(%rsp), %rdi
callq 0x4620b0
movq %r14, %rdi
callq 0x4c34a0
nop