#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_special(const char s[]) {
  printf("\"");
  while (*s) {
    if (34 == (*s))
      printf("\\\"");
    else if (10 == (*s))
      printf("\\n");
    else if (92 == (*s))
      printf("\\\\");
    else if (37 == (*s))
      printf("%%");
    else
      printf("%c", *s);
    ++s;
  }
  printf("\"");
}


x86 assembly (clang, -O0):
<print_special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1208 <print_special+0xf8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x22,%eax
cmp    %ecx,%eax
jne    115e <print_special+0x4e>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f7 <print_special+0xe7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
jne    1185 <print_special+0x75>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <print_special+0xe2>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x5c,%eax
cmp    %ecx,%eax
jne    11ac <print_special+0x9c>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <print_special+0xdd>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x25,%eax
cmp    %ecx,%eax
jne    11d3 <print_special+0xc3>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <print_special+0xd8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <print_special+0xdd>
jmp    11f2 <print_special+0xe2>
jmp    11f7 <print_special+0xe7>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112a <print_special+0x1a>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_special>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%rbx
mov    $0x22,%edi
call   1030 <putchar@plt>
lea    0xf61(%rip),%r14
lea    0xebc(%rip),%r13
lea    0xf50(%rip),%r15
lea    0xf46(%rip),%r12
jmp    116e <print_special+0x4e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x25,%rax
ja     1190 <print_special+0x70>
movslq 0x0(%r13,%rax,4),%rcx
add    %r13,%rcx
jmp    *%rcx
mov    %r15,%rdi
jmp    1163 <print_special+0x43>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x5c,%al
jne    11a0 <print_special+0x80>
mov    %r14,%rdi
jmp    1163 <print_special+0x43>
nopl   0x0(%rax)
movsbl %al,%edi
jmp    11b5 <print_special+0x95>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x25,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    116e <print_special+0x4e>
mov    $0x22,%edi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putchar@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"\\n\00"
@.str.3 = [3 x i8] c"\\\\\00"
@.str.4 = [3 x i8] c"%%\00"
@.str.5 = [3 x i8] c"%c\00"
define void @print_special(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %44, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %47
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 34, %11
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %44
15: ; preds = %8
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 10, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %43
22: ; preds = %15
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 92, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %42
29: ; preds = %22
%30 = load i8*, i8** %2
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 37, %32
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %41
36: ; preds = %29
%37 = load i8*, i8** %2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %36, %34
br label %42
42: ; preds = %41, %27
br label %43
43: ; preds = %42, %20
br label %44
44: ; preds = %43, %13
%45 = load i8*, i8** %2
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %2
br label %4
47: ; preds = %4
%48 = call i32 (i8*, ...) @printf(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"\\n\00"
@.str.3 = [3 x i8] c"\\\\\00"
define void @print_special(i8* nocapture %0) {
%2 = tail call i32 @putchar(i32 34)
br label %3
3: ; preds = %17, %1
%4 = phi i8* [ %0, %1 ], [ %18, %17 ]
%5 = load i8, i8* %4
switch i8 %5, label %14 [
i8 0, label %19
i8 34, label %6
i8 10, label %8
i8 92, label %10
i8 37, label %12
]
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %17
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %17
10: ; preds = %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %17
12: ; preds = %3
%13 = tail call i32 @putchar(i32 37)
br label %17
14: ; preds = %3
%15 = sext i8 %5 to i32
%16 = tail call i32 @putchar(i32 %15)
br label %17
17: ; preds = %8, %12, %14, %10, %6
%18 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
19: ; preds = %3
%20 = tail call i32 @putchar(i32 34)
ret void
}