#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_quick_two_sum(double, double, double *);
double floor(double const);
void dd_floor(const double *a, double *b) {
  double hi = floor(a[0]);
  double lo = 0.0;
  if (hi == a[0]) {
    lo = floor(a[1]);
    b[0] = dd_quick_two_sum(hi, lo, &b[1]);
  } else {
    b[0] = hi;
    b[1] = lo;
  }
}


x86 assembly (clang, -O0):
<dd_floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jne    119a <dd_floor+0x7a>
jp     119a <dd_floor+0x7a>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1030 <dd_quick_two_sum@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11b5 <dd_floor+0x95>
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_floor>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <floor@plt>
ucomisd (%rsp),%xmm0
jne    1168 <dd_floor+0x48>
jp     1168 <dd_floor+0x48>
movsd  %xmm0,(%rsp)
movsd  0x8(%rbx),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
lea    0x8(%r14),%rdi
movsd  (%rsp),%xmm0
call   1030 <dd_quick_two_sum@plt>
movsd  %xmm0,(%r14)
jmp    1175 <dd_floor+0x55>
movsd  %xmm0,(%r14)
movq   $0x0,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dd_floor(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = call double @llvm.floor.f64(double %9)
store double %10, double* %5
store double 0.000000e+00, double* %6
%11 = load double, double* %5
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = fcmp oeq double %11, %14
br i1 %15, label %16, label %28
16: ; preds = %2
%17 = load double*, double** %3
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = call double @llvm.floor.f64(double %19)
store double %20, double* %6
%21 = load double, double* %5
%22 = load double, double* %6
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = call double @dd_quick_two_sum(double %21, double %22, double* %24)
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 0
store double %25, double* %27
br label %35
28: ; preds = %2
%29 = load double, double* %5
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 0
store double %29, double* %31
%32 = load double, double* %6
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 1
store double %32, double* %34
br label %35
35: ; preds = %28, %16
ret void
}

LLVM IR (-O2):
define void @dd_floor(double* nocapture %0, double* %1) {
%3 = load double, double* %0
%4 = tail call double @llvm.floor.f64(double %3)
%5 = fcmp oeq double %4, %3
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = tail call double @llvm.floor.f64(double %8)
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = tail call double @dd_quick_two_sum(double %4, double %9, double* %10)
store double %11, double* %1
br label %14
12: ; preds = %2
store double %4, double* %1
%13 = getelementptr inbounds double, double* %1, i64 1
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %12, %6
ret void
}