#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 dd_quick_two_sum(double, double, double *);
double dd_two_prod(double, double, double *);
void dd_mlt_d(double *a, double b) {
  double p1, p2;
  p1 = dd_two_prod(a[0], b, &p2);
  p2 += a[1] * b;
  a[0] = dd_quick_two_sum(p1, p2, &a[1]);
}


x86 assembly (clang, -O0):
<dd_mlt_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x20(%rbp),%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
call   1030 <dd_quick_two_sum@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_mlt_d>:
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
mov    %rsp,%rdi
call   1040 <dd_two_prod@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x8(%rbx),%xmm1
lea    0x8(%rbx),%rdi
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
call   1030 <dd_quick_two_sum@plt>
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @dd_mlt_d(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double* %0, double** %3
store double %1, double* %4
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double, double* %4
%11 = call double @dd_two_prod(double %9, double %10, double* %6)
store double %11, double* %5
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double, double* %4
%16 = load double, double* %6
%17 = call double @llvm.fmuladd.f64(double %14, double %15, double %16)
store double %17, double* %6
%18 = load double, double* %5
%19 = load double, double* %6
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = call double @dd_quick_two_sum(double %18, double %19, double* %21)
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 0
store double %22, double* %24
ret void
}

LLVM IR (-O2):
define void @dd_mlt_d(double* %0, double %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = load double, double* %0
%6 = call double @dd_two_prod(double %5, double %1, double* %3)
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %8, double %1, double %9)
store double %10, double* %3
%11 = call double @dd_quick_two_sum(double %6, double %10, double* %7)
store double %11, double* %0
ret void
}