// File: /workspace/github_c_makefile_star2_O1/lecram[P]congif/term.c
// Function: modeswitch
static void
modeswitch(Term *term, int private, int number, int value)
{
    if (private) {
        /* DEC modes */
        switch (number) {
        case 1:
            SWITCH(term, M_CURSORKEY, value);
            break;
        case 3:
            /* TODO: 80/132 columns mode switch */
            logfmt("NYI: DEC mode 3\n");
            break;
        case 5:
            SWITCH(term, M_REVERSE, value);
            break;
        case 6:
            SWITCH(term, M_ORIGIN, value);
            term->row = term->top;
            term->col = 0;
            break;
        case 7:
            SWITCH(term, M_AUTOWRAP, value);
            break;
        case 8:
            SWITCH(term, M_AUTORPT, value);
            break;
        case 9:
            SWITCH(term, M_MOUSEX10, value);
            break;
        case 25:
            SWITCH(term, M_CURSORVIS, value);
            break;
        case 1000:
            SWITCH(term, M_MOUSEX11, value);
            break;
        default:
            logfmt("UNS: DEC mode %d\n", number);
        }
    } else {
        /* ANSI modes */
        switch (number) {
        case 3:
            SWITCH(term, M_DISPCTRL, value);
            break;
        case 4:
            SWITCH(term, M_INSERT, value);
            break;
        case 20:
            SWITCH(term, M_NEWLINE, value);
            break;
        default:
            logfmt("UNS: ANSI mode %d\n", number);
        }
    }
}

// Assembly:
testl %esi, %esi
je 0x2b9d
leal -0x1(%rdx), %eax
cmpl $0x8, %eax
ja 0x2bbe
leaq 0x27ed(%rip), %rsi      # 0x536c
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x9, %ecx
leal (%rcx,%rax,8), %eax
jmp 0x2cbd
cmpl $0x14, %edx
je 0x2bfb
cmpl $0x4, %edx
je 0x2be6
cmpl $0x3, %edx
jne 0x2c10
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x2, %ecx
jmp 0x2cbb
cmpl $0x19, %edx
je 0x2ca9
cmpl $0x3e8, %edx            # imm = 0x3E8
jne 0x2c19
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
andl 0x18(%rdi), %ecx
shll $0xb, %eax
jmp 0x2cbb
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x3, %ecx
leal (%rcx,%rax,2), %eax
jmp 0x2cbd
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x5, %ecx
leal (%rcx,%rax,4), %eax
jmp 0x2cbd
leaq 0x2db1(%rip), %rdi      # 0x59c8
jmp 0x2c20
leaq 0x2d96(%rip), %rdi      # 0x59b6
movl %edx, %esi
xorl %eax, %eax
jmp 0x2877
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x10(%rdi), %ecx
movl 0x18(%rdi), %edx
andl $-0x41, %edx
shll $0x6, %eax
orl %edx, %eax
movw %ax, 0x18(%rdi)
movl %ecx, 0x8(%rdi)
movl $0x0, 0xc(%rdi)
retq
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x21, %ecx
shll $0x5, %eax
jmp 0x2cbb
leaq 0x2d3f(%rip), %rdi      # 0x59a5
xorl %eax, %eax
jmp 0x2877
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
andl 0x18(%rdi), %ecx
shll $0x9, %eax
jmp 0x2cbb
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
andl 0x18(%rdi), %ecx
shll $0x8, %eax
jmp 0x2cbb
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
andl 0x18(%rdi), %ecx
shll $0x7, %eax
jmp 0x2cbb
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
andl 0x18(%rdi), %ecx
shll $0xa, %eax
orl %ecx, %eax
movw %ax, 0x18(%rdi)
retq