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

```asm
<zipmapXSet>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%rbp
  mov    %rdi,(%rsp)
  mov    %rsi,%r15
  mov    %rsi,0x8(%rsp)
  mov    %edx,%ebx
  mov    %ecx,0x14(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %r9d,%r13d
  mov    0x70(%rsp),%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %r9d,%esi
  mov    %edx,%edi
  call   <zipmapXRequiredLength@plt>
  mov    %eax,%r12d
  test   %r14,%r14
  je     L40
  movl   $0x0,(%r14)
  lea    0x24(%rsp),%rcx
  mov    $0x0,%r8d
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <zipmapXLookupRaw@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L49
  movl   $0x1,(%r14)
L61:
  mov    %rbp,%rdi
  call   <zipmapXRawEntryLength@plt>
  mov    %eax,%r14d
  cmp    %eax,%r12d
  ja     L27
  mov    %eax,%r15d
  sub    %r12d,%r15d
  mov    (%rsp),%rax
  cmp    $0x3,%r15d
  jbe    L78
  mov    %rbp,%r15
  sub    %rax,%r15
  mov    %r14d,%edx
  not    %edx
  add    0x24(%rsp),%edx
  sub    %r15d,%edx
  mov    %r14d,%esi
  add    %rbp,%rsi
  mov    %r12d,%edi
  add    %rbp,%rdi
  call   <memmove@plt>
  mov    %r12d,%esi
  add    0x24(%rsp),%esi
  sub    %r14d,%esi
  mov    %esi,0x24(%rsp)
  mov    (%rsp),%rdi
  call   <zipmapResize@plt>
  mov    %rax,(%rsp)
  mov    %r15d,%r15d
  lea    (%rax,%r15,1),%rbp
  mov    $0x0,%r15d
  jmp    L78
L27:
  mov    %rbp,%r15
  mov    (%rsp),%rdi
  sub    %rdi,%r15
  mov    %r12d,%esi
  add    0x24(%rsp),%esi
  sub    %eax,%esi
  call   <zipmapResize@plt>
  mov    %rax,(%rsp)
  mov    %r15d,%ebp
  add    %rax,%rbp
  mov    %r14d,%edx
  not    %edx
  add    0x24(%rsp),%edx
  sub    %r15d,%edx
  mov    %r14d,%esi
  add    %rbp,%rsi
  mov    %r12d,%edi
  add    %rbp,%rdi
  call   <memmove@plt>
  sub    %r14d,%r12d
  add    %r12d,0x24(%rsp)
L53:
  mov    $0x0,%r15d
L78:
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <zipmapEncodeLength@plt>
  cltq
  add    %rax,%rbp
  mov    %ebx,%edx
  mov    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %ebx,%ebx
  add    %rbx,%rbp
  mov    0x14(%rsp),%eax
  mov    %eax,0x0(%rbp)
  add    $0x4,%rbp
  mov    %r13d,%esi
  mov    %rbp,%rdi
  call   <zipmapEncodeLength@plt>
  cltq
  add    %rax,%rbp
  mov    %r15b,0x0(%rbp)
  lea    0x1(%rbp),%rdi
  mov    %r13d,%edx
  mov    0x18(%rsp),%rsi
  call   <memcpy@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  mov    (%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L40:
  lea    0x24(%rsp),%rcx
  mov    $0x0,%r8d
  mov    %ebx,%edx
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  call   <zipmapXLookupRaw@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L61
L49:
  mov    %r12d,%esi
  add    0x24(%rsp),%esi
  mov    (%rsp),%rdi
  call   <zipmapResize@plt>
  mov    %rax,%rcx
  mov    %rax,(%rsp)
  mov    0x24(%rsp),%eax
  lea    -0x1(%rcx,%rax,1),%rbp
  mov    %r12d,%eax
  add    0x24(%rsp),%eax
  mov    %eax,0x24(%rsp)
  movzbl (%rcx),%eax
  cmp    $0xfd,%al
  ja     L53
  add    $0x1,%eax
  mov    %al,(%rcx)
  jmp    L53
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned char *zipmapXSet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned int timestamp, unsigned char *val, unsigned int vlen, int *update) {
  unsigned int zmlen, offset;
  unsigned int freelen, reqlen = zipmapXRequiredLength(klen, vlen);
  unsigned int empty, vempty;
  unsigned char *p = NULL;
  unsigned int *ts = NULL;
  freelen = reqlen;
  if (update)
    *update = 0;
  p = zipmapXLookupRaw(zm, key, klen, &zmlen, ts);
  if (p == NULL) {
    zm = zipmapResize(zm, zmlen + reqlen);
    p = zm + zmlen - 1;
    zmlen = zmlen + reqlen;
    if (zm[0] < 254)
      zm[0]++;
  } else {
    if (update)
      *update = 1;
    freelen = zipmapXRawEntryLength(p);
    if (freelen < reqlen) {
      offset = p - zm;
      zm = zipmapResize(zm, zmlen - freelen + reqlen);
      p = zm + offset;
      memmove(p + reqlen, p + freelen, zmlen - (offset + freelen + 1));
      zmlen = zmlen - freelen + reqlen;
      freelen = reqlen;
    }
  }
  empty = freelen - reqlen;
  if (empty >= 4) {
    offset = p - zm;
    memmove(p + reqlen, p + freelen, zmlen - (offset + freelen + 1));
    zmlen -= empty;
    zm = zipmapResize(zm, zmlen);
    p = zm + offset;
    vempty = 0;
  } else {
    vempty = empty;
  }
  p += zipmapEncodeLength(p, klen);
  memcpy(p, key, klen);
  p += klen;
  *(unsigned int *)p = timestamp;
  p += sizeof(unsigned int);
  p += zipmapEncodeLength(p, vlen);
  *p++ = vempty;
  memcpy(p, val, vlen);
  return zm;
}
```