#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, int);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *check_realloc(void *old, size_t bytes) {
  void *tmp;
  if (!(bytes > 0)) {
    fprintf(stderr, "Error: '%s' [%s:%i]\n", "bytes > 0",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/PGAS-community-benchmarks/CFD-Proxy/"
            "refs/heads/master/src/util.c",
            46);
    exit(EXIT_FAILURE);
  };
  tmp = realloc(old, bytes);
  if (!(tmp != NULL)) {
    fprintf(stderr, "Error: '%s' [%s:%i]\n", "tmp != NULL",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/PGAS-community-benchmarks/CFD-Proxy/"
            "refs/heads/master/src/util.c",
            48);
    exit(EXIT_FAILURE);
  };
  return tmp;
}


x86 assembly (clang, -O0):
<check_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
ja     1182 <check_realloc+0x52>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
lea    0xeb3(%rip),%rdx
lea    0xeb6(%rip),%rcx
mov    $0x2e,%r8d
call   1030 <fprintf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d5 <check_realloc+0xa5>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
lea    0xf05(%rip),%rdx
lea    0xe63(%rip),%rcx
mov    $0x30,%r8d
call   1030 <fprintf@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_realloc>:
push   %rax
test   %rsi,%rsi
je     1142 <check_realloc+0x12>
call   1040 <realloc@plt>
test   %rax,%rax
je     1168 <check_realloc+0x38>
pop    %rcx
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xebf(%rip),%rcx
mov    $0x2e,%r8d
jmp    118c <check_realloc+0x5c>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
lea    0xf3b(%rip),%rdx
lea    0xe99(%rip),%rcx
mov    $0x30,%r8d
call   1030 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Error: '%s' [%s:%i]\0A\00"
@.str.1 = [10 x i8] c"bytes > 0\00"
@.str.2 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/PGAS-community-benchmarks/CFD-Proxy/refs/heads/master/src/util.c\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [12 x i8] c"tmp != NULL\00"
define i8* @check_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = icmp ugt i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.2, i64 0, i64 0), i32 46)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i64, i64* %4
%16 = call i8* @realloc(i8* %14, i64 %15)
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %24, label %19
19: ; preds = %13
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.2, i64 0, i64 0), i32 48)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %13
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Error: '%s' [%s:%i]\0A\00"
@.str.1 = [10 x i8] c"bytes > 0\00"
@.str.2 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/PGAS-community-benchmarks/CFD-Proxy/refs/heads/master/src/util.c\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [12 x i8] c"tmp != NULL\00"
define noalias i8* @check_realloc(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.2, i64 0, i64 0), i32 46)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = tail call i8* @realloc(i8* %0, i64 %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.2, i64 0, i64 0), i32 48)
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %9
ret i8* %10
}