// File: /workspace/github_c_makefile_star2_O3/veltzer[P]xmeltdown/src/xmeltdown.c
// Function: main
int main(int argc, char** argv, char** envp) {
	char *display=NULL;
	unsigned long vmask;
	XSetWindowAttributes xswat;
	XGCValues gcvals;
	Bool use_planes=False;
	int i;

	srandom(getpid());
	for (i=1; i < argc; i++) {
		if (strncmp(argv[i], "-dis", 4) == 0) {
			if (argv[i+1])
				display=argv[++i];
			else
				usage();
		} else if (strncmp(argv[i], "-p", 2) == 0) {
			use_planes=1;
		} else
			usage();
	}
	if ((dpy=XOpenDisplay(display)) == NULL) {
		fprintf(stderr, "can't open display\n");
		exit(0);
	}
	screen=DefaultScreen(dpy);

	xswat.override_redirect=True;
	xswat.do_not_propagate_mask=KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask;
	vmask=CWOverrideRedirect|CWDontPropagate;
	win=XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0,
		DisplayWidth(dpy, screen), DisplayHeight(dpy, screen),
		0, CopyFromParent, CopyFromParent, CopyFromParent, vmask,
		&xswat);
	XMapWindow(dpy, win);

	gcvals.graphics_exposures=False;
	/* copyplane gc wants to leave the data alone */
	gcvals.foreground=1;
	gcvals.background=0;
	copygc=XCreateGC(dpy, win,
		GCForeground|GCBackground|GCGraphicsExposures, &gcvals);

	gcvals.foreground=BlackPixel(dpy, screen);
	fillgc=XCreateGC(dpy, win, GCForeground, &gcvals);

	XSync(dpy, 0);
	if (use_planes) {
		do_planes();
	} else {
		do_all();
	}
	sleep(2);
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movl %edi, %ebp
callq 0x1080
movl %eax, %edi
callq 0x1070
xorl %r13d, %r13d
movl %ebp, 0x4(%rsp)
cmpl $0x2, %ebp
jl 0x137f
movl $0x1, %r15d
xorl %r14d, %r14d
movslq %r15d, %rbp
movq (%rbx,%rbp,8), %r12
movl $0x4, %edx
movq %r12, %rdi
leaq 0xd04(%rip), %rsi       # 0x2038
callq 0x1040
testl %eax, %eax
je 0x135b
cmpb $0x2d, (%r12)
jne 0x14c2
movl $0x1, %r13d
cmpb $0x70, 0x1(%r12)
je 0x136c
jmp 0x14c2
movq 0x8(%rbx,%rbp,8), %r14
testq %r14, %r14
je 0x14c7
incl %r15d
incl %r15d
cmpl 0x4(%rsp), %r15d
jl 0x131e
testl %r13d, %r13d
sete %bpl
jmp 0x1385
movb $0x1, %bpl
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x1090
movq %rax, 0x2d2c(%rip)      # 0x40c0
testq %rax, %rax
je 0x14cc
movslq 0xe0(%rax), %rcx
movl %ecx, 0x2d1e(%rip)      # 0x40c8
leaq 0x8(%rsp), %r10
movl $0x1, 0x58(%r10)
movq $0xf, 0x50(%r10)
movq 0xe8(%rax), %rdx
shlq $0x7, %rcx
movq 0x10(%rdx,%rcx), %rsi
movl 0x18(%rdx,%rcx), %r8d
movl 0x1c(%rdx,%rcx), %r9d
xorl %r14d, %r14d
movq %rax, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
pushq %r10
pushq $0x1200                 # imm = 0x1200
pushq %r14
pushq %r14
pushq %r14
pushq %r14
callq 0x1060
addq $0x30, %rsp
movq %rax, 0x2cce(%rip)      # 0x40d0
movq 0x2cb7(%rip), %rdi      # 0x40c0
movq %rax, %rsi
callq 0x10e0
leaq 0x78(%rsp), %rbx
movl %r14d, 0x64(%rbx)
movq $0x1, 0x10(%rbx)
movq %r14, 0x18(%rbx)
movq 0x2c93(%rip), %rdi      # 0x40c0
movq 0x2c9c(%rip), %rsi      # 0x40d0
movl $0x1000c, %edx          # imm = 0x1000C
movq %rbx, %rcx
callq 0x10f0
movq %rax, 0x2c90(%rip)      # 0x40d8
movq 0x2c71(%rip), %rdi      # 0x40c0
movq 0xe8(%rdi), %rax
movslq 0x2c6b(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
movq 0x60(%rax,%rcx), %rax
movq %rax, 0x10(%rbx)
movq 0x2c5f(%rip), %rsi      # 0x40d0
movl $0x4, %edx
movq %rbx, %rcx
callq 0x10f0
movq %rax, 0x2c5b(%rip)      # 0x40e0
movq 0x2c34(%rip), %rdi      # 0x40c0
xorl %esi, %esi
callq 0x1100
testb %bpl, %bpl
je 0x149f
callq 0x1834
jmp 0x14a4
callq 0x14d1
movl $0x2, %edi
callq 0x10c0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1160
callq 0x11a9
callq 0x1185