// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/cram/cram_index.c
// Function: cram_index_slice
int cram_index_slice(cram_fd *fd,
                     cram_container *c,
                     cram_slice *s,
                     BGZF *fp,
                     off_t cpos,
                     off_t spos, // relative to cpos
                     off_t sz) {
    int ret;
    char buf[1024];

    if (sz > INT_MAX) {
        hts_log_error("CRAM slice is too big (%"PRId64" bytes)",
                      (int64_t) sz);
        return -1;
    }

    if (s->hdr->ref_seq_id == -2) {
        ret = cram_index_build_multiref(fd, c, s, fp, cpos, spos, sz);
    } else {
        snprintf(buf, sizeof(buf),
                 "%d\t%"PRId64"\t%"PRId64"\t%"PRId64"\t%d\t%d\n",
                 s->hdr->ref_seq_id, s->hdr->ref_seq_start,
                 s->hdr->ref_seq_span, (int64_t)cpos, (int)spos, (int)sz);
        ret = (bgzf_write(fp, buf, strlen(buf)) >= 0)? 0 : -4;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq 0x460(%rsp), %r10
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, %r10
jl 0x3d9fa
leaq 0x3e623(%rip), %rsi     # 0x7c001
leaq 0x3e62d(%rip), %rdx     # 0x7c012
pushq $0x1
popq %rdi
movq %r10, %rcx
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rbx
jmp 0x3dbdb
movq %r9, %r15
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r13
movq (%rdx), %rax
movl 0x4(%rax), %ecx
cmpl $-0x2, %ecx
jne 0x3db24
cmpl $0x77, 0x8(%rdi)
je 0x3da2b
movq 0x18(%rdi), %rcx
movq %r13, %rdx
callq 0x2e93b
testl %eax, %eax
jne 0x3d9f2
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
pushq $-0x9
popq %rax
pushq $-0x9
popq %rdx
movq $-0x80000000, %r9       # imm = 0x80000000
pushq $-0x2
popq %rcx
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r8d, %r8d
movq (%r13), %rsi
movslq 0x18(%rsi), %rsi
cmpq %rsi, %r12
jge 0x3db7c
movq 0x30(%r13), %rsi
movl 0x8(%rsi,%rbx), %r14d
movq 0x18(%rsi,%rbx), %r15
cmpl %edx, %r14d
jne 0x3da81
cltq
cmpq %rax, %r15
jl 0x3dbef
cmpl %ecx, %r14d
jne 0x3da94
movq 0x78(%rsi,%rbx), %rax
cmpq %rax, %r9
cmovleq %rax, %r9
jmp 0x3db0f
movq %r15, %rax
movl %r14d, %edx
cmpl $-0x2, %ecx
je 0x3db05
subq %r8, %r9
incq %r9
subq $0x8, %rsp
movl $0x400, %esi            # imm = 0x400
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
leaq 0x3e577(%rip), %rdx     # 0x7c034
xorl %eax, %eax
pushq 0x468(%rsp)
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x4800
addq $0x20, %rsp
movq %rbp, %rdi
callq 0x41d0
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xba64
testq %rax, %rax
js 0x3dc0e
movq 0x30(%r13), %rsi
movl 0x8(%rsi,%rbx), %edx
movq 0x18(%rsi,%rbx), %rax
movq 0x78(%rsi,%rbx), %r9
movl %edx, %ecx
movq %rax, %r8
incq %r12
addq $0x90, %rbx
movl %r14d, %edx
movq %r15, %rax
jmp 0x3da52
movq 0x8(%rax), %r8
movq 0x10(%rax), %r9
subq $0x8, %rsp
leaq 0x3e4fd(%rip), %rdx     # 0x7c034
leaq 0x28(%rsp), %r12
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %r14
callq 0x4800
addq $0x20, %rsp
movq %r12, %rdi
callq 0x41d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xba64
xorl %ecx, %ecx
testq %rax, %rax
setns %cl
leal -0x4(,%rcx,4), %ebx
jmp 0x3dbdb
cmpl $-0x2, %ecx
pushq $-0x4
popq %rbx
je 0x3dbd9
subq %r8, %r9
incq %r9
subq $0x8, %rsp
leaq 0x3e49f(%rip), %rdx     # 0x7c034
leaq 0x28(%rsp), %r12
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdi
xorl %eax, %eax
pushq 0x468(%rsp)
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x4800
addq $0x20, %rsp
movq %r12, %rdi
callq 0x41d0
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xba64
testq %rax, %rax
js 0x3dbdb
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3e57f(%rip), %rsi     # 0x7c175
leaq 0x3e4f6(%rip), %rdx     # 0x7c0f3
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
pushq $-0x2
jmp 0x3d9f4
pushq $-0x4
jmp 0x3d9f4