// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_dump
void sam_hdr_dump(SAM_hdr *hdr) {
    khint_t k;
    int i;

    printf("===DUMP===\n");
    for (k = kh_begin(hdr->h); k != kh_end(hdr->h); k++) {
	SAM_hdr_type *t1, *t2;
	char c[2];

	if (!kh_exist(hdr->h, k))
	    continue;

	t1 = t2 = kh_val(hdr->h, k);
	c[0] = kh_key(hdr->h, k)>>8;
	c[1] = kh_key(hdr->h, k)&0xff;
	printf("Type %.2s, count %d\n", c, t1->prev->order+1);

	do {
	    SAM_hdr_tag *tag;
	    printf(">>>%d ", t1->order);
	    for (tag = t1->tag; tag; tag=tag->next) {
		printf("\"%.2s\":\"%.*s\"\t",
		       tag->str, tag->len-3, tag->str+3);
	    }
	    putchar('\n');
	    t1 = t1->next;
	} while (t1 != t2);
    }

    /* Dump out PG chains */
    printf("\n@PG chains:\n");
    for (i = 0; i < hdr->npg_end; i++) {
	int j;
	printf("  %d:", i);
	for (j = hdr->pg_end[i]; j != -1; j = hdr->pg[j].prev_id) {
	    printf("%s%d(%.*s)", 
		   j == hdr->pg_end[i] ? " " : "->",
		   j, hdr->pg[j].name_len, hdr->pg[j].name);
	}
	printf("\n");
    }

    puts("===END DUMP===");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x5096d(%rip), %rdi     # 0xe3780
movb $0x0, %al
callq 0x6070
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
je 0x92f5f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0xc(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x92e62
jmp 0x92f51
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl -0xc(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl $0x8, %eax
movb %al, -0x22(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl -0xc(%rbp), %ecx
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movb %al, -0x21(%rbp)
leaq -0x22(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x18(%rax), %edx
addl $0x1, %edx
leaq 0x508c4(%rip), %rdi     # 0xe378c
movb $0x0, %al
callq 0x6070
movq -0x18(%rbp), %rax
movl 0x18(%rax), %esi
leaq 0x508c4(%rip), %rdi     # 0xe37a1
movb $0x0, %al
callq 0x6070
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x92f30
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edx
subl $0x3, %edx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x3, %rcx
leaq 0x5088c(%rip), %rdi     # 0xe37a8
movb $0x0, %al
callq 0x6070
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x92ef0
movl $0xa, %edi
callq 0x6a30
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x92ecf
jmp 0x92f51
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x92e21
leaq 0x50851(%rip), %rdi     # 0xe37b7
movb $0x0, %al
callq 0x6070
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x93054
movl -0x10(%rbp), %esi
leaq 0x50837(%rip), %rdi     # 0xe37c5
movb $0x0, %al
callq 0x6070
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $-0x1, -0x34(%rbp)
je 0x93038
movl -0x34(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x10(%rbp), %rdx
movl (%rax,%rdx,4), %edx
leaq 0x50806(%rip), %rsi     # 0xe37d6
leaq 0x45353(%rip), %rax     # 0xd832a
cmpl %edx, %ecx
cmoveq %rax, %rsi
movl -0x34(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x34(%rbp), %rdi
imulq $0x28, %rdi, %rdi
addq %rdi, %rax
movq (%rax), %r8
leaq 0x507b8(%rip), %rdi     # 0xe37cb
movb $0x0, %al
callq 0x6070
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movl %eax, -0x34(%rbp)
jmp 0x92faa
leaq 0x45fda(%rip), %rdi     # 0xd9019
movb $0x0, %al
callq 0x6070
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x92f74
leaq 0x5077e(%rip), %rdi     # 0xe37d9
callq 0x6bb0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)