// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_vim.c
// Function: ce_vim_motion_visual
CeVimMotionResult_t ce_vim_motion_visual(CeVim_t* vim, CeVimAction_t* action, const CeView_t* view, const CePoint_t* cursor,
                                         CeVimVisualData_t* visual, const CeConfigOptions_t* config_options,
                                         CeVimBufferData_t* buffer_data, CeRange_t* motion_range){
     if(vim->mode == CE_VIM_MODE_VISUAL || vim->mode == CE_VIM_MODE_VISUAL_LINE){
          motion_range->start = *cursor;
          motion_range->end = visual->point;
          ce_range_sort(motion_range);
          action->motion.integer = ce_buffer_range_len(view->buffer, motion_range->start, motion_range->end) - 1;

          if(vim->mode == CE_VIM_MODE_VISUAL_LINE){
               motion_range->start.x = 0;
               motion_range->end.x = ce_utf8_strlen(view->buffer->lines[motion_range->end.y]);
               action->yank_type = CE_VIM_YANK_TYPE_LINE;
               action->motion.integer = motion_range->end.y - motion_range->start.y;
          }
     }else if(vim->verb_last_action){
          switch(action->yank_type){
          default:
               break;
          case CE_VIM_YANK_TYPE_LINE:
               motion_range->start = (CePoint_t){0, cursor->y};
               motion_range->end.y = cursor->y + action->motion.integer;
               if(motion_range->end.y >= view->buffer->line_count){
                    motion_range->end.y = (view->buffer->line_count - 1);
               }
               if(motion_range->end.y < 0){
                    motion_range->end.y = 0;
               }
               motion_range->end.x = ce_utf8_strlen(view->buffer->lines[motion_range->end.y]);
               break;
          case CE_VIM_YANK_TYPE_STRING:
               motion_range->start = *cursor;
               motion_range->end = ce_buffer_advance_point(view->buffer, *cursor, action->motion.integer);
               break;
          }
     }

     return CE_VIM_MOTION_RESULT_SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq 0x38(%rsp), %rbx
movl (%rdi), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x25a59
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movups (%r8), %xmm0
movups %xmm0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x10614
movq 0x40(%r15), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %r8
callq 0xeb33
decl %eax
movl %eax, 0x18(%r14)
cmpl $0x3, (%r12)
jne 0x25af1
movq $0x0, (%rbx)
movq 0x40(%r15), %rax
movq (%rax), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xe445
movq %rax, 0x10(%rbx)
movl $0x2, 0x38(%r14)
movl 0x18(%rbx), %eax
subl 0x8(%rbx), %eax
movl %eax, 0x18(%r14)
jmp 0x25af1
cmpb $0x1, 0x19d9(%r12)
jne 0x25af1
movl 0x38(%r14), %eax
cmpl $0x1, %eax
je 0x25acc
cmpl $0x2, %eax
jne 0x25af1
movq 0x8(%rcx), %rax
xorl %edx, %edx
movq %rdx, (%rbx)
movq %rax, 0x8(%rbx)
movslq 0x18(%r14), %rsi
addq 0x8(%rcx), %rsi
movq %rsi, 0x18(%rbx)
movq 0x40(%r15), %rax
movq 0x8(%rax), %rdi
leaq -0x1(%rdi), %rcx
cmpq %rdi, %rsi
setl %dil
cmovlq %rsi, %rcx
testq %rcx, %rcx
setns %sil
cmovleq %rdx, %rcx
testb %sil, %dil
jne 0x25aba
movq %rcx, 0x18(%rbx)
movq (%rax), %rax
movq (%rax,%rcx,8), %rdi
callq 0xe445
movq %rax, 0x10(%rbx)
jmp 0x25af1
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x40(%r15), %rdi
movslq 0x18(%r14), %rax
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
movq %rax, %rcx
callq 0xee7a
movq %rax, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq