user: Translate the below assembly code into C programming language:

```asm
<writePgmPictureBinary>:
  endbr64
  push   %rbp
  mov    %rdi,%r10
  mov    %rsi,%rdi
  mov    %rdx,%rsi
  mov    %r8,%rdx
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  movslq 0x10(%rbp),%r13
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%r8
  lea    0xf(%r13),%rax
  mov    %r13,%r15
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%r8
  and    $0xfffffffffffffff0,%rcx
  cmp    %r8,%rsp
  je     L19
L79:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %r8,%rsp
  jne    L79
L19:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L52
L36:
  mov    %r9d,-0x54(%rbp)
  mov    %rsp,%rbx
  mov    %rdx,-0x50(%rbp)
  mov    %r10,-0x48(%rbp)
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L0
  mov    -0x50(%rbp),%rdx
  mov    %rax,%rdi
  lea    D43(%rip),%rsi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    -0x48(%rbp),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D9(%rip),%rsi
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x41,%edx
  mov    $0x1,%esi
  lea    D10(%rip),%rdi
  call   <fwrite@plt>
  mov    -0x54(%rbp),%r9d
  mov    %r15d,%ecx
  mov    %r12,%rdi
  lea    D11(%rip),%rsi
  xor    %eax,%eax
  mov    %r9d,%edx
  mov    %r9d,-0x48(%rbp)
  call   <fprintf@plt>
  mov    0x18(%rbp),%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D14(%rip),%rsi
  call   <fprintf@plt>
  mov    -0x48(%rbp),%r9d
  test   %r9d,%r9d
  jle    L46
  lea    -0x1(%r9),%eax
  lea    0x8(%r14,%rax,8),%rax
  mov    %rax,-0x48(%rbp)
  nopl   0x0(%rax)
L60:
  test   %r15d,%r15d
  jle    L32
  mov    (%r14),%rcx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L25:
  mov    (%rcx,%rax,4),%edx
  mov    %dl,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%r13
  jne    L25
L32:
  mov    %r12,%rcx
  mov    %r15d,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <fwrite@plt>
  add    $0x8,%r14
  cmp    -0x48(%rbp),%r14
  jne    L60
L46:
  mov    %r12,%rdi
  call   <fclose@plt>
L0:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L52:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L36
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D43
datatype: string
name: extract_symbolic_data
arguments: label: D9
datatype: string
name: extract_symbolic_data
arguments: label: D10
datatype: string
name: extract_symbolic_data
arguments: label: D11
datatype: string
name: extract_symbolic_data
arguments: label: D14
datatype: string

tool: D43: %s@n

tool: D9: # This a binary image from %s@n

tool: D10: # It is automatic created by Delmas Pierre Binarisation Program@n

tool: D11: %d %d@n

tool: D14: %d@n

assistant: ```c
void writePgmPictureBinary(char *fileNameBase, char *nameFile, char *mode, int **imageMatrix, char *magicNumber, int idim, int jdim, int dynamic) {
  int row = 0;
  int column = 0;
  unsigned char line[jdim];
  FILE *file;
  file = fopen(nameFile, mode);
  if (file != NULL) {
    fprintf(file, "%s@n", magicNumber);
    fprintf(file, "# This a binary image from %s@n", fileNameBase);
    fprintf(file, "# It is automatic created by Delmas Pierre Binarisation Program@n");
    fprintf(file, "%d %d@n", idim, jdim);
    fprintf(file, "%d@n", dynamic);
    for (row = 0; row < idim; row++) {
      for (column = 0; column < jdim; column++) {
        line[column] = (unsigned char)imageMatrix[row][column];
      }
      fwrite(line, sizeof(unsigned char), jdim, file);
    }
    fclose(file);
  }
}
```