#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_two_sum(double const, double, double *);
int /*<<< orphan*/ qd_renorm5(double *, double *, double *, double *, double *);
void qd_add_d(const double *a, double b, double *c) {
  double c0, c1, c2, c3, e;
  c[0] = dd_two_sum(a[0], b, &e);
  c[1] = dd_two_sum(a[1], e, &e);
  c[2] = dd_two_sum(a[2], e, &e);
  c[3] = dd_two_sum(a[3], e, &e);
  qd_renorm5(&c[0], &c[1], &c[2], &c[3], &e);
}


x86 assembly (clang, -O0):
<qd_add_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1030 <dd_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1030 <dd_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1030 <dd_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1030 <dd_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
add    $0x10,%rdx
mov    -0x18(%rbp),%rcx
add    $0x18,%rcx
lea    -0x40(%rbp),%r8
call   1040 <qd_renorm5@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_add_d>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movaps %xmm0,%xmm1
mov    %rdi,%r15
movsd  (%rdi),%xmm0
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1030 <dd_two_sum@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%r15),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %r14,%rdi
call   1030 <dd_two_sum@plt>
lea    0x8(%rbx),%r12
movsd  %xmm0,0x8(%rbx)
movsd  0x10(%r15),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %r14,%rdi
call   1030 <dd_two_sum@plt>
lea    0x10(%rbx),%r13
movsd  %xmm0,0x10(%rbx)
movsd  0x18(%r15),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %r14,%rdi
call   1030 <dd_two_sum@plt>
lea    0x18(%rbx),%rcx
movsd  %xmm0,0x18(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14,%r8
call   1040 <qd_renorm5@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @qd_add_d(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
%11 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double, double* %5
%16 = call double @dd_two_sum(double %14, double %15, double* %11)
%17 = load double*, double** %6
%18 = getelementptr inbounds double, double* %17, i64 0
store double %16, double* %18
%19 = load double*, double** %4
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double, double* %11
%23 = call double @dd_two_sum(double %21, double %22, double* %11)
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 1
store double %23, double* %25
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = load double, double* %11
%30 = call double @dd_two_sum(double %28, double %29, double* %11)
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 2
store double %30, double* %32
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 3
%35 = load double, double* %34
%36 = load double, double* %11
%37 = call double @dd_two_sum(double %35, double %36, double* %11)
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 3
store double %37, double* %39
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 3
%48 = call i32 @qd_renorm5(double* %41, double* %43, double* %45, double* %47, double* %11)
ret void
}

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