// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./ls.h
// Function: LarssonSadakane<int>::choose_pivot(int*, int)
inline T choose_pivot(T *p, T n) {
	   T *pl, *pm, *pn;
	   T s;

	   pm=p+(n>>1);                 /* small arrays, middle element.*/
	   if (n>7) {
		  pl=p;
		  pn=p+n-1;
		  if (n>40) {               /* big arrays, pseudomedian of 9.*/
			 s=n>>3;
			 pl=LS_SMED3(pl, pl+s, pl+s+s);
			 pm=LS_SMED3(pm-s, pm, pm+s);
			 pn=LS_SMED3(pn-s-s, pn-s, pn);
		  }
		  pm=LS_SMED3(pl, pm, pn);      /* midsize arrays, median of 3.*/
	   }
	   return LS_KEY(pm);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %eax
sarl %eax
cltq
leaq (%rsi,%rax,4), %r8
cmpl $0x7, %edx
jle 0x17db2
movl %edx, %eax
leaq (%rsi,%rax,4), %r9
addq $-0x4, %r9
cmpl $0x28, %edx
jbe 0x17dbe
shrl $0x3, %edx
movq 0x8(%rdi), %rax
movl (%rsi), %r11d
movl 0x14(%rdi), %ecx
leal (%rcx,%r11), %edi
movslq %edi, %rdi
movl (%rax,%rdi,4), %ebx
movl %edx, %edi
shll $0x2, %edi
leaq (%rsi,%rdi), %r13
movl (%rsi,%rdi), %r10d
leal (%r10,%rcx), %ebp
movslq %ebp, %r14
movl (%rax,%r14,4), %r12d
leaq (%r13,%rdi), %r14
movl (%rdi,%r13), %r15d
leal (%r15,%rcx), %edi
movslq %edi, %rdi
movl (%rax,%rdi,4), %ebp
cmpl %r12d, %ebx
jge 0x17dd0
cmpl %ebp, %r12d
jl 0x17de5
cmpl %ebp, %ebx
cmovll %r15d, %r11d
cmovlq %r14, %rsi
jmp 0x17ddf
movq 0x8(%rdi), %rax
movl 0x14(%rdi), %ecx
jmp 0x17ee8
movq 0x8(%rdi), %rax
movl (%rsi), %r10d
movl 0x14(%rdi), %ecx
movl (%r8), %edx
jmp 0x17ea9
cmpl %ebp, %r12d
jg 0x17de5
cmpl %ebp, %ebx
cmovgl %r15d, %r11d
cmovgq %r14, %rsi
movl %r11d, %r10d
movq %rsi, %r13
movq %r13, -0x8(%rsp)
movslq %ecx, %rsi
movq %rdx, %r11
negq %r11
leal (,%rdx,4), %r12d
movq %r8, %rbx
subq %r12, %rbx
movl (%rbx), %r14d
leal (%r14,%rcx), %edx
movslq %edx, %rdx
movl (%rax,%rdx,4), %ebp
movl (%r8), %edx
leal (%rdx,%rcx), %edi
movslq %edi, %rdi
movl (%rax,%rdi,4), %edi
leaq (%r8,%r12), %r15
movl (%r8,%r12), %r12d
leal (%r12,%rcx), %r13d
movslq %r13d, %r13
movl (%rax,%r13,4), %r13d
cmpl %edi, %ebp
jge 0x17e43
cmpl %r13d, %edi
jl 0x17e59
cmpl %r13d, %ebp
cmovll %r12d, %r14d
cmovlq %r15, %rbx
jmp 0x17e53
cmpl %r13d, %edi
jg 0x17e59
cmpl %r13d, %ebp
cmovgl %r12d, %r14d
cmovgq %r15, %rbx
movl %r14d, %edx
movq %rbx, %r8
leaq (%r9,%r11,4), %rbx
leaq (%rbx,%r11,4), %r11
movslq (%r11), %rdi
addq %rsi, %rdi
movl (%rax,%rdi,4), %ebp
movslq (%rbx), %rdi
addq %rsi, %rdi
movl (%rax,%rdi,4), %edi
movslq (%r9), %r14
addq %rsi, %r14
movl (%rax,%r14,4), %esi
cmpl %edi, %ebp
jge 0x17e92
cmpl %esi, %edi
movq -0x8(%rsp), %rdi
jl 0x17e9b
cmpl %esi, %ebp
cmovgeq %r11, %r9
jmp 0x17ea6
cmpl %esi, %edi
movq -0x8(%rsp), %rdi
jle 0x17ea0
movq %rbx, %r9
jmp 0x17ea6
cmpl %esi, %ebp
cmovleq %r11, %r9
movq %rdi, %rsi
addl %ecx, %r10d
movslq %r10d, %rdi
movl (%rax,%rdi,4), %edi
addl %ecx, %edx
movslq %edx, %rdx
movl (%rax,%rdx,4), %edx
movslq (%r9), %r10
movslq %ecx, %r11
addq %r10, %r11
movl (%rax,%r11,4), %r10d
cmpl %edx, %edi
jge 0x17ed9
cmpl %r10d, %edx
jl 0x17ee8
cmpl %r10d, %edi
cmovlq %r9, %rsi
jmp 0x17ee5
cmpl %r10d, %edx
jg 0x17ee8
cmpl %r10d, %edi
cmovgq %r9, %rsi
movq %rsi, %r8
movslq (%r8), %rdx
movslq %ecx, %rcx
addq %rdx, %rcx
movl (%rax,%rcx,4), %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop