// File: /workspace/github_cpp_makefile_star2_O3/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 0x115ee
movl %esi, %eax
leaq 0x18139(%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 0x6c14
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x238fc
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
movq (%rdi), %rbx
cmpq %rax, %rdi
je 0x115dd
callq 0x53d0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x11665
callq 0x53d0
jmp 0x11665
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
callq 0x23a0a
jmp 0x11663
movl %edx, %edx
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
jmp 0x24260
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
movq %rsp, %rdi
callq 0x23af4
xorl %eax, %eax
xorl %ebx, %ebx
movzbl (%rsp,%rax), %ecx
andl $0x1, %ecx
leaq (%rcx,%rbx,2), %rbx
incq %rax
cmpq $0x20, %rax
jne 0x11629
jmp 0x11665
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r14
jmp 0x2392c
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movq %rax, %rdi
callq 0x276ea
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 0x281b1
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1169a
callq 0x53d0
movq %rbx, %rdi
callq 0x56b0