#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ shell();
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("usage:\n%s string\n", argv[0]);
    return EXIT_FAILURE;
  }
  int set_me = 0;
  char buf[15];
  strcpy(buf, argv[1]);
  if (set_me == 0xdeadbeef) {
    shell();
  } else {
    printf("Not authenticated.\nset_me was %d\n", set_me);
  }
  return EXIT_SUCCESS;
}


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     1176 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <main+0x94>
movl   $0x0,-0x14(%rbp)
lea    -0x23(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
cmpl   $0xdeadbeef,-0x14(%rbp)
jne    11a7 <main+0x77>
mov    $0x0,%al
call   1050 <shell@plt>
jmp    11b8 <main+0x88>
mov    -0x14(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1150 <main+0x30>
mov    0x8(%rsi),%rsi
lea    0x9(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0xed4(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e8a(%rip),%rax
jmp    1168 <main+0x48>
mov    (%rsi),%rsi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"usage:\0A%s string\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [34 x i8] c"Not authenticated.\0Aset_me was %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [15 x i8]
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 %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %3
br label %31
16: ; preds = %2
store i32 0, i32* %6
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcpy(i8* %17, i8* %20)
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, -559038737
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = call i32 (...) @shell()
br label %29
26: ; preds = %16
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %24
%30 = load i32, i32* @EXIT_SUCCESS
store i32 %30, i32* %3
br label %31
31: ; preds = %29, %10
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [18 x i8] c"usage:\0A%s string\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [34 x i8] c"Not authenticated.\0Aset_me was %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [15 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
br label %16
9: ; preds = %2
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcpy(i8* %10, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 0)
%15 = load i32, i32* @EXIT_SUCCESS
br label %16
16: ; preds = %9, %5
%17 = phi i32 [ %8, %5 ], [ %15, %9 ]
ret i32 %17
}