// File: /workspace/github_cpp_makefile_star2_O1/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 0x18c6
cmpq $-0x1, 0x8(%rbx)
je 0x160d
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 0x1a1e
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 0x1c9e
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 0x185e
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 0x1565
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 0x1dd9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1ebc
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x212c
movq %rax, %rbx
movq 0x8(%rsp), %r14
cmpq %r14, %rax
je 0x1650
movq (%rsp), %r15
movq 0x3a61(%rip), %rdi      # 0x4ff0
leaq 0x1afa(%rip), %rsi      # 0x3090
movl $0x20, %edx
callq 0x1100
subq %r15, %r14
sarq $0x2, %r14
subq %r15, %rbx
shrq $0x2, %rbx
imulq $0x64, %rbx, %rax
xorl %edx, %edx
divq %r14
movl $0x64, %esi
subl %eax, %esi
movq 0x3a2b(%rip), %rdi      # 0x4ff0
callq 0x1080
movq %rax, %rbx
leaq 0x1add(%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 0x1696
movq 0x39dc(%rip), %rbx      # 0x4ff0
leaq 0x1a02(%rip), %rsi      # 0x301d
movl $0x11, %edx
movq %rbx, %rdi
callq 0x1100
testq %r14, %r14
je 0x180d
movq %r14, %rdi
callq 0x1050
movq 0x39b0(%rip), %rdi      # 0x4ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x1100
jmp 0x1824
movq 0x3999(%rip), %rbx      # 0x4ff0
leaq 0x1a2a(%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 0x3967(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3953(%rip), %rbx      # 0x4ff0
leaq 0x19ca(%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 0x3921(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x390d(%rip), %rbx      # 0x4ff0
leaq 0x19c9(%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 0x38db(%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 0x1944(%rip), %rax      # 0x3088
leaq 0x197e(%rip), %rsi      # 0x30c9
cmoveq %rax, %rsi
leaq (%rdx,%rdx,4), %rdx
addq $0x7, %rdx
movq 0x3892(%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 0x386c(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3858(%rip), %rbx      # 0x4ff0
leaq 0x18cf(%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 0x3826(%rip), %rdi      # 0x4ff0
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17ed
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1809
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x10f0
xorl %ebx, %ebx
jmp 0x1854
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 0x37ae(%rip), %rdi      # 0x4ff0
callq 0x1030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x1090
leaq 0x40(%rsp), %rdi
callq 0x1c66
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x187e
movq %rax, %rbx
jmp 0x18b3
jmp 0x187e
jmp 0x187e
jmp 0x187e
jmp 0x187e
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1897
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x18b3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x10f0
leaq 0x40(%rsp), %rdi
callq 0x1c66
movq %rbx, %rdi
callq 0x1150
nop