// File: /workspace/github_cpp_makefile_star2_O2/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 $0x408, %rsp            # imm = 0x408
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0x80(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x45cbc0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xa0(%rsp,%rax)
jne 0x40657d
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x60(%rsp), %r14
leaq 0x40(%rsp), %rbp
pushq $0xa
popq %rbx
xorl %r13d, %r13d
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0x493470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4064ea
cmpw $0x1, %r13w
jbe 0x4064e2
leaq 0x288(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
pushq $0x8
popq %rdx
callq 0x488420
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
andq $0x0, 0x8(%rsp)
xorl %ecx, %ecx
movb %cl, 0x30(%rsp)
movb %cl, 0x10(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb %cl, 0x50(%rsp)
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
movq %rsp, %rsi
callq 0x415af0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x415af0
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movq %rax, %r15
movq %rsp, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movq %rax, %r12
movq %rbp, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movzbl %r15b, %ecx
movzbl 0x2020d6(%rip), %edx    # 0x608556
cmpl %edx, %ecx
jae 0x406520
movl 0x202126(%rip), %ecx    # 0x6085b4
cmpl %r12d, %ecx
jbe 0x40653f
cmpl %eax, %ecx
jbe 0x40655e
movq 0x20219a(%rip), %rcx    # 0x608640
movq (%rcx), %rdx
movzbl %r15b, %esi
shll $0x2, %esi
movl %r12d, (%rdx,%rsi)
movq 0x8(%rcx), %rcx
movl %eax, (%rcx,%rsi)
movq %rbp, %rdi
callq 0x490a30
movq %rsp, %rdi
callq 0x490a30
leaq 0x20(%rsp), %rdi
callq 0x490a30
leaq 0x288(%rsp), %rdi
callq 0x485d10
incl %r13d
jmp 0x4063a6
leaq 0x80(%rsp), %rdi
callq 0x45d170
leaq 0x60(%rsp), %rdi
callq 0x490a30
leaq 0x80(%rsp), %rdi
callq 0x45d520
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18a53e(%rip), %rdi    # 0x590a65
leaq 0x189b4b(%rip), %rsi    # 0x590079
leaq 0x18a586(%rip), %rcx    # 0x590abb
movl $0xf6, %edx
callq 0x4d36d0
leaq 0x18a5a5(%rip), %rdi    # 0x590aeb
leaq 0x189b2c(%rip), %rsi    # 0x590079
leaq 0x18a567(%rip), %rcx    # 0x590abb
movl $0xf7, %edx
callq 0x4d36d0
leaq 0x18a5eb(%rip), %rdi    # 0x590b50
leaq 0x189b0d(%rip), %rsi    # 0x590079
leaq 0x18a548(%rip), %rcx    # 0x590abb
movl $0xf8, %edx
callq 0x4d36d0
movq $0x609900, %rdi         # imm = 0x609900
leaq 0x189a95(%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 0x4065ef
jmp 0x4065b4
jmp 0x4065b4
movq %rax, %rbx
jmp 0x4065e5
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x490a30
movq %rsp, %rdi
callq 0x490a30
leaq 0x20(%rsp), %rdi
callq 0x490a30
leaq 0x288(%rsp), %rdi
callq 0x485d10
leaq 0x60(%rsp), %rdi
callq 0x490a30
leaq 0x80(%rsp), %rdi
callq 0x45d520
movq %rbx, %rdi
callq 0x4bea70