// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dec/buffer_dec.c
// Function: CheckDecBuffer
static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
  int ok = 1;
  const WEBP_CSP_MODE mode = buffer->colorspace;
  const int width = buffer->width;
  const int height = buffer->height;
  if (!IsValidColorspace(mode)) {
    ok = 0;
  } else if (!WebPIsRGBMode(mode)) {   // YUV checks
    const WebPYUVABuffer* const buf = &buffer->u.YUVA;
    const int uv_width  = (width  + 1) / 2;
    const int uv_height = (height + 1) / 2;
    const int y_stride = abs(buf->y_stride);
    const int u_stride = abs(buf->u_stride);
    const int v_stride = abs(buf->v_stride);
    const int a_stride = abs(buf->a_stride);
    const uint64_t y_size = MIN_BUFFER_SIZE(width, height, y_stride);
    const uint64_t u_size = MIN_BUFFER_SIZE(uv_width, uv_height, u_stride);
    const uint64_t v_size = MIN_BUFFER_SIZE(uv_width, uv_height, v_stride);
    const uint64_t a_size = MIN_BUFFER_SIZE(width, height, a_stride);
    ok &= (y_size <= buf->y_size);
    ok &= (u_size <= buf->u_size);
    ok &= (v_size <= buf->v_size);
    ok &= (y_stride >= width);
    ok &= (u_stride >= uv_width);
    ok &= (v_stride >= uv_width);
    ok &= (buf->y != NULL);
    ok &= (buf->u != NULL);
    ok &= (buf->v != NULL);
    if (mode == MODE_YUVA) {
      ok &= (a_stride >= width);
      ok &= (a_size <= buf->a_size);
      ok &= (buf->a != NULL);
    }
  } else {    // RGB checks
    const WebPRGBABuffer* const buf = &buffer->u.RGBA;
    const int stride = abs(buf->stride);
    const uint64_t size =
        MIN_BUFFER_SIZE((uint64_t)width * kModeBpp[mode], height, stride);
    ok &= (size <= buf->size);
    ok &= (stride >= width * kModeBpp[mode]);
    ok &= (buf->rgba != NULL);
  }
  return ok ? VP8_STATUS_OK : VP8_STATUS_INVALID_PARAM;
}

// Assembly:
movl (%rdi), %r10d
movl $0x2, %ecx
cmpq $0xc, %r10
ja 0xc68dc
movslq 0x4(%rdi), %r8
movslq 0x8(%rdi), %r9
cmpl $0xb, %r10d
jb 0xc6892
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
leal 0x1(%r8), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %esi
leal 0x1(%r9), %eax
cltd
idivl %ecx
movl 0x30(%rdi), %edx
movl 0x34(%rdi), %ebx
movl %edx, %r11d
negl %r11d
cmovsl %edx, %r11d
movl %ebx, %edx
negl %edx
cmovsl %ebx, %edx
movl 0x38(%rdi), %ebp
movl %ebp, %ebx
negl %ebx
cmovsl %ebp, %ebx
decq %r9
movq %r11, %r14
imulq %r9, %r14
addq %r8, %r14
decl %eax
cltq
movq %rdx, %r15
imulq %rax, %r15
movslq %esi, %rsi
addq %rsi, %r15
imulq %rbx, %rax
addq %rsi, %rax
cmpq 0x40(%rdi), %r14
setbe %bpl
cmpq 0x48(%rdi), %r15
setbe %r14b
andb %bpl, %r14b
cmpq 0x50(%rdi), %rax
setbe %al
cmpl %r8d, %r11d
setge %r11b
andb %al, %r11b
andb %r14b, %r11b
cmpl %esi, %edx
setge %al
cmpl %esi, %ebx
setge %dl
andb %al, %dl
cmpq $0x0, 0x10(%rdi)
setne %al
andb %dl, %al
cmpq $0x0, 0x18(%rdi)
setne %dl
andb %al, %dl
cmpq $0x0, 0x20(%rdi)
setne %al
andb %dl, %al
andb %r11b, %al
cmpl $0xc, %r10d
popq %rbx
popq %r14
popq %r15
popq %rbp
jne 0xc688c
movl 0x3c(%rdi), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
imulq %rsi, %r9
addq %r8, %r9
cmpl %r8d, %esi
setge %dl
cmpq 0x58(%rdi), %r9
setbe %sil
cmpq $0x0, 0x28(%rdi)
setne %dil
andb %dl, %dil
andb %sil, %dil
andb %dil, %al
testb $0x1, %al
jne 0xc68da
jmp 0xc68dc
movl 0x18(%rdi), %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
decl %r9d
movslq %r9d, %rax
imulq %rdx, %rax
leaq 0x51e90(%rip), %rsi     # 0x11873d
movzbl (%r10,%rsi), %esi
movq %r8, %r9
imulq %rsi, %r9
addq %rax, %r9
cmpq 0x20(%rdi), %r9
setbe %al
imull %r8d, %esi
cmpl %esi, %edx
setge %dl
andb %al, %dl
cmpq $0x0, 0x10(%rdi)
setne %al
testb %dl, %al
je 0xc68dc
xorl %ecx, %ecx
movl %ecx, %eax
retq