// File: /workspace/github_c_makefile_star2_O0/lecram[P]congif/term.c
// Function: do_linux_osc
static int
do_linux_osc(Term *term)
{
    int i;
    uint8_t buf[4] = {0,0,0,0};
    if (term->partial[0] == 'R')
    {
        if (memcmp(term->plt, def_plt, sizeof(term->plt) != 0))
            term->plt_dirty = 1;
        memcpy(term->plt, def_plt, sizeof(term->plt));
        term->plt_local = 0;
        return 1;
    }
    if (term->partial[0] != 'P' || term->parlen != 8)
        return 0;

    for (i=1; i<8; i++) {
        /* isxdigit is locale broken */
        int ch = term->partial[i];
        if (ch >= '0' && ch <= '9')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - '0');
        else if (ch >= 'a' && ch <= 'f')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - 'a' + 10);
        else if (ch >= 'A' && ch <= 'F')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - 'A' + 10);
        else
            return 0;
    }
    for(i=0; i<3; i++) {
        if (term->plt[buf[0]*3+i] != buf[i+1]) {
            term->plt[buf[0]*3+i] = buf[i+1];
            term->plt_local = term->plt_dirty = 1;
        }
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x10c0
movq -0x10(%rbp), %rax
movzbl 0x6c(%rax), %eax
cmpl $0x52, %eax
jne 0x33b8
movq -0x10(%rbp), %rdi
addq $0x16c, %rdi            # imm = 0x16C
movq 0x6f15(%rip), %rsi      # 0xa280
movl $0x1, %edx
callq 0x1100
cmpl $0x0, %eax
je 0x3385
movq -0x10(%rbp), %rax
movb $0x1, 0x19d(%rax)
movq -0x10(%rbp), %rdi
addq $0x16c, %rdi            # imm = 0x16C
movq 0x6ee9(%rip), %rsi      # 0xa280
movl $0x30, %edx
callq 0x1160
movq -0x10(%rbp), %rax
movb $0x0, 0x19c(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x353e
movq -0x10(%rbp), %rax
movzbl 0x6c(%rax), %eax
cmpl $0x50, %eax
jne 0x33cf
movq -0x10(%rbp), %rax
cmpl $0x8, 0x64(%rax)
je 0x33db
movl $0x0, -0x4(%rbp)
jmp 0x353e
movl $0x1, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0x34b8
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movzbl 0x6c(%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x30, -0x1c(%rbp)
jl 0x342e
cmpl $0x39, -0x1c(%rbp)
jg 0x342e
movl -0x14(%rbp), %eax
sarl %eax
cltq
movzbl -0x18(%rbp,%rax), %eax
shll $0x4, %eax
movl -0x1c(%rbp), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movb %al, %cl
movl -0x14(%rbp), %eax
sarl %eax
cltq
movb %cl, -0x18(%rbp,%rax)
jmp 0x34a8
cmpl $0x61, -0x1c(%rbp)
jl 0x3463
cmpl $0x66, -0x1c(%rbp)
jg 0x3463
movl -0x14(%rbp), %eax
sarl %eax
cltq
movzbl -0x18(%rbp,%rax), %eax
shll $0x4, %eax
movl -0x1c(%rbp), %ecx
subl $0x61, %ecx
addl $0xa, %ecx
addl %ecx, %eax
movb %al, %cl
movl -0x14(%rbp), %eax
sarl %eax
cltq
movb %cl, -0x18(%rbp,%rax)
jmp 0x34a6
cmpl $0x41, -0x1c(%rbp)
jl 0x3498
cmpl $0x46, -0x1c(%rbp)
jg 0x3498
movl -0x14(%rbp), %eax
sarl %eax
cltq
movzbl -0x18(%rbp,%rax), %eax
shll $0x4, %eax
movl -0x1c(%rbp), %ecx
subl $0x41, %ecx
addl $0xa, %ecx
addl %ecx, %eax
movb %al, %cl
movl -0x14(%rbp), %eax
sarl %eax
cltq
movb %cl, -0x18(%rbp,%rax)
jmp 0x34a4
movl $0x0, -0x4(%rbp)
jmp 0x353e
jmp 0x34a6
jmp 0x34a8
jmp 0x34aa
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x33e2
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x3537
movq -0x10(%rbp), %rax
movzbl -0x18(%rbp), %ecx
imull $0x3, %ecx, %ecx
addl -0x14(%rbp), %ecx
movslq %ecx, %rcx
movzbl 0x16c(%rax,%rcx), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl -0x18(%rbp,%rcx), %ecx
cmpl %ecx, %eax
je 0x352a
movl -0x14(%rbp), %eax
addl $0x1, %eax
cltq
movb -0x18(%rbp,%rax), %dl
movq -0x10(%rbp), %rax
movzbl -0x18(%rbp), %ecx
imull $0x3, %ecx, %ecx
addl -0x14(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, 0x16c(%rax,%rcx)
movq -0x10(%rbp), %rax
movb $0x1, 0x19d(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x19c(%rax)
jmp 0x352c
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x34bf
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)