// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/webp_dec.c
// Function: WebPIoInitFromOptions
int WebPIoInitFromOptions(const WebPDecoderOptions* const options,
                          VP8Io* const io, WEBP_CSP_MODE src_colorspace) {
  const int W = io->width;
  const int H = io->height;
  int x = 0, y = 0, w = W, h = H;

  // Cropping
  io->use_cropping = (options != NULL) && options->use_cropping;
  if (io->use_cropping) {
    w = options->crop_width;
    h = options->crop_height;
    x = options->crop_left;
    y = options->crop_top;
    if (!WebPIsRGBMode(src_colorspace)) {   // only snap for YUV420
      x &= ~1;
      y &= ~1;
    }
    if (!WebPCheckCropDimensions(W, H, x, y, w, h)) {
      return 0;  // out of frame boundary error
    }
  }
  io->crop_left   = x;
  io->crop_top    = y;
  io->crop_right  = x + w;
  io->crop_bottom = y + h;
  io->mb_w = w;
  io->mb_h = h;

  // Scaling
  io->use_scaling = (options != NULL) && options->use_scaling;
  if (io->use_scaling) {
    int scaled_width = options->scaled_width;
    int scaled_height = options->scaled_height;
    if (!WebPRescalerGetScaledDimensions(w, h, &scaled_width, &scaled_height)) {
      return 0;
    }
    io->scaled_width = scaled_width;
    io->scaled_height = scaled_height;
  }

  // Filter
  io->bypass_filtering = (options != NULL) && options->bypass_filtering;

  // Fancy upsampler
#ifdef FANCY_UPSAMPLING
  io->fancy_upsampling = (options == NULL) || (!options->no_fancy_upsampling);
#endif

  if (io->use_scaling) {
    // disable filter (only for large downscaling ratio).
    io->bypass_filtering |= (io->scaled_width < W * 3 / 4) &&
                            (io->scaled_height < H * 3 / 4);
    io->fancy_upsampling = 0;
  }
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x3d(%rbp)
je 0x13c91a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x74(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x74(%rax)
je 0x13c9a6
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x13cb50
cmpl $0x0, %eax
jne 0x13c97a
movl -0x28(%rbp), %eax
andl $-0x2, %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
andl $-0x2, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r8d
movl -0x34(%rbp), %r9d
callq 0x13c810
cmpl $0x0, %eax
jne 0x13c9a4
movl $0x0, -0x4(%rbp)
jmp 0x13cb44
jmp 0x13c9a6
movl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x78(%rax)
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x80(%rax)
movl -0x28(%rbp), %ecx
addl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x7c(%rax)
movl -0x2c(%rbp), %ecx
addl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x84(%rax)
movl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x3e(%rbp)
je 0x13ca08
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
setne %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x88(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x88(%rax)
je 0x13ca79
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x30(%rbp), %edi
movl -0x34(%rbp), %esi
leaq -0x38(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x13d6b0
cmpl $0x0, %eax
jne 0x13ca5f
movl $0x0, -0x4(%rbp)
jmp 0x13cb44
movl -0x38(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8c(%rax)
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x90(%rax)
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x3f(%rbp)
je 0x13ca92
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
setne %al
movb %al, -0x3f(%rbp)
movb -0x3f(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x70(%rax)
movb $0x1, %al
cmpq $0x0, -0x10(%rbp)
movb %al, -0x40(%rbp)
je 0x13cabd
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x40(%rbp)
movb -0x40(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x88(%rax)
je 0x13cb3d
movq -0x18(%rbp), %rax
movl 0x8c(%rax), %ecx
imull $0x3, -0x20(%rbp), %eax
movl $0x4, %esi
cltd
idivl %esi
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x41(%rbp)
jge 0x13cb20
movq -0x18(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x48(%rbp)
imull $0x3, -0x24(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x48(%rbp), %eax
cmpl %ecx, %eax
setl %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
orl 0x70(%rax), %ecx
movl %ecx, 0x70(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x58(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)