user: 请从给定的汇编指令推导出C源代码:

```asm
<validate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x34(%rbp),%ecx
  mov    -0x30(%rbp),%rdx
  lea    -0x18(%rbp),%rsi
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <encode_block@plt>
  test   %rax,%rax
  jns    L37
  mov    $0xffffffff,%eax
  jmp    L92
L37:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x18(%rbp),%edx
  cmp    %edx,%eax
  je     L78
  mov    $0xffffffff,%eax
  jmp    L92
L78:
  mov    -0x18(%rbp),%edx
  lea    -0x11(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L98
  mov    $0xffffffff,%eax
  jmp    L92
L98:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rdx
  lea    -0x18(%rbp),%rsi
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <decode_block@plt>
  test   %rax,%rax
  jns    L59
  mov    $0xffffffff,%eax
  jmp    L92
L59:
  mov    -0x18(%rbp),%eax
  cmp    %eax,-0x34(%rbp)
  je     L87
  mov    $0xffffffff,%eax
  jmp    L92
L87:
  mov    -0x18(%rbp),%edx
  lea    -0x11(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L248
  mov    $0xffffffff,%eax
  jmp    L92
L248:
  mov    -0x34(%rbp),%ecx
  mov    -0x30(%rbp),%rdx
  lea    -0x18(%rbp),%rsi
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <encode_context@plt>
  test   %rax,%rax
  jns    L55
  mov    $0xffffffff,%eax
  jmp    L92
L55:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x18(%rbp),%edx
  cmp    %edx,%eax
  je     L196
  mov    $0xffffffff,%eax
  jmp    L92
L196:
  mov    -0x18(%rbp),%edx
  lea    -0x11(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L134
  mov    $0xffffffff,%eax
  jmp    L92
L134:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rdx
  lea    -0x18(%rbp),%rsi
  lea    -0x11(%rbp),%rax
  mov    %rax,%rdi
  call   <decode_context@plt>
  test   %rax,%rax
  jns    L57
  mov    $0xffffffff,%eax
  jmp    L92
L57:
  mov    -0x18(%rbp),%eax
  cmp    %eax,-0x34(%rbp)
  je     L214
  mov    $0xffffffff,%eax
  jmp    L92
L214:
  mov    -0x18(%rbp),%edx
  lea    -0x11(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L241
  mov    $0xffffffff,%eax
  jmp    L92
L241:
  mov    $0x0,%eax
L92:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L142
  call   <__stack_chk_fail@plt>
L142:
  leave
  ret
```

assistant: ```c
int validate(const char *dst, const void *src, int srclen) {
  int n;
  char buf[9];
  if (encode_block(buf, &n, src, srclen) < 0)
    return (-1);
  if (n != strlen(dst))
    return (-1);
  if (strncmp(dst, buf, n))
    return (-1);
  if (decode_block(buf, &n, dst, strlen(dst)) < 0)
    return (-1);
  if (n != srclen)
    return (-1);
  if (strncmp(src, buf, n))
    return (-1);
  if (encode_context(buf, &n, src, srclen) < 0)
    return (-1);
  if (n != strlen(dst))
    return (-1);
  if (strncmp(dst, buf, n))
    return (-1);
  if (decode_context(buf, &n, dst, strlen(dst)) < 0)
    return (-1);
  if (n != srclen)
    return (-1);
  if (strncmp(src, buf, n))
    return (-1);
  return (0);
}
```