// File: /workspace/github_c_makefile_star2_O2/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 0x2502c
movq %rdi, %r12
movl 0x19dc(%rdi), %eax
cmpq $0x3, %rax
ja 0x2502c
movq %rdx, %r14
movq 0x88(%rsp), %r13
leaq 0x8376(%rip), %rcx      # 0x2d218
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
pushq $0x1
popq %rcx
callq 0xec3a
movq 0x40(%r14), %rdi
movq 0x11c0(%r12), %rcx
movq %rax, %rsi
callq 0xe5e7
jmp 0x24fc7
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
pushq $0x1
popq %rcx
callq 0xec3a
movq %rax, %r15
movq %rdx, %rbp
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x11c0(%r12), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x1d614
movq (%r12), %rsi
testq %rsi, %rsi
je 0x24fcf
leaq 0x7644(%rip), %rdi      # 0x2c568
xorl %eax, %eax
callq 0xd8e5
movq 0x18(%rsp), %rdi
callq 0xd090
pushq $-0x1
popq %r15
jmp 0x24f9a
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
pushq $-0x1
popq %r15
movq %r15, %rcx
callq 0xec3a
movq %rax, 0x10(%rsp)
movq %rdx, %rbp
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x11c0(%r12), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x1d614
movq (%r12), %rsi
testq %rsi, %rsi
je 0x24fed
leaq 0x75df(%rip), %rdi      # 0x2c568
xorl %eax, %eax
callq 0xd8e5
movq 0x18(%rsp), %rdi
callq 0xd090
movq %r15, %r14
jmp 0x25012
movq 0x40(%r14), %rdi
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
pushq $-0x1
popq %rcx
callq 0xec3a
movq 0x40(%r14), %rdi
movq 0x11c0(%r12), %rcx
movq %rax, %rsi
callq 0xe6b3
movq %rax, %r15
movq %rdx, %r14
jmp 0x2501c
movq 0x40(%r14), %rsi
movq 0x8(%rsp), %r8
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xe797
jmp 0x2500b
movq 0x40(%r14), %rsi
movq 0x8(%rsp), %r8
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
callq 0xe84e
movq (%r14), %r15
movq 0x8(%r14), %r14
movq 0x8(%rsp), %rdi
callq 0x1d726
testq %r15, %r15
js 0x2502c
movq %r15, 0x10(%r13)
movq %r14, 0x18(%r13)
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq