// File: /workspace/github_c_makefile_star2_O1/veltzer[P]xmeltdown/src/stickread.c
// Function: main
int main(int argc, char** argv)
{
	Skeleton** skellist;
	char* inputfile;
	int framecount;
	XGCValues my_gcvalues;
	XEvent my_event;
	if (argc < 2) {
		printf ("Usage: %s filename [framecount]\n", argv[0]);
		exit (1);
	}
	inputfile=argv[1];
	if (argc == 3)
		framecount=atoi(argv[2]);
	else
		framecount=10;
	Initialize(argc, argv);
	XSelectInput(dpy, win,
		ExposureMask|ButtonPressMask|KeyPressMask);
	my_gcvalues.line_width=3;
	my_gcvalues.line_style=LineSolid;
	my_gcvalues.function=GXset;

	set_gc=XCreateGC(dpy, win,
		GCFunction|GCLineWidth|GCLineStyle,
		&my_gcvalues);

	my_gcvalues.line_width=3;
	my_gcvalues.line_style=LineSolid;
	my_gcvalues.function=GXclear;

	unset_gc=XCreateGC(dpy, win,
		GCFunction|GCLineWidth|GCLineStyle,
		&my_gcvalues);

	my_gcvalues.line_width=3;
	my_gcvalues.line_style=LineSolid;
	my_gcvalues.function=GXnoop;

	noop_gc=XCreateGC(dpy, win,
		GCFunction|GCLineWidth|GCLineStyle,
		&my_gcvalues);

	my_gcvalues.line_width=3;
	my_gcvalues.line_style=LineSolid;
	my_gcvalues.function=GXinvert;

	neg_gc=XCreateGC(dpy, win,
		GCFunction|GCLineWidth|GCLineStyle,
		&my_gcvalues);

	skellist=ReadFile(inputfile);
	while (1) {
		XNextEvent (dpy, &my_event);
		if (my_event.type == KeyPress)
			HandleKeyPress((XKeyEvent*)&my_event);
		if (my_event.type == ButtonPress) {
			Interpolate(skellist, framecount);
			printf ("Beep.");
		}else if (my_event.type == Expose)
			Interpolate(skellist, framecount);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rsi, %r15
cmpl $0x1, %edi
jg 0x1320
movq (%r15), %rsi
leaq 0x1d11(%rip), %rdi      # 0x3020
xorl %eax, %eax
callq 0x1030
movl $0x1, %edi
callq 0x1070
movl %edi, %ebp
movq 0x8(%r15), %r14
movl $0xa, %ebx
cmpl $0x3, %edi
jne 0x133b
movq 0x10(%r15), %rdi
callq 0x1110
movl %eax, %ebx
movl %ebp, %edi
movq %r15, %rsi
callq 0x2513
leaq 0x3e34(%rip), %r13      # 0x5180
movq (%r13), %rdi
leaq 0x3e39(%rip), %r12      # 0x5190
movq (%r12), %rsi
movl $0x8005, %edx           # imm = 0x8005
callq 0x1140
movl $0x3, %ebp
leaq 0xc8(%rsp), %r15
movq %rbp, 0x20(%r15)
movl $0xf, (%r15)
movq (%r13), %rdi
movq (%r12), %rsi
movl $0x31, %edx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d5f(%rip)      # 0x50f8
movq %rbp, 0x20(%r15)
movl $0x0, (%r15)
movq (%r13), %rdi
movq (%r12), %rsi
movl $0x31, %edx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d40(%rip)      # 0x5100
movq %rbp, 0x20(%r15)
movl $0x5, (%r15)
movq (%r13), %rdi
movq (%r12), %rsi
movl $0x31, %edx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d21(%rip)      # 0x5108
movq %rbp, 0x20(%r15)
movl $0xa, (%r15)
movq (%r13), %rdi
movq (%r12), %rsi
movl $0x31, %edx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d02(%rip)      # 0x5110
movq %r14, %rdi
callq 0x146f
movq %rax, %r14
leaq 0x8(%rsp), %r15
leaq 0x1c1c(%rip), %r12      # 0x3041
movq (%r13), %rdi
movq %r15, %rsi
callq 0x1100
movl 0x8(%rsp), %eax
cmpl $0x4, %eax
je 0x1452
cmpl $0xc, %eax
je 0x1446
cmpl $0x2, %eax
jne 0x1425
jmp 0x1468
movq %r14, %rdi
movl %ebx, %esi
callq 0x17f3
jmp 0x1425
movq %r14, %rdi
movl %ebx, %esi
callq 0x17f3
movq %r12, %rdi
xorl %eax, %eax
callq 0x1030
jmp 0x1425
xorl %edi, %edi
callq 0x1070