// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl $0x1, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %edi
callq 0x13b4b0
cmpl $0x0, %eax
jne 0x13b099
movl $0x0, -0xc(%rbp)
jmp 0x13b352
movl -0x10(%rbp), %edi
callq 0x13a860
cmpl $0x0, %eax
jne 0x13b2aa
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x38(%rbp)
movslq -0x2c(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movslq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movslq -0x34(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movslq -0x38(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x30(%rcx), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x38(%rcx), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x40(%rcx), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
cmpl $0xc, -0x10(%rbp)
jne 0x13b2a5
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x48(%rcx), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x13b350
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x64(%rbp)
movslq -0x64(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl -0x10(%rbp), %edx
movl %edx, %esi
leaq 0x80f4e(%rip), %rdx     # 0x1bc236
movzbl (%rdx,%rsi), %edx
imulq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq 0x10(%rcx), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x64(%rbp), %eax
movl -0x14(%rbp), %ecx
movl -0x10(%rbp), %edx
movl %edx, %esi
leaq 0x80f13(%rip), %rdx     # 0x1bc236
movzbl (%rdx,%rsi), %edx
imull %edx, %ecx
cmpl %ecx, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
andl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x13b352
movl -0xc(%rbp), %edx
movl $0x2, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)