// File: /workspace/github_c_makefile_star2_O3/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 0x33959
movq %rdi, %r15
cmpq $0x2, %rdi
jne 0x332a7
cmpl $0x0, 0x1e0fe(%rip)     # 0x51370
je 0x338df
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 0x3390f
testq %r14, %r14
jne 0x33959
jmp 0x33920
movl $0x2, %ecx
movl $0x2, %ebx
movl $0xf0, %edi
movl $0x1, %eax
shlq %cl, %rax
incq %rcx
addl $0x2, %ebx
addq $0xc0, %rdi
cmpq %r15, %rax
jb 0x332b6
callq 0x3240
shlq $0x5, %r15
movq 0x10(%rsp), %r13
leaq (%r15,%r13), %rcx
movq %rcx, 0x68(%rsp)
leaq (%r15,%r13), %rbp
addq $-0x20, %rbp
movq %rax, 0x70(%rsp)
movq %rax, 0x20(%rsp)
movl 0x1e070(%rip), %r11d    # 0x51370
movl $0x20, %eax
subq %r13, %rax
movq %rax, 0x80(%rsp)
movl %r11d, 0xc(%rsp)
movq %r13, 0x78(%rsp)
cmpq %rbp, %r13
jae 0x337ac
decl %ebx
je 0x33797
movq %rbp, %rax
subq %r13, %rax
sarq $0x6, %rax
shlq $0x5, %rax
leaq (%rax,%r13), %r14
addq $0x20, %r14
testl %r11d, %r11d
movl %ebx, 0x2c(%rsp)
je 0x3336e
movq 0x18(%r13), %r15
movq 0x38(%r13,%rax), %r12
testq %r12, %r12
sete %al
testq %r15, %r15
sete %cl
orb %al, %cl
je 0x333ba
testq %r12, %r12
jne 0x334ac
jmp 0x333d0
movq 0x8(%r13), %rdi
movl 0x20(%r13,%rax), %edx
movq 0x28(%r13,%rax), %r8
movq 0x30(%r13,%rax), %rax
cmpq %rdi, %r8
jbe 0x33426
cmpq 0x8(%rbp), %r8
ja 0x33562
jne 0x334fb
cmpl (%rbp), %edx
jg 0x33562
sete %cl
cmpq 0x10(%rbp), %rax
seta %al
testb %al, %cl
je 0x334fb
jmp 0x33562
movq 0x30(%r12), %rdi
movq 0x30(%r15), %rsi
callq 0x3678e
testl %eax, %eax
jle 0x33490
testq %r12, %r12
je 0x33481
movq 0x18(%rbp), %r15
testq %r15, %r15
je 0x33481
movq 0x30(%r12), %rdi
movq 0x30(%r15), %rsi
callq 0x3678e
testl %eax, %eax
movl 0xc(%rsp), %r11d
jg 0x33562
jne 0x334fb
movl 0xc(%r12), %eax
movl $0xc0, %edx
andl %edx, %eax
movl 0xc(%r15), %ecx
andl %edx, %ecx
cmpl %ecx, %eax
jbe 0x334fb
jmp 0x33562
movl (%r13), %esi
movq 0x10(%r13), %rcx
jne 0x3344c
cmpl %esi, %edx
jg 0x3338a
setne %r9b
cmpq %rcx, %rax
setbe %r10b
orb %r9b, %r10b
je 0x3338a
movq %r13, %r14
cmpq %rdi, 0x8(%rbp)
ja 0x334fb
jne 0x33562
movq %r13, %r14
cmpl %esi, (%rbp)
jg 0x334fb
sete %al
cmpq %rcx, 0x10(%rbp)
seta %cl
movq %r13, %r14
testb %cl, %al
jne 0x334fb
jmp 0x33562
testq %r12, %r12
movl 0xc(%rsp), %r11d
jne 0x334fb
jmp 0x33562
jne 0x334ac
movl 0xc(%r12), %eax
movl $0xc0, %edx
andl %edx, %eax
movl 0xc(%r15), %ecx
andl %edx, %ecx
cmpl %ecx, %eax
ja 0x333d0
movq 0x18(%rbp), %r12
testq %r12, %r12
je 0x33555
testq %r15, %r15
je 0x33555
movq 0x30(%r12), %rdi
movq 0x30(%r15), %rsi
callq 0x3678e
movq %r13, %r14
testl %eax, %eax
movl 0xc(%rsp), %r11d
jg 0x334fb
jne 0x33562
movl 0xc(%r12), %eax
movl $0xc0, %edx
andl %edx, %eax
movl 0xc(%r15), %ecx
andl %edx, %ecx
movq %r13, %r14
cmpl %ecx, %eax
jbe 0x33562
movl (%r14), %eax
movl %eax, 0x1c(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%r14), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%r14), %r15
cmpq %rbp, %r14
je 0x3357f
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movups %xmm1, 0x10(%rbp)
movups %xmm0, (%rbp)
jmp 0x3357f
movq %r13, %r14
testq %r12, %r12
movl 0xc(%rsp), %r11d
je 0x334fb
movl (%rbp), %eax
movl %eax, 0x1c(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rbp), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rbp), %r15
movq %rbp, 0x88(%rsp)
movq %rbp, %r14
movl $0xc0, %ebx
xorl %r12d, %r12d
testl %r11d, %r11d
je 0x335cf
movq 0x38(%r13,%r12), %rbp
testq %rbp, %rbp
je 0x335f8
testq %r15, %r15
je 0x335f8
movq 0x30(%rbp), %rdi
movq 0x30(%r15), %rsi
callq 0x3678e
movl 0xc(%rsp), %r11d
testl %eax, %eax
jg 0x335fd
jne 0x33603
movl 0xc(%rbp), %eax
andl %ebx, %eax
movl 0xc(%r15), %ecx
andl %ebx, %ecx
cmpl %ecx, %eax
ja 0x335fd
jmp 0x33603
movq 0x38(%rsp), %rax
cmpq %rax, 0x28(%r13,%r12)
ja 0x335fd
jne 0x33603
movl 0x1c(%rsp), %eax
cmpl %eax, 0x20(%r13,%r12)
jg 0x335fd
jne 0x33603
movq 0x30(%rsp), %rax
cmpq %rax, 0x30(%r13,%r12)
ja 0x335fd
jmp 0x33603
testq %rbp, %rbp
jne 0x33603
addq $0x20, %r12
jmp 0x33592
addq $-0x20, %r14
leaq (%r12,%r13), %rbp
addq $0x20, %rbp
cmpq %r14, %rbp
ja 0x33685
testl %r11d, %r11d
je 0x33655
testq %r15, %r15
je 0x3367a
movq 0x18(%r14), %rbx
testq %rbx, %rbx
je 0x3367a
movq 0x30(%r15), %rdi
movq 0x30(%rbx), %rsi
callq 0x3678e
movl 0xc(%rsp), %r11d
testl %eax, %eax
jg 0x3367f
jne 0x33685
movl 0xc(%r15), %eax
movl $0xc0, %edx
andl %edx, %eax
movl 0xc(%rbx), %ecx
andl %edx, %ecx
cmpl %ecx, %eax
ja 0x3367f
jmp 0x33685
movq 0x38(%rsp), %rax
cmpq 0x8(%r14), %rax
ja 0x3367f
jne 0x33685
movl 0x1c(%rsp), %eax
cmpl (%r14), %eax
jg 0x3367f
jne 0x33685
movq 0x30(%rsp), %rax
cmpq 0x10(%r14), %rax
ja 0x3367f
jmp 0x33685
testq %r15, %r15
jne 0x33685
addq $-0x20, %r14
jmp 0x3360f
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
cmpq %rbp, %r14
jbe 0x336c8
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rbp)
movups %xmm0, (%rbp)
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movq %rbp, %r13
jmp 0x3358a
leaq (%r12,%r13), %rax
movq 0x88(%rsp), %rbp
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x30(%r13,%r12)
movups %xmm0, 0x20(%r13,%r12)
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movups %xmm0, (%rbp)
movups %xmm1, 0x10(%rbp)
movq 0x80(%rsp), %rcx
addq %rax, %rcx
sarq $0x5, %rcx
movq %rbp, %rdx
subq %r13, %rdx
subq %r12, %rdx
addq $-0x20, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rcx
jg 0x3375e
cmpq $0x11, %rdx
movl 0x2c(%rsp), %ebx
jl 0x33749
leaq (%r12,%r13), %rdx
addq $0x40, %rdx
movq 0x20(%rsp), %rsi
movq %rdx, (%rsi)
movq %rbp, 0x8(%rsi)
movl %ebx, 0x10(%rsi)
addq $0x18, %rsi
movq %rsi, 0x20(%rsp)
cmpq $0x11, %rcx
movq 0x78(%rsp), %r13
cmovlq %r13, %rax
movq %rax, %rbp
jmp 0x3331a
cmpq $0x11, %rcx
movl 0x2c(%rsp), %ebx
jl 0x33785
movq 0x20(%rsp), %rcx
movq 0x78(%rsp), %rsi
movq %rsi, (%rcx)
movq %rax, 0x8(%rcx)
movl %ebx, 0x10(%rcx)
addq $0x18, %rcx
movq %rcx, 0x20(%rsp)
cmpq $0x11, %rdx
leaq 0x40(%r13,%r12), %r13
cmovlq %rbp, %r13
jmp 0x332f9
subq %r13, %rbp
sarq $0x5, %rbp
incq %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x32f9e
movq 0x20(%rsp), %rax
cmpq 0x70(%rsp), %rax
je 0x337cc
movq -0x18(%rax), %r13
movq -0x10(%rax), %rbp
movl -0x8(%rax), %ebx
addq $-0x18, %rax
jmp 0x332f4
movq 0x70(%rsp), %rdi
callq 0x3350
movq 0x10(%rsp), %rax
leaq 0x20(%rax), %rbx
cmpq 0x68(%rsp), %rbx
jae 0x33959
movl 0x1db80(%rip), %ebp     # 0x51370
movl $0xc0, %r14d
cmpq 0x10(%rsp), %rbx
jbe 0x338ce
movq %rbx, %r15
testl %ebp, %ebp
je 0x3382a
movq -0x8(%r15), %r12
movq 0x18(%r15), %r13
testq %r13, %r13
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
je 0x33855
testq %r13, %r13
je 0x3387c
jmp 0x338ce
movq -0x18(%r15), %rax
cmpq %rax, 0x8(%r15)
ja 0x3387c
jne 0x338ce
movl -0x20(%r15), %eax
cmpl %eax, (%r15)
jg 0x3387c
jne 0x338ce
movq -0x10(%r15), %rax
cmpq %rax, 0x10(%r15)
ja 0x3387c
jmp 0x338ce
movq 0x30(%r13), %rdi
movq 0x30(%r12), %rsi
callq 0x3678e
testl %eax, %eax
jg 0x3387c
jne 0x338ce
movl 0xc(%r13), %eax
andl %r14d, %eax
movl 0xc(%r12), %ecx
andl %r14d, %ecx
cmpl %ecx, %eax
jbe 0x338ce
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 0x33804
addq $0x20, %rbx
cmpq 0x68(%rsp), %rbx
jb 0x337f6
jmp 0x33959
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq %rax, 0x28(%rcx)
ja 0x33920
jne 0x33959
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
cmpl %eax, 0x20(%rcx)
jg 0x33920
jne 0x33959
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rax
cmpq %rax, 0x30(%rcx)
ja 0x33920
jmp 0x33959
movq 0x30(%r14), %rdi
movq 0x30(%rbx), %rsi
callq 0x3678e
testl %eax, %eax
jle 0x3396b
movq 0x10(%rsp), %rcx
leaq 0x20(%rcx), %rax
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movaps 0x40(%rsp), %xmm0
movaps 0x50(%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 0x33959
movl $0xc0, %eax
movl 0xc(%r14), %ecx
andl %eax, %ecx
andl 0xc(%rbx), %eax
cmpl %eax, %ecx
ja 0x33920
jmp 0x33959