#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 */
scalar_t__ authenticate(char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    puts("Provide password as a parameter.");
    return 1;
  }
  if (authenticate(argv[1])) {
    puts("Access GRANTED.");
  } else {
    puts("Access REFUSED.");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1193 <main+0x73>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <authenticate@plt>
cmp    $0x0,%rax
je     1180 <main+0x60>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
jmp    118c <main+0x6c>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jge    1134 <main+0x14>
mov    $0x1,%ebx
lea    0xece(%rip),%rdi
jmp    1154 <main+0x34>
mov    0x8(%rsi),%rdi
call   1030 <authenticate@plt>
test   %rax,%rax
lea    0xeea(%rip),%rax
lea    0xed3(%rip),%rdi
cmove  %rax,%rdi
xor    %ebx,%ebx
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Provide password as a parameter.\00"
@.str.1 = [16 x i8] c"Access GRANTED.\00"
@.str.2 = [16 x i8] c"Access REFUSED.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @authenticate(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %20
18: ; preds = %10
%19 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
store i32 0, i32* %3
br label %21
21: ; preds = %20, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [33 x i8] c"Provide password as a parameter.\00"
@.str.1 = [16 x i8] c"Access GRANTED.\00"
@.str.2 = [16 x i8] c"Access REFUSED.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @authenticate(i8* %6)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
br label %10
10: ; preds = %4, %2
%11 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), %2 ], [ %9, %4 ]
%12 = phi i32 [ 1, %2 ], [ 0, %4 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 %12
}