#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 */
void *calloc(int, int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int checksum_md5_xinfo_cloner(void *old_data, void **new_data, int flag) {
  *new_data = NULL;
  if (flag)
    return 0xE830FE89;
  if (old_data == NULL)
    return 0;
  *new_data = calloc(1, 16);
  if (*new_data == NULL)
    return 0xF030FFFA;
  memcpy(*new_data, old_data, 16);
  return 16;
}


x86 assembly (clang, -O0):
<checksum_md5_xinfo_cloner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
cmpl   $0x0,-0x1c(%rbp)
je     1154 <checksum_md5_xinfo_cloner+0x34>
movl   $0xe830fe89,-0x4(%rbp)
jmp    11ba <checksum_md5_xinfo_cloner+0x9a>
cmpq   $0x0,-0x10(%rbp)
jne    116b <checksum_md5_xinfo_cloner+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11ba <checksum_md5_xinfo_cloner+0x9a>
mov    $0x1,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    119e <checksum_md5_xinfo_cloner+0x7e>
movl   $0xf030fffa,-0x4(%rbp)
jmp    11ba <checksum_md5_xinfo_cloner+0x9a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
movl   $0x10,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checksum_md5_xinfo_cloner>:
push   %rbp
push   %r14
push   %rbx
movq   $0x0,(%rsi)
mov    $0xe830fe89,%ebp
test   %edx,%edx
je     113b <checksum_md5_xinfo_cloner+0x1b>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rdi,%r14
test   %rdi,%rdi
je     1174 <checksum_md5_xinfo_cloner+0x54>
mov    %rsi,%rbx
mov    $0x10,%ebp
mov    $0x1,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1178 <checksum_md5_xinfo_cloner+0x58>
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
jmp    1134 <checksum_md5_xinfo_cloner+0x14>
xor    %ebp,%ebp
jmp    1134 <checksum_md5_xinfo_cloner+0x14>
mov    $0xf030fffa,%ebp
jmp    1134 <checksum_md5_xinfo_cloner+0x14>

LLVM IR (-O0):
define i32 @checksum_md5_xinfo_cloner(i8* %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%8 = load i8**, i8*** %6
store i8* null, i8** %8
%9 = load i32, i32* %7
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 -399442295, i32* %4
br label %28
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 0, i32* %4
br label %28
16: ; preds = %12
%17 = call i8* @calloc(i32 1, i32 16)
%18 = load i8**, i8*** %6
store i8* %17, i8** %18
%19 = load i8**, i8*** %6
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 -265224198, i32* %4
br label %28
23: ; preds = %16
%24 = load i8**, i8*** %6
%25 = load i8*, i8** %24
%26 = load i8*, i8** %5
%27 = call i32 @memcpy(i8* %25, i8* %26, i32 16)
store i32 16, i32* %4
br label %28
28: ; preds = %23, %22, %15, %11
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @checksum_md5_xinfo_cloner(i8* %0, i8** nocapture writeonly %1, i32 %2) {
store i8* null, i8** %1
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = icmp eq i8* %0, null
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = tail call dereferenceable_or_null(16) i8* @calloc(i32 1, i32 16)
store i8* %8, i8** %1
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @memcpy(i8* %8, i8* %0, i32 16)
br label %12
12: ; preds = %7, %5, %3, %10
%13 = phi i32 [ 16, %10 ], [ -399442295, %3 ], [ 0, %5 ], [ -265224198, %7 ]
ret i32 %13
}