// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq (%rsi), %rsi
leaq 0x260(%rsp), %rbp
movq %rbp, %rdi
movl $0x8, %edx
callq 0x460c10
movq (%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x280(%rsp,%rax)
jne 0x408000
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
leaq 0xc0(%rsp), %r14
movl $0x0, 0x10(%rsp)
movq 0x260(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x4653c0
movsbl %al, %edx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x419ec0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x407e9c
movl 0x10(%rsp), %eax
cmpw $0x1, %ax
jbe 0x407e91
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x48c470
movq %rbx, 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 %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x419b40
movq %rbp, %r14
movq 0x40(%rsp), %r12
callq 0x4c7aa0
movq %rax, %rbp
movl (%rax), %r15d
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r12, 0x8(%rsp)
je 0x407f6e
movq %rax, %r13
movl (%rbp), %eax
testl %eax, %eax
je 0x407b94
cmpl $0x22, %eax
jne 0x407b98
jmp 0x407fd0
movl %r15d, (%rbp)
movq 0x20(%rsp), %r15
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x407f7a
movq %rax, %r12
movl (%rbp), %eax
testl %eax, %eax
je 0x407bd8
cmpl $0x22, %eax
jne 0x407bdb
jmp 0x407fe8
movl %ebx, (%rbp)
movq 0xa0(%rsp), %r15
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x407f56
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407c1b
cmpl $0x22, %ecx
jne 0x407c1e
jmp 0x407fc4
movl %ebx, (%rbp)
movl %eax, 0x1c(%rsp)
movq 0x80(%rsp), %r15
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x407f62
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407c62
cmpl $0x22, %ecx
jne 0x407c65
jmp 0x407ff4
movl %ebx, (%rbp)
movl %eax, 0x14(%rsp)
movq 0x60(%rsp), %r15
movl (%rbp), %ebx
movl $0x0, (%rbp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x407f4a
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x407ca6
cmpl $0x22, %ecx
jne 0x407ca9
jmp 0x407fdc
movl %ebx, (%rbp)
movl %eax, 0x18(%rsp)
movzbl %r12b, %ecx
movzbl 0x20389e(%rip), %edx    # 0x60b556
cmpl %edx, %ecx
jae 0x407f2b
movzwl %r13w, %ecx
movzwl 0x203889(%rip), %edx    # 0x60b554
cmpl %edx, %ecx
jae 0x407fa5
movq %r14, %rbp
movl 0x1c(%rsp), %ecx
movl 0x2038d4(%rip), %edx    # 0x60b5b4
cmpl %edx, %ecx
leaq 0xc0(%rsp), %r14
jae 0x407eed
movl 0x14(%rsp), %esi
testl %esi, %esi
je 0x407f86
cmpl %edx, %esi
jae 0x407f86
cmpl %eax, %edx
jbe 0x407f0c
movq 0x203935(%rip), %rax    # 0x60b648
movzwl %r13w, %r15d
leal (,%r15,8), %edx
movq (%rax,%rdx), %rax
movzbl %r12b, %esi
movb $0x1, (%rax,%rsi)
movq 0x20391e(%rip), %rax    # 0x60b650
movq (%rax,%rdx), %rax
leaq (%rsi,%rsi,2), %r12
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407d5e
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
jmp 0x407d72
leaq 0x1c(%rsp), %rdx
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
callq 0x40e9fa
movq 0x2038df(%rip), %rax    # 0x60b658
movq (%rax,%r15,8), %rax
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407d9b
movl 0x14(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x407da5
leaq 0x14(%rsp), %rdx
callq 0x40e9fa
movq 0x2038b4(%rip), %rax    # 0x60b660
movq (%rax,%r15,8), %rax
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x407dce
movl 0x18(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x407dd8
leaq 0x18(%rsp), %rdx
callq 0x40e9fa
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x407df4
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x407e19
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x407e3e
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x407e55
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x407e6c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0xe0(%rsp), %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48c720
leaq 0x158(%rsp), %rdi
callq 0x4667e0
movl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x10(%rsp)
jmp 0x407a35
leaq 0x260(%rsp), %rdi
callq 0x4611c0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x407ece
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x260(%rsp), %rdi
callq 0x461570
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18cd5b(%rip), %rdi    # 0x594c4f
leaq 0x18c17e(%rip), %rsi    # 0x594079
leaq 0x18ccb3(%rip), %rcx    # 0x594bb5
movl $0x121, %edx            # imm = 0x121
callq 0x4d75c0
leaq 0x18ce42(%rip), %rdi    # 0x594d55
leaq 0x18c15f(%rip), %rsi    # 0x594079
leaq 0x18cc94(%rip), %rcx    # 0x594bb5
movl $0x125, %edx            # imm = 0x125
callq 0x4d75c0
leaq 0x18cb33(%rip), %rdi    # 0x594a65
leaq 0x18c140(%rip), %rsi    # 0x594079
leaq 0x18cc75(%rip), %rcx    # 0x594bb5
movl $0x11e, %edx            # imm = 0x11E
callq 0x4d75c0
leaq 0x18da7a(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18da6e(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18da62(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18da56(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18da4a(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18cd55(%rip), %rdi    # 0x594ce2
leaq 0x18c0e5(%rip), %rsi    # 0x594079
leaq 0x18cc1a(%rip), %rcx    # 0x594bb5
movl $0x123, %edx            # imm = 0x123
callq 0x4d75c0
leaq 0x18cc47(%rip), %rdi    # 0x594bf3
leaq 0x18c0c6(%rip), %rsi    # 0x594079
leaq 0x18cbfb(%rip), %rcx    # 0x594bb5
movl $0x11f, %edx            # imm = 0x11F
callq 0x4d75c0
leaq 0x18da00(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d9f4(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d9e8(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d9dc(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d9d0(%rip), %rdi    # 0x5959cb
callq 0x402c3d
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18c012(%rip), %rsi    # 0x594020
movl $0x1b, %edx
callq 0x484270
movq (%r14), %rsi
movq $0x60c900, %rdi         # imm = 0x60C900
callq 0x4847a0
movq %rax, %rdi
callq 0x484080
movl $0x1, %edi
callq 0x4de3d0
movq %rax, %r14
jmp 0x408157
jmp 0x408072
jmp 0x408072
jmp 0x40805a
jmp 0x40805a
jmp 0x40805a
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x408066
movl %r15d, (%rbp)
jmp 0x408066
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x408066
movl %ebx, (%rbp)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
jmp 0x40807d
movq %rax, %r14
jmp 0x408132
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x408099
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x4080be
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x4080e3
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x4080fa
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x408111
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0xe0(%rsp), %rdi
callq 0x48c720
leaq 0x158(%rsp), %rdi
callq 0x4667e0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x408157
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x260(%rsp), %rdi
callq 0x461570
movq %r14, %rdi
callq 0x4c2960