// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/cmds.c
// Function: c_r
bool c_r(char *argv0, char *rest, bool via_shell, struct range *range)
{
	window *const win = windows_cur();
	buffer_t *const b = win->buf;

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

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

	list_t *lines = NULL;

	if(via_shell){
		lines = list_new(NULL);
		int err = list_filter(
				&lines,
				&(region_t){ .type = REGION_LINE, },
				rest);

		const int eno = errno;

		ui_redraw();

		if(err){
			ui_err("read process: %s", strerror(eno));
			return false;
		}

	}else{
		int argc = 0;
		char **argv = NULL;
		parse_cmd(rest, &argc, &argv, /*shell glob*/true);

		if(argc != 1){
			ui_err("%s: too many filenames", argv0);
			free_argv(argv, argc);
			return false;
		}

		FILE *stream = fopen(argv[0], "r");

		if(!stream){
			ui_err("%s: %s", rest, strerror(errno));
			return false;
		}

		free_argv(argv, argc);

		lines = list_new_file(stream, /*eol:*/&(bool){ false });
		fclose(stream);
	}

	b->head = list_append(b->head, window_current_line(win, true), lines);

	if(lines)
		win->ui_pos->y++;

	b->modified = true;

	ui_redraw();
	ui_cur_changed();

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq %rcx, -0x28(%rbp)
callq 0x13c60
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x9cc2
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movl %eax, -0x40(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x122d0
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movl $0x0, -0x48(%rbp)
movq -0x28(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, -0x44(%rbp)
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq $0x0, -0x50(%rbp)
testb $0x1, -0x19(%rbp)
je 0x9d6c
xorl %eax, %eax
movl %eax, %edi
callq 0xc6e0
movq %rax, -0x50(%rbp)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x4240
movl $0x2, -0x58(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xde50
movl %eax, -0x54(%rbp)
callq 0x40a0
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
callq 0x4fd0
cmpl $0x0, -0x54(%rbp)
je 0x9d67
movl -0x6c(%rbp), %edi
callq 0x44d0
movq %rax, %rsi
leaq 0xb713(%rip), %rdi      # 0x1546a
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x9ead
jmp 0x9e44
movl $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movl $0x1, %ecx
callq 0x12310
cmpl $0x1, -0x70(%rbp)
je 0x9dbe
movq -0x10(%rbp), %rsi
leaq 0xb6d9(%rip), %rdi      # 0x1547b
movb $0x0, %al
callq 0x4f30
movq -0x78(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x129d0
movb $0x0, -0x1(%rbp)
jmp 0x9ead
movq -0x78(%rbp), %rax
movq (%rax), %rdi
leaq 0xb70d(%rip), %rsi      # 0x154d9
callq 0x4440
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x9e14
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
callq 0x40a0
movl (%rax), %edi
callq 0x44d0
movq -0x90(%rbp), %rsi
movq %rax, %rdx
leaq 0xb810(%rip), %rdi      # 0x15614
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x9ead
movq -0x78(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x129d0
movq -0x80(%rbp), %rdi
movb $0x0, -0x81(%rbp)
leaq -0x81(%rbp), %rsi
callq 0xc7b0
movq %rax, -0x50(%rbp)
movq -0x80(%rbp), %rdi
callq 0x4150
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x13790
movq -0x98(%rbp), %rdi
movq %rax, %rsi
movq -0x50(%rbp), %rdx
callq 0xd320
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x50(%rbp)
je 0x9e97
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movb $0x1, 0x39(%rax)
callq 0x4fd0
callq 0x5050
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)