#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 *malloc(size_t);
int /*<<< orphan*/ stderr;
void *check_malloc(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",
            34);
    exit(EXIT_FAILURE);
  };
  tmp = malloc(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",
            36);
    exit(EXIT_FAILURE);
  };
  return tmp;
}


x86 assembly (clang, -O0):
<check_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
ja     117e <check_malloc+0x4e>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
lea    0xeb7(%rip),%rdx
lea    0xeba(%rip),%rcx
mov    $0x22,%r8d
call   1030 <fprintf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cd <check_malloc+0x9d>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
lea    0xf0d(%rip),%rdx
lea    0xe6b(%rip),%rcx
mov    $0x24,%r8d
call   1030 <fprintf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_malloc>:
push   %rax
test   %rdi,%rdi
je     1142 <check_malloc+0x12>
call   1040 <malloc@plt>
test   %rax,%rax
je     1168 <check_malloc+0x38>
pop    %rcx
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xebf(%rip),%rcx
mov    $0x22,%r8d
jmp    118c <check_malloc+0x5c>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
lea    0xf3b(%rip),%rdx
lea    0xe99(%rip),%rcx
mov    $0x24,%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_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ugt i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, 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 34)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i64, i64* %2
%13 = call i8* @malloc(i64 %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = icmp ne i8* %14, null
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, 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 36)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %11
%22 = load i8*, i8** %3
ret i8* %22
}

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_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, 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 34)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
%9 = tail call i8* @malloc(i64 %0)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, 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 36)
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %8
ret i8* %9
}