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

```asm
<unbalance>:
  endbr64
  push   %r15
  mov    %edi,%r10d
  mov    %rsi,%r11
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  mov    %ecx,-0x20(%rsp)
  mov    %r8d,-0x28(%rsp)
  mov    %r9,-0x18(%rsp)
  cmp    %r8d,%ecx
  jg     L275
  test   %edi,%edi
  jle    L275
  mov    %r9,%rax
  movslq %ecx,%r9
  movslq %edi,%r14
  lea    (%rax,%r9,8),%rbp
  mov    %edi,%eax
  lea    0x0(,%r14,8),%r13
  shr    %eax
  lea    -0x1(%rax),%r8d
  mov    %edi,%eax
  and    $0xfffffffe,%eax
  add    $0x1,%r8
  mov    %eax,-0x24(%rsp)
  mov    %eax,%esi
  shl    $0x4,%r8
  shl    $0x3,%rsi
  nopw   0x0(%rax,%rax,1)
L75:
  mov    (%r11,%r9,8),%rax
  mov    %rbp,%rcx
  add    $0x8,%rbp
  mov    (%rbx,%r9,8),%rdx
  lea    (%rax,%r13,1),%rdi
  cmp    %rdi,%rcx
  setae  %r12b
  cmp    %rbp,%rax
  setae  %dil
  or     %edi,%r12d
  lea    (%rdx,%r13,1),%rdi
  cmp    %rdi,%rcx
  setae  %dil
  cmp    %rbp,%rdx
  setae  %r15b
  or     %r15d,%edi
  and    %r12d,%edi
  cmp    $0x1,%r10d
  setne  %r12b
  test   %r12b,%dil
  je     L1
  lea    0xf(%rax),%rdi
  sub    %rdx,%rdi
  cmp    $0x1e,%rdi
  jbe    L1
  movsd  (%rcx),%xmm1
  xor    %edi,%edi
  unpcklpd %xmm1,%xmm1
  nopl   0x0(%rax,%rax,1)
L126:
  movupd (%rax,%rdi,1),%xmm0
  mulpd  %xmm1,%xmm0
  movups %xmm0,(%rax,%rdi,1)
  movupd (%rdx,%rdi,1),%xmm0
  mulpd  %xmm1,%xmm0
  movups %xmm0,(%rdx,%rdi,1)
  add    $0x10,%rdi
  cmp    %r8,%rdi
  jne    L126
  cmp    -0x24(%rsp),%r10d
  je     L271
  add    %rsi,%rax
  add    %rsi,%rdx
  movsd  (%rax),%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%rax)
  movsd  (%rdx),%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%rdx)
L271:
  add    $0x1,%r9
  cmp    %r9d,-0x28(%rsp)
  jge    L75
L275:
  mov    -0x20(%rsp),%r8d
  sub    $0x1,%r8d
  js     L300
  mov    %r10d,%eax
  lea    -0x1(%r10),%r15d
  movslq %r8d,%r8
  shr    %eax
  mov    %r15d,-0x24(%rsp)
  lea    -0x1(%rax),%r9d
  mov    %r10d,%eax
  mov    %r15,-0x10(%rsp)
  mov    -0x18(%rsp),%r15
  and    $0xfffffffe,%eax
  add    $0x1,%r9
  movslq %eax,%rdi
  mov    %eax,-0x20(%rsp)
  shl    $0x4,%r9
  shl    $0x3,%rdi
  jmp    L9
L254:
  sub    $0x1,%r8
  test   %r8d,%r8d
  js     L300
  nopl   (%rax)
L9:
  cvttsd2si (%r15,%r8,8),%eax
  cmp    %r8d,%eax
  je     L254
  test   %r10d,%r10d
  jle    L254
  mov    (%r11,%r8,8),%rsi
  movslq %eax,%rdx
  mov    (%rbx,%r8,8),%rax
  mov    (%r11,%rdx,8),%rcx
  mov    (%rbx,%rdx,8),%rdx
  lea    0xf(%rsi),%rbp
  mov    %rbp,%r13
  lea    0xf(%rcx),%r12
  sub    %rax,%r13
  cmp    $0x1e,%r13
  seta   %r14b
  cmpl   $0x1,-0x24(%rsp)
  seta   %r13b
  and    %r13d,%r14d
  mov    %rbp,%r13
  sub    %rcx,%r13
  cmp    $0x1e,%r13
  seta   %r13b
  sub    %rdx,%rbp
  and    %r14d,%r13d
  cmp    $0x1e,%rbp
  seta   %bpl
  and    %ebp,%r13d
  lea    0xf(%rax),%rbp
  sub    %rdx,%rbp
  cmp    $0x1e,%rbp
  seta   %bpl
  and    %r13d,%ebp
  mov    %r12,%r13
  sub    %rax,%r13
  cmp    $0x1e,%r13
  seta   %r13b
  test   %r13b,%bpl
  mov    $0x0,%ebp
  je     L36
  sub    %rdx,%r12
  cmp    $0x1e,%r12
  jbe    L36
  nop
L321:
  movupd (%rsi,%rbp,1),%xmm0
  movupd (%rcx,%rbp,1),%xmm2
  movups %xmm2,(%rsi,%rbp,1)
  movups %xmm0,(%rcx,%rbp,1)
  movupd (%rax,%rbp,1),%xmm0
  movupd (%rdx,%rbp,1),%xmm3
  movups %xmm3,(%rax,%rbp,1)
  movups %xmm0,(%rdx,%rbp,1)
  add    $0x10,%rbp
  cmp    %rbp,%r9
  jne    L321
  cmp    -0x20(%rsp),%r10d
  je     L254
  add    %rdi,%rsi
  add    %rdi,%rcx
  add    %rdi,%rax
  add    %rdi,%rdx
  movsd  (%rsi),%xmm0
  movsd  (%rcx),%xmm1
  sub    $0x1,%r8
  movsd  %xmm1,(%rsi)
  movsd  %xmm0,(%rcx)
  movsd  (%rax),%xmm0
  movsd  (%rdx),%xmm1
  movsd  %xmm1,(%rax)
  movsd  %xmm0,(%rdx)
  test   %r8d,%r8d
  jns    L9
L300:
  mov    -0x28(%rsp),%r8d
  add    $0x1,%r8d
  cmp    %r10d,%r8d
  jge    L317
  mov    %r10d,%eax
  lea    -0x1(%r10),%r15d
  movslq %r8d,%r8
  shr    %eax
  mov    %r15d,-0x28(%rsp)
  lea    -0x1(%rax),%r9d
  mov    %r10d,%eax
  mov    %r15,-0x20(%rsp)
  mov    -0x18(%rsp),%r15
  and    $0xfffffffe,%eax
  add    $0x1,%r9
  movslq %eax,%rdi
  mov    %eax,-0x24(%rsp)
  shl    $0x4,%r9
  shl    $0x3,%rdi
  jmp    L294
L96:
  add    $0x1,%r8
  cmp    %r8d,%r10d
  jle    L317
  nopw   0x0(%rax,%rax,1)
L294:
  cvttsd2si (%r15,%r8,8),%eax
  cmp    %r8d,%eax
  je     L96
  test   %r10d,%r10d
  jle    L96
  mov    (%r11,%r8,8),%rsi
  movslq %eax,%rdx
  mov    (%rbx,%r8,8),%rax
  mov    (%r11,%rdx,8),%rcx
  mov    (%rbx,%rdx,8),%rdx
  lea    0xf(%rsi),%rbp
  mov    %rbp,%r13
  lea    0xf(%rcx),%r12
  sub    %rax,%r13
  cmp    $0x1e,%r13
  seta   %r14b
  cmpl   $0x1,-0x28(%rsp)
  seta   %r13b
  and    %r13d,%r14d
  mov    %rbp,%r13
  sub    %rcx,%r13
  cmp    $0x1e,%r13
  seta   %r13b
  sub    %rdx,%rbp
  and    %r14d,%r13d
  cmp    $0x1e,%rbp
  seta   %bpl
  and    %ebp,%r13d
  lea    0xf(%rax),%rbp
  sub    %rdx,%rbp
  cmp    $0x1e,%rbp
  seta   %bpl
  and    %r13d,%ebp
  mov    %r12,%r13
  sub    %rax,%r13
  cmp    $0x1e,%r13
  seta   %r13b
  test   %r13b,%bpl
  mov    $0x0,%ebp
  je     L73
  sub    %rdx,%r12
  cmp    $0x1e,%r12
  jbe    L73
  nop
L113:
  movupd (%rsi,%rbp,1),%xmm0
  movupd (%rcx,%rbp,1),%xmm4
  movups %xmm4,(%rsi,%rbp,1)
  movups %xmm0,(%rcx,%rbp,1)
  movupd (%rax,%rbp,1),%xmm0
  movupd (%rdx,%rbp,1),%xmm5
  movups %xmm5,(%rax,%rbp,1)
  movups %xmm0,(%rdx,%rbp,1)
  add    $0x10,%rbp
  cmp    %r9,%rbp
  jne    L113
  cmp    %r10d,-0x24(%rsp)
  je     L96
  add    %rdi,%rsi
  add    %rdi,%rcx
  add    %rdi,%rax
  add    %rdi,%rdx
  movsd  (%rsi),%xmm0
  movsd  (%rcx),%xmm1
  add    $0x1,%r8
  movsd  %xmm1,(%rsi)
  movsd  %xmm0,(%rcx)
  movsd  (%rax),%xmm0
  movsd  (%rdx),%xmm1
  movsd  %xmm1,(%rax)
  movsd  %xmm0,(%rdx)
  cmp    %r8d,%r10d
  jg     L294
L317:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L1:
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L52:
  movsd  (%rax,%rdi,8),%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%rax,%rdi,8)
  movsd  (%rdx,%rdi,8),%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%rdx,%rdi,8)
  add    $0x1,%rdi
  cmp    %r14,%rdi
  jne    L52
  jmp    L271
L73:
  mov    -0x20(%rsp),%r13
  nopw   0x0(%rax,%rax,1)
L104:
  movsd  (%rsi,%rbp,8),%xmm0
  movsd  (%rcx,%rbp,8),%xmm1
  mov    %rbp,%r12
  movsd  %xmm1,(%rsi,%rbp,8)
  movsd  %xmm0,(%rcx,%rbp,8)
  movsd  (%rax,%rbp,8),%xmm0
  movsd  (%rdx,%rbp,8),%xmm1
  movsd  %xmm1,(%rax,%rbp,8)
  movsd  %xmm0,(%rdx,%rbp,8)
  add    $0x1,%rbp
  cmp    %r12,%r13
  jne    L104
  jmp    L96
L36:
  mov    -0x10(%rsp),%r13
  xchg   %ax,%ax
L312:
  movsd  (%rsi,%rbp,8),%xmm0
  movsd  (%rcx,%rbp,8),%xmm1
  mov    %rbp,%r12
  movsd  %xmm1,(%rsi,%rbp,8)
  movsd  %xmm0,(%rcx,%rbp,8)
  movsd  (%rax,%rbp,8),%xmm0
  movsd  (%rdx,%rbp,8),%xmm1
  movsd  %xmm1,(%rax,%rbp,8)
  movsd  %xmm0,(%rdx,%rbp,8)
  add    $0x1,%rbp
  cmp    %r13,%r12
  jne    L312
  jmp    L254
```

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][j] *= scale[i];
      vi[i][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][j];
        vr[i][j] = vr[k][j];
        vr[k][j] = tmp;
        tmp = vi[i][j];
        vi[i][j] = vi[k][j];
        vi[k][j] = tmp;
      }
    }
  }
  for (i = hi + 1; i < n; i++) {
    if ((k = (int)scale[i]) != i) {
      for (j = 0; j < n; j++) {
        tmp = vr[i][j];
        vr[i][j] = vr[k][j];
        vr[k][j] = tmp;
        tmp = vi[i][j];
        vi[i][j] = vi[k][j];
        vi[k][j] = tmp;
      }
    }
  }
}
```