// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/cmds.c
// Function: edit_common
bool edit_common(const char *fname, bool const force)
{
	window *win = windows_cur();

	const bool reload = !fname;
	if(reload)
		fname = buffer_fname(win->buf);

	if(!fname){ /* shouldn't be the case */
		ui_err("no filename");
		return false;
	}

	/* if it's a reload, we care about whether the buffer is modified, no matter
	 * how many times it's open. otherwise we are loading another file, which is
	 * fine as long as it's not the only instance of the modified-buffer
	 */
	if(!force && (reload ? win->buf->modified : buffers_modified_single(win->buf))){
		ui_err("buffer modified");
		return false;
	}

	bool ret = false;

	const char *err;
	bool loaded = reload
		? window_reload_buffer(win, &err)
		: window_replace_fname(win, fname, &err);

	if(loaded){
		ui_status("%s: loaded", fname);
		buffers_cur()->modified = false;
		ret = true;
	}else{
		ui_err("%s: %s", fname, err);
		if(!reload){
			/* wipe the buffer, e.g. :e /root/hi */
			buffer_t *empty = buffer_new();
			window_replace_buffer(win, empty);
			buffer_release(empty);
		}
	}

	buffer_set_fname(buffers_cur(), fname);

	ui_redraw();
	ui_cur_changed();

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
callq 0x13c60
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
je 0x8be2
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0xbb30
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x8c00
leaq 0xc7bd(%rip), %rdi      # 0x153ad
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8d1d
testb $0x1, -0x11(%rbp)
jne 0x8c44
testb $0x1, -0x21(%rbp)
je 0x8c1b
movq -0x20(%rbp), %rax
movq (%rax), %rax
testb $0x1, 0x39(%rax)
jne 0x8c2d
jmp 0x8c44
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x12ce0
testb $0x1, %al
jne 0x8c2d
jmp 0x8c44
leaq 0xc6c1(%rip), %rdi      # 0x152f5
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8d1d
movb $0x0, -0x22(%rbp)
testb $0x1, -0x21(%rbp)
je 0x8c65
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x13bc0
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
jmp 0x8c7e
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x13b50
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
je 0x8cb6
movq -0x10(%rbp), %rsi
leaq 0xc71c(%rip), %rdi      # 0x153b9
movb $0x0, %al
callq 0x51a0
callq 0x13c60
movq (%rax), %rax
movb $0x0, 0x39(%rax)
movb $0x1, -0x22(%rbp)
jmp 0x8cfa
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq 0xc94f(%rip), %rdi      # 0x15614
movb $0x0, %al
callq 0x4f30
testb $0x1, -0x21(%rbp)
jne 0x8cf8
callq 0xb750
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x13ac0
movq -0x40(%rbp), %rdi
leaq 0x2a1d(%rip), %rsi      # 0xb710
callq 0x12040
jmp 0x8cfa
callq 0x13c60
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xb8d0
callq 0x4fd0
callq 0x5050
movb -0x22(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)