#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*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int strlen(char *);
int main() {
  int i, len, n, j, l = 1;
  char sp1 = 92, sp2 = 34;
  char a[100000];
  while (scanf("%d", &n) == 1) {
    getchar();
    if (n == 0)
      break;
    printf("Case %d:\n", l);
    printf("#include<string.h>\n#include<stdio.h>\nint main()\n{\n");
    for (i = 0; i < n; i++) {
      gets(a);
      len = strlen(a);
      printf("printf(\"");
      for (j = 0; j < len; j++) {
        if (a[j] == 34)
          printf("\\\"");
        else if (a[j] == 92)
          printf("\\\\");
        else
          printf("%c", a[j]);
      }
      printf("\\n%c);", sp2);
      printf("\n");
    }
    printf("printf(%c%cn%c);\n", sp2, sp1, sp2);
    printf("return 0;\n}\n");
    l++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
movb   $0x5c,-0x19(%rbp)
movb   $0x22,-0x1a(%rbp)
lea    0xe88(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    12f4 <main+0x1a4>
mov    $0x0,%al
call   1050 <getchar@plt>
cmpl   $0x0,-0x10(%rbp)
jne    11a0 <main+0x50>
jmp    12f4 <main+0x1a4>
mov    -0x18(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12be <main+0x16e>
lea    -0x186c0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x186c0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1290 <main+0x140>
movslq -0x14(%rbp),%rax
movsbl -0x186c0(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
jne    1236 <main+0xe6>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127d <main+0x12d>
movslq -0x14(%rbp),%rax
movsbl -0x186c0(%rbp,%rax,1),%eax
ff
cmp    $0x5c,%eax
jne    125e <main+0x10e>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1278 <main+0x128>
movslq -0x14(%rbp),%rax
movsbl -0x186c0(%rbp,%rax,1),%esi
ff
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127d <main+0x12d>
jmp    1282 <main+0x132>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1202 <main+0xb2>
movsbl -0x1a(%rbp),%esi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c6 <main+0x76>
movsbl -0x1a(%rbp),%esi
movsbl -0x19(%rbp),%edx
movsbl -0x1a(%rbp),%ecx
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <main+0x21>
xor    %eax,%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186b8,%rsp
lea    0xe78(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    12d5 <main+0x165>
mov    $0x1,%ebx
lea    0xe72(%rip),%r15
lea    0xe68(%rip),%r14
jmp    11fa <main+0x8a>
lea    0xe6c(%rip),%rdi
mov    $0x22,%esi
mov    $0x5c,%edx
mov    $0x22,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ebx
add    $0x1,%ebx
lea    0xe19(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    12d5 <main+0x165>
xor    %eax,%eax
call   1070 <getchar@plt>
cmpl   $0x0,0x8(%rsp)
je     12d5 <main+0x165>
lea    0xdf0(%rip),%rdi
mov    %ebx,0xc(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe0e(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    11b0 <main+0x40>
xor    %r13d,%r13d
jmp    126c <main+0xfc>
nopl   0x0(%rax)
lea    0xdd5(%rip),%rdi
mov    $0x22,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    0x8(%rsp),%r13d
jge    11b0 <main+0x40>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <gets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
lea    0xd82(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r12d,%r12d
jle    1240 <main+0xd0>
mov    %r12d,%ebx
xor    %ebp,%ebp
jmp    12b3 <main+0x143>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1240 <main+0xd0>
movsbl 0x10(%rsp,%rbp,1),%edi
cmp    $0x5c,%edi
je     12d0 <main+0x160>
cmp    $0x22,%dil
je     12a0 <main+0x130>
call   1030 <putchar@plt>
jmp    12aa <main+0x13a>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
jmp    12a3 <main+0x133>
xor    %eax,%eax
add    $0x186b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"Case %d:\0A\00"
@.str.2 = [51 x i8] c"#include<string.h>\0A#include<stdio.h>\0Aint main()\0A{\0A\00"
@.str.3 = [9 x i8] c"printf(\22\00"
@.str.4 = [3 x i8] c"\\\22\00"
@.str.5 = [3 x i8] c"\\\\\00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [7 x i8] c"\\n%c);\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [18 x i8] c"printf(%c%cn%c);\0A\00"
@.str.10 = [13 x i8] c"return 0;\0A}\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca [100000 x i8]
store i32 0, i32* %1
store i32 1, i32* %6
store i8 92, i8* %7
store i8 34, i8* %8
br label %10
10: ; preds = %74, %0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %85
13: ; preds = %10
%14 = call i32 (...) @getchar()
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
br label %85
18: ; preds = %13
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %22
22: ; preds = %71, %18
%23 = load i32, i32* %2
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %74
26: ; preds = %22
%27 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 0
%28 = call i32 @gets(i8* %27)
%29 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
store i32 %30, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %32
32: ; preds = %63, %26
%33 = load i32, i32* %5
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %66
36: ; preds = %32
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 34
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %62
45: ; preds = %36
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 92
br i1 %51, label %52, label %54
52: ; preds = %45
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %61
54: ; preds = %45
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %54, %52
br label %62
62: ; preds = %61, %43
br label %63
63: ; preds = %62
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %32
66: ; preds = %32
%67 = load i8, i8* %8
%68 = sext i8 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %71
71: ; preds = %66
%72 = load i32, i32* %2
%73 = add nsw i32 %72, 1
store i32 %73, i32* %2
br label %22
74: ; preds = %22
%75 = load i8, i8* %8
%76 = sext i8 %75 to i32
%77 = load i8, i8* %7
%78 = sext i8 %77 to i32
%79 = load i8, i8* %8
%80 = sext i8 %79 to i32
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %76, i32 %78, i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %6
br label %10
85: ; preds = %17, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"Case %d:\0A\00"
@.str.3 = [9 x i8] c"printf(\22\00"
@.str.4 = [3 x i8] c"\\\22\00"
@.str.5 = [3 x i8] c"\\\\\00"
@.str.7 = [7 x i8] c"\\n%c);\00"
@.str.9 = [18 x i8] c"printf(%c%cn%c);\0A\00"
@str = [50 x i8] c"#include<string.h>\0A#include<stdio.h>\0Aint main()\0A{\00"
@str.11 = [12 x i8] c"return 0;\0A}\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %51
7: ; preds = %0, %45
%8 = phi i32 [ %48, %45 ], [ 1, %0 ]
%9 = call i32 (...) @getchar()
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %51, label %12
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %45
17: ; preds = %12, %39
%18 = phi i32 [ %42, %39 ], [ 0, %12 ]
%19 = call i32 @gets(i8* %4)
%20 = call i32 @strlen(i8* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp sgt i32 %20, 0
br i1 %22, label %23, label %39
23: ; preds = %17
%24 = zext i32 %20 to i64
br label %25
25: ; preds = %23, %36
%26 = phi i64 [ 0, %23 ], [ %37, %36 ]
%27 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
switch i8 %28, label %33 [
i8 34, label %29
i8 92, label %31
]
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %36
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %36
33: ; preds = %25
%34 = sext i8 %28 to i32
%35 = call i32 @putchar(i32 %34)
br label %36
36: ; preds = %29, %33, %31
%37 = add nuw nsw i64 %26, 1
%38 = icmp eq i64 %37, %24
br i1 %38, label %39, label %25
39: ; preds = %36, %17
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 34)
%41 = call i32 @putchar(i32 10)
%42 = add nuw nsw i32 %18, 1
%43 = load i32, i32* %1
%44 = icmp slt i32 %42, %43
br i1 %44, label %17, label %45
45: ; preds = %39, %12
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 34, i32 92, i32 34)
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
%48 = add nuw nsw i32 %8, 1
%49 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%50 = icmp eq i32 %49, 1
br i1 %50, label %7, label %51
51: ; preds = %45, %7, %0
ret i32 0
}