// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_SPM_config(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_SPM_config(string spmConfigFileName)
{
	uint8_t operand_number; uint32_t start_addr_SPM_buffer0, start_addr_SPM_buffer1;
	uint16_t it=0;

	ifstream inFile(spmConfigFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << spmConfigFileName.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;
		tokenStream >> token1 >> token2 >> token3;
		operand_number = stoul(token1);
		start_addr_SPM_buffer0 = stoul(token2);
		start_addr_SPM_buffer1 = stoul(token3);

		assert((operand_number >= 0 && operand_number < total_operands) && "invalid operand number!");
		assert(start_addr_SPM_buffer0 >= 0 && start_addr_SPM_buffer0 < SPM_size && "invalid SPM address specified!");
		assert(start_addr_SPM_buffer1 >= 0 && start_addr_SPM_buffer1 < SPM_size && "invalid SPM address specified!");

		operand_start_addr_SPM_buffer[0][operand_number] = start_addr_SPM_buffer0;
		operand_start_addr_SPM_buffer[1][operand_number] = start_addr_SPM_buffer1;
		it++;
	}

	inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x461750
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x40788b
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x60(%rsp), %rbx
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %r12
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r13
leaq 0x298(%rsp), %rbp
movl $0x0, 0x4(%rsp)
leaq (%rsp,%rax), %rdi
addq $0x90, %rdi
movl $0xa, %esi
callq 0x465f00
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x41aa00
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x407798
movl 0x4(%rsp), %eax
cmpw $0x1, %ax
jbe 0x407781
movq %rbp, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x48cfb0
movq %rbx, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x58(%rsp)
movb %al, 0x60(%rsp)
movq %r14, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movb %al, 0x40(%rsp)
movq %r12, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb %al, 0x20(%rsp)
movq %rbp, %rdi
leaq 0x50(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41a680
movq 0x50(%rsp), %r14
callq 0x4c85e0
movq %rax, %rbx
movl (%rax), %r15d
movl $0x0, (%rax)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r14, 0x8(%rsp)
je 0x407830
movq %rax, %rbp
movl (%rbx), %r13d
testl %r13d, %r13d
je 0x40762d
cmpl $0x22, %r13d
jne 0x407633
jmp 0x407867
movl %r15d, (%rbx)
movl %r15d, %r13d
movq 0x30(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40783c
movq %rax, %r14
movl (%rbx), %r15d
testl %r15d, %r15d
je 0x407671
cmpl $0x22, %r15d
jne 0x407677
jmp 0x40787f
movl %r13d, (%rbx)
movl %r13d, %r15d
movq 0x10(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x407805
movl (%rbx), %ecx
testl %ecx, %ecx
leaq 0x20(%rsp), %r12
je 0x4076b4
cmpl $0x22, %ecx
jne 0x4076b7
jmp 0x407873
movl %r15d, (%rbx)
movzbl %bpl, %ecx
movzbl 0x203e94(%rip), %edx    # 0x60b556
cmpl %edx, %ecx
jae 0x407848
movl 0x203ee4(%rip), %ecx    # 0x60b5b4
cmpl %r14d, %ecx
jbe 0x4077e6
cmpl %eax, %ecx
jbe 0x407811
movq 0x203f58(%rip), %rcx    # 0x60b640
movq (%rcx), %rdx
movzbl %bpl, %esi
shll $0x2, %esi
movl %r14d, (%rdx,%rsi)
movq 0x8(%rcx), %rcx
movl %eax, (%rcx,%rsi)
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x407714
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %r14
cmpq %r14, %rdi
leaq 0x60(%rsp), %rbx
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r13
leaq 0x298(%rsp), %rbp
je 0x40774a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x407761
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq %rbp, %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48d260
leaq 0x310(%rsp), %rdi
callq 0x467320
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x40753e
leaq 0x90(%rsp), %rdi
callq 0x461d00
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x4077c7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x90(%rsp), %rdi
callq 0x4620b0
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18d2fe(%rip), %rdi    # 0x594aeb
leaq 0x18c885(%rip), %rsi    # 0x594079
leaq 0x18d2c0(%rip), %rcx    # 0x594abb
movl $0xf7, %edx
callq 0x4d8100
leaq 0x18e1bf(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18d338(%rip), %rdi    # 0x594b50
leaq 0x18c85a(%rip), %rsi    # 0x594079
leaq 0x18d295(%rip), %rcx    # 0x594abb
movl $0xf8, %edx
callq 0x4d8100
leaq 0x18e194(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18e188(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x18d216(%rip), %rdi    # 0x594a65
leaq 0x18c823(%rip), %rsi    # 0x594079
leaq 0x18d25e(%rip), %rcx    # 0x594abb
movl $0xf6, %edx
callq 0x4d8100
leaq 0x18e15d(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18e151(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18e145(%rip), %rdi    # 0x5959cb
callq 0x402c01
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18c787(%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 0x407991
jmp 0x40796c
jmp 0x40796c
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x4078f0
movl %r13d, (%rbx)
jmp 0x4078f0
jmp 0x4078e5
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x4078f0
movl %r15d, (%rbx)
leaq 0x20(%rsp), %r12
jmp 0x4078fa
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x407911
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x40792d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x407949
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0x298(%rsp), %rdi
callq 0x48d260
leaq 0x310(%rsp), %rdi
callq 0x467320
jmp 0x40796f
movq %rax, %r14
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x407991
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x90(%rsp), %rdi
callq 0x4620b0
movq %r14, %rdi
callq 0x4c34a0