// File: /workspace/github_c_makefile_star2_O2/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, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
movups %xmm0, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
andq $0x0, 0x60(%rsp)
pushq $0x1
popq %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x18(%rsp), %rbx
andq $0x0, (%rbx)
leaq 0x1010(%rsi), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x119fc
movq (%rbx), %rcx
testq %rcx, %rcx
setne %sil
testq %rax, %rax
setne %dl
andb %sil, %dl
xorl %esi, %esi
cmpb $0x1, %dl
jne 0x2280c
movq %rax, 0x20(%rsp)
pushq $0x4
popq %rsi
movq %rcx, %r15
leaq 0x10(%r14), %r12
movq %r12, (%rsp)
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
cmpq 0x1008(%r14), %rbp
jge 0x228ae
movl (%r15), %edx
cmpl -0x8(%r12), %edx
jne 0x22846
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%r12)
pushq $0x1
popq %rsi
cmpl $0x1, %eax
jne 0x2284f
incq %rbp
addq $0x10, %r12
jmp 0x2281b
movl %eax, %ebx
movq %r13, 0x10(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpl $0x2, %ebx
jne 0x22973
movl 0x4(%r15,%r13,4), %edx
testl %edx, %edx
je 0x229b0
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%r12)
cmpl $0x3, %eax
je 0x22896
movl %eax, %ebx
incq %r13
addq $-0x4, %rbp
cmpq $0xa, %r13
jne 0x2285b
jmp 0x229b5
subq %rbp, %r15
addq $0x8, %r15
pushq $0x3
popq %rsi
movq 0x10(%rsp), %r13
movq (%rsp), %r12
jmp 0x22819
movl %esi, %ebx
movl (%r14), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
sete %cl
cmpl $0x4, %eax
sete %al
orb %cl, %al
cmpl $0x5, %ebx
movq 0x8(%rsp), %rcx
je 0x229c8
testq %rcx, %rcx
sete %cl
andb %cl, %al
cmpb $0x1, %al
je 0x229d5
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x119fc
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x22908
testq %rax, %rax
je 0x22908
movq %rax, 0x28(%rsp)
movq %rcx, %r15
movq %rax, 0x8(%rsp)
movq (%rsp), %r12
xorl %ebp, %ebp
cmpq 0x1008(%r14), %rbp
jge 0x22995
movl (%r15), %edx
cmpl -0x8(%r12), %edx
jne 0x2293a
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%r12)
pushq $0x1
popq %rbx
cmpl $0x1, %eax
jne 0x22943
incq %rbp
addq $0x10, %r12
jmp 0x22913
addq $0x8, %r15
pushq $0xa
popq %rbx
cmpl $0x2, %eax
jne 0x22997
movl -0x4(%r15), %edx
testl %edx, %edx
je 0x229b0
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq *(%r12)
cmpl $0x3, %eax
je 0x22984
addq $0x4, %r15
decq %rbx
jne 0x2294a
jmp 0x229b5
subq %rbp, %r15
addq $0x4, %r15
movq 0x10(%rsp), %r13
jmp 0x228b0
pushq $0x3
popq %rsi
movq 0x8(%rsp), %rax
movq (%rsp), %r12
jmp 0x22814
movl %ebx, %eax
movl %eax, %ecx
cmpl $0x5, %eax
jne 0x229b7
pushq $0x9
popq %rcx
leaq 0x20(%rsp), %rsi
movq %r13, %rdi
rep  movsq (%rsi), %es:(%rdi)
pushq $0x5
jmp 0x229b2
pushq $0x2
popq %rcx
jmp 0x229b7
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x30(%rsp)
sete %cl
testb %cl, %al
je 0x2299e
leaq 0x3f4(%rip), %rax       # 0x22dd0
movq %rax, 0x30(%rsp)
jmp 0x2299e