// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: main
int main(int argc, char *argv[])
{
	int opt;
	char *config_path = malloc(MAXLEN * sizeof(char));
	config_path[0] = '\0';
	while ((opt = getopt(argc, argv, "hvc:")) != -1) {
		switch (opt) {
			case 'h':
				usage(argv[0]);
				break;
			case 'c':
				snprintf(config_path, MAXLEN * sizeof(char), "%s", optarg);
				break;
			case 'v':
				version();
				break;
		}
	}
	atexit(cleanup);

	register_event_handlers();
	register_ipc_handlers();
	load_defaults();

	if (setup() < 0)
		errx(EXIT_FAILURE, "error connecting to X");
	/* if not set, get path of the rc file */
	if (config_path[0] == '\0') {
		char *xdg_home = getenv("XDG_CONFIG_HOME");
		if (xdg_home != NULL)
			snprintf(config_path, MAXLEN * sizeof(char), "%s/%s/%s", xdg_home, __NAME__, __CONFIG_NAME__);
		else
			snprintf(config_path, MAXLEN * sizeof(char), "%s/%s/%s/%s", getenv("HOME"), ".config",
					__NAME__, __CONFIG_NAME__);
	}

	signal(SIGCHLD, handle_child);

	/* execute config file */
	load_config(config_path);
	run();

	free(config_path);

	return exit_code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x100, %edi            # imm = 0x100
callq 0x31b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x88f7(%rip), %rdx      # 0xc160
callq 0x3170
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x38cf
movl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
subl $0x63, %eax
je 0x38a5
jmp 0x3883
movl -0x2c(%rbp), %eax
subl $0x68, %eax
je 0x3897
jmp 0x388d
movl -0x2c(%rbp), %eax
subl $0x76, %eax
je 0x38c8
jmp 0x38cd
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x39e0
jmp 0x38cd
movq -0x20(%rbp), %rdi
movq 0xb738(%rip), %rax      # 0xefe8
movq (%rax), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x88dd(%rip), %rdx      # 0xc19c
movb $0x0, %al
callq 0x30b0
jmp 0x38cd
callq 0x3a10
jmp 0x385b
leaq 0x1aa(%rip), %rdi       # 0x3a80
callq 0xb940
callq 0x3b10
callq 0x3bf0
callq 0x3da0
callq 0x3e80
cmpl $0x0, %eax
jge 0x3907
movl $0x1, %edi
leaq 0x8865(%rip), %rsi      # 0xc165
movb $0x0, %al
callq 0x35d0
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x39a2
leaq 0x885d(%rip), %rdi      # 0xc17b
callq 0x34b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3959
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x8854(%rip), %rdx      # 0xc196
leaq 0x8842(%rip), %r8       # 0xc18b
leaq 0x883e(%rip), %r9       # 0xc18e
movb $0x0, %al
callq 0x30b0
jmp 0x39a0
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0x881e(%rip), %rdi      # 0xc186
callq 0x34b0
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x8813(%rip), %rdx      # 0xc193
leaq 0x8818(%rip), %r8       # 0xc19f
leaq 0x87fd(%rip), %r9       # 0xc18b
leaq 0x87f9(%rip), %rax      # 0xc18e
movq %rax, (%rsp)
movb $0x0, %al
callq 0x30b0
jmp 0x39a2
movl $0x11, %edi
leaq -0x19e(%rip), %rsi      # 0x3810
callq 0x3480
movq -0x20(%rbp), %rdi
callq 0x4270
callq 0x42e0
movq -0x20(%rbp), %rdi
callq 0x32d0
movl 0xba00(%rip), %eax      # 0xf3d0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)