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

```asm
<unbalance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8d,-0x3c(%rbp)
  mov    %r9,-0x48(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L112
L0:
  movl   $0x0,-0x10(%rbp)
  jmp    L122
L70:
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L122:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L70
  addl   $0x1,-0x14(%rbp)
L112:
  mov    -0x14(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jle    L0
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L40
L128:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  je     L50
  movl   $0x0,-0x10(%rbp)
  jmp    L59
L71:
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L59:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L71
L50:
  subl   $0x1,-0x14(%rbp)
L40:
  cmpl   $0x0,-0x14(%rbp)
  jns    L128
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L82
L103:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  je     L19
  movl   $0x0,-0x10(%rbp)
  jmp    L136
L98:
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x10(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L136:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L98
L19:
  addl   $0x1,-0x14(%rbp)
L82:
  mov    -0x14(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L103
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void unbalance(int n, double vr[], double vi[], int low, int hi, double scale[]) {
  int i, j, k;
  double tmp;
  for (i = low; i <= hi; i++) {
    for (j = 0; j < n; j++) {
      vr[((i) * (n) + (j))] *= scale[i];
      vi[((i) * (n) + (j))] *= scale[i];
    }
  }
  for (i = low - 1; i >= 0; i--) {
    if ((k = (int)scale[i]) != i) {
      for (j = 0; j < n; j++) {
        tmp = vr[((i) * (n) + (j))];
        vr[((i) * (n) + (j))] = vr[((k) * (n) + (j))];
        vr[((k) * (n) + (j))] = tmp;
        tmp = vi[((i) * (n) + (j))];
        vi[((i) * (n) + (j))] = vi[((k) * (n) + (j))];
        vi[((k) * (n) + (j))] = tmp;
      }
    }
  }
  for (i = hi + 1; i < n; i++) {
    if ((k = (int)scale[i]) != i) {
      for (j = 0; j < n; j++) {
        tmp = vr[((i) * (n) + (j))];
        vr[((i) * (n) + (j))] = vr[((k) * (n) + (j))];
        vr[((k) * (n) + (j))] = tmp;
        tmp = vi[((i) * (n) + (j))];
        vi[((i) * (n) + (j))] = vi[((k) * (n) + (j))];
        vi[((k) * (n) + (j))] = tmp;
      }
    }
  }
}
```