#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*/ assert(float const *);
float sqrtf(float const);
void vectorf_sqrt(const float *self, size_t size, float *output) {
  assert(self);
  assert(output);
  for (size_t i = 0; i < size; i++)
    output[i] = sqrtf(self[i]);
}


x86 assembly (clang, -O0):
<vectorf_sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118c <vectorf_sqrt+0x6c>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <sqrtf@plt>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114e <vectorf_sqrt+0x2e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectorf_sqrt>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
test   %r15,%r15
je     11a8 <vectorf_sqrt+0x88>
lea    -0x1(%r15),%rax
mov    %r15d,%r12d
and    $0x3,%r12d
cmp    $0x3,%rax
jae    11b2 <vectorf_sqrt+0x92>
xor    %ebx,%ebx
test   %r12,%r12
je     11a8 <vectorf_sqrt+0x88>
lea    (%r14,%rbx,4),%r14
lea    0x0(,%rbx,4),%r15
add    %r13,%r15
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
jmp    1197 <vectorf_sqrt+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
je     11a8 <vectorf_sqrt+0x88>
movss  (%r15,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1180 <vectorf_sqrt+0x60>
sqrtss %xmm0,%xmm0
jmp    1188 <vectorf_sqrt+0x68>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
and    $0xfffffffffffffffc,%r15
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
jmp    11dc <vectorf_sqrt+0xbc>
nopl   (%rax)
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0xc(%r14,%rbx,4)
add    $0x4,%rbx
cmp    %rbx,%r15
je     1157 <vectorf_sqrt+0x37>
movss  0x0(%r13,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11f0 <vectorf_sqrt+0xd0>
sqrtss %xmm0,%xmm0
jmp    11f8 <vectorf_sqrt+0xd8>
xchg   %ax,%ax
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,(%r14,%rbx,4)
movss  0x4(%r13,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1210 <vectorf_sqrt+0xf0>
sqrtss %xmm0,%xmm0
jmp    1218 <vectorf_sqrt+0xf8>
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0x4(%r14,%rbx,4)
movss  0x8(%r13,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     1240 <vectorf_sqrt+0x120>
sqrtss %xmm0,%xmm0
jmp    1248 <vectorf_sqrt+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  %xmm0,0x8(%r14,%rbx,4)
movss  0xc(%r13,%rbx,4),%xmm0
ucomiss %xmm1,%xmm0
jb     11c0 <vectorf_sqrt+0xa0>
sqrtss %xmm0,%xmm0
jmp    11c8 <vectorf_sqrt+0xa8>

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

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