#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(int *, int *);
void vec_mult(int *p) {
  int i;
  int v1[100000], v2[100000];
  init(v1, v2);
#pragma omp target map(p [0:N])
#pragma omp parallel for
  for (i = 0; i < 100000; i++)
    p[i] = v1[i] * v2[i];
}


x86 assembly (clang, -O0):
<vec_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3510,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x61a90(%rbp),%rdi
lea    -0xc3510(%rbp),%rsi
call   1030 <init@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    1176 <vec_mult+0x66>
movslq -0xc(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%edx
movslq -0xc(%rbp),%rax
imul   -0xc3510(%rbp,%rax,4),%edx
ff
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <vec_mult+0x29>
add    $0xc3510,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_mult>:
push   %rbx
sub    $0xc3500,%rsp
mov    %rdi,%rbx
lea    0x61a80(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <init@plt>
mov    $0xc,%eax
movdqa 0x61a50(%rsp,%rax,4),%xmm0
movdqa 0x61a60(%rsp,%rax,4),%xmm1
movdqa -0x30(%rsp,%rax,4),%xmm2
movdqa -0x20(%rsp,%rax,4),%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pshufd $0xf5,%xmm0,%xmm0
pmuludq %xmm4,%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm2
pshufd $0xf5,%xmm3,%xmm0
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pshufd $0xf5,%xmm1,%xmm1
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm0
punpckldq %xmm0,%xmm3
movdqu %xmm2,-0x30(%rbx,%rax,4)
movdqu %xmm3,-0x20(%rbx,%rax,4)
movdqa 0x61a70(%rsp,%rax,4),%xmm0
movdqa 0x61a80(%rsp,%rax,4),%xmm1
movdqa -0x10(%rsp,%rax,4),%xmm2
movdqa (%rsp,%rax,4),%xmm3
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pshufd $0xf5,%xmm0,%xmm0
pmuludq %xmm4,%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm2
pshufd $0xf5,%xmm3,%xmm0
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pshufd $0xf5,%xmm1,%xmm1
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm0
punpckldq %xmm0,%xmm3
movdqu %xmm2,-0x10(%rbx,%rax,4)
movdqu %xmm3,(%rbx,%rax,4)
add    $0x10,%rax
cmp    $0x186ac,%rax
jne    1130 <vec_mult+0x20>
add    $0xc3500,%rsp
pop    %rbx
ret

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