#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 pow(double, double);
void asyfunc(double *x, double *xasy, int nx, double beta) {
  int i;
  for (i = 0; i < nx; i++) {
    if (x[i] > 0)
      xasy[i] = pow(x[i], 1.0 + beta * i / (nx - 1) * pow(x[i], 0.5));
  }
}


x86 assembly (clang, -O0):
<asyfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e4 <asyfunc+0xd4>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d1 <asyfunc+0xc1>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe6b(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm1
movsd  0xe45(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11d6 <asyfunc+0xc6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <asyfunc+0x1f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asyfunc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
test   %edx,%edx
jle    11ba <asyfunc+0xaa>
mov    %rsi,%r14
mov    %rdi,%r15
lea    -0x1(%rdx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r12d
xor    %ebx,%ebx
xorpd  %xmm1,%xmm1
jmp    1159 <asyfunc+0x49>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     11ba <asyfunc+0xaa>
movsd  (%r15,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1150 <asyfunc+0x40>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  0xe74(%rip),%xmm1
call   1030 <pow@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe65(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,(%r14,%rbx,8)
xorpd  %xmm1,%xmm1
jmp    1150 <asyfunc+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @asyfunc(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
store i32 0, i32* %9
br label %10
10: ; preds = %48, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %51
14: ; preds = %10
%15 = load double*, double** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = fcmp ogt double %19, 0.000000e+00
br i1 %20, label %21, label %47
21: ; preds = %14
%22 = load double*, double** %5
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double, double* %8
%28 = load i32, i32* %9
%29 = sitofp i32 %28 to double
%30 = fmul double %27, %29
%31 = load i32, i32* %7
%32 = sub nsw i32 %31, 1
%33 = sitofp i32 %32 to double
%34 = fdiv double %30, %33
%35 = load double*, double** %5
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = call double @pow(double %39, double 5.000000e-01)
%41 = call double @llvm.fmuladd.f64(double %34, double %40, double 1.000000e+00)
%42 = call double @pow(double %26, double %41)
%43 = load double*, double** %6
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
br label %47
47: ; preds = %21, %14
br label %48
48: ; preds = %47
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %10
51: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @asyfunc(double* nocapture %0, double* nocapture writeonly %1, i32 %2, double %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %27
6: ; preds = %4
%7 = add nsw i32 %2, -1
%8 = sitofp i32 %7 to double
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %6, %24
%11 = phi i64 [ 0, %6 ], [ %25, %24 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %24
15: ; preds = %10
%16 = trunc i64 %11 to i32
%17 = sitofp i32 %16 to double
%18 = fmul double %17, %3
%19 = fdiv double %18, %8
%20 = tail call double @pow(double %13, double 5.000000e-01)
%21 = tail call double @llvm.fmuladd.f64(double %19, double %20, double 1.000000e+00)
%22 = tail call double @pow(double %13, double %21)
%23 = getelementptr inbounds double, double* %1, i64 %11
store double %22, double* %23
br label %24
24: ; preds = %10, %15
%25 = add nuw nsw i64 %11, 1
%26 = icmp eq i64 %25, %9
br i1 %26, label %27, label %10
27: ; preds = %24, %4
ret void
}