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

```asm
<filter_image>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r13
  mov    %rsi,%rbp
  mov    %rdx,%rbx
  mov    %rcx,0x18(%rsp)
  mov    %r8,%r12
  mov    %r9,%rdx
  mov    %r9,0x8(%rsp)
  mov    0x78(%rsp),%rsi
  mov    0x70(%rsp),%edi
  mov    $0x0,%eax
  call   <setup_filters@plt>
  mov    0x70(%rsp),%eax
  sub    $0x2,%eax
  cmp    $0x1,%eax
  mov    $0x1,%eax
  cmova  0x70(%rsp),%eax
  mov    %eax,0x70(%rsp)
  cmp    $0x4,%r12
  mov    $0xff,%edx
  mov    $0x10,%eax
  cmovne %edx,%eax
  mov    %eax,%r12d
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    -0x1(%rbx),%rax
  mov    %rax,0x28(%rsp)
  cmp    $0x1,%rax
  jle    L29
  add    $0x8,%r13
  lea    -0x2(%rbx),%rax
  mov    %rax,0x20(%rsp)
  mov    $0x1,%ebx
  jmp    L102
L108:
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L103
L40:
  add    $0x8,%r15
  add    $0x6,%rdi
  cmp    %rdi,%r10
  je     L110
L44:
  mov    %rdi,%r8
  mov    $0x0,%edx
  mov    %r9,%rsi
  add    -0x8(%r15),%rsi
L101:
  movswl -0x2(%rsi,%rdx,1),%ecx
  movswl (%r8,%rdx,1),%r14d
  imul   %r14d,%ecx
  add    %ecx,%eax
  add    $0x2,%rdx
  cmp    $0x6,%rdx
  jne    L101
  jmp    L40
L110:
  mov    0x0(%rbp,%rbx,8),%rcx
  cltd
  idivl  0x70(%rsp)
  test   %eax,%eax
  mov    $0x0,%edx
  cmovs  %edx,%eax
  cmp    %r12d,%eax
  cmovg  %r12d,%eax
  mov    %ax,(%rcx,%r9,1)
  add    $0x1,%r11d
  add    $0x2,%r9
  cmp    0x10(%rsp),%r11d
  je     L37
L113:
  mov    0x8(%rsp),%rdi
  mov    %r13,%r15
  mov    $0x0,%eax
  jmp    L44
L37:
  mov    0x14(%rsp),%esi
  add    $0x1,%esi
  cmp    0x20(%rsp),%rbx
  je     L29
  movslq %esi,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %esi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  cmp    %eax,%esi
  je     L108
L103:
  add    $0x1,%rbx
  add    $0x8,%r13
L102:
  mov    %ebx,0x14(%rsp)
  mov    0x18(%rsp),%rax
  cmp    $0x2,%rax
  jle    L37
  sub    $0x1,%eax
  mov    %eax,0x10(%rsp)
  mov    $0x2,%r9d
  mov    $0x1,%r11d
  mov    0x8(%rsp),%rax
  lea    0x12(%rax),%r10
  jmp    L113
L29:
  mov    0x18(%rsp),%rcx
  sub    $0x1,%rcx
  mov    0x28(%rsp),%rdx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fix_edges@plt>
  mov    $0x1,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: tag: D4
data_type: string

tool: D4: %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);
}
```