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

```asm
<writeIntArrtoFile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %rcx,%r15
  mov    %r8d,0x1c(%rsp)
  mov    %r9d,%ebx
  mov    0x80(%rsp),%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    D2(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    %rax,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D11(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbp,%rcx
  mov    $0x11,%edx
  mov    $0x1,%esi
  lea    D41(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rdx
  lea    D28(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebx,%ecx
  mov    0x1c(%rsp),%r12d
  mov    %r12d,%edx
  lea    D55(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %ebx,%ebx
  jle    L23
  lea    -0x1(%r12),%eax
  add    $0x1,%rax
  mov    %rax,%rdx
  shl    $0x4,%rdx
  sub    %rax,%rdx
  shl    $0x5,%rdx
  mov    %rdx,0x8(%rsp)
  mov    %ebx,%ebx
  lea    0x0(,%rbx,4),%rax
  mov    %rax,0x20(%rsp)
  movq   $0x0,0x10(%rsp)
  lea    0x37(%rsp),%r12
  jmp    L1
L33:
  mov    0x0(%r13,%rbx,1),%eax
  mov    %al,0x37(%rsp)
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  mov    (%r14,%rbx,1),%eax
  mov    %al,0x37(%rsp)
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  mov    (%r15,%rbx,1),%eax
  mov    %al,0x37(%rsp)
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  add    $0x1e0,%rbx
  cmp    0x8(%rsp),%rbx
  jne    L33
L38:
  addq   $0x4,0x10(%rsp)
  mov    0x10(%rsp),%rax
  addq   $0x4,0x8(%rsp)
  cmp    0x20(%rsp),%rax
  je     L23
L1:
  mov    0x10(%rsp),%rbx
  cmpl   $0x0,0x1c(%rsp)
  jg     L33
  jmp    L38
L23:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rsi
  lea    D16(%rip),%rdi
  call   <printf@plt>
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L37:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D2
datatype: string
name: unpack_data
arguments: data_label: D11
datatype: string
name: unpack_data
arguments: data_label: D41
datatype: string
name: unpack_data
arguments: data_label: D28
datatype: string
name: unpack_data
arguments: data_label: D55
datatype: string
name: unpack_data
arguments: data_label: D16
datatype: string

tool: D2: w

tool: D11: P6 


tool: D41: # Filtered Image


tool: D28: # initial image:  %s


tool: D55: %ld %ld 
255


tool: D16: output image %s successfully written



assistant: ```c
void writeIntArrtoFile(char *outfilename, int C1[80][120], int C2[80][120], int C3[80][120], int nx, int ny, char *in) {
  int i, j;
  unsigned char byte;
  FILE *outimage = fopen(outfilename, "w");
  fprintf(outimage, "P6 \n");
  fprintf(outimage, "# Filtered Image\n");
  fprintf(outimage, "# initial image:  %s\n", in);
  fprintf(outimage, "%ld %ld \n255\n", nx, ny);
  for (j = 0; j < ny; j++)
    for (i = 0; i < nx; i++) {
      byte = (unsigned char)(C1[i][j]);
      fwrite(&byte, sizeof(unsigned char), 1, outimage);
      byte = (unsigned char)(C2[i][j]);
      fwrite(&byte, sizeof(unsigned char), 1, outimage);
      byte = (unsigned char)(C3[i][j]);
      fwrite(&byte, sizeof(unsigned char), 1, outimage);
    }
  fclose(outimage);
  printf("output image %s successfully written\n\n", outfilename);
}
```