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

/* Variables and functions */
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE;
char *OPENSSL_strdup(char const *);
int /*<<< orphan*/ UIT_VERIFY;
int /*<<< orphan*/ UI_F_UI_DUP_VERIFY_STRING;
int /*<<< orphan*/ UIerr(int /*<<< orphan*/, int /*<<< orphan*/);
int general_allocate_string(int /*<<< orphan*/ *, char *, int,
                            int /*<<< orphan*/, int, char *, int, int,
                            char const *);
int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
                         char *result_buf, int minsize, int maxsize,
                         const char *test_buf) {
  char *prompt_copy = NULL;
  if (prompt) {
    prompt_copy = OPENSSL_strdup(prompt);
    if (prompt_copy == NULL) {
      UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
      return -1;
    }
  }
  return general_allocate_string(ui, prompt_copy, 1, UIT_VERIFY, flags,
                                 result_buf, minsize, maxsize, test_buf);
}


x86 assembly (clang, -O0):
<UI_dup_verify_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a6 <UI_dup_verify_string+0x76>
mov    -0x18(%rbp),%rdi
call   1040 <OPENSSL_strdup@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11a1 <UI_dup_verify_string+0x71>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
call   1030 <UIerr@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e6 <UI_dup_verify_string+0xb6>
jmp    11a6 <UI_dup_verify_string+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    0x2e1b(%rip),%rax
mov    (%rax),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    -0x2c(%rbp),%r11d
mov    -0x30(%rbp),%r10d
mov    0x10(%rbp),%rax
mov    $0x1,%edx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <general_allocate_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_dup_verify_string>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rcx,%r12
mov    %edx,%ebp
mov    %rdi,%rbx
test   %rsi,%rsi
je     1179 <UI_dup_verify_string+0x49>
mov    %rsi,%rdi
call   1040 <OPENSSL_strdup@plt>
mov    %rax,%rsi
test   %rax,%rax
jne    117b <UI_dup_verify_string+0x4b>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
call   1030 <UIerr@plt>
mov    $0xffffffff,%eax
jmp    11a7 <UI_dup_verify_string+0x77>
xor    %esi,%esi
mov    0x2e4e(%rip),%rax
mov    (%rax),%ecx
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0x1,%edx
mov    %ebp,%r8d
mov    %r12,%r9
push   0x38(%rsp)
push   %r15
push   %r14
call   1050 <general_allocate_string@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UI_F_UI_DUP_VERIFY_STRING = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
@UIT_VERIFY = global i32 0
define i32 @UI_dup_verify_string(i32* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i32* %0, i32** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i8* %6, i8** %15
store i8* null, i8** %16
%17 = load i8*, i8** %10
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %29
19: ; preds = %7
%20 = load i8*, i8** %10
%21 = call i8* @OPENSSL_strdup(i8* %20)
store i8* %21, i8** %16
%22 = load i8*, i8** %16
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32, i32* @UI_F_UI_DUP_VERIFY_STRING
%26 = load i32, i32* @ERR_R_MALLOC_FAILURE
%27 = call i32 @UIerr(i32 %25, i32 %26)
store i32 -1, i32* %8
br label %39
28: ; preds = %19
br label %29
29: ; preds = %28, %7
%30 = load i32*, i32** %9
%31 = load i8*, i8** %16
%32 = load i32, i32* @UIT_VERIFY
%33 = load i32, i32* %11
%34 = load i8*, i8** %12
%35 = load i32, i32* %13
%36 = load i32, i32* %14
%37 = load i8*, i8** %15
%38 = call i32 @general_allocate_string(i32* %30, i8* %31, i32 1, i32 %32, i32 %33, i8* %34, i32 %35, i32 %36, i8* %37)
store i32 %38, i32* %8
br label %39
39: ; preds = %29, %24
%40 = load i32, i32* %8
ret i32 %40
}

LLVM IR (-O2):
@UI_F_UI_DUP_VERIFY_STRING = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
@UIT_VERIFY = global i32 0
define i32 @UI_dup_verify_string(i32* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i8* %6) {
%8 = icmp eq i8* %1, null
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = tail call i8* @OPENSSL_strdup(i8* %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* @UI_F_UI_DUP_VERIFY_STRING
%14 = load i32, i32* @ERR_R_MALLOC_FAILURE
%15 = tail call i32 @UIerr(i32 %13, i32 %14)
br label %20
16: ; preds = %9, %7
%17 = phi i8* [ %10, %9 ], [ null, %7 ]
%18 = load i32, i32* @UIT_VERIFY
%19 = tail call i32 @general_allocate_string(i32* %0, i8* %17, i32 1, i32 %18, i32 %2, i8* %3, i32 %4, i32 %5, i8* %6)
br label %20
20: ; preds = %16, %12
%21 = phi i32 [ -1, %12 ], [ %19, %16 ]
ret i32 %21
}