#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 */
scalar_t__ allocator_alloc(int, int /*<<< orphan*/);
int /*<<< orphan*/ allocator_always_fail();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int, char *);
void _ensure_allocator_alloc_returns_null_when_allocator_fails(void) {
  if (!(allocator_alloc(1024, allocator_always_fail()) == 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",
           49, "allocator_alloc( 1024, allocator_always_fail( ) ) == 0");
    exit(1);
  };
}


x86 assembly (clang, -O0):
<_ensure_allocator_alloc_returns_null_when_allocator_fails>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <allocator_always_fail@plt>
mov    %eax,%esi
mov    $0x400,%edi
call   1040 <allocator_alloc@plt>
cmp    $0x0,%rax
je     118a <_ensure_allocator_alloc_returns_null_when_allocator_fails+0x4a>
lea    0xe98(%rip),%rdi
lea    0xeab(%rip),%rsi
mov    $0x31,%edx
lea    0xf33(%rip),%rcx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ensure_allocator_alloc_returns_null_when_allocator_fails>:
push   %rax
xor    %eax,%eax
call   1050 <allocator_always_fail@plt>
mov    $0x400,%edi
mov    %eax,%esi
call   1040 <allocator_alloc@plt>
test   %rax,%rax
jne    115b <_ensure_allocator_alloc_returns_null_when_allocator_fails+0x1b>
pop    %rax
ret
lea    0xe9e(%rip),%rdi
lea    0xeb1(%rip),%rsi
lea    0xf3e(%rip),%rcx
mov    $0x31,%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 = [55 x i8] c"allocator_alloc( 1024, allocator_always_fail( ) ) == 0\00"
define void @_ensure_allocator_alloc_returns_null_when_allocator_fails() {
%1 = call i32 (...) @allocator_always_fail()
%2 = call i64 @allocator_alloc(i32 1024, i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = 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 49, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
7: ; 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 = [55 x i8] c"allocator_alloc( 1024, allocator_always_fail( ) ) == 0\00"
define void @_ensure_allocator_alloc_returns_null_when_allocator_fails() {
%1 = tail call i32 (...) @allocator_always_fail()
%2 = tail call i64 @allocator_alloc(i32 1024, i32 %1)
%3 = icmp eq i64 %2, 0
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 49, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret void
}