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

```asm
<ctm_fitting>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1a8,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %rdx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  lea    0x80(%rsp),%rdi
  mov    $0x48,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x40(%rsp),%rdi
  mov    $0x18,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x60(%rsp),%rdi
  mov    $0x18,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  lea    0x20(%rsp),%rdi
  mov    $0x18,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    %rsp,%rdi
  mov    $0x18,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    $0x4,%ecx
  mov    %ebx,%edx
  mov    %r12,%rsi
  lea    D19(%rip),%rdi
  call   <print_matrix@plt>
  test   %ebx,%ebx
  jle    L26
  movsd  0x80(%rsp),%xmm12
  movsd  0x88(%rsp),%xmm11
  movsd  0x90(%rsp),%xmm13
  movsd  0xa0(%rsp),%xmm10
  movsd  0xa8(%rsp),%xmm9
  movsd  0x40(%rsp),%xmm8
  movsd  0x48(%rsp),%xmm7
  movsd  0x50(%rsp),%xmm6
  movsd  0x60(%rsp),%xmm5
  movsd  0x68(%rsp),%xmm4
  movsd  0x70(%rsp),%xmm3
  mov    %r12,%rax
  lea    -0x1(%rbx),%edx
  shl    $0x5,%rdx
  lea    0x20(%r12,%rdx,1),%rdx
L47:
  movsd  (%rax),%xmm1
  movapd %xmm1,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm12
  movsd  0x8(%rax),%xmm0
  movapd %xmm1,%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm11
  addsd  %xmm1,%xmm13
  movapd %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm10
  addsd  %xmm0,%xmm9
  movsd  0x10(%rax),%xmm2
  movapd %xmm1,%xmm14
  mulsd  %xmm2,%xmm14
  addsd  %xmm14,%xmm8
  movapd %xmm0,%xmm14
  mulsd  %xmm2,%xmm14
  addsd  %xmm14,%xmm7
  addsd  %xmm2,%xmm6
  movsd  0x18(%rax),%xmm2
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm5
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm4
  addsd  %xmm2,%xmm3
  add    $0x20,%rax
  cmp    %rdx,%rax
  jne    L47
  movsd  %xmm12,0x80(%rsp)
  movsd  %xmm11,0x88(%rsp)
  movsd  %xmm13,0x90(%rsp)
  movsd  %xmm10,0xa0(%rsp)
  movsd  %xmm9,0xa8(%rsp)
  movsd  %xmm8,0x40(%rsp)
  movsd  %xmm7,0x48(%rsp)
  movsd  %xmm6,0x50(%rsp)
  movsd  %xmm5,0x60(%rsp)
  movsd  %xmm4,0x68(%rsp)
  movsd  %xmm3,0x70(%rsp)
L26:
  movsd  0x88(%rsp),%xmm0
  movsd  %xmm0,0x98(%rsp)
  movsd  0x90(%rsp),%xmm0
  movsd  %xmm0,0xb0(%rsp)
  movsd  0xa8(%rsp),%xmm0
  movsd  %xmm0,0xb8(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  movsd  %xmm0,0xc0(%rsp)
  lea    0x80(%rsp),%rbx
  mov    $0x3,%ecx
  mov    $0x3,%edx
  mov    %rbx,%rsi
  lea    D43(%rip),%rdi
  call   <print_matrix@plt>
  lea    0x40(%rsp),%r12
  mov    $0x1,%ecx
  mov    $0x3,%edx
  mov    %r12,%rsi
  lea    D59(%rip),%rdi
  call   <print_matrix@plt>
  lea    0x60(%rsp),%rsi
  mov    $0x1,%ecx
  mov    $0x3,%edx
  lea    D5(%rip),%rdi
  call   <print_matrix@plt>
  mov    %rbx,%rdx
  lea    0xd0(%rsp),%rcx
  mov    %r12,%rsi
  lea    0xc8(%rsp),%rdi
  mov    %rbx,%rax
L11:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rcx)
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,0x8(%rcx)
  movsd  0x10(%rax),%xmm0
  movsd  %xmm0,0x10(%rcx)
  movsd  (%rsi),%xmm0
  movsd  %xmm0,0x18(%rcx)
  add    $0x18,%rax
  add    $0x20,%rcx
  add    $0x8,%rsi
  cmp    %rdi,%rax
  jne    L11
  lea    0x130(%rsp),%rax
  lea    0x60(%rsp),%rcx
L24:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,0x8(%rax)
  movsd  0x10(%rdx),%xmm0
  movsd  %xmm0,0x10(%rax)
  movsd  (%rcx),%xmm0
  movsd  %xmm0,0x18(%rax)
  add    $0x18,%rdx
  add    $0x20,%rax
  add    $0x8,%rcx
  cmp    %rdi,%rdx
  jne    L24
  lea    0xd0(%rsp),%rbx
  mov    $0x4,%ecx
  mov    $0x3,%edx
  mov    %rbx,%rsi
  lea    D54(%rip),%rdi
  call   <print_matrix@plt>
  lea    0x130(%rsp),%r13
  mov    $0x4,%ecx
  mov    $0x3,%edx
  mov    %r13,%rsi
  lea    D72(%rip),%rdi
  call   <print_matrix@plt>
  mov    %rsp,%r12
  mov    $0x3,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <gauss1@plt>
  lea    0x20(%rsp),%rbx
  mov    $0x3,%edx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <gauss1@plt>
  mov    $0x1,%ecx
  mov    $0x3,%edx
  mov    %r12,%rsi
  lea    D84(%rip),%rdi
  call   <print_matrix@plt>
  mov    $0x1,%ecx
  mov    $0x3,%edx
  mov    %rbx,%rsi
  lea    D48(%rip),%rdi
  call   <print_matrix@plt>
  movsd  (%rsp),%xmm0
  movsd  %xmm0,0x0(%rbp)
  movsd  0x20(%rsp),%xmm0
  movsd  %xmm0,0x18(%rbp)
  movsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rbp)
  movsd  0x28(%rsp),%xmm0
  movsd  %xmm0,0x20(%rbp)
  movsd  0x10(%rsp),%xmm0
  movsd  %xmm0,0x10(%rbp)
  movsd  0x30(%rsp),%xmm0
  movsd  %xmm0,0x28(%rbp)
  movq   $0x0,0x30(%rbp)
  movq   $0x0,0x38(%rbp)
  mov    D50(%rip),%rax
  mov    %rax,0x40(%rbp)
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x1a8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D19
data_type: string
name: disassemble_data
arguments: data_label: D43
data_type: string
name: disassemble_data
arguments: data_label: D59
data_type: string
name: disassemble_data
arguments: data_label: D5
data_type: string
name: disassemble_data
arguments: data_label: D54
data_type: string
name: disassemble_data
arguments: data_label: D72
data_type: string
name: disassemble_data
arguments: data_label: D84
data_type: string
name: disassemble_data
arguments: data_label: D48
data_type: string
name: disassemble_data
arguments: data_label: D50
data_type: byte[8]

tool: D19: XY

tool: D43: ata

tool: D59: atx

tool: D5: aty

tool: D54: ata\atx

tool: D72: ata\aty

tool: D84: abc

tool: D48: def

tool: {"D50": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
void ctm_fitting(double *xy, int cnt, double *coeff_return) {
  int i;
  double abc[3], def[3];
  double ata[9], atx[3], aty[3];
  memset(ata, 0, sizeof ata);
  ;
  memset(atx, 0, sizeof atx);
  ;
  memset(aty, 0, sizeof aty);
  ;
  memset(def, 0, sizeof def);
  ;
  memset(abc, 0, sizeof abc);
  ;
  print_matrix("XY", xy, cnt, 4);
  for (i = 0; i < cnt; i++) {
    double *xy1 = xy + 4 * i;
    ata[0] += xy1[0] * xy1[0];
    ata[1] += xy1[0] * xy1[1];
    ata[2] += xy1[0];
    ata[4] += xy1[1] * xy1[1];
    ata[5] += xy1[1];
    atx[0] += xy1[0] * xy1[2];
    atx[1] += xy1[1] * xy1[2];
    atx[2] += xy1[2];
    aty[0] += xy1[0] * xy1[3];
    aty[1] += xy1[1] * xy1[3];
    aty[2] += xy1[3];
  }
  ata[3] = ata[1];
  ata[6] = ata[2];
  ata[7] = ata[5];
  ata[8] = cnt;
  print_matrix("ata", ata, 3, 3);
  print_matrix("atx", atx, 3, 1);
  print_matrix("aty", aty, 3, 1);
  double bgauss1[4 * 3], bgauss2[4 * 3];
  for (i = 0; i < 3; i++) {
    double *b = bgauss1 + i * 4;
    double *a = ata + i * 3;
    double *x = atx + i;
    b[0] = a[0];
    b[1] = a[1];
    b[2] = a[2];
    b[3] = x[0];
  }
  for (i = 0; i < 3; i++) {
    double *b = bgauss2 + i * 4;
    double *a = ata + i * 3;
    double *x = aty + i;
    b[0] = a[0];
    b[1] = a[1];
    b[2] = a[2];
    b[3] = x[0];
  }
  print_matrix("ata\\atx", bgauss1, 3, 4);
  print_matrix("ata\\aty", bgauss2, 3, 4);
  gauss1(bgauss1, abc, 3);
  gauss1(bgauss2, def, 3);
  print_matrix("abc", abc, 3, 1);
  print_matrix("def", def, 3, 1);
  for (i = 0; i < 3; i++) {
    coeff_return[3 * 0 + i] = abc[i];
    coeff_return[3 * 1 + i] = def[i];
  }
  coeff_return[3 * 2 + 0] = 0;
  coeff_return[3 * 2 + 1] = 0;
  coeff_return[3 * 2 + 2] = 1;
}
```