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

```asm
<ios_game_rate>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  mov    %r9,%rbx
  sub    $0x38,%rsp
  movsd  %xmm0,0x10(%rsp)
  call   <game_adapt_result@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm1,%xmm0
  call   <game_adapt_K@plt>
  pxor   %xmm5,%xmm5
  movsd  D98(%rip),%xmm2
  cvtsi2sd %r12d,%xmm5
  movsd  %xmm0,0x10(%rsp)
  test   %r15d,%r15d
  je     L23
  pxor   %xmm2,%xmm2
  cvtsi2sd %r15d,%xmm2
L23:
  movsd  D98(%rip),%xmm3
  test   %r14d,%r14d
  je     L28
  pxor   %xmm3,%xmm3
  cvtsi2sd %r14d,%xmm3
L28:
  cmp    $0x9,%r13d
  jg     L68
  pxor   %xmm4,%xmm4
  movsd  D121(%rip),%xmm0
  movapd %xmm2,%xmm6
  cvtsi2sd %r13d,%xmm4
  mulsd  %xmm4,%xmm6
  addsd  %xmm4,%xmm0
  cmp    $0x9,%r12d
  jle    L56
  movsd  0x8(%rsp),%xmm1
  subsd  %xmm3,%xmm2
  movsd  D5(%rip),%xmm5
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm3,0x18(%rsp)
  mulsd  %xmm5,%xmm1
  divsd  %xmm5,%xmm2
  addsd  %xmm3,%xmm1
  addsd  %xmm6,%xmm1
  divsd  %xmm0,%xmm1
  movapd %xmm2,%xmm0
  movsd  %xmm1,0x20(%rsp)
  call   <exp10@plt>
  pxor   %xmm5,%xmm5
  movsd  D121(%rip),%xmm0
  subsd  0x8(%rsp),%xmm0
  lea    0x1(%rax),%ecx
  mov    $0x1,%eax
  movsd  0x28(%rsp),%xmm4
  movsd  0x18(%rsp),%xmm3
  mulsd  D187(%rip),%xmm0
  cltd
  movsd  0x20(%rsp),%xmm1
  idiv   %ecx
  movapd %xmm0,%xmm2
  movsd  0x10(%rsp),%xmm0
  cvtsi2sd %eax,%xmm5
  subsd  %xmm5,%xmm2
  mulsd  %xmm2,%xmm0
  mulsd  %xmm4,%xmm0
  divsd  D74(%rip),%xmm0
  addsd  %xmm0,%xmm3
  jmp    L17
  nopl   0x0(%rax,%rax,1)
L68:
  movsd  D121(%rip),%xmm1
  addsd  0x8(%rsp),%xmm1
  movapd %xmm3,%xmm0
  mulsd  D187(%rip),%xmm1
  subsd  %xmm2,%xmm0
  divsd  D5(%rip),%xmm0
  movq   %xmm1,%r14
  cmp    $0x9,%r12d
  jle    L5
  movsd  %xmm3,0x28(%rsp)
  mov    $0x1,%r12d
  movsd  %xmm2,0x18(%rsp)
  call   <exp10@plt>
  pxor   %xmm0,%xmm0
  movq   %r14,%xmm1
  movsd  0x18(%rsp),%xmm2
  lea    0x1(%rax),%ecx
  mov    %r12d,%eax
  movsd  0x28(%rsp),%xmm3
  cltd
  idiv   %ecx
  movsd  %xmm3,0x18(%rsp)
  cvtsi2sd %eax,%xmm0
  subsd  %xmm0,%xmm1
  mulsd  0x10(%rsp),%xmm1
  addsd  %xmm2,%xmm1
  subsd  %xmm3,%xmm2
  divsd  D5(%rip),%xmm2
  movapd %xmm2,%xmm0
  movsd  %xmm1,0x20(%rsp)
  call   <exp10@plt>
  pxor   %xmm2,%xmm2
  movsd  D121(%rip),%xmm0
  subsd  0x8(%rsp),%xmm0
  lea    0x1(%rax),%ecx
  mov    %r12d,%eax
  movsd  0x18(%rsp),%xmm3
  movsd  0x20(%rsp),%xmm1
  mulsd  D187(%rip),%xmm0
  cltd
  idiv   %ecx
  cvtsi2sd %eax,%xmm2
  subsd  %xmm2,%xmm0
  mulsd  0x10(%rsp),%xmm0
  addsd  %xmm0,%xmm3
L17:
  movapd %xmm1,%xmm0
  movsd  %xmm3,0x8(%rsp)
  call   <rint@plt>
  movsd  0x8(%rsp),%xmm3
  mov    %eax,0x0(%rbp)
  movapd %xmm3,%xmm0
  call   <rint@plt>
  mov    %eax,(%rbx)
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L5:
  movsd  D5(%rip),%xmm4
  mulsd  0x8(%rsp),%xmm4
  movapd %xmm2,%xmm1
  movsd  %xmm2,0x20(%rsp)
  mulsd  %xmm5,%xmm3
  movsd  %xmm5,0x18(%rsp)
  subsd  %xmm4,%xmm1
  movsd  D121(%rip),%xmm4
  addsd  %xmm5,%xmm4
  addsd  %xmm1,%xmm3
  divsd  %xmm4,%xmm3
  movsd  %xmm3,0x8(%rsp)
  call   <exp10@plt>
  pxor   %xmm1,%xmm1
  movq   %r14,%xmm0
  movsd  0x18(%rsp),%xmm5
  lea    0x1(%rax),%ecx
  mov    $0x1,%eax
  movsd  0x20(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm3
  cltd
  idiv   %ecx
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  movsd  0x10(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  mulsd  %xmm5,%xmm1
  divsd  D74(%rip),%xmm1
  addsd  %xmm2,%xmm1
  jmp    L17
  nopw   0x0(%rax,%rax,1)
L56:
  addsd  %xmm3,%xmm2
  movsd  0x8(%rsp),%xmm4
  mulsd  D187(%rip),%xmm2
  mulsd  D99(%rip),%xmm4
  mulsd  %xmm5,%xmm3
  addsd  D121(%rip),%xmm5
  movapd %xmm2,%xmm1
  addsd  %xmm4,%xmm1
  subsd  %xmm4,%xmm2
  addsd  %xmm6,%xmm1
  addsd  %xmm2,%xmm3
  divsd  %xmm0,%xmm1
  divsd  %xmm5,%xmm3
  jmp    L17
```

tool_calls: name: read_data
arguments: tag: D98
type_infered: byte[8]
name: read_data
arguments: tag: D121
type_infered: byte[8]
name: read_data
arguments: tag: D5
type_infered: byte[8]
name: read_data
arguments: tag: D187
type_infered: byte[8]
name: read_data
arguments: tag: D74
type_infered: byte[8]
name: read_data
arguments: tag: D99
type_infered: byte[8]

tool: {"D98": [0x00,0x00,0x00,0x00,0x00,0x00,0x99,0x40]}

tool: {"D121": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

tool: {"D5": [0x00,0x00,0x00,0x00,0x00,0x00,0x79,0x40]}

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

tool: {"D74": [0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40]}

tool: {"D99": [0x00,0x00,0x00,0x00,0x00,0x00,0x69,0x40]}

assistant: ```c
void ios_game_rate(double f, int ogb, int ogw, int orb, int orw, int *nrb, int *nrw) {
  double vb, vw, nb, nw;
  double gb, gw, rb, rw, K, w;
  w = game_adapt_result(f);
  K = game_adapt_K(f);
  gb = (double)ogb;
  gw = (double)ogw;
  rb = (double)orb;
  rw = (double)orw;
  if (rb == 0)
    rb = 1600;
  if (rw == 0)
    rw = 1600;
  if (gb < 10 && gw < 10) {
    vb = (rb + rw) / 2 + 200 * w;
    nb = (rb * gb + vb) / (gb + 1);
    vw = (rb + rw) / 2 - 200 * w;
    nw = (rw * gw + vw) / (gw + 1);
    goto END;
  } else if (gb < 10 && gw >= 10) {
    vb = rw + 400 * w;
    nb = (rb * gb + vb) / (gb + 1);
    vw = (1 - w) / 2;
    nw = rw + K * (vw - 1 / (1 + exp10((rb - rw) / 400))) * gb / 10;
    goto END;
  } else if (gb >= 10 && gw < 10) {
    vw = rb - 400 * w;
    nw = (rw * gw + vw) / (gw + 1);
    vb = (1 + w) / 2;
    nb = rb + K * (vb - 1 / (1 + exp10((rw - rb) / 400))) * gw / 10;
    goto END;
  } else {
    vb = (1 + w) / 2;
    nb = rb + K * (vb - 1 / (1 + exp10((rw - rb) / 400)));
    vw = (1 - w) / 2;
    nw = rw + K * (vw - 1 / (1 + exp10((rb - rw) / 400)));
    goto END;
  }
END:;
  *nrb = rint(nb);
  *nrw = rint(nw);
}
```