// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/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->e_huffman.val2code[sym+1];
	    assert(c->e_huffman.codes[i].symbol == sym);
	    code = c->e_huffman.codes[i].code;
	    len  = c->e_huffman.codes[i].len;
	} else {
	    /* Slow - use a lookup table for when sym < MAX_HUFF? */
	    for (i = 0; i < c->e_huffman.nvals; i++) {
		if (c->e_huffman.codes[i].symbol == sym)
		    break;
	    }
	    if (i == c->e_huffman.nvals)
		return -1;
    
	    code = c->e_huffman.codes[i].code;
	    len  = c->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 0xd08bd
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 0xd081c
cmpl $0x80, -0x44(%rbp)
jge 0xd081c
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x3c(%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0xd07c6
jmp 0xd07e5
leaq 0x153fb(%rip), %rdi     # 0xe5bc8
leaq 0x1532b(%rip), %rsi     # 0xe5aff
movl $0x431, %edx            # imm = 0x431
leaq 0x1540c(%rip), %rcx     # 0xe5bec
callq 0x6450
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0xd089f
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0xd0858
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0xd084b
jmp 0xd0858
jmp 0xd084d
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xd0823
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jne 0xd086d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd08c3
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0xcefa0
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xd0756
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)