// File: /workspace/github_cpp_makefile_star2_O1/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 0x12231(%rip), %rsi     # 0x14c11
movq %rbx, %rdi
callq 0x21c0
testq %rax, %rax
je 0x2cce
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
leaq 0x50(%rsp), %r12
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 0x2a5c
cmpl $0x70, %eax
je 0x2c04
movl %eax, %ecx
andl $-0x5, %ecx
cmpl $0x61, %ecx
jne 0x2a6e
cmpl $0xa, %eax
jne 0x2a78
xorl %eax, %eax
jmp 0x2a98
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2a5c
movl $0xa, %eax
cmpl $-0x1, %eax
jne 0x2a33
jmp 0x2c94
xorl %r12d, %r12d
movb %al, 0x50(%rsp,%r12)
incq %r12
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2a7b
movl %r12d, %eax
leaq 0x50(%rsp), %r12
movb $0x0, 0x50(%rsp,%rax)
testb $0x1, 0xc(%rsp)
je 0x2ac9
movq %r12, %rdi
leaq 0xf62f(%rip), %rsi      # 0x120dd
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2b26
jmp 0x2cb1
movq %r12, %rdi
leaq 0xf62c(%rip), %rsi      # 0x120ff
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x48(%rsp), %r8
xorl %eax, %eax
callq 0x2130
cmpl $0x3, %eax
je 0x2b26
jmp 0x2cb1
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x36a4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2b26
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 0x2af3
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 0x2b69
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2b71
movq %rbp, %rdx
callq 0x38bc
cmpb $0x0, 0xb(%rsp)
je 0x2a69
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 0x2bce
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x36a4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2b7c
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x2b7c
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 0x2bf7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2a69
movq %rbp, %rdx
callq 0x38bc
jmp 0x2a69
movl $0x70, %eax
xorl %r12d, %r12d
movb %al, 0x50(%rsp,%r12)
incq %r12
movq %r15, %rdi
callq 0x2280
cmpl $0xa, %eax
jne 0x2c0c
movl %r12d, %eax
movb $0x0, 0x50(%rsp,%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0xf45b(%rip), %rsi      # 0x12093
movq %r14, %rdx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2c8b
movl $0x0, 0xc(%rsp)
movq %r12, %rdi
leaq 0xf442(%rip), %rsi      # 0x120a0
movq %r14, %rdx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x2, %eax
je 0x2c8b
movl $0x0, 0xc(%rsp)
leaq 0xf42a(%rip), %rdi      # 0x120ab
movq %r12, %rsi
xorl %eax, %eax
callq 0x28bb
movl 0xc(%rsp), %eax
jmp 0x2a27
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 0xf42f(%rip), %rdi      # 0x120e7
leaq 0x50(%rsp), %rsi
xorl %eax, %eax
callq 0x28bb
movl $0x1, %edi
callq 0x21f0
leaq 0xf3a2(%rip), %rdi      # 0x12077
movq %rbx, %rsi
jmp 0x2cbd
jmp 0x2cdc
movq %rax, %r14
jmp 0x2cfd
jmp 0x2ce3
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2cfd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x35fc
movq %r14, %rdi
callq 0x22d0