#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*/ get_user_input(char *);
int /*<<< orphan*/ printf(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++) {
    get_user_input(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   1050 <memset@plt>
movb   $0x66,-0x70(%rbp)
movb   $0x61,-0x6f(%rbp)
movb   $0x69,-0x6e(%rbp)
movb   $0x6c,-0x6d(%rbp)
lea    0xe87(%rip),%rdi
call   1040 <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   1060 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11cd <main+0x8d>
jmp    1229 <main+0xe9>
lea    -0xe0(%rbp),%rdi
call   1030 <get_user_input@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1204 <main+0xc4>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <main+0xd0>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
jmp    1215 <main+0xd5>
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    1268 <main+0x128>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    127b <main+0x13b>
jmp    12c6 <main+0x186>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12ad <main+0x16d>
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
jmp    12b2 <main+0x172>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1233 <main+0xf3>
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    0xea9(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     126d <main+0x12d>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <get_user_input@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11cb <main+0x8b>
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
jmp    11d7 <main+0x97>
lea    0xf04(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     126d <main+0x12d>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <get_user_input@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1218 <main+0xd8>
lea    0xdef(%rip),%rdi
call   1050 <printf@plt>
jmp    1224 <main+0xe4>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     126d <main+0x12d>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <get_user_input@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1261 <main+0x121>
lea    0xda6(%rip),%rdi
call   1050 <printf@plt>
jmp    126d <main+0x12d>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2710,%ebp
mov    %rsp,%r14
lea    0x70(%rsp),%rbx
lea    0xddf(%rip),%r15
lea    0xe13(%rip),%r12
jmp    1295 <main+0x155>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     12c7 <main+0x187>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12c7 <main+0x187>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1290 <main+0x150>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    1290 <main+0x150>
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 = [56 x i8] c"Well done. You got it right! You are very clever!!!!!!\0A\00"
@.str.2 = [46 x i8] c"%s is not the secret word, please try again:\0A\00"
@.str.3 = [60 x i8] c"FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL\0A\00"
@.str.4 = [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 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%24 = call i32 @get_user_input(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.1, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, 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.3, i64 0, i64 0))
%55 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, 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.2 = [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.5 = [59 x i8] c"FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL\00"
@str.6 = [59 x i8] c"!!!!!!!!!!!!!!!!!!!!!!!!FAIL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\00"
@str.7 = [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 = call i64 @strcmp(i8* %3, i8* %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %41, label %11
11: ; preds = %0
%12 = call i32 @get_user_input(i8* %7)
%13 = call i64 @strcmp(i8* %3, i8* %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %15, %17
%20 = call i64 @strcmp(i8* %3, i8* %7)
%21 = icmp eq i64 %20, 0
br i1 %21, label %41, label %22
22: ; preds = %19
%23 = call i32 @get_user_input(i8* %7)
%24 = call i64 @strcmp(i8* %3, i8* %7)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %30
28: ; preds = %22
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
%31 = call i64 @strcmp(i8* %3, i8* %7)
%32 = icmp eq i64 %31, 0
br i1 %32, label %41, label %33
33: ; preds = %30
%34 = call i32 @get_user_input(i8* %7)
%35 = call i64 @strcmp(i8* %3, i8* %7)
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %41
39: ; preds = %33
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
br label %41
41: ; preds = %37, %39, %30, %19, %0
br label %42
42: ; preds = %41, %52
%43 = phi i32 [ %53, %52 ], [ 0, %41 ]
%44 = call i64 @strcmp(i8* %3, i8* %7)
%45 = icmp eq i64 %44, 0
br i1 %45, label %55, label %46
46: ; preds = %42
%47 = call i64 @strcmp(i8* %3, i8* %7)
%48 = icmp eq i64 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %46
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.5, i64 0, i64 0))
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.6, i64 0, i64 0))
br label %52
52: ; preds = %46, %49
%53 = add nuw nsw i32 %43, 1
%54 = icmp eq i32 %53, 10000
br i1 %54, label %55, label %42
55: ; preds = %52, %42
ret i32 0
}