#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 */
float expf(float);
double log(float);
float sqrtf(float);
float map_value_forward_log(double v, float min, float max) {
  float sr, k;
  sr = sqrtf(min * max);
  k = 2.0 * log(max / sr);
  return sr * expf(k * (v - 0.5));
}


x86 assembly (clang, -O0):
<map_value_forward_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
call   1040 <sqrtf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe5e(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <expf@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_value_forward_log>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
mulss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jb     114f <map_value_forward_log+0x1f>
xorps  %xmm0,%xmm0
sqrtss %xmm1,%xmm0
jmp    1163 <map_value_forward_log+0x33>
movaps %xmm1,%xmm0
movss  %xmm2,0xc(%rsp)
call   1040 <sqrtf@plt>
movss  0xc(%rsp),%xmm2
movss  %xmm0,0xc(%rsp)
divss  %xmm0,%xmm2
movaps %xmm2,%xmm0
call   1050 <log@plt>
addsd  %xmm0,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  0xe75(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
call   1030 <expf@plt>
mulss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @map_value_forward_log(double %0, float %1, float %2) {
%4 = alloca double
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store double %0, double* %4
store float %1, float* %5
store float %2, float* %6
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fmul float %9, %10
%12 = call float @sqrtf(float %11)
store float %12, float* %7
%13 = load float, float* %6
%14 = load float, float* %7
%15 = fdiv float %13, %14
%16 = call double @log(float %15)
%17 = fmul double 2.000000e+00, %16
%18 = fptrunc double %17 to float
store float %18, float* %8
%19 = load float, float* %7
%20 = load float, float* %8
%21 = fpext float %20 to double
%22 = load double, double* %4
%23 = fsub double %22, 5.000000e-01
%24 = fmul double %21, %23
%25 = fptrunc double %24 to float
%26 = call float @expf(float %25)
%27 = fmul float %19, %26
ret float %27
}

LLVM IR (-O2):
define float @map_value_forward_log(double %0, float %1, float %2) {
%4 = fmul float %1, %2
%5 = tail call float @sqrtf(float %4)
%6 = fdiv float %2, %5
%7 = tail call double @log(float %6)
%8 = fmul double %7, 2.000000e+00
%9 = fptrunc double %8 to float
%10 = fpext float %9 to double
%11 = fadd double %0, -5.000000e-01
%12 = fmul double %11, %10
%13 = fptrunc double %12 to float
%14 = tail call float @expf(float %13)
%15 = fmul float %5, %14
ret float %15
}