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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  lea    -0x50(%rbp),%rsi
  push   %r13
  lea    D1(%rip),%r13
  push   %r12
  mov    %r13,%rdi
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <scanf@plt>
  mov    -0x50(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x50(%rbp)
  test   %eax,%eax
  je     L10
  lea    -0x4c(%rbp),%rax
  lea    D28(%rip),%r14
  mov    %rax,-0x68(%rbp)
  lea    -0x44(%rbp),%rax
  lea    -0x3c(%rbp),%r15
  mov    %rax,-0x78(%rbp)
  lea    -0x48(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  lea    -0x40(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  nopl   0x0(%rax,%rax,1)
L74:
  mov    -0x68(%rbp),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %rsp,-0x60(%rbp)
  xor    %ebx,%ebx
  call   <scanf@plt>
  mov    -0x78(%rbp),%rdx
  mov    -0x70(%rbp),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    -0x4c(%rbp),%eax
  lea    0x1(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    -0x4c(%rbp),%eax
  test   %eax,%eax
  jle    L152
  nopw   0x0(%rax,%rax,1)
L73:
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    $0xffffffff,%esi
  mov    %rax,(%r12,%rbx,8)
  mov    %rax,%rdi
  mov    -0x4c(%rbp),%eax
  add    $0x1,%rbx
  lea    0x0(,%rax,4),%edx
  call   <memset@plt>
  mov    -0x4c(%rbp),%eax
  cmp    %ebx,%eax
  jg     L73
  test   %eax,%eax
  jle    L152
  xor    %ebx,%ebx
L21:
  mov    -0x58(%rbp),%rsi
  mov    %r15,%rdx
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  call   <scanf@plt>
  movslq -0x40(%rbp),%rax
  movslq -0x3c(%rbp),%rdx
  mov    %r13,%rdi
  mov    (%r12,%rax,8),%rax
  lea    (%rax,%rdx,4),%rsi
  xor    %eax,%eax
  call   <scanf@plt>
  cmp    %ebx,-0x4c(%rbp)
  jg     L21
L152:
  mov    %r15,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  movslq -0x4c(%rbp),%rax
  mov    %rsp,%rsi
  mov    %rax,%rdx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L6
L69:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L69
L6:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  je     L94
  orq    $0x0,-0x8(%rsp,%rcx,1)
L94:
  mov    %rsp,%rbx
  shl    $0x2,%edx
  mov    $0x3f3f3f3f,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  movslq -0x4c(%rbp),%rax
  mov    %rsp,%rdi
  mov    %rax,%rdx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rdi
  and    $0xfffffffffffffff0,%rsi
  cmp    %rdi,%rsp
  je     L149
L40:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L40
L149:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L140
L144:
  lea    0x3(%rsp),%r8
  mov    $0xffffffff,%esi
  shl    $0x2,%edx
  mov    %r8,%rax
  and    $0xfffffffffffffffc,%r8
  mov    %r8,%rdi
  shr    $0x2,%rax
  mov    %r8,-0x88(%rbp)
  mov    %rax,-0x80(%rbp)
  call   <memset@plt>
  mov    -0x48(%rbp),%edi
  mov    -0x80(%rbp),%rax
  xor    %esi,%esi
  movslq -0x44(%rbp),%r11
  mov    -0x4c(%rbp),%r10d
  mov    %edi,0x0(,%rax,4)
  movslq %edi,%rax
  mov    -0x88(%rbp),%r8
  movslq %edi,%rcx
  movl   $0x0,(%rbx,%rax,4)
L50:
  sub    $0x1,%esi
  cmp    %r11d,%ecx
  je     L205
  lea    (%r12,%rcx,8),%rdi
  xor    %eax,%eax
  jmp    L44
L116:
  mov    (%rdi),%rdx
  mov    (%rdx,%rax,4),%edx
  cmp    $0xffffffff,%edx
  je     L70
  add    (%rbx,%rcx,4),%edx
  cmp    (%rbx,%rax,4),%edx
  jge    L70
  add    $0x1,%esi
  mov    %edx,(%rbx,%rax,4)
  movslq %esi,%rdx
  mov    %eax,(%r8,%rdx,4)
L70:
  add    $0x1,%rax
L44:
  cmp    %eax,%r10d
  jg     L116
L205:
  cmp    $0xffffffff,%esi
  je     L16
  movslq %esi,%rax
  movslq (%r8,%rax,4),%rcx
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L16:
  mov    (%rbx,%r11,4),%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  mov    -0x50(%rbp),%eax
  mov    -0x60(%rbp),%rsp
  lea    -0x1(%rax),%edx
  mov    %edx,-0x50(%rbp)
  test   %eax,%eax
  jne    L74
L10:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L176
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L140:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L144
L176:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D1
datatype: string
name: disassemble_data
arguments: label: D28
datatype: string
name: disassemble_data
arguments: label: D5
datatype: string

tool: D1: %d

tool: D28: %d %d

tool: D5: %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;
}
```