// File: /workspace/github_c_makefile_star2_O1/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 0xcf624
movq %rsi, %r14
testq %rsi, %rsi
je 0xcf643
testq %r15, %r15
je 0xcf662
testq %rbx, %rbx
je 0xcf681
movq (%r14), %rsi
movl $0x7, %eax
cmpq $0x8, %rsi
jb 0xcf615
movb %r12b, %r11b
movb %r13b, %bpl
testl %ebp, %ebp
sete %al
testl %r11d, %r11d
sete %r11b
orb %al, %r11b
cmpb $0x1, %r11b
jne 0xcf5d4
movl 0x4(%rdi), %eax
cmpq $0xc, %rcx
jb 0xcf5e3
addq $-0xc, %rcx
cmpq %rax, %rcx
jae 0xcf5e3
xorl %ecx, %ecx
movl $0x3, %eax
jmp 0xcf60f
callq 0x58360
movl %eax, (%rbx)
movq (%r14), %rax
movq %rax, (%r15)
jmp 0xcf613
testl %edx, %edx
je 0xcf5f9
addq $-0x8, %rsi
cmpq %rax, %rsi
jae 0xcf5f9
xorl %ecx, %ecx
movl $0x7, %eax
jmp 0xcf60f
movq %rax, (%r15)
addq $0x8, %rdi
movq %rdi, (%r8)
addq $-0x8, (%r14)
movb %r10b, %r9b
movl %r9d, (%rbx)
movb $0x1, %cl
testb %cl, %cl
je 0xcf615
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a303(%rip), %rdi     # 0x12992e
leaq 0x5a088(%rip), %rsi     # 0x1296ba
leaq 0x5a31f(%rip), %rcx     # 0x129958
movl $0xeb, %edx
callq 0x55710
leaq 0x5a241(%rip), %rdi     # 0x12988b
leaq 0x5a069(%rip), %rsi     # 0x1296ba
leaq 0x5a300(%rip), %rcx     # 0x129958
movl $0xec, %edx
callq 0x55710
leaq 0x5a35a(%rip), %rdi     # 0x1299c3
leaq 0x5a04a(%rip), %rsi     # 0x1296ba
leaq 0x5a2e1(%rip), %rcx     # 0x129958
movl $0xed, %edx
callq 0x55710
leaq 0x5a34e(%rip), %rdi     # 0x1299d6
leaq 0x5a02b(%rip), %rsi     # 0x1296ba
leaq 0x5a2c2(%rip), %rcx     # 0x129958
movl $0xee, %edx
callq 0x55710