// File: /workspace/github_cpp_makefile_star2_O3/biotomas[P]ipasir/app/genipalsp/genipalsp.cpp
// Function: loadGraph(char const*, bool)
Graph loadGraph(const char* filename, bool backEdges = false) {
	FILE* f = fopen(filename, "r");
	if (f == NULL) {
		log("File '%s' cannot be opened\n", filename);
		exit(1);
	}
	Graph g;
	int c = 0;
	bool edge = true;

	while (c != EOF) {
		c = fgetc(f);

		// problem definition line
		if (c == 'p') {
			char pline[512];
			int i = 0;
			while (c != '\n') {
				pline[i++] = c;
				c = fgetc(f);
			}
			pline[i] = 0;
			if (2 != sscanf(pline, "p edge %d %d", &(g.verticesCount), &(g.edgesCount))) {
				edge = false;
				if (2 != sscanf(pline, "p sp %d %d", &(g.verticesCount), &(g.edgesCount))) {
					log("Failed to parse the problem definition line (%s)\n", pline);
				}
			}
			continue;
		}
		// comment
		if (c == 'c') {
			// skip this line
			while(c != '\n') {
				c = fgetc(f);
			}
			continue;
		}
		// edge
		if (c == 'e' || c == 'a') {
			char pline[512];
			int i = 0;
			while (c != '\n') {
				pline[i++] = c;
				c = fgetc(f);
			}
			pline[i] = 0;
			size_t start, end, weight;
			if (edge && 2 != sscanf(pline, "e %lu %lu", &start , &end)) {
				log("Invalid edge line (%s)\n", pline);
				exit(1);
			}
			if (!edge && 3 != sscanf(pline, "a %lu %lu %lu", &start , &end, &weight)) {
				log("Invalid edge line (%s)\n", pline);
				exit(1);
			}
			while (g.neighbours.size() <= start) {
				g.neighbours.push_back(vector<int>());
			}
			g.neighbours[start].push_back(end);

			if (edge && backEdges) {
				while (g.neighbours.size() <= end) {
					g.neighbours.push_back(vector<int>());
				}
				g.neighbours[end].push_back(start);
			}
			continue;
		}
	}
	fclose(f);
	return g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %edx, 0x3c(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1220d(%rip), %rsi     # 0x14bed
movq %rbx, %rdi
callq 0x21c0
testq %rax, %rax
je 0x2cc7
movq %rax, %r15
leaq 0x8(%r14), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movq $0x0, 0x18(%r14)
leaq 0x4(%r14), %rax
movq %rax, 0x40(%rsp)
movb $0x1, %al
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x10(%rsp), %rbp
movl %eax, 0xc(%rsp)
andb 0x3c(%rsp), %al
movb %al, 0xb(%rsp)
movq %r15, %rdi
callq 0x2280
cmpl $0x63, %eax
je 0x2aa0
cmpl $0x70, %eax
je 0x2bfd
movl %eax, %ecx
andl $-0x5, %ecx
cmpl $0x61, %ecx
jne 0x2ab2
xorl %r12d, %r12d
movb %al, 0x50(%rsp,%r12)
incq %r12
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2a51
movl %r12d, %eax
movb $0x0, 0x50(%rsp,%rax)
testb $0x1, 0xc(%rsp)
je 0x2ac0
leaq 0x50(%rsp), %rdi
leaq 0xf65c(%rip), %rsi      # 0x120dd
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2b1f
jmp 0x2caa
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2aa0
movl $0xa, %eax
cmpl $-0x1, %eax
jne 0x2a2e
jmp 0x2c8d
leaq 0x50(%rsp), %rdi
leaq 0xf633(%rip), %rsi      # 0x120ff
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x48(%rsp), %r8
xorl %eax, %eax
callq 0x2130
cmpl $0x3, %eax
je 0x2b1f
jmp 0x2caa
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x36ce
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2b1f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq 0x8(%r14), %rax
movq 0x10(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
movq 0x30(%rsp), %rcx
cmpq %rcx, %rdx
jbe 0x2aec
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2b62
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2b6a
movq %rbp, %rdx
callq 0x38ce
cmpb $0x0, 0xb(%rsp)
je 0x2aad
movq 0x8(%r14), %rax
movq 0x10(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
movq 0x28(%rsp), %rcx
cmpq %rcx, %rdx
ja 0x2bc7
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x36ce
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2b75
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x2b75
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl 0x30(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2bf0
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2aad
movq %rbp, %rdx
callq 0x38ce
jmp 0x2aad
movl $0x70, %eax
xorl %r12d, %r12d
movb %al, 0x50(%rsp,%r12)
incq %r12
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2c05
movl %r12d, %eax
movb $0x0, 0x50(%rsp,%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0xf462(%rip), %rsi      # 0x12093
movq %r14, %rdx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2c84
movl $0x0, 0xc(%rsp)
movq %r12, %rdi
leaq 0xf449(%rip), %rsi      # 0x120a0
movq %r14, %rdx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2c84
movl $0x0, 0xc(%rsp)
leaq 0xf431(%rip), %rdi      # 0x120ab
movq %r12, %rsi
xorl %eax, %eax
callq 0x28bb
movl 0xc(%rsp), %eax
jmp 0x2a22
movq %r15, %rdi
callq 0x2140
movq %r14, %rax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf436(%rip), %rdi      # 0x120e7
leaq 0x50(%rsp), %rsi
xorl %eax, %eax
callq 0x28bb
movl $0x1, %edi
callq 0x21f0
leaq 0xf3a9(%rip), %rdi      # 0x12077
movq %rbx, %rsi
jmp 0x2cb6
jmp 0x2cd5
movq %rax, %r14
jmp 0x2cf6
jmp 0x2cdc
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2cf6
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x3620
movq %r14, %rdi
callq 0x22d0