// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_encode.c
// Function: cram_add_feature
static int cram_add_feature(cram_container *c, cram_slice *s,
                            cram_record *r, cram_feature *f) {
    if (s->nfeatures >= s->afeatures) {
        s->afeatures = s->afeatures ? s->afeatures*2 : 1024;
        s->features = realloc(s->features, s->afeatures*sizeof(*s->features));
        if (!s->features)
            return -1;
    }

    if (!r->nfeature++) {
        r->feature = s->nfeatures;
        if (cram_stats_add(c->stats[DS_FP], f->X.pos) < 0)
            return -1;
    } else {
        if (cram_stats_add(c->stats[DS_FP],
                           f->X.pos - s->features[r->feature + r->nfeature-2].X.pos) < 0)
            return -1;

    }
    if (cram_stats_add(c->stats[DS_FC], f->X.code) < 0)
        return -1;

    s->features[s->nfeatures++] = *f;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x54(%rcx), %eax
jb 0x68a42
movq -0x18(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x689f0
movq -0x18(%rbp), %rax
movl 0x54(%rax), %eax
shll %eax
movl %eax, -0x2c(%rbp)
jmp 0x689fa
movl $0x400, %eax            # imm = 0x400
movl %eax, -0x2c(%rbp)
jmp 0x689fa
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x54(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x54(%rax), %eax
movl %eax, %esi
shlq $0x4, %rsi
callq 0x4820
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x68a40
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x68b49
jmp 0x68a42
movq -0x20(%rbp), %rcx
movl 0x88(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x88(%rcx)
cmpl $0x0, %eax
jne 0x68a97
movq -0x18(%rbp), %rax
movl 0x50(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x84(%rax)
movq -0x10(%rbp), %rax
movq 0x1d8(%rax), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rsi
callq 0x7ec30
cmpl $0x0, %eax
jge 0x68a95
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x68b49
jmp 0x68aea
movq -0x10(%rbp), %rax
movq 0x1d8(%rax), %rdi
movq -0x28(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
movq 0x48(%rcx), %rcx
movq -0x20(%rbp), %rdx
movl 0x84(%rdx), %edx
movq -0x20(%rbp), %rsi
addl 0x88(%rsi), %edx
subl $0x2, %edx
movl %edx, %edx
shlq $0x4, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movslq %eax, %rsi
callq 0x7ec30
cmpl $0x0, %eax
jge 0x68ae8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x68b49
jmp 0x68aea
movq -0x10(%rbp), %rax
movq 0x1d0(%rax), %rdi
movq -0x28(%rbp), %rax
movslq 0x4(%rax), %rsi
callq 0x7ec30
cmpl $0x0, %eax
jge 0x68b10
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x68b49
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rdx
movl 0x50(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x50(%rdx)
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)