user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<blend_image_inplace>:
  endbr64
  mov    %edx,%r9d
  test   %r9d,%r9d
  je     L60
  lea    0x4(%rsi),%rdx
  mov    %rdi,%rax
  push   %rbp
  sub    %rdx,%rax
  push   %rbx
  cmp    $0x8,%rax
  jbe    L26
  lea    -0x1(%r9),%eax
  cmp    $0x2,%eax
  jbe    L26
  mov    %r9d,%edx
  movdqa D9(%rip),%xmm2
  xor    %eax,%eax
  shr    $0x2,%edx
  shl    $0x4,%rdx
  nopw   0x0(%rax,%rax,1)
L13:
  movdqu (%rsi,%rax,1),%xmm1
  movdqu (%rdi,%rax,1),%xmm4
  movdqa %xmm2,%xmm8
  movdqa %xmm1,%xmm0
  movdqa %xmm1,%xmm5
  psrld  $0x18,%xmm0
  psrad  $0x8,%xmm5
  pand   %xmm2,%xmm5
  movdqa %xmm0,%xmm6
  psrlq  $0x20,%xmm6
  movdqa %xmm5,%xmm3
  psrlq  $0x20,%xmm5
  pmuludq %xmm0,%xmm3
  pmuludq %xmm6,%xmm5
  pshufd $0x8,%xmm3,%xmm3
  pshufd $0x8,%xmm5,%xmm5
  punpckldq %xmm5,%xmm3
  movdqa %xmm4,%xmm5
  psrad  $0x8,%xmm5
  psrad  $0x8,%xmm3
  pand   %xmm2,%xmm5
  paddd  %xmm5,%xmm3
  movdqa %xmm2,%xmm5
  movdqa %xmm3,%xmm7
  pcmpgtd %xmm2,%xmm7
  pand   %xmm7,%xmm5
  pandn  %xmm3,%xmm7
  por    %xmm5,%xmm7
  movdqa %xmm1,%xmm5
  pand   %xmm2,%xmm1
  psrad  $0x10,%xmm5
  pslld  $0x8,%xmm7
  pand   %xmm2,%xmm5
  movdqa %xmm5,%xmm3
  psrlq  $0x20,%xmm5
  pmuludq %xmm0,%xmm3
  pmuludq %xmm6,%xmm5
  pmuludq %xmm1,%xmm0
  psrlq  $0x20,%xmm1
  pmuludq %xmm6,%xmm1
  pshufd $0x8,%xmm5,%xmm5
  pshufd $0x8,%xmm3,%xmm3
  punpckldq %xmm5,%xmm3
  movdqa %xmm4,%xmm5
  pshufd $0x8,%xmm0,%xmm0
  psrad  $0x10,%xmm5
  pshufd $0x8,%xmm1,%xmm1
  pand   %xmm2,%xmm4
  pand   %xmm2,%xmm5
  psrad  $0x8,%xmm3
  punpckldq %xmm1,%xmm0
  paddd  %xmm5,%xmm3
  psrad  $0x8,%xmm0
  movdqa %xmm3,%xmm5
  paddd  %xmm4,%xmm0
  pcmpgtd %xmm2,%xmm5
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm5,%xmm8
  pandn  %xmm3,%xmm5
  movdqa %xmm2,%xmm3
  por    %xmm8,%xmm5
  pand   %xmm1,%xmm3
  pandn  %xmm0,%xmm1
  pslld  $0x10,%xmm5
  por    %xmm3,%xmm1
  por    %xmm7,%xmm5
  por    %xmm1,%xmm5
  movups %xmm5,(%rdi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L13
  mov    %r9d,%eax
  and    $0xfffffffc,%eax
  mov    %eax,%ecx
  shl    $0x2,%rcx
  add    %rcx,%rdi
  add    %rsi,%rcx
  mov    %r9d,%esi
  sub    %eax,%esi
  cmp    %eax,%r9d
  je     L15
  mov    (%rcx),%eax
  mov    (%rdi),%ebx
  mov    $0xff,%r9d
  mov    %eax,%r8d
  movzbl %ah,%edx
  movzbl %bh,%ebp
  mov    %ebx,%r10d
  shr    $0x18,%r8d
  movzbl %bl,%ebx
  imul   %r8d,%edx
  sar    $0x8,%edx
  add    %ebp,%edx
  cmp    %r9d,%edx
  cmovg  %r9d,%edx
  sar    $0x10,%r10d
  movzbl %r10b,%r10d
  shl    $0x8,%edx
  mov    %edx,%r9d
  mov    %eax,%edx
  movzbl %al,%eax
  sar    $0x10,%edx
  movzbl %dl,%edx
  imul   %r8d,%edx
  sar    $0x8,%edx
  add    %r10d,%edx
  mov    $0xff,%r10d
  cmp    %r10d,%edx
  cmovg  %r10d,%edx
  imul   %r8d,%eax
  mov    $0xff,%r8d
  shl    $0x10,%edx
  sar    $0x8,%eax
  or     %r9d,%edx
  add    %ebx,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  or     %eax,%edx
  mov    %edx,(%rdi)
  cmp    $0x1,%esi
  je     L15
  mov    0x4(%rcx),%eax
  mov    0x4(%rdi),%ebx
  mov    $0xff,%r9d
  mov    %eax,%r8d
  movzbl %ah,%edx
  movzbl %bh,%ebp
  mov    %ebx,%r10d
  shr    $0x18,%r8d
  movzbl %bl,%ebx
  imul   %r8d,%edx
  sar    $0x8,%edx
  add    %ebp,%edx
  cmp    %r9d,%edx
  cmovg  %r9d,%edx
  sar    $0x10,%r10d
  movzbl %r10b,%r10d
  shl    $0x8,%edx
  mov    %edx,%r9d
  mov    %eax,%edx
  movzbl %al,%eax
  sar    $0x10,%edx
  movzbl %dl,%edx
  imul   %r8d,%edx
  sar    $0x8,%edx
  add    %r10d,%edx
  mov    $0xff,%r10d
  cmp    %r10d,%edx
  cmovg  %r10d,%edx
  imul   %r8d,%eax
  mov    $0xff,%r8d
  shl    $0x10,%edx
  sar    $0x8,%eax
  or     %r9d,%edx
  add    %ebx,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  or     %eax,%edx
  mov    %edx,0x4(%rdi)
  cmp    $0x2,%esi
  je     L15
  mov    0x8(%rcx),%ecx
  mov    0x8(%rdi),%ebx
  mov    %ecx,%esi
  movzbl %ch,%eax
  movzbl %bh,%edx
  mov    %ebx,%r8d
  shr    $0x18,%esi
  movzbl %bl,%ebx
  imul   %esi,%eax
  sar    $0x8,%eax
  add    %edx,%eax
  mov    $0xff,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  mov    %ecx,%edx
  sar    $0x10,%r8d
  sar    $0x10,%edx
  movzbl %r8b,%r8d
  movzbl %dl,%edx
  shl    $0x8,%eax
  imul   %esi,%edx
  sar    $0x8,%edx
  add    %r8d,%edx
  mov    $0xff,%r8d
  cmp    %r8d,%edx
  cmovg  %r8d,%edx
  shl    $0x10,%edx
  or     %edx,%eax
  movzbl %cl,%edx
  mov    $0xff,%ecx
  imul   %esi,%edx
  sar    $0x8,%edx
  add    %ebx,%edx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  or     %edx,%eax
  mov    %eax,0x8(%rdi)
L15:
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L26:
  xor    %r8d,%r8d
  nopl   0x0(%rax,%rax,1)
L18:
  mov    (%rsi,%r8,4),%ecx
  mov    (%rdi,%r8,4),%ebx
  mov    $0xff,%r11d
  mov    %ecx,%eax
  mov    %ecx,%r10d
  mov    %ebx,%edx
  movzbl %bh,%ebp
  sar    $0x10,%eax
  shr    $0x18,%r10d
  movzbl %bl,%ebx
  movzbl %al,%eax
  sar    $0x10,%edx
  imul   %r10d,%eax
  movzbl %dl,%edx
  sar    $0x8,%eax
  add    %edx,%eax
  mov    $0xff,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  movzbl %ch,%edx
  imul   %r10d,%edx
  shl    $0x10,%eax
  sar    $0x8,%edx
  add    %ebp,%edx
  cmp    %r11d,%edx
  cmovg  %r11d,%edx
  shl    $0x8,%edx
  or     %edx,%eax
  movzbl %cl,%edx
  mov    $0xff,%ecx
  imul   %r10d,%edx
  sar    $0x8,%edx
  add    %ebx,%edx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  or     %edx,%eax
  mov    %eax,(%rdi,%r8,4)
  add    $0x1,%r8
  cmp    %r9,%r8
  jne    L18
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L60:
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D9
data_type: byte[16]

tool: {"D9": [0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00]}

assistant: ```c
void blend_image_inplace(uint32_t *background, uint32_t *foreground, int count) {
  uint32_t Rf, Gf, Bf, Af;
  uint32_t Rb, Gb, Bb;
  uint32_t R, G, B;
  while (count) {
    Rf = (*foreground) & 0xff;
    Gf = ((*foreground) >> 8) & 0xff;
    Bf = ((*foreground) >> 16) & 0xff;
    Af = ((*foreground) >> 24) & 0xff;
    Rb = (*background) & 0xff;
    Gb = ((*background) >> 8) & 0xff;
    Bb = ((*background) >> 16) & 0xff;
    R = (Rf * Af) / 256 + Rb;
    G = (Gf * Af) / 256 + Gb;
    B = (Bf * Af) / 256 + Bb;
    if (R > 255)
      R = 255;
    if (G > 255)
      G = 255;
    if (B > 255)
      B = 255;
    (*background) = R | (G << 8) | (B << 16);
    foreground += 1;
    background += 1;
    count -= 1;
  }
}
```