#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 */
struct Vector {
  int dummy;
};

/* Variables and functions */
struct Vector *add_vectors(struct Vector *, struct Vector *);
struct Vector *new_from(double *, int);
int /*<<< orphan*/ print_vector(struct Vector *);
int main() {
  double values_x[] = {1.43, 2.0, 3.5, 4.0};
  double values_y[] = {7.0, -2.7, 4.0, 0.0};
  struct Vector *x = new_from(values_x, 4);
  struct Vector *y = new_from(values_y, 4);
  struct Vector *r = add_vectors(x, y);
  print_vector(r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1040 <new_from@plt>
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x4,%esi
call   1040 <new_from@plt>
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1050 <add_vectors@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1030 <print_vector@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x4,%esi
call   1040 <new_from@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x4,%esi
call   1040 <new_from@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <add_vectors@plt>
mov    %rax,%rdi
call   1030 <print_vector@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Vector = type { i32 }
@__const.main.values_x = [4 x double] [double 1.430000e+00, double 2.000000e+00, double 3.500000e+00, double 4.000000e+00]
@__const.main.values_y = [4 x double] [double 7.000000e+00, double -2.700000e+00, double 4.000000e+00, double 0.000000e+00]
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x double]
%3 = alloca [4 x double]
%4 = alloca %struct.Vector*
%5 = alloca %struct.Vector*
%6 = alloca %struct.Vector*
store i32 0, i32* %1
%7 = bitcast [4 x double]* %2 to i8*
%8 = bitcast [4 x double]* %3 to i8*
%9 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%10 = call %struct.Vector* @new_from(double* %9, i32 4)
store %struct.Vector* %10, %struct.Vector** %4
%11 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
%12 = call %struct.Vector* @new_from(double* %11, i32 4)
store %struct.Vector* %12, %struct.Vector** %5
%13 = load %struct.Vector*, %struct.Vector** %4
%14 = load %struct.Vector*, %struct.Vector** %5
%15 = call %struct.Vector* @add_vectors(%struct.Vector* %13, %struct.Vector* %14)
store %struct.Vector* %15, %struct.Vector** %6
%16 = load %struct.Vector*, %struct.Vector** %6
%17 = call i32 @print_vector(%struct.Vector* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.Vector = type { i32 }
@__const.main.values_x = [4 x double] [double 1.430000e+00, double 2.000000e+00, double 3.500000e+00, double 4.000000e+00]
@__const.main.values_y = [4 x double] [double 7.000000e+00, double -2.700000e+00, double 4.000000e+00, double 0.000000e+00]
define i32 @main() {
%1 = alloca [4 x double]
%2 = alloca [4 x double]
%3 = bitcast [4 x double]* %1 to i8*
%4 = bitcast [4 x double]* %2 to i8*
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%6 = call %struct.Vector* @new_from(double* %5, i32 4)
%7 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%8 = call %struct.Vector* @new_from(double* %7, i32 4)
%9 = call %struct.Vector* @add_vectors(%struct.Vector* %6, %struct.Vector* %8)
%10 = call i32 @print_vector(%struct.Vector* %9)
ret i32 0
}