LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: m_searchnext
int m_searchnext(motion_arg const *m, unsigned repeat, window *win, point_t *to)
{
	if(!lastsearch){
		ui_err("no last search");
		return MOTION_FAILURE;
	}

	const bool forward = m->i > 0;
	const int dir = (forward == lastsearch_forward) ? 1 : -1;

	repeat = DEFAULT_REPEAT(repeat);
	*to = *win->ui_pos;
	while(repeat --> 0){
		if(!buffer_findat(win->buf, lastsearch, to, dir)){
			ui_err("search pattern not found");
			return MOTION_FAILURE;
		}
	}

	ui_status("");
	return MOTION_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0xb5b8(%rip)      # 0x163e8
je 0xae89
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
cmpl $0x0, (%rdi)
setg %al
xorl %ecx, %ecx
cmpb %al, 0xb5a8(%rip)       # 0x163f0
sete %cl
cmpl $0x1, %esi
adcl $0x1, %ebp
leal -0x1(,%rcx,2), %r15d
movq 0x30(%rdx), %rax
movq (%rax), %rax
movq %rax, (%rbx)
decl %ebp
je 0xae9b
movq (%r14), %rdi
movq 0xb577(%rip), %rsi      # 0x163e8
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x90b1
testb %al, %al
jne 0xae63
leaq 0x3857(%rip), %rdi      # 0xe6de
jmp 0xae90
leaq 0x383f(%rip), %rdi      # 0xe6cf
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4c34
jmp 0xaeac
leaq 0x38a7(%rip), %rdi      # 0xe749
xorl %eax, %eax
callq 0x50b5
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: m_search
int m_search(motion_arg const *m, unsigned repeat, window *win, point_t *to)
{
	const bool forward = m->i > 0;

	char *target = prompt(forward ? '/' : '?', NULL);
	if(!target)
		return MOTION_FAILURE;

	m_setlastsearch(target, forward);

	return m_searchnext(&(motion_arg){ 1 }, repeat, win, to);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movl (%rdi), %r12d
xorl %edi, %edi
testl %r12d, %r12d
setle %dil
shll $0x4, %edi
orl $0x2f, %edi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0xb7f4
testq %rax, %rax
je 0xaf1a
xorl %esi, %esi
testl %r12d, %r12d
setg %sil
movq %rax, %rdi
callq 0xadf7
leaq 0x8(%rsp), %rdi
movl $0x1, (%rdi)
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0xae21
movl %eax, %r15d
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: m_visual
int m_visual(
		motion_arg const *arg, unsigned repeat,
		window *win, point_t *to)
{
	(void)repeat;

	if(!(win->ui_mode & UI_VISUAL_ANY))
		return MOTION_FAILURE;

	/* line, char? */
	switch(win->ui_mode){
		case UI_NORMAL:
		case UI_INSERT: /* fall */
		case UI_INSERT_COL:
		case UI_VISUAL_CHAR: *arg->phow = M_NONE; break;
		case UI_VISUAL_LN:   *arg->phow = M_LINEWISE; break;
		case UI_VISUAL_COL:  *arg->phow = M_COLUMN; break;
	}

	/* set `to' to the opposite corner */
	*to = *window_uipos_alt(win);

	return MOTION_SUCCESS;
}

// Assembly:
movl 0x40(%rdx), %eax
testb $0x38, %al
je 0xaf48
pushq %rbx
movq %rcx, %rbx
cmpl $0x8, %eax
je 0xaf50
cmpl $0x10, %eax
je 0xaf4b
cmpl $0x20, %eax
jne 0xaf57
pushq $0x1
jmp 0xaf4d
xorl %eax, %eax
retq
pushq $0x4
popq %rax
jmp 0xaf52
xorl %eax, %eax
movq (%rdi), %rcx
movl %eax, (%rcx)
movq %rdx, %rdi
callq 0xcee5
movq (%rax), %rax
movq %rax, (%rbx)
pushq $0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: find_unnested_paren
static bool find_unnested_paren(
		const int ptofind, const int porig, const int dir,
		list_t **pl, point_t *pos)
{
	int nest = 0;

	for(list_t *l = *pl;
	    l;
	    l = *pl = list_advance_y(l, dir, &pos->y, &pos->x))
	{
		if((unsigned)pos->x >= l->len_line)
			continue;

		char in_quote = 0; /* scoped here - ignore multi-line quotes */

		char *p = l->line + pos->x;
		while(1){
			if((*p == '\'' || *p == '"')
			&& (!in_quote || in_quote == *p))
			{
				if(in_quote == *p){
					in_quote = 0;
				}else{
					in_quote = *p;
				}
			}else if(in_quote){
				/* skipping quotes */
			}else if(*p == ptofind){
				if(nest == 0){
					pos->x = p - l->line;
					return true;
				}
				nest--;
			}else if(*p == porig){
				nest++;
			}

			if(dir > 0){
				if(p == l->line + l->len_line - 1)
					break;
				p++;
			}else{
				if(p == l->line)
					break;
				p--;
			}
		}
	}

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movl %edx, %ebp
movl %esi, (%rsp)
movq %rcx, 0x10(%rsp)
movq (%rcx), %rax
leaq 0x4(%r8), %rcx
movq %rcx, 0x8(%rsp)
xorl %r15d, %r15d
pushq $0x1
popq %r13
pushq $-0x1
popq %r14
xorl %r12d, %r12d
movl %edi, 0x4(%rsp)
testq %rax, %rax
je 0xb223
movl (%rbx), %ecx
movq 0x8(%rax), %rsi
cmpq %rcx, %rsi
jbe 0xb1fc
movslq %ecx, %rcx
movq (%rax), %rdx
addq %rdx, %rcx
addq %rdx, %rsi
decq %rsi
xorl %r10d, %r10d
movzbl (%rcx), %r9d
movsbl %r9b, %r8d
cmpl $0x27, %r9d
je 0xb1a5
cmpl $0x22, %r9d
jne 0xb1bc
testb %r10b, %r10b
movzbl %r10b, %r9d
movl %r9d, %r10d
cmovel %r8d, %r10d
cmpb %r8b, %r9b
cmovel %r15d, %r10d
jmp 0xb1e1
testb %r10b, %r10b
jne 0xb1e1
cmpl %edi, %r8d
jne 0xb1d0
testl %r12d, %r12d
je 0xb21f
decl %r12d
jmp 0xb1de
xorl %r9d, %r9d
cmpl (%rsp), %r8d
sete %r9b
addl %r9d, %r12d
xorl %r10d, %r10d
testl %ebp, %ebp
jle 0xb1ef
movq %r13, %r8
cmpq %rsi, %rcx
jne 0xb1f7
jmp 0xb1fc
movq %r14, %r8
cmpq %rdx, %rcx
je 0xb1fc
addq %r8, %rcx
jmp 0xb191
movq %rax, %rdi
movl %ebp, %esi
movq 0x8(%rsp), %rdx
movq %rbx, %rcx
callq 0xa350
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movl 0x4(%rsp), %edi
jmp 0xb16b
subl %edx, %ecx
movl %ecx, (%rbx)
testq %rax, %rax
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: motion_apply_win_dry
int motion_apply_win_dry(
		const motion *m, unsigned repeat,
		window *win, point_t *out)
{
	*out = *win->ui_pos;
	int r = m->func(&m->arg, repeat, win, out);
	if(r == MOTION_SUCCESS){
		if(out->y < 0 || out->x < 0)
			r = MOTION_FAILURE;
	}
	return r;
}

// Assembly:
pushq %rbx
movq %rcx, %rbx
movq %rdi, %rax
movq 0x30(%rdx), %rcx
movq (%rcx), %rcx
movq %rcx, (%rbx)
addq $0x8, %rdi
movq %rbx, %rcx
callq *(%rax)
cmpl $0x1, %eax
jne 0xb269
cmpl $0x0, 0x4(%rbx)
js 0xb267
cmpl $0x0, (%rbx)
js 0xb267
pushq $0x1
popq %rax
jmp 0xb269
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: motion_apply_win
int motion_apply_win(const motion *m, unsigned repeat, window *win)
{
	point_t to;

	if(motion_apply_win_dry(m, repeat, win, &to)){
		if(memcmp(win->ui_pos, &to, sizeof to)){
			*win->ui_pos = to;
			ui_cur_changed();
		}
		return MOTION_SUCCESS;
	}
	return MOTION_FAILURE;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x8(%rsp), %rcx
callq 0xb238
testl %eax, %eax
je 0xb2a1
movq 0x30(%rbx), %rax
movq (%rax), %rcx
pushq $0x1
popq %rbx
cmpq 0x8(%rsp), %rcx
je 0xb2a3
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
callq 0x501c
jmp 0xb2a3
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/motion.c
// Function: motion_to_region
bool motion_to_region(
		const motion *m, unsigned repeat,
		window *win, region_t *out)
{
	region_t r = {
		.begin = *win->ui_pos
	};
	if(!motion_apply_win_dry(m, repeat, win, &r.end))
		return false;

	/* reverse if negative range */
	point_sort_yx(&r.begin, &r.end);

	if(m->how & M_COLUMN){
		r.type = REGION_COL;

		/* needs to be done before incrementing r.end.x/y below */
		point_sort_full(&r.begin, &r.end);

	}else if(m->how & M_LINEWISE){
		r.type = REGION_LINE;

	}else{
		r.type = REGION_CHAR;
	}

	if(win->ui_mode & UI_VISUAL_ANY){
		/* only increment y in the line case */
		r.end.x++;

	}else if(!(m->how & M_LINEWISE) && !(m->how & M_EXCLUSIVE)){
		/* linewise motions are always inclusive */
		++r.end.x;
	}

	*out = r;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq 0x30(%rdx), %rax
movq (%rax), %rax
leaq 0x10(%rsp), %r12
movq %rax, -0x8(%r12)
andq $0x0, (%r12)
movq %rdi, %r15
andl $0x0, 0x8(%r12)
movq %r12, %rcx
callq 0xb238
movl %eax, %ebp
testl %eax, %eax
je 0xb34b
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0xc160
movl 0x10(%r15), %eax
testb $0x4, %al
jne 0xb30a
testb $0x1, %al
jne 0xb320
andl $0x0, 0x18(%rsp)
jmp 0xb328
leaq 0x8(%rsp), %rdi
movl $0x1, 0x10(%rdi)
movq %r12, %rsi
callq 0xc13d
jmp 0xb328
movl $0x2, 0x18(%rsp)
testb $0x38, 0x40(%r14)
je 0xb335
incl 0x10(%rsp)
jmp 0xb33c
testb $0x3, 0x10(%r15)
je 0xb32f
movl 0x18(%rsp), %eax
movl %eax, 0x10(%rbx)
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rbx)
testl %ebp, %ebp
setne %al
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/external.c
// Function: shellout_write
bool shellout_write(const char *cmd, list_t *seeked, int nlines)
{
	ui_term();

	FILE *subp = popen(cmd, "w");

	if(!subp){
		fprintf(stderr, "fork/exec: %s", strerror(errno));
		return false;
	}

	int r = list_write_file(seeked, nlines, subp, /*eol*/true);
	int errno_write = errno;

	int waitret = pclose(subp);
	int errno_wait = errno;

	if(r){
		fprintf(stderr, "write subprocess: %s", strerror(errno_write));
		return false;
	}

	if(WIFEXITED(waitret)){
		int ec = WEXITSTATUS(waitret);

		if(ec)
			fprintf(stderr, "command returned %d\n", ec);

	}else if(WIFSIGNALED(waitret)){
		fprintf(stderr, "command signalled with %d\n", WTERMSIG(waitret));
	}else if(WIFSTOPPED(waitret)){
		fprintf(stderr, "command stopped with %d\n", WSTOPSIG(waitret));
	}else{
		fprintf(stderr, "unknown state from wait()/pclose(): %d: %s",
				waitret, strerror(errno_wait));
	}

	shellout_wait_ret();

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0x5554
leaq 0x35a4(%rip), %rsi      # 0xe98e
movq %r15, %rdi
callq 0x4430
testq %rax, %rax
je 0xb44a
movq %rax, %r15
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x9626
movl %eax, %r12d
callq 0x40a0
movq %rax, %r14
movl (%rax), %ebp
movq %r15, %rdi
callq 0x41d0
testl %r12d, %r12d
jne 0xb469
movl %eax, %ebx
movl %eax, %edx
andl $0x7f, %edx
jne 0xb492
shrl $0x8, %ebx
andl $0xff, %ebx
jne 0xb4b6
callq 0xb360
movb $0x1, %bl
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xab9f(%rip), %rax      # 0x15ff0
movq (%rax), %r14
callq 0x40a0
movl (%rax), %edi
callq 0x44e0
leaq 0x32ab(%rip), %rsi      # 0xe712
jmp 0xb481
movq 0xab80(%rip), %rax      # 0x15ff0
movq (%rax), %r14
movl %ebp, %edi
callq 0x44e0
leaq 0x329f(%rip), %rsi      # 0xe720
xorl %ebx, %ebx
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4320
jmp 0xb43f
movl %edx, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jl 0xb4cb
movq 0xab46(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x3296(%rip), %rsi      # 0xe74a
jmp 0xb4e7
movq 0xab33(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x326e(%rip), %rsi      # 0xe735
movl %ebx, %edx
jmp 0xb4e7
movq 0xab1e(%rip), %rax      # 0x15ff0
movq (%rax), %r15
cmpb $0x7f, %bl
jne 0xb4f3
movzbl %bh, %edx
leaq 0x3281(%rip), %rsi      # 0xe765
movq %r15, %rdi
xorl %eax, %eax
callq 0x4320
jmp 0xb438
movl (%r14), %edi
callq 0x44e0
leaq 0x327c(%rip), %rsi      # 0xe77e
movq %r15, %rdi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4320
jmp 0xb438
nop
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: strchr_rev
char *strchr_rev(const char *s, int ch, const char *start)
{
	while(*s != ch){
		if(s == start)
			return NULL;
		s--;
	}
	return (char *)s; /* *s == ch */
}

// Assembly:
movq %rdi, %rax
movsbl (%rax), %ecx
cmpl %esi, %ecx
je 0xb52e
cmpq %rdx, %rax
je 0xb52c
decq %rax
jmp 0xb51b
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: tim_strrevstr
char *tim_strrevstr(char *restrict haystack, unsigned off, const char *restrict needle)
{
	const size_t nlen = strlen(needle);

	for(char *p = haystack + off;
			p >= haystack;
			p--)
	{
		if(!strncmp(p, needle, nlen))
			return p;
	}

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
movq %rdx, %rdi
callq 0x4170
movq %rax, %r12
movl %ebp, %r14d
addq %r15, %r14
cmpq %r15, %r14
jb 0xb56c
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x40c0
testl %eax, %eax
je 0xb56f
decq %r14
jmp 0xb550
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: tim_strstr
char *tim_strstr(char *restrict haystack, size_t len, const char *restrict needle)
{
	if(!*needle)
		return NULL;

	/* memstr */
	for(size_t h = 0; h < len; h++)
		if(haystack[h] == *needle)
			/* can assume needle is 0-terminated */
			for(size_t n = 0; n < len - h;){
				if(haystack[h + n] != needle[n])
					break;
				n++;
				if(!needle[n])
					return haystack + h;
			}

	return NULL;
}

// Assembly:
movb (%rdx), %cl
testb %cl, %cl
je 0xb5c5
pushq %rbx
movq %rdi, %r8
movq %rsi, %r9
xorl %r10d, %r10d
cmpq %rsi, %r10
je 0xb5c8
cmpb %cl, (%rdi,%r10)
jne 0xb5ba
leaq (%rdi,%r10), %rax
xorl %r11d, %r11d
cmpq %r11, %r9
je 0xb5ba
movb (%r8,%r11), %bl
cmpb (%rdx,%r11), %bl
jne 0xb5ba
cmpb $0x0, 0x1(%rdx,%r11)
leaq 0x1(%r11), %r11
jne 0xb59d
jmp 0xb5ca
incq %r10
decq %r9
incq %r8
jmp 0xb58b
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: isallspace
bool isallspace(const char *s, size_t len)
{
	for(size_t i = 0; i < len; i++)
		if(!isspace(s[i]))
			return false;
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
movq %rax, %r15
cmpq %rax, %rbx
je 0xb5f9
callq 0x4540
movq (%rax), %rcx
movsbq (%r14,%r15), %rdx
leaq 0x1(%r15), %rax
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0xb5d9
cmpq %rbx, %r15
setae %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: str_rtrim
void str_rtrim(char *s, size_t *pl)
{
	size_t i = *pl;

	while(i > 0 && isspace(s[i - 1])){
		s[i - 1] = '\0';
		i--;
	}

	*pl = i;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %r15
movq %r15, %r12
subq $0x1, %r12
jb 0xb740
callq 0x4540
movq (%rax), %rax
movsbq -0x1(%r14,%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0xb740
movb $0x0, -0x1(%r14,%r15)
movq %r12, %r15
jmp 0xb71a
movq %r15, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/str.c
// Function: expand_tilde
char *expand_tilde(const char *in)
{
	if(*in != '~')
		return NULL;

	const char *user = in + 1;

	if(isalpha(*user)){
		const char *user_end;

		for(user_end = user; isalnum(*user_end); user_end++);
		/* TODO */

		return NULL;
	}else{
		/* plain ~ */
		const char *home = getenv("HOME");
		if(!home)
			return NULL;

		size_t homelen = strlen(home);
		size_t userlen = strlen(user);
		size_t len = homelen + userlen + 1;
		char *ret = umalloc(len);

		memcpy(ret, home, homelen);
		memcpy(ret + homelen, user, userlen);
		ret[homelen + userlen] = '\0';
		return ret;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x7e, (%rdi)
jne 0xb7dc
movq %rdi, %rbx
callq 0x4540
movq (%rax), %rax
movsbq 0x1(%rbx), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0xb7dc
leaq 0x302c(%rip), %rdi      # 0xe7a9
callq 0x4040
testq %rax, %rax
je 0xb7dc
movq %rax, %r15
incq %rbx
movq %rax, %rdi
callq 0x4170
movq %rax, %r12
movq %rbx, %rdi
callq 0x4170
movq %rax, %r13
leaq (%rax,%r12), %rbp
leaq (%rax,%r12), %rdi
incq %rdi
callq 0x5648
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4360
addq %r14, %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4360
movb $0x0, (%r14,%rbp)
jmp 0xb7df
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/prompt.c
// Function: yesno
bool yesno(const char *fmt, ...)
{
	int y, x;
	nc_get_yx(&y, &x);
	nc_set_yx(nc_LINES() - 1, 0);

	va_list l;
	va_start(l, fmt);
	nc_vprintf(fmt, l);
	va_end(l);

	bool wasraw;
	int ch = io_getch(IO_NOMAP, &wasraw, /*domaps:*/true);

	nc_set_yx(y, x);

	return tolower(ch) == 'y';
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movq %rdi, %r15
leaq 0x30(%rsp), %r12
movq %rsi, 0x8(%r12)
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0xbb1f
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
leaq 0xc(%rsp), %rbx
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x49c3
callq 0x4b4e
leal -0x1(%rax), %edi
xorl %esi, %esi
callq 0x49e5
leaq 0x10(%rsp), %rsi
movq %r12, 0x10(%rsi)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsi)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x4b39
leaq 0x7(%rsp), %rsi
pushq $0x1
popq %rdi
movl %edi, %edx
callq 0xbbc8
movl %eax, %ebp
movl (%rbx), %edi
movl (%r14), %esi
callq 0x49e5
movl %ebp, %edi
callq 0x4558
cmpl $0x79, %eax
sete %al
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/io.c
// Function: io_getch
int io_getch(enum io ty, bool *wasraw, bool domaps)
{
	if(wasraw)
		*wasraw = false;

	int ch;
	bool need_map = false;
	if(io_fifoused)
		ch = io_fifo_pop(&need_map);
	else
		ch = nc_getch(ty & IO_MAPRAW, wasraw);

	/* don't run maps for raw keys */
	if(domaps && (!wasraw || !*wasraw || need_map)){
		const keymap_t *map = io_findmap(ch, ty & ~IO_MAPRAW);

		if(map){
			for(size_t i = strlen(map->to); i > 0; i--)
				io_ungetch(map->to[i-1], false);

			ch = io_fifo_pop(&need_map);
			assert(!need_map); /* corresponds to the false above */
			return ch;
		}
	}

	return ch;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %ebx
xorl %eax, %eax
movb %al, (%rsi)
movb %al, 0xf(%rsp)
cmpq $0x0, 0xa811(%rip)      # 0x163f8
je 0xbbf5
leaq 0xf(%rsp), %rdi
callq 0xbc9b
jmp 0xbc05
movl %ebx, %edi
andl $0x10, %edi
shrl $0x4, %edi
movq %r14, %rsi
callq 0x4a2a
testb %bpl, %bpl
je 0xbc75
cmpb $0x1, (%r14)
jne 0xbc17
cmpb $0x1, 0xf(%rsp)
jne 0xbc75
leaq 0x9cc2(%rip), %rcx      # 0x158e0
addq $0x8, %rcx
andl $-0x11, %ebx
movq (%rcx), %r14
testq %r14, %r14
je 0xbc75
testl %ebx, -0x8(%rcx)
je 0xbc3a
movsbl -0x4(%rcx), %edx
cmpl %edx, %eax
je 0xbc40
addq $0x10, %rcx
jmp 0xbc25
movq %r14, %rdi
callq 0x4170
movq %rax, %rbx
subq $0x1, %rbx
jb 0xbc63
movsbl -0x1(%r14,%rax), %edi
xorl %esi, %esi
callq 0xbcd8
movq %rbx, %rax
jmp 0xbc4b
leaq 0xf(%rsp), %rbx
movq %rbx, %rdi
callq 0xbc9b
cmpb $0x0, (%rbx)
jne 0xbc7e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2c27(%rip), %rdi      # 0xe8ac
leaq 0x2c2a(%rip), %rsi      # 0xe8b6
leaq 0x2c28(%rip), %rcx      # 0xe8bb
pushq $0x6a
popq %rdx
callq 0x4210
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/io.c
// Function: io_fifo_pop
static int io_fifo_pop(bool *need_map)
{
	/* pull a char from the fifo */
	int ret = io_fifo->ch;
	*need_map = io_fifo->needs_map;

	io_fifoused--;
	if(io_fifoused)
		memmove(io_fifo, io_fifo + 1, sizeof(*io_fifo) * io_fifoused);

	return ret;
}

// Assembly:
pushq %rbx
movq %rdi, %rax
movq 0xa75a(%rip), %rdi      # 0x16400
movzwl (%rdi), %ebx
movl %ebx, %ecx
shrl $0x8, %ecx
andb $0x1, %cl
movb %cl, (%rax)
movq 0xa73e(%rip), %rdx      # 0x163f8
decq %rdx
movq %rdx, 0xa734(%rip)      # 0x163f8
je 0xbcd3
leaq 0x4(%rdi), %rsi
shlq $0x2, %rdx
callq 0x4400
movzbl %bl, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/io.c
// Function: io_read_repeat
unsigned io_read_repeat(enum io io_mode)
{
	unsigned repeat = 0;

	bool raw;
	int ch = io_getch(io_mode, &raw, true);
	(void)raw;

	if(isdigit(ch) && ch != '0'){
		repeat = ch - '0';
		/* more repeats */
		for(;;){
			ch = io_getch(io_mode, &raw, true);
			if('0' <= ch && ch <= '9')
				repeat = repeat * 10 + ch - '0';
			else
				break;
		}
	}

	io_ungetch(ch, false);
	return repeat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
leaq 0x7(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xbbc8
movl %eax, %ebx
callq 0x4540
xorl %r14d, %r14d
cmpl $0x30, %ebx
je 0xbdbe
movq (%rax), %rax
movslq %ebx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
je 0xbdbe
leaq 0x7(%rsp), %r14
pushq $0x1
popq %r15
addl $-0x30, %ebx
movl %ebp, %edi
movq %r14, %rsi
movl %r15d, %edx
callq 0xbbc8
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0xbdb9
imull $0xa, %ebx, %ebx
addl %eax, %ebx
jmp 0xbd9a
movl %ebx, %r14d
movl %eax, %ebx
movl %ebx, %edi
xorl %esi, %esi
callq 0xbcd8
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/yank.c
// Function: yank_new
yank *yank_new(list_t *l, enum region_type as)
{
	yank *y = retain(umalloc(sizeof *y));
	assert(l && !l->prev);
	y->list = l;
	y->as = as;
	return y;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x5648
movq %rax, %rdi
callq 0xc254
testq %r14, %r14
je 0xbe0b
cmpq $0x0, 0x20(%r14)
jne 0xbe0b
movq %r14, (%rax)
movl %ebx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2acf(%rip), %rdi      # 0xe8e1
leaq 0x2ad6(%rip), %rsi      # 0xe8ef
leaq 0x2ad6(%rip), %rcx      # 0xe8f6
pushq $0x19
popq %rdx
callq 0x4210
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/yank.c
// Function: yank_push
yank *yank_push(yank *y)
{
	if(yank_buf)
		release(yank_buf, yank_free);
	yank_buf = retain(y);
	return yank_buf;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0xa5c8(%rip), %rdi      # 0x16410
testq %rdi, %rdi
je 0xbe59
leaq -0x2c(%rip), %rsi       # 0xbe28
callq 0xc25f
movq %rbx, %rdi
callq 0xc254
movq %rax, 0xa5a8(%rip)      # 0x16410
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/pos.c
// Function: point_sort_yx
void point_sort_yx(point_t *const a, point_t *const b)
{
	if(b->y < a->y){
		point_t tmp = *b;
		*b = *a;
		*a = tmp;
	}else if(b->y == a->y && b->x < a->x){
		int tmp = b->x;
		b->x = a->x;
		a->x = tmp;
	}
}

// Assembly:
movl 0x4(%rdi), %eax
cmpl %eax, 0x4(%rsi)
jge 0xc175
movq (%rsi), %rax
movq (%rdi), %rcx
movq %rcx, (%rsi)
movq %rax, (%rdi)
retq
jne 0xc183
movl (%rsi), %eax
movl (%rdi), %ecx
cmpl %ecx, %eax
jge 0xc183
movl %ecx, (%rsi)
movl %eax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/region.c
// Function: region_contains
bool region_contains(const region_t *re, int x, int y)
{
	region_t sorted = *re;
	point_sort_full(&sorted.begin, &sorted.end);

	const struct
	{
		bool x, y;
	} in = {
		sorted.begin.x <= x && x <= sorted.end.x,
		sorted.begin.y <= y && y <= sorted.end.y
	};

	switch(re->type){
		case REGION_LINE:
			return in.y;

		case REGION_COL:
			return in.y && in.x;

		case REGION_CHAR:
			if(!in.y)
				return false;

			if(re->begin.y == re->end.y)
				return in.x;

			sorted = *re;
			point_sort_y(&sorted.begin, &sorted.end);

			if(y == sorted.begin.y)
				return x >= sorted.begin.x;
			if(y == sorted.end.y)
				return x <= sorted.end.x;

			return true;
	}

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r15
movl 0x10(%rdi), %eax
leaq 0x8(%rsp), %r14
movl %eax, 0x8(%r14)
movups (%rdi), %xmm0
movaps %xmm0, -0x8(%r14)
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xc13d
cmpl %ebx, (%r12)
setle %cl
cmpl %ebx, 0x8(%r12)
setge %al
andb %cl, %al
cmpl %ebp, 0x4(%r12)
setle %dl
cmpl %ebp, 0xc(%r12)
setge %cl
andb %dl, %cl
movl 0x10(%r15), %edx
testl %edx, %edx
je 0xc1f6
cmpl $0x2, %edx
je 0xc1f2
cmpl $0x1, %edx
jne 0xc233
andb %cl, %al
jmp 0xc235
movl %ecx, %eax
jmp 0xc235
testb %cl, %cl
je 0xc233
movl 0x4(%r15), %ecx
cmpl 0xc(%r15), %ecx
je 0xc235
movl 0x10(%r15), %eax
movq %rsp, %r12
movl %eax, 0x10(%r12)
movups (%r15), %xmm0
movaps %xmm0, (%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0xc128
cmpl %ebp, 0x4(%r12)
jne 0xc242
cmpl %ebx, (%rsp)
setle %al
jmp 0xc235
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
cmpl %ebp, 0xc(%rsp)
jne 0xc235
cmpl %ebx, 0x8(%rsp)
setge %al
jmp 0xc235
nop
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/range.c
// Function: parse_range_1
bool parse_range_1(
		char *range, char **end,
		int *out)
{
	bool handled = true;

	switch(*range){
		case '0' ... '9':
			/* go into 0-based */
			*out = strtol(range, &range, 10) - 1;
			break;

		case '.':
			*out = windows_cur()->ui_pos->y;
			range++;
			break;
		case '$':
			*out = buffer_nlines(buffers_cur());
			range++;
			break;
		/*case '\'': */

		default:
			/* don't touch range */
			handled = false;
			*out = windows_cur()->ui_pos->y;
			break;
	}

	for(;;){
		switch(*range){
			case '+':
			case '-':
			{
				const int dir = (*range == '+' ? 1 : -1);

				range++;
				int amt = isdigit(*range)
					? strtol(range, &range, 10)
					: 1;

				*out += dir * amt;

				handled = true;
				/* read more +/- */
				break;
			}
			default:
				*end = range;
				return handled;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %r12
movq %rdi, 0x8(%rsp)
movzbl (%rdi), %eax
leal -0x30(%rax), %ecx
cmpl $0xa, %ecx
movq %rsi, 0x10(%rsp)
jae 0xc329
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
movq %r12, %rdi
callq 0x4350
movq %rax, %r15
decl %r15d
movl %r15d, (%r14)
movb $0x1, %al
pushq $0x1
popq %rbx
movq 0x8(%rsp), %rbp
movzbl (%rbp), %r12d
cmpl $0x2d, %r12d
je 0xc2c9
cmpl $0x2b, %r12d
jne 0xc310
leaq 0x1(%rbp), %r13
movq %r13, 0x8(%rsp)
callq 0x4540
movq (%rax), %rax
movsbq 0x1(%rbp), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
movl %ebx, %eax
je 0xc2fb
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x4350
movl (%r14), %r15d
movl %eax, %ecx
negl %ecx
cmpb $0x2b, %r12b
cmovel %eax, %ecx
addl %ecx, %r15d
movl %r15d, (%r14)
movb $0x1, %al
jmp 0xc2b3
movq 0x10(%rsp), %rcx
movq %rbp, (%rcx)
andb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x24, %eax
je 0xc345
cmpl $0x2e, %eax
jne 0xc365
callq 0xd170
movq 0x30(%rax), %rax
movl 0x4(%rax), %r15d
movl %r15d, (%r14)
jmp 0xc358
callq 0xd170
movq (%rax), %rdi
callq 0x90a8
movl %eax, %r15d
movl %eax, (%r14)
incq %r12
movq %r12, 0x8(%rsp)
jmp 0xc2ae
callq 0xd170
movq 0x30(%rax), %rax
movl 0x4(%rax), %r15d
movl %r15d, (%r14)
xorl %eax, %eax
jmp 0xc2b0
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/range.c
// Function: parse_range
enum range_parse parse_range(
		char *cmd, char **end,
		struct range *r)
{
	if(*cmd == '%'){
		r->start = 0;
		r->end = buffer_nlines(buffers_cur());
		*end = cmd + 1;
		return RANGE_PARSE_PASS;
	}

	if(!parse_range_1(cmd, end, &r->start))
		return RANGE_PARSE_NONE; /* no range */

	cmd = *end;
	if(*cmd == ','){
		cmd++;
		if(!parse_range_1(cmd, end, &r->end))
			return RANGE_PARSE_FAIL;
	}else{
		r->end = r->start;
	}

	return RANGE_PARSE_PASS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpb $0x25, (%rdi)
jne 0xc3ad
andl $0x0, (%rbx)
callq 0xd170
movq (%rax), %rdi
callq 0x90a8
movl %eax, 0x4(%rbx)
incq %r15
movq %r15, (%r14)
pushq $0x2
popq %rax
jmp 0xc3e5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xc268
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0xc3e5
movq (%r14), %rdi
cmpb $0x2c, (%rdi)
jne 0xc3eb
addq $0x4, %rbx
incq %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xc268
testb %al, %al
jne 0xc3a8
pushq $0x1
jmp 0xc3aa
popq %rbx
popq %r14
popq %r15
retq
movl (%rbx), %eax
movl %eax, 0x4(%rbx)
jmp 0xc3a8
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/parse_cmd.c
// Function: parse_cmd
void parse_cmd(char *cmd, int *pargc, char ***pargv, bool shellglob)
{
	int argc = *pargc;
	char **argv = *pargv;

	char *anchor, *p;
	p = anchor = cmd;
	while(*p){
		if(*p == '\\'){
			p++;
			continue;
		}
		if(!isspace(*p)){
			p++;
			continue;
		}

		*p++ = '\0';

		add_argv(&argv, &argc, &anchor, p, shellglob);
	}

	if(anchor != p)
		add_argv(&argv, &argc, &anchor, p, shellglob);

	*pargv = argv;
	*pargc = argc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq %rsi, 0x20(%rsp)
movl (%rsi), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %rdx, 0x18(%rsp)
movq (%rdx), %rax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
leaq 0x8(%rsp), %r13
movq %rdi, (%r13)
movzbl %cl, %ebp
movq %r14, %rbx
movzbl (%r14), %eax
cmpl $0x5c, %eax
je 0xc483
testl %eax, %eax
je 0xc48b
movsbq %al, %r15
callq 0x4540
movq (%rax), %rax
leaq 0x1(%rbx), %r14
testb $0x20, 0x1(%rax,%r15,2)
je 0xc440
movb $0x0, (%rbx)
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
movq %r13, %rdx
movq %r14, %rcx
movl %ebp, %r8d
callq 0xc4d3
jmp 0xc440
incq %rbx
movq %rbx, %r14
jmp 0xc440
cmpq %rbx, 0x8(%rsp)
je 0xc4ac
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rcx
movl %ebp, %r8d
callq 0xc4d3
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movl 0x4(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/parse_cmd.c
// Function: add_argv
static void add_argv(
		char ***pargv, int *pargc,
		char **panchor, char *current,
		bool shellglob)
{
#define argv (*pargv)
#define argc (*pargc)
#define anchor (*panchor)
	char *failbuf;

	glob_t globbed = { 0 };
	int argc_inc;
	char **argv_add;

	int flags = GLOB_MARK | GLOB_BRACE | GLOB_TILDE;

	if(shellglob && 0 == glob(anchor, flags, /*errfunc*/NULL, &globbed)){
		argc_inc = globbed.gl_pathc;
		argv_add = globbed.gl_pathv;
	}else{
		argc_inc = 1;
		argv_add = &failbuf;
		failbuf = anchor;
	}

	argv = urealloc(argv, (argc + argc_inc + 1) * sizeof *argv);
	for(int i = 0; i < argc_inc; i++)
		argv[argc + i] = ustrdup(argv_add[i]);

	argc += argc_inc;

	globfree(&globbed);

	anchor = current;
#undef argv
#undef argc
#undef anchor
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x50(%rsp)
testl %r8d, %r8d
movq %rdx, (%rsp)
je 0xc531
movq (%rbx), %rdi
leaq 0x10(%rsp), %rcx
movl $0x1402, %esi           # imm = 0x1402
xorl %edx, %edx
callq 0x4490
testl %eax, %eax
je 0xc5b6
movq (%rbx), %rax
leaq 0x60(%rsp), %rbp
movq %rax, (%rbp)
pushq $0x1
popq %r13
movq (%r12), %rdi
movl (%r15), %eax
addl %r13d, %eax
incl %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x5660
movq %rax, (%r12)
xorl %ebx, %ebx
testl %r13d, %r13d
movl $0x0, %r14d
cmovgl %r13d, %r14d
cmpq %rbx, %r14
je 0xc58e
movq (%rbp,%rbx,8), %rdi
callq 0x5672
movq (%r12), %rcx
movslq (%r15), %rdx
addq %rbx, %rdx
movq %rax, (%rcx,%rdx,8)
incq %rbx
jmp 0xc56c
addl %r13d, (%r15)
leaq 0x10(%rsp), %rdi
callq 0x4050
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
movq %rax, (%rcx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x10(%rsp), %r13d
movq 0x18(%rsp), %rbp
jmp 0xc541
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/word.c
// Function: word_state
enum word_state word_state(
		const list_t *l, int x, bool big_words)
{
	if(l && 0 <= x && (unsigned)x < l->len_line){
		const char ch = l->line[x];

		if(isspace(ch))
			return W_SPACE;
		else if(big_words)
			return W_KEYWORD;
		else if(isalnum(ch) || ch == '_')
			return W_KEYWORD;
		return W_NON_KWORD;
	}

	return W_NONE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rdi, %rdi
sete %cl
testl %esi, %esi
sets %dl
xorl %eax, %eax
orb %cl, %dl
jne 0xc8e6
movl %esi, %ecx
cmpq %rcx, 0x8(%rdi)
jbe 0xc8e6
movq (%rdi), %rax
movsbq (%rax,%rcx), %r14
callq 0x4540
movq (%rax), %rax
movzwl (%rax,%r14,2), %ecx
movl %ecx, %edx
shrl $0xd, %edx
andl $0x1, %edx
orb %dl, %bl
pushq $0x2
popq %rax
je 0xc8d3
subl %edx, %eax
jmp 0xc8e6
xorl %edx, %edx
testb $0x8, %cl
sete %dl
cmpb $0x5f, %r14b
leal 0x2(%rdx,%rdx), %ecx
cmovnel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/word.c
// Function: word_seek
list_t *word_seek(
		list_t *l, int dir, point_t *to,
		enum word_state target, bool big_words)
{
	while((word_state(l, to->x, big_words) & target) == 0){
		const int y = to->y;

		l = list_advance_x(l, dir, &to->y, &to->x);

		if(!l)
			break;
		if(y != to->y)
			break; /* newlines are a fresh start */
	}
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
leaq 0x4(%rdx), %r12
movzbl %r8b, %r13d
movl (%r14), %esi
movq %r15, %rdi
movl %r13d, %edx
callq 0xc88c
testl %eax, 0x4(%rsp)
jne 0xc948
movl 0x4(%r14), %ebx
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0xa38f
testq %rax, %rax
je 0xc945
movq %rax, %r15
cmpl (%r12), %ebx
je 0xc90d
jmp 0xc948
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/word.c
// Function: word_seek_to_end
void word_seek_to_end(list_t *l, int dir, point_t *to, bool big_words)
{
	/* put us on the start/end of the word */
	const enum word_state st = word_state(l, to->x, big_words);

	if(st != W_NONE)
		while(word_state(l, to->x + dir, big_words) == st)
			to->x += dir;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r13d
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl (%rdx), %r15d
movl %r15d, %esi
movl %ecx, %edx
callq 0xc88c
testl %eax, %eax
je 0xc9a6
movl %eax, %r12d
addl %ebp, %r15d
movzbl %r13b, %r13d
movq %r14, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0xc88c
cmpl %r12d, %eax
jne 0xc9a6
movl %r15d, (%rbx)
addl %ebp, %r15d
jmp 0xc98b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/buffers.c
// Function: buffers_find
buffer_t *buffers_find(const char *fname)
{
	if(!windows_cur()) /* called on startup */
		return 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 *thisfname = buffer_fname(buf);

			if(thisfname && !strcmp(thisfname, fname))
				return buf;
		}
	}

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0xd170
testq %rax, %rax
je 0xca25
callq 0xd260
movq %rax, %r14
testq %r14, %r14
je 0xca25
movq (%r14), %rdi
callq 0xcb9a
movq %rax, %r15
testq %r15, %r15
je 0xca1f
movq %r15, %r13
testq %r13, %r13
je 0xca19
movq (%r13), %r12
movq %r12, %rdi
callq 0x8cc6
testq %rax, %rax
je 0xca13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42e0
testl %eax, %eax
je 0xca28
movq 0x58(%r13), %r13
jmp 0xc9ee
movq 0x50(%r15), %r15
jmp 0xc9e6
movq 0x8(%r14), %r14
jmp 0xc9d6
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/buffers.c
// Function: buffers_modified_excluding
window *buffers_modified_excluding(buffer_t *excluding, tab **const ptab)
{
	if(ptab)
		*ptab = NULL;

	for(tab *tab = tabs_first(); tab; tab = tab->next){
		window *win;
		ITER_WINDOWS_FROM(win, tab->win){
			buffer_t *buf = win->buf;
			if(buf != excluding && buf->modified){
				if(ptab)
					*ptab = tab;
				return win;
			}
		}
	}

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0xca63
andq $0x0, (%rbx)
callq 0xd260
movq %rax, %r15
testq %r15, %r15
je 0xcabb
movq (%r15), %rdi
callq 0xcb9a
testq %rax, %rax
je 0xcaa9
movq %rax, %rcx
testq %rcx, %rcx
je 0xcaa3
movq (%rcx), %rdx
cmpq %r14, %rdx
je 0xca9d
movb 0x39(%rdx), %dl
testq %rbx, %rbx
je 0xca99
testb %dl, %dl
jne 0xcaaf
testb %dl, %dl
jne 0xcab2
movq 0x58(%rcx), %rcx
jmp 0xca80
movq 0x50(%rax), %rax
jmp 0xca78
movq 0x8(%r15), %r15
jmp 0xca6b
movq %r15, (%rbx)
movq %rcx, %rax
popq %rbx
popq %r14
popq %r15
retq
xorl %ecx, %ecx
jmp 0xcab2
nop
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_calc_rects
void window_calc_rects(
		window *topleft,
		const unsigned screentop,
		const unsigned screenwidth,
		const unsigned screenheight)
{
	unsigned nwins_h = 0;
	window *win_h;
	for(win_h = topleft; win_h; win_h = win_h->neighbours.right, nwins_h++);

	const unsigned nvlines = nwins_h + 1;
	const unsigned winspace_v = screenwidth - nvlines;
	unsigned winwidth = winspace_v / nwins_h;

	unsigned i_h;
	for(i_h = 0, win_h = topleft; win_h; win_h = win_h->neighbours.right, i_h++){
		unsigned nwins_v = 0;
		window *win_v;
		for(win_v = win_h; win_v; win_v = win_v->neighbours.below)
			nwins_v++;

		/* final win gets any left over cols */
		if(!win_h->neighbours.right)
			winwidth += winspace_v % nwins_h;

		const unsigned nhlines = nwins_v - 1;
		const unsigned winspace_h = screenheight - nhlines;
		const unsigned winheight = winspace_h / nwins_v;

		unsigned i_v;
		for(i_v = 0, win_v = win_h; win_v; win_v = win_v->neighbours.below, i_v++){
			rect_t r = {
				.x = i_h * (winwidth + 1),
				.y = i_v * (winheight + 1) + screentop,
				.w = winwidth,
				.h = winheight,
			};

			/* final win gets any left over lines */
			if(!win_v->neighbours.below)
				r.h += winspace_h % nwins_v;

			win_v->screen_coord = r;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %r8d, %r8d
movq %rdi, %rax
testq %rax, %rax
je 0xcade
movq 0x50(%rax), %rax
incl %r8d
jmp 0xcad0
movl %r8d, %eax
notl %eax
addl %edx, %eax
xorl %edx, %edx
divl %r8d
movl %eax, %r8d
movl %edx, %r9d
xorl %r10d, %r10d
incl %ecx
testq %rdi, %rdi
je 0xcb6e
xorl %ebx, %ebx
movq %rdi, %rax
testq %rax, %rax
je 0xcb0c
incl %ebx
movq 0x58(%rax), %rax
jmp 0xcaff
movq 0x50(%rdi), %r11
leal (%r9,%r8), %eax
testq %r11, %r11
cmovel %eax, %r8d
movl %ecx, %eax
subl %ebx, %eax
xorl %edx, %edx
divl %ebx
xorl %ebx, %ebx
leal 0x1(%r8), %ebp
imull %r10d, %ebp
leal 0x1(%rax), %r14d
addl %eax, %edx
testq %rdi, %rdi
je 0xcb66
movl %ebx, %r15d
imull %r14d, %r15d
addl %esi, %r15d
movq 0x58(%rdi), %r12
testq %r12, %r12
movl %eax, %r13d
cmovel %edx, %r13d
movl %ebp, 0x10(%rdi)
movl %r15d, 0x14(%rdi)
movl %r8d, 0x18(%rdi)
movl %r13d, 0x1c(%rdi)
incl %ebx
movq %r12, %rdi
jmp 0xcb33
incl %r10d
movq %r11, %rdi
jmp 0xcaf5
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_next
window *window_next(window *cur)
{
#define RET_IF(x) if(x) return x
	RET_IF(cur->neighbours.below);
	RET_IF(cur->neighbours.above);
	RET_IF(cur->neighbours.right);
	RET_IF(cur->neighbours.left);
#undef RET_IF
	return NULL;
}

// Assembly:
movq 0x58(%rdi), %rax
testq %rax, %rax
je 0xcb83
retq
movq 0x60(%rdi), %rax
testq %rax, %rax
jne 0xcb82
movq 0x50(%rdi), %rax
testq %rax, %rax
jne 0xcb82
movq 0x48(%rdi), %rax
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_new
window *window_new(buffer_t *b)
{
	window *win = umalloc(sizeof *win);

	win->buf = retain(b);

	win->ui_pos = &win->ui_npos;
	win->ui_mode = UI_NORMAL;
	win->ui_paren = (point_t){ -1, -1 };

	return win;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x68
popq %rdi
callq 0x5648
movq %rax, %r14
movq %rbx, %rdi
callq 0xc254
movq %rax, (%r14)
leaq 0x20(%r14), %rax
movq %rax, 0x30(%r14)
movl $0x1, 0x40(%r14)
orq $-0x1, 0x38(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_toscreen
point_t window_toscreen(const window *win, point_t const *pt)
{
	list_t *l = list_seek(win->buf->head, win->ui_pos->y, 0);
	int xoff = 0;

	if(l && l->len_line > 0)
		for(int x = MIN((unsigned)win->ui_pos->x, l->len_line - 1);
				x >= 0;
				x--)
			xoff += nc_charlen(l->line[x]) - 1;

	return (point_t){
		win->screen_coord.x + pt->x - win->ui_start.x + xoff,
		win->screen_coord.y + pt->y - win->ui_start.y
	};
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x30(%rdi), %rcx
movq 0x8(%rax), %rdi
movl 0x4(%rcx), %esi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x9737
testq %rax, %rax
je 0xcf96
movq %rax, %r12
movq 0x8(%rax), %r13
testq %r13, %r13
je 0xcf96
movq 0x30(%rbx), %rax
movl (%rax), %eax
decq %r13
cmpq %rax, %r13
cmoval %eax, %r13d
xorl %r15d, %r15d
testl %r13d, %r13d
js 0xcf96
movq (%r12), %rax
movl %r13d, %ecx
movsbl (%rax,%rcx), %edi
callq 0x49f8
addl %eax, %r15d
decl %r15d
decl %r13d
jmp 0xcf76
addl 0x10(%rbx), %r15d
addl (%r14), %r15d
subl 0x8(%rbx), %r15d
movl 0x4(%r14), %eax
addl 0x14(%rbx), %eax
subl 0xc(%rbx), %eax
shlq $0x20, %rax
orq %rax, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_setmode
int window_setmode(window *win, enum buf_mode m)
{
	if(!m || (m & (m - 1))){
		return -1;
	}else{
		if(win->ui_mode & UI_INSERT_ANY)
			win->buf->prev_insert = *win->ui_pos;

		if(m & UI_VISUAL_ANY){
			if((win->ui_mode & UI_VISUAL_ANY) == 0){
				/* from non-visual to visual */
				*window_uipos_alt(win) = *win->ui_pos;
			}
		}else{
			/* from a visual, save state */
			win->buf->prev_visual.mode = win->ui_mode;

			win->buf->prev_visual.npos = *win->ui_pos;
			win->buf->prev_visual.vpos = *window_uipos_alt(win);
		}

		win->ui_mode = m;
		return 0;
	}
}

// Assembly:
leal -0x1(%rsi), %eax
movl %esi, %ecx
xorl %eax, %ecx
cmpl %eax, %ecx
jbe 0xd005
testb $0x6, 0x40(%rdi)
je 0xcfde
movq (%rdi), %rax
movq 0x30(%rdi), %rcx
movq (%rcx), %rcx
movq %rcx, 0x24(%rax)
movl 0x40(%rdi), %eax
testb $0x38, %sil
je 0xd009
testb $0x38, %al
jne 0xd033
movq 0x30(%rdi), %rax
leaq 0x28(%rdi), %rcx
xorl %edx, %edx
cmpq %rcx, %rax
setne %dl
movq (%rax), %rax
movq %rax, 0x20(%rdi,%rdx,8)
jmp 0xd033
pushq $-0x1
popq %rax
retq
movq (%rdi), %rcx
movl %eax, 0x20(%rcx)
movq 0x30(%rdi), %rax
movq (%rax), %rax
movq %rax, 0x10(%rcx)
leaq 0x28(%rdi), %rax
xorl %ecx, %ecx
cmpq %rax, 0x30(%rdi)
movq (%rdi), %rax
setne %cl
movq 0x20(%rdi,%rcx,8), %rcx
movq %rcx, 0x18(%rax)
movl %esi, 0x40(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_inschar
void window_inschar(window *win, char ch)
{
	if(win->ui_mode != UI_INSERT_COL || isnewline(ch)){
		/* can't col-insert a newline, revert */
		if(win->ui_mode == UI_INSERT_COL)
			window_setmode(win, UI_INSERT);

		buffer_inscolchar(win->buf, ch, 1, win->ui_pos);
	}else{
		buffer_inscolchar(win->buf, ch, win->buf->col_insert_height, win->ui_pos);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
cmpl $0x4, 0x40(%rdi)
movsbl %sil, %ebx
jne 0xd05f
cmpl $0xd, %ebx
je 0xd054
cmpl $0xa, %ebx
jne 0xd077
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0xcfbf
movq (%r14), %rdi
movq 0x30(%r14), %rcx
pushq $0x1
popq %rdx
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8e4c
movq (%r14), %rdi
movq 0x30(%r14), %rcx
movl 0x48(%rdi), %edx
jmp 0xd069
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_replace_fname
bool window_replace_fname(window *win, const char *fname, const char **const err)
{
	buffer_t *buf = NULL;
	buffer_new_fname(&buf, fname, err);

	if(!*err){
		window_replace_buffer(win, buf);
		buffer_release(buf);
	}

	return !*err;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq %rsp, %rdi
andq $0x0, (%rdi)
callq 0x8ba2
cmpq $0x0, (%rbx)
je 0xd0f9
xorl %eax, %eax
jmp 0xd11c
movq (%rsp), %rsi
movq %r14, %rdi
callq 0xd083
movq (%rsp), %rdi
leaq -0x46d8(%rip), %rsi     # 0x8a38
callq 0xc25f
cmpq $0x0, (%rbx)
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/window.c
// Function: window_reload_buffer
bool window_reload_buffer(window *win, const char **const err)
{
	const char *fname = buffer_fname(win->buf);
	if(!fname)
		return false;

	/* need to update the buffer's list, not the window,
	 * since there may be multiple windows with the old buffer */
	buffer_replace_fname(win->buf, fname, err);

	return !*err;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x8cc6
testq %rax, %rax
je 0xd152
movq (%r14), %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x8a9c
cmpq $0x0, (%rbx)
sete %al
jmp 0xd154
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/tab.c
// Function: tab_new
tab *tab_new(window *win)
{
	tab *t = umalloc(sizeof *t);
	t->win = win;
	t->next = NULL;
	return t;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x5648
movq %rbx, (%rax)
andq $0x0, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/tab.c
// Function: tab_free
void tab_free(tab *t)
{
	if(t->win){
		window_free(t->win);
		t->win = NULL;
	}

	if(t == tabs_first())
		tabs_set_first(t->next);

	free(t);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0xd1c7
callq 0xce94
andq $0x0, (%rbx)
callq 0xd260
cmpq %rbx, %rax
jne 0xd1da
movq 0x8(%rbx), %rdi
callq 0xd268
movq %rbx, %rdi
popq %rbx
jmp 0x4080
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/tab.c
// Function: tab_evict
void tab_evict(tab *t)
{
	tab *i;

	for(i = tabs_first(); i; i = i->next){
		if(i->next == t){
			i->next = t->next;
			break;
		}
	}

	t->next = NULL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xd260
testq %rax, %rax
je 0xd209
movq %rax, %rcx
movq 0x8(%rax), %rax
cmpq %rbx, %rax
jne 0xd1f0
movq 0x8(%rbx), %rax
movq %rax, 0x8(%rcx)
andq $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bobrippling[P]tim/tab.c
// Function: tab_contains_buffer
bool tab_contains_buffer(tab *t, buffer_t *b)
{
	window *win;
	ITER_WINDOWS_FROM(win, t->win)
		if(win->buf == b)
			return true;

	return false;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movq (%rdi), %rdi
callq 0xcb9a
testq %rax, %rax
je 0xd248
movq %rax, %rcx
testq %rcx, %rcx
je 0xd242
cmpq %rbx, (%rcx)
je 0xd248
movq 0x58(%rcx), %rcx
jmp 0xd232
movq 0x50(%rax), %rax
jmp 0xd22a
testq %rax, %rax
setne %al
popq %rbx
retq