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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    0x8(%rsi),%rdi
  lea    D74(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L118
L110:
  mov    %rsp,%rdx
  lea    D49(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  cmpl   $0x0,(%rsp)
  jle    L76
L11:
  mov    (%rsp),%edi
  shl    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L92
L38:
  mov    (%rsp),%edi
  shl    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L64
L30:
  mov    %r13,%rbp
  mov    %r14,%rbx
  lea    D58(%rip),%r15
  jmp    L115
L118:
  lea    D46(%rip),%rdi
  call   <error@plt>
  jmp    L110
L76:
  lea    D71(%rip),%rdi
  call   <error@plt>
  jmp    L11
L92:
  lea    D80(%rip),%rdi
  call   <error@plt>
  jmp    L38
L64:
  lea    D69(%rip),%rdi
  call   <error@plt>
  jmp    L30
L77:
  lea    0x8(%rbp),%rcx
  lea    0x8(%rbx),%r9
  mov    %rbx,%r8
  mov    %rbp,%rdx
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  add    $0x10,%rbp
  add    $0x10,%rbx
L115:
  mov    %r12,%rdi
  call   <feof@plt>
  test   %eax,%eax
  je     L77
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  movl   $0x1,0x4(%rsp)
  lea    0x10(%rsp),%rbx
  lea    0x8(%rsp),%rcx
  mov    %rbx,%r9
  lea    0x4(%rsp),%r8
  mov    (%rsp),%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <ellipse_fit_with_gradients@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  lea    D50(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x38(%rsp),%r12
  lea    D51(%rip),%rbp
L93:
  movsd  (%rbx),%xmm0
  mov    %rbp,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L93
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L69
  mov    $0x0,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D74
type_infered: string
name: parse_data
arguments: data_tag: D49
type_infered: string
name: parse_data
arguments: data_tag: D58
type_infered: string
name: parse_data
arguments: data_tag: D46
type_infered: string
name: parse_data
arguments: data_tag: D71
type_infered: string
name: parse_data
arguments: data_tag: D80
type_infered: string
name: parse_data
arguments: data_tag: D69
type_infered: string
name: parse_data
arguments: data_tag: D50
type_infered: string
name: parse_data
arguments: data_tag: D51
type_infered: string

tool: D74: r

tool: D49: %d


tool: D58: %lf %lf %lf %lf


tool: D46: invalid input file

tool: D71: invalid points size

tool: D80: not enough memory for pts

tool: D69: not enough memory for grad

tool: D50: Ellipse parameters: 

tool: D51: %lf 

assistant: ```c
int main(int argc, char **argv) {
  int i;
  double *pts;
  double *grad;
  double param[5];
  char *fname = argv[1];
  FILE *f = fopen(fname, "r");
  if (f == NULL)
    error("invalid input file");
  int pts_size;
  fscanf(f, "%d\n", &pts_size);
  if (pts_size <= 0)
    error("invalid points size");
  pts = (double *)malloc(2 * pts_size * sizeof(double));
  if (pts == NULL)
    error("not enough memory for pts");
  grad = (double *)malloc(2 * pts_size * sizeof(double));
  if (grad == NULL)
    error("not enough memory for grad");
  for (i = 0; i < pts_size, !feof(f); ++i) {
    fscanf(f, "%lf %lf %lf %lf\n", &(pts[2 * i]), &(pts[2 * i + 1]), &(grad[2 * i]), &(grad[2 * i + 1]));
  }
  double *buff = (double *)malloc(sizeof(double));
  int size_buff_max = 1;
  ellipse_fit_with_gradients(pts, grad, pts_size, &buff, &size_buff_max, param);
  free(buff);
  printf("Ellipse parameters: ");
  for (i = 0; i < 5; ++i)
    printf("%lf ", param[i]);
  printf("\n");
  return 0;
}
```