#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*/ ll_delete(int, int, int);
int /*<<< orphan*/ ll_freetable(int);
int /*<<< orphan*/ ll_insert(int, int, int, int *);
int ll_newtable();
int /*<<< orphan*/ ll_search(int, int *, int, int *, int *);
int /*<<< orphan*/ m_time(float *);
scalar_t__ sqrt(double);
float ll_EstimateS(int datasize) {
  int tid;
  float t;
  int x = (int)sqrt((double)datasize), e = 5;
  float et;
  tid = ll_newtable();
  ll_insert(tid, x, x, &e);
  m_time(NULL);
  ll_search(tid, &e, sizeof(int), &x, &x);
  m_time(&et);
  t = (float)et;
  ll_delete(tid, x, x);
  ll_freetable(tid);
  return t;
}


x86 assembly (clang, -O0):
<ll_EstimateS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    $0x0,%al
call   1080 <ll_newtable@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x14(%rbp),%rcx
call   1090 <ll_insert@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <m_time@plt>
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
lea    -0x10(%rbp),%r8
mov    %r8,%rcx
call   1050 <ll_search@plt>
lea    -0x18(%rbp),%rdi
call   1040 <m_time@plt>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <ll_delete@plt>
mov    -0x8(%rbp),%edi
call   1030 <ll_freetable@plt>
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ll_EstimateS>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cvtsi2sd %edi,%xmm0
call   1070 <sqrt@plt>
mov    %rax,%rbx
mov    %ebx,(%rsp)
movl   $0x5,0xc(%rsp)
xor    %eax,%eax
call   1080 <ll_newtable@plt>
mov    %eax,%ebp
lea    0xc(%rsp),%r14
mov    %eax,%edi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1090 <ll_insert@plt>
xor    %edi,%edi
call   1040 <m_time@plt>
mov    %rsp,%rcx
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x4,%edx
mov    %rcx,%r8
call   1050 <ll_search@plt>
lea    0x8(%rsp),%rdi
call   1040 <m_time@plt>
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    (%rsp),%edx
mov    %ebp,%edi
mov    %edx,%esi
call   1060 <ll_delete@plt>
mov    %ebp,%edi
call   1030 <ll_freetable@plt>
movss  0x4(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define float @ll_EstimateS(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = call i64 @sqrt(double %9)
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
store i32 5, i32* %6
%12 = call i32 (...) @ll_newtable()
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = load i32, i32* %5
%16 = call i32 @ll_insert(i32 %13, i32 %14, i32 %15, i32* %6)
%17 = call i32 @m_time(float* null)
%18 = load i32, i32* %3
%19 = call i32 @ll_search(i32 %18, i32* %6, i32 4, i32* %5, i32* %5)
%20 = call i32 @m_time(float* %7)
%21 = load float, float* %7
store float %21, float* %4
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = load i32, i32* %5
%25 = call i32 @ll_delete(i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %3
%27 = call i32 @ll_freetable(i32 %26)
%28 = load float, float* %4
ret float %28
}

LLVM IR (-O2):
define float @ll_EstimateS(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %2 to i8*
%6 = sitofp i32 %0 to double
%7 = tail call i64 @sqrt(double %6)
%8 = trunc i64 %7 to i32
store i32 %8, i32* %2
%9 = bitcast i32* %3 to i8*
store i32 5, i32* %3
%10 = bitcast float* %4 to i8*
%11 = tail call i32 (...) @ll_newtable()
%12 = call i32 @ll_insert(i32 %11, i32 %8, i32 %8, i32* %3)
%13 = call i32 @m_time(float* null)
%14 = call i32 @ll_search(i32 %11, i32* %3, i32 4, i32* %2, i32* %2)
%15 = call i32 @m_time(float* %4)
%16 = load float, float* %4
%17 = load i32, i32* %2
%18 = call i32 @ll_delete(i32 %11, i32 %17, i32 %17)
%19 = call i32 @ll_freetable(i32 %11)
ret float %16
}