// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_io.c
// Function: lzma_mem_inflate
static char *lzma_mem_inflate(char *cdata, size_t csize, size_t *size) {
    lzma_stream strm = LZMA_STREAM_INIT;
    size_t out_size = 0, out_pos = 0;
    char *out = NULL, *new_out;
    int r;

    /* Initiate the decoder */
    if (LZMA_OK != lzma_stream_decoder(&strm, lzma_easy_decoder_memusage(9), 0))
        return NULL;

    /* Decode loop */
    strm.avail_in = csize;
    strm.next_in = (uint8_t *)cdata;

    for (;strm.avail_in;) {
        if (strm.avail_in > out_size - out_pos) {
            out_size += strm.avail_in * 4 + 32768;
            new_out = realloc(out, out_size);
            if (!new_out)
                goto fail;
            out = new_out;
        }
        strm.avail_out = out_size - out_pos;
        strm.next_out = (uint8_t *)&out[out_pos];

        r = lzma_code(&strm, LZMA_RUN);
        if (LZMA_OK != r && LZMA_STREAM_END != r) {
            hts_log_error("LZMA decode failure (error %d)", r);
            goto fail;
        }

        out_pos = strm.total_out;

        if (r == LZMA_STREAM_END)
            break;
    }

    /* finish up any unflushed data; necessary? */
    r = lzma_code(&strm, LZMA_FINISH);
    if (r != LZMA_OK && r != LZMA_STREAM_END) {
        hts_log_error("Call to lzma_code failed with error %d", r);
        goto fail;
    }

    new_out = realloc(out, strm.total_out > 0 ? strm.total_out : 1);
    if (new_out)
        out = new_out;
    *size = strm.total_out;

    lzma_end(&strm);

    return out;

 fail:
    lzma_end(&strm);
    free(out);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x88, %edx
callq 0x4250
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xc0(%rbp)
movl $0x9, %edi
callq 0x4980
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
xorl %edx, %edx
callq 0x40f0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x6ffdb
movq $0x0, -0x8(%rbp)
jmp 0x701f8
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x70104
movq -0xa0(%rbp), %rax
movq -0xb0(%rbp), %rcx
subq -0xb8(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x7006f
movq -0xa0(%rbp), %rax
shlq $0x2, %rax
addq $0x8000, %rax           # imm = 0x8000
addq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x4820
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
jne 0x70061
jmp 0x701d8
movq -0xc8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb0(%rbp), %rax
subq -0xb8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xc0(%rbp), %rax
addq -0xb8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0x4190
movl %eax, -0xcc(%rbp)
xorl %eax, %eax
cmpl -0xcc(%rbp), %eax
je 0x700e9
movl $0x1, %eax
cmpl -0xcc(%rbp), %eax
je 0x700e9
movl -0xcc(%rbp), %ecx
movl $0x1, %edi
leaq 0x85afe(%rip), %rsi     # 0xf5bd4
leaq 0x85b08(%rip), %rdx     # 0xf5be5
movb $0x0, %al
callq 0x1b030
jmp 0x701d8
movq -0x80(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpl $0x1, -0xcc(%rbp)
jne 0x700ff
jmp 0x70104
jmp 0x6fff1
leaq -0xa8(%rbp), %rdi
movl $0x3, %esi
callq 0x4190
movl %eax, -0xcc(%rbp)
cmpl $0x0, -0xcc(%rbp)
je 0x70152
cmpl $0x1, -0xcc(%rbp)
je 0x70152
movl -0xcc(%rbp), %ecx
movl $0x1, %edi
leaq 0x85a95(%rip), %rsi     # 0xf5bd4
leaq 0x85abe(%rip), %rdx     # 0xf5c04
movb $0x0, %al
callq 0x1b030
jmp 0x701d8
movq -0xc0(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0x80(%rbp)
jbe 0x70174
movq -0x80(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x70182
movl $0x1, %eax
movq %rax, -0xe0(%rbp)
jmp 0x70182
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x4820
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x701b4
movq -0xc8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq -0xa8(%rbp), %rdi
callq 0x4710
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x701f8
leaq -0xa8(%rbp), %rdi
callq 0x4710
movq -0xc0(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)