void get_scaling_basis_PYR(const unsigned int i, const unsigned int j,
                           const unsigned int k, const double c, double *con_i,
                           double *con_j, double *con_k, double *con_c) {
  double mu_ij = ({
    __typeof__(i) _a = (i);
    __typeof__(j) _b = (j);
    _a > _b ? _a : _b;
  });
  *con_i = sqrt((2.0 * i + 1.0) / 2.0);
  *con_j = sqrt((2.0 * j + 1.0) / 2.0);
  *con_k = sqrt((2.0 * (mu_ij + k) + 3.0) / pow(2.0, 2.0 * mu_ij + 3.0));
  *con_c = pow(1.0 - c, (double)mu_ij);
}


x86 assembly (clang, -O0):
<get_scaling_basis_PYR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jbe    1169 <get_scaling_basis_PYR+0x49>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    116f <get_scaling_basis_PYR+0x4f>
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm0
movsd  0xe6a(%rip),%xmm1
movsd  %xmm1,-0x60(%rbp)
addsd  %xmm1,%xmm0
movsd  0xe61(%rip),%xmm1
movsd  %xmm1,-0x58(%rbp)
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
movsd  0xe0b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xdf1(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xddd(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xdaf(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <pow@plt>
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_scaling_basis_PYR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
cmp    %esi,%edi
mov    %esi,%ebp
cmova  %edi,%ebp
mov    %edi,%eax
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm1
addsd  0xea6(%rip),%xmm1
mulsd  0xea6(%rip),%xmm1
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r13
movsd  %xmm0,0x10(%rsp)
mov    %edx,%r12d
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jb     1187 <get_scaling_basis_PYR+0x57>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1194 <get_scaling_basis_PYR+0x64>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
xorpd  %xmm2,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %rbp,%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  %xmm0,0x0(%r13)
addsd  %xmm1,%xmm1
addsd  0xe43(%rip),%xmm1
mulsd  0xe43(%rip),%xmm1
ucomisd %xmm2,%xmm1
jb     11d4 <get_scaling_basis_PYR+0xa4>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11dd <get_scaling_basis_PYR+0xad>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    0x50(%rsp),%rbx
movsd  %xmm0,(%r15)
mov    %r12d,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm2
movsd  0xe09(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp2@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     123c <get_scaling_basis_PYR+0x10c>
sqrtsd %xmm0,%xmm0
jmp    1241 <get_scaling_basis_PYR+0x111>
call   1050 <sqrt@plt>
movsd  %xmm0,(%r14)
movsd  0xdb2(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_scaling_basis_PYR(i32 %0, i32 %1, i32 %2, double %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store double %3, double* %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
%21 = load i32, i32* %9
store i32 %21, i32* %18
%22 = load i32, i32* %10
store i32 %22, i32* %19
%23 = load i32, i32* %18
%24 = load i32, i32* %19
%25 = icmp ugt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %8
%27 = load i32, i32* %18
br label %30
28: ; preds = %8
%29 = load i32, i32* %19
br label %30
30: ; preds = %28, %26
%31 = phi i32 [ %27, %26 ], [ %29, %28 ]
store i32 %31, i32* %20
%32 = load i32, i32* %20
%33 = uitofp i32 %32 to double
store double %33, double* %17
%34 = load i32, i32* %9
%35 = uitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %35, double 1.000000e+00)
%37 = fdiv double %36, 2.000000e+00
%38 = call double @sqrt(double %37)
%39 = load double*, double** %13
store double %38, double* %39
%40 = load i32, i32* %10
%41 = uitofp i32 %40 to double
%42 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %41, double 1.000000e+00)
%43 = fdiv double %42, 2.000000e+00
%44 = call double @sqrt(double %43)
%45 = load double*, double** %14
store double %44, double* %45
%46 = load double, double* %17
%47 = load i32, i32* %11
%48 = uitofp i32 %47 to double
%49 = fadd double %46, %48
%50 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %49, double 3.000000e+00)
%51 = load double, double* %17
%52 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %51, double 3.000000e+00)
%53 = call double @pow(double 2.000000e+00, double %52)
%54 = fdiv double %50, %53
%55 = call double @sqrt(double %54)
%56 = load double*, double** %15
store double %55, double* %56
%57 = load double, double* %12
%58 = fsub double 1.000000e+00, %57
%59 = load double, double* %17
%60 = call double @pow(double %58, double %59)
%61 = load double*, double** %16
store double %60, double* %61
ret void
}

LLVM IR (-O2):
define void @get_scaling_basis_PYR(i32 %0, i32 %1, i32 %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = icmp ugt i32 %0, %1
%10 = select i1 %9, i32 %0, i32 %1
%11 = uitofp i32 %10 to double
%12 = uitofp i32 %0 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double 1.000000e+00)
%14 = fmul double %13, 5.000000e-01
%15 = tail call double @sqrt(double %14)
store double %15, double* %4
%16 = uitofp i32 %1 to double
%17 = tail call double @llvm.fmuladd.f64(double %16, double 2.000000e+00, double 1.000000e+00)
%18 = fmul double %17, 5.000000e-01
%19 = tail call double @sqrt(double %18)
store double %19, double* %5
%20 = uitofp i32 %2 to double
%21 = fadd double %20, %11
%22 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double 3.000000e+00)
%23 = tail call double @llvm.fmuladd.f64(double %11, double 2.000000e+00, double 3.000000e+00)
%24 = tail call double @exp2(double %23)
%25 = fdiv double %22, %24
%26 = tail call double @sqrt(double %25)
store double %26, double* %6
%27 = fsub double 1.000000e+00, %3
%28 = tail call double @pow(double %27, double %11)
store double %28, double* %7
ret void
}