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


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

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

LLVM IR (-O0):
define double @map_value_backward_log(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %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* %4
%20 = load float, float* %7
%21 = fdiv float %19, %20
%22 = call float @logf(float %21)
%23 = load float, float* %8
%24 = fdiv float %22, %23
%25 = fpext float %24 to double
%26 = fadd double %25, 5.000000e-01
ret double %26
}

LLVM IR (-O2):
define double @map_value_backward_log(float %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 = fdiv float %0, %5
%11 = tail call float @logf(float %10)
%12 = fdiv float %11, %9
%13 = fpext float %12 to double
%14 = fadd double %13, 5.000000e-01
ret double %14
}