// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq $0x1050, %rax           # imm = 0x1050
movq %rax, -0x128(%rbp)
movl $0x2f, %edi
callq 0x33a80
movq %rax, %rcx
movq -0x128(%rbp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x388d2
movl $0x0, -0x4(%rbp)
jmp 0x38bab
movups 0x9f2f(%rip), %xmm0     # 0x42808
movaps %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movl 0x19dc(%rax), %eax
movq %rax, -0x130(%rbp)
subq $0x3, %rax
ja 0x3890b
movq -0x130(%rbp), %rax
leaq 0xcab6(%rip), %rcx      # 0x453b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4(%rbp)
jmp 0x38bab
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movl $0x1, %ecx
callq 0xfaf0
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0xef30
movq %rax, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b80
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movq $-0x1, %rcx
callq 0xfaf0
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0xf080
movq %rax, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b80
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movl $0x1, %ecx
callq 0xfaf0
movq %rax, -0xa0(%rbp)
movq %rdx, -0x98(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xc0(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x2a950
cmpq $0x0, -0xc0(%rbp)
je 0x38a64
movq -0xc0(%rbp), %rsi
leaq 0xba9f(%rip), %rdi      # 0x444ee
movb $0x0, %al
callq 0xd8f0
movq -0xc0(%rbp), %rdi
callq 0xd090
jmp 0x38aa3
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0xa8(%rbp), %r8
movq -0xa0(%rbp), %rdx
movq -0x98(%rbp), %rcx
leaq -0xd8(%rbp), %rdi
callq 0xf230
movq -0xd8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x2aaf0
jmp 0x38b80
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
movq $-0x1, %rcx
callq 0xfaf0
movq %rax, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movq $0x0, -0xf0(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x108(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x2a950
cmpq $0x0, -0x108(%rbp)
je 0x38b35
movq -0x108(%rbp), %rsi
leaq 0xb9ce(%rip), %rdi      # 0x444ee
movb $0x0, %al
callq 0xd8f0
movq -0x108(%rbp), %rdi
callq 0xd090
jmp 0x38b74
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0xf0(%rbp), %r8
movq -0xe8(%rbp), %rdx
movq -0xe0(%rbp), %rcx
leaq -0x120(%rbp), %rdi
callq 0xf340
movq -0x120(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0xf0(%rbp), %rdi
callq 0x2aaf0
cmpq $0x0, -0x50(%rbp)
jge 0x38b90
movl $0x0, -0x4(%rbp)
jmp 0x38bab
movq 0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x18(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)