// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/libraries/libwebp/src/dec/webp_dec.c
// Function: ParseVP8Header
static VP8StatusCode ParseVP8Header(const uint8_t** const data_ptr,
                                    size_t* const data_size, int have_all_data,
                                    size_t riff_size, size_t* const chunk_size,
                                    int* const is_lossless) {
  const uint8_t* const data = *data_ptr;
  const int is_vp8 = !memcmp(data, "VP8 ", TAG_SIZE);
  const int is_vp8l = !memcmp(data, "VP8L", TAG_SIZE);
  const uint32_t minimal_size =
      TAG_SIZE + CHUNK_HEADER_SIZE;  // "WEBP" + "VP8 nnnn" OR
                                     // "WEBP" + "VP8Lnnnn"
  assert(data != NULL);
  assert(data_size != NULL);
  assert(chunk_size != NULL);
  assert(is_lossless != NULL);

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

  if (is_vp8 || is_vp8l) {
    // Bitstream contains VP8/VP8L header.
    const uint32_t size = GetLE32(data + TAG_SIZE);
    if ((riff_size >= minimal_size) && (size > riff_size - minimal_size)) {
      return VP8_STATUS_BITSTREAM_ERROR;  // Inconsistent size information.
    }
    if (have_all_data && (size > *data_size - CHUNK_HEADER_SIZE)) {
      return VP8_STATUS_NOT_ENOUGH_DATA;  // Truncated bitstream.
    }
    // Skip over CHUNK_HEADER_SIZE bytes from VP8/VP8L Header.
    *chunk_size = size;
    *data_ptr += CHUNK_HEADER_SIZE;
    *data_size -= CHUNK_HEADER_SIZE;
    *is_lossless = is_vp8l;
  } else {
    // Raw VP8/VP8L bitstream (no header).
    *is_lossless = VP8LCheckSignature(data, *data_size);
    *chunk_size = *data_size;
  }

  return VP8_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r15
movq %rdi, %r8
movq (%rdi), %rdi
movl (%rdi), %eax
xorl %r11d, %r11d
cmpl $0x20385056, %eax       # imm = 0x20385056
setne %r12b
xorl %r9d, %r9d
xorl %ebp, %ebp
cmpl $0x4c385056, %eax       # imm = 0x4C385056
sete %r10b
setne %r13b
testq %rdi, %rdi
je 0xce6eb
movq %rsi, %r14
testq %rsi, %rsi
je 0xce70a
testq %r15, %r15
je 0xce729
testq %rbx, %rbx
je 0xce748
movq (%r14), %rsi
movl $0x7, %eax
cmpq $0x8, %rsi
jb 0xce6dc
movb %r12b, %r11b
movb %r13b, %bpl
testl %ebp, %ebp
sete %al
testl %r11d, %r11d
sete %r11b
orb %al, %r11b
cmpb $0x1, %r11b
jne 0xce6cd
movl 0x4(%rdi), %r11d
cmpq $0xc, %rcx
jb 0xce6a5
addq $-0xc, %rcx
movl $0x3, %eax
cmpq %r11, %rcx
jb 0xce6dc
testl %edx, %edx
je 0xce6b7
addq $-0x8, %rsi
movl $0x7, %eax
cmpq %r11, %rsi
jb 0xce6dc
movq %r11, (%r15)
addq $0x8, %rdi
movq %rdi, (%r8)
addq $-0x8, (%r14)
movb %r10b, %r9b
movl %r9d, (%rbx)
jmp 0xce6da
callq 0x58360
movl %eax, (%rbx)
movq (%r14), %rax
movq %rax, (%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a45c(%rip), %rdi     # 0x128b4e
leaq 0x5a1e1(%rip), %rsi     # 0x1288da
leaq 0x5a478(%rip), %rcx     # 0x128b78
movl $0xeb, %edx
callq 0x55710
leaq 0x5a39a(%rip), %rdi     # 0x128aab
leaq 0x5a1c2(%rip), %rsi     # 0x1288da
leaq 0x5a459(%rip), %rcx     # 0x128b78
movl $0xec, %edx
callq 0x55710
leaq 0x5a4b3(%rip), %rdi     # 0x128be3
leaq 0x5a1a3(%rip), %rsi     # 0x1288da
leaq 0x5a43a(%rip), %rcx     # 0x128b78
movl $0xed, %edx
callq 0x55710
leaq 0x5a4a7(%rip), %rdi     # 0x128bf6
leaq 0x5a184(%rip), %rsi     # 0x1288da
leaq 0x5a41b(%rip), %rcx     # 0x128b78
movl $0xee, %edx
callq 0x55710
nop