// File: /workspace/github_c_makefile_star2_O1/annoroad[P]fqtools_plus/fqtools.c
// Function: quality_base_percent
local void quality_base_percent(struct readclass* readclass){
	readline* read1 = readclass->read1;
    int i=0;
    int curqual;
    read1->highAT_sign=0;
    read1->low = 0;
	read1->N = 0;
    read1->Q30=0;
    read1->A=0;
    read1->T=0;
    read1->GC=0;
	char* seq=(read1->reads)[1];
	char* qual=(read1->reads)[3];
    while(i < g.CUT){
        switch (*(seq + i)){
            case 'A': read1->A++; break;
            case 'a': read1->A++; break;
            case 'T': read1->T++; break;
            case 't': read1->T++; break;
            case 'G': read1->GC++; break;
            case 'g': read1->GC++; break;
            case 'C': read1->GC++; break;
            case 'c': read1->GC++; break;
            case 'N': read1->N++;  break;
            case 'n': read1->N++;  break;
        }
        curqual = (int)*(qual + i) - g.ASCII;
        i++;
        if (curqual <= g.LOWQ){
           	read1->low++;
            continue;
        }

        if (curqual >= g.HIGHQ){
            read1->Q30++;
            continue;
        }
    }
    if (read1->A >= g.highAT || read1->T >= g.highAT){
    	read1->highAT_sign=1;
    }
    if (g.single_or_pair){
    	readline* read2 = readclass->read2;
    	i=0;
	    read2->highAT_sign=0;
	    read2->low = 0;
		read2->N = 0;
	    read2->Q30=0;
	    read2->A=0;
	    read2->T=0;
	    read2->GC=0;
	   	seq=(read2->reads)[1];
		qual=(read2->reads)[3];
	    while(i < g.CUT){
	        switch (*(seq + i)){
	            case 'A': read2->A++; break;
	            case 'a': read2->A++; break;
	            case 'T': read2->T++; break;
	            case 't': read2->T++; break;
	            case 'G': read2->GC++; break;
	            case 'g': read2->GC++; break;
	            case 'C': read2->GC++; break;
	            case 'c': read2->GC++; break;
	            case 'N': read2->N++;  break;
	            case 'n': read2->N++;  break;
	        }
	        curqual = (int)*(qual + i) - g.ASCII;
	        i++;
	        if (curqual <= g.LOWQ){
	            read2->low++;
	            continue;
	        }
	        if (curqual >= g.HIGHQ){
	            read2->Q30++;
	            continue;
	        }
	    }
		if (read2->A >= g.highAT || read2->T >= g.highAT){
		   	read2->highAT_sign=1;
		}
    }
    
}

// Assembly:
pushq %r14
pushq %rbx
movq (%rdi), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0xd(%rcx)
movups %xmm0, 0x4(%rcx)
movslq 0x739d(%rip), %rax      # 0xb1c4
testq %rax, %rax
jle 0x3edb
leaq 0x14(%rcx), %rdx
leaq 0x4(%rcx), %rsi
movl 0x73b5(%rip), %r8d      # 0xb1f4
movl 0x7392(%rip), %r9d      # 0xb1d8
movl 0x738f(%rip), %r10d     # 0xb1dc
xorl %r11d, %r11d
movzbl 0x41d(%rcx,%r11), %ebx
cmpl $0x60, %ebx
jg 0x3e74
cmpl $0x46, %ebx
jle 0x3e8d
cmpl $0x47, %ebx
je 0x3ea3
cmpl $0x4e, %ebx
je 0x3ead
cmpl $0x54, %ebx
je 0x3e88
jmp 0x3eb0
cmpl $0x66, %ebx
jle 0x3e99
cmpl $0x67, %ebx
je 0x3ea3
cmpl $0x6e, %ebx
je 0x3ead
cmpl $0x74, %ebx
jne 0x3eb0
incl 0xc(%rcx)
jmp 0x3eb0
cmpl $0x41, %ebx
je 0x3ea8
cmpl $0x43, %ebx
je 0x3ea3
jmp 0x3eb0
cmpl $0x61, %ebx
je 0x3ea8
cmpl $0x63, %ebx
jne 0x3eb0
incl 0x10(%rcx)
jmp 0x3eb0
incl 0x8(%rcx)
jmp 0x3eb0
incl 0x18(%rcx)
movsbl 0xc1d(%rcx,%r11), %ebx
subl %r8d, %ebx
movq %rdx, %r14
cmpl %r9d, %ebx
jle 0x3ecc
movq %rsi, %r14
cmpl %r10d, %ebx
jl 0x3ecf
incl (%r14)
incq %r11
cmpq %r11, %rax
jne 0x3e50
cvtsi2ssl 0x8(%rcx), %xmm1
movss 0x7300(%rip), %xmm0     # 0xb1e8
ucomiss %xmm0, %xmm1
jae 0x3efa
xorps %xmm1, %xmm1
cvtsi2ssl 0xc(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jb 0x3efe
movb $0x1, 0x1c(%rcx)
cmpb $0x0, 0x72bb(%rip)      # 0xb1c0
je 0x3ff6
movq 0x8(%rdi), %rcx
xorps %xmm1, %xmm1
movups %xmm1, 0xd(%rcx)
movups %xmm1, 0x4(%rcx)
testl %eax, %eax
jle 0x3fd8
leaq 0x14(%rcx), %rdx
leaq 0x4(%rcx), %rsi
movl 0x72c4(%rip), %edi      # 0xb1f4
movl 0x72a1(%rip), %r8d      # 0xb1d8
movl 0x729e(%rip), %r9d      # 0xb1dc
xorl %r10d, %r10d
movzbl 0x41d(%rcx,%r10), %r11d
cmpl $0x60, %r11d
jg 0x3f6a
cmpl $0x46, %r11d
jle 0x3f87
cmpl $0x47, %r11d
je 0x3fa1
cmpl $0x4e, %r11d
je 0x3fab
cmpl $0x54, %r11d
je 0x3f82
jmp 0x3fae
cmpl $0x66, %r11d
jle 0x3f95
cmpl $0x67, %r11d
je 0x3fa1
cmpl $0x6e, %r11d
je 0x3fab
cmpl $0x74, %r11d
jne 0x3fae
incl 0xc(%rcx)
jmp 0x3fae
cmpl $0x41, %r11d
je 0x3fa6
cmpl $0x43, %r11d
je 0x3fa1
jmp 0x3fae
cmpl $0x61, %r11d
je 0x3fa6
cmpl $0x63, %r11d
jne 0x3fae
incl 0x10(%rcx)
jmp 0x3fae
incl 0x8(%rcx)
jmp 0x3fae
incl 0x18(%rcx)
movsbl 0xc1d(%rcx,%r10), %r11d
subl %edi, %r11d
movq %rdx, %rbx
cmpl %r8d, %r11d
jle 0x3fca
movq %rsi, %rbx
cmpl %r9d, %r11d
jl 0x3fcc
incl (%rbx)
incq %r10
cmpq %r10, %rax
jne 0x3f41
xorps %xmm1, %xmm1
cvtsi2ssl 0x8(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jae 0x3ff2
xorps %xmm1, %xmm1
cvtsi2ssl 0xc(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jb 0x3ff6
movb $0x1, 0x1c(%rcx)
popq %rbx
popq %r14
retq