#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 */
double sqrt(double);
void __vsqrt(double *x, double *y, long count, long stridex, long stridey) {
  long i;
  double u;
  double z;
  double result;
  for (i = 0; i < count; i++) {
    u = z = *x;
    result = sqrt(u);
    *y = result;
    x += stridex;
    y += stridey;
  }
}


x86 assembly (clang, -O0):
<__vsqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11a1 <__vsqrt+0x91>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <__vsqrt+0x24>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__vsqrt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %rdx,%rdx
jle    12bb <__vsqrt+0x1ab>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%r12
lea    -0x1(%rdx),%rax
mov    %r13d,%ebp
and    $0x3,%ebp
cmp    $0x3,%rax
jb     127c <__vsqrt+0x16c>
and    $0xfffffffffffffffc,%r13
mov    %r14,%rax
shl    $0x5,%rax
mov    %rax,0x18(%rsp)
mov    %r15,%rax
shl    $0x5,%rax
mov    %rax,0x10(%rsp)
mov    %r14,0x20(%rsp)
lea    0x0(,%r14,8),%r14
mov    %r15,0x28(%rsp)
lea    0x0(,%r15,8),%r15
xorpd  %xmm1,%xmm1
jmp    11b2 <__vsqrt+0xa2>
cs nopw 0x0(%rax,%rax,1)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,(%rbx,%r15,1)
add    %r15,%rbx
add    %r14,%r12
add    %r15,%rbx
add    $0xfffffffffffffffc,%r13
je     125e <__vsqrt+0x14e>
mov    %rbx,0x8(%rsp)
mov    %r12,%rbx
movsd  (%r12),%xmm0
ucomisd %xmm1,%xmm0
jb     11d0 <__vsqrt+0xc0>
sqrtsd %xmm0,%xmm0
jmp    11d9 <__vsqrt+0xc9>
nopl   0x0(%rax)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
lea    (%rbx,%r14,1),%r12
movsd  (%rbx,%r14,1),%xmm0
ucomisd %xmm1,%xmm0
mov    %rbx,0x30(%rsp)
jb     1200 <__vsqrt+0xf0>
sqrtsd %xmm0,%xmm0
jmp    1209 <__vsqrt+0xf9>
nopl   (%rax)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
mov    0x8(%rsp),%rax
lea    (%rax,%r15,1),%rbx
movsd  %xmm0,(%rax,%r15,1)
movsd  (%r12,%r14,1),%xmm0
add    %r14,%r12
ucomisd %xmm1,%xmm0
jb     1230 <__vsqrt+0x120>
sqrtsd %xmm0,%xmm0
jmp    1239 <__vsqrt+0x129>
nopl   (%rax)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,(%rbx,%r15,1)
add    %r15,%rbx
movsd  (%r12,%r14,1),%xmm0
add    %r14,%r12
ucomisd %xmm1,%xmm0
jb     1190 <__vsqrt+0x80>
sqrtsd %xmm0,%xmm0
jmp    1199 <__vsqrt+0x89>
mov    0x30(%rsp),%r12
add    0x18(%rsp),%r12
mov    0x8(%rsp),%rbx
add    0x10(%rsp),%rbx
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%r14
test   %rbp,%rbp
je     12bb <__vsqrt+0x1ab>
shl    $0x3,%r14
shl    $0x3,%r15
xorpd  %xmm1,%xmm1
jmp    12a9 <__vsqrt+0x199>
nop
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,(%rbx)
add    %r14,%r12
add    %r15,%rbx
add    $0xffffffffffffffff,%rbp
je     12bb <__vsqrt+0x1ab>
movsd  (%r12),%xmm0
ucomisd %xmm1,%xmm0
jb     1290 <__vsqrt+0x180>
sqrtsd %xmm0,%xmm0
jmp    1299 <__vsqrt+0x189>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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