// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/io_dec.c
// Function: CustomSetup
static int CustomSetup(VP8Io* io) {
  WebPDecParams* const p = (WebPDecParams*)io->opaque;
  const WEBP_CSP_MODE colorspace = p->output->colorspace;
  const int is_rgb = WebPIsRGBMode(colorspace);
  const int is_alpha = WebPIsAlphaMode(colorspace);

  p->memory = NULL;
  p->emit = NULL;
  p->emit_alpha = NULL;
  p->emit_alpha_row = NULL;
  if (!WebPIoInitFromOptions(p->options, io, is_alpha ? MODE_YUV : MODE_YUVA)) {
    return 0;
  }
  if (is_alpha && WebPIsPremultipliedMode(colorspace)) {
    WebPInitUpsamplers();
  }
  if (io->use_scaling) {
#if !defined(WEBP_REDUCE_SIZE)
    const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p);
    if (!ok) {
      return 0;    // memory error
    }
#else
    return 0;   // rescaling support not compiled
#endif
  } else {
    if (is_rgb) {
      WebPInitSamplers();
      p->emit = EmitSampledRGB;   // default
      if (io->fancy_upsampling) {
#ifdef FANCY_UPSAMPLING
        const int uv_width = (io->mb_w + 1) >> 1;
        p->memory = WebPSafeMalloc(1ULL, (size_t)(io->mb_w + 2 * uv_width));
        if (p->memory == NULL) {
          return 0;   // memory error.
        }
        p->tmp_y = (uint8_t*)p->memory;
        p->tmp_u = p->tmp_y + io->mb_w;
        p->tmp_v = p->tmp_u + uv_width;
        p->emit = EmitFancyRGB;
        WebPInitUpsamplers();
#endif
      }
    } else {
      p->emit = EmitYUV;
    }
    if (is_alpha) {  // need transparency output
      p->emit_alpha =
          (colorspace == MODE_RGBA_4444 || colorspace == MODE_rgbA_4444) ?
              EmitAlphaRGBA4444
          : is_rgb ? EmitAlphaRGB
          : EmitAlphaYUV;
      if (is_rgb) {
        WebPInitAlphaProcessing();
      }
    }
  }

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x1405b0
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edi
callq 0x1405d0
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl $0xc, %edx
movl $0xb, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
callq 0x13c8c0
cmpl $0x0, %eax
jne 0x1403bf
movl $0x0, -0x4(%rbp)
jmp 0x140565
cmpl $0x0, -0x24(%rbp)
je 0x1403d7
movl -0x1c(%rbp), %edi
callq 0x140640
cmpl $0x0, %eax
je 0x1403d7
callq 0x1514d0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x88(%rax)
je 0x140429
cmpl $0x0, -0x20(%rbp)
je 0x1403fc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x140680
movl %eax, -0x30(%rbp)
jmp 0x14040c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x140a30
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x140424
movl $0x0, -0x4(%rbp)
jmp 0x140565
jmp 0x14055e
cmpl $0x0, -0x20(%rbp)
je 0x1404f9
callq 0x153aa0
movq -0x18(%rbp), %rax
leaq 0x96d(%rip), %rcx       # 0x140db0
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x58(%rax)
je 0x1404f7
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
sarl %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl -0x2c(%rbp), %ecx
shll %ecx
addl %ecx, %eax
movslq %eax, %rsi
movl $0x1, %edi
callq 0x5b060
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x1404a1
movl $0x0, -0x4(%rbp)
jmp 0x140565
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x2c(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
leaq 0x992(%rip), %rcx       # 0x140e80
movq %rcx, 0x58(%rax)
callq 0x1514d0
jmp 0x140508
movq -0x18(%rbp), %rax
leaq 0xcac(%rip), %rcx       # 0x1411b0
movq %rcx, 0x58(%rax)
cmpl $0x0, -0x24(%rbp)
je 0x14055c
cmpl $0x5, -0x1c(%rbp)
je 0x14051a
cmpl $0xa, -0x1c(%rbp)
jne 0x140527
leaq 0xddf(%rip), %rax       # 0x141300
movq %rax, -0x38(%rbp)
jmp 0x140543
movl -0x20(%rbp), %edx
leaq 0x10df(%rip), %rax      # 0x141610
leaq 0xf78(%rip), %rcx       # 0x1414b0
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
cmpl $0x0, -0x20(%rbp)
je 0x14055a
callq 0x1493b0
jmp 0x14055c
jmp 0x14055e
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop