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


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

x86 assembly (clang, -O2):
<dd_inc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <dd_two_sum@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x8(%r14),%r12
movsd  0x8(%r14),%xmm0
movsd  0x8(%rbx),%xmm1
lea    0x10(%rsp),%rdi
call   1040 <dd_two_sum@plt>
movapd %xmm0,%xmm1
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %r15,%rdi
call   1030 <dd_quick_two_sum@plt>
movsd  0x10(%rsp),%xmm1
addsd  (%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %r12,%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_inc(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = call double @dd_two_sum(double %11, double %14, double* %6)
store double %15, double* %5
%16 = load double*, double** %3
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %4
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = call double @dd_two_sum(double %18, double %21, double* %8)
store double %22, double* %7
%23 = load double, double* %7
%24 = load double, double* %6
%25 = fadd double %24, %23
store double %25, double* %6
%26 = load double, double* %5
%27 = load double, double* %6
%28 = call double @dd_quick_two_sum(double %26, double %27, double* %6)
store double %28, double* %5
%29 = load double, double* %8
%30 = load double, double* %6
%31 = fadd double %30, %29
store double %31, double* %6
%32 = load double, double* %5
%33 = load double, double* %6
%34 = load double*, double** %3
%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** %3
%38 = getelementptr inbounds double, double* %37, i64 0
store double %36, double* %38
ret void
}

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