user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    0x10(%rsi),%rdi
  lea    D66(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,0x8(%rsp)
  mov    0x8(%rbx),%rdi
  lea    D65(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbx
  movl   $0x0,0x18(%rsp)
  mov    $0x0,%r14d
  mov    $0x0,%r13d
  lea    D18(%rip),%r12
  lea    D46(%rip),%r15
  jmp    L8
L75:
  lea    0x1e(%rsp),%rbp
  mov    %rbp,%rdx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <fscanf@plt>
  mov    %rbp,%rsi
  lea    D42(%rip),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L30
  movl   $0x0,0x18(%rsp)
  add    $0x1,%r13d
  test   %r14d,%r14d
  je     L8
  mov    $0x0,%r8d
  mov    %r14d,%ecx
  mov    %r13d,%edx
  lea    D77(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <fprintf@plt>
  jmp    L8
L88:
  cmp    $0x1,%eax
  je     L87
L8:
  lea    0x18(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  test   %eax,%eax
  js     L30
  jne    L88
  mov    0x18(%rsp),%ebp
  test   %ebp,%ebp
  jne    L75
  lea    0x1e(%rsp),%rdx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    %ebp,%r14d
  jmp    L8
L87:
  add    $0x1,%r13d
  mov    0x18(%rsp),%r8d
  mov    %r14d,%ecx
  mov    %r13d,%edx
  lea    D77(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <fprintf@plt>
  mov    0x18(%rsp),%r14d
  jmp    L8
L30:
  lea    0x1(%r13),%edx
  mov    $0x0,%r8d
  mov    0x18(%rsp),%ecx
  lea    D77(%rip),%rsi
  mov    0x8(%rsp),%r15
  mov    %r15,%rdi
  call   <fprintf@plt>
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L72
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L72:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D66
type: string
name: disassemble_data
arguments: data_tag: D65
type: string
name: disassemble_data
arguments: data_tag: D18
type: string
name: disassemble_data
arguments: data_tag: D46
type: string
name: disassemble_data
arguments: data_tag: D42
type: string
name: disassemble_data
arguments: data_tag: D77
type: string

tool: D66: a

tool: D65: r

tool: D18: %i

tool: D46: %s

tool: D42: cost

tool: D77: a %i %i %i 0


assistant: ```c
int main(int argc, char **argv) {
  FILE *f1, *f2;
  int i, j = 0;
  char key[10];
  int prev_node, node, code;
  f1 = fopen(argv[2], "a");
  f2 = fopen(argv[1], "r");
  node = 0;
  prev_node = 0;
  while ((code = fscanf(f2, "%i", &node)) >= 0) {
    if (!code && node) {
      fscanf(f2, "%s", key);
      if (strcmp("cost", key) == 0)
        break;
      node = 0;
      j++;
      if (prev_node)
        fprintf(f1, "a %i %i %i 0\n", j, prev_node, node);
    } else if (!code) {
      fscanf(f2, "%s", key);
      prev_node = 0;
    } else if (code == 1) {
      j++;
      fprintf(f1, "a %i %i %i 0\n", j, prev_node, node);
      prev_node = node;
    }
  }
  j++;
  fprintf(f1, "a %i %i %i 0\n", j, node, 0);
  fclose(f1);
  fclose(f2);
}
```