// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf0, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq %r9, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl 0x54(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x60(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x10(%rbp), %rax
imulq $0x24, %rax, %rsi
movslq -0x14(%rbp), %rax
imulq %rax, %rsi
callq 0x11a20
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x10(%rbp), %rsi
shlq $0x2, %rsi
callq 0x11a20
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq 0xa496(%rip), %rax      # 0x1336c
movq %rax, -0x60(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x93cf
movl -0x4c(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movb 0x58(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xd1(%rbp)
je 0x8f47
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0xd1(%rbp)
je 0x8f47
xorl %eax, %eax
cmpl $0x0, -0x4c(%rbp)
movb %al, -0xd1(%rbp)
jl 0x8f47
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb (%rax,%rcx,4), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xd1(%rbp)
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x8f53
jmp 0x8f5e
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8ef0
movl -0x4c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x68(%rbp), %eax
jg 0x8fe6
movq -0x8(%rbp), %rax
movb 0x58(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8fc1
movl -0x74(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x8fc1
movq -0x38(%rbp), %rax
movl -0x74(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx,4), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8fc1
movl -0x28(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x8fd9
movq -0x30(%rbp), %rdi
movl -0x74(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x9a80
addl -0x70(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x8fdb
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x8f71
movl -0x64(%rbp), %eax
movl -0x50(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x8fff
cmpl $0x0, -0x70(%rbp)
jne 0x8fff
movl -0x50(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movb 0x58(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x9048
cmpl $0x0, -0x70(%rbp)
je 0x902d
movl -0x70(%rbp), %eax
addl -0x14(%rbp), %eax
subl $0x1, %eax
cltd
idivl -0x14(%rbp)
movl %eax, -0xd8(%rbp)
jmp 0x903a
movl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x903a
movl -0xd8(%rbp), %eax
movl %eax, -0xdc(%rbp)
jmp 0x9055
movl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x9055
movl -0xdc(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x50(%rbp), %eax
subl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x10(%rbp), %eax
subl -0x64(%rbp), %eax
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x80(%rbp)
jge 0x918a
cmpl $0x0, -0x88(%rbp)
jl 0x918a
testb $0x1, -0x15(%rbp)
je 0x90be
cmpl $-0x1, -0x60(%rbp)
je 0x90be
movl -0x60(%rbp), %eax
subl -0x80(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x918a
xorl %eax, %eax
subl -0x80(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jle 0x90e3
movl -0x88(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x10(%rbp), %eax
subl -0x8c(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0x40(%rbp), %rdi
movl -0x8c(%rbp), %eax
imull -0x14(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movl -0x90(%rbp), %eax
imull -0x14(%rbp), %eax
cltq
imulq $0x24, %rax, %rdx
callq 0x21b0
movq -0x48(%rbp), %rdi
movslq -0x8c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x48(%rbp), %rsi
movslq -0x90(%rbp), %rdx
shlq $0x2, %rdx
callq 0x21b0
movl -0x8c(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x8c(%rbp), %eax
addl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x8c(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x60(%rbp)
jl 0x917e
movl -0x8c(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x8c(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x80(%rbp)
jge 0x91c5
movl -0x6c(%rbp), %eax
cmpl -0x58(%rbp), %eax
jg 0x91c0
movl -0x58(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x91c0
movl $0x0, -0x60(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x91be
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x91c0
jmp 0x93cf
movl -0x80(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jg 0x93b8
movl -0x70(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x91f0
movl -0x14(%rbp), %eax
movl %eax, -0xe0(%rbp)
jmp 0x91f9
movl -0x70(%rbp), %eax
movl %eax, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %ecx
movl -0x70(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x70(%rbp)
movl $0x0, -0x98(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x92fe
movq -0x40(%rbp), %rdi
movl -0x50(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0x98(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movl -0x4c(%rbp), %eax
imull -0x28(%rbp), %eax
addl -0x84(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rsi
movl $0x24, %edx
callq 0x2130
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jne 0x928a
movl -0x54(%rbp), %eax
cmpl -0x84(%rbp), %eax
jne 0x928a
movl -0x50(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x92db
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movb 0x58(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x92d1
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x92fe
movl $0x0, -0x84(%rbp)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
movl -0x94(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x921d
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jne 0x933c
movl -0x54(%rbp), %eax
cmpl -0x84(%rbp), %eax
jl 0x933c
movl -0x50(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x54(%rbp), %eax
subl -0x84(%rbp), %eax
addl -0x98(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x933a
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x933c
jmp 0x933e
movl -0x98(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x937d
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x50(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0x98(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rsi
callq 0x9af0
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x933e
movl -0x50(%rbp), %eax
cmpl -0x80(%rbp), %eax
setg %al
andb $0x1, %al
movzbl %al, %edx
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
movb %dl, %sil
movb (%rax,%rcx,4), %dl
andb $0x1, %sil
shlb $0x3, %sil
andb $-0x9, %dl
orb %sil, %dl
movb %dl, (%rax,%rcx,4)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x91d1
movl -0x6c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x80(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x8ee0
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x93f7
movl $0x0, -0x60(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x93f5
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x93f7
testb $0x1, -0x15(%rbp)
je 0x9426
cmpl $-0x1, -0x60(%rbp)
je 0x9409
cmpl $-0x1, -0x5c(%rbp)
jne 0x9426
movq 0xebe8(%rip), %rax      # 0x17ff8
movq (%rax), %rdi
leaq 0x9f5a(%rip), %rsi      # 0x13374
movb $0x0, %al
callq 0x2120
callq 0x2060
cmpl $0x0, -0x4c(%rbp)
jl 0x9501
cmpl $0x0, -0xc(%rbp)
jne 0x9501
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9454
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x30(%rax)
jne 0x947c
movq -0x8(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x94e9
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x94e9
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x48(%rax)
je 0x94e9
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x94e7
movq -0x38(%rbp), %rax
movslq -0x9c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x9c(%rbp), %esi
movq -0xa8(%rbp), %rax
movb (%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x9b30
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x9486
jmp 0x94e9
testb $0x1, -0x15(%rbp)
je 0x94ff
movl -0x4c(%rbp), %edx
addl $0x1, %edx
movq -0x20(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
jmp 0x9501
cmpl $0x0, -0x50(%rbp)
jl 0x98e9
cmpl $0x0, -0xc(%rbp)
jne 0x98e9
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x98e9
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x38(%rax)
je 0x98e9
jmp 0x9539
cmpl $0x0, -0x50(%rbp)
jl 0x98e7
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rax), %rax
movl -0x28(%rbp), %edi
movq -0x8(%rbp), %rcx
movq 0x78(%rcx), %rsi
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rdx
callq *%rax
cmpl $0x0, %eax
jne 0x956e
jmp 0x98e7
movl -0x50(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl $0x0, -0xac(%rbp)
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %ecx
xorl %eax, %eax
cmpl -0x28(%rbp), %ecx
movb %al, -0xe1(%rbp)
jge 0x95b0
movl -0xac(%rbp), %eax
cmpl -0x14(%rbp), %eax
setl %al
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x95bf
jmp 0x9884
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0xac(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x40(%rbp), %rax
movl -0xb0(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl -0xac(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xc4(%rbp)
cmpl $0x6, -0xc4(%rbp)
jge 0x965f
movq -0xb8(%rbp), %rax
movslq -0xc4(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0xc0(%rbp), %rax
movslq -0xc4(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0xb8(%rbp), %rax
movslq -0xc4(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x964c
jmp 0x965f
jmp 0x964e
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x960b
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
andl $-0x2, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl %edx
andl $0x3, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x3, %edx
shll %edx
andl $-0x7, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x3, %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0x3, %edx
andl $-0x9, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x4, %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0x4, %edx
andl $-0x11, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x5, %edx
andl $0x1, %edx
movq -0x8(%rbp), %rax
movb 0x58(%rax), %al
andb $0x1, %al
movzbl %al, %eax
xorl %eax, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0x5, %edx
andl $-0x21, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x6, %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0x6, %edx
andl $-0x41, %ecx
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x7, %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0x7, %edx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x8, %edx
andl $0xf, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0xf, %edx
shll $0x8, %edx
andl $0xfffff0ff, %ecx       # imm = 0xFFFFF0FF
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0xf, %edx
andl $0x1, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x1, %edx
shll $0xc, %edx
andl $0xffffefff, %ecx       # imm = 0xFFFFEFFF
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xb8(%rbp), %rax
movl 0x1c(%rax), %edx
shrl $0x10, %edx
andl $0x3, %edx
movq -0xc0(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x3, %edx
shll $0xd, %edx
andl $0xffff9fff, %ecx       # imm = 0xFFFF9FFF
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0xc0(%rbp), %rax
movq -0xb8(%rbp), %rcx
movl 0x20(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0xc0(%rbp), %rax
movq -0xb8(%rbp), %rcx
movl 0x24(%rcx), %ecx
movl %ecx, 0x1c(%rax)
movq -0xb8(%rbp), %rax
movsbl 0x18(%rax), %eax
cmpl $0x2, %eax
jne 0x9857
movl -0xac(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x9857
movq -0xc0(%rbp), %rax
movl $0xffffffff, 0x24(%rax) # imm = 0xFFFFFFFF
jmp 0x9859
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0xac(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movsbl 0x18(%rax), %eax
addl -0xac(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x958b
jmp 0x9886
movl -0xac(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x98c8
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0xb0(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0xac(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rsi
callq 0x9af0
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x9886
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
testb $0x1, -0x15(%rbp)
je 0x98e2
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x9539
jmp 0x98e9
cmpl $0x0, -0x50(%rbp)
jl 0x9a1c
movl -0x10(%rbp), %eax
subl -0x50(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xc8(%rbp)
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x50(%rbp), %eax
addl $0x1, %eax
imull -0x14(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rsi
movl -0xc8(%rbp), %eax
imull -0x14(%rbp), %eax
cltq
imulq $0x24, %rax, %rdx
callq 0x21b0
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x50(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movslq -0xc8(%rbp), %rdx
shlq $0x2, %rdx
callq 0x21b0
movl -0x50(%rbp), %ecx
addl $0x1, %ecx
movl -0x60(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x60(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x9a1a
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x99c5
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x50(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0xcc(%rbp), %eax
cltq
imulq $0x24, %rax, %rax
addq %rax, %rsi
callq 0x9af0
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x9986
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
movb -0xd0(%rbp), %dl
andb $-0x2, %dl
orb $0x0, %dl
movb %dl, -0xd0(%rbp)
movb -0xd0(%rbp), %dl
andb $-0x7, %dl
orb $0x0, %dl
movb %dl, -0xd0(%rbp)
movb -0xd0(%rbp), %dl
andb $-0x9, %dl
orb $0x0, %dl
movb %dl, -0xd0(%rbp)
movl -0xd0(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x9970
jmp 0x9a1c
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x11ae0
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, 0x60(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x11ae0
movq -0x48(%rbp), %rdx
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
testb $0x1, -0x15(%rbp)
je 0x9a6f
movq -0x20(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)