user: 请从给定的汇编指令推导出C源代码:

```asm
<state_eval>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  mov    (%rdi),%esi
  cmp    $0x10,%esi
  je     L29
  movslq %esi,%rax
  mov    -0x4(%rdi,%rax,4),%edx
  call   <get_distance@plt>
  mov    %eax,%r12d
L29:
  mov    0x4(%rbp),%esi
  cmp    $0x10,%esi
  je     L45
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L45:
  mov    0x8(%rbp),%esi
  cmp    $0x10,%esi
  je     L80
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L80:
  mov    0xc(%rbp),%esi
  cmp    $0x10,%esi
  je     L135
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L135:
  mov    0x10(%rbp),%esi
  cmp    $0x10,%esi
  je     L116
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L116:
  mov    0x14(%rbp),%esi
  cmp    $0x10,%esi
  je     L101
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L101:
  mov    0x18(%rbp),%esi
  cmp    $0x10,%esi
  je     L8
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L8:
  mov    0x1c(%rbp),%esi
  cmp    $0x10,%esi
  je     L24
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L24:
  mov    0x20(%rbp),%esi
  cmp    $0x10,%esi
  je     L127
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L127:
  mov    0x24(%rbp),%esi
  cmp    $0x10,%esi
  je     L64
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L64:
  mov    0x28(%rbp),%esi
  cmp    $0x10,%esi
  je     L50
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L50:
  mov    0x2c(%rbp),%esi
  cmp    $0x10,%esi
  je     L155
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L155:
  mov    0x30(%rbp),%esi
  cmp    $0x10,%esi
  je     L90
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L90:
  mov    0x34(%rbp),%esi
  cmp    $0x10,%esi
  je     L56
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L56:
  mov    0x38(%rbp),%esi
  cmp    $0x10,%esi
  je     L16
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L16:
  mov    0x3c(%rbp),%esi
  cmp    $0x10,%esi
  je     L107
  movslq %esi,%rax
  mov    %rbp,%rdi
  mov    -0x4(%rbp,%rax,4),%edx
  call   <get_distance@plt>
  add    %eax,%r12d
L107:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int state_eval(int *table) {
  int i;
  int value = 0;
  for (i = 0; i < 16; i++)
    if (table[i] != 16)
      value += get_distance(table, table[i], table[table[i] - 1]);
  return value;
}
```