#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*/ abort();
void *calloc(unsigned long, unsigned long);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int /*<<< orphan*/ stderr;
void *mem_calloc(unsigned long count, unsigned long nbytes,
                 const char *filename, unsigned long line) {
  void *ptr;
  ptr = calloc(count, nbytes);
  ((void)((ptr != NULL) ||
          (fprintf(stderr, "%s:%d Assertion failed: %s\n",
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/ajholanda/edu-C/refs/"
                   "heads/master/mem/mem.c",
                   21, "ptr != NULL"),
           abort(), 0)));
  return ptr;
}


x86 assembly (clang, -O0):
<mem_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1193 <mem_calloc+0x63>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
lea    0xea1(%rip),%rdx
mov    $0x15,%ecx
lea    0xf1b(%rip),%r8
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_calloc>:
push   %rax
call   1040 <calloc@plt>
test   %rax,%rax
je     113d <mem_calloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
lea    0xec8(%rip),%rdx
lea    0xf47(%rip),%r8
mov    $0x15,%ecx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"%s:%d Assertion failed: %s\0A\00"
@.str.1 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ajholanda/edu-C/refs/heads/master/mem/mem.c\00"
@.str.2 = [12 x i8] c"ptr != NULL\00"
define i8* @mem_calloc(i64 %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %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 %20, label %15
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.1, i64 0, i64 0), i32 21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (...) @abort()
unreachable
19: ; No predecessors!
br label %20
20: ; preds = %19, %4
%21 = phi i1 [ true, %4 ], [ false, %19 ]
%22 = zext i1 %21 to i32
%23 = load i8*, i8** %9
ret i8* %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"%s:%d Assertion failed: %s\0A\00"
@.str.1 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ajholanda/edu-C/refs/heads/master/mem/mem.c\00"
@.str.2 = [12 x i8] c"ptr != NULL\00"
define noalias i8* @mem_calloc(i64 %0, i64 %1, i8* nocapture readnone %2, i64 %3) {
%5 = tail call i8* @calloc(i64 %0, i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.1, i64 0, i64 0), i32 21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %4
ret i8* %5
}