// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 = 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 += itf8_put(cp, -2);
	cp += itf8_put(cp, 0);
	cp += itf8_put(cp, 0);
    } else {
	cp += itf8_put(cp, c->ref_seq_id);
	cp += itf8_put(cp, c->ref_seq_start);
	cp += itf8_put(cp, c->ref_seq_span);
    }
    cp += itf8_put(cp, c->num_records);
    if (CRAM_MAJOR_VERS(fd->version) == 2) {
	cp += itf8_put(cp, c->record_counter);
	cp += ltf8_put(cp, c->num_bases);
    } else if (CRAM_MAJOR_VERS(fd->version) >= 3) {
	cp += ltf8_put(cp, c->record_counter);
	cp += ltf8_put(cp, c->num_bases);
    }

    cp += itf8_put(cp, c->num_blocks);
    cp += itf8_put(cp, c->num_landmarks);
    for (i = 0; i < c->num_landmarks; i++)
	cp += itf8_put(cp, 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:
movl 0x28(%rsi), %eax
leal (%rax,%rax,4), %eax
addl $0x37, %eax
cmpl (%rcx), %eax
jle 0x2b0b6
pushq $-0x1
popq %rax
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
andl 0xc(%rdi), %ecx
movl (%rsi), %eax
pushq $0x4
popq %r13
cmpl $0x100, %ecx            # imm = 0x100
jne 0x2b0f0
cmpl $0x7f, %eax
ja 0x2b0f8
movb %al, (%r14)
pushq $0x1
jmp 0x2b18d
movl %eax, (%r14)
jmp 0x2b18f
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b112
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r14)
movb (%r15), %al
movb %al, 0x1(%r14)
pushq $0x2
jmp 0x2b18d
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b134
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r14)
movb 0x1(%r15), %al
movb %al, 0x1(%r14)
movb (%r15), %al
movb %al, 0x2(%r14)
pushq $0x3
jmp 0x2b18d
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b15c
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r14)
movb 0x2(%r15), %al
movb %al, 0x1(%r14)
movb 0x1(%r15), %al
movb %al, 0x2(%r14)
movb (%r15), %al
movb %al, 0x3(%r14)
jmp 0x2b18f
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r14)
movl (%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r14)
movl (%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r14)
movl (%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r14)
movb (%r15), %al
andb $0xf, %al
movb %al, 0x4(%r14)
pushq $0x5
popq %r13
addq %r14, %r13
cmpl $0x0, 0x94(%r15)
je 0x2b1b6
orl $-0x1, (%r13)
movw $0xe, 0x4(%r13)
movb $0x0, 0x6(%r13)
addq $0x7, %r13
jmp 0x2b3ed
movl 0x4(%r15), %eax
cmpl $0x7f, %eax
ja 0x2b1ca
movb %al, (%r13)
pushq $0x1
jmp 0x2b26f
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b1e9
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x4(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b26f
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b20d
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x5(%r15), %al
movb %al, 0x1(%r13)
movb 0x4(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b26f
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b239
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x6(%r15), %al
movb %al, 0x1(%r13)
movb 0x5(%r15), %al
movb %al, 0x2(%r13)
movb 0x4(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b26f
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x4(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x4(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x4(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x4(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x8(%r15), %eax
cmpl $0x7f, %eax
ja 0x2b287
movb %al, (%r13)
pushq $0x1
jmp 0x2b32c
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b2a6
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x8(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b32c
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b2ca
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x9(%r15), %al
movb %al, 0x1(%r13)
movb 0x8(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b32c
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b2f6
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0xa(%r15), %al
movb %al, 0x1(%r13)
movb 0x9(%r15), %al
movb %al, 0x2(%r13)
movb 0x8(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b32c
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x8(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x8(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x8(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x8(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0xc(%r15), %eax
cmpl $0x7f, %eax
ja 0x2b344
movb %al, (%r13)
pushq $0x1
jmp 0x2b3e9
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b363
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0xc(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b3e9
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b387
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0xd(%r15), %al
movb %al, 0x1(%r13)
movb 0xc(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b3e9
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b3b3
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0xe(%r15), %al
movb %al, 0x1(%r13)
movb 0xd(%r15), %al
movb %al, 0x2(%r13)
movb 0xc(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b3e9
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0xc(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0xc(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0xc(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0xc(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x20(%r15), %ecx
cmpl $0x7f, %ecx
ja 0x2b402
movb %cl, (%r13)
pushq $0x1
popq %rax
jmp 0x2b4b2
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x2b424
pushq $0x2
popq %rax
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, (%r13)
movb 0x20(%r15), %cl
movb %cl, 0x1(%r13)
jmp 0x2b4b2
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x2b44b
pushq $0x3
popq %rax
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, (%r13)
movb 0x21(%r15), %cl
movb %cl, 0x1(%r13)
movb 0x20(%r15), %cl
movb %cl, 0x2(%r13)
jmp 0x2b4b2
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x2b479
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, (%r13)
movb 0x22(%r15), %al
movb %al, 0x1(%r13)
movb 0x21(%r15), %al
movb %al, 0x2(%r13)
movb 0x20(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b3fc
pushq $0x5
popq %rax
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, (%r13)
movl 0x20(%r15), %ecx
shrl $0x14, %ecx
movb %cl, 0x1(%r13)
movl 0x20(%r15), %ecx
shrl $0xc, %ecx
movb %cl, 0x2(%r13)
movl 0x20(%r15), %ecx
shrl $0x4, %ecx
movb %cl, 0x3(%r13)
movb 0x20(%r15), %cl
andb $0xf, %cl
movb %cl, 0x4(%r13)
addq %rax, %r13
movl 0xc(%r12), %eax
sarl $0x8, %eax
cmpl $0x2, %eax
jne 0x2b4d7
movq 0x10(%r15), %rax
cmpq $0x7f, %rax
ja 0x2b4f0
movb %al, (%r13)
pushq $0x1
jmp 0x2b598
jle 0x2b5ad
movq 0x10(%r15), %rsi
movq %r13, %rdi
callq 0x2697e
movl %eax, %eax
jmp 0x2b599
cmpq $0x3fff, %rax           # imm = 0x3FFF
ja 0x2b510
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x10(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b598
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
ja 0x2b535
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x11(%r15), %al
movb %al, 0x1(%r13)
movb 0x10(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b598
cmpq $0xfffffff, %rax        # imm = 0xFFFFFFF
ja 0x2b562
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x12(%r15), %al
movb %al, 0x1(%r13)
movb 0x11(%r15), %al
movb %al, 0x2(%r13)
movb 0x10(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b598
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x10(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x10(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x10(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x10(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movq 0x18(%r15), %rsi
movq %r13, %rdi
callq 0x2697e
movl %eax, %eax
addq %rax, %r13
movl 0x24(%r15), %eax
cmpl $0x7f, %eax
ja 0x2b5c1
movb %al, (%r13)
pushq $0x1
jmp 0x2b666
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b5e0
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x24(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b666
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b604
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x25(%r15), %al
movb %al, 0x1(%r13)
movb 0x24(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b666
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b630
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x26(%r15), %al
movb %al, 0x1(%r13)
movb 0x25(%r15), %al
movb %al, 0x2(%r13)
movb 0x24(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b666
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x24(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x24(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x24(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x24(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x28(%r15), %eax
cmpl $0x7f, %eax
ja 0x2b67e
movb %al, (%r13)
pushq $0x1
jmp 0x2b723
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x2b69d
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x28(%r15), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x2b723
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x2b6c1
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x29(%r15), %al
movb %al, 0x1(%r13)
movb 0x28(%r15), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x2b723
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x2b6ed
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x2a(%r15), %al
movb %al, 0x1(%r13)
movb 0x29(%r15), %al
movb %al, 0x2(%r13)
movb 0x28(%r15), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x2b723
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x28(%r15), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x28(%r15), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x28(%r15), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x28(%r15), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rcx
pushq $0x1
popq %rax
addq %rcx, %r13
xorl %ecx, %ecx
pushq $0x2
popq %rdx
pushq $0x3
popq %rsi
pushq $0x4
popq %rdi
pushq $0x5
popq %r8
movslq 0x28(%r15), %r9
cmpq %r9, %rcx
jge 0x2b859
movq 0x30(%r15), %r9
movl (%r9,%rcx,4), %r9d
cmpl $0x7f, %r9d
ja 0x2b760
movb %r9b, (%r13)
movq %rax, %r9
jmp 0x2b84e
cmpl $0x3fff, %r9d           # imm = 0x3FFF
ja 0x2b789
shrl $0x8, %r9d
orb $-0x80, %r9b
movb %r9b, (%r13)
movq 0x30(%r15), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq %rdx, %r9
jmp 0x2b84e
cmpl $0x1fffff, %r9d         # imm = 0x1FFFFF
ja 0x2b7bf
shrl $0x10, %r9d
orb $-0x40, %r9b
movb %r9b, (%r13)
movq 0x30(%r15), %r9
movb 0x1(%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq 0x30(%r15), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x2(%r13)
movq %rsi, %r9
jmp 0x2b84e
cmpl $0xfffffff, %r9d        # imm = 0xFFFFFFF
ja 0x2b7ff
shrl $0x18, %r9d
orb $-0x20, %r9b
movb %r9b, (%r13)
movq 0x30(%r15), %r9
movb 0x2(%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq 0x30(%r15), %r9
movb 0x1(%r9,%rcx,4), %r9b
movb %r9b, 0x2(%r13)
movq 0x30(%r15), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x3(%r13)
movq %rdi, %r9
jmp 0x2b84e
shrl $0x1c, %r9d
orb $-0x10, %r9b
movb %r9b, (%r13)
movq 0x30(%r15), %r9
movl (%r9,%rcx,4), %r9d
shrl $0x14, %r9d
movb %r9b, 0x1(%r13)
movq 0x30(%r15), %r9
movl (%r9,%rcx,4), %r9d
shrl $0xc, %r9d
movb %r9b, 0x2(%r13)
movq 0x30(%r15), %r9
movl (%r9,%rcx,4), %r9d
shrl $0x4, %r9d
movb %r9b, 0x3(%r13)
movq 0x30(%r15), %r9
movb (%r9,%rcx,4), %r9b
andb $0xf, %r9b
movb %r9b, 0x4(%r13)
movq %r8, %r9
addq %r9, %r13
incq %rcx
jmp 0x2b739
cmpl $0x2ff, 0xc(%r12)       # imm = 0x2FF
jle 0x2b8a4
movl %r13d, %edx
subl %r14d, %edx
xorl %edi, %edi
movq %r14, %rsi
callq 0x43b0
movl %eax, 0x248(%r15)
movb %al, (%r13)
movb 0x249(%r15), %al
movb %al, 0x1(%r13)
movb 0x24a(%r15), %al
movb %al, 0x2(%r13)
movb 0x24b(%r15), %al
movb %al, 0x3(%r13)
addq $0x4, %r13
subl %r14d, %r13d
movl %r13d, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq