// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: DecodeImageStream
static int DecodeImageStream(int xsize, int ysize,
                             int is_level0,
                             VP8LDecoder* const dec,
                             uint32_t** const decoded_data) {
  int ok = 1;
  int transform_xsize = xsize;
  int transform_ysize = ysize;
  VP8LBitReader* const br = &dec->br_;
  VP8LMetadata* const hdr = &dec->hdr_;
  uint32_t* data = NULL;
  int color_cache_bits = 0;

  // Read the transforms (may recurse).
  if (is_level0) {
    while (ok && VP8LReadBits(br, 1)) {
      ok = ReadTransform(&transform_xsize, &transform_ysize, dec);
    }
  }

  // Color cache
  if (ok && VP8LReadBits(br, 1)) {
    color_cache_bits = VP8LReadBits(br, 4);
    ok = (color_cache_bits >= 1 && color_cache_bits <= MAX_CACHE_BITS);
    if (!ok) {
      VP8LSetError(dec, VP8_STATUS_BITSTREAM_ERROR);
      goto End;
    }
  }

  // Read the Huffman codes (may recurse).
  ok = ok && ReadHuffmanCodes(dec, transform_xsize, transform_ysize,
                              color_cache_bits, is_level0);
  if (!ok) {
    VP8LSetError(dec, VP8_STATUS_BITSTREAM_ERROR);
    goto End;
  }

  // Finish setting up the color-cache
  if (color_cache_bits > 0) {
    hdr->color_cache_size_ = 1 << color_cache_bits;
    if (!VP8LColorCacheInit(&hdr->color_cache_, color_cache_bits)) {
      ok = VP8LSetError(dec, VP8_STATUS_OUT_OF_MEMORY);
      goto End;
    }
  } else {
    hdr->color_cache_size_ = 0;
  }
  UpdateDecoder(dec, transform_xsize, transform_ysize);

  if (is_level0) {   // level 0 complete
    dec->state_ = READ_HDR;
    goto End;
  }

  {
    const uint64_t total_size = (uint64_t)transform_xsize * transform_ysize;
    data = (uint32_t*)WebPSafeMalloc(total_size, sizeof(*data));
    if (data == NULL) {
      ok = VP8LSetError(dec, VP8_STATUS_OUT_OF_MEMORY);
      goto End;
    }
  }

  // Use the Huffman trees to decode the LZ77 encoded data.
  ok = DecodeImageData(dec, data, transform_xsize, transform_ysize,
                       transform_ysize, NULL);
  ok = ok && !br->eos_;

 End:
  if (!ok) {
    WebPSafeFree(data);
    ClearMetadata(hdr);
  } else {
    if (decoded_data != NULL) {
      *decoded_data = data;
    } else {
      // We allocate image data in this function only for transforms. At level 0
      // (that is: not the transforms), we shouldn't have allocated anything.
      assert(data == NULL);
      assert(is_level0);
    }
    dec->last_pixel_ = 0;  // Reset for future DECODE_DATA_FUNC() calls.
    if (!is_level0) ClearMetadata(hdr);  // Clean up temporary data behind.
  }
  return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, 0x40(%rsp)
movq %rcx, %r14
movl %edx, %r12d
movl %esi, %r13d
leaq 0x28(%rcx), %r15
leaq 0x98(%rcx), %rax
movq %rax, 0x30(%rsp)
testl %edx, %edx
movq %rdi, 0x18(%rsp)
je 0xcc739
movl %r12d, 0xc(%rsp)
pushq $0x1
popq %rbx
leaq 0x118(%r14), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movl %ebx, %esi
callq 0xe0a0b
testl %eax, %eax
je 0xcc734
movslq 0x110(%r14), %r12
movq %r15, %rdi
pushq $0x2
popq %rsi
callq 0xe0a0b
movl 0x178(%r14), %edx
movl %ebx, %esi
movl %eax, %ecx
shll %cl, %esi
btl %eax, %edx
jb 0xcc8b6
imulq $0x18, %r12, %rbp
addq 0x10(%rsp), %rbp
orl %esi, %edx
movl %edx, 0x178(%r14)
movl %eax, (%rbp)
movq 0x18(%rsp), %rcx
movl %ecx, 0x8(%rbp)
movl %r13d, 0xc(%rbp)
andq $0x0, 0x10(%rbp)
movl 0x110(%r14), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x110(%r14)
cmpl $0x4, %ecx
jge 0xccaf7
leaq 0x10(%rbp), %r12
cmpl $0x2, %eax
jae 0xcc648
movq %r15, %rdi
pushq $0x3
popq %rsi
callq 0xe0a0b
leal 0x2(%rax), %ecx
pushq $-0x1
popq %rsi
shll %cl, %esi
movl %ecx, 0x4(%rbp)
notl %esi
movl 0x8(%rbp), %edi
addl %esi, %edi
shrl %cl, %edi
addl 0xc(%rbp), %esi
shrl %cl, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %r12, %r8
callq 0xcc53a
testl %eax, %eax
jne 0xcc587
jmp 0xcc8b6
je 0xcc587
cmpl $0x3, %eax
jne 0xccb16
movq %r15, %rdi
pushq $0x8
popq %rsi
callq 0xe0a0b
incl %eax
xorl %ecx, %ecx
cmpl $0x10, %eax
jg 0xcc67d
movl %ebx, %ecx
cmpl $0x4, %eax
jg 0xcc67d
xorl %ecx, %ecx
cmpl $0x3, %eax
setge %cl
xorl $0x3, %ecx
movl %ebx, %esi
shll %cl, %esi
movl 0x8(%rbp), %edx
addl %esi, %edx
decl %edx
shrl %cl, %edx
movq %rdx, 0x18(%rsp)
movl %ecx, 0x4(%rbp)
movl %eax, 0x8(%rsp)
movl %eax, %edi
movl %ebx, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %r12, %r8
callq 0xcc53a
testl %eax, %eax
je 0xcc8b6
movb 0x4(%rbp), %cl
pushq $0x8
popq %rax
shrq %cl, %rax
pushq $0x1
popq %rdi
movq %rax, 0x28(%rsp)
movl %eax, %ecx
shlq %cl, %rdi
pushq $0x4
popq %rsi
callq 0x57c90
testq %rax, %rax
je 0xccadb
movq %rax, %rbp
movq (%r12), %rcx
movl (%rcx), %eax
movl %eax, (%rbp)
movl 0x8(%rsp), %eax
shll $0x2, %eax
movslq %eax, %rdx
pushq $0x4
popq %rax
cmpq %rdx, %rax
jge 0xcc707
movb -0x4(%rbp,%rax), %sil
addb (%rcx,%rax), %sil
movb %sil, (%rbp,%rax)
incq %rax
jmp 0xcc6ef
pushq $0x4
popq %rcx
movl %ecx, %edx
movq 0x28(%rsp), %rcx
shll %cl, %edx
cmpq %rdx, %rax
jae 0xcc722
movb $0x0, (%rbp,%rax)
incq %rax
jmp 0xcc713
movq (%r12), %rdi
callq 0x58480
movq %rbp, (%r12)
jmp 0xcc587
movl 0xc(%rsp), %r12d
pushq $0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0xe0a0b
testl %eax, %eax
je 0xcc763
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0xe0a0b
movl %eax, %edi
decl %eax
cmpl $0xb, %eax
jb 0xcc765
jmp 0xcc8b6
xorl %edi, %edi
andq $0x0, 0x20(%rsp)
andq $0x0, 0x38(%rsp)
xorl %eax, %eax
cmpq %rax, 0xe8(%r14)
jne 0xccb35
cmpq $0x0, 0x108(%r14)
jne 0xccb54
leaq 0xe8(%r14), %rax
movq %rax, 0x10(%rsp)
testl %r12d, %r12d
movl %edi, 0x8(%rsp)
je 0xcc84d
pushq $0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0xe0a0b
testl %eax, %eax
je 0xcc87d
movl %r12d, 0xc(%rsp)
pushq $0x3
popq %rsi
movq %r15, %rdi
callq 0xe0a0b
movl %eax, %ebx
addl $0x2, %ebx
pushq $0x1
popq %rbp
movl %ebp, %eax
movl %ebx, %ecx
shll %cl, %eax
movq 0x18(%rsp), %rcx
leal (%rcx,%rax), %r12d
decl %r12d
movl %ebx, %ecx
shrl %cl, %r12d
movq %r13, 0x28(%rsp)
addl %eax, %r13d
decl %r13d
shrl %cl, %r13d
xorl %r15d, %r15d
leaq 0x20(%rsp), %r8
movl %r12d, %edi
movl %r13d, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0xcc53a
testl %eax, %eax
je 0xcc88d
imull %r13d, %r12d
movl %ebx, 0xc4(%r14)
movq 0x20(%rsp), %rax
testl %r12d, %r12d
cmovlel %r15d, %r12d
movq 0x28(%rsp), %r13
cmpq %r15, %r12
je 0xcc854
movzwl 0x1(%rax,%r15,4), %ecx
movl %ecx, (%rax,%r15,4)
leal 0x1(%rcx), %edx
cmpl %ebp, %ecx
cmovgel %edx, %ebp
incq %r15
jmp 0xcc831
xorl %r15d, %r15d
movl %ebp, %ebx
jmp 0xcc886
cmpl $0x3e8, %ebp            # imm = 0x3E8
jg 0xcc978
movq 0x18(%rsp), %rax
imull %r13d, %eax
cmpl %eax, %ebp
jg 0xcc978
xorl %r15d, %r15d
movl %ebp, %ebx
movl 0xc(%rsp), %r12d
jmp 0xcc882
xorl %r15d, %r15d
movl %ebp, %ebx
movl 0x8(%rsp), %edi
cmpl $0x0, 0x4c(%r14)
je 0xcc8f0
movq 0x10(%rsp), %rbp
movq %r15, %rdi
callq 0x58480
movq 0x20(%rsp), %rdi
callq 0x58480
movq %rbp, %rdi
callq 0xe12da
movq 0x38(%rsp), %rdi
callq 0xe0bbf
movl (%r14), %eax
pushq $0x3
popq %rbx
testl %eax, %eax
je 0xcc8c5
cmpl $0x5, %eax
jne 0xcc8c8
movl %ebx, (%r14)
xorl %r15d, %r15d
movq %r15, %rdi
callq 0x58480
movq 0x30(%rsp), %rdi
callq 0xcc35f
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38(%rsp), %rax
movq %rax, (%rsp)
movl %ebx, %esi
movl %ebp, %edx
movq %r15, %rcx
movq %r14, %r8
movq 0x10(%rsp), %rbp
movq %rbp, %r9
callq 0xcbbac
testl %eax, %eax
je 0xcc892
movq 0x20(%rsp), %rax
movq %rax, 0xd0(%r14)
movl %ebx, 0xd8(%r14)
movq 0x38(%rsp), %rax
movq %rax, 0xe0(%r14)
movq %r15, %rdi
callq 0x58480
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
jle 0xcc9d6
pushq $0x1
popq %rbx
movl %ebx, %eax
shll %cl, %eax
movl %eax, 0x98(%r14)
leaq 0xa0(%r14), %rdi
movl %ecx, %esi
callq 0xe0a70
testl %eax, %eax
movq 0x18(%rsp), %rbp
jne 0xcc9e3
movl (%r14), %eax
jmp 0xcc8bc
movl %ebp, %ebx
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x57c90
testq %rax, %rax
je 0xccab6
movq %rax, %r15
shlq $0x2, %rbx
movq %rax, %rdi
movl $0xff, %esi
movq %rbx, %rdx
callq 0x56ff0
xorl %eax, %eax
movq 0x20(%rsp), %rcx
xorl %ebx, %ebx
cmpq %rax, %r12
je 0xcc876
movl (%rcx,%rax,4), %esi
movl (%r15,%rsi,4), %edx
cmpl $-0x1, %edx
jne 0xcc9ce
movl %ebx, (%r15,%rsi,4)
movl %ebx, %edx
leal 0x1(%rbx), %esi
movl %esi, %ebx
movl %edx, (%rcx,%rax,4)
incq %rax
jmp 0xcc9ae
movq 0x30(%rsp), %rax
andl $0x0, (%rax)
movq 0x18(%rsp), %rbp
movl 0xc4(%r14), %ecx
pushq $0x1
popq %rbx
movl %ebx, %eax
shll %cl, %eax
addl %ebp, %eax
decl %eax
shrl %cl, %eax
pushq $-0x1
popq %rsi
shll %cl, %esi
notl %esi
xorl %edx, %edx
cmpl $0x1, %ecx
sbbl %edx, %edx
orl %esi, %edx
movl %ebp, 0x84(%r14)
movl %r13d, 0x88(%r14)
movl %eax, 0xc8(%r14)
movl %edx, 0xc0(%r14)
testl %r12d, %r12d
je 0xcca4b
movl $0x1, 0x4(%r14)
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0xcca3e
andq $0x0, (%rax)
andl $0x0, 0x90(%r14)
jmp 0xcc8df
movslq %ebp, %rax
movslq %r13d, %rdi
imulq %rax, %rdi
pushq $0x4
popq %rsi
callq 0x57c90
testq %rax, %rax
je 0xccad1
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movl %ebp, %edx
movl %r13d, %ecx
movl %r13d, %r8d
xorl %r9d, %r9d
callq 0xcd1a4
testl %eax, %eax
je 0xcc8cb
cmpl $0x0, 0x4c(%r14)
jne 0xcc8cb
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0xccb73
movq %r15, (%rax)
andl $0x0, 0x90(%r14)
movq 0x30(%rsp), %rdi
callq 0xcc35f
jmp 0xcc8df
movl (%r14), %eax
cmpl $0x5, %eax
je 0xccac2
testl %eax, %eax
jne 0xccac9
movl $0x1, (%r14)
xorl %r15d, %r15d
jmp 0xcc88d
movl (%r14), %eax
pushq $0x1
jmp 0xcc8bb
movl (%r14), %eax
pushq $0x1
popq %rbx
testl %eax, %eax
je 0xcc8c5
cmpl $0x5, %eax
je 0xcc8c5
jmp 0xcc8b9
leaq 0x4ce25(%rip), %rdi     # 0x119923
leaq 0x4cb14(%rip), %rsi     # 0x119619
leaq 0x4ce3e(%rip), %rcx     # 0x11994a
movl $0x545, %edx            # imm = 0x545
callq 0x56770
leaq 0x4f50d(%rip), %rdi     # 0x11c02a
leaq 0x4caf5(%rip), %rsi     # 0x119619
leaq 0x4ce1f(%rip), %rcx     # 0x11994a
movl $0x563, %edx            # imm = 0x563
callq 0x56770
leaq 0x4ce4d(%rip), %rdi     # 0x119989
leaq 0x4cad6(%rip), %rsi     # 0x119619
leaq 0x4ce62(%rip), %rcx     # 0x1199ac
movl $0x17b, %edx            # imm = 0x17B
callq 0x56770
leaq 0x4ce8e(%rip), %rdi     # 0x1199e9
leaq 0x4cab7(%rip), %rsi     # 0x119619
leaq 0x4ce43(%rip), %rcx     # 0x1199ac
movl $0x17c, %edx            # imm = 0x17C
callq 0x56770
leaq 0x4cd51(%rip), %rdi     # 0x1198cb
leaq 0x4ca98(%rip), %rsi     # 0x119619
leaq 0x4cd50(%rip), %rcx     # 0x1198d8
movl $0x5fd, %edx            # imm = 0x5FD
callq 0x56770