// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8_dec.c
// Function: VP8GetInfo
int VP8GetInfo(const uint8_t* data, size_t data_size, size_t chunk_size,
               int* const width, int* const height) {
  if (data == NULL || data_size < VP8_FRAME_HEADER_SIZE) {
    return 0;         // not enough data
  }
  // check signature
  if (!VP8CheckSignature(data + 3, data_size - 3)) {
    return 0;         // Wrong signature.
  } else {
    const uint32_t bits = data[0] | (data[1] << 8) | (data[2] << 16);
    const int key_frame = !(bits & 1);
    const int w = ((data[7] << 8) | data[6]) & 0x3fff;
    const int h = ((data[9] << 8) | data[8]) & 0x3fff;

    if (!key_frame) {   // Not a keyframe.
      return 0;
    }

    if (((bits >> 1) & 7) > 3) {
      return 0;         // unknown profile
    }
    if (!((bits >> 4) & 1)) {
      return 0;         // first frame is invisible!
    }
    if (((bits >> 5)) >= chunk_size) {  // partition_length
      return 0;         // inconsistent size information.
    }
    if (w == 0 || h == 0) {
      return 0;         // We don't support both width and height to be zero.
    }

    if (width) {
      *width = w;
    }
    if (height) {
      *height = h;
    }

    return 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x14268a
cmpq $0xa, -0x18(%rbp)
jae 0x142696
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
movq -0x10(%rbp), %rdi
addq $0x3, %rdi
movq -0x18(%rbp), %rsi
subq $0x3, %rsi
callq 0x5b180
cmpl $0x0, %eax
jne 0x1426bc
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
orl %ecx, %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
orl %ecx, %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x142742
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
movl -0x34(%rbp), %eax
shrl %eax
andl $0x7, %eax
cmpl $0x3, %eax
jbe 0x142758
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
movl -0x34(%rbp), %eax
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x14276f
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
movl -0x34(%rbp), %eax
shrl $0x5, %eax
movl %eax, %eax
cmpq -0x20(%rbp), %rax
jb 0x142786
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
cmpl $0x0, -0x3c(%rbp)
je 0x142792
cmpl $0x0, -0x40(%rbp)
jne 0x14279b
movl $0x0, -0x4(%rbp)
jmp 0x1427c2
cmpq $0x0, -0x28(%rbp)
je 0x1427ab
movl -0x3c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x1427bb
movl -0x40(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)