#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 */
int /*<<< orphan*/ Allocate_vectors(double **, double **, double **, int);
int /*<<< orphan*/ Print_vector(double *, int, char *);
int /*<<< orphan*/ Read_n(int *);
int /*<<< orphan*/ Read_vector(double *, int, char *);
int /*<<< orphan*/ Vector_sum(double *, double *, double *, int);
int /*<<< orphan*/ free(double *);
int main(void) {
  int n;
  double *x, *y, *z;
  Read_n(&n);
  Allocate_vectors(&x, &y, &z, n);
  Read_vector(x, n, "x");
  Read_vector(y, n, "y");
  Vector_sum(x, y, z, n);
  Print_vector(z, n, "The sum is");
  free(x);
  free(y);
  free(z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <Read_n@plt>
mov    -0x8(%rbp),%ecx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <Allocate_vectors@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdx
call   1080 <Read_vector@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    0xe55(%rip),%rdx
call   1080 <Read_vector@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%ecx
call   1070 <Vector_sum@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    0xe30(%rip),%rdx
call   1060 <Print_vector@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xc(%rsp),%rdi
call   1040 <Read_n@plt>
mov    0xc(%rsp),%ecx
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <Allocate_vectors@plt>
mov    0x20(%rsp),%rdi
mov    0xc(%rsp),%esi
lea    0xe6a(%rip),%rdx
call   1080 <Read_vector@plt>
mov    0x18(%rsp),%rdi
mov    0xc(%rsp),%esi
lea    0xe57(%rip),%rdx
call   1080 <Read_vector@plt>
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1070 <Vector_sum@plt>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%esi
lea    0xe2c(%rip),%rdx
call   1060 <Print_vector@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [11 x i8] c"The sum is\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double*
%4 = alloca double*
%5 = alloca double*
store i32 0, i32* %1
%6 = call i32 @Read_n(i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @Allocate_vectors(double** %3, double** %4, double** %5, i32 %7)
%9 = load double*, double** %3
%10 = load i32, i32* %2
%11 = call i32 @Read_vector(double* %9, i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load double*, double** %4
%13 = load i32, i32* %2
%14 = call i32 @Read_vector(double* %12, i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load double*, double** %3
%16 = load double*, double** %4
%17 = load double*, double** %5
%18 = load i32, i32* %2
%19 = call i32 @Vector_sum(double* %15, double* %16, double* %17, i32 %18)
%20 = load double*, double** %5
%21 = load i32, i32* %2
%22 = call i32 @Print_vector(double* %20, i32 %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%23 = load double*, double** %3
%24 = call i32 @free(double* %23)
%25 = load double*, double** %4
%26 = call i32 @free(double* %25)
%27 = load double*, double** %5
%28 = call i32 @free(double* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [11 x i8] c"The sum is\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double*
%3 = alloca double*
%4 = alloca double*
%5 = bitcast i32* %1 to i8*
%6 = bitcast double** %2 to i8*
%7 = bitcast double** %3 to i8*
%8 = bitcast double** %4 to i8*
%9 = call i32 @Read_n(i32* %1)
%10 = load i32, i32* %1
%11 = call i32 @Allocate_vectors(double** %2, double** %3, double** %4, i32 %10)
%12 = load double*, double** %2
%13 = load i32, i32* %1
%14 = call i32 @Read_vector(double* %12, i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load double*, double** %3
%16 = load i32, i32* %1
%17 = call i32 @Read_vector(double* %15, i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = load double*, double** %2
%19 = load double*, double** %3
%20 = load double*, double** %4
%21 = load i32, i32* %1
%22 = call i32 @Vector_sum(double* %18, double* %19, double* %20, i32 %21)
%23 = load double*, double** %4
%24 = load i32, i32* %1
%25 = call i32 @Print_vector(double* %23, i32 %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%26 = load double*, double** %2
%27 = call i32 @free(double* %26)
%28 = load double*, double** %3
%29 = call i32 @free(double* %28)
%30 = load double*, double** %4
%31 = call i32 @free(double* %30)
ret i32 0
}