// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/cram/sam_header.c
// Function: sam_hdr_PG_ID
const char *sam_hdr_PG_ID(SAM_hdr *sh, const char *name) {
    khint_t k = kh_get(m_s2i, sh->pg_hash, name);
    if (k == kh_end(sh->pg_hash))
	return name;

    do {
	sprintf(sh->ID_buf, "%.1000s.%d", name, sh->ID_cnt++);
	k = kh_get(m_s2i, sh->pg_hash, sh->ID_buf);
    } while (k != kh_end(sh->pg_hash));

    return sh->ID_buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r8
movq 0x80(%rdi), %rax
movq %rax, (%rsp)
movl (%rax), %eax
testl %eax, %eax
movq %rsi, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
je 0x40282
leal -0x1(%rax), %esi
movsbl (%r8), %r14d
testl %r14d, %r14d
movq %rax, 0x10(%rsp)
je 0x4028c
movb 0x1(%r8), %al
testb %al, %al
je 0x4028f
leaq 0x2(%r8), %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x40267
jmp 0x4028f
movq %rdi, %r15
xorl %ebx, %ebx
jmp 0x40310
xorl %r14d, %r14d
andl %esi, %r14d
movq (%rsp), %rax
movq 0x10(%rax), %r15
movl $0x1, %r12d
movl %r14d, %ebx
movl %esi, 0x8(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%r15,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x402fa
testb $0x1, %al
jne 0x402e8
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x4750
movl 0x8(%rsp), %esi
movq 0x20(%rsp), %r8
testl %eax, %eax
je 0x402fa
addl %r12d, %ebx
andl %esi, %ebx
incl %r12d
cmpl %r14d, %ebx
jne 0x402a7
jmp 0x4044b
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x10(%rsp), %rax
cmovnel %eax, %ebx
movq 0x18(%rsp), %r15
cmpl %eax, %ebx
je 0x4044b
leaq 0x94(%r15), %rax
movq %rax, (%rsp)
leaq 0x96(%r15), %rax
movq %rax, 0x28(%rsp)
leaq 0x13716(%rip), %r14     # 0x53a4c
movl 0x494(%r15), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x494(%r15)
xorl %ebx, %ebx
movq (%rsp), %rdi
movq %r14, %rsi
movq %r8, %rdx
xorl %eax, %eax
callq 0x4110
movq 0x80(%r15), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %esi
testl %esi, %esi
je 0x4043a
movq (%rsp), %rax
movsbl (%rax), %r14d
testl %r14d, %r14d
je 0x403a8
movb 0x95(%r15), %al
testb %al, %al
je 0x403ab
movq 0x28(%rsp), %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x4038d
jmp 0x403ab
xorl %r14d, %r14d
movq %rsi, 0x30(%rsp)
leal -0x1(%rsi), %r15d
andl %r15d, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r14d, %ebx
movq %rsi, 0x10(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x4041d
testb $0x1, %al
jne 0x4040d
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq (%rsp), %rsi
callq 0x4750
movq 0x10(%rsp), %rsi
testl %eax, %eax
je 0x4041d
addl %r12d, %ebx
andl %r15d, %ebx
incl %r12d
cmpl %r14d, %ebx
jne 0x403ce
jmp 0x40447
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x30(%rsp), %rsi
cmovnel %esi, %ebx
movq 0x18(%rsp), %r15
leaq 0x13612(%rip), %r14     # 0x53a4c
cmpl %esi, %ebx
movq 0x20(%rsp), %r8
jne 0x40336
movq (%rsp), %r8
movq %r8, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq