// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movq %rsi, %r12
movq %rdi, %r14
leaq 0x1(%rsi), %r15
movq %r15, %rsi
callq 0xe425
testq %rax, %rax
je 0x23867
movq (%r14), %rax
movq (%rax,%rbx,8), %rdi
movq %r15, %rsi
callq 0xe4a6
andq $0x0, (%rsp)
cmpb $0x0, (%rax)
movq %r14, 0x10(%rsp)
je 0x23875
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movq %rsp, %rsi
movq %rax, %rdi
callq 0xe53f
movl %eax, %ebp
movl %eax, %edi
callq 0x23570
xorl %r14d, %r14d
testb %al, %al
jne 0x23761
callq 0xd720
movq (%rax), %rax
movslq %ebp, %rcx
movb 0x1(%rax,%rcx,2), %al
andb $0x20, %al
xorl %r14d, %r14d
cmpb $0x1, %al
adcl $0x1, %r14d
addq (%rsp), %r12
movq %rsp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xe53f
movl %eax, %ebp
movslq %eax, %rbx
testl %r14d, %r14d
je 0x237af
cmpl $0x1, %r14d
jne 0x238e6
movl %ebp, %edi
callq 0x23570
testb %al, %al
jne 0x237d1
callq 0xd720
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x238e3
xorl %eax, %eax
pushq $0x1
popq %rcx
movl %ecx, %r14d
jmp 0x237d6
callq 0xd720
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
jne 0x238e6
movl %ebp, %edi
callq 0x23570
testb %al, %al
je 0x238e6
xorl %r14d, %r14d
movb $0x1, %al
movq (%rsp), %rcx
incq %r15
cmpb $0x0, (%r12,%rcx)
leaq (%r12,%rcx), %r12
jne 0x23768
testb %al, %al
jne 0x238e6
movq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rax
decq %rax
movq 0x8(%rsp), %rcx
cmpq %rax, %rcx
jge 0x238e6
movq (%rdx), %rax
movq 0x8(%rax,%rcx,8), %r12
incq %rcx
movq %rcx, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xe53f
movl %eax, %ebp
addq (%rsp), %r12
callq 0xd720
movq (%rax), %rax
movslq %ebp, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
movl $0x0, %r15d
pushq $0x1
popq %rax
movl %eax, %r14d
jne 0x23768
movl %ebp, %edi
callq 0x23570
xorl %r15d, %r15d
movl $0x0, %r14d
testb %al, %al
jne 0x23768
jmp 0x238e6
testq %r12, %r12
je 0x238db
pushq $-0x1
popq %r15
movq %r15, %rdx
jmp 0x238eb
movq 0x8(%r14), %rax
decq %rax
cmpq %rbx, %rax
jle 0x238d0
movq (%r14), %rax
movq 0x8(%rax,%rbx,8), %r12
incq %rbx
movq %rbx, 0x8(%rsp)
movq %rsp, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0xe53f
movl %eax, %ebp
addq (%r15), %r12
callq 0xd720
movq (%rax), %rax
movslq %ebp, %rcx
xorl %r14d, %r14d
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x238fd
movl %ebp, %edi
callq 0x23570
movl $0x0, %r15d
testb %al, %al
jne 0x23765
jmp 0x238e6
pushq $-0x1
popq %r15
movq %r15, 0x8(%rsp)
jmp 0x238e6
xorl %r15d, %r15d
jmp 0x23702
incq %r15
movq 0x8(%rsp), %rdx
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %r14
xorl %r15d, %r15d
jmp 0x23765