#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*/ DES_cblock;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ DES_string_to_2keys(char *, int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ OPENSSL_cleanse(char *, int);
int UI_UTIL_read_pw(char *, char *, int, char const *, int);
int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
                        int verify) {
  int ok;
  char buf[BUFSIZ], buff[BUFSIZ];
  if ((ok = UI_UTIL_read_pw(buf, buff, BUFSIZ, prompt, verify)) == 0)
    DES_string_to_2keys(buf, key1, key2);
  OPENSSL_cleanse(buf, BUFSIZ);
  OPENSSL_cleanse(buff, BUFSIZ);
  return (ok);
}


x86 assembly (clang, -O0):
<DES_read_2passwords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0x48(%rbp)
mov    %rdi,%rsp
mov    %rcx,-0x30(%rbp)
mov    (%rax),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x40(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x38(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <UI_UTIL_read_pw@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    11c4 <DES_read_2passwords+0x94>
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <DES_string_to_2keys@plt>
mov    -0x48(%rbp),%rdi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1030 <OPENSSL_cleanse@plt>
mov    -0x40(%rbp),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
call   1030 <OPENSSL_cleanse@plt>
mov    -0x20(%rbp),%eax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DES_read_2passwords>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,-0x30(%rbp)
mov    %rdi,%r15
mov    0x2e8e(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rbx
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <UI_UTIL_read_pw@plt>
mov    %eax,%r13d
test   %eax,%eax
jne    1193 <DES_read_2passwords+0x63>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    -0x30(%rbp),%rdx
call   1050 <DES_string_to_2keys@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <OPENSSL_cleanse@plt>
mov    (%r14),%esi
mov    %r12,%rdi
call   1030 <OPENSSL_cleanse@plt>
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
define i32 @DES_read_2passwords(i32* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%13 = load i32, i32* @BUFSIZ
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %10
%16 = alloca i8, i64 %14
store i64 %14, i64* %11
%17 = load i32, i32* @BUFSIZ
%18 = zext i32 %17 to i64
%19 = alloca i8, i64 %18
store i64 %18, i64* %12
%20 = load i32, i32* @BUFSIZ
%21 = load i8*, i8** %7
%22 = load i32, i32* %8
%23 = call i32 @UI_UTIL_read_pw(i8* %16, i8* %19, i32 %20, i8* %21, i32 %22)
store i32 %23, i32* %9
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %4
%26 = load i32*, i32** %5
%27 = load i32*, i32** %6
%28 = call i32 @DES_string_to_2keys(i8* %16, i32* %26, i32* %27)
br label %29
29: ; preds = %25, %4
%30 = load i32, i32* @BUFSIZ
%31 = call i32 @OPENSSL_cleanse(i8* %16, i32 %30)
%32 = load i32, i32* @BUFSIZ
%33 = call i32 @OPENSSL_cleanse(i8* %19, i32 %32)
%34 = load i32, i32* %9
%35 = load i8*, i8** %10
ret i32 %34
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
define i32 @DES_read_2passwords(i32* %0, i32* %1, i8* %2, i32 %3) {
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = alloca i8, i64 %6
%9 = call i32 @UI_UTIL_read_pw(i8* %7, i8* %8, i32 %5, i8* %2, i32 %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = call i32 @DES_string_to_2keys(i8* %7, i32* %0, i32* %1)
br label %13
13: ; preds = %11, %4
%14 = load i32, i32* @BUFSIZ
%15 = call i32 @OPENSSL_cleanse(i8* %7, i32 %14)
%16 = load i32, i32* @BUFSIZ
%17 = call i32 @OPENSSL_cleanse(i8* %8, i32 %16)
ret i32 %9
}