// File: /workspace/github_c_makefile_star2_O3/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 0xf1968
movl %ecx, %r12d
movl %edx, %r14d
movl 0x84(%rsi), %ebx
testl %edx, %edx
sets %al
testl %ecx, %ecx
setle %cl
orb %al, %cl
leal (%r12,%r14), %r13d
cmpl %ebx, %r13d
setg %al
orb %cl, %al
je 0xf1530
xorl %eax, %eax
jmp 0xf154c
movq %rdi, %r15
movl (%rsi), %ebp
cmpl $0x0, 0xba8(%rdi)
je 0xf155b
imull %r14d, %ebp
movslq %ebp, %rax
addq 0xbb8(%r15), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, 0x14(%rsp)
movq %rsi, 0x8(%rsp)
movq 0xb90(%r15), %r9
testq %r9, %r9
je 0xf15bd
cmpl %ebx, %r13d
jg 0xf1987
movl 0xa4(%r9), %esi
cmpl $0x0, 0x8(%r9)
je 0xf1636
cmpq $0x0, 0x18(%r9)
je 0xf19a6
movl %esi, %r12d
movq %r9, %rdi
movl %r13d, %esi
callq 0xd4919
testl %eax, %eax
movq 0x8(%rsp), %rbx
movl 0x14(%rsp), %ebp
movl %r12d, %esi
jne 0xf16f4
jmp 0xf1865
movl $0x1, %edi
movl $0xd8, %esi
callq 0x56580
movq %rax, 0xb90(%r15)
testq %rax, %rax
je 0xf1775
movq %r14, 0x18(%rsp)
cmpq $0x0, 0xbb0(%r15)
jne 0xf1a03
movq 0x8(%rsp), %rcx
movslq (%rcx), %rax
movslq 0x84(%rcx), %rdi
imulq %rax, %rdi
movl $0x1, %esi
callq 0x56b20
movq %rax, 0xbb0(%r15)
testq %rax, %rax
je 0xf178e
movq %rax, %r14
movq %rax, 0xbb8(%r15)
movq $0x0, 0xbc0(%r15)
jmp 0xf17b1
movq %r15, %rdx
movslq (%r9), %r15
movq 0xb98(%rdx), %rcx
movl %r15d, %eax
movq %r14, 0x18(%rsp)
imull %r14d, %eax
cltq
leaq (%rcx,%rax), %r14
incq %r14
movq %rdx, (%rsp)
addq 0xba0(%rdx), %rcx
cmpq %rcx, %r14
ja 0xf19c5
movl 0xc(%r9), %ecx
leaq 0x89d79(%rip), %rbp     # 0x17b3f0
cmpq $0x0, (%rbp,%rcx,8)
je 0xf19e4
movq (%rsp), %rcx
movq 0xbc0(%rcx), %rdi
testl %r12d, %r12d
jle 0xf16db
movl %r13d, 0x20(%rsp)
movl %esi, 0x24(%rsp)
addq 0xbb8(%rcx), %rax
movq %rax, %rbx
movl 0xc(%r9), %eax
movq %r14, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
movq %r9, %r13
callq *(%rbp,%rax,8)
movq %r13, %r9
leaq (%rbx,%r15), %rax
addq %r15, %r14
movq %rbx, %rdi
decl %r12d
jne 0xf16a3
subq %r15, %rax
movq %rax, %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %r13d
movq (%rsp), %r15
movq %rdi, 0xbc0(%r15)
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %rbx
movl 0x14(%rsp), %ebp
cmpl %esi, %r13d
jge 0xf1708
cmpl $0x0, 0xba8(%r15)
jne 0xf1713
jmp 0xf153e
movl $0x1, 0xba8(%r15)
movq 0xb90(%r15), %rdi
callq 0xf14cb
movq $0x0, 0xb90(%r15)
movl 0xbc8(%r15), %r8d
testl %r8d, %r8d
jle 0xf153e
movl 0x80(%rbx), %eax
movl 0x84(%rbx), %edx
subl %eax, %edx
imull %ebp, %eax
movslq %eax, %rdi
addq 0xbb8(%r15), %rdi
movl 0x7c(%rbx), %esi
movslq 0x78(%rbx), %rax
addq %rax, %rdi
subl %eax, %esi
movl %ebp, %ecx
callq 0xf2930
testl %eax, %eax
jne 0xf153e
jmp 0xf1865
leaq 0x3cad4(%rip), %rdx     # 0x12e250
movq %r15, %rdi
movl $0x1, %esi
callq 0xd18d5
jmp 0xf152c
leaq 0x3cabb(%rip), %rdx     # 0x12e250
movq %r15, %rdi
movl $0x1, %esi
callq 0xd18d5
testl %eax, %eax
je 0xf1865
movq 0xbb8(%r15), %r14
movq 0xb98(%r15), %rbp
testq %rbp, %rbp
je 0xf1a22
testq %r14, %r14
je 0xf1a22
movq 0xb90(%r15), %r13
movq 0xba0(%r15), %rax
movq %rax, (%rsp)
callq 0xd98e8
movq %r14, 0xc8(%r13)
movq 0x8(%rsp), %rax
movl (%rax), %ecx
movl %ecx, (%r13)
movl 0x4(%rax), %eax
movl %eax, 0x4(%r13)
testl %ecx, %ecx
jle 0xf1a41
testl %eax, %eax
jle 0xf1a41
cmpq $0x2, (%rsp)
jb 0xf183d
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 0xf1898
movq 0xb90(%r15), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xf1851
movl (%rax), %esi
jmp 0xf1856
movl $0x1, %esi
leaq 0x3c9f3(%rip), %rdx     # 0x12e250
movq %r15, %rdi
callq 0xd18d5
movq 0xbb0(%r15), %rdi
callq 0x57290
xorps %xmm0, %xmm0
movups %xmm0, 0xbb0(%r15)
movq 0xb90(%r15), %rdi
callq 0xf14cb
movq $0x0, 0xb90(%r15)
jmp 0xf152c
cmpb $0x1, %al
ja 0xf183d
cmpb $0x3f, (%rbp)
ja 0xf183d
leaq 0x20(%r13), %r14
movq %r14, %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xd1786
movq (%rsp), %rcx
testl %eax, %eax
je 0xf183d
decq %rcx
xorl %edi, %edi
movq %r14, %rsi
movq %rcx, %r14
callq 0xd031c
movq %r13, 0x58(%r13)
movq 0x8(%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 0xf191b
testl %eax, %eax
jne 0xf1a60
movslq (%r13), %rax
movslq 0x4(%r13), %rcx
imulq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %r14
setae %al
jmp 0xf192c
incq %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0xd3fbd
testl %eax, %eax
je 0xf183d
movq 0xb90(%r15), %r9
cmpl $0x1, 0x10(%r9)
jne 0xf194f
movl %ebx, %r12d
movq 0x18(%rsp), %r14
subl %r14d, %r12d
jmp 0xf195f
movl $0x0, 0xbc8(%r15)
movq 0x18(%rsp), %r14
leal (%r12,%r14), %r13d
jmp 0xf1570
leaq 0x3c870(%rip), %rdi     # 0x12e1df
leaq 0x3c823(%rip), %rsi     # 0x12e199
leaq 0x3c87c(%rip), %rcx     # 0x12e1f9
movl $0xb5, %edx
callq 0x55710
leaq 0x3c8e7(%rip), %rdi     # 0x12e275
leaq 0x3c804(%rip), %rsi     # 0x12e199
leaq 0x3c85d(%rip), %rcx     # 0x12e1f9
movl $0xd6, %edx
callq 0x55710
leaq 0x3ca75(%rip), %rdi     # 0x12e422
leaq 0x3c7e5(%rip), %rsi     # 0x12e199
leaq 0x3ca3b(%rip), %rcx     # 0x12e3f6
movl $0x86, %edx
callq 0x55710
leaq 0x3c9f7(%rip), %rdi     # 0x12e3c3
leaq 0x3c7c6(%rip), %rsi     # 0x12e199
leaq 0x3ca1c(%rip), %rcx     # 0x12e3f6
movl $0x7c, %edx
callq 0x55710
leaq 0x384d7(%rip), %rdi     # 0x129ec2
leaq 0x3c7a7(%rip), %rsi     # 0x12e199
leaq 0x3c9fd(%rip), %rcx     # 0x12e3f6
movl $0x7d, %edx
callq 0x55710
leaq 0x3c884(%rip), %rdi     # 0x12e28e
leaq 0x3c788(%rip), %rsi     # 0x12e199
leaq 0x3c894(%rip), %rcx     # 0x12e2ac
movl $0x97, %edx
callq 0x55710
leaq 0x3c8c1(%rip), %rdi     # 0x12e2ea
leaq 0x3c769(%rip), %rsi     # 0x12e199
leaq 0x3c8e4(%rip), %rcx     # 0x12e31b
movl $0x3b, %edx
callq 0x55710
leaq 0x3c92c(%rip), %rdi     # 0x12e374
leaq 0x3c74a(%rip), %rsi     # 0x12e199
leaq 0x3c8c5(%rip), %rcx     # 0x12e31b
movl $0x41, %edx
callq 0x55710
leaq 0x3c931(%rip), %rdi     # 0x12e398
leaq 0x3c72b(%rip), %rsi     # 0x12e199
leaq 0x3c8a6(%rip), %rcx     # 0x12e31b
movl $0x67, %edx
callq 0x55710
nop