#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 nc7(double xmin, double xmax, int n) {
  double h, hh, h2, h3, h4, h5, h6, hi, s, x;
  int i;
  if (n < 2) {
    fprintf(stderr, "Error : n < 2  in nc7()\n");
    return 0.;
  }
  if (xmin == xmax)
    return 0.;
  s = _f(xmin) - 751. * _f(xmax);
  h = (xmax - xmin) / (double)n;
  hh = h / 7.;
  h2 = h / 3.5;
  h3 = hh * 3.;
  h4 = h / 1.75;
  h5 = h / 1.4;
  h6 = hh * 6.;
  for (i = 0, hi = 1.; i < n; i++, hi += 1.) {
    x = xmin + h * hi;
    s +=
        (1502. * _f(x) + 3577. * (_f(x - h6) + _f(x - hh)) +
         1323. * (_f(x - h5) + _f(x - h2)) + 2989. * (_f(x - h4) + _f(x - h3)));
  }
  return s * h / 17280.;
}


x86 assembly (clang, -O0):
<nc7>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1164 <nc7+0x44>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xf16(%rip),%rsi
call   1030 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13e7 <nc7+0x2c7>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1187 <nc7+0x67>
jp     1187 <nc7+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13e7 <nc7+0x2c7>
movsd  -0x10(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x80(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xe83(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%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  0xe49(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe12(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdf3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdd5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdbc(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
movsd  0xd9b(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13cc <nc7+0x2ac>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0xa4(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0xb0(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm2
movsd  0xd76(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd62(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x94(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x38(%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  0xd08(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x84(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x40(%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  0xcae(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
movsd  0xc43(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    126a <nc7+0x14a>
movsd  -0x68(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc62(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc7>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
cmp    $0x1,%edi
jg     1155 <nc7+0x35>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf21(%rip),%rsi
call   1030 <fprintf@plt>
xorpd  %xmm0,%xmm0
jmp    1370 <nc7+0x250>
xorpd  %xmm0,%xmm0
movsd  0x20(%rsp),%xmm1
ucomisd 0x10(%rsp),%xmm1
jne    116d <nc7+0x4d>
jnp    1370 <nc7+0x250>
mov    %edi,%ebx
movsd  0x20(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe5f(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x10(%rsp),%xmm4
subsd  0x20(%rsp),%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,%xmm0
divsd  0xe44(%rip),%xmm0
addsd  0x8(%rsp),%xmm1
movapd %xmm4,%xmm2
divsd  0xe3a(%rip),%xmm2
movsd  %xmm2,0x48(%rsp)
movsd  0xe34(%rip),%xmm2
movapd %xmm4,%xmm3
divsd  0xe30(%rip),%xmm3
movsd  %xmm3,0x38(%rsp)
movsd  %xmm4,0x10(%rsp)
movapd %xmm4,%xmm3
divsd  0xe20(%rip),%xmm3
movsd  %xmm3,0x30(%rsp)
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rsp)
movsd  0xe10(%rip),%xmm2
movsd  %xmm0,0x50(%rsp)
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%rsp)
movsd  0xe00(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x58(%rsp)
movsd  %xmm1,0x60(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
subsd  0x50(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd97(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xd91(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
subsd  0x48(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd5a(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
subsd  0x40(%rsp),%xmm0
call   1040 <_f@plt>
movsd  0x60(%rsp),%xmm1
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd1b(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  0x58(%rsp),%xmm2
addsd  0xce3(%rip),%xmm2
add    $0xffffffff,%ebx
jne    1240 <nc7+0x120>
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xcf0(%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 nc7()\0A\00"
define double @nc7(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 i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %4
br label %113
24: ; preds = %3
%25 = load double, double* %5
%26 = load double, double* %6
%27 = fcmp oeq double %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
store double 0.000000e+00, double* %4
br label %113
29: ; preds = %24
%30 = load double, double* %5
%31 = call i32 @_f(double %30)
%32 = sitofp i32 %31 to double
%33 = load double, double* %6
%34 = call i32 @_f(double %33)
%35 = sitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double -7.510000e+02, double %35, double %32)
store double %36, double* %16
%37 = load double, double* %6
%38 = load double, double* %5
%39 = fsub double %37, %38
%40 = load i32, i32* %7
%41 = sitofp i32 %40 to double
%42 = fdiv double %39, %41
store double %42, double* %8
%43 = load double, double* %8
%44 = fdiv double %43, 7.000000e+00
store double %44, double* %9
%45 = load double, double* %8
%46 = fdiv double %45, 3.500000e+00
store double %46, double* %10
%47 = load double, double* %9
%48 = fmul double %47, 3.000000e+00
store double %48, double* %11
%49 = load double, double* %8
%50 = fdiv double %49, 1.750000e+00
store double %50, double* %12
%51 = load double, double* %8
%52 = fdiv double %51, 1.400000e+00
store double %52, double* %13
%53 = load double, double* %9
%54 = fmul double %53, 6.000000e+00
store double %54, double* %14
store i32 0, i32* %18
store double 1.000000e+00, double* %15
br label %55
55: ; preds = %103, %29
%56 = load i32, i32* %18
%57 = load i32, i32* %7
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %108
59: ; preds = %55
%60 = load double, double* %5
%61 = load double, double* %8
%62 = load double, double* %15
%63 = call double @llvm.fmuladd.f64(double %61, double %62, double %60)
store double %63, double* %17
%64 = load double, double* %17
%65 = call i32 @_f(double %64)
%66 = sitofp i32 %65 to double
%67 = load double, double* %17
%68 = load double, double* %14
%69 = fsub double %67, %68
%70 = call i32 @_f(double %69)
%71 = load double, double* %17
%72 = load double, double* %9
%73 = fsub double %71, %72
%74 = call i32 @_f(double %73)
%75 = add nsw i32 %70, %74
%76 = sitofp i32 %75 to double
%77 = fmul double 3.577000e+03, %76
%78 = call double @llvm.fmuladd.f64(double 1.502000e+03, double %66, double %77)
%79 = load double, double* %17
%80 = load double, double* %13
%81 = fsub double %79, %80
%82 = call i32 @_f(double %81)
%83 = load double, double* %17
%84 = load double, double* %10
%85 = fsub double %83, %84
%86 = call i32 @_f(double %85)
%87 = add nsw i32 %82, %86
%88 = sitofp i32 %87 to double
%89 = call double @llvm.fmuladd.f64(double 1.323000e+03, double %88, double %78)
%90 = load double, double* %17
%91 = load double, double* %12
%92 = fsub double %90, %91
%93 = call i32 @_f(double %92)
%94 = load double, double* %17
%95 = load double, double* %11
%96 = fsub double %94, %95
%97 = call i32 @_f(double %96)
%98 = add nsw i32 %93, %97
%99 = sitofp i32 %98 to double
%100 = call double @llvm.fmuladd.f64(double 2.989000e+03, double %99, double %89)
%101 = load double, double* %16
%102 = fadd double %101, %100
store double %102, double* %16
br label %103
103: ; preds = %59
%104 = load i32, i32* %18
%105 = add nsw i32 %104, 1
store i32 %105, i32* %18
%106 = load double, double* %15
%107 = fadd double %106, 1.000000e+00
store double %107, double* %15
br label %55
108: ; preds = %55
%109 = load double, double* %16
%110 = load double, double* %8
%111 = fmul double %109, %110
%112 = fdiv double %111, 1.728000e+04
store double %112, double* %4
br label %113
113: ; preds = %108, %28, %21
%114 = load double, double* %4
ret double %114
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc7()\0A\00"
define double @nc7(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 %61
8: ; preds = %3
%9 = fcmp oeq double %0, %1
br i1 %9, label %61, 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 -7.510000e+02, double %12)
%16 = fsub double %1, %0
%17 = sitofp i32 %2 to double
%18 = fdiv double %16, %17
%19 = fdiv double %18, 7.000000e+00
%20 = fdiv double %18, 3.500000e+00
%21 = fmul double %19, 3.000000e+00
%22 = fdiv double %18, 1.750000e+00
%23 = fdiv double %18, 1.400000e+00
%24 = fmul double %19, 6.000000e+00
br label %25
25: ; preds = %10, %25
%26 = phi i32 [ %55, %25 ], [ 0, %10 ]
%27 = phi double [ %54, %25 ], [ %15, %10 ]
%28 = phi double [ %56, %25 ], [ 1.000000e+00, %10 ]
%29 = tail call double @llvm.fmuladd.f64(double %18, double %28, double %0)
%30 = tail call i32 @_f(double %29)
%31 = sitofp i32 %30 to double
%32 = fsub double %29, %24
%33 = tail call i32 @_f(double %32)
%34 = fsub double %29, %19
%35 = tail call i32 @_f(double %34)
%36 = add nsw i32 %35, %33
%37 = sitofp i32 %36 to double
%38 = fmul double %37, 3.577000e+03
%39 = tail call double @llvm.fmuladd.f64(double %31, double 1.502000e+03, double %38)
%40 = fsub double %29, %23
%41 = tail call i32 @_f(double %40)
%42 = fsub double %29, %20
%43 = tail call i32 @_f(double %42)
%44 = add nsw i32 %43, %41
%45 = sitofp i32 %44 to double
%46 = tail call double @llvm.fmuladd.f64(double %45, double 1.323000e+03, double %39)
%47 = fsub double %29, %22
%48 = tail call i32 @_f(double %47)
%49 = fsub double %29, %21
%50 = tail call i32 @_f(double %49)
%51 = add nsw i32 %50, %48
%52 = sitofp i32 %51 to double
%53 = tail call double @llvm.fmuladd.f64(double %52, double 2.989000e+03, double %46)
%54 = fadd double %27, %53
%55 = add nuw nsw i32 %26, 1
%56 = fadd double %28, 1.000000e+00
%57 = icmp eq i32 %55, %2
br i1 %57, label %58, label %25
58: ; preds = %25
%59 = fmul double %18, %54
%60 = fdiv double %59, 1.728000e+04
br label %61
61: ; preds = %8, %58, %5
%62 = phi double [ 0.000000e+00, %5 ], [ %60, %58 ], [ 0.000000e+00, %8 ]
ret double %62
}