// File: /workspace/github_c_makefile_star2_O1/justy989[P]ce/ce_vim.c
// Function: ce_vim_parse_action
CeVimParseResult_t ce_vim_parse_action(CeVimAction_t* action, const CeVim_t* vim){
     CeVimParseResult_t result = CE_VIM_PARSE_INVALID;
     CeVimAction_t build_action = {};

     // setup default multipliers
     build_action.multiplier = 1;
     build_action.motion.multiplier = 1;

     // parse multiplier if it exists
     const CeRune_t* end_of_multiplier = NULL;
     const CeRune_t* keys = vim->current_command;
     int64_t multiplier = istrtol(keys, &end_of_multiplier);
     if(end_of_multiplier && multiplier != 0){
          build_action.multiplier = multiplier;
          keys = end_of_multiplier;
          result = CE_VIM_PARSE_IN_PROGRESS;
     }

     // parse verb
VIM_PARSE_CONTINUE:
     for(int64_t i = 0; i < vim->key_bind_count; ++i){
          const CeVimKeyBind_t* key_bind = vim->key_binds + i;
          if(*keys == key_bind->key){
               result = key_bind->function(&build_action, vim, *keys);
               if(result != CE_VIM_PARSE_KEY_NOT_HANDLED){
                    keys++;

                    int64_t loops = 0;
                    while(result == CE_VIM_PARSE_CONSUME_ADDITIONAL_KEY){
                         if(*keys == 0) return result;
                         result = key_bind->function(&build_action, vim, *keys);
                         keys++;
                         if(result == CE_VIM_PARSE_CONTINUE) goto VIM_PARSE_CONTINUE;
                         loops++;
                         if(loops >= 10) return CE_VIM_PARSE_INVALID;
                    }

                    break;
               }
          }
     }

     // parse multiplier
     if(result != CE_VIM_PARSE_COMPLETE){
          if(vim_mode_is_visual(vim->mode) && multiplier == 0){
               build_action.motion.function = &ce_vim_motion_visual;
               result = CE_VIM_PARSE_COMPLETE;
          }else{
               multiplier = istrtol(keys, &end_of_multiplier);
               if(end_of_multiplier && multiplier != 0){
                    build_action.motion.multiplier = multiplier;
                    keys = end_of_multiplier;
               }

               // parse motion
               for(int64_t i = 0; i < vim->key_bind_count; ++i){
                    const CeVimKeyBind_t* key_bind = vim->key_binds + i;
                    if(*keys == key_bind->key){
                         result = key_bind->function(&build_action, vim, *keys);
                         if(result != CE_VIM_PARSE_KEY_NOT_HANDLED){
                              keys++;

                              int64_t loops = 0;
                              while(result == CE_VIM_PARSE_CONSUME_ADDITIONAL_KEY){
                                   if(*keys == 0) return result;
                                   result = key_bind->function(&build_action, vim, *keys);
                                   keys++;
                                   if(result == CE_VIM_PARSE_CONTINUE) goto VIM_PARSE_CONTINUE;
                                   loops++;
                                   if(loops >= 10) return CE_VIM_PARSE_INVALID;
                              }

                              break;
                         }
                    }
               }
          }
     }else if(vim_mode_is_visual(vim->mode) && !build_action.motion.function){
          build_action.motion.function = &ce_vim_motion_visual;
     }

     if(result == CE_VIM_PARSE_COMPLETE) *action = build_action;
     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
xorl %r13d, %r13d
movq %r13, 0x70(%rsp)
movl $0x1, %eax
movq %rax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
leaq 0x20(%rsp), %rbx
movq %r13, (%rbx)
movq %rsi, 0x8(%rsp)
leaq 0x1010(%rsi), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1235c
movq %rax, %rsi
movq (%rbx), %rax
testq %rax, %rax
setne %cl
testq %rsi, %rsi
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x25421
movq %rsi, 0x30(%rsp)
movl $0x4, %r13d
movq %rax, %r15
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movl $0x3, %ebp
movq 0x8(%rsp), %rax
cmpq $0x0, 0x1008(%rax)
jle 0x25523
xorl %r14d, %r14d
movq %r14, %r12
shlq $0x4, %r12
movl (%r15), %edx
xorl %ebp, %ebp
movb $0x1, %bl
movq 0x18(%rsp), %rax
cmpl (%rax,%r12), %edx
jne 0x254f9
addq %rax, %r12
leaq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq *0x8(%r12)
movl $0x1, %r13d
cmpl $0x1, %eax
je 0x254f9
addq $0x4, %r15
movl $0xa, %ebx
movl %eax, %r13d
cmpl $0x2, %r13d
jne 0x254d3
movl (%r15), %edx
movl $0x1, %ebp
testl %edx, %edx
je 0x254da
leaq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq *0x8(%r12)
addq $0x4, %r15
cmpl $0x3, %eax
je 0x254ec
movl %eax, %r13d
decq %rbx
jne 0x25495
xorl %ebx, %ebx
movl $0x0, 0x4(%rsp)
jmp 0x254f9
movl $0x3, %ebp
jmp 0x254f7
movl $0x2, %r13d
xorl %ebx, %ebx
movl $0x2, 0x4(%rsp)
jmp 0x254f9
movl $0x3, %r13d
movl $0x2, %ebp
xorl %ebx, %ebx
testb %bl, %bl
je 0x2551e
incq %r14
movq 0x8(%rsp), %rax
cmpq 0x1008(%rax), %r14
jl 0x2544f
movq 0x10(%rsp), %rsi
movl $0x3, %ebp
jmp 0x25523
movq 0x10(%rsp), %rsi
cmpl $0x2, %ebp
je 0x25434
cmpl $0x3, %ebp
jne 0x25690
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
sete %cl
cmpl $0x4, %eax
sete %al
orb %cl, %al
cmpl $0x5, %r13d
je 0x256a9
testq %rsi, %rsi
sete %cl
andb %cl, %al
cmpb $0x1, %al
je 0x256be
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1235c
movq %rax, %rsi
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x25590
testq %rsi, %rsi
je 0x25590
movq %rsi, 0x38(%rsp)
movq %rax, %r15
movl $0x8, %ebp
movq 0x8(%rsp), %rax
cmpq $0x0, 0x1008(%rax)
jle 0x25682
movq %rsi, 0x10(%rsp)
xorl %r12d, %r12d
movq %r12, %r14
shlq $0x4, %r14
movl (%r15), %edx
xorl %ebp, %ebp
movb $0x1, %bl
movq 0x18(%rsp), %rax
cmpl (%rax,%r14), %edx
jne 0x25658
addq %rax, %r14
leaq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq *0x8(%r14)
movl $0x1, %r13d
cmpl $0x1, %eax
je 0x25658
addq $0x4, %r15
movl $0xa, %ebx
movl %eax, %r13d
cmpl $0x2, %r13d
jne 0x25632
movl (%r15), %edx
movl $0x1, %ebp
testl %edx, %edx
je 0x25639
leaq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq *0x8(%r14)
addq $0x4, %r15
cmpl $0x3, %eax
je 0x2564b
movl %eax, %r13d
decq %rbx
jne 0x255f5
xorl %ebx, %ebx
movl $0x0, 0x4(%rsp)
jmp 0x25658
movl $0x8, %ebp
jmp 0x25656
movl $0x2, %r13d
xorl %ebx, %ebx
movl $0x2, 0x4(%rsp)
jmp 0x25658
movl $0x3, %r13d
movl $0x2, %ebp
xorl %ebx, %ebx
testb %bl, %bl
je 0x2567d
incq %r12
movq 0x8(%rsp), %rax
cmpq 0x1008(%rax), %r12
jl 0x255b0
movq 0x10(%rsp), %rsi
movl $0x8, %ebp
jmp 0x25682
movq 0x10(%rsp), %rsi
cmpl $0x2, %ebp
je 0x2542f
cmpl $0x8, %ebp
je 0x256d0
movl 0x4(%rsp), %eax
movl %eax, %r13d
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x40(%rsp)
sete %cl
andb %cl, %al
movl $0x5, %r13d
cmpb $0x1, %al
jne 0x256d0
leaq 0x430(%rip), %rax       # 0x25af5
movq %rax, 0x40(%rsp)
movl $0x5, %r13d
cmpl $0x5, %r13d
jne 0x25697
leaq 0x30(%rsp), %rsi
movl $0x9, %ecx
movq 0x28(%rsp), %rdi
rep  movsq (%rsi), %es:(%rdi)
jmp 0x25697