// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/alpha_dec.c
// Function: VP8DecompressAlphaRows
WEBP_NODISCARD const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
                                                     const VP8Io* const io,
                                                     int row, int num_rows) {
  const int width = io->width;
  const int height = io->crop_bottom;

  assert(dec != NULL && io != NULL);

  if (row < 0 || num_rows <= 0 || row + num_rows > height) {
    return NULL;
  }

  if (!dec->is_alpha_decoded_) {
    if (dec->alph_dec_ == NULL) {    // Initialize decoder.
      dec->alph_dec_ = ALPHNew();
      if (dec->alph_dec_ == NULL) {
        VP8SetError(dec, VP8_STATUS_OUT_OF_MEMORY,
                    "Alpha decoder initialization failed.");
        return NULL;
      }
      if (!AllocateAlphaPlane(dec, io)) goto Error;
      if (!ALPHInit(dec->alph_dec_, dec->alpha_data_, dec->alpha_data_size_,
                    io, dec->alpha_plane_)) {
        VP8LDecoder* const vp8l_dec = dec->alph_dec_->vp8l_dec_;
        VP8SetError(dec,
                    (vp8l_dec == NULL) ? VP8_STATUS_OUT_OF_MEMORY
                                       : vp8l_dec->status_,
                    "Alpha decoder initialization failed.");
        goto Error;
      }
      // if we allowed use of alpha dithering, check whether it's needed at all
      if (dec->alph_dec_->pre_processing_ != ALPHA_PREPROCESSED_LEVELS) {
        dec->alpha_dithering_ = 0;   // disable dithering
      } else {
        num_rows = height - row;     // decode everything in one pass
      }
    }

    assert(dec->alph_dec_ != NULL);
    assert(row + num_rows <= height);
    if (!ALPHDecode(dec, row, num_rows)) goto Error;

    if (dec->is_alpha_decoded_) {   // finished?
      ALPHDelete(dec->alph_dec_);
      dec->alph_dec_ = NULL;
      if (dec->alpha_dithering_ > 0) {
        uint8_t* const alpha = dec->alpha_plane_ + io->crop_top * width
                             + io->crop_left;
        if (!WebPDequantizeLevels(alpha,
                                  io->crop_right - io->crop_left,
                                  io->crop_bottom - io->crop_top,
                                  width, dec->alpha_dithering_)) {
          goto Error;
        }
      }
    }
  }

  // Return a pointer to the current decoded row.
  return dec->alpha_plane_ + row * width;

 Error:
  WebPDeallocateAlphaMemory(dec);
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
je 0xe221b
movl %edx, %ebx
movl 0x84(%rsi), %r14d
testl %edx, %edx
sets %al
testl %ecx, %ecx
setle %dl
orb %al, %dl
leal (%rcx,%rbx), %r13d
cmpl %r14d, %r13d
setg %al
orb %dl, %al
je 0xe1e23
xorl %eax, %eax
jmp 0xe1e3f
movq %rdi, %r12
movl (%rsi), %ebp
cmpl $0x0, 0xba8(%rdi)
je 0xe1e4e
imull %ebx, %ebp
movslq %ebp, %rax
addq 0xbb8(%r12), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, 0xc(%rsp)
movq %rsi, (%rsp)
movq 0xb90(%r12), %rbp
testq %rbp, %rbp
je 0xe1ea8
cmpl %r14d, %r13d
jg 0xe223a
movl 0xa4(%rbp), %r15d
cmpl $0x0, 0x8(%rbp)
je 0xe1f23
cmpq $0x0, 0x18(%rbp)
je 0xe2259
movq %rbp, %rdi
movl %r13d, %esi
callq 0xccc7d
testl %eax, %eax
movq (%rsp), %r14
movl 0xc(%rsp), %ebp
jne 0xe1fd4
jmp 0xe2144
movq %rcx, 0x18(%rsp)
pushq $0x1
popq %rdi
movl $0xd8, %esi
callq 0x57690
movq %rax, 0xb90(%r12)
testq %rax, %rax
je 0xe205b
movq %rbx, 0x10(%rsp)
cmpq $0x0, 0xbb0(%r12)
jne 0xe22aa
movq (%rsp), %rcx
movslq (%rcx), %rax
movslq 0x84(%rcx), %rdi
imulq %rax, %rdi
pushq $0x1
popq %rsi
callq 0x57c90
movq %rax, 0xbb0(%r12)
testq %rax, %rax
je 0xe2072
movq %rax, %rbx
movq %rax, 0xbb8(%r12)
andq $0x0, 0xbc0(%r12)
jmp 0xe2094
movl %r15d, 0x18(%rsp)
movslq (%rbp), %r15
movq 0xb98(%r12), %rax
movl %r15d, %edx
movq %rbx, 0x10(%rsp)
imull %ebx, %edx
movslq %edx, %rbx
leaq (%rax,%rbx), %r14
incq %r14
addq 0xba0(%r12), %rax
cmpq %rax, %r14
ja 0xe2278
movl 0xc(%rbp), %eax
leaq 0x8f64c(%rip), %rdx     # 0x1715b0
cmpq $0x0, (%rdx,%rax,8)
je 0xe2291
movq 0xbc0(%r12), %rdi
movq %r12, 0x20(%rsp)
addq 0xbb8(%r12), %rbx
xorl %r12d, %r12d
testl %ecx, %ecx
cmovgl %ecx, %r12d
subl $0x1, %r12d
jb 0xe1fb5
movl 0xc(%rbp), %eax
movq %r14, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
leaq 0x8f60a(%rip), %r8      # 0x1715b0
callq *(%r8,%rax,8)
movq %rbx, %rdi
addq %r15, %rbx
addq %r15, %r14
jmp 0xe1f8d
movq 0x20(%rsp), %r12
movq %rdi, 0xbc0(%r12)
movq 0x10(%rsp), %rbx
movq (%rsp), %r14
movl 0xc(%rsp), %ebp
movl 0x18(%rsp), %r15d
cmpl %r15d, %r13d
jge 0xe1fe9
cmpl $0x0, 0xba8(%r12)
jne 0xe1ff5
jmp 0xe1e31
movl $0x1, 0xba8(%r12)
movq 0xb90(%r12), %rdi
callq 0xe1dc4
andq $0x0, 0xb90(%r12)
movl 0xbc8(%r12), %r8d
testl %r8d, %r8d
jle 0xe1e31
movl 0x80(%r14), %eax
movl 0x84(%r14), %edx
subl %eax, %edx
imull %ebp, %eax
movslq %eax, %rdi
addq 0xbb8(%r12), %rdi
movl 0x7c(%r14), %esi
movslq 0x78(%r14), %rax
addq %rax, %rdi
subl %eax, %esi
movl %ebp, %ecx
callq 0xe2a28
testl %eax, %eax
jne 0xe1e31
jmp 0xe2144
leaq 0x3bf5a(%rip), %rdx     # 0x11dfbc
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xca862
jmp 0xe1e1f
leaq 0x3bf43(%rip), %rdx     # 0x11dfbc
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xca862
testl %eax, %eax
je 0xe2144
movq 0xbb8(%r12), %rbx
movq 0xb98(%r12), %rbp
testq %rbp, %rbp
je 0xe22c9
testq %rbx, %rbx
je 0xe22c9
movq 0xb90(%r12), %r13
movq 0xba0(%r12), %r15
callq 0xd122c
movq %rbx, 0xc8(%r13)
movq (%rsp), %rax
movl (%rax), %ecx
movl %ecx, (%r13)
movl 0x4(%rax), %eax
movl %eax, 0x4(%r13)
testl %ecx, %ecx
jle 0xe22e2
testl %eax, %eax
jle 0xe22e2
cmpq $0x2, %r15
jb 0xe211d
movzbl (%rbp), %ecx
andl $0x3, %ecx
movl %ecx, 0x8(%r13)
movzbl (%rbp), %eax
shrl $0x2, %eax
andl $0x3, %eax
movl %eax, 0xc(%r13)
movzbl (%rbp), %eax
shrl $0x4, %eax
andl $0x3, %eax
movl %eax, 0x10(%r13)
cmpb $0x1, %cl
jbe 0xe2151
movq 0xb90(%r12), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xe2132
movl (%rax), %esi
jmp 0xe2135
pushq $0x1
popq %rsi
leaq 0x3be80(%rip), %rdx     # 0x11dfbc
movq %r12, %rdi
callq 0xca862
movq %r12, %rdi
callq 0xe1d70
jmp 0xe1e1f
cmpb $0x1, %al
ja 0xe211d
cmpb $0x3f, (%rbp)
ja 0xe211d
leaq 0x20(%r13), %rbx
movq %rbx, %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xca71a
testl %eax, %eax
je 0xe211d
decq %r15
xorl %edi, %edi
movq %rbx, %rsi
callq 0xc9370
movq %r13, 0x58(%r13)
movq (%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x20(%r13)
movups 0x74(%rcx), %xmm0
movups %xmm0, 0x94(%r13)
movl 0x84(%rcx), %eax
movl %eax, 0xa4(%r13)
movl 0x8(%r13), %eax
cmpl $0x1, %eax
je 0xe21cc
testl %eax, %eax
jne 0xe22ff
movslq (%r13), %rax
movslq 0x4(%r13), %rcx
imulq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %r15
setae %al
jmp 0xe21dd
incq %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xcc3f1
testl %eax, %eax
je 0xe211d
movq 0xb90(%r12), %rbp
cmpl $0x1, 0x10(%rbp)
jne 0xe21ff
movl %r14d, %ecx
movq 0x10(%rsp), %rbx
subl %ebx, %ecx
jmp 0xe2212
andl $0x0, 0xbc8(%r12)
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rcx
leal (%rcx,%rbx), %r13d
jmp 0xe1e63
leaq 0x3bd29(%rip), %rdi     # 0x11df4b
leaq 0x3bcdc(%rip), %rsi     # 0x11df05
leaq 0x3bd35(%rip), %rcx     # 0x11df65
movl $0xb5, %edx
callq 0x56770
leaq 0x3bda0(%rip), %rdi     # 0x11dfe1
leaq 0x3bcbd(%rip), %rsi     # 0x11df05
leaq 0x3bd16(%rip), %rcx     # 0x11df65
movl $0xd6, %edx
callq 0x56770
leaq 0x3bf2e(%rip), %rdi     # 0x11e18e
leaq 0x3bc9e(%rip), %rsi     # 0x11df05
leaq 0x3bef4(%rip), %rcx     # 0x11e162
movl $0x86, %edx
callq 0x56770
leaq 0x3beb0(%rip), %rdi     # 0x11e12f
leaq 0x3bc7f(%rip), %rsi     # 0x11df05
leaq 0x3bed5(%rip), %rcx     # 0x11e162
pushq $0x7c
jmp 0xe22f9
leaq 0x3795a(%rip), %rdi     # 0x119bf2
leaq 0x3bc66(%rip), %rsi     # 0x11df05
leaq 0x3bebc(%rip), %rcx     # 0x11e162
pushq $0x7d
jmp 0xe22f9
leaq 0x3bd49(%rip), %rdi     # 0x11dffa
leaq 0x3bc4d(%rip), %rsi     # 0x11df05
leaq 0x3bd59(%rip), %rcx     # 0x11e018
movl $0x97, %edx
callq 0x56770
leaq 0x3bd86(%rip), %rdi     # 0x11e056
leaq 0x3bc2e(%rip), %rsi     # 0x11df05
leaq 0x3bda9(%rip), %rcx     # 0x11e087
pushq $0x3b
jmp 0xe22f9
leaq 0x3bdf7(%rip), %rdi     # 0x11e0e0
leaq 0x3bc15(%rip), %rsi     # 0x11df05
leaq 0x3bd90(%rip), %rcx     # 0x11e087
pushq $0x41
popq %rdx
callq 0x56770
leaq 0x3bdfe(%rip), %rdi     # 0x11e104
leaq 0x3bbf8(%rip), %rsi     # 0x11df05
leaq 0x3bd73(%rip), %rcx     # 0x11e087
pushq $0x67
jmp 0xe22f9