#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 */
typedef scalar_t__ __m128d;
typedef scalar_t__ __m128;

/* Variables and functions */
scalar_t__ _mm_add_pd(scalar_t__, scalar_t__);
scalar_t__ _mm_add_sd(scalar_t__, scalar_t__);
scalar_t__ _mm_cvtps_pd(scalar_t__);
int /*<<< orphan*/ _mm_load1_ps(float const *);
scalar_t__ _mm_loadu_ps(float const *);
scalar_t__ _mm_movehl_ps(scalar_t__, scalar_t__);
scalar_t__ _mm_mul_pd(scalar_t__, scalar_t__);
scalar_t__ _mm_mul_ps(int /*<<< orphan*/, scalar_t__);
scalar_t__ _mm_setzero_pd();
int /*<<< orphan*/ _mm_store_sd(double *, scalar_t__);
double interpolate_product_double(const float *a, const float *b,
                                  unsigned int len,
                                  const unsigned int oversample, float *frac) {
  int i;
  double ret;
  __m128d sum;
  __m128d sum1 = _mm_setzero_pd();
  __m128d sum2 = _mm_setzero_pd();
  __m128 f = _mm_loadu_ps(frac);
  __m128d f1 = _mm_cvtps_pd(f);
  __m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f, f));
  __m128 t;
  for (i = 0; i < len; i += 2) {
    t = _mm_mul_ps(_mm_load1_ps(a + i), _mm_loadu_ps(b + i * oversample));
    sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
    sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
    t = _mm_mul_ps(_mm_load1_ps(a + i + 1),
                   _mm_loadu_ps(b + (i + 1) * oversample));
    sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
    sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
  }
  sum1 = _mm_mul_pd(f1, sum1);
  sum2 = _mm_mul_pd(f2, sum2);
  sum = _mm_add_pd(sum1, sum2);
  sum = _mm_add_sd(sum, (__m128d)_mm_movehl_ps((__m128)sum, (__m128)sum));
  _mm_store_sd(&ret, sum);
  return ret;
}


x86 assembly (clang, -O0):
<interpolate_product_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    $0x0,%al
call   1090 <_mm_setzero_pd@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1090 <_mm_setzero_pd@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    135a <interpolate_product_double+0x1ba>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   10b0 <_mm_load1_ps@plt>
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    -0x94(%rbp),%edi
mov    %rax,%rsi
call   1060 <_mm_mul_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x68(%rbp),%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    -0x90(%rbp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
call   10b0 <_mm_load1_ps@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%eax
add    $0x1,%eax
imul   -0x18(%rbp),%eax
mov    %eax,%eax
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    -0x7c(%rbp),%edi
mov    %rax,%rsi
call   1060 <_mm_mul_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x68(%rbp),%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    -0x78(%rbp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    120d <interpolate_product_double+0x6d>
mov    -0x58(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <_mm_mul_pd@plt>
mov    %rax,-0x40(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <_mm_mul_pd@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1080 <_mm_movehl_ps@plt>
mov    -0xa0(%rbp),%rdi
mov    %rax,%rsi
call   1030 <_mm_add_sd@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    -0x30(%rbp),%rdi
call   10c0 <_mm_store_sd@plt>
movsd  -0x30(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolate_product_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r12
mov    %rcx,0x18(%rsp)
mov    %edx,%r15d
mov    %rsi,0x38(%rsp)
mov    %rdi,%rbx
xor    %r13d,%r13d
xor    %eax,%eax
call   1090 <_mm_setzero_pd@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1090 <_mm_setzero_pd@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %rax,0x28(%rsp)
mov    %r12,%rdi
mov    %r12,%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %rax,0x20(%rsp)
test   %r15d,%r15d
je     130d <interpolate_product_double+0x16d>
mov    %r15d,%eax
mov    %rax,0x30(%rsp)
mov    0x18(%rsp),%rax
add    %eax,%eax
mov    %eax,0x14(%rsp)
xor    %r15d,%r15d
mov    0x38(%rsp),%r12
nopl   0x0(%rax)
mov    %rbp,0x8(%rsp)
mov    %rbx,%rdi
call   10b0 <_mm_load1_ps@plt>
mov    %eax,%ebp
mov    %r13d,%eax
lea    (%r12,%rax,4),%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1060 <_mm_mul_ps@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %rbp,%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    0x8(%rsp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,0x8(%rsp)
lea    0x4(%rbx),%rdi
call   10b0 <_mm_load1_ps@plt>
mov    %eax,%ebp
mov    0x18(%rsp),%rax
add    %r13d,%eax
lea    (%r12,%rax,4),%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1060 <_mm_mul_ps@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %rbp,%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_cvtps_pd@plt>
mov    0x8(%rsp),%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,%rbp
add    $0x2,%r15
add    0x14(%rsp),%r13d
add    $0x8,%rbx
cmp    0x30(%rsp),%r15
jb     1230 <interpolate_product_double+0x90>
mov    0x28(%rsp),%rdi
mov    %r14,%rsi
call   10a0 <_mm_mul_pd@plt>
mov    %rax,%rbx
mov    0x20(%rsp),%rdi
mov    %rbp,%rsi
call   10a0 <_mm_mul_pd@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <_mm_add_pd@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rax,%rsi
call   1080 <_mm_movehl_ps@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <_mm_add_sd@plt>
lea    0x40(%rsp),%rdi
mov    %rax,%rsi
call   10c0 <_mm_store_sd@plt>
movsd  0x40(%rsp),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @interpolate_product_double(float* %0, float* %1, i32 %2, i32 %3, float* %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
%10 = alloca float*
%11 = alloca i32
%12 = alloca double
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
store float* %0, float** %6
store float* %1, float** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store float* %4, float** %10
%20 = call i64 (...) @_mm_setzero_pd()
store i64 %20, i64* %14
%21 = call i64 (...) @_mm_setzero_pd()
store i64 %21, i64* %15
%22 = load float*, float** %10
%23 = call i64 @_mm_loadu_ps(float* %22)
store i64 %23, i64* %16
%24 = load i64, i64* %16
%25 = call i64 @_mm_cvtps_pd(i64 %24)
store i64 %25, i64* %17
%26 = load i64, i64* %16
%27 = load i64, i64* %16
%28 = call i64 @_mm_movehl_ps(i64 %26, i64 %27)
%29 = call i64 @_mm_cvtps_pd(i64 %28)
store i64 %29, i64* %18
store i32 0, i32* %11
br label %30
30: ; preds = %83, %5
%31 = load i32, i32* %11
%32 = load i32, i32* %8
%33 = icmp ult i32 %31, %32
br i1 %33, label %34, label %86
34: ; preds = %30
%35 = load float*, float** %6
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds float, float* %35, i64 %37
%39 = call i32 @_mm_load1_ps(float* %38)
%40 = load float*, float** %7
%41 = load i32, i32* %11
%42 = load i32, i32* %9
%43 = mul i32 %41, %42
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds float, float* %40, i64 %44
%46 = call i64 @_mm_loadu_ps(float* %45)
%47 = call i64 @_mm_mul_ps(i32 %39, i64 %46)
store i64 %47, i64* %19
%48 = load i64, i64* %14
%49 = load i64, i64* %19
%50 = call i64 @_mm_cvtps_pd(i64 %49)
%51 = call i64 @_mm_add_pd(i64 %48, i64 %50)
store i64 %51, i64* %14
%52 = load i64, i64* %15
%53 = load i64, i64* %19
%54 = load i64, i64* %19
%55 = call i64 @_mm_movehl_ps(i64 %53, i64 %54)
%56 = call i64 @_mm_cvtps_pd(i64 %55)
%57 = call i64 @_mm_add_pd(i64 %52, i64 %56)
store i64 %57, i64* %15
%58 = load float*, float** %6
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds float, float* %58, i64 %60
%62 = getelementptr inbounds float, float* %61, i64 1
%63 = call i32 @_mm_load1_ps(float* %62)
%64 = load float*, float** %7
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
%67 = load i32, i32* %9
%68 = mul i32 %66, %67
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds float, float* %64, i64 %69
%71 = call i64 @_mm_loadu_ps(float* %70)
%72 = call i64 @_mm_mul_ps(i32 %63, i64 %71)
store i64 %72, i64* %19
%73 = load i64, i64* %14
%74 = load i64, i64* %19
%75 = call i64 @_mm_cvtps_pd(i64 %74)
%76 = call i64 @_mm_add_pd(i64 %73, i64 %75)
store i64 %76, i64* %14
%77 = load i64, i64* %15
%78 = load i64, i64* %19
%79 = load i64, i64* %19
%80 = call i64 @_mm_movehl_ps(i64 %78, i64 %79)
%81 = call i64 @_mm_cvtps_pd(i64 %80)
%82 = call i64 @_mm_add_pd(i64 %77, i64 %81)
store i64 %82, i64* %15
br label %83
83: ; preds = %34
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 2
store i32 %85, i32* %11
br label %30
86: ; preds = %30
%87 = load i64, i64* %17
%88 = load i64, i64* %14
%89 = call i64 @_mm_mul_pd(i64 %87, i64 %88)
store i64 %89, i64* %14
%90 = load i64, i64* %18
%91 = load i64, i64* %15
%92 = call i64 @_mm_mul_pd(i64 %90, i64 %91)
store i64 %92, i64* %15
%93 = load i64, i64* %14
%94 = load i64, i64* %15
%95 = call i64 @_mm_add_pd(i64 %93, i64 %94)
store i64 %95, i64* %13
%96 = load i64, i64* %13
%97 = load i64, i64* %13
%98 = load i64, i64* %13
%99 = call i64 @_mm_movehl_ps(i64 %97, i64 %98)
%100 = call i64 @_mm_add_sd(i64 %96, i64 %99)
store i64 %100, i64* %13
%101 = load i64, i64* %13
%102 = call i32 @_mm_store_sd(double* %12, i64 %101)
%103 = load double, double* %12
ret double %103
}

LLVM IR (-O2):
define double @interpolate_product_double(float* %0, float* %1, i32 %2, i32 %3, float* %4) {
%6 = alloca double
%7 = bitcast double* %6 to i8*
%8 = tail call i64 (...) @_mm_setzero_pd()
%9 = tail call i64 (...) @_mm_setzero_pd()
%10 = tail call i64 @_mm_loadu_ps(float* %4)
%11 = tail call i64 @_mm_cvtps_pd(i64 %10)
%12 = tail call i64 @_mm_movehl_ps(i64 %10, i64 %10)
%13 = tail call i64 @_mm_cvtps_pd(i64 %12)
%14 = icmp eq i32 %2, 0
br i1 %14, label %50, label %15
15: ; preds = %5
%16 = zext i32 %2 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %48, %17 ]
%19 = phi i64 [ %8, %15 ], [ %44, %17 ]
%20 = phi i64 [ %9, %15 ], [ %47, %17 ]
%21 = getelementptr inbounds float, float* %0, i64 %18
%22 = tail call i32 @_mm_load1_ps(float* %21)
%23 = trunc i64 %18 to i32
%24 = mul i32 %23, %3
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds float, float* %1, i64 %25
%27 = tail call i64 @_mm_loadu_ps(float* %26)
%28 = tail call i64 @_mm_mul_ps(i32 %22, i64 %27)
%29 = tail call i64 @_mm_cvtps_pd(i64 %28)
%30 = tail call i64 @_mm_add_pd(i64 %19, i64 %29)
%31 = tail call i64 @_mm_movehl_ps(i64 %28, i64 %28)
%32 = tail call i64 @_mm_cvtps_pd(i64 %31)
%33 = tail call i64 @_mm_add_pd(i64 %20, i64 %32)
%34 = getelementptr inbounds float, float* %21, i64 1
%35 = tail call i32 @_mm_load1_ps(float* %34)
%36 = trunc i64 %18 to i32
%37 = or i32 %36, 1
%38 = mul i32 %37, %3
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds float, float* %1, i64 %39
%41 = tail call i64 @_mm_loadu_ps(float* %40)
%42 = tail call i64 @_mm_mul_ps(i32 %35, i64 %41)
%43 = tail call i64 @_mm_cvtps_pd(i64 %42)
%44 = tail call i64 @_mm_add_pd(i64 %30, i64 %43)
%45 = tail call i64 @_mm_movehl_ps(i64 %42, i64 %42)
%46 = tail call i64 @_mm_cvtps_pd(i64 %45)
%47 = tail call i64 @_mm_add_pd(i64 %33, i64 %46)
%48 = add nuw nsw i64 %18, 2
%49 = icmp ult i64 %48, %16
br i1 %49, label %17, label %50
50: ; preds = %17, %5
%51 = phi i64 [ %9, %5 ], [ %47, %17 ]
%52 = phi i64 [ %8, %5 ], [ %44, %17 ]
%53 = tail call i64 @_mm_mul_pd(i64 %11, i64 %52)
%54 = tail call i64 @_mm_mul_pd(i64 %13, i64 %51)
%55 = tail call i64 @_mm_add_pd(i64 %53, i64 %54)
%56 = tail call i64 @_mm_movehl_ps(i64 %55, i64 %55)
%57 = tail call i64 @_mm_add_sd(i64 %55, i64 %56)
%58 = call i32 @_mm_store_sd(double* %6, i64 %57)
%59 = load double, double* %6
ret double %59
}