#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 */
void *allocator_alloc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ allocator_default();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int, char *);
void _ensure_allocator_default_returns_null_for_zero_length_allocation(void) {
  void *mem = allocator_alloc(0, allocator_default());
  if (!(mem == 0)) {
    printf("%s:%d - test '%s' failed\n",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/jbrd/libmem/refs/heads/master/src/tests/"
           "allocator_tests.c",
           118, "mem == 0");
    exit(1);
  };
}


x86 assembly (clang, -O0):
<_ensure_allocator_default_returns_null_for_zero_length_allocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <allocator_default@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1050 <allocator_alloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1190 <_ensure_allocator_default_returns_null_for_zero_length_allocation+0x50>
lea    0xe92(%rip),%rdi
lea    0xea5(%rip),%rsi
mov    $0x76,%edx
lea    0xf2d(%rip),%rcx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ensure_allocator_default_returns_null_for_zero_length_allocation>:
push   %rax
xor    %eax,%eax
call   1040 <allocator_default@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1050 <allocator_alloc@plt>
test   %rax,%rax
jne    1158 <_ensure_allocator_default_returns_null_for_zero_length_allocation+0x18>
pop    %rax
ret
lea    0xea1(%rip),%rdi
lea    0xeb4(%rip),%rsi
lea    0xf41(%rip),%rcx
mov    $0x76,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"%s:%d - test '%s' failed\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jbrd/libmem/refs/heads/master/src/tests/allocator_tests.c\00"
@.str.2 = [9 x i8] c"mem == 0\00"
define void @_ensure_allocator_default_returns_null_for_zero_length_allocation() {
%1 = alloca i8*
%2 = call i32 (...) @allocator_default()
%3 = call i8* @allocator_alloc(i32 0, i32 %2)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 118, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s:%d - test '%s' failed\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jbrd/libmem/refs/heads/master/src/tests/allocator_tests.c\00"
@.str.2 = [9 x i8] c"mem == 0\00"
define void @_ensure_allocator_default_returns_null_for_zero_length_allocation() {
%1 = tail call i32 (...) @allocator_default()
%2 = tail call i8* @allocator_alloc(i32 0, i32 %1)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 118, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret void
}