#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void printString(FILE *out, char *string) {
  fprintf(out, "\"");
  if (string) {
    while (*string) {
      switch (*string) {
      case '"':
        fprintf(out, "\\\"");
        break;
      case '\\':
        fprintf(out, "\\\\");
        break;
      case '/':
        fprintf(out, "\\/");
        break;
      case '\b':
        fprintf(out, "\\b");
        break;
      case '\f':
        fprintf(out, "\\f");
        break;
      case '\n':
        fprintf(out, "\\n");
        break;
      case '\r':
        fprintf(out, "\\r");
        break;
      case '\t':
        fprintf(out, "\\t");
        break;
      default:
        fprintf(out, "%c", *string);
      }
      string++;
    }
  }
  fprintf(out, "\"");
}


x86 assembly (clang, -O0):
<printString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     12c5 <printString+0x1b5>
jmp    1142 <printString+0x32>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     12c0 <printString+0x1b0>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x8,%eax
je     1223 <printString+0x113>
jmp    1167 <printString+0x57>
mov    -0x14(%rbp),%eax
sub    $0x9,%eax
je     127f <printString+0x16f>
jmp    1178 <printString+0x68>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     1251 <printString+0x141>
jmp    1189 <printString+0x79>
mov    -0x14(%rbp),%eax
sub    $0xc,%eax
je     123a <printString+0x12a>
jmp    119a <printString+0x8a>
mov    -0x14(%rbp),%eax
sub    $0xd,%eax
je     1268 <printString+0x158>
jmp    11ab <printString+0x9b>
mov    -0x14(%rbp),%eax
sub    $0x22,%eax
je     11de <printString+0xce>
jmp    11bc <printString+0xac>
mov    -0x14(%rbp),%eax
sub    $0x2f,%eax
je     120c <printString+0xfc>
jmp    11cd <printString+0xbd>
mov    -0x14(%rbp),%eax
sub    $0x5c,%eax
je     11f5 <printString+0xe5>
jmp    1296 <printString+0x186>
mov    -0x8(%rbp),%rdi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xdef(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xdc7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xd9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12af <printString+0x19f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
lea    0xd70(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1142 <printString+0x32>
jmp    12c5 <printString+0x1b5>
mov    -0x8(%rbp),%rdi
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x22,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
test   %rbx,%rbx
je     1243 <printString+0x123>
mov    (%rbx),%al
test   %al,%al
je     1243 <printString+0x123>
add    $0x1,%rbx
lea    0xea4(%rip),%r15
lea    0xf4f(%rip),%r12
lea    0xf36(%rip),%r13
lea    0xf35(%rip),%rbp
jmp    1197 <printString+0x77>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %r14,%rcx
call   1040 <fwrite@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1243 <printString+0x123>
movsbl %al,%edi
lea    -0x8(%rdi),%eax
cmp    $0x27,%eax
ja     11be <printString+0x9e>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xeed(%rip),%rdi
jmp    1180 <printString+0x60>
cmp    $0x5c,%edi
jne    11d6 <printString+0xb6>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xecf(%rip),%rdi
jmp    1180 <printString+0x60>
mov    %r14,%rsi
call   1030 <fputc@plt>
jmp    1188 <printString+0x68>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xec4(%rip),%rdi
jmp    1180 <printString+0x60>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xeab(%rip),%rdi
jmp    1180 <printString+0x60>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe92(%rip),%rdi
jmp    1180 <printString+0x60>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rdi
jmp    1180 <printString+0x60>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
jmp    1180 <printString+0x60>
mov    $0x22,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\/\00"
@.str.4 = [3 x i8] c"\\b\00"
@.str.5 = [3 x i8] c"\\f\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
@.str.8 = [3 x i8] c"\\t\00"
@.str.9 = [3 x i8] c"%c\00"
define void @printString(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %52
9: ; preds = %2
br label %10
10: ; preds = %48, %9
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %51
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %42 [
i32 34, label %18
i32 92, label %21
i32 47, label %24
i32 8, label %27
i32 12, label %30
i32 10, label %33
i32 13, label %36
i32 9, label %39
]
18: ; preds = %14
%19 = load i32*, i32** %3
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %48
21: ; preds = %14
%22 = load i32*, i32** %3
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %48
24: ; preds = %14
%25 = load i32*, i32** %3
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %48
27: ; preds = %14
%28 = load i32*, i32** %3
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %48
30: ; preds = %14
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %48
33: ; preds = %14
%34 = load i32*, i32** %3
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %48
36: ; preds = %14
%37 = load i32*, i32** %3
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %48
39: ; preds = %14
%40 = load i32*, i32** %3
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %48
42: ; preds = %14
%43 = load i32*, i32** %3
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %42, %39, %36, %33, %30, %27, %24, %21, %18
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %4
br label %10
51: ; preds = %10
br label %52
52: ; preds = %51, %2
%53 = load i32*, i32** %3
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\/\00"
@.str.4 = [3 x i8] c"\\b\00"
@.str.5 = [3 x i8] c"\\f\00"
@.str.6 = [3 x i8] c"\\n\00"
@.str.7 = [3 x i8] c"\\r\00"
@.str.8 = [3 x i8] c"\\t\00"
define void @printString(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fputc(i32 34, i32* %0)
%4 = icmp eq i8* %1, null
br i1 %4, label %34, label %5
5: ; preds = %2
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 0
br i1 %7, label %34, label %8
8: ; preds = %5, %30
%9 = phi i8 [ %32, %30 ], [ %6, %5 ]
%10 = phi i8* [ %31, %30 ], [ %1, %5 ]
%11 = sext i8 %9 to i32
switch i32 %11, label %28 [
i32 34, label %12
i32 92, label %14
i32 47, label %16
i32 8, label %18
i32 12, label %20
i32 10, label %22
i32 13, label %24
i32 9, label %26
]
12: ; preds = %8
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
14: ; preds = %8
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
16: ; preds = %8
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
18: ; preds = %8
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
20: ; preds = %8
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
22: ; preds = %8
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
24: ; preds = %8
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
26: ; preds = %8
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %30
28: ; preds = %8
%29 = tail call i32 @fputc(i32 %11, i32* %0)
br label %30
30: ; preds = %28, %26, %24, %22, %20, %18, %16, %14, %12
%31 = getelementptr inbounds i8, i8* %10, i64 1
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %8
34: ; preds = %30, %5, %2
%35 = tail call i32 @fputc(i32 34, i32* %0)
ret void
}