#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 sqrt(double);
double L2_aN_so3(int j, int m1, int m2) {
  double dj, dm1, dm2;
  dj = (double)j;
  dm1 = (double)m1;
  dm2 = (double)m2;
  if (j > 0)
    return (-sqrt((2. * dj + 3.) / (2. * dj - 1.)) * (dj + 1.) /
            sqrt(((dj + 1.) * (dj + 1.) - dm1 * dm1) *
                 ((dj + 1.) * (dj + 1.) - dm2 * dm2)) *
            sqrt((dj * dj - dm1 * dm1) * (dj * dj - dm2 * dm2)) / dj);
  else
    return 0.;
}


x86 assembly (clang, -O0):
<L2_aN_so3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    12d3 <L2_aN_so3+0x1c3>
movsd  -0x20(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe99(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe65(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe4f(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe42(%rip),%xmm2
addsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe0c(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xdff(%rip),%xmm3
addsd  -0x20(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12db <L2_aN_so3+0x1cb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<L2_aN_so3>:
test   %edi,%edi
jle    1165 <L2_aN_so3+0x55>
sub    $0x48,%rsp
cvtsi2sd %edi,%xmm2
movd   %edx,%xmm0
movd   %esi,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm5
movapd %xmm2,0x10(%rsp)
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
unpcklpd %xmm0,%xmm0
addpd  0xeba(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm6,%xmm6
ucomisd %xmm6,%xmm0
jb     1169 <L2_aN_so3+0x59>
xorps  %xmm2,%xmm2
sqrtsd %xmm0,%xmm2
jmp    117f <L2_aN_so3+0x6f>
xorps  %xmm0,%xmm0
ret
movaps %xmm5,(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm6,%xmm6
movapd (%rsp),%xmm5
movapd %xmm0,%xmm2
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
movapd 0xe7b(%rip),%xmm4
xorpd  %xmm4,%xmm2
movsd  0xe7f(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
xorpd  %xmm5,%xmm4
mulpd  %xmm5,%xmm4
mulsd  %xmm1,%xmm1
unpcklpd %xmm1,%xmm1
addpd  %xmm4,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
ucomisd %xmm6,%xmm0
jb     11d5 <L2_aN_so3+0xc5>
sqrtsd %xmm0,%xmm0
jmp    11fc <L2_aN_so3+0xec>
movapd %xmm2,(%rsp)
movapd %xmm3,0x30(%rsp)
movapd %xmm4,0x20(%rsp)
call   1030 <sqrt@plt>
movapd 0x20(%rsp),%xmm4
movapd 0x30(%rsp),%xmm3
movapd (%rsp),%xmm2
divsd  %xmm0,%xmm2
mulpd  %xmm3,%xmm3
addpd  %xmm4,%xmm3
movapd %xmm3,%xmm0
unpckhpd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1224 <L2_aN_so3+0x114>
sqrtsd %xmm0,%xmm0
jmp    1233 <L2_aN_so3+0x123>
movapd %xmm2,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  0x10(%rsp),%xmm2
add    $0x48,%rsp
movapd %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @L2_aN_so3(i32 %0, i32 %1, i32 %2) {
%4 = sitofp i32 %0 to double
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %37
6: ; preds = %3
%7 = insertelement <2 x i32> poison, i32 %1, i64 0
%8 = insertelement <2 x i32> %7, i32 %2, i64 1
%9 = sitofp <2 x i32> %8 to <2 x double>
%10 = insertelement <2 x double> poison, double %4, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> <double 3.000000e+00, double -1.000000e+00>)
%13 = extractelement <2 x double> %12, i64 0
%14 = extractelement <2 x double> %12, i64 1
%15 = fdiv double %13, %14
%16 = tail call double @sqrt(double %15)
%17 = fneg double %16
%18 = fadd double %4, 1.000000e+00
%19 = fmul double %18, %17
%20 = fneg <2 x double> %9
%21 = fmul <2 x double> %20, %9
%22 = insertelement <2 x double> poison, double %18, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %23, <2 x double> %21)
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%26 = fmul <2 x double> %24, %25
%27 = extractelement <2 x double> %26, i64 0
%28 = tail call double @sqrt(double %27)
%29 = fdiv double %19, %28
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %11, <2 x double> %21)
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%32 = fmul <2 x double> %30, %31
%33 = extractelement <2 x double> %32, i64 0
%34 = tail call double @sqrt(double %33)
%35 = fmul double %29, %34
%36 = fdiv double %35, %4
br label %37
37: ; preds = %3, %6
%38 = phi double [ %36, %6 ], [ 0.000000e+00, %3 ]
ret double %38
}