#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*/ exp(float);
scalar_t__ floor(int /*<<< orphan*/);
scalar_t__ log(float);
int /*<<< orphan*/ pow(float, int);
int lookup1_values(int entries, int dim) {
  int r = (int)floor(exp((float)log((float)entries) / dim));
  if ((int)floor(pow((float)r + 1, dim)) <= entries)
    ++r;
  ;
  ;
  return r;
}


x86 assembly (clang, -O0):
<lookup1_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
call   1040 <log@plt>
cvtsi2ss %rax,%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <exp@plt>
mov    %eax,%edi
call   1060 <floor@plt>
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  0xe7e(%rip),%xmm1
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%edi
call   1050 <pow@plt>
mov    %eax,%edi
call   1060 <floor@plt>
cmp    -0x4(%rbp),%eax
jg     11a7 <lookup1_values+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup1_values>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
cvtsi2ss %edi,%xmm0
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtsi2ss %ebp,%xmm1
divss  %xmm1,%xmm0
call   1030 <exp@plt>
mov    %eax,%edi
call   1060 <floor@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addss  0xe80(%rip),%xmm0
mov    %ebp,%edi
call   1050 <pow@plt>
mov    %eax,%edi
call   1060 <floor@plt>
xor    %ecx,%ecx
cmp    %r14d,%eax
setle  %cl
add    %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @lookup1_values(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to float
%8 = call i64 @log(float %7)
%9 = sitofp i64 %8 to float
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
%12 = fdiv float %9, %11
%13 = call i32 @exp(float %12)
%14 = call i64 @floor(i32 %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = sitofp i32 %16 to float
%18 = fadd float %17, 1.000000e+00
%19 = load i32, i32* %4
%20 = call i32 @pow(float %18, i32 %19)
%21 = call i64 @floor(i32 %20)
%22 = trunc i64 %21 to i32
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %2
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %28
28: ; preds = %25, %2
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @lookup1_values(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = tail call i64 @log(float %3)
%5 = sitofp i64 %4 to float
%6 = sitofp i32 %1 to float
%7 = fdiv float %5, %6
%8 = tail call i32 @exp(float %7)
%9 = tail call i64 @floor(i32 %8)
%10 = trunc i64 %9 to i32
%11 = sitofp i32 %10 to float
%12 = fadd float %11, 1.000000e+00
%13 = tail call i32 @pow(float %12, i32 %1)
%14 = tail call i64 @floor(i32 %13)
%15 = trunc i64 %14 to i32
%16 = icmp sle i32 %15, %0
%17 = zext i1 %16 to i32
%18 = add nsw i32 %17, %10
ret i32 %18
}