#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*/ qd_mul_d(double *, double, double *);
int /*<<< orphan*/ qd_renorm5(double *, double *, double *, double *, double *);
int /*<<< orphan*/ qd_sub(double const *, double *, double *);
void qd_div_qd_dd(const double *a, const double *b, double *c) {
  double q0, q1, q2, q3, q4;
  double qd_b[4];
  double acc[4];
  double r[4];
  qd_b[0] = b[0];
  qd_b[1] = b[1];
  qd_b[2] = 0.0;
  qd_b[3] = 0.0;
  q0 = a[0] / b[0];
  qd_mul_d(qd_b, q0, acc);
  qd_sub(a, acc, r);
  q1 = r[0] / b[0];
  qd_mul_d(qd_b, q1, acc);
  qd_sub(r, acc, r);
  q2 = r[0] / b[0];
  qd_mul_d(qd_b, q2, acc);
  qd_sub(r, acc, r);
  q3 = r[0] / b[0];
  qd_mul_d(qd_b, q3, acc);
  qd_sub(r, acc, r);
  q4 = r[0] / b[0];
  qd_renorm5(&q0, &q1, &q2, &q3, &q4);
  c[0] = q0;
  c[1] = q1;
  c[2] = q2;
  c[3] = q3;
}


x86 assembly (clang, -O0):
<qd_div_qd_dd>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
lea    -0x80(%rbp),%rsi
call   1050 <qd_mul_d@plt>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1030 <qd_sub@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x60(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
lea    -0x80(%rbp),%rsi
call   1050 <qd_mul_d@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1030 <qd_sub@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x60(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
lea    -0x80(%rbp),%rsi
call   1050 <qd_mul_d@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1030 <qd_sub@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x60(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
lea    -0x80(%rbp),%rsi
call   1050 <qd_mul_d@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1030 <qd_sub@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x40(%rbp),%r8
call   1040 <qd_renorm5@plt>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_div_qd_dd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rbp
movupd (%rsi),%xmm1
movapd %xmm1,0x50(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movsd  (%rdi),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x50(%rsp),%r12
lea    0x70(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <qd_mul_d@plt>
lea    0x30(%rsp),%r13
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <qd_sub@plt>
movsd  0x30(%rsp),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <qd_mul_d@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <qd_sub@plt>
movsd  0x30(%rsp),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <qd_mul_d@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <qd_sub@plt>
movsd  0x30(%rsp),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <qd_mul_d@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <qd_sub@plt>
movsd  0x30(%rsp),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x28(%rsp),%r8
call   1040 <qd_renorm5@plt>
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%r14)
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @qd_div_qd_dd(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 [4 x double]
%13 = alloca [4 x double]
%14 = alloca [4 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
store double %17, double* %18
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 1
store double %21, double* %22
%23 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 2
store double 0.000000e+00, double* %23
%24 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 3
store double 0.000000e+00, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = fdiv double %27, %30
store double %31, double* %7
%32 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%33 = load double, double* %7
%34 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%35 = call i32 @qd_mul_d(double* %32, double %33, double* %34)
%36 = load double*, double** %4
%37 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%38 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%39 = call i32 @qd_sub(double* %36, double* %37, double* %38)
%40 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%41 = load double, double* %40
%42 = load double*, double** %5
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
%45 = fdiv double %41, %44
store double %45, double* %8
%46 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%47 = load double, double* %8
%48 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%49 = call i32 @qd_mul_d(double* %46, double %47, double* %48)
%50 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%51 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%52 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%53 = call i32 @qd_sub(double* %50, double* %51, double* %52)
%54 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%55 = load double, double* %54
%56 = load double*, double** %5
%57 = getelementptr inbounds double, double* %56, i64 0
%58 = load double, double* %57
%59 = fdiv double %55, %58
store double %59, double* %9
%60 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%61 = load double, double* %9
%62 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%63 = call i32 @qd_mul_d(double* %60, double %61, double* %62)
%64 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%65 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%66 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%67 = call i32 @qd_sub(double* %64, double* %65, double* %66)
%68 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%69 = load double, double* %68
%70 = load double*, double** %5
%71 = getelementptr inbounds double, double* %70, i64 0
%72 = load double, double* %71
%73 = fdiv double %69, %72
store double %73, double* %10
%74 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%75 = load double, double* %10
%76 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%77 = call i32 @qd_mul_d(double* %74, double %75, double* %76)
%78 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%79 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%80 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%81 = call i32 @qd_sub(double* %78, double* %79, double* %80)
%82 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%83 = load double, double* %82
%84 = load double*, double** %5
%85 = getelementptr inbounds double, double* %84, i64 0
%86 = load double, double* %85
%87 = fdiv double %83, %86
store double %87, double* %11
%88 = call i32 @qd_renorm5(double* %7, double* %8, double* %9, double* %10, double* %11)
%89 = load double, double* %7
%90 = load double*, double** %6
%91 = getelementptr inbounds double, double* %90, i64 0
store double %89, double* %91
%92 = load double, double* %8
%93 = load double*, double** %6
%94 = getelementptr inbounds double, double* %93, i64 1
store double %92, double* %94
%95 = load double, double* %9
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 2
store double %95, double* %97
%98 = load double, double* %10
%99 = load double*, double** %6
%100 = getelementptr inbounds double, double* %99, i64 3
store double %98, double* %100
ret void
}

LLVM IR (-O2):
define void @qd_div_qd_dd(double* %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca [4 x double]
%10 = alloca [4 x double]
%11 = alloca [4 x double]
%12 = bitcast double* %4 to i8*
%13 = bitcast double* %5 to i8*
%14 = bitcast double* %6 to i8*
%15 = bitcast double* %7 to i8*
%16 = bitcast double* %8 to i8*
%17 = bitcast [4 x double]* %9 to i8*
%18 = bitcast [4 x double]* %10 to i8*
%19 = bitcast [4 x double]* %11 to i8*
%20 = getelementptr inbounds [4 x double], [4 x double]* %9, i64 0, i64 0
%21 = bitcast double* %1 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = bitcast [4 x double]* %9 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = getelementptr inbounds [4 x double], [4 x double]* %9, i64 0, i64 2
%25 = bitcast double* %24 to i8*
%26 = load double, double* %0
%27 = extractelement <2 x double> %22, i64 0
%28 = fdiv double %26, %27
store double %28, double* %4
%29 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%30 = call i32 @qd_mul_d(double* %20, double %28, double* %29)
%31 = getelementptr inbounds [4 x double], [4 x double]* %11, i64 0, i64 0
%32 = call i32 @qd_sub(double* %0, double* %29, double* %31)
%33 = load double, double* %31
%34 = load double, double* %1
%35 = fdiv double %33, %34
store double %35, double* %5
%36 = call i32 @qd_mul_d(double* %20, double %35, double* %29)
%37 = call i32 @qd_sub(double* %31, double* %29, double* %31)
%38 = load double, double* %31
%39 = load double, double* %1
%40 = fdiv double %38, %39
store double %40, double* %6
%41 = call i32 @qd_mul_d(double* %20, double %40, double* %29)
%42 = call i32 @qd_sub(double* %31, double* %29, double* %31)
%43 = load double, double* %31
%44 = load double, double* %1
%45 = fdiv double %43, %44
store double %45, double* %7
%46 = call i32 @qd_mul_d(double* %20, double %45, double* %29)
%47 = call i32 @qd_sub(double* %31, double* %29, double* %31)
%48 = load double, double* %31
%49 = load double, double* %1
%50 = fdiv double %48, %49
store double %50, double* %8
%51 = call i32 @qd_renorm5(double* %4, double* %5, double* %6, double* %7, double* %8)
%52 = load double, double* %4
store double %52, double* %2
%53 = load double, double* %5
%54 = getelementptr inbounds double, double* %2, i64 1
store double %53, double* %54
%55 = load double, double* %6
%56 = getelementptr inbounds double, double* %2, i64 2
store double %55, double* %56
%57 = load double, double* %7
%58 = getelementptr inbounds double, double* %2, i64 3
store double %57, double* %58
ret void
}