// File: /workspace/github_c_makefile_star2_O2/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 0xc6928
movl %eax, %ebp
testl %eax, %eax
jne 0xc728b
testq %rbx, %rbx
je 0xc72b8
leaq 0x48(%rsp), %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xca71a
testl %eax, %eax
je 0xc71d8
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 0xc9370
cmpl $0x0, 0x40(%rsp)
je 0xc71df
callq 0xcc2b3
testq %rax, %rax
je 0xc7288
movq %rax, %r14
leaq 0x48(%rsp), %rsi
movq %rax, %rdi
callq 0xcdb6f
testl %eax, %eax
je 0xc71c8
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xc6301
movl %eax, %ebp
testl %eax, %eax
jne 0xc71cb
movq %r14, %rdi
callq 0xcdc53
xorl %ebp, %ebp
testl %eax, %eax
jne 0xc71cb
movl (%r14), %ebp
movq %r14, %rdi
callq 0xcc3d9
jmp 0xc727a
pushq $0x2
jmp 0xc728a
callq 0xca743
testq %rax, %rax
je 0xc7288
movq %rax, %r14
movq 0x20(%rsp), %rax
movq %rax, 0xb98(%r14)
movq 0x28(%rsp), %rax
movq %rax, 0xba0(%r14)
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0xca964
testl %eax, %eax
je 0xc726f
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xc6301
movl %eax, %ebp
testl %eax, %eax
jne 0xc7272
movq 0x28(%rbx), %rdi
leaq 0x48(%rsp), %r15
movl (%r15), %edx
movl 0x4(%r15), %ecx
movq %rsp, %rsi
callq 0xc8e79
movl %eax, 0xc8(%r14)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0xc7db0
movq %r14, %rdi
movq %r15, %rsi
callq 0xcb3b0
xorl %ebp, %ebp
testl %eax, %eax
jne 0xc7272
movl (%r14), %ebp
movq %r14, %rdi
callq 0xca802
testl %ebp, %ebp
je 0xc729b
movq (%rbx), %rdi
callq 0x58ee0
jmp 0xc728b
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0xc728b
cmpl $0x0, 0x30(%rax)
je 0xc728b
movq (%rbx), %rdi
callq 0xc626c
movl %eax, %ebp
jmp 0xc728b
leaq 0x51685(%rip), %rdi     # 0x118944
leaq 0x51494(%rip), %rsi     # 0x11875a
leaq 0x51686(%rip), %rcx     # 0x118953
movl $0x1d1, %edx            # imm = 0x1D1
callq 0x56770