#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*/ scanf(char *, char **);
scalar_t__ strcmp(char const *, char *);
int main(void) {
  const char SECRET[100] = "fail";
  char guess[100];
  int counter;
  printf("You only have 3 chances to guess the secret word:\n");
  for (counter = 0; (counter < 3) && (strcmp(SECRET, guess) != 0); counter++) {
    scanf("%99s", &guess);
    if (strcmp(SECRET, guess) == 0) {
      printf("Well done. You got it right! You are very clever!!!!!!\n");
    } else {
      printf("%s is not the secret word, please try again:\n");
    }
  }
  for (counter = 0; (counter < 10000) && (strcmp(SECRET, guess) != 0);
       counter++) {
    if (strcmp(SECRET, guess) != 0) {
      printf("FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL\n");
      printf("!!!!!!!!!!!!!!!!!!!!!!!!FAIL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x66,-0x70(%rbp)
movb   $0x61,-0x6f(%rbp)
movb   $0x69,-0x6e(%rbp)
movb   $0x6c,-0x6d(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xe4(%rbp)
xor    %eax,%eax
cmpl   $0x3,-0xe4(%rbp)
mov    %al,-0xe5(%rbp)
jge    11ba <main+0x7a>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11cd <main+0x8d>
jmp    1230 <main+0xf0>
lea    -0xe0(%rbp),%rsi
lea    0xe58(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    120b <main+0xcb>
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xd7>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    121c <main+0xdc>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1188 <main+0x48>
movl   $0x0,-0xe4(%rbp)
xor    %eax,%eax
cmpl   $0x2710,-0xe4(%rbp)
mov    %al,-0xe6(%rbp)
jge    126f <main+0x12f>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    1282 <main+0x142>
jmp    12cd <main+0x18d>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12b4 <main+0x174>
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    12b9 <main+0x179>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    123a <main+0xfa>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x6c696166,(%rsp)
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1282 <main+0x142>
lea    0xe59(%rip),%rdi
lea    0x70(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d2 <main+0x92>
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
jmp    11de <main+0x9e>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1282 <main+0x142>
lea    0xe05(%rip),%rdi
lea    0x70(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1226 <main+0xe6>
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
jmp    1232 <main+0xf2>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1282 <main+0x142>
lea    0xdb5(%rip),%rdi
lea    0x70(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1276 <main+0x136>
lea    0xd96(%rip),%rdi
call   1040 <printf@plt>
jmp    1282 <main+0x142>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2710,%ebp
mov    %rsp,%r14
lea    0x70(%rsp),%rbx
lea    0xdcf(%rip),%r15
lea    0xe03(%rip),%r12
jmp    12a5 <main+0x165>
nop
add    $0xffffffff,%ebp
je     12d7 <main+0x197>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12d7 <main+0x197>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12a0 <main+0x160>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    12a0 <main+0x160>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"You only have 3 chances to guess the secret word:\0A\00"
@.str.1 = [5 x i8] c"%99s\00"
@.str.2 = [56 x i8] c"Well done. You got it right! You are very clever!!!!!!\0A\00"
@.str.3 = [46 x i8] c"%s is not the secret word, please try again:\0A\00"
@.str.4 = [60 x i8] c"FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL\0A\00"
@.str.5 = [60 x i8] c"!!!!!!!!!!!!!!!!!!!!!!!!FAIL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [100 x i8]* %2 to i8*
%6 = bitcast i8* %5 to [100 x i8]*
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 0
store i8 102, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 1
store i8 97, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 2
store i8 105, i8* %9
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 3
store i8 108, i8* %10
%11 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %12
12: ; preds = %34, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = call i64 @strcmp(i8* %16, i8* %17)
%19 = icmp ne i64 %18, 0
br label %20
20: ; preds = %15, %12
%21 = phi i1 [ false, %12 ], [ %19, %15 ]
br i1 %21, label %22, label %37
22: ; preds = %20
%23 = bitcast [100 x i8]* %3 to i8**
%24 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%27 = call i64 @strcmp(i8* %25, i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %12
37: ; preds = %20
store i32 0, i32* %4
br label %38
38: ; preds = %57, %37
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 10000
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%44 = call i64 @strcmp(i8* %42, i8* %43)
%45 = icmp ne i64 %44, 0
br label %46
46: ; preds = %41, %38
%47 = phi i1 [ false, %38 ], [ %45, %41 ]
br i1 %47, label %48, label %60
48: ; preds = %46
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%51 = call i64 @strcmp(i8* %49, i8* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
%55 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
br label %56
56: ; preds = %53, %48
br label %57
57: ; preds = %56
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %38
60: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%99s\00"
@.str.3 = [46 x i8] c"%s is not the secret word, please try again:\0A\00"
@str = [50 x i8] c"You only have 3 chances to guess the secret word:\00"
@str.6 = [59 x i8] c"FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL\00"
@str.7 = [59 x i8] c"!!!!!!!!!!!!!!!!!!!!!!!!FAIL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\00"
@str.8 = [55 x i8] c"Well done. You got it right! You are very clever!!!!!!\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 102, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 97, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 2
store i8 105, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 3
store i8 108, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%9 = bitcast [100 x i8]* %2 to i8**
%10 = call i64 @strcmp(i8* %3, i8* %7)
%11 = icmp eq i64 %10, 0
br i1 %11, label %42, label %12
12: ; preds = %0
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9)
%14 = call i64 @strcmp(i8* %3, i8* %7)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.8, i64 0, i64 0))
br label %20
18: ; preds = %12
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %16, %18
%21 = call i64 @strcmp(i8* %3, i8* %7)
%22 = icmp eq i64 %21, 0
br i1 %22, label %42, label %23
23: ; preds = %20
%24 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9)
%25 = call i64 @strcmp(i8* %3, i8* %7)
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %31
29: ; preds = %23
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.8, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
%32 = call i64 @strcmp(i8* %3, i8* %7)
%33 = icmp eq i64 %32, 0
br i1 %33, label %42, label %34
34: ; preds = %31
%35 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9)
%36 = call i64 @strcmp(i8* %3, i8* %7)
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %42
40: ; preds = %34
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.8, i64 0, i64 0))
br label %42
42: ; preds = %38, %40, %31, %20, %0
br label %43
43: ; preds = %42, %53
%44 = phi i32 [ %54, %53 ], [ 0, %42 ]
%45 = call i64 @strcmp(i8* %3, i8* %7)
%46 = icmp eq i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %43
%48 = call i64 @strcmp(i8* %3, i8* %7)
%49 = icmp eq i64 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.6, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.7, i64 0, i64 0))
br label %53
53: ; preds = %47, %50
%54 = add nuw nsw i32 %44, 1
%55 = icmp eq i32 %54, 10000
br i1 %55, label %56, label %43
56: ; preds = %53, %43
ret i32 0
}