// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./ebwt_search_util.h
// Function: PartialAlignmentManager::addPartials(unsigned int, EList<PartialAlignment, 128> const&)
void addPartials(uint32_t patid, const EList<PartialAlignment>& ps) {
		if(ps.size() == 0) return;
		ThreadSafe _ts(&mutex_m);
		size_t origPlSz = _partialsList.size();
		// Assert that the entry doesn't exist yet
		assert(_partialsMap.find(patid) == _partialsMap.end());
		if(ps.size() == 1) {
			_partialsMap[patid] = ps[0];
			_partialsMap[patid].entry.type = 0; // singleton
		} else {
#ifndef NDEBUG
			// Make sure there are not duplicate entries
			for(size_t i = 0; i < ps.size()-1; i++)
				for(size_t j = i+1; j < ps.size(); j++)
					assert(!samePartialAlignment(ps[i], ps[j]));
#endif
			// Insert a "pointer" record into the map that refers to
			// the stretch of the _partialsList vector that contains
			// the partial alignments.
			PartialAlignment al;
			al.u64.u64 = 0xffffffffffffffffllu;
			al.off.off = origPlSz;
			al.off.type = 1; // list offset
			_partialsMap[patid] = al; // install pointer
			assert_gt(ps.size(), 1);
			// Now add all the non-tail partial alignments (all but the
			// last) to the _partialsList
			for(size_t i = 0; i < ps.size()-1; i++) {
				assert(validPartialAlignment(ps[i]));
				_partialsList.push_back(ps[i]);
				// list entry (non-tail)
				_partialsList.back().entry.type = 2;
			}
			// Now add the tail (last) partial alignment and mark it as
			// such
			assert(validPartialAlignment(ps.back()));
			_partialsList.push_back(ps.back());
			// list tail
			_partialsList.back().entry.type = 3;
#ifndef NDEBUG
			// Make sure there are not duplicate entries
			assert_eq(_partialsList.size(), origPlSz + ps.size());
			for(size_t i = origPlSz; i < _partialsList.size()-1; i++) {
				for(size_t j = i+1; j < _partialsList.size(); j++) {
					assert(!samePartialAlignment(_partialsList[i], _partialsList[j]));
				}
			}
#endif
		}
		// Assert that we added an entry
		assert(_partialsMap.find(patid) != _partialsMap.end());
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0xc(%rsp)
cmpq $0x0, 0x18(%rdx)
je 0x40c6f
movq %rdx, %r15
movq %rdi, %r14
leaq 0x50(%rdi), %r12
movq %r12, %rdi
callq 0x4ac58
cmpq $0x1, 0x18(%r15)
jne 0x40bb9
movq 0x8(%r15), %rbx
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x40ca6
movq (%rbx), %rcx
movq %rcx, (%rax)
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x40ca6
andb $0x3f, 0x7(%rax)
jmp 0x40c67
movq %r12, 0x10(%rsp)
movq 0x48(%r14), %rbx
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x40ca6
leaq 0x30(%r14), %r12
movabsq $0x3fffffffffffffff, %r13 # imm = 0x3FFFFFFFFFFFFFFF
andq %r13, %rbx
leaq (%rbx,%r13), %rcx
incq %rcx
movq %rcx, (%rax)
movl $0x1, %eax
cmpq $0x1, 0x18(%r15)
je 0x40c37
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x8(%r15), %rsi
addq %rbp, %rsi
movq %r12, %rdi
callq 0x40062
movq 0x38(%r14), %rax
movq 0x48(%r14), %rcx
movq -0x8(%rax,%rcx,8), %rdx
andq %r13, %rdx
btsq $0x3f, %rdx
movq %rdx, -0x8(%rax,%rcx,8)
incq %rbx
movq 0x18(%r15), %rax
leaq -0x1(%rax), %rcx
addq $0x8, %rbp
cmpq %rcx, %rbx
jb 0x40bfa
movq 0x8(%r15), %rcx
leaq (%rcx,%rax,8), %rsi
addq $-0x8, %rsi
movq %r12, %rdi
callq 0x40062
movq 0x38(%r14), %rax
movq 0x48(%r14), %rcx
movabsq $-0x4000000000000000, %rdx # imm = 0xC000000000000000
orq %rdx, -0x8(%rax,%rcx,8)
movq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x4ac94
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40c9e
jmp 0x40c89
movq %r12, 0x10(%rsp)
jmp 0x40c89
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x4ac94
movq %r14, %rdi
callq 0x9930
movq %rax, %rdi
callq 0x1afa3