LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: c_ls
bool c_ls(int argc, char **argv, bool force, struct range *range)
{
	RANGE_NO();
	ARGV_NO();

	buffer_t *b = buffer_new();
	attach_buffer(b, neighbour_down, NULL);

	list_t *files = NULL, *latest = NULL;

	for(tab *tab = tabs_first(); tab; tab = tab->next){
		window *win;
		ITER_WINDOWS_FROM(win, tab->win){
			buffer_t *buf = win->buf;
			const char *fname = buffer_fname(buf);
			if(fname){
				if(list_contains(files, fname))
					continue;

				list_t *new = list_new(NULL);
				new->line = ustrdup(fname);
				new->len_line = strlen(new->line);
				new->len_malloc = new->len_line + 1;

				files = list_append(files, latest, new);
				latest = new;
			}
		}
	}

	buffer_replace_list(b, files);

	ui_redraw();
	ui_cur_changed();

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rcx, %rcx
je 0x85c1
movq (%rsi), %rsi
leaq 0x6cec(%rip), %rdi      # 0xf2a8
jmp 0x86ba
cmpl $0x1, %edi
jne 0x86b0
callq 0x907b
xorl %r14d, %r14d
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x86d4
callq 0xdf6c
testq %rax, %rax
je 0x8695
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %rax, 0x10(%rsp)
movq (%rax), %rdi
callq 0xd869
testq %rax, %rax
je 0x8683
movq %rax, %r15
movq %r15, %r13
movq (%r13), %rdi
callq 0x9348
testq %rax, %rax
je 0x8671
movq %rax, %rbp
movq %r14, %rdi
movq %rax, %rsi
callq 0xb1c5
testq %rax, %rax
jne 0x8671
xorl %edi, %edi
callq 0x99a4
movq %rax, %r12
movq %rbp, %rdi
callq 0x5863
movq %rax, (%r12)
movq %rax, %rdi
callq 0x4170
movq %rax, 0x8(%r12)
incq %rax
movq %rax, 0x10(%r12)
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xa286
movq %rax, %r14
movq %r12, %rbx
movq 0x58(%r13), %r13
testq %r13, %r13
jne 0x8611
movq 0x50(%r15), %r15
testq %r15, %r15
jne 0x860e
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x85f9
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x90a3
callq 0x4e77
callq 0x51d8
movb $0x1, %bl
jmp 0x86c3
movq (%rsi), %rsi
leaq 0x6c09(%rip), %rdi      # 0xf2c3
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4de2
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: attach_buffer
static void attach_buffer(
		buffer_t *buf,
		const enum neighbour dir,
		window *const copy_pos_from)
{
	window *w = window_new(buf);
	buffer_release(buf);

	window_add_neighbour(windows_cur(), dir, w);
	windows_set_cur(w);

	if(copy_pos_from){
		*w->ui_pos = *copy_pos_from->ui_pos;

		w->ui_start = copy_pos_from->ui_start;
		if(neighbour_is_vertical(dir)){
			int diff = (w->ui_pos->y - w->ui_start.y) / 2;

			copy_pos_from->ui_start.y += diff;
			w->ui_start.y += diff;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
callq 0xdb45
movq %rax, %r14
leaq 0x96a(%rip), %rsi       # 0x905c
movq %r15, %rdi
callq 0xce9b
callq 0xde6c
movq %rax, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0xda27
movq %r14, %rdi
callq 0xde80
testq %rbx, %rbx
je 0x8755
movq 0x30(%r14), %rax
movq 0x30(%rbx), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq 0x8(%rbx), %rax
movq %rax, 0x8(%r14)
movl %ebp, %edi
callq 0xda20
testb %al, %al
je 0x8755
movq 0x30(%r14), %rax
movl 0x4(%rax), %eax
subl 0xc(%r14), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %ecx, 0xc(%rbx)
addl %ecx, 0xc(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: c_p
bool c_p(int argc, char **argv, bool force, struct range *range)
{
	ARGV_NO();

	window *win = windows_cur();

	struct range rng;
	RANGE_DEFAULT(range, rng, win);

	buffer_t *const b = win->buf;

	list_t *l = list_seek(b->head, range->start, false);
	for(int i = range->start; i <= range->end; i++){
		ui_print(l ? l->line : "", l ? l->len_line : 0);
		if(l)
			l = l->next;
	}

	ui_want_return();

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
cmpl $0x1, %edi
jne 0x8800
movq %rcx, %r14
callq 0xde6c
movq %rax, %r15
testq %r14, %r14
jne 0x879a
movq 0x30(%r15), %rax
movl 0x4(%rax), %eax
leaq 0x8(%rsp), %r14
movl %eax, 0x4(%r14)
movl %eax, (%r14)
movq %r14, %rdi
callq 0xd017
movq (%r15), %rax
movq 0x8(%rax), %rdi
movl (%r14), %esi
xorl %edx, %edx
callq 0x9ede
movl (%r14), %ebp
cmpl 0x4(%r14), %ebp
jg 0x87f9
movq %rax, %r15
decl %ebp
leaq 0x6f90(%rip), %r12      # 0xf758
movq %r12, %rdi
testq %r15, %r15
je 0x87d3
movq (%r15), %rdi
testq %r15, %r15
je 0x87e7
movq 0x8(%r15), %rsi
callq 0x57e4
movq 0x18(%r15), %r15
jmp 0x87f1
xorl %esi, %esi
callq 0x57e4
xorl %r15d, %r15d
incl %ebp
cmpl 0x4(%r14), %ebp
jl 0x87c8
callq 0x5827
jmp 0x8811
movq (%rsi), %rsi
leaq 0x6ab9(%rip), %rdi      # 0xf2c3
xorl %eax, %eax
callq 0x4de2
cmpl $0x1, %ebx
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: copy_move_common
static bool copy_move_common(
		int argc, char **argv,
		struct range **const range,
		struct range *const range_store,
		int *const out_addr)
{
	if(argc != 2){
		ui_err("Usage: %s address", *argv);
		return false;
	}

	char *addr_end;
	if(!parse_range_1(argv[1], &addr_end, out_addr) || *addr_end){
		ui_err("bad address: \"%s\"", argv[1]);
		return false;
	}

	window *win = windows_cur();

	RANGE_DEFAULT(*range, *range_store, win);

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
cmpl $0x2, %edi
jne 0x89c4
movq %rcx, %r14
movq %rdx, %rbx
movq 0x8(%r15), %rdi
leaq 0x8(%rsp), %rsi
movq %r8, %rdx
callq 0xcea4
testb %al, %al
je 0x89b7
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
je 0x89e3
movq 0x8(%r15), %rsi
leaq 0x6bda(%rip), %rdi      # 0xf59c
jmp 0x89ce
movq (%r15), %rsi
leaq 0x6abc(%rip), %rdi      # 0xf48a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4de2
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0xde6c
cmpq $0x0, (%rbx)
jne 0x89ff
movq 0x30(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, 0x4(%r14)
movl %eax, (%r14)
movq %r14, (%rbx)
movq (%rbx), %rdi
callq 0xd017
movb $0x1, %bl
jmp 0x89d7
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: c_t
bool c_t(int argc, char **argv, bool force, struct range *range)
{
	if(argc != 2){
		ui_err("Usage: %s address", *argv);
		return false;
	}

	struct range range_store;
	int lno;
	if(!copy_move_common(argc, argv, &range, &range_store, &lno))
		return false;

	buffer_t *const b = windows_cur()->buf;

	list_t *landing = list_seek(b->head, lno, false);
	if(!landing)
		NO_LINE(lno);

	/* copy the range */
	list_t *start = list_seek(b->head, range->start, false);
	if(!start)
		NO_LINE(range->start);

	list_t *end = list_seek(b->head, range->end, false);
	if(!end)
		NO_LINE(range->end);

	list_t *copied;
	/* break the bottom link temporarily for the copy */
	{
		list_t *after = end->next;
		end->next = NULL;

		copied = list_copy_deep(start, NULL);
		end->next = after;
	}

	if(lno == -1){
		/* special case - head */
		list_t *head = b->head;

		b->head = copied;
		list_t *i;
		for(i = b->head; i->next; i = i->next);

		i->next = head;
		if(head)
			head->prev = i;

	}else{
		list_t *next = landing->next;
		landing->next = copied;
		copied->prev = landing;

		list_t *i;
		for(i = landing; i->next; i = i->next);
		i->next = next;
		if(next)
			next->prev = i;
	}

	b->modified = true;

	ui_redraw();
	ui_cur_changed();

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, 0x10(%rsp)
cmpl $0x2, %edi
jne 0x8adb
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl $0x2, %edi
callq 0x8981
testb %al, %al
je 0x8af0
callq 0xde6c
movq (%rax), %r12
movq 0x8(%r12), %rdi
movl 0xc(%rsp), %esi
xorl %edx, %edx
callq 0x9ede
testq %rax, %rax
je 0x8af4
movq %rax, %rbx
movq 0x8(%r12), %rdi
movq 0x10(%rsp), %r13
movl (%r13), %esi
xorl %edx, %edx
callq 0x9ede
testq %rax, %rax
je 0x8afa
movq %rax, %r14
movq 0x8(%r12), %rdi
movl 0x4(%r13), %esi
xorl %edx, %edx
callq 0x9ede
testq %rax, %rax
je 0x8b00
movq %rax, %r15
movq 0x18(%rax), %r13
movq $0x0, 0x18(%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x99b8
movq %r13, 0x18(%r15)
cmpl $-0x1, 0xc(%rsp)
je 0x8b16
movq 0x18(%rbx), %rcx
movq %rax, 0x18(%rbx)
movq %rbx, 0x20(%rax)
movq %rbx, %rdx
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x8acd
jmp 0x8b2c
movq (%rsi), %rsi
leaq 0x69a5(%rip), %rdi      # 0xf48a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4de2
jmp 0x8b4b
xorl %ebx, %ebx
jmp 0x8b4b
movl 0xc(%rsp), %esi
jmp 0x8b04
movl (%r13), %esi
jmp 0x8b04
movl 0x4(%r13), %esi
leaq 0x696f(%rip), %rdi      # 0xf47a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4de2
jmp 0x8b4b
movq 0x8(%r12), %rcx
movq %rax, 0x8(%r12)
movq %rax, %rdx
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0x8b20
movq %rcx, 0x18(%rdx)
testq %rcx, %rcx
je 0x8b39
movq %rdx, 0x20(%rcx)
movb $0x1, 0x39(%r12)
callq 0x4e77
callq 0x51d8
movb $0x1, %bl
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: command_bufaction
static void command_bufaction(
		struct range *range, buffer_action_f *buf_fn, int end_add)
{
	window *win = windows_cur();

	struct range range_store;
	RANGE_DEFAULT(range, range_store, win);

	range->end += end_add;

	buffer_t *const b = win->buf;

	buf_fn(
			b,
			&(region_t){
				.begin.y = range->start,
				.end.y = range->end,
				.type = REGION_LINE
			},
			&(point_t){});

	*win->ui_pos = (point_t){ .y = range->end - end_add };

	ui_redraw();
	ui_cur_changed();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0xde6c
movq %rax, %r12
testq %r15, %r15
jne 0x8bc7
movq 0x30(%r12), %rax
movl 0x4(%rax), %eax
leaq 0x14(%rsp), %r15
movl %eax, 0x4(%r15)
movl %eax, (%r15)
movq %r15, %rdi
callq 0xd017
movl 0x4(%r15), %eax
addl %ebx, %eax
movl %eax, 0x4(%r15)
movq (%r12), %rdi
xorl %ebp, %ebp
leaq 0x1c(%rsp), %rsi
movl %ebp, (%rsi)
movl (%r15), %ecx
movl %ecx, 0x4(%rsi)
movl %ebp, 0x8(%rsi)
movl %eax, 0xc(%rsi)
movl $0x2, 0x10(%rsi)
leaq 0xc(%rsp), %rdx
movq $0x0, (%rdx)
callq *%r14
movq 0x30(%r12), %rax
movl 0x4(%r15), %ecx
subl %ebx, %ecx
movl %ebp, (%rax)
movl %ecx, 0x4(%rax)
callq 0x4e77
callq 0x51d8
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: c_j
bool c_j(int argc, char **argv, bool force, struct range *range)
{
	ARGV_NO();

	if(range && range->start != range->end){
		/* :2j means :2,3j
		 * otherwise, we have :5,6j, in which case we want to say :5,5j */
		range->end--;
	}

	command_bufaction(range, buffer_joinregion_space.fn, 1);

	return true;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
cmpl $0x1, %edi
jne 0x8c61
testq %rcx, %rcx
je 0x8c48
movl 0x4(%rcx), %eax
cmpl %eax, (%rcx)
je 0x8c48
decl %eax
movl %eax, 0x4(%rcx)
leaq 0xe731(%rip), %rax      # 0x17380
movq (%rax), %rsi
movq %rcx, %rdi
movl $0x1, %edx
callq 0x8b92
jmp 0x8c72
movq (%rsi), %rsi
leaq 0x6658(%rip), %rdi      # 0xf2c3
xorl %eax, %eax
callq 0x4de2
cmpl $0x1, %ebx
sete %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: c_norm
bool c_norm(char *cmd, char *normcmd, bool force, struct range *range)
{
	enum io mode = IO_MAP; /* normal mode mappings */
	if(force)
		mode = IO_NOMAP;

	window *win = windows_cur();

	struct range rng;
	RANGE_DEFAULT(range, rng, win);

	size_t normcmdlen = strlen(normcmd);

	for(int n = range->start;
			n <= range->end;
			n++)
	{
		*win->ui_pos = (point_t){ .y = n };

		size_t const io_empty = io_bufsz();

		/* end with an escape */
		io_ungetch(K_ESC, false);

		/* don't io_map() here - may be in insert mode
		 * when we actually execute */
		for(size_t i = normcmdlen; i > 0; i--)
			io_ungetch(normcmd[i - 1], false);

		do{
			/* run the commands while the buffer is on this line */
			ui_normal_1(/*repeat:*/&(unsigned){ 0 }, mode);
		}while(io_bufsz() > io_empty);
	}

	ui_redraw();
	ui_cur_changed();

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movl %edx, %r15d
movq %rsi, %rbx
callq 0xde6c
movq %rax, 0x8(%rsp)
testq %r12, %r12
jne 0x8f5a
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movl 0x4(%rax), %eax
leaq 0x20(%rsp), %r12
movl %eax, 0x4(%r12)
movl %eax, (%r12)
movq %r12, %rdi
callq 0xd017
movq %rbx, %rdi
callq 0x4170
movq %rax, 0x10(%rsp)
movl (%r12), %r14d
cmpl 0x4(%r12), %r14d
jg 0x9005
movl $0x2, %ebp
subl %r15d, %ebp
leaq 0x4(%rsp), %r13
movq %r12, 0x18(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movl $0x0, (%rax)
movl %r14d, 0x4(%rax)
callq 0xc750
movq %rax, %r15
movl $0x1b, %edi
xorl %esi, %esi
callq 0xc8a5
cmpq $0x0, 0x10(%rsp)
je 0x8fd6
movq 0x10(%rsp), %r12
movsbl -0x1(%rbx,%r12), %edi
xorl %esi, %esi
callq 0xc8a5
decq %r12
jne 0x8fc4
movl $0x0, 0x4(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x5409
callq 0xc750
cmpq %r15, %rax
ja 0x8fd6
leal 0x1(%r14), %eax
movq 0x18(%rsp), %r12
cmpl 0x4(%r12), %r14d
movl %eax, %r14d
jl 0x8f90
callq 0x4e77
callq 0x51d8
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/cmds.c
// Function: cmd_dispatch
bool cmd_dispatch(
		const cmd_t *cmd_f,
		int argc, char **argv,
		bool force, struct range *range)
{
	force ^= cmd_f->inverse;

	return cmd_f->single_arg
		? cmd_f->f_arg1(argv[0], argv[1], force, range)
		: cmd_f->f_argv(argc, argv, force, range);
}

// Assembly:
movb 0x11(%rdi), %r10b
movq 0x8(%rdi), %r9
cmpb $0x1, 0x10(%rdi)
jne 0x9045
xorl %eax, %eax
cmpb %cl, %r10b
setne %al
movq (%rdx), %rdi
movq 0x8(%rdx), %rsi
movl %eax, %edx
movq %r8, %rcx
jmpq *%r9
xorl %eax, %eax
cmpb %cl, %r10b
setne %al
movl %esi, %edi
movq %rdx, %rsi
movl %eax, %edx
movq %r8, %rcx
jmpq *%r9
nop
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_new
buffer_t *buffer_new()
{
	buffer_t *b = umalloc(sizeof *b);

	retain_init(b);

	b->head = list_new(NULL);
	b->eol = true; /* default to nice eol */
	return b;
}

// Assembly:
pushq %rbx
movl $0x50, %edi
callq 0x5830
movq %rax, %rbx
movl $0x1, (%rax)
xorl %edi, %edi
callq 0x99a4
movq %rax, 0x8(%rbx)
movb $0x1, 0x38(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_replace_fname
void buffer_replace_fname(
		buffer_t *const b, const char *fname,
		const char **const err)
{
	*err = NULL;

	FILE *f = fopen(fname, "r");
	if(!f){
err:
		*err = strerror(errno);
		return;
	}

	if(!buffer_replace_file(b, f)){
		fclose(f);
		goto err;
	}
	fclose(f);

	buffer_set_fname(b, fname);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq $0x0, (%rdx)
leaq 0x6318(%rip), %rsi      # 0xf3f9
movq %r14, %rdi
callq 0x4440
testq %rax, %rax
je 0x911d
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0x9135
movl %eax, %ebp
movq %r12, %rdi
callq 0x4150
testl %ebp, %ebp
je 0x911d
movq %r15, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x917c
callq 0x40a0
movl (%rax), %edi
callq 0x44e0
movq %rax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_replace_file
static int buffer_replace_file(buffer_t *b, FILE *f)
{
	list_t *l = list_new_file(f, &b->eol);

	if(!l)
		return 0;

	buffer_replace_list(b, l);

	b->mtime = time(NULL);

	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x38(%rdi), %rsi
movq %rax, %rdi
callq 0x9a11
testq %rax, %rax
je 0x9172
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x9d7b
movq %r14, 0x8(%rbx)
xorl %edi, %edi
callq 0x4360
movq %rax, 0x40(%rbx)
movl $0x1, %eax
jmp 0x9174
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_new_file_nofind
buffer_t *buffer_new_file_nofind(FILE *f)
{
	buffer_t *b = buffer_new();

	if(buffer_replace_file(b, f))
		return b;

	buffer_free(b);

	return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x50, %edi
callq 0x5830
movq %rax, %rbx
movl $0x1, (%rax)
xorl %edi, %edi
callq 0x99a4
movq %rax, 0x8(%rbx)
movb $0x1, 0x38(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9135
testl %eax, %eax
jne 0x91ea
movq %rbx, %rdi
callq 0x905c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_new_fname
void buffer_new_fname(
		buffer_t **pb, const char *fname,
		const char **const err)
{
	*err = NULL;

	/* look for an existing buffer first */
	buffer_t *b = buffers_find(fname);

	if(b){
		*pb = retain(b);
		return;
	}

	FILE *f = fopen(fname, "r");
	if(!f){
got_err:
		*err = strerror(errno);
		b = buffer_new();
		b->modified = false; /* editing a non-existant file, etc */
		goto fin;
	}

	b = buffer_new_file_nofind(f);
	fclose(f);

	if(!b){
		if(errno == EISDIR){
			DIR *d = opendir(fname);
			if(!d)
				goto got_err;

			list_t *l = list_from_dir(d);

			const int save_errno = errno;
			closedir(d);
			errno = save_errno;

			if(!l)
				goto got_err;

			b = buffer_new();
			buffer_replace_list(b, l);
		}else{
			goto got_err;
		}
	}

fin:
	buffer_set_fname(b, fname);
	*pb = b;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, (%rdx)
movq %rsi, %rdi
callq 0xd62c
testq %rax, %rax
je 0x922d
movq %rax, %rdi
callq 0xce90
movq %rax, %r12
jmp 0x930a
leaq 0x61c5(%rip), %rsi      # 0xf3f9
movq %r14, %rdi
callq 0x4440
testq %rax, %rax
je 0x92c9
movq %rax, %r13
movq %rax, %rdi
callq 0x91a8
movq %rax, %r12
movq %r13, %rdi
callq 0x4150
testq %r12, %r12
jne 0x92ff
callq 0x40a0
cmpl $0x15, (%rax)
jne 0x92c9
movq %rax, %r12
movq %r14, %rdi
callq 0x4160
testq %rax, %rax
je 0x92c0
movq %rax, %rbp
movq %rax, %rdi
callq 0x9bfe
movq %rax, (%rsp)
movl (%r12), %r13d
movq %rbp, %rdi
callq 0x4290
movl %r13d, (%r12)
movq (%rsp), %r13
testq %r13, %r13
je 0x92c0
callq 0x907b
movq %rax, %r12
movq 0x8(%rax), %rdi
callq 0x9d7b
movq %r13, 0x8(%r12)
movb $0x1, %al
jmp 0x92c5
xorl %eax, %eax
xorl %r12d, %r12d
testb %al, %al
jne 0x92ff
callq 0x40a0
movl (%rax), %edi
callq 0x44e0
movq %rax, (%r15)
movl $0x50, %edi
callq 0x5830
movq %rax, %r12
movl $0x1, (%rax)
xorl %edi, %edi
callq 0x99a4
movq %rax, 0x8(%r12)
movw $0x1, 0x38(%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0x917c
movq %r12, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_write_file
int buffer_write_file(buffer_t *b, int n, FILE *f, bool eol)
{
	int r = list_write_file(b->head, n, f, eol);
	b->mtime = time(NULL);
	b->modified = false;
	return r;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x9dab
movl %eax, %ebp
xorl %edi, %edi
callq 0x4360
movq %rax, 0x40(%rbx)
movb $0x0, 0x39(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_last_indent_line
static list_t *buffer_last_indent_line(buffer_t *buf, int y)
{
	list_t *l = list_seek(buf->head, y, false);

	if(!l)
		return NULL;

	/* scan backwards until we hit a non-empty line */
	while(l->prev){
		l = l->prev;
		if(!isallspace(l->line, l->len_line))
			return l;
	}

	return NULL;
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rdi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x9ede
testq %rax, %rax
je 0x93a0
movq %rax, %rbx
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
je 0x939e
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0xc139
testb %al, %al
jne 0x9383
jmp 0x93a0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: list_count_indent
static int list_count_indent(list_t *l)
{
	int indent = 0;

	/* count indent */
	for(unsigned i = 0; i < l->len_line; i++, indent++)
		if(!isspace(l->line[i]))
			break;

	/* if it ends with a '{', increase indent */
	if(l->len_line > 0 && l->line[l->len_line - 1] == '{')
		indent++;

	return indent;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x93da
callq 0x4540
movq (%rax), %rcx
movq (%rbx), %rdx
xorl %eax, %eax
movsbq (%rdx,%rax), %rsi
testb $0x20, 0x1(%rcx,%rsi,2)
je 0x93dc
incq %rax
movl %eax, %esi
cmpq %rsi, %r14
ja 0x93c2
jmp 0x93dc
xorl %eax, %eax
testq %r14, %r14
je 0x93f1
movq (%rbx), %rcx
xorl %edx, %edx
cmpb $0x7b, -0x1(%rcx,%r14)
sete %dl
addl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_inschar_at
void buffer_inschar_at(buffer_t *buf, char ch, int *x, int *y)
{
	bool indent = false;
	bool inschar = true;

	switch(ch){
		case CTRL_AND('?'):
		case CTRL_AND('H'):
		case 127:
			if(*x > 0)
				buffer_delchar(buf, x, y);
			inschar = false;
			break;

		case '}':
			/* if we've just started a new line, this unindents */
			buffer_unindent_empty(buf, x, *y);
			indent = false;
			break;

		case '\n':
			indent = true;
	}

	if(inschar){
		list_inschar(buf->head, x, y, ch, /*autogap*/0);
		if(indent)
			buffer_smartindent(buf, x, *y);
	}

	buf->modified = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movb $0x1, %r13b
xorl %r12d, %r12d
cmpl $0x1e, %esi
jle 0x942b
cmpl $0x7f, %ebp
je 0x943d
cmpl $0x7d, %ebp
je 0x945e
cmpl $0x1f, %ebp
je 0x943d
jmp 0x949d
cmpl $0x8, %ebp
je 0x943d
cmpl $0xa, %ebp
jne 0x949d
movb $0x1, %r12b
movb $0x1, %r13b
jmp 0x949d
cmpl $0x0, (%r14)
jle 0x9456
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xa1ff
movb $0x1, 0x39(%rbx)
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0x949d
movl (%r15), %esi
testl %esi, %esi
je 0x949a
movq %rbx, %rdi
callq 0x936d
testq %rax, %rax
je 0x949a
movq %rax, %r12
movq (%rax), %rdi
testq %rdi, %rdi
je 0x949a
movslq (%r14), %rsi
callq 0xc139
testb %al, %al
je 0x949a
movq %r12, %rdi
callq 0x93a5
testl %eax, %eax
je 0x949a
decl %eax
movl %eax, (%r14)
xorl %r12d, %r12d
testb %r13b, %r13b
je 0x94dc
movq 0x8(%rbx), %rdi
movsbl %bpl, %ecx
xorl %ebp, %ebp
movq %r14, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0xa0a0
testb %r12b, %r12b
je 0x94dc
movl (%r15), %esi
movq %rbx, %rdi
callq 0x936d
testq %rax, %rax
je 0x94d9
movq %rax, %rdi
callq 0x93a5
movl %eax, %ebp
movl %ebp, (%r14)
movb $0x1, 0x39(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_inscolchar
void buffer_inscolchar(
		buffer_t *buf, char ch, unsigned ncols,
		point_t *const ui_pos)
{
	for(int i = ncols - 1; i >= 0; i--){
		int y = ui_pos->y + i;
		int x = ui_pos->x;
		int *px = &x;
		int *py = &y;

		/* update x and y in the last case */
		if(i == 0){
			px = &ui_pos->x;
			py = &ui_pos->y;
		}

		buffer_inschar_at(buf, ch, px, py);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
decl %r14d
js 0x955b
movq %rcx, %rbx
movq %rdi, %r15
leaq 0x4(%rcx), %r12
leaq 0x4(%rsp), %r13
movsbl %sil, %ebp
movl 0x4(%rbx), %eax
addl %r14d, %eax
movl %eax, 0x4(%rsp)
movl (%rbx), %eax
subl $0x1, %r14d
movq %rsp, %rdx
cmovbq %rbx, %rdx
movl %eax, (%rsp)
movq %r13, %rcx
cmovbq %r12, %rcx
movq %r15, %rdi
movl %ebp, %esi
callq 0x93f9
leal 0x1(%r14), %eax
testl %eax, %eax
jg 0x9528
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_delregion_f
static
void buffer_delregion_f(buffer_t *buf, const region_t *region, point_t *out)
{
	list_t *del = list_delregion(&buf->head, region);

	if(del){
		release(yank_push(yank_new(del, region->type)), yank_free);

		buf->modified = true;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rdi
callq 0xa2bd
testq %rax, %rax
je 0x95a9
movl 0x10(%r14), %esi
movq %rax, %rdi
callq 0xc9dc
movq %rax, %rdi
callq 0xca45
leaq 0x3493(%rip), %rsi      # 0xca30
movq %rax, %rdi
callq 0xce9b
movb $0x1, 0x39(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_yankregion_f
static
void buffer_yankregion_f(buffer_t *buf, const region_t *region, point_t *out)
{
	list_t *yanked = list_delregion(&buf->head, region);

	if(yanked){
		yank *yank = yank_new(yanked, region->type);
		yank_push(yank);

		point_t ui_pos = region->begin;

		buffer_insyank(buf, yank, &ui_pos,
				/*prepend:*/true, /*modify:*/false);

		release(yank, yank_free);
	}

	/* restore ui pos (set in buffer_insyank) */
	*out = region->begin;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addq $0x8, %r15
movq %r15, %rdi
callq 0xa2bd
testq %rax, %rax
je 0x9618
movl 0x10(%r14), %esi
movq %rax, %rdi
callq 0xc9dc
movq %rax, %r12
movq %rax, %rdi
callq 0xca45
movq (%r14), %rax
leaq 0x4(%rsp), %rcx
movq %rax, -0x4(%rcx)
movq %rsp, %r8
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0xca7a
leaq 0x3420(%rip), %rsi      # 0xca30
movq %r12, %rdi
callq 0xce9b
movq (%r14), %rax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_insyank
void buffer_insyank(
		buffer_t *buf, const yank *y,
		point_t *ui_pos,
		bool prepend, bool modify)
{
	yank_put_in_list(y,
			&buf->head,
			prepend,
			&ui_pos->y,
			&ui_pos->x);

	if(modify)
		buf->modified = true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rdx, %r8
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %rsi
leaq 0x4(%rdx), %r9
movq %rax, %rdi
movl %ecx, %edx
movq %r9, %rcx
callq 0xca7a
testl %ebp, %ebp
je 0x9656
movb $0x1, 0x39(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_caseregion
void buffer_caseregion(
		buffer_t *buf,
		enum case_tog tog_type,
		const region_t *r)
{
	int (*f)(int) = NULL;

	switch(tog_type){
		case CASE_TOGGLE: f = ctoggle; break;
		case CASE_UPPER:  f = toupper; break;
		case CASE_LOWER:  f = tolower; break;
	}
	assert(f);

	list_iter_region(buf->head, r, 0, buffer_case_cb, &f);
	buf->modified = true;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
cmpl $0x2, %esi
je 0x96d4
cmpl $0x1, %esi
je 0x96cb
testl %esi, %esi
jne 0x96e0
leaq 0x62(%rip), %rax        # 0x972b
jmp 0x96db
movq 0xd8c6(%rip), %rax      # 0x16f98
jmp 0x96db
movq 0xd8ed(%rip), %rax      # 0x16fc8
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x970c
movq 0x8(%rbx), %rdi
leaq 0x5d(%rip), %rcx        # 0x9750
leaq 0x8(%rsp), %r8
movq %rdx, %rsi
xorl %edx, %edx
callq 0xabf8
movb $0x1, 0x39(%rbx)
addq $0x10, %rsp
popq %rbx
retq
leaq 0x5a30(%rip), %rdi      # 0xf143
leaq 0x5e94(%rip), %rsi      # 0xf5ae
leaq 0x5e96(%rip), %rcx      # 0xf5b7
movl $0x1e2, %edx            # imm = 0x1E2
callq 0x4210
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_findat
bool buffer_findat(const buffer_t *buf, const char *search, point_t *at, int dir)
{
	list_t *l = list_seek(buf->head, at->y, 0);

	if(!l){
		if(dir < 0){
			l = list_last(buf->head, &at->y);
		}else{
			return false;
		}
	}

	/* search at the next char */
	l = list_advance_x(l, dir, &at->y, &at->x);

	while(l){
		char *p;
		if((unsigned)at->x < l->len_line
		&& (p = buffer_find2(l->line, l->len_line, search, at->x, dir)))
		{
			at->x = p - l->line;
			at->y = at->y;
			return true;
		}

		l = list_advance_y(l, dir, &at->y, &at->x);
	}

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movq 0x8(%rdi), %rdi
leaq 0x4(%rdx), %r12
movl 0x4(%rdx), %esi
xorl %edx, %edx
callq 0x9ede
testq %rax, %rax
je 0x9827
movq %rax, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0xae3c
movq %rax, %r13
testq %r13, %r13
setne %bpl
je 0x982d
movl (%r14), %esi
movq 0x8(%r13), %rax
subq %rsi, %rax
jbe 0x980c
movq (%r13), %rdi
testl %ebx, %ebx
js 0x97f4
addq %rsi, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xc0c9
jmp 0x97fc
movq %r15, %rdx
callq 0xc07f
testq %rax, %rax
je 0x980c
subl (%r13), %eax
movl %eax, (%r14)
xorl %eax, %eax
jmp 0x9821
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0xadfa
movq %rax, %r13
movb $0x1, %al
testb %al, %al
jne 0x97c7
jmp 0x982d
testl %ebx, %ebx
js 0x983e
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r13), %rdi
movq %r12, %rsi
callq 0xae7e
jmp 0x97b4
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_joinregion_f
static
void buffer_joinregion_f(
		buffer_t *buf,
		const region_t *region,
		point_t *out,
		const bool space)
{
	/* could use 'how' here - columns and lines only make sense */
	list_t *l = list_seek(buf->head, region->begin.y, 0);
	const int mid = l ? l->len_line : 0;

	list_joinregion(&buf->head, region, space);

	if(l)
		out->x = mid;
	buf->modified = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r12
movq 0x8(%rdi), %rdi
movl 0x4(%rsi), %esi
xorl %r14d, %r14d
xorl %edx, %edx
callq 0x9ede
movq %rax, %r13
testq %rax, %rax
je 0x9887
movl 0x8(%r13), %r14d
movzbl %bpl, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0xa83e
testq %r13, %r13
je 0x98a2
movq (%rsp), %rax
movl %r14d, (%rax)
movb $0x1, 0x39(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/buffer.c
// Function: buffer_indent2
static
void buffer_indent2(
		buffer_t *buf, const region_t *region,
		point_t *out, int dir)
{
	/* region is sorted by y */
	const int min_x = MIN(region->begin.x, region->end.x);
	list_t *pos = dir < 0
		? list_seek(buf->head, region->begin.y, 0)
		: NULL;

	for(int y = region->begin.y; y <= region->end.y; y++){
		int x = 0;

		switch(region->type){
			case REGION_CHAR:
			case REGION_LINE:
				break;
			case REGION_COL:
				/* indent from the first col onwards */
				x = min_x;
		}

		if(dir > 0){
			buffer_inschar_at(buf, '\t', &x, &y);
		}else{
			if(pos){
				if(pos->len_line > 0 && pos->line[0] == '\t')
					memmove(pos->line, pos->line + 1, --pos->len_line);

				pos = pos->next;
			}else{
				break;
			}
		}
	}
	buf->modified = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl (%rsi), %eax
movl 0x8(%rsi), %r13d
cmpl %r13d, %eax
cmovll %eax, %r13d
testl %edx, %edx
js 0x98de
xorl %r12d, %r12d
jmp 0x98f0
movq 0x8(%r14), %rdi
movl 0x4(%r15), %esi
xorl %edx, %edx
callq 0x9ede
movq %rax, %r12
movl 0x4(%r15), %eax
movl %eax, (%rsp)
cmpl 0xc(%r15), %eax
jle 0x9911
movb $0x1, 0x39(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
movl %ebp, 0x4(%rsp)
cmpl $0x1, 0x10(%r15)
movl $0x0, %eax
cmovel %r13d, %eax
movl %eax, 0x4(%rsp)
testl %ebx, %ebx
jle 0x994d
movq 0x8(%r14), %rdi
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
movl $0x9, %ecx
xorl %r8d, %r8d
callq 0xa0a0
movb $0x1, 0x39(%r14)
jmp 0x997b
testq %r12, %r12
je 0x999d
movq 0x8(%r12), %rdx
testq %rdx, %rdx
je 0x9976
movq (%r12), %rdi
cmpb $0x9, (%rdi)
jne 0x9976
leaq 0x1(%rdi), %rsi
decq %rdx
movq %rdx, 0x8(%r12)
callq 0x4400
movq 0x18(%r12), %r12
movb $0x1, %al
testb %al, %al
je 0x98fd
movl (%rsp), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%rsp)
cmpl 0xc(%r15), %eax
jl 0x9913
jmp 0x98fd
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0x997d
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_copy_deep
list_t *list_copy_deep(const list_t *const l, list_t *prev)
{
	if(!l)
		return NULL;
	list_t *new = list_new(prev);
	new->len_line = l->len_line;
	new->len_malloc = l->len_line; /* len_line, not len_malloc */
	new->line = ustrdup_len(l->line, l->len_line);
	new->next = list_copy_deep(l->next, new);
	return new;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x9a06
movq %rsi, %r15
movq %rdi, %r14
movl $0x30, %edi
callq 0x5830
movq %rax, %rbx
movq %r15, 0x20(%rax)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq 0x8(%r14), %rsi
movq %rsi, 0x10(%rbx)
movq (%r14), %rdi
callq 0x58a8
movq %rax, (%rbx)
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0x99b8
movq %rax, 0x18(%rbx)
jmp 0x9a08
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_new_fd
static list_t *list_new_fd(int fd, bool *eol)
{
	struct stat st;
	if(fstat(fd, &st) == -1)
		return NULL;

	if(st.st_size == 0)
		goto fallback; /* could be stdin */

	if(S_ISDIR(st.st_mode)){
		errno = EISDIR;
		return NULL;
	}

	void *mem = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);

	if(mem == MAP_FAILED){
		if(errno == EINVAL)
fallback:
			return list_new_fd_read(fd, eol);

		return NULL;
	}

	list_t *l = mmap_to_lines(mem, st.st_size, eol);
	munmap(mem, st.st_size);

	return l;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r12
movl %edi, %ebp
leaq 0x28(%rsp), %rsi
callq 0x4510
cmpl $-0x1, %eax
je 0x9a70
movq 0x58(%rsp), %r15
testq %r15, %r15
je 0x9b32
movl $0xf000, %eax           # imm = 0xF000
andl 0x40(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x9a78
callq 0x40a0
movl $0x15, (%rax)
xorl %r14d, %r14d
jmp 0x9be9
xorl %edi, %edi
movq %r15, %rsi
movl $0x1, %edx
movl $0x2, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x4190
cmpq $-0x1, %rax
je 0x9b24
movq %rax, %r13
movq %r12, 0x20(%rsp)
movq %rax, %r12
movl $0x30, %edi
callq 0x5830
movq %rax, %r14
movq $0x0, 0x20(%rax)
leaq 0x18(%rsp), %rax
movq %r14, (%rax)
leaq 0x8(%rsp), %rbx
movq %r13, (%rbx)
xorl %ebp, %ebp
cmpb $0xa, (%r12,%rbp)
jne 0x9ae8
movq %r13, %rsi
addq %rbp, %rsi
leaq 0x18(%rsp), %rdi
movq %rbx, %rdx
callq 0xb1f9
incq %rbp
cmpq %rbp, %r15
jne 0x9ace
addq %rbp, %r13
cmpq 0x8(%rsp), %r13
movq 0x20(%rsp), %rax
sete (%rax)
je 0x9b14
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r13, %rsi
callq 0xb1f9
movq %r12, %rdi
movq %r15, %rsi
callq 0x43f0
jmp 0x9be9
callq 0x40a0
cmpl $0x16, (%rax)
jne 0x9a70
movl $0x30, %edi
callq 0x5830
movq %rax, %r14
movq $0x0, 0x20(%rax)
xorl %eax, %eax
movl %eax, 0x18(%rsp)
movl %eax, 0x8(%rsp)
leaq 0x14(%rsp), %rsi
movl %eax, (%rsi)
movl $0x1, %edx
movl %ebp, %edi
callq 0x42b0
movb $0x1, %bl
cmpl $0x1, %eax
jne 0x9be5
movq %r12, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x18(%rsp), %r12
leaq 0x14(%rsp), %r13
movl %ebx, %r15d
testb $0x1, %bl
je 0x9ba2
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movq %r12, %rdx
movl $0xa, %ecx
movl $0x20, %r8d
callq 0xa0a0
xorl %r15d, %r15d
movl 0x14(%rsp), %eax
movb $0x1, %bl
cmpl $0xa, %eax
je 0x9bc9
movsbl %al, %ecx
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movq %r12, %rdx
movl $0x20, %r8d
callq 0xa0a0
movl %r15d, %ebx
movl $0x1, %edx
movl %ebp, %edi
movq %r13, %rsi
callq 0x42b0
cmpl $0x1, %eax
je 0x9b7c
andb $0x1, %bl
movq 0x20(%rsp), %r12
movb %bl, (%r12)
movq %r14, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_from_dir
list_t *list_from_dir(DIR *d)
{
	list_t *head = list_new(NULL), *prev = NULL;
	int dfd = dirfd(d);

	struct dirent *dent;
	while((errno = 0, dent = readdir(d))){
		size_t len = strlen(dent->d_name);
		struct stat st;
		const bool is_dir = (dfd != -1
				&& fstatat(dfd, dent->d_name, &st, 0) == 0
				&& S_ISDIR(st.st_mode));

		char *line;
		if(is_dir){
			len++;
			line = umalloc(len + 1);
			snprintf(line, len + 1, "%s/", dent->d_name);

		}else{
			line = ustrdup_len(dent->d_name, len);
		}

		list_t *l;

		if(!head->line){
			l = head;
		}else{
			assert(prev);
			l = list_new(prev);
			prev->next = l;
		}
		prev = l;

		l->line = line;
		l->len_line = len;
		l->len_malloc = len + 1;
	}

	if(errno){
		int save = errno;
		list_free(head);
		head = NULL;
		errno = save;
	}

	return head;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movl $0x30, %edi
callq 0x5830
movq %rax, 0x8(%rsp)
movq $0x0, 0x20(%rax)
movq %rbx, %rdi
callq 0x42f0
movl %eax, 0x4(%rsp)
callq 0x40a0
movq %rax, %r15
movl $0x0, (%rax)
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
callq 0x4380
testq %rax, %rax
je 0x9d2d
movq %rax, %r12
xorl %ebp, %ebp
addq $0x13, %r12
movq %r12, %rdi
callq 0x4170
movq %rax, %r13
cmpl $-0x1, 0x4(%rsp)
je 0x9ccc
movl 0x4(%rsp), %edi
movq %r12, %rsi
leaq 0x18(%rsp), %rdx
xorl %ecx, %ecx
callq 0x4530
testl %eax, %eax
jne 0x9ccc
movl 0x30(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x9ccc
leaq 0x1(%r13), %rbx
addq $0x2, %r13
movq %r13, %rdi
callq 0x5830
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
leaq 0x593e(%rip), %rdx      # 0xf5fb
movq %r12, %rcx
xorl %eax, %eax
callq 0x41e0
movq %rbx, %r13
jmp 0x9cda
movq %r12, %rdi
movq %r13, %rsi
callq 0x58a8
movq %rax, %r14
movq 0x8(%rsp), %rbx
cmpq $0x0, (%rbx)
je 0x9cff
testq %rbp, %rbp
je 0x9d5c
movl $0x30, %edi
callq 0x5830
movq %rax, %rbx
movq %rbp, 0x20(%rax)
movq %rax, 0x18(%rbp)
movq %r14, (%rbx)
movq %r13, 0x8(%rbx)
incq %r13
movq %r13, 0x10(%rbx)
movl $0x0, (%r15)
movq 0x10(%rsp), %rdi
callq 0x4380
movq %rax, %r12
movq %rbx, %rbp
testq %rax, %rax
jne 0x9c5e
movl (%r15), %ebx
testl %ebx, %ebx
je 0x9d45
movq 0x8(%rsp), %rdi
callq 0x9d7b
movl %ebx, (%r15)
xorl %eax, %eax
jmp 0x9d4a
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5b97(%rip), %rdi      # 0xf8fa
leaq 0x5895(%rip), %rsi      # 0xf5ff
leaq 0x5895(%rip), %rcx      # 0xf606
movl $0xcc, %edx
callq 0x4210
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_free
void list_free(list_t *l)
{
	while(l){
		list_t *next = l->next;

		free(l->line);
		free(l);

		l = next;
	}
}

// Assembly:
testq %rdi, %rdi
je 0x9daa
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rbx), %rdi
movq 0x18(%rbx), %r14
callq 0x4080
movq %rbx, %rdi
callq 0x4080
movq %r14, %rbx
testq %r14, %r14
jne 0x9d87
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_write_fd
static int list_write_fd(list_t *l, int n, int fd, bool eol)
{
	for(; l && (n == -1 || n --> 0); l = l->next){
		if(write(fd, l->line, l->len_line) != (int)l->len_line)
			goto got_err;

		if(l->next || eol)
			if(write(fd, "\n", 1) != 1)
				goto got_err;
	}

	return 0;
got_err:
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x9e4c
movl %ecx, %ebx
movl %edx, %ebp
movq %rdi, %r14
xorb $0x1, %bl
leaq 0x5969(%rip), %r15      # 0xf757
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $-0x1, %esi
je 0x9e08
testl %esi, %esi
jle 0x9e4c
decl %esi
movl %esi, %r13d
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movl %ebp, %edi
callq 0x4110
movslq 0x8(%r14), %rcx
cmpq %rcx, %rax
jne 0x9e4f
cmpq $0x0, 0x18(%r14)
sete %al
testb %bl, %al
jne 0x9e40
movl $0x1, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x4110
cmpq $0x1, %rax
jne 0x9e4f
movq 0x18(%r14), %r14
movl %r13d, %esi
testq %r14, %r14
jne 0x9df4
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_seekp
list_t **list_seekp(list_t **pl, int y, bool creat)
{
	if(!*pl){
		if(creat)
			*pl = list_new(NULL);
		else
			return NULL;
	}

	while(y > 0){
		if(!(*pl)->next){
			if(creat)
				(*pl)->next = list_new(*pl);
			else
				return NULL;
		}

		pl = &(*pl)->next;
		y--;
	}

	return pl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x9e90
testb %bpl, %bpl
je 0x9ece
movl $0x30, %edi
callq 0x5830
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
testl %r14d, %r14d
jle 0x9ed0
incl %r14d
movq (%rbx), %r15
cmpq $0x0, 0x18(%r15)
jne 0x9ebc
testb %bpl, %bpl
je 0x9ece
movl $0x30, %edi
callq 0x5830
movq %r15, 0x20(%rax)
movq (%rbx), %rcx
movq %rax, 0x18(%rcx)
movq (%rbx), %rbx
addq $0x18, %rbx
decl %r14d
cmpl $0x1, %r14d
jg 0x9e98
jmp 0x9ed0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_evalnewlines1
int list_evalnewlines1(list_t *l)
{
	if(l->len_line == 0)
		return 0;

	int r = 0;
	for(size_t i = l->len_line - 1; ; i--){
		char ch = l->line[i];

		if(ch == '\n' /* XXX: not '\r' / ^M */){
			int cut_len = l->len_line - i;
			char *cut;
			if(cut_len > 0){
				cut = umalloc(cut_len);
				/* cut_len-1, don't copy the \n */
				memcpy(cut, l->line + i + 1, cut_len-1);
			}else{
				cut = NULL;
				cut_len = 0;
			}

			l->len_line = i;

			/* insert a line after */
			list_insline(&l, &(int){0}, &(int){0}, 1);

			list_t *nl = l->next;
			nl->line = cut;
			nl->len_malloc = cut_len;
			nl->len_line = cut_len - 1;

			r = 1; /* we replaced */
		}

		if(i == 0)
			break;
	}

	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, (%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0xa001
leaq -0x1(%rax), %rbx
movabsq $0x100000000, %r14      # imm = 0x100000000
subq %rax, %r14
movl $0x1, %r15d
subq %rax, %r15
movl $0x1, %ebp
subl %eax, %ebp
xorl %r13d, %r13d
movq (%rsp), %rax
movq (%rax), %rcx
cmpb $0xa, (%rcx,%rbx)
jne 0x9fec
movq 0x8(%rax), %r13
movq %rbp, %r12
addq %r13, %r12
testl %r12d, %r12d
jle 0x9f90
leaq (%r15,%r13), %rdi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
callq 0x5830
movq %rax, %rdi
movq (%rsp), %rax
movq (%rax), %rax
leaq (%rax,%rbx), %rsi
incq %rsi
addl %r14d, %r13d
movq %rdi, 0x10(%rsp)
movq %r13, %rdx
callq 0x4350
jmp 0x9f9c
xorl %r12d, %r12d
movq $0x0, 0x10(%rsp)
movq (%rsp), %rax
movq %rbx, 0x8(%rax)
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
movl $0x1, %r13d
movq %rsp, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movl $0x1, %ecx
callq 0xa016
movq (%rsp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
movl %r12d, %ecx
movq %rcx, 0x10(%rax)
decl %r12d
movslq %r12d, %rcx
movq %rcx, 0x8(%rax)
incq %r14
incq %r15
incq %rbp
addq $-0x1, %rbx
jb 0x9f3e
jmp 0xa004
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_insline
void list_insline(list_t **pl, int *x, int *y, int dir)
{
	list_t *l, *save;

	*x = 0;

	if(dir < 0 && *y == 0){
		/* special case */
		l = *pl;
		(*pl = list_new(NULL))->next = l;
		if(l)
			l->prev = *pl;
		return;
	}

	if(dir < 0)
		--*y;

	/* list_seekp() to create if necessary,
	 * and make that creation available in *pl */
	l = *list_seekp(pl, *y, true);

	save = l->next;
	l->next = list_new(l);
	l->next->next = save;
	if(save)
		save->prev = l->next;

	++*y;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movl $0x0, (%rsi)
testl %ecx, %ecx
jns 0xa035
movl (%rbx), %eax
testl %eax, %eax
je 0xa076
decl %eax
movl %eax, (%rbx)
movl (%rbx), %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x9e61
movq (%rax), %r14
movq 0x18(%r14), %r15
movl $0x30, %edi
callq 0x5830
movq %r14, 0x20(%rax)
movq %rax, 0x18(%r14)
movq %r15, 0x18(%rax)
testq %r15, %r15
je 0xa06e
movq 0x18(%r14), %rax
movq %rax, 0x20(%r15)
incl (%rbx)
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rbx
movl $0x30, %edi
callq 0x5830
movq $0x0, 0x20(%rax)
movq %rax, (%r14)
movq %rbx, 0x18(%rax)
testq %rbx, %rbx
je 0xa070
movq (%r14), %rax
movq %rax, 0x20(%rbx)
jmp 0xa070
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_inschar
void list_inschar(
		list_t *l, int *x, int *y,
		char ch, char gapchar)
{
	l = list_seek(l, *y, true);

	if((unsigned)*x >= l->len_malloc){
		const int old_len = l->len_malloc;

		l->len_malloc = *x + 1;
		l->line = urealloc(l->line, l->len_malloc);

		memset(l->line + old_len, 0, l->len_malloc - old_len);
	}else{
		/* shift stuff up */
		l->line = urealloc(l->line, ++l->len_malloc);
		memmove(l->line + *x + 1, l->line + *x, l->len_malloc - *x - 1);
	}

	if(!gapchar){
		/* autogap */
		for(int i = 0; i < *x && (unsigned)i < l->len_line; i++){
			if(!isspace(l->line[i])){
				gapchar = ' ';
				break;
			}
		}

		if(!gapchar){
			/* all space, go with a tab */
			gapchar = '\t';
		}
	}

	for(int i = l->len_line; i < *x; i++){
		l->line[i] = gapchar;
		l->len_line++;
	}

	l->line[*x] = ch;
	l->len_line++;
	if(list_evalnewlines1(l)){
		*x = 0;
		++*y;
	}else{
		++*x;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r15d
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movl (%rdx), %esi
leaq 0x10(%rsp), %rax
movq %rdi, (%rax)
movq %rax, %rdi
movl $0x1, %edx
callq 0x9e61
testq %rax, %rax
je 0xa0da
movq (%rax), %r12
jmp 0xa0dd
xorl %r12d, %r12d
movl (%r14), %eax
movq 0x10(%r12), %r13
cmpq %rax, %r13
jbe 0xa11f
movq (%r12), %rdi
incq %r13
movq %r13, 0x10(%r12)
movq %r13, %rsi
callq 0x5851
movq %rax, (%r12)
movslq (%r14), %rdx
leaq (%rax,%rdx), %rdi
incq %rdi
leaq (%rax,%rdx), %rsi
notq %rdx
addq 0x10(%r12), %rdx
callq 0x4400
jmp 0xa14d
movslq %eax, %rsi
incq %rsi
movq %rsi, 0x10(%r12)
movq (%r12), %rdi
callq 0x5851
movq %rax, (%r12)
movslq %r13d, %rcx
leaq (%rax,%rcx), %rdi
movq 0x10(%r12), %rdx
subq %rcx, %rdx
xorl %esi, %esi
callq 0x4240
testb %r15b, %r15b
jne 0xa1a0
movslq (%r14), %r13
movb $0x9, %r15b
testq %r13, %r13
jle 0xa1a0
movl %ebp, 0x4(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x8(%r12), %rbp
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0xa197
callq 0x4540
movq (%rax), %rax
movq (%r12), %rcx
movsbq (%rcx,%rbx), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0xa194
incq %rbx
cmpq %rbx, %r13
jne 0xa16d
jmp 0xa197
movb $0x20, %r15b
movq 0x8(%rsp), %rbx
movl 0x4(%rsp), %ebp
movq 0x8(%r12), %rcx
movl (%r14), %eax
cmpl %ecx, %eax
jle 0xa1c7
movslq %ecx, %rcx
movq (%r12), %rax
movb %r15b, (%rax,%rcx)
incq 0x8(%r12)
incq %rcx
movslq (%r14), %rax
cmpq %rax, %rcx
jl 0xa1af
movq (%r12), %rcx
cltq
movb %bpl, (%rcx,%rax)
incq 0x8(%r12)
movq %r12, %rdi
callq 0x9efb
testl %eax, %eax
je 0xa1eb
movl $0x0, (%r14)
jmp 0xa1ee
movq %r14, %rbx
incl (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_delchar
void list_delchar(list_t *l, int *x, int *y)
{
	l = list_seek(l, *y, false);

	--*x;

	if(!l)
		return;

	if((unsigned)*x >= l->len_line)
		return;

	memmove(l->line + *x, l->line + *x + 1, --l->len_line - *x);
}

// Assembly:
pushq %rax
movl (%rdx), %ecx
movq %rdi, (%rsp)
testq %rdi, %rdi
je 0xa22b
testl %ecx, %ecx
jle 0xa22f
incl %ecx
movq %rsp, %rax
movq (%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0xa22b
addq $0x18, %rax
decl %ecx
cmpl $0x1, %ecx
jg 0xa214
jmp 0xa232
xorl %eax, %eax
jmp 0xa232
movq %rsp, %rax
testq %rax, %rax
je 0xa23c
movq (%rax), %rax
jmp 0xa23e
xorl %eax, %eax
movslq (%rsi), %rcx
decq %rcx
movl %ecx, (%rsi)
testq %rax, %rax
je 0xa272
movl %ecx, %esi
movq 0x8(%rax), %rdx
cmpq %rsi, %rdx
jbe 0xa272
movq (%rax), %rdi
leaq (%rdi,%rcx), %rsi
incq %rsi
addq %rcx, %rdi
decq %rdx
movq %rdx, 0x8(%rax)
subq %rcx, %rdx
callq 0x4400
popq %rax
retq