// File: /workspace/github_c_makefile_star2_O3/mati75[P]evilwm/main.c
// Function: main
int main(int argc, char *argv[]) {
	struct sigaction act;
	int argn = 1, ret;
	Window old_current_window = None;

	act.sa_handler = handle_signal;
	sigemptyset(&act.sa_mask);
	act.sa_flags = 0;
	sigaction(SIGTERM, &act, NULL);
	sigaction(SIGINT, &act, NULL);
	sigaction(SIGHUP, &act, NULL);

	// Run until something signals to quit.
	wm_exit = 0;
	while (!wm_exit) {

		// Default options
		option = (struct options){0};
		for (unsigned i = 0; i < NUM_DEFAULT_OPTIONS; i++)
			xconfig_parse_line(evilwm_options, default_options[i]);

		// Read configuration file
		const char *home = getenv("HOME");
		if (home) {
			char *conffile = xmalloc(strlen(home) + sizeof(CONFIG_FILE) + 2);
			strcpy(conffile, home);
			strcat(conffile, "/" CONFIG_FILE);
			xconfig_parse_file(evilwm_options, conffile);
			free(conffile);
		}

		// Parse CLI options
		ret = xconfig_parse_cli(evilwm_options, argc, argv, &argn);
		if (ret == XCONFIG_MISSING_ARG) {
			fprintf(stderr, "%s: missing argument to `%s'\n", argv[0], argv[argn]);
			fprintf(stderr, "Try '%s --help' for more information.\n", argv[0]);
			exit(1);
		} else if (ret == XCONFIG_BAD_OPTION) {
			if (0 == strcmp(argv[argn], "-h")
			    || 0 == strcmp(argv[argn], "--help")) {
				helptext();
				exit(0);
			} else if (0 == strcmp(argv[argn], "-V")
				   || 0 == strcmp(argv[argn], "--version")) {
				LOG_INFO("evilwm version " VERSION "\n");
				exit(0);
			} else {
				fprintf(stderr, "%s: unrecognised option '%s'\n", argv[0], argv[argn]);
				fprintf(stderr, "Try '%s --help' for more information.\n", argv[0]);
				exit(1);
			}
		}

		bind_modifier("mask1", opt_grabmask1);
		bind_modifier("mask2", opt_grabmask2);
		bind_modifier("altmask", opt_altmask);

		bind_reset();
		while (opt_bind) {
			char *arg = opt_bind->data;
			opt_bind = list_delete(opt_bind, arg);
			char *ctlstr = strtok(arg, "=");
			if (!ctlstr) {
				free(arg);
				continue;
			}
			char *funcstr = strtok(NULL, "");
			bind_control(ctlstr, funcstr);
			free(arg);
		}

		// Open display only if not already open
		if (!display.dpy) {
			display_open();
		}

		// Manage all eligible clients across all screens
		display_manage_clients();

		// Restore "old current window", if known
		if (old_current_window != None) {
			struct client *c = find_client(old_current_window);
			if (c)
				select_client(c);
		}

		// Event loop will run until interrupted
		end_event_loop = 0;
		event_main_loop();

		// Record "old current window" across SIGHUPs
		old_current_window = current ? current->window : None;

		// Important to clean up anything now that might be reallocated
		// after rereading config, re-managing windows, etc.

		// Free any allocated strings in parsed options
		xconfig_free(evilwm_options);

		// Free application configuration
		while (applications) {
			struct application *app = applications->data;
			applications = list_delete(applications, app);
			if (app->res_name)
				free(app->res_name);
			if (app->res_class)
				free(app->res_class);
			free(app);
		}

		display_unmanage_clients();
		XSync(display.dpy, True);
	}

	// Close display
	display_close();

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x8(%rsp)
movl %edi, 0x1c(%rsp)
leaq 0x4(%rsp), %rax
movl $0x1, (%rax)
leaq 0x365(%rip), %rax       # 0x8add
leaq 0x28(%rsp), %rbx
movq %rax, -0x8(%rbx)
movq %rbx, %rdi
callq 0x4690
movl $0x0, 0x80(%rbx)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rbx
movl $0xf, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4400
movl $0x2, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4400
movl $0x1, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4400
movb $0x0, 0x7113(%rip)      # 0xf8e8
leaq 0x2194(%rip), %r12      # 0xa970
leaq 0x6cbd(%rip), %r15      # 0xf4a0
leaq 0x2b21(%rip), %r13      # 0xb30b
leaq 0x2222(%rip), %r14      # 0xaa13
xorps %xmm0, %xmm0
movups %xmm0, 0x7125(%rip)     # 0xf920
movups %xmm0, 0x710e(%rip)     # 0xf910
movups %xmm0, 0x70f7(%rip)     # 0xf900
movups %xmm0, 0x70e0(%rip)     # 0xf8f0
movq $0x0, 0x7115(%rip) # 0xf930
xorl %ebx, %ebx
movslq (%rbx,%r12), %rsi
addq %r12, %rsi
movq %r15, %rdi
callq 0x99b4
addq $0x4, %rbx
cmpq $0x20, %rbx
jne 0x881d
leaq 0x2153(%rip), %rdi      # 0xa990
callq 0x44a0
testq %rax, %rax
je 0x889b
movq %rax, %rbx
movq %rax, %rdi
callq 0x42f0
leaq 0xc(%rax), %rdi
callq 0x9eb8
movq %rax, %rbp
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4570
movq %rbp, %rdi
callq 0x42f0
movabsq $0x6d776c6976652e2f, %rcx # imm = 0x6D776C6976652E2F
movq %rcx, (%rbp,%rax)
movl $0x63726d, 0x7(%rbp,%rax) # imm = 0x63726D
movq %r15, %rdi
movq %rbp, %rsi
callq 0x9cf6
movq %rbp, %rdi
callq 0x42d0
movq %r15, %rdi
movl 0x1c(%rsp), %esi
movq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
callq 0x9d75
cmpl $0x1, %eax
je 0x8a3c
cmpl $0x2, %eax
je 0x8a81
movq 0x706e(%rip), %rsi      # 0xf938
leaq 0x174f(%rip), %rdi      # 0xa020
callq 0x4d80
movq 0x7063(%rip), %rsi      # 0xf940
leaq 0x1742(%rip), %rdi      # 0xa026
callq 0x4d80
movq 0x7058(%rip), %rsi      # 0xf948
leaq 0x1735(%rip), %rdi      # 0xa02c
callq 0x4d80
callq 0x4a4c
movq 0x7048(%rip), %rdi      # 0xf950
testq %rdi, %rdi
je 0x8952
movq 0x8(%rdi), %rbx
movq %rbx, %rsi
callq 0x867f
movq %rax, 0x7030(%rip)      # 0xf950
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4580
testq %rax, %rax
je 0x8948
movq %rax, %rbp
xorl %edi, %edi
movq %r14, %rsi
callq 0x4580
movq %rbp, %rdi
movq %rax, %rsi
callq 0x4aae
movq %rbx, %rdi
callq 0x42d0
jmp 0x8901
leaq 0x6dcf(%rip), %rbp      # 0xf728
cmpq $0x0, (%rbp)
jne 0x8965
callq 0x70dc
callq 0x73cd
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8986
callq 0x534f
testq %rax, %rax
je 0x8986
movq %rax, %rdi
callq 0x5780
leaq 0x6f3f(%rip), %rax      # 0xf8cc
movb $0x0, (%rax)
callq 0x74c8
leaq 0x6d84(%rip), %rax      # 0xf720
movq (%rax), %rax
testq %rax, %rax
je 0x89ae
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x89b7
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
callq 0x9e42
movq 0x6f1a(%rip), %rdi      # 0xf8e0
testq %rdi, %rdi
je 0x8a03
movq 0x8(%rdi), %rbx
movq %rbx, %rsi
callq 0x867f
movq %rax, 0x6f02(%rip)      # 0xf8e0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x89eb
callq 0x42d0
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x89f9
callq 0x42d0
movq %rbx, %rdi
callq 0x42d0
jmp 0x89bf
callq 0x74aa
movq (%rbp), %rdi
movl $0x1, %esi
callq 0x4500
cmpb $0x1, 0x6ecb(%rip)      # 0xf8e8
jne 0x87f1
callq 0x72f5
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq 0x4(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %r14
cmpb $0x2d, (%r14)
jne 0x8a90
cmpb $0x68, 0x1(%r14)
jne 0x8a5e
cmpb $0x0, 0x2(%r14)
je 0x8aa3
leaq 0x1f80(%rip), %rsi      # 0xa9e5
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
je 0x8aa3
cmpb $0x56, 0x1(%r14)
jne 0x8aaa
cmpb $0x0, 0x2(%r14)
je 0x8abd
jmp 0x8aaa
leaq 0x4(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x48ab
leaq 0x1f4e(%rip), %rsi      # 0xa9e5
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
jne 0x8aaa
callq 0x8af4
jmp 0x8ac9
leaq 0x1f3b(%rip), %rsi      # 0xa9ec
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
jne 0x8ad0
leaq 0x2824(%rip), %rdi      # 0xb2e8
callq 0x4130
xorl %edi, %edi
callq 0x4160
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x486a