LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_set_header2
int cram_set_header2(cram_fd *fd, const sam_hdr_t *hdr) {
    if (!fd || !hdr )
        return -1;

    if (fd->header != hdr) {
        if (fd->header)
            sam_hdr_destroy(fd->header);
        fd->header = sam_hdr_dup(hdr);
        if (!fd->header)
            return -1;
    }
    return refs_from_header(fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x71c7e
cmpq $0x0, -0x18(%rbp)
jne 0x71c87
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x71ce3
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x18(%rbp), %rax
je 0x71cd7
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x71cad
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x31e70
movq -0x18(%rbp), %rdi
callq 0x32060
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x71cd5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x71ce3
jmp 0x71cd7
movq -0x10(%rbp), %rdi
callq 0x71cf0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_ref_incr_locked
static void cram_ref_incr_locked(refs_t *r, int id) {
    RP("%d INC REF %d, %d %p\n", gettid(), id,
       (int)(id>=0 && r->ref_id[id]?r->ref_id[id]->count+1:-999),
       id>=0 && r->ref_id[id]?r->ref_id[id]->seq:(char *)1);

    if (id < 0 || !r->ref_id[id] || !r->ref_id[id]->seq)
        return;

    if (r->last_id == id)
        r->last_id = -1;

    ++r->ref_id[id]->count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0x7215b
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x7215b
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x38(%rax)
jne 0x7215d
jmp 0x72190
movq -0x8(%rbp), %rax
movl 0x68(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x72174
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x68(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x30(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_ref_decr_locked
static void cram_ref_decr_locked(refs_t *r, int id) {
    RP("%d DEC REF %d, %d %p\n", gettid(), id,
       (int)(id>=0 && r->ref_id[id]?r->ref_id[id]->count-1:-999),
       id>=0 && r->ref_id[id]?r->ref_id[id]->seq:(char *)1);

    if (id < 0 || !r->ref_id[id] || !r->ref_id[id]->seq) {
        return;
    }

    if (--r->ref_id[id]->count <= 0) {
        assert(r->ref_id[id]->count == 0);
        if (r->last_id >= 0) {
            if (r->ref_id[r->last_id]->count <= 0 &&
                r->ref_id[r->last_id]->seq) {
                RP("%d FREE REF %d (%p)\n", gettid(),
                   r->last_id, r->ref_id[r->last_id]->seq);
                ref_entry_free_seq(r->ref_id[r->last_id]);
                if (r->ref_id[r->last_id]->is_md5) r->ref_id[r->last_id]->length = 0;
            }
        }
        r->last_id = id;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0x7221f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x7221f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x38(%rax)
jne 0x72224
jmp 0x72323
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x30(%rcx), %rax
addq $-0x1, %rax
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jg 0x72323
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x30(%rax)
jne 0x72263
jmp 0x72282
leaq 0x83ad9(%rip), %rdi     # 0xf5d43
leaq 0x833a1(%rip), %rsi     # 0xf5612
movl $0xc7b, %edx            # imm = 0xC7B
leaq 0x83ae0(%rip), %rcx     # 0xf5d5d
callq 0x42e0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x68(%rax)
jl 0x72319
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0x68(%rcx), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x30(%rax)
jg 0x72317
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0x68(%rcx), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x38(%rax)
je 0x72317
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0x68(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x71900
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0x68(%rcx), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x48(%rax)
je 0x72315
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0x68(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x10(%rax)
jmp 0x72317
jmp 0x72319
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x68(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: bgzf_open_ref
static BGZF *bgzf_open_ref(char *fn, char *mode, int is_md5) {
    BGZF *fp;

    if (strncmp(fn, "file://", 7) == 0)
        fn += 7;

    if (!is_md5 && !hisremote(fn)) {
        char fai_file[PATH_MAX];

        snprintf(fai_file, PATH_MAX, "%s.fai", fn);
        if (access(fai_file, R_OK) != 0)
            if (fai_build(fn) != 0)
                return NULL;
    }

    if (!(fp = bgzf_open(fn, mode))) {
        perror(fn);
        return NULL;
    }

    if (fp->is_compressed == 1 && bgzf_index_load(fp, fn, ".gzi") < 0) {
        hts_log_error("Unable to load .gzi index '%s.gzi'", fn);
        bgzf_close(fp);
        return NULL;
    }

    return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1030, %rsp           # imm = 0x1030
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x83815(%rip), %rsi     # 0xf5d86
movl $0x7, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x7258c
movq -0x10(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x725f3
movq -0x10(%rbp), %rdi
callq 0x15cf0
cmpl $0x0, %eax
jne 0x725f3
leaq -0x1030(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x837d7(%rip), %rdx     # 0xf5d8e
movb $0x0, %al
callq 0x47e0
leaq -0x1030(%rbp), %rdi
movl $0x4, %esi
callq 0x4860
cmpl $0x0, %eax
je 0x725f1
movq -0x10(%rbp), %rdi
callq 0xd3dc0
cmpl $0x0, %eax
je 0x725ef
movq $0x0, -0x8(%rbp)
jmp 0x72680
jmp 0x725f1
jmp 0x725f3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc090
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x7261d
movq -0x10(%rbp), %rdi
callq 0x43c0
movq $0x0, -0x8(%rbp)
jmp 0x72680
movq -0x28(%rbp), %rax
movl (%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x72678
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x85307(%rip), %rdx     # 0xf7944
callq 0x118d0
cmpl $0x0, %eax
jge 0x72678
movq -0x10(%rbp), %rcx
movl $0x1, %edi
leaq 0x8373e(%rip), %rsi     # 0xf5d95
leaq 0x83745(%rip), %rdx     # 0xf5da3
movb $0x0, %al
callq 0x1b030
movq -0x28(%rbp), %rdi
callq 0x103d0
movq $0x0, -0x8(%rbp)
jmp 0x72680
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_load_reference
int cram_load_reference(cram_fd *fd, char *fn) {
    int ret = 0;

    if (fn) {
        fd->refs = refs_load_fai(fd->refs, fn,
                                 !(fd->embed_ref>0 && fd->mode == 'r'));
        fn = fd->refs ? fd->refs->fn : NULL;
        if (!fn)
            ret = -1;
        sanitise_SQ_lines(fd);
    }
    fd->ref_fn = fn;

    if ((!fd->refs || (fd->refs->nref == 0 && !fn)) && fd->header) {
        if (fd->refs)
            refs_free(fd->refs);
        if (!(fd->refs = refs_create()))
            return -1;
        if (-1 == refs_from_header(fd))
            return -1;
    }

    if (fd->header)
        if (-1 == refs2id(fd->refs, fd->header))
            return -1;

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x73b3c
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x220(%rcx)
movb %al, -0x1d(%rbp)
jle 0x73ad6
movq -0x10(%rbp), %rax
cmpl $0x72, 0x8(%rax)
sete %al
movb %al, -0x1d(%rbp)
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdi
movb -0x1d(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %edx
callq 0x73c10
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x73b15
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x73b1d
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x73b1d
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x73b33
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x74460
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x73b6b
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
cmpl $0x0, 0x18(%rax)
jne 0x73bc9
cmpq $0x0, -0x18(%rbp)
jne 0x73bc9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x73bc9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x73b8e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x717d0
callq 0x74660
movq -0x10(%rbp), %rcx
movq %rax, 0x50(%rcx)
cmpq $0x0, %rax
jne 0x73baa
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x73c05
movq -0x10(%rbp), %rdi
callq 0x71cf0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x73bc7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x73c05
jmp 0x73bc9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x73bff
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x719c0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x73bfd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x73c05
jmp 0x73bff
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: refs_create
static refs_t *refs_create(void) {
    refs_t *r = calloc(1, sizeof(*r));

    RP("refs_create()\n");

    if (!r)
        return NULL;

    if (!(r->pool = string_pool_create(8192)))
        goto err;

    r->ref_id = NULL; // see refs2id() to populate.
    r->count = 1;
    r->last = NULL;
    r->last_id = -1;

    if (!(r->h_meta = kh_init(refs)))
        goto err;

    pthread_mutex_init(&r->lock, NULL);

    return r;

 err:
    refs_free(r);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, %edi
movl $0x70, %esi
callq 0x42f0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7468f
movq $0x0, -0x8(%rbp)
jmp 0x74717
movl $0x2000, %edi           # imm = 0x2000
callq 0x82320
movq -0x10(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x746a8
jmp 0x74706
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x68(%rax) # imm = 0xFFFFFFFF
callq 0x7cae0
movq -0x10(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x746eb
jmp 0x74706
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4760
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x74717
movq -0x10(%rbp), %rdi
callq 0x717d0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_new_compression_header
cram_block_compression_hdr *cram_new_compression_header(void) {
    cram_block_compression_hdr *hdr = calloc(1, sizeof(*hdr));
    if (!hdr)
        return NULL;

    if (!(hdr->TD_blk = cram_new_block(CORE, 0))) {
        free(hdr);
        return NULL;
    }

    if (!(hdr->TD_hash = kh_init(m_s2i))) {
        cram_free_block(hdr->TD_blk);
        free(hdr);
        return NULL;
    }

    if (!(hdr->TD_keys = string_pool_create(8192))) {
        kh_destroy(m_s2i, hdr->TD_hash);
        cram_free_block(hdr->TD_blk);
        free(hdr);
        return NULL;
    }

    return hdr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, %edi
movl $0x418, %esi            # imm = 0x418
callq 0x42f0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7498f
movq $0x0, -0x8(%rbp)
jmp 0x74a3f
movl $0x5, %edi
xorl %esi, %esi
callq 0x6ede0
movq -0x10(%rbp), %rcx
movq %rax, 0x50(%rcx)
cmpq $0x0, %rax
jne 0x749bf
movq -0x10(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x74a3f
callq 0x76e40
movq -0x10(%rbp), %rcx
movq %rax, 0x68(%rcx)
cmpq $0x0, %rax
jne 0x749f2
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x6f940
movq -0x10(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x74a3f
movl $0x2000, %edi           # imm = 0x2000
callq 0x82320
movq -0x10(%rbp), %rcx
movq %rax, 0x70(%rcx)
cmpq $0x0, %rax
jne 0x74a37
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x76e60
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x6f940
movq -0x10(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x74a3f
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: free_bam_list
static void free_bam_list(bam_seq_t **bams, int max_rec) {
    int i;
    for (i = 0; i < max_rec; i++)
        bam_free(bams[i]);

    free(bams);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7524a
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32ff0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x75226
movq -0x8(%rbp), %rdi
callq 0x45a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_flush_container
int cram_flush_container(cram_fd *fd, cram_container *c) {
    /* Encode the container blocks and generate compression header */
    if (0 != cram_encode_container(fd, c))
        return -1;

    return cram_flush_container2(fd, c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5c820
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x7666e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7667e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x76690
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_flush_thread
void *cram_flush_thread(void *arg) {
    cram_job *j = (cram_job *)arg;

    /* Encode the container blocks and generate compression header */
    if (0 != cram_encode_container(j->fd, j->c)) {
        hts_log_error("Call to cram_encode_container failed");
        return NULL;
    }

    return arg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x5c820
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x768d4
movl $0x1, %edi
leaq 0x7f0a5(%rip), %rsi     # 0xf5961
leaq 0x7f0b0(%rip), %rdx     # 0xf5973
movb $0x0, %al
callq 0x1b030
movq $0x0, -0x8(%rbp)
jmp 0x768dc
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: reset_metrics
void reset_metrics(cram_fd *fd) {
    int i;

    if (fd->pool) {
        // If multi-threaded we have multiple blocks being
        // compressed already and several on the to-do list
        // (fd->rqueue->pending).  It's tricky to reset the
        // metrics exactly the correct point, so instead we
        // just flush the pool, reset, and then continue again.

        // Don't bother starting a new trial before then though.
        for (i = 0; i < DS_END; i++) {
            cram_metrics *m = fd->m[i];
            if (!m)
                continue;
            m->next_trial = 999;
        }

        pthread_mutex_unlock(&fd->metrics_lock);
        hts_tpool_process_flush(fd->rqueue);
        pthread_mutex_lock(&fd->metrics_lock);
    }

    for (i = 0; i < DS_END; i++) {
        cram_metrics *m = fd->m[i];
        if (!m)
            continue;

        m->trial = NTRIALS;
        m->next_trial = TRIAL_SPAN;
        m->revised_method = 0;
        m->unpackable = 0;

        memset(m->sz, 0, sizeof(m->sz));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88b8(%rax)
je 0x7697a
movl $0x0, -0xc(%rbp)
cmpl $0x2f, -0xc(%rbp)
jge 0x7694a
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x76934
jmp 0x7693f
movq -0x18(%rbp), %rax
movl $0x3e7, 0x4(%rax)       # imm = 0x3E7
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x76911
movq -0x8(%rbp), %rdi
addq $0x88c8, %rdi           # imm = 0x88C8
callq 0x4330
movq -0x8(%rbp), %rax
movq 0x88c0(%rax), %rdi
callq 0x4e740
movq -0x8(%rbp), %rdi
addq $0x88c8, %rdi           # imm = 0x88C8
callq 0x4730
movl $0x0, -0xc(%rbp)
cmpl $0x2f, -0xc(%rbp)
jge 0x769f4
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x769a4
jmp 0x769e9
movq -0x20(%rbp), %rax
movl $0x3, (%rax)
movq -0x20(%rbp), %rax
movl $0x46, 0x4(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x98(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x220(%rax)
movq -0x20(%rbp), %rdi
addq $0xc, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x4250
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x76981
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_free_slice_header
void cram_free_slice_header(cram_block_slice_hdr *hdr) {
    if (!hdr)
        return;

    if (hdr->block_content_ids)
        free(hdr->block_content_ids);

    free(hdr);

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x76f15
jmp 0x76f36
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x76f2d
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x45a0
movq -0x8(%rbp), %rdi
callq 0x45a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_read_file_def
cram_file_def *cram_read_file_def(cram_fd *fd) {
    cram_file_def *def = malloc(sizeof(*def));
    if (!def)
        return NULL;

    if (26 != hread(fd->fp, &def->magic[0], 26)) {
        free(def);
        return NULL;
    }

    if (memcmp(def->magic, "CRAM", 4) != 0) {
        free(def);
        return NULL;
    }

    if (def->major_version > 4) {
        hts_log_error("CRAM version number mismatch. Expected 1.x, 2.x, 3.x or 4.x, got %d.%d",
                      def->major_version, def->minor_version);
        free(def);
        return NULL;
    }

    fd->first_container += 26;
    fd->curr_position = fd->first_container;
    fd->last_slice = 0;

    return def;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x1a, %edi
callq 0x4650
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x775ee
movq $0x0, -0x8(%rbp)
jmp 0x776df
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movl $0x1a, %edx
callq 0x6cee0
movq %rax, %rcx
movl $0x1a, %eax
cmpq %rcx, %rax
je 0x77626
movq -0x18(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x776df
movq -0x18(%rbp), %rax
movl (%rax), %eax
subl $0x4d415243, %eax       # imm = 0x4D415243
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x77652
movq -0x18(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x776df
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x4, %eax
jle 0x7769d
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movzbl 0x5(%rax), %r8d
movl $0x1, %edi
leaq 0x7e36f(%rip), %rsi     # 0xf59eb
leaq 0x7e37b(%rip), %rdx     # 0xf59fe
movb $0x0, %al
callq 0x1b030
movq -0x18(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0x776df
movq -0x10(%rbp), %rax
movq 0x8880(%rax), %rcx
addq $0x1a, %rcx
movq %rcx, 0x8880(%rax)
movq -0x10(%rbp), %rax
movq 0x8880(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8888(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8894(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: full_path
static void full_path(char *out, char *in) {
    size_t in_l = strlen(in);
    if (hisremote(in)) {
        if (in_l > PATH_MAX) {
            hts_log_error("Reference path is longer than %d", PATH_MAX);
            return;
        }
        strncpy(out, in, PATH_MAX-1);
        out[PATH_MAX-1] = 0;
        return;
    }
    if (*in == '/' ||
        // Windows paths
        (in_l > 3 && toupper_c(*in) >= 'A'  && toupper_c(*in) <= 'Z' &&
         in[1] == ':' && (in[2] == '/' || in[2] == '\\'))) {
        strncpy(out, in, PATH_MAX-1);
        out[PATH_MAX-1] = 0;
    } else {
        size_t len;

        // unable to get dir or out+in is too long
        if (!getcwd(out, PATH_MAX) ||
            (len = strlen(out))+1+strlen(in) >= PATH_MAX) {
            strncpy(out, in, PATH_MAX-1);
            out[PATH_MAX-1] = 0;
            return;
        }

        snprintf(out+len, PATH_MAX - len, "/%s", in);

        // FIXME: cope with `pwd`/../../../foo.fa ?
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41b0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15cf0
cmpl $0x0, %eax
je 0x7897b
cmpq $0x1000, -0x18(%rbp)    # imm = 0x1000
jbe 0x78959
movl $0x1, %edi
leaq 0x7d6c0(%rip), %rsi     # 0xf6001
leaq 0x7d6c3(%rip), %rdx     # 0xf600b
movl $0x1000, %ecx           # imm = 0x1000
movb $0x0, %al
callq 0x1b030
jmp 0x78a85
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x4240
movq -0x8(%rbp), %rax
movb $0x0, 0xfff(%rax)
jmp 0x78a85
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x789dd
cmpq $0x3, -0x18(%rbp)
jbe 0x789ff
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x7c610
movsbl %al, %eax
cmpl $0x41, %eax
jl 0x789ff
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x7c610
movsbl %al, %eax
cmpl $0x5a, %eax
jg 0x789ff
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
jne 0x789ff
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2f, %eax
je 0x789dd
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x5c, %eax
jne 0x789ff
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x4240
movq -0x8(%rbp), %rax
movb $0x0, 0xfff(%rax)
jmp 0x78a85
movq -0x8(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x4230
cmpq $0x0, %rax
je 0x78a43
movq -0x8(%rbp), %rdi
callq 0x41b0
movq %rax, -0x20(%rbp)
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
addq %rcx, %rax
cmpq $0x1000, %rax           # imm = 0x1000
jb 0x78a62
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x4240
movq -0x8(%rbp), %rax
movb $0x0, 0xfff(%rax)
jmp 0x78a85
movq -0x8(%rbp), %rdi
addq -0x20(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
subq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
leaq 0x7eb23(%rip), %rdx     # 0xf75a1
movb $0x0, %al
callq 0x47e0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_open
cram_fd *cram_open(const char *filename, const char *mode) {
    hFILE *fp;
    cram_fd *fd;
    char fmode[3]= { mode[0], '\0', '\0' };

    if (strlen(mode) > 1 && (mode[1] == 'b' || mode[1] == 'c')) {
        fmode[1] = 'b';
    }

    fp = hopen(filename, fmode);
    if (!fp)
        return NULL;

    fd = cram_dopen(fp, filename, mode);
    if (!fd)
        hclose_abruptly(fp);

    return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb (%rax), %al
movb %al, -0x2b(%rbp)
movb $0x0, -0x2a(%rbp)
movb $0x0, -0x29(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41b0
cmpq $0x1, %rax
jbe 0x78b6e
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x62, %eax
je 0x78b6a
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x63, %eax
jne 0x78b6e
movb $0x62, -0x2a(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x2b(%rbp), %rsi
movb $0x0, %al
callq 0x158b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x78b92
movq $0x0, -0x8(%rbp)
jmp 0x78bbf
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x78bd0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x78bb7
movq -0x20(%rbp), %rdi
callq 0x149d0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_flush
int cram_flush(cram_fd *fd) {
    if (!fd)
        return -1;

    int ret = 0;

    if (fd->mode == 'w' && fd->ctr) {
        if(fd->ctr->slice)
            cram_update_curr_slice(fd->ctr, fd->version);

        if (-1 == cram_flush_container_mt(fd, fd->ctr))
            ret = -1;

        cram_free_container(fd->ctr);
        if (fd->ctr_mt == fd->ctr)
            fd->ctr_mt = NULL;
        fd->ctr = NULL;
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x798bf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x79969
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x77, 0x8(%rax)
jne 0x79963
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x79963
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq $0x0, 0x90(%rax)
je 0x79909
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
callq 0x62160
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x76a00
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x7992c
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x74a70
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jne 0x79957
movq -0x10(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_set_option
int cram_set_option(cram_fd *fd, enum hts_fmt_option opt, ...) {
    int r;
    va_list args;

    va_start(args, opt);
    r = cram_set_voption(fd, opt, args);
    va_end(args);

    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
testb %al, %al
je 0x79f98
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %r9, -0xb8(%rbp)
movq %r8, -0xc0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %rdx, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x10, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x30(%rbp), %rdx
callq 0x7a000
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: lzma_mem_deflate
static char *lzma_mem_deflate(char *data, size_t size, size_t *cdata_size,
                              int level) {
    char *out;
    size_t out_size = lzma_stream_buffer_bound(size);
    *cdata_size = 0;

    out = malloc(out_size);

    /* Single call compression */
    if (LZMA_OK != lzma_easy_buffer_encode(level, LZMA_CHECK_CRC32, NULL,
                                           (uint8_t *)data, size,
                                           (uint8_t *)out, cdata_size,
                                           out_size))
        return NULL;

    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x18(%rbp), %rdi
callq 0x4880
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rdi
callq 0x4650
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %r10
movq -0x38(%rbp), %rax
movl $0x1, %esi
xorl %edx, %edx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x42d0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x7bd0a
movq $0x0, -0x8(%rbp)
jmp 0x7bd12
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: mkdir_prefix
static void mkdir_prefix(char *path, int mode) {
    char *cp = strrchr(path, '/');
    if (!cp)
        return;

    *cp = 0;
    if (is_directory(path)) {
        *cp = '/';
        return;
    }

    if (mkdir(path, mode) == 0) {
        chmod(path, mode);
        *cp = '/';
        return;
    }

    mkdir_prefix(path, mode);
    mkdir(path, mode);
    chmod(path, mode);
    *cp = '/';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2f, %esi
callq 0x4510
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x7ca0a
jmp 0x7ca79
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x7ca80
cmpl $0x0, %eax
je 0x7ca28
movq -0x18(%rbp), %rax
movb $0x2f, (%rax)
jmp 0x7ca79
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x41d0
cmpl $0x0, %eax
jne 0x7ca4e
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4420
movq -0x18(%rbp), %rax
movb $0x2f, (%rax)
jmp 0x7ca79
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x7c9e0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x41d0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4420
movq -0x18(%rbp), %rax
movb $0x2f, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_get_32
static int64_t uint7_get_32(char **cp, const char *endp, int *err) {
    uint32_t val;
    int nb = var_get_u32((uint8_t *)(*cp), (const uint8_t *)endp, &val);
    (*cp) += nb;
    if (!nb && err) *err = 1;
    return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x7db00
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
cmpl $0x0, -0x20(%rbp)
jne 0x7cdb5
cmpq $0x0, -0x18(%rbp)
je 0x7cdb5
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: sint7_get_32
static int64_t sint7_get_32(char **cp, const char *endp, int *err) {
    int32_t val;
    int nb = var_get_s32((uint8_t *)(*cp), (const uint8_t *)endp, &val);
    (*cp) += nb;
    if (!nb && err) *err = 1;
    return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x7dc50
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
cmpl $0x0, -0x20(%rbp)
jne 0x7ce15
cmpq $0x0, -0x18(%rbp)
je 0x7ce15
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movslq -0x1c(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_get_64
static int64_t uint7_get_64(char **cp, const char *endp, int *err) {
    uint64_t val;
    int nb = var_get_u64((uint8_t *)(*cp), (const uint8_t *)endp, &val);
    (*cp) += nb;
    if (!nb && err) *err = 1;
    return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x7dca0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
cmpl $0x0, -0x24(%rbp)
jne 0x7ce75
cmpq $0x0, -0x18(%rbp)
je 0x7ce75
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: sint7_get_64
static int64_t sint7_get_64(char **cp, const char *endp, int *err) {
    int64_t val;
    int nb = var_get_s64((uint8_t *)(*cp), (const uint8_t *)endp, &val);
    (*cp) += nb;
    if (!nb && err) *err = 1;
    return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x7dde0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
cmpl $0x0, -0x24(%rbp)
jne 0x7ced5
cmpq $0x0, -0x18(%rbp)
je 0x7ced5
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_put_blk_32
static int uint7_put_blk_32(cram_block *blk, int32_t v) {
    uint8_t buf[10];
    int sz = var_put_u32(buf, buf+10, v);
    BLOCK_APPEND(blk, buf, sz);
    return sz;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x1e(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
addq $0xa, %rsi
movl -0x14(%rbp), %edx
callq 0x7de40
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x7cfde
jmp 0x7cfe6
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7cfed
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: sint7_put_blk_32
static int sint7_put_blk_32(cram_block *blk, int32_t v) {
    uint8_t buf[10];
    int sz = var_put_s32(buf, buf+10, v);
    BLOCK_APPEND(blk, buf, sz);
    return sz;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x1e(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
addq $0xa, %rsi
movl -0x14(%rbp), %edx
callq 0x7e190
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x7d03e
jmp 0x7d046
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7d04d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_put_blk_64
static int uint7_put_blk_64(cram_block *blk, int64_t v) {
    uint8_t buf[10];
    int sz = var_put_u64(buf, buf+10, v);
    BLOCK_APPEND(blk, buf, sz);
    return sz;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x22(%rbp), %rdi
leaq -0x22(%rbp), %rsi
addq $0xa, %rsi
movq -0x18(%rbp), %rdx
callq 0x7e1d0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x22(%rbp), %rsi
movslq -0x28(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x7d0a0
jmp 0x7d0a8
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7d0af
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: sint7_put_blk_64
static int sint7_put_blk_64(cram_block *blk, int64_t v) {
    uint8_t buf[10];
    int sz = var_put_s64(buf, buf+10, v);
    BLOCK_APPEND(blk, buf, sz);
    return sz;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x22(%rbp), %rdi
leaq -0x22(%rbp), %rsi
addq $0xa, %rsi
movq -0x18(%rbp), %rdx
callq 0x7eba0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x22(%rbp), %rsi
movslq -0x28(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x7d100
jmp 0x7d108
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7d10f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_decode_crc32
static int uint7_decode_crc32(cram_fd *fd, int32_t *val_p, uint32_t *crc) {
    uint8_t b[5], i = 0;
    int c;
    uint32_t v = 0;

#ifdef VARINT2
    b[0] = hgetc(fd->fp);
    if (b[0] < 177) {
    } else if (b[0] < 241) {
        b[1] = hgetc(fd->fp);
    } else if (b[0] < 249) {
        b[1] = hgetc(fd->fp);
        b[2] = hgetc(fd->fp);
    } else {
        int n = b[0]+2, z = 1;
        while (n-- >= 249)
            b[z++] = hgetc(fd->fp);
    }
    i = var_get_u32(b, NULL, &v);
#else
//    // Little endian
//    int s = 0;
//    do {
//        b[i++] = c = hgetc(fd->fp);
//        if (c < 0)
//            return -1;
//        v |= (c & 0x7f) << s;
//      s += 7;
//    } while (i < 5 && (c & 0x80));

    // Big endian, see also htscodecs/varint.h
    do {
        b[i++] = c = hgetc(fd->fp);
        if (c < 0)
            return -1;
        v = (v<<7) | (c & 0x7f);
    } while (i < 5 && (c & 0x80));
#endif
    *crc = crc32(*crc, b, i);

    *val_p = v;
    return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movb $0x0, -0x26(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x6cbf0
movl %eax, -0x2c(%rbp)
movb %al, %cl
movb -0x26(%rbp), %al
movb %al, %dl
addb $0x1, %dl
movb %dl, -0x26(%rbp)
movzbl %al, %eax
movb %cl, -0x25(%rbp,%rax)
cmpl $0x0, -0x2c(%rbp)
jge 0x7d191
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d1f5
movl -0x30(%rbp), %eax
shll $0x7, %eax
movl -0x2c(%rbp), %ecx
andl $0x7f, %ecx
orl %ecx, %eax
movl %eax, -0x30(%rbp)
movzbl -0x26(%rbp), %ecx
xorl %eax, %eax
cmpl $0x5, %ecx
movb %al, -0x31(%rbp)
jge 0x7d1c1
movl -0x2c(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x7d15f
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
leaq -0x25(%rbp), %rsi
movzbl -0x26(%rbp), %edx
callq 0x4310
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movzbl -0x26(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: uint7_decode_crc64
static int uint7_decode_crc64(cram_fd *fd, int64_t *val_p, uint32_t *crc) {
    uint8_t b[10], i = 0;
    int c;
    uint64_t v = 0;

#ifdef VARINT2
    b[0] = hgetc(fd->fp);
    if (b[0] < 177) {
    } else if (b[0] < 241) {
        b[1] = hgetc(fd->fp);
    } else if (b[0] < 249) {
        b[1] = hgetc(fd->fp);
        b[2] = hgetc(fd->fp);
    } else {
        int n = b[0]+2, z = 1;
        while (n-- >= 249)
            b[z++] = hgetc(fd->fp);
    }
    i = var_get_u64(b, NULL, &v);
#else
//    // Little endian
//    int s = 0;
//    do {
//        b[i++] = c = hgetc(fd->fp);
//        if (c < 0)
//            return -1;
//        v |= (c & 0x7f) << s;
//      s += 7;
//    } while (i < 10 && (c & 0x80));

    // Big endian, see also htscodecs/varint.h
    do {
        b[i++] = c = hgetc(fd->fp);
        if (c < 0)
            return -1;
        v = (v<<7) | (c & 0x7f);
    } while (i < 5 && (c & 0x80));
#endif
    *crc = crc32(*crc, b, i);

    *val_p = v;
    return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movb $0x0, -0x2b(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x6cbf0
movl %eax, -0x30(%rbp)
movb %al, %cl
movb -0x2b(%rbp), %al
movb %al, %dl
addb $0x1, %dl
movb %dl, -0x2b(%rbp)
movzbl %al, %eax
movb %cl, -0x2a(%rbp,%rax)
cmpl $0x0, -0x30(%rbp)
jge 0x7d322
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d38f
movq -0x38(%rbp), %rax
shlq $0x7, %rax
movl -0x30(%rbp), %ecx
andl $0x7f, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movzbl -0x2b(%rbp), %ecx
xorl %eax, %eax
cmpl $0x5, %ecx
movb %al, -0x39(%rbp)
jge 0x7d359
movl -0x30(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x7d2f0
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
leaq -0x2a(%rbp), %rsi
movzbl -0x2b(%rbp), %edx
callq 0x4310
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movzbl -0x2b(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/../htscodecs/htscodecs/varint.h
// Function: var_get_u32
static inline
int var_get_u32(uint8_t *cp, const uint8_t *endp, uint32_t *i) {
    uint8_t *op = cp, c;
    uint32_t j = 0;

    if (!endp || endp - cp >= 6) {
        // Known maximum loop count helps optimiser.
        // NB: this helps considerably at -O3 level, but may harm -O2.
        // (However we optimise for those that want optimal code.)
        int n = 5;
        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && n-- > 0);
    } else {
        if (cp >= endp) {
            *i = 0;
            return 0;
        }

        if (*cp < 128) {
            *i = *cp;
            return 1;
        }

        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && cp < endp);
    }

    *i = j;
    return cp-op;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7db37
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x6, %rax
jl 0x7db98
movl $0x5, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %al
movb %al, -0x29(%rbp)
movl -0x30(%rbp), %eax
shll $0x7, %eax
movzbl -0x29(%rbp), %ecx
andl $0x7f, %ecx
orl %ecx, %eax
movl %eax, -0x30(%rbp)
movzbl -0x29(%rbp), %ecx
andl $0x80, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x35(%rbp)
je 0x7db8c
movl -0x34(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x34(%rbp)
cmpl $0x0, %eax
setg %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0x7db3e
jmp 0x7dc2f
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jb 0x7dbb8
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x7dc46
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x7dbdc
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x7dc46
jmp 0x7dbde
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %al
movb %al, -0x29(%rbp)
movl -0x30(%rbp), %eax
shll $0x7, %eax
movzbl -0x29(%rbp), %ecx
andl $0x7f, %ecx
orl %ecx, %eax
movl %eax, -0x30(%rbp)
movzbl -0x29(%rbp), %ecx
andl $0x80, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x36(%rbp)
je 0x7dc26
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
setb %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
testb $0x1, %al
jne 0x7dbde
jmp 0x7dc2f
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/../htscodecs/htscodecs/varint.h
// Function: var_get_u64
static inline
int var_get_u64(uint8_t *cp, const uint8_t *endp, uint64_t *i) {
    uint8_t *op = cp, c;
    uint64_t j = 0;

    if (!endp || endp - cp >= 11) {
        int n = 10;
        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && n-- > 0);
    } else {
        if (cp >= endp) {
            *i = 0;
            return 0;
        }

        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && cp < endp);
    }

    *i = j;
    return cp-op;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7dcd8
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0xb, %rax
jl 0x7dd3d
movl $0xa, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %al
movb %al, -0x29(%rbp)
movq -0x38(%rbp), %rax
shlq $0x7, %rax
movzbl -0x29(%rbp), %ecx
andl $0x7f, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movzbl -0x29(%rbp), %ecx
andl $0x80, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3d(%rbp)
je 0x7dd34
movl -0x3c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x3c(%rbp)
cmpl $0x0, %eax
setg %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x7dcdf
jmp 0x7ddb5
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jb 0x7dd5b
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x7ddce
jmp 0x7dd5d
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %al
movb %al, -0x29(%rbp)
movq -0x38(%rbp), %rax
shlq $0x7, %rax
movzbl -0x29(%rbp), %ecx
andl $0x7f, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movzbl -0x29(%rbp), %ecx
andl $0x80, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3e(%rbp)
je 0x7ddac
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
setb %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %al
testb $0x1, %al
jne 0x7dd5d
jmp 0x7ddb5
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)