// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: DecodeAlphaData
static int DecodeAlphaData(VP8LDecoder* const dec, uint8_t* const data,
                           int width, int height, int last_row) {
  int ok = 1;
  int row = dec->last_pixel_ / width;
  int col = dec->last_pixel_ % width;
  VP8LBitReader* const br = &dec->br_;
  VP8LMetadata* const hdr = &dec->hdr_;
  int pos = dec->last_pixel_;         // current position
  const int end = width * height;     // End of data
  const int last = width * last_row;  // Last pixel to decode
  const int len_code_limit = NUM_LITERAL_CODES + NUM_LENGTH_CODES;
  const int mask = hdr->huffman_mask_;
  const HTreeGroup* htree_group =
      (pos < last) ? GetHtreeGroupForPos(hdr, col, row) : NULL;
  assert(pos <= end);
  assert(last_row <= height);
  assert(Is8bOptimizable(hdr));

  while (!br->eos_ && pos < last) {
    int code;
    // Only update when changing tile.
    if ((col & mask) == 0) {
      htree_group = GetHtreeGroupForPos(hdr, col, row);
    }
    assert(htree_group != NULL);
    VP8LFillBitWindow(br);
    code = ReadSymbol(htree_group->htrees[GREEN], br);
    if (code < NUM_LITERAL_CODES) {  // Literal
      data[pos] = code;
      ++pos;
      ++col;
      if (col >= width) {
        col = 0;
        ++row;
        if (row <= last_row && (row % NUM_ARGB_CACHE_ROWS == 0)) {
          ExtractPalettedAlphaRows(dec, row);
        }
      }
    } else if (code < len_code_limit) {  // Backward reference
      int dist_code, dist;
      const int length_sym = code - NUM_LITERAL_CODES;
      const int length = GetCopyLength(length_sym, br);
      const int dist_symbol = ReadSymbol(htree_group->htrees[DIST], br);
      VP8LFillBitWindow(br);
      dist_code = GetCopyDistance(dist_symbol, br);
      dist = PlaneCodeToDistance(width, dist_code);
      if (pos >= dist && end - pos >= length) {
        CopyBlock8b(data + pos, dist, length);
      } else {
        ok = 0;
        goto End;
      }
      pos += length;
      col += length;
      while (col >= width) {
        col -= width;
        ++row;
        if (row <= last_row && (row % NUM_ARGB_CACHE_ROWS == 0)) {
          ExtractPalettedAlphaRows(dec, row);
        }
      }
      if (pos < last && (col & mask)) {
        htree_group = GetHtreeGroupForPos(hdr, col, row);
      }
    } else {  // Not reached
      ok = 0;
      goto End;
    }
    br->eos_ = VP8LIsEndOfStream(br);
  }
  // Process the remaining rows corresponding to last row-block.
  ExtractPalettedAlphaRows(dec, row > last_row ? last_row : row);

 End:
  br->eos_ = VP8LIsEndOfStream(br);
  if (!ok || (br->eos_ && pos < end)) {
    return VP8LSetError(
        dec, br->eos_ ? VP8_STATUS_SUSPENDED : VP8_STATUS_BITSTREAM_ERROR);
  }
  dec->last_pixel_ = pos;
  return ok;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x90(%rax), %eax
cltd
idivl -0x1c(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x90(%rax), %eax
cltd
idivl -0x1c(%rbp)
movl %edx, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x1c(%rbp), %eax
imull -0x20(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x1c(%rbp), %eax
imull -0x24(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl $0x118, -0x50(%rbp)     # imm = 0x118
movq -0x40(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x145a0f
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x147ba0
movq %rax, -0x80(%rbp)
jmp 0x145a17
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0x145a17
movq -0x80(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jg 0x145a29
jmp 0x145a48
leaq 0x77f26(%rip), %rdi     # 0x1bd956
leaq 0x77ab2(%rip), %rsi     # 0x1bd4e9
movl $0x419, %edx            # imm = 0x419
leaq 0x77f1e(%rip), %rcx     # 0x1bd961
callq 0x598a0
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x145a52
jmp 0x145a71
leaq 0x77f4f(%rip), %rdi     # 0x1bd9a8
leaq 0x77a89(%rip), %rsi     # 0x1bd4e9
movl $0x41a, %edx            # imm = 0x41A
leaq 0x77ef5(%rip), %rcx     # 0x1bd961
callq 0x598a0
movq -0x40(%rbp), %rdi
callq 0x145610
cmpl $0x0, %eax
je 0x145a81
jmp 0x145aa0
leaq 0x77f33(%rip), %rdi     # 0x1bd9bb
leaq 0x77a5a(%rip), %rsi     # 0x1bd4e9
movl $0x41b, %edx            # imm = 0x41B
leaq 0x77ec6(%rip), %rcx     # 0x1bd961
callq 0x598a0
jmp 0x145aa2
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x24(%rcx)
movb %al, -0x81(%rbp)
jne 0x145ac3
movl -0x44(%rbp), %eax
cmpl -0x4c(%rbp), %eax
setl %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x145ad2
jmp 0x145cd8
movl -0x30(%rbp), %eax
andl -0x54(%rbp), %eax
cmpl $0x0, %eax
jne 0x145af0
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x147ba0
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x145af9
jmp 0x145b18
leaq 0x77ed0(%rip), %rdi     # 0x1bd9d0
leaq 0x779e2(%rip), %rsi     # 0x1bd4e9
movl $0x423, %edx            # imm = 0x423
leaq 0x77e4e(%rip), %rcx     # 0x1bd961
callq 0x598a0
movq -0x38(%rbp), %rdi
callq 0x147300
movq -0x60(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x147c20
movl %eax, -0x64(%rbp)
cmpl $0x100, -0x64(%rbp)     # imm = 0x100
jge 0x145ba2
movl -0x64(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x145b9d
movl $0x0, -0x30(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x145b9b
movl -0x2c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x145b9b
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x147d00
jmp 0x145b9d
jmp 0x145cc1
cmpl $0x118, -0x64(%rbp)     # imm = 0x118
jge 0x145cb6
movl -0x64(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x147ec0
movl %eax, -0x74(%rbp)
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x147c20
movl %eax, -0x78(%rbp)
movq -0x38(%rbp), %rdi
callq 0x147300
movl -0x78(%rbp), %edi
movq -0x38(%rbp), %rsi
callq 0x147ef0
movl %eax, -0x68(%rbp)
movl -0x1c(%rbp), %edi
movl -0x68(%rbp), %esi
callq 0x147f60
movl %eax, -0x6c(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jl 0x145c2e
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
cmpl -0x74(%rbp), %eax
jl 0x145c2e
movq -0x18(%rbp), %rdi
movslq -0x44(%rbp), %rax
addq %rax, %rdi
movl -0x6c(%rbp), %esi
movl -0x74(%rbp), %edx
callq 0x147fe0
jmp 0x145c3a
movl $0x0, -0x28(%rbp)
jmp 0x145d11
movl -0x74(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x74(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x145c8e
movl -0x1c(%rbp), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x145c8c
movl -0x2c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x145c8c
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x147d00
jmp 0x145c4c
movl -0x44(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x145cb4
movl -0x30(%rbp), %eax
andl -0x54(%rbp), %eax
cmpl $0x0, %eax
je 0x145cb4
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x147ba0
movq %rax, -0x60(%rbp)
jmp 0x145cbf
movl $0x0, -0x28(%rbp)
jmp 0x145d11
jmp 0x145cc1
movq -0x38(%rbp), %rdi
callq 0x1480e0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x145aa2
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x145cf6
movl -0x24(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x145cff
movl -0x2c(%rbp), %eax
movl %eax, -0x94(%rbp)
movq -0x90(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x147d00
movq -0x38(%rbp), %rdi
callq 0x1480e0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x24(%rax)
cmpl $0x0, -0x28(%rbp)
je 0x145d3b
movq -0x38(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0x145d60
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x145d60
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x24(%rax), %ecx
movl $0x3, %esi
movl $0x5, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
callq 0x144bc0
movl %eax, -0x4(%rbp)
jmp 0x145d73
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x90(%rax)
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop