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

```asm
<tls1_prf>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  mov    %rdx,%rdi
  push   %r14
  push   %r13
  movslq %esi,%r13
  push   %r12
  push   %rbp
  mov    %r8d,%ebp
  push   %rbx
  mov    %r9,%rbx
  sub    $0xf8,%rsp
  mov    %rcx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  mov    %rdx,0x10(%rsp)
  call   <strlen@plt>
  lea    0x14(%rbp,%rax,1),%eax
  cmp    $0x80,%eax
  ja     L54
  lea    0x1(%r13),%eax
  mov    0x10(%rsp),%rdi
  mov    %eax,%r12d
  shr    $0x1f,%r12d
  add    %eax,%r12d
  sar    %r12d
  movslq %r12d,%rax
  sub    %rax,%r13
  lea    (%r15,%r13,1),%rax
  lea    0x60(%rsp),%r13
  mov    %rax,0x20(%rsp)
  call   <strlen@plt>
  mov    0x10(%rsp),%rsi
  mov    %eax,%r14d
  lea    0x74(%rsp),%rax
  mov    %r14d,%edx
  mov    %rax,%rdi
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <memcpy@plt>
  movslq %r14d,%rax
  mov    0x8(%rsp),%rsi
  mov    %ebp,%edx
  lea    0x14(%r13,%rax,1),%rdi
  xor    %eax,%eax
  add    %r14d,%ebp
  call   <memcpy@plt>
  lea    0x64(%rsp),%r14
  mov    %ebp,%ecx
  mov    %r12d,%esi
  mov    0x18(%rsp),%rdx
  mov    %r14,%r8
  mov    %r15,%rdi
  mov    %ebp,0x2c(%rsp)
  call   <md5_hmac@plt>
  mov    0x130(%rsp),%eax
  test   %eax,%eax
  jle    L259
  mov    $0xf,%r9d
  lea    0x40(%rsp),%r10
  mov    %rbx,0x30(%rsp)
  mov    0x130(%rsp),%eax
  mov    %r13,0x38(%rsp)
  and    $0xf,%eax
  mov    %eax,0x28(%rsp)
  lea    0x10(%rbp),%eax
  mov    %rbx,%rbp
  mov    %r9d,%ebx
  mov    %eax,0x10(%rsp)
  mov    0x130(%rsp),%eax
  mov    %rbp,%r13
  mov    %r14,%rbp
  mov    %r10,%r14
  sub    $0x1,%eax
  and    $0xfffffff0,%eax
  add    $0x1f,%eax
  mov    %eax,0x8(%rsp)
  jmp    L25
  nopl   0x0(%rax,%rax,1)
L0:
  and    $0x4,%ecx
  jne    L227
  test   %eax,%eax
  je     L140
  movzbl (%r14),%ecx
  mov    %cl,0x0(%r13)
  test   $0x2,%al
  jne    L63
L140:
  add    $0x10,%ebx
  add    $0x10,%r13
  cmp    0x8(%rsp),%ebx
  je     L344
L25:
  mov    0x10(%rsp),%ecx
  mov    %r14,%r8
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    %r15,%rdi
  call   <md5_hmac@plt>
  mov    %rbp,%r8
  mov    $0x10,%ecx
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    %r15,%rdi
  call   <md5_hmac@plt>
  mov    $0x10,%eax
  cmp    0x130(%rsp),%ebx
  jge    L287
L250:
  movslq %eax,%rcx
  test   %eax,%eax
  mov    $0x1,%eax
  cmovle %rax,%rcx
  mov    %ecx,%eax
  cmp    $0x8,%ecx
  jb     L0
  mov    (%r14),%rax
  lea    0x8(%r13),%rdi
  mov    %r14,%r8
  and    $0xfffffffffffffff8,%rdi
  mov    %rax,0x0(%r13)
  mov    %ecx,%eax
  mov    -0x8(%r14,%rax,1),%rsi
  mov    %rsi,-0x8(%r13,%rax,1)
  mov    %r13,%rax
  sub    %rdi,%rax
  sub    %rax,%r8
  add    %ecx,%eax
  and    $0xfffffff8,%eax
  cmp    $0x8,%eax
  jb     L140
  and    $0xfffffff8,%eax
  xor    %ecx,%ecx
L66:
  mov    %ecx,%edx
  add    $0x8,%ecx
  mov    (%r8,%rdx,1),%rsi
  mov    %rsi,(%rdi,%rdx,1)
  cmp    %eax,%ecx
  jb     L66
  add    $0x10,%ebx
  add    $0x10,%r13
  cmp    0x8(%rsp),%ebx
  jne    L25
L344:
  mov    %r14,0x8(%rsp)
  mov    0x38(%rsp),%r13
  mov    %r12d,%esi
  xor    %ebp,%ebp
  mov    0x2c(%rsp),%r14d
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%rdi
  mov    %r13,%r8
  mov    0x30(%rsp),%rbx
  mov    %r14d,%ecx
  add    $0x14,%r14d
  call   <sha1_hmac@plt>
  mov    0x8(%rsp),%r10
  mov    %r14d,0x28(%rsp)
  mov    %rbx,%r14
  movslq 0x130(%rsp),%r11
  mov    0x130(%rsp),%eax
  mov    %r10,0x10(%rsp)
  mov    0x20(%rsp),%rbx
  imul   $0x66666667,%r11,%r11
  sar    $0x1f,%eax
  sar    $0x23,%r11
  mov    %r11d,%r15d
  sub    %eax,%r15d
  lea    (%r15,%r15,4),%eax
  mov    0x130(%rsp),%r15d
  shl    $0x2,%eax
  sub    %eax,%r15d
  jmp    L226
  nop
L285:
  movdqu (%r14,%rbp,1),%xmm0
  mov    $0x14,%ecx
  mov    $0x10,%eax
  pxor   0x40(%rsp),%xmm0
  movups %xmm0,(%r14,%rbp,1)
L296:
  lea    (%r11,%rax,1),%esi
  movslq %eax,%rdi
  movslq %esi,%rsi
  movzbl 0x40(%rsp,%rdi,1),%edi
  xor    %dil,(%r14,%rsi,1)
  lea    0x1(%rax),%esi
  cmp    %ecx,%esi
  jge    L17
  lea    (%rsi,%r11,1),%edi
  movslq %esi,%rsi
  movslq %edi,%rdi
  movzbl 0x40(%rsp,%rsi,1),%esi
  xor    %sil,(%r14,%rdi,1)
  lea    0x2(%rax),%esi
  cmp    %ecx,%esi
  jge    L17
  lea    (%r11,%rsi,1),%edi
  movslq %esi,%rsi
  movslq %edi,%rdi
  movzbl 0x40(%rsp,%rsi,1),%esi
  xor    %sil,(%r14,%rdi,1)
  lea    0x3(%rax),%esi
  cmp    %ecx,%esi
  jge    L17
  lea    (%r11,%rsi,1),%edi
  movslq %esi,%rsi
  movslq %edi,%rdi
  movzbl 0x40(%rsp,%rsi,1),%esi
  xor    %sil,(%r14,%rdi,1)
  lea    0x4(%rax),%esi
  cmp    %ecx,%esi
  jge    L17
  lea    (%r11,%rsi,1),%edi
  movslq %esi,%rsi
  movslq %edi,%rdi
  movzbl 0x40(%rsp,%rsi,1),%esi
  xor    %sil,(%r14,%rdi,1)
  lea    0x5(%rax),%esi
  cmp    %ecx,%esi
  jge    L17
  lea    (%r11,%rsi,1),%edi
  add    $0x6,%eax
  movslq %esi,%rsi
  movslq %edi,%rdi
  movzbl 0x40(%rsp,%rsi,1),%esi
  xor    %sil,(%r14,%rdi,1)
  cmp    %ecx,%eax
  jge    L17
  add    %eax,%r11d
  cltq
  movslq %r11d,%r11
  movzbl 0x40(%rsp,%rax,1),%eax
  xor    %al,(%r14,%r11,1)
L17:
  add    $0x14,%rbp
  cmp    %ebp,0x130(%rsp)
  jle    L215
L226:
  mov    0x10(%rsp),%r8
  mov    0x28(%rsp),%ecx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  mov    %ebp,0x8(%rsp)
  call   <sha1_hmac@plt>
  mov    %r13,%r8
  mov    $0x14,%ecx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <sha1_hmac@plt>
  lea    0x13(%rbp),%eax
  cmp    %eax,0x130(%rsp)
  mov    0x8(%rsp),%r11d
  jg     L285
  test   %r15d,%r15d
  je     L17
  mov    $0x1,%edi
  cmovg  %r15d,%edi
  cmp    $0xf,%r15d
  jle    L231
  movdqu (%r14,%rbp,1),%xmm0
  pxor   0x40(%rsp),%xmm0
  movups %xmm0,(%r14,%rbp,1)
  cmp    $0x10,%edi
  je     L17
  mov    $0x10,%ecx
  mov    $0x10,%eax
L92:
  sub    %ecx,%edi
  lea    -0x1(%rdi),%esi
  cmp    $0x6,%esi
  jbe    L101
  lea    0x0(%rbp,%rcx,1),%rsi
  movq   0x40(%rsp,%rcx,1),%xmm1
  mov    %edi,%ecx
  add    %r14,%rsi
  and    $0xfffffff8,%ecx
  movq   (%rsi),%xmm0
  add    %ecx,%eax
  pxor   %xmm1,%xmm0
  movq   %xmm0,(%rsi)
  cmp    %ecx,%edi
  je     L17
L101:
  mov    %r15d,%ecx
  jmp    L296
  nopw   0x0(%rax,%rax,1)
L287:
  mov    0x28(%rsp),%edx
  mov    %edx,%eax
  test   %edx,%edx
  jne    L250
  jmp    L140
  nopl   0x0(%rax,%rax,1)
L215:
  mov    0x10(%rsp),%r10
L19:
  mov    $0x80,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %r10,0x8(%rsp)
  call   <memset@plt>
  mov    0x8(%rsp),%rdi
  mov    $0x14,%edx
  xor    %esi,%esi
  call   <memset@plt>
  xor    %eax,%eax
L206:
  mov    0xe8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L230
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L231:
  xor    %ecx,%ecx
  xor    %eax,%eax
  jmp    L92
L227:
  mov    (%r14),%ecx
  mov    %ecx,0x0(%r13)
  mov    -0x4(%r14,%rax,1),%ecx
  mov    %ecx,-0x4(%r13,%rax,1)
  jmp    L140
L63:
  movzwl -0x2(%r14,%rax,1),%ecx
  mov    %cx,-0x2(%r13,%rax,1)
  jmp    L140
L259:
  mov    0x2c(%rsp),%ecx
  mov    0x18(%rsp),%rdx
  mov    %r13,%r8
  mov    %r12d,%esi
  mov    0x20(%rsp),%rdi
  call   <sha1_hmac@plt>
  lea    0x40(%rsp),%r10
  jmp    L19
L54:
  mov    $0xffffe800,%eax
  jmp    L206
L230:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int tls1_prf(unsigned char *secret, int slen, char *label, unsigned char *random, int rlen, unsigned char *dstbuf, int dlen) {
  int nb, hs;
  int i, j, k;
  unsigned char *S1, *S2;
  unsigned char tmp[128];
  unsigned char h_i[20];
  if (sizeof(tmp) < 20 + strlen(label) + rlen)
    return (-0x1800);
  hs = (slen + 1) / 2;
  S1 = secret;
  S2 = secret + slen - hs;
  nb = strlen(label);
  memcpy(tmp + 20, label, nb);
  memcpy(tmp + 20 + nb, random, rlen);
  nb += rlen;
  md5_hmac(S1, hs, tmp + 20, nb, 4 + tmp);
  for (i = 0; i < dlen; i += 16) {
    md5_hmac(S1, hs, 4 + tmp, 16 + nb, h_i);
    md5_hmac(S1, hs, 4 + tmp, 16, 4 + tmp);
    k = (i + 16 > dlen) ? dlen % 16 : 16;
    for (j = 0; j < k; j++)
      dstbuf[i + j] = h_i[j];
  }
  sha1_hmac(S2, hs, tmp + 20, nb, tmp);
  for (i = 0; i < dlen; i += 20) {
    sha1_hmac(S2, hs, tmp, 20 + nb, h_i);
    sha1_hmac(S2, hs, tmp, 20, tmp);
    k = (i + 20 > dlen) ? dlen % 20 : 20;
    for (j = 0; j < k; j++)
      dstbuf[i + j] = (unsigned char)(dstbuf[i + j] ^ h_i[j]);
  }
  memset(tmp, 0, sizeof(tmp));
  memset(h_i, 0, sizeof(h_i));
  return (0);
}
```