// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/keys.c
// Function: around_motion
static bool around_motion(
		unsigned repeat, const int from_ch,
		bool always_linewise,
		struct around_motion *action,
		region_t *used_region)
{
	motion m_doubletap = {
		.func = m_move,
		.how = M_LINEWISE,
	};

	unsigned repeat_motion;
	const motion *m = motion_read_or_visual(
			&repeat_motion, /* operator pending - no maps: */ false);

	if(!m){
		/* check for dd, etc */
		bool raw;
		int ch = io_getch(IO_NOMAP, &raw, true);
		(void)raw;

		if(ch == from_ch){
			/* dd - stay where we are, +the repeat */
			m_doubletap.arg.pos.y = DEFAULT_REPEAT(repeat) - 1;
			repeat = 0;
			m = &m_doubletap;
		}else{
			if(ch != K_ESC)
				ui_err("no motion '%c'", ch);
			/*io_ungetch(ch);*/
		}
	}

	if(m){
		if(!repeat && !repeat_motion){
			/* leave repeat as zero
			 * e.g. dG will not set any repeats, telling 'G' / m_eof
			 * to go to the default, end of file.
			 */
		}else{
			repeat = DEFAULT_REPEAT(repeat) * DEFAULT_REPEAT(repeat_motion);
		}

		window *win = windows_cur();

		region_t r;
		if(!motion_to_region(m, repeat, win, &r))
			return false;

		if(used_region)
			*used_region = r;

		/* reset cursor to beginning, then allow adjustments */
		*win->ui_pos = r.begin;
		if(action)
			action->fn(win->buf, &r, win->ui_pos, action);

		ui_set_bufmode(UI_NORMAL);

		ui_redraw();
		ui_cur_changed();

		return true;
	}

	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %dl, %al
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq 0x13789(%rip), %rax     # 0x1ba70
movq %rax, -0x38(%rbp)
movq 0x13786(%rip), %rax     # 0x1ba78
movq %rax, -0x30(%rbp)
movq 0x13783(%rip), %rax     # 0x1ba80
movq %rax, -0x28(%rbp)
leaq -0x3c(%rbp), %rdi
xorl %esi, %esi
callq 0x81e0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x837f
movl $0x1, %edx
leaq -0x49(%rbp), %rsi
movl %edx, %edi
callq 0x11310
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x8364
cmpl $0x0, -0x8(%rbp)
je 0x8340
movl -0x8(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x834a
movl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x834a
movl -0x70(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x8(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x837d
cmpl $0x1b, -0x50(%rbp)
je 0x837b
movl -0x50(%rbp), %esi
leaq 0xcfe0(%rip), %rdi      # 0x15354
movb $0x0, %al
callq 0x4f30
jmp 0x837d
jmp 0x837f
cmpq $0x0, -0x48(%rbp)
je 0x8471
cmpl $0x0, -0x8(%rbp)
jne 0x8398
cmpl $0x0, -0x3c(%rbp)
jne 0x8398
jmp 0x83da
cmpl $0x0, -0x8(%rbp)
je 0x83a6
movl -0x8(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x83b0
movl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x83b0
movl -0x74(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x83c4
movl -0x3c(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0x83ce
movl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x83ce
movl -0x78(%rbp), %eax
movl -0x7c(%rbp), %ecx
imull %ecx, %eax
movl %eax, -0x8(%rbp)
callq 0x13c60
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movl -0x8(%rbp), %esi
movq -0x58(%rbp), %rdx
leaq -0x6c(%rbp), %rcx
callq 0x10390
testb $0x1, %al
jne 0x8401
movb $0x0, -0x1(%rbp)
jmp 0x8475
cmpq $0x0, -0x20(%rbp)
je 0x8421
movq -0x20(%rbp), %rax
movq -0x6c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x64(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0x5c(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x6c(%rbp), %rcx
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x8457
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movq (%rcx), %rdi
movq -0x58(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq -0x18(%rbp), %rcx
leaq -0x6c(%rbp), %rsi
callq *%rax
movl $0x1, %edi
callq 0x4eb0
callq 0x4fd0
callq 0x5050
movb $0x1, -0x1(%rbp)
jmp 0x8475
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)