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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x20(%rbp)
  movl   $0x1,-0x34(%rbp)
  cmpl   $0x1,-0x44(%rbp)
  jg     L26
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L26:
  mov    -0x50(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rdx
  lea    -0x30(%rbp),%rax
  lea    D112(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <asprintf@plt>
  mov    -0x10(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  lea    D56(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <asprintf@plt>
  mov    -0x30(%rbp),%rax
  lea    D38(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L86
  mov    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <warn@plt>
  jmp    L91
L86:
  mov    -0x28(%rbp),%rax
  lea    D38(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L75
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <warn@plt>
  jmp    L91
L75:
  mov    -0x18(%rbp),%rax
  lea    D104(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    -0x20(%rbp),%rax
  lea    D0(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D105(%rip),%rax
  mov    %rax,%rdi
  call   <exec_cmd@plt>
  test   %rax,%rax
  jne    L56
  mov    -0x20(%rbp),%rax
  lea    D59(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    -0x20(%rbp),%rax
  lea    D21(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  call   <exec_cmd@plt>
  test   %rax,%rax
  jne    L47
  mov    -0x20(%rbp),%rax
  lea    D59(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L91
L56:
  nop
  jmp    L91
L47:
  nop
L91:
  cmpq   $0x0,-0x18(%rbp)
  je     L9
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L9:
  cmpq   $0x0,-0x20(%rbp)
  je     L112
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L112:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x34(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L101
  call   <__stack_chk_fail@plt>
L101:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D14
data_type: string
name: extract_symbolic_data
arguments: tag: D112
data_type: string
name: extract_symbolic_data
arguments: tag: D56
data_type: string
name: extract_symbolic_data
arguments: tag: D38
data_type: string
name: extract_symbolic_data
arguments: tag: D13
data_type: string
name: extract_symbolic_data
arguments: tag: D104
data_type: string
name: extract_symbolic_data
arguments: tag: D0
data_type: string
name: extract_symbolic_data
arguments: tag: D105
data_type: string
name: extract_symbolic_data
arguments: tag: D59
data_type: string
name: extract_symbolic_data
arguments: tag: D21
data_type: string
name: extract_symbolic_data
arguments: tag: D115
data_type: string

tool: D14: usage: mkversion OUTDIR


tool: D112: %s/version.h

tool: D56: %s/version.c

tool: D38: wt

tool: D13: cannot open %s

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


tool: D0: const char app_version[] = "

tool: D105: git describe --tags --long

tool: D59: ";


tool: D21: const char app_date[] = "

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

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;
}
```