#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*/ power_1(double *, double const *, double const *);
void sheng_rho_value(const double r, const double *p, double *f) {
  double power = 0;
  power_1(&power, &r, &p[1]);
  double x = (p[4] * p[4]) / (r * r);
  x = x * x * x;
  if (r > 1.45)
    *f = 4.0 * p[3] * x * (x - 1.0);
  else
    *f = p[0] * power + p[2];
}


x86 assembly (clang, -O0):
<sheng_rho_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
lea    -0x20(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <power_1@plt>
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe78(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ca <sheng_rho_value+0xba>
mov    -0x10(%rbp),%rax
movsd  0xe72(%rip),%xmm0
mulsd  0x18(%rax),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe53(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11f0 <sheng_rho_value+0xe0>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x20(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sheng_rho_value>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rdi),%rdx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <power_1@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xeb3(%rip),%xmm0
jbe    118b <sheng_rho_value+0x7b>
movsd  0x20(%rbx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x18(%rbx),%xmm1
mulsd  0xe8f(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe8b(%rip),%xmm0
mulsd  %xmm1,%xmm0
jmp    119a <sheng_rho_value+0x8a>
movsd  (%rbx),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rbx),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @sheng_rho_value(double %0, double* %1, double* nocapture writeonly %2) {
%4 = alloca double
%5 = alloca double
store double %0, double* %4
%6 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = call i32 @power_1(double* %5, double* %4, double* %7)
%9 = getelementptr inbounds double, double* %1, i64 4
%10 = load double, double* %9
%11 = fmul double %10, %10
%12 = load double, double* %4
%13 = fmul double %12, %12
%14 = fdiv double %11, %13
%15 = fmul double %14, %14
%16 = fmul double %14, %15
%17 = fcmp ogt double %12, 1.450000e+00
br i1 %17, label %18, label %25
18: ; preds = %3
%19 = getelementptr inbounds double, double* %1, i64 3
%20 = load double, double* %19
%21 = fmul double %20, 4.000000e+00
%22 = fmul double %16, %21
%23 = fadd double %16, -1.000000e+00
%24 = fmul double %23, %22
br label %31
25: ; preds = %3
%26 = load double, double* %1
%27 = load double, double* %5
%28 = getelementptr inbounds double, double* %1, i64 2
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %26, double %27, double %29)
br label %31
31: ; preds = %25, %18
%32 = phi double [ %30, %25 ], [ %24, %18 ]
store double %32, double* %2
ret void
}