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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x6,-0x44(%rbp)
  je     L121
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x50(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L121:
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x50(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <omp_set_num_threads@plt>
  lea    D64(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x50(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rdx
  mov    -0x50(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rsi
  mov    -0x50(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    -0x3c(%rbp),%rdi
  lea    -0x40(%rbp),%rcx
  mov    %rdi,%r8
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <gethead@plt>
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L71
  cmpq   $0x0,-0x28(%rbp)
  jne    L15
L71:
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpq   $0x0,-0x30(%rbp)
  je     L0
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L0:
  cmpq   $0x0,-0x28(%rbp)
  je     L125
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L125:
  mov    $0x1,%edi
  call   <exit@plt>
L15:
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x40(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L52
  cmpq   $0x0,-0x18(%rbp)
  je     L52
  cmpq   $0x0,-0x10(%rbp)
  jne    L18
L52:
  lea    D67(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpq   $0x0,-0x30(%rbp)
  je     L86
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L86:
  cmpq   $0x0,-0x28(%rbp)
  je     L123
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L123:
  cmpq   $0x0,-0x20(%rbp)
  je     L65
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L65:
  cmpq   $0x0,-0x18(%rbp)
  je     L87
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L87:
  cmpq   $0x0,-0x10(%rbp)
  je     L135
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L135:
  mov    $0x1,%edi
  call   <exit@plt>
L18:
  mov    -0x3c(%rbp),%r8d
  mov    -0x40(%rbp),%edi
  mov    -0x50(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rdx
  mov    -0x50(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rsi
  mov    -0x50(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    -0x20(%rbp),%r9
  mov    -0x10(%rbp),%r10
  mov    -0x18(%rbp),%rcx
  push   %r8
  push   %rdi
  push   -0x28(%rbp)
  push   -0x30(%rbp)
  mov    %r10,%r8
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <getdata@plt>
  add    $0x20,%rsp
  mov    -0x50(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  lea    D68(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x3c(%rbp),%r8d
  mov    -0x40(%rbp),%r9d
  mov    D12(%rip),%rdi
  mov    -0x28(%rbp),%r10
  mov    -0x30(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    -0x20(%rbp),%rax
  push   %r8
  mov    -0x34(%rbp),%r8d
  push   %r8
  movq   %rdi,%xmm0
  mov    %r10,%r8
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <cgm_CRS@plt>
  add    $0x10,%rsp
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L61
  call   <__stack_chk_fail@plt>
L61:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D71
type: string
name: retrieve_data
arguments: data_tag: D28
type: string
name: retrieve_data
arguments: data_tag: D57
type: string
name: retrieve_data
arguments: data_tag: D64
type: string
name: retrieve_data
arguments: data_tag: D1
type: string
name: retrieve_data
arguments: data_tag: D67
type: string
name: retrieve_data
arguments: data_tag: D68
type: string
name: retrieve_data
arguments: data_tag: D12
type: byte[8]

tool: D71: Usage 

tool: D28: %s colval ptr bx maxloop thread


tool: D57: --set OpenMP

tool: D64: --check error

tool: D1: malloc b x error

tool: D67: malloc val col ptr error

tool: D68: --result--

tool: {"D12": [0xbb,0xbd,0xd7,0xd9,0xdf,0x7c,0xdb,0x3d]}

assistant: ```c
int main(int argc, char const *argv[]) {
  int N;
  int M;
  int MAX;
  double *b;
  double *x;
  double *val;
  int *col;
  int *ptr;
  if (argc != 6) {
    printf("Usage \n");
    printf("%s colval ptr bx maxloop thread\n", argv[0]);
    exit(0);
  }
  printf("--set OpenMP\n");
  omp_set_num_threads(atoi(argv[5]));
  printf("--check error\n");
  gethead(argv[1], argv[2], argv[3], &N, &M);
  b = (double *)malloc(sizeof(double) * N);
  x = (double *)malloc(sizeof(double) * N);
  if (!b || !x) {
    printf("malloc b x error");
    if (b)
      free(b);
    if (x)
      free(x);
    exit(1);
  }
  val = (double *)malloc(sizeof(double) * M);
  col = (int *)malloc(sizeof(int) * M);
  ptr = (int *)malloc(sizeof(int) * (N + 1));
  if (!val || !col || !ptr) {
    printf("malloc val col ptr error");
    if (b)
      free(b);
    if (x)
      free(x);
    if (val)
      free(val);
    if (col)
      free(col);
    if (ptr)
      free(ptr);
    exit(1);
  }
  getdata(argv[1], argv[2], argv[3], col, ptr, val, b, x, N, M);
  int alpha = atoi(argv[4]);
  MAX = alpha;
  printf("--result--\n");
  cgm_CRS(val, col, ptr, b, x, N, 1e-10, MAX, M);
  free(b);
  free(x);
  free(val);
  free(col);
  free(ptr);
  return 0;
}
```