user: Converte this assembly snippet into its equivalent C code:

```asm
<idct_perform32_fixed>:
  endbr64
  push   %r15
  push   %r14
  lea    0x80(%rdi),%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  nopl   (%rax)
L16:
  mov    0x0(%rbp),%edi
  add    $0x4,%rbp
  call   <abs@plt>
  add    %eax,%r12d
  cmp    %r14,%rbp
  jne    L16
  xor    %ebp,%ebp
  cmp    $0x400000,%r12d
  mov    %rbx,%rsi
  mov    %r13,%rdi
  setg   %bpl
  movdqu 0x0(%r13),%xmm2
  movdqu 0x70(%r13),%xmm4
  lea    0x40(%rbx),%r12
  add    %ebp,%ebp
  lea    0x40(%r13),%r14
  lea    0x60(%r13),%r15
  mov    $0x10,%edx
  movd   %ebp,%xmm3
  movslq %ebp,%rax
  pshufd $0x0,%xmm3,%xmm1
  movq   %rax,%xmm0
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x0(%r13)
  movdqu 0x10(%r13),%xmm2
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x10(%r13)
  movdqu 0x20(%r13),%xmm2
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x20(%r13)
  movdqu 0x30(%r13),%xmm2
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x30(%r13)
  movdqu 0x40(%r13),%xmm2
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x40(%r13)
  movdqu 0x50(%r13),%xmm2
  paddd  %xmm1,%xmm2
  psrad  %xmm0,%xmm2
  movups %xmm2,0x50(%r13)
  movdqu 0x60(%r13),%xmm2
  paddd  %xmm1,%xmm2
  paddd  %xmm4,%xmm1
  psrad  %xmm0,%xmm2
  psrad  %xmm0,%xmm1
  movups %xmm2,0x60(%r13)
  movups %xmm1,0x70(%r13)
  call   <sum_a@plt>
  mov    $0x10,%edx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <sum_b@plt>
  mov    $0x20,%esi
  mov    %rbx,%rdi
  call   <clp_v@plt>
  mov    $0x8,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <sum_a@plt>
  lea    0x20(%r13),%r8
  mov    $0x8,%edx
  mov    %rbx,%rdi
  mov    %r8,%rsi
  mov    %r8,0x8(%rsp)
  call   <sum_b@plt>
  mov    %r12,%rdi
  mov    $0x8,%edx
  mov    %r14,%rsi
  call   <sum_c@plt>
  mov    $0x8,%edx
  mov    %r12,%rdi
  mov    %r15,%rsi
  call   <sum_d@plt>
  mov    $0x20,%esi
  mov    %r13,%rdi
  call   <clp_v@plt>
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <dct_a@plt>
  mov    0x8(%rsp),%rdi
  lea    0x20(%rbx),%rsi
  call   <dct_b@plt>
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <dct_b@plt>
  lea    0x60(%rbx),%rsi
  mov    %r15,%rdi
  call   <dct_b@plt>
  mov    $0x20,%esi
  mov    %rbx,%rdi
  call   <clp_v@plt>
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <mod_a@plt>
  mov    %r12,%rdi
  mov    %r14,%rsi
  lea    0x80(%rbx),%r12
  call   <mod_b@plt>
  mov    $0x20,%esi
  mov    %r13,%rdi
  call   <clp_v@plt>
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <mod_c@plt>
  nopl   (%rax)
L15:
  mov    (%rbx),%edi
  mov    %ebp,%ecx
  add    $0x4,%rbx
  shl    %cl,%edi
  call   <clip23@plt>
  mov    %eax,-0x4(%rbx)
  cmp    %r12,%rbx
  jne    L15
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void idct_perform32_fixed(int *restrict input, int *restrict output) {
  int mag = 0;
  for (int i = 0; i < 32; i++)
    mag += abs(input[i]);
  int shift = mag > 0x400000 ? 2 : 0;
  int round = shift > 0 ? 1 << (shift - 1) : 0;
  for (int i = 0; i < 32; i++)
    input[i] = (input[i] + round) >> shift;
  sum_a(input, output + 0, 16);
  sum_b(input, output + 16, 16);
  clp_v(output, 32);
  sum_a(output + 0, input + 0, 8);
  sum_b(output + 0, input + 8, 8);
  sum_c(output + 16, input + 16, 8);
  sum_d(output + 16, input + 24, 8);
  clp_v(input, 32);
  dct_a(input + 0, output + 0);
  dct_b(input + 8, output + 8);
  dct_b(input + 16, output + 16);
  dct_b(input + 24, output + 24);
  clp_v(output, 32);
  mod_a(output + 0, input + 0);
  mod_b(output + 16, input + 16);
  clp_v(input, 32);
  mod_c(input, output);
  for (int i = 0; i < 32; i++)
    output[i] = clip23(output[i] * (1 << shift));
}
```