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

```asm
<set_date_tmpl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%rdx
  lea    -0xd(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    $0x4,%r8d
  mov    $0x79,%ecx
  mov    %rax,%rdi
  call   <get_dt_part@plt>
  test   %rax,%rax
  jns    L104
  mov    $0xffffffff,%eax
  jmp    L204
L104:
  mov    -0x30(%rbp),%rdx
  lea    -0x11(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    $0x3,%r8d
  mov    $0x6d,%ecx
  mov    %rax,%rdi
  call   <get_dt_part@plt>
  test   %rax,%rax
  jns    L183
  mov    $0xffffffff,%eax
  jmp    L204
L183:
  mov    -0x30(%rbp),%rdx
  lea    -0x14(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    $0x2,%r8d
  mov    $0x64,%ecx
  mov    %rax,%rdi
  call   <get_dt_part@plt>
  test   %rax,%rax
  jns    L76
  mov    $0xffffffff,%eax
  jmp    L204
L76:
  lea    -0xd(%rbp),%rax
  mov    %rax,%rdi
  call   <date_digit@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L37
  mov    $0xfffffffe,%eax
  jmp    L204
L37:
  mov    -0x18(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,(%rax)
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x2,%eax
  jg     L156
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <date_digit@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L98
  mov    $0xfffffffd,%eax
  jmp    L204
L156:
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <mmm_val@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L98
  mov    $0xfffffffc,%eax
  jmp    L204
L98:
  cmpl   $0x0,-0x18(%rbp)
  jle    L167
  cmpl   $0xc,-0x18(%rbp)
  jle    L113
L167:
  mov    $0xfffffffd,%eax
  jmp    L204
L113:
  mov    -0x18(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  lea    -0x14(%rbp),%rax
  mov    %rax,%rdi
  call   <date_digit@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jns    L137
  mov    $0xfffffffb,%eax
  jmp    L204
L137:
  mov    -0x18(%rbp),%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%ecx
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <dd_val@plt>
  test   %rax,%rax
  jns    L56
  mov    $0xfffffffb,%eax
  jmp    L204
L56:
  mov    $0x1,%eax
L204:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L85
  call   <__stack_chk_fail@plt>
L85:
  leave
  ret
```

assistant: ```c
int set_date_tmpl(char *dt, char *tmpl, unsigned int *yyyy, unsigned int *mm, unsigned int *dd) {
  int n;
  char yr[5], month[4], day[3];
  if (get_dt_part(dt, yr, tmpl, 'y', 4) < 0)
    return -1;
  if (get_dt_part(dt, month, tmpl, 'm', 3) < 0)
    return -1;
  if (get_dt_part(dt, day, tmpl, 'd', 2) < 0)
    return -1;
  if ((n = date_digit(yr)) < 0)
    return -2;
  *yyyy = (unsigned int)n;
  if (strlen(month) < 3) {
    if ((n = date_digit(month)) < 0)
      return -3;
  } else {
    if ((n = mmm_val(month)) < 0)
      return -4;
  }
  if (n < 1 || n > 12)
    return -3;
  *mm = (unsigned int)n;
  if ((n = date_digit(day)) < 0)
    return -5;
  *dd = (unsigned int)n;
  if ((dd_val(*dd, *mm, *yyyy)) < 0)
    return -5;
  return 1;
}
```