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


x86 assembly (clang, -O0):
<new_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1185 <new_double+0x55>
movslq -0x4(%rbp),%rdx
lea    0x2eee(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x8,%ecx
call   1050 <sprintf@plt>
lea    0x2ed6(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <FATAL@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_double>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1173 <new_double+0x43>
movslq %ebp,%rdx
lea    0x2eff(%rip),%rbp
lea    0xea8(%rip),%rsi
mov    $0x8,%ecx
mov    %rbp,%rdi
call   1050 <sprintf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <FATAL@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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