// File: /workspace/github_c_makefile_star2_O0/JimKent[P]linearSat/lib/cheapcgi.c
// Function: javaScriptLiteralEncode
char *javaScriptLiteralEncode(char *inString)
/* Use backslash escaping on newline
 * and quote chars, backslash and others.
 * Intended that the encoded string will be
 * put between quotes at a higher level and
 * then interpreted by Javascript. */
{
char c;
int outSize = 0;
char *outString, *out, *in;

if (inString == NULL)
    return(cloneString(""));

/* Count up how long it will be */
in = inString;
while ((c = *in++) != 0)
    {
    if (c == '\''
     || c == '\"'
     || c == '&'
     || c == '\\'
     || c == '\n'
     || c == '\r'
     || c == '\t'
     || c == '\b'
     || c == '\f'
	)
        outSize += 2;
    else
        outSize += 1;
    }
outString = needMem(outSize+1);

/* Encode string */
in = inString;
out = outString;
while ((c = *in++) != 0)
    {
    if (c == '\''
     || c == '\"'
     || c == '&'
     || c == '\\'
     || c == '\n'
     || c == '\r'
     || c == '\t'
     || c == '\b'
     || c == '\f'
	)
        *out++ = '\\';
    *out++ = c;
    }
*out++ = 0;
return outString;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1c30f
leaq 0x89f9(%rip), %rdi      # 0x24cfa
callq 0x7530
movq %rax, -0x8(%rbp)
jmp 0x1c471
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $0x0, %eax
je 0x1c39d
movsbl -0x11(%rbp), %eax
cmpl $0x27, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0x22, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0x26, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0x5c, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0xa, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0xd, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0x9, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0x8, %eax
je 0x1c384
movsbl -0x11(%rbp), %eax
cmpl $0xc, %eax
jne 0x1c38f
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x1c398
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1c317
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x152f0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $0x0, %eax
je 0x1c457
movsbl -0x11(%rbp), %eax
cmpl $0x27, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0x22, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0x26, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0x5c, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0xa, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0xd, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0x9, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0x8, %eax
je 0x1c42c
movsbl -0x11(%rbp), %eax
cmpl $0xc, %eax
jne 0x1c43e
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x5c, (%rax)
movb -0x11(%rbp), %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
jmp 0x1c3bf
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)