#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 pow(double, int);
double q4(double d) {
  double q4;
  if (d > 30) {
    q4 = 2;
  } else {
    q4 = 100.9571 - 10.7121 * d + 0.49544 * pow(d, 2) - 0.011167 * pow(d, 3) +
         0.0001 * pow(d, 4);
  }
  return q4;
}


x86 assembly (clang, -O0):
<q4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1146 <q4+0x36>
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e3 <q4+0xd3>
movsd  -0x8(%rbp),%xmm0
movsd  0xecd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x28(%rbp),%xmm1
movsd  0xe94(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe63(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe32(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q4>:
sub    $0x18,%rsp
ucomisd 0xee4(%rip),%xmm0
jbe    112b <q4+0x1b>
movsd  0xf0a(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xed5(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xed1(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0xebb(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
mulsd  0xe9f(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
mulsd  0xe83(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @q4(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp ogt double %4, 3.000000e+01
br i1 %5, label %6, label %7
6: ; preds = %1
store double 2.000000e+00, double* %3
br label %19
7: ; preds = %1
%8 = load double, double* %2
%9 = call double @llvm.fmuladd.f64(double -1.071210e+01, double %8, double 0x40593D41205BC01A)
%10 = load double, double* %2
%11 = call double @pow(double %10, i32 2)
%12 = call double @llvm.fmuladd.f64(double 4.954400e-01, double %11, double %9)
%13 = load double, double* %2
%14 = call double @pow(double %13, i32 3)
%15 = call double @llvm.fmuladd.f64(double -1.116700e-02, double %14, double %12)
%16 = load double, double* %2
%17 = call double @pow(double %16, i32 4)
%18 = call double @llvm.fmuladd.f64(double 1.000000e-04, double %17, double %15)
store double %18, double* %3
br label %19
19: ; preds = %7, %6
%20 = load double, double* %3
ret double %20
}

LLVM IR (-O2):
define double @q4(double %0) {
%2 = fcmp ogt double %0, 3.000000e+01
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double -1.071210e+01, double 0x40593D41205BC01A)
%5 = tail call double @pow(double %0, i32 2)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 4.954400e-01, double %4)
%7 = tail call double @pow(double %0, i32 3)
%8 = tail call double @llvm.fmuladd.f64(double %7, double -1.116700e-02, double %6)
%9 = tail call double @pow(double %0, i32 4)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e-04, double %8)
br label %11
11: ; preds = %1, %3
%12 = phi double [ %10, %3 ], [ 2.000000e+00, %1 ]
ret double %12
}