// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_free
void sam_hdr_free(SAM_hdr *hdr) {
    if (!hdr)
	return;

    if (--hdr->ref_count > 0)
	return;

    if (ks_str(&hdr->text))
	KS_FREE(&hdr->text);

    if (hdr->h)
	kh_destroy(sam_hdr, hdr->h);

    if (hdr->ref_hash)
	kh_destroy(m_s2i, hdr->ref_hash);

    if (hdr->ref) {
	int i;
	for (i = 0; i < hdr->nref; i++)
	    if (hdr->ref[i].name)
		free(hdr->ref[i].name);
	free(hdr->ref);
    }

    if (hdr->rg_hash)
	kh_destroy(m_s2i, hdr->rg_hash);

    if (hdr->rg) {
	int i;
	for (i = 0; i < hdr->nrg; i++)
	    if (hdr->rg[i].name)
		free(hdr->rg[i].name);
	free(hdr->rg);
    }

    if (hdr->pg_hash)
	kh_destroy(m_s2i, hdr->pg_hash);

    if (hdr->pg) {
	int i;
	for (i = 0; i < hdr->npg; i++)
	    if (hdr->pg[i].name)
		free(hdr->pg[i].name);
	free(hdr->pg);
    }

    if (hdr->pg_end)
	free(hdr->pg_end);

    if (hdr->type_pool)
	pool_destroy(hdr->type_pool);

    if (hdr->tag_pool)
	pool_destroy(hdr->tag_pool);

    if (hdr->str_pool)
	string_pool_destroy(hdr->str_pool);

    free(hdr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x96508
jmp 0x9676b
movq -0x8(%rbp), %rcx
movl 0x498(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x498(%rcx)
cmpl $0x0, %eax
jle 0x96525
jmp 0x9676b
movq -0x8(%rbp), %rdi
callq 0x938c0
cmpq $0x0, %rax
je 0x96552
jmp 0x96536
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9654e
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6880
jmp 0x96550
jmp 0x96552
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x9656a
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x96400
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x96582
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x96c40
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x965ee
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x965e1
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x965d4
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x6880
jmp 0x965d6
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x96594
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x96606
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x96c40
movq -0x8(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x96672
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x96665
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x96658
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x6880
jmp 0x9665a
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x96618
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x96690
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x96c40
movq -0x8(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x966fc
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0x966ef
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x966e2
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x6880
jmp 0x966e4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x966a2
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x9671a
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x96732
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xcb5b0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x9674a
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xcb5b0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x96762
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x97f90
movq -0x8(%rbp), %rdi
callq 0x6880
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)