user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<change_path>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    $0x1,%r13d
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x58,%rsp
  mov    (%rsi),%r12d
  mov    0x4(%rsi),%r15d
  mov    %rdi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movl   $0x3,0x8(%rsi)
  mov    $0x3,%eax
  jmp    L65
  nopw   0x0(%rax,%rax,1)
L7:
  mov    0x8(%r14),%eax
L135:
  add    $0x1,%eax
  mov    $0x1,%ecx
  mov    0x4(%r14),%r15d
  mov    (%r14),%r12d
  cmp    $0x5,%eax
  cmovge %ecx,%eax
  mov    %eax,0x8(%r14)
  cmp    $0x5,%r13d
  je     L32
L65:
  cmp    $0x3,%eax
  je     L51
  cmp    $0x4,%eax
  je     L45
  cmp    $0x1,%eax
  je     L143
  cmp    $0x2,%eax
  jne    L50
  add    $0x1,%r15d
  add    $0x1,%r13d
L50:
  mov    0x8(%rsp),%rdi
  mov    %r15d,%edx
  mov    %r12d,%esi
  call   <validate_position@plt>
  test   %rax,%rax
  je     L7
  movslq %ebx,%rax
  add    $0x1,%ebx
  lea    (%rax,%rax,2),%rdx
  mov    0x8(%r14),%eax
  shl    $0x2,%rdx
  mov    %r12d,0x10(%rsp,%rdx,1)
  mov    %r15d,0x14(%rsp,%rdx,1)
  mov    %eax,0x18(%rsp,%rdx,1)
  jmp    L135
  nopw   0x0(%rax,%rax,1)
L45:
  sub    $0x1,%r15d
  add    $0x1,%r13d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L51:
  sub    $0x1,%r12d
  add    $0x1,%r13d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L143:
  add    $0x1,%r12d
  add    $0x1,%r13d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L32:
  mov    0x4(%rbp),%edx
  mov    0x0(%rbp),%esi
  lea    0x10(%rsp),%rdi
  call   <score@plt>
  movaps %xmm0,%xmm1
  cmp    $0x1,%ebx
  jle    L97
  lea    0x1c(%rsp),%r13
  xor    %r15d,%r15d
  mov    $0x1,%r12d
  nopw   0x0(%rax,%rax,1)
L139:
  mov    0x4(%rbp),%edx
  mov    0x0(%rbp),%esi
  mov    %r13,%rdi
  movss  %xmm1,0x8(%rsp)
  call   <score@plt>
  movss  0x8(%rsp),%xmm1
  comiss %xmm0,%xmm1
  minss  %xmm1,%xmm0
  cmova  %r12d,%r15d
  add    $0x1,%r12d
  movaps %xmm0,%xmm1
  add    $0xc,%r13
  cmp    %r12d,%ebx
  jne    L139
L118:
  movslq %r15d,%r15
  lea    (%r15,%r15,2),%rax
  shl    $0x2,%rax
  mov    0x18(%rsp,%rax,1),%edx
  mov    0x10(%rsp,%rax,1),%rax
  mov    %edx,0x8(%r14)
  mov    %rax,(%r14)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L149
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L97:
  xor    %r15d,%r15d
  jmp    L118
L149:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void change_path(char maze[23][30], int ghost[3], int target[2]) {
  int changes[4][3];
  int i = 1, j = 0, x, y, menor_indice;
  float menor_score, score_aux;
  y = ghost[0];
  x = ghost[1];
  ghost[2] = 3;
  while (i <= 4) {
    switch (ghost[2]) {
    case 1:
      y = y + 1;
      i++;
      break;
    case 2:
      x = x + 1;
      i++;
      break;
    case 3:
      y = y - 1;
      i++;
      break;
    case 4:
      x = x - 1;
      i++;
      break;
    }
    if (validate_position(maze, y, x)) {
      changes[j][0] = y;
      changes[j][1] = x;
      changes[j][2] = ghost[2];
      j++;
    }
    x = ghost[1];
    y = ghost[0];
    ghost[2] = ghost[2] + 1;
    if (ghost[2] > 4) {
      ghost[2] = 1;
    }
  }
  menor_indice = 0;
  menor_score = score(changes[0], target[0], target[1]);
  for (i = 1; i < j; i++) {
    score_aux = score(changes[i], target[0], target[1]);
    if (score_aux < menor_score) {
      menor_score = score_aux;
      menor_indice = i;
    }
  }
  ghost[0] = changes[menor_indice][0];
  ghost[1] = changes[menor_indice][1];
  ghost[2] = changes[menor_indice][2];
}
```