LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: enter_directory
static bool enter_directory(struct application *app, const char *oldpathname)
{
	while(1) {
		const char *cwd = path_tocstr(&app->cwd);

		if(app->inotify_fd != -1) {
			if(app->inotify_watch != -1)
				inotify_rm_watch(app->inotify_fd, app->inotify_watch);

			app->inotify_watch = inotify_add_watch(app->inotify_fd, cwd,
				IN_CREATE |
				IN_ATTRIB |
				IN_DELETE |
				IN_MOVED_FROM |
				IN_MOVED_TO |
				IN_MODIFY |
				IN_EXCL_UNLINK
				);
		}

		if(chdir(cwd) == 0 && dirmodel_change_directory(&app->model, cwd))
			break;

		if(strcmp(cwd, "/") == 0) {
			puts("Cannot even open \"/\", exiting");
			app->running = false;
			return false;
		}
		path_remove_component(&app->cwd, &oldpathname);
	}

	update_terminal_title(app);
	select_stored_position(app, oldpathname);
	display_current_path(app);
	refresh_statusbar(app);
	listview_refresh(&app->view);

	app->inotify_cookie = 0;

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %rsi, (%r15)
leaq 0x140(%rdi), %r14
leaq 0x28(%rdi), %r12
movq %r14, %rdi
callq 0x8050
movq %rax, %r13
movl 0x1b0(%rbx), %edi
cmpl $-0x1, %edi
je 0x4b65
movl 0x1b4(%rbx), %esi
cmpl $-0x1, %esi
je 0x4b52
callq 0x36b0
movl 0x1b0(%rbx), %edi
movq %r13, %rsi
movl $0x40003c6, %edx        # imm = 0x40003C6
callq 0x34b0
movl %eax, 0x1b4(%rbx)
movq %r13, %rdi
callq 0x3250
testl %eax, %eax
jne 0x4b80
movq %r12, %rdi
movq %r13, %rsi
callq 0x684e
testb %al, %al
jne 0x4bb5
cmpb $0x2f, (%r13)
jne 0x4b8e
cmpb $0x0, 0x1(%r13)
je 0x4b9b
movq %r14, %rdi
movq %r15, %rsi
callq 0x80ff
jmp 0x4b26
leaq 0x45ff(%rip), %rdi      # 0x91a1
callq 0x3160
movb $0x0, 0x1c0(%rbx)
xorl %eax, %eax
jmp 0x4c7c
leaq 0x4603(%rip), %rdi      # 0x91bf
callq 0x31f0
testl %eax, %eax
je 0x4c24
leaq 0x45f6(%rip), %rdi      # 0x91c2
callq 0x35f0
movq %rax, %rdi
callq 0x3510
leaq 0x45e6(%rip), %rdi      # 0x91c6
callq 0x3510
movq %r14, %rdi
callq 0x8050
movq %rax, %rdi
callq 0x3510
leaq 0x45d0(%rip), %rdi      # 0x91cc
callq 0x3510
leaq 0x45c6(%rip), %rdi      # 0x91ce
callq 0x35f0
movq %rax, %rdi
callq 0x3510
movq 0x83ac(%rip), %rax      # 0xcfc8
movq (%rax), %rdi
callq 0x34a0
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
jne 0x4c50
movq 0xe0(%rbx), %r15
movq %r14, %rdi
callq 0x8050
movq %r15, %rdi
movq %rax, %rsi
callq 0x5fd8
movq %rax, %rsi
testq %rax, %rax
je 0x4c58
movq %rbx, %rdi
callq 0x50aa
movq %rbx, %rdi
callq 0x51f1
movq %rbx, %rdi
callq 0x4d1e
movq %rbx, %rdi
callq 0x7bf0
movl $0x0, 0x1b8(%rbx)
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: application_destroy
void application_destroy(struct application *app)
{
	free((void*)app->lastsearch_regex);
	listview_destroy(&app->view);
	path_destroy(&app->cwd);
	commandline_destroy(&app->commandline);
	if(app->status)
		delwin(app->status);
	if(app->pathbar)
		delwin(app->pathbar);
	dict_delete(app->stored_positions, true);
	dirmodel_destroy(&app->model);
	keymap_destroy(&app->keymap);
	clipboard_destroy(&app->clipboard);
	processmanager_destroy(&app->pm);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x1c8(%rdi), %rdi
callq 0x3740
movq %rbx, %rdi
callq 0x8029
leaq 0x140(%rbx), %rdi
callq 0x837d
leaq 0xf8(%rbx), %rdi
callq 0x5e85
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x4ccb
callq 0x31e0
movq 0xe8(%rbx), %rdi
testq %rdi, %rdi
je 0x4cdc
callq 0x31e0
movq 0xe0(%rbx), %rdi
movl $0x1, %esi
callq 0x5ec3
leaq 0x28(%rbx), %rdi
callq 0x6b94
leaq 0x168(%rbx), %rdi
callq 0x6e8a
leaq 0x150(%rbx), %rdi
callq 0x5360
addq $0x180, %rbx            # imm = 0x180
movq %rbx, %rdi
popq %rbx
jmp 0x852e
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: save_current_position
static void save_current_position(struct application *app)
{
	if(listmodel_count(&app->model.listmodel) != 0) {
		free(dict_get(app->stored_positions, path_tocstr(&app->cwd)));

		size_t index = listview_getindex(&app->view);
		const char *filename = dirmodel_getfilename(&app->model, index);

		char *filename_copy = strdup(filename);
		if(filename_copy == NULL)
			return;
		if(!dict_set(app->stored_positions, path_tocstr(&app->cwd), filename_copy))
			free(filename_copy);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28(%rdi), %r15
movq %r15, %rdi
callq 0x7a7c
testq %rax, %rax
je 0x4ffc
movq 0xe0(%rbx), %r12
leaq 0x140(%rbx), %r14
movq %r14, %rdi
callq 0x8050
movq %r12, %rdi
movq %rax, %rsi
callq 0x5fd8
movq %rax, %rdi
callq 0x3740
movq %rbx, %rdi
callq 0x7eb3
movq %r15, %rdi
movq %rax, %rsi
callq 0x6811
movq %rax, %rdi
callq 0x36a0
testq %rax, %rax
je 0x4ffc
movq %rax, %r15
movq 0xe0(%rbx), %rbx
movq %r14, %rdi
callq 0x8050
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x5f2e
testb %al, %al
je 0x5008
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3740
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: background_process_and_unblock_signals
static void background_process_and_unblock_signals(void)
{
	int fd = open("/dev/null", O_RDWR);
	dup2(fd, 0);
	dup2(fd, 1);
	dup2(fd, 2);

	unblock_signals();
}

// Assembly:
pushq %rbx
leaq 0x40fc(%rip), %rdi      # 0x9171
movl $0x2, %esi
xorl %eax, %eax
callq 0x3600
movl %eax, %ebx
movl %eax, %edi
xorl %esi, %esi
callq 0x3270
movl %ebx, %edi
movl $0x1, %esi
callq 0x3270
movl %ebx, %edi
movl $0x2, %esi
callq 0x3270
popq %rbx
jmp 0x501b
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: select_filename
static void select_filename(struct application *app, const char *filename)
{
	size_t index;

	if(!dirmodel_get_index(&app->model, filename, &index))
		return;
	if(index == listmodel_count(&app->model.listmodel))
		index--;
	listview_setindex(&app->view, index);
	listview_refresh(&app->view);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x6168
testb %al, %al
je 0x50fa
movq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x7a7c
movq 0x8(%rsp), %rsi
cmpq %rax, %r15
jne 0x50ea
decq %rsi
movq %rsi, 0x8(%rsp)
movq %rbx, %rdi
callq 0x7eaa
movq %rbx, %rdi
callq 0x7bf0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: insert_current_file_into_commandline
static void insert_current_file_into_commandline(struct application *app)
{
	if(listmodel_count(&app->model.listmodel) == 0)
		return;

	size_t index = listview_getindex(&app->view);
	const char *filename = dirmodel_getfilename(&app->model, index);
	size_t length = mbstowcs(NULL, filename, 0);

	if(length != (size_t)-1) {
		wchar_t buffer[length + 1];
		mbstowcs(buffer, filename, length);

		for(size_t i = 0; i < length; i++)
			commandline_handlekey(&app->commandline, buffer[i], false);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %r14, %rdi
callq 0x7a7c
testq %rax, %rax
je 0x51e2
movq %rbx, %rdi
callq 0x7eb3
movq %r14, %rdi
movq %rax, %rsi
callq 0x6811
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
callq 0x31a0
cmpq $-0x1, %rax
je 0x51e2
movq %rax, %r14
movq %rsp, %r13
movq %rsp, %r15
leaq 0x13(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x31a0
testq %r14, %r14
je 0x51df
addq $0xf8, %rbx
xorl %r12d, %r12d
movl (%r15,%r12,4), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5879
incq %r12
cmpq %r12, %r14
jne 0x51c9
movq %r13, %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/application.c
// Function: display_current_path
static void display_current_path(struct application *app)
{
	wmove(app->pathbar, 0, 0);
	werase(app->pathbar);
	wprintw(app->pathbar, "%s", path_tocstr(&app->cwd));
	wrefresh(app->pathbar);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xe8(%rdi), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3090
movq 0xe8(%rbx), %rdi
callq 0x30e0
movq 0xe8(%rbx), %r14
leaq 0x140(%rbx), %rdi
callq 0x8050
leaq 0x3f1a(%rip), %rsi      # 0x9148
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3730
movq 0xe8(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3390
nop
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/clipboard.c
// Function: clipboard_set_contents
bool clipboard_set_contents(struct clipboard *clipboard, const char *path, const struct list *filelist)
{
	if(clipboard->shared_clipboard_path) {
		int clipboard_dir_fd = open(clipboard->shared_clipboard_path, O_RDONLY);
		if(clipboard_dir_fd == -1) {
			free((void *)path);
			list_delete(filelist, free);
			return false;
		}

		unlinkat(clipboard_dir_fd, CLIPBOARD_PATH, 0);
		unlinkat(clipboard_dir_fd, CLIPBOARD_LIST, 0);
		bool ret = dump_contents_to_directory(clipboard_dir_fd, path, filelist);

		free((void *)path);
		list_delete(filelist, free);
		close(clipboard_dir_fd);

		return ret;
	} else {
		clipboard_destroy(clipboard);
		clipboard->path = path;
		clipboard->filelist = filelist;
	}

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x52cc
xorl %esi, %esi
xorl %eax, %eax
callq 0x3600
cmpl $-0x1, %eax
je 0x52ef
movl %eax, %ebp
leaq 0x3f70(%rip), %rsi      # 0x91f0
movl %eax, %edi
xorl %edx, %edx
callq 0x3150
leaq 0x3f6f(%rip), %rsi      # 0x91ff
movl %ebp, %edi
xorl %edx, %edx
callq 0x3150
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5313
movl %eax, %r15d
movq %r14, %rdi
callq 0x3740
movq 0x7cf8(%rip), %rsi      # 0xcfb0
movq %rbx, %rdi
callq 0x7706
movl %ebp, %edi
callq 0x3320
movl %r15d, %eax
jmp 0x5308
movq (%r15), %rdi
callq 0x3740
movq 0x7cd5(%rip), %rsi      # 0xcfb0
movq 0x8(%r15), %rdi
callq 0x7706
movq %r14, (%r15)
movq %rbx, 0x8(%r15)
movb $0x1, %al
jmp 0x5308
movq %r14, %rdi
callq 0x3740
movq 0x7cb2(%rip), %rsi      # 0xcfb0
movq %rbx, %rdi
callq 0x7706
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/clipboard.c
// Function: dump_contents_to_directory
static bool dump_contents_to_directory(int dir_fd, const char *path, const struct list *filelist) {
	if(path && filelist) {
		if(!dump_string_to_file(dir_fd, CLIPBOARD_PATH, path))
			return false;

		if(!dump_filelist_to_file(dir_fd, CLIPBOARD_LIST, filelist))
			return false;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x5353
movq %rsi, %rdx
movl %edi, %ebp
leaq 0x3ebb(%rip), %rsi      # 0x91f0
callq 0x8867
testb %al, %al
je 0x5357
leaq 0x3eba(%rip), %rsi      # 0x91ff
movl %ebp, %edi
movq %rbx, %rdx
callq 0x88b5
testb %al, %al
je 0x5357
movb $0x1, %al
jmp 0x5359
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/clipboard.c
// Function: clipboard_dump_contents_to_directory
bool clipboard_dump_contents_to_directory(struct clipboard *clipboard, int dir_fd)
{
	if(clipboard->shared_clipboard_path) {
		int clipboard_dir_fd = open(clipboard->shared_clipboard_path, O_RDONLY);
		if(clipboard_dir_fd == -1)
			return false;

		if((faccessat(clipboard_dir_fd, CLIPBOARD_PATH, F_OK, 0) != 0 &&
		    faccessat(clipboard_dir_fd, CLIPBOARD_LIST, F_OK, 0) != 0) ||
		   (linkat(clipboard_dir_fd, CLIPBOARD_PATH, dir_fd, CLIPBOARD_PATH, 0) == 0 &&
		    linkat(clipboard_dir_fd, CLIPBOARD_LIST, dir_fd, CLIPBOARD_LIST, 0) == 0)) {
			close(clipboard_dir_fd);
			return true;
		}
		close(clipboard_dir_fd);
		return false;
	} else {
		return dump_contents_to_directory(dir_fd, clipboard->path, clipboard->filelist);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %rax
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x53de
xorl %r14d, %r14d
xorl %esi, %esi
xorl %eax, %eax
callq 0x3600
cmpl $-0x1, %eax
je 0x542e
movl %eax, %ebp
leaq 0x3e43(%rip), %rsi      # 0x91f0
movl %eax, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3190
testl %eax, %eax
je 0x53f0
leaq 0x3e3c(%rip), %rsi      # 0x91ff
movl %ebp, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3190
testl %eax, %eax
je 0x53f0
movl %ebp, %edi
callq 0x3320
movb $0x1, %r14b
jmp 0x542e
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movl %ebx, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x5313
leaq 0x3df9(%rip), %rcx      # 0x91f0
movl %ebp, %edi
movq %rcx, %rsi
movl %ebx, %edx
xorl %r8d, %r8d
callq 0x3550
testl %eax, %eax
jne 0x5424
leaq 0x3dee(%rip), %rcx      # 0x91ff
movl %ebp, %edi
movq %rcx, %rsi
movl %ebx, %edx
xorl %r8d, %r8d
callq 0x3550
testl %eax, %eax
je 0x53d2
movl %ebp, %edi
callq 0x3320
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandexecutor.c
// Function: command_parse
static int command_parse(char *command, command_ptr *commandptr, char **param, struct command_map *commandmap)
{
	bool param_mandatory;
	bool characters_after_command = false;

	char *token = command;
	size_t length = strcspn(token, " \t");

	if(length > 0) {
		if(token[length] != '\0')
			characters_after_command = true;
		token[length] = '\0';
		map_command(commandmap, token, commandptr, &param_mandatory);
		if(*commandptr == NULL)
			return EINVAL;
	} else
		return EINVAL;

	if(characters_after_command) {
		token = token + length + 1 + strspn(token + length + 1, " \t");
		if(token[0] != '\0') {
			*param = token;
			return 0;
		}
	}

	*param = NULL;
	if(param_mandatory)
		return EINVAL;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r13
leaq 0x3d4d(%rip), %rsi      # 0x920e
callq 0x33a0
movl $0x16, %ebp
testq %rax, %rax
je 0x5568
movq %rax, %r14
movq %rbx, (%rsp)
movb (%r13,%rax), %bl
movb $0x0, (%r13,%rax)
movq $0x0, (%r12)
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5568
addq %r13, %r14
addq $0x18, %r15
movq %r13, %rsi
callq 0x33d0
testl %eax, %eax
je 0x5517
movq (%r15), %rdi
addq $0x18, %r15
testq %rdi, %rdi
jne 0x54fd
jmp 0x5568
movq -0x10(%r15), %rax
movq %rax, (%r12)
xorl %r12d, %r12d
cmpb $0x0, -0x8(%r15)
movl $0x16, %ebp
cmovnel %ebp, %r12d
testq %rax, %rax
je 0x5568
testb %bl, %bl
je 0x555c
leaq 0x1(%r14), %rdi
leaq 0x3cca(%rip), %rsi      # 0x920e
callq 0x3340
cmpb $0x0, 0x1(%r14,%rax)
je 0x555c
addq %r14, %rax
incq %rax
xorl %r12d, %r12d
jmp 0x555e
xorl %eax, %eax
movq (%rsp), %rcx
movq %rax, (%rcx)
movl %r12d, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandexecutor.c
// Function: commandexecutor_execute
int commandexecutor_execute(struct commandexecutor *commandexecutor, char *command) {
	command_ptr commandptr;
	char *param;

	int ret = command_parse(command, &commandptr, &param, commandexecutor->commandmap);
	if(ret == 0)
		commandptr(commandexecutor, param);
	else
		return ret;
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, %rbx
movq (%rdi), %rcx
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x54a3
movl %eax, %ebp
testl %eax, %eax
jne 0x55ac
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq *0x10(%rsp)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_start
int commandline_start(struct commandline *commandline, wchar_t prompt)
{
	commandline->prompt[0] = prompt;
	commandline->cursor_pos = 0;
	commandline->first = 0;
	commandline->history_position = 0;

	if(commandline->backup_buffer) {
		commandline->buffer = commandline->backup_buffer;
		commandline->backup_buffer = NULL;
	}
	if(commandline->buffer == NULL)
		commandline->buffer = malloc(commandline->allocated_size * sizeof(wchar_t));
	if(commandline->buffer == NULL)
		return ENOMEM;

	commandline->buffer[0] = L'\0';

	commandline_updateview(commandline);

	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl %esi, 0x30(%rdi)
movq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x561f
movq %rax, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
jmp 0x563e
movq 0x18(%rbx), %rax
testq %rax, %rax
jne 0x563e
movq 0x28(%rbx), %rdi
shlq $0x2, %rdi
callq 0x3490
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x5650
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x5657
xorl %eax, %eax
popq %rbx
retq
movl $0xc, %eax
jmp 0x564e
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_copy_history_buffer
static int commandline_copy_history_buffer(struct commandline *commandline)
{
	if(commandline->history_position == 0)
		return 0;

	wchar_t *history_buffer = commandline->buffer;
	commandline->buffer = commandline->backup_buffer;
	commandline->backup_buffer = NULL;

	while(commandline->allocated_size < wcslen(history_buffer) + 1) {
		if(commandline_makeroom(commandline) != 0)
			return ENOMEM;
	}

	wcscpy(commandline->buffer, history_buffer);
	commandline->history_position = 0;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rdi)
je 0x5c3a
movq %rdi, %r14
movq 0x18(%rdi), %r15
movq 0x20(%rdi), %r12
movq %r12, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movq 0x28(%rdi), %r13
movq %r15, %rdi
callq 0x3280
incq %rax
cmpq %rax, %r13
jae 0x5c20
leaq (,%r13,8), %rsi
movq %r12, %rdi
callq 0x3520
testq %rax, %rax
je 0x5c35
movq %rax, %r12
addq %r13, %r13
movq %rax, 0x18(%r14)
movq %r13, 0x28(%r14)
jmp 0x5beb
movq %r12, %rdi
movq %r15, %rsi
callq 0x33e0
movq $0x0, 0x10(%r14)
jmp 0x5c3a
movl $0xc, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_delete_character_before_cursor
static void commandline_delete_character_before_cursor(struct commandline *commandline)
{
	size_t oldcursorpos = commandline->cursor_pos;
	size_t length = wcslen(commandline->buffer);

	if(commandline->cursor_pos > 0) {
		size_t distance = 0;
		int width;
		do {
			width = wcwidth(commandline->buffer[commandline->cursor_pos - 1]);
			distance++;
			commandline->cursor_pos--;
		} while(commandline->cursor_pos > 0 && width < 1);

		wmemmove(commandline->buffer + commandline->cursor_pos, commandline->buffer + oldcursorpos, length - commandline->cursor_pos);
		commandline->buffer[length - distance] = L'\0';
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x38(%rbx), %r15
callq 0x3280
testq %r15, %r15
je 0x5cb6
movq %rax, %r14
leaq (,%rax,4), %r12
movq %r15, %rcx
movq 0x18(%rbx), %rax
movl -0x4(%rax,%rcx,4), %edi
callq 0x3480
movq 0x38(%rbx), %rcx
addq $-0x4, %r12
decq %rcx
movq %rcx, 0x38(%rbx)
je 0x5c93
testl %eax, %eax
jle 0x5c71
movq 0x18(%rbx), %rax
leaq (%rax,%rcx,4), %rdi
leaq (%rax,%r15,4), %rsi
subq %rcx, %r14
movq %r14, %rdx
callq 0x35d0
movq 0x18(%rbx), %rax
movl $0x0, (%rax,%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_makeroom
static int commandline_makeroom(struct commandline *commandline)
{
	size_t newsize = commandline->allocated_size * 2;
	wchar_t *newbuffer = realloc(commandline->buffer, newsize * sizeof(wchar_t));

	if(newbuffer == NULL)
		return ENOMEM;

	commandline->buffer = newbuffer;
	commandline->allocated_size = newsize;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x28(%rbx), %r14
leaq (,%r14,8), %rsi
callq 0x3520
testq %rax, %rax
je 0x5cf2
addq %r14, %r14
movq %rax, 0x18(%rbx)
movq %r14, 0x28(%rbx)
xorl %eax, %eax
jmp 0x5cf7
movl $0xc, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_resize
void commandline_resize(struct commandline *commandline, unsigned int x, unsigned int y, unsigned int width)
{
	mvwin(commandline->window, y, x);
	wresize(commandline->window, 1, width);
	if(commandline->buffer)
		commandline_updateview(commandline);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %esi, %eax
movq %rdi, %rbx
movq (%rdi), %rdi
movl %edx, %esi
movl %eax, %edx
callq 0x35c0
movq (%rbx), %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0x3650
cmpq $0x0, 0x18(%rbx)
je 0x5d3e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5657
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_history_add
int commandline_history_add(struct commandline *commandline, const wchar_t *command)
{
	if(command == NULL)
		return EINVAL;

	/* filter out commands only consisting of whitespace */
	for(size_t i = 0; ; i++) {
		if(i == wcslen(command))
			return EINVAL;
		if(!iswspace(command[i]))
			break;
	}

	/* make old entry with same content the newest entry and ignore the new addition */
	for(size_t i = 0; i < list_length(commandline->history); i++) {
		if(wcscmp(command, list_get_item(commandline->history, i)) == 0) {
			list_move_item(commandline->history, i, list_length(commandline->history) - 1);
			return 0;
		}
	}

	wchar_t *commanddup = wcsdup(command);
	if(commanddup == NULL) {
		return ENOMEM;
	}

	if(list_append(commandline->history, commanddup))
		return 0;
	else {
		free(commanddup);
		return ENOMEM;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0x16, %ebp
testq %rsi, %rsi
je 0x5e1e
movq %rsi, %r14
cmpl $0x0, (%rsi)
je 0x5e1e
movq %rdi, %rbx
xorl %r15d, %r15d
movl (%r14,%r15,4), %edi
callq 0x3590
testl %eax, %eax
je 0x5d8e
incq %r15
movq %r14, %rdi
callq 0x3280
cmpq %rax, %r15
jne 0x5d6c
jmp 0x5e1e
movq 0x8(%rbx), %rdi
callq 0x774e
testq %rax, %rax
je 0x5dcb
xorl %r15d, %r15d
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0x7929
movq %r14, %rdi
movq %rax, %rsi
callq 0x30b0
testl %eax, %eax
je 0x5e01
incq %r15
movq 0x8(%rbx), %rdi
callq 0x774e
cmpq %rax, %r15
jb 0x5d9f
movq %r14, %rdi
callq 0x34f0
movl $0xc, %ebp
testq %rax, %rax
je 0x5e1e
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %rax, %rsi
callq 0x7752
xorl %ebp, %ebp
testb %al, %al
jne 0x5e1e
movq %r14, %rdi
callq 0x3740
movl $0xc, %ebp
jmp 0x5e1e
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x774e
leaq -0x1(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7837
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_init
bool commandline_init(struct commandline *commandline, unsigned int x, unsigned int y, unsigned int width)
{
	commandline->allocated_size = 1;
	commandline->buffer = NULL;
	commandline->backup_buffer = NULL;
	commandline->prompt[1] = L'\0';
	commandline->window = newwin(1, width, y, x);
	if(commandline->window == NULL)
		return false;
	commandline->history = list_new(0);
	if(commandline->history == NULL) {
		delwin(commandline->window);
		commandline->window = NULL;
		return false;
	}
	return true;
}

// Assembly:
pushq %rbx
movl %esi, %eax
movq %rdi, %rbx
movq $0x1, 0x28(%rdi)
movl $0x0, 0x34(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movl $0x1, %edi
movl %ecx, %esi
movl %eax, %ecx
callq 0x3030
movq %rax, (%rbx)
testq %rax, %rax
je 0x5e81
xorl %edi, %edi
callq 0x76b0
movq %rax, %rcx
movq %rax, 0x8(%rbx)
movb $0x1, %al
testq %rcx, %rcx
jne 0x5e83
movq (%rbx), %rdi
callq 0x31e0
movq $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/commandline.c
// Function: commandline_destroy
void commandline_destroy(struct commandline *commandline)
{
	if(commandline->window != NULL)
		delwin(commandline->window);
	if(commandline->backup_buffer)
		free(commandline->backup_buffer);
	else
		free(commandline->buffer);
	list_delete(commandline->history, free);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x5e96
callq 0x31e0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
jne 0x5ea3
movq 0x18(%rbx), %rdi
callq 0x3740
movq 0x8(%rbx), %rdi
movq 0x70fd(%rip), %rsi      # 0xcfb0
popq %rbx
jmp 0x7706
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dict.c
// Function: dict_delete
void dict_delete(struct list *list, bool free_value)
{
	struct dict_item *item;

	if(list == NULL)
		return;

	size_t length = list_length(list);;
	for(size_t i = 0; i < length; i++) {
		item = list_get_item(list, i);
		if(free_value)
			free(item->value);
		free((void*)item->key);
		free(item);
	}
	list_delete(list, NULL);
}

// Assembly:
testq %rdi, %rdi
je 0x5f2d
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x774e
testq %rax, %rax
je 0x5f1b
movq %rax, %r14
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7929
movq %rax, %r12
testb %bpl, %bpl
je 0x5f02
movq 0x8(%r12), %rdi
callq 0x3740
movq (%r12), %rdi
callq 0x3740
movq %r12, %rdi
callq 0x3740
incq %r15
cmpq %r15, %r14
jne 0x5ee5
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7706
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dict.c
// Function: dict_set
bool dict_set(struct list *list, const char *key, void *value)
{
	struct dict_item *item, needle;

	size_t index;
	bool found;

	needle.key = key;

	found = list_find_item_or_insertpoint(list, compare_key, &needle, &index);
	if(found) {
		item = list_get_item(list, index);
	} else {
		item = malloc(sizeof(*item));
		if(item == NULL)
			return false;

		item->key = strdup(key);
		if(item->key == NULL) {
			free(item);
			return false;
		}
		if(!list_insert(list, index, item)) {
			free((void*)item->key);
			free(item);
			return false;
		}
	}
	item->value = value;

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
leaq 0x76(%rip), %rsi        # 0x5fc7
movq %rsp, %rcx
callq 0x7999
testb %al, %al
je 0x5f74
movq (%rsp), %rsi
movq %r15, %rdi
callq 0x7929
movq %rax, %r14
movq %rbx, 0x8(%r14)
movb $0x1, %al
jmp 0x5fbb
movl $0x10, %edi
callq 0x3490
testq %rax, %rax
je 0x5fb9
movq %rax, %r14
movq %r12, %rdi
callq 0x36a0
movq %rax, (%r14)
testq %rax, %rax
je 0x5fb1
movq (%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x77ba
testb %al, %al
jne 0x5f6c
movq (%r14), %rdi
callq 0x3740
movq %r14, %rdi
callq 0x3740
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dict.c
// Function: dict_get
void *dict_get(struct list *list, const char *key)
{
	struct dict_item item;
	size_t index;
	bool found;

	item.key = key;

	found = list_find_item_or_insertpoint(list, compare_key, &item, &index);
	if(found) {
		struct dict_item *item = list_get_item(list, index);
		return item->value;
	}
	return NULL;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rdx
movq %rsi, (%rdx)
leaq -0x28(%rip), %rsi       # 0x5fc7
leaq 0x8(%rsp), %rcx
callq 0x7999
testb %al, %al
je 0x6010
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x7929
movq 0x8(%rax), %rax
jmp 0x6012
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_getmarkedfilenames
int dirmodel_getmarkedfilenames(struct dirmodel *model, const struct list **markedlist_out)
{
	struct list *list = model->sortedlist;
	struct list *markedlist = list_new(0);

	if(markedlist == NULL)
		return ENOMEM;

	size_t length = list_length(list);

	for(size_t i = 0; i < length; i++)
	{
		struct filedata *filedata = list_get_item(list, i);
		if(filedata->is_marked) {
			char *filename = strdup(filedata->filename);
			if(filename == NULL) {
				list_delete(markedlist, free);
				return ENOMEM;
			}
			if(!list_append(markedlist, filename)) {
				free(filename);
				list_delete(markedlist, free);
				return ENOMEM;
			}
		}
	}
	if(list_length(markedlist) == 0) {
		list_delete(markedlist, NULL);
		return ENOENT;
	}

	*markedlist_out = markedlist;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq 0x30(%rdi), %r12
xorl %edi, %edi
callq 0x76b0
movl $0xc, %ebx
testq %rax, %rax
je 0x60e3
movq %rax, %r14
movq %r15, (%rsp)
movq %r12, %rdi
callq 0x774e
testq %rax, %rax
je 0x60a3
movq %rax, %r13
xorl %ebp, %ebp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7929
cmpb $0x1, 0xa8(%rax)
jne 0x609b
movq (%rax), %rdi
callq 0x36a0
testq %rax, %rax
je 0x60d4
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x7752
testb %al, %al
je 0x60cc
incq %rbp
cmpq %rbp, %r13
jne 0x6068
movq %r14, %rdi
callq 0x774e
testq %rax, %rax
je 0x60bb
movq (%rsp), %rax
movq %r14, (%rax)
xorl %ebx, %ebx
jmp 0x60e3
movq %r14, %rdi
xorl %esi, %esi
callq 0x7706
movl $0x2, %ebx
jmp 0x60e3
movq %r15, %rdi
callq 0x3740
movq 0x6ed5(%rip), %rsi      # 0xcfb0
movq %r14, %rdi
callq 0x7706
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_get_internal_index
bool dirmodel_get_internal_index(struct dirmodel *model, const char *filename, size_t *internal_index, size_t *index)
{
	struct filedata filedata;

	filedata.filename = filename;

	if(!list_find_item_or_insertpoint(model->list, filedata_listcompare_filename, &filedata, internal_index))
		return false;

	struct filedata *internal_filedata = list_get_item(model->list, *internal_index);
	if(!list_find_item_or_insertpoint(model->sortedlist, model->sort_compare, internal_filedata, index))
		return false;
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
movq %rsp, %rdx
movq %rsi, (%rdx)
movq 0x28(%rdi), %rdi
leaq 0xd77(%rip), %rsi       # 0x6ea0
movq %r15, %rcx
callq 0x7999
testb %al, %al
je 0x6159
movq 0x28(%r14), %rdi
movq (%r15), %rsi
callq 0x7929
movq 0x30(%r14), %rdi
movq 0x90(%r14), %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x7999
jmp 0x615b
xorl %eax, %eax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_regex_getnext
size_t dirmodel_regex_getnext(struct dirmodel *model, const char *regex, size_t start_index, int direction)
{
	struct list *list = model->sortedlist;
	regex_t cregex;
	size_t result = start_index;

	int ret = regcomp(&cregex, regex, REG_EXTENDED | REG_ICASE | REG_NOSUB);
	if(ret != 0)
		return start_index;

	if(direction > 0 && start_index < SIZE_MAX) {
		size_t length = list_length(list);
		for(size_t i = start_index + 1; i < length; i++) {
			struct filedata *filedata = list_get_item(list, i);
			if(regexec(&cregex, filedata->filename, 0, NULL, 0) == 0) {
				result = i;
				break;
			}
		}
	} else if(direction < 0 && start_index > 0) {
		for(size_t i = start_index - 1; i > 0; i--) {
			struct filedata *filedata = list_get_item(list, i);
			if(regexec(&cregex, filedata->filename, 0, NULL, 0) == 0) {
				result = i;
				break;
			}
		}
	}

	regfree(&cregex);
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq 0x30(%rdi), %r14
leaq 0x8(%rsp), %rdi
movl $0xb, %edx
callq 0x3370
testl %eax, %eax
jne 0x6249
testl %ebp, %ebp
setle %al
cmpq $-0x1, %rbx
sete %cl
orb %al, %cl
jne 0x61f2
movq %r14, %rdi
callq 0x774e
movq %rax, %r12
leaq 0x8(%rsp), %r13
movq %rbx, %r15
incq %r15
cmpq %r12, %r15
jae 0x6239
movq %r14, %rdi
movq %r15, %rsi
callq 0x7929
movq (%rax), %rsi
movq %r13, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x34d0
testl %eax, %eax
jne 0x61c7
jmp 0x623c
testl %ebp, %ebp
setns %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x6239
leaq -0x1(%rbx), %rsi
leaq 0x8(%rsp), %r12
movq %rsi, %r15
subq $0x1, %r15
jb 0x6239
movq %r14, %rdi
callq 0x7929
movq (%rax), %rsi
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x34d0
movq %r15, %rsi
testl %eax, %eax
jne 0x620d
incq %r15
jmp 0x623c
movq %rbx, %r15
leaq 0x8(%rsp), %rdi
callq 0x3220
movq %r15, %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_regex_setmark
void dirmodel_regex_setmark(struct dirmodel *model, const char *regex, bool mark)
{
	struct list *list = model->sortedlist;
	regex_t cregex;

	int ret = regcomp(&cregex, regex, REG_EXTENDED | REG_ICASE | REG_NOSUB);
	if(ret != 0)
		return;

	size_t length = list_length(list);

	for(size_t i = 0; i < length; i++) {
		struct filedata *filedata = list_get_item(list, i);
		if(regexec(&cregex, filedata->filename, 0, NULL, 0) == 0 &&
		   filedata->is_marked != mark) {
			if(mark) {
				dirmodel_update_marked_stats(model, NULL, filedata);
			} else {
				dirmodel_update_marked_stats(model, filedata, NULL);
			}
			filedata->is_marked = mark;
			listmodel_notify_change(&model->listmodel, MODEL_CHANGE, i, i);
		}
	}

	regfree(&cregex);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rdi, %r14
movq 0x30(%rdi), %r15
leaq 0x8(%rsp), %rdi
movl $0xb, %edx
callq 0x3370
testl %eax, %eax
jne 0x6342
movq %r15, %rdi
callq 0x774e
testq %rax, %rax
je 0x6338
movq %rax, %r12
movzbl %bl, %eax
decq %rax
orq $0x1, %rax
movq %rax, (%rsp)
xorl %r13d, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0x7929
movq %rax, %rbp
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x34d0
testl %eax, %eax
jne 0x632c
cmpb %bl, 0xa8(%rbp)
je 0x632c
leaq 0x40(%rbp), %rax
movq %rbp, %rcx
addq $0xa0, %rcx
cmpb $0x0, 0x8(%rbp)
cmoveq %rax, %rcx
movq (%rcx), %rax
movq %rax, %rcx
negq %rcx
testb %bl, %bl
cmovneq %rax, %rcx
addq %rcx, 0xa8(%r14)
movq (%rsp), %rax
addq %rax, 0xa0(%r14)
movb %bl, 0xa8(%rbp)
movq %r14, %rdi
movl $0x2, %esi
movq %r13, %rdx
movq %r13, %rcx
callq 0x7b76
incq %r13
cmpq %r13, %r12
jne 0x62ae
leaq 0x8(%rsp), %rdi
callq 0x3220
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_setfilter
bool dirmodel_setfilter(struct dirmodel *model, const char *regex)
{
	if(model->filter_active)
		regfree(&model->filter);

	if(regex == NULL) {
		model->filter_active = false;
	} else {
		int ret = regcomp(&model->filter, regex, REG_EXTENDED | REG_ICASE | REG_NOSUB);
		model->filter_active = (ret == 0);
	}

	return model->filter_active;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0x88(%rdi)
jne 0x636d
leaq 0x48(%rbx), %rdi
callq 0x3220
testq %r14, %r14
je 0x638a
leaq 0x48(%rbx), %rdi
movq %r14, %rsi
movl $0xb, %edx
callq 0x3370
testl %eax, %eax
sete %al
jmp 0x638c
xorl %eax, %eax
movb %al, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_notify_file_deleted
void dirmodel_notify_file_deleted(struct dirmodel *model, const char *filename)
{
	struct list *list = model->list;
	size_t index, internal_index;

	bool found = dirmodel_get_internal_index(model, filename, &internal_index, &index);
	if(found) {
		struct filedata *filedata = list_get_item(list, internal_index);
		if(filedata->is_marked) {
			dirmodel_update_marked_stats(model, filedata, NULL);
		}
		dirmodel_update_dirsize(model, filedata, NULL);
		filedata_delete(filedata);
		list_remove(list, internal_index);
		list_remove(model->sortedlist, index);
		listmodel_notify_change(&model->listmodel, MODEL_REMOVE, 0, index);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %r14
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x6103
testb %al, %al
je 0x6465
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x7929
movb 0x8(%rax), %cl
cmpb $0x0, 0xa8(%rax)
je 0x6412
testb $0x1, %cl
movl $0xa0, %edx
movl $0x40, %ecx
cmovneq %rdx, %rcx
movq (%rax,%rcx), %rdx
subq %rdx, 0xa8(%rbx)
decq 0xa0(%rbx)
jmp 0x6423
testb $0x1, %cl
movl $0xa0, %edx
movl $0x40, %ecx
cmovneq %rdx, %rcx
movq (%rax,%rcx), %rcx
subq %rcx, 0xb0(%rbx)
movq %rax, %rdi
callq 0x7695
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x78d7
movq 0x30(%rbx), %rdi
movq 0x10(%rsp), %rsi
callq 0x78d7
movq 0x10(%rsp), %rcx
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x7b76
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_notify_file_added_or_changed
int dirmodel_notify_file_added_or_changed(struct dirmodel *model, const char *filename)
{
	size_t index;
	bool found = list_find_item_or_insertpoint(model->addchange_queue, listcompare_strcmp, filename, &index);
	if(!found) {
		char *filename_copy = strdup(filename);
		if(filename_copy == NULL)
			return ENOMEM;
		if(!list_insert(model->addchange_queue, index, filename_copy)) {
			free(filename_copy);
			return ENOMEM;
		}
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq 0x38(%rdi), %rdi
leaq 0x51(%rip), %rsi        # 0x64d8
leaq 0x8(%rsp), %rcx
movq %r15, %rdx
callq 0x7999
xorl %ebx, %ebx
testb %al, %al
jne 0x64cc
movq %r15, %rdi
callq 0x36a0
testq %rax, %rax
je 0x64c7
movq %rax, %r15
movq 0x38(%r14), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0x77ba
testb %al, %al
jne 0x64cc
movq %r15, %rdi
callq 0x3740
movl $0xc, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_change_directory
bool dirmodel_change_directory(struct dirmodel *model, const char *path)
{
	internal_destroy(model);
	if(!internal_init(model, path))
		return false;
	listmodel_notify_change(&model->listmodel, MODEL_RELOAD, 0, 0);
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x6a2d
movq %r14, %rdi
callq 0x3200
testq %rax, %rax
je 0x6a1c
movq %rax, %r14
xorl %edi, %edi
callq 0x76b0
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x6a14
xorl %edi, %edi
callq 0x76b0
testq %rax, %rax
je 0x6a09
movq %rax, %r15
xorl %edi, %edi
callq 0x76b0
testq %rax, %rax
je 0x69fa
movq %rax, %r12
movq $0x0, 0xb0(%rbx)
movq %r14, %rdi
callq 0x3470
testq %rax, %rax
je 0x699e
movq %rax, %rbp
leaq 0x48(%rbx), %r13
cmpb $0x2e, 0x13(%rbp)
jne 0x68f6
movzbl 0x14(%rbp), %eax
testl %eax, %eax
je 0x698a
cmpl $0x2e, %eax
jne 0x68f6
cmpb $0x0, 0x15(%rbp)
je 0x698a
addq $0x13, %rbp
cmpb $0x1, 0x88(%rbx)
jne 0x6919
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x34d0
testl %eax, %eax
jne 0x698a
movq %r14, %rdi
callq 0x33f0
movq %rsp, %rdi
movl %eax, %esi
movq %rbp, %rdx
callq 0x753b
testl %eax, %eax
je 0x693c
cmpl $0xc, %eax
jne 0x698a
jmp 0x69e7
movq (%rsp), %rsi
movq %r12, %rdi
callq 0x7752
testb %al, %al
je 0x69e7
movq (%rsp), %rsi
movq %r15, %rdi
callq 0x7752
testb %al, %al
je 0x69e7
movq (%rsp), %rax
testq %rax, %rax
je 0x698a
leaq 0x40(%rax), %rcx
leaq 0xa0(%rax), %rdx
cmpb $0x0, 0x8(%rax)
cmovneq %rdx, %rcx
movq (%rcx), %rax
addq %rax, 0xb0(%rbx)
movq %r14, %rdi
callq 0x3470
movq %rax, %rbp
testq %rax, %rax
jne 0x68d5
movq %r14, 0x40(%rbx)
movq %r15, 0x28(%rbx)
movq %r12, 0x30(%rbx)
leaq 0x4ef(%rip), %rsi       # 0x6ea0
movq %r15, %rdi
callq 0x7985
movq 0x90(%rbx), %rsi
movq %r12, %rdi
callq 0x7985
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rbx)
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7b76
movb $0x1, %al
jmp 0x6a1e
movq (%rsp), %rdi
callq 0x7695
movq %r12, %rdi
xorl %esi, %esi
callq 0x7706
leaq 0xc94(%rip), %rsi       # 0x7695
movq %r15, %rdi
callq 0x7706
movq 0x38(%rbx), %rdi
xorl %esi, %esi
callq 0x7706
movq %r14, %rdi
callq 0x3350
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: internal_destroy
static void internal_destroy(struct dirmodel *model)
{
	struct list *list = model->list;
	if(list == NULL)
		return;

	closedir(model->dir);

	list_delete(list, (list_item_deallocator)filedata_delete);
	list_delete(model->sortedlist, NULL);
	list_delete(model->addchange_queue, free);
	model->list = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x28(%rdi), %r14
testq %r14, %r14
je 0x6a78
movq %rdi, %rbx
movq 0x40(%rdi), %rdi
callq 0x3350
leaq 0xc48(%rip), %rsi       # 0x7695
movq %r14, %rdi
callq 0x7706
movq 0x30(%rbx), %rdi
xorl %esi, %esi
callq 0x7706
movq 0x38(%rbx), %rdi
movq 0x6545(%rip), %rsi      # 0xcfb0
callq 0x7706
movq $0x0, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_init
void dirmodel_init(struct dirmodel *model)
{
	listmodel_init(&model->listmodel);

	model->list = NULL;
	model->sortedlist = NULL;
	model->listmodel.count = dirmodel_count;
	model->listmodel.render = dirmodel_render;
	model->listmodel.setmark = dirmodel_setmark;
	model->listmodel.ismarked = dirmodel_ismarked;
	model->filter_active = false;
	model->sort_compare = filedata_listcompare_directory_filename;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7bd5
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rbx)
leaq -0xa7f(%rip), %rax      # 0x6018
movq %rax, (%rbx)
leaq 0x31(%rip), %rax        # 0x6ad2
movq %rax, 0x8(%rbx)
leaq 0x56(%rip), %rax        # 0x6b02
movq %rax, 0x10(%rbx)
leaq 0xcb(%rip), %rax        # 0x6b82
movq %rax, 0x18(%rbx)
movb $0x0, 0x88(%rbx)
leaq 0x3e8(%rip), %rax       # 0x6eb1
movq %rax, 0x90(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_setmark
static void dirmodel_setmark(struct listmodel *listmodel, size_t index, bool mark)
{
	struct dirmodel *model = container_of(listmodel, struct dirmodel, listmodel);;
	struct list *list = model->sortedlist;
	struct filedata *filedata = list_get_item(list, index);

	if(filedata->is_marked == mark)
		return;

	if(mark) {
		dirmodel_update_marked_stats(model, NULL, filedata);
	} else {
		dirmodel_update_marked_stats(model, filedata, NULL);
	}
	filedata->is_marked = mark;
	listmodel_notify_change(listmodel, MODEL_CHANGE, index, index);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x30(%rdi), %rdi
callq 0x7929
cmpb %bpl, 0xa8(%rax)
jne 0x6b25
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x40(%rax), %rcx
movq %rax, %rdx
addq $0xa0, %rdx
cmpb $0x0, 0x8(%rax)
cmoveq %rcx, %rdx
movq (%rdx), %rcx
movq %rcx, %rdx
negq %rdx
testb %bpl, %bpl
cmovneq %rcx, %rdx
movzbl %bpl, %ecx
decq %rcx
orq $0x1, %rcx
addq %rdx, 0xa8(%r14)
addq %rcx, 0xa0(%r14)
movb %bpl, 0xa8(%rax)
movq %r14, %rdi
movl $0x2, %esi
movq %rbx, %rdx
movq %rbx, %rcx
popq %rbx
popq %r14
popq %rbp
jmp 0x7b76
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/dirmodel.c
// Function: dirmodel_destroy
void dirmodel_destroy(struct dirmodel *model)
{
	internal_destroy(model);
	listmodel_destroy(&model->listmodel);
	if(model->filter_active)
		regfree(&model->filter);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x6a2d
movq %rbx, %rdi
callq 0x7bde
cmpb $0x1, 0x88(%rbx)
jne 0x6bbb
addq $0x48, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x3220
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/keymap.c
// Function: keymap_handlekey
int keymap_handlekey(struct keymap *keymap, wint_t key, bool iskeycode)
{
	if(keymap->entries == NULL)
		return EINVAL;

	size_t length = list_length(keymap->entries);

	for(size_t i = 0; i < length; i++) {
		struct keymap_entry *curitem = list_get_item(keymap->entries, i);
		if(curitem->keyspec.key == key && curitem->keyspec.iskeycode == iskeycode) {
			char buffer[strlen(curitem->command) + 1];
			strcpy(buffer, curitem->command);

			return commandexecutor_execute(keymap->commandexecutor, buffer);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, -0x2c(%rbp)
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x6c1a
movl %esi, %r15d
callq 0x774e
testq %rax, %rax
je 0x6c16
movq %rax, %r12
xorl %r14d, %r14d
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x7929
cmpl %r15d, 0x4(%rax)
jne 0x6c0e
movq %rax, %r13
movl -0x2c(%rbp), %eax
cmpb %al, (%r13)
je 0x6c21
incq %r14
cmpq %r14, %r12
jne 0x6bf0
xorl %eax, %eax
jmp 0x6c58
movl $0x16, %eax
jmp 0x6c58
movq 0x8(%r13), %rdi
callq 0x3230
movq %rsp, %r15
movq %rsp, %r14
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
movq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x3110
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5579
movq %r15, %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/filedata.c
// Function: filedata_listcompare_directory_size_filename
int filedata_listcompare_directory_size_filename(const void *a, const void *b)
{
	struct filedata *filedata1 = *(struct filedata **)a;
	struct filedata *filedata2 = *(struct filedata **)b;

	if(!S_ISDIR(filedata1->stat.st_mode) && !S_ISDIR(filedata2->stat.st_mode)) {
		if(filedata1->stat.st_size < filedata2->stat.st_size)
			return -1;
		else if(filedata1->stat.st_size > filedata2->stat.st_size)
			return 1;
		return strcoll(filedata1->filename, filedata2->filename);
	}
	if(S_ISDIR(filedata1->stat.st_mode) && S_ISDIR(filedata2->stat.st_mode))
		return strcoll(filedata1->filename, filedata2->filename);
	if(S_ISDIR(filedata1->stat.st_mode))
		return -1;
	return 1;
}

// Assembly:
movq (%rdi), %rcx
movq (%rsi), %rdx
movl $0xf000, %esi           # imm = 0xF000
movl 0x28(%rcx), %eax
andl %esi, %eax
andl 0x28(%rdx), %esi
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x6f79
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x4000, %esi           # imm = 0x4000
jne 0x6f9c
movq (%rcx), %rdi
movq (%rdx), %rsi
jmp 0x34e0
movl $0x1, %eax
cmpl $0x4000, %esi           # imm = 0x4000
je 0x6f9c
movq 0x40(%rdx), %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rsi, 0x40(%rcx)
jl 0x6f9c
movl $0x1, %eax
jle 0x6f6e
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/filedata.c
// Function: filedata_listcompare_directory_mtime_filename
int filedata_listcompare_directory_mtime_filename(const void *a, const void *b)
{
	struct filedata *filedata1 = *(struct filedata **)a;
	struct filedata *filedata2 = *(struct filedata **)b;

	if(!(S_ISDIR(filedata1->stat.st_mode) ^ S_ISDIR(filedata2->stat.st_mode))) {
		if(filedata1->stat.st_mtime < filedata2->stat.st_mtime)
			return -1;
		else if(filedata1->stat.st_mtime > filedata2->stat.st_mtime)
			return 1;
		return strcoll(filedata1->filename, filedata2->filename);
	}
	if(S_ISDIR(filedata1->stat.st_mode))
		return -1;
	return 1;
}

// Assembly:
movq (%rdi), %rcx
movq (%rsi), %rdx
movl $0xf000, %esi           # imm = 0xF000
movl 0x28(%rcx), %eax
andl %esi, %eax
movl $0x4000, %edi           # imm = 0x4000
cmpl %edi, %eax
sete %r8b
andl 0x28(%rdx), %esi
cmpl %edi, %esi
sete %sil
xorb %r8b, %sil
je 0x7029
xorl %ecx, %ecx
cmpl $0x4000, %eax           # imm = 0x4000
setne %cl
leal -0x1(,%rcx,2), %eax
retq
movq 0x68(%rdx), %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rsi, 0x68(%rcx)
jl 0x703f
movl $0x1, %eax
jle 0x7040
retq
movq (%rcx), %rdi
movq (%rdx), %rsi
jmp 0x34e0