#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 */
typedef int /*<<< orphan*/ passwd;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  int flag = 0;
  char passwd[10];
  memset(passwd, 0, sizeof(passwd));
  strcpy(passwd, argv[1]);
  if (0 == strcmp("LinuxGeek", passwd))
    flag = 1;
  if (flag)
    printf("\n Password cracked \n");
  else
    printf("\n Incorrect passwd \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x1e(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x1e(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x1e(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11a3 <main+0x63>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11be <main+0x7e>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
jmp    11ca <main+0x8a>
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
lea    0xe(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xe8f(%rip),%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
lea    0xe9b(%rip),%rax
lea    0xe80(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"LinuxGeek\00"
@str = [20 x i8] c"\0A Incorrect passwd \00"
@str.3 = [20 x i8] c"\0A Password cracked \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 10)
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @strcpy(i8* %4, i8* %7)
%9 = call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0)
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}