#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_INFO;
int /*<<< orphan*/ UI_F_UI_DUP_INFO_STRING;
int /*<<< orphan*/ UIerr(int /*<<< orphan*/, int /*<<< orphan*/);
int general_allocate_string(int /*<<< orphan*/ *, char *, int,
                            int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/ *);
int UI_dup_info_string(UI *ui, const char *text) {
  char *text_copy = NULL;
  if (text) {
    text_copy = OPENSSL_strdup(text);
    if (text_copy == NULL) {
      UIerr(UI_F_UI_DUP_INFO_STRING, ERR_R_MALLOC_FAILURE);
      return -1;
    }
  }
  return general_allocate_string(ui, text_copy, 1, UIT_INFO, 0, NULL, 0, 0,
                                 NULL);
}


x86 assembly (clang, -O0):
<UI_dup_info_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1193 <UI_dup_info_string+0x63>
mov    -0x18(%rbp),%rdi
call   1040 <OPENSSL_strdup@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118e <UI_dup_info_string+0x5e>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
call   1030 <UIerr@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d1 <UI_dup_info_string+0xa1>
jmp    1193 <UI_dup_info_string+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2e2e(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%r9d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1050 <general_allocate_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_dup_info_string>:
push   %rbx
mov    %rdi,%rbx
test   %rsi,%rsi
je     1167 <UI_dup_info_string+0x37>
mov    %rsi,%rdi
call   1040 <OPENSSL_strdup@plt>
mov    %rax,%rsi
test   %rax,%rax
jne    1169 <UI_dup_info_string+0x39>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
call   1030 <UIerr@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %esi,%esi
mov    0x2e60(%rip),%rax
mov    (%rax),%ecx
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
push   $0x0
call   1050 <general_allocate_string@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@UI_F_UI_DUP_INFO_STRING = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
@UIT_INFO = global i32 0
define i32 @UI_dup_info_string(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* null, i8** %6
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = call i8* @OPENSSL_strdup(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* @UI_F_UI_DUP_INFO_STRING
%16 = load i32, i32* @ERR_R_MALLOC_FAILURE
%17 = call i32 @UIerr(i32 %15, i32 %16)
store i32 -1, i32* %3
br label %24
18: ; preds = %9
br label %19
19: ; preds = %18, %2
%20 = load i32*, i32** %4
%21 = load i8*, i8** %6
%22 = load i32, i32* @UIT_INFO
%23 = call i32 @general_allocate_string(i32* %20, i8* %21, i32 1, i32 %22, i32 0, i32* null, i32 0, i32 0, i32* null)
store i32 %23, i32* %3
br label %24
24: ; preds = %19, %14
%25 = load i32, i32* %3
ret i32 %25
}

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