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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x3,-0x74(%rbp)
  jg     L57
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L57:
  mov    -0x80(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  lea    D16(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x60(%rbp)
  cmpq   $0x0,-0x60(%rbp)
  jne    L8
  mov    -0x80(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L8:
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,-0x6c(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  lea    -0x6c(%rbp),%rax
  mov    %rax,%rdi
  call   <ctime@plt>
  mov    %rax,%rdx
  mov    -0x60(%rbp),%rax
  lea    D65(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x60(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x36,%edx
  mov    $0x1,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x60(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x5,%edx
  mov    $0x1,%esi
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x80(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rcx
  mov    -0x80(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rdx
  mov    -0x60(%rbp),%rax
  lea    D88(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <cuserid@plt>
  mov    %rax,-0x58(%rbp)
  lea    -0x6c(%rbp),%rax
  mov    %rax,%rdi
  call   <ctime@plt>
  mov    %rax,%rcx
  lea    -0x50(%rbp),%rax
  mov    $0x40,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0x50(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  jmp    L39
L27:
  addq   $0x1,-0x68(%rbp)
L39:
  mov    -0x68(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L27
  subq   $0x1,-0x68(%rbp)
  mov    -0x68(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L56
  mov    -0x68(%rbp),%rax
  movb   $0x0,(%rax)
L56:
  lea    -0x50(%rbp),%rcx
  mov    -0x58(%rbp),%rdx
  mov    -0x60(%rbp),%rax
  lea    D34(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L30
  call   <__stack_chk_fail@plt>
L30:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D24
datatype: string
name: unpack_data
arguments: data_label: D16
datatype: string
name: unpack_data
arguments: data_label: D18
datatype: string
name: unpack_data
arguments: data_label: D36
datatype: string
name: unpack_data
arguments: data_label: D65
datatype: string
name: unpack_data
arguments: data_label: D22
datatype: string
name: unpack_data
arguments: data_label: D60
datatype: string
name: unpack_data
arguments: data_label: D88
datatype: string
name: unpack_data
arguments: data_label: D34
datatype: string

tool: D24: usage: mkversion ostype version outputfile

tool: D16: w

tool: D18: Couldn't create %s


tool: D36: /*


tool: D65:  * G2 Version Stamp, %s

tool: D22:  * Automatically generated, hand edits are pointless.


tool: D60:  */



tool: D88: const char *version_string = "G2 (%s) major version %s";


tool: D34: const char *minor_v_string = "Built by %s at %s";


assistant: ```c
int main(int argc, char **argv) {
  time_t now;
  FILE *ofp;
  char *dateval;
  char *username;
  char *userstr;
  char *datestr;
  int i;
  char propname[32];
  char *propvalue;
  char timestr[64];
  char *cp;
  if (argc < 4) {
    printf("usage: mkversion ostype version outputfile\n");
    exit(1);
  }
  ofp = fopen(argv[3], "w");
  if (ofp == NULL) {
    printf("Couldn't create %s\n", argv[3]);
    exit(1);
  }
  now = time(0);
  fprintf(ofp, "/*\n");
  fprintf(ofp, " * G2 Version Stamp, %s", ctime(&now));
  fprintf(ofp, " * Automatically generated, hand edits are pointless.\n");
  fprintf(ofp, " */\n\n");
  fprintf(ofp, "const char *version_string = \"G2 (%s) major version %s\";\n", argv[1], argv[2]);
  username = (char *)cuserid(0);
  strncpy(timestr, ctime(&now), sizeof(timestr));
  cp = timestr;
  while (*cp) {
    cp++;
  }
  if (*--cp == '\n')
    *cp = 0;
  fprintf(ofp, "const char *minor_v_string = \"Built by %s at %s\";\n", username, timestr);
  exit(0);
}
```