// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0xac(%rbp)
movq $0x0, -0xb8(%rbp)
leaq 0x53b(%rip), %rax       # 0xb680
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rdi
addq $0x8, %rdi
callq 0x46a0
movl $0x0, -0x20(%rbp)
movl $0xf, %edi
leaq -0xa8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x4410
movl $0x2, %edi
leaq -0xa8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x4410
movl $0x1, %edi
leaq -0xa8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x4410
movb $0x0, 0x7d97(%rip)      # 0x12f40
movb 0x7d91(%rip), %al       # 0x12f40
xorb $-0x1, %al
testb $0x1, %al
jne 0xb1ba
jmp 0xb667
leaq -0x100(%rbp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x4080
leaq 0x7d74(%rip), %rdi      # 0x12f48
leaq -0x100(%rbp), %rsi
movl $0x48, %edx
callq 0x4750
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpq $0x8, %rax
jae 0xb22b
movl -0x104(%rbp), %eax
movl %eax, %ecx
leaq 0x7b06(%rip), %rax      # 0x12d10
movq (%rax,%rcx,8), %rsi
leaq 0x789b(%rip), %rdi      # 0x12ab0
callq 0xd050
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0xb1ef
leaq 0x36be(%rip), %rdi      # 0xe8f0
callq 0x44b0
movq %rax, -0x110(%rbp)
cmpq $0x0, -0x110(%rbp)
je 0xb2b0
movq -0x110(%rbp), %rdi
callq 0x4300
movq %rax, %rdi
addq $0xa, %rdi
addq $0x2, %rdi
callq 0xd890
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
callq 0x4580
movq -0x118(%rbp), %rdi
leaq 0x3669(%rip), %rsi      # 0xe8f5
callq 0x4420
movq -0x118(%rbp), %rsi
leaq 0x7811(%rip), %rdi      # 0x12ab0
callq 0xd330
movq -0x118(%rbp), %rdi
callq 0x42e0
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq 0x77f2(%rip), %rdi      # 0x12ab0
leaq -0xac(%rbp), %rcx
callq 0xd3d0
movl %eax, -0xb0(%rbp)
cmpl $0x2, -0xb0(%rbp)
jne 0xb330
movq 0x6d10(%rip), %rax      # 0x11ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x3600(%rip), %rsi      # 0xe900
movb $0x0, %al
callq 0x4700
movq 0x6ce2(%rip), %rax      # 0x11ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x35ff(%rip), %rsi      # 0xe91e
movb $0x0, %al
callq 0x4700
movl $0x1, %edi
callq 0x4170
cmpl $0x1, -0xb0(%rbp)
jne 0xb441
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x35f2(%rip), %rsi      # 0xe945
callq 0x4550
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0xb383
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x35d2(%rip), %rsi      # 0xe948
callq 0x4550
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xb38f
callq 0xb6a0
xorl %edi, %edi
callq 0x4170
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x35aa(%rip), %rsi      # 0xe94f
callq 0x4550
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0xb3d5
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x358a(%rip), %rsi      # 0xe952
callq 0x4550
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xb3ea
leaq 0x3580(%rip), %rdi      # 0xe95c
movb $0x0, %al
callq 0x4060
xorl %edi, %edi
callq 0x4170
movq 0x6bff(%rip), %rax      # 0x11ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x3561(%rip), %rsi      # 0xe972
movb $0x0, %al
callq 0x4700
movq 0x6bd1(%rip), %rax      # 0x11ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x34ee(%rip), %rsi      # 0xe91e
movb $0x0, %al
callq 0x4700
movl $0x1, %edi
callq 0x4170
jmp 0xb443
movq 0x7b46(%rip), %rsi      # 0x12f90
leaq 0x2bb3(%rip), %rdi      # 0xe004
callq 0x4ce0
movq 0x7b3b(%rip), %rsi      # 0x12f98
leaq 0x2ba6(%rip), %rdi      # 0xe00a
callq 0x4ce0
movq 0x7b30(%rip), %rsi      # 0x12fa0
leaq 0x2b99(%rip), %rdi      # 0xe010
callq 0x4ce0
callq 0x48b0
cmpq $0x0, 0x7b1f(%rip)      # 0x12fa8
je 0xb528
movq 0x7b12(%rip), %rax      # 0x12fa8
movq 0x8(%rax), %rax
movq %rax, -0x120(%rbp)
movq 0x7b00(%rip), %rdi      # 0x12fa8
movq -0x120(%rbp), %rsi
callq 0xaf90
movq %rax, 0x7aed(%rip)      # 0x12fa8
movq -0x120(%rbp), %rdi
leaq 0x3da9(%rip), %rsi      # 0xf272
callq 0x4590
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
jne 0xb4ed
movq -0x120(%rbp), %rdi
callq 0x42e0
jmp 0xb481
xorl %eax, %eax
movl %eax, %edi
leaq 0x3497(%rip), %rsi      # 0xe98f
callq 0x4590
movq %rax, -0x130(%rbp)
movq -0x128(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x4950
movq -0x120(%rbp), %rdi
callq 0x42e0
jmp 0xb481
leaq 0x7851(%rip), %rax      # 0x12d80
cmpq $0x0, (%rax)
jne 0xb53a
callq 0x8950
callq 0x8d60
cmpq $0x0, -0xb8(%rbp)
je 0xb574
movq -0xb8(%rbp), %rdi
callq 0x5820
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x138(%rbp)
je 0xb572
movq -0x138(%rbp), %rdi
callq 0x5f40
jmp 0xb574
leaq 0x79a9(%rip), %rax      # 0x12f24
movb $0x0, (%rax)
callq 0x8e70
leaq 0x77ee(%rip), %rax      # 0x12d78
cmpq $0x0, (%rax)
je 0xb5a6
leaq 0x77e1(%rip), %rax      # 0x12d78
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x148(%rbp)
jmp 0xb5b1
xorl %eax, %eax
movq %rax, -0x148(%rbp)
jmp 0xb5b1
movq -0x148(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0x74ea(%rip), %rdi      # 0x12ab0
callq 0xd560
cmpq $0x0, 0x7965(%rip)      # 0x12f38
je 0xb649
movq 0x795c(%rip), %rax      # 0x12f38
movq 0x8(%rax), %rax
movq %rax, -0x140(%rbp)
movq 0x794a(%rip), %rdi      # 0x12f38
movq -0x140(%rbp), %rsi
callq 0xaf90
movq %rax, 0x7937(%rip)      # 0x12f38
movq -0x140(%rbp), %rax
cmpq $0x0, (%rax)
je 0xb61d
movq -0x140(%rbp), %rax
movq (%rax), %rdi
callq 0x42e0
movq -0x140(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xb63b
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x42e0
movq -0x140(%rbp), %rdi
callq 0x42e0
jmp 0xb5cb
callq 0x8e40
leaq 0x772b(%rip), %rax      # 0x12d80
movq (%rax), %rdi
movl $0x1, %esi
callq 0x4510
jmp 0xb1a9
callq 0x8c50
xorl %eax, %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)