char *PR_String(char *string) {
  static char buf[80];
  char *s;
  s = buf;
  *s++ = '"';
  while (string && *string) {
    if (s == buf + sizeof(buf) - 2)
      break;
    if (*string == '\n') {
      *s++ = '\\';
      *s++ = 'n';
    } else if (*string == '"') {
      *s++ = '\\';
      *s++ = '"';
    } else
      *s++ = *string;
    string++;
    if (s - buf > 60) {
      *s++ = '.';
      *s++ = '.';
      *s++ = '.';
      break;
    }
  }
  *s++ = '"';
  *s++ = 0;
  return buf;
}


x86 assembly (clang, -O0):
<PR_String>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0x2f21(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x22,(%rax)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1145 <PR_String+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1155 <PR_String+0x55>
jmp    1261 <PR_String+0x161>
lea    0x2ed4(%rip),%rax
add    $0x4e,%rax
cmp    %rax,-0x10(%rbp)
jne    116f <PR_String+0x6f>
jmp    1261 <PR_String+0x161>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    11a8 <PR_String+0xa8>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x6e,(%rax)
jmp    11fd <PR_String+0xfd>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11e1 <PR_String+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x22,(%rax)
jmp    11f8 <PR_String+0xf8>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11fd <PR_String+0xfd>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
lea    0x2e1c(%rip),%rcx
sub    %rcx,%rax
cmp    $0x3c,%rax
jle    125c <PR_String+0x15c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2e,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2e,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2e,(%rax)
jmp    1261 <PR_String+0x161>
jmp    1125 <PR_String+0x25>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x22,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
lea    0x2da4(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PR_String>:
movb   $0x22,0x2f29(%rip)
lea    0x2f23(%rip),%rax
lea    0x2f69(%rip),%rcx
lea    0x2f14(%rip),%rsi
jmp    1136 <PR_String+0x36>
xchg   %ax,%ax
mov    %dl,(%rax)
add    $0x1,%rax
add    $0x1,%rdi
mov    %rax,%rdx
sub    %rsi,%rdx
cmp    $0x3d,%rdx
jge    116b <PR_String+0x6b>
test   %rdi,%rdi
je     1178 <PR_String+0x78>
movzbl (%rdi),%edx
test   %dl,%dl
je     1178 <PR_String+0x78>
cmp    %rcx,%rax
je     1178 <PR_String+0x78>
cmp    $0x22,%dl
je     1160 <PR_String+0x60>
cmp    $0xa,%dl
jne    1120 <PR_String+0x20>
movw   $0x6e5c,(%rax)
add    $0x2,%rax
jmp    1126 <PR_String+0x26>
nopl   0x0(%rax)
movw   $0x225c,(%rax)
add    $0x2,%rax
jmp    1126 <PR_String+0x26>
movw   $0x2e2e,(%rax)
movb   $0x2e,0x2(%rax)
add    $0x3,%rax
movw   $0x22,(%rax)
lea    0x2eac(%rip),%rax
ret

LLVM IR (-O0):
@PR_String.buf = internal global [80 x i8] zeroinitializer
define i8* @PR_String(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i32 1
store i8* %5, i8** %3
store i8 34, i8* %4
br label %6
6: ; preds = %60, %1
%7 = load i8*, i8** %2
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %9, %6
%15 = phi i1 [ false, %6 ], [ %13, %9 ]
br i1 %15, label %16, label %61
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = icmp eq i8* %17, getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 1, i64 -2)
br i1 %18, label %19, label %20
19: ; preds = %16
br label %61
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
store i8 92, i8* %26
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
store i8 110, i8* %28
br label %46
30: ; preds = %20
%31 = load i8*, i8** %2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 34
br i1 %34, label %35, label %40
35: ; preds = %30
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %3
store i8 92, i8* %36
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %3
store i8 34, i8* %38
br label %45
40: ; preds = %30
%41 = load i8*, i8** %2
%42 = load i8, i8* %41
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %3
store i8 %42, i8* %43
br label %45
45: ; preds = %40, %35
br label %46
46: ; preds = %45, %25
%47 = load i8*, i8** %2
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %2
%49 = load i8*, i8** %3
%50 = ptrtoint i8* %49 to i64
%51 = sub i64 %50, ptrtoint ([80 x i8]* @PR_String.buf to i64)
%52 = icmp sgt i64 %51, 60
br i1 %52, label %53, label %60
53: ; preds = %46
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %3
store i8 46, i8* %54
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %3
store i8 46, i8* %56
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %3
store i8 46, i8* %58
br label %61
60: ; preds = %46
br label %6
61: ; preds = %53, %19, %14
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i32 1
store i8* %63, i8** %3
store i8 34, i8* %62
%64 = load i8*, i8** %3
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %3
store i8 0, i8* %64
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@PR_String.buf = internal global [80 x i8] zeroinitializer
define i8* @PR_String(i8* %0) {
store i8 34, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 0)
br label %2
2: ; preds = %20, %1
%3 = phi i8* [ %0, %1 ], [ %22, %20 ]
%4 = phi i8* [ getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 1), %1 ], [ %21, %20 ]
%5 = icmp eq i8* %3, null
br i1 %5, label %30, label %6
6: ; preds = %2
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 0
%9 = icmp eq i8* %4, getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 78)
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %30, label %11
11: ; preds = %6
switch i8 %7, label %18 [
i8 10, label %12
i8 34, label %15
]
12: ; preds = %11
%13 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%14 = getelementptr inbounds i8, i8* %4, i64 2
store i8 110, i8* %13
br label %20
15: ; preds = %11
%16 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%17 = getelementptr inbounds i8, i8* %4, i64 2
store i8 34, i8* %16
br label %20
18: ; preds = %11
%19 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
br label %20
20: ; preds = %15, %18, %12
%21 = phi i8* [ %14, %12 ], [ %17, %15 ], [ %19, %18 ]
%22 = getelementptr inbounds i8, i8* %3, i64 1
%23 = ptrtoint i8* %21 to i64
%24 = sub i64 %23, ptrtoint ([80 x i8]* @PR_String.buf to i64)
%25 = icmp sgt i64 %24, 60
br i1 %25, label %26, label %2
26: ; preds = %20
%27 = getelementptr inbounds i8, i8* %21, i64 1
store i8 46, i8* %21
%28 = getelementptr inbounds i8, i8* %21, i64 2
store i8 46, i8* %27
%29 = getelementptr inbounds i8, i8* %21, i64 3
store i8 46, i8* %28
br label %30
30: ; preds = %2, %6, %26
%31 = phi i8* [ %29, %26 ], [ %4, %6 ], [ %4, %2 ]
%32 = getelementptr inbounds i8, i8* %31, i64 1
store i8 34, i8* %31
store i8 0, i8* %32
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @PR_String.buf, i64 0, i64 0)
}