// File: /workspace/github_cpp_makefile_star2_O1/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_DMAC_WB_management(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_DMAC_WB_management(string dmacWBManageFileName)
{
	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(dmacWBManageFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << dmacWBManageFileName.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 >= WB_delay_SPM_pass && SPM_pass_number < (SPM_passes+WB_delay_SPM_pass)) && "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!");

		write_operand_SPM_pass[SPM_pass_number][operand_number] = true;
		write_operand_offset_base_addr_SPM[SPM_pass_number][operand_number].push_back(offset_base_addr_SPM);
		write_operand_burst_width_bytes_SPM_pass[SPM_pass_number][operand_number].push_back(burst_width_bytes);
		write_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 0x4087b6
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 0x408652
movl 0x10(%rsp), %eax
cmpw $0x1, %ax
jbe 0x408647
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 0x408743
movq %rax, %r13
movl (%rbp), %eax
testl %eax, %eax
je 0x40833e
cmpl $0x22, %eax
jne 0x408342
jmp 0x4087aa
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 0x40874f
movq %rax, %r12
movl (%rbp), %eax
testl %eax, %eax
je 0x408382
cmpl $0x22, %eax
jne 0x408385
jmp 0x408792
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 0x40872b
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x4083c5
cmpl $0x22, %ecx
jne 0x4083c8
jmp 0x40877a
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 0x408737
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x40840c
cmpl $0x22, %ecx
jne 0x40840f
jmp 0x408786
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 0x40871f
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x408450
cmpl $0x22, %ecx
jne 0x408453
jmp 0x40879e
movl %ebx, (%rbp)
movl %eax, 0x18(%rsp)
movzbl %r12b, %ecx
movzbl 0x2030f4(%rip), %edx    # 0x60b556
cmpl %edx, %ecx
jae 0x4086c2
movzwl %r13w, %ecx
cmpl $0x2, %ecx
jb 0x4086a3
movzwl 0x2030d6(%rip), %edx    # 0x60b554
addl $0x2, %edx
cmpl %edx, %ecx
jae 0x4086a3
movq %r14, %rbp
movl 0x1c(%rsp), %ecx
movl 0x20311e(%rip), %edx    # 0x60b5b4
cmpl %edx, %ecx
leaq 0xc0(%rsp), %r14
jae 0x4086e1
movl 0x14(%rsp), %esi
testl %esi, %esi
je 0x40875b
cmpl %edx, %esi
jae 0x40875b
cmpl %eax, %edx
jbe 0x408700
movq 0x20319f(%rip), %rax    # 0x60b668
movzwl %r13w, %r15d
leal (,%r15,8), %edx
movq (%rax,%rdx), %rax
movzbl %r12b, %esi
movb $0x1, (%rax,%rsi)
movq 0x203188(%rip), %rax    # 0x60b670
movq (%rax,%rdx), %rax
leaq (%rsi,%rsi,2), %r12
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x408514
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
jmp 0x408528
leaq 0x1c(%rsp), %rdx
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
callq 0x40e9fa
movq 0x203149(%rip), %rax    # 0x60b678
movq (%rax,%r15,8), %rax
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x408551
movl 0x14(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40855b
leaq 0x14(%rsp), %rdx
callq 0x40e9fa
movq 0x20311e(%rip), %rax    # 0x60b680
movq (%rax,%r15,8), %rax
leaq (%rax,%r12,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x408584
movl 0x18(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40858e
leaq 0x18(%rsp), %rdx
callq 0x40e9fa
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x4085aa
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x4085cf
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x4085f4
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x40860b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x408622
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 0x4081df
leaq 0x260(%rsp), %rdi
callq 0x4611c0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x408684
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 0x18c76d(%rip), %rdi    # 0x594e17
leaq 0x18b9c8(%rip), %rsi    # 0x594079
leaq 0x18c727(%rip), %rcx    # 0x594ddf
movl $0x14f, %edx            # imm = 0x14F
callq 0x4d75c0
leaq 0x18c39c(%rip), %rdi    # 0x594a65
leaq 0x18b9a9(%rip), %rsi    # 0x594079
leaq 0x18c708(%rip), %rcx    # 0x594ddf
movl $0x14e, %edx            # imm = 0x14E
callq 0x4d75c0
leaq 0x18c567(%rip), %rdi    # 0x594c4f
leaq 0x18b98a(%rip), %rsi    # 0x594079
leaq 0x18c6e9(%rip), %rcx    # 0x594ddf
movl $0x151, %edx            # imm = 0x151
callq 0x4d75c0
leaq 0x18c64e(%rip), %rdi    # 0x594d55
leaq 0x18b96b(%rip), %rsi    # 0x594079
leaq 0x18c6ca(%rip), %rcx    # 0x594ddf
movl $0x155, %edx            # imm = 0x155
callq 0x4d75c0
leaq 0x18d2a5(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d299(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d28d(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d281(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d275(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18c580(%rip), %rdi    # 0x594ce2
leaq 0x18b910(%rip), %rsi    # 0x594079
leaq 0x18c66f(%rip), %rcx    # 0x594ddf
movl $0x153, %edx            # imm = 0x153
callq 0x4d75c0
leaq 0x18d24a(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d23e(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d232(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d226(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18d21a(%rip), %rdi    # 0x5959cb
callq 0x402c3d
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18b85c(%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 0x40890d
jmp 0x408828
jmp 0x408828
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x40881c
movl %r15d, (%rbp)
jmp 0x40881c
jmp 0x408810
jmp 0x408810
jmp 0x408810
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x40881c
movl %ebx, (%rbp)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r13
jmp 0x408833
movq %rax, %r14
jmp 0x4088e8
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x40884f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x408874
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x408899
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x4088b0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4088c7
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 0x40890d
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x260(%rsp), %rdi
callq 0x461570
movq %r14, %rdi
callq 0x4c2960