// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: cram_store_container
int cram_store_container(cram_fd *fd, cram_container *c, char *dat, int *size)
{
    char *cp = (char *)dat;
    int i;

    // Check the input buffer is large enough according to our stated
    // requirements. (NOTE: it may actually take less.)
    if (cram_container_size(c) > *size)
        return -1;

    if (CRAM_MAJOR_VERS(fd->version) == 1) {
        cp += itf8_put(cp, c->length);
    } else {
        *(int32_t *)cp = le_int4(c->length);
        cp += 4;
    }
    if (c->multi_seq) {
        cp += fd->vv.varint_put32(cp, NULL, -2);
        cp += fd->vv.varint_put32(cp, NULL, 0);
        cp += fd->vv.varint_put32(cp, NULL, 0);
    } else {
        cp += fd->vv.varint_put32s(cp, NULL, c->ref_seq_id);
        if (CRAM_MAJOR_VERS(fd->version) >= 4) {
            cp += fd->vv.varint_put64(cp, NULL, c->ref_seq_start);
            cp += fd->vv.varint_put64(cp, NULL, c->ref_seq_span);
        } else {
            cp += fd->vv.varint_put32(cp, NULL, c->ref_seq_start);
            cp += fd->vv.varint_put32(cp, NULL, c->ref_seq_span);
        }
    }
    cp += fd->vv.varint_put32(cp, NULL, c->num_records);
    if (CRAM_MAJOR_VERS(fd->version) == 2) {
        cp += fd->vv.varint_put64(cp, NULL, c->record_counter);
    } else if (CRAM_MAJOR_VERS(fd->version) >= 3) {
        cp += fd->vv.varint_put32(cp, NULL, c->record_counter);
    }
    cp += fd->vv.varint_put64(cp, NULL, c->num_bases);
    cp += fd->vv.varint_put32(cp, NULL, c->num_blocks);
    cp += fd->vv.varint_put32(cp, NULL, c->num_landmarks);
    for (i = 0; i < c->num_landmarks; i++)
        cp += fd->vv.varint_put32(cp, NULL, c->landmark[i]);

    if (CRAM_MAJOR_VERS(fd->version) >= 3) {
        c->crc32 = crc32(0L, (uc *)dat, cp-dat);
        cp[0] =  c->crc32        & 0xff;
        cp[1] = (c->crc32 >>  8) & 0xff;
        cp[2] = (c->crc32 >> 16) & 0xff;
        cp[3] = (c->crc32 >> 24) & 0xff;
        cp += 4;
    }

    *size = cp-dat; // actual used size

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x75bb0
movq -0x28(%rbp), %rcx
cmpl (%rcx), %eax
jle 0x75c0d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7601e
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x75c3d
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x6cfe0
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75c55
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0xac(%rax)
je 0x75cdf
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
xorl %edx, %edx
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
xorl %edx, %edx
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75dd6
movq -0x10(%rbp), %rax
movq 0x89d0(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x4, %eax
jl 0x75d76
movq -0x10(%rbp), %rax
movq 0x89d8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89d8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75dd4
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75dd6
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x28(%rcx), %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x2, %eax
jne 0x75e40
movq -0x10(%rbp), %rax
movq 0x89d8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75e80
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
jl 0x75e7e
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x75e80
movq -0x10(%rbp), %rax
movq 0x89d8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rdx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x2c(%rcx), %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x30(%rcx), %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x75f57
movq -0x10(%rbp), %rax
movq 0x89c8(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
movslq -0x34(%rbp), %rdx
movl (%rcx,%rdx,4), %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x75f0c
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
jl 0x76004
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
xorl %eax, %eax
movl %eax, %edi
callq 0x4310
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x280(%rax)
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)