// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/src/state.c
// Function: vterm_state_reset
void vterm_state_reset(VTermState *state, int hard)
{
  state->scrollregion_top = 0;
  state->scrollregion_bottom = -1;
  state->scrollregion_left = 0;
  state->scrollregion_right = -1;

  state->mode.keypad          = 0;
  state->mode.cursor          = 0;
  state->mode.autowrap        = 1;
  state->mode.insert          = 0;
  state->mode.newline         = 0;
  state->mode.alt_screen      = 0;
  state->mode.origin          = 0;
  state->mode.leftrightmargin = 0;
  state->mode.bracketpaste    = 0;
  state->mode.report_focus    = 0;

  state->mouse_flags = 0;

  state->vt->mode.ctrl8bit   = 0;

  for(int col = 0; col < state->cols; col++)
    if(col % 8 == 0)
      set_col_tabstop(state, col);
    else
      clear_col_tabstop(state, col);

  for(int row = 0; row < state->rows; row++)
    set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF);

  if(state->callbacks && state->callbacks->initpen)
    (*state->callbacks->initpen)(state->cbdata);

  vterm_state_resetpen(state);

  VTermEncoding *default_enc = state->vt->mode.utf8 ?
      vterm_lookup_encoding(ENC_UTF8,      'u') :
      vterm_lookup_encoding(ENC_SINGLE_94, 'B');

  for(int i = 0; i < 4; i++) {
    state->encoding[i].enc = default_enc;
    if(default_enc->init)
      (*default_enc->init)(default_enc, state->encoding[i].data);
  }

  state->gl_set = 0;
  state->gr_set = 1;
  state->gsingle_set = 0;

  state->protected_cell = 0;

  // Initialise the props
  settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, 1);
  settermprop_bool(state, VTERM_PROP_CURSORBLINK,   1);
  settermprop_int (state, VTERM_PROP_CURSORSHAPE,   VTERM_PROP_CURSORSHAPE_BLOCK);

  if(hard) {
    state->pos.row = 0;
    state->pos.col = 0;
    state->at_phantom = 0;

    VTermRect rect = { 0, state->rows, 0, state->cols };
    erase(state, rect, 0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x44(%rax)
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x48(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x50(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $-0x2, %cx
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $-0x3, %cx
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $-0x5, %cx
orw $0x4, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $-0x9, %cx
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $-0x11, %cx
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $0xfdff, %cx            # imm = 0xFDFF
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $0xfbff, %cx            # imm = 0xFBFF
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $0xefff, %cx            # imm = 0xEFFF
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $0xdfff, %cx            # imm = 0xDFFF
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %cx
andw $0xbfff, %cx            # imm = 0xBFFF
orw $0x0, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x84(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb 0x18(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x18(%rax)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jge 0xa0af
movl -0x10(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xa096
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0xa2a0
jmp 0xa0a2
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0xa2e0
jmp 0xa0a4
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xa06c
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0xa0e4
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
movl $0x1, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0xa320
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa0b6
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xa114
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x28(%rax)
je 0xa114
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x46b0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb 0x18(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa143
xorl %edi, %edi
movl $0x75, %esi
callq 0x2140
movq %rax, -0x40(%rbp)
jmp 0xa156
movl $0x1, %edi
movl $0x42, %esi
callq 0x2140
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0xa1c5
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
addq $0xb0, %rax
movslq -0x24(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa1b8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0xb0, %rsi
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
addq $0x8, %rsi
callq *%rax
jmp 0xa1ba
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa165
movq -0x8(%rbp), %rax
movl $0x0, 0x128(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x12c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x130(%rax)
movq -0x8(%rbp), %rax
movb 0x18c(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x18c(%rax)
movq -0x8(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0xa420
movq -0x8(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0xa420
movq -0x8(%rbp), %rdi
movl $0x7, %esi
movl $0x1, %edx
callq 0xa450
cmpl $0x0, -0xc(%rbp)
je 0xa297
movq -0x8(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x3c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x40(%rax)
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x34(%rbp), %rsi
movq -0x2c(%rbp), %rdx
xorl %ecx, %ecx
callq 0xa480
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)