// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/QV.c
// Function: QVcoding_Scan1
void QVcoding_Scan1(int rlen, char *delQV, char *delTag, char *insQV, char *mergeQV, char *subQV)
{
  if (rlen == 0)   //  Initialization call
    { int   i;

      //  Zero histograms

      bzero(delHist,sizeof(uint64)*256);
      bzero(mrgHist,sizeof(uint64)*256);
      bzero(insHist,sizeof(uint64)*256);
      bzero(subHist,sizeof(uint64)*256);

      for (i = 0; i < 256; i++)
        delRun[i] = subRun[i] = 1;

      totChar    = 0;
      delChar    = -1;
      subChar    = -1;
      return;
    }

  //  Add streams to accumulating histograms and figure out the run chars
  //    for the deletion and substition streams

  Histogram_Seqs(delHist,(uint8 *) delQV,rlen);
  Histogram_Seqs(insHist,(uint8 *) insQV,rlen);
  Histogram_Seqs(mrgHist,(uint8 *) mergeQV,rlen);
  Histogram_Seqs(subHist,(uint8 *) subQV,rlen);

  if (delChar < 0)
    { int   k;

      for (k = 0; k < rlen; k++)
        if (delTag[k] == 'n' || delTag[k] == 'N')
          { delChar = delQV[k];
            break;
          }
    }
  if (delChar >= 0)
    Histogram_Runs( delRun,(uint8 *) delQV,rlen,delChar);
  totChar += rlen;
  if (subChar < 0)
    { if (totChar >= 100000)
        { int k;

          subChar = 0;
          for (k = 1; k < 256; k++)
            if (subHist[k] > subHist[subChar])
              subChar = k;
        }
    }
  if (subChar >= 0)
    Histogram_Runs( subRun,(uint8 *) subQV,rlen,subChar);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x9d3a
leaq 0xae50(%rip), %rdi      # 0x14ae0
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x1120
leaq 0xb63d(%rip), %rdi      # 0x152e0
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x1120
leaq 0xbe2a(%rip), %rdi      # 0x15ae0
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x1120
leaq 0xc617(%rip), %rdi      # 0x162e0
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x1120
movl $0x0, -0x34(%rbp)
cmpl $0x100, -0x34(%rbp)     # imm = 0x100
jge 0x9d16
movslq -0x34(%rbp), %rcx
leaq 0xcdf0(%rip), %rax      # 0x16ae0
movq $0x1, (%rax,%rcx,8)
movslq -0x34(%rbp), %rcx
leaq 0xd5dd(%rip), %rax      # 0x172e0
movq $0x1, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9cdc
movq $0x0, 0xddbf(%rip) # 0x17ae0
movl $0xffffffff, 0xddbd(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0xddb7(%rip) # imm = 0xFFFFFFFF
jmp 0x9ea8
movq -0x10(%rbp), %rsi
movl -0x4(%rbp), %edx
leaq 0xad98(%rip), %rdi      # 0x14ae0
callq 0x9eb0
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
leaq 0xbd85(%rip), %rdi      # 0x15ae0
callq 0x9eb0
movq -0x28(%rbp), %rsi
movl -0x4(%rbp), %edx
leaq 0xb572(%rip), %rdi      # 0x152e0
callq 0x9eb0
movq -0x30(%rbp), %rsi
movl -0x4(%rbp), %edx
leaq 0xc55f(%rip), %rdi      # 0x162e0
callq 0x9eb0
cmpl $0x0, 0xdd5b(%rip)      # 0x17ae8
jge 0x9de3
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x9de1
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x6e, %eax
je 0x9dc0
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x4e, %eax
jne 0x9dd4
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, 0xdd16(%rip)      # 0x17ae8
jmp 0x9de1
jmp 0x9dd6
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x9d96
jmp 0x9de3
cmpl $0x0, 0xdcfe(%rip)      # 0x17ae8
jl 0x9e05
movq -0x10(%rbp), %rsi
movl -0x4(%rbp), %edx
movl 0xdcef(%rip), %ecx      # 0x17ae8
leaq 0xd4e0(%rip), %rdi      # 0x172e0
callq 0x9f00
movslq -0x4(%rbp), %rax
addq 0xdcd0(%rip), %rax      # 0x17ae0
movq %rax, 0xdcc9(%rip)      # 0x17ae0
cmpl $0x0, 0xdcce(%rip)      # 0x17aec
jge 0x9e84
cmpq $0x186a0, 0xdcb5(%rip) # imm = 0x186A0
jb 0x9e82
movl $0x0, 0xdcb5(%rip)      # 0x17aec
movl $0x1, -0x3c(%rbp)
cmpl $0x100, -0x3c(%rbp)     # imm = 0x100
jge 0x9e80
movslq -0x3c(%rbp), %rcx
leaq 0xc48e(%rip), %rax      # 0x162e0
movq (%rax,%rcx,8), %rax
movslq 0xdc8f(%rip), %rdx      # 0x17aec
leaq 0xc47c(%rip), %rcx      # 0x162e0
cmpq (%rcx,%rdx,8), %rax
jbe 0x9e73
movl -0x3c(%rbp), %eax
movl %eax, 0xdc79(%rip)      # 0x17aec
jmp 0x9e75
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9e3e
jmp 0x9e82
jmp 0x9e84
cmpl $0x0, 0xdc61(%rip)      # 0x17aec
jl 0x9ea6
movq -0x30(%rbp), %rsi
movl -0x4(%rbp), %edx
movl 0xdc52(%rip), %ecx      # 0x17aec
leaq 0xcc3f(%rip), %rdi      # 0x16ae0
callq 0x9f00
jmp 0x9ea8
addq $0x40, %rsp
popq %rbp
retq
nop