// File: /workspace/github_cpp_makefile_star2_O1/nanjiangshu[P]calSOV/calSOV.cpp
// Function: ProofReading(char*, int, int)
int ProofReading(char *predSec, int seqLength, int method_ProofReading = 0)/*{{{*/
{
    //proof reading for predicted result, for 1 long strand (sheet)
    int Part1;
    int Part2;
    int ik;
    int ij;
    if (method_ProofReading == 0)/*{{{*/
    {
        int NShe = 0;
        for (ik=0; ik<seqLength; ik++)
        {
            if (  predSec[ik] == 'S'  )
            {
                NShe++;
            }
            else
            {
                if (  NShe == 1  )
                {
                    //previous
                    Part1 = ik-3;
                    Part2 = ik +1 ;
                    if (  (Part1>=0) && (predSec[Part1]=='S')  )
                    {
                        predSec[Part1+1] = 'S';
                    }
                    else if (  (Part2<seqLength) && (predSec[Part2]=='S')  )
                    {
                        predSec[Part2-1] = 'S';
                    }
                    else
                    {
                        for (ij=ik-NShe; ij<ik; ij++)
                        {
                            predSec[ij] = 'R';
                        }
                    }
                }
                NShe = 0;
            }
        }


        //proof reading for predicted result, for 1 or 2 long helix
        int NHel = 0;
        for (ik=0; ik<seqLength; ik++)
        {
            if (  predSec[ik] == 'H'  )
            {
                NHel++;
            }
            else
            {
                if  (   (NHel>=1) &&  (NHel<=2)   )
                {
                    //previous
                    Part1 = ik-NHel-2;
                    Part2 = ik +1 ;
                    if (  (Part1>=0) && (predSec[Part1]=='H')  )
                    {
                        predSec[Part1+1] = 'H';
                    }
                    else if (  (Part2<seqLength) && (predSec[Part2]=='H')  )
                    {
                        predSec[Part2-1] = 'H';
                    }
                    else
                    {
                        for (ij=ik-NHel; ij<ik; ij++)
                        {
                            predSec[ij] = 'R';
                        }
                    }
                }
                NHel = 0;
            }
        } 
    }/*}}}*/
    else if (method_ProofReading == 1)/*{{{*/
    {  /*do not proof reading single residue sheet, when using the DSSP8to3 scheme BE --> Sheet, 2009-10-29*/
        //proof reading for predicted result, for 1 or 2 long helix
        int NHel = 0;
        for (ik=0; ik<seqLength; ik++)
        {
            if (  predSec[ik] == 'H'  )
            {
                NHel++;
            }
            else
            {
                if  (   (NHel>=1) &&  (NHel<=2)   )
                {
                    //previous
                    Part1 = ik-NHel-2;
                    Part2 = ik +1 ;
                    if (  (Part1>=0) && (predSec[Part1]=='H')  )
                    {
                        predSec[Part1+1] = 'H';
                    }
                    else if (  (Part2<seqLength) && (predSec[Part2]=='H')  )
                    {
                        predSec[Part2-1] = 'H';
                    }
                    else
                    {
                        for (ij=ik-NHel; ij<ik; ij++)
                        {
                            predSec[ij] = 'R';
                        }
                    }
                }
                NHel = 0;
            }
        } 
    }/*}}}*/
    return seqLength;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r8d
movq %rdi, %r14
testl %edx, %edx
je 0x346f
cmpl $0x1, %edx
jne 0x3583
testl %r8d, %r8d
jle 0x3583
movl %r8d, %r15d
xorl %r12d, %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r13d
xorl %edx, %edx
movl %r8d, 0x4(%rsp)
cmpb $0x48, (%r14,%r12)
jne 0x33e2
incl %edx
movl %edx, %ebx
jmp 0x3457
leal -0x1(%rdx), %eax
xorl %ebx, %ebx
cmpl $0x1, %eax
ja 0x3457
movl %edx, %eax
negl %eax
addq %r12, %rax
cmpl $0x2, %eax
jl 0x340c
movl %eax, %ecx
cmpb $0x48, -0x2(%r14,%rcx)
jne 0x340c
movl %eax, %eax
movb $0x48, -0x1(%r14,%rax)
jmp 0x3457
leaq 0x1(%r12), %rax
cmpq %r15, %rax
jae 0x3425
cmpb $0x48, 0x1(%r14,%r12)
jne 0x3425
movb $0x48, (%r14,%r12)
jmp 0x3457
testl %edx, %edx
jle 0x3457
movslq %edx, %rax
movq %r14, %rdi
subq %rax, %rdi
addq %r12, %rdi
movl %r13d, %eax
subl %edx, %eax
cmpl %eax, %r12d
cmovgl %r12d, %eax
addl %ebp, %edx
addl %eax, %edx
incq %rdx
movl $0x52, %esi
callq 0x2100
movl 0x4(%rsp), %r8d
incq %r12
decl %ebp
incl %r13d
movl %ebx, %edx
cmpq %r12, %r15
jne 0x33d5
jmp 0x3583
testl %r8d, %r8d
jle 0x34cd
movl %r8d, %eax
xorl %ecx, %ecx
xorl %esi, %esi
cmpb $0x53, (%r14,%rcx)
jne 0x3488
incl %esi
movl %esi, %edx
jmp 0x34c3
xorl %edx, %edx
cmpl $0x1, %esi
jne 0x34c3
cmpq $0x3, %rcx
jb 0x34a5
cmpb $0x53, -0x3(%r14,%rcx)
jne 0x34a5
movb $0x53, -0x2(%r14,%rcx)
jmp 0x34c3
leaq 0x1(%rcx), %rsi
cmpq %rax, %rsi
jae 0x34bd
cmpb $0x53, 0x1(%r14,%rcx)
jne 0x34bd
movb $0x53, (%r14,%rcx)
jmp 0x34c3
movb $0x52, -0x1(%r14,%rcx)
incq %rcx
movl %edx, %esi
cmpq %rcx, %rax
jne 0x347b
testl %r8d, %r8d
jle 0x3583
movl %r8d, %r15d
xorl %r12d, %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r13d
xorl %edx, %edx
movl %r8d, 0x4(%rsp)
cmpb $0x48, (%r14,%r12)
jne 0x34fb
incl %edx
movl %edx, %ebx
jmp 0x3570
leal -0x1(%rdx), %eax
xorl %ebx, %ebx
cmpl $0x1, %eax
ja 0x3570
movl %edx, %eax
negl %eax
addq %r12, %rax
cmpl $0x2, %eax
jl 0x3525
movl %eax, %ecx
cmpb $0x48, -0x2(%r14,%rcx)
jne 0x3525
movl %eax, %eax
movb $0x48, -0x1(%r14,%rax)
jmp 0x3570
leaq 0x1(%r12), %rax
cmpq %r15, %rax
jae 0x353e
cmpb $0x48, 0x1(%r14,%r12)
jne 0x353e
movb $0x48, (%r14,%r12)
jmp 0x3570
testl %edx, %edx
jle 0x3570
movslq %edx, %rax
movq %r14, %rdi
subq %rax, %rdi
addq %r12, %rdi
movl %r13d, %eax
subl %edx, %eax
cmpl %eax, %r12d
cmovgl %r12d, %eax
addl %ebp, %edx
addl %eax, %edx
incq %rdx
movl $0x52, %esi
callq 0x2100
movl 0x4(%rsp), %r8d
incq %r12
decl %ebp
incl %r13d
movl %ebx, %edx
cmpq %r12, %r15
jne 0x34ee
movl %r8d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq