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

```asm
<ai_roadfromvert>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  lea    0x1(%rbp),%r14d
  mov    %ebx,%edi
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%rsi
  mov    %rsi,0x8(%rsp)
  call   <ai_surroundingverts@plt>
  lea    0x4(%rbp),%eax
  mov    %eax,0x18(%rsp)
L15:
  mov    %r14d,%eax
  sar    $0x1f,%eax
  shr    $0x1e,%eax
  lea    (%r14,%rax,1),%r15d
  and    $0x3,%r15d
  sub    %eax,%r15d
  mov    %r15d,%edi
  call   <data_getroadlen@plt>
  cmp    %r13d,%eax
  jg     L164
L50:
  add    $0x1,%r14d
  cmp    0x18(%rsp),%r14d
  jne    L15
  mov    %ebx,%edi
  call   <data_poslegal@plt>
  movl   $0x0,0x20(%rsp)
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L161
L128:
  mov    $0x4,%edx
  mov    0x8(%rsp),%r15
  mov    %ebp,0x1c(%rsp)
  lea    0x3c(%rsp),%r14
  cmp    %edx,%r13d
  movl   $0x0,0x8(%rsp)
  cmovge %r13d,%edx
  movl   $0x0,0x18(%rsp)
  mov    %edx,0x24(%rsp)
  mov    $0x5,%edx
  sub    %eax,%edx
  mov    %edx,0x28(%rsp)
L120:
  mov    (%r15),%esi
  mov    %ebx,%edi
  call   <road_freeedge@plt>
  test   %rax,%rax
  jne    L23
L115:
  add    $0x4,%r15
  cmp    %r15,%r14
  jne    L120
  mov    0x8(%rsp),%eax
  mov    %eax,(%r12)
  mov    0x18(%rsp),%eax
  mov    %eax,0x4(%r12)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L20
  add    $0x58,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L164:
  mov    %r15d,%edi
  call   <data_getroadlen@plt>
  mov    %eax,%r13d
  jmp    L50
L23:
  mov    0x1c(%rsp),%r13d
  xor    %edx,%edx
  mov    %r12,%rsi
  mov    %r13d,%edi
  call   <data_hypotheticalroadlength@plt>
  mov    %ebx,(%r12)
  mov    %r13d,%edi
  mov    %r12,%rsi
  mov    %eax,%ebp
  mov    (%r15),%eax
  mov    $0x1,%edx
  mov    %eax,0x4(%r12)
  call   <data_hypotheticalroadlength@plt>
  mov    0x24(%rsp),%ecx
  mov    (%r15),%edi
  cmp    %ebp,%ecx
  cmovge %ecx,%ebp
  cmp    %eax,%ebp
  mov    0x20(%rsp),%eax
  cmovl  0x28(%rsp),%eax
  mov    %eax,0x2c(%rsp)
  call   <data_poslegal@plt>
  test   %rax,%rax
  jne    L33
L10:
  mov    (%r15),%edi
  mov    %r14,%rsi
  mov    %r14,%rbp
  xor    %r13d,%r13d
  call   <ai_surroundingverts@plt>
  lea    0x48(%rsp),%rax
  mov    %rax,0x10(%rsp)
L100:
  mov    0x0(%rbp),%esi
  mov    (%r15),%edi
  call   <road_freeedge@plt>
  test   %rax,%rax
  jne    L114
L56:
  add    $0x4,%rbp
  cmp    %rbp,0x10(%rsp)
  jne    L100
  imul   %r13d,%r13d
  add    0x2c(%rsp),%r13d
  cmp    0x18(%rsp),%r13d
  jle    L115
  mov    (%r15),%eax
  mov    %r13d,0x18(%rsp)
  mov    %eax,0x8(%rsp)
  jmp    L115
  nopl   0x0(%rax)
L114:
  mov    0x0(%rbp),%edi
  call   <data_poslegal@plt>
  test   %rax,%rax
  je     L56
  mov    0x0(%rbp),%esi
  mov    0x1c(%rsp),%edi
  call   <ai_vertweight@plt>
  cmp    %r13d,%eax
  jle    L56
  mov    0x0(%rbp),%esi
  mov    0x1c(%rsp),%edi
  call   <ai_vertweight@plt>
  mov    %eax,%r13d
  jmp    L56
  nopw   0x0(%rax,%rax,1)
L161:
  mov    %ebx,%esi
  mov    %ebp,%edi
  call   <ai_vertweight@plt>
  imul   %eax,%eax
  mov    %eax,%ecx
  neg    %ecx
  mov    %ecx,0x20(%rsp)
  jmp    L128
  nopl   0x0(%rax)
L33:
  mov    0x1c(%rsp),%r13d
  mov    (%r15),%esi
  mov    %r13d,%edi
  call   <ai_vertweight@plt>
  mov    (%r15),%esi
  mov    %r13d,%edi
  mov    %eax,%ebp
  call   <ai_vertweight@plt>
  imul   %eax,%ebp
  mov    0x2c(%rsp),%eax
  lea    (%rax,%rbp,2),%eax
  mov    %eax,0x2c(%rsp)
  jmp    L10
L20:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int *ai_roadfromvert(int player, int vert, int ret[2]) {
  int i, j, weight, w;
  int maxweight = 0;
  int dest = 0;
  int sur[3];
  ai_surroundingverts(vert, sur);
  int handicap = 0;
  int roadlen, newroadlen, nextlongest;
  nextlongest = 0;
  for (j = 1; j < 4; j++) {
    if (data_getroadlen((player + j) % 4) > nextlongest) {
      nextlongest = data_getroadlen((player + j) % 4);
    }
  }
  if (data_poslegal(vert)) {
    handicap = ai_vertweight(player, vert);
    handicap *= handicap;
  }
  for (i = 0; i < 3; i++) {
    weight = handicap * -1;
    if (road_freeedge(vert, sur[i])) {
      roadlen = data_hypotheticalroadlength(player, ret, 0);
      ret[0] = vert;
      ret[1] = sur[i];
      newroadlen = data_hypotheticalroadlength(player, ret, 1);
      if (newroadlen >= 5 && newroadlen > nextlongest && newroadlen > roadlen) {
        weight += 5;
      }
      if (data_poslegal(sur[i]))
        weight += ai_vertweight(player, sur[i]) * ai_vertweight(player, sur[i]) * 2;
      int sur2[3];
      ai_surroundingverts(sur[i], sur2);
      w = 0;
      for (j = 0; j < 3; j++) {
        if (road_freeedge(sur[i], sur2[j]) && data_poslegal(sur2[j]))
          if (ai_vertweight(player, sur2[j]) > w)
            w = ai_vertweight(player, sur2[j]);
      }
      weight += w * w;
      if (weight > maxweight) {
        maxweight = weight;
        dest = sur[i];
      }
    }
  }
  ret[0] = dest;
  ret[1] = maxweight;
  return ret;
}
```