user: 请从给定的汇编指令推导出C源代码:

```asm
<putsprite_blend_flip_>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,0x2c(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %r9d,(%rsp)
  test   %r8d,%r8d
  jle    L38
  mov    %rcx,%r15
  movslq %r9d,%rax
  shl    $0x2,%rax
  mov    %rax,0x18(%rsp)
  mov    %r8d,%r8d
  lea    (%rdx,%r8,4),%rax
  mov    %rax,0x20(%rsp)
  jmp    L136
L42:
  mov    (%rsp),%eax
  cmp    %eax,%r12d
  jle    L121
  sub    %eax,%r12d
  sub    %r12d,%r14d
  movslq %r12d,%r12
  add    %r12,%r13
  cmp    %eax,%r14d
  cmovg  %eax,%r14d
  mov    %eax,%r12d
  test   %r14d,%r14d
  jg     L18
  jmp    L124
L31:
  mov    0x18(%rsp),%rcx
  add    %rcx,0x8(%rsp)
  mov    0x20(%rsp),%rcx
  cmp    %rcx,0x10(%rsp)
  je     L38
L136:
  mov    0x10(%rsp),%rax
  movslq (%rax),%r13
  add    %rax,%r13
  add    $0x4,%rax
  mov    %rax,0x10(%rsp)
  mov    0x2c(%rsp),%r12d
  jmp    L124
L121:
  test   %edx,%edx
  cmovs  %r12d,%r14d
L18:
  movslq %r12d,%rax
  mov    0x8(%rsp),%rcx
  lea    (%rcx,%rax,4),%rbp
  mov    %r13,%rbx
  lea    (%r14,%r13,1),%eax
  mov    %r12d,0x4(%rsp)
  mov    %r14d,0x28(%rsp)
  mov    0x70(%rsp),%r12
  mov    %eax,%r14d
L5:
  add    $0x1,%rbx
  mov    -0x4(%rbp),%esi
  movzbl -0x1(%rbx),%eax
  mov    (%r15,%rax,4),%edi
  call   *%r12
  mov    %eax,-0x4(%rbp)
  sub    $0x4,%rbp
  mov    %r14d,%eax
  sub    %ebx,%eax
  test   %eax,%eax
  jg     L5
  mov    0x4(%rsp),%r12d
  mov    0x28(%rsp),%r14d
  test   %r14d,%r14d
  mov    $0x1,%eax
  cmovg  %r14d,%eax
  sub    %eax,%r12d
  lea    -0x1(%r14),%eax
  add    $0x1,%rax
  test   %r14d,%r14d
  mov    $0x1,%edx
  cmovle %rdx,%rax
  add    %rax,%r13
L124:
  test   %r12d,%r12d
  jle    L31
  movzbl 0x0(%r13),%eax
  cmp    $0xff,%eax
  je     L31
  sub    %eax,%r12d
  test   %r12d,%r12d
  jle    L31
  add    $0x2,%r13
  movzbl -0x1(%r13),%eax
  movzbl %al,%r14d
  test   %r14d,%r14d
  je     L124
  mov    %r12d,%edx
  sub    %r14d,%edx
  cmp    (%rsp),%edx
  jl     L42
  movzbl %al,%eax
  add    %rax,%r13
  mov    %edx,%r12d
  jmp    L124
L38:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void putsprite_blend_flip_(unsigned *dest, int x, int *linetab, unsigned *palette, int h, int screenwidth, unsigned (*blendfp)(unsigned, unsigned)) {
  for (; h > 0; h--, dest += screenwidth) {
    register int lx = x;
    unsigned char *data = ((unsigned char *)linetab) + (*linetab);
    linetab++;
    while (lx > 0) {
      register int count = *data++;
      if (count == 0xFF)
        break;
      lx -= count;
      if (lx <= 0)
        break;
      count = *data++;
      if (!count)
        continue;
      if ((lx - count) >= screenwidth) {
        lx -= count;
        data += count;
        continue;
      }
      if (lx > screenwidth) {
        int diff = (lx - screenwidth);
        count -= diff;
        data += diff;
        lx = screenwidth;
      }
      if ((lx - count) < 0) {
        count = lx;
      }
      for (; count > 0; count--) {
        --lx;
        dest[lx] = blendfp(palette[*data++], dest[lx]);
      }
    }
  }
}
```