#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*/);
void *malloc(int);
int /*<<< orphan*/ nocc_pinternal(char *, char *, int, int);
void *dmem_alloc(int bytes) {
  void *ptr;
  ptr = malloc(bytes);
  if (!ptr) {
    nocc_pinternal(("dmem_alloc(): out of memory! (wanted %d bytes)"),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/"
                   "heads/master/misc/support.c",
                   341, bytes);
    exit(EXIT_FAILURE);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<dmem_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117b <dmem_alloc+0x4b>
mov    -0x4(%rbp),%ecx
lea    0xea4(%rip),%rdi
lea    0xecc(%rip),%rsi
mov    $0x155,%edx
call   1050 <nocc_pinternal@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmem_alloc>:
push   %rbx
mov    %edi,%ebx
call   1030 <malloc@plt>
test   %rax,%rax
je     113f <dmem_alloc+0xf>
pop    %rbx
ret
lea    0xeba(%rip),%rdi
lea    0xee2(%rip),%rsi
mov    $0x155,%edx
mov    %ebx,%ecx
call   1050 <nocc_pinternal@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"dmem_alloc(): out of memory! (wanted %d bytes)\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/misc/support.c\00"
@EXIT_FAILURE = global i32 0
define i8* @dmem_alloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @nocc_pinternal(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i32 341, i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [47 x i8] c"dmem_alloc(): out of memory! (wanted %d bytes)\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/concurrency/nocc/refs/heads/master/misc/support.c\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @dmem_alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @nocc_pinternal(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i32 341, i32 %0)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %2
}