#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 rq_interpolate_log_linear(double x, double x1, double y1, double x2,
                                 double y2) {
  if (!(x1 < x2 + 0.000000001 && x1 > x2 - 0.000000001)) {
    double alpha = (x - x1) / (x2 - x1);
    double y = pow(y1, (1.0 - alpha)) * pow(y2, (alpha));
    return y;
  } else {
    return y1;
  }
}


x86 assembly (clang, -O0):
<rq_interpolate_log_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xec2(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    116d <rq_interpolate_log_linear+0x5d>
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xea1(%rip),%xmm2
subsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
ja     11d5 <rq_interpolate_log_linear+0xc5>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
subsd  -0x38(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11df <rq_interpolate_log_linear+0xcf>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_interpolate_log_linear>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm5
addsd  %xmm3,%xmm5
ucomisd %xmm1,%xmm5
jbe    1138 <rq_interpolate_log_linear+0x28>
movsd  0xeda(%rip),%xmm5
addsd  %xmm3,%xmm5
ucomisd %xmm5,%xmm1
ja     1183 <rq_interpolate_log_linear+0x73>
subsd  %xmm1,%xmm0
subsd  %xmm1,%xmm3
divsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xebe(%rip),%xmm1
subsd  %xmm0,%xmm1
movaps %xmm2,%xmm0
movsd  %xmm4,(%rsp)
call   1030 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
movapd %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rq_interpolate_log_linear(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
%14 = load double, double* %8
%15 = load double, double* %10
%16 = fadd double %15, 1.000000e-09
%17 = fcmp olt double %14, %16
br i1 %17, label %18, label %23
18: ; preds = %5
%19 = load double, double* %8
%20 = load double, double* %10
%21 = fsub double %20, 1.000000e-09
%22 = fcmp ogt double %19, %21
br i1 %22, label %40, label %23
23: ; preds = %18, %5
%24 = load double, double* %7
%25 = load double, double* %8
%26 = fsub double %24, %25
%27 = load double, double* %10
%28 = load double, double* %8
%29 = fsub double %27, %28
%30 = fdiv double %26, %29
store double %30, double* %12
%31 = load double, double* %9
%32 = load double, double* %12
%33 = fsub double 1.000000e+00, %32
%34 = call double @pow(double %31, double %33)
%35 = load double, double* %11
%36 = load double, double* %12
%37 = call double @pow(double %35, double %36)
%38 = fmul double %34, %37
store double %38, double* %13
%39 = load double, double* %13
store double %39, double* %6
br label %42
40: ; preds = %18
%41 = load double, double* %9
store double %41, double* %6
br label %42
42: ; preds = %40, %23
%43 = load double, double* %6
ret double %43
}

LLVM IR (-O2):
define double @rq_interpolate_log_linear(double %0, double %1, double %2, double %3, double %4) {
%6 = fadd double %3, 1.000000e-09
%7 = fcmp ogt double %6, %1
%8 = fadd double %3, -1.000000e-09
%9 = fcmp olt double %8, %1
%10 = and i1 %7, %9
br i1 %10, label %19, label %11
11: ; preds = %5
%12 = fsub double %0, %1
%13 = fsub double %3, %1
%14 = fdiv double %12, %13
%15 = fsub double 1.000000e+00, %14
%16 = tail call double @pow(double %2, double %15)
%17 = tail call double @pow(double %4, double %14)
%18 = fmul double %16, %17
br label %19
19: ; preds = %5, %11
%20 = phi double [ %18, %11 ], [ %2, %5 ]
ret double %20
}