#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 nc5(double xmin, double xmax, int n) {
  double h, hh, h2, h3, h4, hi, s, x;
  int i;
  if (n < 2) {
    fprintf(stderr, "Error : n < 2  in nc5()\n");
    return 0.;
  }
  if (xmin == xmax)
    return 0.;
  s = _f(xmin) - 19. * _f(xmax);
  h = (xmax - xmin) / (double)n;
  hh = h / 5.;
  h2 = h * .4;
  h3 = h * .6;
  h4 = h * .8;
  for (i = 0, hi = 1.; i < n; i++, hi += 1.) {
    x = xmin + h * hi;
    s += (38. * _f(x) + 75. * (_f(x - h4) + _f(x - hh)) +
          50. * (_f(x - h3) + _f(x - h2)));
  }
  return s * h / 288.;
}


x86 assembly (clang, -O0):
<nc5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1164 <nc5+0x44>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xefe(%rip),%rsi
call   1030 <fprintf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1359 <nc5+0x239>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1187 <nc5+0x67>
jp     1187 <nc5+0x67>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1359 <nc5+0x239>
movsd  -0x10(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x70(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xe73(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%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  0xe39(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe20(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe06(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdec(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x64(%rbp)
movsd  0xdcb(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    133e <nc5+0x21e>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1040 <_f@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x84(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm2
movsd  0xd8e(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd7a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
call   1040 <_f@plt>
mov    %eax,-0x74(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
call   1040 <_f@plt>
movsd  -0x80(%rbp),%xmm1
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xd2c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
movsd  0xcd1(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    123a <nc5+0x11a>
movsd  -0x58(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xce0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc5>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
cmp    $0x1,%edi
jg     1155 <nc5+0x35>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xf09(%rip),%rsi
call   1030 <fprintf@plt>
xorpd  %xmm0,%xmm0
jmp    130f <nc5+0x1ef>
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd 0x8(%rsp),%xmm1
jne    116d <nc5+0x4d>
jnp    130f <nc5+0x1ef>
mov    %edi,%ebx
movsd  0x18(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <_f@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe5f(%rip),%xmm1
addsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
subsd  0x18(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
divsd  0xe3e(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0xe38(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0xe2e(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0xe24(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0xe14(%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,0x10(%rsp)
call   1040 <_f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
subsd  0x40(%rsp),%xmm0
call   1040 <_f@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xda7(%rip),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0xda1(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
call   1040 <_f@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
call   1040 <_f@plt>
movsd  0x50(%rsp),%xmm1
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd64(%rip),%xmm0
addsd  0x20(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  0x48(%rsp),%xmm2
addsd  0xd34(%rip),%xmm2
add    $0xffffffff,%ebx
jne    1220 <nc5+0x100>
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xd39(%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 nc5()\0A\00"
define double @nc5(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 i32
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %4
br label %96
22: ; preds = %3
%23 = load double, double* %5
%24 = load double, double* %6
%25 = fcmp oeq double %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
store double 0.000000e+00, double* %4
br label %96
27: ; preds = %22
%28 = load double, double* %5
%29 = call i32 @_f(double %28)
%30 = sitofp i32 %29 to double
%31 = load double, double* %6
%32 = call i32 @_f(double %31)
%33 = sitofp i32 %32 to double
%34 = call double @llvm.fmuladd.f64(double -1.900000e+01, double %33, double %30)
store double %34, double* %14
%35 = load double, double* %6
%36 = load double, double* %5
%37 = fsub double %35, %36
%38 = load i32, i32* %7
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
store double %40, double* %8
%41 = load double, double* %8
%42 = fdiv double %41, 5.000000e+00
store double %42, double* %9
%43 = load double, double* %8
%44 = fmul double %43, 4.000000e-01
store double %44, double* %10
%45 = load double, double* %8
%46 = fmul double %45, 6.000000e-01
store double %46, double* %11
%47 = load double, double* %8
%48 = fmul double %47, 8.000000e-01
store double %48, double* %12
store i32 0, i32* %16
store double 1.000000e+00, double* %13
br label %49
49: ; preds = %86, %27
%50 = load i32, i32* %16
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %91
53: ; preds = %49
%54 = load double, double* %5
%55 = load double, double* %8
%56 = load double, double* %13
%57 = call double @llvm.fmuladd.f64(double %55, double %56, double %54)
store double %57, double* %15
%58 = load double, double* %15
%59 = call i32 @_f(double %58)
%60 = sitofp i32 %59 to double
%61 = load double, double* %15
%62 = load double, double* %12
%63 = fsub double %61, %62
%64 = call i32 @_f(double %63)
%65 = load double, double* %15
%66 = load double, double* %9
%67 = fsub double %65, %66
%68 = call i32 @_f(double %67)
%69 = add nsw i32 %64, %68
%70 = sitofp i32 %69 to double
%71 = fmul double 7.500000e+01, %70
%72 = call double @llvm.fmuladd.f64(double 3.800000e+01, double %60, double %71)
%73 = load double, double* %15
%74 = load double, double* %11
%75 = fsub double %73, %74
%76 = call i32 @_f(double %75)
%77 = load double, double* %15
%78 = load double, double* %10
%79 = fsub double %77, %78
%80 = call i32 @_f(double %79)
%81 = add nsw i32 %76, %80
%82 = sitofp i32 %81 to double
%83 = call double @llvm.fmuladd.f64(double 5.000000e+01, double %82, double %72)
%84 = load double, double* %14
%85 = fadd double %84, %83
store double %85, double* %14
br label %86
86: ; preds = %53
%87 = load i32, i32* %16
%88 = add nsw i32 %87, 1
store i32 %88, i32* %16
%89 = load double, double* %13
%90 = fadd double %89, 1.000000e+00
store double %90, double* %13
br label %49
91: ; preds = %49
%92 = load double, double* %14
%93 = load double, double* %8
%94 = fmul double %92, %93
%95 = fdiv double %94, 2.880000e+02
store double %95, double* %4
br label %96
96: ; preds = %91, %26, %19
%97 = load double, double* %4
ret double %97
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Error : n < 2 in nc5()\0A\00"
define double @nc5(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 %52
8: ; preds = %3
%9 = fcmp oeq double %0, %1
br i1 %9, label %52, 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 -1.900000e+01, double %12)
%16 = fsub double %1, %0
%17 = sitofp i32 %2 to double
%18 = fdiv double %16, %17
%19 = fdiv double %18, 5.000000e+00
%20 = fmul double %18, 4.000000e-01
%21 = fmul double %18, 6.000000e-01
%22 = fmul double %18, 8.000000e-01
br label %23
23: ; preds = %10, %23
%24 = phi i32 [ %46, %23 ], [ 0, %10 ]
%25 = phi double [ %45, %23 ], [ %15, %10 ]
%26 = phi double [ %47, %23 ], [ 1.000000e+00, %10 ]
%27 = tail call double @llvm.fmuladd.f64(double %18, double %26, double %0)
%28 = tail call i32 @_f(double %27)
%29 = sitofp i32 %28 to double
%30 = fsub double %27, %22
%31 = tail call i32 @_f(double %30)
%32 = fsub double %27, %19
%33 = tail call i32 @_f(double %32)
%34 = add nsw i32 %33, %31
%35 = sitofp i32 %34 to double
%36 = fmul double %35, 7.500000e+01
%37 = tail call double @llvm.fmuladd.f64(double %29, double 3.800000e+01, double %36)
%38 = fsub double %27, %21
%39 = tail call i32 @_f(double %38)
%40 = fsub double %27, %20
%41 = tail call i32 @_f(double %40)
%42 = add nsw i32 %41, %39
%43 = sitofp i32 %42 to double
%44 = tail call double @llvm.fmuladd.f64(double %43, double 5.000000e+01, double %37)
%45 = fadd double %25, %44
%46 = add nuw nsw i32 %24, 1
%47 = fadd double %26, 1.000000e+00
%48 = icmp eq i32 %46, %2
br i1 %48, label %49, label %23
49: ; preds = %23
%50 = fmul double %18, %45
%51 = fdiv double %50, 2.880000e+02
br label %52
52: ; preds = %8, %49, %5
%53 = phi double [ 0.000000e+00, %5 ], [ %51, %49 ], [ 0.000000e+00, %8 ]
ret double %53
}