#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() {
  char passIsGood = 0;
  char buf[80];
  printf("Enter password:\n");
  gets(buf);
  if (strcmp(buf, "GOODPASS") == 0)
    passIsGood = 1;
  if (passIsGood == 1)
    printf("You win!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1176 <main+0x46>
movb   $0x1,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    118f <main+0x5f>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    116c <main+0x3c>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter password:\0A\00"
@.str.1 = [9 x i8] c"GOODPASS\00"
@.str.2 = [10 x i8] c"You win!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [80 x i8]
store i32 0, i32* %1
store i8 0, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
store i8 1, i8* %2
br label %11
11: ; preds = %10, %0
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"GOODPASS\00"
@str = [16 x i8] c"Enter password:\00"
@str.3 = [9 x i8] c"You win!\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
ret i32 0
}