#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 binomial(double, double);
double modf(double, double *);
int combin_length(int n) {
  int choose;
  double length = n;
  double middle_int;
  double middle_dec;
  middle_dec = modf(length / 2, &middle_int);
  if (middle_dec >= 0.5)
    middle_int++;
  choose = binomial(length, middle_int);
  n = middle_int * choose;
  return (n);
}


x86 assembly (clang, -O0):
<combin_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    -0x18(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     117d <combin_length+0x5d>
movsd  0xe9d(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <binomial@plt>
mov    %eax,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combin_length>:
sub    $0x28,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0x8(%rsp),%rdi
call   1040 <modf@plt>
movsd  0x8(%rsp),%xmm3
movsd  0xeb7(%rip),%xmm2
addsd  %xmm3,%xmm2
movsd  0xea3(%rip),%xmm1
cmpnlesd %xmm0,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm3,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <binomial@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @combin_length(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
store double %8, double* %4
%9 = load double, double* %4
%10 = fdiv double %9, 2.000000e+00
%11 = call double @modf(double %10, double* %5)
store double %11, double* %6
%12 = load double, double* %6
%13 = fcmp oge double %12, 5.000000e-01
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load double, double* %5
%16 = fadd double %15, 1.000000e+00
store double %16, double* %5
br label %17
17: ; preds = %14, %1
%18 = load double, double* %4
%19 = load double, double* %5
%20 = call i32 @binomial(double %18, double %19)
store i32 %20, i32* %3
%21 = load double, double* %5
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to double
%24 = fmul double %21, %23
%25 = fptosi double %24 to i32
store i32 %25, i32* %2
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @combin_length(i32 %0) {
%2 = alloca double
%3 = sitofp i32 %0 to double
%4 = bitcast double* %2 to i8*
%5 = fmul double %3, 5.000000e-01
%6 = call double @modf(double %5, double* %2)
%7 = fcmp ult double %6, 5.000000e-01
%8 = load double, double* %2
%9 = fadd double %8, 1.000000e+00
%10 = select i1 %7, double %8, double %9
%11 = tail call i32 @binomial(double %3, double %10)
%12 = sitofp i32 %11 to double
%13 = fmul double %10, %12
%14 = fptosi double %13 to i32
ret i32 %14
}