// File: /workspace/github_cpp_makefile_star2_O1/BU-DiSC[P]BF-Shared-Hashing/BF_bit.cpp
// Function: BFHash::get_hash_digest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, HashType, unsigned int)
uint64_t BFHash::get_hash_digest(string & key, HashType ht, uint32_t seed){
    uint64_t result = 0;
    switch(ht){
        case MD5:
            memcpy(&result, md5(key).c_str(), sizeof(result));
            break;
        case SHA2:{
            uint8_t hash[32];
            const uint8_t * a = (const uint8_t*)key.c_str();
            calc_sha_256(hash, a, key.length());
	    for(int i = 0; i < 32; i++){
               result = (result << 1) + (hash[i]&0x1);
	    }
            break;
        }
            
        case MurMurhash: {
            result = MurmurHash2(key.c_str(), key.size(), seed);
            break;
	}
	case MurMur64: {
	    result = MurmurHash64A( key.c_str(), key.size(), seed);
	    break;
	}
        case XXhash:
        {
            // result = MurmurHash2(key.c_str(), key.size(), seed);
            XXH64_hash_t const p = seed;
            const void * key_void = key.c_str();
            XXH64_hash_t const h = XXH64(key_void, key.size(), p);
            result = h;
            break;
        }
        case CRC:{
            const void * key_void = key.c_str();
            result = crc32_fast( key_void, (unsigned long)key.size(), seed );
            break;
        }
        case CITY:{
            const char * key_void = key.c_str();
            result = CityHash64WithSeed( key_void, (unsigned long)key.size(), (unsigned long) seed);
	    break;
        }
	default:
            result = MurmurHash2(key.c_str(), key.size(), seed);
            break;
    }
    
    return result;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpl $0x6, %esi
ja 0x11716
movl %esi, %eax
leaq 0x18011(%rip), %rcx     # 0x296cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x6bf6
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x23ea8
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
movq (%rdi), %rbx
cmpq %rax, %rdi
je 0x11705
callq 0x53d0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1178d
callq 0x53d0
jmp 0x1178d
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
callq 0x23fb4
jmp 0x1178b
movl %edx, %edx
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
jmp 0x247d8
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
movq %rsp, %rdi
callq 0x240a0
xorl %eax, %eax
xorl %ebx, %ebx
movzbl (%rsp,%rax), %ecx
andl $0x1, %ecx
leaq (%rcx,%rbx,2), %rbx
incq %rax
cmpq $0x20, %rax
jne 0x11751
jmp 0x1178d
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
jmp 0x23ed8
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
callq 0x27c62
movl %eax, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movl %edx, %edx
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
jmp 0x2871d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x117c2
callq 0x53d0
movq %rbx, %rdi
callq 0x56b0