LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/filedata.c
// Function: filesize_to_string
void filesize_to_string(wchar_t *buf, off_t filesize)
{
	char suffix[] = {' ', 'K', 'M', 'G', 'T', 'P', 'E'};
	size_t cs = 0;
	off_t cv = filesize;

	while(cv > 1024 && cs < sizeof(suffix) - 1) {
		filesize = cv;
		cv /= 1024;
		cs++;
	}

	if(cv >= 10000)
		wcscpy(buf, INFO_SIZE_OVERFLOW);
	else if(cv < 100 && cs > 0)
		swprintf(buf, 6, L"%lu.%1lu%c", cv, (filesize - cv * 1024) * 10 / 1024, suffix[cs]);
	else
		swprintf(buf, 6, L"%lu%c", cv, suffix[cs]);
}

// Assembly:
movq %rsi, %rcx
cmpq $0x401, %rsi            # imm = 0x401
jl 0x729c
xorl %esi, %esi
movq %rcx, %rdx
shrq $0xa, %rcx
leaq 0x1(%rsi), %rax
cmpq $0x100400, %rdx         # imm = 0x100400
jb 0x7287
cmpq $0x5, %rsi
movq %rax, %rsi
jb 0x726a
cmpq $0x9c4000, %rdx         # imm = 0x9C4000
jb 0x72bd
leaq 0x203d(%rip), %rsi      # 0x92d4
jmp 0x33e0
xorl %eax, %eax
leaq 0x1ffb(%rip), %rdx      # 0x92a0
movsbl (%rax,%rdx), %r8d
leaq 0x2067(%rip), %rdx      # 0x9318
movl $0x6, %esi
xorl %eax, %eax
jmp 0x3410
cmpq $0x18fff, %rdx          # imm = 0x18FFF
ja 0x729e
andl $0x3ff, %edx            # imm = 0x3FF
addl %edx, %edx
leal (%rdx,%rdx,4), %r8d
shrl $0xa, %r8d
leaq 0x1fc3(%rip), %rdx      # 0x92a0
movsbl (%rax,%rdx), %r9d
leaq 0x2003(%rip), %rdx      # 0x92ec
movl $0x6, %esi
xorl %eax, %eax
jmp 0x3410
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/filedata.c
// Function: filedata_new_from_file
int filedata_new_from_file(struct filedata **filedata, int dirfd, const char *filename)
{
	struct stat stat;
	bool valid = true;

	if(fstatat(dirfd, filename, &stat, AT_SYMLINK_NOFOLLOW) != 0) {
		if(errno == ENOENT)
			return ENOENT;
		valid = false;
		memset(&stat, 0, sizeof(stat));
	}

	*filedata = malloc(sizeof(**filedata));
	if(*filedata == NULL)
		return ENOMEM;

	(*filedata)->filename = strdup(filename);
	if((*filedata)->filename == NULL) {
		free(*filedata);
		*filedata = NULL;
		return ENOMEM;
	}

	(*filedata)->is_marked = false;
	(*filedata)->is_stat_valid = valid;

	if(S_ISLNK(stat.st_mode)) {
		(*filedata)->is_link = true;
		(*filedata)->link_size = stat.st_size;
		if(fstatat(dirfd, (*filedata)->filename, &(*filedata)->stat, 0) != 0) {
			(*filedata)->is_link_broken = true;
			memcpy(&(*filedata)->stat, &stat, sizeof(stat));
		} else
			(*filedata)->is_link_broken = false;
	} else {
		(*filedata)->is_link = false;
		memcpy(&(*filedata)->stat, &stat, sizeof(stat));
	}

	/* st_size field is not used for directories, so zero it out to get
	 * better file size count statistics in dirmodel */
	if(S_ISDIR((*filedata)->stat.st_mode))
		(*filedata)->stat.st_size = 0;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
movl %esi, %edi
movq %r15, %rsi
movl $0x100, %ecx            # imm = 0x100
callq 0x3710
movl %eax, %r12d
testl %eax, %eax
je 0x7594
callq 0x30d0
movl $0x2, %r13d
cmpl $0x2, (%rax)
je 0x7680
leaq 0x8(%rsp), %rdi
movl $0x90, %edx
xorl %esi, %esi
callq 0x32e0
movl $0xb0, %edi
callq 0x3490
movq %rax, (%rbx)
movl $0xc, %r13d
testq %rax, %rax
je 0x7680
movq %rax, %r14
movq %r15, %rdi
callq 0x36a0
movq %rax, (%r14)
testq %rax, %rax
je 0x7632
testl %r12d, %r12d
movb $0x0, 0xa8(%r14)
sete 0xa9(%r14)
movl $0xf000, %ecx           # imm = 0xF000
andl 0x20(%rsp), %ecx
cmpl $0xa000, %ecx           # imm = 0xA000
jne 0x7643
movb $0x1, 0x8(%r14)
movq 0x38(%rsp), %rcx
movq %rcx, 0xa0(%r14)
addq $0x10, %r14
movl %ebp, %edi
movq %rax, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x3710
movq (%rbx), %r14
testl %eax, %eax
je 0x7660
movb $0x1, 0x9(%r14)
addq $0x10, %r14
leaq 0x8(%rsp), %rsi
movl $0x90, %edx
movq %r14, %rdi
callq 0x3450
movq (%rbx), %r14
jmp 0x7665
movq %r14, %rdi
callq 0x3740
movq $0x0, (%rbx)
jmp 0x7680
movb $0x0, 0x8(%r14)
movq %r14, %rdi
addq $0x10, %rdi
leaq 0x8(%rsp), %rsi
movl $0x90, %edx
callq 0x3450
jmp 0x7665
movb $0x0, 0x9(%r14)
movl $0xf000, %eax           # imm = 0xF000
andl 0x28(%r14), %eax
xorl %r13d, %r13d
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x7680
movq $0x0, 0x40(%r14)
movl %r13d, %eax
addq $0x98, %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/list.c
// Function: list_delete
void list_delete(const struct list *list, list_item_deallocator deallocator)
{
	if(list == NULL)
		return;
	if(deallocator)
		for(size_t i = 0; i < list->length; i++)
			deallocator(list->items[i]);
	free(list->items);
	free((void *)list);
}

// Assembly:
testq %rdi, %rdi
je 0x774d
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x7737
cmpq $0x0, (%rbx)
je 0x7737
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq *%r14
incq %r15
cmpq (%rbx), %r15
jb 0x7724
movq 0x10(%rbx), %rdi
callq 0x3740
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3740
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/list.c
// Function: list_append
bool list_append(struct list *list, void *item)
{
	if(list->length == list->allocated_items)
		if(!list_make_room(list))
			return false;

	list->items[list->length] = item;
	list->length++;

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
cmpq 0x8(%rdi), %rax
jne 0x7774
movq %rbx, %rdi
callq 0x7790
testb %al, %al
je 0x7786
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq %r14, (%rcx,%rax,8)
incq %rax
movq %rax, (%rbx)
movb $0x1, %al
jmp 0x7788
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/list.c
// Function: list_make_room
static bool list_make_room(struct list *list)
{
	void *newitems = realloc(list->items, 2 * list->allocated_items * sizeof(void *));
	if(newitems == NULL)
		return false;

	list->allocated_items *= 2;
	list->items = newitems;

	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rdi
shlq $0x4, %rsi
callq 0x3520
testq %rax, %rax
je 0x77b2
shlq 0x8(%rbx)
movq %rax, 0x10(%rbx)
testq %rax, %rax
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/list.c
// Function: list_insert
bool list_insert(struct list *list, size_t index, void *item)
{
	assert(index <= list->length);

	if(list->length == list->allocated_items)
		if(!list_make_room(list))
			return false;

	memmove(&list->items[index + 1], &list->items[index], (list->length - index) * sizeof(list->items[0]));
	list->items[index] = item;
	list->length++;

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq (%rdi), %rdx
cmpq %rsi, %rdx
jb 0x7818
movq %rsi, %r15
movq %rdi, %r14
cmpq 0x8(%rdi), %rdx
jne 0x77e5
movq %r14, %rdi
callq 0x7790
testb %al, %al
je 0x7810
movq (%r14), %rdx
movq 0x10(%r14), %rax
leaq (%rax,%r15,8), %rsi
leaq (%rax,%r15,8), %rdi
addq $0x8, %rdi
subq %r15, %rdx
shlq $0x3, %rdx
callq 0x35b0
movq 0x10(%r14), %rax
movq %rbx, (%rax,%r15,8)
incq (%r14)
movb $0x1, %al
jmp 0x7812
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1b5d(%rip), %rdi      # 0x937c
leaq 0x1b6c(%rip), %rsi      # 0x9392
leaq 0x1b70(%rip), %rcx      # 0x939d
movl $0x4e, %edx
callq 0x32c0
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/list.c
// Function: list_move_item
void list_move_item(struct list *list, size_t oldindex, size_t newindex)
{
	assert(oldindex < list->length);
	assert(newindex < list->length);

	void *item = list->items[oldindex];

	if(oldindex < newindex)
		memmove(&list->items[oldindex], &list->items[oldindex + 1], (newindex - oldindex) * sizeof(list->items[0]));
	else
		memmove(&list->items[newindex + 1], &list->items[newindex], (oldindex - newindex) * sizeof(list->items[0]));

	list->items[newindex] = item;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rax
cmpq %rsi, %rax
jbe 0x7899
movq %rdx, %rbx
cmpq %rdx, %rax
jbe 0x78b8
movq %rdi, %r14
movq 0x10(%rdi), %rax
movq (%rax,%rsi,8), %r15
movq %rsi, %rdx
subq %rbx, %rdx
jae 0x7876
leaq (%rax,%rsi,8), %rdi
leaq 0x8(%rdi), %rax
movq %rbx, %rdx
subq %rsi, %rdx
shlq $0x3, %rdx
movq %rax, %rsi
jmp 0x7886
leaq (%rax,%rbx,8), %rsi
leaq (%rax,%rbx,8), %rdi
addq $0x8, %rdi
shlq $0x3, %rdx
callq 0x35b0
movq 0x10(%r14), %rax
movq %r15, (%rax,%rbx,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1b2e(%rip), %rdi      # 0x93ce
leaq 0x1aeb(%rip), %rsi      # 0x9392
leaq 0x1b38(%rip), %rcx      # 0x93e6
movl $0x5d, %edx
callq 0x32c0
leaq 0x1b5a(%rip), %rdi      # 0x9419
leaq 0x1acc(%rip), %rsi      # 0x9392
leaq 0x1b19(%rip), %rcx      # 0x93e6
movl $0x5e, %edx
callq 0x32c0
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/list.c
// Function: list_find_item_or_insertpoint
bool list_find_item_or_insertpoint(const struct list *list, int (*compare)(const void *, const void *), const void *item, size_t *index)
{
	void *currentitem;
	size_t min, middle, max;
	int ret;

	if(list_length(list) == 0) {
		*index = 0;
		return false;
	}

	min = 0;
	max = list_length(list) - 1;

	while(min < max) {
		middle = (min + max) / 2;
		currentitem = list_get_item(list, middle);
		ret = compare(&item, &currentitem);
		if(ret <= 0)
			max = middle;
		else
			min = middle + 1;
	}

	*index = min;
	currentitem = list_get_item(list, *index);
	ret = compare(&item, &currentitem);

	if(ret > 0 && *index == list_length(list) - 1)
		*index = list_length(list);
	return ret == 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x7a45
movq %rsi, %r15
movq %rdi, %r14
movq %rcx, 0x10(%rsp)
xorl %ebp, %ebp
decq %rbx
je 0x7a08
movq %rsp, %r13
leaq (%rbx,%rbp), %r12
shrq %r12
cmpq %r12, (%r14)
jbe 0x7a5d
movq 0x10(%r14), %rax
movq (%rax,%r12,8), %rax
movq %rax, (%rsp)
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq *%r15
leaq 0x1(%r12), %rcx
testl %eax, %eax
cmovgq %rcx, %rbp
cmovleq %r12, %rbx
cmpq %rbx, %rbp
jb 0x79cd
movq 0x10(%rsp), %rbx
movq %rbp, (%rbx)
cmpq %rbp, (%r14)
jbe 0x7a5d
movq 0x10(%r14), %rax
movq (%rax,%rbp,8), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rdi
callq *%r15
testl %eax, %eax
jle 0x7a3e
movq (%r14), %rcx
leaq -0x1(%rcx), %rdx
cmpq %rdx, (%rbx)
jne 0x7a3e
movq %rcx, (%rbx)
testl %eax, %eax
sete %al
jmp 0x7a4e
movq $0x0, (%rcx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x196d(%rip), %rdi      # 0x93d1
leaq 0x1927(%rip), %rsi      # 0x9392
leaq 0x19e7(%rip), %rcx      # 0x9459
movl $0x74, %edx
callq 0x32c0
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/listmodel.c
// Function: listmodel_register_change_callback
bool listmodel_register_change_callback(struct listmodel *model, model_change_callback callback, void *data)
{
	if(model->change_callbacks == NULL)
		model->change_callbacks = list_new(0);

	if(model->change_callbacks == NULL)
		return false;

	struct callback *cb = malloc(sizeof(*cb));
	if(cb == NULL)
		return false;

	cb->cb = callback;
	cb->data = data;

	if(!list_append(model->change_callbacks, cb)) {
		free(cb);
		return false;
	}

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq 0x20(%rdi), %r12
testq %r12, %r12
jne 0x7ad2
movq %rdi, %r13
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x76b0
movq %rax, %r12
movq %rax, 0x20(%r13)
testq %rax, %rax
je 0x7b08
movl $0x10, %edi
callq 0x3490
testq %rax, %rax
je 0x7b05
movq %rax, %r13
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
movq %r12, %rdi
movq %rax, %rsi
callq 0x7752
movb $0x1, %r15b
testb %al, %al
jne 0x7b08
movq %r13, %rdi
callq 0x3740
xorl %r15d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/listmodel.c
// Function: listmodel_unregister_change_callback
void listmodel_unregister_change_callback(struct listmodel *model, model_change_callback callback, void *data)
{
	struct list *list = model->change_callbacks;
	struct callback *cb;
	size_t length = list_length(list);;

	for(size_t i = 0; i < length; i++) {
		cb = list_get_item(list, i);
		if(cb->cb == callback && cb->data == data) {
			free(cb);
			list_remove(list, i);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x774e
testq %rax, %rax
je 0x7b6c
movq %rax, %r12
xorl %r13d, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0x7929
cmpq %r14, (%rax)
jne 0x7b64
cmpq %rbx, 0x8(%rax)
jne 0x7b64
movq %rax, %rdi
callq 0x3740
movq %r15, %rdi
movq %r13, %rsi
callq 0x78d7
incq %r13
cmpq %r13, %r12
jne 0x7b3b
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/listmodel.c
// Function: listmodel_notify_change
void listmodel_notify_change(struct listmodel *model, enum model_change change, size_t newindex, size_t oldindex)
{
	struct list *list = model->change_callbacks;
	if(list == NULL)
		return;

	struct callback *cb;
	size_t length = list_length(list);;

	for(size_t i = 0; i < length; i++) {
		cb = list_get_item(list, i);
		cb->cb(change, newindex, oldindex, cb->data);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x20(%rdi), %r15
testq %r15, %r15
je 0x7bc6
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %r15, %rdi
callq 0x774e
testq %rax, %rax
je 0x7bc6
movq %rax, %r12
xorl %r13d, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0x7929
movq 0x8(%rax), %rcx
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq *(%rax)
incq %r13
cmpq %r13, %r12
jne 0x7ba5
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/listview.c
// Function: listview_refresh
void listview_refresh(struct listview *view)
{
	if(!view->needs_refresh)
		return;

	unsigned int height, width;
	size_t i = 0;
	height = getmaxy(view->window);
	width = getmaxx(view->window);

	size_t buflen = width;

	werase(view->window);
	while(i < height) {
		if(i + view->first >= listmodel_count(view->model))
			break;

		wchar_t buffer[buflen + 1];
		size_t reallen = listmodel_render(view->model, buffer, buflen, width, i + view->first);

		if(reallen > buflen) {
			buflen = reallen;
			continue;
		}

		int attrs = attrs_for_index(view->model, view->first + i, view->index);

		wmove(view->window, i, 0);
		wattron(view->window, attrs);
		waddwstr(view->window, buffer);
		wattroff(view->window, attrs);

		i++;
	}
	wrefresh(view->window);
	view->needs_refresh = false;
}

// Assembly:
cmpb $0x1, 0x20(%rdi)
jne 0x7d49
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x7c3a
movswl 0x4(%rdi), %r14d
incl %r14d
movswl 0x6(%rdi), %r12d
callq 0x30e0
movq %r14, -0x30(%rbp)
testl %r14d, %r14d
je 0x7d2f
incl %r12d
jmp 0x7c4e
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
callq 0x30e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x30(%rbp)
xorl %r15d, %r15d
movq %r12, -0x38(%rbp)
movq %r12, -0x40(%rbp)
movq 0x10(%rbx), %r14
addq %r15, %r14
movq 0x8(%rbx), %rdi
callq 0x7a7c
cmpq %rax, %r14
jae 0x7d2f
movq %rsp, -0x50(%rbp)
movq %rsp, %r13
movq -0x38(%rbp), %r14
leaq 0x13(,%r14,4), %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r8
addq %r15, %r8
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x7a7e
cmpq %r14, %rax
jbe 0x7cb3
movq %rax, -0x38(%rbp)
jmp 0x7d21
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r12
addq %r15, %r12
movq 0x18(%rbx), %rax
movq %rax, -0x48(%rbp)
movq %r12, %rsi
callq 0x7a93
movzbl %al, %eax
shll $0x9, %eax
leal 0x200100(%rax), %r14d
cmpq -0x48(%rbp), %r12
movq -0x40(%rbp), %r12
cmovnel %eax, %r14d
movq (%rbx), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x3090
movq (%rbx), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x3120
movq (%rbx), %rdi
movq %r13, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x32d0
movq (%rbx), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x3620
incq %r15
movq -0x50(%rbp), %rsp
cmpq -0x30(%rbp), %r15
jb 0x7c59
movq (%rbx), %rdi
callq 0x3390
movb $0x0, 0x20(%rbx)
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/listview.c
// Function: listview_setindex_internal
static void listview_setindex_internal(struct listview *view, size_t index, int direction, bool keep_distance)
{
	size_t listcount = listmodel_count(view->model);
	unsigned int rowcount = getmaxy(view->window);
	size_t distance = view->index - view->first;

	/* check index for over- and underflow */
	if(direction == 0 && index > listcount - 1)
		view->index = listcount - 1;
	else if(direction < 0 && index > view->index)
		view->index = 0;
	else if(direction > 0 && (index < view->index || index > listcount - 1))
		view->index = listcount - 1;
	else
		view->index = index;

	/* try to restore distance between first and index
	 * may underflow, but this is checked later */
	if(keep_distance)
		view->first = view->index - distance;

	/* make sure, first has a sane value relative to index */
	if(view->index < view->first)
		view->first = view->index;
	else if(view->index - view->first >= rowcount)
		view->first = view->index - rowcount + 1;

	/* make sure, view is always filled to the bottom with entries,
	 * or in case there aren't enough, scrolled to the first entry */
	if(listcount <= rowcount)
		view->first = 0;
	else if(listcount - view->first <= rowcount)
		view->first = listcount - rowcount;

	view->needs_refresh = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x7a7c
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x7d85
movswl 0x4(%rcx), %ecx
incl %ecx
jmp 0x7d8a
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x18(%rbx), %rsi
testl %r15d, %r15d
je 0x7dae
js 0x7db9
cmpq %r14, %rsi
seta %dil
leaq -0x1(%rax), %rdx
cmpq %r14, %rdx
setb %r8b
orb %dil, %r8b
je 0x7dc2
jmp 0x7dc5
leaq -0x1(%rax), %rdx
cmpq %r14, %rdx
jae 0x7dc2
jmp 0x7dc5
cmpq %r14, %rsi
jae 0x7dc2
xorl %edx, %edx
jmp 0x7dc5
movq %r14, %rdx
movq 0x10(%rbx), %rdi
movq %rdx, 0x18(%rbx)
testb %bpl, %bpl
je 0x7ddc
subq %rsi, %rdi
addq %rdx, %rdi
movq %rdi, 0x10(%rbx)
movq %rdx, %rsi
subq %rdi, %rsi
jb 0x7def
cmpq %rcx, %rsi
jb 0x7df6
subq %rcx, %rdx
incq %rdx
movq %rdx, 0x10(%rbx)
movq %rdx, %rdi
movq %rax, %rdx
subq %rcx, %rdx
jbe 0x7e08
subq %rdi, %rax
cmpq %rcx, %rax
jbe 0x7e0a
jmp 0x7e0e
xorl %edx, %edx
movq %rdx, 0x10(%rbx)
movb $0x1, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/listview.c
// Function: listview_init
bool listview_init(struct listview *view, struct listmodel *model, unsigned int x, unsigned int y, unsigned int width, unsigned int height)
{
	view->window = newwin(height, width, y, x);
	if(view->window == NULL)
		return false;

	view->index = 0;
	view->first = 0;
	view->model = model;
	view->needs_refresh = true;

	if(!listmodel_register_change_callback(view->model, change_cb, view)) {
		delwin(view->window);
		view->window = NULL;
		return false;
	}

	listview_refresh(view);

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %eax
movq %rsi, %r14
movq %rdi, %rbx
movl %r9d, %edi
movl %r8d, %esi
movl %ecx, %edx
movl %eax, %ecx
callq 0x3030
movq %rax, (%rbx)
testq %rax, %rax
je 0x7f43
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movb $0x1, 0x20(%rbx)
leaq 0x34(%rip), %rsi        # 0x7f4d
movq %r14, %rdi
movq %rbx, %rdx
callq 0x7aa1
testb %al, %al
je 0x7f34
movq %rbx, %rdi
callq 0x7bf0
movb $0x1, %al
jmp 0x7f45
movq (%rbx), %rdi
callq 0x31e0
movq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/listview.c
// Function: change_cb
static void change_cb(enum model_change change, size_t newindex, size_t oldindex, void *data)
{
	struct listview *view = data;
	unsigned int rowcount = getmaxy(view->window);

	switch(change) {
	case MODEL_ADD:
		if(newindex <= view->index)
			listview_setindex_internal(view, view->index + 1, 1, true);
		else if(newindex < view->first + rowcount)
			view->needs_refresh = true;
		break;
	case MODEL_REMOVE:
		if(oldindex < view->index)
			listview_setindex_internal(view, view->index - 1, -1, true);
		else if(oldindex < view->first + rowcount)
			listview_setindex_internal(view, view->index, 0, true);
		break;
	case MODEL_CHANGE:
		if(newindex == oldindex) {
			if(newindex >= view->first && newindex < view->first + rowcount)
				view->needs_refresh = true;
		} else if(oldindex == view->index) {
			listview_setindex_internal(view, newindex, 0, false);
		} else {
			change_cb(MODEL_ADD, newindex, oldindex, data);
			change_cb(MODEL_REMOVE, newindex, oldindex, data);
		}
		break;
	case MODEL_RELOAD:
		view->first = 0;
		view->index = 0;
		view->needs_refresh = true;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq (%rbx), %rax
testq %rax, %rax
je 0x7f6b
movswl 0x4(%rax), %eax
incl %eax
jmp 0x7f70
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x2, %edi
jne 0x7f97
cmpq %r15, %r14
je 0x7fd8
cmpq %r15, 0x18(%rbx)
je 0x7ff3
xorl %edi, %edi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x7f4d
movl $0x1, %edi
jmp 0x7f5b
cmpl $0x3, %edi
je 0x7fb9
cmpl $0x1, %edi
je 0x7fc2
testl %edi, %edi
jne 0x7fed
movq 0x18(%rbx), %rsi
cmpq %r14, %rsi
jae 0x7fff
addq 0x10(%rbx), %rax
cmpq %r14, %rax
ja 0x7fe9
jmp 0x7fed
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x7fe9
movq 0x18(%rbx), %rsi
cmpq %r15, %rsi
jbe 0x800c
decq %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
jmp 0x801a
movq 0x10(%rbx), %rcx
cmpq %r14, %rcx
ja 0x7fed
addq %rax, %rcx
cmpq %r14, %rcx
jbe 0x7fed
movb $0x1, 0x20(%rbx)
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x801f
incq %rsi
movq %rbx, %rdi
movl $0x1, %edx
jmp 0x801a
addq 0x10(%rbx), %rax
cmpq %r15, %rax
jbe 0x7fed
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0x7d5a
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_add_component
bool path_add_component(struct path *path, const char *component)
{
	while(strlen(path->path) + strlen(component) + 2 > path->allocated_size)
		if(!path_make_room(path, 0))
			return false;

	strcat(path->path, "/");
	strcat(path->path, component);

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
movq %r15, %rdi
callq 0x3230
movq %rax, %r12
movq %rbx, %rdi
callq 0x3230
addq %r12, %rax
addq $0x2, %rax
movq 0x8(%r14), %r12
cmpq %r12, %rax
jbe 0x80d5
testq %r12, %r12
jle 0x80b9
addq %r12, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3520
testq %rax, %rax
je 0x80fb
movq %rax, %r15
movq %r12, 0x8(%r14)
movq %rax, (%r14)
movq %r15, %rdi
callq 0x3230
movq %rax, %r13
movq %rbx, %rdi
callq 0x3230
addq %r13, %rax
addq $0x2, %rax
jmp 0x8092
movq %r15, %rdi
callq 0x3230
movw $0x2f, (%r15,%rax)
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x3670
movb $0x1, %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0x80f1
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_remove_component
bool path_remove_component(struct path *path, const char **component)
{
	if(path->path[0] == '\0')
		return false;

	char *slash = strrchr(path->path, '/');
	*slash = '\0';

	if(component)
		*component = slash + 1;

	return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq (%rdi), %rdi
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x8128
movq %rsi, %rbx
movl $0x2f, %esi
callq 0x32b0
movb $0x0, (%rax)
testq %rbx, %rbx
je 0x8128
incq %rax
movq %rax, (%rbx)
testb %bpl, %bpl
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_set_to_current_working_directory
bool path_set_to_current_working_directory(struct path *path)
{
	while(getcwd(path->path, path->allocated_size) == NULL)
	{
		if(errno == ERANGE) {
			if(!path_make_room(path, 0))
				return false;
		} else
			return false;
	}
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x8(%r14), %rsi
callq 0x3310
movb $0x1, %bl
testq %rax, %rax
jne 0x819b
callq 0x30d0
movq %rax, %r15
cmpl $0x22, (%r15)
jne 0x8199
movq (%r14), %rax
movq 0x8(%r14), %r12
testq %r12, %r12
jle 0x8187
addq %r12, %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x3520
testq %rax, %rax
je 0x8199
movq %r12, 0x8(%r14)
movq %rax, (%r14)
movq %rax, %rdi
movq %r12, %rsi
callq 0x3310
testq %rax, %rax
je 0x815b
jmp 0x819b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_set_from_string
int path_set_from_string(struct path *path, const char *cstr)
{
	if(strcmp(cstr, "~") == 0) {
		const char *home = getenv("HOME");
		if(home == NULL || strcmp(home, "~") == 0)
			return EINVAL;
		return path_set_from_string(path, home);
	}

	if(!(path_cstr_is_valid(cstr)))
		return EINVAL;

	if(!path_make_room(path, strlen(cstr) + 1))
		return ENOMEM;
	strcpy(path->path, cstr);

	/* reduce multiple consecutive slashes to a single one */
	size_t s = 0, d = 0;
	do {
		s++;
		if(path->path[s] == '/' && path->path[d] == '/')
			continue;
		d++;
		path->path[d] = path->path[s];
	} while(path->path[s] != '\0');

	/* remove trailing slash, this also ensures that the string will be
	 * empty for the root directory */
	if(path->path[d - 1] == '/')
		path->path[d - 1] = '\0';

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movb (%rsi), %al
cmpb $0x7e, %al
jne 0x81fe
leaq 0x1306(%rip), %r15      # 0x94c9
movl $0x16, %ebp
cmpb $0x0, 0x1(%r14)
jne 0x8296
movq %r15, %rdi
callq 0x3070
testq %rax, %rax
je 0x8296
movq %rax, %r14
movb (%rax), %al
cmpb $0x7e, %al
jne 0x81fa
movb $0x7e, %al
cmpb $0x0, 0x1(%r14)
je 0x8296
cmpb $0x7e, %al
je 0x81c8
movl $0x16, %ebp
cmpb $0x2f, %al
jne 0x8296
movq %r14, %rdi
callq 0x3230
movq %rax, %r15
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
leaq (%rax,%rax), %rcx
incq %r15
cmoveq %rcx, %r15
cmpq %rax, %r15
jbe 0x8244
movq %r15, %rsi
callq 0x3520
testq %rax, %rax
je 0x8291
movq %rax, %rdi
movq %r15, 0x8(%rbx)
movq %rax, (%rbx)
movq %r14, %rsi
callq 0x3110
movq (%rbx), %rax
xorl %edx, %edx
xorl %ecx, %ecx
incq %rdx
movq %rdx, %rdi
movq %rdi, %rdx
movb (%rax,%rdi), %sil
cmpb $0x2f, %sil
jne 0x8270
leaq 0x1(%rdx), %rdi
cmpb $0x2f, (%rax,%rcx)
je 0x8259
movb %sil, 0x1(%rax,%rcx)
incq %rcx
movq (%rbx), %rax
cmpb $0x0, (%rax,%rdx)
jne 0x8253
xorl %ebp, %ebp
cmpb $0x2f, -0x1(%rax,%rcx)
jne 0x8296
movb $0x0, -0x1(%rax,%rcx)
jmp 0x8296
movl $0xc, %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/path.c
// Function: path_new_from_string
int path_new_from_string(struct path **path, const char *cstr)
{
	/* this check is done again in path_set_from_string,
	 * but the the allocations can be saved, if cstr is invalid */
	if(!(path_cstr_is_valid(cstr)))
		return EINVAL;

	*path = path_new();
	if(*path == NULL)
		return ENOMEM;

	int ret = path_set_from_string(*path, cstr);
	if(ret != 0) {
		path_delete(*path);
		*path = NULL;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl $0x16, %ebp
cmpb $0x2f, (%rsi)
jne 0x82ef
movq %rsi, %r14
movq %rdi, %rbx
callq 0x82f6
movq %rax, (%rbx)
testq %rax, %rax
je 0x82e6
movq %rax, %rdi
movq %r14, %rsi
callq 0x81a9
testl %eax, %eax
je 0x82ed
movl %eax, %ebp
movq (%rbx), %rdi
callq 0x8337
movq $0x0, (%rbx)
jmp 0x82ef
movl $0xc, %ebp
jmp 0x82ef
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_new
struct path *path_new(void)
{
	struct path *path = malloc(sizeof(*path));
	if(path == NULL)
		return NULL;

	if(!path_init(path, 0)) {
		free(path);
		return NULL;
	}
	return path;
}

// Assembly:
pushq %rbx
movl $0x10, %edi
callq 0x3490
testq %rax, %rax
je 0x8330
movq %rax, %rbx
movq $0x1, 0x8(%rax)
movl $0x1, %edi
callq 0x3490
movq %rax, (%rbx)
testq %rax, %rax
je 0x8328
movb $0x0, (%rax)
jmp 0x8332
movq %rbx, %rdi
callq 0x3740
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/path.c
// Function: path_init
bool path_init(struct path *path, size_t size)
{
	path->allocated_size = size;
	if(path->allocated_size < 1)
		path->allocated_size = 1;

	path->path = malloc(path->allocated_size);
	if(path->path == NULL)
		return false;

	path->path[0] = '\0';

	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x1, %rsi
adcq $0x0, %rsi
movq %rsi, 0x8(%rdi)
movq %rsi, %rdi
callq 0x3490
movq %rax, (%rbx)
testq %rax, %rax
je 0x8375
movb $0x0, (%rax)
testq %rax, %rax
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/processmanager.c
// Function: processmanager_spawn
int processmanager_spawn(struct processmanager *pm, const char *program, char * const argv[], const char *tmpdir, pre_exec_callback cb, pid_t *pid)
{
	struct process *process = NULL;

	if(tmpdir) {
		if(!pm->processlist) {
			pm->processlist = list_new(0);
			if(!pm->processlist)
				return ENOMEM;
		}

		process = malloc(sizeof(*process));
		if(!process)
			return ENOMEM;

		process->tmpdir = strdup(tmpdir);
		if(!process->tmpdir) {
			free(process);
			return ENOMEM;
		}

		if(!list_append(pm->processlist, process)) {
			process_delete(process);
			return ENOMEM;
		}
	}

	*pid = fork();

	if(*pid < 0)
		return errno;
	if(*pid > 0) {
		if(process)
			process->pid = *pid;
		return 0;
	}

	if(cb)
		cb();

	execvp(program, argv);
	exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r12
movq %r8, %r14
movq %rdx, %rbp
movq %rsi, %r15
testq %rcx, %rcx
je 0x8435
movq %rcx, %rbx
movq %rdi, %r13
movq %r14, 0x10(%rsp)
movq (%rdi), %r14
testq %r14, %r14
jne 0x83e7
xorl %edi, %edi
callq 0x76b0
movq %rax, %r14
movq %rax, (%r13)
testq %rax, %rax
je 0x8470
movq %r15, 0x8(%rsp)
movq %rbp, %r15
movl $0x10, %edi
callq 0x3490
movl $0xc, %ebp
testq %rax, %rax
je 0x8475
movq %rax, %r13
movq %rbx, %rdi
callq 0x36a0
movq %rax, 0x8(%r13)
testq %rax, %rax
je 0x8466
movq %r14, %rdi
movq %r13, %rsi
callq 0x7752
testb %al, %al
je 0x845d
movq %r15, %rbp
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r14
jmp 0x8438
xorl %r13d, %r13d
callq 0x3700
movl %eax, (%r12)
testl %eax, %eax
js 0x8454
je 0x8486
xorl %ebp, %ebp
testq %r13, %r13
je 0x8475
movl %eax, (%r13)
jmp 0x8475
callq 0x30d0
movl (%rax), %ebp
jmp 0x8475
movq 0x8(%r13), %rdi
callq 0x3740
movq %r13, %rdi
callq 0x3740
jmp 0x8475
movl $0xc, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r14, %r14
je 0x848e
callq *%r14
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3640
movl $0x1, %edi
callq 0x3690
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/processmanager.c
// Function: processmanager_waitpid
pid_t processmanager_waitpid(struct processmanager *pm, pid_t pid, int *wstatus)
{
	pid = waitpid(pid, wstatus, 0);
	if(pid <= 0)
		return pid;

	if(!pm->processlist)
		return pid;

	size_t length = list_length(pm->processlist);

	for(size_t i = 0; i < length; i++) {
		struct process *process = list_get_item(pm->processlist, i);

		if(process->pid == pid) {
			remove_directory_recursively(process->tmpdir);
			process_delete(process);
			list_remove(pm->processlist, i);
			break;
		}
	}

	return pid;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movl %esi, %edi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x35e0
movl %eax, %ebx
testl %eax, %eax
jle 0x851a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x851a
callq 0x774e
testq %rax, %rax
je 0x851a
movq %rax, %r12
xorl %r15d, %r15d
movq (%r14), %rdi
movq %r15, %rsi
callq 0x7929
cmpl %ebx, (%rax)
je 0x84f2
incq %r15
cmpq %r15, %r12
jne 0x84d9
jmp 0x851a
movq %rax, %r13
movq 0x8(%rax), %rdi
callq 0x8750
movq 0x8(%r13), %rdi
callq 0x3740
movq %r13, %rdi
callq 0x3740
movq (%r14), %rdi
movq %r15, %rsi
callq 0x78d7
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/xdg.c
// Function: xdg_get_config_home
int xdg_get_config_home(struct path **path)
{
	int ret = 0;
	*path = NULL;

	const char *config_home = getenv("XDG_CONFIG_HOME");
	if(config_home)
		ret = path_new_from_string(path, config_home);

	if(ret == ENOMEM)
		return ENOMEM;

	if(*path == NULL) {
		const char *home = getenv("HOME");
		if(home) {
			ret = path_new_from_string(path, home);

			if(ret == ENOMEM)
				return ENOMEM;

			if(*path == NULL)
				return ENOENT;

			if(!path_add_component(*path, ".config")) {
				path_delete(*path);
				*path = NULL;
				return ENOMEM;
			}
		} else
			return ENOENT;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x0, (%rdi)
leaq 0xf66(%rip), %rdi       # 0x94be
callq 0x3070
testq %rax, %rax
je 0x8581
movq %rbx, %rdi
movq %rax, %rsi
callq 0x82a3
movl $0xc, %ebp
cmpl $0xc, %eax
je 0x85d3
cmpq $0x0, (%rbx)
je 0x8581
xorl %ebp, %ebp
jmp 0x85d3
leaq 0xf41(%rip), %rdi       # 0x94c9
callq 0x3070
movl $0x2, %ebp
testq %rax, %rax
je 0x85d3
movq %rbx, %rdi
movq %rax, %rsi
callq 0x82a3
cmpl $0xc, %eax
je 0x85ce
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x85d3
leaq 0xf18(%rip), %rsi       # 0x94ce
callq 0x8062
testb %al, %al
jne 0x857d
movq (%rbx), %rdi
callq 0x8337
movq $0x0, (%rbx)
movl $0xc, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/xdg.c
// Function: xdg_get_config_dirs
struct list *xdg_get_config_dirs(bool include_config_home)
{
	struct path *path;
	int ret;

	struct list *list = list_new(0);
	if(list == NULL)
		return NULL;

	const char *config_dirs = getenv("XDG_CONFIG_DIRS");
	if(config_dirs) {
		char *curpath, *saveptr;
		char config_dirs_copy[strlen(config_dirs) + 1];

		strcpy(config_dirs_copy, config_dirs);

		if((curpath = strtok_r(config_dirs_copy, ":", &saveptr))) {
			do {
				ret = path_new_from_string(&path, curpath);
				if(ret == EINVAL)
					continue;
				if(path != NULL) {
					if(!list_append(list, path))
						goto err_delete_list_and_path;
				} else
					goto err_delete_list;
			} while((curpath = strtok_r(NULL, ":", &saveptr)));

		}
	}

	if(list_length(list) == 0) {
		ret = path_new_from_string(&path, "/etc/xdg");
		if(path != NULL) {
			if(!list_append(list, path))
				goto err_delete_list_and_path;
		} else
			goto err_delete_list;
	}

	if(include_config_home) {
		ret = xdg_get_config_home(&path);
		if(path != NULL) {
			if(!list_insert(list, 0, path))
				goto err_delete_list_and_path;
		} else if(ret == ENOMEM)
			goto err_delete_list;
	}

	return list;

err_delete_list_and_path:
	path_delete(path);
err_delete_list:
	list_delete(list, (list_item_deallocator)path_delete);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %r14d
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x76b0
testq %rax, %rax
je 0x873e
movq %rax, %rbx
leaq 0xec9(%rip), %rdi       # 0x94d6
callq 0x3070
testq %rax, %rax
je 0x86b0
movq %rax, %r15
movq %rax, %rdi
callq 0x3230
movq %rsp, -0x38(%rbp)
movq %rsp, %r12
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x3110
leaq 0xe99(%rip), %rsi       # 0x94e6
leaq -0x40(%rbp), %rdx
movq %r12, %rdi
callq 0x33b0
testq %rax, %rax
je 0x86ac
leaq -0x30(%rbp), %r15
leaq 0xe7d(%rip), %r12       # 0x94e6
leaq -0x40(%rbp), %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x82a3
cmpl $0x16, %eax
je 0x869a
movq -0x30(%rbp), %rsi
testq %rsi, %rsi
je 0x8719
movq %rbx, %rdi
callq 0x7752
testb %al, %al
je 0x871f
xorl %edi, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x33b0
testq %rax, %rax
jne 0x866d
movq -0x38(%rbp), %rsp
movq %rbx, %rdi
callq 0x774e
testq %rax, %rax
je 0x86e6
testb %r14b, %r14b
je 0x8714
leaq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x8544
movq (%r14), %rdx
testq %rdx, %rdx
je 0x870f
movq %rbx, %rdi
xorl %esi, %esi
callq 0x77ba
testb %al, %al
jne 0x8714
jmp 0x8723
leaq 0xdfb(%rip), %rsi       # 0x94e8
leaq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x82a3
movq (%r15), %rsi
testq %rsi, %rsi
je 0x872c
movq %rbx, %rdi
callq 0x7752
testb %al, %al
jne 0x86bd
jmp 0x8723
cmpl $0xc, %eax
je 0x872c
movq %rbx, %r15
jmp 0x873e
movq -0x38(%rbp), %rsp
jmp 0x872c
movq -0x38(%rbp), %rsp
movq -0x30(%rbp), %rdi
callq 0x8337
leaq -0x3fc(%rip), %rsi      # 0x8337
movq %rbx, %rdi
callq 0x7706
xorl %r15d, %r15d
movq %r15, %rax
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/util.c
// Function: determine_usable_config_file
struct path *determine_usable_config_file(const char *project, const char *subdir, const char *config, int flags)
{
	struct path *path = NULL;
	struct list *list = xdg_get_config_dirs(true);

	if(list == NULL)
		return NULL;

	size_t length = list_length(list);;

	for(size_t i = 0; i < length; i++) {
		struct path *curpath = list_get_item(list, i);
		if(!path_add_component(curpath, project))
			goto err;
		if(subdir) {
			if(!path_add_component(curpath, subdir))
				goto err;
		}
		if(!path_add_component(curpath, config))
			goto err;
		if(path == NULL && access(path_tocstr(curpath), flags) == 0) {
			path = curpath;
			list_set_item(list, i, NULL);
		}
	}
err:
	list_delete(list, (list_item_deallocator)path_delete);
	return path;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0x4(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, 0x10(%rsp)
movl $0x1, %edi
callq 0x85dc
testq %rax, %rax
je 0x883e
movq %rax, %rbx
movq %rax, %rdi
callq 0x774e
testq %rax, %rax
je 0x8843
movq %rax, %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x7929
movq %rax, %r14
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x8062
testb %al, %al
je 0x8846
testq %r15, %r15
je 0x87f1
movq %r14, %rdi
movq %r15, %rsi
callq 0x8062
testb %al, %al
je 0x8846
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x8062
testb %al, %al
je 0x8846
testq %r12, %r12
jne 0x8834
movq %r14, %rdi
callq 0x8050
movq %rax, %rdi
movl 0x4(%rsp), %esi
callq 0x3610
testl %eax, %eax
je 0x8824
xorl %r12d, %r12d
jmp 0x8834
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x7957
movq %r14, %r12
incq %rbp
cmpq %rbp, %r13
jne 0x87be
jmp 0x8846
xorl %r12d, %r12d
jmp 0x8855
xorl %r12d, %r12d
leaq -0x516(%rip), %rsi      # 0x8337
movq %rbx, %rdi
callq 0x7706
movq %r12, %rax
addq $0x18, %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/util.c
// Function: dump_string_to_file
bool dump_string_to_file(int dir_fd, const char *filename, const char *value)
{
	int fd = openat(dir_fd, filename, O_CREAT|O_WRONLY, 0700);
	if(fd < 0)
		return false;

	int ret = write(fd, value, strlen(value));

	close(fd);

	return ret < 0 ? false : true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
xorl %r14d, %r14d
movl $0x41, %edx
movl $0x1c0, %ecx            # imm = 0x1C0
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
js 0x88ad
movl %eax, %ebp
movq %rbx, %rdi
callq 0x3230
movl %ebp, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x31c0
movq %rax, %rbx
movl %ebp, %edi
callq 0x3320
testl %ebx, %ebx
setns %r14b
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/util.c
// Function: dump_filelist_to_file
bool dump_filelist_to_file(int dir_fd, const char *filename, const struct list *list)
{
	int ret = 0;

	int fd = openat(dir_fd, filename, O_CREAT|O_WRONLY, 0700);
	if(fd < 0)
		return false;

	size_t length = list_length(list);;

	for(size_t i = 0; i < length; i++) {
		const char *file = list_get_item(list, i);
		if((ret = write(fd, file, strlen(file))) < 0)
			break;
		if((ret = write(fd, "\0", 1)) < 0)
			break;
	}
	close(fd);

	return ret < 0 ? false : true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
xorl %r14d, %r14d
movl $0x41, %edx
movl $0x1c0, %ecx            # imm = 0x1C0
xorl %eax, %eax
callq 0x3240
testl %eax, %eax
js 0x897d
movl %eax, %ebp
movq %rbx, %rdi
callq 0x774e
testq %rax, %rax
je 0x8973
movq %rax, %r15
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7929
movq %rax, %r12
movq %rax, %rdi
callq 0x3230
movl %ebp, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x31c0
testl %eax, %eax
js 0x8976
movl $0x1, %r12d
xorl %r14d, %r14d
movl $0x1, %edx
movl %ebp, %edi
leaq 0xbbc(%rip), %rsi       # 0x94f1
callq 0x31c0
testl %eax, %eax
js 0x8976
cmpq %r15, %r12
setae %r14b
je 0x8976
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7929
movq %rax, %r13
movq %rax, %rdi
callq 0x3230
movl %ebp, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0x31c0
incq %r12
testl %eax, %eax
jns 0x8927
jmp 0x8976
movb $0x1, %r14b
movl %ebp, %edi
callq 0x3320
andb $0x1, %r14b
movl %r14d, %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/util.c
// Function: run_in_foreground
bool run_in_foreground()
{
	const char *display = getenv("DISPLAY");

	if(display == NULL || strlen(display) == 0)
		return true;

	const char *foreground = getenv("DFM_FOREGROUND");

	if(foreground != NULL && strcmp(foreground, "yes") == 0)
		return true;

	return false;
}

// Assembly:
pushq %rbx
leaq 0xb58(%rip), %rdi       # 0x94f3
callq 0x3070
movb $0x1, %bl
testq %rax, %rax
je 0x89d2
cmpb $0x0, (%rax)
je 0x89d2
leaq 0xb48(%rip), %rdi       # 0x94fb
callq 0x3070
testq %rax, %rax
je 0x89d0
leaq 0xb46(%rip), %rsi       # 0x950a
movq %rax, %rdi
callq 0x33d0
testl %eax, %eax
je 0x89d2
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/cglindkamp[P]dfm/src/main.c
// Function: main
int main(void)
{
	struct application app;
	int ret = 0;

	setlocale(LC_ALL, "");
	tzset();
	init_ncurses();

	if(application_init(&app)) {
		application_run(&app);
	} else {
		endwin();
		puts("Failed to initialize the application, exiting");
	}
	application_destroy(&app);

	endwin();
	_nc_freeall();

	return ret;
}

// Assembly:
subq $0x1d8, %rsp            # imm = 0x1D8
leaq 0x7db(%rip), %rsi       # 0x9210
movl $0x6, %edi
callq 0x3570
callq 0x3460
callq 0x89d8
movq %rsp, %rdi
callq 0x4794
testb %al, %al
je 0x8a5f
movq %rsp, %rdi
callq 0x41ac
jmp 0x8a70
callq 0x36c0
leaq 0xaa3(%rip), %rdi       # 0x950e
callq 0x3160
movq %rsp, %rdi
callq 0x4c8a
callq 0x36c0
xorl %eax, %eax
callq 0x32f0
xorl %eax, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
retq
// File: /workspace/github_c_makefile_star2_O3/robertdavidgraham[P]wc2/wctool.c
// Function: utf8_to_ucs4
unsigned 
utf8_to_ucs4(unsigned char *buf, size_t sizeof_buf)
{
    if (sizeof_buf >= 1 && buf[0] < 0x80) {
        return buf[0];
    } else if (sizeof_buf >= 2 && (buf[0]&0xE0) == 0xC0) {
        return  (buf[0]&0x1F)<<6 
                | (buf[1] & 0x3F) << 0;
    } else if (sizeof_buf >= 3 && (buf[0]&0xF0) == 0xE0) {
        return (buf[0]&0x0F)<<12 
                | (buf[1] & 0x3F) << 6
                | (buf[2] & 0x3F) << 0;
    } else if (sizeof_buf >= 4 && (buf[0]&0xF1) == 0xF0) {
        return (buf[0]&0x07)<<18 
                | (buf[1] & 0x3F) << 12
                | (buf[2] & 0x3F) << 6
                | (buf[3] & 0x3F) << 0;
    } else
        return 0xFFFFFFFF;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x1452
movsbl (%rdi), %edx
testl %edx, %edx
js 0x13c4
movl %edx, %eax
retq
cmpq $0x1, %rsi
je 0x1452
movzbl %dl, %ecx
andl $0xe0, %edx
cmpl $0xc0, %edx
jne 0x13f0
andl $0x1f, %ecx
shll $0x6, %ecx
movzbl 0x1(%rdi), %eax
andl $0x3f, %eax
orl %ecx, %eax
jmp 0x1452
cmpq $0x3, %rsi
jb 0x1452
movl %ecx, %edx
andl $-0x10, %edx
cmpl $0xe0, %edx
jne 0x141b
shll $0xc, %ecx
movzwl %cx, %eax
movzbl 0x1(%rdi), %ecx
andl $0x3f, %ecx
shll $0x6, %ecx
orl %eax, %ecx
movzbl 0x2(%rdi), %eax
jmp 0x13e9
cmpq $0x3, %rsi
je 0x1452
movl %ecx, %edx
andl $-0xf, %edx
cmpl $0xf0, %edx
jne 0x1452
andl $0x6, %ecx
shll $0x12, %ecx
movzbl 0x1(%rdi), %eax
andl $0x3f, %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x2(%rdi), %ecx
andl $0x3f, %ecx
shll $0x6, %ecx
orl %eax, %ecx
movzbl 0x3(%rdi), %eax
jmp 0x13e9
retq
// File: /workspace/github_c_makefile_star2_O3/robertdavidgraham[P]wc2/wctool.c
// Function: ucs4_to_utf8
size_t ucs4_to_utf8(unsigned char *buf, size_t sizeof_buf, unsigned wchar)
{
	#if 0
    if (0xD800 <= wchar && wchar <= 0xDFFF) {
        /* surrogates must not be encoded */
        return 0;
    }
	#endif

    if (0x10000 <= wchar && wchar <= 0x10FFFF && sizeof_buf >= 4) {
        buf[0] = 0xF0 | ((wchar >> 18) & 0x07);
        buf[1] = 0x80 | ((wchar >> 12) & 0x3F);
        buf[2] = 0x80 | ((wchar >>  6) & 0x3F);
        buf[3] = 0x80 | ((wchar >>  0) & 0x3F);
        return 4;
    } else if (0x0800 <= wchar && wchar <= 0xFFFF && sizeof_buf >= 3) {
        buf[0] = 0xE0 | ((wchar >> 12) & 0x0F);
        buf[1] = 0x80 | ((wchar >>  6) & 0x3F);
        buf[2] = 0x80 | ((wchar >>  0) & 0x3F);
        return 3;
    } else if (0x0080 <= wchar && wchar <= 0x7FF && sizeof_buf >= 2) {
        buf[0] = 0xC0 | ((wchar >>  6) & 0x1F);
        buf[1] = 0x80 | ((wchar >>  0) & 0x3F);
        return 2;
    } else if (wchar <= 0x7F && sizeof_buf >= 1) {
        buf[0] = wchar;
        return 1;
    } else
        return 0;
}

// Assembly:
leal -0x10000(%rdx), %eax
cmpl $0x100000, %eax         # imm = 0x100000
setae %al
cmpq $0x4, %rsi
setb %cl
orb %al, %cl
jne 0x149c
movl %edx, %eax
shrl $0x12, %eax
orb $-0x10, %al
movb %al, (%rdi)
movl %edx, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rdi)
movl %edx, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x2(%rdi)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rdi)
movl $0x4, %eax
retq
leal -0x800(%rdx), %eax
cmpl $0xf800, %eax           # imm = 0xF800
setae %al
cmpq $0x3, %rsi
setb %cl
orb %al, %cl
jne 0x14d9
movl %edx, %eax
shrl $0xc, %eax
orb $-0x20, %al
movb %al, (%rdi)
movl %edx, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rdi)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x2(%rdi)
movl $0x3, %eax
retq
leal -0x80(%rdx), %eax
cmpl $0x780, %eax            # imm = 0x780
setae %al
cmpq $0x2, %rsi
setb %cl
orb %al, %cl
jne 0x1507
movl %edx, %eax
shrl $0x6, %eax
orb $-0x40, %al
movb %al, (%rdi)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x1(%rdi)
movl $0x2, %eax
retq
cmpl $0x7f, %edx
seta %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x151f
movb %dl, (%rdi)
movl $0x1, %eax
retq
xorl %eax, %eax
retq