user: Translate the below assembly code into C programming language:

```asm
<ai_rateres>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,-0x64(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x5c(%rbp)
  jmp    L5
L8:
  mov    -0x5c(%rbp),%eax
  cltq
  movl   $0x0,-0x50(%rbp,%rax,4)
  addl   $0x1,-0x5c(%rbp)
L5:
  cmpl   $0x4,-0x5c(%rbp)
  jle    L8
  movl   $0x0,-0x5c(%rbp)
  jmp    L33
L13:
  mov    -0x5c(%rbp),%eax
  cltq
  movl   $0x0,-0x30(%rbp,%rax,4)
  addl   $0x1,-0x5c(%rbp)
L33:
  cmpl   $0x4,-0x5c(%rbp)
  jle    L13
  movl   $0x0,-0x5c(%rbp)
  jmp    L138
L37:
  mov    -0x5c(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  cmp    $0x5,%eax
  je     L24
  mov    -0x5c(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  cmp    $0xffffffff,%eax
  je     L24
  mov    -0x5c(%rbp),%edx
  mov    -0x64(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <data_onhex@plt>
  mov    %eax,%ebx
  mov    -0x5c(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  sub    $0x7,%eax
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  mov    $0x6,%eax
  sub    %edx,%eax
  imul   %eax,%ebx
  mov    -0x5c(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  movslq %eax,%rdx
  mov    -0x50(%rbp,%rdx,4),%edx
  add    %ebx,%edx
  cltq
  mov    %edx,-0x50(%rbp,%rax,4)
  mov    -0x5c(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  sub    $0x7,%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  mov    $0x6,%edx
  mov    %edx,%ebx
  sub    %eax,%ebx
  mov    -0x5c(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <map_getdat@plt>
  movslq %eax,%rdx
  mov    -0x30(%rbp,%rdx,4),%edx
  add    %ebx,%edx
  cltq
  mov    %edx,-0x30(%rbp,%rax,4)
L24:
  addl   $0x1,-0x5c(%rbp)
L138:
  cmpl   $0x15,-0x5c(%rbp)
  jle    L37
  movl   $0x0,-0x58(%rbp)
  movl   $0x0,-0x54(%rbp)
  movl   $0x0,-0x5c(%rbp)
  jmp    L145
L177:
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x50(%rbp,%rax,4),%eax
  cmp    %eax,-0x58(%rbp)
  jge    L165
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x50(%rbp,%rax,4),%eax
  mov    %eax,-0x58(%rbp)
L165:
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%eax
  cmp    %eax,-0x54(%rbp)
  jge    L100
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%eax
  mov    %eax,-0x54(%rbp)
L100:
  addl   $0x1,-0x5c(%rbp)
L145:
  cmpl   $0x4,-0x5c(%rbp)
  jle    L177
  movl   $0x0,-0x5c(%rbp)
  jmp    L121
L150:
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltd
  idivl  -0x54(%rbp)
  mov    %eax,%edx
  mov    $0x4,%eax
  sub    %edx,%eax
  mov    %eax,%ecx
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D34(%rip),%rax
  mov    %ecx,(%rdx,%rax,1)
  addl   $0x1,-0x5c(%rbp)
L121:
  cmpl   $0x4,-0x5c(%rbp)
  jle    L150
  cmpl   $0x0,-0x58(%rbp)
  jne    L115
  lea    D34(%rip),%rax
  jmp    L50
L115:
  movl   $0x0,-0x5c(%rbp)
  jmp    L131
L103:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D34(%rip),%rax
  mov    (%rdx,%rax,1),%ecx
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x50(%rbp,%rax,4),%eax
  shl    $0x2,%eax
  cltd
  idivl  -0x58(%rbp)
  mov    %eax,%edx
  mov    $0x5,%eax
  sub    %edx,%eax
  add    %eax,%ecx
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D34(%rip),%rax
  mov    %ecx,(%rdx,%rax,1)
  addl   $0x1,-0x5c(%rbp)
L131:
  cmpl   $0x4,-0x5c(%rbp)
  jle    L103
  lea    D34(%rip),%rax
L50:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

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;
}
```