#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 *);
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, *v2;
  vec_mult_ref(p1, v1, v2, 10000);
  vec_mult(p2, v1, v2, 10000);
  check(p1, p2, 10000);
  free(p1);
  free(p2);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x9c40,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x9c40,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x2710,%ecx
call   1050 <vec_mult_ref@plt>
mov    %rbx,%rdi
mov    $0x2710,%ecx
call   1070 <vec_mult@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2710,%edx
call   1060 <check@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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 = load float*, float** %2
%11 = load float*, float** %4
%12 = load float*, float** %5
%13 = call i32 @vec_mult_ref(float* %10, float* %11, float* %12, i32 10000)
%14 = load float*, float** %3
%15 = load float*, float** %4
%16 = load float*, float** %5
%17 = call i32 @vec_mult(float* %14, float* %15, float* %16, i32 10000)
%18 = load float*, float** %2
%19 = load float*, float** %3
%20 = call i32 @check(float* %18, float* %19, i32 10000)
%21 = load float*, float** %2
%22 = call i32 @free(float* %21)
%23 = load float*, float** %3
%24 = call i32 @free(float* %23)
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 i32 @vec_mult_ref(float* %2, float* undef, float* undef, i32 10000)
%6 = tail call i32 @vec_mult(float* %4, float* undef, float* undef, i32 10000)
%7 = tail call i32 @check(float* %2, float* %4, i32 10000)
%8 = tail call i32 @free(float* %2)
%9 = tail call i32 @free(float* %4)
ret i32 0
}