// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
subl $0x20385056, %eax       # imm = 0x20385056
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
subl $0x4c385056, %eax       # imm = 0x4C385056
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movl $0xc, -0x4c(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x13d16c
jmp 0x13d18b
leaq 0x7f43e(%rip), %rdi     # 0x1bc5b1
leaq 0x7f0d9(%rip), %rsi     # 0x1bc253
movl $0xeb, %edx
leaq 0x7f455(%rip), %rcx     # 0x1bc5db
callq 0x598a0
cmpq $0x0, -0x18(%rbp)
je 0x13d194
jmp 0x13d1b3
leaq 0x7f2db(%rip), %rdi     # 0x1bc476
leaq 0x7f0b1(%rip), %rsi     # 0x1bc253
movl $0xec, %edx
leaq 0x7f42d(%rip), %rcx     # 0x1bc5db
callq 0x598a0
cmpq $0x0, -0x30(%rbp)
je 0x13d1bc
jmp 0x13d1db
leaq 0x7f483(%rip), %rdi     # 0x1bc646
leaq 0x7f089(%rip), %rsi     # 0x1bc253
movl $0xed, %edx
leaq 0x7f405(%rip), %rcx     # 0x1bc5db
callq 0x598a0
cmpq $0x0, -0x38(%rbp)
je 0x13d1e4
jmp 0x13d203
leaq 0x7f46e(%rip), %rdi     # 0x1bc659
leaq 0x7f061(%rip), %rsi     # 0x1bc253
movl $0xee, %edx
leaq 0x7f3dd(%rip), %rcx     # 0x1bc5db
callq 0x598a0
movq -0x18(%rbp), %rax
cmpq $0x8, (%rax)
jae 0x13d219
movl $0x7, -0x4(%rbp)
jmp 0x13d2de
cmpl $0x0, -0x44(%rbp)
jne 0x13d229
cmpl $0x0, -0x48(%rbp)
je 0x13d2b1
movq -0x40(%rbp), %rdi
addq $0x4, %rdi
callq 0x13d2f0
movl %eax, -0x50(%rbp)
cmpq $0xc, -0x28(%rbp)
jb 0x13d25c
movl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
subq $0xc, %rcx
cmpq %rcx, %rax
jbe 0x13d25c
movl $0x3, -0x4(%rbp)
jmp 0x13d2de
cmpl $0x0, -0x1c(%rbp)
je 0x13d27e
movl -0x50(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq $0x8, %rcx
cmpq %rcx, %rax
jbe 0x13d27e
movl $0x7, -0x4(%rbp)
jmp 0x13d2de
movl -0x50(%rbp), %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x8, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
subq $0x8, %rcx
movq %rcx, (%rax)
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
jmp 0x13d2d7
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x5cd90
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)