// File: /workspace/github_c_makefile_star2_O1/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 0x25b8a
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movups (%r8), %xmm0
movups %xmm0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1079c
movq 0x40(%r15), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %r8
callq 0xecb5
decl %eax
movl %eax, 0x18(%r14)
cmpl $0x3, (%r12)
jne 0x25c20
movq $0x0, (%rbx)
movq 0x40(%r15), %rax
movq (%rax), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xe485
movq %rax, 0x10(%rbx)
movl $0x2, 0x38(%r14)
movl 0x18(%rbx), %eax
subl 0x8(%rbx), %eax
movl %eax, 0x18(%r14)
jmp 0x25c20
cmpb $0x1, 0x19d9(%r12)
jne 0x25c20
movl 0x38(%r14), %eax
cmpl $0x1, %eax
je 0x25bfb
cmpl $0x2, %eax
jne 0x25c20
movq 0x8(%rcx), %rax
movq $0x0, (%rbx)
movq %rax, 0x8(%rbx)
movslq 0x18(%r14), %rdx
addq 0x8(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq 0x40(%r15), %rax
movq 0x8(%rax), %rcx
cmpq %rcx, %rdx
jl 0x25bd6
decq %rcx
movq %rcx, 0x18(%rbx)
cmpq $0x0, 0x18(%rbx)
jns 0x25be5
movq $0x0, 0x18(%rbx)
movq (%rax), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xe485
movq %rax, 0x10(%rbx)
jmp 0x25c20
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 0xeffa
movq %rax, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq