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

```asm
<maiseg>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm2
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x3c8,%rsp
  movsd  D35(%rip),%xmm6
  mov    %rdi,0x30(%rsp)
  mov    %rsi,0x38(%rsp)
  movsd  %xmm0,(%rsp)
  pxor   %xmm0,%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x3b8(%rsp)
  xor    %eax,%eax
  comisd %xmm2,%xmm0
  movsd  %xmm6,0x20(%rsp)
  ja     L136
  movsd  (%rsp),%xmm2
  comisd %xmm6,%xmm2
  jbe    L51
L136:
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  call   <mexErrMsgTxt@plt>
L51:
  movsd  (%rsp),%xmm7
  comisd D5(%rip),%xmm7
  jbe    L207
  movsd  0x20(%rsp),%xmm6
  movl   $0x1,0x4c(%rsp)
  subsd  %xmm7,%xmm6
  movsd  %xmm6,(%rsp)
L92:
  lea    0x50(%rsp),%rax
  lea    0x170(%rsp),%rdx
  mov    %rax,0x18(%rsp)
  mov    %rax,%r14
  mov    %rdx,0x28(%rsp)
L188:
  movq   $0x0,(%rax)
  add    $0x30,%rax
  movq   $0x0,-0x28(%rax)
  movq   $0x0,-0x20(%rax)
  movq   $0x0,-0x18(%rax)
  movq   $0x0,-0x10(%rax)
  movq   $0x0,-0x8(%rax)
  cmp    %rdx,%rax
  jne    L188
  lea    0x290(%rsp),%rax
  lea    0x3b0(%rsp),%rdx
  mov    %rax,0x10(%rsp)
  nopl   (%rax)
L45:
  movq   $0x0,(%rax)
  add    $0x30,%rax
  movq   $0x0,-0x28(%rax)
  movq   $0x0,-0x20(%rax)
  movq   $0x0,-0x18(%rax)
  movq   $0x0,-0x10(%rax)
  movq   $0x0,-0x8(%rax)
  cmp    %rdx,%rax
  jne    L45
  mov    0x28(%rsp),%rax
  mov    0x10(%rsp),%rdx
  mov    %rax,%rbp
  nopl   (%rax)
L1:
  movq   $0x0,(%rax)
  add    $0x30,%rax
  movq   $0x0,-0x28(%rax)
  movq   $0x0,-0x20(%rax)
  movq   $0x0,-0x18(%rax)
  movq   $0x0,-0x10(%rax)
  movq   $0x0,-0x8(%rax)
  cmp    %rdx,%rax
  jne    L1
  mov    $0x1,%r13d
  mov    0x18(%rsp),%r15
  mov    %rbp,0x40(%rsp)
  mov    %r13d,%ebp
L205:
  pxor   %xmm7,%xmm7
  mov    %r15,%r13
  mov    $0xfffffffe,%r12d
  cvtsi2sd %ebp,%xmm7
  movsd  %xmm7,0x8(%rsp)
L81:
  mov    %r12d,%edi
  mov    %ebp,%esi
  xor    %eax,%eax
  add    $0x30,%r13
  call   <aipow@plt>
  lea    -0x1(%r12),%edi
  mov    %ebp,%esi
  add    $0x1,%r12d
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <aipow@plt>
  pxor   %xmm0,%xmm0
  sub    %eax,%ebx
  cvtsi2sd %ebx,%xmm0
  divsd  0x8(%rsp),%xmm0
  movsd  %xmm0,-0x30(%r13)
  cmp    $0x1,%r12d
  jne    L81
  add    $0x1,%ebp
  add    $0x8,%r15
  cmp    $0x4,%ebp
  jne    L205
  mov    0x40(%rsp),%rbp
  mov    0x18(%rsp),%r15
  mov    $0x1,%r13d
L185:
  mov    %r13d,%esi
  mov    $0x2,%edi
  xor    %eax,%eax
  add    $0x8,%r15
  call   <aipow@plt>
  mov    %r13d,%esi
  mov    $0x1,%edi
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <aipow@plt>
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  mov    %r13d,%esi
  sub    %eax,%ebx
  cvtsi2sd %r13d,%xmm1
  mov    $0x3,%edi
  xor    %eax,%eax
  cvtsi2sd %ebx,%xmm0
  movsd  %xmm1,0x8(%rsp)
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0xd0(%r15)
  call   <aipow@plt>
  mov    %r13d,%esi
  mov    $0x2,%edi
  add    $0x1,%r13d
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <aipow@plt>
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm1
  sub    %eax,%ebx
  cvtsi2sd %ebx,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x100(%r15)
  cmp    $0x4,%r13d
  jne    L185
  mov    $0x1,%ebx
L160:
  pxor   %xmm1,%xmm1
  movsd  (%rsp),%xmm0
  add    $0x8,%r14
  cvtsi2sd %ebx,%xmm1
  add    $0x1,%ebx
  movsd  %xmm1,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x88(%r14)
  movsd  (%rsp),%xmm0
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm2
  movsd  0x20(%rsp),%xmm0
  subsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0xa0(%r14)
  cmp    $0x4,%ebx
  jne    L160
  mov    0x18(%rsp),%rdi
  mov    $0x6,%esi
  xor    %eax,%eax
  mov    $0x1,%r13d
  call   <matinv@plt>
  mov    %rbp,0x20(%rsp)
L150:
  pxor   %xmm2,%xmm2
  lea    -0x1(%r13),%r14d
  mov    $0x2,%r15d
  mov    $0xffffffff,%ebx
  cvtsi2sd %r13d,%xmm2
  movslq %r14d,%r14
  movsd  %xmm2,0x8(%rsp)
L43:
  mov    %ebx,%edi
  mov    %r13d,%esi
  xor    %eax,%eax
  call   <aipow@plt>
  lea    -0x1(%rbx),%edi
  mov    %r13d,%esi
  add    $0x1,%ebx
  mov    %eax,%ebp
  xor    %eax,%eax
  movslq %ebx,%rbx
  call   <aipow@plt>
  mov    %r13d,%esi
  mov    $0x2,%edi
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <aipow@plt>
  sub    %r12d,%ebp
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  mov    %eax,%r8d
  add    %ebp,%ebp
  lea    (%rbx,%rbx,2),%rax
  xor    %ebx,%ebx
  cvtsi2sd %r8d,%xmm1
  mulsd  0x8(%rsp),%xmm1
  lea    (%r14,%rax,2),%rax
  cvtsi2sd %ebp,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x290(%rsp,%rax,8)
  cmp    $0x1,%r15d
  jne    L211
  add    $0x1,%r13d
  cmp    $0x4,%r13d
  jne    L150
  lea    0x2a8(%rsp),%r12
  mov    $0x1,%r14d
L88:
  pxor   %xmm7,%xmm7
  mov    %r12,%r13
  mov    $0x2,%r15d
  cvtsi2sd %r14d,%xmm7
  movsd  %xmm7,0x8(%rsp)
L210:
  mov    %r15d,%edi
  mov    %r14d,%esi
  xor    %eax,%eax
  add    $0x30,%r13
  call   <aipow@plt>
  lea    -0x1(%r15),%edi
  mov    %r14d,%esi
  add    $0x1,%r15d
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <aipow@plt>
  mov    %r14d,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  xor    %eax,%eax
  call   <aipow@plt>
  sub    %ebp,%ebx
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm1
  mulsd  0x8(%rsp),%xmm1
  add    %ebx,%ebx
  cvtsi2sd %ebx,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x60(%r13)
  cmp    $0x5,%r15d
  jne    L210
  mov    0x10(%rsp),%rbx
  mov    $0x1,%r15d
L217:
  pxor   %xmm1,%xmm1
  movsd  (%rsp),%xmm0
  add    $0x8,%rbx
  cvtsi2sd %r15d,%xmm1
  add    $0x1,%r15d
  movsd  %xmm1,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  mov    D5(%rip),%rax
  addsd  %xmm0,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x58(%rbx)
  movq   %rax,%xmm0
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  movq   %xmm0,%rbp
  movsd  (%rsp),%xmm0
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm3
  movq   %rbp,%xmm0
  subsd  %xmm3,%xmm0
  addsd  %xmm0,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x70(%rbx)
  cmp    $0x4,%r15d
  jne    L217
  add    $0x1,%r14d
  add    $0x8,%r12
  cmp    $0x4,%r14d
  jne    L88
  mov    0x28(%rsp),%r9
  mov    0x18(%rsp),%rcx
  mov    $0x6,%edx
  xor    %eax,%eax
  mov    0x10(%rsp),%rdi
  mov    $0x6,%r8d
  mov    $0x6,%esi
  mov    0x20(%rsp),%rbp
  call   <matmpy@plt>
  mov    0x4c(%rsp),%eax
  test   %eax,%eax
  jne    L169
  mov    0x30(%rsp),%rcx
  mov    0x38(%rsp),%rdx
  lea    0x2f(%rcx),%rax
  sub    %rdx,%rax
  cmp    $0x5e,%rax
  jbe    L114
  movdqa 0x1d0(%rsp),%xmm7
  movdqa 0x1e0(%rsp),%xmm3
  movdqa 0x1f0(%rsp),%xmm4
  movdqa 0x200(%rsp),%xmm5
  movdqa 0x220(%rsp),%xmm2
  movups %xmm7,(%rcx)
  movdqa 0x210(%rsp),%xmm7
  movups %xmm3,0x10(%rcx)
  movups %xmm4,0x20(%rcx)
  movups %xmm5,(%rdx)
  movups %xmm7,0x10(%rdx)
  movups %xmm2,0x20(%rdx)
L85:
  mov    0x30(%rsp),%rax
  movq   $0x0,0x30(%rax)
  mov    0x38(%rsp),%rax
  movq   $0x0,0x30(%rax)
L64:
  mov    0x3b8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L164
  add    $0x3c8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L211:
  mov    $0x1,%r15d
  jmp    L43
  nopl   0x0(%rax,%rax,1)
L207:
  movl   $0x0,0x4c(%rsp)
  jmp    L92
  nopl   (%rax)
L169:
  mov    0x30(%rsp),%rdx
  mov    0x38(%rsp),%rcx
  mov    $0x8,%eax
  movq   $0x0,(%rdx)
  movq   $0x0,(%rcx)
  nopl   (%rax)
L111:
  movsd  0x88(%rbp),%xmm0
  sub    $0x8,%rbp
  movsd  %xmm0,(%rcx,%rax,1)
  movsd  0xc0(%rbp),%xmm0
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    $0x38,%rax
  jne    L111
  jmp    L64
L114:
  mov    0x30(%rsp),%rsi
  mov    0x38(%rsp),%rdi
  xor    %eax,%eax
  lea    0x1d0(%rsp),%rcx
  lea    0x200(%rsp),%rdx
L49:
  movsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rsi,%rax,1)
  movsd  (%rdx,%rax,1),%xmm0
  movsd  %xmm0,(%rdi,%rax,1)
  add    $0x8,%rax
  cmp    $0x30,%rax
  jne    L49
  jmp    L85
L164:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D35
type: f32[2]
name: parse_data
arguments: tag: D18
type: string
name: parse_data
arguments: tag: D5
type: f32

tool: {"D35": [0.0,1.875]}

tool: D18: eta0 out of range in maiseg

tool: D5: 0

assistant: ```c
void maiseg(eta0, SegFiltLeft, SegFiltRight) double eta0, SegFiltLeft[], SegFiltRight[];
{
  int flip;
  int lp1, kp1, kpp1, kpp2, ll;
  double Mmat[2 * 2 + 2][2 * 2 + 2], Pmat[2 * 2 + 2][2 * 2 + 2], Jmat[2 * 2 + 2][2 * 2 + 2];
  if ((2 % 2) || 2 < 2) {
    mexErrMsgTxt("D must be an even integer >= 2 in maiseg");
  }
  if (eta0 < 0 || eta0 > 1) {
    mexErrMsgTxt("eta0 out of range in maiseg");
  }
  if (eta0 > .5) {
    flip = 1;
    eta0 = 1 - eta0;
  } else
    flip = 0;
  for (kp1 = 0; kp1 < 2 * 2 + 2; kp1++)
    for (lp1 = 0; lp1 < 2 * 2 + 2; lp1++)
      Mmat[kp1][lp1] = 0.;
  for (kp1 = 0; kp1 < 2 * 2 + 2; kp1++)
    for (lp1 = 0; lp1 < 2 * 2 + 2; lp1++)
      Jmat[kp1][lp1] = 0.;
  for (kp1 = 0; kp1 < 2 * 2 + 2; kp1++)
    for (lp1 = 0; lp1 < 2 * 2 + 2; lp1++)
      Pmat[kp1][lp1] = 0.;
  for (kp1 = 1; kp1 <= (2 + 1); kp1++) {
    for (lp1 = -2; lp1 <= 0; lp1++) {
      Mmat[2 + lp1][kp1 - 1] = (aipow(lp1, kp1) - aipow(lp1 - 1, kp1)) / ((double)kp1);
    }
  }
  for (kp1 = 1; kp1 <= (2 + 1); kp1++)
    for (lp1 = 2; lp1 <= (2 + 1); lp1++)
      Mmat[2 + lp1][2 + kp1] = (aipow(lp1, kp1) - aipow(lp1 - 1, kp1)) / ((double)kp1);
  for (kp1 = 1; kp1 <= (2 + 1); kp1++) {
    Mmat[2 + 1][kp1 - 1] = (pow(eta0, kp1)) / ((double)kp1);
    Mmat[2 + 1][2 + kp1] = (1 - pow(eta0, kp1)) / ((double)kp1);
  }
  matinv(&(Mmat[0][0]), 2 * 2 + 2);
  for (kpp1 = 1; kpp1 <= (2 + 1); kpp1++) {
    for (lp1 = (-2 + 1); lp1 <= 0; lp1++) {
      Jmat[2 + lp1 - 1][kpp1 - 1] = 2 * (aipow(lp1, kpp1) - aipow(lp1 - 1, kpp1)) / (aipow(2, kpp1) * (double)kpp1);
    }
  }
  for (kpp2 = 1; kpp2 <= (2 + 1); kpp2++) {
    for (lp1 = 2; lp1 <= (2 + 2); lp1++)
      Jmat[2 + lp1 - 1][2 + kpp2] = 2 * (aipow(lp1, kpp2) - aipow(lp1 - 1, kpp2)) / (aipow(2, kpp2) * (double)kpp2);
    for (kpp1 = 1; kpp1 <= (2 + 1); kpp1++) {
      Jmat[2][kpp1 - 1] = 2 * (pow(eta0, kpp1)) / ((double)kpp1);
      Jmat[2][2 + kpp1] = 2 * (pow(.5, kpp1) - pow(eta0, kpp1)) / ((double)kpp1);
    }
  }
  matmpy(&(Jmat[0][0]), 2 * 2 + 2, 2 * 2 + 2, &(Mmat[0][0]), 2 * 2 + 2, &(Pmat[0][0]));
  if (flip == 0) {
    for (ll = 0; ll < 2 * 2 + 2; ll++) {
      SegFiltLeft[ll] = Pmat[2][ll];
      SegFiltRight[ll] = Pmat[2 + 1][ll];
    }
    SegFiltLeft[2 * 2 + 2] = 0.0;
    SegFiltRight[2 * 2 + 2] = 0.0;
  } else {
    SegFiltLeft[0] = 0.0;
    SegFiltRight[0] = 0.0;
    for (ll = 0; ll < 2 * 2 + 2; ll++) {
      SegFiltRight[ll + 1] = Pmat[2][2 * 2 + 1 - ll];
      SegFiltLeft[ll + 1] = Pmat[2 + 1][2 * 2 + 1 - ll];
    }
  }
}
```