// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/webp_dec.c
// Function: ParseVP8X
static VP8StatusCode ParseVP8X(const uint8_t** const data,
                               size_t* const data_size,
                               int* const found_vp8x,
                               int* const width_ptr, int* const height_ptr,
                               uint32_t* const flags_ptr) {
  const uint32_t vp8x_size = CHUNK_HEADER_SIZE + VP8X_CHUNK_SIZE;
  assert(data != NULL);
  assert(data_size != NULL);
  assert(found_vp8x != NULL);

  *found_vp8x = 0;

  if (*data_size < CHUNK_HEADER_SIZE) {
    return VP8_STATUS_NOT_ENOUGH_DATA;  // Insufficient data.
  }

  if (!memcmp(*data, "VP8X", TAG_SIZE)) {
    int width, height;
    uint32_t flags;
    const uint32_t chunk_size = GetLE32(*data + TAG_SIZE);
    if (chunk_size != VP8X_CHUNK_SIZE) {
      return VP8_STATUS_BITSTREAM_ERROR;  // Wrong chunk size.
    }

    // Verify if enough data is available to validate the VP8X chunk.
    if (*data_size < vp8x_size) {
      return VP8_STATUS_NOT_ENOUGH_DATA;  // Insufficient data.
    }
    flags = GetLE32(*data + 8);
    width = 1 + GetLE24(*data + 12);
    height = 1 + GetLE24(*data + 15);
    if (width * (uint64_t)height >= MAX_IMAGE_AREA) {
      return VP8_STATUS_BITSTREAM_ERROR;  // image is too large
    }

    if (flags_ptr != NULL) *flags_ptr = flags;
    if (width_ptr != NULL) *width_ptr = width;
    if (height_ptr != NULL) *height_ptr = height;
    // Skip over VP8X header bytes.
    *data += vp8x_size;
    *data_size -= vp8x_size;
    *found_vp8x = 1;
  }
  return VP8_STATUS_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x12, -0x3c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x13cd20
jmp 0x13cd3f
leaq 0x7f88a(%rip), %rdi     # 0x1bc5b1
leaq 0x7f525(%rip), %rsi     # 0x1bc253
movl $0x66, %edx
leaq 0x7f76a(%rip), %rcx     # 0x1bc4a4
callq 0x598a0
cmpq $0x0, -0x18(%rbp)
je 0x13cd48
jmp 0x13cd67
leaq 0x7f727(%rip), %rdi     # 0x1bc476
leaq 0x7f4fd(%rip), %rsi     # 0x1bc253
movl $0x67, %edx
leaq 0x7f742(%rip), %rcx     # 0x1bc4a4
callq 0x598a0
cmpq $0x0, -0x20(%rbp)
je 0x13cd70
jmp 0x13cd8f
leaq 0x7f7a0(%rip), %rdi     # 0x1bc517
leaq 0x7f4d5(%rip), %rsi     # 0x1bc253
movl $0x68, %edx
leaq 0x7f71a(%rip), %rcx     # 0x1bc4a4
callq 0x598a0
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x8, (%rax)
jae 0x13cdaf
movl $0x7, -0x4(%rbp)
jmp 0x13cec7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
subl $0x58385056, %eax       # imm = 0x58385056
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x13cec0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0x4, %rdi
callq 0x13d2f0
movl %eax, -0x4c(%rbp)
cmpl $0xa, -0x4c(%rbp)
je 0x13cdf1
movl $0x3, -0x4(%rbp)
jmp 0x13cec7
movq -0x18(%rbp), %rax
cmpq $0x12, (%rax)
jae 0x13ce07
movl $0x7, -0x4(%rbp)
jmp 0x13cec7
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x13d2f0
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0xc, %rdi
callq 0x13d360
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0xf, %rdi
callq 0x13d360
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movslq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq %rcx, %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %rax
jb 0x13ce6a
movl $0x3, -0x4(%rbp)
jmp 0x13cec7
cmpq $0x0, -0x38(%rbp)
je 0x13ce7a
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x13ce8a
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x13ce9a
movl -0x44(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x12, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
subq $0x12, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq