// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/libraries/libwebp/src/dec/webp_dec.c
// Function: DecodeInto
WEBP_NODISCARD static VP8StatusCode DecodeInto(const uint8_t* const data,
                                               size_t data_size,
                                               WebPDecParams* const params) {
  VP8StatusCode status;
  VP8Io io;
  WebPHeaderStructure headers;

  headers.data = data;
  headers.data_size = data_size;
  headers.have_all_data = 1;
  status = WebPParseHeaders(&headers);   // Process Pre-VP8 chunks.
  if (status != VP8_STATUS_OK) {
    return status;
  }

  assert(params != NULL);
  if (!VP8InitIo(&io)) {
    return VP8_STATUS_INVALID_PARAM;
  }
  io.data = headers.data + headers.offset;
  io.data_size = headers.data_size - headers.offset;
  WebPInitCustomIo(params, &io);  // Plug the I/O functions.

  if (!headers.is_lossless) {
    VP8Decoder* const dec = VP8New();
    if (dec == NULL) {
      return VP8_STATUS_OUT_OF_MEMORY;
    }
    dec->alpha_data_ = headers.alpha_data;
    dec->alpha_data_size_ = headers.alpha_data_size;

    // Decode bitstream header, update io->width/io->height.
    if (!VP8GetHeaders(dec, &io)) {
      status = dec->status_;   // An error occurred. Grab error status.
    } else {
      // Allocate/check output buffers.
      status = WebPAllocateDecBuffer(io.width, io.height, params->options,
                                     params->output);
      if (status == VP8_STATUS_OK) {  // Decode
        // This change must be done before calling VP8Decode()
        dec->mt_method_ = VP8GetThreadMethod(params->options, &headers,
                                             io.width, io.height);
        VP8InitDithering(params->options, dec);
        if (!VP8Decode(dec, &io)) {
          status = dec->status_;
        }
      }
    }
    VP8Delete(dec);
  } else {
    VP8LDecoder* const dec = VP8LNew();
    if (dec == NULL) {
      return VP8_STATUS_OUT_OF_MEMORY;
    }
    if (!VP8LDecodeHeader(dec, &io)) {
      status = dec->status_;   // An error occurred. Grab error status.
    } else {
      // Allocate/check output buffers.
      status = WebPAllocateDecBuffer(io.width, io.height, params->options,
                                     params->output);
      if (status == VP8_STATUS_OK) {  // Decode
        if (!VP8LDecodeImage(dec)) {
          status = dec->status_;
        }
      }
    }
    VP8LDelete(dec);
  }

  if (status != VP8_STATUS_OK) {
    WebPFreeDecBuffer(params->output);
  } else {
    if (params->options != NULL && params->options->flip) {
      // This restores the original stride values if options->flip was used
      // during the call to WebPAllocateDecBuffer above.
      status = WebPFlipBuffer(params->output);
    }
  }
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xe8, %rsp
movq %rdx, %rbx
movq %rsp, %rax
movq %rdi, (%rax)
movq %rsi, 0x8(%rax)
movl $0x1, 0x10(%rax)
movq %rax, %rdi
callq 0xce3a4
movl %eax, %ebp
testl %eax, %eax
je 0xceb7e
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testq %rbx, %rbx
je 0xced19
leaq 0x48(%rsp), %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xd2606
testl %eax, %eax
je 0xcec28
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rsp), %rdx
addq %rcx, %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, 0x68(%rsi)
subq %rcx, %rax
movq %rax, 0x60(%rsi)
movq %rbx, %rdi
callq 0xd1208
cmpl $0x0, 0x40(%rsp)
je 0xcec32
callq 0xd4e07
movq %rax, %r14
testq %rax, %rax
je 0xceccf
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0xd6df6
testl %eax, %eax
je 0xcec18
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xcdd03
movl %eax, %ebp
testl %eax, %eax
jne 0xcec1b
movq %r14, %rdi
callq 0xd6ee2
xorl %ebp, %ebp
testl %eax, %eax
jne 0xcec1b
movl (%r14), %ebp
movq %r14, %rdi
callq 0xd4f48
jmp 0xcecd1
movl $0x2, %ebp
jmp 0xceb6e
callq 0xd2631
movq %rax, %r14
testq %rax, %rax
je 0xceccf
movq 0x20(%rsp), %rax
movq %rax, 0xb98(%r14)
movq 0x28(%rsp), %rax
movq %rax, 0xba0(%r14)
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0xd2848
testl %eax, %eax
je 0xcecc2
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xcdd03
movl %eax, %ebp
testl %eax, %eax
jne 0xcecc5
movq 0x28(%rbx), %rdi
leaq 0x48(%rsp), %r15
movl (%r15), %edx
movl 0x4(%r15), %ecx
movq %rsp, %rsi
callq 0xd0d36
movl %eax, 0xc8(%r14)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0xcfbac
movq %r14, %rdi
movq %r15, %rsi
callq 0xd3337
xorl %ebp, %ebp
testl %eax, %eax
jne 0xcecc5
movl (%r14), %ebp
movq %r14, %rdi
callq 0xd26f2
jmp 0xcecd1
xorl %ebp, %ebp
testq %r14, %r14
je 0xcece7
testl %ebp, %ebp
je 0xcecf1
movq (%rbx), %rdi
callq 0x57c60
jmp 0xceb6e
movl $0x1, %ebp
jmp 0xceb6e
movq 0x28(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0xceb6e
cmpl $0x0, 0x30(%rax)
je 0xceb6e
movq (%rbx), %rdi
callq 0xcdc6c
movl %eax, %ebp
jmp 0xceb6e
leaq 0x5acca(%rip), %rdi     # 0x1299ea
leaq 0x5a993(%rip), %rsi     # 0x1296ba
leaq 0x5accb(%rip), %rcx     # 0x1299f9
movl $0x1d1, %edx            # imm = 0x1D1
callq 0x55710