// File: /workspace/github_c_makefile_star2_O3/neovim[P]libvterm/src/screen.c
// Function: resize_buffer
static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new_cols, bool active, VTermStateFields *statefields)
{
  int old_rows = screen->rows;
  int old_cols = screen->cols;

  ScreenCell *old_buffer = screen->buffers[bufidx];
  VTermLineInfo *old_lineinfo = statefields->lineinfos[bufidx];

  ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols);
  VTermLineInfo *new_lineinfo = vterm_allocator_malloc(screen->vt, sizeof(new_lineinfo[0]) * new_rows);

  int old_row = old_rows - 1;
  int new_row = new_rows - 1;

  VTermPos old_cursor = statefields->pos;
  VTermPos new_cursor = { -1, -1 };

#ifdef DEBUG_REFLOW
  fprintf(stderr, "Resizing from %dx%d to %dx%d; cursor was at (%d,%d)\n",
      old_cols, old_rows, new_cols, new_rows, old_cursor.col, old_cursor.row);
#endif

  /* Keep track of the final row that is knonw to be blank, so we know what
   * spare space we have for scrolling into
   */
  int final_blank_row = new_rows;

  while(old_row >= 0) {
    int old_row_end = old_row;
    /* TODO: Stop if dwl or dhl */
    while(screen->reflow && old_lineinfo && old_row >= 0 && old_lineinfo[old_row].continuation)
      old_row--;
    int old_row_start = old_row;

    int width = 0;
    for(int row = old_row_start; row <= old_row_end; row++) {
      if(screen->reflow && row < (old_rows - 1) && old_lineinfo[row + 1].continuation)
        width += old_cols;
      else
        width += line_popcount(old_buffer, row, old_rows, old_cols);
    }

    if(final_blank_row == (new_row + 1) && width == 0)
      final_blank_row = new_row;

    int new_height = screen->reflow
      ? width ? (width + new_cols - 1) / new_cols : 1
      : 1;

    int new_row_end = new_row;
    int new_row_start = new_row - new_height + 1;

    old_row = old_row_start;
    int old_col = 0;

    int spare_rows = new_rows - final_blank_row;

    if(new_row_start < 0 && /* we'd fall off the top */
        spare_rows >= 0 && /* we actually have spare rows */
        (!active || new_cursor.row == -1 || (new_cursor.row - new_row_start) < new_rows))
    {
      /* Attempt to scroll content down into the blank rows at the bottom to
       * make it fit
       */
      int downwards = -new_row_start;
      if(downwards > spare_rows)
        downwards = spare_rows;
      int rowcount = new_rows - downwards;

#ifdef DEBUG_REFLOW
      fprintf(stderr, "  scroll %d rows +%d downwards\n", rowcount, downwards);
#endif

      memmove(&new_buffer[downwards * new_cols], &new_buffer[0],   rowcount * new_cols * sizeof(ScreenCell));
      memmove(&new_lineinfo[downwards],          &new_lineinfo[0], rowcount            * sizeof(new_lineinfo[0]));

      new_row += downwards;
      new_row_start += downwards;
      new_row_end += downwards;

      if(new_cursor.row >= 0)
        new_cursor.row += downwards;

      final_blank_row += downwards;
    }

#ifdef DEBUG_REFLOW
    fprintf(stderr, "  rows [%d..%d] <- [%d..%d] width=%d\n",
        new_row_start, new_row_end, old_row_start, old_row_end, width);
#endif

    if(new_row_start < 0) {
      if(old_row_start <= old_cursor.row && old_cursor.row < old_row_end) {
        new_cursor.row = 0;
        new_cursor.col = old_cursor.col;
        if(new_cursor.col >= new_cols)
          new_cursor.col = new_cols-1;
      }
      break;
    }

    for(new_row = new_row_start, old_row = old_row_start; new_row <= new_row_end; new_row++) {
      int count = width >= new_cols ? new_cols : width;
      width -= count;

      int new_col = 0;

      while(count) {
        /* TODO: This could surely be done a lot faster by memcpy()'ing the entire range */
        new_buffer[new_row * new_cols + new_col] = old_buffer[old_row * old_cols + old_col];

        if(old_cursor.row == old_row && old_cursor.col == old_col)
          new_cursor.row = new_row, new_cursor.col = new_col;

        old_col++;
        if(old_col == old_cols) {
          old_row++;

          if(!screen->reflow) {
            new_col++;
            break;
          }
          old_col = 0;
        }

        new_col++;
        count--;
      }

      if(old_cursor.row == old_row && old_cursor.col >= old_col) {
        new_cursor.row = new_row, new_cursor.col = (old_cursor.col - old_col + new_col);
        if(new_cursor.col >= new_cols)
          new_cursor.col = new_cols-1;
      }

      while(new_col < new_cols) {
        clearcell(screen, &new_buffer[new_row * new_cols + new_col]);
        new_col++;
      }

      new_lineinfo[new_row].continuation = (new_row > new_row_start);
    }

    old_row = old_row_start - 1;
    new_row = new_row_start - 1;
  }

  if(old_cursor.row <= old_row) {
    /* cursor would have moved entirely off the top of the screen; lets just
     * bring it within range */
    new_cursor.row = 0, new_cursor.col = old_cursor.col;
    if(new_cursor.col >= new_cols)
      new_cursor.col = new_cols-1;
  }

  /* We really expect the cursor position to be set by now */
  if(active && (new_cursor.row == -1 || new_cursor.col == -1)) {
    fprintf(stderr, "screen_resize failed to update cursor position\n");
    abort();
  }

  if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) {
    /* Push spare lines to scrollback buffer */
    if((screen->callbacks && screen->callbacks->sb_pushline) ||
          (screen->callbacks_has_pushline4 && screen->callbacks && screen->callbacks->sb_pushline4))
      for(int row = 0; row <= old_row; row++) {
        const VTermLineInfo *lineinfo = old_lineinfo + row;
        sb_pushline_from_row(screen, row, lineinfo->continuation);
      }
    if(active)
      statefields->pos.row -= (old_row + 1);
  }
  if(new_row >= 0 && bufidx == BUFIDX_PRIMARY &&
      screen->callbacks && screen->callbacks->sb_popline) {
    /* Try to backfill rows by popping scrollback buffer */
    while(new_row >= 0) {
      if(!(screen->callbacks->sb_popline(old_cols, screen->sb_buffer, screen->cbdata)))
        break;

      VTermPos pos = { .row = new_row };
      for(pos.col = 0; pos.col < old_cols && pos.col < new_cols; pos.col += screen->sb_buffer[pos.col].width) {
        VTermScreenCell *src = &screen->sb_buffer[pos.col];
        ScreenCell *dst = &new_buffer[pos.row * new_cols + pos.col];

        for(int i = 0; i < VTERM_MAX_CHARS_PER_CELL; i++) {
          dst->chars[i] = src->chars[i];
          if(!src->chars[i])
            break;
        }

        dst->pen.bold      = src->attrs.bold;
        dst->pen.underline = src->attrs.underline;
        dst->pen.italic    = src->attrs.italic;
        dst->pen.blink     = src->attrs.blink;
        dst->pen.reverse   = src->attrs.reverse ^ screen->global_reverse;
        dst->pen.conceal   = src->attrs.conceal;
        dst->pen.strike    = src->attrs.strike;
        dst->pen.font      = src->attrs.font;
        dst->pen.small     = src->attrs.small;
        dst->pen.baseline  = src->attrs.baseline;

        dst->pen.fg = src->fg;
        dst->pen.bg = src->bg;

        if(src->width == 2 && pos.col < (new_cols-1))
          (dst + 1)->chars[0] = (uint32_t) -1;
      }
      for( ; pos.col < new_cols; pos.col++)
        clearcell(screen, &new_buffer[pos.row * new_cols + pos.col]);
      new_row--;

      if(active)
        statefields->pos.row++;
    }
  }
  if(new_row >= 0) {
    /* Scroll new rows back up to the top and fill in blanks at the bottom */
    int moverows = new_rows - new_row - 1;
    memmove(&new_buffer[0], &new_buffer[(new_row + 1) * new_cols], moverows * new_cols * sizeof(ScreenCell));
    memmove(&new_lineinfo[0], &new_lineinfo[new_row + 1], moverows * sizeof(new_lineinfo[0]));

    new_cursor.row -= (new_row + 1);

    for(new_row = moverows; new_row < new_rows; new_row++) {
      for(int col = 0; col < new_cols; col++)
        clearcell(screen, &new_buffer[new_row * new_cols + col]);
      new_lineinfo[new_row] = (VTermLineInfo){ 0 };
    }
  }

  vterm_allocator_free(screen->vt, old_buffer);
  screen->buffers[bufidx] = new_buffer;

  vterm_allocator_free(screen->vt, old_lineinfo);
  statefields->lineinfos[bufidx] = new_lineinfo;

  if(active)
    statefields->pos = new_cursor;

  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, %r14
movl %r8d, 0x14(%rsp)
movl %ecx, %r15d
movq %rdi, %r12
movl 0x50(%rdi), %ebx
movl 0x54(%rdi), %eax
movl %eax, 0x10(%rsp)
movl %esi, 0x7c(%rsp)
movl %esi, %eax
movq 0x60(%rdi,%rax,8), %rcx
movq %rcx, 0x58(%rsp)
movq %rax, 0xc0(%rsp)
movq 0x8(%r9,%rax,8), %rax
movq %rax, 0x48(%rsp)
movq (%rdi), %rdi
movl %edx, 0x18(%rsp)
movslq %edx, %rbp
movslq %r15d, %r13
movq %rbp, %rax
imulq %r13, %rax
shlq $0x2, %rax
leaq (%rax,%rax,8), %rsi
callq 0xacb9
movq %rax, 0x30(%rsp)
movq (%r12), %rdi
leaq (,%rbp,4), %rsi
callq 0xacb9
movl 0x10(%rsp), %esi
movq 0x58(%rsp), %rdx
movq %r12, %r9
movq %rbp, %r8
movq %rax, 0x70(%rsp)
leal -0x1(%rbx), %ebp
movl (%r14), %eax
movl %eax, 0x28(%rsp)
movq %r14, 0x40(%rsp)
movl 0x4(%r14), %eax
movl %eax, 0x8(%rsp)
decl %r8d
testl %ebx, %ebx
movq %r12, 0x20(%rsp)
movq %r15, 0x38(%rsp)
movq %r13, 0x50(%rsp)
jle 0x6aee
movslq %esi, %rcx
movl %ecx, %eax
sarl $0x1f, %eax
andl %esi, %eax
movl %eax, 0xa8(%rsp)
leal -0x1(%r15), %eax
movq %rax, 0x80(%rsp)
movl 0x14(%rsp), %eax
xorb $0x1, %al
movb %al, 0xf(%rsp)
leaq 0x80(%r9), %rbx
movl %ebp, %eax
movq %rax, 0xd0(%rsp)
leal 0x1(%rcx), %eax
movl %eax, 0xac(%rsp)
leaq -0x24(%rdx), %rax
movq %rax, 0xc8(%rsp)
movq %rcx, 0xb8(%rsp)
leaq (,%rcx,4), %rax
leaq (%rax,%rax,8), %r12
leaq (,%r13,4), %rax
leaq (%rax,%rax,8), %rax
movq %rax, 0xb0(%rsp)
movl 0x18(%rsp), %eax
movl %eax, %edi
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %eax, 0x1c(%rsp)
movq 0x48(%rsp), %r10
movq %r15, %r11
movq %r12, 0x90(%rsp)
testq %r10, %r10
setne %al
movb 0x58(%r9), %cl
movl %ecx, %edx
shrb %dl
andb %al, %dl
movl %ebp, %esi
cmpb $0x1, %dl
movq %r8, 0x88(%rsp)
movq %rbp, 0xa0(%rsp)
jne 0x6715
movl %ebp, %eax
movl %eax, %edx
testb $0x8, (%r10,%rdx,4)
je 0x66f9
leal -0x1(%rax), %esi
testl %eax, %eax
movl %esi, %eax
jg 0x66e5
jmp 0x66fb
movl %eax, %esi
cmpl %ebp, %esi
jle 0x6715
movl 0x1c(%rsp), %edx
cmpl %edi, %edx
cmovel %r8d, %edx
movl $0x1, %eax
xorl %ebp, %ebp
jmp 0x67ee
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movslq %esi, %rax
leal 0x1(%rbp), %edx
leaq (%rax,%rax,8), %rsi
leaq 0x24(,%rsi,4), %rsi
imulq 0xb8(%rsp), %rsi
addq 0xc8(%rsp), %rsi
xorl %ebp, %ebp
testb $0x2, %cl
je 0x675f
cmpq 0xd0(%rsp), %rax
jge 0x675f
testb $0x8, 0x4(%r10,%rax,4)
movl 0x10(%rsp), %edi
jne 0x678e
movq %rsi, %r8
movl 0xac(%rsp), %edi
movq 0xb8(%rsp), %r9
testq %r9, %r9
jle 0x6787
decq %r9
decl %edi
cmpl $0x0, (%r8)
leaq -0x24(%r8), %r8
je 0x6771
jmp 0x678e
movl 0xa8(%rsp), %edi
addl %edi, %ebp
incq %rax
addq %r12, %rsi
cmpl %eax, %edx
jne 0x6744
movl 0x1c(%rsp), %edx
movq 0x68(%rsp), %r15
xorl %edx, %r15d
movq %rbp, %rdi
orl %edi, %r15d
movq 0x88(%rsp), %r8
cmovel %r8d, %edx
movl $0x1, %eax
testb $0x2, %cl
je 0x67e4
testl %edi, %edi
movq 0x20(%rsp), %r9
movq 0x60(%rsp), %rsi
je 0x67ee
movq 0x80(%rsp), %rax
addl %edi, %eax
movl %edx, %ecx
cltd
idivl %r11d
movl %ecx, %edx
jmp 0x67ee
movq 0x20(%rsp), %r9
movq 0x60(%rsp), %rsi
movl %r8d, %r15d
subl %eax, %r15d
leal 0x1(%r15), %edi
cmpl $-0x2, %r15d
movq %rsi, 0x60(%rsp)
jg 0x68df
movl 0x18(%rsp), %eax
subl %edx, %eax
js 0x68df
cmpl $-0x1, %r14d
sete %cl
orb 0xf(%rsp), %cl
jne 0x682f
movl %r14d, %ecx
subl %edi, %ecx
cmpl 0x18(%rsp), %ecx
jge 0x6aba
notl %r15d
cmpl %r15d, %eax
cmovbl %eax, %r15d
movl 0x18(%rsp), %ecx
subl %r15d, %ecx
movl %ecx, 0x98(%rsp)
movl %r15d, %eax
imull %r11d, %eax
cltq
leaq (%rax,%rax,8), %rax
movq 0x30(%rsp), %rsi
movq %rdi, 0x68(%rsp)
leaq (%rsi,%rax,4), %rdi
movl %ecx, %eax
imull %r11d, %eax
cltq
shlq $0x2, %rax
movl %edx, 0x1c(%rsp)
leaq (%rax,%rax,8), %rdx
movq %r9, %r12
callq 0x2190
movq 0x70(%rsp), %rsi
leaq (%rsi,%r15,4), %rdi
movslq 0x98(%rsp), %rdx
shlq $0x2, %rdx
callq 0x2190
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %r12, %r9
movq 0x90(%rsp), %r12
movq 0x88(%rsp), %r8
movq 0x38(%rsp), %r11
movq 0x48(%rsp), %r10
addl %r15d, %r8d
addl %r15d, %edi
testl %r14d, %r14d
leal (%r15,%r14), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovsl %ecx, %eax
addl 0x1c(%rsp), %r15d
movl %r15d, %edx
movl %eax, %r14d
testl %edi, %edi
js 0x6aba
movl %edx, 0x1c(%rsp)
cmpl %r8d, %edi
movq %rdi, 0x68(%rsp)
jg 0x6a92
movl %edi, %edx
incl %r8d
movq 0xb0(%rsp), %rcx
imulq %rdx, %rcx
addq 0x30(%rsp), %rcx
xorl %edi, %edi
movq %rdx, 0x98(%rsp)
movq %r8, 0x88(%rsp)
cmpl %r11d, %ebp
movl %r11d, %r8d
movq %rbp, 0xa0(%rsp)
cmovll %ebp, %r8d
testl %r8d, %r8d
je 0x69b1
movq %r9, %r12
xorl %r9d, %r9d
movq %rcx, %r10
movl %esi, %r11d
movl 0x10(%rsp), %ebp
imull %ebp, %r11d
addl %edi, %r11d
movslq %r11d, %r11
leaq (%r11,%r11,8), %r11
movq 0x58(%rsp), %r15
movl 0x20(%r15,%r11,4), %eax
movl %eax, 0x20(%r10)
movups (%r15,%r11,4), %xmm0
movups 0x10(%r15,%r11,4), %xmm1
movups %xmm1, 0x10(%r10)
movups %xmm0, (%r10)
movl 0x28(%rsp), %eax
xorl %esi, %eax
movl 0x8(%rsp), %r11d
xorl %edi, %r11d
orl %eax, %r11d
cmovel %edx, %r14d
cmovel %r9d, %r13d
incl %edi
cmpl %ebp, %edi
jne 0x69a3
incl %esi
xorl %edi, %edi
testb $0x2, 0x58(%r12)
je 0x69b6
addq $0x24, %r10
incl %r9d
cmpl %r9d, %r8d
jne 0x6941
jmp 0x69bd
xorl %r9d, %r9d
jmp 0x69c5
incl %r9d
movl 0x10(%rsp), %edi
movq 0x90(%rsp), %r12
movl %r13d, %eax
movl %r14d, %r10d
cmpl %esi, 0x28(%rsp)
setne %r11b
movl 0x8(%rsp), %ebp
movl %ebp, %r14d
subl %edi, %r14d
setl %bpl
orb %r11b, %bpl
leal (%r14,%r9), %r13d
movq 0x38(%rsp), %r11
cmpl %r11d, %r13d
cmovgel 0x80(%rsp), %r13d
testb %bpl, %bpl
movl %edx, %r14d
cmovnel %r10d, %r14d
cmovnel %eax, %r13d
cmpl %r11d, %r9d
jge 0x6a44
movslq %r9d, %rax
leaq (,%rax,4), %r9
leaq (%r9,%r9,8), %r9
movq 0x50(%rsp), %r10
subq %rax, %r10
movl $0x0, (%rcx,%r9)
movq (%rbx), %rax
movq %rax, 0x18(%rcx,%r9)
movl 0x8(%rbx), %eax
movl %eax, 0x20(%rcx,%r9)
addq $0x24, %r9
decq %r10
jne 0x6a23
movq 0xa0(%rsp), %rbp
subl %r8d, %ebp
cmpq 0x98(%rsp), %rdx
seta %al
movq 0x70(%rsp), %r9
movb (%r9,%rdx,4), %r8b
shlb $0x3, %al
andb $-0x9, %r8b
orb %al, %r8b
movb %r8b, (%r9,%rdx,4)
incq %rdx
addq 0xb0(%rsp), %rcx
movq 0x88(%rsp), %r8
cmpl %edx, %r8d
movq 0x20(%rsp), %r9
jne 0x6921
movq 0x60(%rsp), %rax
leal -0x1(%rax), %ebp
movq 0x68(%rsp), %rdi
leal -0x1(%rdi), %r8d
testl %eax, %eax
movq 0x48(%rsp), %r10
jg 0x66bc
movq 0x80(%rsp), %rbx
jmp 0x6b06
movl 0x28(%rsp), %ecx
cmpl %ecx, %esi
setg %al
cmpl 0xa0(%rsp), %ecx
setge %cl
orb %al, %cl
movq 0x80(%rsp), %rbx
jne 0x6aea
movl 0x8(%rsp), %eax
cmpl %r11d, %eax
movl %ebx, %r13d
cmovll %eax, %r13d
xorl %r14d, %r14d
movl %esi, %ebp
jmp 0x6b06
leal -0x1(%r15), %ebx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq 0x48(%rsp), %r10
movq %r15, %r11
movl 0x8(%rsp), %eax
cmpl %r11d, %eax
cmovgel %ebx, %eax
xorl %r12d, %r12d
cmpl %ebp, 0x28(%rsp)
cmovgl %r14d, %r12d
cmovgl %r13d, %eax
movl %eax, 0x8(%rsp)
cmpb $0x0, 0x14(%rsp)
je 0x6b3f
cmpl $-0x1, %r12d
je 0x6ff0
cmpl $-0x1, 0x8(%rsp)
je 0x6ff0
movl 0x7c(%rsp), %eax
testl %eax, %eax
movq 0x50(%rsp), %rdx
jne 0x6bdc
testl %ebp, %ebp
js 0x6bdc
movl %r12d, 0x28(%rsp)
movq %rbx, %r13
movq %r8, %r14
movq 0x10(%r9), %rax
testq %rax, %rax
je 0x6bb3
cmpq $0x0, 0x30(%rax)
je 0x6ba5
leal 0x1(%rbp), %ebx
xorl %r15d, %r15d
movb (%r10,%r15,4), %al
andb $0x8, %al
shrb $0x3, %al
movzbl %al, %edx
movq %r9, %rdi
movl %r15d, %esi
movq %r9, %r12
callq 0x6ff5
movq %r12, %r9
movq 0x48(%rsp), %r10
incq %r15
cmpq %r15, %rbx
jne 0x6b79
jmp 0x6bb3
cmpb $0x1, 0x20(%r9)
jne 0x6bb3
cmpq $0x0, 0x48(%rax)
jne 0x6b73
cmpb $0x0, 0x14(%rsp)
movq 0x38(%rsp), %r11
movq %r14, %r8
movq %r13, %rbx
movl 0x7c(%rsp), %eax
movl 0x28(%rsp), %r12d
movq 0x50(%rsp), %rdx
je 0x6bdc
notl %ebp
movq 0x40(%rsp), %rcx
addl %ebp, (%rcx)
testl %eax, %eax
jne 0x6e7c
testl %r8d, %r8d
js 0x6e7c
movq 0x10(%r9), %rax
testq %rax, %rax
je 0x6e93
cmpq $0x0, 0x38(%rax)
je 0x6e93
movl 0x10(%rsp), %edi
cmpl %r11d, %edi
movl %r11d, %r14d
cmovll %edi, %r14d
leaq 0x80(%r9), %r15
movl %r8d, %r8d
movq %rdx, %rax
imulq %r8, %rax
leaq (%rax,%rax,8), %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax,4), %r13
leaq (,%rdx,4), %rax
leaq (%rax,%rax,8), %rax
negq %rax
movq %rax, 0x28(%rsp)
movq %r8, %rbp
movq 0x20(%rsp), %rcx
movq 0x78(%rcx), %rsi
movq 0x10(%rcx), %rax
movq 0x18(%rcx), %rdx
callq *0x38(%rax)
testl %eax, %eax
je 0x6e8b
testl %r14d, %r14d
jle 0x6df9
movq %rbp, %rax
imulq 0x50(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x78(%rcx), %rsi
leaq (%rax,%rax,8), %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax,4), %rcx
xorl %eax, %eax
movq 0x38(%rsp), %r11
movslq %eax, %r8
leaq (%r8,%r8,4), %rdx
leaq (%rsi,%rdx,8), %rdi
shlq $0x2, %r8
leaq (%r8,%r8,8), %r8
leaq (%rcx,%r8), %rsi
addq %r13, %r8
xorl %r9d, %r9d
movl (%rdi,%r9,4), %r10d
movl %r10d, (%r8,%r9,4)
testl %r10d, %r10d
je 0x6cca
leaq 0x1(%r9), %r10
cmpq $0x5, %r9
movq %r10, %r9
jb 0x6cb0
movl 0x1c(%rdi), %r9d
andl $0x1, %r9d
movl 0x20(%rsi), %r8d
andl $-0x2, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
andl $0x6, %r9d
andl $-0x7, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
andl $0x8, %r9d
andl $-0x9, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
andl $0x10, %r9d
andl $-0x11, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movq 0x20(%rsp), %r9
movl 0x58(%r9), %r9d
shll $0x5, %r9d
xorl 0x1c(%rdi), %r9d
andl $0x20, %r9d
andl $-0x21, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
andl $0x40, %r9d
andl $-0x41, %r8d
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
movl $0x80, %r10d
andl %r10d, %r9d
andl $0xffffff7f, %r8d       # imm = 0xFFFFFF7F
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
movl $0xf00, %r10d           # imm = 0xF00
andl %r10d, %r9d
andl $0xfffff0ff, %r8d       # imm = 0xFFFFF0FF
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
shrl $0x3, %r9d
andl $0x1000, %r9d           # imm = 0x1000
andl $0xffffefff, %r8d       # imm = 0xFFFFEFFF
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x1c(%rdi), %r9d
shrl $0x3, %r9d
andl $0x6000, %r9d           # imm = 0x6000
andl $0xffff9fff, %r8d       # imm = 0xFFFF9FFF
orl %r9d, %r8d
movl %r8d, 0x20(%rsi)
movl 0x20(%rdi), %r8d
movl %r8d, 0x18(%rsi)
movl 0x24(%rdi), %r8d
movl %r8d, 0x1c(%rsi)
cmpb $0x2, 0x18(%rdi)
jne 0x6dde
cmpl %ebx, %eax
jge 0x6dde
movl $0xffffffff, 0x24(%rsi) # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rsi
movq 0x78(%rsi), %rsi
movsbl 0x18(%rsi,%rdx,8), %edx
addl %edx, %eax
cmpl %r14d, %eax
jl 0x6c93
jmp 0x6e00
xorl %eax, %eax
movq 0x38(%rsp), %r11
cmpl %r11d, %eax
jge 0x6e3f
movslq %eax, %rdx
leaq (,%rdx,4), %rax
leaq (%rax,%rax,8), %rax
movq 0x50(%rsp), %rcx
subq %rdx, %rcx
movl $0x0, (%r13,%rax)
movq (%r15), %rdx
movq %rdx, 0x18(%r13,%rax)
movl 0x8(%r15), %edx
movl %edx, 0x20(%r13,%rax)
addq $0x24, %rax
decq %rcx
jne 0x6e1c
cmpb $0x0, 0x14(%rsp)
movl 0x10(%rsp), %edi
je 0x6e51
movq 0x40(%rsp), %rax
incl (%rax)
leaq -0x1(%rbp), %r8
addq 0x28(%rsp), %r13
testq %rbp, %rbp
jg 0x6c45
movq 0x40(%rsp), %r15
movq 0x20(%rsp), %r9
movq 0x30(%rsp), %r13
movq 0x58(%rsp), %rsi
jmp 0x6f9d
testl %r8d, %r8d
jns 0x6e93
movq 0x30(%rsp), %r13
jmp 0x6f93
movq 0x38(%rsp), %r11
movq %rbp, %r8
movl %r8d, %ebx
notl %ebx
movl 0x18(%rsp), %r14d
addl %r14d, %ebx
leal 0x1(%r8), %ebp
movl %ebp, %eax
imull %r11d, %eax
cltq
leaq (%rax,%rax,8), %rax
movq 0x30(%rsp), %r13
leaq (,%rax,4), %rsi
addq %r13, %rsi
movl %ebx, %eax
imull %r11d, %eax
cltq
shlq $0x2, %rax
leaq (%rax,%rax,8), %rdx
movq %r13, %rdi
movq %r8, %r15
callq 0x2190
movl %r15d, %eax
movq 0x70(%rsp), %rdi
leaq (%rdi,%rax,4), %rsi
addq $0x4, %rsi
movslq %ebx, %rbx
leaq (,%rbx,4), %rdx
callq 0x2190
subl %ebp, %r12d
cmpl %r14d, %ebx
jge 0x6f8e
movl %r14d, %r10d
movq 0x20(%rsp), %rax
movq %rax, %r11
addq $0x80, %rax
movq 0x38(%rsp), %r9
movl %r9d, %esi
movq 0x50(%rsp), %rcx
shlq $0x2, %rcx
leaq (%rcx,%rcx,8), %rcx
movq %rcx, %rdx
imulq %rbx, %rdx
addq %r13, %rdx
addq $0x18, %rdx
shlq $0x2, %rsi
leaq (%rsi,%rsi,8), %r14
movq 0x58(%rsp), %rsi
movq 0x40(%rsp), %r15
testl %r9d, %r9d
jle 0x6f75
xorl %edi, %edi
movl $0x0, -0x18(%rdx,%rdi)
movq (%rax), %r8
movq %r8, (%rdx,%rdi)
movl 0x8(%rax), %r8d
movl %r8d, 0x8(%rdx,%rdi)
addq $0x24, %rdi
cmpq %rdi, %r14
jne 0x6f54
movq 0x70(%rsp), %rdi
movb $0x0, (%rdi,%rbx,4)
incq %rbx
addq %rcx, %rdx
cmpl %r10d, %ebx
jne 0x6f4d
movq %r11, %r9
jmp 0x6f9d
movq 0x20(%rsp), %r9
movq 0x58(%rsp), %rsi
movq 0x40(%rsp), %r15
movq (%r9), %rdi
movq %r9, %r14
callq 0xad24
movq 0xc0(%rsp), %rbx
movq %r13, 0x60(%r14,%rbx,8)
movq (%r14), %rdi
movq 0x48(%rsp), %rsi
callq 0xad24
movq 0x70(%rsp), %rax
movq %rax, 0x8(%r15,%rbx,8)
cmpb $0x0, 0x14(%rsp)
je 0x6fde
movl %r12d, (%r15)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%r15)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2210