#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) {
  double q2, A = 0.05421, B = 1.23, C = -0.09873;
  if (pH >= 12) {
    return 3;
  } else if (pH < 2) {
    return 2;
  } else {
    q2 = A * pow(pH, (B * pH) + (C * pow(pH, 2))) + 5.213;
    return q2;
  }
}


x86 assembly (clang, -O0):
<qpH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xef3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     116d <qpH+0x5d>
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1225 <qpH+0x115>
movsd  0xeab(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1192 <qpH+0x82>
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1225 <qpH+0x115>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x58(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe16(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qpH>:
push   %rax
ucomisd 0xeef(%rip),%xmm0
jae    1160 <qpH+0x50>
movsd  0xeed(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1168 <qpH+0x58>
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  0xedf(%rip),%xmm2
movsd  0xedf(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
call   1030 <pow@plt>
mulsd  0xed2(%rip),%xmm0
addsd  0xed2(%rip),%xmm0
pop    %rax
ret
movsd  0xe98(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @qpH(double %0) {
%2 = fcmp ult double %0, 1.200000e+01
br i1 %2, label %3, label %11
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
}