// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_xdelta_decode_init
cram_codec *cram_xdelta_decode_init(cram_block_compression_hdr *hdr,
                                    char *data, int size,
                                    enum cram_encoding codec,
                                    enum cram_external_type option,
                                    int version, varint_vec *vv) {
    cram_codec *c;
    char *cp = data;
    char *endp = data+size;

    if (!(c = calloc(1, sizeof(*c))))
        return NULL;

    c->codec  = E_XDELTA;
    if (option == E_LONG)
        c->decode = cram_xdelta_decode_long;
    else if (option == E_INT)
        c->decode = cram_xdelta_decode_int;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
        c->decode = cram_xdelta_decode_char;
    else if (option == E_BYTE_ARRAY_BLOCK) {
        option = E_BYTE_ARRAY;
        c->decode = cram_xdelta_decode_block;
    } else {
        free(c);
        return NULL;
    }
    c->free = cram_xdelta_decode_free;
    c->size = cram_xdelta_decode_size;
    c->get_block = cram_xdelta_get_block;
    c->describe = NULL;

    c->u.xdelta.word_size = vv->varint_get32(&cp, endp, NULL);
    c->u.xdelta.last = 0;

    int encoding = vv->varint_get32(&cp, endp, NULL);
    int sub_size = vv->varint_get32(&cp, endp, NULL);
    if (sub_size < 0 || endp - cp < sub_size)
        goto malformed;
    c->u.xdelta.sub_codec = cram_decoder_init(hdr, encoding, cp, sub_size,
                                              option, version, vv);
    if (c->u.xdelta.sub_codec == NULL)
        goto malformed;
    cp += sub_size;

    if (cp - data != size) {
    malformed:
        fprintf(stderr, "Malformed xdelta header stream\n");
        cram_xdelta_decode_free(c);
        return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x1, %edi
movl $0x880, %esi            # imm = 0x880
callq 0x42f0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xe600f
movq $0x0, -0x8(%rbp)
jmp 0xe61e5
movq -0x30(%rbp), %rax
movl $0x35, (%rax)
cmpl $0x2, -0x24(%rbp)
jne 0xe6030
movq -0x30(%rbp), %rax
leaq -0x4ba(%rip), %rcx      # 0xe5b70
movq %rcx, 0x28(%rax)
jmp 0xe609e
cmpl $0x1, -0x24(%rbp)
jne 0xe6047
movq -0x30(%rbp), %rax
leaq -0x4b1(%rip), %rcx      # 0xe5b90
movq %rcx, 0x28(%rax)
jmp 0xe609c
cmpl $0x4, -0x24(%rbp)
je 0xe6053
cmpl $0x3, -0x24(%rbp)
jne 0xe6064
movq -0x30(%rbp), %rax
leaq -0x3ee(%rip), %rcx      # 0xe5c70
movq %rcx, 0x28(%rax)
jmp 0xe609a
cmpl $0x5, -0x24(%rbp)
jne 0xe6082
movl $0x4, -0x24(%rbp)
movq -0x30(%rbp), %rax
leaq -0x3ec(%rip), %rcx      # 0xe5c90
movq %rcx, 0x28(%rax)
jmp 0xe6098
movq -0x30(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0xe61e5
jmp 0xe609a
jmp 0xe609c
jmp 0xe609e
movq -0x30(%rbp), %rax
leaq -0x1f9(%rip), %rcx      # 0xe5eb0
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
leaq -0x1b8(%rip), %rcx      # 0xe5f00
movq %rcx, 0x40(%rax)
movq -0x30(%rbp), %rax
leaq -0x157(%rip), %rcx      # 0xe5f70
movq %rcx, 0x50(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x58(%rax)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x68(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x60(%rax)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x44(%rbp)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jl 0xe614e
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movslq -0x48(%rbp), %rcx
cmpq %rcx, %rax
jge 0xe6150
jmp 0xe61b2
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x38(%rbp), %rdx
movl -0x48(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movq 0x10(%rbp), %rax
movq %rax, (%rsp)
callq 0xe5250
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0xe618b
jmp 0xe61b2
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
je 0xe61dd
jmp 0xe61b2
movq 0x26e27(%rip), %rax     # 0x10cfe0
movq (%rax), %rdi
leaq 0x12d5c(%rip), %rsi     # 0xf8f1f
movb $0x0, %al
callq 0x46d0
movq -0x30(%rbp), %rdi
callq 0xe5eb0
movq $0x0, -0x8(%rbp)
jmp 0xe61e5
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop