user: Converte this assembly snippet into its equivalent C code:

```asm
<bencn_score>:
  endbr64
  push   %r15
  xor    %r15d,%r15d
  push   %r14
  mov    %r15d,%eax
  push   %r13
  lea    D9(%rip),%r13
  push   %r12
  lea    0x4(%r13),%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  xor    %esi,%esi
  mov    %rsi,%r15
  mov    %eax,%esi
L38:
  mov    0x0(%rbp),%r8d
  xor    %edi,%edi
  mov    $0x40000000,%ebx
  mov    $0xffffffff,%r14d
  nopl   0x0(%rax,%rax,1)
L8:
  mov    0x0(%r13,%rdi,8),%eax
  mov    %r8d,%r9d
  mov    %r8d,%r10d
  mov    %eax,%edx
  shl    $0x6,%edx
  sub    %eax,%edx
  mov    (%r12,%rdi,8),%eax
  mov    %eax,%ecx
  shl    $0x6,%ecx
  sub    %eax,%ecx
  sub    %ecx,%r9d
  mov    %r9d,%eax
  neg    %eax
  cmovs  %r9d,%eax
  sub    %edx,%r10d
  mov    %r10d,%r9d
  neg    %r9d
  cmovs  %r10d,%r9d
  cmp    %r9d,%eax
  cmovg  %r9d,%eax
  imul   %eax,%eax
  sar    $0x2,%eax
  cmp    %ebx,%eax
  jge    L98
  mov    0x4(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%r9d
  cmovg  %r10d,%r9d
  imul   %r9d,%r9d
  sar    $0x2,%r9d
  add    %eax,%r9d
  cmp    %ebx,%r9d
  jge    L98
  mov    0x8(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%eax
  neg    %eax
  cmovs  %r11d,%eax
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%eax
  cmovg  %r10d,%eax
  imul   %eax,%eax
  sar    $0x2,%eax
  add    %r9d,%eax
  cmp    %ebx,%eax
  jge    L98
  mov    0xc(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%r9d
  cmovg  %r10d,%r9d
  imul   %r9d,%r9d
  sar    $0x2,%r9d
  add    %eax,%r9d
  cmp    %ebx,%r9d
  jge    L98
  mov    0x10(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%eax
  neg    %eax
  cmovs  %r11d,%eax
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%eax
  cmovg  %r10d,%eax
  imul   %eax,%eax
  sar    $0x2,%eax
  add    %r9d,%eax
  cmp    %ebx,%eax
  jge    L98
  mov    0x14(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%r9d
  cmovg  %r10d,%r9d
  imul   %r9d,%r9d
  sar    $0x2,%r9d
  add    %eax,%r9d
  cmp    %ebx,%r9d
  jge    L98
  mov    0x18(%rbp),%r10d
  mov    %r10d,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%eax
  neg    %eax
  cmovs  %r11d,%eax
  sub    %edx,%r10d
  mov    %r10d,%r11d
  neg    %r11d
  cmovns %r11d,%r10d
  cmp    %r10d,%eax
  cmovg  %r10d,%eax
  imul   %eax,%eax
  sar    $0x2,%eax
  add    %r9d,%eax
  cmp    %eax,%ebx
  jle    L98
  mov    0x1c(%rbp),%r9d
  mov    %r9d,%r10d
  sub    %ecx,%r10d
  mov    %r10d,%ecx
  neg    %ecx
  cmovs  %r10d,%ecx
  sub    %edx,%r9d
  mov    %r9d,%edx
  neg    %edx
  cmovs  %r9d,%edx
  cmp    %edx,%ecx
  cmovle %ecx,%edx
  imul   %edx,%edx
  sar    $0x2,%edx
  add    %eax,%edx
  cmp    %edx,%ebx
  jle    L98
  mov    %edx,%ebx
  mov    %edi,%r14d
L98:
  add    $0x1,%rdi
  cmp    $0x8,%rdi
  jne    L8
  xor    %edi,%edi
  cmp    $0xffffffff,%r14d
  mov    %esi,0x4(%rsp)
  setne  %dil
  add    $0x20,%rbp
  call   <assert@plt>
  mov    0x8(%rsp),%rax
  mov    0x4(%rsp),%esi
  mov    %r14d,(%rax,%r15,4)
  add    %ebx,%esi
  cmp    $0x1,%r15
  je     L16
  mov    $0x1,%r15d
  jmp    L38
L16:
  add    $0x18,%rsp
  mov    %esi,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D9
data_type: string

tool: D9: 

assistant: ```c
int bencn_score(int greymap[2][8], int tabs[2]) {
  static const int table[8][2] = {{2, 8}, {5, 17}, {9, 29}, {13, 42}, {18, 60}, {24, 80}, {33, 106}, {47, 183}};
  int total = 0;
  int i, j;
  for (i = 0; i < 2; i++) {
    int bestfit = -1;
    int bestscore = 1 << 30;
    for (j = 0; j < 8; j++) {
      int little = table[j][0] * (19 + 37 + 7), big = table[j][1] * (19 + 37 + 7);
      int score = 0;
      int k;
      for (k = 0; k < 8; k++) {
        int e1, e2, emin;
        e1 = abs(greymap[i][k] - big);
        e2 = abs(greymap[i][k] - little);
        emin = ((e1) > (e2) ? (e2) : (e1));
        score += emin * emin >> 2;
        if (score >= bestscore)
          break;
      }
      if (score < bestscore) {
        bestfit = j;
        bestscore = score;
      }
    }
    assert(bestfit != -1);
    tabs[i] = bestfit;
    total += bestscore;
  }
  return total;
}
```