// File: cssartori[P]ga-qap/src/datafile.cpp
// Function: DataFile::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int DataFile::read(const std::string& filename){
	FILE *file = fopen(filename.c_str(), "rt");

	if(file == NULL)
		return -1;
	int temp;
	//reads the number of facilities
	temp = fscanf(file, "%li\n\n", &(this->n));
	
	this->flow.assign(this->n, std::vector<int>(this->n, 0));
	this->distance.assign(this->n, std::vector<int>(this->n, 0));

	//reads flow and distance matrix
	for(size_t i=0;i<this->n;i++)
		for(size_t j=0;j<this->n;j++)
			temp = fscanf(file, "%i", &(this->flow[i][j]));

	for(size_t i=0;i<this->n;i++)
		for(size_t j=0;j<this->n;j++)
			temp = fscanf(file, "%i", &(this->distance[i][j]));

	/*Just to avoid compilation warnings*/
	temp+=1;

	fclose(file);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
leaq 0xcd1a(%rip), %rsi      # 0xf25b
callq 0x2220
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x255d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x285b
movq -0xa0(%rbp), %rdx
movq -0x20(%rbp), %rdi
addq $0x30, %rdx
leaq 0xca91(%rip), %rsi      # 0xf004
xorl %eax, %eax
callq 0x2300
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, -0x24(%rbp)
movq %rax, %rcx
movq %rcx, -0xb8(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0xb0(%rbp)
movl $0x0, -0x44(%rbp)
leaq -0x45(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x2bb0
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rcx
leaq -0x40(%rbp), %rdi
leaq -0x44(%rbp), %rdx
callq 0x2bd0
jmp 0x25cf
movq -0xb0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x2b80
jmp 0x25e8
leaq -0x40(%rbp), %rdi
callq 0x2c50
leaq -0x45(%rbp), %rdi
callq 0x2cb0
movq -0xa0(%rbp), %rax
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, -0xd0(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0xc8(%rbp)
movl $0x0, -0x74(%rbp)
leaq -0x75(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x2bb0
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0x2bd0
jmp 0x264e
movq -0xc8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x2b80
jmp 0x2667
leaq -0x70(%rbp), %rdi
callq 0x2c50
leaq -0x75(%rbp), %rdi
callq 0x2cb0
movq $0x0, -0x80(%rbp)
movq -0xa0(%rbp), %rcx
movq -0x80(%rbp), %rax
cmpq 0x30(%rcx), %rax
jae 0x2787
movq $0x0, -0x88(%rbp)
movq -0xa0(%rbp), %rcx
movq -0x88(%rbp), %rax
cmpq 0x30(%rcx), %rax
jae 0x2774
movq -0xa0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x80(%rbp), %rsi
callq 0x2cd0
movq %rax, %rdi
movq -0x88(%rbp), %rsi
callq 0x2cf0
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
leaq 0xc916(%rip), %rsi      # 0xf00a
movb $0x0, %al
callq 0x2300
movl %eax, -0x24(%rbp)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x26a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2735
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2c50
leaq -0x45(%rbp), %rdi
callq 0x2cb0
jmp 0x2867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2766
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2c50
leaq -0x75(%rbp), %rdi
callq 0x2cb0
jmp 0x2867
jmp 0x2776
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2681
movq $0x0, -0x90(%rbp)
movq -0xa0(%rbp), %rcx
movq -0x90(%rbp), %rax
cmpq 0x30(%rcx), %rax
jae 0x2842
movq $0x0, -0x98(%rbp)
movq -0xa0(%rbp), %rcx
movq -0x98(%rbp), %rax
cmpq 0x30(%rcx), %rax
jae 0x2829
movq -0xa0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
addq $0x18, %rdi
movq -0x90(%rbp), %rsi
callq 0x2cd0
movq %rax, %rdi
movq -0x98(%rbp), %rsi
callq 0x2cf0
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
leaq 0xc7ff(%rip), %rsi      # 0xf00a
movb $0x0, %al
callq 0x2300
movl %eax, -0x24(%rbp)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x27b5
jmp 0x282b
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x2792
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x21a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x22d0