// File: /workspace/github_cpp_makefile_star2_O1/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 0x41afb
movq %rdx, %r15
movq %rdi, %r14
leaq 0x50(%rdi), %r12
movq %r12, %rdi
callq 0x4bff0
cmpq $0x1, 0x18(%r15)
jne 0x41a47
movq 0x8(%r15), %rbx
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x41b32
movq (%rbx), %rcx
movq %rcx, (%rax)
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x41b32
andb $0x3f, 0x7(%rax)
jmp 0x41af3
movq %r12, 0x10(%rsp)
movq 0x48(%r14), %rbx
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x41b32
leaq 0x30(%r14), %r12
movabsq $0x3fffffffffffffff, %r13 # imm = 0x3FFFFFFFFFFFFFFF
andq %r13, %rbx
leaq (%rbx,%r13), %rcx
incq %rcx
movq %rcx, (%rax)
movq 0x18(%r15), %rax
cmpq $0x1, %rax
je 0x41ac3
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x8(%r15), %rsi
addq %rbp, %rsi
movq %r12, %rdi
callq 0x40eea
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 0x41a86
movq 0x8(%r15), %rcx
leaq (%rcx,%rax,8), %rsi
addq $-0x8, %rsi
movq %r12, %rdi
callq 0x40eea
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 0x4c02c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41b2a
jmp 0x41b15
movq %r12, 0x10(%rsp)
jmp 0x41b15
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0x4c02c
movq %r14, %rdi
callq 0x9930
movq %rax, %rdi
callq 0x1b23d