// File: /workspace/github_c_makefile_star2_O0/cglindkamp[P]dfm/src/application.c
// Function: application_init
bool application_init(struct application *app)
{
	bool ret = true;

	app->mode = MODE_NORMAL;
	app->lastsearch_regex = NULL;
	app->timer_running = false;
	curs_set(0);

	processmanager_init(&app->pm);

	const char *shared_clipboard_path = getenv("DFM_CLIPBOARD_DIR");
	if(shared_clipboard_path) {
		if(access(shared_clipboard_path, R_OK | W_OK | X_OK) != 0)
			shared_clipboard_path = NULL;
	}
	clipboard_init(&app->clipboard, shared_clipboard_path);

	app->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
	app->inotify_watch = -1;

	dirmodel_init(&app->model);
	commandexecutor_init(&app->commandexecutor, application_command_map);
	keymap_init(&app->keymap, &app->commandexecutor);

	app->stored_positions = dict_new();
	if(app->stored_positions == NULL)
		ret = false;

	app->pathbar = newwin(1, COLS, 0, 0);
	if(app->pathbar == NULL)
		ret = false;

	app->status = newwin(1, COLS, LINES - 1, 0);
	if(app->status != NULL) {
		keypad(app->status, TRUE);
		nodelay(app->status, TRUE);
	} else
		ret = false;

	if(!commandline_init(&app->commandline, 0, LINES - 1, COLS))
		ret = false;

	if(!path_init(&app->cwd, PATH_MAX))
		ret = false;

	if(!listview_init(&app->view, &app->model.listmodel, 0, 1, COLS, LINES - 2))
		ret = false;

	if(ret == false)
		return false;

	if(!path_set_to_current_working_directory(&app->cwd))
		return false;

	if(!enter_directory(app, NULL))
		return false;

	app->signal_fd = create_signalfd();
	if(app->signal_fd == -1)
		return false;

	if(!application_run_rcfile(app))
		return false;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x1bc(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1c8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x1a8(%rax)
xorl %edi, %edi
callq 0x3140
movq -0x10(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0xbb20
leaq 0x812d(%rip), %rdi      # 0xd103
callq 0x3070
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x5003
movq -0x20(%rbp), %rdi
movl $0x7, %esi
callq 0x3610
cmpl $0x0, %eax
je 0x5001
movq $0x0, -0x20(%rbp)
jmp 0x5003
movq -0x10(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq -0x20(%rbp), %rsi
callq 0x6240
movl $0x80800, %edi          # imm = 0x80800
callq 0x36f0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1b0(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x1b4(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x8670
movq -0x10(%rbp), %rdi
addq $0x178, %rdi            # imm = 0x178
leaq 0xc356(%rip), %rsi      # 0x113b0
callq 0x6470
movq -0x10(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
movq -0x10(%rbp), %rsi
addq $0x178, %rsi            # imm = 0x178
callq 0x8ee0
movb $0x0, %al
callq 0x74f0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xe0(%rax)
jne 0x50a1
movb $0x0, -0x11(%rbp)
movq 0xbf38(%rip), %rax      # 0x10fe0
movl (%rax), %esi
movl $0x1, %edi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x3030
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xe8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
jne 0x50d8
movb $0x0, -0x11(%rbp)
movq 0xbf01(%rip), %rax      # 0x10fe0
movl (%rax), %esi
movq 0xbf00(%rip), %rax      # 0x10fe8
movl (%rax), %edx
subl $0x1, %edx
movl $0x1, %edi
xorl %ecx, %ecx
callq 0x3030
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x5141
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rdi
movl $0x1, %esi
callq 0x3360
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rdi
movl $0x1, %esi
callq 0x3060
jmp 0x5145
movb $0x0, -0x11(%rbp)
movq -0x10(%rbp), %rdi
addq $0xf8, %rdi
movq 0xbe91(%rip), %rax      # 0x10fe8
movl (%rax), %edx
subl $0x1, %edx
movq 0xbe7d(%rip), %rax      # 0x10fe0
movl (%rax), %ecx
xorl %esi, %esi
callq 0x73c0
testb $0x1, %al
jne 0x5174
movb $0x0, -0x11(%rbp)
movq -0x10(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
movl $0x1000, %esi           # imm = 0x1000
callq 0xb820
testb $0x1, %al
jne 0x5191
movb $0x0, -0x11(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
movq 0xbe3c(%rip), %rax      # 0x10fe0
movl (%rax), %r8d
movq 0xbe3a(%rip), %rax      # 0x10fe8
movl (%rax), %r9d
subl $0x2, %r9d
xorl %edx, %edx
movl $0x1, %ecx
callq 0xb020
testb $0x1, %al
jne 0x51c9
movb $0x0, -0x11(%rbp)
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x51dc
movb $0x0, -0x1(%rbp)
jmp 0x5248
movq -0x10(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
callq 0xb4e0
testb $0x1, %al
jne 0x51f6
movb $0x0, -0x1(%rbp)
jmp 0x5248
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5260
testb $0x1, %al
jne 0x520d
movb $0x0, -0x1(%rbp)
jmp 0x5248
callq 0x5e10
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1ac(%rax)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x1ac(%rax)
jne 0x5231
movb $0x0, -0x1(%rbp)
jmp 0x5248
movq -0x10(%rbp), %rdi
callq 0x53a0
testb $0x1, %al
jne 0x5244
movb $0x0, -0x1(%rbp)
jmp 0x5248
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)