// File: BU-DiSC[P]BF-Shared-Hashing/BF_bit.cpp
// Function: BFHash::getLevelwiseHashDigest(int)
vector<uint64_t>* BFHash::getLevelwiseHashDigest(int level){
        if((!share_hash_across_levels_ && level != -1)|| hash_digests_->size() == 0 || reset){
	    if(hash_digests_ == nullptr){
		hash_digests_ = new vector<uint64_t>(num_filter_units_, 0);
	    }
	    if(share_hash_across_filter_units_ == 0){
                for(int i = 0; i < num_filter_units_; i++){
                    hash_digests_->at(i) = getFilterUnitwiseHashDigest(i);
                }
            }else if(share_hash_across_filter_units_ == 1){
                uint64_t last_hash_digest = getFilterUnitwiseHashDigest(0);
                hash_digests_->at(0) = last_hash_digest;
		uint64_t delta = last_hash_digest << 17 | last_hash_digest >> 15;
                for(int i = 1; i < num_filter_units_; i++){
                   last_hash_digest = last_hash_digest + delta; 
                   hash_digests_->at(i) = last_hash_digest;
                }
            }else{
                uint64_t hash_digest1 = getFilterUnitwiseHashDigest(0);
                if(num_filter_units_ == 1){
                   hash_digests_->at(0) = hash_digest1;
                }else{
		   HashType ht = filter_unit_hash_funcs_[0];
		   HashType ht2 = MD5;
                   for(auto t_ht: { MD5, MurMurhash, CRC, XXhash, MurMur64, SHA2}){
                      if(t_ht != ht){
                          ht2 = t_ht;
			  break;
                      }
                   }
                   uint32_t seed = filter_unit_seeds_[0];
	           uint64_t hash_digest2 = get_hash_digest(key_, ht2, seed + (seed << 17 | seed >> 15));
                   for(int i = 0; i < num_filter_units_; i++){
                       hash_digests_->at(i) = hash_digest1 + i*hash_digest2;
                   }
                }
                
            }
	    reset = false;
	}
	return hash_digests_;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movl %esi, 0xfc(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x48(%rsp)
testb $0x1, 0x620be(%rip)     # 0x804c8
jne 0x1e416
cmpl $-0x1, 0xfc(%rsp)
jne 0x1e435
movq 0x6217b(%rip), %rdi     # 0x80598
callq 0x1ab90
cmpq $0x0, %rax
je 0x1e435
testb $0x1, 0x620a9(%rip)     # 0x804d8
je 0x1e816
cmpq $0x0, 0x6215b(%rip)     # 0x80598
jne 0x1e506
movl $0x18, %edi
callq 0x6510
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movb $0x1, 0xdb(%rsp)
movslq 0x6206a(%rip), %rax     # 0x804d0
movq %rax, 0x38(%rsp)
movq $0x0, 0xf0(%rsp)
leaq 0xef(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x11120
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rcx
leaq 0xf0(%rsp), %rdx
callq 0x11130
jmp 0x1e4a7
movq 0x28(%rsp), %rax
movb $0x0, 0xdb(%rsp)
movq %rax, 0x620dd(%rip)     # 0x80598
leaq 0xef(%rsp), %rdi
callq 0x88d0
jmp 0x1e506
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe0(%rsp)
movl %eax, 0xdc(%rsp)
leaq 0xef(%rsp), %rdi
callq 0x88d0
testb $0x1, 0xdb(%rsp)
jne 0x1e4f7
jmp 0x1e501
movq 0x28(%rsp), %rdi
callq 0x64c0
jmp 0x1e825
cmpl $0x0, 0x61fbf(%rip)     # 0x804cc
jne 0x1e573
movl $0x0, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
cmpl 0x61fa9(%rip), %eax     # 0x804d0
jge 0x1e56e
movq 0x48(%rsp), %rdi
movl 0xd4(%rsp), %esi
callq 0x1dfb0
movq %rax, 0x20(%rsp)
movq 0x62052(%rip), %rdi     # 0x80598
movslq 0xd4(%rsp), %rsi
callq 0x11c50
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd4(%rsp)
jmp 0x1e51a
jmp 0x1e80f
cmpl $0x1, 0x61f52(%rip)     # 0x804cc
jne 0x1e64f
movq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x1dfb0
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x61ff0(%rip), %rdi     # 0x80598
xorl %eax, %eax
movl %eax, %esi
callq 0x11c50
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
movq 0xc8(%rsp), %rax
shlq $0x11, %rax
movq 0xc8(%rsp), %rcx
shrq $0xf, %rcx
orq %rcx, %rax
movq %rax, 0xc0(%rsp)
movl $0x1, 0xbc(%rsp)
movl 0xbc(%rsp), %eax
cmpl 0x61edc(%rip), %eax     # 0x804d0
jge 0x1e64a
movq 0xc8(%rsp), %rax
addq 0xc0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x61f76(%rip), %rdi     # 0x80598
movslq 0xbc(%rsp), %rsi
callq 0x11c50
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x1e5e7
jmp 0x1e80d
movq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x1dfb0
movq %rax, 0xb0(%rsp)
cmpl $0x1, 0x61e66(%rip)     # 0x804d0
jne 0x1e696
movq 0xb0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x61f18(%rip), %rdi     # 0x80598
xorl %eax, %eax
movl %eax, %esi
callq 0x11c50
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x1e80b
leaq 0x61ecb(%rip), %rdi     # 0x80568
xorl %eax, %eax
movl %eax, %esi
callq 0x1ebc0
movl (%rax), %eax
movl %eax, 0xac(%rsp)
movl $0x0, 0xa8(%rsp)
movq 0x46017(%rip), %rax     # 0x646d8
movq %rax, 0x78(%rsp)
movq 0x46013(%rip), %rax     # 0x646e0
movq %rax, 0x80(%rsp)
movq 0x4600c(%rip), %rax     # 0x646e8
movq %rax, 0x88(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
movq $0x6, 0x98(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1ec00
movq %rax, 0x70(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1ec10
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
je 0x1e774
movq 0x70(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0xac(%rsp), %eax
je 0x1e762
movl 0x64(%rsp), %eax
movl %eax, 0xa8(%rsp)
jmp 0x1e774
jmp 0x1e764
movq 0x70(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x70(%rsp)
jmp 0x1e731
leaq 0x61e05(%rip), %rdi     # 0x80580
xorl %eax, %eax
movl %eax, %esi
callq 0x1ebe0
movq 0x48(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x60(%rsp)
movl 0xa8(%rsp), %esi
movl 0x60(%rsp), %edx
movl 0x60(%rsp), %eax
shll $0x11, %eax
movl 0x60(%rsp), %ecx
shrl $0xf, %ecx
orl %ecx, %eax
addl %eax, %edx
callq 0x1e010
movq %rax, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpl 0x61d08(%rip), %eax     # 0x804d0
jge 0x1e809
movq 0xb0(%rsp), %rax
movslq 0x54(%rsp), %rcx
imulq 0x58(%rsp), %rcx
addq %rcx, %rax
movq %rax, (%rsp)
movq 0x61dad(%rip), %rdi     # 0x80598
movslq 0x54(%rsp), %rsi
callq 0x11c50
movq (%rsp), %rcx
movq %rcx, (%rax)
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x1e7be
jmp 0x1e80b
jmp 0x1e80d
jmp 0x1e80f
movb $0x0, 0x61cc2(%rip)     # 0x804d8
movq 0x61d7b(%rip), %rax     # 0x80598
addq $0x108, %rsp            # imm = 0x108
retq
movq 0xe0(%rsp), %rdi
callq 0x6850
nopw %cs:(%rax,%rax)