// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_sort.c
// Function: ks_mergesort_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 $0xd8, %rsp
movq %rdi, %r13
movq %rsi, 0xc0(%rsp)
movq %rdx, %rax
movq %rdx, 0x78(%rsp)
testq %rdx, %rdx
jne 0x2a210f
movq %r13, %rdi
shlq $0x5, %rdi
movq %rsi, %rbx
callq 0x33048
movq %rbx, %rsi
movq %rax, 0x50(%rsp)
movq %rax, 0xc8(%rsp)
movq %r13, %rcx
shlq $0x5, %rcx
movq %rcx, 0x48(%rsp)
leaq -0x20(%rcx), %rax
movq %rax, 0x80(%rsp)
xorl %ecx, %ecx
movq %rsi, 0x70(%rsp)
xorl %eax, %eax
movq %r13, 0xa0(%rsp)
pushq $0x1
popq %rdx
shlq %cl, %rdx
movq %rdx, 0x58(%rsp)
cmpq %r13, %rdx
jae 0x2a23d6
pushq $0x1
popq %rdx
subl %eax, %edx
movq %rdx, 0x88(%rsp)
movq 0xc0(%rsp,%rdx,8), %r15
testq %rcx, %rcx
movq %rcx, 0x90(%rsp)
movq %r15, 0x60(%rsp)
je 0x2a22f6
movq 0x58(%rsp), %rdx
pushq $0x2
popq %rax
shlq %cl, %rax
movq %rax, 0x68(%rsp)
shlq $0x5, %rdx
movq %rdx, 0xb0(%rsp)
leaq (%rsi,%rdx), %rax
movq %rax, 0x98(%rsp)
movq 0x48(%rsp), %rax
addq %rsi, %rax
movq %rax, 0xa8(%rsp)
xorl %ebx, %ebx
movq %rsi, 0xb8(%rsp)
cmpq %r13, %rbx
jae 0x2a23b9
movq 0x58(%rsp), %rax
addq %rbx, %rax
movq 0xa8(%rsp), %rbp
movq %rsi, %r14
cmpq %r13, %rax
ja 0x2a220d
movq %rbx, %rbp
shlq $0x5, %rbp
addq 0x98(%rsp), %rbp
movq 0x68(%rsp), %rax
leaq (%rbx,%rax), %r14
cmpq %r13, %r14
cmovaeq %r13, %r14
shlq $0x5, %r14
addq %rsi, %r14
movq %rbx, %r15
shlq $0x5, %r15
leaq (%rsi,%r15), %r13
movq 0xb0(%rsp), %rax
leaq (%rax,%r13), %r12
addq 0x60(%rsp), %r15
cmpq %rbp, %r13
jae 0x2a22b4
cmpq %r14, %r12
jae 0x2a22b4
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x30(%rsp)
movups %xmm0, 0x20(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x2a243e
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
setne %cl
sete %dl
movq %r12, %rax
cmoveq %r13, %rax
shll $0x5, %edx
addq %rdx, %r13
shll $0x5, %ecx
addq %rcx, %r12
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm0, (%r15)
movups %xmm1, 0x10(%r15)
addq $0x20, %r15
jmp 0x2a2229
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
addq $0x20, %r15
addq $0x20, %r13
cmpq %rbp, %r13
jb 0x2a2299
xorl %eax, %eax
movq 0xa0(%rsp), %r13
leaq (%r12,%rax), %rcx
cmpq %r14, %rcx
jae 0x2a22e4
leaq (%r15,%rax), %rdx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
addq $0x20, %rax
jmp 0x2a22c3
addq 0x68(%rsp), %rbx
movq 0xb8(%rsp), %rsi
jmp 0x2a21c6
movq 0x48(%rsp), %rax
leaq (%rsi,%rax), %rbx
movq 0x80(%rsp), %r14
cmpq %rbx, %rsi
jae 0x2a23b9
testq %r14, %r14
je 0x2a236d
movq %rsi, %rbp
leaq 0x20(%rsi), %r12
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups 0x30(%rsi), %xmm3
movups %xmm1, 0x30(%rsp)
movups %xmm0, 0x20(%rsp)
movups %xmm3, 0x10(%rsp)
movups %xmm2, (%rsp)
callq 0x2a243e
leaq 0x20(%r15), %rdx
leaq 0x40(%r15), %rcx
testl %eax, %eax
je 0x2a2383
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
jmp 0x2a239f
leaq 0x20(%r15), %rcx
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
jmp 0x2a23a9
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
movq %rbp, %rsi
addq $0x40, %rsi
addq $-0x40, %r14
movq %rcx, %r15
jmp 0x2a2307
movq 0x90(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %rsi
movq 0x88(%rsp), %rax
jmp 0x2a2145
cmpl $0x1, %eax
movq 0x70(%rsp), %rcx
jne 0x2a2409
addq %rcx, 0x48(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rcx
jae 0x2a2409
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
addq $0x20, %rcx
addq $0x20, %rax
jmp 0x2a23ea
cmpq $0x0, 0x78(%rsp)
je 0x2a2423
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%rsp), %rdi
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33058