// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/cmds.c
// Function: quit_common
static bool quit_common(
		bool qall,
		int argc, char **argv,
		bool force, struct range *range)
{
	RANGE_NO();
	ARGV_NO();

	if(!force){
		bool modified = false;

		if(qall){
			tab *modtab;
			window *modwin = buffers_modified_excluding(NULL, &modtab);

			if(modwin){
				modified = true;

				tabs_set_cur(modtab);
				tab_set_focus(modtab, modwin);
				ui_redraw();
				ui_cur_changed();
			}
		}else{
			modified = buffers_modified_single(buffers_cur());
		}

		if(modified){
			ui_err("buffer modified");
			return false;
		}
	}

	if(qall){
		ui_run = UI_EXIT_0;
	}else{
		window *win = windows_cur();
		window *focus = window_next(win);

		/* check remaining buffers */
		if(!force && !focus && args_next_fname(false)){
			ui_err("more files to edit");
			return false;
		}

		window_evict(win);
		window_free(win);
		windows_set_cur(focus);

		if(!focus){
			/* fallback to another tab? */
			tab *current = tabs_cur();
			tab *tabfocus = tab_next(current);

			if(tabfocus == current){
				/* no more tabs */
				ui_run = UI_EXIT_0;
				tabfocus = NULL;
			}

			tabs_set_cur(tabfocus);
			tab_evict(current);
			tab_free(current);
		}

		switch(ui_run){
			case UI_EXIT_0:
			case UI_EXIT_1:
				break;
			case UI_RUNNING:
				ui_redraw();
				ui_cur_changed();
				break;
		}
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %cl, %al
movb %dil, %cl
andb $0x1, %cl
movb %cl, -0x2(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq %r8, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8928
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0xca70(%rip), %rdi      # 0x15388
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8acc
cmpl $0x1, -0x8(%rbp)
je 0x894c
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0xca67(%rip), %rdi      # 0x153a3
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8acc
testb $0x1, -0x11(%rbp)
jne 0x89cb
movb $0x0, -0x21(%rbp)
testb $0x1, -0x2(%rbp)
je 0x899a
xorl %eax, %eax
movl %eax, %edi
leaq -0x30(%rbp), %rsi
callq 0x12d20
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x8998
movb $0x1, -0x21(%rbp)
movq -0x30(%rbp), %rdi
callq 0x13ed0
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x13d80
callq 0x4fd0
callq 0x5050
jmp 0x89ac
callq 0x13c60
movq (%rax), %rdi
callq 0x12ce0
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
je 0x89c9
leaq 0xc93c(%rip), %rdi      # 0x152f5
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8acc
jmp 0x89cb
testb $0x1, -0x2(%rbp)
je 0x89e3
leaq 0x139f4(%rip), %rax     # 0x1c3cc
movl $0x1, (%rax)
jmp 0x8ac8
callq 0x13c60
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x12f90
movq %rax, -0x48(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x8a2a
cmpq $0x0, -0x48(%rbp)
jne 0x8a2a
xorl %edi, %edi
callq 0x4650
cmpq $0x0, %rax
je 0x8a2a
leaq 0xcb96(%rip), %rdi      # 0x155b0
movb $0x0, %al
callq 0x4f30
movb $0x0, -0x1(%rbp)
jmp 0x8acc
movq -0x40(%rbp), %rdi
callq 0x130f0
movq -0x40(%rbp), %rdi
callq 0x13690
movq -0x48(%rbp), %rdi
callq 0x13ca0
cmpq $0x0, -0x48(%rbp)
jne 0x8a9c
callq 0x13ec0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x13e00
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x8a81
leaq 0x13959(%rip), %rax     # 0x1c3cc
movl $0x1, (%rax)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x13ed0
movq -0x50(%rbp), %rdi
callq 0x13da0
movq -0x50(%rbp), %rdi
callq 0x13d10
leaq 0x13929(%rip), %rax     # 0x1c3cc
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
testl %eax, %eax
je 0x8abc
jmp 0x8aae
movl -0x5c(%rbp), %eax
decl %eax
subl $0x1, %eax
ja 0x8ac6
jmp 0x8aba
jmp 0x8ac6
callq 0x4fd0
callq 0x5050
jmp 0x8ac8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)