// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_vim.c
// Function: ce_vim_motion_search_next
CeVimMotionResult_t ce_vim_motion_search_next(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){
     const CeVimYank_t* yank = vim->yanks + ce_vim_register_index('/');
     if(!yank->text) return CE_VIM_MOTION_RESULT_FAIL;
     CePoint_t result = {-1, -1};
     switch(vim->search_mode){
     default:
          return CE_VIM_MOTION_RESULT_FAIL;
     case CE_VIM_SEARCH_MODE_FORWARD:
     {
          CePoint_t start = ce_buffer_advance_point(view->buffer, motion_range->end, 1);
          result = ce_buffer_search_forward(view->buffer, start, yank->text);
     } break;
     case CE_VIM_SEARCH_MODE_BACKWARD:
     {
          CePoint_t start = ce_buffer_advance_point(view->buffer, motion_range->end, -1);
          result = ce_buffer_search_backward(view->buffer, start, yank->text);
     } break;
     case CE_VIM_SEARCH_MODE_REGEX_FORWARD:
     {
          CePoint_t start = ce_buffer_advance_point(view->buffer, motion_range->end, 1);
          CeRegex_t regex = NULL;
          CeRegexResult_t regex_result = ce_regex_init(yank->text,
                                                       &regex);
          if(regex_result.error_message != NULL){
               ce_log("ce_regex_init() failed: '%s'", regex_result.error_message);
               free(regex_result.error_message);
          }else{
               CeRegexSearchResult_t search_result = ce_buffer_regex_search_forward(view->buffer, start, regex);
               result = search_result.point;
          }
          ce_regex_free(regex);
     } break;
     case CE_VIM_SEARCH_MODE_REGEX_BACKWARD:
     {
          CePoint_t start = ce_buffer_advance_point(view->buffer, motion_range->end, -1);
          CeRegex_t regex = NULL;
          CeRegexResult_t regex_result = ce_regex_init(yank->text,
                                                       &regex);
          if(regex_result.error_message != NULL){
               ce_log("ce_regex_init() failed: '%s'", regex_result.error_message);
               free(regex_result.error_message);
          }else{
               CeRegexSearchResult_t search_result = ce_buffer_regex_search_backward(view->buffer, start, regex);
               result = search_result.point;
          }
          ce_regex_free(regex);
     } break;
     }
     if(result.x < 0) return CE_VIM_MOTION_RESULT_FAIL;
     motion_range->end = result;
     return CE_VIM_MOTION_RESULT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
xorl %ebx, %ebx
cmpq $0x0, 0x11c0(%rdi)
je 0x27ed5
movq %rdi, %r12
movl 0x19dc(%rdi), %eax
cmpq $0x3, %rax
ja 0x27ed5
movq %rdx, %r14
movq 0x88(%rsp), %r13
leaq 0x8553(%rip), %rcx      # 0x30280
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movl $0x1, %ecx
callq 0xee7a
movq 0x40(%r14), %rdi
movq 0x11c0(%r12), %rcx
movq %rax, %rsi
callq 0xe6aa
jmp 0x27e6e
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movl $0x1, %ecx
callq 0xee7a
movq %rax, %r15
movq %rdx, %rbp
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
movq 0x11c0(%r12), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x1f3a0
movq (%r12), %rsi
testq %rsi, %rsi
je 0x27e76
leaq 0x77b2(%rip), %rdi      # 0x2f568
xorl %eax, %eax
callq 0xd954
movq 0x18(%rsp), %rdi
callq 0xd090
movq $-0x1, %r15
jmp 0x27e39
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq $-0x1, %r15
movq $-0x1, %rcx
callq 0xee7a
movq %rax, 0x10(%rsp)
movq %rdx, %rbp
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
movq 0x11c0(%r12), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x1f3a0
movq (%r12), %rsi
testq %rsi, %rsi
je 0x27e94
leaq 0x7740(%rip), %rdi      # 0x2f568
xorl %eax, %eax
callq 0xd954
movq 0x18(%rsp), %rdi
callq 0xd090
movq $-0x1, %r14
jmp 0x27eb9
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq $-0x1, %rcx
callq 0xee7a
movq 0x40(%r14), %rdi
movq 0x11c0(%r12), %rcx
movq %rax, %rsi
callq 0xe7c2
movq %rax, %r15
movq %rdx, %r14
jmp 0x27ec3
movq 0x40(%r14), %rsi
movq 0x8(%rsp), %r8
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xe8e3
jmp 0x27eb2
movq 0x40(%r14), %rsi
movq 0x8(%rsp), %r8
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
callq 0xe9c4
movq (%r14), %r15
movq 0x8(%r14), %r14
movq 0x8(%rsp), %rdi
callq 0x1f4be
testq %r15, %r15
js 0x27ed5
movq %r15, 0x10(%r13)
movq %r14, 0x18(%r13)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq