#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 */
int /*<<< orphan*/ dd_dec(double *, double *);
int /*<<< orphan*/ dd_inc_d(double *, double);
int /*<<< orphan*/ dd_mul_d_dd(double, double const *, double *);
double dd_quick_two_sum(double, double, double *);
int /*<<< orphan*/ dd_sub(double const *, double *, double *);
void dd_div(const double *a, const double *b, double *c) {
  double q1, q2, q3;
  double acc[2];
  q1 = a[0] / b[0];
  dd_mul_d_dd(q1, b, acc);
  dd_sub(a, acc, c);
  q2 = c[0] / b[0];
  dd_mul_d_dd(q2, b, acc);
  dd_dec(c, acc);
  q3 = c[0] / b[0];
  c[0] = dd_quick_two_sum(q1, q2, &c[1]);
  dd_inc_d(c, q3);
}


x86 assembly (clang, -O0):
<dd_div>:
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
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <dd_mul_d_dd@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <dd_sub@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <dd_mul_d_dd@plt>
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <dd_dec@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1050 <dd_quick_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
call   1070 <dd_inc_d@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_div>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  (%rdi),%xmm0
divsd  (%rsi),%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0x20(%rsp),%r12
mov    %rsi,%rdi
mov    %r12,%rsi
call   1040 <dd_mul_d_dd@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <dd_sub@plt>
movsd  (%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <dd_mul_d_dd@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <dd_dec@plt>
movsd  (%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x8(%rbx),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <dd_quick_two_sum@plt>
movsd  %xmm0,(%rbx)
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
call   1070 <dd_inc_d@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dd_div(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 [2 x 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 = fdiv double %13, %16
store double %17, double* %7
%18 = load double, double* %7
%19 = load double*, double** %5
%20 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%21 = call i32 @dd_mul_d_dd(double %18, double* %19, double* %20)
%22 = load double*, double** %4
%23 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%24 = load double*, double** %6
%25 = call i32 @dd_sub(double* %22, double* %23, double* %24)
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = load double*, double** %5
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fdiv double %28, %31
store double %32, double* %8
%33 = load double, double* %8
%34 = load double*, double** %5
%35 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%36 = call i32 @dd_mul_d_dd(double %33, double* %34, double* %35)
%37 = load double*, double** %6
%38 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%39 = call i32 @dd_dec(double* %37, double* %38)
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = load double*, double** %5
%44 = getelementptr inbounds double, double* %43, i64 0
%45 = load double, double* %44
%46 = fdiv double %42, %45
store double %46, double* %9
%47 = load double, double* %7
%48 = load double, double* %8
%49 = load double*, double** %6
%50 = getelementptr inbounds double, double* %49, i64 1
%51 = call double @dd_quick_two_sum(double %47, double %48, double* %50)
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 0
store double %51, double* %53
%54 = load double*, double** %6
%55 = load double, double* %9
%56 = call i32 @dd_inc_d(double* %54, double %55)
ret void
}

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