// File: /workspace/github_c_makefile_star2_O2/veltzer[P]xmeltdown/src/stickread.c
// Function: ReadFile
Skeleton**ReadFile(char* filename)
{
	FILE* infile;
	Skeleton** retval;
	int numread=1, okayflag=1, tempradius;
	Skeleton* current;

	infile=fopen(filename, "r");
	if (infile == NULL) {
		fprintf(stderr, "Cannot open file %s\n", filename);
		exit(1);
	}
	retval=(Skeleton **) calloc (2, sizeof (Skeleton *));
	retval[0]=(Skeleton *) calloc (1, sizeof (Skeleton));
	retval[1]=NULL;
	current=retval[0];
	okayflag=fscanf(infile, "%d, %d, %d\n", &tempradius, &waistx, &waisty);
	while (okayflag >= 0) {
		current->headradius=tempradius;
		current->waistx=waistx;
		current->waisty=waisty;

		Fill (infile, &(current->torso));
		Fill (infile, &(current->rthigh));
		Fill (infile, &(current->rshin));
		Fill (infile, &(current->rfoot));
		Fill (infile, &(current->rbicep));
		Fill (infile, &(current->rtricep));
		Fill (infile, &(current->lthigh));
		Fill (infile, &(current->lshin));
		Fill (infile, &(current->lfoot));
		Fill (infile, &(current->lbicep));
		Fill (infile, &(current->ltricep));

		printf ("Read %d skeleton%s\n",
			numread, numread == 1 ? "." : "s.");
		okayflag=fscanf(infile, "%d, %d, %d\n", &tempradius, &waistx, &waisty);
		if (okayflag >= 0) {
			numread++;
			retval=(Skeleton **)
				realloc (
				retval, (numread+1)*sizeof (Skeleton *));

			retval[numread-1]=(Skeleton *)calloc (1, sizeof (Skeleton));

			retval[numread]=0;
			current=retval[numread-1];
		}else
			printf ("Nothing else to read\n");
	}
	return (retval);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
leaq 0x1bf5(%rip), %rsi      # 0x3047
callq 0x1090
testq %rax, %rax
je 0x1682
movq %rax, %rbx
pushq $0x2
popq %rdi
pushq $0x8
popq %rsi
callq 0x1150
movq %rax, %r14
pushq $0x1
popq %rdi
movl $0x170, %esi            # imm = 0x170
callq 0x1150
movq %rax, %rbp
movq %rax, (%r14)
leaq 0x1c3e(%rip), %rsi      # 0x30c9
leaq 0x3c86(%rip), %rcx      # 0x5118
leaq 0x3c83(%rip), %r8       # 0x511c
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1050
testl %eax, %eax
setns %al
pushq $0x1
popq %r12
pushq $0x18
popq %r13
cmpl $0x1, %r12d
leaq 0x1bb2(%rip), %r15      # 0x3072
leaq 0x1b7e(%rip), %rcx      # 0x3045
cmoveq %rcx, %r15
testb $0x1, %al
je 0x1670
movq %r14, 0x10(%rsp)
leaq 0x10(%rbp), %rsi
leaq 0x30(%rbp), %r14
leaq 0x50(%rbp), %rax
movq %rax, 0x18(%rsp)
movl %r12d, 0xc(%rsp)
leaq 0x70(%rbp), %r12
leaq 0x90(%rbp), %rax
movq %rax, 0x20(%rsp)
leaq 0xb0(%rbp), %rax
movq %rax, 0x28(%rsp)
leaq 0xd0(%rbp), %rax
movq %rax, 0x30(%rsp)
leaq 0xf0(%rbp), %rax
movq %rax, 0x38(%rsp)
leaq 0x110(%rbp), %rax
movq %rax, 0x40(%rsp)
leaq 0x130(%rbp), %rax
movq %rax, 0x48(%rsp)
leaq 0x150(%rbp), %rax
movq %rax, 0x50(%rsp)
movl 0x8(%rsp), %eax
movl %eax, (%rbp)
movl 0x3bc5(%rip), %eax      # 0x5118
movl %eax, 0x4(%rbp)
movl 0x3bc0(%rip), %eax      # 0x511c
movl %eax, 0x8(%rbp)
movq %rbx, %rdi
callq 0x1893
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq %r12, %rsi
movl 0xc(%rsp), %r12d
callq 0x1893
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x1893
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
callq 0x1893
leaq 0x1a6d(%rip), %rdi      # 0x305e
movl %r12d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1030
movq %rbx, %rdi
leaq 0x1ac1(%rip), %rsi      # 0x30c9
leaq 0x8(%rsp), %rdx
leaq 0x3b04(%rip), %rcx      # 0x5118
leaq 0x3b01(%rip), %r8       # 0x511c
xorl %eax, %eax
callq 0x1050
testl %eax, %eax
js 0x165f
incl %r12d
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1180
movq %rax, %r14
movl $0x170, %esi            # imm = 0x170
pushq $0x1
popq %rdi
callq 0x1150
movq %rax, %rbp
movq %rax, -0x10(%r14,%r13)
andq $0x0, -0x8(%r14,%r13)
addq $0x8, %r13
movb $0x1, %al
jmp 0x14b5
leaq 0x1a0f(%rip), %rdi      # 0x3075
callq 0x1060
movq 0x10(%rsp), %r14
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x395f(%rip), %rax      # 0x4fe8
movq (%rax), %rdi
leaq 0x19b6(%rip), %rsi      # 0x3049
movq %r14, %rdx
xorl %eax, %eax
callq 0x1190
pushq $0x1
popq %rdi
callq 0x1070