// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: JimEscape
static int JimEscape(char *dest, const char *s, int slen)
{
    char *p = dest;
    int i, len;

    for (i = 0; i < slen; i++) {
        switch (s[i]) {
            case '\\':
                switch (s[i + 1]) {
                    case 'a':
                        *p++ = 0x7;
                        i++;
                        break;
                    case 'b':
                        *p++ = 0x8;
                        i++;
                        break;
                    case 'f':
                        *p++ = 0xc;
                        i++;
                        break;
                    case 'n':
                        *p++ = 0xa;
                        i++;
                        break;
                    case 'r':
                        *p++ = 0xd;
                        i++;
                        break;
                    case 't':
                        *p++ = 0x9;
                        i++;
                        break;
                    case 'u':
                    case 'U':
                    case 'x':
                        {
                            unsigned val = 0;
                            int k;
                            int maxchars = 2;

                            i++;

                            if (s[i] == 'U') {
                                maxchars = 8;
                            }
                            else if (s[i] == 'u') {
                                if (s[i + 1] == '{') {
                                    maxchars = 6;
                                    i++;
                                }
                                else {
                                    maxchars = 4;
                                }
                            }

                            for (k = 0; k < maxchars; k++) {
                                int c = xdigitval(s[i + k + 1]);
                                if (c == -1) {
                                    break;
                                }
                                val = (val << 4) | c;
                            }

                            if (s[i] == '{') {
                                if (k == 0 || val > 0x1fffff || s[i + k + 1] != '}') {

                                    i--;
                                    k = 0;
                                }
                                else {

                                    k++;
                                }
                            }
                            if (k) {

                                if (s[i] == 'x') {
                                    *p++ = val;
                                }
                                else {
                                    p += utf8_fromunicode(p, val);
                                }
                                i += k;
                                break;
                            }

                            *p++ = s[i];
                        }
                        break;
                    case 'v':
                        *p++ = 0xb;
                        i++;
                        break;
                    case '\0':
                        *p++ = '\\';
                        i++;
                        break;
                    case '\n':

                        *p++ = ' ';
                        do {
                            i++;
                        } while (s[i + 1] == ' ' || s[i + 1] == '\t');
                        break;
                    case '0':
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':

                        {
                            int val = 0;
                            int c = odigitval(s[i + 1]);

                            val = c;
                            c = odigitval(s[i + 2]);
                            if (c == -1) {
                                *p++ = val;
                                i++;
                                break;
                            }
                            val = (val * 8) + c;
                            c = odigitval(s[i + 3]);
                            if (c == -1) {
                                *p++ = val;
                                i += 2;
                                break;
                            }
                            val = (val * 8) + c;
                            *p++ = val;
                            i += 3;
                        }
                        break;
                    default:
                        *p++ = s[i + 1];
                        i++;
                        break;
                }
                break;
            default:
                *p++ = s[i];
                break;
        }
    }
    len = p - dest;
    *p = '\0';
    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r9
movq %rdi, %r12
testl %edx, %edx
jle 0x18a95
movl %edx, %r14d
movq %rsi, %r15
leaq 0x1(%rsi), %r10
leaq 0x2(%rsi), %r11
xorl %r13d, %r13d
leaq 0xfa5b(%rip), %r8       # 0x282a4
movq %r9, %r12
movslq %r13d, %rax
movb (%r15,%rax), %cl
cmpb $0x5c, %cl
jne 0x18968
leaq 0x1(%rax), %r13
movb 0x1(%r15,%rax), %cl
movzbl %cl, %edx
cmpl $0x54, %edx
jg 0x188de
leal -0x30(%rdx), %esi
cmpl $0x8, %esi
jae 0x18911
movsbl %cl, %ecx
movl %ecx, %edx
andl $-0x8, %edx
addl $-0x30, %ecx
cmpl $0x30, %edx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %edx, %ecx
movsbl 0x2(%r15,%rax), %edx
movl %edx, %esi
andl $-0x8, %esi
cmpl $0x30, %esi
setne %sil
addl $-0x30, %edx
cmpl $-0x1, %edx
sete %dil
orb %sil, %dil
jne 0x18941
leal (%rdx,%rcx,8), %ecx
movsbl 0x3(%r15,%rax), %edx
movl %edx, %esi
andl $-0x8, %esi
cmpl $0x30, %esi
setne %sil
addl $-0x30, %edx
cmpl $-0x1, %edx
sete %dil
orb %sil, %dil
je 0x18937
addq $0x2, %rax
jmp 0x1893e
cmpl $0x65, %edx
jle 0x188fb
leal -0x6e(%rdx), %esi
cmpl $0xa, %esi
ja 0x1895c
movslq (%r8,%rsi,4), %rdx
addq %r8, %rdx
jmpq *%rdx
movb $0xa, (%r12)
jmp 0x1896c
cmpl $0x55, %edx
je 0x1894e
cmpl $0x61, %edx
je 0x18947
cmpl $0x62, %edx
jne 0x18968
movb $0x8, (%r12)
jmp 0x1896c
testl %edx, %edx
je 0x18955
cmpl $0xa, %edx
jne 0x18968
movb $0x20, (%r12)
addq %r11, %rax
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x1892f
cmpl $0x9, %ecx
jne 0x1896c
incq %rax
incl %r13d
jmp 0x18922
addq $0x3, %rax
leal (%rdx,%rcx,8), %ecx
movl %eax, %r13d
movb %cl, (%r12)
jmp 0x1896c
movb $0x7, (%r12)
jmp 0x1896c
movl $0x8, %eax
jmp 0x189b6
movb $0x5c, (%r12)
jmp 0x1896c
cmpl $0x66, %edx
jne 0x18968
movb $0xc, (%r12)
jmp 0x1896c
movb %cl, (%r12)
incq %r12
incl %r13d
cmpl %r14d, %r13d
jl 0x1884c
jmp 0x18a95
leaq 0x2(%rax), %rcx
xorl %edx, %edx
cmpb $0x7b, 0x2(%r15,%rax)
sete %dl
cmovel %ecx, %r13d
leal 0x4(,%rdx,2), %eax
jmp 0x189b6
movb $0x9, (%r12)
jmp 0x1896c
movb $0xd, (%r12)
jmp 0x1896c
movb $0xb, (%r12)
jmp 0x1896c
movl $0x2, %eax
movl %eax, %ecx
movslq %r13d, %rax
leaq (%r10,%rax), %rdx
xorl %ebx, %ebx
xorl %esi, %esi
movsbl (%rdx,%rbx), %edi
leal -0x30(%rdi), %r8d
cmpl $0xa, %r8d
jb 0x189f8
leal -0x61(%rdi), %r8d
cmpl $0x5, %r8d
ja 0x189e0
addl $-0x57, %edi
jmp 0x189f5
leal -0x41(%rdi), %r8d
addl $-0x37, %edi
cmpl $0x6, %r8d
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmovael %r8d, %edi
movl %edi, %r8d
movl %esi, %edi
shll $0x4, %edi
orl %r8d, %edi
cmpl $-0x1, %r8d
cmovnel %edi, %esi
je 0x18a13
incq %rbx
cmpq %rbx, %rcx
jne 0x189c3
movl %ecx, %ebx
cmpb $0x7b, (%r15,%rax)
jne 0x18a3d
testl %ebx, %ebx
je 0x18a38
cmpl $0x1fffff, %esi         # imm = 0x1FFFFF
ja 0x18a38
leal (%rbx,%r13), %eax
cltq
cmpb $0x7d, 0x1(%r15,%rax)
jne 0x18a38
incl %ebx
jmp 0x18a3d
decl %r13d
xorl %ebx, %ebx
movslq %r13d, %rax
movb (%r15,%rax), %al
testl %ebx, %ebx
je 0x18a55
cmpb $0x78, %al
jne 0x18a5e
movb %sil, (%r12)
incq %r12
jmp 0x18a83
movb %al, (%r12)
incq %r12
jmp 0x18a89
movq %r12, %rdi
movq %r9, -0x40(%rbp)
movq %r10, -0x38(%rbp)
movq %r11, -0x30(%rbp)
callq 0x120c4
movq -0x30(%rbp), %r11
movq -0x38(%rbp), %r10
movq -0x40(%rbp), %r9
movl %eax, %eax
addq %rax, %r12
addl %r13d, %ebx
movl %ebx, %r13d
leaq 0xf814(%rip), %r8       # 0x282a4
jmp 0x1896f
movl %r12d, %eax
subl %r9d, %eax
movb $0x0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq