#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 log(int);
double getNu0multiplier(double nu0, int n) {
  double val = 0.0;
  while (n > 1) {
    val += log((nu0 + n) / 2.0 - 1.0);
    n--;
    n--;
  }
  if (n == 1) {
    while (nu0 > 2) {
      val += log((double)(nu0 - 1) / (double)(nu0 - 2));
      nu0--;
      nu0--;
    }
    if (((int)nu0) == 1)
      val -= log(3.1415926535897932384626433832795) / 2;
    if (((int)nu0) == 2)
      val += log(3.1415926535897932384626433832795) / 2 - log(2);
  }
  return (val);
}


x86 assembly (clang, -O0):
<getNu0multiplier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1186 <getNu0multiplier+0x76>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <getNu0multiplier+0x18>
cmpl   $0x1,-0xc(%rbp)
jne    128b <getNu0multiplier+0x17b>
jmp    1195 <getNu0multiplier+0x85>
movsd  -0x8(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1212 <getNu0multiplier+0x102>
movsd  -0x8(%rbp),%xmm0
movsd  0xe57(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe36(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe17(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe05(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <getNu0multiplier+0x85>
cvttsd2si -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1244 <getNu0multiplier+0x134>
mov    $0x3,%edi
call   1030 <log@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x8(%rbp),%eax
cmp    $0x2,%eax
jne    1286 <getNu0multiplier+0x176>
mov    $0x3,%edi
call   1030 <log@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    128b <getNu0multiplier+0x17b>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNu0multiplier>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
cmp    $0x2,%edi
jl     118d <getNu0multiplier+0x7d>
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x8(%rsp)
xchg   %ax,%ax
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xeb8(%rip),%xmm0
addsd  0xeb8(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm0
lea    -0x2(%rbx),%eax
cmp    $0x3,%ebx
mov    %eax,%ebx
ja     1130 <getNu0multiplier+0x20>
cmp    $0x1,%eax
je     1198 <getNu0multiplier+0x88>
jmp    1292 <getNu0multiplier+0x182>
mov    %ebx,%eax
cmp    $0x1,%eax
jne    1292 <getNu0multiplier+0x182>
ucomisd 0xe70(%rip),%xmm1
jbe    1218 <getNu0multiplier+0x108>
movapd %xmm1,%xmm2
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  0xe4b(%rip),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
addsd  0xe49(%rip),%xmm1
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  0x8(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe00(%rip),%xmm2
ucomisd 0xe00(%rip),%xmm2
movapd %xmm2,%xmm1
ja     11b0 <getNu0multiplier+0xa0>
jmp    121c <getNu0multiplier+0x10c>
movapd %xmm1,%xmm2
cvttsd2si %xmm2,%eax
cmp    $0x2,%eax
je     1254 <getNu0multiplier+0x144>
cmp    $0x1,%eax
jne    1292 <getNu0multiplier+0x182>
mov    $0x3,%edi
movsd  %xmm0,(%rsp)
call   1030 <log@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
jmp    1288 <getNu0multiplier+0x178>
mov    $0x3,%edi
movsd  %xmm0,(%rsp)
call   1030 <log@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    $0x2,%edi
call   1030 <log@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define double @getNu0multiplier(double %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %17
4: ; preds = %2, %4
%5 = phi double [ %14, %4 ], [ 0.000000e+00, %2 ]
%6 = phi i32 [ %15, %4 ], [ %1, %2 ]
%7 = sitofp i32 %6 to double
%8 = fadd double %7, %0
%9 = fmul double %8, 5.000000e-01
%10 = fadd double %9, -1.000000e+00
%11 = fptosi double %10 to i32
%12 = tail call i32 @log(i32 %11)
%13 = sitofp i32 %12 to double
%14 = fadd double %5, %13
%15 = add nsw i32 %6, -2
%16 = icmp ugt i32 %6, 3
br i1 %16, label %4, label %17
17: ; preds = %4, %2
%18 = phi i32 [ %1, %2 ], [ %15, %4 ]
%19 = phi double [ 0.000000e+00, %2 ], [ %14, %4 ]
%20 = icmp eq i32 %18, 1
br i1 %20, label %21, label %51
21: ; preds = %17
%22 = fcmp ogt double %0, 2.000000e+00
br i1 %22, label %23, label %35
23: ; preds = %21, %23
%24 = phi double [ %32, %23 ], [ %19, %21 ]
%25 = phi double [ %33, %23 ], [ %0, %21 ]
%26 = fadd double %25, -1.000000e+00
%27 = fadd double %25, -2.000000e+00
%28 = fdiv double %26, %27
%29 = fptosi double %28 to i32
%30 = tail call i32 @log(i32 %29)
%31 = sitofp i32 %30 to double
%32 = fadd double %24, %31
%33 = fadd double %26, -1.000000e+00
%34 = fcmp ogt double %33, 2.000000e+00
br i1 %34, label %23, label %35
35: ; preds = %23, %21
%36 = phi double [ %0, %21 ], [ %33, %23 ]
%37 = phi double [ %19, %21 ], [ %32, %23 ]
%38 = fptosi double %36 to i32
switch i32 %38, label %51 [
i32 1, label %39
i32 2, label %44
]
39: ; preds = %35
%40 = tail call i32 @log(i32 3)
%41 = sdiv i32 %40, 2
%42 = sitofp i32 %41 to double
%43 = fsub double %37, %42
br label %51
44: ; preds = %35
%45 = tail call i32 @log(i32 3)
%46 = sdiv i32 %45, 2
%47 = tail call i32 @log(i32 2)
%48 = sub nsw i32 %46, %47
%49 = sitofp i32 %48 to double
%50 = fadd double %37, %49
br label %51
51: ; preds = %35, %39, %44, %17
%52 = phi double [ %50, %44 ], [ %19, %17 ], [ %43, %39 ], [ %37, %35 ]
ret double %52
}