// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $-0x1, %esi
je 0x11826
cmpb $0x0, 0x27ba4(%rip)     # 0x393c8
je 0x11843
movq 0x27c73(%rip), %rax     # 0x394a0
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x11843
cmpb $0x1, 0x27b9b(%rip)     # 0x393d8
jne 0x11a48
cmpq $0x0, 0x27c55(%rip)     # 0x394a0
jne 0x11881
movl $0x18, %edi
callq 0x5410
movq %rax, %r14
movslq 0x27b6f(%rip), %rsi     # 0x393d0
leaq 0x10(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0xf(%rsp), %rcx
movq %rax, %rdi
callq 0xd250
movq %r14, 0x27c1f(%rip)     # 0x394a0
movl 0x27b45(%rip), %eax     # 0x393cc
cmpl $0x1, %eax
je 0x118f8
testl %eax, %eax
jne 0x11988
cmpl $0x0, 0x27b35(%rip)     # 0x393d0
jle 0x11a41
xorl %r14d, %r14d
movq 0x27bc5(%rip), %rax     # 0x39470
movl (%rax,%r14,4), %esi
movq 0x27bd2(%rip), %rax     # 0x39488
movl (%rax,%r14,4), %edx
movq %rbx, %rdi
callq 0x116a6
movq 0x27bd7(%rip), %rdx     # 0x394a0
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x11a60
movq %rax, (%rcx,%r14,8)
incq %r14
movslq 0x27ae2(%rip), %rax     # 0x393d0
cmpq %rax, %r14
jl 0x118a4
jmp 0x11a41
movq 0x27b71(%rip), %rax     # 0x39470
movl (%rax), %esi
movq 0x27b80(%rip), %rax     # 0x39488
movl (%rax), %edx
movq %rbx, %rdi
callq 0x116a6
movq 0x27b87(%rip), %rdx     # 0x394a0
movq (%rdx), %rcx
movq 0x8(%rdx), %rsi
movq %rsi, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rcx, %rsi
je 0x11a71
movq %rax, (%rcx)
movslq 0x27a93(%rip), %rdi     # 0x393d0
cmpq $0x2, %rdi
jl 0x11a41
movq %rax, %rsi
shlq $0x11, %rsi
movq %rax, %r8
shrq $0xf, %r8
orq %rsi, %r8
cmpq $0x1, %rdx
movq %rdx, %r9
adcq $0x0, %r9
addq %r8, %rax
movl $0x1, %esi
cmpq %rsi, %r9
je 0x11a57
movq %rax, (%rcx,%rsi,8)
incq %rsi
addq %r8, %rax
cmpq %rsi, %rdi
jne 0x1196b
jmp 0x11a41
movq 0x27ae1(%rip), %rax     # 0x39470
movl (%rax), %esi
movq 0x27af0(%rip), %rax     # 0x39488
movl (%rax), %edx
movq %rbx, %rdi
callq 0x116a6
movq %rax, %r14
cmpl $0x1, 0x27a24(%rip)     # 0x393d0
jne 0x119c7
movq 0x27aeb(%rip), %rcx     # 0x394a0
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x11a7c
movq %r14, (%rax)
jmp 0x11a41
movq 0x27aa2(%rip), %rax     # 0x39470
movl (%rax), %eax
xorl %ecx, %ecx
leaq 0x17d0f(%rip), %rdx     # 0x296e8
xorl %esi, %esi
movl (%rcx,%rdx), %edi
cmpl %eax, %edi
cmovnel %edi, %esi
jne 0x119f2
leaq 0x4(%rcx), %rdi
cmpq $0x14, %rcx
movq %rdi, %rcx
jne 0x119db
movq 0x27a8f(%rip), %rax     # 0x39488
movl (%rax), %eax
movl %eax, %edx
roll $0x11, %edx
addl %eax, %edx
movq %rbx, %rdi
callq 0x116a6
movslq 0x279bf(%rip), %rcx     # 0x393d0
testq %rcx, %rcx
jle 0x11a41
movq 0x27a83(%rip), %rdx     # 0x394a0
movq (%rdx), %rdi
movq 0x8(%rdx), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x11a57
movq %r14, (%rdi,%rsi,8)
incq %rsi
addq %rax, %r14
cmpq %rsi, %rcx
jne 0x11a2d
movb $0x0, 0x27990(%rip)     # 0x393d8
movq 0x27a51(%rip), %rax     # 0x394a0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x17615(%rip), %rdi     # 0x29073
jmp 0x11a6a
leaq 0x1760c(%rip), %rdi     # 0x29073
movq %r14, %rsi
xorl %eax, %eax
callq 0x55d0
leaq 0x175fb(%rip), %rdi     # 0x29073
xorl %esi, %esi
jmp 0x11a6a
leaq 0x175f0(%rip), %rdi     # 0x29073
xorl %esi, %esi
xorl %edx, %edx
jmp 0x11a6a
movq %rax, %rbx
movq %r14, %rdi
callq 0x53d0
movq %rbx, %rdi
callq 0x56b0