#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 */
struct bbiSummary {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bbiAddToSummary(unsigned int, unsigned int, unsigned int,
                                   unsigned int, int, double, double, double,
                                   double, int, struct bbiSummary **);
void bbiAddRangeToSummary(unsigned chromId, unsigned chromSize, unsigned start,
                          unsigned end, double val, int reduction,
                          struct bbiSummary **pOutList) {
  int size = end - start;
  double sum = size * val;
  double sumSquares = sum * val;
  bbiAddToSummary(chromId, chromSize, start, end, size, val, val, sum,
                  sumSquares, reduction, pOutList);
}


x86 assembly (clang, -O0):
<bbiAddRangeToSummary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
mov    -0x1c(%rbp),%r9d
mov    -0x28(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <bbiAddToSummary@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbiAddRangeToSummary>:
push   %rax
mov    %r8d,%eax
mov    %ecx,%r8d
sub    %edx,%r8d
cvtsi2sd %r8d,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm0,%xmm3
mov    %r9,(%rsp)
movapd %xmm0,%xmm1
mov    %eax,%r9d
call   1030 <bbiAddToSummary@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.bbiSummary = type { i32 }
define void @bbiAddRangeToSummary(i32 %0, i32 %1, i32 %2, i32 %3, double %4, i32 %5, %struct.bbiSummary** %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca %struct.bbiSummary**
%15 = alloca i32
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double %4, double* %12
store i32 %5, i32* %13
store %struct.bbiSummary** %6, %struct.bbiSummary*** %14
%18 = load i32, i32* %11
%19 = load i32, i32* %10
%20 = sub i32 %18, %19
store i32 %20, i32* %15
%21 = load i32, i32* %15
%22 = sitofp i32 %21 to double
%23 = load double, double* %12
%24 = fmul double %22, %23
store double %24, double* %16
%25 = load double, double* %16
%26 = load double, double* %12
%27 = fmul double %25, %26
store double %27, double* %17
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = load i32, i32* %11
%32 = load i32, i32* %15
%33 = load double, double* %12
%34 = load double, double* %12
%35 = load double, double* %16
%36 = load double, double* %17
%37 = load i32, i32* %13
%38 = load %struct.bbiSummary**, %struct.bbiSummary*** %14
%39 = call i32 @bbiAddToSummary(i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, double %33, double %34, double %35, double %36, i32 %37, %struct.bbiSummary** %38)
ret void
}

LLVM IR (-O2):
%struct.bbiSummary = type { i32 }
define void @bbiAddRangeToSummary(i32 %0, i32 %1, i32 %2, i32 %3, double %4, i32 %5, %struct.bbiSummary** %6) {
%8 = sub i32 %3, %2
%9 = sitofp i32 %8 to double
%10 = fmul double %9, %4
%11 = fmul double %10, %4
%12 = tail call i32 @bbiAddToSummary(i32 %0, i32 %1, i32 %2, i32 %3, i32 %8, double %4, double %4, double %10, double %11, i32 %5, %struct.bbiSummary** %6)
ret void
}