// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/pcalutil.c
// Function: cvt_escape
void cvt_escape (char *obuf, char *ibuf)
{
   char c, c2, *po, *pi, *p, *dfltfont;
   static char whitespace[] = "abnrtv"; /* see ANSI spec, 2.2.2 */
   static char no_cvt[] = "\"'\\";
   
   dfltfont = fontstyle[0] == BOLD   ? BOLD_FONT :
      fontstyle[0] == ITALIC ? ITALIC_FONT :
      ROMAN_FONT ;

   strcpy(currfont, dfltfont);   /* defaults for font style */
   strcpy(prevfont, dfltfont);
   
   for (po = obuf, pi = ibuf; (c = *pi) != '\0'; *po++ = c, pi++) {

      /* handle escape sequences here:
        
          escaped whitespace and ANSI escapes (except \f) are all converted to
          a single space;

          octal and hex constants are converted in place;

          escaped single/double quotes are left escaped for loadwords() to
          handle later on;
        
          if the output is PostScript:

            \f[BIR] is converted to " .[bir] ";
            \fP is converted to the previous " .[bir] ";
            <[BI]> is converted to " .[bi] ";
            </[BI]> is converted to the previous " .[bir] "
        
          if the output is HTML:

            \f[BI] is converted to "<[BI]>";
            \f[PR] is converted to the previous "</[BI]>";
            <[BI]> and </[BI]> are copied intact

       */
      if (c == '\\') {
         c2 = *++pi;
         if (isspace((int)c2) || strchr(whitespace, c2)) {
            c = ' ';
         }
         else if (isodigit(c2)) {   /* octal */
            pi = octal_esc(pi, &c);
         }
         else if (tolower(c2) == 'x') {   /* hex */
            pi = hex_esc(pi, &c);
         }
         else if (c2 == 'f') {   /* \f[BIPR] */
            c = output_type == OUTPUT_HTML ? '>' : ' ';
            if (*++pi == BOLD) po = set_fontstyle(po, BOLD_FONT);
            else if (*pi == ITALIC) po = set_fontstyle(po, ITALIC_FONT);
            else if (*pi == PREVFONT) po = set_fontstyle(po, prevfont);
            else if (*pi == ROMAN) po = set_fontstyle(po, ROMAN_FONT);
            else {   /* unrecognized \f escape */
               *po++ = ' ';
               c = *pi;
            }
         }
         else {
            if (strchr(no_cvt, c2)) *po++ = c;   /* leave escaped */
            c = c2;
         }
      }
      else if (output_type != OUTPUT_HTML && (p = html_esc(pi, &c2)) != pi) {
         /* convert special HTML character back to ASCII */
         pi = p;
         if (c2 == '"') *po++ = '\\';
         c = c2;
      }
      else if (HTML_ESCAPE(pi)) {
         /* convert HTML escape to PostScript */
         c2 = *++pi;
         if ((c2 = toupper(c2)) == BOLD) po = set_fontstyle(po, BOLD_FONT);
         else if (c2 == ITALIC) po = set_fontstyle(po, ITALIC_FONT);
         else po = set_fontstyle(po, prevfont); /* </[BI]> */

         while ((c = *++pi) != '>')
            ;

         c = output_type == OUTPUT_HTML ? '>' : ' ';
      }
   }
   
   /* if generating HTML, reset font at end of line if necessary */
   if (output_type == OUTPUT_HTML && currfont[1] != dfltfont[1]) {
      *po++ = '<';
      *po++ = '/';
      *po++ = currfont[1];
      *po++ = '>';
   }
   *po = '\0';

   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x2211f(%rip), %rax     # 0x2ec66
movsbl (%rax), %eax
cmpl $0x42, %eax
jne 0xcb5c
leaq 0x17b04(%rip), %rax     # 0x2465a
movq %rax, -0x40(%rbp)
jmp 0xcb7f
leaq 0x22103(%rip), %rax     # 0x2ec66
movsbl (%rax), %edx
leaq 0x17af3(%rip), %rax     # 0x24660
leaq 0x17ae9(%rip), %rcx     # 0x2465d
cmpl $0x49, %edx
cmoveq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x26c08(%rip), %rdi     # 0x3379a
callq 0x5080
movq -0x38(%rbp), %rsi
leaq 0x26bee(%rip), %rdi     # 0x33790
callq 0x5080
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb (%rax), %al
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $0x0, %eax
je 0xcf38
movsbl -0x11(%rbp), %eax
cmpl $0x5c, %eax
jne 0xcd94
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb 0x1(%rax), %al
movb %al, -0x12(%rbp)
callq 0x52e0
movq (%rax), %rax
movsbl -0x12(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0xcc21
movsbl -0x12(%rbp), %esi
leaq 0x22f9e(%rip), %rdi     # 0x2fbb4
callq 0x5100
cmpq $0x0, %rax
je 0xcc2a
movb $0x20, -0x11(%rbp)
jmp 0xcd8f
movsbl -0x12(%rbp), %eax
cmpl $0x30, %eax
jl 0xcc52
movsbl -0x12(%rbp), %eax
cmpl $0x37, %eax
jg 0xcc52
movq -0x28(%rbp), %rdi
leaq -0x11(%rbp), %rsi
callq 0xcfc0
movq %rax, -0x28(%rbp)
jmp 0xcd8d
movsbl -0x12(%rbp), %edi
callq 0x51e0
cmpl $0x78, %eax
jne 0xcc76
movq -0x28(%rbp), %rdi
leaq -0x11(%rbp), %rsi
callq 0xd060
movq %rax, -0x28(%rbp)
jmp 0xcd8b
movsbl -0x12(%rbp), %eax
cmpl $0x66, %eax
jne 0xcd59
leaq 0x25abe(%rip), %rax     # 0x32748
movl (%rax), %edx
movl $0x20, %eax
movl $0x3e, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movb %al, -0x11(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x42, %eax
jne 0xccd0
movq -0x20(%rbp), %rdi
leaq 0x17998(%rip), %rsi     # 0x2465a
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xcd57
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x49, %eax
jne 0xccf2
movq -0x20(%rbp), %rdi
leaq 0x17976(%rip), %rsi     # 0x2465d
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xcd55
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x50, %eax
jne 0xcd14
movq -0x20(%rbp), %rdi
leaq 0x26a87(%rip), %rsi     # 0x33790
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xcd53
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x52, %eax
jne 0xcd36
movq -0x20(%rbp), %rdi
leaq 0x17935(%rip), %rsi     # 0x24660
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xcd51
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x20, (%rax)
movq -0x28(%rbp), %rax
movb (%rax), %al
movb %al, -0x11(%rbp)
jmp 0xcd53
jmp 0xcd55
jmp 0xcd57
jmp 0xcd89
movsbl -0x12(%rbp), %esi
leaq 0x22e57(%rip), %rdi     # 0x2fbbb
callq 0x5100
cmpq $0x0, %rax
je 0xcd83
movb -0x11(%rbp), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movb -0x12(%rbp), %al
movb %al, -0x11(%rbp)
jmp 0xcd8b
jmp 0xcd8d
jmp 0xcd8f
jmp 0xcf11
leaq 0x259ad(%rip), %rax     # 0x32748
cmpl $0x2, (%rax)
je 0xcde5
movq -0x28(%rbp), %rdi
leaq -0x12(%rbp), %rsi
callq 0xd1a0
movq %rax, -0x30(%rbp)
cmpq -0x28(%rbp), %rax
je 0xcde5
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movsbl -0x12(%rbp), %eax
cmpl $0x22, %eax
jne 0xcdda
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x5c, (%rax)
movb -0x12(%rbp), %al
movb %al, -0x11(%rbp)
jmp 0xcf0f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
jne 0xcf0d
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %esi
leaq 0x1785f(%rip), %rdi     # 0x24663
callq 0x5100
cmpq $0x0, %rax
je 0xce1c
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x3e, %eax
je 0xce5c
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0xcf0d
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %esi
leaq 0x17827(%rip), %rdi     # 0x24663
callq 0x5100
cmpq $0x0, %rax
je 0xcf0d
movq -0x28(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x3e, %eax
jne 0xcf0d
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb 0x1(%rax), %al
movb %al, -0x12(%rbp)
movsbl -0x12(%rbp), %edi
callq 0x5090
movb %al, -0x12(%rbp)
movsbl %al, %eax
cmpl $0x42, %eax
jne 0xce9b
movq -0x20(%rbp), %rdi
leaq 0x177ca(%rip), %rsi     # 0x2465a
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xced0
movsbl -0x12(%rbp), %eax
cmpl $0x49, %eax
jne 0xceba
movq -0x20(%rbp), %rdi
leaq 0x177ae(%rip), %rsi     # 0x2465d
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xcece
movq -0x20(%rbp), %rdi
leaq 0x268cb(%rip), %rsi     # 0x33790
callq 0xba40
movq %rax, -0x20(%rbp)
jmp 0xced0
jmp 0xced2
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb 0x1(%rax), %al
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $0x3e, %eax
je 0xcef1
jmp 0xced2
leaq 0x25850(%rip), %rax     # 0x32748
movl (%rax), %edx
movl $0x20, %eax
movl $0x3e, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movb %al, -0x11(%rbp)
jmp 0xcf0f
jmp 0xcf11
jmp 0xcf13
movb -0x11(%rbp), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xcbb7
leaq 0x25809(%rip), %rax     # 0x32748
cmpl $0x2, (%rax)
jne 0xcfa4
movsbl 0x26850(%rip), %eax     # 0x3379b
movq -0x38(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
je 0xcfa4
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x3c, (%rax)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x2f, (%rax)
movb 0x2681a(%rip), %cl      # 0x3379b
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x3e, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)