// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: ReadTransform
static int ReadTransform(int* const xsize, int const* ysize,
                         VP8LDecoder* const dec) {
  int ok = 1;
  VP8LBitReader* const br = &dec->br_;
  VP8LTransform* transform = &dec->transforms_[dec->next_transform_];
  const VP8LImageTransformType type =
      (VP8LImageTransformType)VP8LReadBits(br, 2);

  // Each transform type can only be present once in the stream.
  if (dec->transforms_seen_ & (1U << type)) {
    return 0;  // Already there, let's not accept the second same transform.
  }
  dec->transforms_seen_ |= (1U << type);

  transform->type_ = type;
  transform->xsize_ = *xsize;
  transform->ysize_ = *ysize;
  transform->data_ = NULL;
  ++dec->next_transform_;
  assert(dec->next_transform_ <= NUM_TRANSFORMS);

  switch (type) {
    case PREDICTOR_TRANSFORM:
    case CROSS_COLOR_TRANSFORM:
      transform->bits_ = VP8LReadBits(br, 3) + 2;
      ok = DecodeImageStream(VP8LSubSampleSize(transform->xsize_,
                                               transform->bits_),
                             VP8LSubSampleSize(transform->ysize_,
                                               transform->bits_),
                             /*is_level0=*/0, dec, &transform->data_);
      break;
    case COLOR_INDEXING_TRANSFORM: {
       const int num_colors = VP8LReadBits(br, 8) + 1;
       const int bits = (num_colors > 16) ? 0
                      : (num_colors > 4) ? 1
                      : (num_colors > 2) ? 2
                      : 3;
       *xsize = VP8LSubSampleSize(transform->xsize_, bits);
       transform->bits_ = bits;
       ok = DecodeImageStream(num_colors, /*ysize=*/1, /*is_level0=*/0, dec,
                              &transform->data_);
       if (ok && !ExpandColorMap(num_colors, transform)) {
         return VP8LSetError(dec, VP8_STATUS_OUT_OF_MEMORY);
       }
      break;
    }
    case SUBTRACT_GREEN_TRANSFORM:
      break;
    default:
      assert(0);    // can't happen
      break;
  }

  return ok;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movq -0x20(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq -0x20(%rbp), %rcx
movslq 0x110(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movl $0x2, %esi
callq 0x1824b0
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl 0x178(%rax), %eax
movl -0x3c(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1474b1
movl $0x0, -0x4(%rbp)
jmp 0x1476ad
movl -0x3c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
orl 0x178(%rax), %ecx
movl %ecx, 0x178(%rax)
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x110(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x110(%rax)
movq -0x20(%rbp), %rax
cmpl $0x4, 0x110(%rax)
jg 0x14751e
jmp 0x14753d
leaq 0x762f3(%rip), %rdi     # 0x1bd818
leaq 0x75fbd(%rip), %rsi     # 0x1bd4e9
movl $0x545, %edx            # imm = 0x545
leaq 0x76307(%rip), %rcx     # 0x1bd83f
callq 0x598a0
movl -0x3c(%rbp), %eax
movl %eax, -0x48(%rbp)
subl $0x2, %eax
jb 0x147565
jmp 0x14754a
movl -0x48(%rbp), %eax
subl $0x2, %eax
je 0x147686
jmp 0x147558
movl -0x48(%rbp), %eax
subl $0x3, %eax
je 0x1475c8
jmp 0x147688
movq -0x30(%rbp), %rdi
movl $0x3, %esi
callq 0x1824b0
movl %eax, %ecx
addl $0x2, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x38(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x147a50
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x38(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x147a50
movl -0x4c(%rbp), %edi
movl %eax, %esi
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %r8
addq $0x10, %r8
xorl %edx, %edx
callq 0x145310
movl %eax, -0x24(%rbp)
jmp 0x1476a7
movq -0x30(%rbp), %rdi
movl $0x8, %esi
callq 0x1824b0
addl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x10, -0x40(%rbp)
jle 0x1475e9
xorl %eax, %eax
movl %eax, -0x50(%rbp)
jmp 0x147615
cmpl $0x4, -0x40(%rbp)
jle 0x1475f9
movl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x14760f
movl -0x40(%rbp), %edx
movl $0x3, %eax
movl $0x2, %ecx
cmpl $0x2, %edx
cmovgl %ecx, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %edi
movl -0x44(%rbp), %esi
callq 0x147a50
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x44(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x40(%rbp), %edi
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %r8
addq $0x10, %r8
movl $0x1, %esi
xorl %edx, %edx
callq 0x145310
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x147684
movl -0x40(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x147a80
cmpl $0x0, %eax
jne 0x147684
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x144bc0
movl %eax, -0x4(%rbp)
jmp 0x1476ad
jmp 0x1476a7
jmp 0x1476a7
leaq 0x78931(%rip), %rdi     # 0x1bffc0
leaq 0x75e53(%rip), %rsi     # 0x1bd4e9
movl $0x563, %edx            # imm = 0x563
leaq 0x7619d(%rip), %rcx     # 0x1bd83f
callq 0x598a0
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)