user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<compute_scale>:
  endbr64
  push   %rbx
  pxor   %xmm2,%xmm2
  pxor   %xmm0,%xmm0
  pxor   %xmm4,%xmm4
  mov    %rdi,%r8
  movapd %xmm4,%xmm1
  movapd %xmm4,%xmm3
  xor    %ebx,%ebx
  add    $0x2,%r8
  mov    $0x1,%edx
  mov    $0xaaaaaaab,%ecx
  mov    $0x1,%r9d
  sub    $0x10,%rsp
  movswl (%rdi),%esi
  xor    %edi,%edi
  mov    %esi,%eax
  cvtsi2sd %esi,%xmm2
  imul   %esi,%eax
  cvtsi2sd %eax,%xmm0
  addsd  %xmm4,%xmm2
  xor    %eax,%eax
  addsd  %xmm4,%xmm0
  jmp    L34
  nopl   0x0(%rax)
L35:
  movswl (%r8),%esi
  pxor   %xmm5,%xmm5
  cvtsi2sd %esi,%xmm5
  mov    %esi,%eax
  imul   %esi,%eax
  addsd  %xmm5,%xmm2
  pxor   %xmm5,%xmm5
  cvtsi2sd %eax,%xmm5
  mov    %edi,%eax
  mov    %rax,%rdx
  imul   %rcx,%rdx
  addsd  %xmm5,%xmm0
  shr    $0x21,%rdx
  lea    (%rdx,%rdx,2),%r10d
  mov    %edi,%edx
  sub    %r10d,%edx
  cmp    $0x2,%edx
  cmovne %r9d,%edx
  add    $0x2,%r8
L34:
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  pxor   %xmm5,%xmm5
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  mov    %eax,%eax
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  imul   %rcx,%rax
  lea    (%rdx,%rdx,1),%r11d
  shr    $0x21,%rax
  imul   $0xaaaaaaab,%eax,%r10d
  sub    $0x55555556,%r10d
  cmp    $0x55555555,%r10d
  cmovb  %r11d,%edx
  sub    $0x6,%eax
  cmp    $0x3,%eax
  lea    (%rdx,%rdx,1),%r10d
  cmovb  %r10d,%edx
  add    $0x1,%edi
  add    %edx,%ebx
  imul   %esi,%edx
  cvtsi2sd %edx,%xmm5
  imul   %esi,%edx
  addsd  %xmm5,%xmm3
  pxor   %xmm5,%xmm5
  cvtsi2sd %edx,%xmm5
  addsd  %xmm5,%xmm1
  cmp    $0xe6a9,%edi
  jne    L35
  movsd  D6(%rip),%xmm5
  divsd  %xmm5,%xmm2
  divsd  %xmm5,%xmm0
  mulsd  %xmm2,%xmm2
  subsd  %xmm2,%xmm0
  ucomisd %xmm0,%xmm4
  ja     L24
L19:
  pxor   %xmm2,%xmm2
  cvtsi2sd %ebx,%xmm2
  divsd  %xmm2,%xmm3
  divsd  %xmm2,%xmm1
  mulsd  %xmm3,%xmm3
  movapd %xmm1,%xmm0
  subsd  %xmm3,%xmm0
  ucomisd %xmm0,%xmm4
  ja     L53
  sqrtsd %xmm0,%xmm0
L26:
  add    $0x10,%rsp
  cvtsd2ss %xmm0,%xmm0
  pop    %rbx
  ret
L24:
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm3,(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm3
  pxor   %xmm4,%xmm4
  jmp    L19
L53:
  call   <sqrt@plt>
  jmp    L26
```

tool_calls: name: read_data
arguments: tag: D6
type_infered: byte[8]

tool: {"D6": [0x00,0x00,0x00,0x00,0x20,0xd5,0xec,0x40]}

assistant: ```c
float compute_scale(short *table) {
  double sums;
  double sums2;
  int sumw;
  double sumws;
  double sumws2;
  int i;
  double mean;
  double sdev;
  sums = 0;
  sums2 = 0;
  sumw = 0;
  sumws = 0;
  sumws2 = 0;
  for (i = 0; i < 59049; i++) {
    int score;
    int weight;
    int temp;
    int j;
    score = table[i];
    sums += score;
    sums2 += score * score;
    weight = 1;
    temp = i;
    for (j = 0; j < 10; j++) {
      if (temp % 3 == 2)
        weight *= 2;
      temp /= 3;
    }
    sumw += weight;
    sumws += weight * score;
    sumws2 += weight * score * score;
  }
  mean = sums / 59049;
  sdev = sqrt(sums2 / 59049 - mean * mean);
  mean = sumws / sumw;
  sdev = sqrt(sumws2 / sumw - mean * mean);
  return sdev;
}
```