#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*/ add_random(int, double, int);
int atoi(char *);
int /*<<< orphan*/ basic();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perf_loop(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  (void)printf("testing libbloom...\n");
  if (argc == 4 && !strncmp(argv[1], "-p", 2)) {
    perf_loop(atoi(argv[2]), atoi(argv[3]));
    exit(0);
  }
  basic();
  add_random(100, 0.001, 300);
  int i;
  for (i = 0; i < 10; i++) {
    add_random(1000000, 0.001, 1000000);
  }
  perf_loop(10000000, 10000000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe7b(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
jne    11ec <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    11ec <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1050 <perf_loop@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    $0x0,%al
call   1090 <basic@plt>
mov    $0x64,%edi
movsd  0xe00(%rip),%xmm0
mov    $0x12c,%esi
call   1030 <add_random@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    123d <main+0xcd>
mov    $0xf4240,%esi
movsd  0xdd8(%rip),%xmm0
mov    %esi,%edi
call   1030 <add_random@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <main+0xa1>
mov    $0x989680,%esi
mov    %esi,%edi
call   1050 <perf_loop@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe8c(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x4,%ebp
jne    11a6 <main+0x36>
mov    0x8(%rbx),%rdi
lea    0xe74(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     12c2 <main+0x152>
xor    %eax,%eax
call   1090 <basic@plt>
movsd  0xe4b(%rip),%xmm0
mov    $0x64,%edi
mov    $0x12c,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xe2f(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xe18(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xe01(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xdea(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xdd3(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xdbc(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xda5(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xd8e(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xd77(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0xf4240,%edi
movsd  0xd60(%rip),%xmm0
mov    $0xf4240,%esi
call   1030 <add_random@plt>
mov    $0x989680,%edi
mov    $0x989680,%esi
call   1060 <perf_loop@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1070 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <perf_loop@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"testing libbloom...\0A\00"
@.str.1 = [3 x i8] c"-p\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %27
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strncmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%15 = icmp ne i32 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = call i32 @perf_loop(i32 %20, i32 %24)
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %10, %2
%28 = call i32 (...) @basic()
%29 = call i32 @add_random(i32 100, double 1.000000e-03, i32 300)
store i32 0, i32* %6
br label %30
30: ; preds = %35, %27
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
br label %35
35: ; preds = %33
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %30
38: ; preds = %30
%39 = call i32 @perf_loop(i32 10000000, i32 10000000)
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-p\00"
@str = [20 x i8] c"testing libbloom...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = icmp eq i32 %0, 4
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @strncmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %5
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 @perf_loop(i32 %13, i32 %16)
%18 = tail call i32 @exit(i32 0)
unreachable
19: ; preds = %5, %2
%20 = tail call i32 (...) @basic()
%21 = tail call i32 @add_random(i32 100, double 1.000000e-03, i32 300)
%22 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%23 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%24 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%25 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%26 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%27 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%28 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%29 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%30 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%31 = tail call i32 @add_random(i32 1000000, double 1.000000e-03, i32 1000000)
%32 = tail call i32 @perf_loop(i32 10000000, i32 10000000)
ret i32 0
}