#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  int villains;
  char villain[41];
  int i, v;
  freopen("avengers.in", "r", stdin);
  scanf("%d", &villains);
  gets(villain);
  for (v = 0; v < villains; v++) {
    for (i = 0; i < 40; i++)
      villain[i] = 0;
    gets(villain);
    if (v % 3 == 0) {
      printf("Captain America: I'll take care of %s!\n", villain);
    } else if (v % 3 == 1) {
      printf("Thor: I shall deal with %s!\n", villain);
    } else {
      printf("HULK SMASH!\n");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1040 <freopen@plt>
lea    0xe9c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x40(%rbp),%rdi
call   1050 <gets@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124d <main+0x10d>
movl   $0x0,-0x44(%rbp)
cmpl   $0x28,-0x44(%rbp)
jge    11bf <main+0x7f>
movslq -0x44(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    119e <main+0x5e>
lea    -0x40(%rbp),%rdi
call   1050 <gets@plt>
mov    -0x48(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f3 <main+0xb3>
lea    -0x40(%rbp),%rsi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0xf1>
mov    -0x48(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    121e <main+0xde>
lea    -0x40(%rbp),%rsi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0xec>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0xf1>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    118b <main+0x4b>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    0xe82(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1060 <freopen@plt>
lea    0xe7d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
lea    0x10(%rsp),%rdi
call   1070 <gets@plt>
cmpl   $0x0,0xc(%rsp)
jle    1243 <main+0xe3>
mov    $0xaaaaaaab,%r13d
lea    0x10(%rsp),%rbx
lea    0xe4f(%rip),%r15
lea    0xe8d(%rip),%r12
xor    %ebp,%ebp
jmp    11eb <main+0x8b>
nopl   (%rax)
mov    %r12,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1243 <main+0xe3>
mov    %ebp,%eax
imul   %r13,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%r14d
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
mov    %rbx,%rdi
call   1070 <gets@plt>
mov    %ebp,%eax
sub    %r14d,%eax
cmp    $0x1,%eax
je     1230 <main+0xd0>
test   %eax,%eax
jne    11d0 <main+0x70>
mov    %r15,%rdi
jmp    1237 <main+0xd7>
nopw   0x0(%rax,%rax,1)
lea    0xe02(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11d8 <main+0x78>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"avengers.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [40 x i8] c"Captain America: I'll take care of %s!\0A\00"
@.str.4 = [29 x i8] c"Thor: I shall deal with %s!\0A\00"
@.str.5 = [13 x i8] c"HULK SMASH!\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [41 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @stdin
%7 = call i32 @freopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
store i32 0, i32* %5
br label %11
11: ; preds = %47, %0
%12 = load i32, i32* %5
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %50
15: ; preds = %11
store i32 0, i32* %4
br label %16
16: ; preds = %23, %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 40
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %19
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %16
26: ; preds = %16
%27 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%28 = call i32 @gets(i8* %27)
%29 = load i32, i32* %5
%30 = srem i32 %29, 3
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %45
35: ; preds = %26
%36 = load i32, i32* %5
%37 = srem i32 %36, 3
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %40)
br label %44
42: ; preds = %35
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
br label %45
45: ; preds = %44, %32
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %11
50: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"avengers.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [40 x i8] c"Captain America: I'll take care of %s!\0A\00"
@.str.4 = [29 x i8] c"Thor: I shall deal with %s!\0A\00"
@str = [12 x i8] c"HULK SMASH!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [41 x i8]
%3 = getelementptr inbounds [41 x i8], [41 x i8]* %2, i64 0, i64 0
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [41 x i8], [41 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = tail call i32 @freopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = call i32 @gets(i8* %5)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %0, %22
%13 = phi i32 [ %24, %22 ], [ 0, %0 ]
%14 = call i32 @gets(i8* %5)
%15 = urem i32 %13, 3
switch i32 %15, label %20 [
i32 0, label %16
i32 1, label %18
]
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %22
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %5)
br label %22
20: ; preds = %12
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %18, %20, %16
%23 = call i32 @putchar(i32 10)
%24 = add nuw nsw i32 %13, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %24, %25
br i1 %26, label %12, label %27
27: ; preds = %22, %0
ret i32 0
}