// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %r13
movq (%r13), %rax
movl (%rax), %r12d
cmpl $0xc, %r12d
ja 0xd0494
movl $0x103a, %eax           # imm = 0x103A
btl %r12d, %eax
jae 0xd0494
leaq 0x50(%r13), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r13)
movups %xmm0, 0x50(%r13)
movl $0xb, %edx
xorl %r15d, %r15d
movq 0x28(%r13), %rdi
movq %rbx, %rsi
callq 0xce305
xorl %edx, %edx
testl %eax, %eax
je 0xd09a8
leal -0xb(%r12), %eax
cmpl $-0x4, %eax
setb %al
orb %r15b, %al
jne 0xd0426
callq 0xdbf39
cmpl $0x0, 0x88(%rbx)
je 0xd045b
movq (%r13), %rdx
movl (%rdx), %eax
leal -0x1(%rax), %ecx
cmpl $0xa, %r12d
movq %rbp, 0x10(%rsp)
jbe 0xd0475
cmpl $0xc, %ecx
movq %rdx, 0x28(%rsp)
jae 0xd04bf
movl $0x81d, %edx            # imm = 0x81D
btl %ecx, %edx
jae 0xd04bf
xorl %ecx, %ecx
jmp 0xd04c8
cmpl $0xa, %r12d
jbe 0xd0911
leaq 0x7e0(%rip), %rax       # 0xd0c4c
movq %rax, 0x58(%r13)
jmp 0xd097d
cmpl $0xc, %ecx
jae 0xd06e7
movl $0x81d, %edx            # imm = 0x81D
btl %ecx, %edx
jae 0xd06e7
xorl %r12d, %r12d
jmp 0xd06f1
leal -0xb(%r12), %eax
xorl %r15d, %r15d
cmpl $-0x4, %eax
setb %r15b
leaq 0x50(%r13), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r13)
movups %xmm0, 0x50(%r13)
movl %r15d, %edx
addl $0xb, %edx
jmp 0xd03fb
addl $-0xb, %eax
cmpl $-0x4, %eax
setb %cl
movl %ecx, 0x20(%rsp)
movslq 0x8c(%rbx), %r14
movl 0x90(%rbx), %eax
movq %rax, 0x30(%rsp)
leaq 0x1(%r14), %rax
movl 0xc(%rbx), %edx
movl %edx, 0x1c(%rsp)
movl 0x10(%rbx), %edx
movl %edx, 0x3c(%rsp)
leaq (%r14,%r14), %rsi
movq %rax, 0x8(%rsp)
andq $-0x2, %rax
movq %rax, 0x40(%rsp)
movq %rsi, 0x50(%rsp)
leaq (%rsi,%rax,2), %r15
leaq (,%r14,8), %rax
testb %cl, %cl
movl $0x0, %ebp
cmoveq %rax, %rbp
leaq 0x157(%rbp,%r15,4), %rax
leaq 0x1bf(%rbp,%r15,4), %rsi
cmovneq %rax, %rsi
movl $0x1, %edi
callq 0x56b20
xorl %edx, %edx
movq %rax, %r12
movq 0x10(%rsp), %rax
movq %r12, (%rax)
testq %r12, %r12
je 0xd09a8
leaq (,%r15,4), %rax
addq %rbp, %rax
leaq (%r12,%rax), %rdi
addq $0x1f, %rdi
andq $-0x20, %rdi
movq %rdi, 0x30(%r13)
leaq 0x68(%rdi), %rax
movq %rax, 0x38(%r13)
leaq 0xd0(%rdi), %rax
movq %rax, 0x40(%r13)
leaq 0x138(%rdi), %rax
movl 0x20(%rsp), %ecx
testb %cl, %cl
movl $0x0, %ecx
cmoveq %rax, %rcx
movq %rcx, 0x48(%r13)
movl 0xc(%rbx), %esi
movl 0x10(%rbx), %edx
movq 0x28(%rsp), %r15
movq 0x10(%r15), %rcx
movl 0x30(%r15), %eax
subq $0x8, %rsp
movl %r14d, %r8d
movq 0x38(%rsp), %rbp
movl %ebp, %r9d
pushq %r12
pushq $0x1
pushq %rax
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
movq %r14, 0x48(%rsp)
movq 0x8(%rsp), %r8
sarl %r8d
leal 0x1(%rbp), %r9d
sarl %r9d
movl 0x1c(%rsp), %r14d
incl %r14d
sarl %r14d
movl 0x3c(%rsp), %ebp
incl %ebp
sarl %ebp
movq 0x38(%r13), %rdi
movq 0x18(%r15), %rcx
movl 0x34(%r15), %eax
movq 0x50(%rsp), %rdx
leaq (%r12,%rdx,4), %r12
subq $0x8, %rsp
movl %r14d, %esi
movl %ebp, %edx
movq %r8, 0x10(%rsp)
movl %r9d, 0x18(%rsp)
pushq %r12
pushq $0x1
pushq %rax
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
movq 0x40(%r13), %rdi
movq 0x20(%r15), %rcx
movl 0x38(%r15), %eax
movq 0x40(%rsp), %rdx
leaq (%r12,%rdx,4), %r10
subq $0x8, %rsp
movl %r14d, %esi
movl %ebp, %edx
movq 0x10(%rsp), %r8
movl 0x18(%rsp), %r9d
pushq %r10
pushq $0x1
pushq %rax
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
leaq 0xea0(%rip), %rax       # 0xd151c
movq %rax, 0x58(%r13)
movl $0x1, %edx
cmpb $0x0, 0x20(%rsp)
movq 0x48(%rsp), %r8
movq 0x30(%rsp), %r9
jne 0xd09a8
movq 0x40(%rsp), %r10
addq %r10, %r10
movq 0x48(%r13), %rdi
movl 0xc(%rbx), %esi
movl 0x10(%rbx), %edx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rcx
movl 0x3c(%rax), %eax
leaq (%r12,%r10,4), %r10
subq $0x8, %rsp
pushq %r10
pushq $0x1
pushq %rax
callq 0xce768
addq $0x20, %rsp
movl $0x0, %edx
testl %eax, %eax
je 0xd09a8
leaq 0xef6(%rip), %rax       # 0xd15d8
jmp 0xd099a
addl $-0xb, %eax
cmpl $-0x4, %eax
setb %r12b
movslq 0x8c(%rbx), %r14
movl 0x90(%rbx), %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rbx), %eax
movl %eax, 0x20(%rsp)
movl 0x10(%rbx), %eax
movl %eax, 0x30(%rsp)
leaq (%r14,%r14), %r15
movzbl %r12b, %eax
movl $0x4, %ecx
subq %rax, %rcx
movq %r15, 0x28(%rsp)
imulq %rcx, %r15
imulq $0x68, %rcx, %rax
imulq %r14, %rcx
leaq (%rcx,%r15,4), %rbp
leaq (%rax,%rbp), %rsi
addq $0x1f, %rsi
movl $0x1, %edi
callq 0x56b20
movq %rax, %r10
movq 0x10(%rsp), %rax
movq %r10, (%rax)
testq %r10, %r10
movl $0x0, %edx
je 0xd09a8
leaq (%r10,%r15,4), %rcx
leaq (%r10,%rbp), %rdi
addq $0x1f, %rdi
andq $-0x20, %rdi
movq %rdi, 0x30(%r13)
leaq 0x68(%rdi), %rax
movq %rax, 0x38(%r13)
leaq 0x138(%rdi), %rax
movl %r12d, 0x1c(%rsp)
testb %r12b, %r12b
movl $0x0, %edx
cmoveq %rax, %rdx
leaq 0xd0(%rdi), %rax
movq %rax, 0x40(%r13)
movq %rdx, 0x48(%r13)
movl 0xc(%rbx), %esi
movl 0x10(%rbx), %edx
subq $0x8, %rsp
movq %rcx, %r12
movl %r14d, %r8d
movl 0x10(%rsp), %ebp
movl %ebp, %r9d
pushq %r10
pushq $0x1
pushq $0x0
movq %r10, 0x30(%rsp)
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
movq %r14, %r15
movl %ebp, %r9d
movl 0x20(%rsp), %r14d
incl %r14d
sarl %r14d
movl 0x30(%rsp), %ebp
incl %ebp
sarl %ebp
movq 0x38(%r13), %rdi
leaq (%r12,%r15), %rcx
movq 0x28(%rsp), %rax
movq 0x10(%rsp), %rdx
leaq (%rdx,%rax,4), %rax
subq $0x8, %rsp
movl %r14d, %esi
movl %ebp, %edx
movl %r15d, %r8d
pushq %rax
pushq $0x1
pushq $0x0
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
movq 0x40(%r13), %rdi
movq %r12, 0x20(%rsp)
leaq (%r12,%r15,2), %rcx
movq %r15, %rax
shlq $0x4, %rax
movl %r14d, %esi
movq 0x10(%rsp), %rdx
movq %rdx, %r14
addq %rdx, %rax
subq $0x8, %rsp
movl %ebp, %edx
movl %r15d, %r8d
movl 0x10(%rsp), %r9d
pushq %rax
pushq $0x1
pushq $0x0
callq 0xce768
addq $0x20, %rsp
testl %eax, %eax
je 0xd090a
leaq 0x74d(%rip), %rax       # 0xd0fc1
movq %rax, 0x58(%r13)
callq 0xdc8f1
movl $0x1, %edx
cmpb $0x0, 0x1c(%rsp)
movl 0x8(%rsp), %r9d
jne 0xd09a8
movq 0x48(%r13), %rdi
movl 0xc(%rbx), %esi
movl 0x10(%rbx), %edx
leal (%r15,%r15,2), %eax
cltq
movq 0x20(%rsp), %rcx
addq %rax, %rcx
leaq (%r15,%r15,2), %rax
leaq (%r14,%rax,8), %rax
subq $0x8, %rsp
movl %r15d, %r8d
pushq %rax
pushq $0x1
pushq $0x0
callq 0xce768
addq $0x20, %rsp
movl $0x0, %edx
testl %eax, %eax
je 0xd09a8
leaq 0x91e(%rip), %rax       # 0xd11f9
movq %rax, 0x60(%r13)
movq (%r13), %rax
movl (%rax), %eax
cmpl $0xa, %eax
leaq 0x978(%rip), %rcx       # 0xd1267
leaq 0xac0(%rip), %rdx       # 0xd13b6
cmoveq %rcx, %rdx
cmpl $0x5, %eax
cmoveq %rcx, %rdx
movq %rdx, 0x68(%r13)
jmp 0xd099e
xorl %edx, %edx
jmp 0xd09a8
callq 0xe0612
leaq 0xd2(%rip), %rax        # 0xd09ef
movq %rax, 0x58(%r13)
cmpl $0x0, 0x58(%rbx)
je 0xd097d
movslq 0xc(%rbx), %rax
leaq 0x1(%rax), %r14
movq %r14, %rsi
andq $-0x2, %rsi
addq %rax, %rsi
movl $0x1, %edi
callq 0x56b20
movq %rax, (%rbp)
testq %rax, %rax
movl $0x0, %edx
je 0xd09a8
sarl %r14d
movq %rax, 0x8(%r13)
movslq 0xc(%rbx), %rcx
addq %rax, %rcx
movq %rcx, 0x10(%r13)
movslq %r14d, %rax
addq %rcx, %rax
movq %rax, 0x18(%r13)
leaq 0xd6(%rip), %rax        # 0xd0a4a
movq %rax, 0x58(%r13)
callq 0xdbf39
movl $0x1, %edx
testb %r15b, %r15b
jne 0xd09a8
cmpl $0xa, %r12d
je 0xd0993
cmpl $0x5, %r12d
jne 0xd09b9
leaq 0x36a(%rip), %rax       # 0xd0d04
movq %rax, 0x60(%r13)
callq 0xd6da2
movl $0x1, %edx
movl %edx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x543(%rip), %rax       # 0xd0f03
leaq 0x445(%rip), %rcx       # 0xd0e0c
cmpl $0xb, %r12d
cmovaeq %rax, %rcx
movq %rcx, 0x60(%r13)
jb 0xd099e
jmp 0xd09a8