#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_diff(double const, double const, double *);
void dd_sub(const double *a, const double *b, double *c) {
  double s1, s2, t1, t2;
  s1 = dd_two_diff(a[0], b[0], &s2);
  t1 = dd_two_diff(a[1], b[1], &t2);
  s2 += t1;
  s1 = dd_quick_two_sum(s1, s2, &s2);
  s2 += t2;
  c[0] = dd_quick_two_sum(s1, s2, &c[1]);
}


x86 assembly (clang, -O0):
<dd_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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_diff@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
lea    -0x38(%rbp),%rdi
call   1040 <dd_two_diff@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
call   1030 <dd_quick_two_sum@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%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    $0x40,%rsp
pop    %rbp
ret

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

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

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