#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    exit(0);
  }
  char pass[16];
  int auth = 0;
  strcpy(pass, argv[1]);
  if (strcmp(pass, "passkey") == 0) {
    auth = 1;
  } else {
    printf("Wrong Password.\n");
  }
  if (auth == 1) {
    printf("Secret!\n");
  }
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1167 <main+0x27>
xor    %edi,%edi
call   1060 <exit@plt>
movl   $0x0,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a5 <main+0x65>
movl   $0x1,-0x24(%rbp)
jmp    11b1 <main+0x71>
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x24(%rbp)
jne    11c7 <main+0x87>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    118a <main+0x4a>
mov    0x8(%rsi),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xea6(%rip),%rax
lea    0xe8f(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"passkey\00"
@.str.1 = [17 x i8] c"Wrong Password.\0A\00"
@.str.2 = [9 x i8] c"Secret!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
store i32 0, i32* %7
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %12
store i32 1, i32* %7
br label %24
22: ; preds = %12
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %21
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"passkey\00"
@str = [16 x i8] c"Wrong Password.\00"
@str.3 = [8 x i8] c"Secret!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strcpy(i8* %8, i8* %10)
%12 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 0
}