#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);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
void *malloc(int);
int /*<<< orphan*/ stderr;
void *_co_mem_malloc(int len) {
  void *r;
  if (len < 0) {
    len = 0;
  }
  if ((r = malloc(len)) == 0) {
    {
      fprintf(stderr,
              "FATAL "
              "_co_mem_malloc: insufficient memory for %d bytes: %m",
              len);
      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",
              156);
      fflush(stderr);
      _exit(1);
    };
  }
  return r;
}


x86 assembly (clang, -O0):
<_co_mem_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    115c <_co_mem_malloc+0x1c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11c7 <_co_mem_malloc+0x87>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
lea    0xea2(%rip),%rdx
mov    $0x9c,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e2a(%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_malloc>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
test   %edi,%edi
cmovns %edi,%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <_co_mem_malloc+0x1f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e7a(%rip),%r14
mov    (%r14),%edi
lea    0xe90(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xeb8(%rip),%rsi
lea    0xebb(%rip),%rdx
mov    $0x9c,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"FATAL _co_mem_malloc: insufficient memory for %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_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %1
%8 = load i32, i32* %2
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32, i32* @stderr
%13 = load i32, i32* %2
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, 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 156)
%17 = load i32, i32* @stderr
%18 = call i32 @fflush(i32 %17)
%19 = call i32 @_exit(i32 1)
unreachable
20: ; preds = %7
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"FATAL _co_mem_malloc: insufficient memory for %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_malloc(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %3)
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, 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 156)
%11 = load i32, i32* @stderr
%12 = tail call i32 @fflush(i32 %11)
%13 = tail call i32 @_exit(i32 1)
unreachable
14: ; preds = %1
ret i8* %4
}