// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0xe0(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x3210
movq %rax, 0x555c(%rip)      # 0x13ba0
cmpq $0x0, %rax
jne 0xe658
movl $0x1, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x5bda(%rip)      # 0x14240
movq 0x5533(%rip), %rax      # 0x13ba0
movq 0xe8(%rax), %rax
movq 0x5525(%rip), %rcx      # 0x13ba0
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, 0x5b04(%rip)      # 0x14198
leaq -0x18b(%rip), %rdi      # 0xe510
callq 0x35f0
movq %rax, 0x5ba9(%rip)      # 0x14250
leaq 0x5baa(%rip), %rax      # 0x14258
movq %rax, 0x5b7b(%rip)      # 0x14230
movl $0x0, -0x14(%rbp)
cmpl $0x1f, -0x14(%rbp)
jge 0xe6fc
movq 0x54d7(%rip), %rdi      # 0x13ba0
movslq -0x14(%rbp), %rcx
leaq 0x4c9c(%rip), %rax      # 0x13370
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
callq 0x3540
movq %rax, %rdx
movslq -0x14(%rbp), %rcx
leaq 0x55a3(%rip), %rax      # 0x13c90
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe6bc
cmpl $0x1, -0x8(%rbp)
jle 0xe7e2
movq 0x5493(%rip), %rdi      # 0x13ba0
movq 0x5a84(%rip), %rsi      # 0x14198
xorl %ecx, %ecx
movl $0x1, %r9d
xorl %eax, %eax
movl %ecx, %edx
movl %r9d, %r8d
movl $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x31e0
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1307(%rip), %rsi      # 0xfa5e
callq 0x3470
cmpl $0x0, %eax
jne 0xe771
movq 0x5538(%rip), %rax      # 0x13ca0
movq %rax, -0xe0(%rbp)
jmp 0xe7b7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x12e6(%rip), %rsi      # 0xfa66
callq 0x3470
cmpl $0x0, %eax
jne 0xe79a
movq 0x5507(%rip), %rax      # 0x13c98
movq %rax, -0xe0(%rbp)
jmp 0xe7b5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0x12bd(%rip), %rsi      # 0xfa6b
movb $0x0, %al
callq 0x35a0
jmp 0xe7b7
movq 0x59da(%rip), %rdi      # 0x14198
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
movl $0x180000, %r8d         # imm = 0x180000
callq 0x7290
xorl %edi, %edi
callq 0x3100
callq 0xbd50
callq 0xd0a0
jmp 0xe7ee
cmpw $0x0, 0x559a(%rip)      # 0x13d90
je 0xe821
movw 0x5591(%rip), %ax       # 0x13d90
addw $-0x1, %ax
movw %ax, 0x5586(%rip)       # 0x13d90
movswq %ax, %rcx
leaq 0x557b(%rip), %rax      # 0x13d90
movq 0x8(%rax,%rcx,8), %rdi
callq 0x86e0
jmp 0xe7ee
movq 0x5378(%rip), %rdi      # 0x13ba0
leaq -0xd8(%rbp), %rsi
callq 0x3310
movslq -0xd8(%rbp), %rcx
leaq 0x4f2e(%rip), %rax      # 0x13770
cmpq $0x0, (%rax,%rcx,8)
je 0xe861
movslq -0xd8(%rbp), %rcx
leaq -0xd8(%rbp), %rdi
leaq 0x4f12(%rip), %rax      # 0x13770
callq *(%rax,%rcx,8)
jmp 0xe7ec