#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 */
char *crypt(int /*<<< orphan*/, char const *const);
int /*<<< orphan*/ getpass(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char const *const);
int main(void) {
  const char *const pass = "$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/";
  char *result;
  int ok;
  result = crypt(getpass("Password:"), pass);
  ok = strcmp(result, pass) == 0;
  puts(ok ? "Access granted." : "Access denied.");
  return ok ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec2(%rip),%rdi
call   1060 <getpass@plt>
mov    %eax,%edi
lea    0xe91(%rip),%rsi
call   1040 <crypt@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
lea    0xe9c(%rip),%rdi
lea    0xe85(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
mov    -0x1c(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xedb(%rip),%rdi
call   1060 <getpass@plt>
lea    0xeac(%rip),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <crypt@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
lea    0xeb5(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/\00"
@.str.1 = [10 x i8] c"Password:\00"
@.str.2 = [16 x i8] c"Access granted.\00"
@.str.3 = [15 x i8] c"Access denied.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = call i32 @getpass(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = call i8* @crypt(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i32 0, i32 0))
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i32 0, i32 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0)
%15 = call i32 @puts(i8* %14)
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 0, i32 1
ret i32 %19
}

LLVM IR (-O2):
@.str = [35 x i8] c"$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/\00"
@.str.1 = [10 x i8] c"Password:\00"
@.str.2 = [16 x i8] c"Access granted.\00"
@.str.3 = [15 x i8] c"Access denied.\00"
define i32 @main() {
%1 = tail call i32 @getpass(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i8* @crypt(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = xor i1 %4, true
%8 = zext i1 %7 to i32
ret i32 %8
}