#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 _f(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
double nc6(double xmin, double xmax, int n) {
  double h, hh, h2, h3, h4, h5, hi, s, x;
  int i;
  if (n < 2) {
    fprintf(stderr, "Error : n < 2  in nc6()\n");
    return 0.;
  }
  if (xmin == xmax)
    return 0.;
  s = _f(xmin) - 41. * _f(xmax);
  h = (xmax - xmin) / (double)n;
  hh = h / 6.;
  h2 = h / 3.;
  h3 = h / 2.;
  h4 = h / 1.5;
  h5 = h / 1.2;
  for (i = 0, hi = 1.; i < n; i++, hi += 1.) {
    x = xmin + h * hi;
    s += (82. * _f(x) + 216. * (_f(x - h5) + _f(x - hh)) +
          27. * (_f(x - h4) + _f(x - h2)) + 272. * _f(x - h3));
  }
  return s * h / 840.;
}


x86 assembly (clang, -O0):
<nc6>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1164 <nc6+0x44>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xf0e(%rip),%rsi
call   1030 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13b4 <nc6+0x294>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1187 <nc6+0x67>
jp     1187 <nc6+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13b4 <nc6+0x294>
movsd  -0x10(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x78(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe41(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe05(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xde7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdc9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x6c(%rbp)
movsd  0xda9(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1399 <nc6+0x279>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x94(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm2
movsd  0xd7c(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd68(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x84(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x90(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd0e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x80(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xcd9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
movsd  0xc76(%rip),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    125c <nc6+0x13c>
movsd  -0x60(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc8d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc6>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
cmp    $0x1,%edi
jg     1155 <nc6+0x35>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf19(%rip),%rsi
call   1030 <fprintf@plt>
xorpd  %xmm0,%xmm0
jmp    1345 <nc6+0x225>
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd 0x8(%rsp),%xmm1
jne    116d <nc6+0x4d>
jnp    1345 <nc6+0x225>
mov    %edi,%ebx
movsd  0x18(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe60(%rip),%xmm1
movsd  0x8(%rsp),%xmm3
subsd  0x18(%rsp),%xmm3
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
divsd  0xe45(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
movapd %xmm3,%xmm0
divsd  0xe3b(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
addsd  (%rsp),%xmm1
movsd  0xe30(%rip),%xmm0
movapd %xmm3,%xmm2
divsd  0xe2c(%rip),%xmm2
movsd  %xmm2,0x28(%rsp)
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  %xmm3,0x8(%rsp)
movapd %xmm3,%xmm0
divsd  0xe12(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xe0c(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x50(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
subsd  0x40(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xda2(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xd9c(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd67(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
call   1040 <_f@plt>
movsd  0x50(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd3e(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  0x48(%rsp),%xmm2
addsd  0xd06(%rip),%xmm2
add    $0xffffffff,%ebx
jne    1230 <nc6+0x110>
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xd13(%rip),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc6()\0A\00"
define double @nc6(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %4
br label %105
23: ; preds = %3
%24 = load double, double* %5
%25 = load double, double* %6
%26 = fcmp oeq double %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store double 0.000000e+00, double* %4
br label %105
28: ; preds = %23
%29 = load double, double* %5
%30 = call i32 @_f(double %29)
%31 = sitofp i32 %30 to double
%32 = load double, double* %6
%33 = call i32 @_f(double %32)
%34 = sitofp i32 %33 to double
%35 = call double @llvm.fmuladd.f64(double -4.100000e+01, double %34, double %31)
store double %35, double* %15
%36 = load double, double* %6
%37 = load double, double* %5
%38 = fsub double %36, %37
%39 = load i32, i32* %7
%40 = sitofp i32 %39 to double
%41 = fdiv double %38, %40
store double %41, double* %8
%42 = load double, double* %8
%43 = fdiv double %42, 6.000000e+00
store double %43, double* %9
%44 = load double, double* %8
%45 = fdiv double %44, 3.000000e+00
store double %45, double* %10
%46 = load double, double* %8
%47 = fdiv double %46, 2.000000e+00
store double %47, double* %11
%48 = load double, double* %8
%49 = fdiv double %48, 1.500000e+00
store double %49, double* %12
%50 = load double, double* %8
%51 = fdiv double %50, 1.200000e+00
store double %51, double* %13
store i32 0, i32* %17
store double 1.000000e+00, double* %14
br label %52
52: ; preds = %95, %28
%53 = load i32, i32* %17
%54 = load i32, i32* %7
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %100
56: ; preds = %52
%57 = load double, double* %5
%58 = load double, double* %8
%59 = load double, double* %14
%60 = call double @llvm.fmuladd.f64(double %58, double %59, double %57)
store double %60, double* %16
%61 = load double, double* %16
%62 = call i32 @_f(double %61)
%63 = sitofp i32 %62 to double
%64 = load double, double* %16
%65 = load double, double* %13
%66 = fsub double %64, %65
%67 = call i32 @_f(double %66)
%68 = load double, double* %16
%69 = load double, double* %9
%70 = fsub double %68, %69
%71 = call i32 @_f(double %70)
%72 = add nsw i32 %67, %71
%73 = sitofp i32 %72 to double
%74 = fmul double 2.160000e+02, %73
%75 = call double @llvm.fmuladd.f64(double 8.200000e+01, double %63, double %74)
%76 = load double, double* %16
%77 = load double, double* %12
%78 = fsub double %76, %77
%79 = call i32 @_f(double %78)
%80 = load double, double* %16
%81 = load double, double* %10
%82 = fsub double %80, %81
%83 = call i32 @_f(double %82)
%84 = add nsw i32 %79, %83
%85 = sitofp i32 %84 to double
%86 = call double @llvm.fmuladd.f64(double 2.700000e+01, double %85, double %75)
%87 = load double, double* %16
%88 = load double, double* %11
%89 = fsub double %87, %88
%90 = call i32 @_f(double %89)
%91 = sitofp i32 %90 to double
%92 = call double @llvm.fmuladd.f64(double 2.720000e+02, double %91, double %86)
%93 = load double, double* %15
%94 = fadd double %93, %92
store double %94, double* %15
br label %95
95: ; preds = %56
%96 = load i32, i32* %17
%97 = add nsw i32 %96, 1
store i32 %97, i32* %17
%98 = load double, double* %14
%99 = fadd double %98, 1.000000e+00
store double %99, double* %14
br label %52
100: ; preds = %52
%101 = load double, double* %15
%102 = load double, double* %8
%103 = fmul double %101, %102
%104 = fdiv double %103, 8.400000e+02
store double %104, double* %4
br label %105
105: ; preds = %100, %27, %20
%106 = load double, double* %4
ret double %106
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc6()\0A\00"
define double @nc6(double %0, double %1, i32 %2) {
%4 = icmp slt i32 %2, 2
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %57
8: ; preds = %3
%9 = fcmp oeq double %0, %1
br i1 %9, label %57, label %10
10: ; preds = %8
%11 = tail call i32 @_f(double %0)
%12 = sitofp i32 %11 to double
%13 = tail call i32 @_f(double %1)
%14 = sitofp i32 %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %14, double -4.100000e+01, double %12)
%16 = fsub double %1, %0
%17 = sitofp i32 %2 to double
%18 = fdiv double %16, %17
%19 = fdiv double %18, 6.000000e+00
%20 = fdiv double %18, 3.000000e+00
%21 = fmul double %18, 5.000000e-01
%22 = fdiv double %18, 1.500000e+00
%23 = fdiv double %18, 1.200000e+00
br label %24
24: ; preds = %10, %24
%25 = phi i32 [ %51, %24 ], [ 0, %10 ]
%26 = phi double [ %50, %24 ], [ %15, %10 ]
%27 = phi double [ %52, %24 ], [ 1.000000e+00, %10 ]
%28 = tail call double @llvm.fmuladd.f64(double %18, double %27, double %0)
%29 = tail call i32 @_f(double %28)
%30 = sitofp i32 %29 to double
%31 = fsub double %28, %23
%32 = tail call i32 @_f(double %31)
%33 = fsub double %28, %19
%34 = tail call i32 @_f(double %33)
%35 = add nsw i32 %34, %32
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 2.160000e+02
%38 = tail call double @llvm.fmuladd.f64(double %30, double 8.200000e+01, double %37)
%39 = fsub double %28, %22
%40 = tail call i32 @_f(double %39)
%41 = fsub double %28, %20
%42 = tail call i32 @_f(double %41)
%43 = add nsw i32 %42, %40
%44 = sitofp i32 %43 to double
%45 = tail call double @llvm.fmuladd.f64(double %44, double 2.700000e+01, double %38)
%46 = fsub double %28, %21
%47 = tail call i32 @_f(double %46)
%48 = sitofp i32 %47 to double
%49 = tail call double @llvm.fmuladd.f64(double %48, double 2.720000e+02, double %45)
%50 = fadd double %26, %49
%51 = add nuw nsw i32 %25, 1
%52 = fadd double %27, 1.000000e+00
%53 = icmp eq i32 %51, %2
br i1 %53, label %54, label %24
54: ; preds = %24
%55 = fmul double %18, %50
%56 = fdiv double %55, 8.400000e+02
br label %57
57: ; preds = %8, %54, %5
%58 = phi double [ 0.000000e+00, %5 ], [ %56, %54 ], [ 0.000000e+00, %8 ]
ret double %58
}