user: 请将以下的汇编代码转换成C语言代码:

```asm
<tcp6_checksum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdx,-0x28(%rbp)
  mov    %rsp,%rcx
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  mov    D5(%rip),%rax
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L44
L0:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L0
L44:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L48
L19:
  lea    -0x18(%rbp),%rsi
  mov    $0x1,%edx
  mov    %rsp,%rdi
  call   <memcpy@plt>
  lea    -0x17(%rbp),%rsi
  mov    $0x1,%edx
  lea    0x1(%rsp),%rdi
  call   <memcpy@plt>
  mov    $0x10,%edi
  call   <htonl@plt>
  lea    -0xa(%rbp),%rsi
  lea    0x2(%rsp),%rdi
  mov    $0x1,%edx
  mov    %al,-0xa(%rbp)
  call   <memcpy@plt>
  xor    %eax,%eax
  lea    -0x16(%rbp),%rsi
  lea    0x6(%rsp),%rdi
  mov    $0x1,%edx
  mov    %ax,0x3(%rsp)
  movb   $0x0,0x5(%rsp)
  call   <memcpy@plt>
  lea    -0x30(%rbp),%rsi
  lea    0x7(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  lea    -0x2f(%rbp),%rsi
  lea    0x8(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  lea    -0x2e(%rbp),%rsi
  lea    0x9(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  lea    -0x2d(%rbp),%rsi
  lea    0xa(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  movzbl -0x2c(%rbp),%eax
  lea    -0x9(%rbp),%rsi
  lea    0xb(%rsp),%rdi
  mov    $0x1,%edx
  shl    $0x4,%eax
  add    -0x28(%rbp),%al
  mov    %al,-0x9(%rbp)
  call   <memcpy@plt>
  lea    -0x24(%rbp),%rsi
  lea    0xc(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  lea    -0x23(%rbp),%rsi
  lea    0xd(%rsp),%rdi
  mov    $0x1,%edx
  call   <memcpy@plt>
  xor    %edx,%edx
  lea    -0x22(%rbp),%rsi
  lea    0x10(%rsp),%rdi
  mov    %dx,0xe(%rsp)
  mov    $0x1,%edx
  call   <memcpy@plt>
  mov    $0x11,%esi
  mov    %rsp,%rdi
  call   <checksum@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  leave
  ret
  nop
L48:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L19
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint16_t tcp6_checksum(struct ip6_hdr iphdr, struct tcphdr tcphdr) {
  uint32_t lvalue;
  char buf[IP_MAXPACKET], cvalue;
  char *ptr;
  int chksumlen = 0;
  ptr = &buf[0];
  memcpy(ptr, &iphdr.ip6_src, sizeof(iphdr.ip6_src));
  ptr += sizeof(iphdr.ip6_src);
  chksumlen += sizeof(iphdr.ip6_src);
  memcpy(ptr, &iphdr.ip6_dst, sizeof(iphdr.ip6_dst));
  ptr += sizeof(iphdr.ip6_dst);
  chksumlen += sizeof(iphdr.ip6_dst);
  lvalue = htonl(sizeof(tcphdr));
  memcpy(ptr, &lvalue, sizeof(lvalue));
  ptr += sizeof(lvalue);
  chksumlen += sizeof(lvalue);
  *ptr = 0;
  ptr++;
  *ptr = 0;
  ptr++;
  *ptr = 0;
  ptr++;
  chksumlen += 3;
  memcpy(ptr, &iphdr.ip6_nxt, sizeof(iphdr.ip6_nxt));
  ptr += sizeof(iphdr.ip6_nxt);
  chksumlen += sizeof(iphdr.ip6_nxt);
  memcpy(ptr, &tcphdr.th_sport, sizeof(tcphdr.th_sport));
  ptr += sizeof(tcphdr.th_sport);
  chksumlen += sizeof(tcphdr.th_sport);
  memcpy(ptr, &tcphdr.th_dport, sizeof(tcphdr.th_dport));
  ptr += sizeof(tcphdr.th_dport);
  chksumlen += sizeof(tcphdr.th_dport);
  memcpy(ptr, &tcphdr.th_seq, sizeof(tcphdr.th_seq));
  ptr += sizeof(tcphdr.th_seq);
  chksumlen += sizeof(tcphdr.th_seq);
  memcpy(ptr, &tcphdr.th_ack, sizeof(tcphdr.th_ack));
  ptr += sizeof(tcphdr.th_ack);
  chksumlen += sizeof(tcphdr.th_ack);
  cvalue = (tcphdr.th_off << 4) + tcphdr.th_x2;
  memcpy(ptr, &cvalue, sizeof(cvalue));
  ptr += sizeof(cvalue);
  chksumlen += sizeof(cvalue);
  memcpy(ptr, &tcphdr.th_flags, sizeof(tcphdr.th_flags));
  ptr += sizeof(tcphdr.th_flags);
  chksumlen += sizeof(tcphdr.th_flags);
  memcpy(ptr, &tcphdr.th_win, sizeof(tcphdr.th_win));
  ptr += sizeof(tcphdr.th_win);
  chksumlen += sizeof(tcphdr.th_win);
  *ptr = 0;
  ptr++;
  *ptr = 0;
  ptr++;
  chksumlen += 2;
  memcpy(ptr, &tcphdr.th_urp, sizeof(tcphdr.th_urp));
  ptr += sizeof(tcphdr.th_urp);
  chksumlen += sizeof(tcphdr.th_urp);
  return checksum((uint16_t *)buf, chksumlen);
}
```