#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, double);
double qPH(double PH) {
  if (PH > 12)
    return 3.0;
  if (PH < 2)
    return 2.0;
  double e = 1.23 * PH + -0.09873 * pow(PH, 2);
  return 0.05421 * pow(PH, e) + 5.213;
}


x86 assembly (clang, -O0):
<qPH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1146 <qPH+0x36>
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11dc <qPH+0xcc>
movsd  0xeba(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116b <qPH+0x5b>
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11dc <qPH+0xcc>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe7d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movsd  0xe49(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe45(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qPH>:
push   %rax
ucomisd 0xeef(%rip),%xmm0
jbe    1125 <qPH+0x15>
movsd  0xedd(%rip),%xmm1
jmp    1133 <qPH+0x23>
movsd  0xee3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1139 <qPH+0x29>
movapd %xmm1,%xmm0
pop    %rax
ret
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  0xecf(%rip),%xmm2
movsd  0xecf(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
mulsd  0xec2(%rip),%xmm0
addsd  0xec2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @qPH(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp ogt double %5, 1.200000e+01
br i1 %6, label %7, label %8
7: ; preds = %1
store double 3.000000e+00, double* %2
br label %22
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp olt double %9, 2.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store double 2.000000e+00, double* %2
br label %22
12: ; preds = %8
%13 = load double, double* %3
%14 = load double, double* %3
%15 = call double @pow(double %14, double 2.000000e+00)
%16 = fmul double 0xBFB9465E89225311, %15
%17 = call double @llvm.fmuladd.f64(double 1.230000e+00, double %13, double %16)
store double %17, double* %4
%18 = load double, double* %3
%19 = load double, double* %4
%20 = call double @pow(double %18, double %19)
%21 = call double @llvm.fmuladd.f64(double 5.421000e-02, double %20, double 5.213000e+00)
store double %21, double* %2
br label %22
22: ; preds = %12, %11, %7
%23 = load double, double* %2
ret double %23
}

LLVM IR (-O2):
define double @qPH(double %0) {
%2 = fcmp ogt double %0, 1.200000e+01
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = fcmp olt double %0, 2.000000e+00
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fmul double %0, %0
%7 = fmul double %6, 0xBFB9465E89225311
%8 = tail call double @llvm.fmuladd.f64(double %0, double 1.230000e+00, double %7)
%9 = tail call double @pow(double %0, double %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 5.421000e-02, double 5.213000e+00)
br label %11
11: ; preds = %3, %1, %5
%12 = phi double [ %10, %5 ], [ 3.000000e+00, %1 ], [ 2.000000e+00, %3 ]
ret double %12
}