#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char buff[10];
  int pass = 0;
  printf("\n Enter the password : \n");
  gets(buff);
  if (strcmp(buff, "thegeekstuff")) {
    printf("\n Wrong Password \n");
  } else {
    printf("\n Correct Password \n");
    pass = 1;
  }
  if (pass == 1) {
    printf("\n Root privileges given to the user \n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xe(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1186 <main+0x56>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x69>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11af <main+0x7f>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     116b <main+0x3b>
lea    0xef5(%rip),%rdi
jmp    117e <main+0x4e>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A Enter the password : \0A\00"
@.str.1 = [13 x i8] c"thegeekstuff\00"
@.str.2 = [19 x i8] c"\0A Wrong Password \0A\00"
@.str.3 = [21 x i8] c"\0A Correct Password \0A\00"
@.str.4 = [38 x i8] c"\0A Root privileges given to the user \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"thegeekstuff\00"
@str = [24 x i8] c"\0A Enter the password : \00"
@str.5 = [20 x i8] c"\0A Correct Password \00"
@str.6 = [37 x i8] c"\0A Root privileges given to the user \00"
@str.7 = [18 x i8] c"\0A Wrong Password \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0))
br label %9
9: ; preds = %0, %7
%10 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0), %0 ]
%11 = call i32 @puts(i8* dereferenceable(1) %10)
ret i32 0
}