// File: /workspace/github_cpp_makefile_star2_O2/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_SPM_read_management(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_SPM_read_management(string spmReadManageFileName)
{
	uint8_t operand_number, network_number;	uint16_t RF_pass_number, offset_network_packets;
	uint32_t offset_base_addr_SPM,	burst_width_elements;
	uint16_t it=0;
	ifstream inFile(spmReadManageFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << spmReadManageFileName.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, token6;
		tokenStream >> token1 >> token2 >> token3 >> token4 >> token5 >> token6;
		RF_pass_number 					= stoul(token1);
		network_number					= stoul(token2);
		operand_number 					= stoul(token3);
		offset_network_packets	= stoul(token4);
		burst_width_elements		= stoul(token5);
		offset_base_addr_SPM 		= stoul(token6);

		assert((RF_pass_number >= 0 && RF_pass_number < RF_passes) && "invalid number for an RF pass!");
		assert((network_number >= 0 && network_number < inNetworks) && "invalid number of a network for read-operands!");
		assert((operand_number >= 0 && operand_number < total_operands) && "invalid operand number!");
		assert(offset_network_packets >= 0 && offset_network_packets < size_packetArr[operand_number] &&
			"invalid start address specified for communicating data packets for a read-operand in an RF pass!");
		assert(burst_width_elements > 0 && burst_width_elements <= size_packetArr[operand_number] &&
			"invalid burst width specified for communicating data packets for read-operand via network!");
			assert(offset_base_addr_SPM >= 0 && offset_base_addr_SPM < SPM_size &&
				"invalid SPM address specified for reading an operand in an RF pass!");

		read_data_RF_pass[RF_pass_number][network_number] = true;
		RF_pass_network_read_operand[RF_pass_number][network_number].push_back(operand_number);
		RF_pass_network_read_operand_offset_network_packet[RF_pass_number][network_number].push_back(offset_network_packets);
		RF_pass_network_read_operand_burst_width_elements[RF_pass_number][network_number].push_back(burst_width_elements);
		RF_pass_network_read_operand_offset_base_addr_SPM[RF_pass_number][network_number].push_back(offset_base_addr_SPM);
		it++;
	}
	inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0xf0(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x45cbc0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x110(%rsp,%rax)
jne 0x4088a5
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r15d, %r15d
leaq 0xb0(%rsp), %r12
pushq $0xa
popq %r13
xorl %r14d, %r14d
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x493470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4087b2
cmpw $0x1, %r14w
jbe 0x4087aa
leaq 0x2f8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xd0(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x488420
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
andq $0x0, 0x98(%rsp)
movb %r15b, 0xa0(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
andq $0x0, 0x78(%rsp)
movb %r15b, 0x80(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movb %r15b, 0x60(%rsp)
movb %r15b, 0x40(%rsp)
movb %r15b, 0x20(%rsp)
leaq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
andq $0x0, 0xb8(%rsp)
movb %r15b, 0xc0(%rsp)
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x70(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x415af0
movq %rax, %rdi
movq %r12, %rsi
callq 0x415af0
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movq %rax, %rbp
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movb %al, 0x5(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movw %ax, 0x6(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movl %eax, 0x8(%rsp)
movq %r12, %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movl %eax, 0xc(%rsp)
movzwl %bp, %ecx
movzwl 0x1ffecd(%rip), %edx    # 0x608552
cmpl %edx, %ecx
jae 0x408829
movzbl %bl, %ecx
movzbl 0x1fdaba(%rip), %edx    # 0x606151
cmpl %edx, %ecx
jae 0x4087eb
movzbl 0x5(%rsp), %ecx
cmpb 0x1ffeac(%rip), %cl     # 0x608556
jae 0x408886
movq 0x1fff31(%rip), %rdx    # 0x6085e8
movzwl (%rdx,%rcx,2), %ecx
cmpw %cx, 0x6(%rsp)
jae 0x40880a
movl 0x8(%rsp), %edx
decl %edx
cmpl %ecx, %edx
jae 0x408848
cmpl %eax, 0x1ffeda(%rip)    # 0x6085b4
jbe 0x408867
movq 0x1fffa1(%rip), %rax    # 0x608688
movzwl %bp, %ebp
leal (,%rbp,8), %ecx
movq (%rax,%rcx), %rax
movzbl %bl, %edx
movb $0x1, (%rax,%rdx)
movq 0x1fff8d(%rip), %rax    # 0x608690
imulq $0x18, %rdx, %rbx
movq (%rax,%rcx), %rdi
addq %rbx, %rdi
leaq 0x5(%rsp), %rsi
callq 0x40a57e
movq 0x1fff79(%rip), %rax    # 0x608698
movq (%rax,%rbp,8), %rdi
addq %rbx, %rdi
leaq 0x6(%rsp), %rsi
callq 0x40a598
movq 0x1fff69(%rip), %rax    # 0x6086a0
movq (%rax,%rbp,8), %rdi
addq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x40a4a2
movq 0x1fff59(%rip), %rax    # 0x6086a8
addq (%rax,%rbp,8), %rbx
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x40a4a2
movq %r12, %rdi
callq 0x490a30
leaq 0x10(%rsp), %rdi
callq 0x490a30
leaq 0x30(%rsp), %rdi
callq 0x490a30
leaq 0x50(%rsp), %rdi
callq 0x490a30
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x490a30
leaq 0x2f8(%rsp), %rdi
callq 0x485d10
incl %r14d
jmp 0x4084d1
leaq 0xf0(%rsp), %rdi
callq 0x45d170
leaq 0xd0(%rsp), %rdi
callq 0x490a30
leaq 0xf0(%rsp), %rdi
callq 0x45d520
addq $0x478, %rsp            # imm = 0x478
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x188b4c(%rip), %rdi    # 0x59133e
leaq 0x187880(%rip), %rsi    # 0x590079
leaq 0x188b05(%rip), %rcx    # 0x591305
movl $0x2af, %edx            # imm = 0x2AF
callq 0x4d36d0
leaq 0x188b96(%rip), %rdi    # 0x5913a7
leaq 0x187861(%rip), %rsi    # 0x590079
leaq 0x188ae6(%rip), %rcx    # 0x591305
movl $0x2b2, %edx            # imm = 0x2B2
callq 0x4d36d0
leaq 0x188a7d(%rip), %rdi    # 0x5912ad
leaq 0x187842(%rip), %rsi    # 0x590079
leaq 0x188ac7(%rip), %rcx    # 0x591305
movl $0x2ae, %edx            # imm = 0x2AE
callq 0x4d36d0
leaq 0x188c15(%rip), %rdi    # 0x591464
leaq 0x187823(%rip), %rsi    # 0x590079
leaq 0x188aa8(%rip), %rcx    # 0x591305
movl $0x2b4, %edx            # imm = 0x2B4
callq 0x4d36d0
leaq 0x188ca9(%rip), %rdi    # 0x591517
leaq 0x187804(%rip), %rsi    # 0x590079
leaq 0x188a89(%rip), %rcx    # 0x591305
movl $0x2b6, %edx            # imm = 0x2B6
callq 0x4d36d0
leaq 0x1881d8(%rip), %rdi    # 0x590a65
leaq 0x1877e5(%rip), %rsi    # 0x590079
leaq 0x188a6a(%rip), %rcx    # 0x591305
movl $0x2b0, %edx            # imm = 0x2B0
callq 0x4d36d0
movq $0x609900, %rdi         # imm = 0x609900
leaq 0x18776d(%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 0x408940
jmp 0x4088dc
jmp 0x4088dc
movq %rax, %rbx
jmp 0x408933
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x490a30
leaq 0x10(%rsp), %rdi
callq 0x490a30
leaq 0x30(%rsp), %rdi
callq 0x490a30
leaq 0x50(%rsp), %rdi
callq 0x490a30
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x490a30
leaq 0x2f8(%rsp), %rdi
callq 0x485d10
leaq 0xd0(%rsp), %rdi
callq 0x490a30
leaq 0xf0(%rsp), %rdi
callq 0x45d520
movq %rbx, %rdi
callq 0x4bea70
nop