#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*/ sqrt(int /*<<< orphan*/);
void dmat_ysqrtx(const int n, const double *x, double *y) {
  const double *xi;
  double *yi;
  xi = x + n - 1;
  yi = y + n - 1;
  do {
    *yi-- = sqrt(*xi--);
  } while (xi >= x);
}


x86 assembly (clang, -O0):
<dmat_ysqrtx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x20(%rbp)
cvttsd2si (%rax),%edi
call   1030 <sqrt@plt>
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1151 <dmat_ysqrtx+0x41>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmat_ysqrtx>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
movslq %edi,%rax
lea    (%rsi,%rax,8),%rbx
add    $0xfffffffffffffff8,%rbx
lea    (%rdx,%rax,8),%r15
add    $0xfffffffffffffff8,%r15
nopl   0x0(%rax,%rax,1)
cvttsd2si (%rbx),%edi
add    $0xfffffffffffffff8,%rbx
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r15)
add    $0xfffffffffffffff8,%r15
cmp    %r14,%rbx
jae    1130 <dmat_ysqrtx+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @dmat_ysqrtx(i32 %0, double* %1, double* nocapture writeonly %2) {
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds double, double* %1, i64 %4
%6 = getelementptr inbounds double, double* %5, i64 -1
%7 = getelementptr inbounds double, double* %2, i64 %4
br label %8
8: ; preds = %8, %3
%9 = phi double* [ %6, %3 ], [ %12, %8 ]
%10 = phi double* [ %7, %3 ], [ %11, %8 ]
%11 = getelementptr inbounds double, double* %10, i64 -1
%12 = getelementptr inbounds double, double* %9, i64 -1
%13 = load double, double* %9
%14 = fptosi double %13 to i32
%15 = tail call i32 @sqrt(i32 %14)
%16 = sitofp i32 %15 to double
store double %16, double* %11
%17 = icmp ult double* %12, %1
br i1 %17, label %18, label %8
18: ; preds = %8
ret void
}