// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movl 0x40(%rdi), %eax
cmpl 0x38(%rdi), %eax
jge 0xe7d94
movl 0x18(%rdi), %eax
testl %eax, %eax
jg 0xe7d75
movslq 0x20(%rdi), %r10
movl %r10d, %ecx
addl %eax, %ecx
js 0xe7d75
cmpl $0x0, 0x4(%rdi)
je 0xe7db3
movq 0x48(%rdi), %rcx
movl 0x8(%rdi), %r8d
imull 0x34(%rdi), %r8d
movq 0x60(%rdi), %rsi
movd 0x10(%rdi), %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
testl %eax, %eax
je 0xe7c33
movq 0x58(%rdi), %r9
negl %eax
shlq $0x20, %rax
xorl %ebx, %ebx
xorl %edx, %edx
divq %r10
movl %eax, %r10d
negl %r10d
movl %r8d, %edx
cmpl $0x8, %r8d
jl 0xe7bcf
movd %r10d, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movd %eax, %xmm2
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
xorl %ebx, %ebx
movdqa 0x45664(%rip), %xmm3    # 0x12d0c0
movdqa %xmm0, %xmm4
psrlq $0x20, %xmm4
movdqa 0x45663(%rip), %xmm5    # 0x12d0d0
movq %rbx, %r11
movdqu (%rsi,%rbx,4), %xmm10
movdqu 0x10(%rsi,%rbx,4), %xmm11
movdqa %xmm10, %xmm12
psrlq $0x20, %xmm12
movdqa %xmm11, %xmm13
psrlq $0x20, %xmm13
pmuludq %xmm1, %xmm10
pmuludq %xmm1, %xmm11
pmuludq %xmm1, %xmm12
pmuludq %xmm1, %xmm13
movdqu (%r9,%rbx,4), %xmm9
movdqu 0x10(%r9,%rbx,4), %xmm8
movdqa %xmm9, %xmm7
psrlq $0x20, %xmm7
movdqa %xmm8, %xmm6
psrlq $0x20, %xmm6
pmuludq %xmm2, %xmm9
paddq %xmm10, %xmm9
pmuludq %xmm2, %xmm8
paddq %xmm11, %xmm8
pmuludq %xmm2, %xmm7
paddq %xmm12, %xmm7
pmuludq %xmm2, %xmm6
paddq %xmm13, %xmm6
paddq %xmm3, %xmm9
paddq %xmm3, %xmm8
paddq %xmm3, %xmm7
paddq %xmm3, %xmm6
psrlq $0x20, %xmm9
psrlq $0x20, %xmm8
psrlq $0x20, %xmm7
psrlq $0x20, %xmm6
movdqa %xmm9, %xmm10
pmuludq %xmm0, %xmm10
pmuludq %xmm4, %xmm9
psllq $0x20, %xmm9
movdqa %xmm8, %xmm11
pmuludq %xmm0, %xmm11
pmuludq %xmm4, %xmm8
psllq $0x20, %xmm8
movdqa %xmm7, %xmm12
pmuludq %xmm0, %xmm12
pmuludq %xmm4, %xmm7
psllq $0x20, %xmm7
movdqa %xmm6, %xmm13
pmuludq %xmm0, %xmm13
pmuludq %xmm4, %xmm6
psllq $0x20, %xmm6
paddq %xmm3, %xmm10
paddq %xmm9, %xmm10
paddq %xmm3, %xmm11
paddq %xmm8, %xmm11
paddq %xmm3, %xmm12
paddq %xmm7, %xmm12
paddq %xmm3, %xmm13
paddq %xmm6, %xmm13
psrlq $0x20, %xmm10
psrlq $0x20, %xmm11
pand %xmm5, %xmm12
por %xmm10, %xmm12
pand %xmm5, %xmm13
por %xmm11, %xmm13
packssdw %xmm13, %xmm12
packuswb %xmm12, %xmm12
movq %xmm12, (%rcx,%rbx)
addq $0x8, %rbx
addq $0x10, %r11
cmpq %rdx, %r11
jbe 0xe7a6d
cmpl %r8d, %ebx
jge 0xe7d73
movl %eax, %eax
movl %r10d, %r8d
movl %ebx, %r10d
movl (%rsi,%r10,4), %r11d
imulq %r8, %r11
movl (%r9,%r10,4), %ebx
imulq %rax, %rbx
addq %r11, %rbx
subq $-0x80000000, %rbx      # imm = 0x80000000
shrq $0x20, %rbx
movl 0x10(%rdi), %r11d
imulq %rbx, %r11
subq $-0x80000000, %r11      # imm = 0x80000000
shrq $0x20, %r11
movl $0xff, %ebx
cmpl $0x100, %r11d           # imm = 0x100
jge 0xe7c22
movl %r11d, %ebx
movb %bl, (%rcx,%r10)
incq %r10
cmpq %r10, %rdx
jne 0xe7be0
jmp 0xe7d73
xorl %r9d, %r9d
cmpl $0x8, %r8d
jl 0xe7d34
movl %r8d, %eax
xorl %r9d, %r9d
movdqa %xmm0, %xmm1
psrlq $0x20, %xmm1
movdqa 0x45469(%rip), %xmm2    # 0x12d0c0
movdqa 0x45471(%rip), %xmm3    # 0x12d0d0
movq %r9, %rdx
movdqu (%rsi,%r9,4), %xmm11
movdqu 0x10(%rsi,%r9,4), %xmm9
movdqa %xmm11, %xmm8
psrlq $0x20, %xmm8
movdqa %xmm9, %xmm7
psrlq $0x20, %xmm7
movdqa %xmm11, %xmm4
pmuludq %xmm0, %xmm4
pmuludq %xmm1, %xmm11
psllq $0x20, %xmm11
movdqa %xmm9, %xmm5
pmuludq %xmm0, %xmm5
pmuludq %xmm1, %xmm9
psllq $0x20, %xmm9
movdqa %xmm8, %xmm6
pmuludq %xmm0, %xmm6
pmuludq %xmm1, %xmm8
psllq $0x20, %xmm8
movdqa %xmm7, %xmm10
pmuludq %xmm0, %xmm10
pmuludq %xmm1, %xmm7
psllq $0x20, %xmm7
paddq %xmm2, %xmm4
paddq %xmm11, %xmm4
paddq %xmm2, %xmm5
paddq %xmm9, %xmm5
paddq %xmm2, %xmm6
paddq %xmm8, %xmm6
paddq %xmm2, %xmm10
paddq %xmm7, %xmm10
psrlq $0x20, %xmm4
psrlq $0x20, %xmm5
pand %xmm3, %xmm6
por %xmm4, %xmm6
pand %xmm3, %xmm10
por %xmm5, %xmm10
packssdw %xmm10, %xmm6
packuswb %xmm6, %xmm6
movq %xmm6, (%rcx,%r9)
addq $0x8, %r9
addq $0x10, %rdx
cmpq %rax, %rdx
jbe 0xe7c5f
cmpl %r8d, %r9d
jge 0xe7d73
movl %r9d, %eax
movl %r8d, %edx
movl $0xff, %r8d
movl (%rsi,%rax,4), %r9d
movl 0x10(%rdi), %r10d
imulq %r9, %r10
subq $-0x80000000, %r10      # imm = 0x80000000
shrq $0x20, %r10
cmpl $0x100, %r10d           # imm = 0x100
cmovgel %r8d, %r10d
movb %r10b, (%rcx,%rax)
incq %rax
cmpq %rax, %rdx
jne 0xe7d45
popq %rbx
retq
leaq 0x45443(%rip), %rdi     # 0x12d1bf
leaq 0x4535d(%rip), %rsi     # 0x12d0e0
leaq 0x453fe(%rip), %rcx     # 0x12d188
movl $0xed, %edx
callq 0x55710
leaq 0x4453a(%rip), %rdi     # 0x12c2d5
leaq 0x4533e(%rip), %rsi     # 0x12d0e0
leaq 0x453df(%rip), %rcx     # 0x12d188
movl $0xec, %edx
callq 0x55710
leaq 0x445cb(%rip), %rdi     # 0x12c385
leaq 0x4531f(%rip), %rsi     # 0x12d0e0
leaq 0x453c0(%rip), %rcx     # 0x12d188
movl $0xee, %edx
callq 0x55710