#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 */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
scalar_t__ allocator_guarded_length(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *, int, char *);
void ensure_allocator_guarded_length_returns_zero_when_address_not_guarded(
    void) {
  char buffer[128];
  memset(buffer, 0, sizeof(buffer));
  if (!(allocator_guarded_length(buffer + 64) == 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_guarded_tests.c",
           112, "allocator_guarded_length( buffer + 64 ) == 0");
    exit(1);
  };
}


x86 assembly (clang, -O0):
<ensure_allocator_guarded_length_returns_zero_when_address_not_guarded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x80(%rbp),%rdi
add    $0x40,%rdi
call   1050 <allocator_guarded_length@plt>
cmp    $0x0,%rax
je     119b <ensure_allocator_guarded_length_returns_zero_when_address_not_guarded+0x5b>
lea    0xe87(%rip),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x70,%edx
lea    0xf2a(%rip),%rcx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_allocator_guarded_length_returns_zero_when_address_not_guarded>:
sub    $0x88,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    0x40(%rsp),%rdi
call   1050 <allocator_guarded_length@plt>
test   %rax,%rax
jne    116d <ensure_allocator_guarded_length_returns_zero_when_address_not_guarded+0x2d>
add    $0x88,%rsp
ret
lea    0xe8c(%rip),%rdi
lea    0xe9f(%rip),%rsi
lea    0xf34(%rip),%rcx
mov    $0x70,%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 = [156 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_guarded_tests.c\00"
@.str.2 = [45 x i8] c"allocator_guarded_length( buffer + 64 ) == 0\00"
define void @ensure_allocator_guarded_length_returns_zero_when_address_not_guarded() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 128)
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %4, i64 64
%6 = call i64 @allocator_guarded_length(i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 112, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s:%d - test '%s' failed\0A\00"
@.str.1 = [156 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_guarded_tests.c\00"
@.str.2 = [45 x i8] c"allocator_guarded_length( buffer + 64 ) == 0\00"
define void @ensure_allocator_guarded_length_returns_zero_when_address_not_guarded() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 128)
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 64
%5 = call i64 @allocator_guarded_length(i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 112, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
ret void
}