#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 free(void *);
void *malloc(size_t);
void *realloc(void *, size_t);
void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
                              void (**f)(void *)) {
  if (m != NULL)
    *m = malloc;
  if (r != NULL)
    *r = realloc;
  if (f != NULL)
    *f = free;
}


x86 assembly (clang, -O0):
<CRYPTO_get_mem_functions>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <CRYPTO_get_mem_functions+0x29>
mov    -0x8(%rbp),%rax
mov    0x2eba(%rip),%rcx
mov    %rcx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1142 <CRYPTO_get_mem_functions+0x42>
mov    -0x10(%rbp),%rax
mov    0x2ea9(%rip),%rcx
mov    %rcx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     115b <CRYPTO_get_mem_functions+0x5b>
mov    -0x18(%rbp),%rax
mov    0x2e70(%rip),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTO_get_mem_functions>:
test   %rdi,%rdi
je     110f <CRYPTO_get_mem_functions+0xf>
mov    0x2ed4(%rip),%rax
mov    %rax,(%rdi)
test   %rsi,%rsi
je     111e <CRYPTO_get_mem_functions+0x1e>
mov    0x2ecd(%rip),%rax
mov    %rax,(%rsi)
test   %rdx,%rdx
je     112d <CRYPTO_get_mem_functions+0x2d>
mov    0x2e9e(%rip),%rax
mov    %rax,(%rdx)
ret

LLVM IR (-O0):
define void @CRYPTO_get_mem_functions(i8* (i64)** %0, i8* (i8*, i64)** %1, void (i8*)** %2) {
%4 = alloca i8* (i64)**
%5 = alloca i8* (i8*, i64)**
%6 = alloca void (i8*)**
store i8* (i64)** %0, i8* (i64)*** %4
store i8* (i8*, i64)** %1, i8* (i8*, i64)*** %5
store void (i8*)** %2, void (i8*)*** %6
%7 = load i8* (i64)**, i8* (i64)*** %4
%8 = icmp ne i8* (i64)** %7, null
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i8* (i64)**, i8* (i64)*** %4
store i8* (i64)* @malloc, i8* (i64)** %10
br label %11
11: ; preds = %9, %3
%12 = load i8* (i8*, i64)**, i8* (i8*, i64)*** %5
%13 = icmp ne i8* (i8*, i64)** %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i8* (i8*, i64)**, i8* (i8*, i64)*** %5
store i8* (i8*, i64)* @realloc, i8* (i8*, i64)** %15
br label %16
16: ; preds = %14, %11
%17 = load void (i8*)**, void (i8*)*** %6
%18 = icmp ne void (i8*)** %17, null
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = load void (i8*)**, void (i8*)*** %6
store void (i8*)* @free, void (i8*)** %20
br label %21
21: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
define void @CRYPTO_get_mem_functions(i8* (i64)** writeonly %0, i8* (i8*, i64)** writeonly %1, void (i8*)** writeonly %2) {
%4 = icmp eq i8* (i64)** %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
store i8* (i64)* @malloc, i8* (i64)** %0
br label %6
6: ; preds = %5, %3
%7 = icmp eq i8* (i8*, i64)** %1, null
br i1 %7, label %9, label %8
8: ; preds = %6
store i8* (i8*, i64)* @realloc, i8* (i8*, i64)** %1
br label %9
9: ; preds = %8, %6
%10 = icmp eq void (i8*)** %2, null
br i1 %10, label %12, label %11
11: ; preds = %9
store void (i8*)* @free, void (i8*)** %2
br label %12
12: ; preds = %11, %9
ret void
}