#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_and_test(int, double, int, int);
char *bloom_version();
int /*<<< orphan*/ printf(char *, char *);
void basic() {
  printf("libloom %s\n", bloom_version());
  int n = 50000;
  add_and_test(n + 15, 0.01, n, 1);
  add_and_test(n + 15, 0.01, n, 0);
  n = 1000000;
  add_and_test(n, 0.1, n, 1);
  add_and_test(n, 0.1, n, 0);
  add_and_test(n, 0.01, n, 1);
  add_and_test(n, 0.01, n, 0);
  add_and_test(n, 0.001, n, 1);
  add_and_test(n, 0.001, n, 0);
  n = 10000000;
  add_and_test(n, 0.001, n, 1);
  add_and_test(n, 0.001, n, 0);
}


x86 assembly (clang, -O0):
<basic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <bloom_version@plt>
mov    %rax,%rsi
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
movl   $0xc350,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0xf,%edi
mov    -0x4(%rbp),%esi
movsd  0xea2(%rip),%xmm0
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
add    $0xf,%edi
mov    -0x4(%rbp),%esi
movsd  0xe87(%rip),%xmm0
xor    %edx,%edx
call   1050 <add_and_test@plt>
movl   $0xf4240,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xe73(%rip),%xmm0
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xe5b(%rip),%xmm0
xor    %edx,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xe3e(%rip),%xmm0
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xe26(%rip),%xmm0
xor    %edx,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xe09(%rip),%xmm0
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xdf1(%rip),%xmm0
xor    %edx,%edx
call   1050 <add_and_test@plt>
movl   $0x989680,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xdd5(%rip),%xmm0
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
movsd  0xdbd(%rip),%xmm0
xor    %edx,%edx
call   1050 <add_and_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic>:
push   %rax
xor    %eax,%eax
call   1030 <bloom_version@plt>
lea    0xed9(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
movsd  0xeb1(%rip),%xmm0
mov    $0xc35f,%edi
mov    $0xc350,%esi
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    $0xc35f,%edi
movsd  0xe90(%rip),%xmm0
mov    $0xc350,%esi
xor    %edx,%edx
call   1050 <add_and_test@plt>
movsd  0xe84(%rip),%xmm0
mov    $0xf4240,%edi
mov    $0xf4240,%esi
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    $0xf4240,%edi
movsd  0xe63(%rip),%xmm0
mov    $0xf4240,%esi
xor    %edx,%edx
call   1050 <add_and_test@plt>
mov    $0xf4240,%edi
movsd  0xe42(%rip),%xmm0
mov    $0xf4240,%esi
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    $0xf4240,%edi
movsd  0xe26(%rip),%xmm0
mov    $0xf4240,%esi
xor    %edx,%edx
call   1050 <add_and_test@plt>
movsd  0xe22(%rip),%xmm0
mov    $0xf4240,%edi
mov    $0xf4240,%esi
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    $0xf4240,%edi
movsd  0xe01(%rip),%xmm0
mov    $0xf4240,%esi
xor    %edx,%edx
call   1050 <add_and_test@plt>
mov    $0x989680,%edi
movsd  0xde8(%rip),%xmm0
mov    $0x989680,%esi
mov    $0x1,%edx
call   1050 <add_and_test@plt>
mov    $0x989680,%edi
movsd  0xdcc(%rip),%xmm0
mov    $0x989680,%esi
xor    %edx,%edx
pop    %rax
jmp    1050 <add_and_test@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"libloom %s\0A\00"
define void @basic() {
%1 = alloca i32
%2 = call i8* (...) @bloom_version()
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
store i32 50000, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 15
%6 = load i32, i32* %1
%7 = call i32 @add_and_test(i32 %5, double 1.000000e-02, i32 %6, i32 1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 15
%10 = load i32, i32* %1
%11 = call i32 @add_and_test(i32 %9, double 1.000000e-02, i32 %10, i32 0)
store i32 1000000, i32* %1
%12 = load i32, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @add_and_test(i32 %12, double 1.000000e-01, i32 %13, i32 1)
%15 = load i32, i32* %1
%16 = load i32, i32* %1
%17 = call i32 @add_and_test(i32 %15, double 1.000000e-01, i32 %16, i32 0)
%18 = load i32, i32* %1
%19 = load i32, i32* %1
%20 = call i32 @add_and_test(i32 %18, double 1.000000e-02, i32 %19, i32 1)
%21 = load i32, i32* %1
%22 = load i32, i32* %1
%23 = call i32 @add_and_test(i32 %21, double 1.000000e-02, i32 %22, i32 0)
%24 = load i32, i32* %1
%25 = load i32, i32* %1
%26 = call i32 @add_and_test(i32 %24, double 1.000000e-03, i32 %25, i32 1)
%27 = load i32, i32* %1
%28 = load i32, i32* %1
%29 = call i32 @add_and_test(i32 %27, double 1.000000e-03, i32 %28, i32 0)
store i32 10000000, i32* %1
%30 = load i32, i32* %1
%31 = load i32, i32* %1
%32 = call i32 @add_and_test(i32 %30, double 1.000000e-03, i32 %31, i32 1)
%33 = load i32, i32* %1
%34 = load i32, i32* %1
%35 = call i32 @add_and_test(i32 %33, double 1.000000e-03, i32 %34, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"libloom %s\0A\00"
define void @basic() {
%1 = tail call i8* (...) @bloom_version()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @add_and_test(i32 50015, double 1.000000e-02, i32 50000, i32 1)
%4 = tail call i32 @add_and_test(i32 50015, double 1.000000e-02, i32 50000, i32 0)
%5 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-01, i32 1000000, i32 1)
%6 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-01, i32 1000000, i32 0)
%7 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-02, i32 1000000, i32 1)
%8 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-02, i32 1000000, i32 0)
%9 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-03, i32 1000000, i32 1)
%10 = tail call i32 @add_and_test(i32 1000000, double 1.000000e-03, i32 1000000, i32 0)
%11 = tail call i32 @add_and_test(i32 10000000, double 1.000000e-03, i32 10000000, i32 1)
%12 = tail call i32 @add_and_test(i32 10000000, double 1.000000e-03, i32 10000000, i32 0)
ret void
}