#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);
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);
  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   1090 <readVector@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <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    -0x4(%rbp),%esi
call   1050 <printTab@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <lVec@plt>
lea    0xe28(%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    0xe04(%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    0xde0(%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   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    $0x4,%edi
call   1090 <readVector@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1090 <readVector@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1040 <addVec@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <lVec@plt>
lea    0xe2c(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    %r12,%rdi
mov    $0x4,%esi
call   1060 <lVec@plt>
mov    %r14,%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    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [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 i32, i32* %1
%17 = call i32 @printTab(double* %15, i32 %16)
%18 = load double*, double** %2
%19 = load i32, i32* %1
%20 = call double @lVec(double* %18, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %20)
%22 = load double*, double** %3
%23 = load i32, i32* %1
%24 = call i32 @printTab(double* %22, i32 %23)
%25 = load double*, double** %3
%26 = load i32, i32* %1
%27 = call double @lVec(double* %25, i32 %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %27)
%29 = load double*, double** %4
%30 = load i32, i32* %1
%31 = call i32 @printTab(double* %29, i32 %30)
%32 = load double*, double** %4
%33 = load i32, i32* %1
%34 = call double @lVec(double* %32, i32 %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [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 @printTab(double* %3, i32 4)
%7 = tail call double @lVec(double* %3, i32 4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call i32 @printTab(double* %4, i32 4)
%10 = tail call double @lVec(double* %4, i32 4)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %10)
%12 = tail call i32 @printTab(double* %5, i32 4)
%13 = tail call double @lVec(double* %5, i32 4)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %13)
ret i32 0
}