#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 */
char *crypt(char *, char *);
char *getpass(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int cripteaza(char *oldp) {
  char key[3], *newpass, *mlp;
  key[0] = oldp[0];
  key[1] = oldp[1];
  newpass = getpass("Introduceti Parola :");
  mlp = crypt(newpass, key);
  if (strcmp(mlp, oldp) == 0)
    printf("Parola Valida\n");
  else
    printf("Parola invalida\n");
  return 0;
}


x86 assembly (clang, -O0):
<cripteaza>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0xa(%rbp)
lea    0xe9a(%rip),%rdi
call   1060 <getpass@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1030 <crypt@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a8 <cripteaza+0x68>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
jmp    11b4 <cripteaza+0x74>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cripteaza>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%al
mov    %al,0xd(%rsp)
mov    0x1(%rdi),%al
mov    %al,0xe(%rsp)
lea    0xea4(%rip),%rdi
call   1060 <getpass@plt>
lea    0xd(%rsp),%rsi
mov    %rax,%rdi
call   1040 <crypt@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xea2(%rip),%rax
lea    0xe8b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"Introduceti Parola :\00"
@str = [16 x i8] c"Parola invalida\00"
@str.3 = [14 x i8] c"Parola Valida\00"
define i32 @cripteaza(i8* %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
store i8 %4, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %6, i8* %7
%8 = tail call i8* @getpass(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i8* @crypt(i8* %8, i8* %3)
%10 = call i64 @strcmp(i8* %9, i8* %0)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}