// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x8898(%rdi), %r15
xorl %ebx, %ebx
movl $0x1, %ebp
movq 0x38(%r14), %r12
testq %r12, %r12
je 0x7c63f
movq 0x80(%r12), %rdi
testq %rdi, %rdi
je 0x7c356
movslq 0x5c(%r12), %rax
cmpl 0x58(%r12), %eax
jge 0x7c356
movl 0x228(%r14), %ecx
cmpl $-0x1, %ecx
je 0x7c6e9
cmpl $-0x2, %ecx
jne 0x7c6f8
jmp 0x7c8a5
testq %r12, %r12
je 0x7c63f
movq 0x80(%r12), %rdi
testq %rdi, %rdi
je 0x7c37d
movq $0x0, 0x80(%r12)
callq 0x595ed
movl 0x54(%r12), %ecx
movl $0x0, %r13d
movl $0x0, %eax
cmpl 0x50(%r12), %ecx
jne 0x7c3a2
movq %r12, %rdi
callq 0x593d4
movq %r13, %rax
xorl %r12d, %r12d
movq %rax, %r13
movq 0x88f0(%r14), %rdi
testq %rdi, %rdi
jne 0x7c529
cmpl $0x0, 0x88f8(%r14)
jne 0x7c541
testq %r12, %r12
je 0x7c3d8
movl 0x54(%r12), %eax
cmpl 0x50(%r12), %eax
jne 0x7c4ce
movq %r14, %rdi
callq 0x597db
movq %rax, %r12
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x7c3f5
cmpl $0x0, (%r12)
je 0x7c3d8
jmp 0x7c40e
cmpq $0x0, 0x8860(%r14)
je 0x7c816
movl $0x1, 0x88f8(%r14)
cmpl $0x0, 0x88f8(%r14)
jne 0x7c7f2
movl 0x228(%r14), %eax
cmpl $-0x2, %eax
je 0x7c466
movl 0x4(%r12), %ecx
cmpl $-0x2, %ecx
je 0x7c466
orb $0x8, 0x224(%r14)
cmpl %eax, %ecx
jne 0x7c7d4
movl 0x8(%r12), %eax
cmpl 0x230(%r14), %eax
jg 0x7c7d4
addl 0xc(%r12), %eax
cmpl 0x22c(%r14), %eax
jle 0x7c4ea
movq %r14, %rdi
callq 0x55f49
movq %rax, 0x48(%r12)
testq %rax, %rax
je 0x7c816
cmpl $0x1, 0x8(%rax)
jne 0x7c816
movq %r14, %rdi
movq %rax, %rsi
callq 0x7508d
movq %rax, 0x40(%r12)
testq %rax, %rax
je 0x7c816
cmpl $0x0, 0x34(%rax)
jne 0x7c4ce
movq 0x18(%r14), %rdi
callq 0x63427
cmpl $0x2, %eax
je 0x7c4ce
movq %r15, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%r14)
movq %r15, %rdi
callq 0x64f0
cmpl $0x0, 0x20(%r12)
jne 0x7c5a9
movq %r12, %rdi
callq 0x593d4
xorl %r12d, %r12d
jmp 0x7c3c3
movl 0x50(%r12), %eax
movl 0x58(%r12), %ecx
movl %ecx, 0x5c(%r12)
movl %eax, 0x54(%r12)
movslq (%r12), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x5c89c
movq %r12, %rdi
callq 0x593d4
movq 0x88f0(%r14), %rdi
movl $0x0, %r12d
jmp 0x7c3ac
movq 0x8(%rdi), %r12
movq 0x10(%rdi), %r13
callq 0x68a0
movq $0x0, 0x88f0(%r14)
testq %r12, %r12
je 0x7c7f2
testq %r13, %r13
je 0x7c7f2
movq 0x18(%r14), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7c23e
testl %eax, %eax
jne 0x7c874
cmpq $0x0, 0x8860(%r14)
je 0x7c7f2
cmpq $0x0, 0x88f0(%r14)
jne 0x7c7f2
movq 0x8868(%r14), %rdi
callq 0x65341
movq 0x8860(%r14), %rcx
cmpl (%rcx), %eax
jle 0x7c3a5
jmp 0x7c7f2
movq %r14, %rdi
callq 0x5b0aa
movq %rax, 0x80(%r12)
testq %rax, %rax
je 0x7c816
movq %rax, %r13
incl 0x54(%r12)
movl $0x0, 0x5c(%r12)
movq (%rax), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x58(%r12)
movl 0x8(%rax), %ecx
movl %ecx, 0x20(%r13)
movl 0x228(%r14), %edx
cmpl $-0x2, %edx
je 0x7c541
movl 0x4(%rax), %esi
cmpl $-0x2, %esi
je 0x7c541
cmpl %edx, %esi
jne 0x7c881
cmpl 0x230(%r14), %ecx
jg 0x7c881
addl 0xc(%rax), %ecx
cmpl 0x22c(%r14), %ecx
jg 0x7c541
movq %r13, %rdi
callq 0x595ed
movq $0x0, 0x80(%r12)
jmp 0x7c394
movq %r14, %rdi
callq 0x597db
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x7c816
movq %rax, %r12
cmpl $0x0, (%rax)
je 0x7c63f
cmpl $-0x2, 0x228(%r14)
je 0x7c674
movl 0x4(%r12), %eax
cmpl $-0x2, %eax
jne 0x7c767
movq %r14, %rdi
callq 0x55f49
movq %rax, 0x48(%r12)
testq %rax, %rax
je 0x7c816
cmpl $0x1, 0x8(%rax)
jne 0x7c816
movq %r14, %rdi
movq %rax, %rsi
callq 0x7508d
movq %rax, 0x40(%r12)
testq %rax, %rax
je 0x7c816
cmpl $0x0, 0x34(%rax)
jne 0x7c35f
movq 0x18(%r14), %rdi
callq 0x63427
cmpl $0x2, %eax
je 0x7c35f
movq %r15, %rdi
callq 0x6ae0
movl $0x1, 0x8854(%r14)
movq %r15, %rdi
callq 0x64f0
jmp 0x7c35f
movq 0x28(%rdi), %rdx
imulq $0x70, %rax, %rsi
cmpl $-0x1, 0x8(%rdx,%rsi)
jne 0x7c75b
movq 0x28(%rdi), %rdx
imulq $0x70, %rax, %rsi
movl 0x8(%rdx,%rsi), %r8d
cmpl %ecx, %r8d
setl %r9b
cmpl $-0x1, %r8d
setne %r8b
testb %r8b, %r9b
jne 0x7c75b
cmpl %ecx, 0x8(%rdx,%rsi)
jne 0x7c8b7
cmpl $-0x1, %ecx
je 0x7c8a5
leaq (%rdx,%rsi), %r8
movl 0x18(%r8), %r8d
cmpl 0x230(%r14), %r8d
jg 0x7c8b7
cmpl $-0x1, %ecx
je 0x7c8a5
movl 0x5c(%rdx,%rsi), %ecx
cmpl 0x22c(%r14), %ecx
jge 0x7c8a5
incl %eax
movl %eax, 0x5c(%r12)
jmp 0x7c312
xorl %ecx, %ecx
movl 0x228(%r14), %edx
cmpl %edx, %eax
jl 0x7c78b
movl 0xc(%r12), %esi
addl 0x8(%r12), %esi
cmpl 0x22c(%r14), %esi
jg 0x7c863
movslq (%r12), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x5c89c
testl %eax, %eax
jne 0x7c816
movq 0x38(%r14), %rdi
callq 0x593d4
movq %r14, %rdi
callq 0x597db
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x7c816
movq %rax, %r12
cmpl $0x0, (%rax)
je 0x7c7a9
movl 0x4(%r12), %eax
cmpl $-0x2, %eax
sete %cl
jne 0x7c769
jmp 0x7c674
movq %r12, %rdi
callq 0x593d4
movq $0x0, 0x38(%r14)
movl %ebp, 0x88f8(%r14)
movl %ebp, 0x8848(%r14)
cmpq $0x0, 0x8860(%r14)
je 0x7c819
cmpl $0x0, 0x88f8(%r14)
je 0x7c827
movq 0x8868(%r14), %rdi
callq 0x6530b
testl %eax, %eax
je 0x7c827
xorl %r13d, %r13d
testq %r13, %r13
jne 0x7c312
jmp 0x7c8d5
movq 0x8868(%r14), %rdi
callq 0x65275
testq %rax, %rax
je 0x7c85c
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x7c85c
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %r13
movq %rdx, 0x38(%r14)
movq %rax, %rdi
movl $0x1, %esi
callq 0x65391
jmp 0x7c819
callq 0x834f
jmp 0x7c816
cmpl %edx, %eax
setne %al
notb %cl
testb %al, %cl
je 0x7c674
jmp 0x7c816
movq %r13, %rdi
movq %r12, %rsi
callq 0x8311
jmp 0x7c816
movl $0x1, 0x8848(%r14)
movq %r13, %rdi
callq 0x595ed
movq $0x0, 0x80(%r12)
jmp 0x7c816
leal 0x1(%rax), %ecx
imulq $0x70, %rax, %rbx
addq 0x28(%rdi), %rbx
movl %ecx, 0x5c(%r12)
jmp 0x7c8d5
movl $0x1, 0x8848(%r14)
callq 0x595ed
movq $0x0, 0x80(%r12)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq