// File: /workspace/github_cpp_makefile_star2_O1/BenLangmead[P]bowtie/pat.cpp
// Function: RawPatternSource::parse(Read&, Read&, unsigned long) const
bool RawPatternSource::parse(Read& r, Read& rb, TReadId rdid) const {
	assert(r.empty());
	assert(!r.readOrigBuf.empty());
	size_t cur = 0;
	const size_t buflen = r.readOrigBuf.length();

	// Parse sequence
	assert(r.patFw.empty());
	int nchar = 0;
	int c = r.readOrigBuf[cur++];


	cur--;
	while(cur < buflen) {
		c = r.readOrigBuf[cur++];
		if(isalpha(c)) {
			assert_in(toupper(c), "ACGTN");
			if(nchar++ >= this->trim5_) {
				assert_neq(0, asc2dnacat[c]);
				r.patFw.append(asc2dna[c]);
			}
		}
	}
	assert_eq(cur, buflen);
	// record amt trimmed from 5' end due to --trim5
	r.trimmed5 = (int)(nchar - r.patFw.length());
	// record amt trimmed from 3' end due to --trim3
	r.trimmed3 = (int)(r.patFw.trimEnd(this->trim3_));

	// Give the name field a dummy value
	char cbuf[20];
	itoa10<TReadId>(rdid, cbuf);
	r.name.install(cbuf);

	// Give the base qualities dummy values
	assert(r.qual.empty());
	const size_t len = r.patFw.length();
	for(size_t i = 0; i < len; i++) {
		r.qual.append('I');
	}
	r.parsed = true;
	if(!rb.parsed && !rb.readOrigBuf.empty()) {
		return parse(rb, r, rdid);
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x30(%rsp)
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
movq 0x140(%rsi), %rbx
testq %rbx, %rbx
movq %rdx, 0x28(%rsp)
je 0x4ec6b
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x128(%r14), %rax
movsbl (%rax,%r15), %ebp
movl %ebp, %edi
callq 0x9800
testl %eax, %eax
je 0x4ec5b
leal 0x1(%r12), %r13d
movq 0x8(%rsp), %rax
cmpl 0x18(%rax), %r12d
jl 0x4ec5e
movslq %ebp, %rax
leaq 0x1e90b(%rip), %rcx     # 0x6d550
movb (%rcx,%rax), %al
movb %al, 0x10(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4f074
jmp 0x4ec5e
movl %r12d, %r13d
incq %r15
movl %r13d, %r12d
cmpq %r15, %rbx
jne 0x4ec14
jmp 0x4ec6e
xorl %r13d, %r13d
movq 0x20(%r14), %rax
subl %eax, %r13d
movl %r13d, 0x1a8(%r14)
movq 0x8(%rsp), %rcx
movslq 0x14(%rcx), %rcx
xorl %edx, %edx
movq %rax, %rsi
subq %rcx, %rsi
cmovaeq %rsi, %rdx
cmovbq %rax, %rcx
movq %rdx, 0x20(%r14)
movl %ecx, 0x1ac(%r14)
leaq 0xf(%rsp), %rsi
leaq 0x9750(%rip), %rdi      # 0x583fc
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movq 0x30(%rsp), %r15
movq %r15, %rcx
movq %rcx, %rax
mulq %r8
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, %r9
subq %rax, %r9
movb (%rdi,%r9), %al
movb %al, 0x1(%rsi)
incq %rsi
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x4ecbe
leaq 0x10(%rsp), %rax
cmpq %rax, %rsi
jbe 0x4ed16
leaq 0x11(%rsp), %rax
movq %rsi, %rcx
movb -0x1(%rax), %dl
movb (%rcx), %dil
movb %dil, -0x1(%rax)
movb %dl, (%rcx)
decq %rcx
leaq 0x1(%rax), %rdx
cmpq %rcx, %rax
movq %rdx, %rax
jb 0x4ecfb
movb $0x0, 0x1(%rsi)
leaq 0x150(%r14), %r13
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x91b0
movq 0x150(%r14), %rcx
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq *0x10(%rcx)
movq 0x20(%r14), %rbx
testq %rbx, %rbx
je 0x4ed68
leaq 0x60(%r14), %r13
leaq 0x7(%rsp), %rbp
movb $0x49, 0x7(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4f02e
decq %rbx
jne 0x4ed53
movb $0x1, 0x190(%r14)
movb $0x1, %al
movq 0x28(%rsp), %rsi
cmpb $0x0, 0x190(%rsi)
jne 0x4ed9b
cmpq $0x0, 0x140(%rsi)
je 0x4ed9b
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
movq %r14, %rdx
movq %r15, %rcx
callq *0x18(%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq