#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 sqrtf(float);
void densearray_sqrt_f32(float *dst, size_t dim) {
#pragma omp parallel for
  for (size_t idx = 0; idx < dim; idx++) {
    float y = dst[idx];
    dst[idx] = sqrtf(y);
  }
}


x86 assembly (clang, -O0):
<densearray_sqrt_f32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1170 <densearray_sqrt_f32+0x60>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sqrtf@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <densearray_sqrt_f32+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<densearray_sqrt_f32>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1178 <densearray_sqrt_f32+0x68>
mov    %rsi,%r14
mov    %rdi,%r12
lea    -0x1(%rsi),%rax
mov    %r14d,%r15d
and    $0x3,%r15d
cmp    $0x3,%rax
jae    1184 <densearray_sqrt_f32+0x74>
xor    %ebx,%ebx
test   %r15,%r15
je     1178 <densearray_sqrt_f32+0x68>
lea    (%r12,%rbx,4),%r14
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
jmp    1167 <densearray_sqrt_f32+0x57>
cs nopw 0x0(%rax,%rax,1)
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1178 <densearray_sqrt_f32+0x68>
movss  (%r14,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1150 <densearray_sqrt_f32+0x40>
sqrtss %xmm0,%xmm0
jmp    1158 <densearray_sqrt_f32+0x48>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
and    $0xfffffffffffffffc,%r14
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
jmp    11a8 <densearray_sqrt_f32+0x98>
nop
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0xc(%r12,%rbx,4)
add    $0x4,%rbx
cmp    %rbx,%r14
je     1136 <densearray_sqrt_f32+0x26>
movss  (%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11c0 <densearray_sqrt_f32+0xb0>
sqrtss %xmm0,%xmm0
jmp    11c8 <densearray_sqrt_f32+0xb8>
nopl   0x0(%rax)
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,(%r12,%rbx,4)
movss  0x4(%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11e0 <densearray_sqrt_f32+0xd0>
sqrtss %xmm0,%xmm0
jmp    11e8 <densearray_sqrt_f32+0xd8>
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0x4(%r12,%rbx,4)
movss  0x8(%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1210 <densearray_sqrt_f32+0x100>
sqrtss %xmm0,%xmm0
jmp    1218 <densearray_sqrt_f32+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0x8(%r12,%rbx,4)
movss  0xc(%r12,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1190 <densearray_sqrt_f32+0x80>
sqrtss %xmm0,%xmm0
jmp    1198 <densearray_sqrt_f32+0x88>

LLVM IR (-O0):
define void @densearray_sqrt_f32(float* %0, i64 %1) {
%3 = alloca float*
%4 = alloca i64
%5 = alloca i64
%6 = alloca float
store float* %0, float** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %7
7: ; preds = %21, %2
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load float*, float** %3
%13 = load i64, i64* %5
%14 = getelementptr inbounds float, float* %12, i64 %13
%15 = load float, float* %14
store float %15, float* %6
%16 = load float, float* %6
%17 = call float @sqrtf(float %16)
%18 = load float*, float** %3
%19 = load i64, i64* %5
%20 = getelementptr inbounds float, float* %18, i64 %19
store float %17, float* %20
br label %21
21: ; preds = %11
%22 = load i64, i64* %5
%23 = add i64 %22, 1
store i64 %23, i64* %5
br label %7
24: ; preds = %7
ret void
}

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