#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 */
int /*<<< orphan*/ assert(int);
double pow(double, double);
double position_to_logscale(double pos, double lower, double upper) {
  assert(upper > lower && lower * upper > 0);
  assert(pos >= 0.0 && pos <= 1.0);
  return lower * pow(upper / lower, pos);
}


x86 assembly (clang, -O0):
<position_to_logscale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x19(%rbp)
jbe    1163 <position_to_logscale+0x43>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x1a(%rbp)
jb     119a <position_to_logscale+0x7a>
movsd  0xe71(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
setae  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<position_to_logscale>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
ucomisd %xmm1,%xmm2
seta   %al
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movsd  (%rsp),%xmm1
ucomisd 0xea2(%rip),%xmm1
setae  %al
movsd  0xe8f(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @position_to_logscale(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = load double, double* %5
%9 = fcmp ogt double %7, %8
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fmul double %11, %12
%14 = fcmp ogt double %13, 0.000000e+00
br label %15
15: ; preds = %10, %3
%16 = phi i1 [ false, %3 ], [ %14, %10 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load double, double* %4
%20 = fcmp oge double %19, 0.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load double, double* %4
%23 = fcmp ole double %22, 1.000000e+00
br label %24
24: ; preds = %21, %15
%25 = phi i1 [ false, %15 ], [ %23, %21 ]
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load double, double* %5
%29 = load double, double* %6
%30 = load double, double* %5
%31 = fdiv double %29, %30
%32 = load double, double* %4
%33 = call double @pow(double %31, double %32)
%34 = fmul double %28, %33
ret double %34
}

LLVM IR (-O2):
define double @position_to_logscale(double %0, double %1, double %2) {
%4 = fcmp ogt double %2, %1
%5 = fmul double %1, %2
%6 = fcmp ogt double %5, 0.000000e+00
%7 = and i1 %4, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = fcmp oge double %0, 0.000000e+00
%11 = fcmp ole double %0, 1.000000e+00
%12 = and i1 %10, %11
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = fdiv double %2, %1
%16 = tail call double @pow(double %15, double %0)
%17 = fmul double %16, %1
ret double %17
}