// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/rescaler_sse2.c
// Function: RescalerExportRowShrink_SSE2
static void RescalerExportRowShrink_SSE2(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) {
    const int scale_xy = wrk->fxy_scale;
    const __m128i mult_xy = _mm_set_epi32(0, scale_xy, 0, scale_xy);
    const __m128i mult_y = _mm_set_epi32(0, yscale, 0, yscale);
    for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) {
      __m128i A0, A1, A2, A3, B0, B1, B2, B3;
      LoadDispatchAndMult_SSE2(irow + x_out, NULL, &A0, &A1, &A2, &A3);
      LoadDispatchAndMult_SSE2(frow + x_out, &mult_y, &B0, &B1, &B2, &B3);
      {
        const __m128i D0 = _mm_srli_epi64(B0, WEBP_RESCALER_RFIX);   // = frac
        const __m128i D1 = _mm_srli_epi64(B1, WEBP_RESCALER_RFIX);
        const __m128i D2 = _mm_srli_epi64(B2, WEBP_RESCALER_RFIX);
        const __m128i D3 = _mm_srli_epi64(B3, WEBP_RESCALER_RFIX);
        const __m128i E0 = _mm_sub_epi64(A0, D0);   // irow[x] - frac
        const __m128i E1 = _mm_sub_epi64(A1, D1);
        const __m128i E2 = _mm_sub_epi64(A2, D2);
        const __m128i E3 = _mm_sub_epi64(A3, D3);
        const __m128i F2 = _mm_slli_epi64(D2, 32);
        const __m128i F3 = _mm_slli_epi64(D3, 32);
        const __m128i G0 = _mm_or_si128(D0, F2);
        const __m128i G1 = _mm_or_si128(D1, F3);
        _mm_storeu_si128((__m128i*)(irow + x_out + 0), G0);
        _mm_storeu_si128((__m128i*)(irow + x_out + 4), G1);
        ProcessRow_SSE2(&E0, &E1, &E2, &E3, &mult_xy, dst + x_out);
      }
    }
    for (; x_out < x_out_max; ++x_out) {
      const uint32_t frac = (int)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 {
    const uint32_t scale = wrk->fxy_scale;
    const __m128i mult = _mm_set_epi32(0, scale, 0, scale);
    const __m128i zero = _mm_setzero_si128();
    for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) {
      __m128i A0, A1, A2, A3;
      LoadDispatchAndMult_SSE2(irow + x_out, NULL, &A0, &A1, &A2, &A3);
      _mm_storeu_si128((__m128i*)(irow + x_out + 0), zero);
      _mm_storeu_si128((__m128i*)(irow + x_out + 4), zero);
      ProcessRow_SSE2(&A0, &A1, &A2, &A3, &mult, dst + x_out);
    }
    for (; x_out < x_out_max; ++x_out) {
      const int v = (int)MULT_FIX(irow[x_out], scale);
      dst[x_out] = (v > 255) ? 255u : (uint8_t)v;
      irow[x_out] = 0;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x288(%rbp)
movq -0x278(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x290(%rbp)
movq -0x278(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x278(%rbp), %rcx
imull 0x8(%rcx), %eax
movl %eax, -0x294(%rbp)
movq -0x278(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x2a0(%rbp)
movq -0x278(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x278(%rbp), %rdx
xorl %ecx, %ecx
subl 0x18(%rdx), %ecx
imull %ecx, %eax
movl %eax, -0x2a4(%rbp)
movq -0x278(%rbp), %rdi
callq 0x16e280
cmpl $0x0, %eax
jne 0x16d825
jmp 0x16d844
leaq 0x5271f(%rip), %rdi     # 0x1bff4b
leaq 0x5338d(%rip), %rsi     # 0x1c0bc0
movl $0x125, %edx            # imm = 0x125
leaq 0x53494(%rip), %rcx     # 0x1c0cd3
callq 0x598a0
movq -0x278(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jg 0x16d853
jmp 0x16d872
leaq 0x52746(%rip), %rdi     # 0x1bffa0
leaq 0x5335f(%rip), %rsi     # 0x1c0bc0
movl $0x126, %edx            # imm = 0x126
leaq 0x53466(%rip), %rcx     # 0x1c0cd3
callq 0x598a0
movq -0x278(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x16d881
jmp 0x16d8a0
leaq 0x52772(%rip), %rdi     # 0x1bfffa
leaq 0x53331(%rip), %rsi     # 0x1c0bc0
movl $0x127, %edx            # imm = 0x127
leaq 0x53438(%rip), %rcx     # 0x1c0cd3
callq 0x598a0
cmpl $0x0, -0x2a4(%rbp)
je 0x16de4b
movq -0x278(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x2a8(%rbp)
movl -0x2a8(%rbp), %eax
movl $0x0, -0x178(%rbp)
movl %eax, -0x17c(%rbp)
movl $0x0, -0x180(%rbp)
movl %eax, -0x184(%rbp)
movd -0x178(%rbp), %xmm0
movd -0x17c(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x180(%rbp), %xmm2
movd -0x184(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x1a0(%rbp)
movaps -0x1a0(%rbp), %xmm0
movaps %xmm0, -0x2c0(%rbp)
movl -0x2a4(%rbp), %eax
movl $0x0, -0x1a4(%rbp)
movl %eax, -0x1a8(%rbp)
movl $0x0, -0x1ac(%rbp)
movl %eax, -0x1b0(%rbp)
movd -0x1a4(%rbp), %xmm0
movd -0x1a8(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x1ac(%rbp), %xmm2
movd -0x1b0(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, -0x1c0(%rbp)
movdqa -0x1c0(%rbp), %xmm0
movdqa %xmm0, -0x2d0(%rbp)
movl $0x0, -0x27c(%rbp)
movl -0x27c(%rbp), %eax
addl $0x8, %eax
cmpl -0x294(%rbp), %eax
jg 0x16dd63
movq -0x290(%rbp), %rdi
movslq -0x27c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x2e0(%rbp), %rdx
leaq -0x2f0(%rbp), %rcx
leaq -0x300(%rbp), %r8
leaq -0x310(%rbp), %r9
callq 0x16e2a0
movq -0x2a0(%rbp), %rdi
movslq -0x27c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
leaq -0x2d0(%rbp), %rsi
leaq -0x320(%rbp), %rdx
leaq -0x330(%rbp), %rcx
leaq -0x340(%rbp), %r8
leaq -0x350(%rbp), %r9
callq 0x16e2a0
movdqa -0x320(%rbp), %xmm0
movdqa %xmm0, -0x110(%rbp)
movl $0x20, -0x114(%rbp)
movdqa -0x110(%rbp), %xmm0
movl -0x114(%rbp), %eax
movd %eax, %xmm1
psrlq %xmm1, %xmm0
movdqa %xmm0, -0x360(%rbp)
movdqa -0x330(%rbp), %xmm0
movdqa %xmm0, -0x130(%rbp)
movl $0x20, -0x134(%rbp)
movdqa -0x130(%rbp), %xmm0
movl -0x134(%rbp), %eax
movd %eax, %xmm1
psrlq %xmm1, %xmm0
movdqa %xmm0, -0x370(%rbp)
movdqa -0x340(%rbp), %xmm0
movdqa %xmm0, -0x150(%rbp)
movl $0x20, -0x154(%rbp)
movdqa -0x150(%rbp), %xmm0
movl -0x154(%rbp), %eax
movd %eax, %xmm1
psrlq %xmm1, %xmm0
movdqa %xmm0, -0x380(%rbp)
movdqa -0x350(%rbp), %xmm0
movdqa %xmm0, -0x170(%rbp)
movl $0x20, -0x174(%rbp)
movdqa -0x170(%rbp), %xmm0
movl -0x174(%rbp), %eax
movd %eax, %xmm1
psrlq %xmm1, %xmm0
movdqa %xmm0, -0x390(%rbp)
movdqa -0x2e0(%rbp), %xmm1
movdqa -0x360(%rbp), %xmm0
movdqa %xmm1, -0x50(%rbp)
movdqa %xmm0, -0x60(%rbp)
movdqa -0x50(%rbp), %xmm0
psubq -0x60(%rbp), %xmm0
movdqa %xmm0, -0x3a0(%rbp)
movdqa -0x2f0(%rbp), %xmm1
movdqa -0x370(%rbp), %xmm0
movdqa %xmm1, -0x70(%rbp)
movdqa %xmm0, -0x80(%rbp)
movdqa -0x70(%rbp), %xmm0
psubq -0x80(%rbp), %xmm0
movdqa %xmm0, -0x3b0(%rbp)
movdqa -0x300(%rbp), %xmm1
movdqa -0x380(%rbp), %xmm0
movdqa %xmm1, -0x90(%rbp)
movdqa %xmm0, -0xa0(%rbp)
movdqa -0x90(%rbp), %xmm0
psubq -0xa0(%rbp), %xmm0
movdqa %xmm0, -0x3c0(%rbp)
movdqa -0x310(%rbp), %xmm1
movdqa -0x390(%rbp), %xmm0
movdqa %xmm1, -0xb0(%rbp)
movdqa %xmm0, -0xc0(%rbp)
movdqa -0xb0(%rbp), %xmm0
psubq -0xc0(%rbp), %xmm0
movdqa %xmm0, -0x3d0(%rbp)
movdqa -0x380(%rbp), %xmm0
movdqa %xmm0, -0x10(%rbp)
movl $0x20, -0x14(%rbp)
movdqa -0x10(%rbp), %xmm0
movl -0x14(%rbp), %eax
movd %eax, %xmm1
psllq %xmm1, %xmm0
movdqa %xmm0, -0x3e0(%rbp)
movdqa -0x390(%rbp), %xmm0
movdqa %xmm0, -0x30(%rbp)
movl $0x20, -0x34(%rbp)
movdqa -0x30(%rbp), %xmm0
movl -0x34(%rbp), %eax
movd %eax, %xmm1
psllq %xmm1, %xmm0
movdqa %xmm0, -0x3f0(%rbp)
movdqa -0x360(%rbp), %xmm1
movdqa -0x3e0(%rbp), %xmm0
movdqa %xmm1, -0xd0(%rbp)
movdqa %xmm0, -0xe0(%rbp)
movdqa -0xd0(%rbp), %xmm0
por -0xe0(%rbp), %xmm0
movdqa %xmm0, -0x400(%rbp)
movdqa -0x370(%rbp), %xmm1
movdqa -0x3f0(%rbp), %xmm0
movdqa %xmm1, -0xf0(%rbp)
movdqa %xmm0, -0x100(%rbp)
movdqa -0xf0(%rbp), %xmm0
por -0x100(%rbp), %xmm0
movdqa %xmm0, -0x410(%rbp)
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movdqa -0x400(%rbp), %xmm0
movq %rax, -0x1f8(%rbp)
movdqa %xmm0, -0x210(%rbp)
movdqa -0x210(%rbp), %xmm0
movq -0x1f8(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x10, %rax
movdqa -0x410(%rbp), %xmm0
movq %rax, -0x218(%rbp)
movdqa %xmm0, -0x230(%rbp)
movdqa -0x230(%rbp), %xmm0
movq -0x218(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x288(%rbp), %r9
movslq -0x27c(%rbp), %rax
addq %rax, %r9
leaq -0x3a0(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
leaq -0x3c0(%rbp), %rdx
leaq -0x3d0(%rbp), %rcx
leaq -0x2c0(%rbp), %r8
callq 0x16e4c0
movl -0x27c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x27c(%rbp)
jmp 0x16d998
jmp 0x16dd65
movl -0x27c(%rbp), %eax
cmpl -0x294(%rbp), %eax
jge 0x16de46
movq -0x2a0(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x2a4(%rbp), %ecx
imulq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x414(%rbp)
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x414(%rbp), %eax
movl %eax, %eax
movq -0x278(%rbp), %rcx
movl 0x14(%rcx), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x418(%rbp)
cmpl $0xff, -0x418(%rbp)
jle 0x16ddf3
movl $0xff, %eax
movl %eax, -0x488(%rbp)
jmp 0x16de02
movl -0x418(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x488(%rbp)
movl -0x488(%rbp), %eax
movb %al, %dl
movq -0x288(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x414(%rbp), %edx
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0x16dd65
jmp 0x16e0b6
movq -0x278(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x41c(%rbp)
movl -0x41c(%rbp), %eax
movl $0x0, -0x1c4(%rbp)
movl %eax, -0x1c8(%rbp)
movl $0x0, -0x1cc(%rbp)
movl %eax, -0x1d0(%rbp)
movd -0x1c4(%rbp), %xmm0
movd -0x1c8(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x1cc(%rbp), %xmm2
movd -0x1d0(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x1e0(%rbp)
movaps -0x1e0(%rbp), %xmm0
movaps %xmm0, -0x430(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x1f0(%rbp)
movdqa -0x1f0(%rbp), %xmm0
movdqa %xmm0, -0x440(%rbp)
movl $0x0, -0x27c(%rbp)
movl -0x27c(%rbp), %eax
addl $0x8, %eax
cmpl -0x294(%rbp), %eax
jg 0x16e004
movq -0x290(%rbp), %rdi
movslq -0x27c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x450(%rbp), %rdx
leaq -0x460(%rbp), %rcx
leaq -0x470(%rbp), %r8
leaq -0x480(%rbp), %r9
callq 0x16e2a0
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movdqa -0x440(%rbp), %xmm0
movq %rax, -0x238(%rbp)
movdqa %xmm0, -0x250(%rbp)
movdqa -0x250(%rbp), %xmm0
movq -0x238(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x10, %rax
movdqa -0x440(%rbp), %xmm0
movq %rax, -0x258(%rbp)
movdqa %xmm0, -0x270(%rbp)
movdqa -0x270(%rbp), %xmm0
movq -0x258(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x288(%rbp), %r9
movslq -0x27c(%rbp), %rax
addq %rax, %r9
leaq -0x450(%rbp), %rdi
leaq -0x460(%rbp), %rsi
leaq -0x470(%rbp), %rdx
leaq -0x480(%rbp), %rcx
leaq -0x430(%rbp), %r8
callq 0x16e4c0
movl -0x27c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x27c(%rbp)
jmp 0x16dee6
jmp 0x16e006
movl -0x27c(%rbp), %eax
cmpl -0x294(%rbp), %eax
jge 0x16e0b4
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x41c(%rbp), %ecx
imulq %rcx, %rax
movabsq $0x80000000, %rcx       # imm = 0x80000000
addq %rcx, %rax
shrq $0x20, %rax
movl %eax, -0x484(%rbp)
cmpl $0xff, -0x484(%rbp)
jle 0x16e063
movl $0xff, %eax
movl %eax, -0x48c(%rbp)
jmp 0x16e072
movl -0x484(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x48c(%rbp)
movl -0x48c(%rbp), %eax
movb %al, %dl
movq -0x288(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x290(%rbp), %rax
movslq -0x27c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0x16e006
jmp 0x16e0b6
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nop