#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*/ db_init(int, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
double get_timer();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ random_value();
int /*<<< orphan*/ start_timer();
int /*<<< orphan*/ stderr;
void db_init_test(int show) {
  random_value();
  double cost;
  start_timer();
  cost = get_timer();
  fprintf(stderr, "loading bloom filter......%30s\r", "");
  db_init((1024 * 1024 * 1024), (1));
  fflush(stderr);
  cost = get_timer();
  if (show) {
    printf("+-----------------------+---------------------------+--------------"
           "--------------------+---------------------+\n");
    printf("|loadindex	(load:%d): %.6f sec/op; %.1f reads /sec(estimated) "
           "cost:%.2f(sec)\n",
           5000000, (double)(cost / 10000), (double)(5000000 / cost), cost);
  }
}


x86 assembly (clang, -O0):
<db_init_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1070 <random_value@plt>
mov    $0x0,%al
call   1090 <start_timer@plt>
mov    $0x0,%al
call   1080 <get_timer@plt>
movsd  %xmm0,-0x10(%rbp)
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
lea    0xf41(%rip),%rdx
call   1050 <fprintf@plt>
mov    $0x40000000,%edi
mov    $0x1,%esi
call   1030 <db_init@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x0,%al
call   1080 <get_timer@plt>
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1228 <db_init_test+0xb8>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe09(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdf5(%rip),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
lea    0xe84(%rip),%rdi
mov    $0x4c4b40,%esi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_init_test>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1080 <random_value@plt>
xor    %eax,%eax
call   10a0 <start_timer@plt>
xor    %eax,%eax
call   1090 <get_timer@plt>
mov    0x2e3f(%rip),%rbx
mov    (%rbx),%edi
lea    0xe66(%rip),%rsi
lea    0xecc(%rip),%rdx
call   1060 <fprintf@plt>
mov    $0x40000000,%edi
mov    $0x1,%esi
call   1040 <db_init@plt>
mov    (%rbx),%edi
call   1070 <fflush@plt>
xor    %eax,%eax
call   1090 <get_timer@plt>
test   %ebp,%ebp
je     121e <db_init_test+0x9e>
lea    0xea0(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1030 <puts@plt>
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
divsd  0xe07(%rip),%xmm0
movsd  0xe07(%rip),%xmm1
divsd  %xmm2,%xmm1
lea    0xe24(%rip),%rdi
mov    $0x4c4b40,%esi
mov    $0x3,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"loading bloom filter......%30s\0D\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [112 x i8] c"+-----------------------+---------------------------+----------------------------------+---------------------+\0A\00"
@.str.3 = [78 x i8] c"|loadindex\09(load:%d): %.6f sec/op; %.1f reads /sec(estimated) cost:%.2f(sec)\0A\00"
define void @db_init_test(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = call i32 (...) @random_value()
%5 = call i32 (...) @start_timer()
%6 = call double (...) @get_timer()
store double %6, double* %3
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @db_init(i32 1073741824, i32 1)
%10 = load i32, i32* @stderr
%11 = call i32 @fflush(i32 %10)
%12 = call double (...) @get_timer()
store double %12, double* %3
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str.2, i64 0, i64 0))
%17 = load double, double* %3
%18 = fdiv double %17, 1.000000e+04
%19 = load double, double* %3
%20 = fdiv double 5.000000e+06, %19
%21 = load double, double* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0), i32 5000000, double %18, double %20, double %21)
br label %23
23: ; preds = %15, %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"loading bloom filter......%30s\0D\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.3 = [78 x i8] c"|loadindex\09(load:%d): %.6f sec/op; %.1f reads /sec(estimated) cost:%.2f(sec)\0A\00"
@str = [111 x i8] c"+-----------------------+---------------------------+----------------------------------+---------------------+\00"
define void @db_init_test(i32 %0) {
%2 = tail call i32 (...) @random_value()
%3 = tail call i32 (...) @start_timer()
%4 = tail call double (...) @get_timer()
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @db_init(i32 1073741824, i32 1)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fflush(i32 %8)
%10 = tail call double (...) @get_timer()
%11 = icmp eq i32 %0, 0
br i1 %11, label %17, label %12
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @str, i64 0, i64 0))
%14 = fdiv double %10, 1.000000e+04
%15 = fdiv double 5.000000e+06, %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0), i32 5000000, double %14, double %15, double %10)
br label %17
17: ; preds = %12, %1
ret void
}