// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_huffman_encode_char
int cram_huffman_encode_char(cram_slice *slice, cram_codec *c,
                             char *in, int in_size) {
    int i, code, len, r = 0;
    unsigned char *syms = (unsigned char *)in;

    while (in_size--) {
        int sym = *syms++;
        if (sym >= -1 && sym < MAX_HUFF) {
            i = c->u.e_huffman.val2code[sym+1];
            assert(c->u.e_huffman.codes[i].symbol == sym);
            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        } else {
            /* Slow - use a lookup table for when sym < MAX_HUFF? */
            for (i = 0; i < c->u.e_huffman.nvals; i++) {
                if (c->u.e_huffman.codes[i].symbol == sym)
                    break;
            }
            if (i == c->u.e_huffman.nvals)
                return -1;

            code = c->u.e_huffman.codes[i].code;
            len  = c->u.e_huffman.codes[i].len;
        }

        r |= store_bits_MSB(c->out, code, len);
    }

    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x24(%rbp)
cmpl $0x0, %eax
je 0xe9d68
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $-0x1, -0x44(%rbp)
jl 0xe9cc1
cmpl $0x80, -0x44(%rbp)
jge 0xe9cc1
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x6c(%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0x44(%rbp), %rcx
cmpq %rcx, %rax
jne 0xe9c6b
jmp 0xe9c8a
leaq 0xf49a(%rip), %rdi      # 0xf910c
leaq 0xf4b9(%rip), %rsi      # 0xf9132
movl $0xba9, %edx            # imm = 0xBA9
leaq 0xf4c0(%rip), %rcx      # 0xf9145
callq 0x42e0
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0xe9d49
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0xe9d02
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0x44(%rbp), %rcx
cmpq %rcx, %rax
jne 0xe9cf5
jmp 0xe9d02
jmp 0xe9cf7
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xe9cc8
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jne 0xe9d17
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe9d6e
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x2c(%rbp), %rsi
movl -0x30(%rbp), %edx
callq 0xe43f0
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xe9bf6
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)