// File: /workspace/github_c_makefile_star2_O2/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 0x29a9
leal -0x1(%rdx), %eax
cmpl $0x8, %eax
ja 0x29ca
leaq 0x19e1(%rip), %rsi      # 0x436c
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 0x2ac6
cmpl $0x14, %edx
je 0x2a07
cmpl $0x4, %edx
je 0x29f2
cmpl $0x3, %edx
jne 0x2a1c
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x2, %ecx
jmp 0x2ac4
cmpl $0x19, %edx
je 0x2ab2
cmpl $0x3e8, %edx            # imm = 0x3E8
jne 0x2a25
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
andl 0x18(%rdi), %ecx
shll $0xb, %eax
jmp 0x2ac4
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x3, %ecx
leal (%rcx,%rax,2), %eax
jmp 0x2ac6
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x5, %ecx
leal (%rcx,%rax,4), %eax
jmp 0x2ac6
leaq 0x1fa5(%rip), %rdi      # 0x49c8
jmp 0x2a2c
leaq 0x1f8a(%rip), %rdi      # 0x49b6
movl %edx, %esi
xorl %eax, %eax
jmp 0x265f
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)
andl $0x0, 0xc(%rdi)
retq
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x18(%rdi), %ecx
andl $-0x21, %ecx
shll $0x5, %eax
jmp 0x2ac4
leaq 0x1f36(%rip), %rdi      # 0x49a5
xorl %eax, %eax
jmp 0x265f
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
andl 0x18(%rdi), %ecx
shll $0x9, %eax
jmp 0x2ac4
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
andl 0x18(%rdi), %ecx
shll $0x8, %eax
jmp 0x2ac4
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
andl 0x18(%rdi), %ecx
shll $0x7, %eax
jmp 0x2ac4
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