// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/rescaler.c
// Function: WebPRescalerExportRowExpand_C
void WebPRescalerExportRowExpand_C(WebPRescaler* const wrk) {
  int x_out;
  uint8_t* const dst = wrk->dst;
  rescaler_t* const irow = wrk->irow;
  const int x_out_max = wrk->dst_width * wrk->num_channels;
  const rescaler_t* const frow = wrk->frow;
  assert(!WebPRescalerOutputDone(wrk));
  assert(wrk->y_accum <= 0);
  assert(wrk->y_expand);
  assert(wrk->y_sub != 0);
  if (wrk->y_accum == 0) {
    for (x_out = 0; x_out < x_out_max; ++x_out) {
      const uint32_t J = frow[x_out];
      const int v = (int)MULT_FIX(J, wrk->fy_scale);
      dst[x_out] = (v > 255) ? 255u : (uint8_t)v;
    }
  } else {
    const uint32_t B = WEBP_RESCALER_FRAC(-wrk->y_accum, wrk->y_sub);
    const uint32_t A = (uint32_t)(WEBP_RESCALER_ONE - B);
    for (x_out = 0; x_out < x_out_max; ++x_out) {
      const uint64_t I = (uint64_t)A * frow[x_out]
                       + (uint64_t)B * irow[x_out];
      const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX);
      const int v = (int)MULT_FIX(J, wrk->fy_scale);
      dst[x_out] = (v > 255) ? 255u : (uint8_t)v;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x150ef0
cmpl $0x0, %eax
jne 0x150cd2
jmp 0x150cf1
leaq 0x6f272(%rip), %rdi     # 0x1bff4b
leaq 0x6f178(%rip), %rsi     # 0x1bfe58
movl $0x69, %edx
leaq 0x6f27c(%rip), %rcx     # 0x1bff68
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jg 0x150cfd
jmp 0x150d1c
leaq 0x6f29c(%rip), %rdi     # 0x1bffa0
leaq 0x6f14d(%rip), %rsi     # 0x1bfe58
movl $0x6a, %edx
leaq 0x6f251(%rip), %rcx     # 0x1bff68
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x150d28
jmp 0x150d47
leaq 0x6f2cc(%rip), %rdi     # 0x1bfffb
leaq 0x6f122(%rip), %rsi     # 0x1bfe58
movl $0x6b, %edx
leaq 0x6f226(%rip), %rcx     # 0x1bff68
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x150d53
jmp 0x150d72
leaq 0x6f258(%rip), %rdi     # 0x1bffb2
leaq 0x6f0f7(%rip), %rsi     # 0x1bfe58
movl $0x6c, %edx
leaq 0x6f1fb(%rip), %rcx     # 0x1bff68
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x150df7
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x150df2
movq -0x30(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x38(%rbp)
cmpl $0xff, -0x38(%rbp)
jle 0x150dce
movl $0xff, %eax
movl %eax, -0x54(%rbp)
jmp 0x150dd7
movl -0x38(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x150d83
jmp 0x150edc
movq -0x8(%rbp), %rcx
xorl %eax, %eax
subl 0x18(%rcx), %eax
cltq
shlq $0x20, %rax
movq -0x8(%rbp), %rcx
movslq 0x20(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, %ecx
movabsq $0x100000000, %rax      # imm = 0x100000000
subq %rcx, %rax
movl %eax, -0x40(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x150eda
movl -0x40(%rbp), %eax
movq -0x30(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
imulq %rcx, %rax
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rdx
movslq -0xc(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
imulq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movabsq $0x80000000, %rax       # imm = 0x80000000
addq -0x48(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x50(%rbp)
cmpl $0xff, -0x50(%rbp)
jle 0x150eb3
movl $0xff, %eax
movl %eax, -0x58(%rbp)
jmp 0x150ebc
movl -0x50(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x150e32
jmp 0x150edc
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)