#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 */
float sqrt(float);
void vmul(float *a, float *b, float *c, int N) {
#pragma omp target map(to : a [0:N], b [0:N]) map(from : c [0:N])
#pragma omp teams distribute parallel for
  for (int i = 0; i < N; i++) {
    c[i] = sqrt(a[i]) * sqrt(b[i]);
  }
}


x86 assembly (clang, -O0):
<vmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118a <vmul+0x7a>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112e <vmul+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmul>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    126b <vmul+0x15b>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%r13d
cmp    $0x1,%ecx
jne    115e <vmul+0x4e>
xor    %ebx,%ebx
test   $0x1,%r13b
je     126b <vmul+0x15b>
movss  (%r12,%rbx,4),%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     1234 <vmul+0x124>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    123f <vmul+0x12f>
mov    %r13d,%ebp
and    $0xfffffffe,%ebp
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
jmp    1198 <vmul+0x88>
nopl   0x0(%rax,%rax,1)
movss  %xmm2,0x4(%rsp)
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm2
xorps  %xmm1,%xmm1
mulss  %xmm0,%xmm2
movss  %xmm2,0x4(%r14,%rbx,4)
add    $0x2,%rbx
cmp    %rbx,%rbp
je     1136 <vmul+0x26>
movss  (%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11b0 <vmul+0xa0>
xorps  %xmm2,%xmm2
sqrtss %xmm0,%xmm2
jmp    11bb <vmul+0xab>
nopl   0x0(%rax)
call   1030 <sqrt@plt>
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
movss  (%r15,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11d0 <vmul+0xc0>
sqrtss %xmm0,%xmm0
jmp    11e4 <vmul+0xd4>
nopl   0x0(%rax)
movss  %xmm2,0x4(%rsp)
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm2
xorps  %xmm1,%xmm1
mulss  %xmm0,%xmm2
movss  %xmm2,(%r14,%rbx,4)
movss  0x4(%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1210 <vmul+0x100>
xorps  %xmm2,%xmm2
sqrtss %xmm0,%xmm2
jmp    121b <vmul+0x10b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <sqrt@plt>
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
movss  0x4(%r15,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1170 <vmul+0x60>
sqrtss %xmm0,%xmm0
jmp    1184 <vmul+0x74>
call   1030 <sqrt@plt>
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
movss  (%r15,%rbx,4),%xmm0
ucomiss %xmm2,%xmm0
jb     1250 <vmul+0x140>
sqrtss %xmm0,%xmm0
jmp    1261 <vmul+0x151>
movss  %xmm1,0x4(%rsp)
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vmul(float* %0, float* %1, float* %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %32, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %8
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load float*, float** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* %15, i64 %17
%19 = load float, float* %18
%20 = call float @sqrt(float %19)
%21 = load float*, float** %6
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = load float, float* %24
%26 = call float @sqrt(float %25)
%27 = fmul float %20, %26
%28 = load float*, float** %7
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %28, i64 %30
store float %27, float* %31
br label %32
32: ; preds = %14
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %10
35: ; preds = %10
ret void
}

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