// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
testq %rdi, %rdi
je 0xf2744
movl %ecx, %r12d
movl %edx, %r14d
movq %rsi, %r15
movl 0x84(%rsi), %ebp
testl %edx, %edx
sets %al
testl %ecx, %ecx
setle %cl
orb %al, %cl
leal (%r12,%r14), %eax
cmpl %ebp, %eax
setg %al
orb %cl, %al
je 0xf22ce
xorl %eax, %eax
jmp 0xf22eb
movq %rdi, %rbx
movl (%r15), %r13d
cmpl $0x0, 0xba8(%rdi)
je 0xf22fa
imull %r14d, %r13d
movslq %r13d, %rax
addq 0xbb8(%rbx), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0xb90(%rbx)
je 0xf2368
movl %r13d, 0xc(%rsp)
movq 0xb90(%rbx), %r13
testq %r13, %r13
je 0xf2763
leal (%r12,%r14), %edx
cmpl %ebp, %edx
jg 0xf2782
movl 0xa4(%r13), %esi
cmpl $0x0, 0x8(%r13)
je 0xf23d4
cmpq $0x0, 0x18(%r13)
je 0xf27a1
movl %esi, %r12d
movq %r13, %rdi
movl %edx, %ebp
movl %edx, %esi
callq 0xd5911
movl %ebp, %edx
testl %eax, %eax
movl 0xc(%rsp), %r13d
movl %r12d, %esi
jne 0xf248f
jmp 0xf26f6
movl $0x1, %edi
movl $0xd8, %esi
callq 0x56580
movq %rax, 0xb90(%rbx)
testq %rax, %rax
je 0xf2511
cmpq $0x0, 0xbb0(%rbx)
jne 0xf27fe
movslq (%r15), %rax
movslq 0x84(%r15), %rdi
imulq %rax, %rdi
movl $0x1, %esi
callq 0x56b20
movq %rax, 0xbb0(%rbx)
testq %rax, %rax
je 0xf252a
movq %rax, 0xbb8(%rbx)
movq $0x0, 0xbc0(%rbx)
jmp 0xf2546
movq %r15, 0x18(%rsp)
movslq (%r13), %rbp
movq 0xb98(%rbx), %rcx
movl %ebp, %eax
imull %r14d, %eax
cltq
leaq (%rcx,%rax), %r15
incq %r15
addq 0xba0(%rbx), %rcx
cmpq %rcx, %r15
ja 0xf27c0
movl 0xc(%r13), %ecx
leaq 0x89fe2(%rip), %r8      # 0x17c3f0
cmpq $0x0, (%r8,%rcx,8)
je 0xf27df
movq 0xbc0(%rbx), %rdi
testl %r12d, %r12d
jle 0xf247e
movl %esi, 0x2c(%rsp)
movl %edx, 0x20(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x30(%rsp)
addq 0xbb8(%rbx), %rax
movq %rax, %r14
movl 0xc(%r13), %eax
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq %r8, %rbx
callq *(%r8,%rax,8)
movq %rbx, %r8
leaq (%r14,%rbp), %rax
addq %rbp, %r15
movq %r14, %rdi
decl %r12d
jne 0xf243e
subq %rbp, %rax
movq %rax, %rdi
movq 0x10(%rsp), %r14
movl 0x20(%rsp), %edx
movl 0x2c(%rsp), %esi
movq 0x30(%rsp), %rbx
movq %rdi, 0xbc0(%rbx)
movq 0x18(%rsp), %r15
movl 0xc(%rsp), %r13d
cmpl %esi, %edx
jl 0xf249d
movl $0x1, 0xba8(%rbx)
cmpl $0x0, 0xba8(%rbx)
je 0xf22dd
movq 0xb90(%rbx), %rdi
callq 0xf2267
movq $0x0, 0xb90(%rbx)
movl 0xbc8(%rbx), %r8d
testl %r8d, %r8d
jle 0xf22dd
movl 0x80(%r15), %eax
movl 0x84(%r15), %edx
subl %eax, %edx
imull %r13d, %eax
movslq %eax, %rdi
addq 0xbb8(%rbx), %rdi
movl 0x7c(%r15), %esi
movslq 0x78(%r15), %rax
addq %rax, %rdi
subl %eax, %esi
movl %r13d, %ecx
callq 0xf379c
testl %eax, %eax
jne 0xf22dd
jmp 0xf26f6
leaq 0x3cb44(%rip), %rdx     # 0x12f05c
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd2755
jmp 0xf22ca
leaq 0x3cb2b(%rip), %rdx     # 0x12f05c
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd2755
testl %eax, %eax
je 0xf26f6
movl %r13d, 0xc(%rsp)
movq %r15, 0x18(%rsp)
movq 0xb98(%rbx), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0xf281d
movq %r14, %r15
movq 0xbb8(%rbx), %r14
testq %r14, %r14
je 0xf281d
movq 0xb90(%rbx), %r13
movq 0xba0(%rbx), %rax
movq %rax, 0x10(%rsp)
callq 0xda7c0
movq %r14, 0xc8(%r13)
movq 0x18(%rsp), %rax
movl (%rax), %ecx
movl %ecx, (%r13)
movl 0x4(%rax), %eax
movl %eax, 0x4(%r13)
testl %ecx, %ecx
jle 0xf283c
testl %eax, %eax
jle 0xf283c
xorl %esi, %esi
cmpq $0x2, 0x10(%rsp)
movq %r15, %r14
jb 0xf25f4
movq 0x20(%rsp), %rdx
movzbl (%rdx), %ecx
andl $0x3, %ecx
movl %ecx, 0x8(%r13)
movzbl (%rdx), %eax
shrl $0x2, %eax
andl $0x3, %eax
movl %eax, 0xc(%r13)
movzbl (%rdx), %eax
shrl $0x4, %eax
andl $0x3, %eax
movl %eax, 0x10(%r13)
cmpb $0x1, %cl
jbe 0xf2635
movq 0xb90(%rbx), %rax
testl %esi, %esi
je 0xf260d
cmpl $0x1, 0x10(%rax)
jne 0xf2621
movl %ebp, %r12d
subl %r14d, %r12d
jmp 0xf262b
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xf26e2
movl (%rax), %esi
jmp 0xf26e7
movl $0x0, 0xbc8(%rbx)
movq 0x18(%rsp), %r15
jmp 0xf2309
cmpb $0x1, %al
ja 0xf25f4
cmpb $0x3f, (%rdx)
ja 0xf25f4
leaq 0x20(%r13), %r15
movq %r15, %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xd2606
xorl %esi, %esi
testl %eax, %eax
je 0xf25f4
decq 0x10(%rsp)
xorl %edi, %edi
movq %r15, %rsi
callq 0xd1208
movq %r13, 0x58(%r13)
movq 0x18(%rsp), %rcx
movl (%rcx), %eax
movl %eax, 0x20(%r13)
movl 0x4(%rcx), %eax
movl %eax, 0x24(%r13)
movl 0x74(%rcx), %eax
movl %eax, 0x94(%r13)
movl 0x78(%rcx), %eax
movl %eax, 0x98(%r13)
movl 0x7c(%rcx), %eax
movl %eax, 0x9c(%r13)
movl 0x80(%rcx), %eax
movl %eax, 0xa0(%r13)
movl 0x84(%rcx), %eax
movl %eax, 0xa4(%r13)
movl 0x8(%r13), %eax
cmpl $0x1, %eax
je 0xf2728
movq 0x10(%rsp), %rdx
testl %eax, %eax
jne 0xf285b
movslq (%r13), %rax
movslq 0x4(%r13), %rcx
imulq %rax, %rcx
xorl %esi, %esi
cmpq %rcx, %rdx
setae %sil
jmp 0xf25f4
movl $0x1, %esi
leaq 0x3c96e(%rip), %rdx     # 0x12f05c
movq %rbx, %rdi
callq 0xd2755
movq 0xbb0(%rbx), %rdi
callq 0x57290
xorps %xmm0, %xmm0
movups %xmm0, 0xbb0(%rbx)
movq 0xb90(%rbx), %rdi
callq 0xf2267
movq $0x0, 0xb90(%rbx)
jmp 0xf22ca
movq 0x20(%rsp), %rsi
incq %rsi
movq %r13, %rdi
movq 0x10(%rsp), %rdx
callq 0xd4f60
movl %eax, %esi
jmp 0xf25f4
leaq 0x3c8a0(%rip), %rdi     # 0x12efeb
leaq 0x3c853(%rip), %rsi     # 0x12efa5
leaq 0x3c8ac(%rip), %rcx     # 0x12f005
movl $0xb5, %edx
callq 0x55710
leaq 0x3c917(%rip), %rdi     # 0x12f081
leaq 0x3c834(%rip), %rsi     # 0x12efa5
leaq 0x3c88d(%rip), %rcx     # 0x12f005
movl $0xd5, %edx
callq 0x55710
leaq 0x3c90f(%rip), %rdi     # 0x12f098
leaq 0x3c815(%rip), %rsi     # 0x12efa5
leaq 0x3c86e(%rip), %rcx     # 0x12f005
movl $0xd6, %edx
callq 0x55710
leaq 0x3ca9d(%rip), %rdi     # 0x12f245
leaq 0x3c7f6(%rip), %rsi     # 0x12efa5
leaq 0x3ca63(%rip), %rcx     # 0x12f219
movl $0x86, %edx
callq 0x55710
leaq 0x3ca1f(%rip), %rdi     # 0x12f1e6
leaq 0x3c7d7(%rip), %rsi     # 0x12efa5
leaq 0x3ca44(%rip), %rcx     # 0x12f219
movl $0x7c, %edx
callq 0x55710
leaq 0x384b6(%rip), %rdi     # 0x12ac9c
leaq 0x3c7b8(%rip), %rsi     # 0x12efa5
leaq 0x3ca25(%rip), %rcx     # 0x12f219
movl $0x7d, %edx
callq 0x55710
leaq 0x3c8ac(%rip), %rdi     # 0x12f0b1
leaq 0x3c799(%rip), %rsi     # 0x12efa5
leaq 0x3c8bc(%rip), %rcx     # 0x12f0cf
movl $0x97, %edx
callq 0x55710
leaq 0x3c8e9(%rip), %rdi     # 0x12f10d
leaq 0x3c77a(%rip), %rsi     # 0x12efa5
leaq 0x3c90c(%rip), %rcx     # 0x12f13e
movl $0x3b, %edx
callq 0x55710
leaq 0x3c954(%rip), %rdi     # 0x12f197
leaq 0x3c75b(%rip), %rsi     # 0x12efa5
leaq 0x3c8ed(%rip), %rcx     # 0x12f13e
movl $0x41, %edx
callq 0x55710
leaq 0x3c959(%rip), %rdi     # 0x12f1bb
leaq 0x3c73c(%rip), %rsi     # 0x12efa5
leaq 0x3c8ce(%rip), %rcx     # 0x12f13e
movl $0x67, %edx
callq 0x55710
nop