// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_new
SAM_hdr *sam_hdr_new() {
    SAM_hdr *sh = calloc(1, sizeof(*sh));

    if (!sh)
	return NULL;
    
    sh->h = kh_init(sam_hdr);
    if (!sh->h)
	goto err;

    sh->ID_cnt = 1;
    sh->ref_count = 1;

    sh->nref = 0;
    sh->ref  = NULL;
    if (!(sh->ref_hash = kh_init(m_s2i)))
	goto err;

    sh->nrg = 0;
    sh->rg  = NULL;
    if (!(sh->rg_hash = kh_init(m_s2i)))
	goto err;

    sh->npg = 0;
    sh->pg  = NULL;
    sh->npg_end = sh->npg_end_alloc = 0;
    sh->pg_end = NULL;
    if (!(sh->pg_hash = kh_init(m_s2i)))
	goto err;

    KS_INIT(&sh->text);

    if (!(sh->tag_pool = pool_create(sizeof(SAM_hdr_tag))))
	goto err;

    if (!(sh->type_pool = pool_create(sizeof(SAM_hdr_type))))
	goto err;

    if (!(sh->str_pool = string_pool_create(8192)))
	goto err;

    return sh;

 err:
    if (sh->h)
	kh_destroy(sam_hdr, sh->h);

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

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

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

    free(sh);

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, %edi
movl $0x4a0, %esi            # imm = 0x4A0
callq 0x6460
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x961cf
movq $0x0, -0x8(%rbp)
jmp 0x963a9
callq 0x963c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x961ef
jmp 0x96338
movq -0x10(%rbp), %rax
movl $0x1, 0x494(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x498(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x40(%rax)
callq 0x963e0
movq -0x10(%rbp), %rcx
movq %rax, 0x48(%rcx)
cmpq $0x0, %rax
jne 0x9623a
jmp 0x96338
movq -0x10(%rbp), %rax
movl $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x58(%rax)
callq 0x963e0
movq -0x10(%rbp), %rcx
movq %rax, 0x60(%rcx)
cmpq $0x0, %rax
jne 0x96269
jmp 0x96338
movq -0x10(%rbp), %rax
movl $0x0, 0x68(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x70(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x6c(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x88(%rax)
callq 0x963e0
movq -0x10(%rbp), %rcx
movq %rax, 0x80(%rcx)
cmpq $0x0, %rax
jne 0x962bd
jmp 0x96338
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movl $0x18, %edi
callq 0xcb470
movq -0x10(%rbp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jne 0x962fa
jmp 0x96338
movl $0x20, %edi
callq 0xcb470
movq -0x10(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0x96314
jmp 0x96338
movl $0x2000, %edi           # imm = 0x2000
callq 0x97f10
movq -0x10(%rbp), %rcx
movq %rax, 0x20(%rcx)
cmpq $0x0, %rax
jne 0x9632e
jmp 0x96338
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x963a9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x96350
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x96400
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x96368
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xcb5b0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x96380
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xcb5b0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x96398
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x97f90
movq -0x10(%rbp), %rdi
callq 0x6880
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)