user: 请将以下的汇编代码转换成C语言代码:

```asm
<filter_image>:
  endbr64
  push   %r15
  xor    %eax,%eax
  mov    %rcx,%r15
  push   %r14
  mov    %rdx,%r14
  mov    %r9,%rdx
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    %r9,%rbx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%ebp
  mov    %rsi,0x18(%rsp)
  mov    0x68(%rsp),%rsi
  mov    %ebp,%edi
  call   <setup_filters@plt>
  lea    -0x2(%rbp),%eax
  mov    $0xa,%edi
  cmp    $0x1,%eax
  mov    $0x1,%eax
  cmovbe %eax,%ebp
  cmp    $0x4,%r13
  mov    $0x10,%eax
  mov    $0xff,%r13d
  cmove  %eax,%r13d
  call   <putchar@plt>
  lea    -0x1(%r14),%rax
  lea    -0x1(%r15),%rsi
  mov    %rax,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  cmp    $0x1,%rax
  jle    L45
  lea    -0x4(%r15,%r15,1),%r14
  mov    $0x2,%r15d
  nopl   (%rax)
L37:
  cmpq   $0x1,0x10(%rsp)
  mov    %r15d,%r10d
  jle    L26
  mov    0x18(%rsp),%rax
  mov    -0x10(%r12,%r15,8),%r8
  xor    %ecx,%ecx
  mov    -0x8(%r12,%r15,8),%rdi
  mov    (%r12,%r15,8),%rsi
  mov    -0x8(%rax,%r15,8),%r9
  nopl   0x0(%rax)
L20:
  movswl (%r8,%rcx,1),%edx
  movswl (%rbx),%eax
  movswl 0x2(%rbx),%r11d
  imul   %eax,%edx
  movswl 0x2(%r8,%rcx,1),%eax
  imul   %r11d,%eax
  movswl 0x4(%rbx),%r11d
  add    %eax,%edx
  movswl 0x4(%r8,%rcx,1),%eax
  imul   %r11d,%eax
  movswl 0x6(%rbx),%r11d
  add    %edx,%eax
  movswl (%rdi,%rcx,1),%edx
  imul   %r11d,%edx
  movswl 0x8(%rbx),%r11d
  add    %eax,%edx
  movswl 0x2(%rdi,%rcx,1),%eax
  imul   %r11d,%eax
  movswl 0xa(%rbx),%r11d
  add    %edx,%eax
  movswl 0x4(%rdi,%rcx,1),%edx
  imul   %r11d,%edx
  movswl 0xc(%rbx),%r11d
  add    %eax,%edx
  movswl (%rsi,%rcx,1),%eax
  imul   %r11d,%eax
  movswl 0xe(%rbx),%r11d
  add    %edx,%eax
  movswl 0x2(%rsi,%rcx,1),%edx
  imul   %r11d,%edx
  movswl 0x10(%rbx),%r11d
  add    %eax,%edx
  movswl 0x4(%rsi,%rcx,1),%eax
  imul   %r11d,%eax
  add    %edx,%eax
  cltd
  idiv   %ebp
  xor    %edx,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  cmp    %r13d,%eax
  cmovg  %r13d,%eax
  mov    %ax,0x2(%r9,%rcx,1)
  add    $0x2,%rcx
  cmp    %r14,%rcx
  jne    L20
L26:
  cmp    0x8(%rsp),%r15
  je     L45
  imul   $0xcccccccd,%r10d,%eax
  ror    %eax
  cmp    $0x19999999,%eax
  ja     L7
  mov    %r10d,%esi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L7:
  add    $0x1,%r15
  jmp    L37
L45:
  mov    0x10(%rsp),%rcx
  mov    0x8(%rsp),%rdx
  mov    $0x1,%esi
  xor    %eax,%eax
  mov    0x18(%rsp),%rdi
  call   <fix_edges@plt>
  add    $0x28,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D0
type: string

tool: D0: %d 

assistant: ```c
int filter_image(the_image, out_image, rows, cols, bits_per_pixel, filter, type, low_high)
int type;
short filter[3][3], **the_image, **out_image;
char low_high[];
long rows, cols, bits_per_pixel;
{
  int a, b, d, i, j, k, length, max, sum, width;
  setup_filters(type, low_high, filter);
  d = type;
  if (type == 2 || type == 3)
    d = 1;
  max = 255;
  if (bits_per_pixel == 4)
    max = 16;
  printf("\n");
  for (i = 1; i < rows - 1; i++) {
    if ((i % 10) == 0)
      printf("%d ", i);
    for (j = 1; j < cols - 1; j++) {
      sum = 0;
      for (a = -1; a < 2; a++) {
        for (b = -1; b < 2; b++) {
          sum = sum + the_image[i + a][j + b] * filter[a + 1][b + 1];
        }
      }
      sum = sum / d;
      if (sum < 0)
        sum = 0;
      if (sum > max)
        sum = max;
      out_image[i][j] = sum;
    }
  }
  fix_edges(out_image, 1, rows - 1, cols - 1);
  return (1);
}
```