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


x86 assembly (clang, -O0):
<UI_UTIL_read_pw_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x138(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
cmpl   $0x100,-0xc(%rbp)
jle    116f <UI_UTIL_read_pw_string+0x4f>
mov    $0x100,%eax
mov    %eax,-0x13c(%rbp)
jmp    1178 <UI_UTIL_read_pw_string+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    -0x130(%rbp),%rsi
mov    -0x138(%rbp),%rdi
mov    -0x13c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <UI_UTIL_read_pw@plt>
mov    %eax,-0x124(%rbp)
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
call   1030 <OPENSSL_cleanse@plt>
mov    -0x124(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_UTIL_read_pw_string>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %esi,%edx
cmp    $0x100,%esi
mov    $0x100,%eax
cmovge %eax,%edx
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <UI_UTIL_read_pw@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <OPENSSL_cleanse@plt>
mov    %ebp,%eax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
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 [256 x i8]
%10 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 256
br i1 %14, label %15, label %16
15: ; preds = %4
br label %18
16: ; preds = %4
%17 = load i32, i32* %6
br label %18
18: ; preds = %16, %15
%19 = phi i32 [ 256, %15 ], [ %17, %16 ]
%20 = load i8*, i8** %7
%21 = load i32, i32* %8
%22 = call i32 @UI_UTIL_read_pw(i8* %11, i8* %12, i32 %19, i8* %20, i32 %21)
store i32 %22, i32* %10
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%24 = call i32 @OPENSSL_cleanse(i8* %23, i32 256)
%25 = load i32, i32* %10
ret i32 %25
}

LLVM IR (-O2):
define i32 @UI_UTIL_read_pw_string(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = icmp slt i32 %1, 256
%8 = select i1 %7, i32 %1, i32 256
%9 = call i32 @UI_UTIL_read_pw(i8* %0, i8* %6, i32 %8, i8* %2, i32 %3)
%10 = call i32 @OPENSSL_cleanse(i8* %6, i32 256)
ret i32 %9
}