#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 */
typedef scalar_t__ uint64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ charikar_hash64(char *, long);
int /*<<< orphan*/ dec2bin(unsigned long long, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
char *get_line(int /*<<< orphan*/ *);
int getopt(int, char **, char *);
size_t optind;
int /*<<< orphan*/ printf(char *, char *, char *);
long strlen(char *);
int main(int argc, char **argv) {
  if (argc < 2)
    exit(5);
  int opt;
  while (opt = getopt(argc, argv, "dqs:"), opt != -1)
    switch (opt) {
    default:
      exit(5);
    }
  uint64_t hash1 = 0, hash2 = 0;
  FILE *myfile;
  myfile = fopen(argv[optind], "r");
  char *line;
  while ((line = get_line(myfile))) {
    long data_length;
    data_length = strlen(line);
    hash1 = 0;
    hash2 = 0;
    hash2 = hash1;
    hash1 = charikar_hash64(line, data_length);
    char binary[80];
    dec2bin((unsigned long long)hash1, binary);
    printf("%s %s\n", binary, line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ad <main+0x2d>
mov    $0x5,%edi
call   10a0 <exit@plt>
jmp    11b2 <main+0x32>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe40(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     11dc <main+0x5c>
mov    $0x5,%edi
call   10a0 <exit@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2df1(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe00(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <get_line@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1287 <main+0x107>
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1060 <charikar_hash64@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1070 <dec2bin@plt>
lea    -0x90(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    0xd8a(%rip),%rdi
call   1050 <printf@plt>
jmp    120e <main+0x8e>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x1,%edi
jle    123a <main+0xba>
mov    %rsi,%rbx
lea    0xe62(%rip),%rdx
call   1090 <getopt@plt>
cmp    $0xffffffff,%eax
jne    123a <main+0xba>
mov    0x2e35(%rip),%rax
mov    (%rax),%rax
mov    (%rbx,%rax,8),%rdi
lea    0xe44(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     122c <main+0xac>
mov    %rax,%rbx
mov    %rsp,%r15
lea    0xe24(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <charikar_hash64@plt>
mov    %rax,%rdi
mov    %r15,%rsi
call   1070 <dec2bin@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <get_line@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11f0 <main+0x70>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x5,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"dqs:\00"
@optind = global i64 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca [80 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @exit(i32 5)
unreachable
17: ; preds = %2
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = load i32, i32* %6
switch i32 %25, label %26 [
]
26: ; preds = %24
%27 = call i32 @exit(i32 5)
unreachable
28: ; preds = %18
store i64 0, i64* %7
store i64 0, i64* %8
%29 = load i8**, i8*** %5
%30 = load i64, i64* @optind
%31 = getelementptr inbounds i8*, i8** %29, i64 %30
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %9
br label %34
34: ; preds = %38, %28
%35 = load i32*, i32** %9
%36 = call i8* @get_line(i32* %35)
store i8* %36, i8** %10
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %51
38: ; preds = %34
%39 = load i8*, i8** %10
%40 = call i64 @strlen(i8* %39)
store i64 %40, i64* %11
store i64 0, i64* %7
store i64 0, i64* %8
%41 = load i64, i64* %7
store i64 %41, i64* %8
%42 = load i8*, i8** %10
%43 = load i64, i64* %11
%44 = call i64 @charikar_hash64(i8* %42, i64 %43)
store i64 %44, i64* %7
%45 = load i64, i64* %7
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%47 = call i32 @dec2bin(i64 %45, i8* %46)
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%49 = load i8*, i8** %10
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %48, i8* %49)
br label %34
51: ; preds = %34
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"dqs:\00"
@optind = global i64 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [80 x i8]
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @exit(i32 5)
unreachable
7: ; preds = %2
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, -1
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @exit(i32 5)
unreachable
12: ; preds = %7
%13 = load i64, i64* @optind
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i8* @get_line(i32* %16)
%18 = icmp eq i8* %17, null
br i1 %18, label %29, label %19
19: ; preds = %12
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
br label %21
21: ; preds = %19, %21
%22 = phi i8* [ %17, %19 ], [ %27, %21 ]
%23 = call i64 @strlen(i8* %22)
%24 = call i64 @charikar_hash64(i8* %22, i64 %23)
%25 = call i32 @dec2bin(i64 %24, i8* %20)
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %20, i8* %22)
%27 = call i8* @get_line(i32* %16)
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %21
29: ; preds = %21, %12
ret i32 0
}