#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 /*<<< orphan*/ error2(char *);
double CountLHs(int ns) {
  double i, nLH = 1;
  if (ns > 70)
    error2("ns too large in NumberofLHs().");
  for (i = 3; i <= ns; i++)
    nLH *= i * (i - 1) / 2;
  return (nLH);
}


x86 assembly (clang, -O0):
<CountLHs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xedd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x46,-0x4(%rbp)
jle    113e <CountLHs+0x2e>
lea    0xedf(%rip),%rdi
call   1030 <error2@plt>
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a6 <CountLHs+0x96>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe8f(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8f(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe69(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114b <CountLHs+0x3b>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountLHs>:
push   %rbx
mov    %edi,%ebx
cmp    $0x47,%edi
jl     1126 <CountLHs+0x16>
lea    0xf01(%rip),%rdi
call   1030 <error2@plt>
jmp    1135 <CountLHs+0x25>
cmp    $0x3,%ebx
jge    1135 <CountLHs+0x25>
movsd  0xecd(%rip),%xmm0
jmp    117e <CountLHs+0x6e>
cvtsi2sd %ebx,%xmm1
movsd  0xec7(%rip),%xmm2
movsd  0xeb7(%rip),%xmm3
movsd  0xebf(%rip),%xmm4
movsd  0xebf(%rip),%xmm5
movapd %xmm3,%xmm0
nopl   (%rax)
movapd %xmm2,%xmm6
addsd  %xmm4,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm5,%xmm6
mulsd  %xmm6,%xmm0
addsd  %xmm3,%xmm2
ucomisd %xmm2,%xmm1
jae    1160 <CountLHs+0x50>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"ns too large in NumberofLHs().\00"
define double @CountLHs(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 %0, i32* %2
store double 1.000000e+00, double* %4
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 70
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @error2(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
store double 3.000000e+00, double* %3
br label %10
10: ; preds = %23, %9
%11 = load double, double* %3
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fcmp ole double %11, %13
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load double, double* %3
%17 = load double, double* %3
%18 = fsub double %17, 1.000000e+00
%19 = fmul double %16, %18
%20 = fdiv double %19, 2.000000e+00
%21 = load double, double* %4
%22 = fmul double %21, %20
store double %22, double* %4
br label %23
23: ; preds = %15
%24 = load double, double* %3
%25 = fadd double %24, 1.000000e+00
store double %25, double* %3
br label %10
26: ; preds = %10
%27 = load double, double* %4
ret double %27
}

LLVM IR (-O2):
@.str = [31 x i8] c"ns too large in NumberofLHs().\00"
define double @CountLHs(i32 %0) {
%2 = icmp sgt i32 %0, 70
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @error2(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = icmp slt i32 %0, 3
br i1 %6, label %18, label %7
7: ; preds = %3, %5
%8 = sitofp i32 %0 to double
br label %9
9: ; preds = %7, %9
%10 = phi double [ %15, %9 ], [ 1.000000e+00, %7 ]
%11 = phi double [ %16, %9 ], [ 3.000000e+00, %7 ]
%12 = fadd double %11, -1.000000e+00
%13 = fmul double %11, %12
%14 = fmul double %13, 5.000000e-01
%15 = fmul double %10, %14
%16 = fadd double %11, 1.000000e+00
%17 = fcmp ugt double %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %5
%19 = phi double [ 1.000000e+00, %5 ], [ %15, %9 ]
ret double %19
}