user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ai_rateres>:
  endbr64
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    $0x6,%r12d
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  movl   $0x0,0x10(%rsp)
  movq   $0x0,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  movl   $0x0,0x30(%rsp)
  xchg   %ax,%ax
L49:
  xor    %esi,%esi
  mov    %ebx,%edi
  call   <map_getdat@plt>
  cmp    $0x5,%eax
  je     L36
  xor    %esi,%esi
  mov    %ebx,%edi
  call   <map_getdat@plt>
  cmp    $0xffffffff,%eax
  je     L36
  mov    %ebx,%esi
  mov    %r13d,%edi
  mov    %r12d,%ebp
  call   <data_onhex@plt>
  mov    $0x1,%esi
  mov    %ebx,%edi
  mov    %eax,%r14d
  call   <map_getdat@plt>
  mov    %ebx,%edi
  sub    $0x7,%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  xor    %esi,%esi
  sub    %eax,%ebp
  call   <map_getdat@plt>
  mov    $0x1,%esi
  imul   %r14d,%ebp
  mov    %ebx,%edi
  cltq
  add    %ebp,(%rsp,%rax,4)
  call   <map_getdat@plt>
  xor    %esi,%esi
  mov    %ebx,%edi
  mov    %eax,%ebp
  call   <map_getdat@plt>
  lea    -0x7(%rbp),%edx
  mov    %edx,%ecx
  cltq
  neg    %ecx
  cmovns %ecx,%edx
  mov    %r12d,%ecx
  sub    %edx,%ecx
  add    %ecx,0x20(%rsp,%rax,4)
L36:
  add    $0x1,%ebx
  cmp    $0x16,%ebx
  jne    L49
  xor    %eax,%eax
  xor    %esi,%esi
  xor    %edi,%edi
  mov    %rsp,%r8
  lea    0x20(%rsp),%r9
L42:
  mov    (%rax,%r8,1),%edx
  cmp    %edx,%edi
  cmovl  %edx,%edi
  mov    (%r9,%rax,1),%edx
  cmp    %edx,%esi
  cmovl  %edx,%esi
  add    $0x4,%rax
  cmp    $0x14,%rax
  jne    L42
  xor    %ecx,%ecx
  lea    D9(%rip),%r10
  mov    $0x4,%r11d
L15:
  mov    (%r9,%rcx,1),%eax
  lea    (%rax,%rax,2),%eax
  cltd
  idiv   %esi
  mov    %r11d,%edx
  sub    %eax,%edx
  mov    %edx,(%r10,%rcx,1)
  add    $0x4,%rcx
  cmp    $0x14,%rcx
  jne    L15
  test   %edi,%edi
  je     L37
  lea    D9(%rip),%rsi
  mov    %r8,%rcx
  mov    $0x5,%r8d
  lea    0x14(%rsi),%r9
L70:
  mov    (%rcx),%eax
  add    $0x4,%rcx
  shl    $0x2,%eax
  cltd
  idiv   %edi
  mov    %r8d,%edx
  sub    %eax,%edx
  add    %edx,(%rsi)
  add    $0x4,%rsi
  cmp    %rsi,%r9
  jne    L70
L37:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  add    $0x40,%rsp
  mov    %r10,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int *ai_rateres(int player) {
  static int res[5];
  int weight[5];
  int mapweight[5];
  int i;
  for (i = 0; i < 5; i++)
    weight[i] = 0;
  for (i = 0; i < 5; i++)
    mapweight[i] = 0;
  for (i = 0; i < 22; i++) {
    if (map_getdat(i, 0) != 5 && map_getdat(i, 0) != -1) {
      weight[map_getdat(i, 0)] += data_onhex(player, i) * (abs(map_getdat(i, 1) - 7) * -1 + 6);
      mapweight[map_getdat(i, 0)] += (abs(map_getdat(i, 1) - 7) * -1 + 6);
    }
  }
  int max = 0;
  int mapmax = 0;
  for (i = 0; i < 5; i++) {
    if (max < weight[i])
      max = weight[i];
    if (mapmax < mapweight[i])
      mapmax = mapweight[i];
  }
  for (i = 0; i < 5; i++) {
    res[i] = 4 - mapweight[i] * 3 / mapmax;
  }
  if (max == 0) {
    return res;
  }
  for (i = 0; i < 5; i++) {
    res[i] += 5 - weight[i] * 4 / max;
  }
  return res;
}
```