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


x86 assembly (clang, -O0):
<aRealloc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    118c <aRealloc_+0x5c>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    0xe87(%rip),%rdi
call   1030 <ShowFatalError@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aRealloc_>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %ecx,%ebp
mov    %rdx,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     114b <aRealloc_+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 = [50 x i8] c"%s:%d: in func %s: aRealloc error out of memory!\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @aRealloc_(i8* %0, i64 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %6
%13 = load i64, i64* %7
%14 = call i8* @realloc(i8* %12, i64 %13)
store i8* %14, i8** %11
%15 = load i8*, i8** %11
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %24
17: ; preds = %5
%18 = load i8*, i8** %8
%19 = load i32, i32* %9
%20 = load i8*, i8** %10
%21 = call i32 @ShowFatalError(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19, i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %5
%25 = load i8*, i8** %11
ret i8* %25
}

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