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

```asm
<__BetterVBalance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    %rdx,-0x40(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    %r8,-0x50(%rbp)
  cmpl   $0xffffffff,-0x38(%rbp)
  jne    L61
  mov    -0x40(%rbp),%rax
  movss  (%rax),%xmm1
  mov    -0x48(%rbp),%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x10(%rbp)
  movss  -0x10(%rbp),%xmm0
  movss  %xmm0,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  movss  (%rax),%xmm1
  mov    -0x50(%rbp),%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0xc(%rbp)
  movss  -0xc(%rbp),%xmm0
  movss  %xmm0,-0x14(%rbp)
  mov    -0x40(%rbp),%rax
  movss  (%rax),%xmm1
  mov    -0x48(%rbp),%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  movss  (%rax),%xmm1
  mov    -0x50(%rbp),%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  movl   $0x1,-0x24(%rbp)
  jmp    L30
L49:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  comiss -0x18(%rbp),%xmm0
  jbe    L79
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x18(%rbp)
L79:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm0,%xmm1
  movss  -0x10(%rbp),%xmm0
  comiss %xmm1,%xmm0
  jbe    L77
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x10(%rbp)
L77:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  comiss -0x14(%rbp),%xmm0
  jbe    L116
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x14(%rbp)
L116:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm0,%xmm1
  movss  -0xc(%rbp),%xmm0
  comiss %xmm1,%xmm0
  jbe    L89
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  %xmm0,-0xc(%rbp)
L89:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  -0x20(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  -0x1c(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  addl   $0x1,-0x24(%rbp)
L30:
  mov    -0x24(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L49
  movss  -0x18(%rbp),%xmm0
  subss  -0x10(%rbp),%xmm0
  divss  -0x20(%rbp),%xmm0
  movss  -0x14(%rbp),%xmm1
  subss  -0xc(%rbp),%xmm1
  divss  -0x1c(%rbp),%xmm1
  subss  %xmm1,%xmm0
  jmp    L138
L61:
  cmpl   $0x1,-0x38(%rbp)
  jne    L82
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  movss  -0x1c(%rbp),%xmm0
  movss  %xmm0,-0x20(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L22
L28:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  -0x20(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm1,%xmm0
  movss  -0x1c(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  addl   $0x1,-0x24(%rbp)
L22:
  mov    -0x24(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L28
  pxor   %xmm0,%xmm0
  cvtss2sd -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x34(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  cvtss2sd -0x1c(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x34(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x4(%rbp)
  movss  -0x4(%rbp),%xmm0
  movss  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L55
L78:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm0,%xmm1
  movss  -0x20(%rbp),%xmm0
  subss  %xmm1,%xmm0
  movd   %xmm0,%eax
  movd   %eax,%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  movss  -0x8(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  addss  %xmm0,%xmm1
  movss  -0x1c(%rbp),%xmm0
  subss  %xmm1,%xmm0
  movd   %xmm0,%eax
  movd   %eax,%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  movss  -0x4(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x4(%rbp)
  addl   $0x1,-0x24(%rbp)
L55:
  mov    -0x24(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L78
  movss  -0x8(%rbp),%xmm0
  subss  -0x4(%rbp),%xmm0
  jmp    L138
L82:
  mov    -0x38(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <__errexit@plt>
  pxor   %xmm0,%xmm0
L138:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D9
type_guessed: string

tool: D9: Unknown norm: %d


assistant: ```c
float __BetterVBalance(int ncon, int norm, float *vwgt, float *u1wgt, float *u2wgt) {
  int i;
  float sum1, sum2, max1, max2, min1, min2, diff1, diff2;
  if (norm == -1) {
    max1 = min1 = vwgt[0] + u1wgt[0];
    max2 = min2 = vwgt[0] + u2wgt[0];
    sum1 = vwgt[0] + u1wgt[0];
    sum2 = vwgt[0] + u2wgt[0];
    for (i = 1; i < ncon; i++) {
      if (max1 < vwgt[i] + u1wgt[i])
        max1 = vwgt[i] + u1wgt[i];
      if (min1 > vwgt[i] + u1wgt[i])
        min1 = vwgt[i] + u1wgt[i];
      if (max2 < vwgt[i] + u2wgt[i])
        max2 = vwgt[i] + u2wgt[i];
      if (min2 > vwgt[i] + u2wgt[i])
        min2 = vwgt[i] + u2wgt[i];
      sum1 += vwgt[i] + u1wgt[i];
      sum2 += vwgt[i] + u2wgt[i];
    }
    return ((max1 - min1) / sum1) - ((max2 - min2) / sum2);
  } else if (norm == 1) {
    sum1 = sum2 = 0.0;
    for (i = 0; i < ncon; i++) {
      sum1 += vwgt[i] + u1wgt[i];
      sum2 += vwgt[i] + u2wgt[i];
    }
    sum1 = sum1 / (1.0 * ncon);
    sum2 = sum2 / (1.0 * ncon);
    diff1 = diff2 = 0.0;
    for (i = 0; i < ncon; i++) {
      diff1 += fabs(sum1 - (vwgt[i] + u1wgt[i]));
      diff2 += fabs(sum2 - (vwgt[i] + u2wgt[i]));
    }
    return diff1 - diff2;
  } else {
    __errexit("Unknown norm: %d\n", norm);
  }
  return 0.0;
}
```