#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*/ FATAL(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
void *calloc(unsigned int, size_t);
int /*<<< orphan*/ sprintf(char *, char *, long, long);
void *new_void(int n, size_t size) {
  static char s[70];
  void *p = calloc((unsigned)n, size);
  if (p == NULL) {
    sprintf(s, "new_void(): calloc(%ld,%ld) failed", (long)n, (long)size);
    FATAL(s, 0, 0, 0);
  }
  return p;
}


x86 assembly (clang, -O0):
<new_void>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1187 <new_void+0x57>
movslq -0x4(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0x2ee7(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1050 <sprintf@plt>
lea    0x2ed4(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <FATAL@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_void>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1170 <new_void+0x40>
movslq %ebp,%rdx
lea    0x2f00(%rip),%rbp
lea    0xea9(%rip),%rsi
mov    %rbp,%rdi
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <FATAL@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@new_void.s = internal global [70 x i8] zeroinitializer
@.str = [35 x i8] c"new_void(): calloc(%ld,%ld) failed\00"
define i8* @new_void(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i32, i32* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i32 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = load i64, i64* %4
%15 = call i32 @sprintf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @new_void.s, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i64 %13, i64 %14)
%16 = call i32 @FATAL(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @new_void.s, i64 0, i64 0), i32 0, i32 0, i32 0)
br label %17
17: ; preds = %11, %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@new_void.s = internal global [70 x i8] zeroinitializer
@.str = [35 x i8] c"new_void(): calloc(%ld,%ld) failed\00"
define i8* @new_void(i32 %0, i64 %1) {
%3 = tail call i8* @calloc(i32 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %0 to i64
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @new_void.s, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i64 %6, i64 %1)
%8 = tail call i32 @FATAL(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @new_void.s, i64 0, i64 0), i32 0, i32 0, i32 0)
br label %9
9: ; preds = %5, %2
ret i8* %3
}