// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rdi), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0xd(%rcx)
movups %xmm0, 0x4(%rcx)
movslq 0x73e7(%rip), %rax      # 0xb1cc
testq %rax, %rax
jle 0x3ece
leaq 0x4(%rcx), %rdx
movl 0x7404(%rip), %esi      # 0xb1fc
movl 0x73e1(%rip), %r8d      # 0xb1e0
xorl %r9d, %r9d
movl 0x73db(%rip), %r10d     # 0xb1e4
xorl %ebp, %ebp
xorl %r11d, %r11d
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movzbl 0x41d(%rcx,%r12), %r13d
cmpl $0x60, %r13d
jg 0x3e42
cmpl $0x46, %r13d
jle 0x3e61
cmpl $0x47, %r13d
je 0x3e7b
cmpl $0x4e, %r13d
je 0x3e8d
cmpl $0x54, %r13d
je 0x3e5a
jmp 0x3e94
cmpl $0x66, %r13d
jle 0x3e6f
cmpl $0x67, %r13d
je 0x3e7b
cmpl $0x6e, %r13d
je 0x3e8d
cmpl $0x74, %r13d
jne 0x3e94
incl %ebx
movl %ebx, 0xc(%rcx)
jmp 0x3e94
cmpl $0x41, %r13d
je 0x3e84
cmpl $0x43, %r13d
je 0x3e7b
jmp 0x3e94
cmpl $0x61, %r13d
je 0x3e84
cmpl $0x63, %r13d
jne 0x3e94
incl %r14d
movl %r14d, 0x10(%rcx)
jmp 0x3e94
incl %r11d
movl %r11d, 0x8(%rcx)
jmp 0x3e94
incl %r15d
movl %r15d, 0x18(%rcx)
movsbl 0xc1d(%rcx,%r12), %r13d
subl %esi, %r13d
cmpl %r8d, %r13d
jle 0x3eb2
cmpl %r10d, %r13d
jl 0x3eb7
incl %r9d
movl %r9d, (%rdx)
jmp 0x3eb7
incl %ebp
movl %ebp, 0x14(%rcx)
incq %r12
cmpq %r12, %rax
jne 0x3e19
cvtsi2ss %r11d, %xmm2
cvtsi2ss %ebx, %xmm1
jmp 0x3ed4
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movss 0x7314(%rip), %xmm0     # 0xb1f0
ucomiss %xmm0, %xmm2
jae 0x3ee6
ucomiss %xmm0, %xmm1
jb 0x3eea
movb $0x1, 0x1c(%rcx)
cmpb $0x0, 0x72d7(%rip)      # 0xb1c8
je 0x4008
movq 0x8(%rdi), %rcx
xorps %xmm1, %xmm1
movups %xmm1, 0xd(%rcx)
movups %xmm1, 0x4(%rcx)
testl %eax, %eax
jle 0x3ff4
leaq 0x4(%rcx), %rdx
movl 0x72e4(%rip), %esi      # 0xb1fc
movl 0x72c2(%rip), %edi      # 0xb1e0
xorl %r8d, %r8d
movl 0x72bc(%rip), %r9d      # 0xb1e4
xorl %ebx, %ebx
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
movzbl 0x41d(%rcx,%r15), %r12d
cmpl $0x60, %r12d
jg 0x3f61
cmpl $0x46, %r12d
jle 0x3f82
cmpl $0x47, %r12d
je 0x3f9c
cmpl $0x4e, %r12d
je 0x3fac
cmpl $0x54, %r12d
je 0x3f79
jmp 0x3fb3
cmpl $0x66, %r12d
jle 0x3f90
cmpl $0x67, %r12d
je 0x3f9c
cmpl $0x6e, %r12d
je 0x3fac
cmpl $0x74, %r12d
jne 0x3fb3
incl %r11d
movl %r11d, 0xc(%rcx)
jmp 0x3fb3
cmpl $0x41, %r12d
je 0x3fa3
cmpl $0x43, %r12d
je 0x3f9c
jmp 0x3fb3
cmpl $0x61, %r12d
je 0x3fa3
cmpl $0x63, %r12d
jne 0x3fb3
incl %ebp
movl %ebp, 0x10(%rcx)
jmp 0x3fb3
incl %r10d
movl %r10d, 0x8(%rcx)
jmp 0x3fb3
incl %r14d
movl %r14d, 0x18(%rcx)
movsbl 0xc1d(%rcx,%r15), %r12d
subl %esi, %r12d
cmpl %edi, %r12d
jle 0x3fd1
cmpl %r9d, %r12d
jl 0x3fd6
incl %r8d
movl %r8d, (%rdx)
jmp 0x3fd6
incl %ebx
movl %ebx, 0x14(%rcx)
incq %r15
cmpq %r15, %rax
jne 0x3f38
xorps %xmm2, %xmm2
cvtsi2ss %r10d, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %r11d, %xmm1
jmp 0x3ffa
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
ucomiss %xmm0, %xmm2
jae 0x4004
ucomiss %xmm0, %xmm1
jb 0x4008
movb $0x1, 0x1c(%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq