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

```asm
<DateFmt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  jg     L34
  mov    -0x48(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x48(%rbp),%rax
  jmp    L128
L34:
  lea    -0x2c(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  lea    -0x34(%rbp),%rsi
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <Date_ymd@plt>
  jmp    L217
L43:
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x25,%al
  je     L160
  mov    -0x58(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x58(%rbp)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x28(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L217
L160:
  addq   $0x1,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  test   %eax,%eax
  je     L217
  test   %eax,%eax
  js     L264
  cmp    $0x79,%eax
  jg     L264
  cmp    $0x44,%eax
  jl     L264
  sub    $0x44,%eax
  cmp    $0x35,%eax
  ja     L264
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D43(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D43(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L264:
  mov    -0x58(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x58(%rbp)
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x28(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  jmp    L217
  mov    -0x50(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <Dyofwk@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x30(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <Mmofyr@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x30(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <Mmofyr@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
  addq   $0x3,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D30(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D28(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  jmp    L257
L65:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L56
  mov    -0x28(%rbp),%rax
  movb   $0x30,(%rax)
L56:
  addq   $0x1,-0x28(%rbp)
L257:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L65
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x34(%rbp),%edx
  movslq %edx,%rax
  imul   $0x51eb851f,%rax,%rax
  shr    $0x20,%rax
  sar    $0x5,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x64,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    -0x28(%rbp),%rcx
  mov    %eax,%edx
  lea    D28(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  jmp    L38
L239:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L211
  mov    -0x28(%rbp),%rax
  movb   $0x30,(%rax)
L211:
  addq   $0x1,-0x28(%rbp)
L38:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L239
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x34(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D2(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <Num_sufx@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D30(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%rax
  lea    D28(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  jmp    L217
  lea    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <Time2@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x28(%rbp)
  addq   $0x1,-0x58(%rbp)
  nop
L217:
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L43
  mov    -0x28(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x48(%rbp),%rax
L128:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L199
  call   <__stack_chk_fail@plt>
L199:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D30
datatype: string
name: unpack_data
arguments: data_label: D28
datatype: string
name: unpack_data
arguments: data_label: D2
datatype: string

tool: D30: %d

tool: D28: %02d

tool: D2: %4d

assistant: ```c
char *DateFmt(char *buf, long dt, char *msk) {
  int y, m, d;
  char tmp[20], *bp = buf;
  if (dt <= 0L) {
    *buf = '\0';
    return (buf);
  }
  Date_ymd(dt, &y, &m, &d);
  while (*msk)
    if (*msk != '%')
      *bp++ = *msk++;
    else
      switch (*++msk) {
      case '\0':
        break;
      case '%':
      default:
        *bp++ = *msk++;
        break;
      case 'W':
      case 'w':
        strcpy(bp, Dyofwk(dt, NULL));
        bp += strlen(bp);
        msk++;
        break;
      case 'M':
        strcpy(bp, Mmofyr(m, NULL));
        bp += strlen(bp);
        msk++;
        break;
      case 'm':
        strcpy(bp, Mmofyr(m, NULL));
        bp += 3;
        msk++;
        break;
      case 'd':
        sprintf(bp, "%d", d);
        bp += strlen(bp);
        msk++;
        break;
      case 'D':
        sprintf(bp, "%02d", d);
        for (; *bp; ++bp)
          if (*bp == ' ')
            *bp = '0';
        msk++;
        break;
      case 'y':
        sprintf(bp, "%02d", y % 100);
        for (; *bp; ++bp)
          if (*bp == ' ')
            *bp = '0';
        msk++;
        break;
      case 'Y':
        sprintf(bp, "%4d", y);
        bp += strlen(bp);
        msk++;
        break;
      case 'S':
      case 's':
        strcpy(bp, Num_sufx(d));
        bp += strlen(bp);
        msk++;
        break;
      case 'n':
        sprintf(bp, "%d", m);
        bp += strlen(bp);
        msk++;
        break;
      case 'N':
        sprintf(bp, "%02d", m);
        bp += strlen(bp);
        msk++;
        break;
      case 'T':
      case 't':
        strcpy(bp, Time2(tmp));
        bp += strlen(bp);
        msk++;
        break;
      }
  *bp = '\0';
  return (buf);
}
```