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


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

LLVM IR (-O0):
define void @dd_mlt(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 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = call double @dd_two_prod(double %9, double %12, double* %6)
store double %13, double* %5
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double*, double** %3
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = load double, double* %6
%21 = call double @llvm.fmuladd.f64(double %16, double %19, double %20)
store double %21, double* %6
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double*, double** %3
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = load double, double* %6
%29 = call double @llvm.fmuladd.f64(double %24, double %27, double %28)
store double %29, double* %6
%30 = load double, double* %5
%31 = load double, double* %6
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = call double @dd_quick_two_sum(double %30, double %31, double* %33)
%35 = load double*, double** %3
%36 = getelementptr inbounds double, double* %35, i64 0
store double %34, double* %36
ret void
}

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