// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/state.c
// Function: vterm_state_set_termprop
int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val)
{
  /* Only store the new value of the property if usercode said it was happy.
   * This is especially important for altscreen switching */
  if(state->callbacks && state->callbacks->settermprop)
    if(!(*state->callbacks->settermprop)(prop, val, state->cbdata))
      return 0;

  switch(prop) {
  case VTERM_PROP_TITLE:
  case VTERM_PROP_ICONNAME:
    // we don't store these, just transparently pass through
    return 1;
  case VTERM_PROP_CURSORVISIBLE:
    state->mode.cursor_visible = val->boolean;
    return 1;
  case VTERM_PROP_CURSORBLINK:
    state->mode.cursor_blink = val->boolean;
    return 1;
  case VTERM_PROP_CURSORSHAPE:
    state->mode.cursor_shape = val->number;
    return 1;
  case VTERM_PROP_REVERSE:
    state->mode.screen = val->boolean;
    return 1;
  case VTERM_PROP_ALTSCREEN:
    state->mode.alt_screen = val->boolean;
    state->lineinfo = state->lineinfos[state->mode.alt_screen ? BUFIDX_ALTSCREEN : BUFIDX_PRIMARY];
    if(state->mode.alt_screen) {
      VTermRect rect = {
        .start_row = 0,
        .start_col = 0,
        .end_row = state->rows,
        .end_col = state->cols,
      };
      erase(state, rect, 0);
    }
    return 1;
  case VTERM_PROP_MOUSE:
    state->mouse_flags = 0;
    if(val->number)
      state->mouse_flags |= MOUSE_WANT_CLICK;
    if(val->number == VTERM_PROP_MOUSE_DRAG)
      state->mouse_flags |= MOUSE_WANT_DRAG;
    if(val->number == VTERM_PROP_MOUSE_MOVE)
      state->mouse_flags |= MOUSE_WANT_MOVE;
    return 1;
  case VTERM_PROP_FOCUSREPORT:
    state->mode.report_focus = val->boolean;
    return 1;

  case VTERM_N_PROPS:
    return 0;
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x6bdd
movq 0x38(%rax), %rax
testq %rax, %rax
je 0x6bdd
movq 0x10(%r14), %rdx
movl %r12d, %edi
movq %r15, %rsi
callq *%rax
testl %eax, %eax
je 0x6c13
decl %r12d
cmpl $0x9, %r12d
ja 0x6c13
movl $0x1, %ebx
leaq 0x4abe(%rip), %rax      # 0xb6b0
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl (%r15), %eax
movl 0xac(%r14), %ecx
shll $0x5, %eax
andl $0x20, %eax
andl $-0x21, %ecx
jmp 0x6cae
xorl %ebx, %ebx
jmp 0x6cb8
movl (%r15), %eax
movl 0xac(%r14), %ecx
shll $0x6, %eax
andl $0x40, %eax
andl $-0x41, %ecx
jmp 0x6cae
movl (%r15), %eax
andl $0x1, %eax
shll $0xe, %eax
movl $0xffffbfff, %ecx       # imm = 0xFFFFBFFF
jmp 0x6ca7
movl (%r15), %eax
andl $0x3, %eax
shll $0x7, %eax
movl $0xfffffe7f, %ecx       # imm = 0xFFFFFE7F
jmp 0x6ca7
movl (%r15), %eax
andl $0x1, %eax
movl %eax, %ecx
shll $0x9, %ecx
movl $0xfffffdff, %edx       # imm = 0xFFFFFDFF
andl 0xac(%r14), %edx
orl %ecx, %edx
movw %dx, 0xac(%r14)
movq 0x60(%r14,%rax,8), %rax
movq %rax, 0x70(%r14)
testl %ecx, %ecx
je 0x6cb8
movl 0x30(%r14), %esi
movl 0x34(%r14), %edx
shlq $0x20, %rsi
shlq $0x20, %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6ae6
jmp 0x6cb8
movl (%r15), %eax
andl $0x1, %eax
shll $0xb, %eax
movl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
andl 0xac(%r14), %ecx
orl %eax, %ecx
movw %cx, 0xac(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x0, 0x84(%r14)
xorl %eax, %eax
cmpl $0x0, (%r15)
setne %al
movl %eax, 0x84(%r14)
cmpl $0x2, (%r15)
jne 0x6cf1
orl $0x2, %eax
movl %eax, 0x84(%r14)
cmpl $0x3, (%r15)
jne 0x6cb8
orb $0x4, 0x84(%r14)
jmp 0x6cb8