// File: /workspace/github_cpp_makefile_star2_O3/sile[P]mphf/test_mphf.cc
// Function: main
int main(int argc, char** argv) {
  if(argc != 2) {
    std::cerr << "Usage: test_mphf <index>" << std::endl;
    return 1;
  }

  const char* index_filepath = argv[1];
  
  MPHF::Hash hash(index_filepath);
  if(!hash) {
    std::cerr << "Can't open file: " << index_filepath << std::endl;
    return 1;
  }
    
  std::string line;
  std::vector<unsigned> hash_values;

  std::cerr << "= Read keyset and calculate hash values:" << std::endl;
  while(std::getline(std::cin, line)) 
    hash_values.push_back(hash.mphf(line.c_str()));
  std::cerr << "  == read key count: " << hash_values.size() << std::endl;
  std::cerr << "DONE" << std::endl;
  
  std::cerr << "= Uniqueness check: " << std::endl;
  std::sort(hash_values.begin(), hash_values.end());
  std::vector<unsigned>::const_iterator end = std::unique(hash_values.begin(), hash_values.end());
  if(end == hash_values.end()) {
    std::cerr << "  == OK" << std::endl;
  } else {
    unsigned dup_rate = 100 - (((end-hash_values.begin())*100)/hash_values.size());
    std::cerr << "  == failure: duplicate rate is " << dup_rate << "%" << std::endl;
  }
  std::cerr << "DONE" << std::endl;

  std::cerr << "= Minimalness check: " << std::endl;
  if(hash_values.back() == hash_values.size()-1)
    std::cerr << "  == OK" << std::endl;
  else
    std::cerr << "  == failure" << std::endl;
  std::cerr << "DONE" << std::endl;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $0x2, %edi
jne 0x13f7
movq 0x8(%rsi), %r14
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18fa
cmpq $-0x1, 0x8(%rbx)
je 0x15b9
leaq 0x30(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x3cc9(%rip), %rbx      # 0x4ff0
leaq 0x1d01(%rip), %rsi      # 0x302f
movl $0x28, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x3c97(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3c6b(%rip), %rbx      # 0x4fd8
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
movq %rsp, %r12
leaq 0x1c(%rsp), %r13
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1170
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1443
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x1050
movq %r15, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x1a52
movl %eax, 0x1c(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x13ea
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x137f
movq %r12, %rdi
movq %r13, %rdx
callq 0x1cc6
jmp 0x137f
movq 0x3bf2(%rip), %rbx      # 0x4ff0
leaq 0x1bff(%rip), %rsi      # 0x3004
movl $0x18, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movl $0x1, %ebx
jmp 0x1895
movq 0x3ba6(%rip), %rdi      # 0x4ff0
leaq 0x1c07(%rip), %rsi      # 0x3058
movl $0x15, %edx
callq 0x1100
movq 0x8(%rsp), %rsi
subq (%rsp), %rsi
sarq $0x2, %rsi
movq 0x3b81(%rip), %rdi      # 0x4ff0
callq 0x1080
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3b4b(%rip), %rbx      # 0x4ff0
leaq 0x1bc2(%rip), %rsi      # 0x306e
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x3b19(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3b05(%rip), %rbx      # 0x4ff0
leaq 0x1b81(%rip), %rsi      # 0x3073
movl $0x14, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x3ad3(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %r14, %rbx
je 0x16d0
movq %r14, %rax
subq %rbx, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1e01
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1ee4
movq (%rsp), %r14
movq 0x8(%rsp), %rbx
cmpq %rbx, %r14
je 0x16d0
leaq 0x4(%r14), %rdx
cmpq %rbx, %rdx
je 0x16d0
movl -0x4(%rdx), %eax
leaq 0x4(%rdx), %rcx
cmpl (%rdx), %eax
movq %rcx, %rdx
jne 0x157f
leaq -0x8(%rcx), %r15
cmpq %rbx, %rcx
je 0x1641
movl %eax, %edx
movl (%rcx), %eax
cmpl %eax, %edx
je 0x15b3
movl %eax, 0x4(%r15)
addq $0x4, %r15
addq $0x4, %rcx
jmp 0x159a
movq 0x3a30(%rip), %rbx      # 0x4ff0
leaq 0x1a56(%rip), %rsi      # 0x301d
movl $0x11, %edx
movq %rbx, %rdi
callq 0x1100
testq %r14, %r14
je 0x15f5
movq %r14, %rdi
callq 0x1050
movq 0x3a08(%rip), %rdi      # 0x4ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x1100
jmp 0x160c
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x1140
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x39c6(%rip), %rdi      # 0x4ff0
callq 0x1030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x1090
jmp 0x188b
addq $0x4, %r15
cmpq %rbx, %r15
je 0x16d0
movq 0x399b(%rip), %rdi      # 0x4ff0
leaq 0x1a34(%rip), %rsi      # 0x3090
movl $0x20, %edx
callq 0x1100
subq %r14, %rbx
sarq $0x2, %rbx
subq %r14, %r15
shrq $0x2, %r15
imulq $0x64, %r15, %rax
xorl %edx, %edx
divq %rbx
movl $0x64, %esi
subl %eax, %esi
movq 0x3965(%rip), %rdi      # 0x4ff0
callq 0x1080
movq %rax, %rbx
leaq 0x1a17(%rip), %rsi      # 0x30b1
movl $0x1, %edx
movq %rax, %rdi
callq 0x1100
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
jmp 0x1716
movq 0x3919(%rip), %rbx      # 0x4ff0
leaq 0x19aa(%rip), %rsi      # 0x3088
movl $0x7, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x38e7(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x38d3(%rip), %rbx      # 0x4ff0
leaq 0x194a(%rip), %rsi      # 0x306e
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x38a1(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x388d(%rip), %rbx      # 0x4ff0
leaq 0x1949(%rip), %rsi      # 0x30b3
movl $0x15, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x385b(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movl -0x4(%rax), %ecx
subq (%rsp), %rax
sarq $0x2, %rax
decq %rax
xorl %edx, %edx
cmpq %rcx, %rax
setne %dl
leaq 0x18c4(%rip), %rax      # 0x3088
leaq 0x18fe(%rip), %rsi      # 0x30c9
cmoveq %rax, %rsi
leaq (%rdx,%rdx,4), %rdx
addq $0x7, %rdx
movq 0x3812(%rip), %rbx      # 0x4ff0
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x37ec(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x37d8(%rip), %rbx      # 0x4ff0
leaq 0x184f(%rip), %rsi      # 0x306e
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x37a6(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x186d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1889
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x10f0
xorl %ebx, %ebx
leaq 0x40(%rsp), %rdi
callq 0x1c98
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x18b3
movq %rax, %rbx
jmp 0x18e8
jmp 0x18b3
jmp 0x18b3
jmp 0x18b3
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x18cc
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x18e8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x40(%rsp), %rdi
callq 0x1c98
movq %rbx, %rdi
callq 0x1150