// File: /workspace/github_cpp_makefile_star2_O2/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_SPM_write_management(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_SPM_write_management(string spmWriteManageFileName)
{
	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(spmWriteManageFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << spmWriteManageFileName.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);
		uint8_t	write_network		= inNetworks + network_number;
		operand_number 					= stoul(token3);
		offset_network_packets	= stoul(token4);
		burst_width_elements		= stoul(token5);
		offset_base_addr_SPM 		= stoul(token6);

		assert((RF_pass_number >= WB_delay_RF_pass && RF_pass_number < RF_passes + WB_delay_RF_pass) && "invalid number for an RF pass!");
		assert((network_number >= 0 && network_number < outNetworks) && "invalid number of a network for write-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 write-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 write-operand via network!");
			assert(offset_base_addr_SPM >= 0 && offset_base_addr_SPM < SPM_size &&
				"invalid SPM address specified for writing an operand in an RF pass!");

		write_data_RF_pass[RF_pass_number][network_number] = true;
		RF_pass_network_write_operand[RF_pass_number][network_number].push_back(operand_number);
		RF_pass_network_write_operand_offset_network_packet[RF_pass_number][network_number].push_back(offset_network_packets);
		RF_pass_network_write_operand_burst_width_elements[RF_pass_number][network_number].push_back(burst_width_elements);
		RF_pass_network_write_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 0x408da0
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r15d, %r15d
leaq 0xd0(%rsp), %r14
pushq $0xa
popq %r13
xorl %r12d, %r12d
leaq 0xf0(%rsp), %rdi
movq %r14, %rsi
callq 0x493470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x408cad
cmpw $0x1, %r12w
jbe 0x408ca5
leaq 0x2f8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x8
popq %rdx
callq 0x488420
leaq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
andq $0x0, 0xb8(%rsp)
movb %r15b, 0xc0(%rsp)
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)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb %r15b, 0x80(%rsp)
movb %r15b, 0x60(%rsp)
movb %r15b, 0x40(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movb %r15b, 0x20(%rsp)
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x415af0
movq %rax, %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
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movq %rax, %rbp
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movb %al, 0x5(%rsp)
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movw %ax, 0x6(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x40a485
movl %eax, 0xc(%rsp)
movzwl %bp, %ecx
cmpl $0x2, %ecx
jb 0x408ce6
movzwl 0x1ff9da(%rip), %edx    # 0x608552
addl $0x2, %edx
cmpl %edx, %ecx
jae 0x408ce6
movzbl %bl, %ecx
movzbl 0x1ffa57(%rip), %edx    # 0x6085e4
cmpl %edx, %ecx
jae 0x408d62
movzbl 0x5(%rsp), %ecx
cmpb 0x1ff9b6(%rip), %cl     # 0x608556
jae 0x408d24
movq 0x1ffa3b(%rip), %rdx    # 0x6085e8
movzwl (%rdx,%rcx,2), %ecx
cmpw %cx, 0x6(%rsp)
jae 0x408d05
movl 0x8(%rsp), %edx
decl %edx
cmpl %ecx, %edx
jae 0x408d43
cmpl %eax, 0x1ff9e4(%rip)    # 0x6085b4
jbe 0x408d81
movq 0x1ffad3(%rip), %rax    # 0x6086b0
movzwl %bp, %ebp
leal (,%rbp,8), %ecx
movq (%rax,%rcx), %rax
movzbl %bl, %edx
movb $0x1, (%rax,%rdx)
movq 0x1ffabf(%rip), %rax    # 0x6086b8
imulq $0x18, %rdx, %rbx
movq (%rax,%rcx), %rdi
addq %rbx, %rdi
leaq 0x5(%rsp), %rsi
callq 0x40a57e
movq 0x1ffaab(%rip), %rax    # 0x6086c0
movq (%rax,%rbp,8), %rdi
addq %rbx, %rdi
leaq 0x6(%rsp), %rsi
callq 0x40a598
movq 0x1ffa9b(%rip), %rax    # 0x6086c8
movq (%rax,%rbp,8), %rdi
addq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x40a4a2
movq 0x1ffa8b(%rip), %rax    # 0x6086d0
addq (%rax,%rbp,8), %rbx
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x40a4a2
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 0xb0(%rsp), %rdi
callq 0x490a30
leaq 0x2f8(%rsp), %rdi
callq 0x485d10
incl %r12d
jmp 0x4089bb
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 0x1888b0(%rip), %rdi    # 0x59159d
leaq 0x187385(%rip), %rsi    # 0x590079
leaq 0x18891c(%rip), %rcx    # 0x591617
movl $0x2e1, %edx            # imm = 0x2E1
callq 0x4d36d0
leaq 0x1889b0(%rip), %rdi    # 0x5916bc
leaq 0x187366(%rip), %rsi    # 0x590079
leaq 0x1888fd(%rip), %rcx    # 0x591617
movl $0x2e5, %edx            # imm = 0x2E5
callq 0x4d36d0
leaq 0x187d3a(%rip), %rdi    # 0x590a65
leaq 0x187347(%rip), %rsi    # 0x590079
leaq 0x1888de(%rip), %rcx    # 0x591617
movl $0x2e3, %edx            # imm = 0x2E3
callq 0x4d36d0
leaq 0x188a30(%rip), %rdi    # 0x59177a
leaq 0x187328(%rip), %rsi    # 0x590079
leaq 0x1888bf(%rip), %rcx    # 0x591617
movl $0x2e7, %edx            # imm = 0x2E7
callq 0x4d36d0
leaq 0x1888e8(%rip), %rdi    # 0x591651
leaq 0x187309(%rip), %rsi    # 0x590079
leaq 0x1888a0(%rip), %rcx    # 0x591617
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x4d36d0
leaq 0x188aa6(%rip), %rdi    # 0x59182e
leaq 0x1872ea(%rip), %rsi    # 0x590079
leaq 0x188881(%rip), %rcx    # 0x591617
movl $0x2e9, %edx            # imm = 0x2E9
callq 0x4d36d0
movq $0x609900, %rdi         # imm = 0x609900
leaq 0x187272(%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 0x408e3d
jmp 0x408dd7
jmp 0x408dd7
movq %rax, %rbx
jmp 0x408e30
jmp 0x408dde
movq %rax, %rbx
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 0xb0(%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