#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;
int /*<<< orphan*/ OPENSSL_free(char *);
char *OPENSSL_strdup(char const *);
int /*<<< orphan*/ UIT_BOOLEAN;
int /*<<< orphan*/ UI_F_UI_DUP_INPUT_BOOLEAN;
int /*<<< orphan*/ UIerr(int /*<<< orphan*/, int /*<<< orphan*/);
int general_allocate_boolean(int /*<<< orphan*/ *, char *, char *, char *,
                             char *, int, int /*<<< orphan*/, int, char *);
int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
                         const char *ok_chars, const char *cancel_chars,
                         int flags, char *result_buf) {
  char *prompt_copy = NULL;
  char *action_desc_copy = NULL;
  char *ok_chars_copy = NULL;
  char *cancel_chars_copy = NULL;
  if (prompt) {
    prompt_copy = OPENSSL_strdup(prompt);
    if (prompt_copy == NULL) {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
      goto err;
    }
  }
  if (action_desc) {
    action_desc_copy = OPENSSL_strdup(action_desc);
    if (action_desc_copy == NULL) {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
      goto err;
    }
  }
  if (ok_chars) {
    ok_chars_copy = OPENSSL_strdup(ok_chars);
    if (ok_chars_copy == NULL) {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
      goto err;
    }
  }
  if (cancel_chars) {
    cancel_chars_copy = OPENSSL_strdup(cancel_chars);
    if (cancel_chars_copy == NULL) {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
      goto err;
    }
  }
  return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
                                  ok_chars_copy, cancel_chars_copy, 1,
                                  UIT_BOOLEAN, flags, result_buf);
err:
  OPENSSL_free(prompt_copy);
  OPENSSL_free(action_desc_copy);
  OPENSSL_free(ok_chars_copy);
  OPENSSL_free(cancel_chars_copy);
  return -1;
}


x86 assembly (clang, -O0):
<UI_dup_input_boolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c8 <UI_dup_input_boolean+0x88>
mov    -0x18(%rbp),%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11c3 <UI_dup_input_boolean+0x83>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
call   1040 <UIerr@plt>
jmp    12db <UI_dup_input_boolean+0x19b>
jmp    11c8 <UI_dup_input_boolean+0x88>
cmpq   $0x0,-0x20(%rbp)
je     120c <UI_dup_input_boolean+0xcc>
mov    -0x20(%rbp),%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1207 <UI_dup_input_boolean+0xc7>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    0x2de5(%rip),%rax
mov    (%rax),%esi
call   1040 <UIerr@plt>
jmp    12db <UI_dup_input_boolean+0x19b>
jmp    120c <UI_dup_input_boolean+0xcc>
cmpq   $0x0,-0x28(%rbp)
je     1250 <UI_dup_input_boolean+0x110>
mov    -0x28(%rbp),%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    124b <UI_dup_input_boolean+0x10b>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
mov    0x2da1(%rip),%rax
mov    (%rax),%esi
call   1040 <UIerr@plt>
jmp    12db <UI_dup_input_boolean+0x19b>
jmp    1250 <UI_dup_input_boolean+0x110>
cmpq   $0x0,-0x30(%rbp)
je     1294 <UI_dup_input_boolean+0x154>
mov    -0x30(%rbp),%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    128f <UI_dup_input_boolean+0x14f>
mov    0x2d76(%rip),%rax
mov    (%rax),%edi
mov    0x2d5d(%rip),%rax
mov    (%rax),%esi
call   1040 <UIerr@plt>
jmp    12db <UI_dup_input_boolean+0x19b>
jmp    1294 <UI_dup_input_boolean+0x154>
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    0x2d21(%rip),%rax
mov    (%rax),%r11d
mov    -0x34(%rbp),%r10d
mov    0x10(%rbp),%rax
mov    $0x1,%r9d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <general_allocate_boolean@plt>
mov    %eax,-0x4(%rbp)
jmp    1306 <UI_dup_input_boolean+0x1c6>
mov    -0x40(%rbp),%rdi
call   1060 <OPENSSL_free@plt>
mov    -0x48(%rbp),%rdi
call   1060 <OPENSSL_free@plt>
mov    -0x50(%rbp),%rdi
call   1060 <OPENSSL_free@plt>
mov    -0x58(%rbp),%rdi
call   1060 <OPENSSL_free@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_dup_input_boolean>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r13d
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %rdi,%rbx
test   %rsi,%rsi
je     1177 <UI_dup_input_boolean+0x37>
mov    %rsi,%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,%r15
test   %rax,%rax
jne    117a <UI_dup_input_boolean+0x3a>
xor    %r15d,%r15d
jmp    11c9 <UI_dup_input_boolean+0x89>
xor    %r15d,%r15d
test   %rbp,%rbp
mov    %r13,0x10(%rsp)
mov    %rbx,0x8(%rsp)
je     120f <UI_dup_input_boolean+0xcf>
mov    %rbp,%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,%r13
test   %rax,%rax
je     11c9 <UI_dup_input_boolean+0x89>
test   %r12,%r12
je     1217 <UI_dup_input_boolean+0xd7>
mov    %r12,%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11cc <UI_dup_input_boolean+0x8c>
test   %r14,%r14
je     121e <UI_dup_input_boolean+0xde>
mov    %r14,%rdi
call   1050 <OPENSSL_strdup@plt>
mov    %rax,%r8
test   %rax,%rax
jne    1221 <UI_dup_input_boolean+0xe1>
jmp    11ce <UI_dup_input_boolean+0x8e>
xor    %r13d,%r13d
xor    %ebx,%ebx
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
call   1040 <UIerr@plt>
mov    %r15,%rdi
call   1060 <OPENSSL_free@plt>
mov    %r13,%rdi
call   1060 <OPENSSL_free@plt>
mov    %rbx,%rdi
call   1060 <OPENSSL_free@plt>
xor    %edi,%edi
call   1060 <OPENSSL_free@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
jmp    1254 <UI_dup_input_boolean+0x114>
xor    %r13d,%r13d
test   %r12,%r12
jne    11a2 <UI_dup_input_boolean+0x62>
xor    %ebx,%ebx
test   %r14,%r14
jne    11b7 <UI_dup_input_boolean+0x77>
xor    %r8d,%r8d
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    $0x1,%r9d
push   0x58(%rsp)
push   0x20(%rsp)
push   %rax
call   1030 <general_allocate_boolean@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UI_F_UI_DUP_INPUT_BOOLEAN = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
@UIT_BOOLEAN = global i32 0
define i32 @UI_dup_input_boolean(i32* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32 %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
store i32* %0, i32** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i32 %5, i32* %14
store i8* %6, i8** %15
store i8* null, i8** %16
store i8* null, i8** %17
store i8* null, i8** %18
store i8* null, i8** %19
%20 = load i8*, i8** %10
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %32
22: ; preds = %7
%23 = load i8*, i8** %10
%24 = call i8* @OPENSSL_strdup(i8* %23)
store i8* %24, i8** %16
%25 = load i8*, i8** %16
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i32, i32* @UI_F_UI_DUP_INPUT_BOOLEAN
%29 = load i32, i32* @ERR_R_MALLOC_FAILURE
%30 = call i32 @UIerr(i32 %28, i32 %29)
br label %81
31: ; preds = %22
br label %32
32: ; preds = %31, %7
%33 = load i8*, i8** %11
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %45
35: ; preds = %32
%36 = load i8*, i8** %11
%37 = call i8* @OPENSSL_strdup(i8* %36)
store i8* %37, i8** %17
%38 = load i8*, i8** %17
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %44
40: ; preds = %35
%41 = load i32, i32* @UI_F_UI_DUP_INPUT_BOOLEAN
%42 = load i32, i32* @ERR_R_MALLOC_FAILURE
%43 = call i32 @UIerr(i32 %41, i32 %42)
br label %81
44: ; preds = %35
br label %45
45: ; preds = %44, %32
%46 = load i8*, i8** %12
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %58
48: ; preds = %45
%49 = load i8*, i8** %12
%50 = call i8* @OPENSSL_strdup(i8* %49)
store i8* %50, i8** %18
%51 = load i8*, i8** %18
%52 = icmp eq i8* %51, null
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i32, i32* @UI_F_UI_DUP_INPUT_BOOLEAN
%55 = load i32, i32* @ERR_R_MALLOC_FAILURE
%56 = call i32 @UIerr(i32 %54, i32 %55)
br label %81
57: ; preds = %48
br label %58
58: ; preds = %57, %45
%59 = load i8*, i8** %13
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = load i8*, i8** %13
%63 = call i8* @OPENSSL_strdup(i8* %62)
store i8* %63, i8** %19
%64 = load i8*, i8** %19
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %70
66: ; preds = %61
%67 = load i32, i32* @UI_F_UI_DUP_INPUT_BOOLEAN
%68 = load i32, i32* @ERR_R_MALLOC_FAILURE
%69 = call i32 @UIerr(i32 %67, i32 %68)
br label %81
70: ; preds = %61
br label %71
71: ; preds = %70, %58
%72 = load i32*, i32** %9
%73 = load i8*, i8** %16
%74 = load i8*, i8** %17
%75 = load i8*, i8** %18
%76 = load i8*, i8** %19
%77 = load i32, i32* @UIT_BOOLEAN
%78 = load i32, i32* %14
%79 = load i8*, i8** %15
%80 = call i32 @general_allocate_boolean(i32* %72, i8* %73, i8* %74, i8* %75, i8* %76, i32 1, i32 %77, i32 %78, i8* %79)
store i32 %80, i32* %8
br label %90
81: ; preds = %66, %53, %40, %27
%82 = load i8*, i8** %16
%83 = call i32 @OPENSSL_free(i8* %82)
%84 = load i8*, i8** %17
%85 = call i32 @OPENSSL_free(i8* %84)
%86 = load i8*, i8** %18
%87 = call i32 @OPENSSL_free(i8* %86)
%88 = load i8*, i8** %19
%89 = call i32 @OPENSSL_free(i8* %88)
store i32 -1, i32* %8
br label %90
90: ; preds = %81, %71
%91 = load i32, i32* %8
ret i32 %91
}

LLVM IR (-O2):
@UI_F_UI_DUP_INPUT_BOOLEAN = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
@UIT_BOOLEAN = global i32 0
define i32 @UI_dup_input_boolean(i32* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32 %5, i8* %6) {
%8 = icmp eq i8* %1, null
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = tail call i8* @OPENSSL_strdup(i8* %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %34, label %12
12: ; preds = %9, %7
%13 = phi i8* [ %10, %9 ], [ null, %7 ]
%14 = icmp eq i8* %2, null
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i8* @OPENSSL_strdup(i8* %2)
%17 = icmp eq i8* %16, null
br i1 %17, label %34, label %18
18: ; preds = %15, %12
%19 = phi i8* [ %16, %15 ], [ null, %12 ]
%20 = icmp eq i8* %3, null
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = tail call i8* @OPENSSL_strdup(i8* %3)
%23 = icmp eq i8* %22, null
br i1 %23, label %34, label %24
24: ; preds = %21, %18
%25 = phi i8* [ %22, %21 ], [ null, %18 ]
%26 = icmp eq i8* %4, null
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = tail call i8* @OPENSSL_strdup(i8* %4)
%29 = icmp eq i8* %28, null
br i1 %29, label %34, label %30
30: ; preds = %27, %24
%31 = phi i8* [ %28, %27 ], [ null, %24 ]
%32 = load i32, i32* @UIT_BOOLEAN
%33 = tail call i32 @general_allocate_boolean(i32* %0, i8* %13, i8* %19, i8* %25, i8* %31, i32 1, i32 %32, i32 %5, i8* %6)
br label %45
34: ; preds = %27, %21, %15, %9
%35 = phi i8* [ null, %9 ], [ %13, %15 ], [ %13, %21 ], [ %13, %27 ]
%36 = phi i8* [ null, %9 ], [ null, %15 ], [ %19, %21 ], [ %19, %27 ]
%37 = phi i8* [ null, %9 ], [ null, %15 ], [ null, %21 ], [ %25, %27 ]
%38 = load i32, i32* @UI_F_UI_DUP_INPUT_BOOLEAN
%39 = load i32, i32* @ERR_R_MALLOC_FAILURE
%40 = tail call i32 @UIerr(i32 %38, i32 %39)
%41 = tail call i32 @OPENSSL_free(i8* %35)
%42 = tail call i32 @OPENSSL_free(i8* %36)
%43 = tail call i32 @OPENSSL_free(i8* %37)
%44 = tail call i32 @OPENSSL_free(i8* null)
br label %45
45: ; preds = %34, %30
%46 = phi i32 [ -1, %34 ], [ %33, %30 ]
ret i32 %46
}