// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dsp/rescaler_sse2.c
// Function: RescalerExportRowExpand_SSE2
static void RescalerExportRowExpand_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 __m128i mult = _mm_set_epi32(0, wrk->fy_scale, 0, wrk->fy_scale);

  assert(!WebPRescalerOutputDone(wrk));
  assert(wrk->y_accum <= 0 && wrk->y_sub + wrk->y_accum >= 0);
  assert(wrk->y_expand);
  if (wrk->y_accum == 0) {
    for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) {
      __m128i A0, A1, A2, A3;
      LoadDispatchAndMult_SSE2(frow + x_out, NULL, &A0, &A1, &A2, &A3);
      ProcessRow_SSE2(&A0, &A1, &A2, &A3, &mult, dst + x_out);
    }
    for (; 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);
    const __m128i mA = _mm_set_epi32(0, A, 0, A);
    const __m128i mB = _mm_set_epi32(0, B, 0, B);
    const __m128i rounder = _mm_set_epi32(0, ROUNDER, 0, ROUNDER);
    for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) {
      __m128i A0, A1, A2, A3, B0, B1, B2, B3;
      LoadDispatchAndMult_SSE2(frow + x_out, &mA, &A0, &A1, &A2, &A3);
      LoadDispatchAndMult_SSE2(irow + x_out, &mB, &B0, &B1, &B2, &B3);
      {
        const __m128i C0 = _mm_add_epi64(A0, B0);
        const __m128i C1 = _mm_add_epi64(A1, B1);
        const __m128i C2 = _mm_add_epi64(A2, B2);
        const __m128i C3 = _mm_add_epi64(A3, B3);
        const __m128i D0 = _mm_add_epi64(C0, rounder);
        const __m128i D1 = _mm_add_epi64(C1, rounder);
        const __m128i D2 = _mm_add_epi64(C2, rounder);
        const __m128i D3 = _mm_add_epi64(C3, rounder);
        const __m128i E0 = _mm_srli_epi64(D0, WEBP_RESCALER_RFIX);
        const __m128i E1 = _mm_srli_epi64(D1, WEBP_RESCALER_RFIX);
        const __m128i E2 = _mm_srli_epi64(D2, WEBP_RESCALER_RFIX);
        const __m128i E3 = _mm_srli_epi64(D3, WEBP_RESCALER_RFIX);
        ProcessRow_SSE2(&E0, &E1, &E2, &E3, &mult, dst + x_out);
      }
    }
    for (; 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq 0x48(%rdi), %r13
movq 0x58(%rdi), %r12
movslq 0x34(%rdi), %rcx
movslq 0x8(%rdi), %rbx
movq 0x60(%rdi), %r15
movd 0x10(%rdi), %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, 0x70(%rsp)
movl 0x40(%rdi), %eax
cmpl 0x38(%rdi), %eax
jge 0xdafd5
movl 0x18(%rdi), %eax
testl %eax, %eax
jg 0xdafb6
movslq 0x20(%rdi), %rsi
movl %esi, %edx
addl %eax, %edx
js 0xdafb6
cmpl $0x0, 0x4(%rdi)
je 0xdaff4
movq %rdi, 0x18(%rsp)
imulq %rcx, %rbx
testl %eax, %eax
movq %r15, 0x8(%rsp)
je 0xdaef8
negl %eax
shlq $0x20, %rax
xorl %r14d, %r14d
xorl %edx, %edx
divq %rsi
movd %eax, %xmm0
movq %rax, 0x60(%rsp)
negl %eax
movl %eax, 0x14(%rsp)
movd %eax, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
leaq 0x50(%rsp), %rax
movdqa %xmm1, (%rax)
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq 0x40(%rsp), %rax
movdqa %xmm0, (%rax)
movslq %ebx, %rbx
movq %r12, 0x68(%rsp)
leaq 0x8(%r14), %rbp
cmpq %rbx, %rbp
jg 0xdae8f
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x110(%rsp), %r8
leaq 0x100(%rsp), %r9
callq 0xdb37c
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
leaq 0xd0(%rsp), %r8
leaq 0xc0(%rsp), %r9
callq 0xdb37c
movdqa 0x30(%rsp), %xmm0
movdqa 0x20(%rsp), %xmm1
movdqa 0x110(%rsp), %xmm2
paddq 0xf0(%rsp), %xmm0
movdqa 0x100(%rsp), %xmm3
movdqa 0x41fe4(%rip), %xmm4    # 0x11cdd0
paddq %xmm4, %xmm0
paddq 0xe0(%rsp), %xmm1
paddq %xmm4, %xmm1
paddq 0xd0(%rsp), %xmm2
paddq %xmm4, %xmm2
paddq 0xc0(%rsp), %xmm3
paddq %xmm4, %xmm3
psrlq $0x20, %xmm0
movdqa %xmm0, 0xb0(%rsp)
psrlq $0x20, %xmm1
movdqa %xmm1, 0xa0(%rsp)
psrlq $0x20, %xmm2
movdqa %xmm2, 0x90(%rsp)
psrlq $0x20, %xmm3
movdqa %xmm3, 0x80(%rsp)
addq %r13, %r14
leaq 0xb0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x80(%rsp), %rcx
leaq 0x70(%rsp), %r8
movq %r14, %r9
callq 0xdb3ce
addq $0x20, %r12
addq $0x20, %r15
movq %rbp, %r14
jmp 0xdad5c
movl 0x60(%rsp), %eax
movl 0x14(%rsp), %ecx
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r8
movq 0x68(%rsp), %r9
cmpq %rbx, %r14
jge 0xdafa4
movl (%r8,%r14,4), %edx
imulq %rcx, %rdx
movl (%r9,%r14,4), %esi
imulq %rax, %rsi
addq %rdx, %rsi
subq $-0x80000000, %rsi      # imm = 0x80000000
shrq $0x20, %rsi
movl 0x10(%rdi), %edx
imulq %rsi, %rdx
subq $-0x80000000, %rdx      # imm = 0x80000000
shrq $0x20, %rdx
movl $0xff, %esi
cmpl $0x100, %edx            # imm = 0x100
jge 0xdaeee
movl %edx, %esi
movb %sil, (%r13,%r14)
incq %r14
jmp 0xdaea6
xorl %r9d, %r9d
leaq 0x30(%rsp), %r12
leaq 0x20(%rsp), %r14
leaq 0x70(%rsp), %r15
leaq 0x8(%r9), %rbp
cmpq %rbx, %rbp
jg 0xdaf67
movq 0x8(%rsp), %rax
movdqu (%rax,%r9,4), %xmm0
movdqu 0x10(%rax,%r9,4), %xmm1
movdqa %xmm0, 0x50(%rsp)
psrlq $0x20, %xmm0
movdqa %xmm1, 0x40(%rsp)
psrlq $0x20, %xmm1
movdqa %xmm0, 0x30(%rsp)
movdqa %xmm1, 0x20(%rsp)
addq %r13, %r9
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0xdb3ce
movq %rbp, %r9
jmp 0xdaf0a
movl $0xff, %eax
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdi
cmpq %rbx, %r9
jge 0xdafa4
movl (%rdi,%r9,4), %ecx
movl 0x10(%rsi), %edx
imulq %rcx, %rdx
subq $-0x80000000, %rdx      # imm = 0x80000000
shrq $0x20, %rdx
cmpl $0x100, %edx            # imm = 0x100
cmovgel %eax, %edx
movb %dl, (%r13,%r9)
incq %r9
jmp 0xdaf76
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41f12(%rip), %rdi     # 0x11cecf
leaq 0x41e2c(%rip), %rsi     # 0x11cdf0
leaq 0x41ecd(%rip), %rcx     # 0x11ce98
movl $0xed, %edx
callq 0x56770
leaq 0x40fd9(%rip), %rdi     # 0x11bfb5
leaq 0x41e0d(%rip), %rsi     # 0x11cdf0
leaq 0x41eae(%rip), %rcx     # 0x11ce98
movl $0xec, %edx
callq 0x56770
leaq 0x4106a(%rip), %rdi     # 0x11c065
leaq 0x41dee(%rip), %rsi     # 0x11cdf0
leaq 0x41e8f(%rip), %rcx     # 0x11ce98
movl $0xee, %edx
callq 0x56770