// File: 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
subq $0x4c0, %rsp            # imm = 0x4C0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3a8(%rbp)
leaq 0x242c7(%rip), %rdi     # 0x3e748
xorl %eax, %eax
movl %eax, %esi
callq 0x1b5a0
movq %rax, %rsi
leaq 0x24230(%rip), %rax     # 0x3e6c4
movslq (%rax), %rcx
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x43e0
movq $0x0, -0x30(%rbp)
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x3b0(%rbp)
leaq 0x24282(%rip), %rdi     # 0x3e748
callq 0x1b790
movq %rax, %rcx
movq -0x3b0(%rbp), %rax
cmpq %rcx, %rax
jae 0x1a66d
movq -0x38(%rbp), %rsi
leaq 0x2425f(%rip), %rdi     # 0x3e748
callq 0x1b5a0
movq %rax, %rdi
leaq 0x241cc(%rip), %rax     # 0x3e6c4
movslq (%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rcx
callq 0x44e0
movl %eax, -0x3b4(%rbp)
jmp 0x1a510
movl -0x3b4(%rbp), %eax
cmpl $0x0, %eax
je 0x1a65a
movq -0x3a8(%rbp), %rax
movq %rax, -0x3c0(%rbp)
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0xac(%rbp), %rcx
leaq -0xb0(%rbp), %r8
callq 0x1b970
jmp 0x1a576
leaq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x1b9c0
jmp 0x1a58f
movq -0x3c0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1b930
movb %dl, -0x3c9(%rbp)
movq %rax, -0x3c8(%rbp)
jmp 0x1a5b1
movb -0x3c9(%rbp), %al
movq -0x3c8(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xbf10
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x2415e(%rip), %rdi     # 0x3e748
callq 0x1b5a0
movq %rax, %rsi
leaq 0x240cb(%rip), %rax     # 0x3e6c4
movslq (%rax), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0xe0(%rbp), %rdi
callq 0x43e0
jmp 0x1a60e
leaq -0x28(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x4480
leaq -0xe0(%rbp), %rdi
callq 0x4270
jmp 0x1a65a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1add6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xbf10
jmp 0x1add6
jmp 0x1a65c
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1a4b4
movq -0x3a8(%rbp), %rax
movq %rax, -0x3d8(%rbp)
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x140(%rbp)
leaq 0x240b8(%rip), %rdi     # 0x3e748
callq 0x1b790
movq %rax, -0x148(%rbp)
movl $0x0, -0x14c(%rbp)
movl $0x0, -0x150(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x148(%rbp), %rdx
leaq -0x14c(%rbp), %rcx
leaq -0x150(%rbp), %r8
callq 0x1ba00
jmp 0x1a6da
leaq -0x120(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x138(%rbp), %rdx
callq 0x1ba50
jmp 0x1a6f3
movq -0x3d8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x1b930
movb %dl, -0x3e1(%rbp)
movq %rax, -0x3e0(%rbp)
jmp 0x1a715
movb -0x3e1(%rbp), %al
movq -0x3e0(%rbp), %rcx
movq %rcx, -0x160(%rbp)
movb %al, -0x158(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xbf10
leaq 0x24006(%rip), %rdi     # 0x3e748
movq %rdi, -0x400(%rbp)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0x3f8(%rbp)
callq 0x1b5a0
movq -0x400(%rbp), %rdi
movq -0x3f8(%rbp), %rsi
movq %rax, -0x3f0(%rbp)
callq 0x1b5a0
movq %rax, %rdi
callq 0x45e0
movq -0x3f0(%rbp), %rsi
movq %rax, %rdx
leaq 0x23f38(%rip), %rax     # 0x3e6c4
movslq (%rax), %rcx
subq %rcx, %rdx
leaq -0x180(%rbp), %rdi
callq 0x43e0
jmp 0x1a7a0
leaq -0x1c0(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x41b0
jmp 0x1a7b5
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0xfc10
jmp 0x1a7ca
leaq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x4480
leaq -0x1a0(%rbp), %rdi
callq 0x4270
leaq -0x1c0(%rbp), %rdi
callq 0x4270
movq $0x0, -0x30(%rbp)
movq $0x1, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq 0x23f46(%rip), %rdi     # 0x3e760
callq 0x1b7b0
movq %rax, %rcx
movq -0x408(%rbp), %rax
cmpq %rcx, %rax
jae 0x1abbf
movq -0x1c8(%rbp), %rsi
leaq 0x23f08(%rip), %rdi     # 0x3e748
movq %rdi, -0x418(%rbp)
callq 0x1b5a0
movq -0x418(%rbp), %rdi
movq %rax, -0x410(%rbp)
movq -0x1c8(%rbp), %rsi
callq 0x1b5a0
movq %rax, %rdi
callq 0x45e0
movq -0x410(%rbp), %rsi
movq %rax, %rdx
leaq 0x23e45(%rip), %rax     # 0x3e6c4
movslq (%rax), %rcx
subq %rcx, %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x43e0
jmp 0x1a893
leaq -0x180(%rbp), %rdi
movq %rdi, -0x420(%rbp)
leaq -0x1e8(%rbp), %rsi
movq %rsi, -0x428(%rbp)
callq 0x4480
movq -0x428(%rbp), %rdi
callq 0x4270
movq -0x420(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x41b0
jmp 0x1a8d5
leaq -0x208(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0xfc10
jmp 0x1a8ea
leaq -0x180(%rbp), %rdi
movq %rdi, -0x438(%rbp)
leaq -0x208(%rbp), %rsi
movq %rsi, -0x440(%rbp)
callq 0x4480
movq -0x440(%rbp), %rdi
callq 0x4270
leaq -0x228(%rbp), %rdi
callq 0x4270
movq -0x438(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4050
movl %eax, -0x42c(%rbp)
jmp 0x1a93b
movl -0x42c(%rbp), %eax
cmpl $0x0, %eax
je 0x1aba6
leaq -0x268(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x41b0
jmp 0x1a95c
movq -0x3a8(%rbp), %rsi
leaq -0x248(%rbp), %rdi
leaq -0x268(%rbp), %rdx
callq 0x1b0b0
jmp 0x1a978
leaq -0x248(%rbp), %rdi
callq 0x1ba90
movq (%rax), %rax
movq %rax, -0x448(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4270
movq -0x448(%rbp), %rax
cmpq $-0x1, %rax
jne 0x1ab0d
movq -0x3a8(%rbp), %rax
movq %rax, -0x450(%rbp)
movl $0x0, -0x2c4(%rbp)
movl $0x0, -0x2c8(%rbp)
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x2d0(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2c4(%rbp), %rsi
leaq -0x2c8(%rbp), %rdx
leaq -0x2d0(%rbp), %rcx
leaq -0x1c8(%rbp), %r8
callq 0x1bab0
jmp 0x1aa05
leaq -0x2a8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x2c0(%rbp), %rdx
callq 0x1bb00
jmp 0x1aa1e
movq -0x450(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x1b930
movb %dl, -0x459(%rbp)
movq %rax, -0x458(%rbp)
jmp 0x1aa40
movb -0x459(%rbp), %al
movq -0x458(%rbp), %rcx
movq %rcx, -0x2e0(%rbp)
movb %al, -0x2d8(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0xbf10
jmp 0x1ab87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xbf10
jmp 0x1add6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1adca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x4270
jmp 0x1adca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x4270
jmp 0x1adca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4270
jmp 0x1adca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0xbf10
jmp 0x1adca
movq -0x3a8(%rbp), %rdi
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x470(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x1bb40
movq %rax, -0x468(%rbp)
jmp 0x1ab34
movq -0x468(%rbp), %rdi
callq 0x17fe0
movq -0x470(%rbp), %rcx
movq -0x3a8(%rbp), %rdi
movq %rcx, (%rax)
movq -0x1c8(%rbp), %rax
movq %rax, -0x480(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x1bb40
movq %rax, -0x478(%rbp)
jmp 0x1ab71
movq -0x478(%rbp), %rdi
callq 0x18000
movq -0x480(%rbp), %rcx
movq %rcx, (%rax)
movq -0x1c8(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4060
jmp 0x1aba4
jmp 0x1aba6
jmp 0x1aba8
movq -0x1c8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1c8(%rbp)
jmp 0x1a805
leaq -0x320(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x41b0
jmp 0x1abd1
movq -0x3a8(%rbp), %rsi
leaq -0x300(%rbp), %rdi
leaq -0x320(%rbp), %rdx
callq 0x1b0b0
jmp 0x1abed
leaq -0x300(%rbp), %rdi
callq 0x1ba90
movq (%rax), %rax
movq %rax, -0x488(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x4270
movq -0x488(%rbp), %rax
cmpq $-0x1, %rax
jne 0x1ad2d
movq -0x3a8(%rbp), %rax
movq %rax, -0x490(%rbp)
movl $0x0, -0x37c(%rbp)
movl $0x0, -0x380(%rbp)
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x388(%rbp)
leaq 0x23b09(%rip), %rdi     # 0x3e760
callq 0x1b7b0
movq %rax, -0x390(%rbp)
leaq -0x378(%rbp), %rdi
leaq -0x37c(%rbp), %rsi
leaq -0x380(%rbp), %rdx
leaq -0x388(%rbp), %rcx
leaq -0x390(%rbp), %r8
callq 0x1bb70
jmp 0x1ac8d
leaq -0x360(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x378(%rbp), %rdx
callq 0x1bbc0
jmp 0x1aca6
movq -0x490(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x1b930
movb %dl, -0x499(%rbp)
movq %rax, -0x498(%rbp)
jmp 0x1acc8
movb -0x499(%rbp), %al
movq -0x498(%rbp), %rcx
movq %rcx, -0x3a0(%rbp)
movb %al, -0x398(%rbp)
leaq -0x360(%rbp), %rdi
callq 0xbf10
jmp 0x1adac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x4270
jmp 0x1adca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x360(%rbp), %rdi
callq 0xbf10
jmp 0x1adca
movq -0x3a8(%rbp), %rdi
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x4b0(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x1bb40
movq %rax, -0x4a8(%rbp)
jmp 0x1ad54
movq -0x4a8(%rbp), %rdi
callq 0x17fe0
movq -0x4b0(%rbp), %rcx
movq %rcx, (%rax)
leaq 0x239ef(%rip), %rdi     # 0x3e760
callq 0x1b7b0
movq -0x3a8(%rbp), %rdi
movq %rax, -0x4c0(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x1bb40
movq %rax, -0x4b8(%rbp)
jmp 0x1ad96
movq -0x4b8(%rbp), %rdi
callq 0x18000
movq -0x4c0(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x180(%rbp), %rdi
callq 0x4270
leaq -0x28(%rbp), %rdi
callq 0x4270
addq $0x4c0, %rsp            # imm = 0x4C0
popq %rbp
retq
leaq -0x180(%rbp), %rdi
callq 0x4270
leaq -0x28(%rbp), %rdi
callq 0x4270
movq -0x40(%rbp), %rdi
callq 0x46c0
nopl (%rax,%rax)