// File: /workspace/github_cpp_makefile_star2_O2/afinit[P]afin/readlist.cpp
// Function: Readlist::create_read_range()
void Readlist::create_read_range(){
  string current( rlist[0].substr( 0, max_sort_char ) );
  long curr_start = 0;
  // cycle through the rlist
  for( long int i=1; i<rlist.size(); i++ ){
    if( rlist[i].compare( 0, max_sort_char, current ) != 0 ){
      // insert values into hash table, the ordered pair reflecting the range is increased by 1 to differentiate between a false search  
      read_range.insert( { current, make_tuple( curr_start+1, i, 0, 0 )});
      curr_start = i;
      current = rlist[i].substr( 0, max_sort_char );
    }
  }
  
  // add the last entry
  read_range.insert( { current, make_tuple( curr_start+1, rlist.size(), 0, 0 )});

  string rc( rlist[0].substr( rlist[0].length() - max_sort_char, max_sort_char ) );
  current = revcomp( rc );
  curr_start = 0;

  // cycle through the rc_reflist to include these ranges in the hash as well
  for( long int i=1; i<rc_reflist.size(); i++ ){
    rc = rlist[i].substr( rlist[i].length() - max_sort_char, max_sort_char );
    rc = revcomp( rc );
    if( rc.compare( current ) != 0 ){
      // check if current already exists in hash
      if( get<0>( get_read_range(current) ) == -1 ){
        read_range.insert( { current, make_tuple( 0, 0, curr_start+1, i )});
      }
      else{
        get<2>( read_range[current] ) = curr_start+1;
        get<3>( read_range[current] ) = i;
      }
      curr_start = i;
      current = rc;
    }
  }
  
  // add the last entry
  if( get<0>( get_read_range(current) ) == -1 ){
    read_range.insert( { current, make_tuple( 0, 0, curr_start+1, rc_reflist.size() )});
  }
  else{
    get<2>( read_range[current] ) = curr_start+1;
    get<3>( read_range[current] ) = rc_reflist.size();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, -0x38(%rbp)
movq 0xedef(%rip), %rsi      # 0x1b6a8
leaq 0xed64(%rip), %rax      # 0x1b624
movslq (%rax), %rcx
xorl %r12d, %r12d
leaq -0x58(%rbp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x4330
pushq $0x1
popq %rbx
pushq $0x20
popq %r13
leaq -0xc0(%rbp), %r15
movq 0xedc7(%rip), %rax      # 0x1b6b0
movq 0xedb8(%rip), %rdi      # 0x1b6a8
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rax, %rbx
jae 0xc98e
addq %r13, %rdi
leaq 0xed1a(%rip), %rax      # 0x1b624
movslq (%rax), %rdx
xorl %esi, %esi
movq %r14, %rcx
callq 0x43c0
testl %eax, %eax
je 0xc982
andq $0x0, -0x80(%rbp)
incq %r12
movq %rbx, -0x78(%rbp)
movq %r12, -0x70(%rbp)
movq %r15, %rdi
movq %r14, %rsi
leaq -0x80(%rbp), %rdx
callq 0xd22a
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0xeb10
movq %r15, %rdi
callq 0x4160
movq 0xed53(%rip), %rsi      # 0x1b6a8
addq %r13, %rsi
leaq 0xecc5(%rip), %rax      # 0x1b624
movslq (%rax), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4330
movq %r14, %rdi
movq %r15, %rsi
callq 0x4390
movq %r15, %rdi
callq 0x4160
movq %rbx, %r12
incq %rbx
addq $0x20, %r13
jmp 0xc8e2
leaq -0x80(%rbp), %rdx
andq $0x0, (%rdx)
incq %r12
movq %rax, 0x8(%rdx)
movq %r12, 0x10(%rdx)
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xd260
leaq -0xc0(%rbp), %rsi
movq -0x38(%rbp), %r12
movq %r12, %rdi
callq 0xeb10
leaq -0xc0(%rbp), %rdi
callq 0x4160
movq 0xecd1(%rip), %rsi      # 0x1b6a8
movq 0x8(%rsi), %rdx
leaq 0xec42(%rip), %rax      # 0x1b624
movslq (%rax), %rcx
subq %rcx, %rdx
leaq -0x80(%rbp), %rdi
callq 0x4330
leaq -0x118(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4410
leaq -0xc0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x802c
leaq -0x58(%rbp), %rdi
leaq -0xc0(%rbp), %r13
movq %r13, %rsi
callq 0x4390
movq %r13, %rdi
callq 0x4160
leaq -0x118(%rbp), %rdi
callq 0x4160
pushq $0x1
popq %rcx
pushq $0x20
popq %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x138(%rbp), %r14
movq 0xec6d(%rip), %rax      # 0x1b6c8
subq 0xec5e(%rip), %rax      # 0x1b6c0
sarq $0x3, %rax
cmpq %rax, %rcx
jae 0xcbda
movq %rcx, %rbx
movq %r12, %r15
movq 0xec2c(%rip), %rsi      # 0x1b6a8
movq -0x60(%rbp), %rax
movq 0x8(%rsi,%rax), %rdx
addq %rax, %rsi
leaq 0xeb95(%rip), %rax      # 0x1b624
movslq (%rax), %rcx
subq %rcx, %rdx
movq %r13, %rdi
callq 0x4330
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x4390
movq %r13, %rdi
callq 0x4160
movq %r14, %rdi
movq %r12, %rsi
callq 0x4410
movq %r13, %rdi
movq %r14, %rsi
callq 0x802c
movq %r12, %rdi
movq %r13, %rsi
callq 0x4390
movq %r13, %rdi
callq 0x4160
movq %r14, %rdi
callq 0x4160
movq %r12, %rdi
leaq -0x58(%rbp), %rsi
callq 0x4030
movq %rbx, %r14
leaq -0x158(%rbp), %rbx
movq %r15, %r12
testl %eax, %eax
je 0xcbc3
movq %rbx, %rdi
leaq -0x58(%rbp), %rsi
callq 0x4410
leaq -0xc0(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xcf28
movq -0xa8(%rbp), %r12
movq %rbx, %rdi
callq 0x4160
cmpq $-0x1, %r12
je 0xcb68
movq -0x38(%rbp), %r12
movq %r12, %rdi
leaq -0x58(%rbp), %rsi
callq 0xefd2
movq -0x30(%rbp), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq %r12, %rdi
leaq -0x58(%rbp), %rsi
callq 0xefd2
movq %r14, (%rax)
jmp 0xcbaf
movq -0x30(%rbp), %rax
incq %rax
movq %r14, -0xd8(%rbp)
movq %rax, -0xd0(%rbp)
andq $0x0, -0xc8(%rbp)
movq %r15, %rdi
leaq -0x58(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0xd296
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xeb10
movq %r15, %rdi
callq 0x4160
leaq -0x58(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x41d0
movq %r14, %rax
movq %r14, -0x30(%rbp)
incq %r14
addq $0x20, -0x60(%rbp)
leaq -0xc0(%rbp), %r13
movq %r14, %rcx
jmp 0xca4d
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4410
leaq -0xc0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
movq %r12, %rsi
callq 0xcf28
movq -0xa8(%rbp), %rbx
leaq -0xf8(%rbp), %rdi
callq 0x4160
cmpq $-0x1, %rbx
je 0xcc56
leaq -0x58(%rbp), %rsi
movq %r12, %rdi
callq 0xefd2
movq -0x30(%rbp), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq 0xea91(%rip), %rbx      # 0x1b6c8
movq 0xea82(%rip), %r14      # 0x1b6c0
leaq -0x58(%rbp), %rsi
movq %r12, %rdi
callq 0xefd2
subq %r14, %rbx
sarq $0x3, %rbx
movq %rbx, (%rax)
jmp 0xccad
movq 0xea6b(%rip), %rax      # 0x1b6c8
subq 0xea5c(%rip), %rax      # 0x1b6c0
movq -0x30(%rbp), %rcx
incq %rcx
sarq $0x3, %rax
leaq -0xd8(%rbp), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
andq $0x0, 0x10(%rdx)
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xd2cc
leaq -0xc0(%rbp), %rsi
movq %r12, %rdi
callq 0xeb10
leaq -0xc0(%rbp), %rdi
callq 0x4160
leaq -0x80(%rbp), %rdi
callq 0x4160
leaq -0x58(%rbp), %rdi
callq 0x4160
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xccfb
jmp 0xcd3f
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
jmp 0xcd33
jmp 0xcd3f
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
jmp 0xcd33
jmp 0xcd3f
jmp 0xcd3a
jmp 0xcd17
jmp 0xcd3a
jmp 0xcd3f
jmp 0xcd3f
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
jmp 0xcd33
jmp 0xcd3f
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
jmp 0xcd33
jmp 0xcd3a
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
jmp 0xcd46
jmp 0xcd3a
jmp 0xcd3f
jmp 0xcd3f
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
callq 0x4160
jmp 0xcd42
movq %rax, %rbx
jmp 0xcd4b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x4160
leaq -0x58(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x4590