// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/src/state.c
// Function: set_dec_mode
static void set_dec_mode(VTermState *state, int num, int val)
{
  switch(num) {
  case 1:
    state->mode.cursor = val;
    break;

  case 5: // DECSCNM - screen mode
    settermprop_bool(state, VTERM_PROP_REVERSE, val);
    break;

  case 6: // DECOM - origin mode
    {
      VTermPos oldpos = state->pos;
      state->mode.origin = val;
      state->pos.row = state->mode.origin ? state->scrollregion_top : 0;
      state->pos.col = state->mode.origin ? SCROLLREGION_LEFT(state) : 0;
      updatecursor(state, &oldpos, 1);
    }
    break;

  case 7:
    state->mode.autowrap = val;
    break;

  case 12:
    settermprop_bool(state, VTERM_PROP_CURSORBLINK, val);
    break;

  case 25:
    settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val);
    break;

  case 69: // DECVSSM - vertical split screen mode
           // DECLRMM - left/right margin mode
    state->mode.leftrightmargin = val;
    if(val) {
      // Setting DECVSSM must clear doublewidth/doubleheight state of every line
      for(int row = 0; row < state->rows; row++)
        set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF);
    }

    break;

  case 1000:
  case 1002:
  case 1003:
    settermprop_int(state, VTERM_PROP_MOUSE,
        !val          ? VTERM_PROP_MOUSE_NONE  :
        (num == 1000) ? VTERM_PROP_MOUSE_CLICK :
        (num == 1002) ? VTERM_PROP_MOUSE_DRAG  :
                        VTERM_PROP_MOUSE_MOVE);
    break;

  case 1004:
    settermprop_bool(state, VTERM_PROP_FOCUSREPORT, val);
    state->mode.report_focus = val;
    break;

  case 1005:
    state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10;
    break;

  case 1006:
    state->mouse_protocol = val ? MOUSE_SGR : MOUSE_X10;
    break;

  case 1015:
    state->mouse_protocol = val ? MOUSE_RXVT : MOUSE_X10;
    break;

  case 1047:
    settermprop_bool(state, VTERM_PROP_ALTSCREEN, val);
    break;

  case 1048:
    savecursor(state, val);
    break;

  case 1049:
    settermprop_bool(state, VTERM_PROP_ALTSCREEN, val);
    savecursor(state, val);
    break;

  case 2004:
    state->mode.bracketpaste = val;
    break;

  default:
    DEBUG_LOG("libvterm: Unknown DEC mode %d\n", num);
    return;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
subl $0x1, %eax
je 0xffad
jmp 0xfeb3
movl -0x20(%rbp), %eax
subl $0x5, %eax
je 0xffd8
jmp 0xfec1
movl -0x20(%rbp), %eax
subl $0x6, %eax
je 0xffee
jmp 0xfecf
movl -0x20(%rbp), %eax
subl $0x7, %eax
je 0x100d3
jmp 0xfedd
movl -0x20(%rbp), %eax
subl $0xc, %eax
je 0x100ff
jmp 0xfeeb
movl -0x20(%rbp), %eax
subl $0x19, %eax
je 0x10115
jmp 0xfef9
movl -0x20(%rbp), %eax
subl $0x45, %eax
je 0x1012b
jmp 0xff07
movl -0x20(%rbp), %eax
subl $0x3e8, %eax            # imm = 0x3E8
je 0x10195
jmp 0xff17
movl -0x20(%rbp), %eax
addl $0xfffffc16, %eax       # imm = 0xFFFFFC16
subl $0x2, %eax
jb 0x10195
jmp 0xff2a
movl -0x20(%rbp), %eax
subl $0x3ec, %eax            # imm = 0x3EC
je 0x101f2
jmp 0xff3a
movl -0x20(%rbp), %eax
subl $0x3ed, %eax            # imm = 0x3ED
je 0x10230
jmp 0xff4a
movl -0x20(%rbp), %eax
subl $0x3ee, %eax            # imm = 0x3EE
je 0x1024f
jmp 0xff5a
movl -0x20(%rbp), %eax
subl $0x3f7, %eax            # imm = 0x3F7
je 0x1026e
jmp 0xff6a
movl -0x20(%rbp), %eax
subl $0x417, %eax            # imm = 0x417
je 0x1028a
jmp 0xff7a
movl -0x20(%rbp), %eax
subl $0x418, %eax            # imm = 0x418
je 0x1029d
jmp 0xff8a
movl -0x20(%rbp), %eax
subl $0x419, %eax            # imm = 0x419
je 0x102ab
jmp 0xff9a
movl -0x20(%rbp), %eax
subl $0x7d4, %eax            # imm = 0x7D4
je 0x102ca
jmp 0x102f4
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw %dx
andw $-0x3, %cx
orw %dx, %cx
movw %cx, 0xac(%rax)
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x6, %esi
callq 0xa420
jmp 0x102f6
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw $0xa, %dx
andw $0xfbff, %cx            # imm = 0xFBFF
orw %dx, %cx
movw %cx, 0xac(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0xa, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x10049
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x10050
xorl %eax, %eax
movl %eax, -0x24(%rbp)
jmp 0x10050
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0xa, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x100ab
movq -0x8(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x1009c
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x100a3
xorl %eax, %eax
movl %eax, -0x28(%rbp)
jmp 0x100a3
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x100b2
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0x100b2
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0xf9d0
jmp 0x102f6
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw $0x2, %dx
andw $-0x5, %cx
orw %dx, %cx
movw %cx, 0xac(%rax)
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x2, %esi
callq 0xa420
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x1, %esi
callq 0xa420
jmp 0x102f6
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw $0xc, %dx
andw $0xefff, %cx            # imm = 0xEFFF
orw %dx, %cx
movw %cx, 0xac(%rax)
cmpl $0x0, -0x10(%rbp)
je 0x10190
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x1018e
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0xa320
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x10160
jmp 0x10190
jmp 0x102f6
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x101aa
xorl %eax, %eax
movl %eax, -0x3c(%rbp)
jmp 0x101dc
cmpl $0x3e8, -0xc(%rbp)      # imm = 0x3E8
jne 0x101bd
movl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x101d6
movl -0xc(%rbp), %edx
movl $0x3, %eax
movl $0x2, %ecx
cmpl $0x3ea, %edx            # imm = 0x3EA
cmovel %ecx, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl $0x8, %esi
callq 0xa450
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x9, %esi
callq 0xa420
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw $0xe, %dx
andw $0xbfff, %cx            # imm = 0xBFFF
orw %dx, %cx
movw %cx, 0xac(%rax)
jmp 0x102f6
movl -0x10(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
jmp 0x102f6
movl -0x10(%rbp), %edx
xorl %ecx, %ecx
movl $0x2, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
jmp 0x102f6
movl -0x10(%rbp), %edx
xorl %ecx, %ecx
movl $0x3, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x88(%rax)
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x3, %esi
callq 0xa420
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0xfb90
jmp 0x102f6
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
movl $0x3, %esi
callq 0xa420
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0xfb90
jmp 0x102f6
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw %cx, %dx
movw 0xac(%rax), %cx
andw $0x1, %dx
shlw $0xd, %dx
andw $0xdfff, %cx            # imm = 0xDFFF
orw %dx, %cx
movw %cx, 0xac(%rax)
jmp 0x102f6
jmp 0x102f6
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)