#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 AT_histoOld_log_bin_width(long const, double const *);
double AT_histoOld_lower_bin_limit(long const, double const *,
                                   int /*<<< orphan*/);
long floor(double);
double log(double const);
long AT_histoOld_bin_no(const long number_of_bins, const double bin_centers[],
                        const double value) {
  double lower_limit =
      AT_histoOld_lower_bin_limit(number_of_bins, bin_centers, 0);
  double log_bin_width = AT_histoOld_log_bin_width(number_of_bins, bin_centers);
  return (floor((log(value) - log(lower_limit)) / log_bin_width));
}


x86 assembly (clang, -O0):
<AT_histoOld_bin_no>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1050 <AT_histoOld_lower_bin_limit@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <AT_histoOld_log_bin_width@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
call   1060 <floor@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT_histoOld_bin_no>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edx,%edx
call   1050 <AT_histoOld_lower_bin_limit@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <AT_histoOld_log_bin_width@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1060 <floor@plt>

LLVM IR (-O0):
define i64 @AT_histoOld_bin_no(i64 %0, double* %1, double %2) {
%4 = alloca i64
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i64 %0, i64* %4
store double* %1, double** %5
store double %2, double* %6
%9 = load i64, i64* %4
%10 = load double*, double** %5
%11 = call double @AT_histoOld_lower_bin_limit(i64 %9, double* %10, i32 0)
store double %11, double* %7
%12 = load i64, i64* %4
%13 = load double*, double** %5
%14 = call double @AT_histoOld_log_bin_width(i64 %12, double* %13)
store double %14, double* %8
%15 = load double, double* %6
%16 = call double @log(double %15)
%17 = load double, double* %7
%18 = call double @log(double %17)
%19 = fsub double %16, %18
%20 = load double, double* %8
%21 = fdiv double %19, %20
%22 = call i64 @floor(double %21)
ret i64 %22
}

LLVM IR (-O2):
define i64 @AT_histoOld_bin_no(i64 %0, double* %1, double %2) {
%4 = tail call double @AT_histoOld_lower_bin_limit(i64 %0, double* %1, i32 0)
%5 = tail call double @AT_histoOld_log_bin_width(i64 %0, double* %1)
%6 = tail call double @log(double %2)
%7 = tail call double @log(double %4)
%8 = fsub double %6, %7
%9 = fdiv double %8, %5
%10 = tail call i64 @floor(double %9)
ret i64 %10
}