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


x86 assembly (clang, -O0):
<dd_div_dd_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x38(%rbp),%rdi
call   1050 <dd_two_prod@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    -0x48(%rbp),%rdi
call   1040 <dd_two_diff@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
divsd  -0x10(%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    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_div_dd_d>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0x20(%rsp),%rdi
call   1050 <dd_two_prod@plt>
movapd %xmm0,%xmm1
movsd  (%rbx),%xmm0
lea    0x8(%rsp),%rdi
call   1040 <dd_two_diff@plt>
movsd  0x8(%rbx),%xmm1
addsd  0x8(%rsp),%xmm1
subsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
addsd  %xmm0,%xmm1
divsd  0x10(%rsp),%xmm1
lea    0x8(%r14),%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <dd_quick_two_sum@plt>
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @dd_div_dd_d(double* nocapture %0, double %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 = fdiv double %8, %1
%10 = call double @dd_two_prod(double %9, double %1, double* %4)
%11 = load double, double* %0
%12 = call double @dd_two_diff(double %11, double %10, double* %5)
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = load double, double* %5
%16 = fadd double %14, %15
%17 = load double, double* %4
%18 = fsub double %16, %17
store double %18, double* %5
%19 = fadd double %12, %18
%20 = fdiv double %19, %1
%21 = getelementptr inbounds double, double* %2, i64 1
%22 = call double @dd_quick_two_sum(double %9, double %20, double* %21)
store double %22, double* %2
ret void
}