// File: /workspace/github_c_makefile_star2_O2/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 $0xe8, %rsp
movq %r9, %rbx
movl %r8d, 0x1c(%rsp)
movl %edx, 0x20(%rsp)
movq %rdi, %r15
movslq 0x50(%rdi), %rax
movq %rax, 0xa0(%rsp)
movl 0x54(%rdi), %r13d
movl %esi, 0x84(%rsp)
movl %esi, %eax
movq 0x60(%rdi,%rax,8), %r12
movq %rax, 0x98(%rsp)
movq 0x8(%r9,%rax,8), %rax
movq %rax, 0x70(%rsp)
movslq %edx, %r14
movq %rcx, 0x28(%rsp)
movslq %ecx, %rbp
imulq $0x24, %rbp, %rsi
movq %rsi, 0x90(%rsp)
imulq %r14, %rsi
movq (%rdi), %rdi
callq 0x95f8
movq %rax, 0x40(%rsp)
movq (%r15), %rdi
movq %r14, 0xc8(%rsp)
leaq (,%r14,4), %rsi
callq 0x95f8
movq %rax, 0x68(%rsp)
movq 0xa0(%rsp), %rdx
decq %rdx
movl (%rbx), %eax
movl %eax, 0x30(%rsp)
movq %rbx, 0x58(%rsp)
movl 0x4(%rbx), %r14d
movslq %r13d, %rcx
movl %ecx, %eax
sarl $0x1f, %eax
andl %r13d, %eax
movl %eax, 0xb0(%rsp)
movq %rbp, 0x50(%rsp)
leal -0x1(%rbp), %eax
movq %rax, 0x78(%rsp)
movl 0x1c(%rsp), %eax
xorb $0x1, %al
movb %al, 0xf(%rsp)
movq %r15, 0x10(%rsp)
leaq 0x80(%r15), %rbp
leal 0x1(%rcx), %eax
movl %eax, 0xb4(%rsp)
leaq -0x24(%r12), %rax
movq %rax, 0xd0(%rsp)
imulq $-0x24, %rcx, %rax
movq %rax, 0xd8(%rsp)
movq %rcx, 0xb8(%rsp)
imulq $0x24, %rcx, %rax
movq %rax, 0xe0(%rsp)
pushq $-0x1
popq %r15
movl 0x20(%rsp), %eax
movl %eax, 0x24(%rsp)
movl %r15d, %ebx
movq %rdx, 0xa0(%rsp)
leal -0x1(%rax), %esi
testl %edx, %edx
js 0x58c3
movq %rsi, 0x38(%rsp)
movq %rax, 0x60(%rsp)
cmpq $0x0, 0x70(%rsp)
setne %al
movq 0x10(%rsp), %rcx
movb 0x58(%rcx), %cl
movl %ecx, %esi
shrb %sil
andb %al, %sil
movl %edx, 0xac(%rsp)
movl %edx, %eax
imulq $0x24, %rax, %rdx
addq $0x24, %rdx
imulq 0xb8(%rsp), %rdx
addq 0xd0(%rsp), %rdx
movq %rax, %r11
testl %r11d, %r11d
setns %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x5592
movl %r11d, %edi
movq 0x70(%rsp), %r8
testb $0x8, (%r8,%rdi,4)
je 0x5592
decq %r11
addq 0xd8(%rsp), %rdx
jmp 0x5566
xorl %r9d, %r9d
movq %r11, %rsi
cmpq %rax, %rsi
jg 0x5600
movq %r9, %r10
testb $0x2, %cl
je 0x55be
cmpq 0xa0(%rsp), %rsi
jge 0x55be
movq 0x70(%rsp), %rdi
testb $0x8, 0x4(%rdi,%rsi,4)
movl %r13d, %edi
jne 0x55ed
movq %rdx, %r8
movl 0xb4(%rsp), %edi
movq 0xb8(%rsp), %r9
testq %r9, %r9
jle 0x55e6
decq %r9
decl %edi
cmpl $0x0, (%r8)
leaq -0x24(%r8), %r8
je 0x55d0
jmp 0x55ed
movl 0xb0(%rsp), %edi
movq %r10, %r9
addl %edi, %r9d
incq %rsi
addq 0xe0(%rsp), %rdx
jmp 0x5598
movl 0x24(%rsp), %eax
movq 0x60(%rsp), %rdx
xorl %eax, %edx
orl %r9d, %edx
movq 0x38(%rsp), %rsi
cmovel %esi, %eax
movl %eax, 0x24(%rsp)
pushq $0x1
popq %rax
testb $0x2, %cl
je 0x5634
testl %r9d, %r9d
je 0x5634
movq 0x78(%rsp), %rax
addl %r9d, %eax
cltd
idivl 0x28(%rsp)
movl %esi, %edi
subl %eax, %edi
leal 0x1(%rdi), %edx
cmpl $-0x2, %edi
movq %r11, 0xc0(%rsp)
jg 0x5720
movl 0x20(%rsp), %eax
subl 0x24(%rsp), %eax
js 0x5720
cmpl $-0x1, %ebx
sete %cl
orb 0xf(%rsp), %cl
jne 0x5674
movl %ebx, %ecx
subl %edx, %ecx
cmpl 0x20(%rsp), %ecx
jge 0x5896
notl %edi
cmpl %edi, %eax
cmovbl %eax, %edi
movq %rdi, 0x88(%rsp)
movl 0x20(%rsp), %r8d
subl %edi, %r8d
movl %r8d, 0xa8(%rsp)
movl %edi, %eax
movq 0x28(%rsp), %rcx
imull %ecx, %eax
cltq
imulq $0x24, %rax, %rdi
movq 0x40(%rsp), %rsi
addq %rsi, %rdi
movl %r8d, %eax
imull %ecx, %eax
cltq
movq %rdx, 0x60(%rsp)
imulq $0x24, %rax, %rdx
movq %r9, 0x48(%rsp)
callq 0x2190
movq 0x68(%rsp), %rsi
movq 0x88(%rsp), %rax
leaq (%rsi,%rax,4), %rdi
movslq 0xa8(%rsp), %rdx
shlq $0x2, %rdx
callq 0x2190
movq 0x48(%rsp), %r9
movq 0x60(%rsp), %rdx
movq 0xc0(%rsp), %r11
movq 0x38(%rsp), %rsi
movq 0x88(%rsp), %rdi
addl %edi, %esi
addl %edi, %edx
testl %ebx, %ebx
leal (%rdi,%rbx), %eax
pushq $-0x1
popq %rcx
cmovsl %ecx, %eax
addl 0x24(%rsp), %edi
movl %edi, 0x24(%rsp)
movl %eax, %ebx
testl %edx, %edx
js 0x5896
movq %rdx, 0x60(%rsp)
movl %edx, %eax
movslq %esi, %rcx
movq %rcx, 0x38(%rsp)
movq 0x90(%rsp), %rdx
imulq %rax, %rdx
addq 0x40(%rsp), %rdx
xorl %r8d, %r8d
movq %rax, 0x88(%rsp)
movq %rax, %rsi
movl %r11d, %edi
cmpq 0x38(%rsp), %rsi
jg 0x5888
movq 0x28(%rsp), %rax
cmpl %eax, %r9d
movl %eax, %r10d
cmovll %r9d, %r10d
subl %r10d, %r9d
movq %r9, 0x48(%rsp)
xorl %r9d, %r9d
movq %rdx, %r11
cmpl %r9d, %r10d
je 0x57ef
movl %edi, %ecx
imull %r13d, %ecx
addl %r8d, %ecx
movslq %ecx, %rcx
imulq $0x24, %rcx, %rcx
movl 0x20(%r12,%rcx), %eax
movl %eax, 0x20(%r11)
movups (%r12,%rcx), %xmm0
movups 0x10(%r12,%rcx), %xmm1
movups %xmm1, 0x10(%r11)
movups %xmm0, (%r11)
movl 0x30(%rsp), %eax
xorl %edi, %eax
movl %r14d, %ecx
xorl %r8d, %ecx
orl %eax, %ecx
cmovel %esi, %ebx
cmovel %r9d, %r15d
incl %r8d
cmpl %r13d, %r8d
jne 0x57e0
incl %edi
xorl %r8d, %r8d
movq 0x10(%rsp), %rax
testb $0x2, 0x58(%rax)
je 0x57e9
incl %r9d
addq $0x24, %r11
jmp 0x5781
incl %r9d
movl %r13d, %r8d
movl %ebx, %eax
cmpl %edi, 0x30(%rsp)
setne %cl
movl %r14d, %r11d
subl %r8d, %r11d
setl %r10b
orb %cl, %r10b
leal (%r11,%r9), %r11d
movl %esi, %ebx
cmovnel %eax, %ebx
movslq %r9d, %r9
imulq $0x24, %r9, %rcx
cmpq 0x50(%rsp), %r9
jge 0x5839
andl $0x0, (%rdx,%rcx)
movq (%rbp), %rax
movq %rax, 0x18(%rdx,%rcx)
movl 0x8(%rbp), %eax
movl %eax, 0x20(%rdx,%rcx)
incq %r9
addq $0x24, %rcx
jmp 0x5815
cmpl 0x28(%rsp), %r11d
cmovgel 0x78(%rsp), %r11d
testb %r10b, %r10b
cmovel %r11d, %r15d
cmpq 0x88(%rsp), %rsi
seta %al
movq 0x68(%rsp), %r9
movb (%r9,%rsi,4), %cl
shlb $0x3, %al
andb $-0x9, %cl
orb %al, %cl
movb %cl, (%r9,%rsi,4)
incq %rsi
addq 0x90(%rsp), %rdx
movq 0xc0(%rsp), %r11
movq 0x48(%rsp), %r9
jmp 0x5759
leal -0x1(%r11), %edx
movq 0x60(%rsp), %rax
jmp 0x5513
movl 0x30(%rsp), %ecx
cmpl %ecx, %r11d
setg %al
cmpl 0xac(%rsp), %ecx
setge %cl
orb %al, %cl
jne 0x58c6
cmpl 0x28(%rsp), %r14d
movq 0x78(%rsp), %rcx
movl %ecx, %r15d
cmovll %r14d, %r15d
xorl %ebx, %ebx
jmp 0x58c6
movl %edx, %r11d
cmpl 0x28(%rsp), %r14d
cmovgel 0x78(%rsp), %r14d
xorl %eax, %eax
cmpl %r11d, 0x30(%rsp)
cmovgl %ebx, %eax
cmovgl %r15d, %r14d
movl %r14d, 0x38(%rsp)
cmpb $0x0, 0x1c(%rsp)
je 0x58ff
cmpl $-0x1, %eax
je 0x5d30
cmpl $-0x1, 0x38(%rsp)
je 0x5d30
movl %eax, 0x48(%rsp)
movl 0x84(%rsp), %eax
testl %eax, %eax
movq 0x58(%rsp), %r14
jne 0x599a
testl %r11d, %r11d
js 0x599a
movq %rsi, %r14
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x597e
cmpq $0x0, 0x30(%rax)
je 0x596c
movl %r11d, %eax
movq %rax, 0x30(%rsp)
xorl %ebx, %ebx
cmpq 0x30(%rsp), %rbx
ja 0x597e
movq 0x70(%rsp), %rax
movb (%rax,%rbx,4), %al
andb $0x8, %al
shrb $0x3, %al
movzbl %al, %edx
movq 0x10(%rsp), %rdi
movl %ebx, %esi
movq %r11, %r15
callq 0x5d51
movq %r15, %r11
incq %rbx
jmp 0x593e
movq 0x10(%rsp), %rcx
cmpb $0x1, 0x20(%rcx)
jne 0x597e
cmpq $0x0, 0x48(%rax)
jne 0x5934
cmpb $0x0, 0x1c(%rsp)
movq %r14, %rsi
movq 0x58(%rsp), %r14
movl 0x84(%rsp), %eax
je 0x599a
notl %r11d
addl %r11d, (%r14)
testl %eax, %eax
jne 0x5be9
testl %esi, %esi
js 0x5be9
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x5bfd
cmpq $0x0, 0x38(%rax)
je 0x5bfd
movq 0x28(%rsp), %rax
cmpl %eax, %r13d
movl %eax, %ebx
cmovll %r13d, %ebx
movl %esi, %esi
movq 0x50(%rsp), %rcx
movq %rcx, %rax
imulq %rsi, %rax
imulq $0x24, %rax, %r14
addq 0x40(%rsp), %r14
imulq $-0x24, %rcx, %rax
movq %rax, 0x30(%rsp)
movq %rsi, %r15
movq 0x10(%rsp), %rcx
movq 0x78(%rcx), %rsi
movq 0x10(%rcx), %rax
movq 0x18(%rcx), %rdx
movl %r13d, %edi
callq *0x38(%rax)
testl %eax, %eax
je 0x5bfa
movq %r15, %r11
movq %r15, %rax
imulq 0x50(%rsp), %rax
imulq $0x24, %rax, %rax
addq 0x40(%rsp), %rax
xorl %ecx, %ecx
movl $0x80, %r15d
cmpl %ebx, %ecx
jge 0x5b95
movslq %ecx, %rsi
imulq $0x28, %rsi, %rdx
movq 0x10(%rsp), %rdi
movq 0x78(%rdi), %rdi
addq %rdx, %rdi
imulq $0x24, %rsi, %r8
leaq (%rax,%r8), %rsi
addq %r14, %r8
xorl %r9d, %r9d
cmpq $0x6, %r9
je 0x5a73
movl (%rdi,%r9,4), %r10d
movl %r10d, (%r8,%r9,4)
incq %r9
testl %r10d, %r10d
jne 0x5a5d
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 0x10(%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
andl %r15d, %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 0x5b80
cmpl 0x78(%rsp), %ecx
jge 0x5b80
orl $-0x1, 0x24(%rsi)
movq 0x10(%rsp), %rsi
movq 0x78(%rsi), %rsi
movsbl 0x18(%rsi,%rdx), %edx
addl %edx, %ecx
jmp 0x5a34
movslq %ecx, %rax
imulq $0x24, %rax, %rcx
cmpq 0x50(%rsp), %rax
jge 0x5bc2
andl $0x0, (%r14,%rcx)
movq (%rbp), %rdx
movq %rdx, 0x18(%r14,%rcx)
movl 0x8(%rbp), %edx
movl %edx, 0x20(%r14,%rcx)
incq %rax
addq $0x24, %rcx
jmp 0x5b9c
cmpb $0x0, 0x1c(%rsp)
je 0x5bd0
movq 0x58(%rsp), %rax
incl (%rax)
leaq -0x1(%r11), %rsi
addq 0x30(%rsp), %r14
testq %r11, %r11
jg 0x59f5
movq 0x58(%rsp), %r14
jmp 0x5bed
testl %esi, %esi
jns 0x5bfd
movq 0x98(%rsp), %r13
jmp 0x5cd7
movq %r15, %rsi
movl %esi, %r14d
notl %r14d
addl 0x20(%rsp), %r14d
leal 0x1(%rsi), %eax
movl %eax, 0x50(%rsp)
movq 0x28(%rsp), %r15
imull %r15d, %eax
cltq
movq %rsi, %rbx
imulq $0x24, %rax, %rsi
movq 0x40(%rsp), %r13
addq %r13, %rsi
movl %r14d, %eax
imull %r15d, %eax
cltq
imulq $0x24, %rax, %rdx
movq %r13, %rdi
callq 0x2190
movl %ebx, %eax
movq 0x68(%rsp), %rdi
leaq (%rdi,%rax,4), %rsi
addq $0x4, %rsi
movslq %r14d, %r14
leaq (,%r14,4), %rdx
callq 0x2190
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
movq 0x90(%rsp), %rax
imulq %r14, %rax
addq %r13, %rax
addq $0x18, %rax
imulq $0x24, %r15, %rcx
movq 0x98(%rsp), %r13
movq 0xc8(%rsp), %rdi
cmpq %rdi, %r14
jge 0x5cca
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x5cb3
andl $0x0, -0x18(%rax,%rdx)
movq (%rbp), %rsi
movq %rsi, (%rax,%rdx)
movl 0x8(%rbp), %esi
movl %esi, 0x8(%rax,%rdx)
addq $0x24, %rdx
jmp 0x5c94
movq 0x68(%rsp), %rdx
movb $0x0, (%rdx,%r14,4)
incq %r14
addq 0x90(%rsp), %rax
jmp 0x5c8d
movl 0x50(%rsp), %eax
subl %eax, 0x48(%rsp)
movq 0x58(%rsp), %r14
movq 0x10(%rsp), %rbx
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x9663
movq 0x40(%rsp), %rax
movq %rax, 0x60(%rbx,%r13,8)
movq (%rbx), %rdi
movq 0x70(%rsp), %rsi
callq 0x9663
movq 0x68(%rsp), %rax
movq %rax, 0x8(%r14,%r13,8)
cmpb $0x0, 0x1c(%rsp)
je 0x5d1e
movl 0x48(%rsp), %eax
movl %eax, (%r14)
movl 0x38(%rsp), %eax
movl %eax, 0x4(%r14)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x92b9(%rip), %rax      # 0xeff0
movq (%rax), %rcx
leaq 0x4907(%rip), %rdi      # 0xa648
pushq $0x2f
popq %rsi
pushq $0x1
popq %rdx
callq 0x21e0
callq 0x2060