#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 BUFSIZ;
int /*<<< orphan*/ OPENSSL_cleanse(char *, int);
int UI_UTIL_read_pw(char *, char *, int, char const *, int);
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
                           int verify) {
  char buff[BUFSIZ];
  int ret;
  ret = UI_UTIL_read_pw(buf, buff, (length > BUFSIZ) ? BUFSIZ : length, prompt,
                        verify);
  OPENSSL_cleanse(buff, BUFSIZ);
  return (ret);
}


x86 assembly (clang, -O0):
<UI_UTIL_read_pw_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e6c(%rip),%rcx
cmp    (%rcx),%eax
jle    118d <UI_UTIL_read_pw_string+0x6d>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
jmp    1193 <UI_UTIL_read_pw_string+0x73>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <UI_UTIL_read_pw@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,-0x34(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
call   1030 <OPENSSL_cleanse@plt>
mov    -0x34(%rbp),%eax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_UTIL_read_pw_string>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    0x2ea9(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rbx
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    %esi,%edx
cmovge %esi,%edx
mov    %rbx,%rsi
call   1040 <UI_UTIL_read_pw@plt>
mov    %eax,%r14d
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <OPENSSL_cleanse@plt>
mov    %r14d,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@BUFSIZ = global i32 0
define i32 @UI_UTIL_read_pw_string(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = icmp slt i32 %5, %1
%9 = select i1 %8, i32 %5, i32 %1
%10 = call i32 @UI_UTIL_read_pw(i8* %0, i8* %7, i32 %9, i8* %2, i32 %3)
%11 = load i32, i32* @BUFSIZ
%12 = call i32 @OPENSSL_cleanse(i8* %7, i32 %11)
ret i32 %10
}