#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 */
double exp(double);
int pow(double, double);
int sqrt(int);
void band_phi6_bin(int *n, int *nb, double *d, int *x, double *h, double *u) {
  int i, nn = *n, nbin = *nb;
  double delta, sum, term;
  sum = 0.0;
  for (i = 0; i < nbin; i++) {
    delta = i * (*d) / (*h);
    delta *= delta;
    if (delta >= 1000)
      break;
    term = exp(-delta / 2) *
           (delta * delta * delta - 15 * delta * delta + 45 * delta - 15);
    sum += term * x[i];
  }
  sum = 2 * sum - 15 * nn;
  *u = sum / (nn * (nn - 1) * pow(*h, 7.0) * sqrt(2 * 3.14159265));
}


x86 assembly (clang, -O0):
<band_phi6_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    128b <band_phi6_bin+0x15b>
cvtsi2sdl -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xe4d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c2 <band_phi6_bin+0x92>
jmp    128b <band_phi6_bin+0x15b>
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe32(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x48(%rbp),%xmm2
mulsd  -0x48(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
movsd  0xe02(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x48(%rbp),%xmm1
movsd  0xdd4(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xdbc(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1171 <band_phi6_bin+0x41>
movsd  -0x50(%rbp),%xmm0
imul   $0xf,-0x38(%rbp),%eax
cvtsi2sd %eax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd3b(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
movsd  -0x68(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<band_phi6_bin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r15
mov    (%rdi),%r13d
mov    (%rsi),%ebp
test   %ebp,%ebp
mov    %r9,0x8(%rsp)
jle    11fa <band_phi6_bin+0xca>
mov    %rcx,%r12
mov    %rdx,%rbx
xorpd  %xmm1,%xmm1
xor    %r14d,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  (%rbx),%xmm0
divsd  (%r15),%xmm0
mulsd  %xmm0,%xmm0
ucomisd 0xe83(%rip),%xmm0
jae    11fe <band_phi6_bin+0xce>
movsd  %xmm0,0x10(%rsp)
mulsd  0xe7b(%rip),%xmm0
movsd  %xmm1,(%rsp)
call   1030 <exp@plt>
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm4,%xmm2
movsd  0xe5f(%rip),%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm1
addsd  %xmm2,%xmm1
mulsd  0xe4f(%rip),%xmm4
addsd  %xmm1,%xmm4
movsd  (%rsp),%xmm1
addsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtsi2sdl (%r12,%r14,4),%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm0,%xmm1
add    $0x1,%r14
cmp    %r14,%rbp
jne    1160 <band_phi6_bin+0x30>
jmp    11fe <band_phi6_bin+0xce>
xorpd  %xmm1,%xmm1
lea    0x0(%r13,%r13,4),%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
lea    -0x1(%r13),%ebp
imul   %r13d,%ebp
movsd  (%r15),%xmm0
movsd  0xdf1(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%ebx
mov    $0x6,%edi
call   1050 <sqrt@plt>
imul   %ebx,%eax
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0x8(%rsp),%rax
movsd  %xmm1,(%rax)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @band_phi6_bin(i32* %0, i32* %1, double* %2, i32* %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32* %0, i32** %7
store i32* %1, i32** %8
store double* %2, double** %9
store i32* %3, i32** %10
store double* %4, double** %11
store double* %5, double** %12
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
store i32 %20, i32* %14
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
store i32 %22, i32* %15
store double 0.000000e+00, double* %17
store i32 0, i32* %13
br label %23
23: ; preds = %70, %6
%24 = load i32, i32* %13
%25 = load i32, i32* %15
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %73
27: ; preds = %23
%28 = load i32, i32* %13
%29 = sitofp i32 %28 to double
%30 = load double*, double** %9
%31 = load double, double* %30
%32 = fmul double %29, %31
%33 = load double*, double** %11
%34 = load double, double* %33
%35 = fdiv double %32, %34
store double %35, double* %16
%36 = load double, double* %16
%37 = load double, double* %16
%38 = fmul double %37, %36
store double %38, double* %16
%39 = load double, double* %16
%40 = fcmp oge double %39, 1.000000e+03
br i1 %40, label %41, label %42
41: ; preds = %27
br label %73
42: ; preds = %27
%43 = load double, double* %16
%44 = fneg double %43
%45 = fdiv double %44, 2.000000e+00
%46 = call double @exp(double %45)
%47 = load double, double* %16
%48 = load double, double* %16
%49 = fmul double %47, %48
%50 = load double, double* %16
%51 = load double, double* %16
%52 = fmul double 1.500000e+01, %51
%53 = load double, double* %16
%54 = fmul double %52, %53
%55 = fneg double %54
%56 = call double @llvm.fmuladd.f64(double %49, double %50, double %55)
%57 = load double, double* %16
%58 = call double @llvm.fmuladd.f64(double 4.500000e+01, double %57, double %56)
%59 = fsub double %58, 1.500000e+01
%60 = fmul double %46, %59
store double %60, double* %18
%61 = load double, double* %18
%62 = load i32*, i32** %10
%63 = load i32, i32* %13
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
%66 = load i32, i32* %65
%67 = sitofp i32 %66 to double
%68 = load double, double* %17
%69 = call double @llvm.fmuladd.f64(double %61, double %67, double %68)
store double %69, double* %17
br label %70
70: ; preds = %42
%71 = load i32, i32* %13
%72 = add nsw i32 %71, 1
store i32 %72, i32* %13
br label %23
73: ; preds = %41, %23
%74 = load double, double* %17
%75 = load i32, i32* %14
%76 = mul nsw i32 15, %75
%77 = sitofp i32 %76 to double
%78 = fneg double %77
%79 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %74, double %78)
store double %79, double* %17
%80 = load double, double* %17
%81 = load i32, i32* %14
%82 = load i32, i32* %14
%83 = sub nsw i32 %82, 1
%84 = mul nsw i32 %81, %83
%85 = load double*, double** %11
%86 = load double, double* %85
%87 = call i32 @pow(double %86, double 7.000000e+00)
%88 = mul nsw i32 %84, %87
%89 = call i32 @sqrt(i32 6)
%90 = mul nsw i32 %88, %89
%91 = sitofp i32 %90 to double
%92 = fdiv double %80, %91
%93 = load double*, double** %12
store double %92, double* %93
ret void
}

LLVM IR (-O2):
define void @band_phi6_bin(i32* nocapture %0, i32* nocapture %1, double* nocapture %2, i32* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = load i32, i32* %0
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %39
10: ; preds = %6
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %23
%13 = phi i64 [ 0, %10 ], [ %37, %23 ]
%14 = phi double [ 0.000000e+00, %10 ], [ %36, %23 ]
%15 = trunc i64 %13 to i32
%16 = sitofp i32 %15 to double
%17 = load double, double* %2
%18 = fmul double %17, %16
%19 = load double, double* %4
%20 = fdiv double %18, %19
%21 = fmul double %20, %20
%22 = fcmp ult double %21, 1.000000e+03
br i1 %22, label %23, label %39
23: ; preds = %12
%24 = fmul double %21, -5.000000e-01
%25 = tail call double @exp(double %24)
%26 = fmul double %21, %21
%27 = fmul double %21, -1.500000e+01
%28 = fmul double %21, %27
%29 = tail call double @llvm.fmuladd.f64(double %26, double %21, double %28)
%30 = tail call double @llvm.fmuladd.f64(double %21, double 4.500000e+01, double %29)
%31 = fadd double %30, -1.500000e+01
%32 = fmul double %31, %25
%33 = getelementptr inbounds i32, i32* %3, i64 %13
%34 = load i32, i32* %33
%35 = sitofp i32 %34 to double
%36 = tail call double @llvm.fmuladd.f64(double %32, double %35, double %14)
%37 = add nuw nsw i64 %13, 1
%38 = icmp eq i64 %37, %11
br i1 %38, label %39, label %12
39: ; preds = %23, %12, %6
%40 = phi double [ 0.000000e+00, %6 ], [ %14, %12 ], [ %36, %23 ]
%41 = mul nsw i32 %7, 15
%42 = sitofp i32 %41 to double
%43 = fneg double %42
%44 = tail call double @llvm.fmuladd.f64(double %40, double 2.000000e+00, double %43)
%45 = add nsw i32 %7, -1
%46 = mul nsw i32 %45, %7
%47 = load double, double* %4
%48 = tail call i32 @pow(double %47, double 7.000000e+00)
%49 = mul nsw i32 %46, %48
%50 = tail call i32 @sqrt(i32 6)
%51 = mul nsw i32 %49, %50
%52 = sitofp i32 %51 to double
%53 = fdiv double %44, %52
store double %53, double* %5
ret void
}