// File: /workspace/github_cpp_makefile_star2_O2/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_output_network_packets(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_output_network_packets(string outputNetworkPacketsFileName)
{
	config_data_collect_write_back = new uint16_t*[outNetworks];
	for(uint8_t i=0; i < outNetworks; i++)
    config_data_collect_write_back[i] = new uint16_t[size_config_data_collect_write_back[i]];

	uint16_t it=0;
	ifstream inFile(outputNetworkPacketsFileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << outputNetworkPacketsFileName.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;

		uint8_t		network 	= stoul(token1);
		uint16_t 	idx				= stoul(token2);
		uint16_t 	offset 		= stoul(token3);

		assert(network < outNetworks && "network number should be less than total networks for outputting data.");
		assert(idx < size_config_data_collect_write_back[network] &&
			"packet number should be less than total data collected via network in an execution pass.");
		assert(offset < size_config_data_collect_write_back[network] &&
			"packet's offset number should be less than total data collected via network in an execution pass.");

		config_data_collect_write_back[network][idx] = offset;
	}
	inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rsi, %rbx
movzbl 0x20077e(%rip), %r14d   # 0x6085e4
movl %r14d, %edi
shll $0x3, %edi
callq 0x414190
movq %rax, 0x200790(%rip)    # 0x608608
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x407ea3
movq 0x200769(%rip), %rax    # 0x6085f0
movzwl (%rax,%r15,2), %edi
addl %edi, %edi
callq 0x414190
movq 0x20076e(%rip), %rcx    # 0x608608
movq %rax, (%rcx,%r15,8)
incq %r15
jmp 0x407e7b
movq (%rbx), %rsi
leaq 0x90(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x45cbc0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x4080e1
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x50(%rsp), %r12
leaq 0x30(%rsp), %r13
leaq 0x10(%rsp), %rbp
pushq $0xa
popq %rbx
movl $0x0, 0xc(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x493470
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40804e
cmpw $0x1, 0xc(%rsp)
jbe 0x408045
leaq 0x298(%rsp), %r14
movq %r14, %rdi
leaq 0x70(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x488420
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
xorl %ecx, %ecx
movb %cl, 0x60(%rsp)
movb %cl, 0x40(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movb %cl, 0x20(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x415af0
movq %rax, %rdi
movq %r13, %rsi
callq 0x415af0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x415af0
movq %r12, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movq %rax, %r15
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movq %rax, %r14
movq %rbp, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x40a485
movzbl %r15b, %ecx
movzbl 0x20060c(%rip), %edx    # 0x6085e4
cmpl %edx, %ecx
jae 0x408084
movzwl %r14w, %esi
movq 0x200605(%rip), %rdx    # 0x6085f0
movzbl %r15b, %ecx
movl %ecx, %edi
movzwl (%rdx,%rdi,2), %edx
cmpl %edx, %esi
jae 0x4080a3
movzwl %ax, %esi
cmpl %edx, %esi
jae 0x4080c2
movq 0x2005f9(%rip), %rdx    # 0x608608
movq (%rdx,%rcx,8), %rcx
movzwl %r14w, %edx
movw %ax, (%rcx,%rdx,2)
movq %rbp, %rdi
callq 0x490a30
movq %r13, %rdi
callq 0x490a30
movq %r12, %rdi
callq 0x490a30
leaq 0x298(%rsp), %rdi
callq 0x485d10
jmp 0x407efc
incl 0xc(%rsp)
jmp 0x407efc
leaq 0x90(%rsp), %rdi
callq 0x45d170
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x45d520
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x189056(%rip), %rdi    # 0x5910e1
leaq 0x187fe7(%rip), %rsi    # 0x590079
leaq 0x1890aa(%rip), %rcx    # 0x591143
movl $0x267, %edx            # imm = 0x267
callq 0x4d36d0
leaq 0x1890d5(%rip), %rdi    # 0x59117f
leaq 0x187fc8(%rip), %rsi    # 0x590079
leaq 0x18908b(%rip), %rcx    # 0x591143
movl $0x269, %edx            # imm = 0x269
callq 0x4d36d0
leaq 0x189147(%rip), %rdi    # 0x591210
leaq 0x187fa9(%rip), %rsi    # 0x590079
leaq 0x18906c(%rip), %rcx    # 0x591143
movl $0x26b, %edx            # imm = 0x26B
callq 0x4d36d0
movq $0x609900, %rdi         # imm = 0x609900
leaq 0x187f31(%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 0x40815b
jmp 0x40811e
jmp 0x408123
jmp 0x408123
jmp 0x408123
jmp 0x40811e
movq %rax, %rbx
jmp 0x408151
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x490a30
leaq 0x30(%rsp), %rdi
callq 0x490a30
leaq 0x50(%rsp), %rdi
callq 0x490a30
leaq 0x298(%rsp), %rdi
callq 0x485d10
leaq 0x70(%rsp), %rdi
callq 0x490a30
leaq 0x90(%rsp), %rdi
callq 0x45d520
movq %rbx, %rdi
callq 0x4bea70