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


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

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

LLVM IR (-O0):
define void @dd_mul(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = call double @dd_two_prod(double %11, double %14, double* %8)
store double %15, double* %7
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = load double*, double** %5
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = fmul double %24, %27
%29 = call double @llvm.fmuladd.f64(double %18, double %21, double %28)
%30 = load double, double* %8
%31 = fadd double %30, %29
store double %31, double* %8
%32 = load double, double* %7
%33 = load double, double* %8
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = call double @dd_quick_two_sum(double %32, double %33, double* %35)
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 0
store double %36, double* %38
ret void
}

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