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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x50(%rbp),%rsi
  lea    D6(%rip),%rdi
  call   <scanf@plt>
  mov    -0x50(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x50(%rbp)
  test   %eax,%eax
  je     L186
  lea    D6(%rip),%r14
  lea    -0x3c(%rbp),%r15
  jmp    L101
L198:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L105
  orq    $0x0,-0x8(%rsp,%rdx,1)
L105:
  mov    %rsp,%rbx
  lea    0x0(,%rcx,4),%edx
  mov    $0x3f3f3f3f,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    -0x4c(%rbp),%ecx
  movslq %ecx,%rax
  lea    0xf(,%rax,4),%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  shl    $0x4,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rsi
  mov    %rsp,%rdx
  sub    %rsi,%rdx
L132:
  cmp    %rdx,%rsp
  je     L194
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L132
L194:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L213
  orq    $0x0,-0x8(%rsp,%rdx,1)
L213:
  lea    0x3(%rsp),%r12
  mov    %r12,%rax
  shr    $0x2,%rax
  mov    %rax,-0x60(%rbp)
  and    $0xfffffffffffffffc,%r12
  lea    0x0(,%rcx,4),%edx
  mov    $0xffffffff,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    -0x48(%rbp),%eax
  mov    -0x60(%rbp),%rcx
  mov    %eax,0x0(,%rcx,4)
  cltq
  movl   $0x0,(%rbx,%rax,4)
  mov    -0x44(%rbp),%r10d
  mov    -0x4c(%rbp),%r9d
  mov    $0x0,%ecx
  jmp    L161
L134:
  add    $0x1,%rax
L140:
  mov    %eax,%esi
  cmp    %eax,%r9d
  jle    L84
  mov    (%r8),%rdx
  mov    (%rdx,%rax,4),%edx
  cmp    $0xffffffff,%edx
  je     L134
  add    (%rbx,%rdi,4),%edx
  cmp    (%rbx,%rax,4),%edx
  jge    L134
  mov    %edx,(%rbx,%rax,4)
  add    $0x1,%ecx
  movslq %ecx,%rdx
  mov    %esi,(%r12,%rdx,4)
  jmp    L134
L84:
  test   %ecx,%ecx
  js     L179
L161:
  movslq %ecx,%rax
  mov    (%r12,%rax,4),%edi
  sub    $0x1,%ecx
  cmp    %r10d,%edi
  je     L84
  movslq %edi,%rax
  lea    0x0(%r13,%rax,8),%r8
  mov    $0x0,%eax
  movslq %edi,%rdi
  jmp    L140
L179:
  movslq %r10d,%r10
  mov    (%rbx,%r10,4),%esi
  lea    D19(%rip),%rdi
  call   <printf@plt>
  mov    -0x58(%rbp),%rsp
  mov    -0x50(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x50(%rbp)
  test   %eax,%eax
  je     L186
L101:
  mov    %rsp,-0x58(%rbp)
  lea    -0x4c(%rbp),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  lea    -0x44(%rbp),%rdx
  lea    -0x48(%rbp),%rsi
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x4c(%rbp),%eax
  lea    0x1(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    -0x4c(%rbp),%eax
  test   %eax,%eax
  jle    L209
  mov    $0x0,%ebx
L181:
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,0x0(%r13,%rbx,8)
  mov    -0x4c(%rbp),%eax
  lea    0x0(,%rax,4),%edx
  mov    $0xffffffff,%esi
  call   <memset@plt>
  mov    -0x4c(%rbp),%eax
  add    $0x1,%rbx
  cmp    %ebx,%eax
  jg     L181
  test   %eax,%eax
  jle    L209
  mov    $0x0,%ebx
  lea    -0x40(%rbp),%r12
L54:
  mov    %r15,%rdx
  mov    %r12,%rsi
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movslq -0x40(%rbp),%rax
  movslq -0x3c(%rbp),%rdx
  mov    0x0(%r13,%rax,8),%rax
  lea    (%rax,%rdx,4),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  add    $0x1,%ebx
  cmp    %ebx,-0x4c(%rbp)
  jg     L54
L209:
  mov    %r15,%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x4c(%rbp),%ecx
  movslq %ecx,%rax
  lea    0xf(,%rax,4),%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  shl    $0x4,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rsi
  mov    %rsp,%rdx
  sub    %rsi,%rdx
L9:
  cmp    %rdx,%rsp
  je     L198
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L9
L186:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L91
  mov    $0x0,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L91:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D6
data_type: string
name: parse_data
arguments: data_label: D19
data_type: string
name: parse_data
arguments: data_label: D28
data_type: string

tool: D6: %d

tool: D19: %d


tool: D28: %d %d

assistant: ```c
int main() {
  int cases;
  scanf("%d", &cases);
  while (cases--) {
    int roads;
    scanf("%d", &roads);
    int start, end;
    scanf("%d %d", &start, &end);
    int **Map = malloc(roads * sizeof(int *) + 1);
    for (int x = 0; x < roads; x++) {
      Map[x] = malloc(roads * sizeof(int));
      memset(Map[x], -1, roads * sizeof(int));
    }
    for (int x = 0; x < roads; x++) {
      int from, to;
      scanf("%d %d", &from, &to);
      scanf("%d", &Map[from][to]);
    }
    int ignore;
    scanf("%d", &ignore);
    int mincost[roads];
    memset(mincost, 0x3f3f3f3f, sizeof(mincost));
    int stack[roads];
    memset(stack, -1, sizeof(stack));
    int sidx = 0;
    stack[0] = start;
    mincost[start] = 0;
    while (sidx >= 0) {
      int curnode = stack[sidx];
      --sidx;
      for (int x = 0; curnode != end && x < roads; x++) {
        if (Map[curnode][x] != -1 && mincost[curnode] + Map[curnode][x] < mincost[x]) {
          mincost[x] = mincost[curnode] + Map[curnode][x];
          stack[++sidx] = x;
        }
      }
    }
    printf("%d\n", mincost[end]);
  }
  return 0;
}
```