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

```asm
<calc_ind_rating>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  movsd  %xmm0,0x18(%rsp)
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %edx,%r14d
  movsd  %xmm1,0x20(%rsp)
  mov    D52(%rip),%rax
  movq   %rax,%xmm0
  call   <ind_expected@plt>
  movapd %xmm0,%xmm1
  movsd  0x18(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,0x10(%rsp)
  movl   $0x14,0x3c(%rsp)
  movabs $0x409f400000000000,%rbx
  movsd  D35(%rip),%xmm3
  movsd  %xmm3,0x30(%rsp)
  movsd  D7(%rip),%xmm3
  movsd  %xmm3,0x28(%rsp)
  jmp    L5
L20:
  mov    %r15,%rbx
  movsd  %xmm1,0x10(%rsp)
L13:
  movsd  0x28(%rsp),%xmm3
  mulsd  D49(%rip),%xmm3
  movsd  %xmm3,0x28(%rsp)
  movsd  0x30(%rsp),%xmm6
  movapd %xmm6,%xmm3
  addsd  %xmm6,%xmm3
  movsd  %xmm3,0x30(%rsp)
  movsd  D78(%rip),%xmm0
  comisd 0x10(%rsp),%xmm0
  ja     L52
  subl   $0x1,0x3c(%rsp)
  je     L52
L5:
  mov    $0x2710,%ebp
  movsd  D11(%rip),%xmm3
  movsd  %xmm3,0x8(%rsp)
L0:
  movsd  0x20(%rsp),%xmm1
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  movq   %rbx,%xmm0
  call   <ind_expected@plt>
  movapd %xmm0,%xmm1
  mov    %rbx,%r15
  movsd  0x8(%rsp),%xmm4
  mulsd  0x30(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm2
  movq   %rbx,%xmm0
  call   <adjust_x@plt>
  movq   %xmm0,%rbx
  movsd  0x20(%rsp),%xmm1
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <ind_expected@plt>
  subsd  0x18(%rsp),%xmm0
  movsd  0x10(%rsp),%xmm1
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,0x10(%rsp)
  comisd %xmm1,%xmm0
  jae    L20
  movsd  D78(%rip),%xmm2
  comisd %xmm0,%xmm2
  ja     L52
  movsd  0x8(%rsp),%xmm4
  mulsd  D36(%rip),%xmm4
  movsd  %xmm4,0x8(%rsp)
  sub    $0x1,%ebp
  jne    L0
  jmp    L13
L52:
  movq   %rbx,%xmm0
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: label: D52
datatype: f64
name: unpack_data
arguments: label: D35
datatype: f64
name: unpack_data
arguments: label: D7
datatype: f64
name: unpack_data
arguments: label: D49
datatype: byte[8]
name: unpack_data
arguments: label: D78
datatype: f64
name: unpack_data
arguments: label: D11
datatype: f64
name: unpack_data
arguments: label: D36
datatype: f64

tool: D52: 2000

tool: D35: 0.05

tool: D7: 200

tool: {"D49": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: D78: 1e-06

tool: D11: 1

tool: D36: 0.995

assistant: ```c
double calc_ind_rating(double cume_score, double *rtng, double *weig, int r, double beta) {
  int i;
  double olddev, curdev;
  int rounds = 10000;
  double delta = 200.0;
  double kappa = 0.05;
  double denom = 2;
  int phase = 0;
  int n = 20;
  double D, sc, oldx;
  double x = 2000;
  double xp;
  D = cume_score - ind_expected(x, rtng, weig, r, beta);
  curdev = D * D;
  olddev = curdev;
  while (n-- > 0) {
    double kk = 1.0;
    for (i = 0; i < rounds; i++) {
      oldx = x;
      olddev = curdev;
      sc = cume_score;
      xp = ind_expected(x, rtng, weig, r, beta);
      x = adjust_x(x, xp, sc, delta, kappa * kk);
      xp = ind_expected(x, rtng, weig, r, beta);
      D = xp - sc;
      curdev = D * D;
      if (curdev >= olddev) {
        x = oldx;
        curdev = olddev;
        break;
      };
      if (curdev < 0.000001)
        break;
      kk *= 0.995;
    }
    delta /= denom;
    kappa *= denom;
    phase++;
    if (curdev < 0.000001)
      break;
  }
  return x;
}
```