#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*/ copyarr(double *, double *, int);
int /*<<< orphan*/ fatalx(char *, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ vsp(double *, double *, double, int);
int /*<<< orphan*/ vvm(double *, double *, double *, int);
void vcompl(double *a, double *b, int n) {
  double *x;
  if ((x = (double *)calloc((n), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", n);
  vvm(x, x, b, n);
  vsp(x, x, 1.0, n);
  copyarr(x, a, n);
  free(x);
}


x86 assembly (clang, -O0):
<vcompl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    119d <vcompl+0x3d>
mov    -0x14(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1050 <fatalx@plt>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1080 <vvm@plt>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  0xe3c(%rip),%xmm0
call   1040 <vsp@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1070 <copyarr@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vcompl>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %edx,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1191 <vcompl+0x31>
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
call   1050 <fatalx@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %ebp,%ecx
call   1080 <vvm@plt>
movsd  0xe57(%rip),%xmm0
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <vsp@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1070 <copyarr@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
define void @vcompl(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i64 @calloc(i32 %8, i32 8)
%10 = inttoptr i64 %9 to double*
store double* %10, double** %7
%11 = icmp eq double* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* %6
%14 = call i32 @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %3
%16 = load double*, double** %7
%17 = load double*, double** %7
%18 = load double*, double** %5
%19 = load i32, i32* %6
%20 = call i32 @vvm(double* %16, double* %17, double* %18, i32 %19)
%21 = load double*, double** %7
%22 = load double*, double** %7
%23 = load i32, i32* %6
%24 = call i32 @vsp(double* %21, double* %22, double 1.000000e+00, i32 %23)
%25 = load double*, double** %7
%26 = load double*, double** %4
%27 = load i32, i32* %6
%28 = call i32 @copyarr(double* %25, double* %26, i32 %27)
%29 = load double*, double** %7
%30 = call i32 @free(double* %29)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
define void @vcompl(double* %0, double* %1, i32 %2) {
%4 = tail call i64 @calloc(i32 %2, 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 %2)
br label %9
9: ; preds = %7, %3
%10 = tail call i32 @vvm(double* %5, double* %5, double* %1, i32 %2)
%11 = tail call i32 @vsp(double* %5, double* %5, double 1.000000e+00, i32 %2)
%12 = tail call i32 @copyarr(double* %5, double* %0, i32 %2)
%13 = tail call i32 @free(double* %5)
ret void
}