#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(long, int);
scalar_t__ malloc(long);
int /*<<< orphan*/ perror(char *);
double *svd_doubleArray(long size, char empty, char *name) {
  double *a;
  if (empty)
    a = (double *)calloc(size, sizeof(double));
  else
    a = (double *)malloc(size * sizeof(double));
  if (!a) {
    perror(name);
  }
  return a;
}


x86 assembly (clang, -O0):
<svd_doubleArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
cmpb   $0x0,-0x9(%rbp)
je     1167 <svd_doubleArray+0x37>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
jmp    1178 <svd_doubleArray+0x48>
mov    -0x8(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118c <svd_doubleArray+0x5c>
mov    -0x18(%rbp),%rdi
call   1050 <perror@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svd_doubleArray>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %sil,%sil
je     1148 <svd_doubleArray+0x18>
mov    $0x8,%esi
call   1030 <calloc@plt>
jmp    1151 <svd_doubleArray+0x21>
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1164 <svd_doubleArray+0x34>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1050 <perror@plt>
jmp    1159 <svd_doubleArray+0x29>

LLVM IR (-O0):
define double* @svd_doubleArray(i64 %0, i8 signext %1, i8* %2) {
%4 = alloca i64
%5 = alloca i8
%6 = alloca i8*
%7 = alloca double*
store i64 %0, i64* %4
store i8 %1, i8* %5
store i8* %2, i8** %6
%8 = load i8, i8* %5
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i64, i64* %4
%12 = call i64 @calloc(i64 %11, i32 8)
%13 = inttoptr i64 %12 to double*
store double* %13, double** %7
br label %19
14: ; preds = %3
%15 = load i64, i64* %4
%16 = mul i64 %15, 8
%17 = call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to double*
store double* %18, double** %7
br label %19
19: ; preds = %14, %10
%20 = load double*, double** %7
%21 = icmp ne double* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i8*, i8** %6
%24 = call i32 @perror(i8* %23)
br label %25
25: ; preds = %22, %19
%26 = load double*, double** %7
ret double* %26
}

LLVM IR (-O2):
define double* @svd_doubleArray(i64 %0, i8 signext %1, i8* nocapture %2) {
%4 = icmp eq i8 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i64 @calloc(i64 %0, i32 8)
br label %10
7: ; preds = %3
%8 = shl i64 %0, 3
%9 = tail call i64 @malloc(i64 %8)
br label %10
10: ; preds = %7, %5
%11 = phi i64 [ %6, %5 ], [ %9, %7 ]
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @perror(i8* %2)
br label %15
15: ; preds = %13, %10
%16 = inttoptr i64 %11 to double*
ret double* %16
}