// File: /workspace/github_c_makefile_star2_O3/fukunagatsu[P]RIblast/db_construction.cpp
// Function: DbConstruction::ConstructHashForShortSubstring(DbConstructionParameters, std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<int, std::allocator<int>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&)
void DbConstruction::ConstructHashForShortSubstring(const DbConstructionParameters parameters,  vector<unsigned char> &encoded_sequences, vector<int> &suffix_array, vector<vector <int> > &start_hash, vector<vector <int> > &end_hash){
  int nucleotide_size = 4;
  
  for(int i = 0; i < parameters.GetHashSize(); i++){
    vector<int> temp_vector; temp_vector.reserve((int)pow(nucleotide_size,i+1));
    start_hash.push_back(temp_vector);
    vector<int> temp_vector2; temp_vector2.reserve((int)pow(nucleotide_size,i+1));
    end_hash.push_back(temp_vector2);
  }

  int start = 0;  int end = 0;
  for(int i = 0; i < parameters.GetHashSize(); i++){
    for(int j  =0; j < (int)pow(nucleotide_size,i+1); j++){
      unsigned char c = (j%4)+2;
      if(i == 0){
	start = 0;
	end = suffix_array.size()-1;
      }else{
	start = start_hash[i-1][j/4];
	end = end_hash[i-1][j/4];
      }
      Search(encoded_sequences, suffix_array, &start, &end, c, i);
      start_hash[i].push_back(start);
      end_hash[i].push_back(end);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %rdx, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
cmpl $0x0, 0x40(%rsi)
jle 0x6c4d
movq %rcx, %r15
xorl %r14d, %r14d
movl $0x2, %r12d
leaq 0x30(%rsp), %r13
leaq 0x10(%rsp), %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl %r12d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x48(%rsp)
callq 0x31f0
cvttsd2si %xmm0, %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0x8732
movq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x4946
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movsd 0x48(%rsp), %xmm0
callq 0x31f0
cvttsd2si %xmm0, %eax
movslq %eax, %rsi
movq %rbp, %rdi
callq 0x8732
movq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x4946
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6aae
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6ac5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
incl %r14d
movq 0x60(%rsp), %rax
movl 0x40(%rax), %eax
addl $0x2, %r12d
cmpl %eax, %r14d
jl 0x6a1a
xorl %ecx, %ecx
movl %ecx, 0x30(%rsp)
movl %ecx, 0x10(%rsp)
testl %eax, %eax
jle 0x6c4d
xorl %r12d, %r12d
leaq 0x1(%r12), %rax
movq %rax, 0x70(%rsp)
addl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x48(%rsp)
callq 0x31f0
cvttsd2si %xmm0, %eax
testl %eax, %eax
jle 0x6c36
leaq -0x1(%r12), %rax
xorl %r14d, %r14d
leaq (%r12,%r12,2), %rbp
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
movl %r14d, %eax
andb $0x3, %al
addb $0x2, %al
movzbl %al, %r9d
testq %r12, %r12
je 0x6b8a
movq 0x50(%rsp), %rax
movq (%rax), %rbx
movq (%rbx,%r13), %rax
movl %r14d, %ecx
andl $-0x4, %ecx
movl (%rax,%rcx), %eax
movl %eax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13), %rax
movl (%rax,%rcx), %eax
movl %eax, 0x10(%rsp)
movl %r12d, (%rsp)
movq 0x68(%rsp), %rsi
movq %r15, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x738a
jmp 0x6bc3
xorl %ecx, %ecx
movl %ecx, 0x30(%rsp)
movq 0x8(%r15), %rax
subq (%r15), %rax
shrq $0x2, %rax
decl %eax
movl %eax, 0x10(%rsp)
movl %ecx, (%rsp)
movq 0x68(%rsp), %rsi
movq %r15, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x738a
movq 0x50(%rsp), %rax
movq (%rax), %rbx
leaq (%rbx,%rbp,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6be1
movl 0x30(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x6beb
leaq 0x30(%rsp), %rdx
callq 0x8e4c
movq 0x58(%rsp), %rax
movq (%rax), %rax
leaq (%rax,%rbp,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6c11
movl 0x10(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x6c1b
leaq 0x10(%rsp), %rdx
callq 0x8e4c
incl %r14d
movsd 0x48(%rsp), %xmm0
callq 0x31f0
cvttsd2si %xmm0, %eax
cmpl %eax, %r14d
jl 0x6b31
movq 0x60(%rsp), %rax
movslq 0x40(%rax), %rax
movq 0x70(%rsp), %r12
cmpq %rax, %r12
jl 0x6af2
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x6c7b
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c7b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6c92
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33e0