// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r14
movl $0x0, 0x1bc(%rdi)
movq $0x0, 0x1c8(%rdi)
movb $0x0, 0x1a8(%rdi)
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x3140
leaq 0x180(%r14), %rdi
callq 0x866c
leaq 0x4929(%rip), %rdi      # 0x912f
callq 0x3070
testq %rax, %rax
je 0x4828
movq %rax, %r15
movq %rax, %rdi
movl $0x7, %esi
callq 0x3610
xorl %ebx, %ebx
testl %eax, %eax
cmoveq %r15, %rbx
leaq 0x150(%r14), %rdi
movq %rbx, %rsi
callq 0x549a
movl $0x80800, %edi          # imm = 0x80800
callq 0x36f0
movl %eax, 0x1b0(%r14)
movl $0xffffffff, 0x1b4(%r14) # imm = 0xFFFFFFFF
leaq 0x28(%r14), %rdi
movq %rdi, 0x10(%rsp)
callq 0x6b61
leaq 0x178(%r14), %rbx
leaq 0x8b41(%rip), %rsi      # 0xd3b0
movq %rbx, %rdi
callq 0x561f
leaq 0x168(%r14), %rdi
movq %rbx, 0x8(%rsp)
movq %rbx, %rsi
callq 0x6fbf
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x5f10
movq %rax, %r15
movq %rax, 0xe0(%r14)
movq 0x8732(%rip), %rbx      # 0xcfd8
movl (%rbx), %esi
movl $0x1, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3030
movq %rax, %r13
movq %rax, 0xe8(%r14)
movl (%rbx), %esi
movq 0x8717(%rip), %rbp      # 0xcfe0
movl (%rbp), %edx
decl %edx
movl $0x1, %edi
xorl %ecx, %ecx
callq 0x3030
movq %rax, 0xf0(%r14)
testq %rax, %rax
je 0x4914
testq %r13, %r13
setne %cl
testq %r15, %r15
setne %r12b
andb %cl, %r12b
movq %rax, %rdi
movl $0x1, %esi
callq 0x3360
movq 0xf0(%r14), %rdi
movl $0x1, %esi
callq 0x3060
leaq 0xf8(%r14), %rdi
movl (%rbp), %edx
decl %edx
movl (%rbx), %ecx
xorl %esi, %esi
callq 0x5e82
movq %rbp, %r15
movl %eax, %ebp
leaq 0x140(%r14), %r13
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdi
callq 0x84a4
movq %rbx, %rcx
movl %eax, %ebx
movl (%rcx), %r8d
movl (%r15), %r9d
addl $-0x2, %r9d
movq %r14, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x8080
testb %al, %al
je 0x4b29
testb %bl, %bl
je 0x4b29
testb %bpl, %bpl
movl $0x0, %r15d
je 0x4b2c
testb %r12b, %r12b
je 0x4b2c
movq %r13, %rdi
callq 0x82e8
testb %al, %al
je 0x4b29
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x4b4e
testb %al, %al
je 0x4b2c
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x3400
movq %rbx, %rdi
movl $0x1c, %esi
callq 0x36e0
movq %rbx, %rdi
movl $0x11, %esi
callq 0x36e0
movq %rbx, %rdi
movl $0xe, %esi
callq 0x36e0
xorl %r15d, %r15d
xorl %edi, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x30a0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movl $0x80000, %edx          # imm = 0x80000
callq 0x3300
movl %eax, 0x1ac(%r14)
cmpl $-0x1, %eax
je 0x4b2c
leaq 0x4742(%rip), %rdi      # 0x9160
leaq 0x47bf(%rip), %rdx      # 0x91e4
xorl %r15d, %r15d
xorl %esi, %esi
movl $0x4, %ecx
callq 0x88e8
testq %rax, %rax
je 0x4b2c
movq %rax, %r14
movq %rax, %rdi
callq 0x81f0
movq %rax, %r13
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x3430
testl %eax, %eax
je 0x4a66
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
jmp 0x4ad0
movq 0x48(%rsp), %r12
testq %r12, %r12
movq 0x8(%rsp), %rbx
je 0x4acd
leaq 0x1(%r12), %rdi
callq 0x3490
testq %rax, %rax
je 0x4acd
movq %rax, %r15
movq %r13, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x3600
testl %eax, %eax
js 0x4ac5
movl %eax, %ebp
movl %eax, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x33c0
movq %rax, %rbx
movl %ebp, %edi
callq 0x3320
testl %ebx, %ebx
js 0x4b41
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movb $0x0, (%r15,%rbx)
jmp 0x4a5f
movq %r15, %rdi
callq 0x3740
xorl %r15d, %r15d
testq %r15, %r15
je 0x4b21
leaq 0x470b(%rip), %r12      # 0x91e7
leaq 0x18(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x33b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x55ea
xorl %edi, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x33b0
testq %rax, %rax
jne 0x4aef
movq %r14, %rdi
callq 0x8489
movq %r15, %rdi
callq 0x3740
movb $0x1, %r15b
jmp 0x4b2c
movq %r14, %rdi
callq 0x8489
xorl %r15d, %r15d
movl %r15d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x3740
jmp 0x4a5c