// File: /workspace/github_c_makefile_star2_O1/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 %r15d, %r15d
movl %ebp, 0x4(%rsp)
cmpl $0x2, %ebp
jl 0x1384
movl $0x1, %r12d
xorl %r14d, %r14d
movslq %r12d, %rbp
movq (%rbx,%rbp,8), %r13
movl $0x4, %edx
movq %r13, %rdi
leaq 0xd04(%rip), %rsi       # 0x2038
callq 0x1040
testl %eax, %eax
je 0x1360
movl $0x2, %edx
movq %r13, %rdi
leaq 0xcf1(%rip), %rsi       # 0x203d
callq 0x1040
movl $0x1, %r15d
testl %eax, %eax
je 0x1371
jmp 0x14c7
movq 0x8(%rbx,%rbp,8), %r14
testq %r14, %r14
je 0x14cc
incl %r12d
incl %r12d
cmpl 0x4(%rsp), %r12d
jl 0x131e
testl %r15d, %r15d
sete %bpl
jmp 0x138a
movb $0x1, %bpl
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x1090
movq %rax, 0x2d27(%rip)      # 0x40c0
testq %rax, %rax
je 0x14d1
movslq 0xe0(%rax), %rcx
movl %ecx, 0x2d19(%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, 0x2cc9(%rip)      # 0x40d0
movq 0x2cb2(%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 0x2c8e(%rip), %rdi      # 0x40c0
movq 0x2c97(%rip), %rsi      # 0x40d0
movl $0x1000c, %edx          # imm = 0x1000C
movq %rbx, %rcx
callq 0x10f0
movq %rax, 0x2c8b(%rip)      # 0x40d8
movq 0x2c6c(%rip), %rdi      # 0x40c0
movq 0xe8(%rdi), %rax
movslq 0x2c66(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
movq 0x60(%rax,%rcx), %rax
movq %rax, 0x10(%rbx)
movq 0x2c5a(%rip), %rsi      # 0x40d0
movl $0x4, %edx
movq %rbx, %rcx
callq 0x10f0
movq %rax, 0x2c56(%rip)      # 0x40e0
movq 0x2c2f(%rip), %rdi      # 0x40c0
xorl %esi, %esi
callq 0x1100
testb %bpl, %bpl
je 0x14a4
callq 0x1857
jmp 0x14a9
callq 0x14d6
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