// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
callq 0x3f792
testq %rax, %rax
je 0x3ff10
movq %rax, 0x20(%rsp)
movl $0x1, %r14d
movl $0x1, %edi
callq 0x4700
testq %rax, %rax
movq %rax, 0x8(%rsp)
je 0x3fcdf
movb $0x40, (%rax)
movq %rax, %rbx
jmp 0x3fce4
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, 0x18(%rsp)
movq %r15, %rdi
callq 0x4230
movq %rax, 0x10(%rsp)
movslq %eax, %r15
leaq (%r15,%r14), %r13
leaq (%r15,%r14), %rax
addq $0x2, %rax
cmpq %rax, %r14
jae 0x3fd69
leaq 0x1(%r13), %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 %rbx, %rdi
movq %rbp, %rsi
callq 0x48d0
movq %rax, %r12
testq %rax, %rax
jne 0x3fd6f
movb $0x1, %al
movq %r14, %rdx
movq %r14, %rbp
jmp 0x3fd95
movq %r14, %rbp
movq %rbx, %r12
addq %r12, %r14
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0x4420
movb $0x0, (%r12,%r13)
cmpl $-0x1, 0x10(%rsp)
sete %al
movq %r12, %rbx
movq %r13, %rdx
cmpq $0x0, 0x8(%rsp)
sete %cl
orb %al, %cl
movzbl %cl, %eax
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %r13
testq %r13, %r13
je 0x3feff
movl %eax, 0x20(%rsp)
leaq 0x1(%rdx), %r15
cmpq %r15, %rbp
jae 0x3fe21
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 %rbx, %rdi
movq %r12, %rsi
movq %rdx, %r14
callq 0x48d0
movq %r14, %rdx
testq %rax, %rax
jne 0x3fe27
movb $0x1, %al
movl %eax, 0x8(%rsp)
movq %rdx, %r15
jmp 0x3fe39
movq %rbp, %r12
movq %rbx, %rax
movb $0x9, (%rax,%rdx)
movl $0x0, 0x8(%rsp)
movq %r12, %rbp
movq %rax, %rbx
movq 0x8(%r13), %rsi
movslq 0x10(%r13), %r12
leaq (%r15,%r12), %r14
leaq (%r15,%r12), %rax
addq $0x2, %rax
cmpq %rax, %rbp
jae 0x3feb9
movq %rbp, 0x10(%rsp)
leaq 0x1(%r14), %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 %rbx, %rdi
movq %rsi, 0x18(%rsp)
movq %rbp, %rsi
callq 0x48d0
movq 0x18(%rsp), %rsi
movq %rbx, %rcx
movq %rax, %rbx
testq %rax, %rax
je 0x3fef0
addq %rbx, %r15
movq %r15, %rdi
movq %r12, %rdx
callq 0x4420
movb $0x0, (%rbx,%r14)
cmpl $-0x1, %r12d
sete %al
movq %r14, %rdx
movl 0x8(%rsp), %ecx
orb %al, %cl
movzbl %cl, %eax
movl 0x20(%rsp), %ecx
orl %eax, %ecx
movl %ecx, %eax
movq (%r13), %r13
jmp 0x3fdac
movb $0x1, %al
movq %r15, %rdx
movq %rcx, %rbx
movq 0x10(%rsp), %rbp
jmp 0x3fed6
testl %eax, %eax
je 0x3ff12
testq %rbx, %rbx
je 0x3ff10
movq %rbx, %rdi
callq 0x4610
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq