// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %ebp
movq 0x38(%rbx), %r15
testq %r15, %r15
je 0x7bfd2
movq 0x80(%r15), %rdi
testq %rdi, %rdi
je 0x7c062
movslq 0x5c(%r15), %rcx
cmpl 0x58(%r15), %ecx
jge 0x7c062
movl 0x228(%rbx), %edx
movq 0x28(%rdi), %rax
cmpl $-0x1, %edx
je 0x7c3eb
cmpl $-0x2, %edx
je 0x7c447
imulq $0x70, %rcx, %rsi
movl 0x8(%rax,%rsi), %r8d
cmpl %edx, %r8d
setl %r9b
cmpl $-0x1, %r8d
setne %r10b
testb %r10b, %r9b
jne 0x7c3f6
cmpl %edx, %r8d
jne 0x7c457
cmpl $-0x1, %edx
je 0x7c447
movl 0x18(%rax,%rsi), %edx
cmpl 0x230(%rbx), %edx
jg 0x7c457
movl 0x5c(%rax,%rsi), %edx
cmpl 0x22c(%rbx), %edx
jl 0x7c3f6
jmp 0x7c447
movq %rbx, %rdi
callq 0x59a12
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x7c485
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x7bfd2
cmpl $-0x2, 0x228(%rbx)
jne 0x7c37f
movq %rbx, %rdi
callq 0x56347
movq %rax, 0x48(%r15)
testq %rax, %rax
je 0x7c485
cmpl $0x1, 0x8(%rax)
jne 0x7c485
movq %rbx, %rdi
movq %rax, %rsi
callq 0x74d91
movq %rax, 0x40(%r15)
testq %rax, %rax
je 0x7c485
cmpl $0x0, 0x34(%rax)
jne 0x7c062
movq 0x18(%rbx), %rdi
callq 0x63530
cmpl $0x2, %eax
je 0x7c062
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%rbx)
movq %r14, %rdi
callq 0x64f0
movq 0x80(%r15), %rdi
testq %rdi, %rdi
je 0x7c07e
movq $0x0, 0x80(%r15)
callq 0x59823
movl 0x54(%r15), %ecx
movl $0x0, %r12d
movl $0x0, %eax
cmpl 0x50(%r15), %ecx
jne 0x7c0a1
movq %r15, %rdi
callq 0x59605
movq %r12, %rax
xorl %r15d, %r15d
movq %rax, %r12
movq 0x88f0(%rbx), %rdi
testq %rdi, %rdi
jne 0x7c1fb
cmpl $0x0, 0x88f8(%rbx)
jne 0x7c213
testq %r15, %r15
je 0x7c0d4
movl 0x54(%r15), %eax
cmpl 0x50(%r15), %eax
jne 0x7c1a9
movq %rbx, %rdi
callq 0x59a12
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x7c30a
movq %rax, %r15
movslq (%rax), %rsi
testq %rsi, %rsi
je 0x7c0d4
cmpl $0x0, 0x88f8(%rbx)
jne 0x7c41d
movl 0x228(%rbx), %eax
cmpl $-0x2, %eax
je 0x7c144
movl 0x4(%r15), %ecx
cmpl $-0x2, %ecx
je 0x7c144
orb $0x8, 0x224(%rbx)
cmpl %eax, %ecx
jne 0x7c401
movl 0x8(%r15), %eax
cmpl 0x230(%rbx), %eax
jg 0x7c401
addl 0xc(%r15), %eax
cmpl 0x22c(%rbx), %eax
jle 0x7c1c4
movq %rbx, %rdi
callq 0x56347
movq %rax, 0x48(%r15)
testq %rax, %rax
je 0x7c485
cmpl $0x1, 0x8(%rax)
jne 0x7c485
movq %rbx, %rdi
movq %rax, %rsi
callq 0x74d91
movq %rax, 0x40(%r15)
testq %rax, %rax
je 0x7c485
cmpl $0x0, 0x34(%rax)
jne 0x7c1a9
movq 0x18(%rbx), %rdi
callq 0x63530
cmpl $0x2, %eax
je 0x7c1a9
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%rbx)
movq %r14, %rdi
callq 0x64f0
cmpl $0x0, 0x20(%r15)
jne 0x7c27b
movq %r15, %rdi
callq 0x59605
xorl %r15d, %r15d
jmp 0x7c0c1
movl 0x50(%r15), %eax
movl 0x58(%r15), %ecx
movl %ecx, 0x5c(%r15)
movl %eax, 0x54(%r15)
movq %rbx, %rdi
movl $0x1, %edx
callq 0x5cc50
movq %r15, %rdi
callq 0x59605
movq 0x88f0(%rbx), %rdi
movl $0x0, %r15d
jmp 0x7c0ab
movq 0x8(%rdi), %r15
movq 0x10(%rdi), %r12
callq 0x68a0
movq $0x0, 0x88f0(%rbx)
testq %r15, %r15
je 0x7c41d
testq %r12, %r12
je 0x7c41d
movq 0x18(%rbx), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7be64
testl %eax, %eax
jne 0x7c47a
cmpq $0x0, 0x8860(%rbx)
je 0x7bf33
cmpq $0x0, 0x88f0(%rbx)
jne 0x7c42b
movq 0x8868(%rbx), %rdi
callq 0x6535d
movq 0x8860(%rbx), %rcx
cmpl (%rcx), %eax
jle 0x7c0a4
jmp 0x7c42b
movq %rbx, %rdi
callq 0x5b2a8
movq %rax, 0x80(%r15)
testq %rax, %rax
je 0x7c485
movq %rax, %r12
incl 0x54(%r15)
movl $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 0x7c213
movl 0x4(%rax), %esi
cmpl $-0x2, %esi
je 0x7c213
cmpl %edx, %esi
jne 0x7c490
cmpl 0x230(%rbx), %ecx
jg 0x7c490
addl 0xc(%rax), %ecx
cmpl 0x22c(%rbx), %ecx
jg 0x7c213
movq %r12, %rdi
callq 0x59823
movq $0x0, 0x80(%r15)
jmp 0x7c093
cmpq $0x0, 0x8860(%rbx)
je 0x7c485
movl $0x1, 0x88f8(%rbx)
movq 0x8868(%rbx), %rdi
callq 0x65327
testl %eax, %eax
jne 0x7c485
movq 0x8868(%rbx), %rdi
callq 0x65291
testq %rax, %rax
je 0x7c473
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x7c473
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %r12
movq %rdx, 0x38(%rbx)
movq %rax, %rdi
movl $0x1, %esi
callq 0x653ad
testq %r12, %r12
jne 0x7bf33
jmp 0x7c485
movl 0x4(%r15), %ecx
cmpl $-0x2, %ecx
je 0x7bffd
movl 0x228(%rbx), %edx
cmpl %edx, %ecx
jl 0x7c3aa
movl 0xc(%r15), %esi
addl 0x8(%r15), %esi
cmpl 0x22c(%rbx), %esi
jg 0x7c43d
movslq %eax, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x5cc50
testl %eax, %eax
jne 0x7c485
movq 0x38(%rbx), %rdi
callq 0x59605
movq %rbx, %rdi
callq 0x59a12
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x7c485
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x7c3cb
jmp 0x7c37f
imulq $0x70, %rcx, %rdx
cmpl $-0x1, 0x8(%rax,%rdx)
je 0x7c447
incl %ecx
movl %ecx, 0x5c(%r15)
jmp 0x7bf33
movq %r15, %rdi
callq 0x59605
movq $0x0, 0x38(%rbx)
movl %ebp, 0x88f8(%rbx)
movl %ebp, 0x8848(%rbx)
cmpq $0x0, 0x8860(%rbx)
je 0x7c371
cmpl $0x0, 0x88f8(%rbx)
jne 0x7c322
jmp 0x7c336
cmpl %edx, %ecx
je 0x7bffd
jmp 0x7c485
leal 0x1(%rcx), %edx
movl %edx, 0x5c(%r15)
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
jmp 0x7c487
movl $0x1, 0x8848(%rbx)
callq 0x59823
movq $0x0, 0x80(%r15)
jmp 0x7c485
callq 0x8257
jmp 0x7c485
movq %r12, %rdi
movq %r15, %rsi
callq 0x8219
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x8848(%rbx)
movq %r12, %rdi
jmp 0x7c461