// File: /workspace/github_c_makefile_star2_O1/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstUtilityBinToEsc
int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len)
{
const unsigned char *src = s;
unsigned char *dst = d;
unsigned char val;
int i;

for(i=0;i<len;i++)
        {
        switch(src[i])
                {
                case '\a':      *(dst++) = '\\'; *(dst++) = 'a'; break;
                case '\b':      *(dst++) = '\\'; *(dst++) = 'b'; break;
                case '\f':      *(dst++) = '\\'; *(dst++) = 'f'; break;
                case '\n':      *(dst++) = '\\'; *(dst++) = 'n'; break;
                case '\r':      *(dst++) = '\\'; *(dst++) = 'r'; break;
                case '\t':      *(dst++) = '\\'; *(dst++) = 't'; break;
                case '\v':      *(dst++) = '\\'; *(dst++) = 'v'; break;
                case '\'':      *(dst++) = '\\'; *(dst++) = '\''; break;
                case '\"':      *(dst++) = '\\'; *(dst++) = '\"'; break;
                case '\\':      *(dst++) = '\\'; *(dst++) = '\\'; break;
                case '\?':      *(dst++) = '\\'; *(dst++) = '\?'; break;
                default:        if((src[i] > ' ') && (src[i] <= '~')) /* no white spaces in output */
                                        {
                                        *(dst++) = src[i];
                                        }
                                        else
                                        {
                                        val = src[i];
                                        *(dst++) = '\\';
                                        *(dst++) = (val/64) + '0'; val = val & 63;
                                        *(dst++) = (val/8)  + '0'; val = val & 7;
                                        *(dst++) = (val) + '0';
                                        }
                                break;
                }
        }

return(dst - d);
}

// Assembly:
movq %rdi, %rax
testl %edx, %edx
jle 0x6d51
pushq %rbp
movq %rsp, %rbp
movl %edx, %ecx
xorl %edx, %edx
leaq 0xe4dd(%rip), %r8       # 0x15140
movq %rdi, %rax
movb (%rsi,%rdx), %r9b
movzbl %r9b, %r10d
cmpl $0x21, %r10d
jg 0x6c93
addl $-0x7, %r10d
cmpl $0x6, %r10d
ja 0x6d07
movslq (%r8,%r10,4), %r9
addq %r8, %r9
jmpq *%r9
movw $0x615c, (%rax)         # imm = 0x615C
jmp 0x6cf5
cmpl $0x3e, %r10d
jg 0x6cac
cmpl $0x22, %r10d
je 0x6cbf
cmpl $0x27, %r10d
jne 0x6d07
movw $0x275c, (%rax)         # imm = 0x275C
jmp 0x6cf5
cmpl $0x3f, %r10d
je 0x6cc6
cmpl $0x5c, %r10d
jne 0x6d07
movw $0x5c5c, (%rax)         # imm = 0x5C5C
jmp 0x6cf5
movw $0x225c, (%rax)         # imm = 0x225C
jmp 0x6cf5
movw $0x3f5c, (%rax)         # imm = 0x3F5C
jmp 0x6cf5
movw $0x765c, (%rax)         # imm = 0x765C
jmp 0x6cf5
movw $0x745c, (%rax)         # imm = 0x745C
jmp 0x6cf5
movw $0x6e5c, (%rax)         # imm = 0x6E5C
jmp 0x6cf5
movw $0x625c, (%rax)         # imm = 0x625C
jmp 0x6cf5
movw $0x665c, (%rax)         # imm = 0x665C
jmp 0x6cf5
movw $0x725c, (%rax)         # imm = 0x725C
addq $0x2, %rax
incq %rdx
cmpq %rdx, %rcx
jne 0x6c66
jmp 0x6d50
leal -0x21(%r9), %r10d
cmpb $0x5d, %r10b
ja 0x6d19
movb %r9b, (%rax)
incq %rax
jmp 0x6cf9
movb $0x5c, (%rax)
movl %r9d, %r10d
shrb $0x6, %r10b
orb $0x30, %r10b
movb %r10b, 0x1(%rax)
movl %r9d, %r10d
shrb $0x3, %r10b
andb $0x7, %r10b
orb $0x30, %r10b
movb %r10b, 0x2(%rax)
andb $0x7, %r9b
orb $0x30, %r9b
movb %r9b, 0x3(%rax)
addq $0x4, %rax
jmp 0x6cf9
popq %rbp
subl %edi, %eax
retq