// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_vim.c
// Function: ce_vim_move_end_little_word
CePoint_t ce_vim_move_end_little_word(CeBuffer_t* buffer, CePoint_t start){
     start.x++;
     if(!ce_buffer_point_is_valid(buffer, start)){
          if(start.x == 1){
               // line is empty
               start.x = 0;
          }else{
               return (CePoint_t){-1, -1};
          }
     }

     char* itr = ce_utf8_iterate_to(buffer->lines[start.y], start.x);
     int64_t rune_len = 0;
     CeRune_t rune = 0;
     WordState_t state = WORD_INSIDE_OTHER;

     if(*itr == 0){
          if(start.y >= buffer->line_count - 1) return (CePoint_t){-1, -1};
          start.x = 0;
          start.y++;
          itr = buffer->lines[start.y];

          rune = ce_utf8_decode(itr, &rune_len);
          itr += rune_len;
          if(isspace(rune)) state = WORD_INSIDE_SPACE;
          else if(is_little_word_character(rune)) state = WORD_INSIDE_WORD;
          else return start;
     }else{
          rune = ce_utf8_decode(itr, &rune_len);

          if(is_little_word_character(rune)){
               state = WORD_INSIDE_WORD;
          }else if(isspace(rune)){
               state = WORD_INSIDE_SPACE;
          }

          itr += rune_len;
     }

     while(true){
          rune = ce_utf8_decode(itr, &rune_len);

          switch(state){
          default:
               assert(0);
               break;
          case WORD_INSIDE_WORD:
               if(isspace(rune)) goto END_LOOP;
               else if(!is_little_word_character(rune)) goto END_LOOP;
               break;
          case WORD_INSIDE_SPACE:
               if(is_little_word_character(rune)) state = WORD_INSIDE_WORD;
               else if(!isspace(rune)){
                    start.x++;
                    goto END_LOOP;
               }
               break;
          case WORD_INSIDE_OTHER:
               goto END_LOOP;
          }

          itr += rune_len;
          start.x++;

          if(*itr == 0){
               if(state == WORD_INSIDE_WORD) break;
               if(start.y >= buffer->line_count - 1) break;
               start.x = 0;
               start.y++;
               itr = buffer->lines[start.y];

               rune = ce_utf8_decode(itr, &rune_len);
               itr += rune_len;
               if(isspace(rune)) state = WORD_INSIDE_SPACE;
               else if(is_little_word_character(rune)) state = WORD_INSIDE_WORD;
               else break;
          }
     }

END_LOOP:

     return start;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x1(%rsi), %r14
movq %r14, %rsi
callq 0xe4d4
testq %rax, %rax
je 0x264ec
movq (%r12), %rax
movq (%rax,%rbp,8), %rdi
movq %r14, %rsi
callq 0xe577
movq $0x0, (%rsp)
cmpb $0x0, (%rax)
movq %r12, 0x10(%rsp)
je 0x2650b
movq %rax, %r15
movq %rsp, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0xe602
movl %eax, %r12d
callq 0xd720
movq (%rax), %rax
movslq %r12d, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0xd, %eax
movl $0x1, %r12d
sbbl $-0x1, %r12d
xorl %edx, %edx
testb $0x8, %al
cmovnel %edx, %r12d
cmpl $0x5f, %ecx
cmovel %edx, %r12d
addq (%rbx), %r15
movq %rsp, %r13
movq %rbp, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xe602
movl %eax, %ebx
testl %r12d, %r12d
je 0x264a7
cmpl $0x1, %r12d
jne 0x2658b
callq 0xd720
cmpl $0x5f, %ebx
je 0x264ce
movq %rax, %rbp
movq (%rax), %rax
movslq %ebx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, %ecx
andl $0x8, %ecx
jne 0x264ce
btl $0xd, %eax
jae 0x26588
movq (%rsp), %rax
incq %r14
cmpb $0x0, (%r15,%rax)
leaq (%r15,%rax), %r15
movl $0x1, %r12d
jne 0x263c5
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
decq %rax
movq 0x8(%rsp), %rdx
cmpq %rax, %rdx
jge 0x2658b
movq (%rcx), %rax
movq 0x8(%rax,%rdx,8), %r15
incq %rdx
movq %rdx, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xe602
movq (%rbp), %rcx
movslq %eax, %rdx
movzwl (%rcx,%rdx,2), %ecx
movl $0x1, %r12d
movl $0x0, %r14d
addq (%rsp), %r15
btl $0xd, %ecx
jb 0x263c5
xorl %r14d, %r14d
movl $0x0, %r12d
cmpl $0x5f, %eax
je 0x263c5
andl $0x8, %ecx
jne 0x263c5
jmp 0x2658b
callq 0xd720
movq (%rax), %rax
movslq %ebx, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0xd, %eax
jb 0x2658b
cmpl $0x5f, %ebx
je 0x264ce
andl $0x8, %eax
je 0x2658b
movq (%rsp), %rax
incq %r14
xorl %r12d, %r12d
cmpb $0x0, (%r15,%rax)
leaq (%r15,%rax), %r15
jne 0x263c5
jmp 0x2658b
movq $-0x1, %r14
movq $-0x1, %rdx
testq %rbx, %rbx
jne 0x26590
xorl %r14d, %r14d
jmp 0x26354
movq 0x8(%r12), %rax
decq %rax
movq $-0x1, %r14
movq $-0x1, 0x8(%rsp)
cmpq %rbp, %rax
jle 0x2658b
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax,%rbp,8), %r15
incq %rbp
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xe602
movl %eax, %ebx
addq (%r14), %r15
callq 0xd720
movq (%rax), %rax
movslq %ebx, %rcx
movzwl (%rax,%rcx,2), %eax
xorl %r14d, %r14d
btl $0xd, %eax
jb 0x2657d
cmpl $0x5f, %ebx
je 0x265a2
movl $0x0, %r12d
movq %rbp, 0x8(%rsp)
andl $0x8, %eax
je 0x2658b
jmp 0x263bd
movl $0x1, %r12d
jmp 0x263bd
incq %r14
movq 0x8(%rsp), %rdx
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x263bd