#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_prod(double, double, double *);
int /*<<< orphan*/ qd_renorm4(double *, double *, double *, double *);
int /*<<< orphan*/ qd_sub_qd_dd(double const *, double *, double *);
void qd_div_qd_d(const double *a, double b, double *c) {
  double t0, t1, q0, q1, q2, q3;
  double dd_t[2];
  q0 = a[0] / b;
  t0 = dd_two_prod(q0, b, &t1);
  dd_t[0] = t0;
  dd_t[1] = t1;
  qd_sub_qd_dd(a, dd_t, c);
  q1 = c[0] / b;
  t0 = dd_two_prod(q1, b, &t1);
  dd_t[0] = t0;
  dd_t[1] = t1;
  qd_sub_qd_dd(c, dd_t, c);
  q2 = c[0] / b;
  t0 = dd_two_prod(q2, b, &t1);
  dd_t[0] = t0;
  dd_t[1] = t1;
  qd_sub_qd_dd(c, dd_t, c);
  q3 = c[0] / b;
  qd_renorm4(&q0, &q1, &q2, &q3);
  c[0] = q0;
  c[1] = q1;
  c[2] = q2;
  c[3] = q3;
}


x86 assembly (clang, -O0):
<qd_div_qd_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <qd_sub_qd_dd@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <qd_sub_qd_dd@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <qd_sub_qd_dd@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1030 <qd_renorm4@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_div_qd_d>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
mov    %rdi,%r12
movsd  (%rdi),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0x10(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <qd_sub_qd_dd@plt>
movsd  (%rbx),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x38(%rsp)
mov    %r14,%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <qd_sub_qd_dd@plt>
movsd  (%rbx),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %r14,%rdi
call   1040 <dd_two_prod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <qd_sub_qd_dd@plt>
movsd  (%rbx),%xmm0
divsd  (%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0x40(%rsp),%rdi
lea    0x38(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x28(%rsp),%rcx
call   1030 <qd_renorm4@plt>
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x8(%rbx)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x10(%rbx)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x18(%rbx)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @qd_div_qd_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
%13 = alloca [2 x double]
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = load double, double* %5
%18 = fdiv double %16, %17
store double %18, double* %9
%19 = load double, double* %9
%20 = load double, double* %5
%21 = call double @dd_two_prod(double %19, double %20, double* %8)
store double %21, double* %7
%22 = load double, double* %7
%23 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
store double %22, double* %23
%24 = load double, double* %8
%25 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 1
store double %24, double* %25
%26 = load double*, double** %4
%27 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%28 = load double*, double** %6
%29 = call i32 @qd_sub_qd_dd(double* %26, double* %27, double* %28)
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double, double* %31
%33 = load double, double* %5
%34 = fdiv double %32, %33
store double %34, double* %10
%35 = load double, double* %10
%36 = load double, double* %5
%37 = call double @dd_two_prod(double %35, double %36, double* %8)
store double %37, double* %7
%38 = load double, double* %7
%39 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
store double %38, double* %39
%40 = load double, double* %8
%41 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 1
store double %40, double* %41
%42 = load double*, double** %6
%43 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%44 = load double*, double** %6
%45 = call i32 @qd_sub_qd_dd(double* %42, double* %43, double* %44)
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = load double, double* %5
%50 = fdiv double %48, %49
store double %50, double* %11
%51 = load double, double* %11
%52 = load double, double* %5
%53 = call double @dd_two_prod(double %51, double %52, double* %8)
store double %53, double* %7
%54 = load double, double* %7
%55 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
store double %54, double* %55
%56 = load double, double* %8
%57 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 1
store double %56, double* %57
%58 = load double*, double** %6
%59 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%60 = load double*, double** %6
%61 = call i32 @qd_sub_qd_dd(double* %58, double* %59, double* %60)
%62 = load double*, double** %6
%63 = getelementptr inbounds double, double* %62, i64 0
%64 = load double, double* %63
%65 = load double, double* %5
%66 = fdiv double %64, %65
store double %66, double* %12
%67 = call i32 @qd_renorm4(double* %9, double* %10, double* %11, double* %12)
%68 = load double, double* %9
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 0
store double %68, double* %70
%71 = load double, double* %10
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i64 1
store double %71, double* %73
%74 = load double, double* %11
%75 = load double*, double** %6
%76 = getelementptr inbounds double, double* %75, i64 2
store double %74, double* %76
%77 = load double, double* %12
%78 = load double*, double** %6
%79 = getelementptr inbounds double, double* %78, i64 3
store double %77, double* %79
ret void
}

LLVM IR (-O2):
define void @qd_div_qd_d(double* %0, double %1, double* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca [2 x double]
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = bitcast double* %8 to i8*
%15 = bitcast [2 x double]* %9 to i8*
%16 = load double, double* %0
%17 = fdiv double %16, %1
store double %17, double* %5
%18 = call double @dd_two_prod(double %17, double %1, double* %4)
%19 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
store double %18, double* %19
%20 = load double, double* %4
%21 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
store double %20, double* %21
%22 = call i32 @qd_sub_qd_dd(double* %0, double* %19, double* %2)
%23 = load double, double* %2
%24 = fdiv double %23, %1
store double %24, double* %6
%25 = call double @dd_two_prod(double %24, double %1, double* %4)
store double %25, double* %19
%26 = load double, double* %4
store double %26, double* %21
%27 = call i32 @qd_sub_qd_dd(double* %2, double* %19, double* %2)
%28 = load double, double* %2
%29 = fdiv double %28, %1
store double %29, double* %7
%30 = call double @dd_two_prod(double %29, double %1, double* %4)
store double %30, double* %19
%31 = load double, double* %4
store double %31, double* %21
%32 = call i32 @qd_sub_qd_dd(double* %2, double* %19, double* %2)
%33 = load double, double* %2
%34 = fdiv double %33, %1
store double %34, double* %8
%35 = call i32 @qd_renorm4(double* %5, double* %6, double* %7, double* %8)
%36 = load double, double* %5
store double %36, double* %2
%37 = load double, double* %6
%38 = getelementptr inbounds double, double* %2, i64 1
store double %37, double* %38
%39 = load double, double* %7
%40 = getelementptr inbounds double, double* %2, i64 2
store double %39, double* %40
%41 = load double, double* %8
%42 = getelementptr inbounds double, double* %2, i64 3
store double %41, double* %42
ret void
}