// File: /workspace/github_c_makefile_star2_O1/pwelke[P]GraphMiningTools/loading.c
// Function: iterateFile
struct Graph* iterateFile() {
	int i;
	struct Graph* g = getGraph(FI_GP);
	const char* currentPosition;

	if (!FI_DATABASE) {
		fprintf(stderr, "Could not access input stream.\n");
		dumpGraph(FI_GP, g);
		return NULL;
	}

	/* copy header line to local variable
	dependent on GNU C */
	if (getline(HEAD_PTR, HEAD_SIZE, FI_DATABASE) == -1) {
		fprintf(stderr, "Could not read graph header from input stream.\n");
		dumpGraph(FI_GP, g);
		return NULL;
	}
			
	/* parse header */	
	if (parseHeader(&(g->number), &(g->activity), &(g->n), &(g->m)) != 4) {
		/* if reading of header does not work anymore, check if we have reached the correct end of the stream */
		if (**HEAD_PTR != '$') {
			fprintf(stderr, "Invalid Graph header: %s\nparsing result: %i %i %i %i\n", *HEAD_PTR, g->number, g->activity, g->n, g->m);
		}
		dumpGraph(FI_GP, g);
		return NULL;
	}

	/* read vertices */
	if ((g->vertices = malloc(g->n * sizeof(struct Vertex*))) == NULL) {
		fprintf(stderr, "Error allocating vertices\n");
		dumpGraph(FI_GP, g);
		return NULL;
	}

	/* copy vertex line to local variable
	dependent on GNU C */
	if (getline(VERTEX_PTR, VERTEX_SIZE, FI_DATABASE) == -1) {
		fprintf(stderr, "Could not read vertex line from input stream.\n");
		dumpGraph(FI_GP, g);
		return NULL;
	}

	/* parse vertex info */
	currentPosition = *VERTEX_PTR;
	for (i=0; i<g->n; ++i) {
		char* label;
		if (grabLabel(&currentPosition, &label) != -1) {
			g->vertices[i] = getVertex(FI_GP->vertexPool);
			g->vertices[i]->label = label;
			g->vertices[i]->number = i;
			g->vertices[i]->isStringMaster = 1;
		} else {
			fprintf(stderr, "Error while parsing vertices\n");
			dumpGraph(FI_GP, g);
			return NULL;
		}
	}
					
	/* copy edge line to local variable
	dependent on GNU C */
	if (getline(EDGE_PTR, EDGE_SIZE, FI_DATABASE) == -1) {
		fprintf(stderr, "Could not read edge line from input stream.\n");
		dumpGraph(FI_GP, g);
		return NULL;
	}

	/* parse edge info */
	currentPosition = *EDGE_PTR;
	for (i=0; i<g->m; ++i) {
		char* label;
		int v,w;

		if (parseEdgeNew(&currentPosition, &v, &w, &label) == 3) {
			
			struct VertexList* e = getVertexList(FI_GP->listPool);
			struct VertexList* f = getVertexList(FI_GP->listPool);

			/* edge */
			e->startPoint = g->vertices[v-1];
			e->endPoint = g->vertices[w-1];
			e->label = label;
			e->isStringMaster = 1;

			addEdge(e->startPoint, e);

			/* reverse edge*/
			f->startPoint = g->vertices[w-1];
			f->endPoint = g->vertices[v-1];
			f->label = e->label;

			addEdge(f->startPoint, f);
		} else {
			fprintf(stderr, "Error while parsing edges\n");
			dumpGraph(FI_GP, g);
			return NULL;
		}
	}
	return g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x1fe11(%rip), %rdi     # 0x2d188
callq 0x147d7
movq %rax, %rbx
movq 0x1fdfa(%rip), %rdx     # 0x2d180
testq %rdx, %rdx
je 0xd68c
movq %rax, %r14
movq 0x1fdf7(%rip), %rdi     # 0x2d190
movq 0x1fdf8(%rip), %rsi     # 0x2d198
callq 0x1200
cmpq $-0x1, %rax
je 0xd699
leaq 0x8(%r14), %rdi
leaq 0xc(%r14), %rsi
addq $0x4, %r14
movq %rbx, %rdx
movq %r14, %rcx
callq 0xd6fa
cmpl $0x4, %eax
jne 0xd529
movslq (%rbx), %rdi
shlq $0x3, %rdi
callq 0x1190
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0xd6a6
movq 0x1fdb1(%rip), %rdi     # 0x2d1a0
movq 0x1fdb2(%rip), %rsi     # 0x2d1a8
movq 0x1fd83(%rip), %rdx     # 0x2d180
callq 0x1200
cmpq $-0x1, %rax
je 0xd6e0
movq %r14, 0x20(%rsp)
movq 0x1fd88(%rip), %rax     # 0x2d1a0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, (%rbx)
jle 0xd55f
movq 0x8(%rsp), %r15
callq 0x1260
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
movq (%rax), %rax
movsbq (%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0xd456
xorl %r14d, %r14d
movq %r15, %rcx
jmp 0xd46d
xorl %r14d, %r14d
movsbq 0x1(%r15,%r14), %rcx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0xd459
leaq (%r15,%r14), %rcx
movsbq (%rcx), %rdx
testb $0x20, 0x1(%rax,%rdx,2)
jne 0xd48c
xorl %ebp, %ebp
movsbq 0x1(%rcx,%rbp), %rdx
incq %rbp
testb $0x20, 0x1(%rax,%rdx,2)
je 0xd47a
jmp 0xd48e
xorl %ebp, %ebp
testq %rbp, %rbp
je 0xd4cc
leaq 0x1(%rbp), %rdi
callq 0x1190
movq %rax, %r13
testq %rax, %rax
je 0xd4cf
addq %r14, %r15
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1170
movb $0x0, (%r13,%rbp)
addq %rbp, %r15
movq %r15, 0x8(%rsp)
cmpl $-0x1, %ebp
sete %r14b
jmp 0xd4d2
xorl %r13d, %r13d
xorl %r14d, %r14d
testb %r14b, %r14b
jne 0xd51f
movq 0x1fcaa(%rip), %rax     # 0x2d188
movq 0x10(%rax), %rdi
callq 0x145b2
movq 0x10(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rcx
movq %r13, (%rcx)
movq (%rax,%r12,8), %rax
movl %r12d, 0x18(%rax)
movl $0x1, 0x24(%rax)
testb %r14b, %r14b
jne 0xd54b
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0xd43b
jmp 0xd55f
movq %rbx, %rdi
callq 0x12d4
jmp 0xd509
movq 0x1fc60(%rip), %rax     # 0x2d190
movq (%rax), %rdx
cmpb $0x24, (%rdx)
jne 0xd6b3
movq 0x1fc45(%rip), %rdi     # 0x2d188
movq %rbx, %rsi
callq 0x14832
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1fc4a(%rip), %rdi     # 0x2d1b0
movq 0x1fc4b(%rip), %rsi     # 0x2d1b8
movq 0x1fc0c(%rip), %rdx     # 0x2d180
callq 0x1200
cmpq $-0x1, %rax
je 0xd6ed
movq 0x1fc26(%rip), %rax     # 0x2d1b0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %r14
cmpl $0x0, (%r14)
jle 0xd54d
xorl %ebp, %ebp
movq %rbx, 0x28(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0xd910
movl %eax, %r15d
cmpl $0x3, %eax
jne 0xd682
movq 0x1fbb8(%rip), %rax     # 0x2d188
movq 0x18(%rax), %rdi
callq 0x1432b
movq %rax, %r12
movq 0x1fba5(%rip), %rax     # 0x2d188
movq 0x18(%rax), %rdi
callq 0x1432b
movq %rax, %r13
movq 0x10(%rbx), %rax
movslq 0x1c(%rsp), %r14
movq -0x8(%rax,%r14,8), %rdi
movq %rdi, 0x10(%r12)
movl %r15d, 0x10(%rsp)
movq %rbx, %r15
movslq 0x18(%rsp), %rbx
movq -0x8(%rax,%rbx,8), %rax
movq %rax, 0x18(%r12)
movq 0x30(%rsp), %rax
movq %rax, (%r12)
movl $0x1, 0x28(%r12)
movq %r12, %rsi
callq 0x7cd0
movq 0x10(%r15), %rax
movl 0x10(%rsp), %r15d
movq -0x8(%rax,%rbx,8), %rdi
movq %rdi, 0x10(%r13)
movq -0x8(%rax,%r14,8), %rax
movq 0x20(%rsp), %r14
movq %rax, 0x18(%r13)
movq (%r12), %rax
movq %rax, (%r13)
movq %r13, %rsi
callq 0x7cd0
cmpl $0x3, %r15d
jne 0xd54b
incl %ebp
cmpl (%r14), %ebp
movq 0x28(%rsp), %rbx
jl 0xd5a4
jmp 0xd54d
movq %rbx, %rdi
callq 0x1304
jmp 0xd663
movq %rbx, %rdi
callq 0x13f4
jmp 0xd54b
movq %rbx, %rdi
callq 0x13c4
jmp 0xd54b
movq %rbx, %rdi
callq 0x1394
jmp 0xd54b
movq 0x1f93e(%rip), %rax     # 0x2cff8
movq (%rax), %rdi
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
movl (%rbx), %r9d
movl 0x4(%rbx), %eax
movl %eax, (%rsp)
leaq 0x12f83(%rip), %rsi     # 0x20657
xorl %eax, %eax
callq 0x1160
jmp 0xd53c
movq %rbx, %rdi
callq 0x1364
jmp 0xd54b
movq %rbx, %rdi
callq 0x1334
jmp 0xd54b