user: What would the C source look like for the assembly code provided here:

```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     L7
  test   %ecx,%ecx
  jle    L177
  mov    0x2c(%rsp),%r8d
  mov    %ecx,%r9d
  xor    %esi,%esi
  xor    %ecx,%ecx
  movq   D48(%rip),%xmm2
  movsd  D1(%rip),%xmm4
  lea    0x8(%rdi),%rdi
  pxor   %xmm3,%xmm3
  nop
L95:
  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)
L103:
  movsd  (%rax),%xmm0
  comisd %xmm0,%xmm3
  jbe    L54
  xorpd  %xmm2,%xmm0
L54:
  maxsd  %xmm1,%xmm0
  add    $0x8,%rax
  movapd %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L103
  add    %r13d,%esi
  ucomisd %xmm3,%xmm0
  jp     L27
  je     L125
L27:
  movapd %xmm4,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15,%rcx,8)
  add    $0x1,%rcx
  cmp    %rcx,%r9
  jne    L95
L177:
  mov    0x2c(%rsp),%eax
  pxor   %xmm3,%xmm3
  test   %eax,%eax
  jle    L408
  mov    0x2c(%rsp),%eax
  mov    %r13d,0x4(%rsp)
  xor    %r9d,%r9d
  xor    %ebx,%ebx
  movq   D48(%rip),%xmm6
  pxor   %xmm5,%xmm5
  mov    %eax,(%rsp)
  lea    0x10(%r14),%rax
  mov    %rax,0x30(%rsp)
  movapd %xmm6,%xmm4
  nop
L168:
  cmp    %ebx,%r13d
  je     L108
  mov    %r9,%rdx
  movapd %xmm5,%xmm3
  movapd %xmm5,%xmm1
  xor    %esi,%esi
  cs nopw 0x0(%rax,%rax,1)
L151:
  movslq (%r12,%rdx,4),%rcx
  mov    %r13d,%eax
  mov    %edx,%edi
  imul   %ecx,%eax
  add    %ebx,%eax
  cltq
  movsd  (%r14,%rax,8),%xmm0
  comisd %xmm0,%xmm5
  jbe    L48
  xorpd  %xmm6,%xmm0
L48:
  mulsd  (%r15,%rcx,8),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  cmova  %edi,%esi
  add    $0x1,%rdx
  movapd %xmm0,%xmm1
  movslq %esi,%rcx
  cmp    %edx,%r13d
  jg     L151
  ucomisd %xmm5,%xmm0
  jp     L144
  je     L108
L144:
  cmp    %ecx,%ebx
  je     L333
  lea    (%r12,%rcx,4),%rax
  mov    (%r12,%r9,4),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%r12,%r9,4)
  mov    %edx,(%rax)
L333:
  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    L256
  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,%rax,1)
L284:
  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  %xmm4,%xmm0
  divsd  %xmm7,%xmm0
  movapd %xmm0,%xmm1
  xorpd  %xmm4,%xmm1
  movsd  %xmm1,(%rax)
  lea    0x0(%rbp,%r9,1),%rax
  shl    $0x3,%rax
  cmp    %rax,%r15
  je     L205
  cmpl   $0x2,0x4(%rsp)
  je     L205
  movapd %xmm0,%xmm2
  add    %r14,%rax
  xor    %r9d,%r9d
  unpcklpd %xmm2,%xmm2
  nopl   0x0(%rax,%rax,1)
L262:
  movupd (%rcx,%r9,1),%xmm1
  movupd (%rax,%r9,1),%xmm8
  mulpd  %xmm2,%xmm1
  addpd  %xmm8,%xmm1
  movups %xmm1,(%rax,%r9,1)
  add    $0x10,%r9
  cmp    %r9,%rdx
  jne    L262
  mov    0x8(%rsp),%r11d
  cmp    %r11d,(%rsp)
  je     L327
  mulsd  (%rdi),%xmm0
  add    %esi,%r10d
  movslq %r10d,%r10
  lea    (%r14,%r10,8),%rax
  addsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
L327:
  add    $0x1,%r8
  cmp    %r8d,%r13d
  jg     L284
  mov    0x20(%rsp),%r15
L22:
  mov    0x28(%rsp),%eax
  subl   $0x1,0x4(%rsp)
  mov    %rbp,%r9
  mov    0xc(%rsp),%ebx
  mov    %eax,(%rsp)
  cmp    %ebx,0x2c(%rsp)
  jne    L168
L408:
  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     L18
  jne    L18
  lea    D16(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%eax
  jmp    L391
L205:
  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)
L222:
  movsd  (%rax,%r10,8),%xmm1
  add    $0x8,%rax
  mulsd  %xmm0,%xmm1
  addsd  -0x8(%rax),%xmm1
  movsd  %xmm1,-0x8(%rax)
  cmp    %r11,%rax
  jne    L222
  jmp    L327
L256:
  mov    (%rsp),%eax
  lea    0x1(%r9),%rbp
  sub    $0x1,%eax
  mov    %eax,0x28(%rsp)
  jmp    L22
L125:
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%eax
L391:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L7:
  movslq %ecx,%r8
  mov    -0x4(%r9,%r8,4),%eax
  imul   %ecx,%eax
  lea    -0x1(%rcx,%rax,1),%eax
  cltq
  lea    (%rdi,%rax,8),%r9
L18:
  movslq (%r12),%rax
  mov    0x38(%rsp),%r10
  movsd  (%r10,%rax,8),%xmm0
  movsd  %xmm0,(%r15)
  cmp    $0x1,%r13d
  jle    L328
  mov    $0x1,%esi
  pxor   %xmm3,%xmm3
  nopl   0x0(%rax,%rax,1)
L166:
  movslq (%r12,%rsi,4),%rdi
  mov    %r13d,%edx
  mov    %esi,%r11d
  imul   %edi,%edx
  cmp    $0x1,%rsi
  je     L292
  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)
L304:
  movupd (%r15,%rax,1),%xmm0
  movupd (%rbx,%rax,1),%xmm6
  add    $0x10,%rax
  mulpd  %xmm6,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L304
  mov    %r11d,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%edx
  cmp    %ecx,%r11d
  je     L221
L278:
  movslq %ecx,%rcx
  movslq %edx,%rax
  movsd  (%r15,%rcx,8),%xmm0
  mulsd  (%r14,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
L221:
  movsd  (%r10,%rdi,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15,%rsi,8)
  add    $0x1,%rsi
  cmp    %r8,%rsi
  jne    L166
  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)
L24:
  mov    -0x4(%r12,%rsi,4),%ecx
  mov    %r9d,%r10d
  sub    $0x1,%r9d
  mov    %r10d,%eax
  imul   %r13d,%ecx
  cmp    %r10d,%r13d
  jle    L1
  cmp    $0x1,%r8d
  je     L32
  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)
L43:
  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    L43
  mov    %r8d,%edx
  and    $0xfffffffe,%edx
  lea    (%r10,%rdx,1),%eax
  cmp    %edx,%r8d
  je     L131
L332:
  lea    (%rcx,%rax,1),%edx
  cltq
  movslq %edx,%rdx
  movsd  (%r14,%rdx,8),%xmm0
  mulsd  (%r15,%rax,8),%xmm0
  addsd  %xmm0,%xmm1
L131:
  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    L24
  xor    %eax,%eax
L335:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L1:
  movapd %xmm3,%xmm1
  jmp    L131
L292:
  movapd %xmm3,%xmm1
  xor    %ecx,%ecx
  jmp    L278
L32:
  movapd %xmm3,%xmm1
  jmp    L332
L108:
  lea    D45(%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
L328:
  lea    -0x8(%r15,%r8,8),%rax
  movsd  (%rax),%xmm0
  divsd  (%r9),%xmm0
  movsd  %xmm0,(%rax)
  xor    %eax,%eax
  jmp    L335
```

tool_calls: name: parse_data
arguments: label: D48
type: f32[2]
name: parse_data
arguments: label: D1
type: f64
name: parse_data
arguments: label: D16
type: string
name: parse_data
arguments: label: D12
type: string
name: parse_data
arguments: label: D45
type: string

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

tool: D1: 1

tool: D16: SIMQ A[kpn]=0

tool: D12: SIMQ ROWNRM=0

tool: D45: 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;
  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 = ((A[ij]) < 0 ? -(A[ij]) : (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 = ((A[ipk]) < 0 ? -(A[ipk]) : (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);
}
```