// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8l_dec.c
// Function: AllocateAndInitRescaler
static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) {
  const int num_channels = 4;
  const int in_width = io->mb_w;
  const int out_width = io->scaled_width;
  const int in_height = io->mb_h;
  const int out_height = io->scaled_height;
  const uint64_t work_size = 2 * num_channels * (uint64_t)out_width;
  rescaler_t* work;        // Rescaler work area.
  const uint64_t scaled_data_size = (uint64_t)out_width;
  uint32_t* scaled_data;  // Temporary storage for scaled BGRA data.
  const uint64_t memory_size = sizeof(*dec->rescaler) +
                               work_size * sizeof(*work) +
                               scaled_data_size * sizeof(*scaled_data);
  uint8_t* memory = (uint8_t*)WebPSafeMalloc(memory_size, sizeof(*memory));
  if (memory == NULL) {
    return VP8LSetError(dec, VP8_STATUS_OUT_OF_MEMORY);
  }
  assert(dec->rescaler_memory == NULL);
  dec->rescaler_memory = memory;

  dec->rescaler = (WebPRescaler*)memory;
  memory += sizeof(*dec->rescaler);
  work = (rescaler_t*)memory;
  memory += work_size * sizeof(*work);
  scaled_data = (uint32_t*)memory;

  if (!WebPRescalerInit(dec->rescaler, in_width, in_height,
                        (uint8_t*)scaled_data, out_width, out_height,
                        0, num_channels, work)) {
    return 0;
  }
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x4, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x8c(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x2c(%rbp)
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
movq %rax, -0x38(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
shlq $0x2, %rax
addq $0x68, %rax
movq -0x48(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0x5b060
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x146c56
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x144bc0
movl %eax, -0x4(%rbp)
jmp 0x146d21
movq -0x10(%rbp), %rax
cmpq $0x0, 0x180(%rax)
jne 0x146c66
jmp 0x146c85
leaq 0x772ea(%rip), %rdi     # 0x1bdf57
leaq 0x76875(%rip), %rsi     # 0x1bd4e9
movl $0x243, %edx            # imm = 0x243
leaq 0x772f4(%rip), %rcx     # 0x1bdf74
callq 0x598a0
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x180(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x188(%rax)
movq -0x60(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
shlq $0x2, %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x188(%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x50(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl -0x2c(%rbp), %r9d
movq -0x40(%rbp), %rax
xorl %r10d, %r10d
movl $0x0, (%rsp)
movl $0x4, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x13d3b0
cmpl $0x0, %eax
jne 0x146d1a
movl $0x0, -0x4(%rbp)
jmp 0x146d21
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)