// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_sort.c
// Function: ks_introsort_heap
static void swap_header_targets(bam_header_t *h1, bam_header_t *h2)
{
	bam_header_t t;
	t.n_targets = h1->n_targets, h1->n_targets = h2->n_targets, h2->n_targets = t.n_targets;
	t.target_name = h1->target_name, h1->target_name = h2->target_name, h2->target_name = t.target_name;
	t.target_len = h1->target_len, h1->target_len = h2->target_len, h2->target_len = t.target_len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x10(%rsp)
testq %rdi, %rdi
je 0x33031
movq %rdi, %r15
cmpq $0x2, %rdi
jne 0x32918
cmpl $0x0, 0x1da8c(%rip)     # 0x50370
je 0x32fb0
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rbx
movq 0x38(%rax), %r14
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
je 0x32fe7
testb %al, %al
jne 0x32ff8
jmp 0x33031
movl $0x2, %ecx
movl $0xf0, %edi
movl $0x2, %ebx
movl $0x1, %eax
shlq %cl, %rax
incq %rcx
addq $0xc0, %rdi
addl $0x2, %ebx
cmpq %r15, %rax
jb 0x32927
callq 0x3240
shlq $0x5, %r15
movq 0x10(%rsp), %rdx
leaq (%rdx,%r15), %rcx
movq %rcx, 0x78(%rsp)
leaq (%rdx,%r15), %rdi
addq $-0x20, %rdi
movq %rax, 0x80(%rsp)
movq %rax, 0x18(%rsp)
movq %rdx, %rsi
movl 0x1d9f9(%rip), %r8d     # 0x50370
movl $0x20, %eax
subq %rsi, %rax
movq %rax, 0x88(%rsp)
movl %r8d, 0x4(%rsp)
movq %rsi, 0x20(%rsp)
cmpq %rdi, %rsi
jae 0x32e36
decl %ebx
je 0x32e27
movl %ebx, 0x2c(%rsp)
movq %rdi, 0x8(%rsp)
movq %rdi, %r14
subq %rsi, %r14
sarq $0x6, %r14
shlq $0x5, %r14
movl (%rsi), %edi
movq 0x8(%rsi), %r11
movq 0x10(%rsi), %rdx
movq 0x18(%rsi), %r15
movl 0x20(%rsi,%r14), %r10d
movq 0x28(%rsi,%r14), %r12
movq 0x30(%rsi,%r14), %r9
movq 0x38(%rsi,%r14), %rsi
testl %r8d, %r8d
je 0x32a01
testq %rsi, %rsi
sete %al
testq %r15, %r15
sete %cl
orb %al, %cl
movl $0xc0, %ebx
je 0x32a29
movq %rsi, %r13
testb %al, %al
jne 0x32a7b
jmp 0x32b14
movq %rsi, %r13
cmpq %r11, %r12
movl $0xc0, %ebx
ja 0x32a7b
jne 0x32b14
cmpl %edi, %r10d
jg 0x32a7b
sete %cl
cmpq %rdx, %r9
seta %al
andb %cl, %al
movq %r13, %rsi
jmp 0x329f5
movl %edi, 0x48(%rsp)
movq %rsi, %r13
movq 0x30(%rsi), %rdi
movq 0x30(%r15), %rsi
movq %rdx, %rbp
movq %r15, 0x40(%rsp)
movq %r9, %r15
movq %r12, 0x30(%rsp)
movl %r10d, %r12d
movq %r11, 0x38(%rsp)
callq 0x35e5f
movq 0x38(%rsp), %r11
movl %r12d, %r10d
movq 0x30(%rsp), %r12
movq %r15, %r9
movq 0x40(%rsp), %r15
movl 0x48(%rsp), %edi
movl 0x4(%rsp), %r8d
testl %eax, %eax
jle 0x32b0b
testl %r8d, %r8d
je 0x32ad6
testq %r13, %r13
sete %cl
movq 0x8(%rsp), %rbp
je 0x32b8f
movq 0x18(%rbp), %r15
testq %r15, %r15
je 0x32b8f
movq 0x30(%r13), %rdi
movq 0x30(%r15), %rsi
callq 0x35e5f
movl 0x4(%rsp), %r8d
movb $0x1, %cl
testl %eax, %eax
jg 0x32b8f
jne 0x32b8d
movl 0xc(%r13), %eax
andl %ebx, %eax
movl 0xc(%r15), %ecx
andl %ebx, %ecx
cmpl %ecx, %eax
seta %cl
jmp 0x32b8f
movq 0x8(%rsp), %rbp
movq 0x8(%rbp), %rax
movb $0x1, %cl
cmpq %rax, %r12
ja 0x32b8f
jne 0x32b8d
cmpl (%rbp), %r10d
jg 0x32b8f
sete %al
cmpq 0x10(%rbp), %r9
seta %cl
andb %al, %cl
jmp 0x32b8f
movq %rbp, %rdx
je 0x32ba4
testl %r8d, %r8d
je 0x32b5e
movq 0x8(%rsp), %rbp
movq 0x18(%rbp), %r14
testq %r14, %r14
sete %cl
movq 0x20(%rsp), %r12
je 0x32bc4
testq %r15, %r15
je 0x32bc4
movq 0x30(%r14), %rdi
movq 0x30(%r15), %rsi
callq 0x35e5f
movl 0x4(%rsp), %r8d
movb $0x1, %cl
testl %eax, %eax
jg 0x32bc4
je 0x32e11
xorl %ecx, %ecx
jmp 0x32bc4
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movb $0x1, %cl
cmpq %r11, %rax
movq 0x20(%rsp), %r12
ja 0x32bbf
jne 0x32bbd
movq 0x8(%rsp), %rbp
cmpl %edi, (%rbp)
jg 0x32bc4
sete %al
cmpq %rdx, 0x10(%rbp)
seta %cl
andb %al, %cl
jmp 0x32bc4
xorl %ecx, %ecx
movq 0x20(%rsp), %r12
leaq (%r12,%r14), %rax
addq $0x20, %rax
testb %cl, %cl
cmovneq %rbp, %rax
jmp 0x32bcd
movq %r13, %rsi
movl 0xc(%r13), %eax
andl %ebx, %eax
movl 0xc(%r15), %ecx
andl %ebx, %ecx
cmpl %ecx, %eax
seta %al
jmp 0x329f5
xorl %ecx, %ecx
movq 0x8(%rsp), %rbp
testb %cl, %cl
movq %rbp, %rax
cmovneq %r12, %rax
movl (%rax), %ecx
movl %ecx, 0x38(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rax), %r13
cmpq %rbp, %rax
je 0x32c20
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movups %xmm1, 0x10(%rbp)
movups %xmm0, (%rbp)
testq %r13, %r13
sete 0x40(%rsp)
movq %rbp, %r14
xorl %ebp, %ebp
testl %r8d, %r8d
je 0x32c6f
movq 0x38(%r12,%rbp), %r15
testq %r15, %r15
sete %al
je 0x32c9a
testq %r13, %r13
je 0x32c9a
movq 0x30(%r15), %rdi
movq 0x30(%r13), %rsi
callq 0x35e5f
movl 0x4(%rsp), %r8d
testl %eax, %eax
jg 0x32c9e
jne 0x32ca4
movl 0xc(%r15), %eax
andl %ebx, %eax
movl 0xc(%r13), %ecx
andl %ebx, %ecx
cmpl %ecx, %eax
seta %al
jmp 0x32c9a
movq 0x48(%rsp), %rax
cmpq %rax, 0x28(%r12,%rbp)
ja 0x32c9e
jne 0x32ca4
movl 0x38(%rsp), %eax
cmpl %eax, 0x20(%r12,%rbp)
jg 0x32c9e
sete %cl
movq 0x30(%rsp), %rax
cmpq %rax, 0x30(%r12,%rbp)
seta %al
andb %cl, %al
testb %al, %al
je 0x32ca4
addq $0x20, %rbp
jmp 0x32c2d
addq $-0x20, %r14
leaq (%r12,%rbp), %r15
addq $0x20, %r15
cmpq %r14, %r15
ja 0x32d30
testl %r8d, %r8d
je 0x32cff
movb 0x40(%rsp), %al
testq %r13, %r13
je 0x32d26
movq 0x18(%r14), %rbx
movb 0x40(%rsp), %al
testq %rbx, %rbx
je 0x32d26
movq 0x30(%r13), %rdi
movq 0x30(%rbx), %rsi
callq 0x35e5f
movl 0x4(%rsp), %r8d
testl %eax, %eax
jg 0x32d2a
jne 0x32d30
movl 0xc(%r13), %eax
movl $0xc0, %edx
andl %edx, %eax
movl 0xc(%rbx), %ecx
andl %edx, %ecx
cmpl %ecx, %eax
seta %al
jmp 0x32d26
movq 0x48(%rsp), %rax
cmpq 0x8(%r14), %rax
ja 0x32d2a
jne 0x32d30
movl 0x38(%rsp), %eax
cmpl (%r14), %eax
jg 0x32d2a
sete %cl
movq 0x30(%rsp), %rax
cmpq 0x10(%r14), %rax
seta %al
andb %cl, %al
testb %al, %al
je 0x32d30
addq $-0x20, %r14
jmp 0x32cb0
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
cmpq %r15, %r14
jbe 0x32d7a
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movq %r15, %r12
movl $0xc0, %ebx
jmp 0x32c2b
leaq (%r12,%rbp), %rax
movq 0x8(%rsp), %rdx
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups %xmm1, 0x30(%r12,%rbp)
movups %xmm0, 0x20(%r12,%rbp)
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movups %xmm0, (%rdx)
movups %xmm1, 0x10(%rdx)
movq 0x88(%rsp), %rcx
addq %rax, %rcx
sarq $0x5, %rcx
subq %r12, %rdx
subq %rbp, %rdx
addq $-0x20, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rcx
jg 0x32e5e
cmpq $0x11, %rdx
movl 0x2c(%rsp), %ebx
jl 0x32dfc
leaq (%r12,%rbp), %rdx
addq $0x40, %rdx
movq 0x18(%rsp), %rsi
movq %rdx, (%rsi)
movq 0x8(%rsp), %rdx
movq %rdx, 0x8(%rsi)
movl %ebx, 0x10(%rsi)
addq $0x18, %rsi
movq %rsi, 0x18(%rsp)
cmpq $0x11, %rcx
movq 0x20(%rsp), %rsi
cmovlq %rsi, %rax
movq %rax, %rdi
jmp 0x32991
movl 0xc(%r14), %eax
andl %ebx, %eax
movl 0xc(%r15), %ecx
andl %ebx, %ecx
cmpl %ecx, %eax
seta %cl
jmp 0x32bc4
subq %rsi, %rdi
sarq $0x5, %rdi
incq %rdi
callq 0x32605
movq 0x18(%rsp), %rax
cmpq 0x80(%rsp), %rax
je 0x32e9c
movq -0x18(%rax), %rsi
movq -0x10(%rax), %rdi
movl -0x8(%rax), %ebx
addq $-0x18, %rax
movq %rax, 0x18(%rsp)
jmp 0x32970
cmpq $0x11, %rcx
movl 0x2c(%rsp), %ebx
jl 0x32e85
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rsi
movq %rsi, (%rcx)
movq %rax, 0x8(%rcx)
movl %ebx, 0x10(%rcx)
addq $0x18, %rcx
movq %rcx, 0x18(%rsp)
cmpq $0x11, %rdx
leaq 0x40(%r12,%rbp), %rsi
movq 0x8(%rsp), %rdi
cmovlq %rdi, %rsi
jmp 0x32970
movq 0x80(%rsp), %rdi
callq 0x3350
movq 0x10(%rsp), %rax
leaq 0x20(%rax), %rbx
cmpq 0x78(%rsp), %rbx
jae 0x33031
movl 0x1d4ad(%rip), %ebp     # 0x50370
movl $0xc0, %r14d
cmpq 0x10(%rsp), %rbx
jbe 0x32f9c
movq %rbx, %r15
testl %ebp, %ebp
je 0x32f21
movq -0x8(%r15), %r12
movq 0x18(%r15), %r13
testq %r13, %r13
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x32f46
movq 0x30(%r13), %rdi
movq 0x30(%r12), %rsi
callq 0x35e5f
testl %eax, %eax
jg 0x32f4a
jne 0x32f9c
movl 0xc(%r13), %eax
andl %r14d, %eax
movl 0xc(%r12), %ecx
andl %r14d, %ecx
cmpl %ecx, %eax
seta %al
jmp 0x32f46
movq -0x18(%r15), %rax
cmpq %rax, 0x8(%r15)
ja 0x32f4a
jne 0x32f9c
movl -0x20(%r15), %eax
cmpl %eax, (%r15)
jg 0x32f4a
movq -0x10(%r15), %rax
sete %cl
cmpq %rax, 0x10(%r15)
seta %al
andb %cl, %al
testb %al, %al
je 0x32f9c
leaq -0x20(%r15), %rax
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movaps 0x90(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, %r15
cmpq 0x10(%rsp), %rax
ja 0x32ed7
addq $0x20, %rbx
cmpq 0x78(%rsp), %rbx
jb 0x32ec9
jmp 0x33031
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq %rax, 0x28(%rcx)
ja 0x32ff8
jne 0x33031
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
cmpl %eax, 0x20(%rcx)
jg 0x32ff8
movq 0x10(%rsp), %rdx
movq 0x10(%rdx), %rax
sete %cl
cmpq %rax, 0x30(%rdx)
seta %al
andb %cl, %al
jmp 0x3290b
movq 0x30(%r14), %rdi
movq 0x30(%rbx), %rsi
callq 0x35e5f
testl %eax, %eax
jle 0x33043
movq 0x10(%rsp), %rcx
leaq 0x20(%rcx), %rax
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jne 0x33031
movl $0xc0, %eax
movl 0xc(%r14), %ecx
andl %eax, %ecx
andl 0xc(%rbx), %eax
cmpl %eax, %ecx
seta %al
jmp 0x3290b