// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/rescaler.c
// Function: WebPRescalerImportRowExpand_C
void WebPRescalerImportRowExpand_C(WebPRescaler* const wrk,
                                   const uint8_t* src) {
  const int x_stride = wrk->num_channels;
  const int x_out_max = wrk->dst_width * wrk->num_channels;
  int channel;
  assert(!WebPRescalerInputDone(wrk));
  assert(wrk->x_expand);
  for (channel = 0; channel < x_stride; ++channel) {
    int x_in = channel;
    int x_out = channel;
    // simple bilinear interpolation
    int accum = wrk->x_add;
    rescaler_t left = (rescaler_t)src[x_in];
    rescaler_t right =
        (wrk->src_width > 1) ? (rescaler_t)src[x_in + x_stride] : left;
    x_in += x_stride;
    while (1) {
      wrk->frow[x_out] = right * wrk->x_add + (left - right) * accum;
      x_out += x_stride;
      if (x_out >= x_out_max) break;
      accum -= wrk->x_sub;
      if (accum < 0) {
        left = right;
        x_in += x_stride;
        assert(x_in < wrk->src_width * x_stride);
        right = (rescaler_t)src[x_in];
        accum += wrk->x_add;
      }
    }
    assert(wrk->x_sub == 0 /* <- special case for src_width=1 */ || accum == 0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x150a80
cmpl $0x0, %eax
jne 0x1508cc
jmp 0x1508eb
leaq 0x6f569(%rip), %rdi     # 0x1bfe3c
leaq 0x6f57e(%rip), %rsi     # 0x1bfe58
movl $0x22, %edx
leaq 0x6f585(%rip), %rcx     # 0x1bfe6b
callq 0x598a0
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1508f6
jmp 0x150915
leaq 0x6f640(%rip), %rdi     # 0x1bff3d
leaq 0x6f554(%rip), %rsi     # 0x1bfe58
movl $0x23, %edx
leaq 0x6f55b(%rip), %rcx     # 0x1bfe6b
callq 0x598a0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x150a74
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x2c(%rax)
jle 0x15096d
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
addl -0x14(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
jmp 0x150973
movl -0x2c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x14(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x30(%rbp), %edx
movq -0x8(%rbp), %rax
imull 0x24(%rax), %edx
movl -0x2c(%rbp), %eax
subl -0x30(%rbp), %eax
imull -0x28(%rbp), %eax
addl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x1509bb
jmp 0x150a33
movq -0x8(%rbp), %rax
movl 0x28(%rax), %ecx
movl -0x28(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x150a2e
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x14(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x2c(%rcx), %ecx
imull -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1509f3
jmp 0x150a12
leaq 0x6f4ba(%rip), %rdi     # 0x1bfeb4
leaq 0x6f457(%rip), %rsi     # 0x1bfe58
movl $0x35, %edx
leaq 0x6f45e(%rip), %rcx     # 0x1bfe6b
callq 0x598a0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x150982
movq -0x8(%rbp), %rax
cmpl $0x0, 0x28(%rax)
je 0x150a43
cmpl $0x0, -0x28(%rbp)
jne 0x150a45
jmp 0x150a64
leaq 0x6f489(%rip), %rdi     # 0x1bfed5
leaq 0x6f405(%rip), %rsi     # 0x1bfe58
movl $0x3a, %edx
leaq 0x6f40c(%rip), %rcx     # 0x1bfe6b
callq 0x598a0
jmp 0x150a66
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x15091c
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)