// File: /workspace/github_c_makefile_star2_O2/seanpringle[P]xoat/xoat.c
// Function: main
int main(int argc, char *argv[])
{
	int i; XEvent ev; Atom msg = None;

	if (!(display = XOpenDisplay(0))) return 1;

	self   = argv[0];
	root   = DefaultRootWindow(display);
	xerror = XSetErrorHandler(oops);
	menu   = &spot_menu;

	for (i = 0; i < ATOMS; i++) atoms[i] = XInternAtom(display, atom_names[i], False);

	// check for restart/exit
	if (argc > 1)
	{
		Window cli = XCreateSimpleWindow(display, root, 0, 0, 1, 1, 0, None, None);
		     if (!strcmp(argv[1], "restart")) msg = atoms[XOAT_RESTART];
		else if (!strcmp(argv[1], "exit"))    msg = atoms[XOAT_EXIT];
		else errx(EXIT_FAILURE, "huh? %s", argv[1]);
		window_send_clientmessage(root, cli, msg, 0, SubstructureNotifyMask | SubstructureRedirectMask);
		exit(EXIT_SUCCESS);
	}

	configure();
	setup();

	// main event loop
	for (;;)
	{
		STACK_FREE(&windows);
		XNextEvent(display, &ev);
		if (handlers[ev.type])
			handlers[ev.type](&ev);
	}
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x3210
movq %rax, 0x583f(%rip)      # 0xebb0
testq %rax, %rax
je 0x9464
movq (%rbx), %rcx
movq %rcx, 0x5ecc(%rip)      # 0xf250
movq 0xe8(%rax), %rcx
movslq 0xe0(%rax), %rax
shlq $0x7, %rax
movq 0x10(%rcx,%rax), %rax
movq %rax, 0x5e06(%rip)      # 0xf1a8
leaq -0xc8(%rip), %rdi       # 0x92e1
callq 0x35f0
movq %rax, 0x5eab(%rip)      # 0xf260
leaq 0x5eac(%rip), %rax      # 0xf268
movq %rax, 0x5e7d(%rip)      # 0xf240
xorl %r14d, %r14d
leaq 0x4fb3(%rip), %r15      # 0xe380
leaq 0x58cc(%rip), %r12      # 0xeca0
cmpq $0xf8, %r14
je 0x93f9
movq 0x57cc(%rip), %rdi      # 0xebb0
movq (%r14,%r15), %rsi
xorl %edx, %edx
callq 0x3540
movq %rax, (%r14,%r12)
addq $0x8, %r14
jmp 0x93d4
cmpl $0x2, %ebp
jge 0x9477
callq 0x7b18
callq 0x8835
leaq 0x20(%rsp), %rbx
leaq 0x536c(%rip), %r14      # 0xe780
leaq 0x5985(%rip), %r15      # 0xeda0
movzwl 0x597e(%rip), %eax      # 0xeda0
testw %ax, %ax
je 0x9440
decl %eax
movw %ax, 0x5970(%rip)       # 0xeda0
movswq %ax, %rax
movq 0x8(%r15,%rax,8), %rdi
callq 0x5dae
jmp 0x941b
movq 0x5769(%rip), %rdi      # 0xebb0
movq %rbx, %rsi
callq 0x3310
movslq 0x20(%rsp), %rax
movq (%r14,%rax,8), %rax
testq %rax, %rax
je 0x941b
movq %rbx, %rdi
callq *%rax
jmp 0x941b
pushq $0x1
popq %rax
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x5732(%rip), %rdi      # 0xebb0
movq 0x5d23(%rip), %rsi      # 0xf1a8
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
andl $0x0, (%rsp)
pushq $0x1
popq %r8
xorl %edx, %edx
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0x31e0
movq %rax, %r14
movq 0x8(%rbx), %rbx
leaq 0x16ad(%rip), %rsi      # 0xab5c
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x94c4
leaq 0x57ee(%rip), %rax      # 0xecb0
jmp 0x94de
leaq 0x1699(%rip), %rsi      # 0xab64
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x94ff
leaq 0x57ca(%rip), %rax      # 0xeca8
movq (%rax), %rdx
movq 0x5cc0(%rip), %rdi      # 0xf1a8
movl $0x180000, %r8d         # imm = 0x180000
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x5582
xorl %edi, %edi
callq 0x3100
leaq 0x1663(%rip), %rsi      # 0xab69
pushq $0x1
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x35a0