// File: /workspace/github_cpp_makefile_star2_O3/afinit[P]afin/extension.cpp
// Function: Extension::build_string()
void Extension::build_string(){
  string ATCGstr( "ATCG" );

  // loop len times processing 1 basepair at a time
  for( int i=0; i<len; i++ ){
    vector<int> ATCG_curr = { 0,0,0,0 };
    int max = 0;
    int avg = 0;
    
    // check coverage at current position
    if( matches.check_cov( start+(pos_mult*i) ) < min_cov ){
      break;
    }
    
    int next_char = 0;

    for( int j=0; j<matches.get_matchlist_size(); j++ ){
      next_char = matches.get_pos( j, start+(pos_mult*i) );

      if ( next_char == 'A' ) {
        ATCG_curr[0]++;
      }
      else if ( next_char == 'T' ) {
        ATCG_curr[1]++;
      }
      else if ( next_char == 'C' ) {
        ATCG_curr[2]++;
      }
      else if ( next_char == 'G' ) {
        ATCG_curr[3]++;
      }
    }

    // find character with greatest appearance
    for( int j=1; j<4; j++ ){
      if( ATCG_curr[j] > ATCG_curr[max] ) {
        max = j;
      }
    }

    // add next base
    if( back ){
      exten_seq.append( ATCGstr.substr( max, 1 ) );
    }
    else{
      exten_seq.insert( 0, ATCGstr.substr( max, 1 ) );
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3b60(%rip), %rsi      # 0x16671
leaq 0x3b5d(%rip), %rdx      # 0x16675
leaq -0x88(%rbp), %rdi
callq 0x6be0
cmpl $0x0, 0xcc(%rbx)
jle 0x12cb2
leaq 0xa8(%rbx), %r14
xorl %r13d, %r13d
leaq -0x50(%rbp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movl $0x4, %edx
leaq -0x68(%rbp), %rdi
movq %r12, %rsi
leaq -0x29(%rbp), %rcx
callq 0x12f7e
movl 0xc8(%rbx), %esi
imull %r13d, %esi
addl 0x80(%rbx), %esi
movq %rbx, %rdi
callq 0xe4c6
leaq 0xaa9e(%rip), %rcx      # 0x1d618
cmpl (%rcx), %eax
jl 0x12ca4
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0xdc12
cmpq %r15, %rax
jbe 0x12bf2
movl 0xc8(%rbx), %edx
imull %r13d, %edx
addl 0x80(%rbx), %edx
movq %rbx, %rdi
movl %r15d, %esi
callq 0xdc32
movzbl %al, %eax
cmpl $0x46, %eax
jg 0x12bc9
cmpl $0x41, %eax
je 0x12bdd
cmpl $0x43, %eax
jne 0x12bed
movq -0x68(%rbp), %rax
addq $0x8, %rax
jmp 0x12beb
cmpl $0x47, %eax
je 0x12be3
cmpl $0x54, %eax
jne 0x12bed
movq -0x68(%rbp), %rax
addq $0x4, %rax
jmp 0x12beb
movq -0x68(%rbp), %rax
jmp 0x12beb
movq -0x68(%rbp), %rax
addq $0xc, %rax
incl (%rax)
incq %r15
jmp 0x12b85
xorl %edx, %edx
movl $0x1, %eax
movq -0x68(%rbp), %rcx
movl (%rcx,%rax,4), %edi
movslq %edx, %r8
movl %eax, %esi
cmpl (%rcx,%r8,4), %edi
jg 0x12c0d
movl %edx, %esi
incq %rax
movl %esi, %edx
cmpq $0x4, %rax
jne 0x12bfd
movslq %esi, %rdx
cmpb $0x0, 0x84(%rbx)
je 0x12c4a
movl $0x1, %ecx
movq %r12, %rdi
leaq -0x88(%rbp), %rsi
callq 0x4330
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x40f0
jmp 0x12c72
movl $0x1, %ecx
movq %r12, %rdi
leaq -0x88(%rbp), %rsi
callq 0x4330
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %r8
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4350
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x12c84
callq 0x42f0
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x12c92
callq 0x42f0
incl %r13d
cmpl 0xcc(%rbx), %r13d
jl 0x12b3f
jmp 0x12cb2
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x12cb2
callq 0x42f0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x12cc7
callq 0x42f0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12cda
jmp 0x12cfa
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x12cfd
callq 0x42f0
jmp 0x12cfd
jmp 0x12cfa
jmp 0x12cfa
movq %rax, %rbx
jmp 0x12d0b
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x12d0b
callq 0x42f0
leaq -0x78(%rbp), %rax
movq -0x88(%rbp), %rdi
cmpq %rax, %rdi
je 0x12d20
callq 0x42f0
movq %rbx, %rdi
callq 0x4590