// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq %rdi, %rbx
leaq 0x1(%rsi), %r14
movq %r14, %rsi
callq 0xe514
testq %rax, %rax
je 0x26625
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
movq %r14, %rsi
callq 0xe5be
movq $0x0, 0x8(%rsp)
cmpb $0x0, (%rax)
movq %rbx, 0x10(%rsp)
je 0x26640
movq %rax, %r15
leaq 0x8(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0xe649
movl %eax, %r13d
callq 0xd720
movq (%rax), %rax
movslq %r13d, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0xd, %eax
movl $0x1, %ebx
sbbl $-0x1, %ebx
xorl %edx, %edx
testb $0x8, %al
cmovnel %edx, %ebx
cmpl $0x5f, %ecx
cmovel %edx, %ebx
addq (%r12), %r15
leaq 0x8(%rsp), %r13
movq %rbp, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0xe649
movl %eax, %ebp
testl %ebx, %ebx
je 0x26566
cmpl $0x1, %ebx
jne 0x266b3
callq 0xd720
xorl %ebx, %ebx
movb $0x1, %cl
cmpl $0x5f, %ebp
je 0x26591
movq (%rax), %rax
movslq %ebp, %rdx
movzwl (%rax,%rdx,2), %eax
movl %eax, %edx
andl $0x8, %edx
jne 0x26591
btl $0xd, %eax
jae 0x266b0
movl $0x1, %ebx
xorl %ecx, %ecx
jmp 0x26591
callq 0xd720
movq (%rax), %rax
movslq %ebp, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0xd, %eax
jb 0x266b3
xorl %ebx, %ebx
movb $0x1, %cl
cmpl $0x5f, %ebp
je 0x26591
andl $0x8, %eax
je 0x266b3
movq 0x8(%rsp), %rax
incq %r14
cmpb $0x0, (%r15,%rax)
leaq (%r15,%rax), %r15
jne 0x2651a
testb %cl, %cl
jne 0x266b3
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
decq %rax
cmpq %rax, %r12
jge 0x266b3
movq (%rcx), %rax
movq 0x8(%rax,%r12,8), %r15
incq %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0xe649
movl %eax, %ebp
addq 0x8(%rsp), %r15
callq 0xd720
movq (%rax), %rax
movslq %ebp, %rcx
movzwl (%rax,%rcx,2), %eax
movl $0x1, %ebx
btl $0xd, %eax
movl $0x0, %r14d
jb 0x2651a
xorl %r14d, %r14d
movl $0x0, %ebx
cmpl $0x5f, %ebp
je 0x2651a
andl $0x8, %eax
jne 0x2651a
jmp 0x266b3
movq $-0x1, %r14
movq $-0x1, %r12
testq %r15, %r15
jne 0x266b3
xorl %r14d, %r14d
jmp 0x264aa
movq 0x8(%rbx), %rax
decq %rax
movq $-0x1, %r14
movq $-0x1, %r12
cmpq %rbp, %rax
jle 0x266b3
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax,%rbp,8), %r15
incq %rbp
leaq 0x8(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xe649
movl %eax, %r12d
addq (%r14), %r15
callq 0xd720
movq (%rax), %rax
movslq %r12d, %rcx
movzwl (%rax,%rcx,2), %eax
xorl %r14d, %r14d
btl $0xd, %eax
jb 0x266c8
cmpl $0x5f, %r12d
je 0x266d2
movl $0x0, %ebx
movq %rbp, %r12
andl $0x8, %eax
je 0x266b3
jmp 0x26512
incq %r14
movq %r14, %rax
movq %r12, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %ebx
jmp 0x26512
xorl %ebx, %ebx
jmp 0x26512