#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 nc8(double xmin, double xmax, int n) {
  double h, hh, h2, h3, h4, h5, h6, h7, hi, s, x;
  int i;
  if (n < 2) {
    fprintf(stderr, "Error : n < 2  in nc8()\n");
    return 0.;
  }
  if (xmin == xmax)
    return 0.;
  s = _f(xmin) - 989. * _f(xmax);
  h = (xmax - xmin) / (double)n;
  hh = h / 8.;
  h2 = h / 4.;
  h3 = h * .375;
  h4 = h / 2.;
  h5 = h / 1.6;
  h6 = h * .75;
  h7 = h * .875;
  for (i = 0, hi = 1.; i < n; i++, hi += 1.) {
    x = xmin + h * hi;
    s += (1978. * _f(x) + 5888. * (_f(x - h7) + _f(x - hh)) -
          928. * (_f(x - h6) + _f(x - h2)) +
          10496. * (_f(x - h5) + _f(x - h3)) - 4540. * _f(x - h4));
  }
  return s * h / 28350.;
}


x86 assembly (clang, -O0):
<nc8>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1164 <nc8+0x44>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xf26(%rip),%rsi
call   1030 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1432 <nc8+0x312>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1187 <nc8+0x67>
jp     1187 <nc8+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1432 <nc8+0x312>
movsd  -0x10(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x88(%rbp),%xmm1
ff
cvtsi2sd %eax,%xmm0
movsd  0xe85(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%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  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe14(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdbe(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xda4(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x7c(%rbp)
movsd  0xd83(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1417 <nc8+0x2f7>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0xb4(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0xc0(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm2
movsd  0xd6e(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd5a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0xa4(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0xb0(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd00(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x94(%rbp)
movsd  -0x78(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0xa0(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xca6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x90(%rbp),%xmm1
ff
cvtsi2sd %eax,%xmm0
movsd  0xc6b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
movsd  0xbf8(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1282 <nc8+0x162>
movsd  -0x70(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc1f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc8>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
cmp    $0x1,%edi
jg     1155 <nc8+0x35>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf31(%rip),%rsi
call   1030 <fprintf@plt>
xorpd  %xmm0,%xmm0
jmp    13a4 <nc8+0x284>
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd 0x10(%rsp),%xmm1
jne    116d <nc8+0x4d>
jnp    13a4 <nc8+0x284>
mov    %edi,%ebx
movsd  0x18(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe60(%rip),%xmm1
addsd  (%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  0x18(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  %xmm0,%xmm2
movsd  0xe44(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  0xe3a(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0xe30(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0xe26(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x38(%rsp)
movapd %xmm2,%xmm0
divsd  0xe18(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0xe12(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0xe08(%rip),%xmm0
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xdf8(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x58(%rsp)
movsd  %xmm1,0x60(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
subsd  0x50(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd92(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xd8c(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
subsd  0x48(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd57(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
subsd  0x30(%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  0xd20(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
call   1040 <_f@plt>
movsd  0x60(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xcf7(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  0x58(%rsp),%xmm2
addsd  0xcb7(%rip),%xmm2
add    $0xffffffff,%ebx
jne    1250 <nc8+0x130>
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xccc(%rip),%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc8()\0A\00"
define double @nc8(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 double
%18 = alloca double
%19 = alloca i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %3
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %4
br label %122
25: ; preds = %3
%26 = load double, double* %5
%27 = load double, double* %6
%28 = fcmp oeq double %26, %27
br i1 %28, label %29, label %30
29: ; preds = %25
store double 0.000000e+00, double* %4
br label %122
30: ; preds = %25
%31 = load double, double* %5
%32 = call i32 @_f(double %31)
%33 = sitofp i32 %32 to double
%34 = load double, double* %6
%35 = call i32 @_f(double %34)
%36 = sitofp i32 %35 to double
%37 = call double @llvm.fmuladd.f64(double -9.890000e+02, double %36, double %33)
store double %37, double* %17
%38 = load double, double* %6
%39 = load double, double* %5
%40 = fsub double %38, %39
%41 = load i32, i32* %7
%42 = sitofp i32 %41 to double
%43 = fdiv double %40, %42
store double %43, double* %8
%44 = load double, double* %8
%45 = fdiv double %44, 8.000000e+00
store double %45, double* %9
%46 = load double, double* %8
%47 = fdiv double %46, 4.000000e+00
store double %47, double* %10
%48 = load double, double* %8
%49 = fmul double %48, 3.750000e-01
store double %49, double* %11
%50 = load double, double* %8
%51 = fdiv double %50, 2.000000e+00
store double %51, double* %12
%52 = load double, double* %8
%53 = fdiv double %52, 1.600000e+00
store double %53, double* %13
%54 = load double, double* %8
%55 = fmul double %54, 7.500000e-01
store double %55, double* %14
%56 = load double, double* %8
%57 = fmul double %56, 8.750000e-01
store double %57, double* %15
store i32 0, i32* %19
store double 1.000000e+00, double* %16
br label %58
58: ; preds = %112, %30
%59 = load i32, i32* %19
%60 = load i32, i32* %7
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %117
62: ; preds = %58
%63 = load double, double* %5
%64 = load double, double* %8
%65 = load double, double* %16
%66 = call double @llvm.fmuladd.f64(double %64, double %65, double %63)
store double %66, double* %18
%67 = load double, double* %18
%68 = call i32 @_f(double %67)
%69 = sitofp i32 %68 to double
%70 = load double, double* %18
%71 = load double, double* %15
%72 = fsub double %70, %71
%73 = call i32 @_f(double %72)
%74 = load double, double* %18
%75 = load double, double* %9
%76 = fsub double %74, %75
%77 = call i32 @_f(double %76)
%78 = add nsw i32 %73, %77
%79 = sitofp i32 %78 to double
%80 = fmul double 5.888000e+03, %79
%81 = call double @llvm.fmuladd.f64(double 1.978000e+03, double %69, double %80)
%82 = load double, double* %18
%83 = load double, double* %14
%84 = fsub double %82, %83
%85 = call i32 @_f(double %84)
%86 = load double, double* %18
%87 = load double, double* %10
%88 = fsub double %86, %87
%89 = call i32 @_f(double %88)
%90 = add nsw i32 %85, %89
%91 = sitofp i32 %90 to double
%92 = call double @llvm.fmuladd.f64(double -9.280000e+02, double %91, double %81)
%93 = load double, double* %18
%94 = load double, double* %13
%95 = fsub double %93, %94
%96 = call i32 @_f(double %95)
%97 = load double, double* %18
%98 = load double, double* %11
%99 = fsub double %97, %98
%100 = call i32 @_f(double %99)
%101 = add nsw i32 %96, %100
%102 = sitofp i32 %101 to double
%103 = call double @llvm.fmuladd.f64(double 1.049600e+04, double %102, double %92)
%104 = load double, double* %18
%105 = load double, double* %12
%106 = fsub double %104, %105
%107 = call i32 @_f(double %106)
%108 = sitofp i32 %107 to double
%109 = call double @llvm.fmuladd.f64(double -4.540000e+03, double %108, double %103)
%110 = load double, double* %17
%111 = fadd double %110, %109
store double %111, double* %17
br label %112
112: ; preds = %62
%113 = load i32, i32* %19
%114 = add nsw i32 %113, 1
store i32 %114, i32* %19
%115 = load double, double* %16
%116 = fadd double %115, 1.000000e+00
store double %116, double* %16
br label %58
117: ; preds = %58
%118 = load double, double* %17
%119 = load double, double* %8
%120 = fmul double %118, %119
%121 = fdiv double %120, 2.835000e+04
store double %121, double* %4
br label %122
122: ; preds = %117, %29, %22
%123 = load double, double* %4
ret double %123
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc8()\0A\00"
define double @nc8(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 %66
8: ; preds = %3
%9 = fcmp oeq double %0, %1
br i1 %9, label %66, 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 -9.890000e+02, double %12)
%16 = fsub double %1, %0
%17 = sitofp i32 %2 to double
%18 = fdiv double %16, %17
%19 = fmul double %18, 1.250000e-01
%20 = fmul double %18, 2.500000e-01
%21 = fmul double %18, 3.750000e-01
%22 = fmul double %18, 5.000000e-01
%23 = fdiv double %18, 1.600000e+00
%24 = fmul double %18, 7.500000e-01
%25 = fmul double %18, 8.750000e-01
br label %26
26: ; preds = %10, %26
%27 = phi i32 [ %60, %26 ], [ 0, %10 ]
%28 = phi double [ %59, %26 ], [ %15, %10 ]
%29 = phi double [ %61, %26 ], [ 1.000000e+00, %10 ]
%30 = tail call double @llvm.fmuladd.f64(double %18, double %29, double %0)
%31 = tail call i32 @_f(double %30)
%32 = sitofp i32 %31 to double
%33 = fsub double %30, %25
%34 = tail call i32 @_f(double %33)
%35 = fsub double %30, %19
%36 = tail call i32 @_f(double %35)
%37 = add nsw i32 %36, %34
%38 = sitofp i32 %37 to double
%39 = fmul double %38, 5.888000e+03
%40 = tail call double @llvm.fmuladd.f64(double %32, double 1.978000e+03, double %39)
%41 = fsub double %30, %24
%42 = tail call i32 @_f(double %41)
%43 = fsub double %30, %20
%44 = tail call i32 @_f(double %43)
%45 = add nsw i32 %44, %42
%46 = sitofp i32 %45 to double
%47 = tail call double @llvm.fmuladd.f64(double %46, double -9.280000e+02, double %40)
%48 = fsub double %30, %23
%49 = tail call i32 @_f(double %48)
%50 = fsub double %30, %21
%51 = tail call i32 @_f(double %50)
%52 = add nsw i32 %51, %49
%53 = sitofp i32 %52 to double
%54 = tail call double @llvm.fmuladd.f64(double %53, double 1.049600e+04, double %47)
%55 = fsub double %30, %22
%56 = tail call i32 @_f(double %55)
%57 = sitofp i32 %56 to double
%58 = tail call double @llvm.fmuladd.f64(double %57, double -4.540000e+03, double %54)
%59 = fadd double %28, %58
%60 = add nuw nsw i32 %27, 1
%61 = fadd double %29, 1.000000e+00
%62 = icmp eq i32 %60, %2
br i1 %62, label %63, label %26
63: ; preds = %26
%64 = fmul double %18, %59
%65 = fdiv double %64, 2.835000e+04
br label %66
66: ; preds = %8, %63, %5
%67 = phi double [ 0.000000e+00, %5 ], [ %65, %63 ], [ 0.000000e+00, %8 ]
ret double %67
}