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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    -0x4(%rbp),%edi
call   1090 <vector@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <initVec@plt>
mov    -0x4(%rbp),%edi
call   1090 <vector@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <initVec@plt>
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>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <printTab@plt>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <printTab@plt>
lea    0xdec(%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   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x4,%edi
call   1090 <vector@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x4,%esi
call   1080 <initVec@plt>
mov    $0x4,%edi
call   1090 <vector@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x4,%esi
call   1080 <initVec@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <addVec@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1050 <printTab@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\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* @vector(i32 %7)
store double* %8, double** %2
%9 = load double*, double** %2
%10 = load i32, i32* %1
%11 = call i32 @initVec(double* %9, i32 %10)
%12 = load i32, i32* %1
%13 = call double* @vector(i32 %12)
store double* %13, double** %3
%14 = load double*, double** %3
%15 = load i32, i32* %1
%16 = call i32 @initVec(double* %14, i32 %15)
%17 = load double*, double** %2
%18 = load double*, double** %3
%19 = load i32, i32* %1
%20 = call double* @addVec(double* %17, double* %18, i32 %19)
store double* %20, double** %4
%21 = load double*, double** %2
%22 = load i32, i32* %1
%23 = call i32 @printTab(double* %21, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load double*, double** %3
%26 = load i32, i32* %1
%27 = call i32 @printTab(double* %25, i32 %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = load double*, double** %4
%30 = load i32, i32* %1
%31 = call i32 @printTab(double* %29, i32 %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call double* @vector(i32 4)
%4 = tail call i32 @initVec(double* %3, i32 4)
%5 = tail call double* @vector(i32 4)
%6 = tail call i32 @initVec(double* %5, i32 4)
%7 = tail call double* @addVec(double* %3, double* %5, i32 4)
%8 = tail call i32 @printTab(double* %3, i32 4)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @printTab(double* %5, i32 4)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 @printTab(double* %7, i32 4)
%13 = tail call i32 @putchar(i32 10)
ret i32 0
}