#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();
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *calloc(size_t, size_t);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void *xcalloc(size_t n, size_t size) {
  void *ptr;
  do {
    assert(((n > 0)) && ("assertion failed in ASSUME"));
  } while (0);
  do {
    assert(((size > 0)) && ("assertion failed in ASSUME"));
  } while (0);
  ptr = calloc((n), (size));
  if ((!!(ptr == NULL))) {
    fputs("Out of memory for xcalloc.\nAborting now.\n", stderr);
    abort();
    do {
      assert((0) && ("assertion failed in ASSUME_UNREACHABLE"));
    } while (0);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jbe    116a <xcalloc+0x2a>
mov    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    116a <xcalloc+0x2a>
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
jmp    117c <xcalloc+0x3c>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1a(%rbp)
jbe    1196 <xcalloc+0x56>
mov    $0x1,%al
mov    %al,-0x1a(%rbp)
jmp    1196 <xcalloc+0x56>
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11db <xcalloc+0x9b>
mov    0x2e1a(%rip),%rax
mov    (%rax),%esi
lea    0xe4c(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1060 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <calloc@plt>
test   %rax,%rax
je     117e <xcalloc+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e5b(%rip),%rax
mov    (%rax),%esi
lea    0xe72(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"assertion failed in ASSUME\00"
@.str.1 = [42 x i8] c"Out of memory for xcalloc.\0AAborting now.\0A\00"
@stderr = global i32 0
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %6
6: ; preds = %2
%7 = load i64, i64* %3
%8 = icmp ugt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
br label %10
10: ; preds = %9, %6
%11 = phi i1 [ false, %6 ], [ true, %9 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
br label %14
14: ; preds = %10
br label %15
15: ; preds = %14
%16 = load i64, i64* %4
%17 = icmp ugt i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %19
19: ; preds = %18, %15
%20 = phi i1 [ false, %15 ], [ true, %18 ]
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
br label %23
23: ; preds = %19
%24 = load i64, i64* %3
%25 = load i64, i64* %4
%26 = call i8* @calloc(i64 %24, i64 %25)
store i8* %26, i8** %5
%27 = load i8*, i8** %5
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = load i32, i32* @stderr
%31 = call i32 @fputs(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %23
%34 = load i8*, i8** %5
ret i8* %34
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"Out of memory for xcalloc.\0AAborting now.\0A\00"
@stderr = global i32 0
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = icmp ne i64 %0, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i8* @calloc(i64 %0, i64 %1)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = tail call i32 @fputs(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %2
ret i8* %9
}