#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 *);
int strcmp(char *, char const *const);
int main(int argc, char *agrv[]) {
  const char *const pass = "$1$Og9RbNrT$/gNprNaDgv.hNS01Ue2gi1";
  char *result;
  int ok;
  result = crypt(getpass("Password:"), pass);
  ok = strcmp(result, pass);
  if (ok == 0) {
    puts("Access granted\n");
    return 0;
  } else {
    puts("Access denied\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xebb(%rip),%rdi
call   1060 <getpass@plt>
mov    %eax,%edi
lea    0xe8a(%rip),%rsi
call   1040 <crypt@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11b4 <main+0x74>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <main+0x87>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%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   %eax,%eax
setne  %bl
lea    0xeb6(%rip),%rax
lea    0xebf(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

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