user: What would the C source look like for the assembly code provided here?

```asm
<ai_roadfromvert>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,%ebx
  mov    %edi,0x18(%rsp)
  mov    %esi,%edi
  mov    %esi,0x4(%rsp)
  mov    %rdx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%rsi
  call   <ai_surroundingverts@plt>
  lea    0x1(%rbx),%r12d
  lea    0x4(%rbx),%r13d
  mov    $0x0,%r15d
  jmp    L22
L94:
  add    $0x1,%r12d
  cmp    %r13d,%r12d
  je     L35
L22:
  mov    %r12d,%eax
  sar    $0x1f,%eax
  shr    $0x1e,%eax
  lea    (%r12,%rax,1),%ebx
  and    $0x3,%ebx
  sub    %eax,%ebx
  mov    %ebx,%edi
  call   <data_getroadlen@plt>
  cmp    %r15d,%eax
  jle    L94
  mov    %ebx,%edi
  call   <data_getroadlen@plt>
  mov    %eax,%r15d
  jmp    L94
L35:
  mov    0x4(%rsp),%edi
  call   <data_poslegal@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L76
L98:
  lea    0x30(%rsp),%rbp
  lea    0x3c(%rsp),%r13
  movl   $0x0,0xc(%rsp)
  movl   $0x0,0x8(%rsp)
  mov    $0x4,%edx
  cmp    %edx,%r15d
  cmovge %r15d,%edx
  mov    %edx,0x1c(%rsp)
  mov    %eax,%ecx
  neg    %ecx
  mov    %ecx,0x20(%rsp)
  mov    $0x5,%edx
  sub    %eax,%edx
  mov    %edx,0x24(%rsp)
L66:
  mov    %rbp,%r12
  mov    0x0(%rbp),%esi
  mov    0x4(%rsp),%edi
  call   <road_freeedge@plt>
  test   %rax,%rax
  jne    L75
L5:
  add    $0x4,%rbp
  cmp    %r13,%rbp
  jne    L66
  mov    0xc(%rsp),%eax
  mov    %eax,(%r14)
  mov    0x8(%rsp),%eax
  mov    %eax,0x4(%r14)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L26
  mov    %r14,%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  mov    0x4(%rsp),%esi
  mov    0x18(%rsp),%edi
  call   <ai_vertweight@plt>
  imul   %eax,%eax
  jmp    L98
L75:
  mov    $0x0,%edx
  mov    %r14,%rsi
  mov    0x18(%rsp),%r15d
  mov    %r15d,%edi
  call   <data_hypotheticalroadlength@plt>
  mov    %eax,%ebx
  mov    0x4(%rsp),%eax
  mov    %eax,(%r14)
  mov    0x0(%rbp),%eax
  mov    %eax,0x4(%r14)
  mov    $0x1,%edx
  mov    %r14,%rsi
  mov    %r15d,%edi
  call   <data_hypotheticalroadlength@plt>
  mov    0x1c(%rsp),%ecx
  cmp    %ebx,%ecx
  cmovge %ecx,%ebx
  cmp    %ebx,%eax
  mov    0x20(%rsp),%eax
  cmovg  0x24(%rsp),%eax
  mov    %eax,0x28(%rsp)
  mov    0x0(%rbp),%edi
  call   <data_poslegal@plt>
  test   %rax,%rax
  jne    L3
L2:
  lea    0x3c(%rsp),%rbx
  mov    %rbx,%rsi
  mov    (%r12),%edi
  call   <ai_surroundingverts@plt>
  lea    0x48(%rsp),%r15
  movl   $0x0,0x2c(%rsp)
  jmp    L68
L3:
  mov    0x0(%rbp),%esi
  mov    0x18(%rsp),%r15d
  mov    %r15d,%edi
  call   <ai_vertweight@plt>
  mov    %eax,%ebx
  mov    0x0(%rbp),%esi
  mov    %r15d,%edi
  call   <ai_vertweight@plt>
  imul   %eax,%ebx
  mov    0x28(%rsp),%eax
  lea    (%rax,%rbx,2),%eax
  mov    %eax,0x28(%rsp)
  jmp    L2
L129:
  add    $0x4,%rbx
  cmp    %r15,%rbx
  je     L175
L68:
  mov    %rbx,0x10(%rsp)
  mov    (%rbx),%esi
  mov    (%r12),%edi
  call   <road_freeedge@plt>
  test   %rax,%rax
  je     L129
  mov    (%rbx),%edi
  call   <data_poslegal@plt>
  test   %rax,%rax
  je     L129
  mov    0x10(%rsp),%rax
  mov    (%rax),%esi
  mov    0x18(%rsp),%edi
  call   <ai_vertweight@plt>
  cmp    0x2c(%rsp),%eax
  jle    L129
  mov    0x10(%rsp),%rax
  mov    (%rax),%esi
  mov    0x18(%rsp),%edi
  call   <ai_vertweight@plt>
  mov    %eax,0x2c(%rsp)
  jmp    L129
L175:
  mov    0x2c(%rsp),%eax
  imul   %eax,%eax
  add    0x28(%rsp),%eax
  cmp    0x8(%rsp),%eax
  jle    L5
  mov    (%r12),%ecx
  mov    %ecx,0xc(%rsp)
  mov    %eax,0x8(%rsp)
  jmp    L5
L26:
  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;
}
```