// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/rescaler.c
// Function: WebPRescalerExportRowShrink_C
void WebPRescalerExportRowShrink_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;
  const uint32_t yscale = wrk->fy_scale * (-wrk->y_accum);
  assert(!WebPRescalerOutputDone(wrk));
  assert(wrk->y_accum <= 0);
  assert(!wrk->y_expand);
  if (yscale) {
    for (x_out = 0; x_out < x_out_max; ++x_out) {
      const uint32_t frac = (uint32_t)MULT_FIX_FLOOR(frow[x_out], yscale);
      const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale);
      dst[x_out] = (v > 255) ? 255u : (uint8_t)v;
      irow[x_out] = frac;   // new fractional start
    }
  } else {
    for (x_out = 0; x_out < x_out_max; ++x_out) {
      const int v = (int)MULT_FIX(irow[x_out], wrk->fxy_scale);
      dst[x_out] = (v > 255) ? 255u : (uint8_t)v;
      irow[x_out] = 0;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %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), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rdx
xorl %ecx, %ecx
subl 0x18(%rdx), %ecx
imull %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
callq 0x150ef0
cmpl $0x0, %eax
jne 0x150f78
jmp 0x150f97
leaq 0x6efcc(%rip), %rdi     # 0x1bff4b
leaq 0x6eed2(%rip), %rsi     # 0x1bfe58
movl $0x87, %edx
leaq 0x6f030(%rip), %rcx     # 0x1bffc2
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jg 0x150fa3
jmp 0x150fc2
leaq 0x6eff6(%rip), %rdi     # 0x1bffa0
leaq 0x6eea7(%rip), %rsi     # 0x1bfe58
movl $0x88, %edx
leaq 0x6f005(%rip), %rcx     # 0x1bffc2
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x150fce
jmp 0x150fed
leaq 0x6f025(%rip), %rdi     # 0x1bfffa
leaq 0x6ee7c(%rip), %rsi     # 0x1bfe58
movl $0x89, %edx
leaq 0x6efda(%rip), %rcx     # 0x1bffc2
callq 0x598a0
cmpl $0x0, -0x34(%rbp)
je 0x15109f
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x15109a
movq -0x30(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x34(%rbp), %ecx
imulq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x38(%rbp), %eax
movl %eax, %eax
movq -0x8(%rbp), %rcx
movl 0x14(%rcx), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x3c(%rbp)
cmpl $0xff, -0x3c(%rbp)
jle 0x151065
movl $0xff, %eax
movl %eax, -0x44(%rbp)
jmp 0x15106e
movl -0x3c(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x38(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x150ffe
jmp 0x151120
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x15111e
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movl 0x14(%rcx), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x40(%rbp)
cmpl $0xff, -0x40(%rbp)
jle 0x1510eb
movl $0xff, %eax
movl %eax, -0x48(%rbp)
jmp 0x1510f4
movl -0x40(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1510a6
jmp 0x151120
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)