// File: /workspace/github_c_makefile_star2_O2/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 0x12ee
movq (%r15), %rsi
leaq 0x1d41(%rip), %rdi      # 0x3020
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %rdi
callq 0x1070
movl %edi, %ebp
movq 0x8(%r15), %rax
cmpl $0x3, %edi
movq %rax, (%rsp)
jne 0x130a
movq 0x10(%r15), %rdi
callq 0x1110
movl %eax, %ebx
jmp 0x130d
pushq $0xa
popq %rbx
movl %ebp, %edi
movq %r15, %rsi
callq 0x1ecd
leaq 0x3e62(%rip), %r13      # 0x5180
movq (%r13), %rdi
leaq 0x3e67(%rip), %rbp      # 0x5190
movq (%rbp), %rsi
movl $0x8005, %edx           # imm = 0x8005
callq 0x1140
pushq $0x3
popq %r14
leaq 0xc8(%rsp), %r15
movq %r14, 0x20(%r15)
movl $0xf, (%r15)
movq (%r13), %rdi
movq (%rbp), %rsi
pushq $0x31
popq %r12
movq %r12, %rdx
movq %r15, %rcx
callq 0x1130
movq %r14, 0x20(%r15)
andl $0x0, (%r15)
movq %rax, 0x3d84(%rip)      # 0x50f8
movq (%r13), %rdi
movq (%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d72(%rip)      # 0x5100
movq %r14, 0x20(%r15)
movl $0x5, (%r15)
movq (%r13), %rdi
movq (%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d55(%rip)      # 0x5108
movq %r14, 0x20(%r15)
movl $0xa, (%r15)
movq (%r13), %rdi
movq (%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x1130
movq %rax, 0x3d38(%rip)      # 0x5110
movq (%rsp), %rdi
callq 0x143a
movq %rax, %r14
leaq 0x8(%rsp), %r15
leaq 0x1c51(%rip), %r12      # 0x3041
movq (%r13), %rdi
movq %r15, %rsi
callq 0x1100
movl 0x8(%rsp), %eax
cmpl $0x4, %eax
je 0x141d
cmpl $0xc, %eax
je 0x1411
cmpl $0x2, %eax
jne 0x13f0
jmp 0x1433
movq %r14, %rdi
movl %ebx, %esi
callq 0x16ad
jmp 0x13f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x16ad
movq %r12, %rdi
xorl %eax, %eax
callq 0x1030
jmp 0x13f0
xorl %edi, %edi
callq 0x1070