#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;
void *calloc(size_t const, size_t const);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           int);
int /*<<< orphan*/ stderr;
char *strerror(int);
void *wrapper_calloc(const size_t count, const size_t size, const char *file,
                     const int line) {
  void *allocation = calloc(count, size);
  if (!allocation) {
    fprintf(stderr,
            "Error: couldn't allocate memory: "
            "%s, line %d\n    %s (%d)\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/"
            "wrappers/std_wrappers.c",
            39, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }
  return allocation;
}


x86 assembly (clang, -O0):
<wrapper_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11c3 <wrapper_calloc+0x83>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%r8
mov    0x2e3e(%rip),%rax
mov    (%rax),%r9d
lea    0xe5c(%rip),%rsi
lea    0xe8f(%rip),%rdx
mov    $0x27,%ecx
call   1040 <fprintf@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrapper_calloc>:
push   %r14
push   %rbx
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     1156 <wrapper_calloc+0x16>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e83(%rip),%rax
mov    (%rax),%ebx
mov    0x2e72(%rip),%r14
mov    (%r14),%edi
call   1060 <strerror@plt>
mov    (%r14),%r9d
lea    0xe88(%rip),%rsi
lea    0xebb(%rip),%rdx
mov    %ebx,%edi
mov    $0x27,%ecx
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"Error: couldn't allocate memory: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/wrappers/std_wrappers.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i8* @wrapper_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = call i8* @calloc(i64 %10, i64 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = icmp ne i8* %13, null
br i1 %14, label %23, label %15
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = load i32, i32* @errno
%18 = call i8* @strerror(i32 %17)
%19 = load i32, i32* @errno
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 39, i8* %18, i32 %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %4
%24 = load i8*, i8** %9
ret i8* %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"Error: couldn't allocate memory: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/wrappers/std_wrappers.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define noalias i8* @wrapper_calloc(i64 %0, i64 %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i8* @calloc(i64 %0, i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = load i32, i32* @errno
%12 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 39, i8* %10, i32 %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %4
ret i8* %5
}