// File: BenLangmead[P]bowtie/./sequence_io.h
// Function: void readSequenceString<SString<char>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, EList<SString<char>, 128>&, long&, int, bool)
void readSequenceString(const std::string& s,
                        EList<T>& ss,
                        int64_t& baseCutoff,
                        int seqCutoff = -1,
                        bool reverse = false)
{
	// Split string s using comma as a delimiter.  Borrowed from C++
	// Programming HOWTO 7.3
	std::string::size_type lastPos = s.find_first_not_of(",", 0);
	std::string::size_type pos = s.find_first_of(",", lastPos);
	while (baseCutoff > 0 && (std::string::npos != pos || std::string::npos != lastPos)) {
		string stmp = s.substr(lastPos, pos - lastPos);
		if((int64_t)stmp.length() < baseCutoff) {
			baseCutoff -= stmp.length();
		} else {
			stmp = stmp.substr(0, baseCutoff);
			baseCutoff = 0;
		}
		if(reverse) {
			size_t len = stmp.length();
			for(size_t i = 0; i < len/2; i++) {
				char tmp = stmp[i];
				stmp[i] = stmp[len-i-1];
				stmp[len-i-1] = tmp;
			}
			ss.push_back(T(stmp.c_str()));
		} else {
			ss.push_back(T(stmp.c_str()));
		}
		if(seqCutoff != -1 && ss.size() >= (size_t)seqCutoff) {
			return;
		}
	    lastPos = s.find_first_not_of(",", pos);
	    pos = s.find_first_of(",", lastPos);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
andb $0x1, %al
movb %al, -0x1d(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x626ee(%rip), %rsi     # 0x8d73b
xorl %eax, %eax
movl %eax, %edx
callq 0xa2f0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x626d2(%rip), %rsi     # 0x8d73b
callq 0xa2a0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0xdd(%rbp)
jle 0x2b0b9
movb $0x1, %al
movq $-0x1, %rcx
cmpq -0x30(%rbp), %rcx
movb %al, -0xde(%rbp)
jne 0x2b0ad
movq $-0x1, %rax
cmpq -0x28(%rbp), %rax
setne %al
movb %al, -0xde(%rbp)
movb -0xde(%rbp), %al
movb %al, -0xdd(%rbp)
movb -0xdd(%rbp), %al
testb $0x1, %al
jne 0x2b0c8
jmp 0x2b3da
movq -0x8(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
subq -0x28(%rbp), %rcx
leaq -0x50(%rbp), %rdi
callq 0xa620
leaq -0x50(%rbp), %rdi
callq 0xa950
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jge 0x2b10e
leaq -0x50(%rbp), %rdi
callq 0xa950
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
subq %rdx, %rcx
movq %rcx, (%rax)
jmp 0x2b15c
movq -0x18(%rbp), %rax
movq (%rax), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa620
jmp 0x2b128
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xa760
leaq -0x70(%rbp), %rdi
callq 0xacd8
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
jmp 0x2b15c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2b3cf
testb $0x1, -0x1d(%rbp)
je 0x2b2e0
leaq -0x50(%rbp), %rdi
callq 0xa950
movq %rax, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jae 0x2b278
movq -0x90(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xacb0
movq %rax, -0xe8(%rbp)
jmp 0x2b1b4
movq -0xe8(%rbp), %rax
movb (%rax), %al
movb %al, -0x91(%rbp)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rsi
notq %rsi
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0xacb0
movq %rax, -0xf0(%rbp)
jmp 0x2b1e9
movq -0xf0(%rbp), %rax
movb (%rax), %al
movb %al, -0xf9(%rbp)
movq -0x90(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xacb0
movq %rax, -0xf8(%rbp)
jmp 0x2b211
movq -0xf8(%rbp), %rax
movb -0xf9(%rbp), %cl
movb %cl, (%rax)
movb -0x91(%rbp), %al
movb %al, -0x109(%rbp)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rsi
notq %rsi
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0xacb0
movq %rax, -0x108(%rbp)
jmp 0x2b252
movq -0x108(%rbp), %rax
movb -0x109(%rbp), %cl
movb %cl, (%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x2b181
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xa210
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x2b3f0
jmp 0x2b29d
movq -0x118(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2a130
jmp 0x2b2b2
leaq -0xb8(%rbp), %rdi
callq 0x25170
jmp 0x2b345
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x25170
jmp 0x2b3cf
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xa210
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x2b3f0
jmp 0x2b305
movq -0x120(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x2a130
jmp 0x2b31a
leaq -0xd8(%rbp), %rdi
callq 0x25170
jmp 0x2b345
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x25170
jmp 0x2b3cf
cmpl $-0x1, -0x1c(%rbp)
je 0x2b379
movq -0x10(%rbp), %rdi
callq 0x250e0
movq %rax, -0x128(%rbp)
jmp 0x2b35d
movq -0x128(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jb 0x2b379
movl $0x1, -0xdc(%rbp)
jmp 0x2b3b3
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x623b3(%rip), %rsi     # 0x8d73b
callq 0xa2f0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6239b(%rip), %rsi     # 0x8d73b
callq 0xa2a0
movq %rax, -0x30(%rbp)
movl $0x0, -0xdc(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xacd8
movl -0xdc(%rbp), %eax
testl %eax, %eax
je 0x2b3ca
jmp 0x2b3c8
jmp 0x2b3da
jmp 0x2b072
leaq -0x50(%rbp), %rdi
callq 0xacd8
jmp 0x2b3e3
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0xab60
nopl (%rax)