// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: ReadHuffmanCode
static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec,
                           int* const code_lengths,
                           HuffmanTables* const table) {
  int ok = 0;
  int size = 0;
  VP8LBitReader* const br = &dec->br_;
  const int simple_code = VP8LReadBits(br, 1);

  memset(code_lengths, 0, alphabet_size * sizeof(*code_lengths));

  if (simple_code) {  // Read symbols, codes & code lengths directly.
    const int num_symbols = VP8LReadBits(br, 1) + 1;
    const int first_symbol_len_code = VP8LReadBits(br, 1);
    // The first code is either 1 bit or 8 bit code.
    int symbol = VP8LReadBits(br, (first_symbol_len_code == 0) ? 1 : 8);
    code_lengths[symbol] = 1;
    // The second code (if present), is always 8 bits long.
    if (num_symbols == 2) {
      symbol = VP8LReadBits(br, 8);
      code_lengths[symbol] = 1;
    }
    ok = 1;
  } else {  // Decode Huffman-coded code lengths.
    int i;
    int code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
    const int num_codes = VP8LReadBits(br, 4) + 4;
    assert(num_codes <= NUM_CODE_LENGTH_CODES);

    for (i = 0; i < num_codes; ++i) {
      code_length_code_lengths[kCodeLengthCodeOrder[i]] = VP8LReadBits(br, 3);
    }
    ok = ReadHuffmanCodeLengths(dec, code_length_code_lengths, alphabet_size,
                                code_lengths);
  }

  ok = ok && !br->eos_;
  if (ok) {
    size = VP8LBuildHuffmanTable(table, HUFFMAN_TABLE_BITS,
                                 code_lengths, alphabet_size);
  }
  if (!ok || size == 0) {
    return VP8LSetError(dec, VP8_STATUS_BITSTREAM_ERROR);
  }
  return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, 0x20(%rsp)
movq %rdx, %rbp
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x28(%rsi), %r12
pushq $0x1
popq %r13
movq %r12, %rdi
movl %r13d, %esi
callq 0xe0a0b
movl %eax, %r15d
movl %r14d, 0x8(%rsp)
movslq %r14d, %rdx
shlq $0x2, %rdx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x56ff0
testl %r15d, %r15d
je 0xcc07a
movq %r12, %rdi
movl %r13d, %esi
callq 0xe0a0b
movl %eax, %r15d
movq %r12, %rdi
movl %r13d, %esi
callq 0xe0a0b
testl %eax, %eax
pushq $0x8
popq %rsi
cmovel %r13d, %esi
movq %r12, %rdi
callq 0xe0a0b
cltq
movl $0x1, (%rbp,%rax,4)
cmpl $0x1, %r15d
jne 0xcc04f
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0xe0a0b
cltq
movl $0x1, (%rbp,%rax,4)
cmpl $0x0, 0x4c(%rbx)
jne 0xcc173
pushq $0x8
popq %rsi
movq 0x20(%rsp), %rdi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
callq 0xe0bc9
testl %eax, %eax
jne 0xcc186
jmp 0xcc173
movq %rbp, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8c(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0xe0a0b
movl %eax, %r13d
addl $0x4, %r13d
cmpl $0x13, %r13d
jg 0xcc294
xorl %r14d, %r14d
testl %r13d, %r13d
cmovlel %r14d, %r13d
pushq $0x3
popq %r15
leaq 0x4d49e(%rip), %rbp     # 0x119570
cmpq %r14, %r13
je 0xcc0f0
movq %r12, %rdi
movl %r15d, %esi
callq 0xe0a0b
movzbl (%r14,%rbp), %ecx
movl %eax, 0x50(%rsp,%rcx,4)
incq %r14
jmp 0xcc0d2
leaq 0x28(%rsp), %rsi
movl $0x80, %edi
callq 0xe12a1
testl %eax, %eax
je 0xcc158
leaq 0x28(%rsp), %rdi
pushq $0x7
popq %rsi
leaq 0x50(%rsp), %rdx
pushq $0x13
popq %rcx
callq 0xe0bc9
testl %eax, %eax
je 0xcc158
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xe0a0b
movl 0x8(%rsp), %r13d
testl %eax, %eax
je 0xcc198
pushq $0x3
popq %rsi
movq %r12, %rdi
callq 0xe0a0b
leal 0x2(,%rax,2), %esi
movq %r12, %rdi
callq 0xe0a0b
movl %eax, %r13d
addl $0x2, %r13d
cmpl 0x8(%rsp), %r13d
jle 0xcc198
leaq 0x28(%rsp), %rdi
callq 0xe12da
movl (%rbx), %eax
cmpl $0x5, %eax
je 0xcc16d
testl %eax, %eax
jne 0xcc173
movl $0x3, (%rbx)
movl (%rbx), %ecx
xorl %eax, %eax
cmpl $0x5, %ecx
je 0xcc180
testl %ecx, %ecx
jne 0xcc186
movl $0x3, (%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
pushq $0x8
popq %rax
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rbp
cmpl 0x8(%rsp), %r15d
jge 0xcc285
subl $0x1, %r13d
jb 0xcc285
movq %r12, %rdi
callq 0xce4b1
movq 0x48(%rsp), %rax
movq 0x28(%rbx), %rdx
movl 0x48(%rbx), %ecx
shrq %cl, %rdx
movq (%rax), %rax
andl $0x7f, %edx
movzbl (%rax,%rdx,4), %esi
addl %ecx, %esi
movl %esi, 0x48(%rbx)
movzwl 0x2(%rax,%rdx,4), %r14d
movslq %r15d, %rbp
cmpl $0xf, %r14d
jbe 0xcc262
leal -0x10(%r14), %eax
leaq 0x4d387(%rip), %rcx     # 0x119583
movzbl (%rax,%rcx), %esi
movl %r13d, 0x1c(%rsp)
movq %rbx, %r13
leaq 0x4d377(%rip), %rcx     # 0x119586
movzbl (%rax,%rcx), %ebx
movq %r12, %rdi
callq 0xe0a0b
addl %ebx, %eax
movq %r13, %rbx
movl 0x1c(%rsp), %r13d
leal (%rax,%r15), %ecx
cmpl 0x8(%rsp), %ecx
jg 0xcc158
cmpl $0x10, %r14d
movl $0x0, %ecx
cmovel 0xc(%rsp), %ecx
movq 0x10(%rsp), %rsi
leaq (%rsi,%rbp,4), %rdx
movq %rsi, %rbp
testl %eax, %eax
jle 0xcc1a7
decl %eax
movl %ecx, (%rdx)
incl %r15d
addq $0x4, %rdx
jmp 0xcc24d
incl %r15d
movq 0x10(%rsp), %rax
movl %r14d, (%rax,%rbp,4)
movq %rax, %rbp
testl %r14d, %r14d
movl 0xc(%rsp), %eax
cmovnel %r14d, %eax
movl %eax, 0xc(%rsp)
jmp 0xcc1a7
leaq 0x28(%rsp), %rdi
callq 0xe12da
jmp 0xcc04f
leaq 0x4d52d(%rip), %rdi     # 0x1197c8
leaq 0x4d377(%rip), %rsi     # 0x119619
leaq 0x4d542(%rip), %rcx     # 0x1197eb
movl $0x159, %edx            # imm = 0x159
callq 0x56770