#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 floor(double const);
int /*<<< orphan*/ qd_renorm4(double *, double *, double *, double *);
void qd_floor(const double *a, double *b) {
  double x0, x1, x2, x3;
  x1 = 0.0;
  x2 = 0.0;
  x3 = 0.0;
  x0 = floor(a[0]);
  if (x0 == a[0]) {
    x1 = floor(a[1]);
    if (x1 == a[1]) {
      x2 = floor(a[2]);
      if (x2 == a[2])
        x3 = floor(a[3]);
    }
    qd_renorm4(&x0, &x1, &x2, &x3);
    b[0] = x0;
    b[1] = x1;
    b[2] = x2;
    b[3] = x3;
  } else
    b[0] = x0;
  b[1] = x1;
  b[2] = x2;
  b[3] = x3;
}


x86 assembly (clang, -O0):
<qd_floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1236 <qd_floor+0x116>
jp     1236 <qd_floor+0x116>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jne    11e5 <qd_floor+0xc5>
jp     11e5 <qd_floor+0xc5>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jne    11e0 <qd_floor+0xc0>
jp     11e0 <qd_floor+0xc0>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    11e5 <qd_floor+0xc5>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <qd_renorm4@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    1243 <qd_floor+0x123>
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qd_floor>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <floor@plt>
movsd  %xmm0,0x20(%rsp)
ucomisd (%rsp),%xmm0
jne    11e8 <qd_floor+0xc8>
jp     11e8 <qd_floor+0xc8>
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <floor@plt>
movsd  %xmm0,0x18(%rsp)
ucomisd (%rsp),%xmm0
jne    11b0 <qd_floor+0x90>
jp     11b0 <qd_floor+0x90>
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <floor@plt>
movsd  %xmm0,0x10(%rsp)
ucomisd (%rsp),%xmm0
jne    11b0 <qd_floor+0x90>
jp     11b0 <qd_floor+0x90>
movsd  0x18(%rbx),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <qd_renorm4@plt>
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
jmp    11f7 <qd_floor+0xd7>
movsd  %xmm0,(%r14)
xorpd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  %xmm2,0x8(%r14)
movsd  %xmm1,0x10(%r14)
movsd  %xmm0,0x18(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @qd_floor(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call double @llvm.floor.f64(double %11)
store double %12, double* %5
%13 = load double, double* %5
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = fcmp oeq double %13, %16
br i1 %17, label %18, label %58
18: ; preds = %2
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = call double @llvm.floor.f64(double %21)
store double %22, double* %6
%23 = load double, double* %6
%24 = load double*, double** %3
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fcmp oeq double %23, %26
br i1 %27, label %28, label %44
28: ; preds = %18
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = call double @llvm.floor.f64(double %31)
store double %32, double* %7
%33 = load double, double* %7
%34 = load double*, double** %3
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
%37 = fcmp oeq double %33, %36
br i1 %37, label %38, label %43
38: ; preds = %28
%39 = load double*, double** %3
%40 = getelementptr inbounds double, double* %39, i64 3
%41 = load double, double* %40
%42 = call double @llvm.floor.f64(double %41)
store double %42, double* %8
br label %43
43: ; preds = %38, %28
br label %44
44: ; preds = %43, %18
%45 = call i32 @qd_renorm4(double* %5, double* %6, double* %7, double* %8)
%46 = load double, double* %5
%47 = load double*, double** %4
%48 = getelementptr inbounds double, double* %47, i64 0
store double %46, double* %48
%49 = load double, double* %6
%50 = load double*, double** %4
%51 = getelementptr inbounds double, double* %50, i64 1
store double %49, double* %51
%52 = load double, double* %7
%53 = load double*, double** %4
%54 = getelementptr inbounds double, double* %53, i64 2
store double %52, double* %54
%55 = load double, double* %8
%56 = load double*, double** %4
%57 = getelementptr inbounds double, double* %56, i64 3
store double %55, double* %57
br label %62
58: ; preds = %2
%59 = load double, double* %5
%60 = load double*, double** %4
%61 = getelementptr inbounds double, double* %60, i64 0
store double %59, double* %61
br label %62
62: ; preds = %58, %44
%63 = load double, double* %6
%64 = load double*, double** %4
%65 = getelementptr inbounds double, double* %64, i64 1
store double %63, double* %65
%66 = load double, double* %7
%67 = load double*, double** %4
%68 = getelementptr inbounds double, double* %67, i64 2
store double %66, double* %68
%69 = load double, double* %8
%70 = load double*, double** %4
%71 = getelementptr inbounds double, double* %70, i64 3
store double %69, double* %71
ret void
}

LLVM IR (-O2):
define void @qd_floor(double* nocapture %0, double* nocapture writeonly %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%11 = load double, double* %0
%12 = tail call double @llvm.floor.f64(double %11)
store double %12, double* %3
%13 = fcmp oeq double %12, %11
br i1 %13, label %14, label %34
14: ; preds = %2
%15 = getelementptr inbounds double, double* %0, i64 1
%16 = load double, double* %15
%17 = tail call double @llvm.floor.f64(double %16)
store double %17, double* %4
%18 = fcmp oeq double %17, %16
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = getelementptr inbounds double, double* %0, i64 2
%21 = load double, double* %20
%22 = tail call double @llvm.floor.f64(double %21)
store double %22, double* %5
%23 = fcmp oeq double %22, %21
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = getelementptr inbounds double, double* %0, i64 3
%26 = load double, double* %25
%27 = tail call double @llvm.floor.f64(double %26)
store double %27, double* %6
br label %28
28: ; preds = %19, %24, %14
%29 = call i32 @qd_renorm4(double* %3, double* %4, double* %5, double* %6)
%30 = load double, double* %3
store double %30, double* %1
%31 = load double, double* %4
%32 = load double, double* %5
%33 = load double, double* %6
br label %35
34: ; preds = %2
store double %12, double* %1
br label %35
35: ; preds = %34, %28
%36 = phi double [ 0.000000e+00, %34 ], [ %33, %28 ]
%37 = phi double [ 0.000000e+00, %34 ], [ %32, %28 ]
%38 = phi double [ 0.000000e+00, %34 ], [ %31, %28 ]
%39 = getelementptr inbounds double, double* %1, i64 1
store double %38, double* %39
%40 = getelementptr inbounds double, double* %1, i64 2
store double %37, double* %40
%41 = getelementptr inbounds double, double* %1, i64 3
store double %36, double* %41
ret void
}