#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 const, double, double *);
double dd_two_sum(double, double, double *);
int /*<<< orphan*/ qd_renorm5(double *, double *, double *, double *, double *);
int /*<<< orphan*/ qd_three_sum(double *, double *, double *);
int /*<<< orphan*/ qd_three_sum2(double *, double *, double *);
void qd_mul_d(const double *a, double b, double *c) {
  double p0, p1, p2, p3, q0, q1, q2, s4;
  p0 = dd_two_prod(a[0], b, &q0);
  p1 = dd_two_prod(a[1], b, &q1);
  p2 = dd_two_prod(a[2], b, &q2);
  p3 = a[3] * b;
  c[0] = p0;
  c[1] = dd_two_sum(q0, p1, &c[2]);
  qd_three_sum(&c[2], &q1, &p2);
  qd_three_sum2(&q1, &q2, &p3);
  c[3] = q1;
  s4 = q2 + p2;
  qd_renorm5(&c[0], &c[1], &c[2], &c[3], &s4);
}


x86 assembly (clang, -O0):
<qd_mul_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
movsd  -0x10(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x48(%rbp),%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x50(%rbp),%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
call   1050 <dd_two_sum@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
lea    -0x48(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <qd_three_sum@plt>
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <qd_three_sum2@plt>
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x50(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
add    $0x10,%rdx
mov    -0x18(%rbp),%rcx
add    $0x18,%rcx
lea    -0x58(%rbp),%r8
call   1060 <qd_renorm5@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_mul_d>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r13
movaps %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
lea    0x40(%rsp),%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rbx),%xmm0
lea    0x38(%rsp),%r14
movsd  0x8(%rsp),%xmm1
mov    %r14,%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rbx),%xmm0
lea    0x30(%rsp),%r12
movsd  0x8(%rsp),%xmm1
mov    %r12,%rdi
call   1030 <dd_two_prod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x0(%r13)
movsd  0x40(%rsp),%xmm0
lea    0x10(%r13),%r15
movsd  0x18(%rsp),%xmm1
mov    %r15,%rdi
call   1050 <dd_two_sum@plt>
lea    0x8(%r13),%rbx
movsd  %xmm0,0x8(%r13)
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <qd_three_sum@plt>
lea    0x48(%rsp),%rdx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <qd_three_sum2@plt>
movsd  0x38(%rsp),%xmm0
lea    0x18(%r13),%rcx
movsd  %xmm0,0x18(%r13)
movsd  0x30(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0x28(%rsp),%r8
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <qd_renorm5@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @qd_mul_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 double
%14 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = load double, double* %5
%19 = call double @dd_two_prod(double %17, double %18, double* %11)
store double %19, double* %7
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = load double, double* %5
%24 = call double @dd_two_prod(double %22, double %23, double* %12)
store double %24, double* %8
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = load double, double* %5
%29 = call double @dd_two_prod(double %27, double %28, double* %13)
store double %29, double* %9
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = load double, double* %31
%33 = load double, double* %5
%34 = fmul double %32, %33
store double %34, double* %10
%35 = load double, double* %7
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 0
store double %35, double* %37
%38 = load double, double* %11
%39 = load double, double* %8
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = call double @dd_two_sum(double %38, double %39, double* %41)
%43 = load double*, double** %6
%44 = getelementptr inbounds double, double* %43, i64 1
store double %42, double* %44
%45 = load double*, double** %6
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = call i32 @qd_three_sum(double* %46, double* %12, double* %9)
%48 = call i32 @qd_three_sum2(double* %12, double* %13, double* %10)
%49 = load double, double* %12
%50 = load double*, double** %6
%51 = getelementptr inbounds double, double* %50, i64 3
store double %49, double* %51
%52 = load double, double* %13
%53 = load double, double* %9
%54 = fadd double %52, %53
store double %54, double* %14
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 0
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double*, double** %6
%60 = getelementptr inbounds double, double* %59, i64 2
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 3
%63 = call i32 @qd_renorm5(double* %56, double* %58, double* %60, double* %62, double* %14)
ret void
}

LLVM IR (-O2):
define void @qd_mul_d(double* nocapture %0, double %1, double* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca 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 double* %9 to i8*
%16 = load double, double* %0
%17 = call double @dd_two_prod(double %16, double %1, double* %6)
%18 = getelementptr inbounds double, double* %0, i64 1
%19 = load double, double* %18
%20 = call double @dd_two_prod(double %19, double %1, double* %7)
%21 = getelementptr inbounds double, double* %0, i64 2
%22 = load double, double* %21
%23 = call double @dd_two_prod(double %22, double %1, double* %8)
store double %23, double* %4
%24 = getelementptr inbounds double, double* %0, i64 3
%25 = load double, double* %24
%26 = fmul double %25, %1
store double %26, double* %5
store double %17, double* %2
%27 = load double, double* %6
%28 = getelementptr inbounds double, double* %2, i64 2
%29 = call double @dd_two_sum(double %27, double %20, double* %28)
%30 = getelementptr inbounds double, double* %2, i64 1
store double %29, double* %30
%31 = call i32 @qd_three_sum(double* %28, double* %7, double* %4)
%32 = call i32 @qd_three_sum2(double* %7, double* %8, double* %5)
%33 = load double, double* %7
%34 = getelementptr inbounds double, double* %2, i64 3
store double %33, double* %34
%35 = load double, double* %8
%36 = load double, double* %4
%37 = fadd double %35, %36
store double %37, double* %9
%38 = call i32 @qd_renorm5(double* %2, double* %30, double* %28, double* %34, double* %9)
ret void
}