// File: /workspace/github_c_makefile_star2_O2/justy989[P]ce/ce_vim.c
// Function: insert_mode_handle_key
CeVimParseResult_t insert_mode_handle_key(CeVim_t* vim, CeView_t* view, CePoint_t* cursor, CeVimVisualData_t* visual,
                                          CeRune_t key, const CeConfigOptions_t* config_options){
     switch(key){
     default:
          if(_is_print(key) || key == CE_NEWLINE){
               if(ce_buffer_insert_rune(view->buffer, key, *cursor)){
                    const char str[2] = {key, 0};
                    CePoint_t save_cursor = *cursor;
                    CePoint_t new_cursor = ce_buffer_advance_point(view->buffer, *cursor, 1);

                    // TODO: convenience function
                    CeBufferChange_t change = {};
                    change.chain = vim->chain_undo;
                    change.insertion = true;
                    change.string = strdup(str);
                    change.location = *cursor;
                    change.cursor_before = *cursor;
                    change.cursor_after = new_cursor;
                    ce_buffer_change(view->buffer, &change);

                    *cursor = new_cursor;
                    vim->chain_undo = true;

                    // indent after newline
                    if(key == CE_NEWLINE && !vim->pasting){
                         // calc indentation
                         CePoint_t indentation_point = {0, cursor->y};
                         int64_t indentation = ce_vim_get_indentation(view->buffer, save_cursor, config_options->tab_width);
                         CePoint_t cursor_end = {indentation, indentation_point.y};

                         if(indentation > 0){
                              // build indentation string
                              char* insert_string = malloc(indentation + 1);
                              memset(insert_string, ' ', indentation);
                              insert_string[indentation] = 0;

                              if(!ce_buffer_insert_string_change(view->buffer, insert_string, indentation_point,
                                                                 cursor, cursor_end, true)){
                                   return false;
                              }
                         }

                         *cursor = cursor_end;

                         // check if previous line was all whitespace, if so, remove it
                         CePoint_t remove_loc = {0, save_cursor.y};
                         if(string_is_whitespace(view->buffer->lines[save_cursor.y])){
                              int64_t remove_len = strlen(view->buffer->lines[save_cursor.y]);
                              ce_buffer_remove_string_change(view->buffer, remove_loc, remove_len, cursor,
                                                             *cursor, true);
                         }
                    }
               }
          }else if(key == CE_TAB){
               // build a string to insert
               char* insert_string = NULL;
               if(config_options->insert_spaces_on_tab && !vim->pasting){
                    int64_t insert_len = config_options->tab_width;
                    insert_string = malloc(insert_len + 1);
                    memset(insert_string, ' ', insert_len);
                    insert_string[insert_len] = 0;
               }else{
                    insert_string = malloc(2);
                    insert_string[0] = key;
                    insert_string[1] = 0;
               }

               if(!ce_buffer_insert_string_change_at_cursor(view->buffer, insert_string, cursor, vim->chain_undo)){
                    break;
               }

               vim->chain_undo = true;
          }else{
               return CE_VIM_PARSE_KEY_NOT_HANDLED;
          }
          break;
     case '}':
     {
          if(!vim->pasting && string_is_whitespace(view->buffer->lines[cursor->y])){
               int64_t remove_len = strlen(view->buffer->lines[cursor->y]);
               CePoint_t remove_loc = {0, cursor->y};
               ce_buffer_remove_string_change(view->buffer, remove_loc, remove_len, cursor, remove_loc, true);

               // calc indentation
               CePoint_t indentation_point = {0, cursor->y};
               int64_t indentation = ce_vim_get_indentation(view->buffer, *cursor, config_options->tab_width);
               if(indentation > 0) indentation -= config_options->tab_width;
               if(indentation < 0) indentation = 0;
               CePoint_t cursor_end = {indentation, indentation_point.y};

               if(indentation > 0){
                   // build indentation string
                    char* insert_string = malloc(indentation + 1);
                    memset(insert_string, ' ', indentation);
                    insert_string[indentation] = 0;

                    if(!ce_buffer_insert_string_change(view->buffer, insert_string, indentation_point,
                                                       cursor, cursor_end, true)){
                         break;
                    }
               }
          }

          if(!ce_buffer_insert_rune(view->buffer, key, *cursor)) break;

          const char str[2] = {key, 0};
          CePoint_t new_cursor = ce_buffer_advance_point(view->buffer, *cursor, 1);

          // TODO: convenience function
          CeBufferChange_t change = {};
          change.chain = vim->chain_undo;
          change.insertion = true;
          change.string = strdup(str);
          change.location = *cursor;
          change.cursor_before = *cursor;
          change.cursor_after = new_cursor;
          ce_buffer_change(view->buffer, &change);

          *cursor = new_cursor;
          vim->chain_undo = true;

     } break;
     case KEY_ONLY_BACKSPACE:
          if(!ce_points_equal(*cursor, (CePoint_t){0, 0})){
               CePoint_t remove_point;
               CePoint_t end_cursor;
               int64_t remove_len = 1;

               if(cursor->x == 0){
                    int64_t line = cursor->y - 1;
                    end_cursor = (CePoint_t){ce_utf8_strlen(view->buffer->lines[line]), line};
                    ce_vim_join_next_line(view->buffer, cursor->y - 1, *cursor, vim->chain_undo);
               }else{
                    remove_point = ce_buffer_advance_point(view->buffer, *cursor, -1);
                    end_cursor = remove_point;
                    ce_buffer_remove_string_change(view->buffer, remove_point, remove_len, cursor,
                                                   end_cursor, vim->chain_undo);
               }

               *cursor = end_cursor;
               vim->chain_undo = true;
          }
          break;
     case KEY_DELETE:
          ce_buffer_remove_string_change(view->buffer, *cursor, 1, cursor,
                                         *cursor, vim->chain_undo);
          vim->chain_undo = true;
          break;
     case KEY_LEFT_ARROW:
          *cursor = ce_buffer_move_point(view->buffer, *cursor, (CePoint_t){-1, 0},
                                         config_options->tab_width, CE_CLAMP_X_ON);
          vim->chain_undo = false;
          break;
     case KEY_DOWN_ARROW:
          *cursor = ce_buffer_move_point(view->buffer, *cursor, (CePoint_t){0, 1},
                                         config_options->tab_width, CE_CLAMP_X_ON);
          vim->chain_undo = false;
          break;
     case KEY_UP_ARROW:
          *cursor = ce_buffer_move_point(view->buffer, *cursor, (CePoint_t){0, -1},
                                        config_options->tab_width, CE_CLAMP_X_ON);
          vim->chain_undo = false;
          break;
     case KEY_RIGHT_ARROW:
          *cursor = ce_buffer_move_point(view->buffer, *cursor, (CePoint_t){1, 0},
                                         config_options->tab_width, CE_CLAMP_X_ON);
          vim->chain_undo = false;
          break;
     case KEY_ESCAPE: // escape
     {
          if(!vim->insert_rune_head &&
             (vim->current_action.verb.function == ce_vim_verb_insert_mode ||
              vim->current_action.verb.function == ce_vim_verb_append ||
              vim->current_action.verb.function == ce_vim_verb_append_at_end_of_line)){
               // pass
          }else if(!vim->verb_last_action){
               vim->last_action = vim->current_action;
               if(vim->last_insert_rune_head){
                   ce_rune_node_free(&vim->last_insert_rune_head);
               }
               vim->last_insert_rune_head = vim->insert_rune_head;
               vim->insert_rune_head = NULL;
          }

          // check if previous line was all whitespace, if so, remove it
          CePoint_t remove_loc = {0, cursor->y};
          if(string_is_whitespace(view->buffer->lines[cursor->y])){
               int64_t remove_len = strlen(view->buffer->lines[cursor->y]);
               ce_buffer_remove_string_change(view->buffer, remove_loc, remove_len, cursor, remove_loc, true);
          }

          if(!ce_points_equal(visual->block_top_left, visual->block_bottom_right)){
               CePoint_t visual_top_left = visual->block_top_left;
               CePoint_t visual_bottom_right = visual->block_bottom_right;

               // adjust range because we've already inserted text the line the cursor is on
               CePoint_t cursor_end = *cursor;
               if(visual_top_left.y == cursor->y){
                    visual_top_left.y++;
               }else{
                    visual_bottom_right.y--;
               }

               visual->block_top_left = (CePoint_t){0, 0};
               visual->block_bottom_right = (CePoint_t){0, 0};

               CeRune_t* rune_string = ce_rune_node_string(vim->last_insert_rune_head);

               if(view->buffer->change_node) view->buffer->change_node->change.chain = true;
               vim->chain_undo = true;

               for(int64_t i = visual_top_left.y; i <= visual_bottom_right.y; i++){
                    *cursor = (CePoint_t){visual_top_left.x, i};
                    CeRune_t* itr = rune_string;
                    while(*itr){
                         insert_mode_handle_key(vim, view, cursor, visual, *itr, config_options);
                         itr++;
                    }
               }

               free(rune_string);
               *cursor = cursor_end;

               if(view->buffer->change_node) view->buffer->change_node->change.cursor_after = *cursor;
          }

          vim->mode = CE_VIM_MODE_NORMAL;
          vim->chain_undo = false;

          if(cursor->x > 0){
               *cursor = ce_buffer_advance_point(view->buffer, *cursor, -1);
          }
     } break;
     case KEY_REDO:
     {
          CeVimYank_t* yank = vim->yanks + ce_vim_register_index('"');
          if(yank->type == CE_VIM_YANK_TYPE_NONE ||
             yank->type == CE_VIM_YANK_TYPE_BLOCK) break;

          vim->chain_undo = false;
          if(!ce_buffer_insert_string_change_at_cursor(view->buffer, strdup(yank->text),
                                                       cursor, vim->chain_undo)){
               break;
          }
     } break;
#if defined(DISPLAY_GUI)
     case KEY_CTRL_SHIFT_V:
     {
          CePoint_t resulting_cursor = ce_paste_clipboard_into_buffer(view->buffer,
                                                                      view->cursor);
          if(resulting_cursor.x >= 0){
               view->cursor = resulting_cursor;
          }
     } break;
#endif
     }

     return CE_VIM_PARSE_COMPLETE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %r12
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leal -0x102(%rbp), %eax
cmpl $0x5, %eax
ja 0x21ab3
leaq 0xb71c(%rip), %rcx      # 0x2d1a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
pushq $0x1
jmp 0x21da4
cmpl $0x1b, %ebp
je 0x21fac
cmpl $0x7d, %ebp
je 0x21e04
cmpl $0x14a, %ebp            # imm = 0x14A
je 0x21dd5
cmpl $0x173, %ebp            # imm = 0x173
jne 0x21b22
movl 0x1080(%r14), %eax
pushq $0x5
popq %r13
testl %eax, %eax
je 0x21dc0
cmpl $0x3, %eax
je 0x21dc0
movb $0x0, 0x19d8(%r14)
movq 0x40(%r15), %r15
movq 0x1088(%r14), %rdi
callq 0xd640
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xf6e4
jmp 0x21dc0
leal -0x20(%rbp), %eax
cmpb $0x5f, %al
setae %al
cmpl $0xa, %ebp
setne %cl
testb %al, %cl
jne 0x2216f
movq 0x40(%r15), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movl %ebp, %esi
callq 0xee12
pushq $0x5
popq %r13
testb %al, %al
je 0x21dc0
leaq 0x2e(%rsp), %rax
movb %bpl, (%rax)
movb $0x0, 0x1(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x40(%r15), %rdi
pushq $0x1
popq %rcx
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
callq 0xec3a
movq %rax, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
leaq 0x58(%rsp), %rcx
andq $0x0, (%rcx)
movb 0x19d8(%r14), %al
movb %al, (%rcx)
movb $0x1, %al
movb %al, 0x1(%rcx)
leaq 0x2e(%rsp), %rdi
callq 0xd640
leaq 0x58(%rsp), %rsi
movq %rax, 0x8(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x10(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x20(%rsi)
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsi)
movq 0x18(%rsp), %rax
movq %rax, 0x38(%rsi)
movq 0x40(%r15), %rdi
callq 0xf64d
movq 0x20(%rsp), %rax
movq %rax, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
movb $0x1, %al
movb %al, 0x19d8(%r14)
cmpl $0xa, %ebp
jne 0x21dc0
cmpb $0x0, 0x19da(%r14)
jne 0x21dc0
movq 0x40(%r15), %rdi
movq 0x8(%r12), %rcx
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rbp
movq %rbp, %rdx
callq 0x222af
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %r12
movq %r12, 0x38(%rsp)
testq %rax, %rax
jle 0x21c8b
movq %rax, %r14
movq %rax, %rdi
incq %rdi
callq 0xd4c0
movq %rax, %r12
pushq $0x20
popq %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0xd2a0
movb $0x0, (%r12,%r14)
movq 0x40(%r15), %rdi
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r9
movq %r12, %rsi
xorl %edx, %edx
movq 0x18(%rsp), %rcx
movq %rbx, %r8
callq 0xf5c8
testb %al, %al
je 0x222a7
movq 0x30(%rsp), %rax
movq %rax, (%rbx)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rbx)
movq 0x40(%r15), %r14
movq (%r14), %rax
movq (%rax,%rbp,8), %r15
movq %r15, %rdi
callq 0x2245c
testb %al, %al
je 0x21dc0
movq %r15, %rdi
callq 0xd210
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r9
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0xf77c
jmp 0x21dc0
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
pushq $-0x1
jmp 0x21d18
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
pushq $0x1
popq %rcx
xorl %r8d, %r8d
jmp 0x21da8
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xedb2
pushq $0x5
popq %r13
testb %al, %al
jne 0x21dc0
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x22207
movq 0x40(%r15), %rdi
movq 0x8(%rbx), %rdx
pushq $-0x1
popq %rcx
callq 0xec3a
movq %rax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
movq 0x40(%r15), %rdi
movzbl 0x19d8(%r14), %r9d
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rcx
movq %rax, %rsi
movq %rbx, %r8
callq 0xf77c
jmp 0x22245
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
pushq $-0x1
popq %r8
xorl %ecx, %ecx
callq 0xea97
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
movb $0x0, 0x19d8(%r14)
pushq $0x5
popq %r13
movl %r13d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%r15), %rdi
movzbl 0x19d8(%r14), %r9d
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rcx
movq %rbx, %r8
callq 0xf77c
movb $0x1, 0x19d8(%r14)
jmp 0x21dbc
cmpb $0x0, 0x19da(%r14)
jne 0x21ef0
movq 0x40(%r15), %rax
movq %rax, 0x18(%rsp)
movq (%rax), %rax
movq 0x8(%rbx), %rbp
movq (%rax,%rbp,8), %r13
movq %r13, %rdi
callq 0x2245c
testb %al, %al
je 0x21ef0
movq %r13, %rdi
callq 0xd210
andq $0x0, 0x58(%rsp)
movq %rbp, 0x60(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r9
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0xf77c
movq (%rbx), %rsi
movq 0x8(%rbx), %r13
movq 0x40(%r15), %rdi
movq 0x8(%r12), %rcx
movq %r13, %rdx
callq 0x222af
testq %rax, %rax
jle 0x21e90
movq 0x8(%r12), %rcx
subq %rcx, %rax
xorl %r12d, %r12d
testq %rax, %rax
cmovgq %rax, %r12
movq %r12, 0x30(%rsp)
movq %r13, 0x38(%rsp)
jle 0x21ef0
leaq 0x1(%r12), %rdi
callq 0xd4c0
movq %rax, %rbp
pushq $0x20
popq %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0xd2a0
movb $0x0, (%rbp,%r12)
movq 0x40(%r15), %rdi
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r9
movq %rbp, %rsi
xorl %edx, %edx
movq %r13, %rcx
movq %rbx, %r8
callq 0xf5c8
testb %al, %al
je 0x21dbc
movq 0x40(%r15), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
pushq $0x7d
popq %rsi
callq 0xee12
pushq $0x5
popq %r13
testb %al, %al
je 0x21dc0
leaq 0x30(%rsp), %rbp
movw $0x7d, (%rbp)
movq 0x40(%r15), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
pushq $0x1
popq %rcx
callq 0xec3a
movq %rax, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
leaq 0x58(%rsp), %r12
andq $0x0, (%r12)
movb 0x19d8(%r14), %al
movb %al, (%r12)
movb $0x1, %al
movb %al, 0x1(%r12)
movq %rbp, %rdi
callq 0xd640
movq %rax, 0x8(%r12)
movups (%rbx), %xmm0
movups %xmm0, 0x10(%r12)
movups (%rbx), %xmm0
movups %xmm0, 0x20(%r12)
movq 0x20(%rsp), %rbp
movq %rbp, 0x30(%r12)
movq 0x18(%rsp), %rax
movq %rax, 0x38(%r12)
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0xf64d
movq %rbp, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
movb $0x1, %al
movb %al, 0x19d8(%r14)
jmp 0x21dc0
movq %rcx, %r13
movq 0x19c8(%r14), %rax
testq %rax, %rax
jne 0x21fe6
movq 0x19a8(%r14), %rcx
leaq 0x585(%rip), %rdx       # 0x2254e
cmpq %rdx, %rcx
je 0x22030
leaq 0x52e(%rip), %rdx       # 0x22503
cmpq %rdx, %rcx
je 0x22030
leaq 0x52c(%rip), %rdx       # 0x2250d
cmpq %rdx, %rcx
je 0x22030
cmpb $0x0, 0x19d9(%r14)
jne 0x22030
leaq 0x1938(%r14), %rdi
leaq 0x1980(%r14), %rsi
pushq $0x9
popq %rcx
rep  movsq (%rsi), %es:(%rdi)
cmpq $0x0, 0x19d0(%r14)
je 0x22021
leaq 0x19d0(%r14), %rdi
callq 0xfe39
movq 0x19c8(%r14), %rax
movq %rax, 0x19d0(%r14)
andq $0x0, 0x19c8(%r14)
andq $0x0, 0x58(%rsp)
movq 0x8(%rbx), %rcx
movq %rcx, 0x60(%rsp)
movq 0x40(%r15), %rax
movq %rax, 0x20(%rsp)
movq (%rax), %rax
movq %rcx, 0x18(%rsp)
movq (%rax,%rcx,8), %rbp
movq %rbp, %rdi
callq 0x2245c
testb %al, %al
je 0x2208c
movq %rbp, %rdi
callq 0xd210
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r9
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0xf77c
movq 0x10(%r13), %rdi
movq 0x18(%r13), %rsi
movq 0x20(%r13), %rdx
movq 0x28(%r13), %rcx
callq 0xedb2
testb %al, %al
jne 0x221cc
leaq 0x10(%r13), %rax
movq 0x10(%r13), %rcx
movq %rcx, 0x48(%rsp)
movq 0x18(%r13), %rbp
movq 0x28(%r13), %rcx
movq %rcx, 0x20(%rsp)
movups (%rbx), %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
cmpq 0x8(%rbx), %rbp
sete %cl
movq %rcx, 0x18(%rsp)
setne %dl
movq %rdx, 0x50(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x19d0(%r14), %rdi
callq 0xfdec
movq %rax, 0x40(%rsp)
movq 0x40(%r15), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x2210e
movb $0x1, (%rax)
movq 0x50(%rsp), %rax
subq %rax, 0x20(%rsp)
addq 0x18(%rsp), %rbp
movb $0x1, 0x19d8(%r14)
cmpq 0x20(%rsp), %rbp
jg 0x221a4
movq 0x48(%rsp), %rax
movq %rax, (%rbx)
movq %rbp, 0x18(%rsp)
movq %rbp, 0x8(%rbx)
movq 0x40(%rsp), %rbp
movl (%rbp), %r8d
testl %r8d, %r8d
je 0x22165
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
movq %r12, %r9
callq 0x21a5a
addq $0x4, %rbp
jmp 0x22142
movq 0x18(%rsp), %rbp
incq %rbp
jmp 0x22125
cmpl $0x9, %ebp
jne 0x22200
cmpb $0x1, 0x20(%r12)
jne 0x2218e
cmpb $0x0, 0x19da(%r14)
je 0x2224f
pushq $0x2
popq %rdi
callq 0xd4c0
movq %rax, %r12
movb %bpl, (%rax)
incq %rax
jmp 0x22274
movq 0x40(%rsp), %rdi
callq 0xd090
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x40(%r15), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x221cc
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x30(%rax)
andl $0x0, (%r14)
movb $0x0, 0x19d8(%r14)
movq (%rbx), %rsi
testq %rsi, %rsi
jle 0x21dbc
movq 0x40(%r15), %rdi
movq 0x8(%rbx), %rdx
pushq $-0x1
popq %rcx
callq 0xec3a
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
jmp 0x21dbc
pushq $0x1
jmp 0x21dbe
movq 0x8(%rbx), %r12
movq 0x40(%r15), %rax
movq (%rax), %rax
movq -0x8(%rax,%r12,8), %rdi
decq %r12
callq 0xe38c
movq %rax, 0x58(%rsp)
movq %r12, 0x60(%rsp)
movq 0x40(%r15), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
leaq -0x1(%rcx), %rsi
movzbl 0x19d8(%r14), %r8d
callq 0x22498
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rbx)
jmp 0x2229a
movq 0x8(%r12), %r13
leaq 0x1(%r13), %rdi
callq 0xd4c0
movq %rax, %r12
pushq $0x20
popq %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0xd2a0
movq %r12, %rax
addq %r13, %rax
movb $0x0, (%rax)
movq 0x40(%r15), %rdi
movzbl 0x19d8(%r14), %ecx
movq %r12, %rsi
movq %rbx, %rdx
callq 0xf6e4
pushq $0x5
popq %r13
testb %al, %al
je 0x21dc0
movb $0x1, 0x19d8(%r14)
jmp 0x21dc0
xorl %r13d, %r13d
jmp 0x21dc0