#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(size_t, size_t);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int /*<<< orphan*/ stderr;
__attribute__((unused)) void *ls_xcalloc(size_t nelems, size_t elemsz) {
  void *r = calloc(nelems, elemsz);
  if (nelems && elemsz && !r) {
    do {
      fprintf(stderr, "LS_PANIC() at %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/shdown/luastatus/refs/heads/master/"
              "libls/alloc_utils.h",
              66, "out of memory");
      abort();
    } while (0);
  }
  return r;
}


x86 assembly (clang, -O0):
<ls_xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a6 <ls_xcalloc+0x76>
cmpq   $0x0,-0x10(%rbp)
je     11a6 <ls_xcalloc+0x76>
cmpq   $0x0,-0x18(%rbp)
jne    11a6 <ls_xcalloc+0x76>
jmp    1177 <ls_xcalloc+0x47>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    $0x42,%ecx
lea    0xf10(%rip),%r8
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <calloc@plt>
test   %rbx,%rbx
je     114e <ls_xcalloc+0x1e>
test   %r14,%r14
je     114e <ls_xcalloc+0x1e>
test   %rax,%rax
je     1156 <ls_xcalloc+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
lea    0xeac(%rip),%rdx
lea    0xf36(%rip),%r8
mov    $0x42,%ecx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"LS_PANIC() at %s:%d: %s\0A\00"
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shdown/luastatus/refs/heads/master/libls/alloc_utils.h\00"
@.str.2 = [14 x i8] c"out of memory\00"
define i8* @ls_xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i64, i64* %3
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %23, label %17
17: ; preds = %14
br label %18
18: ; preds = %17
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 66, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (...) @abort()
unreachable
22: ; No predecessors!
br label %23
23: ; preds = %22, %14, %11, %2
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"LS_PANIC() at %s:%d: %s\0A\00"
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shdown/luastatus/refs/heads/master/libls/alloc_utils.h\00"
@.str.2 = [14 x i8] c"out of memory\00"
define noalias i8* @ls_xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i64 %0, 0
%5 = icmp eq i64 %1, 0
%6 = or i1 %4, %5
%7 = icmp ne i8* %3, null
%8 = or i1 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 66, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 (...) @abort()
unreachable
13: ; preds = %2
ret i8* %3
}