user: 请将以下的汇编代码转换成C语言代码：

```asm
<simq>:
  endbr64
  push   %r15
  lea    -0x1(%rcx),%eax
  mov    %rdx,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %r9,%r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,0x38(%rsp)
  mov    %eax,0x2c(%rsp)
  test   %r8d,%r8d
  js     L76
  test   %ecx,%ecx
  jle    L315
  mov    0x2c(%rsp),%r8d
  mov    %ecx,%r9d
  xor    %esi,%esi
  xor    %ecx,%ecx
  movq   D58(%rip),%xmm2
  movsd  D16(%rip),%xmm4
  lea    0x8(%rdi),%rdi
  pxor   %xmm3,%xmm3
  nop
L248:
  movslq %esi,%rdx
  mov    %ecx,(%r12,%rcx,4)
  movapd %xmm3,%xmm1
  lea    (%r14,%rdx,8),%rax
  add    %r8,%rdx
  lea    (%rdi,%rdx,8),%rdx
  cs nopw 0x0(%rax,%rax,1)
L21:
  movsd  (%rax),%xmm0
  add    $0x8,%rax
  andpd  %xmm2,%xmm0
  maxsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L21
  add    %r13d,%esi
  ucomisd %xmm3,%xmm0
  jp     L250
  je     L336
L250:
  movapd %xmm4,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15,%rcx,8)
  add    $0x1,%rcx
  cmp    %rcx,%r9
  jne    L248
L315:
  mov    0x2c(%rsp),%eax
  pxor   %xmm3,%xmm3
  test   %eax,%eax
  jle    L126
  mov    0x2c(%rsp),%eax
  mov    %r13d,0x4(%rsp)
  xor    %r9d,%r9d
  xor    %ebx,%ebx
  movq   D58(%rip),%xmm4
  movq   D8(%rip),%xmm2
  pxor   %xmm5,%xmm5
  mov    %eax,(%rsp)
  lea    0x10(%r14),%rax
  mov    %rax,0x30(%rsp)
  nopl   (%rax)
L151:
  cmp    %ebx,%r13d
  je     L279
  mov    %r9,%rax
  movapd %xmm5,%xmm3
  movapd %xmm5,%xmm1
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L363:
  movslq (%r12,%rax,4),%rsi
  mov    %r13d,%ecx
  imul   %esi,%ecx
  add    %ebx,%ecx
  movslq %ecx,%rcx
  movsd  (%r14,%rcx,8),%xmm0
  andpd  %xmm4,%xmm0
  mulsd  (%r15,%rsi,8),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  cmova  %eax,%edx
  add    $0x1,%rax
  movapd %xmm0,%xmm1
  movslq %edx,%rcx
  cmp    %eax,%r13d
  jg     L363
  ucomisd %xmm5,%xmm0
  jp     L300
  je     L279
L300:
  cmp    %ecx,%ebx
  je     L244
  lea    (%r12,%rcx,4),%rax
  mov    (%r12,%r9,4),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%r12,%r9,4)
  mov    %edx,(%rax)
L244:
  mov    (%r12,%r9,4),%eax
  lea    0x1(%rbx),%edi
  mov    %edi,0xc(%rsp)
  imul   %r13d,%eax
  lea    (%rax,%rbx,1),%edx
  movslq %edx,%rdx
  movsd  (%r14,%rdx,8),%xmm7
  cmp    %edi,%r13d
  jle    L348
  mov    (%rsp),%r11d
  mov    %edi,%esi
  movslq %eax,%rdi
  lea    0x1(%r9),%rbp
  lea    0x2(%r9,%rdi,1),%rdx
  mov    %rdi,0x10(%rsp)
  mov    %rbp,%r8
  mov    %r11d,%edi
  lea    0x0(,%rdx,8),%r10
  mov    %r11d,%edx
  mov    %r15,0x20(%rsp)
  and    $0xfffffffe,%edi
  shr    %edx
  lea    -0x8(%r14,%r10,1),%rcx
  mov    %r10,%r15
  add    %edi,%esi
  mov    %edi,0x8(%rsp)
  sub    $0x1,%edx
  add    %esi,%eax
  add    $0x1,%rdx
  cltq
  shl    $0x4,%rdx
  lea    (%r14,%rax,8),%rdi
  lea    -0x1(%r11),%eax
  mov    %eax,0x28(%rsp)
  add    %r9,%rax
  mov    %rax,0x18(%rsp)
  nopl   0x0(%rax)
L86:
  mov    (%r12,%r8,4),%r10d
  imul   %r13d,%r10d
  lea    (%r10,%rbx,1),%eax
  movslq %r10d,%r9
  cltq
  lea    (%r14,%rax,8),%rax
  movsd  (%rax),%xmm0
  xorpd  %xmm2,%xmm0
  divsd  %xmm7,%xmm0
  movapd %xmm0,%xmm1
  xorpd  %xmm2,%xmm1
  movsd  %xmm1,(%rax)
  lea    0x0(%rbp,%r9,1),%rax
  shl    $0x3,%rax
  cmp    %rax,%r15
  je     L210
  cmpl   $0x2,0x4(%rsp)
  je     L210
  movapd %xmm0,%xmm6
  add    %r14,%rax
  xor    %r9d,%r9d
  unpcklpd %xmm6,%xmm6
L96:
  movupd (%rcx,%r9,1),%xmm1
  movupd (%rax,%r9,1),%xmm8
  mulpd  %xmm6,%xmm1
  addpd  %xmm8,%xmm1
  movups %xmm1,(%rax,%r9,1)
  add    $0x10,%r9
  cmp    %r9,%rdx
  jne    L96
  mov    0x8(%rsp),%r11d
  cmp    %r11d,(%rsp)
  je     L99
  mulsd  (%rdi),%xmm0
  add    %esi,%r10d
  movslq %r10d,%r10
  lea    (%r14,%r10,8),%rax
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
L99:
  add    $0x1,%r8
  cmp    %r8d,%r13d
  jg     L86
  mov    0x20(%rsp),%r15
L197:
  mov    0x28(%rsp),%eax
  subl   $0x1,0x4(%rsp)
  mov    %rbp,%r9
  mov    0xc(%rsp),%ebx
  mov    %eax,(%rsp)
  cmp    %ebx,0x2c(%rsp)
  jne    L151
L126:
  movslq %r13d,%r8
  mov    -0x4(%r12,%r8,4),%eax
  imul   %r13d,%eax
  lea    -0x1(%r13,%rax,1),%eax
  cltq
  lea    (%r14,%rax,8),%r9
  ucomisd (%r9),%xmm3
  jp     L193
  jne    L193
  lea    D65(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%eax
  jmp    L162
L210:
  mov    0x18(%rsp),%r11
  add    %r14,%rax
  lea    (%r11,%r9,1),%r10
  mov    0x30(%rsp),%r11
  lea    (%r11,%r10,8),%r11
  mov    0x10(%rsp),%r10
  sub    %r9,%r10
  nopl   (%rax)
L324:
  movsd  (%rax,%r10,8),%xmm1
  add    $0x8,%rax
  mulsd  %xmm0,%xmm1
  addsd  -0x8(%rax),%xmm1
  movsd  %xmm1,-0x8(%rax)
  cmp    %r11,%rax
  jne    L324
  jmp    L99
L348:
  mov    (%rsp),%eax
  lea    0x1(%r9),%rbp
  sub    $0x1,%eax
  mov    %eax,0x28(%rsp)
  jmp    L197
L336:
  lea    D37(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%eax
L162:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  movslq %ecx,%r8
  mov    -0x4(%r9,%r8,4),%eax
  imul   %ecx,%eax
  lea    -0x1(%rcx,%rax,1),%eax
  cltq
  lea    (%rdi,%rax,8),%r9
L193:
  movslq (%r12),%rax
  mov    0x38(%rsp),%r10
  movsd  (%r10,%rax,8),%xmm0
  movsd  %xmm0,(%r15)
  cmp    $0x1,%r13d
  jle    L67
  mov    $0x1,%esi
  pxor   %xmm3,%xmm3
  nopl   0x0(%rax,%rax,1)
L384:
  movslq (%r12,%rsi,4),%rdi
  mov    %r13d,%edx
  mov    %esi,%r11d
  imul   %edi,%edx
  cmp    $0x1,%rsi
  je     L102
  mov    %esi,%ecx
  movslq %edx,%rax
  movapd %xmm3,%xmm1
  shr    %ecx
  lea    (%r14,%rax,8),%rbx
  xor    %eax,%eax
  shl    $0x4,%rcx
  nopl   0x0(%rax)
L239:
  movupd (%r15,%rax,1),%xmm0
  movupd (%rbx,%rax,1),%xmm5
  add    $0x10,%rax
  mulpd  %xmm5,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L239
  mov    %r11d,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%edx
  cmp    %ecx,%r11d
  je     L87
L118:
  movslq %ecx,%rcx
  movslq %edx,%rax
  movsd  (%r15,%rcx,8),%xmm0
  mulsd  (%r14,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
L87:
  movsd  (%r10,%rdi,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15,%rsi,8)
  add    $0x1,%rsi
  cmp    %r8,%rsi
  jne    L384
  lea    -0x8(%r15,%rsi,8),%rax
  mov    $0x1,%r8d
  sub    $0x1,%rsi
  movsd  (%rax),%xmm0
  divsd  (%r9),%xmm0
  movsd  %xmm0,(%rax)
  movslq 0x2c(%rsp),%rax
  mov    %rax,%r9
  lea    (%r15,%rax,8),%rdi
  nopl   0x0(%rax)
L13:
  mov    -0x4(%r12,%rsi,4),%ecx
  mov    %r9d,%r10d
  sub    $0x1,%r9d
  mov    %r10d,%eax
  imul   %r13d,%ecx
  cmp    %r10d,%r13d
  jle    L29
  cmp    $0x1,%r8d
  je     L246
  movslq %ecx,%rax
  mov    %r8d,%edx
  movapd %xmm3,%xmm1
  add    %rsi,%rax
  shr    %edx
  lea    (%r14,%rax,8),%r11
  shl    $0x4,%rdx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L253:
  movupd (%rdi,%rax,1),%xmm0
  movupd (%r11,%rax,1),%xmm7
  add    $0x10,%rax
  mulpd  %xmm7,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rdx
  jne    L253
  mov    %r8d,%edx
  and    $0xfffffffe,%edx
  lea    (%r10,%rdx,1),%eax
  cmp    %edx,%r8d
  je     L213
L289:
  lea    (%rcx,%rax,1),%edx
  cltq
  movslq %edx,%rdx
  movsd  (%r14,%rdx,8),%xmm0
  mulsd  (%r15,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
L213:
  lea    (%rcx,%r9,1),%eax
  add    $0x1,%r8d
  sub    $0x8,%rdi
  movsd  (%rdi),%xmm0
  cltq
  sub    $0x1,%rsi
  subsd  %xmm1,%xmm0
  divsd  (%r14,%rax,8),%xmm0
  movsd  %xmm0,(%rdi)
  cmp    %r8d,%r13d
  jne    L13
  xor    %eax,%eax
L105:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L29:
  movapd %xmm3,%xmm1
  jmp    L213
L102:
  movapd %xmm3,%xmm1
  xor    %ecx,%ecx
  jmp    L118
L246:
  movapd %xmm3,%xmm1
  jmp    L289
L279:
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x48,%rsp
  mov    $0x2,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L67:
  lea    -0x8(%r15,%r8,8),%rax
  movsd  (%rax),%xmm0
  divsd  (%r9),%xmm0
  movsd  %xmm0,(%rax)
  xor    %eax,%eax
  jmp    L105
```

tool_calls: name: retrieve_data
arguments: data_tag: D58
datatype: qword
name: retrieve_data
arguments: data_tag: D16
datatype: f64
name: retrieve_data
arguments: data_tag: D8
datatype: f32[2]
name: retrieve_data
arguments: data_tag: D65
datatype: string
name: retrieve_data
arguments: data_tag: D37
datatype: string
name: retrieve_data
arguments: data_tag: D36
datatype: string

tool: D58: 9223372036854775807

tool: D16: 1

tool: {"D8": [0.0,-0.0]}

tool: D65: SIMQ A[kpn]=0

tool: D37: SIMQ ROWNRM=0

tool: D36: SIMQ BIG=0

assistant: ```c
int simq(A, B, X, n, flag, IPS)
double A[], B[], X[];
int n, flag;
int IPS[];
{
  int i, j, ij, ip, ipj, ipk, ipn;
  int idxpiv, iback;
  int k, kp, kp1, kpk, kpn;
  int nip, nkp, nm1;
  double em, q, rownrm, big, size, pivot, sum;
  double fabs();
  nm1 = n - 1;
  if (flag < 0)
    goto solve;
  ij = 0;
  for (i = 0; i < n; i++) {
    IPS[i] = i;
    rownrm = 0.0;
    for (j = 0; j < n; j++) {
      q = fabs(A[ij]);
      if (rownrm < q)
        rownrm = q;
      ++ij;
    }
    if (rownrm == 0.0) {
      printf("SIMQ ROWNRM=0");
      return (1);
    }
    X[i] = 1.0 / rownrm;
  }
  for (k = 0; k < nm1; k++) {
    big = 0.0;
    idxpiv = 0;
    for (i = k; i < n; i++) {
      ip = IPS[i];
      ipk = n * ip + k;
      size = fabs(A[ipk]) * X[ip];
      if (size > big) {
        big = size;
        idxpiv = i;
      }
    }
    if (big == 0.0) {
      printf("SIMQ BIG=0");
      return (2);
    }
    if (idxpiv != k) {
      j = IPS[k];
      IPS[k] = IPS[idxpiv];
      IPS[idxpiv] = j;
    }
    kp = IPS[k];
    kpk = n * kp + k;
    pivot = A[kpk];
    kp1 = k + 1;
    for (i = kp1; i < n; i++) {
      ip = IPS[i];
      ipk = n * ip + k;
      em = -A[ipk] / pivot;
      A[ipk] = -em;
      nip = n * ip;
      nkp = n * kp;
      for (j = kp1; j < n; j++) {
        ipj = nip + j;
        A[ipj] = A[ipj] + em * A[nkp + j];
      }
    }
  }
  kpn = n * IPS[n - 1] + n - 1;
  if (A[kpn] == 0.0) {
    printf("SIMQ A[kpn]=0");
    return (3);
  }
solve:
  ip = IPS[0];
  X[0] = B[ip];
  for (i = 1; i < n; i++) {
    ip = IPS[i];
    ipj = n * ip;
    sum = 0.0;
    for (j = 0; j < i; j++) {
      sum += A[ipj] * X[j];
      ++ipj;
    }
    X[i] = B[ip] - sum;
  }
  ipn = n * IPS[n - 1] + n - 1;
  X[n - 1] = X[n - 1] / A[ipn];
  for (iback = 1; iback < n; iback++) {
    i = nm1 - iback;
    ip = IPS[i];
    nip = n * ip;
    sum = 0.0;
    for (j = i + 1; j < n; j++)
      sum += A[nip + j] * X[j];
    X[i] = (X[i] - sum) / A[nip + i];
  }
  return (0);
}
```