// File: /workspace/github_c_makefile_star2_O3/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 0xcd568
movl %eax, %ebp
testl %eax, %eax
je 0xcdc7e
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testq %rbx, %rbx
je 0xcde10
leaq 0x48(%rsp), %rdi
movl $0x209, %esi            # imm = 0x209
callq 0xd1786
testl %eax, %eax
je 0xcdd28
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 0xd031c
cmpl $0x0, 0x40(%rsp)
je 0xcdd32
callq 0xd3e68
testq %rax, %rax
je 0xcddde
movq %rax, %r14
leaq 0x48(%rsp), %rsi
movq %rax, %rdi
callq 0xd5db7
testl %eax, %eax
je 0xcdd18
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xccef3
movl %eax, %ebp
testl %eax, %eax
jne 0xcdd1b
movq %r14, %rdi
callq 0xd5ea3
xorl %ebp, %ebp
testl %eax, %eax
jne 0xcdd1b
movl (%r14), %ebp
movq %r14, %rdi
callq 0xd3fa5
jmp 0xcddcd
movl $0x2, %ebp
jmp 0xcdc6e
callq 0xd17b1
testq %rax, %rax
je 0xcddde
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 0xd19bc
testl %eax, %eax
je 0xcddc2
movl 0x48(%rsp), %edi
movl 0x4c(%rsp), %esi
movq (%rbx), %rcx
movq 0x28(%rbx), %rdx
callq 0xccef3
movl %eax, %ebp
testl %eax, %eax
jne 0xcddc5
movq 0x28(%rbx), %rdi
leaq 0x48(%rsp), %r15
movl (%r15), %edx
movl 0x4(%r15), %ecx
movq %rsp, %rsi
callq 0xcfe2c
movl %eax, 0xc8(%r14)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0xcec74
movq %r14, %rdi
movq %r15, %rsi
callq 0xd2475
xorl %ebp, %ebp
testl %eax, %eax
jne 0xcddc5
movl (%r14), %ebp
movq %r14, %rdi
callq 0xd1872
testl %ebp, %ebp
je 0xcdde8
movq (%rbx), %rdi
callq 0x57c60
jmp 0xcdc6e
movl $0x1, %ebp
jmp 0xcdc6e
movq 0x28(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0xcdc6e
cmpl $0x0, 0x30(%rax)
je 0xcdc6e
movq (%rbx), %rdi
callq 0xcce5c
movl %eax, %ebp
jmp 0xcdc6e
leaq 0x5adf3(%rip), %rdi     # 0x128c0a
leaq 0x5aabc(%rip), %rsi     # 0x1288da
leaq 0x5adf4(%rip), %rcx     # 0x128c19
movl $0x1d1, %edx            # imm = 0x1D1
callq 0x55710