#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*/ td_fast_renorm(double, double, double, double, double *,
                                  double *, double *);
int /*<<< orphan*/ td_mul_td_d(double const *, double, double *);
int /*<<< orphan*/ td_sub(double const *, double *, double *);
void td_div(const double *a, const double *b, double *c) {
  double acc[3];
  double q0, q1, q2, q3;
  q0 = a[0] / b[0];
  td_mul_td_d(b, q0, acc);
  td_sub(a, acc, c);
  q1 = c[0] / b[0];
  td_mul_td_d(b, q1, acc);
  td_sub(c, acc, c);
  q2 = c[0] / b[0];
  td_mul_td_d(b, q2, acc);
  td_sub(c, acc, c);
  q3 = c[0] / b[0];
  td_fast_renorm(q0, q1, q2, q3, &c[0], &c[1], &c[2]);
}


x86 assembly (clang, -O0):
<td_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
lea    -0x30(%rbp),%rsi
call   1050 <td_mul_td_d@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <td_sub@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
lea    -0x30(%rbp),%rsi
call   1050 <td_mul_td_d@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <td_sub@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x48(%rbp),%xmm0
lea    -0x30(%rbp),%rsi
call   1050 <td_mul_td_d@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <td_sub@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
add    $0x10,%rdx
call   1040 <td_fast_renorm@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<td_div>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r12
movsd  (%rdi),%xmm0
divsd  (%rsi),%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0x20(%rsp),%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1050 <td_mul_td_d@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <td_sub@plt>
movsd  (%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <td_mul_td_d@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <td_sub@plt>
movsd  (%rbx),%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <td_mul_td_d@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <td_sub@plt>
movsd  (%rbx),%xmm3
divsd  (%r14),%xmm3
lea    0x8(%rbx),%rsi
lea    0x10(%rbx),%rdx
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    %rbx,%rdi
call   1040 <td_fast_renorm@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @td_div(double* %0, double* %1, double* %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = load double, double* %0
%7 = load double, double* %1
%8 = fdiv double %6, %7
%9 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%10 = call i32 @td_mul_td_d(double* %1, double %8, double* %9)
%11 = call i32 @td_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 @td_mul_td_d(double* %1, double %14, double* %9)
%16 = call i32 @td_sub(double* %2, double* %9, double* %2)
%17 = load double, double* %2
%18 = load double, double* %1
%19 = fdiv double %17, %18
%20 = call i32 @td_mul_td_d(double* %1, double %19, double* %9)
%21 = call i32 @td_sub(double* %2, double* %9, double* %2)
%22 = load double, double* %2
%23 = load double, double* %1
%24 = fdiv double %22, %23
%25 = getelementptr inbounds double, double* %2, i64 1
%26 = getelementptr inbounds double, double* %2, i64 2
%27 = call i32 @td_fast_renorm(double %8, double %14, double %19, double %24, double* %2, double* %25, double* %26)
ret void
}