// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/cram_decode.c
// Function: cram_get_seq
cram_record *cram_get_seq(cram_fd *fd) {
    cram_container *c;
    cram_slice *s;

    for (;;) {
	c = fd->ctr;
	if (c && c->slice && c->curr_rec < c->max_rec) {
	    s = c->slice;
	} else {
	    if (!(s = cram_next_slice(fd, &c)))
		return NULL;
	    continue; /* In case slice contains no records */
	}

	if (fd->range.refid != -2) {
	    if (fd->range.refid == -1 && s->crecs[c->curr_rec].ref_id != -1) {
		// Special case when looking for unmapped blocks at end.
		// If these are mixed in with mapped data (c->ref_id == -2)
		// then we need skip until we find the unmapped data, if at all
		c->curr_rec++;
		continue;
	    }
	    if (s->crecs[c->curr_rec].ref_id < fd->range.refid &&
		s->crecs[c->curr_rec].ref_id != -1) {
		// Looking for a mapped read, but not there yet.  Special case
		// as -1 (unmapped) shouldn't be considered < refid.
		c->curr_rec++;
		continue;
	    }

	    if (s->crecs[c->curr_rec].ref_id != fd->range.refid) {
		fd->eof = 1;
		cram_free_slice(s);
		c->slice = NULL;
		return NULL;
	    }

	    if (fd->range.refid != -1 && s->crecs[c->curr_rec].apos > fd->range.end) {
		fd->eof = 1;
		cram_free_slice(s);
		c->slice = NULL;
		return NULL;
	    }

	    if (fd->range.refid != -1 && s->crecs[c->curr_rec].aend < fd->range.start) {
		c->curr_rec++;
		continue;
	    }
	}

	break;
    }

    fd->ctr = c;
    c->slice = s;
    return &s->crecs[c->curr_rec++];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x8898(%rdi), %r14
pushq $0x1
popq %rbp
movq 0x38(%rbx), %r15
testq %r15, %r15
je 0x6c1b6
movq 0x80(%r15), %rdi
testq %rdi, %rdi
je 0x6c246
movslq 0x5c(%r15), %rcx
cmpl 0x58(%r15), %ecx
jge 0x6c246
movl 0x228(%rbx), %edx
movq 0x28(%rdi), %rax
cmpl $-0x1, %edx
je 0x6c590
cmpl $-0x2, %edx
je 0x6c5fe
imulq $0x70, %rcx, %rsi
movl 0x8(%rax,%rsi), %r8d
cmpl %edx, %r8d
setl %r9b
cmpl $-0x1, %r8d
setne %r10b
testb %r10b, %r9b
jne 0x6c59b
cmpl %edx, %r8d
jne 0x6c60e
cmpl $-0x1, %edx
je 0x6c5fe
movl 0x18(%rax,%rsi), %edx
cmpl 0x230(%rbx), %edx
jg 0x6c60e
movl 0x5c(%rax,%rsi), %edx
cmpl 0x22c(%rbx), %edx
jl 0x6c59b
jmp 0x6c5fe
movq %rbx, %rdi
callq 0x50ca9
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x6c643
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x6c1b6
cmpl $-0x2, 0x228(%rbx)
jne 0x6c527
movq %rbx, %rdi
callq 0x4dbb3
movq %rax, 0x48(%r15)
testq %rax, %rax
je 0x6c643
cmpl $0x1, 0x8(%rax)
jne 0x6c643
movq %rbx, %rdi
movq %rax, %rsi
callq 0x66815
movq %rax, 0x40(%r15)
testq %rax, %rax
je 0x6c643
cmpl $0x0, 0x34(%rax)
jne 0x6c246
movq 0x18(%rbx), %rdi
callq 0x592c7
cmpl $0x2, %eax
je 0x6c246
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%rbx)
movq %r14, %rdi
callq 0x64f0
movq 0x80(%r15), %rdi
testq %rdi, %rdi
je 0x6c25f
andq $0x0, 0x80(%r15)
callq 0x50b17
movl 0x54(%r15), %ecx
movl $0x0, %r12d
movl $0x0, %eax
cmpl 0x50(%r15), %ecx
jne 0x6c282
movq %r15, %rdi
callq 0x5093a
movq %r12, %rax
xorl %r15d, %r15d
movq %rax, %r12
movq 0x88f0(%rbx), %rdi
testq %rdi, %rdi
jne 0x6c40e
cmpl $0x0, 0x88f8(%rbx)
jne 0x6c423
testq %r15, %r15
je 0x6c2b5
movl 0x54(%r15), %eax
cmpl 0x50(%r15), %eax
jne 0x6c38a
movq %rbx, %rdi
callq 0x50ca9
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x6c4b5
movq %rax, %r15
movslq (%rax), %rsi
testq %rsi, %rsi
je 0x6c2b5
cmpl $0x0, 0x88f8(%rbx)
jne 0x6c5bf
movl 0x228(%rbx), %eax
cmpl $-0x2, %eax
je 0x6c325
movl 0x4(%r15), %ecx
cmpl $-0x2, %ecx
je 0x6c325
orb $0x8, 0x224(%rbx)
cmpl %eax, %ecx
jne 0x6c5a6
movl 0x8(%r15), %eax
cmpl 0x230(%rbx), %eax
jg 0x6c5a6
addl 0xc(%r15), %eax
cmpl 0x22c(%rbx), %eax
jle 0x6c48b
movq %rbx, %rdi
callq 0x4dbb3
movq %rax, 0x48(%r15)
testq %rax, %rax
je 0x6c643
cmpl $0x1, 0x8(%rax)
jne 0x6c643
movq %rbx, %rdi
movq %rax, %rsi
callq 0x66815
movq %rax, 0x40(%r15)
testq %rax, %rax
je 0x6c643
cmpl $0x0, 0x34(%rax)
jne 0x6c38a
movq 0x18(%rbx), %rdi
callq 0x592c7
cmpl $0x2, %eax
je 0x6c38a
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%rbx)
movq %r14, %rdi
callq 0x64f0
cmpl $0x0, 0x20(%r15)
jne 0x6c3a1
movq %r15, %rdi
callq 0x5093a
xorl %r15d, %r15d
jmp 0x6c2a2
movq %rbx, %rdi
callq 0x52385
movq %rax, 0x80(%r15)
testq %rax, %rax
je 0x6c643
movq %rax, %r12
incl 0x54(%r15)
andl $0x0, 0x5c(%r15)
movq (%rax), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x58(%r15)
movl 0x8(%rax), %ecx
movl %ecx, 0x20(%r12)
movl 0x228(%rbx), %edx
cmpl $-0x2, %edx
je 0x6c423
movl 0x4(%rax), %esi
cmpl $-0x2, %esi
je 0x6c423
cmpl %edx, %esi
jne 0x6c64e
cmpl 0x230(%rbx), %ecx
jg 0x6c64e
addl 0xc(%rax), %ecx
cmpl 0x22c(%rbx), %ecx
jg 0x6c423
jmp 0x6c5e9
movq 0x8(%rdi), %r15
movq 0x10(%rdi), %r12
callq 0x68a0
andq $0x0, 0x88f0(%rbx)
testq %r15, %r15
je 0x6c5bf
testq %r12, %r12
je 0x6c5bf
movq 0x18(%rbx), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6c051
testl %eax, %eax
jne 0x6c65a
cmpq $0x0, 0x8860(%rbx)
je 0x6c117
cmpq $0x0, 0x88f0(%rbx)
jne 0x6c5cd
movq 0x8868(%rbx), %rdi
callq 0x5a74f
movq 0x8860(%rbx), %rcx
cmpl (%rcx), %eax
jle 0x6c285
jmp 0x6c5cd
movl 0x50(%r15), %eax
movl 0x58(%r15), %ecx
movl %ecx, 0x5c(%r15)
movl %eax, 0x54(%r15)
movq %rbx, %rdi
movl %ebp, %edx
callq 0x5396e
movq %r15, %rdi
callq 0x5093a
xorl %r15d, %r15d
jmp 0x6c285
cmpq $0x0, 0x8860(%rbx)
je 0x6c643
movl $0x1, 0x88f8(%rbx)
movq 0x8868(%rbx), %rdi
callq 0x5a719
testl %eax, %eax
jne 0x6c643
movq 0x8868(%rbx), %rdi
callq 0x5a68e
testq %rax, %rax
je 0x6c627
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x6c627
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %r12
movq %rdx, 0x38(%rbx)
movq %rax, %rdi
movl %ebp, %esi
callq 0x5a79f
testq %r12, %r12
jne 0x6c117
jmp 0x6c643
movl 0x4(%r15), %ecx
cmpl $-0x2, %ecx
je 0x6c1e1
movl 0x228(%rbx), %edx
cmpl %edx, %ecx
jl 0x6c552
movl 0xc(%r15), %esi
addl 0x8(%r15), %esi
cmpl 0x22c(%rbx), %esi
jg 0x6c5df
movslq %eax, %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x5396e
testl %eax, %eax
jne 0x6c643
movq 0x38(%rbx), %rdi
callq 0x5093a
movq %rbx, %rdi
callq 0x50ca9
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x6c643
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x6c570
jmp 0x6c527
imulq $0x70, %rcx, %rdx
cmpl $-0x1, 0x8(%rax,%rdx)
je 0x6c5fe
incl %ecx
movl %ecx, 0x5c(%r15)
jmp 0x6c117
movq %r15, %rdi
callq 0x5093a
andq $0x0, 0x38(%rbx)
movl %ebp, 0x88f8(%rbx)
movl %ebp, 0x8848(%rbx)
cmpq $0x0, 0x8860(%rbx)
je 0x6c519
cmpl $0x0, 0x88f8(%rbx)
jne 0x6c4cd
jmp 0x6c4e1
cmpl %edx, %ecx
je 0x6c1e1
jmp 0x6c643
movq %r12, %rdi
callq 0x50b17
andq $0x0, 0x80(%r15)
jmp 0x6c274
leal 0x1(%rcx), %edx
movl %edx, 0x5c(%r15)
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
jmp 0x6c645
movl $0x1, 0x8848(%rbx)
callq 0x50b17
andq $0x0, 0x80(%r15)
jmp 0x6c643
movq 0x469aa(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x1d6e1(%rip), %rdi     # 0x89d19
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x8848(%rbx)
jmp 0x6c676
movq 0x46977(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x1d695(%rip), %rdi     # 0x89d00
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
movq %r12, %rdi
jmp 0x6c618