// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq (%rsi), %rsi
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x460c10
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x120(%rsp,%rax)
jne 0x40c06b
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsp), %rbp
leaq 0x40(%rsp), %r13
movl $0x0, 0x14(%rsp)
movq 0x100(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4653c0
movsbl %al, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x419ec0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40bed9
movl 0x14(%rsp), %eax
cmpw $0x1, %ax
jbe 0x40bece
leaq 0x308(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x48c470
movq %rbp, 0x20(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x28(%rsp)
movb %cl, 0x30(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq %rcx, 0xe8(%rsp)
movb %cl, 0xf0(%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)
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %rcx, 0x88(%rsp)
movb %cl, 0x90(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movb %cl, 0x70(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x419b40
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x419b40
movq 0x20(%rsp), %r12
callq 0x4c7aa0
movq %rax, %r14
movl (%rax), %r15d
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r12, 0x8(%rsp)
je 0x40bfc1
movq %rax, %rbp
movl (%r14), %eax
testl %eax, %eax
je 0x40bb0e
cmpl $0x22, %eax
jne 0x40bb11
jmp 0x40c05f
movl %r15d, (%r14)
movq 0xe0(%rsp), %r15
movl (%r14), %ebx
movl $0x0, (%r14)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x40bfcd
movq %rax, %r12
movl (%r14), %eax
testl %eax, %eax
je 0x40bb54
cmpl $0x22, %eax
jne 0x40bb57
jmp 0x40c03b
movl %ebx, (%r14)
movq 0xc0(%rsp), %r15
movl (%r14), %ebx
movl $0x0, (%r14)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x40bfa9
movl (%r14), %ecx
testl %ecx, %ecx
je 0x40bb97
cmpl $0x22, %ecx
jne 0x40bb9a
jmp 0x40c047
movl %ebx, (%r14)
movb %al, 0x5(%rsp)
movq 0xa0(%rsp), %r15
movl (%r14), %ebx
movl $0x0, (%r14)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x40bfb5
movl (%r14), %ecx
testl %ecx, %ecx
je 0x40bbde
cmpl $0x22, %ecx
jne 0x40bbe1
jmp 0x40c023
movl %ebx, (%r14)
movw %ax, 0x6(%rsp)
movq 0x80(%rsp), %r15
movl (%r14), %ebx
movl $0x0, (%r14)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x40bf5f
movl (%r14), %ecx
testl %ecx, %ecx
je 0x40bc26
cmpl $0x22, %ecx
jne 0x40bc29
jmp 0x40c053
movl %ebx, (%r14)
movl %eax, 0x18(%rsp)
movq 0x60(%rsp), %r15
movl (%r14), %ebx
movl $0x0, (%r14)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x4de720
cmpq %r15, 0x8(%rsp)
je 0x40bfd9
movl (%r14), %ecx
testl %ecx, %ecx
je 0x40bc6a
cmpl $0x22, %ecx
jne 0x40bc6d
jmp 0x40c02f
movl %ebx, (%r14)
movl %eax, 0x1c(%rsp)
movzwl %bp, %ecx
cmpl $0x2, %ecx
jb 0x40bf21
movzwl 0x1ff8ce(%rip), %edx    # 0x60b552
addl $0x2, %edx
cmpl %edx, %ecx
jae 0x40bf21
movzbl %r12b, %ecx
movzbl 0x1ff94a(%rip), %edx    # 0x60b5e4
cmpl %edx, %ecx
leaq 0x100(%rsp), %rbx
jae 0x40bf6b
movzbl 0x5(%rsp), %ecx
cmpb 0x1ff8a1(%rip), %cl     # 0x60b556
jae 0x40bf40
movq 0x1ff926(%rip), %rdx    # 0x60b5e8
movzwl (%rdx,%rcx,2), %ecx
cmpw %cx, 0x6(%rsp)
jae 0x40bfe5
movl 0x18(%rsp), %edx
decl %edx
cmpl %ecx, %edx
jae 0x40c004
cmpl %eax, 0x1ff8cf(%rip)    # 0x60b5b4
jbe 0x40bf8a
movq 0x1ff9be(%rip), %rax    # 0x60b6b0
movzwl %bp, %r14d
leal (,%r14,8), %ecx
movq (%rax,%rcx), %rax
movzbl %r12b, %edx
movb $0x1, (%rax,%rdx)
movq 0x1ff9a7(%rip), %rax    # 0x60b6b8
movq (%rax,%rcx), %rax
leaq (%rdx,%rdx,2), %r15
leaq (%rax,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bd38
movb 0x5(%rsp), %al
movb %al, (%rsi)
incq 0x8(%rdi)
leaq 0x30(%rsp), %rbp
jmp 0x40bd47
leaq 0x5(%rsp), %rdx
leaq 0x30(%rsp), %rbp
callq 0x40ec6e
movq 0x1ff972(%rip), %rax    # 0x60b6c0
movq (%rax,%r14,8), %rax
leaq (%rax,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bd72
movzwl 0x6(%rsp), %eax
movw %ax, (%rsi)
addq $0x2, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40bd7c
leaq 0x6(%rsp), %rdx
callq 0x40ed60
movq 0x1ff945(%rip), %rax    # 0x60b6c8
movq (%rax,%r14,8), %rax
leaq (%rax,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bda5
movl 0x18(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40bdaf
leaq 0x18(%rsp), %rdx
callq 0x40e9fa
movq 0x1ff91a(%rip), %rax    # 0x60b6d0
movq (%rax,%r14,8), %rax
leaq (%rax,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x40bdd8
movl 0x1c(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x40bde2
leaq 0x1c(%rsp), %rdx
callq 0x40e9fa
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x40bdfe
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x40be23
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x40be48
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x40be6d
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x40be92
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x40bea9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x308(%rsp), %rdi
movq $0x606328, %rsi         # imm = 0x606328
callq 0x48c720
leaq 0x380(%rsp), %rdi
callq 0x4667e0
movl 0x14(%rsp), %eax
incl %eax
movl %eax, 0x14(%rsp)
jmp 0x40b96f
leaq 0x100(%rsp), %rdi
callq 0x4611c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x40bf02
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x100(%rsp), %rdi
callq 0x461570
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x189675(%rip), %rdi    # 0x59559d
leaq 0x18814a(%rip), %rsi    # 0x594079
leaq 0x1896e1(%rip), %rcx    # 0x595617
movl $0x2e1, %edx            # imm = 0x2E1
callq 0x4d75c0
leaq 0x188b1e(%rip), %rdi    # 0x594a65
leaq 0x18812b(%rip), %rsi    # 0x594079
leaq 0x1896c2(%rip), %rcx    # 0x595617
movl $0x2e3, %edx            # imm = 0x2E3
callq 0x4d75c0
leaq 0x189a65(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x1896df(%rip), %rdi    # 0x595651
leaq 0x188100(%rip), %rsi    # 0x594079
leaq 0x189697(%rip), %rcx    # 0x595617
movl $0x2e2, %edx            # imm = 0x2E2
callq 0x4d75c0
leaq 0x18989d(%rip), %rdi    # 0x59582e
leaq 0x1880e1(%rip), %rsi    # 0x594079
leaq 0x189678(%rip), %rcx    # 0x595617
movl $0x2e9, %edx            # imm = 0x2E9
callq 0x4d75c0
leaq 0x189a1b(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x189a0f(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x189a03(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x1899f7(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x1899eb(%rip), %rdi    # 0x5959cb
callq 0x402b8d
leaq 0x1896d0(%rip), %rdi    # 0x5956bc
leaq 0x188086(%rip), %rsi    # 0x594079
leaq 0x18961d(%rip), %rcx    # 0x595617
movl $0x2e5, %edx            # imm = 0x2E5
callq 0x4d75c0
leaq 0x18976f(%rip), %rdi    # 0x59577a
leaq 0x188067(%rip), %rsi    # 0x594079
leaq 0x1895fe(%rip), %rcx    # 0x595617
movl $0x2e7, %edx            # imm = 0x2E7
callq 0x4d75c0
leaq 0x1899a1(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x189995(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x189989(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x18997d(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x189971(%rip), %rdi    # 0x5959cb
callq 0x402c3d
leaq 0x189965(%rip), %rdi    # 0x5959cb
callq 0x402c3d
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x187fa7(%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, %r12
jmp 0x40c1f4
jmp 0x40c0e0
jmp 0x40c0e0
jmp 0x40c0ed
movq %rax, %r12
cmpl $0x0, (%r14)
jne 0x40c0d4
movl %r15d, (%r14)
jmp 0x40c0d4
jmp 0x40c0c8
jmp 0x40c0c8
jmp 0x40c0c8
jmp 0x40c0c8
movq %rax, %r12
cmpl $0x0, (%r14)
jne 0x40c0d4
movl %ebx, (%r14)
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %rbp
jmp 0x40c0f5
movq %rax, %r12
leaq 0x50(%rsp), %rbx
jmp 0x40c1dd
movq %rax, %r12
leaq 0x50(%rsp), %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x40c111
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x40c136
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c15b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c180
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x40c1a5
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x40c1bc
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x416ca0
movq $0x606328, %rsi         # imm = 0x606328
leaq 0x308(%rsp), %rdi
callq 0x48c720
leaq 0x380(%rsp), %rdi
callq 0x4667e0
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x40c1f4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x416ca0
leaq 0x100(%rsp), %rdi
callq 0x461570
movq %r12, %rdi
callq 0x4c2960
nop