user: Please show me the C implementation that matches the assembly code listed below:

```asm
<IDCT>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    0x20(%rdi),%rbp
  mov    %rdi,%rax
  cmp    $0x1,%esi
  jne    L12
  mov    $0x0,%eax
  call   <IDCT1@plt>
L43:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L44:
  mov    (%rax),%edx
  mov    %edx,0xe0(%rax)
  mov    %edx,0xc0(%rax)
  mov    %edx,0xa0(%rax)
  mov    %edx,0x80(%rax)
  mov    %edx,0x60(%rax)
  mov    %edx,0x40(%rax)
  mov    %edx,0x20(%rax)
L16:
  add    $0x4,%rax
  cmp    %rax,%rbp
  je     L52
L12:
  mov    0x20(%rax),%ecx
  mov    0x40(%rax),%r8d
  mov    0x60(%rax),%edx
  mov    0x80(%rax),%ebx
  mov    0xa0(%rax),%r10d
  mov    0xc0(%rax),%r11d
  mov    0xe0(%rax),%r9d
  mov    %ecx,%esi
  or     %r8d,%esi
  or     %edx,%esi
  or     %ebx,%esi
  or     %r10d,%esi
  or     %r11d,%esi
  or     %r9d,%esi
  je     L44
  mov    (%rax),%esi
  lea    (%rbx,%rsi,1),%r12d
  sub    %ebx,%esi
  lea    (%r8,%r11,1),%ebx
  sub    %r11d,%r8d
  imul   $0x16a,%r8d,%r8d
  sar    $0x8,%r8d
  sub    %ebx,%r8d
  lea    (%r12,%rbx,1),%r11d
  sub    %ebx,%r12d
  lea    (%rsi,%r8,1),%ebx
  sub    %r8d,%esi
  lea    (%rdx,%r10,1),%r13d
  sub    %r10d,%edx
  lea    (%rcx,%r9,1),%r8d
  sub    %r9d,%ecx
  mov    %ecx,%r10d
  sub    %edx,%r10d
  imul   $0x1d9,%r10d,%r10d
  sar    $0x8,%r10d
  lea    0x0(%r13,%r8,1),%r9d
  imul   $0x29d,%edx,%edx
  sar    $0x8,%edx
  add    %r10d,%edx
  sub    %r9d,%edx
  sub    %r13d,%r8d
  imul   $0x16a,%r8d,%r8d
  sar    $0x8,%r8d
  sub    %edx,%r8d
  imul   $0x115,%ecx,%ecx
  sar    $0x8,%ecx
  sub    %r10d,%ecx
  add    %r8d,%ecx
  lea    (%r11,%r9,1),%r10d
  mov    %r10d,(%rax)
  sub    %r9d,%r11d
  mov    %r11d,0xe0(%rax)
  lea    (%rbx,%rdx,1),%r9d
  mov    %r9d,0x20(%rax)
  sub    %edx,%ebx
  mov    %ebx,0xc0(%rax)
  lea    (%rsi,%r8,1),%edx
  mov    %edx,0x40(%rax)
  sub    %r8d,%esi
  mov    %esi,0xa0(%rax)
  lea    (%r12,%rcx,1),%edx
  mov    %edx,0x80(%rax)
  sub    %ecx,%r12d
  mov    %r12d,0x60(%rax)
  jmp    L16
L52:
  lea    0x100(%rdi),%r10
  jmp    L25
L78:
  mov    (%rdi),%eax
  sar    $0x5,%eax
  mov    %eax,0x1c(%rdi)
  mov    %eax,0x18(%rdi)
  mov    %eax,0x14(%rdi)
  mov    %eax,0x10(%rdi)
  mov    %eax,0xc(%rdi)
  mov    %eax,0x8(%rdi)
  mov    %eax,0x4(%rdi)
  mov    %eax,(%rdi)
L46:
  add    $0x20,%rdi
  cmp    %rdi,%r10
  je     L43
L25:
  mov    0x4(%rdi),%edx
  mov    0x8(%rdi),%esi
  mov    0xc(%rdi),%eax
  mov    0x10(%rdi),%ebx
  mov    0x14(%rdi),%r9d
  mov    0x18(%rdi),%r11d
  mov    0x1c(%rdi),%r8d
  mov    %edx,%ecx
  or     %esi,%ecx
  or     %eax,%ecx
  or     %ebx,%ecx
  or     %r9d,%ecx
  or     %r11d,%ecx
  or     %r8d,%ecx
  je     L78
  mov    (%rdi),%ecx
  lea    (%rbx,%rcx,1),%ebp
  sub    %ebx,%ecx
  lea    (%rsi,%r11,1),%ebx
  sub    %r11d,%esi
  imul   $0x16a,%esi,%esi
  sar    $0x8,%esi
  sub    %ebx,%esi
  lea    0x0(%rbp,%rbx,1),%r11d
  sub    %ebx,%ebp
  lea    (%rcx,%rsi,1),%ebx
  sub    %esi,%ecx
  lea    (%rax,%r9,1),%r12d
  sub    %r9d,%eax
  lea    (%rdx,%r8,1),%esi
  sub    %r8d,%edx
  mov    %edx,%r9d
  sub    %eax,%r9d
  imul   $0x1d9,%r9d,%r9d
  sar    $0x8,%r9d
  lea    (%r12,%rsi,1),%r8d
  imul   $0x29d,%eax,%eax
  sar    $0x8,%eax
  add    %r9d,%eax
  sub    %r8d,%eax
  sub    %r12d,%esi
  imul   $0x16a,%esi,%esi
  sar    $0x8,%esi
  sub    %eax,%esi
  imul   $0x115,%edx,%edx
  sar    $0x8,%edx
  sub    %r9d,%edx
  add    %esi,%edx
  lea    (%r11,%r8,1),%r9d
  sar    $0x5,%r9d
  mov    %r9d,(%rdi)
  sub    %r8d,%r11d
  sar    $0x5,%r11d
  mov    %r11d,0x1c(%rdi)
  lea    (%rbx,%rax,1),%r8d
  sar    $0x5,%r8d
  mov    %r8d,0x4(%rdi)
  sub    %eax,%ebx
  sar    $0x5,%ebx
  mov    %ebx,0x18(%rdi)
  lea    (%rcx,%rsi,1),%eax
  sar    $0x5,%eax
  mov    %eax,0x8(%rdi)
  sub    %esi,%ecx
  sar    $0x5,%ecx
  mov    %ecx,0x14(%rdi)
  lea    0x0(%rbp,%rdx,1),%eax
  sar    $0x5,%eax
  mov    %eax,0x10(%rdi)
  sub    %edx,%ebp
  sar    $0x5,%ebp
  mov    %ebp,0xc(%rdi)
  jmp    L46
```

assistant: ```c
void IDCT(int *block, int k) {
  int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  int z5, z10, z11, z12, z13;
  int *ptr;
  int i;
  switch (k) {
  case 1:
    IDCT1(block);
    return;
  }
  ptr = block;
  for (i = 0; i < 8; i++, ptr++) {
    if ((ptr[8 * 1] | ptr[8 * 2] | ptr[8 * 3] | ptr[8 * 4] | ptr[8 * 5] | ptr[8 * 6] | ptr[8 * 7]) == 0) {
      ptr[8 * 0] = ptr[8 * 1] = ptr[8 * 2] = ptr[8 * 3] = ptr[8 * 4] = ptr[8 * 5] = ptr[8 * 6] = ptr[8 * 7] = ptr[8 * 0];
      continue;
    }
    z10 = ptr[8 * 0] + ptr[8 * 4];
    z11 = ptr[8 * 0] - ptr[8 * 4];
    z13 = ptr[8 * 2] + ptr[8 * 6];
    z12 = ((((ptr[8 * 2] - ptr[8 * 6]) * ((362))) >> (8))) - z13;
    tmp0 = z10 + z13;
    tmp3 = z10 - z13;
    tmp1 = z11 + z12;
    tmp2 = z11 - z12;
    z13 = ptr[8 * 3] + ptr[8 * 5];
    z10 = ptr[8 * 3] - ptr[8 * 5];
    z11 = ptr[8 * 1] + ptr[8 * 7];
    z12 = ptr[8 * 1] - ptr[8 * 7];
    z5 = ((((z12 - z10) * ((473))) >> (8)));
    tmp7 = z11 + z13;
    tmp6 = ((((z10) * ((669))) >> (8))) + z5 - tmp7;
    tmp5 = ((((z11 - z13) * ((362))) >> (8))) - tmp6;
    tmp4 = ((((z12) * ((277))) >> (8))) - z5 + tmp5;
    ptr[8 * 0] = (tmp0 + tmp7);
    ptr[8 * 7] = (tmp0 - tmp7);
    ptr[8 * 1] = (tmp1 + tmp6);
    ptr[8 * 6] = (tmp1 - tmp6);
    ptr[8 * 2] = (tmp2 + tmp5);
    ptr[8 * 5] = (tmp2 - tmp5);
    ptr[8 * 4] = (tmp3 + tmp4);
    ptr[8 * 3] = (tmp3 - tmp4);
  }
  ptr = block;
  for (i = 0; i < 8; i++, ptr += 8) {
    if ((ptr[1] | ptr[2] | ptr[3] | ptr[4] | ptr[5] | ptr[6] | ptr[7]) == 0) {
      ptr[0] = ptr[1] = ptr[2] = ptr[3] = ptr[4] = ptr[5] = ptr[6] = ptr[7] = (((ptr[0]) >> (2 + 3)));
      ;
      continue;
    }
    z10 = ptr[0] + ptr[4];
    z11 = ptr[0] - ptr[4];
    z13 = ptr[2] + ptr[6];
    z12 = ((((ptr[2] - ptr[6]) * ((362))) >> (8))) - z13;
    tmp0 = z10 + z13;
    tmp3 = z10 - z13;
    tmp1 = z11 + z12;
    tmp2 = z11 - z12;
    z13 = ptr[3] + ptr[5];
    z10 = ptr[3] - ptr[5];
    z11 = ptr[1] + ptr[7];
    z12 = ptr[1] - ptr[7];
    z5 = ((((z12 - z10) * ((473))) >> (8)));
    tmp7 = z11 + z13;
    tmp6 = ((((z10) * ((669))) >> (8))) + z5 - tmp7;
    tmp5 = ((((z11 - z13) * ((362))) >> (8))) - tmp6;
    tmp4 = ((((z12) * ((277))) >> (8))) - z5 + tmp5;
    ptr[0] = (((tmp0 + tmp7) >> (2 + 3)));
    ;
    ptr[7] = (((tmp0 - tmp7) >> (2 + 3)));
    ;
    ptr[1] = (((tmp1 + tmp6) >> (2 + 3)));
    ;
    ptr[6] = (((tmp1 - tmp6) >> (2 + 3)));
    ;
    ptr[2] = (((tmp2 + tmp5) >> (2 + 3)));
    ;
    ptr[5] = (((tmp2 - tmp5) >> (2 + 3)));
    ;
    ptr[4] = (((tmp3 + tmp4) >> (2 + 3)));
    ;
    ptr[3] = (((tmp3 - tmp4) >> (2 + 3)));
    ;
  }
}
```