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


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

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

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

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