#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*/ init(long long *, long long *);
void vec_mult_ref(long long *p) {
  int i;
  long long v1[100000], v2[100000];
  init(v1, v2);
  for (i = 0; i < 100000; i++)
    p[i] = v1[i] * v2[i];
}


x86 assembly (clang, -O0):
<vec_mult_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186a10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc3510(%rbp),%rdi
lea    -0x186a10(%rbp),%rsi
call   1030 <init@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    1179 <vec_mult_ref+0x69>
movslq -0xc(%rbp),%rax
mov    -0xc3510(%rbp,%rax,8),%rdx
ff
movslq -0xc(%rbp),%rax
imul   -0x186a10(%rbp,%rax,8),%rdx
e7 ff
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <vec_mult_ref+0x29>
add    $0x186a10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_mult_ref>:
push   %rbx
sub    $0x186a00,%rsp
mov    %rdi,%rbx
lea    0xc3500(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <init@plt>
mov    $0x6,%eax
movdqa 0xc34d0(%rsp,%rax,8),%xmm2
movdqa 0xc34e0(%rsp,%rax,8),%xmm3
movdqa -0x30(%rsp,%rax,8),%xmm0
movdqa -0x20(%rsp,%rax,8),%xmm1
movdqa %xmm0,%xmm4
psrlq  $0x20,%xmm4
pmuludq %xmm2,%xmm4
movdqa %xmm2,%xmm5
psrlq  $0x20,%xmm5
pmuludq %xmm0,%xmm5
paddq  %xmm4,%xmm5
psllq  $0x20,%xmm5
pmuludq %xmm2,%xmm0
paddq  %xmm5,%xmm0
movdqa %xmm1,%xmm2
psrlq  $0x20,%xmm2
pmuludq %xmm3,%xmm2
movdqa %xmm3,%xmm4
psrlq  $0x20,%xmm4
pmuludq %xmm1,%xmm4
paddq  %xmm2,%xmm4
psllq  $0x20,%xmm4
pmuludq %xmm3,%xmm1
paddq  %xmm4,%xmm1
movdqu %xmm0,-0x30(%rbx,%rax,8)
movdqu %xmm1,-0x20(%rbx,%rax,8)
movdqa 0xc34f0(%rsp,%rax,8),%xmm2
movdqa 0xc3500(%rsp,%rax,8),%xmm3
movdqa -0x10(%rsp,%rax,8),%xmm0
movdqa (%rsp,%rax,8),%xmm1
movdqa %xmm0,%xmm4
psrlq  $0x20,%xmm4
pmuludq %xmm2,%xmm4
movdqa %xmm2,%xmm5
psrlq  $0x20,%xmm5
pmuludq %xmm0,%xmm5
paddq  %xmm4,%xmm5
psllq  $0x20,%xmm5
pmuludq %xmm2,%xmm0
paddq  %xmm5,%xmm0
movdqa %xmm1,%xmm2
psrlq  $0x20,%xmm2
pmuludq %xmm3,%xmm2
movdqa %xmm3,%xmm4
psrlq  $0x20,%xmm4
pmuludq %xmm1,%xmm4
paddq  %xmm2,%xmm4
psllq  $0x20,%xmm4
pmuludq %xmm3,%xmm1
paddq  %xmm4,%xmm1
movdqu %xmm0,-0x10(%rbx,%rax,8)
movdqu %xmm1,(%rbx,%rax,8)
add    $0x8,%rax
cmp    $0x186a6,%rax
jne    1130 <vec_mult_ref+0x20>
add    $0x186a00,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @vec_mult_ref(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
%4 = alloca [100000 x i64]
%5 = alloca [100000 x i64]
store i64* %0, i64** %2
%6 = getelementptr inbounds [100000 x i64], [100000 x i64]* %4, i64 0, i64 0
%7 = getelementptr inbounds [100000 x i64], [100000 x i64]* %5, i64 0, i64 0
%8 = call i32 @init(i64* %6, i64* %7)
store i32 0, i32* %3
br label %9
9: ; preds = %26, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 100000
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100000 x i64], [100000 x i64]* %4, i64 0, i64 %14
%16 = load i64, i64* %15
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100000 x i64], [100000 x i64]* %5, i64 0, i64 %18
%20 = load i64, i64* %19
%21 = mul nsw i64 %16, %20
%22 = load i64*, i64** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
store i64 %21, i64* %25
br label %26
26: ; preds = %12
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %9
29: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @vec_mult_ref(i64* nocapture writeonly %0) {
%2 = alloca [100000 x i64]
%3 = alloca [100000 x i64]
%4 = bitcast [100000 x i64]* %2 to i8*
%5 = bitcast [100000 x i64]* %3 to i8*
%6 = getelementptr inbounds [100000 x i64], [100000 x i64]* %2, i64 0, i64 0
%7 = getelementptr inbounds [100000 x i64], [100000 x i64]* %3, i64 0, i64 0
%8 = call i32 @init(i64* %6, i64* %7)
br label %9
9: ; preds = %9, %1
%10 = phi i64 [ 0, %1 ], [ %48, %9 ]
%11 = getelementptr inbounds [100000 x i64], [100000 x i64]* %2, i64 0, i64 %10
%12 = bitcast i64* %11 to <2 x i64>*
%13 = load <2 x i64>, <2 x i64>* %12
%14 = getelementptr inbounds i64, i64* %11, i64 2
%15 = bitcast i64* %14 to <2 x i64>*
%16 = load <2 x i64>, <2 x i64>* %15
%17 = getelementptr inbounds [100000 x i64], [100000 x i64]* %3, i64 0, i64 %10
%18 = bitcast i64* %17 to <2 x i64>*
%19 = load <2 x i64>, <2 x i64>* %18
%20 = getelementptr inbounds i64, i64* %17, i64 2
%21 = bitcast i64* %20 to <2 x i64>*
%22 = load <2 x i64>, <2 x i64>* %21
%23 = mul nsw <2 x i64> %19, %13
%24 = mul nsw <2 x i64> %22, %16
%25 = getelementptr inbounds i64, i64* %0, i64 %10
%26 = bitcast i64* %25 to <2 x i64>*
store <2 x i64> %23, <2 x i64>* %26
%27 = getelementptr inbounds i64, i64* %25, i64 2
%28 = bitcast i64* %27 to <2 x i64>*
store <2 x i64> %24, <2 x i64>* %28
%29 = or i64 %10, 4
%30 = getelementptr inbounds [100000 x i64], [100000 x i64]* %2, i64 0, i64 %29
%31 = bitcast i64* %30 to <2 x i64>*
%32 = load <2 x i64>, <2 x i64>* %31
%33 = getelementptr inbounds i64, i64* %30, i64 2
%34 = bitcast i64* %33 to <2 x i64>*
%35 = load <2 x i64>, <2 x i64>* %34
%36 = getelementptr inbounds [100000 x i64], [100000 x i64]* %3, i64 0, i64 %29
%37 = bitcast i64* %36 to <2 x i64>*
%38 = load <2 x i64>, <2 x i64>* %37
%39 = getelementptr inbounds i64, i64* %36, i64 2
%40 = bitcast i64* %39 to <2 x i64>*
%41 = load <2 x i64>, <2 x i64>* %40
%42 = mul nsw <2 x i64> %38, %32
%43 = mul nsw <2 x i64> %41, %35
%44 = getelementptr inbounds i64, i64* %0, i64 %29
%45 = bitcast i64* %44 to <2 x i64>*
store <2 x i64> %42, <2 x i64>* %45
%46 = getelementptr inbounds i64, i64* %44, i64 2
%47 = bitcast i64* %46 to <2 x i64>*
store <2 x i64> %43, <2 x i64>* %47
%48 = add nuw nsw i64 %10, 8
%49 = icmp eq i64 %48, 100000
br i1 %49, label %50, label %9
50: ; preds = %9
ret void
}