// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/cram/cram_io.c
// Function: sanitise_SQ_lines
static void sanitise_SQ_lines(cram_fd *fd) {
    int i;

    if (!fd->header)
	return;

    if (!fd->refs || !fd->refs->h_meta)
	return;

    for (i = 0; i < fd->header->nref; i++) {
	char *name = fd->header->ref[i].name;
	khint_t k = kh_get(refs, fd->refs->h_meta, name);
	ref_entry *r;

	// We may have @SQ lines which have no known .fai, but do not
	// in themselves pose a problem because they are unused in the file.
	if (k == kh_end(fd->refs->h_meta))
	    continue;

	if (!(r = (ref_entry *)kh_val(fd->refs->h_meta, k)))
	    continue;

	if (r->length && r->length != fd->header->ref[i].len) {
	    assert(strcmp(r->name, fd->header->ref[i].name) == 0);

	    // Should we also check MD5sums here to ensure the correct
	    // reference was given?
	    fprintf(stderr, "WARNING: Header @SQ length mismatch for "
		    "ref %s, %d vs %d\n",
		    r->name, fd->header->ref[i].len, (int)r->length);

	    // Fixing the parsed @SQ header will make MD:Z: strings work
	    // and also stop it producing N for the sequence.
	    fd->header->ref[i].len = r->length;
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq 0x18(%rdi), %rdx
testq %rdx, %rdx
je 0x593ca
movq %rdi, %r14
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x593ca
cmpq $0x0, 0x8(%rax)
je 0x593ca
cmpl $0x0, 0x38(%rdx)
jle 0x593ca
xorl %r15d, %r15d
movq %r14, 0x10(%rsp)
movq 0x40(%rdx), %r8
movq %r15, %rdi
shlq $0x5, %rdi
movq (%r8,%rdi), %rsi
movq 0x48(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %r9d
movl $0x0, %r12d
testl %r9d, %r9d
je 0x59340
movsbl (%rsi), %ebx
testl %ebx, %ebx
movq %r15, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rdi, (%rsp)
movq %r8, 0x30(%rsp)
je 0x5928a
movb 0x1(%rsi), %al
testb %al, %al
je 0x5928c
leaq 0x2(%rsi), %rcx
movl %ebx, %edx
shll $0x5, %edx
subl %ebx, %edx
movsbl %al, %ebx
addl %edx, %ebx
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x59273
jmp 0x5928c
xorl %ebx, %ebx
movq %r9, 0x28(%rsp)
leal -0x1(%r9), %r15d
andl %r15d, %ebx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r13d
movl %ebx, %r12d
movq %rsi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r14d
leal (%r12,%r12), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x59316
testb $0x1, %al
jne 0x592f7
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x6a50
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
testl %eax, %eax
je 0x59316
addl %r13d, %r12d
andl %r15d, %r12d
incl %r13d
cmpl %ebx, %r12d
jne 0x592b4
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %rdx
jmp 0x5936f
movl %ebp, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x28(%rsp), %r9
cmovnel %r9d, %r12d
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %rdx
movq (%rsp), %rdi
movq 0x30(%rsp), %r8
cmpl %r9d, %r12d
je 0x5936f
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x5936f
movq 0x10(%rbx), %rbp
testq %rbp, %rbp
je 0x5936f
addq %rdi, %r8
movl 0x8(%r8), %r12d
cmpq %r12, %rbp
jne 0x59381
incq %r15
movslq 0x38(%rdx), %rax
cmpq %rax, %r15
jl 0x59220
jmp 0x593ca
movq %rdi, (%rsp)
movq (%rbx), %r13
movq %r13, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x593d9
movq 0x65c3d(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x40154(%rip), %rsi     # 0x994f9
movq %r13, %rdx
movl %r12d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x6a90
movl 0x10(%rbx), %eax
movq 0x18(%r14), %rdx
movq 0x40(%rdx), %rcx
movq (%rsp), %rsi
movl %eax, 0x8(%rcx,%rsi)
jmp 0x5936f
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x400c9(%rip), %rdi     # 0x994a9
leaq 0x3faef(%rip), %rsi     # 0x98ed6
leaq 0x400e9(%rip), %rcx     # 0x994d7
movl $0x7a6, %edx            # imm = 0x7A6
callq 0x6460