user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cbal>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %edi,0x1c(%rsp)
  mov    %esi,0x44(%rsp)
  mov    %rdx,%r14
  mov    %rcx,%r15
  mov    %r8,0x60(%rsp)
  mov    %r9,0x68(%rsp)
  movslq %esi,%r10
  movslq %edi,%rax
  shl    $0x3,%rax
  mov    %rax,0x28(%rsp)
  mov    $0x1,%r11d
  pxor   %xmm5,%xmm5
  movapd %xmm5,%xmm4
  movapd %xmm5,%xmm7
  movapd %xmm5,%xmm6
  mov    %edi,%r8d
L414:
  mov    %r10d,%ebx
  mov    %r10d,0x18(%rsp)
  mov    %r10d,%edi
  test   %r10d,%r10d
  jle    L36
  mov    %r10d,%r9d
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm0
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm2
  add    $0x1,%ebx
  jmp    L217
L14:
  movslq %r11d,%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  mov    0xb0(%rsp),%rcx
  movsd  %xmm0,-0x8(%rcx,%rax,8)
  mov    $0x2,%r9d
  cmp    %esi,%r11d
  je     L123
  test   %edi,%edi
  jg     L357
  mov    %r11d,%ecx
  jmp    L294
L357:
  mov    %r11d,%ecx
  jmp    L514
L428:
  mov    0x18(%rsp),%ecx
  mov    $0x1,%r9d
L514:
  lea    -0x1(%rsi),%ebp
  imul   %r8d,%ebp
  movslq %ebp,%rbp
  lea    0x0(,%rbp,8),%rax
  lea    (%r14,%rax,1),%rdx
  add    %r15,%rax
  lea    -0x1(%rcx),%ebx
  imul   %r8d,%ebx
  movslq %ebx,%rbx
  sub    %rbp,%rbx
  mov    $0x1,%ebp
L373:
  movsd  (%rdx),%xmm0
  movsd  (%rdx,%rbx,8),%xmm1
  movsd  %xmm1,(%rdx)
  movsd  %xmm0,(%rdx,%rbx,8)
  movsd  (%rax),%xmm0
  movsd  (%rax,%rbx,8),%xmm1
  movsd  %xmm1,(%rax)
  movsd  %xmm0,(%rax,%rbx,8)
  add    $0x1,%ebp
  add    $0x8,%rdx
  add    $0x8,%rax
  cmp    %edi,%ebp
  jle    L373
L294:
  mov    0x44(%rsp),%ebx
  cmp    %ebx,%r11d
  jg     L356
  movslq %esi,%rsi
  lea    -0x1(%r11),%eax
  imul   %r8d,%eax
  cltq
  add    %rsi,%rax
  shl    $0x3,%rax
  lea    (%r14,%rax,1),%rdx
  add    %r15,%rax
  lea    0x1(%rbx),%ebp
  mov    %r11d,%ebx
  movslq %ecx,%rcx
  sub    %rsi,%rcx
  mov    0x28(%rsp),%rsi
L138:
  movsd  -0x8(%rdx),%xmm0
  movsd  -0x8(%rdx,%rcx,8),%xmm1
  movsd  %xmm1,-0x8(%rdx)
  movsd  %xmm0,-0x8(%rdx,%rcx,8)
  movsd  -0x8(%rax),%xmm0
  movsd  -0x8(%rax,%rcx,8),%xmm1
  movsd  %xmm1,-0x8(%rax)
  movsd  %xmm0,-0x8(%rax,%rcx,8)
  add    $0x1,%ebx
  add    %rsi,%rdx
  add    %rsi,%rax
  cmp    %ebp,%ebx
  jne    L138
L356:
  cmp    $0x2,%r9d
  jne    L61
  add    $0x1,%r11d
L36:
  cmp    %edi,%r11d
  jg     L214
  lea    -0x1(%r11),%r9d
  imul   %r8d,%r9d
  mov    %r11d,%esi
  jmp    L179
L123:
  mov    %esi,%r11d
  jmp    L356
L2:
  add    $0x1,%edx
  add    %r8d,%ecx
  cmp    %edi,%edx
  jg     L543
L292:
  cmp    %edx,%esi
  je     L2
  movslq %ecx,%rax
  ucomisd (%r14,%rax,8),%xmm1
  jp     L11
  ucomisd (%r14,%rax,8),%xmm0
  jne    L11
  ucomisd (%r15,%rax,8),%xmm3
  jp     L11
  ucomisd (%r15,%rax,8),%xmm2
  je     L2
L11:
  sub    $0x1,%r9d
  mov    %ebx,%eax
  sub    %r9d,%eax
  cmp    %edi,%eax
  jg     L36
L217:
  mov    %r9d,%esi
  lea    -0x1(%r9),%ecx
  mov    $0x1,%edx
  jmp    L292
L60:
  add    $0x1,%edx
  cmp    %edi,%edx
  jg     L14
L199:
  cmp    %esi,%edx
  je     L60
  lea    (%rcx,%rdx,1),%eax
  cltq
  ucomisd (%r14,%rax,8),%xmm5
  jp     L46
  ucomisd (%r14,%rax,8),%xmm4
  jne    L46
  ucomisd (%r15,%rax,8),%xmm7
  jp     L46
  ucomisd (%r15,%rax,8),%xmm6
  je     L60
L46:
  add    $0x1,%esi
  add    %r8d,%r9d
  cmp    %edi,%esi
  jg     L143
L179:
  mov    %r11d,%edx
  lea    -0x1(%r9),%ecx
  jmp    L199
L143:
  mov    %r11d,0x38(%rsp)
  mov    %r10,0x48(%rsp)
  movslq %r11d,%rax
  movsd  D81(%rip),%xmm0
  mov    0x18(%rsp),%edx
  mov    0xb0(%rsp),%rcx
L296:
  movsd  %xmm0,-0x8(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%edx
  jge    L296
L151:
  mov    0x38(%rsp),%edi
  lea    -0x1(%rdi),%eax
  imul   0x1c(%rsp),%eax
  mov    %eax,0x3c(%rsp)
  movslq %edi,%rsi
  mov    %rsi,0x58(%rsp)
  cltq
  add    %rsi,%rax
  shl    $0x3,%rax
  mov    %rax,0x50(%rsp)
  mov    %r15,%r13
L216:
  mov    0x18(%rsp),%edi
  cmp    %edi,0x38(%rsp)
  jg     L327
  mov    0x50(%rsp),%rax
  mov    %rax,0x30(%rsp)
  mov    0x3c(%rsp),%eax
  mov    %eax,0x24(%rsp)
  mov    0x58(%rsp),%rax
  mov    %rax,0x10(%rsp)
  movl   $0x0,0x40(%rsp)
  jmp    L27
L214:
  mov    %r11d,0x38(%rsp)
  mov    %r10,0x48(%rsp)
  jmp    L151
L458:
  add    $0x1,%ebx
  add    0x1c(%rsp),%r12d
  cmp    %ebx,0x18(%rsp)
  jl     L283
L226:
  cmp    0x10(%rsp),%ebx
  je     L458
  mov    0x20(%rsp),%eax
  lea    (%rax,%rbx,1),%r15d
  movslq %r15d,%r15
  movsd  (%r14,%r15,8),%xmm0
  call   <fabs@plt>
  mov    %rax,%rbp
  movsd  0x0(%r13,%r15,8),%xmm0
  call   <fabs@plt>
  add    %rax,%rbp
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbp,%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  movslq %r12d,%r15
  movsd  (%r14,%r15,8),%xmm0
  call   <fabs@plt>
  mov    %rax,%rbp
  movsd  0x0(%r13,%r15,8),%xmm0
  call   <fabs@plt>
  add    %rax,%rbp
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbp,%xmm0
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  jmp    L458
L283:
  movsd  (%rsp),%xmm5
  ucomisd D8(%rip),%xmm5
  setnp  %al
  mov    $0x0,%edx
  cmovne %edx,%eax
  test   %al,%al
  jne    L176
  movsd  0x8(%rsp),%xmm3
  ucomisd D8(%rip),%xmm3
  setnp  %al
  cmovne %edx,%eax
  test   %al,%al
  jne    L176
  movapd %xmm3,%xmm1
  mulsd  D31(%rip),%xmm1
  movapd %xmm5,%xmm4
  addsd  %xmm3,%xmm4
  movsd  D81(%rip),%xmm0
  movsd  D98(%rip),%xmm2
  comisd %xmm5,%xmm1
  jbe    L466
L16:
  mulsd  D96(%rip),%xmm0
  movsd  (%rsp),%xmm6
  mulsd  %xmm2,%xmm6
  movsd  %xmm6,(%rsp)
  comisd %xmm6,%xmm1
  ja     L16
L530:
  movsd  0x8(%rsp),%xmm1
  mulsd  D96(%rip),%xmm1
  movsd  D31(%rip),%xmm3
  movsd  D78(%rip),%xmm2
  movsd  (%rsp),%xmm5
  comisd %xmm1,%xmm5
  jb     L472
L471:
  mulsd  %xmm3,%xmm0
  movsd  (%rsp),%xmm7
  mulsd  %xmm2,%xmm7
  movsd  %xmm7,(%rsp)
  comisd %xmm1,%xmm7
  jae    L471
L472:
  movsd  0x8(%rsp),%xmm2
  addsd  (%rsp),%xmm2
  divsd  %xmm0,%xmm2
  mulsd  D103(%rip),%xmm4
  comisd %xmm4,%xmm2
  jb     L228
L176:
  addq   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%rax
  mov    0x1c(%rsp),%edi
  add    %edi,0x24(%rsp)
  addq   $0x8,0x30(%rsp)
  cmp    %eax,0x18(%rsp)
  jl     L17
L27:
  mov    0x3c(%rsp),%eax
  mov    0x10(%rsp),%rsi
  lea    -0x1(%rax,%rsi,1),%r12d
  mov    0x38(%rsp),%ebx
  pxor   %xmm3,%xmm3
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm3,(%rsp)
  mov    0x24(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x20(%rsp)
  jmp    L226
L466:
  movsd  D81(%rip),%xmm0
  jmp    L530
L228:
  movsd  D81(%rip),%xmm1
  divsd  %xmm0,%xmm1
  mov    0xb0(%rsp),%rsi
  mov    0x10(%rsp),%rax
  movapd %xmm0,%xmm2
  mulsd  -0x8(%rsi,%rax,8),%xmm2
  movsd  %xmm2,-0x8(%rsi,%rax,8)
  mov    0x38(%rsp),%edx
  mov    0x44(%rsp),%eax
  cmp    %eax,%edx
  jg     L38
  lea    0x1(%rax),%ecx
  mov    0x30(%rsp),%rax
L406:
  movapd %xmm1,%xmm2
  mulsd  -0x8(%r14,%rax,1),%xmm2
  movsd  %xmm2,-0x8(%r14,%rax,1)
  movapd %xmm1,%xmm2
  mulsd  -0x8(%r13,%rax,1),%xmm2
  movsd  %xmm2,-0x8(%r13,%rax,1)
  add    $0x1,%edx
  add    0x28(%rsp),%rax
  cmp    %ecx,%edx
  jne    L406
L38:
  cmpl   $0x0,0x18(%rsp)
  jle    L503
  movslq 0x24(%rsp),%rdx
  lea    0x0(,%rdx,8),%rax
  mov    0x48(%rsp),%rdi
  lea    -0x1(%rdi),%ecx
  lea    0x1(%rdx,%rcx,1),%rdx
  shl    $0x3,%rdx
L35:
  movapd %xmm0,%xmm1
  mulsd  (%r14,%rax,1),%xmm1
  movsd  %xmm1,(%r14,%rax,1)
  movapd %xmm0,%xmm1
  mulsd  0x0(%r13,%rax,1),%xmm1
  movsd  %xmm1,0x0(%r13,%rax,1)
  add    $0x8,%rax
  cmp    %rax,%rdx
  jne    L35
  movl   $0x1,0x40(%rsp)
  jmp    L176
L503:
  movl   $0x1,0x40(%rsp)
  jmp    L176
L17:
  cmpl   $0x0,0x40(%rsp)
  jne    L216
L327:
  mov    0x60(%rsp),%rax
  mov    0x38(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x68(%rsp),%rax
  mov    0x18(%rsp),%esi
  mov    %esi,(%rax)
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L476:
  mov    %r11d,0x38(%rsp)
  jmp    L327
L543:
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  mov    0xb0(%rsp),%rax
  movsd  %xmm0,-0x8(%rax,%r10,8)
  cmp    %edi,%esi
  jne    L428
L61:
  cmp    $0x1,%edi
  je     L476
  sub    $0x1,%r10
  jmp    L414
```

tool_calls: name: read_data
arguments: data_label: D81
type_infered: f64
name: read_data
arguments: data_label: D8
type_infered: f64
name: read_data
arguments: data_label: D31
type_infered: byte[8]
name: read_data
arguments: data_label: D98
type_infered: byte[8]
name: read_data
arguments: data_label: D96
type_infered: f64
name: read_data
arguments: data_label: D78
type_infered: byte[8]
name: read_data
arguments: data_label: D103
type_infered: f64

tool: D81: 1

tool: D8: 0

tool: {"D31": [0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x3f]}

tool: {"D98": [0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x40]}

tool: D96: 16

tool: {"D78": [0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x3f]}

tool: D103: 0.95

assistant: ```c
void cbal(int nm, int n, double *ar, double *ai, int *low, int *igh, double *scale) {
  int i, j, k, l, m, jj, iexc;
  double c, f, g, r, s, b2, radix;
  int noconv;
  radix = 16.0;
  b2 = radix * radix;
  k = 1;
  l = n;
  goto L100;
L20:
  scale[(m)-1] = j;
  if (j != m) {
    for (i = 1; i <= l; i++) {
      f = ar[(i)-1 + ((j)-1) * (nm)];
      ar[(i)-1 + ((j)-1) * (nm)] = ar[(i)-1 + ((m)-1) * (nm)];
      ar[(i)-1 + ((m)-1) * (nm)] = f;
      f = ai[(i)-1 + ((j)-1) * (nm)];
      ai[(i)-1 + ((j)-1) * (nm)] = ai[(i)-1 + ((m)-1) * (nm)];
      ai[(i)-1 + ((m)-1) * (nm)] = f;
    }
    for (i = k; i <= n; i++) {
      f = ar[(j)-1 + ((i)-1) * (nm)];
      ar[(j)-1 + ((i)-1) * (nm)] = ar[(m)-1 + ((i)-1) * (nm)];
      ar[(m)-1 + ((i)-1) * (nm)] = f;
      f = ai[(j)-1 + ((i)-1) * (nm)];
      ai[(j)-1 + ((i)-1) * (nm)] = ai[(m)-1 + ((i)-1) * (nm)];
      ai[(m)-1 + ((i)-1) * (nm)] = f;
    }
  }
  if (iexc == 2) {
    k++;
    goto L130;
  }
  if (l == 1)
    goto L280;
  l--;
L100:
  for (jj = 1; jj <= l; jj++) {
    int test = 0;
    j = l + 1 - jj;
    for (i = 1; i <= l; i++) {
      if (i == j)
        continue;
      if (ar[(j)-1 + ((i)-1) * (nm)] != 0.0 || ai[(j)-1 + ((i)-1) * (nm)] != 0.0) {
        test = 1;
        break;
      }
    }
    if (!test) {
      m = l;
      iexc = 1;
      goto L20;
    }
  }
L130:
  for (j = k; j <= l; j++) {
    int test = 0;
    for (i = k; i <= l; i++) {
      if (i == j)
        continue;
      if (ar[(i)-1 + ((j)-1) * (nm)] != 0.0 || ai[(i)-1 + ((j)-1) * (nm)] != 0.0) {
        test = 1;
        break;
      }
    }
    if (!test) {
      m = k;
      iexc = 2;
      goto L20;
    }
  }
  for (i = k; i <= l; i++)
    scale[(i)-1] = 1.0;
  do {
    noconv = 0;
    for (i = k; i <= l; i++) {
      c = 0.0;
      r = 0.0;
      for (j = k; j <= l; j++) {
        if (j == i)
          continue;
        c += fabs(ar[(j)-1 + ((i)-1) * (nm)]) + fabs(ai[(j)-1 + ((i)-1) * (nm)]);
        r += fabs(ar[(i)-1 + ((j)-1) * (nm)]) + fabs(ai[(i)-1 + ((j)-1) * (nm)]);
      }
      if (c == 0.0 || r == 0.0)
        continue;
      g = r / radix;
      f = 1.0;
      s = c + r;
      while (c < g) {
        f *= radix;
        c *= b2;
      }
      g = r * radix;
      while (c >= g) {
        f /= radix;
        c /= b2;
      }
      if ((c + r) / f >= 0.95 * s)
        continue;
      g = 1.0 / f;
      scale[(i)-1] *= f;
      noconv = 1;
      for (j = k; j <= n; j++) {
        ar[(i)-1 + ((j)-1) * (nm)] *= g;
        ai[(i)-1 + ((j)-1) * (nm)] *= g;
      }
      for (j = 1; j <= l; j++) {
        ar[(j)-1 + ((i)-1) * (nm)] *= f;
        ai[(j)-1 + ((i)-1) * (nm)] *= f;
      }
    }
  } while (noconv);
L280:
  *low = k;
  *igh = l;
}
```