#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 */
double *addVec(double *, double *, int);
int isParallel(double *, double *, int);
double lVec(double *, int);
int /*<<< orphan*/ printTab(double *, int);
int /*<<< orphan*/ printf(char *, double);
double *readVector(int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  int size = 4;
  srand(time(0));
  double *a = readVector(size);
  double *b = readVector(size);
  double *c = addVec(a, b, size);
  printf("%d isParal", isParallel(a, b, size));
  printTab(a, size);
  printf("%f \n", lVec(a, size));
  printTab(b, size);
  printf("%f \n", lVec(b, size));
  printTab(c, size);
  printf("%f \n", lVec(c, size));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x4(%rbp),%edi
call   10a0 <readVector@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   10a0 <readVector@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1040 <addVec@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1090 <isParallel@plt>
cvtsi2sd %eax,%xmm0
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <printTab@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <lVec@plt>
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <printTab@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <lVec@plt>
lea    0xddf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <printTab@plt>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <lVec@plt>
lea    0xdbb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    $0x4,%edi
call   10a0 <readVector@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   10a0 <readVector@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1040 <addVec@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1090 <isParallel@plt>
cvtsi2sd %eax,%xmm0
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <lVec@plt>
lea    0xe0a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1060 <lVec@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1060 <lVec@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d isParal\00"
@.str.1 = [5 x i8] c"%f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double*
%3 = alloca double*
%4 = alloca double*
store i32 4, i32* %1
%5 = call i32 @time(i32 0)
%6 = call i32 @srand(i32 %5)
%7 = load i32, i32* %1
%8 = call double* @readVector(i32 %7)
store double* %8, double** %2
%9 = load i32, i32* %1
%10 = call double* @readVector(i32 %9)
store double* %10, double** %3
%11 = load double*, double** %2
%12 = load double*, double** %3
%13 = load i32, i32* %1
%14 = call double* @addVec(double* %11, double* %12, i32 %13)
store double* %14, double** %4
%15 = load double*, double** %2
%16 = load double*, double** %3
%17 = load i32, i32* %1
%18 = call i32 @isParallel(double* %15, double* %16, i32 %17)
%19 = sitofp i32 %18 to double
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %19)
%21 = load double*, double** %2
%22 = load i32, i32* %1
%23 = call i32 @printTab(double* %21, i32 %22)
%24 = load double*, double** %2
%25 = load i32, i32* %1
%26 = call double @lVec(double* %24, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = load double*, double** %3
%29 = load i32, i32* %1
%30 = call i32 @printTab(double* %28, i32 %29)
%31 = load double*, double** %3
%32 = load i32, i32* %1
%33 = call double @lVec(double* %31, i32 %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %33)
%35 = load double*, double** %4
%36 = load i32, i32* %1
%37 = call i32 @printTab(double* %35, i32 %36)
%38 = load double*, double** %4
%39 = load i32, i32* %1
%40 = call double @lVec(double* %38, i32 %39)
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d isParal\00"
@.str.1 = [5 x i8] c"%f \0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call double* @readVector(i32 4)
%4 = tail call double* @readVector(i32 4)
%5 = tail call double* @addVec(double* %3, double* %4, i32 4)
%6 = tail call i32 @isParallel(double* %3, double* %4, i32 4)
%7 = sitofp i32 %6 to double
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call i32 @printTab(double* %3, i32 4)
%10 = tail call double @lVec(double* %3, i32 4)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = tail call i32 @printTab(double* %4, i32 4)
%13 = tail call double @lVec(double* %4, i32 4)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = tail call i32 @printTab(double* %5, i32 4)
%16 = tail call double @lVec(double* %5, i32 4)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %16)
ret i32 0
}