user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<printMapAsPgm>:
  endbr64
  push   %r15
  push   %r14
  lea    D73(%rip),%r14
  push   %r13
  mov    %rdi,%r13
  mov    %r14,%rdi
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  lea    0x1(%rbp,%rax,1),%edi
  call   <malloc@plt>
  mov    %r12,%rsi
  lea    D68(%rip),%r12
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r15
  test   %ebx,%ebx
  je     L2
  mov    0x0(%r13),%rax
  lea    -0x1(%rbx),%edx
  mov    %ebx,%edi
  mov    $0xffffffff,%r12d
  mov    %rdx,%r10
  and    $0xfffffffc,%edi
  lea    0x8(%rax),%rsi
  mov    (%rax),%rcx
  lea    (%rsi,%rdx,8),%r11
  mov    %ebx,%edx
  shr    $0x2,%edx
  lea    -0x1(%rdx),%r9d
  add    $0x1,%r9
  shl    $0x4,%r9
  cmp    $0x2,%r10d
  jbe    L10
  nopl   0x0(%rax,%rax,1)
L110:
  movd   %r12d,%xmm3
  mov    %rcx,%rax
  lea    (%r9,%rcx,1),%rdx
  pshufd $0x0,%xmm3,%xmm2
  nopl   0x0(%rax)
L19:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  movdqa %xmm1,%xmm2
  por    %xmm0,%xmm2
  cmp    %rdx,%rax
  jne    L19
  movdqa %xmm2,%xmm1
  mov    %edi,%eax
  psrldq $0x8,%xmm1
  movdqa %xmm1,%xmm0
  pcmpgtd %xmm2,%xmm0
  pand   %xmm0,%xmm1
  pandn  %xmm2,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm2
  pandn  %xmm0,%xmm1
  por    %xmm2,%xmm1
  movd   %xmm1,%r12d
  cmp    %edi,%ebx
  je     L43
L87:
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rbp
  mov    (%rcx,%rdx,4),%edx
  cmp    %edx,%r12d
  cmovl  %edx,%r12d
  lea    0x1(%rax),%edx
  cmp    %ebx,%edx
  jae    L43
  mov    0x4(%rcx,%rbp,1),%edx
  cmp    %edx,%r12d
  cmovl  %edx,%r12d
  add    $0x2,%eax
  cmp    %ebx,%eax
  jae    L43
  mov    0x8(%rcx,%rbp,1),%eax
  cmp    %eax,%r12d
  cmovl  %eax,%r12d
L43:
  mov    %rsi,%rax
  cmp    %r11,%rsi
  je     L79
  mov    (%rax),%rcx
  add    $0x8,%rsi
  cmp    $0x2,%r10d
  ja     L110
L10:
  xor    %eax,%eax
  jmp    L87
  nopl   0x0(%rax,%rax,1)
L79:
  mov    %r15,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  xor    %ebp,%ebp
  lea    D16(%rip),%rdi
  lea    D39(%rip),%r14
  call   <fwrite@plt>
  mov    %ebx,%ecx
  mov    %ebx,%edx
  lea    D10(%rip),%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12d,%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D53(%rip),%rsi
  lea    0x0(,%rbx,4),%r12
  call   <fprintf@plt>
  lea    0x0(,%rbx,8),%rax
  mov    %rax,0x8(%rsp)
L90:
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L34:
  mov    0x0(%r13),%rax
  mov    %r14,%rsi
  mov    %r15,%rdi
  mov    (%rax,%rbp,1),%rax
  mov    (%rax,%rbx,1),%edx
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <fprintf@plt>
  cmp    %r12,%rbx
  jne    L34
  mov    %r15,%rsi
  mov    $0xa,%edi
  add    $0x8,%rbp
  call   <fputc@plt>
  cmp    0x8(%rsp),%rbp
  jne    L90
L85:
  add    $0x18,%rsp
  mov    %r15,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10e0 <fclose@plt>
L2:
  mov    %rax,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D16(%rip),%rdi
  call   <fwrite@plt>
  xor    %edx,%edx
  mov    %r15,%rdi
  xor    %ecx,%ecx
  lea    D10(%rip),%rsi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    $0xffffffff,%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D53(%rip),%rsi
  call   <fprintf@plt>
  jmp    L85
```

tool_calls: name: read_data
arguments: label: D73
type: string
name: read_data
arguments: label: D68
type: string
name: read_data
arguments: label: D16
type: string
name: read_data
arguments: label: D39
type: string
name: read_data
arguments: label: D10
type: string
name: read_data
arguments: label: D53
type: string

tool: D73: hmmap.pgm

tool: D68: w

tool: D16: P2


tool: D39: %d 

tool: D10: %u %u


tool: D53: %d


assistant: ```c
void printMapAsPgm(int ***map, const unsigned int MAP_SIZE, char *fn) {
  int i, j, max = -1;
  FILE *f;
  char *filename = (char *)malloc((strlen("hmmap.pgm") + strlen(fn)) * sizeof(char) + 1);
  strcpy(filename, fn);
  strcat(filename, "hmmap.pgm");
  f = fopen(filename, "w");
  f = fopen(filename, "w");
  for (i = 0; i < MAP_SIZE; ++i) {
    for (j = 0; j < MAP_SIZE; ++j) {
      max = max < (*map)[i][j] ? (*map)[i][j] : max;
    }
  }
  fprintf(f, "P2\n");
  fprintf(f, "%u %u\n", MAP_SIZE, MAP_SIZE);
  fprintf(f, "%d\n", max);
  for (i = 0; i < MAP_SIZE; ++i) {
    for (j = 0; j < MAP_SIZE; ++j) {
      fprintf(f, "%d ", (*map)[i][j]);
    }
    fprintf(f, "\n");
  }
  fclose(f);
}
```