// File: /workspace/github_c_makefile_star2_O3/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, %r12
testl %edx, %edx
jle 0x185d3
movl %edx, %r14d
movq %rsi, %r15
leaq 0x1(%rsi), %r10
leaq 0x2(%rsi), %r11
xorl %eax, %eax
leaq 0xeef7(%rip), %rbx      # 0x27280
movq %rdi, %r12
movslq %eax, %rcx
movb (%r15,%rcx), %dl
cmpb $0x5c, %dl
jne 0x1840a
leaq 0x1(%rcx), %rax
movb 0x1(%r15,%rcx), %sil
movzbl %sil, %r8d
cmpl $0x54, %r8d
jg 0x18410
leal -0x30(%r8), %edx
cmpl $0x8, %edx
jae 0x1844c
movsbl 0x2(%r15,%rcx), %esi
movl %esi, %r8d
andl $-0x8, %r8d
cmpl $0x30, %r8d
setne %r9b
addl $-0x30, %esi
cmpl $-0x1, %esi
sete %r8b
orb %r9b, %r8b
jne 0x1847c
leal (%rsi,%rdx,8), %edx
movsbl 0x3(%r15,%rcx), %eax
movl %eax, %esi
andl $-0x8, %esi
cmpl $0x30, %esi
setne %sil
addl $-0x30, %eax
cmpl $-0x1, %eax
sete %r8b
orb %sil, %r8b
je 0x18473
addq $0x2, %rcx
jmp 0x1847a
movb %dl, (%r12)
jmp 0x18480
cmpl $0x65, %r8d
jle 0x18433
leal -0x6e(%r8), %edx
cmpl $0xa, %edx
ja 0x184a8
movslq (%rbx,%rdx,4), %rdx
addq %rbx, %rdx
jmpq *%rdx
movb $0xa, (%r12)
jmp 0x18480
cmpl $0x55, %r8d
je 0x1849a
cmpl $0x61, %r8d
je 0x18493
cmpl $0x62, %r8d
jne 0x184b5
movb $0x8, (%r12)
jmp 0x18480
testl %r8d, %r8d
je 0x184a1
cmpl $0xa, %r8d
jne 0x184b5
movb $0x20, (%r12)
addq %r11, %rcx
movzbl (%rcx), %edx
cmpl $0x20, %edx
je 0x1846c
cmpl $0x9, %edx
jne 0x18480
incq %rcx
incl %eax
jmp 0x1845f
addq $0x3, %rcx
leal (%rax,%rdx,8), %edx
movl %ecx, %eax
movb %dl, (%r12)
incq %r12
incl %eax
cmpl %r14d, %eax
jl 0x1838c
jmp 0x185d3
movb $0x7, (%r12)
jmp 0x18480
movl $0x8, %ecx
jmp 0x184f4
movb $0x5c, (%r12)
jmp 0x18480
cmpl $0x66, %r8d
jne 0x184b5
movb $0xc, (%r12)
jmp 0x18480
movb %sil, (%r12)
jmp 0x18480
leaq 0x2(%rcx), %r13
xorl %edx, %edx
cmpb $0x7b, 0x2(%r15,%rcx)
sete %dl
cmovnel %eax, %r13d
leal 0x4(,%rdx,2), %ecx
movslq %r13d, %rax
jmp 0x184f7
movb $0x9, (%r12)
jmp 0x18480
movb $0xd, (%r12)
jmp 0x18480
movb $0xb, (%r12)
jmp 0x18480
movl $0x2, %ecx
movl %eax, %r13d
movl %ecx, %ecx
leaq (%r10,%rax), %rdx
xorl %ebx, %ebx
xorl %esi, %esi
movsbl (%rdx,%rbx), %r9d
leal -0x30(%r9), %r8d
cmpl $0xa, %r8d
jb 0x18531
leal -0x61(%r9), %r8d
cmpl $0x5, %r8d
ja 0x18520
addl $-0x57, %r9d
jmp 0x1852e
leal -0x41(%r9), %r8d
cmpl $0x5, %r8d
ja 0x18541
addl $-0x37, %r9d
movl %r9d, %r8d
shll $0x4, %esi
orl %r8d, %esi
incq %rbx
cmpq %rbx, %rcx
jne 0x18501
movl %ecx, %ebx
movb (%r15,%rax), %al
cmpb $0x7b, %al
jne 0x18572
testl %ebx, %ebx
je 0x18583
cmpl $0x1fffff, %esi         # imm = 0x1FFFFF
ja 0x18583
leal (%rbx,%r13), %eax
cltq
cmpb $0x7d, (%r10,%rax)
jne 0x18583
movq %r11, -0x30(%rbp)
movq %r10, -0x38(%rbp)
movq %rdi, -0x40(%rbp)
incl %ebx
jmp 0x185a6
testl %ebx, %ebx
je 0x1858e
cmpb $0x78, %al
jne 0x1859a
movb %sil, (%r12)
incq %r12
jmp 0x185c2
movslq %r13d, %r13
movb -0x1(%r15,%r13), %al
decq %r13
movb %al, (%r12)
incq %r12
movl %r13d, %eax
jmp 0x185c7
movq %r11, -0x30(%rbp)
movq %r10, -0x38(%rbp)
movq %rdi, -0x40(%rbp)
movq %r12, %rdi
callq 0x11fa4
movl %eax, %eax
addq %r12, %rax
movq %rax, %r12
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %r10
movq -0x30(%rbp), %r11
addl %r13d, %ebx
movl %ebx, %eax
leaq 0xecb2(%rip), %rbx      # 0x27280
jmp 0x18483
movl %r12d, %eax
subl %edi, %eax
movb $0x0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq