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    D110(%rip),%r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rdx
  mov    %rdx,-0x38(%rbp)
  xor    %edx,%edx
  cmp    $0x1,%edi
  jle    L44
  mov    0x8(%rsi),%r12
L44:
  mov    %r12,%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  lea    D94(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  lea    -0x228000(%rsp),%rax
  test   %r12,%r12
  je     L132
L68:
  cmp    %rax,%rsp
  je     L54
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L68
L54:
  sub    $0x400,%rsp
  orq    $0x0,0x3f8(%rsp)
  mov    %rsp,%r13
  lea    -0x228000(%rsp),%rax
L38:
  cmp    %rax,%rsp
  je     L16
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L38
L132:
  lea    D84(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L140:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L74
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L16:
  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    L25
L52:
  mov    -0x50(%rbp),%rdi
  lea    0xbc0(%r13),%rcx
  lea    0x228fc0(%r13),%r8
  mov    %r13,%rsi
L148:
  mov    %rdi,%rax
  mov    %rsi,%rdx
  nopl   0x0(%rax)
L152:
  movdqu (%rdx),%xmm0
  add    $0x10,%rdx
  add    $0x2f00,%rax
  pshufd $0x55,%xmm0,%xmm1
  movd   %xmm0,-0x2f00(%rax)
  movd   %xmm1,-0x2340(%rax)
  movdqa %xmm0,%xmm1
  punpckhdq %xmm0,%xmm1
  pshufd $0xff,%xmm0,%xmm0
  movd   %xmm1,-0x1780(%rax)
  movd   %xmm0,-0xbc0(%rax)
  cmp    %rcx,%rdx
  jne    L152
  lea    0xbc0(%rdx),%rcx
  add    $0xbc0,%rsi
  add    $0x4,%rdi
  cmp    %r8,%rcx
  jne    L148
  mov    %r12,%rcx
  mov    $0x25,%edx
  mov    $0x1,%esi
  add    $0x20,%r13
  lea    D115(%rip),%rdi
  lea    D103(%rip),%r15
  call   <fwrite@plt>
  mov    $0x2f0,%ecx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    $0x2f0,%edx
  lea    D30(%rip),%rsi
  lea    D112(%rip),%rbx
  call   <fprintf@plt>
  movl   $0x0,-0x44(%rbp)
L139:
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fwrite@plt>
  lea    -0x20(%r13),%r14
  nopw   0x0(%rax,%rax,1)
L112:
  mov    (%r14),%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <fprintf@plt>
  cmp    %r13,%r14
  jne    L112
  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    L139
  mov    %r12,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D82(%rip),%rdi
  call   <fwrite@plt>
  mov    $0x2f0,%ecx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    $0x2f0,%edx
  lea    D87(%rip),%rsi
  call   <fprintf@plt>
  mov    -0x50(%rbp),%r13
  movl   $0x0,-0x44(%rbp)
  add    $0x20,%r13
  nopl   0x0(%rax,%rax,1)
L41:
  mov    %r12,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  mov    %r15,%rdi
  call   <fwrite@plt>
  lea    -0x20(%r13),%r14
  nopl   0x0(%rax)
L90:
  mov    (%r14),%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r14
  call   <fprintf@plt>
  cmp    %r13,%r14
  jne    L90
  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    L41
  mov    %r12,%rcx
  mov    $0x19,%edx
  mov    $0x1,%esi
  lea    D78(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  jmp    L140
L25:
  lea    D99(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L52
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D110
datatype: string
name: read_data
arguments: data_tag: D114
datatype: string
name: read_data
arguments: data_tag: D94
datatype: string
name: read_data
arguments: data_tag: D84
datatype: string
name: read_data
arguments: data_tag: D115
datatype: string
name: read_data
arguments: data_tag: D103
datatype: string
name: read_data
arguments: data_tag: D30
datatype: string
name: read_data
arguments: data_tag: D112
datatype: string
name: read_data
arguments: data_tag: D82
datatype: string
name: read_data
arguments: data_tag: D87
datatype: string
name: read_data
arguments: data_tag: D78
datatype: string
name: read_data
arguments: data_tag: D99
datatype: string

tool: D110: lwe_a.h

tool: D114: Writing matrix to file %s


tool: D94: wt

tool: D84: ERROR: Could not open the file

tool: D115: #ifndef _LWE_A_H_
#define _LWE_A_H_



tool: D103:   

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


tool: D112: 0x%04X, 

tool: D82: };



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


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

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