#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(int);
void *calloc(int, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void *_co_mem_calloc(int nmemb, int size) {
  void *r;
  if (nmemb < 0) {
    nmemb = 0;
  }
  if (size < 0) {
    size = 0;
  }
  if ((r = calloc(nmemb, size)) == 0) {
    {
      fprintf(stderr,
              "FATAL "
              "_co_mem_calloc: insufficient memory for %dx%d bytes: %m",
              nmemb, size);
      fprintf(stderr, " [%s:%u]\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/mailhonor/libzc/refs/heads/master/src/"
              "coroutine/coroutine.c",
              173);
      fflush(stderr);
      _exit(1);
    };
  }
  return r;
}


x86 assembly (clang, -O0):
<_co_mem_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    115f <_co_mem_calloc+0x1f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1170 <_co_mem_calloc+0x30>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11e1 <_co_mem_calloc+0xa1>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    $0xad,%ecx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_co_mem_calloc>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
xor    %ebp,%ebp
test   %edi,%edi
cmovs  %ebp,%ebx
test   %esi,%esi
cmovns %esi,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <calloc@plt>
test   %rax,%rax
je     1165 <_co_mem_calloc+0x25>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e74(%rip),%r14
mov    (%r14),%edi
lea    0xe8a(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
lea    0xeb3(%rip),%rsi
lea    0xeb6(%rip),%rdx
mov    $0xad,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"FATAL _co_mem_calloc: insufficient memory for %dx%d bytes: %m\00"
@.str.1 = [10 x i8] c" [%s:%u]\0A\00"
@.str.2 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mailhonor/libzc/refs/heads/master/src/coroutine/coroutine.c\00"
define i8* @_co_mem_calloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %9
9: ; preds = %8, %2
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %4
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i8* @calloc(i32 %14, i32 %15)
store i8* %16, i8** %5
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %28
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 173)
%25 = load i32, i32* @stderr
%26 = call i32 @fflush(i32 %25)
%27 = call i32 @_exit(i32 1)
unreachable
28: ; preds = %13
%29 = load i8*, i8** %5
ret i8* %29
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"FATAL _co_mem_calloc: insufficient memory for %dx%d bytes: %m\00"
@.str.1 = [10 x i8] c" [%s:%u]\0A\00"
@.str.2 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mailhonor/libzc/refs/heads/master/src/coroutine/coroutine.c\00"
define noalias i8* @_co_mem_calloc(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = select i1 %3, i32 %0, i32 0
%5 = icmp sgt i32 %1, 0
%6 = select i1 %5, i32 %1, i32 0
%7 = tail call i8* @calloc(i32 %4, i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 173)
%14 = load i32, i32* @stderr
%15 = tail call i32 @fflush(i32 %14)
%16 = tail call i32 @_exit(i32 1)
unreachable
17: ; preds = %2
ret i8* %7
}