#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ ShowFatalError(char *, char const *, int, char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
void *aMalloc_(size_t size, const char *file, int line, const char *func) {
  void *ret = malloc(size);
  if (ret == (void *)0) {
    ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n", file,
                   line, func);
    exit(EXIT_FAILURE);
  }
  return ret;
}


x86 assembly (clang, -O0):
<aMalloc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1184 <aMalloc_+0x54>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xe8f(%rip),%rdi
call   1030 <ShowFatalError@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aMalloc_>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     114b <aMalloc_+0x1b>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <ShowFatalError@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"%s:%d: in func %s: aMalloc error out of memory!\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @aMalloc_(i64 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i64 %0, i64* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i64, i64* %5
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %9
%12 = load i8*, i8** %9
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %21
14: ; preds = %4
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = load i8*, i8** %8
%18 = call i32 @ShowFatalError(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16, i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %4
%22 = load i8*, i8** %9
ret i8* %22
}

LLVM IR (-O2):
@.str = [49 x i8] c"%s:%d: in func %s: aMalloc error out of memory!\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @aMalloc_(i64 %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i8* @malloc(i64 %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i32 @ShowFatalError(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %3)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %4
ret i8* %5
}