#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fatalx(char *, int);
int /*<<< orphan*/ vclear(double *, double, int);
double **initarray_2Ddouble(int numrows, int numcolumns, double initval) {
  int i, j;
  double **array;
  if ((array = (double **)calloc((numrows), sizeof(double *))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", numrows);
  for (i = 0; i < numrows; i++) {
    if ((array[i] = (double *)calloc((numcolumns), sizeof(double))) == NULL)
      fatalx("Unable to allocate %d unit(s) for item \n", numcolumns);
    if (initval != 0.0)
      vclear(array[i], initval, numcolumns);
  }
  return array;
}


x86 assembly (clang, -O0):
<initarray_2Ddouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    116d <initarray_2Ddouble+0x3d>
mov    -0x4(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <fatalx@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11fb <initarray_2Ddouble+0xcb>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    -0x20(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %rax,(%rcx,%rdx,8)
cmp    $0x0,%rax
jne    11b2 <initarray_2Ddouble+0x82>
mov    -0x8(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1030 <fatalx@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11cf <initarray_2Ddouble+0x9f>
jp     11cf <initarray_2Ddouble+0x9f>
jmp    11e8 <initarray_2Ddouble+0xb8>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%esi
call   1050 <vclear@plt>
jmp    11ed <initarray_2Ddouble+0xbd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <initarray_2Ddouble+0x44>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initarray_2Ddouble>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     115e <initarray_2Ddouble+0x2e>
test   %ebp,%ebp
jg     1170 <initarray_2Ddouble+0x40>
jmp    11cd <initarray_2Ddouble+0x9d>
lea    0xea3(%rip),%rdi
mov    %ebp,%esi
call   1030 <fatalx@plt>
test   %ebp,%ebp
jle    11cd <initarray_2Ddouble+0x9d>
mov    %ebp,%r12d
xor    %ebp,%ebp
lea    0xe8c(%rip),%r15
jmp    1189 <initarray_2Ddouble+0x59>
xchg   %ax,%ax
add    $0x1,%rbp
cmp    %rbp,%r12
je     11cd <initarray_2Ddouble+0x9d>
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,(%r14,%rbp,8)
test   %rax,%rax
jne    11a8 <initarray_2Ddouble+0x78>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <fatalx@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe4a(%rip),%xmm0
jne    11ba <initarray_2Ddouble+0x8a>
jnp    1180 <initarray_2Ddouble+0x50>
mov    (%r14,%rbp,8),%rdi
movsd  0x8(%rsp),%xmm0
mov    %ebx,%esi
call   1050 <vclear@plt>
jmp    1180 <initarray_2Ddouble+0x50>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
define double** @initarray_2Ddouble(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double**
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%10 = load i32, i32* %4
%11 = call i64 @calloc(i32 %10, i32 8)
%12 = inttoptr i64 %11 to double**
store double** %12, double*** %9
%13 = icmp eq double** %12, null
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* %4
%16 = call i32 @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %3
store i32 0, i32* %7
br label %18
18: ; preds = %47, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %50
22: ; preds = %18
%23 = load i32, i32* %5
%24 = call i64 @calloc(i32 %23, i32 8)
%25 = inttoptr i64 %24 to double*
%26 = load double**, double*** %9
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double*, double** %26, i64 %28
store double* %25, double** %29
%30 = icmp eq double* %25, null
br i1 %30, label %31, label %34
31: ; preds = %22
%32 = load i32, i32* %5
%33 = call i32 @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %22
%35 = load double, double* %6
%36 = fcmp une double %35, 0.000000e+00
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = load double**, double*** %9
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double*, double** %38, i64 %40
%42 = load double*, double** %41
%43 = load double, double* %6
%44 = load i32, i32* %5
%45 = call i32 @vclear(double* %42, double %43, i32 %44)
br label %46
46: ; preds = %37, %34
br label %47
47: ; preds = %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %18
50: ; preds = %18
%51 = load double**, double*** %9
ret double** %51
}

LLVM IR (-O2):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
define double** @initarray_2Ddouble(i32 %0, i32 %1, double %2) {
%4 = tail call i64 @calloc(i32 %0, i32 8)
%5 = inttoptr i64 %4 to double**
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
9: ; preds = %7, %3
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %29
11: ; preds = %9
%12 = fcmp une double %2, 0.000000e+00
%13 = zext i32 %0 to i64
br label %14
14: ; preds = %11, %26
%15 = phi i64 [ 0, %11 ], [ %27, %26 ]
%16 = tail call i64 @calloc(i32 %1, i32 8)
%17 = inttoptr i64 %16 to double*
%18 = getelementptr inbounds double*, double** %5, i64 %15
store double* %17, double** %18
%19 = icmp eq i64 %16, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = tail call i32 @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %22
22: ; preds = %20, %14
br i1 %12, label %23, label %26
23: ; preds = %22
%24 = load double*, double** %18
%25 = tail call i32 @vclear(double* %24, double %2, i32 %1)
br label %26
26: ; preds = %22, %23
%27 = add nuw nsw i64 %15, 1
%28 = icmp eq i64 %27, %13
br i1 %28, label %29, label %14
29: ; preds = %26, %9
ret double** %5
}