#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 hatfldb(double *p, double *x, int m, int n, void *data) {
  register int i;
  x[0] = p[0] - 1.0;
  for (i = 1; i < m; ++i)
    x[i] = p[i - 1] - sqrt(p[i]);
}


x86 assembly (clang, -O0):
<hatfldb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xec6(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a9 <hatfldb+0x99>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <hatfldb+0x3d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hatfldb>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  (%rdi),%xmm0
addsd  0xed7(%rip),%xmm0
movsd  %xmm0,(%rsi)
cmp    $0x2,%edx
jl     1237 <hatfldb+0x127>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
add    $0xffffffffffffffff,%r12
mov    $0x1,%ebx
cmp    $0x2,%edx
jne    117b <hatfldb+0x6b>
test   $0x1,%r12b
je     1237 <hatfldb+0x127>
movsd  -0x8(%r15,%rbx,8),%xmm2
movsd  (%r15,%rbx,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     121c <hatfldb+0x10c>
sqrtsd %xmm0,%xmm0
jmp    122d <hatfldb+0x11d>
mov    %r12,%r13
and    $0xfffffffffffffffe,%r13
neg    %r13
mov    $0x1,%ebx
xorpd  %xmm1,%xmm1
jmp    11c2 <hatfldb+0xb2>
movsd  %xmm2,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r14,%rbx,8)
lea    (%rbx,%r13,1),%rax
add    $0x2,%rax
add    $0x2,%rbx
cmp    $0x1,%rax
je     114d <hatfldb+0x3d>
movsd  -0x8(%r15,%rbx,8),%xmm2
movsd  (%r15,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     11e0 <hatfldb+0xd0>
sqrtsd %xmm0,%xmm0
jmp    11f5 <hatfldb+0xe5>
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm2
movsd  %xmm2,(%r14,%rbx,8)
movsd  (%r15,%rbx,8),%xmm2
movsd  0x8(%r15,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     1190 <hatfldb+0x80>
sqrtsd %xmm0,%xmm0
jmp    11a5 <hatfldb+0x95>
movsd  %xmm2,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,(%r14,%rbx,8)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @hatfldb(double* %0, double* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = fsub double %14, 1.000000e+00
%16 = load double*, double** %7
%17 = getelementptr inbounds double, double* %16, i64 0
store double %15, double* %17
store i32 1, i32* %11
br label %18
18: ; preds = %40, %5
%19 = load i32, i32* %11
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load double*, double** %6
%24 = load i32, i32* %11
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %6
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = call double @sqrt(double %33)
%35 = fsub double %28, %34
%36 = load double*, double** %7
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double %35, double* %39
br label %40
40: ; preds = %22
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
br label %18
43: ; preds = %18
ret void
}

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