// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: VP8LDecodeAlphaHeader
int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
                          const uint8_t* const data, size_t data_size) {
  int ok = 0;
  VP8LDecoder* dec = VP8LNew();

  if (dec == NULL) return 0;

  assert(alph_dec != NULL);

  dec->width_ = alph_dec->width_;
  dec->height_ = alph_dec->height_;
  dec->io_ = &alph_dec->io_;
  dec->io_->opaque = alph_dec;
  dec->io_->width = alph_dec->width_;
  dec->io_->height = alph_dec->height_;

  dec->status_ = VP8_STATUS_OK;
  VP8LInitBitReader(&dec->br_, data, data_size);

  if (!DecodeImageStream(alph_dec->width_, alph_dec->height_, /*is_level0=*/1,
                         dec, /*decoded_data=*/NULL)) {
    goto Err;
  }

  // Special case: if alpha data uses only the color indexing transform and
  // doesn't use color cache (a frequent case), we will use DecodeAlphaData()
  // method that only needs allocation of 1 byte per pixel (alpha channel).
  if (dec->next_transform_ == 1 &&
      dec->transforms_[0].type_ == COLOR_INDEXING_TRANSFORM &&
      Is8bOptimizable(&dec->hdr_)) {
    alph_dec->use_8b_decode_ = 1;
    ok = AllocateInternalBuffers8b(dec);
  } else {
    // Allocate internal buffers (note that dec->width_ may have changed here).
    alph_dec->use_8b_decode_ = 0;
    ok = AllocateInternalBuffers32b(dec, alph_dec->width_);
  }

  if (!ok) goto Err;

  // Only set here, once we are sure it is valid (to avoid thread races).
  alph_dec->vp8l_dec_ = dec;
  return 1;

 Err:
  VP8LDelete(dec);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
callq 0x144f40
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x145197
movl $0x0, -0x4(%rbp)
jmp 0x145303
cmpq $0x0, -0x10(%rbp)
je 0x1451a0
jmp 0x1451bf
leaq 0x78331(%rip), %rdi     # 0x1bd4d8
leaq 0x7833b(%rip), %rsi     # 0x1bd4e9
movl $0x64c, %edx            # imm = 0x64C
leaq 0x78342(%rip), %rcx     # 0x1bd4fc
callq 0x598a0
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x84(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x88(%rax)
movq -0x10(%rbp), %rcx
addq $0x20, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x182070
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x30(%rbp), %rcx
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %r8d
callq 0x145310
cmpl $0x0, %eax
jne 0x14526b
jmp 0x1452f3
movq -0x30(%rbp), %rax
cmpl $0x1, 0x110(%rax)
jne 0x1452b6
movq -0x30(%rbp), %rax
cmpl $0x3, 0x118(%rax)
jne 0x1452b6
movq -0x30(%rbp), %rdi
addq $0x98, %rdi
callq 0x145610
cmpl $0x0, %eax
je 0x1452b6
movq -0x10(%rbp), %rax
movl $0x1, 0xc0(%rax)
movq -0x30(%rbp), %rdi
callq 0x1456c0
movl %eax, -0x24(%rbp)
jmp 0x1452d6
movq -0x10(%rbp), %rax
movl $0x0, 0xc0(%rax)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x145740
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x1452de
jmp 0x1452f3
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x145303
movq -0x30(%rbp), %rdi
callq 0x145130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)