#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 */
scalar_t__ EOF;
int /*<<< orphan*/ bitvector_delete(void *);
void *bitvector_new(int);
int /*<<< orphan*/ bitvector_set(void *, long);
scalar_t__ bitvector_test(void *, long);
int /*<<< orphan*/ printf(char *, long);
scalar_t__ scanf(char *, long *);
int main(void) {
  long readlong = 0L;
  void *bitmap = bitvector_new(10000000);
  while (scanf("%ld", &readlong) != EOF)
    bitvector_set(bitmap, readlong);
  for (long i = 0; i < 10000000; i++)
    if (bitvector_test(bitmap, i))
      printf("%ld\n", i);
  bitvector_delete(bitmap);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x989680,%edi
call   1080 <bitvector_new@plt>
mov    %rax,-0x18(%rbp)
lea    0xe74(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%rax
je     11b7 <main+0x57>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <bitvector_set@plt>
jmp    1185 <main+0x25>
movq   $0x0,-0x20(%rbp)
cmpq   $0x989680,-0x20(%rbp)
jge    120a <main+0xaa>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <bitvector_test@plt>
cmp    $0x0,%rax
je     11f4 <main+0x94>
mov    -0x20(%rbp),%rsi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0x99>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11bf <main+0x5f>
mov    -0x18(%rbp),%rdi
call   1050 <bitvector_delete@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    $0x989680,%edi
call   1080 <bitvector_new@plt>
mov    %rax,%r14
lea    0xe7c(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
mov    0x2e55(%rip),%r12
cmp    (%r12),%rax
je     11cd <main+0x6d>
lea    0xe60(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp),%rsi
mov    %r14,%rdi
call   1060 <bitvector_set@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
cmp    (%r12),%rax
jne    11b0 <main+0x50>
xor    %ebx,%ebx
lea    0xe2e(%rip),%r15
jmp    11ed <main+0x8d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x989680,%rbx
je     120a <main+0xaa>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <bitvector_test@plt>
test   %rax,%rax
je     11e0 <main+0x80>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    11e0 <main+0x80>
mov    %r14,%rdi
call   1050 <bitvector_delete@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
%5 = call i8* @bitvector_new(i32 10000000)
store i8* %5, i8** %3
br label %6
6: ; preds = %10, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %2
%13 = call i32 @bitvector_set(i8* %11, i64 %12)
br label %6
14: ; preds = %6
store i64 0, i64* %4
br label %15
15: ; preds = %27, %14
%16 = load i64, i64* %4
%17 = icmp slt i64 %16, 10000000
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i8*, i8** %3
%20 = load i64, i64* %4
%21 = call i64 @bitvector_test(i8* %19, i64 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i64, i64* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %24)
br label %26
26: ; preds = %23, %18
br label %27
27: ; preds = %26
%28 = load i64, i64* %4
%29 = add nsw i64 %28, 1
store i64 %29, i64* %4
br label %15
30: ; preds = %15
%31 = load i8*, i8** %3
%32 = call i32 @bitvector_delete(i8* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%3 = tail call i8* @bitvector_new(i32 10000000)
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %8, %0
br label %16
8: ; preds = %0, %8
%9 = load i64, i64* %1
%10 = call i32 @bitvector_set(i8* %3, i64 %9)
%11 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %7, label %8
14: ; preds = %22
%15 = call i32 @bitvector_delete(i8* %3)
ret i32 0
16: ; preds = %7, %22
%17 = phi i64 [ %23, %22 ], [ 0, %7 ]
%18 = call i64 @bitvector_test(i8* %3, i64 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %17)
br label %22
22: ; preds = %16, %20
%23 = add nuw nsw i64 %17, 1
%24 = icmp eq i64 %23, 10000000
br i1 %24, label %14, label %16
}