user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D59(%rip),%r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rdx
  mov    %rdx,-0x38(%rbp)
  xor    %edx,%edx
  cmp    $0x1,%edi
  jle    L8
  mov    0x8(%rsi),%r12
L8:
  mov    %r12,%rsi
  lea    D82(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  lea    D52(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  lea    -0x228000(%rsp),%rax
  test   %r12,%r12
  je     L76
L77:
  cmp    %rax,%rsp
  je     L40
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L77
L40:
  sub    $0x400,%rsp
  orq    $0x0,0x3f8(%rsp)
  mov    %rsp,%r13
  lea    -0x228000(%rsp),%rax
L105:
  cmp    %rax,%rsp
  je     L71
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L105
L76:
  lea    D32(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L29:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L103
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L71:
  sub    $0x400,%rsp
  orq    $0x0,0x3f8(%rsp)
  mov    $0x228400,%esi
  mov    %r13,%rdi
  mov    %rsp,-0x50(%rbp)
  call   <RAND_bytes@plt>
  sub    $0x1,%eax
  jne    L48
L23:
  mov    -0x50(%rbp),%rax
  mov    %r13,%r8
  xor    %edi,%edi
  lea    0x228400(%rax),%rsi
L141:
  lea    -0x228400(%rsi),%rax
  mov    %r8,%rdx
  nopl   0x0(%rax,%rax,1)
L12:
  mov    (%rdx),%ecx
  add    $0xbc0,%rax
  add    $0x4,%rdx
  mov    %ecx,-0xbc0(%rax)
  cmp    %rsi,%rax
  jne    L12
  add    $0x1,%edi
  add    $0xbc0,%r8
  lea    0x4(%rax),%rsi
  cmp    $0x2f0,%edi
  jne    L141
  mov    %r12,%rcx
  mov    $0x25,%edx
  mov    $0x1,%esi
  add    $0x20,%r13
  lea    D81(%rip),%rdi
  lea    D101(%rip),%r15
  call   <fwrite@plt>
  mov    $0x2f0,%ecx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    $0x2f0,%edx
  lea    D51(%rip),%rsi
  lea    D0(%rip),%rbx
  call   <fprintf@plt>
  movl   $0x0,-0x44(%rbp)
L24:
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fwrite@plt>
  lea    -0x20(%r13),%r14
  nopl   0x0(%rax,%rax,1)
L70:
  mov    (%r14),%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <fprintf@plt>
  cmp    %r13,%r14
  jne    L70
  mov    %r12,%rsi
  mov    $0xa,%edi
  lea    0x20(%r14),%r13
  call   <fputc@plt>
  addl   $0x8,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  cmp    $0x8a100,%eax
  jne    L24
  mov    %r12,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D23(%rip),%rdi
  call   <fwrite@plt>
  mov    $0x2f0,%ecx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    $0x2f0,%edx
  lea    D93(%rip),%rsi
  call   <fprintf@plt>
  mov    -0x50(%rbp),%r13
  movl   $0x0,-0x44(%rbp)
  add    $0x20,%r13
  nopl   0x0(%rax,%rax,1)
L20:
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fwrite@plt>
  lea    -0x20(%r13),%r14
  nopl   0x0(%rax)
L157:
  mov    (%r14),%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <fprintf@plt>
  cmp    %r13,%r14
  jne    L157
  mov    %r12,%rsi
  mov    $0xa,%edi
  lea    0x20(%r14),%r13
  call   <fputc@plt>
  addl   $0x8,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  cmp    $0x8a100,%eax
  jne    L20
  mov    %r12,%rcx
  mov    $0x19,%edx
  mov    $0x1,%esi
  lea    D38(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  jmp    L29
L48:
  lea    D98(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L23
L103:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D59
type_guessed: string
name: retrieve_data
arguments: tag: D82
type_guessed: string
name: retrieve_data
arguments: tag: D52
type_guessed: string
name: retrieve_data
arguments: tag: D32
type_guessed: string
name: retrieve_data
arguments: tag: D81
type_guessed: string
name: retrieve_data
arguments: tag: D101
type_guessed: string
name: retrieve_data
arguments: tag: D51
type_guessed: string
name: retrieve_data
arguments: tag: D0
type_guessed: string
name: retrieve_data
arguments: tag: D23
type_guessed: string
name: retrieve_data
arguments: tag: D93
type_guessed: string
name: retrieve_data
arguments: tag: D38
type_guessed: string
name: retrieve_data
arguments: tag: D98
type_guessed: string

tool: D59: lwe_a.h

tool: D82: Writing matrix to file %s


tool: D52: wt

tool: D32: ERROR: Could not open the file

tool: D81: #ifndef _LWE_A_H_
#define _LWE_A_H_



tool: D101:   

tool: D51: uint16_t lwe_a[%d * %d] = {


tool: D0: 0x%04X, 

tool: D23: };



tool: D93: uint16_t lwe_a_transpose[%d * %d] = {


tool: D38: };
#endif /* _LWE_A_H_ */

tool: D98: ERROR

assistant: ```c
int main(int argc, char *argv[]) {
  char *filename = (argc > 1) ? argv[1] : "lwe_a.h";
  printf("Writing matrix to file %s\n", filename);
  FILE *f = fopen(filename, "wt");
  if (f == NULL) {
    printf("ERROR: Could not open the file");
    return 0;
  }
  int i, j;
  int N = 752;
  uint16_t lwe_a[N * N];
  uint16_t lwe_a_transpose[N * N];
  if (1 != RAND_bytes((unsigned char *)lwe_a, N * N * sizeof(uint16_t))) {
    printf("ERROR\n");
    exit(1);
  }
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++) {
      lwe_a_transpose[j * N + i] = lwe_a[i * N + j];
    }
  fprintf(f, "#ifndef _LWE_A_H_\n#define _LWE_A_H_\n\n");
  fprintf(f, "uint16_t lwe_a[%d * %d] = {\n", N, N);
  for (i = 0; i < N * N; i += 8) {
    fprintf(f, "  ");
    for (j = 0; j < 8; j++) {
      fprintf(f, "0x%04X, ", lwe_a[i + j]);
    }
    fprintf(f, "\n");
  }
  fprintf(f, "};\n\n");
  fprintf(f, "uint16_t lwe_a_transpose[%d * %d] = {\n", N, N);
  for (i = 0; i < N * N; i += 8) {
    fprintf(f, "  ");
    for (j = 0; j < 8; j++) {
      fprintf(f, "0x%04X, ", lwe_a_transpose[i + j]);
    }
    fprintf(f, "\n");
  }
  fprintf(f, "};\n#endif /* _LWE_A_H_ */");
  fclose(f);
  return (0);
}
```