user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<tls1_P_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8d,-0x68(%rbp)
  mov    %r9,-0x78(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0x80(%rbp)
  mov    0x28(%rbp),%rax
  mov    %rax,-0x88(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x40(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L123:
  cmp    %rdx,%rsp
  je     L29
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L123
L29:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L40
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L40:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x38(%rbp)
  mov    $0x0,%eax
  call   <HMAC_CTX_new@plt>
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x44(%rbp)
  mov    -0x58(%rbp),%rcx
  mov    -0x64(%rbp),%edx
  mov    -0x60(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    $0x0,%r8d
  mov    %rax,%rdi
  call   <HMAC_Init_ex@plt>
L114:
  cmpl   $0x0,-0x44(%rbp)
  je     L60
  mov    -0x48(%rbp),%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Update@plt>
L60:
  cmpq   $0x0,-0x70(%rbp)
  je     L37
  mov    -0x68(%rbp),%edx
  mov    -0x70(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Update@plt>
L37:
  cmpq   $0x0,-0x78(%rbp)
  je     L74
  mov    -0x78(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    0x10(%rbp),%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Update@plt>
L74:
  cmpq   $0x0,-0x80(%rbp)
  je     L48
  mov    0x20(%rbp),%edx
  mov    -0x80(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Update@plt>
L48:
  cmpl   $0x0,-0x44(%rbp)
  jne    L106
  lea    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Final@plt>
  jmp    L27
L106:
  mov    -0x44(%rbp),%edx
  mov    -0x48(%rbp),%eax
  imul   %eax,%edx
  mov    0x30(%rbp),%eax
  cmp    %eax,%edx
  ja     L103
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%eax
  imul   %edx,%eax
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Final@plt>
  mov    -0x48(%rbp),%edi
  mov    -0x38(%rbp),%r8
  mov    -0x38(%rbp),%rcx
  mov    -0x64(%rbp),%edx
  mov    -0x60(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  sub    $0x8,%rsp
  push   $0x0
  mov    %r8,%r9
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <HMAC@plt>
  add    $0x10,%rsp
  jmp    L27
L103:
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <HMAC_Final@plt>
  mov    0x30(%rbp),%eax
  mov    -0x48(%rbp),%ecx
  mov    $0x0,%edx
  div    %ecx
  mov    %edx,%eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%ecx
  mov    -0x48(%rbp),%eax
  imul   %ecx,%eax
  mov    %eax,%ecx
  mov    -0x88(%rbp),%rax
  add    %rax,%rcx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  jmp    L51
L27:
  mov    -0x30(%rbp),%rax
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <HMAC_Init_ex@plt>
  addl   $0x1,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x48(%rbp),%eax
  imul   %eax,%edx
  mov    0x30(%rbp),%eax
  cmp    %eax,%edx
  jbe    L114
L51:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <HMAC_CTX_free@plt>
  mov    $0x1,%eax
  mov    %rbx,%rsp
  mov    -0x28(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L53
  call   <__stack_chk_fail@plt>
L53:
  lea    -0x18(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
int tls1_P_hash(const EVP_MD *md, const unsigned char *sec, int sec_len, const void *seed1, int seed1_len, const void *seed2, int seed2_len, const void *seed3, int seed3_len, unsigned char *out, int olen) {
  unsigned char A1[EVP_MAX_MD_SIZE];
  HMAC_CTX *ctx = HMAC_CTX_new();
  unsigned int chunk;
  int i = 0;
  HMAC_Init_ex(ctx, sec, sec_len, md, NULL);
  do {
    if (i)
      HMAC_Update(ctx, A1, chunk);
    if (seed1)
      HMAC_Update(ctx, seed1, seed1_len);
    if (seed2)
      HMAC_Update(ctx, seed2, seed2_len);
    if (seed3)
      HMAC_Update(ctx, seed3, seed3_len);
    if (!i)
      HMAC_Final(ctx, A1, &chunk);
    else if (i * chunk <= olen) {
      HMAC_Final(ctx, out + ((i - 1) * chunk), NULL);
      HMAC(md, sec, sec_len, A1, chunk, A1, NULL);
    } else {
      HMAC_Final(ctx, A1, NULL);
      memcpy(out + ((i - 1) * chunk), A1, olen % chunk);
      break;
    }
    HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
    i++;
  } while ((i - 1) * chunk <= olen);
  HMAC_CTX_free(ctx);
  return 1;
}
```