// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rsi, -0xa0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0x4, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0xa0(%rbp), %rdi
movl -0x38(%rbp), %eax
movl %eax, -0xa4(%rbp)
callq 0xb170
movl %eax, %ecx
movl -0xa4(%rbp), %eax
cmpl %ecx, %eax
jge 0xa27b
leaq -0x50(%rbp), %rdi
callq 0x4720
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
incl %esi
callq 0x4930
movsd %xmm0, -0xb0(%rbp)
jmp 0xa1b8
movsd -0xb0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %rsi
leaq -0x50(%rbp), %rdi
callq 0xbae0
jmp 0xa1d2
movq -0x28(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4960
jmp 0xa1e1
leaq -0x78(%rbp), %rdi
callq 0x4720
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
incl %esi
callq 0x4930
movsd %xmm0, -0xb8(%rbp)
jmp 0xa201
movsd -0xb8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %rsi
leaq -0x78(%rbp), %rdi
callq 0xbae0
jmp 0xa21b
movq -0x30(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4960
jmp 0xa22a
leaq -0x78(%rbp), %rdi
callq 0x49d0
leaq -0x50(%rbp), %rdi
callq 0x49d0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xa173
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa26d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x49d0
leaq -0x50(%rbp), %rdi
callq 0x49d0
jmp 0xa430
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
movl $0x0, -0x84(%rbp)
movq -0xa0(%rbp), %rdi
movl -0x84(%rbp), %eax
movl %eax, -0xbc(%rbp)
callq 0xb170
movl %eax, %ecx
movl -0xbc(%rbp), %eax
cmpl %ecx, %eax
jge 0xa427
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl -0x34(%rbp), %edi
movl -0x84(%rbp), %esi
addl $0x1, %esi
callq 0x4930
movl -0xc0(%rbp), %eax
cvttsd2si %xmm0, %ecx
cmpl %ecx, %eax
jge 0xa411
movl -0x88(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
addl $0x2, %edx
movb %dl, %al
movb %al, -0x89(%rbp)
cmpl $0x0, -0x84(%rbp)
jne 0xa32f
movl $0x0, -0x7c(%rbp)
movq -0x20(%rbp), %rdi
callq 0x55a0
subq $0x1, %rax
movl %eax, -0x80(%rbp)
jmp 0xa395
movq -0x28(%rbp), %rdi
movl -0x84(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbbe0
movq %rax, %rdi
movl -0x88(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rsi
callq 0xbac0
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movq -0x30(%rbp), %rdi
movl -0x84(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xbbe0
movq %rax, %rdi
movl -0x88(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rsi
callq 0xbac0
movl (%rax), %eax
movl %eax, -0x80(%rbp)
movq -0x98(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movb -0x89(%rbp), %r9b
movl -0x84(%rbp), %eax
leaq -0x7c(%rbp), %rcx
leaq -0x80(%rbp), %r8
movzbl %r9b, %r9d
movl %eax, (%rsp)
callq 0xad90
movq -0x28(%rbp), %rdi
movslq -0x84(%rbp), %rsi
callq 0xbbe0
movq %rax, %rdi
leaq -0x7c(%rbp), %rsi
callq 0xbc00
movq -0x30(%rbp), %rdi
movslq -0x84(%rbp), %rsi
callq 0xbbe0
movq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0xbc00
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0xa2c5
jmp 0xa413
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xa293
addq $0xd0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x34d0
nopl (%rax)