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


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

x86 assembly (clang, -O2):
<q2>:
push   %rax
ucomisd 0xeef(%rip),%xmm0
jae    1160 <q2+0x50>
movsd  0xeed(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1168 <q2+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 @q2(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double 5.421000e-02, double* %4
store double 1.230000e+00, double* %5
store double 0xBFB9465E89225311, double* %6
%7 = load double, double* %3
%8 = fcmp oge double %7, 1.200000e+01
br i1 %8, label %9, label %10
9: ; preds = %1
store double 3.000000e+00, double* %2
br label %27
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp ole double %11, 2.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 2.000000e+00, double* %2
br label %27
14: ; preds = %10
%15 = load double, double* %4
%16 = load double, double* %3
%17 = load double, double* %5
%18 = load double, double* %3
%19 = load double, double* %6
%20 = load double, double* %3
%21 = call double @pow(double %20, double 2.000000e+00)
%22 = fmul double %19, %21
%23 = call double @llvm.fmuladd.f64(double %17, double %18, double %22)
%24 = call double @pow(double %16, double %23)
%25 = call double @llvm.fmuladd.f64(double %15, double %24, double 5.213000e+00)
store double %25, double* %3
%26 = load double, double* %3
store double %26, double* %2
br label %27
27: ; preds = %14, %13, %9
%28 = load double, double* %2
ret double %28
}

LLVM IR (-O2):
define double @q2(double %0) {
%2 = fcmp ult double %0, 1.200000e+01
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = fcmp ugt double %0, 2.000000e+00
br i1 %4, label %5, label %11
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
}