#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char password_buffer[10];
  bool password_found = false;
  printf(
      "Welcome to the Top secret website! Enter your password to continue\n");
  gets(password_buffer);
  printf("\n You entered: %s\n", password_buffer);
  if (strcmp(password_buffer, "secret")) {
    printf("Sorry! Wrong password. You can't Enter\n");
  } else {
    printf("Well done. Password is corrct. You got the password right. Go "
           "right thru. \n");
    password_found = true;
  }
  if (password_found) {
    printf("\n***************\nNow entering the secret "
           "region.\n*****************\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xe(%rbp),%rsi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
lea    0xedd(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     119c <main+0x6c>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x81>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c9 <main+0x99>
lea    0xf10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     118c <main+0x4c>
lea    0xf61(%rip),%rdi
jmp    119f <main+0x5f>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [68 x i8] c"Welcome to the Top secret website! Enter your password to continue\0A\00"
@.str.1 = [19 x i8] c"\0A You entered: %s\0A\00"
@.str.2 = [7 x i8] c"secret\00"
@.str.3 = [40 x i8] c"Sorry! Wrong password. You can't Enter\0A\00"
@.str.4 = [76 x i8] c"Well done. Password is corrct. You got the password right. Go right thru. \0A\00"
@.str.5 = [68 x i8] c"\0A***************\0ANow entering the secret region.\0A*****************\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"\0A You entered: %s\0A\00"
@.str.2 = [7 x i8] c"secret\00"
@str = [67 x i8] c"Welcome to the Top secret website! Enter your password to continue\00"
@str.6 = [75 x i8] c"Well done. Password is corrct. You got the password right. Go right thru. \00"
@str.7 = [67 x i8] c"\0A***************\0ANow entering the secret region.\0A*****************\00"
@str.8 = [39 x i8] c"Sorry! Wrong password. You can't Enter\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.6, i64 0, i64 0))
br label %10
10: ; preds = %0, %8
%11 = phi i8* [ getelementptr inbounds ([67 x i8], [67 x i8]* @str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0), %0 ]
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}