#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 *);
int /*<<< orphan*/ smsg(char *);
scalar_t__ strcmp(char *, char *);
void askfp(char *oldp) {
  char key[3], *newpass, *mlp;
  int i;
  for (i = 0; i < 13; i++)
    oldp[i] = oldp[i + 2];
  oldp[i] = '\0';
  newpass = getpass("Introduceti Parola Supervizor (root) :");
  key[0] = oldp[0];
  key[1] = oldp[1];
  mlp = crypt(newpass, key);
  if (strcmp(mlp, oldp) == 0)
    smsg(".p PASSWDOK\n");
  else
    printf("Password Not Accept!\n");
}


x86 assembly (clang, -O0):
<askfp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xd,-0x24(%rbp)
jge    1196 <askfp+0x46>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <askfp+0x13>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
lea    0xe57(%rip),%rdi
call   1060 <getpass@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0xa(%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    11fe <askfp+0xae>
lea    0xe33(%rip),%rdi
call   1070 <smsg@plt>
jmp    120a <askfp+0xba>
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<askfp>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2(%rdi),%rax
mov    %rax,(%rdi)
mov    0xa(%rdi),%eax
mov    %eax,0x8(%rdi)
mov    0xe(%rdi),%al
mov    %al,0xc(%rdi)
movb   $0x0,0xd(%rdi)
lea    0xe8a(%rip),%rdi
call   1060 <getpass@plt>
mov    (%rbx),%cl
mov    %cl,0xd(%rsp)
mov    0x1(%rbx),%cl
mov    %cl,0xe(%rsp)
lea    0xd(%rsp),%rsi
mov    %rax,%rdi
call   1040 <crypt@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b3 <askfp+0x63>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    11bf <askfp+0x6f>
lea    0xe6d(%rip),%rdi
call   1070 <smsg@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Introduceti Parola Supervizor (root) :\00"
@.str.1 = [13 x i8] c".p PASSWDOK\0A\00"
@.str.2 = [22 x i8] c"Password Not Accept!\0A\00"
define void @askfp(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %6
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 13
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = load i8, i8* %15
%17 = load i8*, i8** %2
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 %16, i8* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load i8*, i8** %2
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 0, i8* %28
%29 = call i8* @getpass(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i8* %29, i8** %4
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 %32, i8* %33
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = load i8, i8* %35
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
store i8 %36, i8* %37
%38 = load i8*, i8** %4
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%40 = call i8* @crypt(i8* %38, i8* %39)
store i8* %40, i8** %5
%41 = load i8*, i8** %5
%42 = load i8*, i8** %2
%43 = call i64 @strcmp(i8* %41, i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %24
%46 = call i32 @smsg(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %49
47: ; preds = %24
%48 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Introduceti Parola Supervizor (root) :\00"
@.str.1 = [13 x i8] c".p PASSWDOK\0A\00"
@str = [21 x i8] c"Password Not Accept!\00"
define void @askfp(i8* %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = getelementptr i8, i8* %0, i64 2
%5 = getelementptr inbounds i8, i8* %0, i64 13
store i8 0, i8* %5
%6 = tail call i8* @getpass(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %0
store i8 %7, i8* %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %9, i8* %10
%11 = call i8* @crypt(i8* %6, i8* %3)
%12 = call i64 @strcmp(i8* %11, i8* %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 @smsg(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %1
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret void
}