#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*/ check(float *, float *, int);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ init(float *, float *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ vec_mult(float *, float *, float *, int);
int /*<<< orphan*/ vec_mult_ref(float *, float *, float *, int);
int main() {
  float *p1 = (float *)malloc(10000 * sizeof(float));
  float *p2 = (float *)malloc(10000 * sizeof(float));
  float *v1 = (float *)malloc(10000 * sizeof(float));
  float *v2 = (float *)malloc(10000 * sizeof(float));
  init(v1, v2, 10000);
  vec_mult_ref(p1, v1, v2, 10000);
  vec_mult(p2, v1, v2, 10000);
  check(p1, p2, 10000);
  free(p1);
  free(p2);
  free(v1);
  free(v2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x2710,%edx
call   1040 <init@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x2710,%ecx
call   1060 <vec_mult_ref@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x2710,%ecx
call   1080 <vec_mult@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x2710,%edx
call   1070 <check@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>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rax,%rsi
mov    $0x2710,%edx
call   1040 <init@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    $0x2710,%ecx
call   1060 <vec_mult_ref@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    $0x2710,%ecx
call   1080 <vec_mult@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x2710,%edx
call   1070 <check@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float*
%3 = alloca float*
%4 = alloca float*
%5 = alloca float*
store i32 0, i32* %1
%6 = call i64 @malloc(i32 40000)
%7 = inttoptr i64 %6 to float*
store float* %7, float** %2
%8 = call i64 @malloc(i32 40000)
%9 = inttoptr i64 %8 to float*
store float* %9, float** %3
%10 = call i64 @malloc(i32 40000)
%11 = inttoptr i64 %10 to float*
store float* %11, float** %4
%12 = call i64 @malloc(i32 40000)
%13 = inttoptr i64 %12 to float*
store float* %13, float** %5
%14 = load float*, float** %4
%15 = load float*, float** %5
%16 = call i32 @init(float* %14, float* %15, i32 10000)
%17 = load float*, float** %2
%18 = load float*, float** %4
%19 = load float*, float** %5
%20 = call i32 @vec_mult_ref(float* %17, float* %18, float* %19, i32 10000)
%21 = load float*, float** %3
%22 = load float*, float** %4
%23 = load float*, float** %5
%24 = call i32 @vec_mult(float* %21, float* %22, float* %23, i32 10000)
%25 = load float*, float** %2
%26 = load float*, float** %3
%27 = call i32 @check(float* %25, float* %26, i32 10000)
%28 = load float*, float** %2
%29 = call i32 @free(float* %28)
%30 = load float*, float** %3
%31 = call i32 @free(float* %30)
%32 = load float*, float** %4
%33 = call i32 @free(float* %32)
%34 = load float*, float** %5
%35 = call i32 @free(float* %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 40000)
%2 = inttoptr i64 %1 to float*
%3 = tail call i64 @malloc(i32 40000)
%4 = inttoptr i64 %3 to float*
%5 = tail call i64 @malloc(i32 40000)
%6 = inttoptr i64 %5 to float*
%7 = tail call i64 @malloc(i32 40000)
%8 = inttoptr i64 %7 to float*
%9 = tail call i32 @init(float* %6, float* %8, i32 10000)
%10 = tail call i32 @vec_mult_ref(float* %2, float* %6, float* %8, i32 10000)
%11 = tail call i32 @vec_mult(float* %4, float* %6, float* %8, i32 10000)
%12 = tail call i32 @check(float* %2, float* %4, i32 10000)
%13 = tail call i32 @free(float* %2)
%14 = tail call i32 @free(float* %4)
%15 = tail call i32 @free(float* %6)
%16 = tail call i32 @free(float* %8)
ret i32 0
}