void vsqrt_float(float *dst, float *src, int count) {
  for (int i = 0; i < count; ++i)
    dst[i] = __builtin_floorf(src[i]);
}


x86 assembly (clang, -O0):
<vsqrt_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1163 <vsqrt_float+0x53>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <floorf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <vsqrt_float+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsqrt_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %edx,%edx
jle    1361 <vsqrt_float+0x251>
mov    %rsi,%r14
mov    %rdi,%r12
mov    %edx,%r15d
cmp    $0x4,%edx
jb     114e <vsqrt_float+0x3e>
lea    (%r14,%r15,4),%rax
cmp    %r12,%rax
jbe    11f8 <vsqrt_float+0xe8>
lea    (%r12,%r15,4),%rax
cmp    %r14,%rax
jbe    11f8 <vsqrt_float+0xe8>
xor    %ebx,%ebx
mov    %rbx,%r13
not    %r13
add    %r15,%r13
mov    %r15,%rbp
and    $0x3,%rbp
je     118b <vsqrt_float+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%r14,%rbx,4),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
add    $0xffffffffffffffff,%rbp
jne    1170 <vsqrt_float+0x60>
cmp    $0x3,%r13
jb     1361 <vsqrt_float+0x251>
cs nopw 0x0(%rax,%rax,1)
nop
movss  (%r14,%rbx,4),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,(%r12,%rbx,4)
movss  0x4(%r14,%rbx,4),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,0x4(%r12,%rbx,4)
movss  0x8(%r14,%rbx,4),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,0x8(%r12,%rbx,4)
movss  0xc(%r14,%rbx,4),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,0xc(%r12,%rbx,4)
add    $0x4,%rbx
cmp    %rbx,%r15
jne    11a0 <vsqrt_float+0x90>
jmp    1361 <vsqrt_float+0x251>
mov    %r15d,%ebx
and    $0xfffffffc,%ebx
lea    -0x4(%rbx),%rax
mov    %rax,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rax,%rax
mov    %rbp,0x30(%rsp)
je     1370 <vsqrt_float+0x260>
and    $0xfffffffffffffffe,%rbp
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups (%r14,%r13,4),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <floorf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <floorf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,(%r12,%r13,4)
movups 0x10(%r14,%r13,4),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <floorf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <floorf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,0x10(%r12,%r13,4)
add    $0x8,%r13
add    $0xfffffffffffffffe,%rbp
jne    1230 <vsqrt_float+0x120>
testb  $0x1,0x30(%rsp)
je     1358 <vsqrt_float+0x248>
movups (%r14,%r13,4),%xmm0
movaps %xmm0,0x10(%rsp)
shufps $0xff,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <floorf@plt>
unpcklps (%rsp),%xmm0
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <floorf@plt>
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
call   1030 <floorf@plt>
movaps 0x20(%rsp),%xmm1
unpcklps %xmm0,%xmm1
unpcklpd (%rsp),%xmm1
movups %xmm1,(%r12,%r13,4)
cmp    %r15,%rbx
jne    1150 <vsqrt_float+0x40>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
testb  $0x1,0x30(%rsp)
jne    12fd <vsqrt_float+0x1ed>
jmp    1358 <vsqrt_float+0x248>

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

LLVM IR (-O2):
define void @vsqrt_float(float* nocapture writeonly %0, float* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %73
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = icmp ult i32 %2, 4
br i1 %7, label %54, label %8
8: ; preds = %5
%9 = getelementptr float, float* %0, i64 %6
%10 = getelementptr float, float* %1, i64 %6
%11 = icmp ugt float* %10, %0
%12 = icmp ugt float* %9, %1
%13 = and i1 %11, %12
br i1 %13, label %54, label %14
14: ; preds = %8
%15 = and i64 %6, 4294967292
%16 = add nsw i64 %15, -4
%17 = lshr exact i64 %16, 2
%18 = add nuw nsw i64 %17, 1
%19 = and i64 %18, 1
%20 = icmp eq i64 %16, 0
br i1 %20, label %42, label %21
21: ; preds = %14
%22 = and i64 %18, 9223372036854775806
br label %23
23: ; preds = %23, %21
%24 = phi i64 [ 0, %21 ], [ %39, %23 ]
%25 = phi i64 [ 0, %21 ], [ %40, %23 ]
%26 = getelementptr inbounds float, float* %1, i64 %24
%27 = bitcast float* %26 to <4 x float>*
%28 = load <4 x float>, <4 x float>* %27
%29 = call <4 x float> @llvm.floor.v4f32(<4 x float> %28)
%30 = getelementptr inbounds float, float* %0, i64 %24
%31 = bitcast float* %30 to <4 x float>*
store <4 x float> %29, <4 x float>* %31
%32 = or i64 %24, 4
%33 = getelementptr inbounds float, float* %1, i64 %32
%34 = bitcast float* %33 to <4 x float>*
%35 = load <4 x float>, <4 x float>* %34
%36 = call <4 x float> @llvm.floor.v4f32(<4 x float> %35)
%37 = getelementptr inbounds float, float* %0, i64 %32
%38 = bitcast float* %37 to <4 x float>*
store <4 x float> %36, <4 x float>* %38
%39 = add nuw i64 %24, 8
%40 = add i64 %25, 2
%41 = icmp eq i64 %40, %22
br i1 %41, label %42, label %23
42: ; preds = %23, %14
%43 = phi i64 [ 0, %14 ], [ %39, %23 ]
%44 = icmp eq i64 %19, 0
br i1 %44, label %52, label %45
45: ; preds = %42
%46 = getelementptr inbounds float, float* %1, i64 %43
%47 = bitcast float* %46 to <4 x float>*
%48 = load <4 x float>, <4 x float>* %47
%49 = call <4 x float> @llvm.floor.v4f32(<4 x float> %48)
%50 = getelementptr inbounds float, float* %0, i64 %43
%51 = bitcast float* %50 to <4 x float>*
store <4 x float> %49, <4 x float>* %51
br label %52
52: ; preds = %42, %45
%53 = icmp eq i64 %15, %6
br i1 %53, label %73, label %54
54: ; preds = %8, %5, %52
%55 = phi i64 [ 0, %8 ], [ 0, %5 ], [ %15, %52 ]
%56 = xor i64 %55, -1
%57 = add nsw i64 %56, %6
%58 = and i64 %6, 3
%59 = icmp eq i64 %58, 0
br i1 %59, label %70, label %60
60: ; preds = %54, %60
%61 = phi i64 [ %67, %60 ], [ %55, %54 ]
%62 = phi i64 [ %68, %60 ], [ 0, %54 ]
%63 = getelementptr inbounds float, float* %1, i64 %61
%64 = load float, float* %63
%65 = tail call float @llvm.floor.f32(float %64)
%66 = getelementptr inbounds float, float* %0, i64 %61
store float %65, float* %66
%67 = add nuw nsw i64 %61, 1
%68 = add i64 %62, 1
%69 = icmp eq i64 %68, %58
br i1 %69, label %70, label %60
70: ; preds = %60, %54
%71 = phi i64 [ %55, %54 ], [ %67, %60 ]
%72 = icmp ult i64 %57, 3
br i1 %72, label %73, label %74
73: ; preds = %70, %74, %52, %3
ret void
74: ; preds = %70, %74
%75 = phi i64 [ %95, %74 ], [ %71, %70 ]
%76 = getelementptr inbounds float, float* %1, i64 %75
%77 = load float, float* %76
%78 = tail call float @llvm.floor.f32(float %77)
%79 = getelementptr inbounds float, float* %0, i64 %75
store float %78, float* %79
%80 = add nuw nsw i64 %75, 1
%81 = getelementptr inbounds float, float* %1, i64 %80
%82 = load float, float* %81
%83 = tail call float @llvm.floor.f32(float %82)
%84 = getelementptr inbounds float, float* %0, i64 %80
store float %83, float* %84
%85 = add nuw nsw i64 %75, 2
%86 = getelementptr inbounds float, float* %1, i64 %85
%87 = load float, float* %86
%88 = tail call float @llvm.floor.f32(float %87)
%89 = getelementptr inbounds float, float* %0, i64 %85
store float %88, float* %89
%90 = add nuw nsw i64 %75, 3
%91 = getelementptr inbounds float, float* %1, i64 %90
%92 = load float, float* %91
%93 = tail call float @llvm.floor.f32(float %92)
%94 = getelementptr inbounds float, float* %0, i64 %90
store float %93, float* %94
%95 = add nuw nsw i64 %75, 4
%96 = icmp eq i64 %95, %6
br i1 %96, label %73, label %74
}