user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%edi
  jle    L28
L81:
  mov    0x8(%rbp),%r12
  lea    0x8(%rsp),%rdi
  lea    D79(%rip),%rsi
  lea    D85(%rip),%rbp
  mov    %r12,%rdx
  call   <asprintf@plt>
  mov    %r12,%rdx
  lea    0x10(%rsp),%rdi
  lea    D93(%rip),%rsi
  call   <asprintf@plt>
  mov    0x8(%rsp),%rdi
  mov    %rbp,%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L45
  mov    0x10(%rsp),%rdi
  mov    %rbp,%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L57
  lea    D45(%rip),%rsi
  mov    %r12,%rdi
  call   <fprintf@plt>
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rsi
  lea    D78(%rip),%rdi
  call   <exec_cmd@plt>
  test   %rax,%rax
  je     L54
L11:
  mov    $0x1,%r13d
L21:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
L19:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  add    $0x20,%rsp
  mov    %r13d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L54:
  lea    D113(%rip),%r13
  mov    %rbp,%rdi
  mov    %r13,%rsi
  call   <fprintf@plt>
  lea    D40(%rip),%rsi
  mov    %rbp,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rsi
  lea    D72(%rip),%rdi
  call   <exec_cmd@plt>
  test   %rax,%rax
  jne    L11
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %r13d,%r13d
  call   <fprintf@plt>
  jmp    L21
L28:
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L81
L45:
  mov    0x8(%rsp),%rsi
  lea    D13(%rip),%rdi
  mov    $0x1,%r13d
  call   <warn@plt>
  jmp    L19
L57:
  mov    0x10(%rsp),%rsi
  lea    D13(%rip),%rdi
  mov    $0x1,%r13d
  call   <warn@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  jmp    L19
L76:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D79
type: string
name: extract_symbolic_data
arguments: label: D85
type: string
name: extract_symbolic_data
arguments: label: D93
type: string
name: extract_symbolic_data
arguments: label: D45
type: string
name: extract_symbolic_data
arguments: label: D34
type: string
name: extract_symbolic_data
arguments: label: D78
type: string
name: extract_symbolic_data
arguments: label: D113
type: string
name: extract_symbolic_data
arguments: label: D40
type: string
name: extract_symbolic_data
arguments: label: D72
type: string
name: extract_symbolic_data
arguments: label: D38
type: string
name: extract_symbolic_data
arguments: label: D13
type: string

tool: D79: %s/version.h

tool: D85: wt

tool: D93: %s/version.c

tool: D45: extern const char app_version[];
extern const char app_date[];


tool: D34: const char app_version[] = "

tool: D78: git describe --tags --long

tool: D113: ";


tool: D40: const char app_date[] = "

tool: D72: git log -n 1 --format=%ai

tool: D38: usage: mkversion OUTDIR


tool: D13: cannot open %s

assistant: ```c
int main(int argc, char **argv) {
  FILE *fh = NULL, *fc = NULL;
  char *hfile, *cfile;
  const char *outdir;
  int ret = 1;
  if (argc < 2) {
    printf("usage: mkversion OUTDIR\n");
    exit(1);
  }
  outdir = argv[1];
  asprintf(&hfile, "%s/version.h", outdir);
  asprintf(&cfile, "%s/version.c", outdir);
  fh = fopen(hfile, "wt");
  if (fh == NULL) {
    warn("cannot open %s", hfile);
    goto out;
  }
  fc = fopen(cfile, "wt");
  if (fc == NULL) {
    warn("cannot open %s", cfile);
    goto out;
  }
  fprintf(fh, "extern const char app_version[];\n"
              "extern const char app_date[];\n");
  fprintf(fc, "const char app_version[] = \"");
  if (exec_cmd("git describe --tags --long", fc) != 0)
    goto out;
  fprintf(fc, "\";\n");
  fprintf(fc, "const char app_date[] = \"");
  if (exec_cmd("git log -n 1 --format=%ai", fc) != 0)
    goto out;
  fprintf(fc, "\";\n");
  ret = 0;
out:
  if (fh != NULL)
    fclose(fh);
  if (fc != NULL)
    fclose(fc);
  free(hfile);
  free(cfile);
  return ret;
}
```