#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 */
unsigned int const pow(double, double);
double sqrt(unsigned int const);
void get_scaling_basis_TRI(const unsigned int i, const unsigned int j,
                           const double b, double *con_i, double *con_j,
                           double *con_b) {
  *con_i = sqrt((2.0 * i + 1.0) / 2.0);
  *con_j = sqrt((i + j + 1.0) / pow(2.0, 2.0 * i + 1.0));
  *con_b = pow(1.0 - b, (double)i);
}


x86 assembly (clang, -O0):
<get_scaling_basis_TRI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm0
movsd  0xead(%rip),%xmm1
movsd  %xmm1,-0x30(%rbp)
addsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
movsd  %xmm1,-0x40(%rbp)
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
call   1040 <sqrt@plt>
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm1,(%rax)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%edx
add    %edx,%ecx
cvtsi2sd %rcx,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x38(%rbp)
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
movsd  -0x38(%rbp),%xmm0
mov    %eax,%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm1,(%rax)
movsd  -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm1
call   1030 <pow@plt>
mov    %eax,%eax
cvtsi2sd %rax,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_scaling_basis_TRI>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebp
mov    %edi,%eax
cvtsi2sd %rax,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
movsd  %xmm0,0x10(%rsp)
mov    %esi,%ebx
addsd  %xmm1,%xmm1
addsd  0xea8(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xea2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <sqrt@plt>
movsd  %xmm0,(%r12)
add    %ebp,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
addsd  0xe74(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe77(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
mov    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1040 <sqrt@plt>
movsd  %xmm0,(%r15)
movsd  0xe32(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <pow@plt>
mov    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_scaling_basis_TRI(i32 %0, i32 %1, double %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
store i32 %0, i32* %7
store i32 %1, i32* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%13 = load i32, i32* %7
%14 = uitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %14, double 1.000000e+00)
%16 = fdiv double %15, 2.000000e+00
%17 = fptoui double %16 to i32
%18 = call double @sqrt(i32 %17)
%19 = load double*, double** %10
store double %18, double* %19
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = add i32 %20, %21
%23 = uitofp i32 %22 to double
%24 = fadd double %23, 1.000000e+00
%25 = load i32, i32* %7
%26 = uitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %26, double 1.000000e+00)
%28 = call i32 @pow(double 2.000000e+00, double %27)
%29 = uitofp i32 %28 to double
%30 = fdiv double %24, %29
%31 = fptoui double %30 to i32
%32 = call double @sqrt(i32 %31)
%33 = load double*, double** %11
store double %32, double* %33
%34 = load double, double* %9
%35 = fsub double 1.000000e+00, %34
%36 = load i32, i32* %7
%37 = uitofp i32 %36 to double
%38 = call i32 @pow(double %35, double %37)
%39 = uitofp i32 %38 to double
%40 = load double*, double** %12
store double %39, double* %40
ret void
}

LLVM IR (-O2):
define void @get_scaling_basis_TRI(i32 %0, i32 %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = uitofp i32 %0 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double 1.000000e+00)
%9 = fmul double %8, 5.000000e-01
%10 = fptoui double %9 to i32
%11 = tail call double @sqrt(i32 %10)
store double %11, double* %3
%12 = add i32 %1, %0
%13 = uitofp i32 %12 to double
%14 = fadd double %13, 1.000000e+00
%15 = tail call i32 @pow(double 2.000000e+00, double %8)
%16 = uitofp i32 %15 to double
%17 = fdiv double %14, %16
%18 = fptoui double %17 to i32
%19 = tail call double @sqrt(i32 %18)
store double %19, double* %4
%20 = fsub double 1.000000e+00, %2
%21 = tail call i32 @pow(double %20, double %7)
%22 = uitofp i32 %21 to double
store double %22, double* %5
ret void
}