// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/cram/sam_header.c
// Function: sam_hdr_find_line
char *sam_hdr_find_line(SAM_hdr *hdr, char *type,
			char *ID_key, char *ID_value) {
    SAM_hdr_type *ty = sam_hdr_find(hdr, type, ID_key, ID_value);
    kstring_t ks = KS_INITIALIZER;
    SAM_hdr_tag *tag;
    int r = 0;

    if (!ty)
	return NULL;

    // Paste together the line from the hashed copy
    r |= (kputc_('@', &ks) == EOF);
    r |= (kputs(type, &ks) == EOF);
    for (tag = ty->tag; tag; tag = tag->next) {
	r |= (kputc_('\t', &ks) == EOF);
	r |= (kputsn(tag->str, tag->len, &ks) == EOF);
    }

    if (r) {
	KS_FREE(&ks);
	return NULL;
    }

    return ks_str(&ks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r13
callq 0x3e8dd
testq %rax, %rax
je 0x3f04e
movq %rax, 0x18(%rsp)
movl $0x1, %ebx
movl $0x1, %edi
callq 0x4700
movq %rax, %r12
testq %rax, %rax
je 0x3ee0f
movb $0x40, (%r12)
jmp 0x3ee11
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x4230
movq %rax, 0x10(%rsp)
movslq %eax, %r15
leaq (%r15,%rbx), %rdx
leaq (%r15,%rbx), %rax
addq $0x2, %rax
cmpq %rax, %rbx
movq %r12, 0x8(%rsp)
jae 0x3eea1
leaq 0x1(%rdx), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rbp
shrq $0x20, %rbp
orq %rcx, %rbp
incq %rbp
movq %r12, %rdi
movq %rbp, %rsi
movq %rdx, %r14
callq 0x48d0
movq %rax, %r12
testq %rax, %rax
jne 0x3eea7
movb $0x1, %al
movq %rbx, %rdx
movq 0x8(%rsp), %rcx
movq %rcx, %rsi
movq %rbx, %rbp
jmp 0x3eed0
movq %rbx, %rbp
movq %rdx, %r14
addq %r12, %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x4420
movq %r12, %rsi
movb $0x0, (%r12,%r14)
cmpl $-0x1, 0x10(%rsp)
sete %al
movq %r14, %rdx
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
sete %cl
orb %al, %cl
movzbl %cl, %eax
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %r13
movq %rsi, %r14
testq %r13, %r13
je 0x3f03d
movl %eax, 0x18(%rsp)
leaq 0x1(%rdx), %r15
cmpq %r15, %rbp
jae 0x3ef5c
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %r12
shrq $0x20, %r12
orq %rax, %r12
incq %r12
movq %r14, %rdi
movq %r12, %rsi
movq %rdx, %rbx
callq 0x48d0
movq %rbx, %rdx
testq %rax, %rax
jne 0x3ef62
movb $0x1, %al
movl %eax, 0x8(%rsp)
movq %rdx, %r15
jmp 0x3ef74
movq %rbp, %r12
movq %r14, %rax
movb $0x9, (%rax,%rdx)
movl $0x0, 0x8(%rsp)
movq %r12, %rbp
movq %rax, %r14
movq 0x8(%r13), %rsi
movslq 0x10(%r13), %r12
leaq (%r15,%r12), %rbx
leaq (%r15,%r12), %rax
addq $0x2, %rax
cmpq %rax, %rbp
jae 0x3eff7
movq %rbp, 0x20(%rsp)
leaq 0x1(%rbx), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rbp
shrq $0x20, %rbp
orq %rcx, %rbp
incq %rbp
movq %r14, %rdi
movq %r14, 0x10(%rsp)
movq %rsi, %r14
movq %rbp, %rsi
callq 0x48d0
movq %r14, %rsi
movq 0x10(%rsp), %rcx
movq %rax, %r14
testq %rax, %rax
je 0x3f02e
addq %r14, %r15
movq %r15, %rdi
movq %r12, %rdx
callq 0x4420
movb $0x0, (%r14,%rbx)
cmpl $-0x1, %r12d
sete %al
movq %rbx, %rdx
movl 0x8(%rsp), %ecx
orb %al, %cl
movzbl %cl, %eax
movl 0x18(%rsp), %ecx
orl %eax, %ecx
movl %ecx, %eax
movq (%r13), %r13
jmp 0x3eee7
movb $0x1, %al
movq %r15, %rdx
movq 0x20(%rsp), %rbp
movq %rcx, %r14
jmp 0x3f014
testl %eax, %eax
je 0x3f051
testq %r14, %r14
je 0x3f04e
movq %r14, %rdi
callq 0x4610
xorl %r14d, %r14d
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq