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

```asm
<foo>:
  endbr64
  mov    %ecx,%r10d
  push   %r12
  mov    %rdi,%rax
  mov    %r8d,%ecx
  push   %rbp
  mov    %esi,%edi
  mov    %rdx,%rsi
  push   %rbx
  cmp    $0x2,%r10d
  je     L146
  test   %edi,%edi
  jle    L35
  mov    %edi,%r8d
  lea    0x4(%rsi),%r10
  lea    (%r9,%r8,4),%rdx
  cmp    %rdx,%rsi
  setae  %dl
  cmp    %r10,%r9
  setae  %r10b
  or     %r10b,%dl
  je     L179
  lea    -0x1(%rdi),%edx
  cmp    $0x2,%edx
  mov    %r9,%rdx
  seta   %r10b
  sub    %rax,%rdx
  cmp    $0xc,%rdx
  seta   %dl
  test   %dl,%r10b
  je     L179
  movd   (%rsi),%xmm5
  mov    %edi,%r8d
  movslq %ecx,%rbx
  xor    %edx,%edx
  shr    $0x2,%r8d
  movq   %rbx,%xmm7
  pshufd $0x0,%xmm5,%xmm2
  shl    $0x4,%r8
  movdqa %xmm2,%xmm3
  psrlq  $0x20,%xmm3
L136:
  movdqu -0x4(%rax,%rdx,1),%xmm0
  movdqu -0x4(%rax,%rdx,1),%xmm1
  psrlq  $0x20,%xmm0
  pmuludq %xmm2,%xmm1
  pmuludq %xmm3,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm0,%xmm0
  punpckldq %xmm0,%xmm1
  movdqa %xmm1,%xmm0
  movdqu (%rax,%rdx,1),%xmm1
  psrad  %xmm7,%xmm0
  psubd  %xmm0,%xmm1
  movups %xmm1,(%r9,%rdx,1)
  add    $0x10,%rdx
  cmp    %r8,%rdx
  jne    L136
  mov    %edi,%r8d
  and    $0xfffffffc,%r8d
  test   $0x3,%dil
  je     L35
  mov    %r8d,%ebx
  lea    0x0(,%rbx,4),%rdx
  mov    -0x4(%rax,%rdx,1),%r10d
  imul   (%rsi),%r10d
  lea    (%rax,%rdx,1),%rbp
  mov    0x0(%rbp),%r11d
  sar    %cl,%r10d
  sub    %r10d,%r11d
  lea    0x1(%r8),%r10d
  mov    %r11d,(%r9,%rbx,4)
  cmp    %r10d,%edi
  jle    L35
  mov    (%rsi),%r10d
  imul   0x0(%rbp),%r10d
  add    $0x2,%r8d
  mov    0x4(%rax,%rdx,1),%r11d
  sar    %cl,%r10d
  sub    %r10d,%r11d
  mov    %r11d,0x4(%r9,%rdx,1)
  cmp    %r8d,%edi
  jle    L35
  mov    0x4(%rax,%rdx,1),%edi
  imul   (%rsi),%edi
  mov    0x8(%rax,%rdx,1),%eax
  mov    %edi,%esi
  sar    %cl,%esi
  sub    %esi,%eax
  mov    %eax,0x8(%r9,%rdx,1)
L35:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L146:
  test   %edi,%edi
  jle    L35
  mov    %edi,%r8d
  lea    0x8(%rsi),%r10
  lea    (%r9,%r8,4),%rdx
  cmp    %rdx,%rsi
  setae  %dl
  cmp    %r10,%r9
  setae  %r10b
  or     %r10b,%dl
  je     L178
  lea    -0x4(%rax),%r10
  mov    %r9,%rdx
  sub    %r10,%rdx
  cmp    $0x10,%rdx
  lea    -0x1(%rdi),%edx
  seta   %r10b
  cmp    $0x2,%edx
  seta   %dl
  test   %dl,%r10b
  je     L178
  movd   (%rsi),%xmm6
  movd   0x4(%rsi),%xmm4
  mov    %edi,%r8d
  movslq %ecx,%rbx
  shr    $0x2,%r8d
  xor    %edx,%edx
  movq   %rbx,%xmm7
  pshufd $0x0,%xmm6,%xmm3
  pshufd $0x0,%xmm4,%xmm4
  shl    $0x4,%r8
  movdqa %xmm4,%xmm6
  movdqa %xmm3,%xmm5
  psrlq  $0x20,%xmm6
  psrlq  $0x20,%xmm5
  nopl   0x0(%rax,%rax,1)
L42:
  movdqu -0x8(%rax,%rdx,1),%xmm1
  movdqu -0x8(%rax,%rdx,1),%xmm0
  movdqu -0x4(%rax,%rdx,1),%xmm2
  psrlq  $0x20,%xmm1
  pmuludq %xmm4,%xmm0
  pmuludq %xmm6,%xmm1
  pmuludq %xmm3,%xmm2
  pshufd $0x8,%xmm0,%xmm0
  pshufd $0x8,%xmm1,%xmm1
  pshufd $0x8,%xmm2,%xmm2
  punpckldq %xmm1,%xmm0
  movdqu -0x4(%rax,%rdx,1),%xmm1
  psrlq  $0x20,%xmm1
  pmuludq %xmm5,%xmm1
  pshufd $0x8,%xmm1,%xmm1
  punpckldq %xmm1,%xmm2
  movdqu (%rax,%rdx,1),%xmm1
  paddd  %xmm2,%xmm0
  psrad  %xmm7,%xmm0
  psubd  %xmm0,%xmm1
  movups %xmm1,(%r9,%rdx,1)
  add    $0x10,%rdx
  cmp    %r8,%rdx
  jne    L42
  mov    %edi,%r10d
  and    $0xfffffffc,%r10d
  test   $0x3,%dil
  je     L35
  mov    %r10d,%ebp
  mov    (%rsi),%r12d
  lea    0x0(,%rbp,4),%rdx
  lea    -0x4(%rax,%rdx,1),%rbx
  mov    -0x8(%rax,%rdx,1),%r8d
  lea    (%rax,%rdx,1),%r11
  imul   (%rbx),%r12d
  imul   0x4(%rsi),%r8d
  add    %r12d,%r8d
  mov    (%r11),%r12d
  sar    %cl,%r8d
  sub    %r8d,%r12d
  lea    0x1(%r10),%r8d
  mov    %r12d,(%r9,%rbp,4)
  cmp    %edi,%r8d
  jge    L35
  mov    0x4(%rsi),%r8d
  imul   (%rbx),%r8d
  add    $0x2,%r10d
  mov    (%rsi),%ebx
  imul   (%r11),%ebx
  add    %ebx,%r8d
  mov    0x4(%rax,%rdx,1),%ebx
  sar    %cl,%r8d
  sub    %r8d,%ebx
  mov    %ebx,0x4(%r9,%rdx,1)
  cmp    %edi,%r10d
  jge    L35
  mov    0x4(%rax,%rdx,1),%edi
  imul   (%rsi),%edi
  mov    0x4(%rsi),%esi
  imul   (%r11),%esi
  mov    0x8(%rax,%rdx,1),%eax
  add    %edi,%esi
  sar    %cl,%esi
  sub    %esi,%eax
  mov    %eax,0x8(%r9,%rdx,1)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L179:
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L48:
  mov    (%rsi),%edi
  imul   -0x4(%rax,%rdx,4),%edi
  mov    (%rax,%rdx,4),%r10d
  sar    %cl,%edi
  sub    %edi,%r10d
  mov    %r10d,(%r9,%rdx,4)
  add    $0x1,%rdx
  cmp    %r8,%rdx
  jne    L48
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L178:
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L175:
  mov    -0x4(%rax,%rdi,4),%edx
  mov    -0x8(%rax,%rdi,4),%r10d
  imul   (%rsi),%edx
  imul   0x4(%rsi),%r10d
  add    %r10d,%edx
  mov    (%rax,%rdi,4),%r10d
  sar    %cl,%edx
  sub    %edx,%r10d
  mov    %r10d,(%r9,%rdi,4)
  add    $0x1,%rdi
  cmp    %rdi,%r8
  jne    L175
  jmp    L35
```

assistant: ```c
void foo(int *data, unsigned len, const int qlp_coeff[], unsigned order, int lp, int residual[]) {
  int i;
  int sum;
  if (order == 2)
    for (i = 0; i < (int)len; i++) {
      sum = 0;
      sum += qlp_coeff[1] * data[i - 2];
      sum += qlp_coeff[0] * data[i - 1];
      residual[i] = data[i] - (sum >> lp);
    }
  else
    for (i = 0; i < (int)len; i++)
      residual[i] = data[i] - ((qlp_coeff[0] * data[i - 1]) >> lp);
}
```