// File: BenLangmead[P]bowtie/ebwt_search.cpp
// Function: createSinkFactory(HitSink&, unsigned long)
static HitSinkPerThreadFactory*
createSinkFactory(HitSink& _sink, size_t threadId) {
	HitSinkPerThreadFactory *sink = NULL;
	if(!strata) {
		// Unstratified
		if(!allHits) {
			// First N good; "good" inherently ignores strata
			sink = new NGoodHitSinkPerThreadFactory(_sink, khits, mhits, defaultMapq, threadId);
		} else {
			// All hits, spanning strata
			sink = new AllHitSinkPerThreadFactory(_sink, mhits, defaultMapq, threadId);
		}
	} else {
		// Stratified
		assert(stateful);
		if(!allHits) {
			assert(stateful);
			// Buffer best hits, assuming they're arriving in best-
			// to-worst order
			sink = new NBestFirstStratHitSinkPerThreadFactory(_sink, khits, mhits, defaultMapq, threadId);
		} else {
			assert(stateful);
			// Buffer best hits, assuming they're arriving in best-
			// to-worst order
			sink = new NBestFirstStratHitSinkPerThreadFactory(_sink, 0xffffffff/2, mhits, defaultMapq, threadId);
		}
	}
	assert(sink != NULL);
	return sink;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
testb $0x1, 0x8bae2(%rip)     # 0xab411
jne 0x1f9fa
testb $0x1, 0x8ba78(%rip)     # 0xab3b4
jne 0x1f99d
movl $0x28, %edi
callq 0xa5f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rsi
movl 0x8baac(%rip), %edx     # 0xab408
movl 0x8baaa(%rip), %ecx     # 0xab40c
movl 0x8bb1f(%rip), %r8d     # 0xab488
movq -0x10(%rbp), %r9
callq 0x369f0
jmp 0x1f974
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1f9f5
movq -0x30(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x28, %esi
callq 0xa600
jmp 0x1fac6
movl $0x20, %edi
callq 0xa5f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rsi
movl 0x8ba51(%rip), %edx     # 0xab40c
movl 0x8bac7(%rip), %ecx     # 0xab488
movq -0x10(%rbp), %r8
callq 0x36a60
jmp 0x1f9cc
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1f9f5
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x20, %esi
callq 0xa600
jmp 0x1fac6
jmp 0x1fabc
testb $0x1, 0x8b9b3(%rip)     # 0xab3b4
jne 0x1fa5f
movl $0x28, %edi
callq 0xa5f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rsi
movl 0x8b9e7(%rip), %edx     # 0xab408
movl 0x8b9e5(%rip), %ecx     # 0xab40c
movl 0x8ba5a(%rip), %r8d     # 0xab488
movq -0x10(%rbp), %r9
callq 0x36ac0
jmp 0x1fa39
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1faba
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x28, %esi
callq 0xa600
jmp 0x1fac6
movl $0x28, %edi
callq 0xa5f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rsi
movl 0x8b98f(%rip), %ecx     # 0xab40c
movl 0x8ba04(%rip), %r8d     # 0xab488
movq -0x10(%rbp), %r9
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
callq 0x36ac0
jmp 0x1fa94
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1faba
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x28, %esi
callq 0xa600
jmp 0x1fac6
jmp 0x1fabc
movq -0x18(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0xab60
nop