// File: /workspace/github_c_makefile_star2_O3/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 0x2bd2
leal -0x1(%rdx), %eax
cmpl $0x8, %eax
ja 0x2bf3
leaq 0x27c8(%rip), %rsi      # 0x537c
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 0x2cf2
cmpl $0x14, %edx
je 0x2c30
cmpl $0x4, %edx
je 0x2c1b
cmpl $0x3, %edx
jne 0x2c45
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x2, %ecx
jmp 0x2cf0
cmpl $0x19, %edx
je 0x2cde
cmpl $0x3e8, %edx            # imm = 0x3E8
jne 0x2c4e
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
andl 0x18(%rdi), %ecx
shll $0xb, %eax
jmp 0x2cf0
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x3, %ecx
leal (%rcx,%rax,2), %eax
jmp 0x2cf2
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x5, %ecx
leal (%rcx,%rax,4), %eax
jmp 0x2cf2
leaq 0x2d8c(%rip), %rdi      # 0x59d8
jmp 0x2c55
leaq 0x2d71(%rip), %rdi      # 0x59c6
movl %edx, %esi
xorl %eax, %eax
jmp 0x28a4
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 0x2cf0
leaq 0x2d1a(%rip), %rdi      # 0x59b5
xorl %eax, %eax
jmp 0x28a4
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
andl 0x18(%rdi), %ecx
shll $0x9, %eax
jmp 0x2cf0
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
andl 0x18(%rdi), %ecx
shll $0x8, %eax
jmp 0x2cf0
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
andl 0x18(%rdi), %ecx
shll $0x7, %eax
jmp 0x2cf0
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