// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq (%rsi), %rsi
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movl $0x8, %edx
callq 0x460c10
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x4078a4
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x60(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x20(%rsp), %r12
leaq 0x70(%rsp), %rbp
xorl %ebx, %ebx
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4653c0
movsbl %al, %edx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x419ec0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4077b1
cmpw $0x1, %bx
jbe 0x4077aa
leaq 0x298(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movl $0x8, %edx
callq 0x48c470
movq %r14, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x58(%rsp)
movb %al, 0x60(%rsp)
movq %r15, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movb %al, 0x40(%rsp)
movq %r12, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb %al, 0x20(%rsp)
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x419b40
movq 0x50(%rsp), %r12
callq 0x4c7aa0
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r12, 0x8(%rsp)
je 0x407849
movq %rax, %rbp
movl (%r14), %eax
testl %eax, %eax
je 0x40765c
cmpl $0x22, %eax
jne 0x40765f
jmp 0x407880
movl %r13d, (%r14)
movq 0x30(%rsp), %r13
movl (%r14), %r15d
movl $0x0, (%r14)
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r13, 0x8(%rsp)
je 0x407855
movq %rax, %r12
movl (%r14), %eax
testl %eax, %eax
je 0x40769f
cmpl $0x22, %eax
jne 0x4076a2
jmp 0x407898
movl %r15d, (%r14)
movq 0x10(%rsp), %r13
movl (%r14), %r15d
movl $0x0, (%r14)
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r13, 0x8(%rsp)
je 0x40781e
movl (%r14), %ecx
testl %ecx, %ecx
je 0x4076df
cmpl $0x22, %ecx
jne 0x4076e2
jmp 0x40788c
movl %r15d, (%r14)
movzbl %bpl, %ecx
movzbl 0x203e69(%rip), %edx    # 0x60b556
cmpl %edx, %ecx
jae 0x407861
movl 0x203eb9(%rip), %ecx    # 0x60b5b4
cmpl %r12d, %ecx
jbe 0x4077ff
cmpl %eax, %ecx
jbe 0x40782a
movq 0x203f2d(%rip), %rcx    # 0x60b640
movq (%rcx), %rdx
movzbl %bpl, %esi
shll $0x2, %esi
movl %r12d, (%rdx,%rsi)
movq 0x8(%rcx), %rcx
movl %eax, (%rcx,%rsi)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %r12
cmpq %r12, %rdi
je 0x407744
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %r15
cmpq %r15, %rdi
leaq 0x60(%rsp), %r14
leaq 0x90(%rsp), %r13
leaq 0x70(%rsp), %rbp
je 0x407772
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x407789
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x298(%rsp), %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48c720
leaq 0x310(%rsp), %rdi
callq 0x4667e0
incl %ebx
jmp 0x407567
leaq 0x90(%rsp), %rdi
callq 0x4611c0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x4077e0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x90(%rsp), %rdi
callq 0x461570
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18d2e5(%rip), %rdi    # 0x594aeb
leaq 0x18c86c(%rip), %rsi    # 0x594079
leaq 0x18d2a7(%rip), %rcx    # 0x594abb
movl $0xf7, %edx
callq 0x4d75c0
leaq 0x18e1a6(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d31f(%rip), %rdi    # 0x594b50
leaq 0x18c841(%rip), %rsi    # 0x594079
leaq 0x18d27c(%rip), %rcx    # 0x594abb
movl $0xf8, %edx
callq 0x4d75c0
leaq 0x18e17b(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18e16f(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x18d1fd(%rip), %rdi    # 0x594a65
leaq 0x18c80a(%rip), %rsi    # 0x594079
leaq 0x18d245(%rip), %rcx    # 0x594abb
movl $0xf6, %edx
callq 0x4d75c0
leaq 0x18e144(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18e138(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18e12c(%rip), %rdi    # 0x5959cb
callq 0x402c3d
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18c76e(%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, %rbx
jmp 0x4079ac
jmp 0x407987
jmp 0x407987
jmp 0x4078f1
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x407910
movl %r15d, (%r14)
jmp 0x407910
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x407910
movl %r13d, (%r14)
jmp 0x407910
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x40792c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x407948
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x407964
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0x298(%rsp), %rdi
callq 0x48c720
leaq 0x310(%rsp), %rdi
callq 0x4667e0
jmp 0x40798a
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x4079ac
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x90(%rsp), %rdi
callq 0x461570
movq %rbx, %rdi
callq 0x4c2960
nop