#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*/ puts(char *);
int /*<<< orphan*/ s_gets(char *, int);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char try[40];
  puts("Who is buried in Grant's tomb?");
  s_gets(try, 40);
  while (strcmp(try, "Grant") != 0) {
    puts("No, that's wrong. Try agin.");
    s_gets(try, 40);
  }
  puts("That's right!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    -0x30(%rbp),%rdi
mov    $0x28,%esi
call   1040 <s_gets@plt>
lea    -0x30(%rbp),%rdi
lea    0xebb(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1192 <main+0x62>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
lea    -0x30(%rbp),%rdi
mov    $0x28,%esi
call   1040 <s_gets@plt>
jmp    1159 <main+0x29>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
call   1040 <s_gets@plt>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11a5 <main+0x75>
lea    0xeb5(%rip),%r14
mov    %rsp,%rbx
lea    0xea5(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1040 <s_gets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1180 <main+0x50>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Who is buried in Grant's tomb?\00"
@.str.1 = [6 x i8] c"Grant\00"
@.str.2 = [28 x i8] c"No, that's wrong. Try agin.\00"
@.str.3 = [14 x i8] c"That's right!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [40 x i8]
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%5 = call i32 @s_gets(i8* %4, i32 40)
br label %6
6: ; preds = %10, %0
%7 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%13 = call i32 @s_gets(i8* %12, i32 40)
br label %6
14: ; preds = %6
%15 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Who is buried in Grant's tomb?\00"
@.str.1 = [6 x i8] c"Grant\00"
@.str.2 = [28 x i8] c"No, that's wrong. Try agin.\00"
@.str.3 = [14 x i8] c"That's right!\00"
define i32 @main() {
%1 = alloca [40 x i8]
%2 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @s_gets(i8* %2, i32 40)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %0, %7
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @s_gets(i8* %2, i32 40)
%10 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}