#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 CG(int, int, int, int, int, int);
double sqrt(double);
double ERI_Gaunt(int l, int m, int l1, int m1, int l2, int m2) {
  double tmp0, tmp1, tmp2, tmp3;
  double result, cg1, cg2;
  cg1 = CG(l1, 0, l2, 0, l, 0);
  cg2 = CG(l1, m1, l2, m2, l, m);
  return cg1 * cg2 *
         sqrt((double)((2 * l1 + 1) * (2 * l2 + 1)) / (double)(8 * l + 4) /
              3.1415926535897932384626);
}


x86 assembly (clang, -O0):
<ERI_Gaunt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    -0x4(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%esi
mov    %r9d,%ecx
call   1030 <CG@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x4(%rbp),%r8d
mov    -0x8(%rbp),%r9d
call   1030 <CG@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
add    $0x4,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERI_Gaunt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%ebx
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%r13d
mov    %edi,%r14d
mov    %edx,%edi
xor    %esi,%esi
mov    %r8d,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
xor    %r9d,%r9d
call   1030 <CG@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
mov    %r13d,%r9d
call   1030 <CG@plt>
lea    0x1(%rbp,%rbp,1),%eax
lea    (%rbx,%rbx,1),%ecx
add    $0x1,%ecx
imul   %eax,%ecx
cvtsi2sd %ecx,%xmm1
lea    0x4(,%r14,8),%eax
cvtsi2sd %eax,%xmm2
movapd %xmm0,%xmm3
divsd  %xmm2,%xmm1
divsd  0xe69(%rip),%xmm1
mulsd  (%rsp),%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     11af <ERI_Gaunt+0x8f>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11c2 <ERI_Gaunt+0xa2>
movapd %xmm1,%xmm0
movsd  %xmm3,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @ERI_Gaunt(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%20 = load i32, i32* %9
%21 = load i32, i32* %11
%22 = load i32, i32* %7
%23 = call double @CG(i32 %20, i32 0, i32 %21, i32 0, i32 %22, i32 0)
store double %23, double* %18
%24 = load i32, i32* %9
%25 = load i32, i32* %10
%26 = load i32, i32* %11
%27 = load i32, i32* %12
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = call double @CG(i32 %24, i32 %25, i32 %26, i32 %27, i32 %28, i32 %29)
store double %30, double* %19
%31 = load double, double* %18
%32 = load double, double* %19
%33 = fmul double %31, %32
%34 = load i32, i32* %9
%35 = mul nsw i32 2, %34
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %11
%38 = mul nsw i32 2, %37
%39 = add nsw i32 %38, 1
%40 = mul nsw i32 %36, %39
%41 = sitofp i32 %40 to double
%42 = load i32, i32* %7
%43 = mul nsw i32 8, %42
%44 = add nsw i32 %43, 4
%45 = sitofp i32 %44 to double
%46 = fdiv double %41, %45
%47 = fdiv double %46, 0x400921FB54442D18
%48 = call double @sqrt(double %47)
%49 = fmul double %33, %48
ret double %49
}

LLVM IR (-O2):
define double @ERI_Gaunt(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call double @CG(i32 %2, i32 0, i32 %4, i32 0, i32 %0, i32 0)
%8 = tail call double @CG(i32 %2, i32 %3, i32 %4, i32 %5, i32 %0, i32 %1)
%9 = fmul double %7, %8
%10 = shl nsw i32 %2, 1
%11 = or i32 %10, 1
%12 = shl nsw i32 %4, 1
%13 = or i32 %12, 1
%14 = mul nsw i32 %13, %11
%15 = sitofp i32 %14 to double
%16 = shl nsw i32 %0, 3
%17 = or i32 %16, 4
%18 = sitofp i32 %17 to double
%19 = fdiv double %15, %18
%20 = fdiv double %19, 0x400921FB54442D18
%21 = tail call double @sqrt(double %20)
%22 = fmul double %9, %21
ret double %22
}