// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/buffer_dec.c
// Function: WebPAllocateDecBuffer
VP8StatusCode WebPAllocateDecBuffer(int width, int height,
                                    const WebPDecoderOptions* const options,
                                    WebPDecBuffer* const buffer) {
  VP8StatusCode status;
  if (buffer == NULL || width <= 0 || height <= 0) {
    return VP8_STATUS_INVALID_PARAM;
  }
  if (options != NULL) {    // First, apply options if there is any.
    if (options->use_cropping) {
      const int cw = options->crop_width;
      const int ch = options->crop_height;
      const int x = options->crop_left & ~1;
      const int y = options->crop_top & ~1;
      if (!WebPCheckCropDimensions(width, height, x, y, cw, ch)) {
        return VP8_STATUS_INVALID_PARAM;   // out of frame boundary.
      }
      width = cw;
      height = ch;
    }

    if (options->use_scaling) {
#if !defined(WEBP_REDUCE_SIZE)
      int scaled_width = options->scaled_width;
      int scaled_height = options->scaled_height;
      if (!WebPRescalerGetScaledDimensions(
              width, height, &scaled_width, &scaled_height)) {
        return VP8_STATUS_INVALID_PARAM;
      }
      width = scaled_width;
      height = scaled_height;
#else
      return VP8_STATUS_INVALID_PARAM;   // rescaling not supported
#endif
    }
  }
  buffer->width = width;
  buffer->height = height;

  // Then, allocate buffer for real.
  status = AllocateBuffer(buffer);
  if (status != VP8_STATUS_OK) return status;

  // Use the stride trick if vertical flip is needed.
  if (options != NULL && options->flip) {
    status = WebPFlipBuffer(buffer);
  }
  return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x13a8a9
cmpl $0x0, -0x8(%rbp)
jle 0x13a8a9
cmpl $0x0, -0xc(%rbp)
jg 0x13a8b5
movl $0x2, -0x4(%rbp)
jmp 0x13a9cc
cmpq $0x0, -0x18(%rbp)
je 0x13a97b
movq -0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x13a92e
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $-0x2, %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
andl $-0x2, %eax
movl %eax, -0x34(%rbp)
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x30(%rbp), %edx
movl -0x34(%rbp), %ecx
movl -0x28(%rbp), %r8d
movl -0x2c(%rbp), %r9d
callq 0x13c810
cmpl $0x0, %eax
jne 0x13a922
movl $0x2, -0x4(%rbp)
jmp 0x13a9cc
movl -0x28(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x13a979
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
leaq -0x38(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x13d6b0
cmpl $0x0, %eax
jne 0x13a96d
movl $0x2, -0x4(%rbp)
jmp 0x13a9cc
movl -0x38(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x13a97b
movl -0x8(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rdi
callq 0x13a9e0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x13a9a9
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13a9cc
cmpq $0x0, -0x18(%rbp)
je 0x13a9c6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x13a9c6
movq -0x20(%rbp), %rdi
callq 0x13a6f0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)