#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 *, ...);
int /*<<< orphan*/ putchar(int);
decls(int d, char *s) {
  printf("char *s%d=\"", d);
  for (; *s; s++) {
    if (*s == '\n')
      printf("\\n");
    else if (*s == '\\')
      printf("\\\\");
    else if (*s == '\"')
      printf("\\\"");
    else
      putchar((int)(*s));
  }
  printf("\";\n");
}


x86 assembly (clang, -O0):
<decls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e2 <decls+0xc2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1170 <decls+0x50>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cc <decls+0xac>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1193 <decls+0x73>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c7 <decls+0xa7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11b6 <decls+0x96>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c2 <decls+0xa2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    11c7 <decls+0xa7>
jmp    11cc <decls+0xac>
jmp    11d1 <decls+0xb1>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <decls+0x20>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decls>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeba(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0xeaf(%rip),%r12
jmp    117e <decls+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movsbl (%rbx),%edi
cmp    $0x21,%edi
jle    11a0 <decls+0x70>
cmp    $0x22,%dil
je     1170 <decls+0x40>
cmp    $0x5c,%dil
jne    11b0 <decls+0x80>
mov    %r12,%rdi
jmp    1173 <decls+0x43>
nopw   0x0(%rax,%rax,1)
cmp    $0xa,%dil
jne    11ab <decls+0x7b>
mov    %r14,%rdi
jmp    1173 <decls+0x43>
test   %dil,%dil
je     11bb <decls+0x8b>
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    117e <decls+0x4e>
lea    0xe53(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"char *s%d=\22\00"
@.str.1 = [3 x i8] c"\\n\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\\22\00"
@.str.4 = [4 x i8] c"\22;\0A\00"
define i32 @decls(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %41, %2
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %40
19: ; preds = %12
%20 = load i8*, i8** %5
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 92
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %39
26: ; preds = %19
%27 = load i8*, i8** %5
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 34
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %38
33: ; preds = %26
%34 = load i8*, i8** %5
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = call i32 @putchar(i32 %36)
br label %38
38: ; preds = %33, %31
br label %39
39: ; preds = %38, %24
br label %40
40: ; preds = %39, %17
br label %41
41: ; preds = %40
%42 = load i8*, i8** %5
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %5
br label %8
44: ; preds = %8
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [12 x i8] c"char *s%d=\22\00"
@.str.1 = [3 x i8] c"\\n\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\\22\00"
@str = [3 x i8] c"\22;\00"
define i32 @decls(i32 %0, i8* nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %4
4: ; preds = %16, %2
%5 = phi i8* [ %1, %2 ], [ %17, %16 ]
%6 = load i8, i8* %5
switch i8 %6, label %13 [
i8 0, label %18
i8 10, label %7
i8 92, label %9
i8 34, label %11
]
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %16
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %16
11: ; preds = %4
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %16
13: ; preds = %4
%14 = sext i8 %6 to i32
%15 = tail call i32 @putchar(i32 %14)
br label %16
16: ; preds = %7, %11, %13, %9
%17 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
18: ; preds = %4
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 undef
}