// File: /workspace/github_cpp_makefile_star2_O3/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 $0x488, %rsp            # imm = 0x488
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0x100(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x461750
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x120(%rsp,%rax)
jne 0x40c099
leaq 0xf0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x30(%rsp), %rbp
movl $0x0, 0x14(%rsp)
leaq (%rsp,%rax), %rdi
addq $0x100, %rdi            # imm = 0x100
movl $0xa, %esi
callq 0x465f00
movsbl %al, %edx
leaq 0x100(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x41aa00
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40befe
movl 0x14(%rsp), %eax
cmpw $0x1, %ax
jbe 0x40bee7
leaq 0x308(%rsp), %rbx
movq %rbx, %rdi
leaq 0xe0(%rsp), %rsi
movl $0x8, %edx
callq 0x48cfb0
movq %r15, 0x80(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x88(%rsp)
movb %cl, 0x90(%rsp)
movq %r12, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movb %cl, 0x70(%rsp)
movq %r13, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movb %cl, 0x50(%rsp)
movq %rbp, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movb %cl, 0x30(%rsp)
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %rcx, 0xc8(%rsp)
movb %cl, 0xd0(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %rcx, 0xa8(%rsp)
movb %cl, 0xb0(%rsp)
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x41a680
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x41a680
movq 0x80(%rsp), %r14
callq 0x4c85e0
movq %rax, %rbx
movl (%rax), %r12d
movl $0x0, (%rax)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r14, 0x8(%rsp)
je 0x40bfef
movq %rax, %rbp
movl (%rbx), %r15d
testl %r15d, %r15d
je 0x40bb2f
cmpl $0x22, %r15d
jne 0x40bb35
jmp 0x40c08d
movl %r12d, (%rbx)
movl %r12d, %r15d
movq 0x60(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40bffb
movq %rax, %r14
movl (%rbx), %r13d
testl %r13d, %r13d
je 0x40bb73
cmpl $0x22, %r13d
jne 0x40bb79
jmp 0x40c069
movl %r15d, (%rbx)
movl %r15d, %r13d
movq 0x40(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40bfd7
movl (%rbx), %r15d
testl %r15d, %r15d
je 0x40bbb4
cmpl $0x22, %r15d
jne 0x40bbba
jmp 0x40c075
movl %r13d, (%rbx)
movl %r13d, %r15d
movb %al, 0x5(%rsp)
movq 0x20(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40bfe3
movl (%rbx), %r13d
testl %r13d, %r13d
je 0x40bbf9
cmpl $0x22, %r13d
jne 0x40bbff
jmp 0x40c051
movl %r15d, (%rbx)
movl %r15d, %r13d
movw %ax, 0x6(%rsp)
movq 0xc0(%rsp), %r12
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40bf8d
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x40bc3f
cmpl $0x22, %ecx
jne 0x40bc42
jmp 0x40c081
movl %r13d, (%rbx)
movl %eax, 0x18(%rsp)
movq 0xa0(%rsp), %r12
movl (%rbx), %r15d
movl $0x0, (%rbx)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x8(%rsp)
je 0x40c007
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x40bc84
cmpl $0x22, %ecx
jne 0x40bc87
jmp 0x40c05d
movl %r15d, (%rbx)
movl %eax, 0x1c(%rsp)
movzwl %bp, %ecx
cmpl $0x2, %ecx
jb 0x40bf4f
movzwl 0x1ff8b4(%rip), %edx    # 0x60b552
addl $0x2, %edx
cmpl %edx, %ecx
jae 0x40bf4f
movzbl %r14b, %ecx
movzbl 0x1ff930(%rip), %edx    # 0x60b5e4
cmpl %edx, %ecx
jae 0x40bf99
movzbl 0x5(%rsp), %ecx
cmpb 0x1ff88f(%rip), %cl     # 0x60b556
jae 0x40bf6e
movq 0x1ff914(%rip), %rdx    # 0x60b5e8
movzwl (%rdx,%rcx,2), %ecx
cmpw %cx, 0x6(%rsp)
jae 0x40c013
movl 0x18(%rsp), %edx
decl %edx
cmpl %ecx, %edx
jae 0x40c032
cmpl %eax, 0x1ff8bd(%rip)    # 0x60b5b4
jbe 0x40bfb8
movq 0x1ff9ac(%rip), %rax    # 0x60b6b0
movzwl %bp, %ebx
leal (,%rbx,8), %ecx
movq (%rax,%rcx), %rax
movzbl %r14b, %edx
movb $0x1, (%rax,%rdx)
movq 0x1ff997(%rip), %rax    # 0x60b6b8
movq (%rax,%rcx), %rax
leaq (%rdx,%rdx,2), %r14
leaq (%rax,%r14,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bd5a
movb 0x5(%rsp), %al
movb %al, (%rsi)
incq 0x8(%rdi)
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x30(%rsp), %rbp
jmp 0x40bd7b
leaq 0x5(%rsp), %rdx
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x30(%rsp), %rbp
callq 0x40ecd0
movq 0x1ff93e(%rip), %rax    # 0x60b6c0
movq (%rax,%rbx,8), %rax
leaq (%rax,%r14,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bda6
movzwl 0x6(%rsp), %eax
movw %ax, (%rsi)
addq $0x2, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40bdb0
leaq 0x6(%rsp), %rdx
callq 0x40edc2
movq 0x1ff911(%rip), %rax    # 0x60b6c8
movq (%rax,%rbx,8), %rax
leaq (%rax,%r14,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bdd9
movl 0x18(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40bde3
leaq 0x18(%rsp), %rdx
callq 0x40ea5c
movq 0x1ff8e6(%rip), %rax    # 0x60b6d0
movq (%rax,%rbx,8), %rax
leaq (%rax,%r14,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40be0c
movl 0x1c(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40be16
leaq 0x1c(%rsp), %rdx
callq 0x40ea5c
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x40be3b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x40be60
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x40be77
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x40be8e
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40bea5
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x40bec2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x308(%rsp), %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48d260
leaq 0x380(%rsp), %rdi
callq 0x467320
movl 0x14(%rsp), %eax
incl %eax
movl %eax, 0x14(%rsp)
movq 0x100(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x40b9a1
leaq 0x100(%rsp), %rdi
callq 0x461d00
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x40bf30
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x100(%rsp), %rdi
callq 0x4620b0
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x189647(%rip), %rdi    # 0x59559d
leaq 0x18811c(%rip), %rsi    # 0x594079
leaq 0x1896b3(%rip), %rcx    # 0x595617
movl $0x2e1, %edx            # imm = 0x2E1
callq 0x4d8100
leaq 0x188af0(%rip), %rdi    # 0x594a65
leaq 0x1880fd(%rip), %rsi    # 0x594079
leaq 0x189694(%rip), %rcx    # 0x595617
movl $0x2e3, %edx            # imm = 0x2E3
callq 0x4d8100
leaq 0x189a37(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1896b1(%rip), %rdi    # 0x595651
leaq 0x1880d2(%rip), %rsi    # 0x594079
leaq 0x189669(%rip), %rcx    # 0x595617
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x4d8100
leaq 0x18986f(%rip), %rdi    # 0x59582e
leaq 0x1880b3(%rip), %rsi    # 0x594079
leaq 0x18964a(%rip), %rcx    # 0x595617
movl $0x2e9, %edx            # imm = 0x2E9
callq 0x4d8100
leaq 0x1899ed(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1899e1(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1899d5(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1899c9(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1899bd(%rip), %rdi    # 0x5959cb
callq 0x402b51
leaq 0x1896a2(%rip), %rdi    # 0x5956bc
leaq 0x188058(%rip), %rsi    # 0x594079
leaq 0x1895ef(%rip), %rcx    # 0x595617
movl $0x2e5, %edx            # imm = 0x2E5
callq 0x4d8100
leaq 0x189741(%rip), %rdi    # 0x59577a
leaq 0x188039(%rip), %rsi    # 0x594079
leaq 0x1895d0(%rip), %rcx    # 0x595617
movl $0x2e7, %edx            # imm = 0x2E7
callq 0x4d8100
leaq 0x189973(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x189967(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18995b(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x18994f(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x189943(%rip), %rdi    # 0x5959cb
callq 0x402c01
leaq 0x189937(%rip), %rdi    # 0x5959cb
callq 0x402c01
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x187f79(%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 0x40c221
jmp 0x40c124
jmp 0x40c124
jmp 0x40c12c
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x40c10b
movl %r12d, (%rbx)
jmp 0x40c10b
jmp 0x40c0ef
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x40c10b
movl %r13d, (%rbx)
jmp 0x40c10b
jmp 0x40c100
jmp 0x40c100
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x40c10b
movl %r15d, (%rbx)
leaq 0x90(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x30(%rsp), %rbp
jmp 0x40c12f
movq %rax, %r14
jmp 0x40c1fc
movq %rax, %r14
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c154
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c179
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x40c190
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x40c1a7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40c1be
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x40c1db
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4177e0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0x308(%rsp), %rdi
callq 0x48d260
leaq 0x380(%rsp), %rdi
callq 0x467320
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c221
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x100(%rsp), %rdi
callq 0x4620b0
movq %r14, %rdi
callq 0x4c34a0