// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
movups %xmm0, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
xorl %r12d, %r12d
movq %r12, 0x60(%rsp)
movl $0x1, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x10(%rsp), %r13
movq %r12, (%r13)
leaq 0x1010(%rsi), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x12156
movq (%r13), %rsi
movq %rax, %r13
testq %rsi, %rsi
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x253a5
movq %r13, 0x20(%rsp)
movl $0x4, %r12d
movq %rsi, %rbp
leaq 0x10(%r14), %r15
movq %r15, (%rsp)
movq 0x1008(%r14), %rax
testq %rax, %rax
jle 0x25493
movq %rbp, %rbx
movq %r15, %rbp
xorl %r15d, %r15d
movl (%rbx), %edx
cmpl -0x8(%rbp), %edx
jne 0x253ea
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%rbp)
cmpl $0x1, %eax
jne 0x253fb
movq 0x1008(%r14), %rax
movl $0x1, %r12d
incq %r15
addq $0x10, %rbp
cmpq %rax, %r15
jl 0x253c6
jmp 0x25482
movl %eax, %r12d
movq %r13, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpl $0x2, %r12d
jne 0x25476
movl 0x4(%rbx,%r13,4), %edx
testl %edx, %edx
je 0x25589
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%rbp)
cmpl $0x3, %eax
je 0x25441
movl %eax, %r12d
incq %r13
addq $-0x4, %r15
cmpq $0xa, %r13
jne 0x25409
jmp 0x25591
movq 0x1008(%r14), %rax
subq %r15, %rbx
leaq 0x8(%rbx), %rbp
movl $0x3, %r12d
testq %rax, %rax
movq 0x8(%rsp), %r13
movq (%rsp), %r15
jg 0x253bd
addq $0x8, %rbx
movl $0x3, %r12d
movq %rbx, %rbp
jmp 0x25493
subq %r15, %rbx
addq $0x4, %rbx
movq 0x8(%rsp), %r13
movq %rbx, %rbp
cmpl $0x5, %r12d
movq (%rsp), %r15
je 0x255a6
movl (%r14), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
setne %cl
cmpl $0x4, %eax
setne %al
testb %cl, %al
jne 0x254b4
testq %r13, %r13
je 0x255c6
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x12156
movq %rax, %r13
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x254db
testq %r13, %r13
je 0x254db
movq %r13, 0x28(%rsp)
movq %rax, %rbp
movq 0x1008(%r14), %rax
testq %rax, %rax
jle 0x25594
movq %r15, %rbx
xorl %r15d, %r15d
movl (%rbp), %edx
cmpl -0x8(%rbx), %edx
jne 0x25515
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%rbx)
cmpl $0x1, %eax
jne 0x25523
movq 0x1008(%r14), %rax
movl $0x1, %r12d
incq %r15
addq $0x10, %rbx
cmpq %rax, %r15
jl 0x254f1
jmp 0x25569
movl %eax, %r12d
addq $0x8, %rbp
movl $0xa, %r15d
cmpl $0x2, %r12d
jne 0x25569
movl -0x4(%rbp), %edx
testl %edx, %edx
je 0x25589
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%rbx)
cmpl $0x3, %eax
je 0x2555a
movl %eax, %r12d
addq $0x4, %rbp
decq %r15
jne 0x25530
jmp 0x25591
movl $0x3, %r12d
movq (%rsp), %r15
jmp 0x253ad
cmpl $0x5, %r12d
jne 0x25594
leaq 0x20(%rsp), %rsi
movl $0x9, %ecx
movq 0x18(%rsp), %rdi
rep  movsq (%rsi), %es:(%rdi)
movl $0x5, %r12d
jmp 0x25594
movl $0x2, %r12d
jmp 0x25594
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%r14), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
setne %cl
cmpl $0x4, %eax
setne %al
testb %cl, %al
jne 0x2556f
cmpq $0x0, 0x30(%rsp)
jne 0x2556f
leaq 0x3f7(%rip), %rax       # 0x259c4
movq %rax, 0x30(%rsp)
jmp 0x2556f