#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
void *calloc_error(int elt_count, size_t elt_size, const char *variable,
                   const char *function) {
  void *array;
  array = (void *)malloc(elt_count * elt_size);
  if (array == (void *)NULL) {
    fprintf(stderr, "Cannot calloc space for \"%s\" in the ", variable);
    fprintf(stderr, "\"%s\" function.\n", function);
    exit(1);
  } else
    return (array);
}


x86 assembly (clang, -O0):
<calloc_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movslq -0x4(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11a2 <calloc_error+0x72>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe86(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc_error>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
imul   %esi,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     114e <calloc_error+0x1e>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e8b(%rip),%r15
mov    (%r15),%edi
lea    0xea1(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r15),%edi
lea    0xeb4(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Cannot calloc space for \22%s\22 in the \00"
@.str.1 = [16 x i8] c"\22%s\22 function.\0A\00"
define i8* @calloc_error(i32 %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = load i64, i64* %6
%13 = mul i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %9
%17 = load i8*, i8** %9
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %27
19: ; preds = %4
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %7
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %8
%25 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %4
%28 = load i8*, i8** %9
ret i8* %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Cannot calloc space for \22%s\22 in the \00"
@.str.1 = [16 x i8] c"\22%s\22 function.\0A\00"
define i8* @calloc_error(i32 %0, i64 %1, i8* %2, i8* %3) {
%5 = trunc i64 %1 to i32
%6 = mul i32 %5, %0
%7 = tail call i64 @malloc(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %4
%16 = inttoptr i64 %7 to i8*
ret i8* %16
}