// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/webp_dec.c
// Function: ParseRIFF
static VP8StatusCode ParseRIFF(const uint8_t** const data,
                               size_t* const data_size, int have_all_data,
                               size_t* const riff_size) {
  assert(data != NULL);
  assert(data_size != NULL);
  assert(riff_size != NULL);

  *riff_size = 0;  // Default: no RIFF present.
  if (*data_size >= RIFF_HEADER_SIZE && !memcmp(*data, "RIFF", TAG_SIZE)) {
    if (memcmp(*data + 8, "WEBP", TAG_SIZE)) {
      return VP8_STATUS_BITSTREAM_ERROR;  // Wrong image file signature.
    } else {
      const uint32_t size = GetLE32(*data + TAG_SIZE);
      // Check that we have at least one chunk (i.e "WEBP" + "VP8?nnnn").
      if (size < TAG_SIZE + CHUNK_HEADER_SIZE) {
        return VP8_STATUS_BITSTREAM_ERROR;
      }
      if (size > MAX_CHUNK_PAYLOAD) {
        return VP8_STATUS_BITSTREAM_ERROR;
      }
      if (have_all_data && (size > *data_size - CHUNK_HEADER_SIZE)) {
        return VP8_STATUS_NOT_ENOUGH_DATA;  // Truncated bitstream.
      }
      // We have a RIFF container. Skip it.
      *riff_size = size;
      *data += RIFF_HEADER_SIZE;
      *data_size -= RIFF_HEADER_SIZE;
    }
  }
  return VP8_STATUS_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x13cb90
jmp 0x13cbaf
leaq 0x7fa1a(%rip), %rdi     # 0x1bc5b1
leaq 0x7f6b5(%rip), %rsi     # 0x1bc253
movl $0x3c, %edx
leaq 0x7f87a(%rip), %rcx     # 0x1bc424
callq 0x598a0
cmpq $0x0, -0x18(%rbp)
je 0x13cbb8
jmp 0x13cbd7
leaq 0x7f8b7(%rip), %rdi     # 0x1bc476
leaq 0x7f68d(%rip), %rsi     # 0x1bc253
movl $0x3d, %edx
leaq 0x7f852(%rip), %rcx     # 0x1bc424
callq 0x598a0
cmpq $0x0, -0x28(%rbp)
je 0x13cbe0
jmp 0x13cbff
leaq 0x7f8a1(%rip), %rdi     # 0x1bc488
leaq 0x7f665(%rip), %rsi     # 0x1bc253
movl $0x3e, %edx
leaq 0x7f82a(%rip), %rcx     # 0x1bc424
callq 0x598a0
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
cmpq $0xc, (%rax)
jb 0x13ccdb
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
subl $0x46464952, %eax       # imm = 0x46464952
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x13ccdb
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movl (%rax), %eax
subl $0x50424557, %eax       # imm = 0x50424557
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x13cc5e
movl $0x3, -0x4(%rbp)
jmp 0x13cce2
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0x4, %rdi
callq 0x13d2f0
movl %eax, -0x2c(%rbp)
cmpl $0xc, -0x2c(%rbp)
jae 0x13cc80
movl $0x3, -0x4(%rbp)
jmp 0x13cce2
cmpl $-0xa, -0x2c(%rbp)
jbe 0x13cc8f
movl $0x3, -0x4(%rbp)
jmp 0x13cce2
cmpl $0x0, -0x1c(%rbp)
je 0x13ccb1
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq $0x8, %rcx
cmpq %rcx, %rax
jbe 0x13ccb1
movl $0x7, -0x4(%rbp)
jmp 0x13cce2
movl -0x2c(%rbp), %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0xc, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
subq $0xc, %rcx
movq %rcx, (%rax)
jmp 0x13ccdb
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)