// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x11c(%rbp)
callq 0x1080
movl %eax, %edi
callq 0x1070
movl $0x1, -0x120(%rbp)
movl -0x120(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1385
movq -0x10(%rbp), %rax
movslq -0x120(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd4e(%rip), %rsi       # 0x2038
movl $0x4, %edx
callq 0x1040
cmpl $0x0, %eax
jne 0x1337
movq -0x10(%rbp), %rax
movl -0x120(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x1330
movq -0x10(%rbp), %rax
movl -0x120(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x120(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
jmp 0x1335
callq 0x1250
jmp 0x136f
movq -0x10(%rbp), %rax
movslq -0x120(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xcf0(%rip), %rsi       # 0x203d
movl $0x2, %edx
callq 0x1040
cmpl $0x0, %eax
jne 0x1368
movl $0x1, -0x11c(%rbp)
jmp 0x136d
callq 0x1250
jmp 0x136f
jmp 0x1371
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x12c5
movq -0x20(%rbp), %rdi
callq 0x1090
movq %rax, 0x2d2b(%rip)      # 0x40c0
cmpq $0x0, %rax
jne 0x13ba
movq 0x2c4e(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
leaq 0xc94(%rip), %rsi       # 0x2040
movb $0x0, %al
callq 0x1140
xorl %edi, %edi
callq 0x1030
movq 0x2cff(%rip), %rax      # 0x40c0
movl 0xe0(%rax), %eax
movl %eax, 0x2cfb(%rip)      # 0x40c8
movl $0x1, -0x40(%rbp)
movq $0xf, -0x48(%rbp)
movq $0x1200, -0x28(%rbp)    # imm = 0x1200
movq 0x2cd5(%rip), %rdi      # 0x40c0
movq 0x2cce(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %rax
movslq 0x2cc8(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movq 0x2cae(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %rax
movslq 0x2ca8(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x18(%rax), %r8d
movq 0x2c8e(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %rax
movslq 0x2c88(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %r9d
movq -0x28(%rbp), %r10
xorl %ecx, %ecx
xorl %eax, %eax
leaq -0x98(%rbp), %rax
movl %ecx, %edx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x1060
movq %rax, 0x2c3e(%rip)      # 0x40d0
movq 0x2c27(%rip), %rdi      # 0x40c0
movq 0x2c30(%rip), %rsi      # 0x40d0
callq 0x10e0
movl $0x0, -0xb4(%rbp)
movq $0x1, -0x108(%rbp)
movq $0x0, -0x100(%rbp)
movq 0x2bf4(%rip), %rdi      # 0x40c0
movq 0x2bfd(%rip), %rsi      # 0x40d0
movl $0x1000c, %edx          # imm = 0x1000C
leaq -0x118(%rbp), %rcx
callq 0x10f0
movq %rax, 0x2bed(%rip)      # 0x40d8
movq 0x2bce(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %rax
movslq 0x2bc8(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x60(%rax), %rax
movq %rax, -0x108(%rbp)
movq 0x2ba7(%rip), %rdi      # 0x40c0
movq 0x2bb0(%rip), %rsi      # 0x40d0
movl $0x4, %edx
leaq -0x118(%rbp), %rcx
callq 0x10f0
movq %rax, 0x2ba8(%rip)      # 0x40e0
movq 0x2b81(%rip), %rdi      # 0x40c0
xorl %esi, %esi
callq 0x1100
cmpl $0x0, -0x11c(%rbp)
je 0x1556
callq 0x1570
jmp 0x155b
callq 0x1a50
movl $0x2, %edi
callq 0x10c0
xorl %eax, %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq