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

```asm
<dj>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %r8,-0x50(%rbp)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L6
L39:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movl   $0x3e7,(%rax)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movl   $0xffffffff,(%rax)
  addl   $0x1,-0x30(%rbp)
L6:
  mov    -0x30(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jle    L39
  mov    -0x40(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  jmp    L101
L11:
  movl   $0x3e7,-0x28(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x1,-0x30(%rbp)
  jmp    L56
L82:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0x30(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x1c(%rbp)
  jge    L49
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L49
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,(%rdx)
L49:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x28(%rbp)
  jle    L100
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L100
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
L100:
  addl   $0x1,-0x30(%rbp)
L56:
  mov    -0x30(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jle    L82
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
L101:
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L11
  mov    -0x44(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L34
L58:
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
L34:
  cmpl   $0xffffffff,-0x24(%rbp)
  jne    L58
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <reverse_array@plt>
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  leave
  ret
```

assistant: ```c
int dj(int **cost, int numNodes, int source, int destination, int *path) {
  int *dist;
  int *prev;
  int *s;
  int v, u, min, w, d, j;
  dist = (int *)malloc(sizeof(int) * (numNodes + 1));
  prev = (int *)malloc(sizeof(int) * (numNodes + 1));
  s = (int *)malloc(sizeof(int) * (numNodes + 1));
  for (v = 1; v <= numNodes; v++) {
    dist[v] = 999;
    prev[v] = -1;
  }
  w = source;
  s[w] = 1;
  dist[w] = 0;
  while (s[destination] == 0) {
    min = 999;
    u = 0;
    for (v = 1; v <= numNodes; v++) {
      d = dist[w] + cost[w][v];
      if (d < dist[v] && s[v] == 0) {
        dist[v] = d;
        prev[v] = w;
      }
      if (min > dist[v] && s[v] == 0) {
        min = dist[v];
        u = v;
      }
    }
    w = u;
    s[w] = 1;
  }
  w = destination;
  j = 0;
  while (w != -1) {
    path[j++] = w;
    w = prev[w];
  }
  reverse_array(path, numNodes + 1);
  return dist[destination];
}
```