// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movq %r9, %r12
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x101, %r8d            # imm = 0x101
jle 0x24528
leal -0x102(%rbp), %eax
cmpl $0x5, %eax
ja 0x2470c
leaq 0xcc65(%rip), %rcx      # 0x31160
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)
movl $0x1, %r8d
xorl %ecx, %ecx
jmp 0x24a46
cmpl $0x1b, %ebp
je 0x24a75
cmpl $0x7d, %ebp
jne 0x2476b
cmpb $0x0, 0x19da(%r14)
jne 0x2462f
movq 0x40(%r15), %rax
movq %rax, 0x10(%rsp)
movq (%rax), %rax
movq 0x8(%rbx), %rbp
movq (%rax,%rbp,8), %r13
movq %r13, %rdi
callq 0x25004
testb %al, %al
je 0x2462f
movq %r13, %rdi
callq 0xd210
movq $0x0, 0x70(%rsp)
movq %rbp, 0x78(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
movl $0x1, %r9d
callq 0xfc21
movq (%rbx), %rsi
movq 0x8(%rbx), %r13
movq 0x40(%r15), %rdi
movq 0x8(%r12), %rcx
movq %r13, %rdx
callq 0x24e16
testq %rax, %rax
jle 0x245cb
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 0x2462f
leaq 0x1(%r12), %rdi
callq 0xd4c0
movq %rax, %rbp
movq %rax, %rdi
movl $0x20, %esi
movq %r12, %rdx
callq 0xd2a0
movb $0x0, (%rbp,%r12)
movq 0x40(%r15), %rdi
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbp, %rsi
xorl %edx, %edx
movq %r13, %rcx
movq %rbx, %r8
movl $0x1, %r9d
callq 0xfa43
testb %al, %al
je 0x24a5a
movq 0x40(%r15), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movl $0x7d, %esi
callq 0xf236
movl $0x5, %r13d
testb %al, %al
je 0x24a60
leaq 0x30(%rsp), %rax
movw $0x7d, (%rax)
movq 0x40(%r15), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, %ecx
callq 0xeffa
movq %rax, %rbp
movq %rdx, 0x10(%rsp)
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %r12
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movb 0x19d8(%r14), %al
movb %al, (%r12)
movq %r15, 0x18(%rsp)
movq %rbx, %r15
movq %r14, %rbx
movb $0x1, %al
movb %al, 0x1(%r12)
leaq 0x30(%rsp), %rdi
callq 0xd640
movq %rax, 0x8(%r12)
movups (%r15), %xmm0
movaps %xmm0, 0x10(%r12)
movups (%r15), %xmm0
movaps %xmm0, 0x20(%r12)
movq %rbp, 0x30(%r12)
movq 0x10(%rsp), %r14
movq %r14, 0x38(%r12)
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rdi
movq %r12, %rsi
callq 0xfad6
movq %rbp, (%r15)
movq %r14, 0x8(%r15)
movb $0x1, %al
movb %al, 0x19d8(%rbx)
jmp 0x24a60
cmpl $0x14a, %ebp            # imm = 0x14A
je 0x24cec
cmpl $0x173, %ebp            # imm = 0x173
jne 0x2476b
movl 0x1080(%r14), %eax
movl $0x5, %r13d
testl %eax, %eax
je 0x24a60
cmpl $0x3, %eax
je 0x24a60
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 0xfb7d
jmp 0x24a60
leal -0x20(%rbp), %eax
cmpb $0x5f, %al
setae %al
cmpl $0xa, %ebp
setne %cl
testb %al, %cl
jne 0x24d20
movq 0x40(%r15), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movl %ebp, %esi
callq 0xf236
movl $0x5, %r13d
testb %al, %al
je 0x24a60
movq %r12, 0x60(%rsp)
leaq 0x2e(%rsp), %rax
movb %bpl, (%rax)
movb $0x0, 0x1(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x40(%r15), %rdi
movl $0x1, %ecx
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
callq 0xeffa
movq %rax, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rcx
movaps %xmm0, 0x30(%rcx)
movaps %xmm0, 0x20(%rcx)
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
movb 0x19d8(%r14), %al
movb %al, (%rcx)
movq %r15, %r12
movq %rbx, %r15
movq %r14, 0x48(%rsp)
movb $0x1, %al
movb %al, 0x1(%rcx)
movq %rcx, %rbx
leaq 0x2e(%rsp), %rdi
callq 0xd640
movq %rax, 0x8(%rbx)
movups (%r15), %xmm0
movaps %xmm0, 0x10(%rbx)
movups (%r15), %xmm0
movaps %xmm0, 0x20(%rbx)
movq 0x20(%rsp), %r14
movq %r14, 0x30(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx)
movq %r12, 0x18(%rsp)
movq 0x40(%r12), %rdi
movq %rax, %r12
movq %rbx, %rsi
callq 0xfad6
movq %r14, (%r15)
movq %r15, 0x20(%rsp)
movq %r12, 0x8(%r15)
movq 0x48(%rsp), %rax
movb $0x1, %cl
movb %cl, 0x19d8(%rax)
movq 0x48(%rsp), %rbx
cmpl $0xa, %ebp
jne 0x24a60
cmpb $0x0, 0x19da(%rbx)
jne 0x24a60
movq 0x18(%rsp), %r15
movq 0x40(%r15), %rdi
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rbp
movq %rbp, %rdx
callq 0x24e16
movq %rax, 0x30(%rsp)
movq %r12, 0x38(%rsp)
testq %rax, %rax
movq 0x20(%rsp), %rbx
jle 0x24912
movq %rax, %r14
movq %rax, %rdi
incq %rdi
callq 0xd4c0
movq %rax, %r12
movq %rax, %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0xd2a0
movb $0x0, (%r12,%r14)
movq 0x40(%r15), %rdi
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rsi
xorl %edx, %edx
movq 0x10(%rsp), %rcx
movq %rbx, %r8
movl $0x1, %r9d
callq 0xfa43
testb %al, %al
je 0x24e0e
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 0x25004
testb %al, %al
je 0x24a60
movq %r15, %rdi
callq 0xd210
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %rax, %rcx
movq %rbx, %r8
movl $0x1, %r9d
callq 0xfc21
jmp 0x24a60
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
movq $-0x1, %rcx
jmp 0x24a43
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
xorl %ecx, %ecx
movq $-0x1, %r8
jmp 0x24a46
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf1d6
movl $0x5, %r13d
testb %al, %al
jne 0x24a60
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x24d59
movq 0x40(%r15), %rdi
movq 0x8(%rbx), %rdx
movq $-0x1, %rcx
callq 0xeffa
movq %rax, 0x70(%rsp)
movq %rdx, 0x78(%rsp)
movq 0x40(%r15), %rdi
movzbl 0x19d8(%r14), %r9d
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %ecx
movq %rax, %rsi
movq %rbx, %r8
callq 0xfc21
jmp 0x24da8
movq 0x40(%r15), %rdi
movq 0x8(%r12), %r9
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x1, (%rsp)
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0xee2d
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
movb $0x0, 0x19d8(%r14)
movl $0x5, %r13d
movl %r13d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r13
cmpq $0x0, 0x19c8(%r14)
jne 0x24aad
movq 0x19a8(%r14), %rax
leaq 0x6a6(%rip), %rcx       # 0x25136
cmpq %rcx, %rax
je 0x24afc
leaq 0x620(%rip), %rcx       # 0x250bc
cmpq %rcx, %rax
je 0x24afc
leaq 0x637(%rip), %rcx       # 0x250df
cmpq %rcx, %rax
je 0x24afc
cmpb $0x0, 0x19d9(%r14)
jne 0x24afc
leaq 0x1938(%r14), %rdi
leaq 0x1980(%r14), %rsi
movl $0x9, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpq $0x0, 0x19d0(%r14)
je 0x24ae3
leaq 0x19d0(%r14), %rdi
callq 0x10370
movq 0x19c8(%r14), %rax
movq %rax, 0x19d0(%r14)
movq $0x0, 0x19c8(%r14)
movq $0x0, 0x70(%rsp)
movq 0x8(%rbx), %rcx
movq %rcx, 0x78(%rsp)
movq 0x40(%r15), %rax
movq %rax, 0x18(%rsp)
movq (%rax), %rax
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %rbp
movq %rbp, %rdi
callq 0x25004
testb %al, %al
je 0x24b5d
movq %rbp, %rdi
callq 0xd210
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movq 0x18(%rsp), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
movq %rbx, %r8
movl $0x1, %r9d
callq 0xfc21
movq 0x10(%r13), %rdi
movq 0x18(%r13), %rsi
movq 0x20(%r13), %rdx
movq 0x28(%r13), %rcx
callq 0xf1d6
testb %al, %al
jne 0x24cb1
movq %r12, 0x60(%rsp)
leaq 0x10(%r13), %rax
movq 0x10(%r13), %rcx
movq %rcx, 0x58(%rsp)
movq 0x18(%r13), %rcx
movq 0x28(%r13), %rdx
movups (%rbx), %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpq 0x8(%rbx), %rcx
sete %r12b
setne %bpl
movq %rdx, 0x50(%rsp)
subq %rbp, %rdx
movq %rdx, 0x10(%rsp)
addq %rcx, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x19d0(%r14), %rdi
callq 0x10317
movq %rax, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq 0x40(%r15), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x24bed
movb $0x1, (%rax)
movq %r14, 0x48(%rsp)
movb $0x1, 0x19d8(%r14)
cmpq 0x10(%rsp), %r12
jg 0x24c7f
negq %rbp
addq %rbp, 0x50(%rsp)
movq 0x20(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x68(%rsp)
movq 0x60(%rsp), %rbp
movq 0x58(%rsp), %rax
movq %rax, (%rbx)
movq %r12, 0x10(%rsp)
movq %r12, 0x8(%rbx)
movq 0x20(%rsp), %rax
movl (%rax), %r8d
testl %r8d, %r8d
movq %rbx, %r15
movq 0x48(%rsp), %rbx
movq 0x18(%rsp), %r12
je 0x24c6c
movq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %rbp, %r9
callq 0x244bc
movl (%r14), %r8d
addq $0x4, %r14
testl %r8d, %r8d
jne 0x24c4c
movq 0x10(%rsp), %rcx
leaq 0x1(%rcx), %r12
cmpq 0x50(%rsp), %rcx
movq %r15, %rbx
jne 0x24c1c
movq 0x20(%rsp), %rdi
callq 0xd090
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x18(%rsp), %r15
movq 0x40(%r15), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
je 0x24cac
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x30(%rax)
movq 0x48(%rsp), %r14
movl $0x0, (%r14)
movb $0x0, 0x19d8(%r14)
movq (%rbx), %rsi
testq %rsi, %rsi
jle 0x24a5a
movq 0x40(%r15), %rdi
movq 0x8(%rbx), %rdx
movq $-0x1, %rcx
callq 0xeffa
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
jmp 0x24a5a
movq 0x40(%r15), %rdi
movzbl 0x19d8(%r14), %r9d
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %ecx
movq %rbx, %r8
callq 0xfc21
movb $0x1, 0x19d8(%r14)
jmp 0x24a5a
movl $0x1, %r13d
cmpl $0x9, %ebp
jne 0x24a60
cmpb $0x1, 0x20(%r12)
jne 0x24d41
cmpb $0x0, 0x19da(%r14)
je 0x24db2
movl $0x2, %edi
callq 0xd4c0
movq %rax, %r12
movb %bpl, (%rax)
incq %rax
jmp 0x24dd9
movq %r15, %r12
movq %rbx, %r15
movq %r14, %rbx
movq 0x8(%r15), %r14
movq 0x40(%r12), %rax
movq (%rax), %rax
movq -0x8(%rax,%r14,8), %rdi
decq %r14
callq 0xe485
movq %rax, 0x70(%rsp)
movq %r14, 0x78(%rsp)
movq %rbx, %r14
movq %r15, %rbx
movq 0x40(%r12), %rdi
movq (%r15), %rdx
movq 0x8(%r15), %rcx
leaq -0x1(%rcx), %rsi
movzbl 0x19d8(%r14), %r8d
callq 0x2504c
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rbx)
jmp 0x24e01
movq 0x8(%r12), %r13
leaq 0x1(%r13), %rdi
callq 0xd4c0
movq %rax, %r12
movq %rax, %rdi
movl $0x20, %esi
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 0xfb7d
movl $0x5, %r13d
testb %al, %al
je 0x24a60
movb $0x1, 0x19d8(%r14)
jmp 0x24a60
xorl %r13d, %r13d
jmp 0x24a60