user: Translate the below assembly code into C programming language:

```asm
<beta_RSA_padding_add_PKCS1_OAEP_mgf1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbx
  lea    -0x1(%rsi),%ebx
  sub    $0x68,%rsp
  mov    %rdx,-0x60(%rbp)
  mov    0x10(%rbp),%r15
  mov    %ecx,-0x48(%rbp)
  mov    %rsp,%rcx
  mov    0x18(%rbp),%r14
  mov    %r8,-0x50(%rbp)
  mov    %r9d,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    D4(%rip),%rax
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L43
L350:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L350
L43:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L122
L24:
  mov    %rsp,-0x80(%rbp)
  test   %r15,%r15
  jne    L21
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    %rax,%r15
L21:
  test   %r14,%r14
  mov    %r15,%rdi
  cmove  %r15,%r14
  call   <EVP_MD_size@plt>
  lea    (%rax,%rax,1),%r10d
  mov    %eax,%r12d
  mov    %ebx,%eax
  sub    %r10d,%eax
  mov    %eax,-0x58(%rbp)
  cmp    %ebx,%r10d
  jge    L366
  mov    -0x48(%rbp),%esi
  cmp    %esi,%eax
  jle    L366
  movslq %r12d,%rax
  movb   $0x0,0x0(%r13)
  mov    -0x54(%rbp),%esi
  xor    %r9d,%r9d
  mov    %rax,-0x68(%rbp)
  add    $0x1,%rax
  mov    -0x50(%rbp),%rdi
  xor    %ecx,%ecx
  lea    0x0(%r13,%rax,1),%r11
  mov    %r15,%r8
  mov    %r10d,-0x74(%rbp)
  mov    %r11,%rdx
  mov    %rax,-0x88(%rbp)
  mov    %r11,-0x70(%rbp)
  call   <EVP_Digest@plt>
  test   %eax,%eax
  jne    L3
  nopw   0x0(%rax,%rax,1)
L366:
  xor    %eax,%eax
L30:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L195
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L3:
  mov    -0x74(%rbp),%r10d
  mov    -0x70(%rbp),%r11
  mov    %ebx,%ecx
  xor    %esi,%esi
  sub    -0x48(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  lea    0x1(%r13),%r15
  sub    %r10d,%ecx
  mov    %r11,-0x50(%rbp)
  lea    -0x1(%rcx),%edx
  lea    (%r11,%rax,1),%rdi
  mov    %ecx,-0x54(%rbp)
  call   <memset@plt>
  mov    -0x54(%rbp),%ecx
  mov    -0x50(%rbp),%r11
  movslq %ebx,%rdi
  movslq -0x48(%rbp),%rax
  mov    -0x60(%rbp),%rsi
  add    %r12d,%ecx
  mov    %r11,-0x48(%rbp)
  movslq %ecx,%rcx
  sub    %rax,%rdi
  sub    -0x68(%rbp),%rdi
  mov    %rax,%rdx
  movb   $0x1,-0x1(%r11,%rcx,1)
  add    %r11,%rdi
  call   <memcpy@plt>
  mov    %r12d,%esi
  mov    %r15,%rdi
  call   <RAND_bytes@plt>
  test   %rax,%rax
  jle    L366
  mov    -0x58(%rbp),%r9d
  add    %r12d,%r9d
  mov    %r9d,%edi
  mov    %r9d,-0x50(%rbp)
  call   <OPENSSL_malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L366
  mov    -0x50(%rbp),%esi
  mov    %r14,%r8
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    %rax,%rdi
  call   <beta_PKCS1_MGF1@plt>
  test   %rax,%rax
  js     L366
  mov    -0x50(%rbp),%r9d
  mov    -0x48(%rbp),%r11
  test   %r9d,%r9d
  jle    L351
  lea    0x1(%rbx),%rsi
  mov    %r11,%rdx
  lea    -0x1(%r9),%eax
  mov    %r9d,%ecx
  sub    %rsi,%rdx
  cmp    $0xe,%rdx
  jbe    L304
  cmp    $0x6,%eax
  jbe    L304
  cmp    $0xe,%eax
  jbe    L234
  mov    %r9d,%edx
  xor    %eax,%eax
  shr    $0x4,%edx
  shl    $0x4,%rdx
  nopl   0x0(%rax,%rax,1)
L278:
  movdqu (%r11,%rax,1),%xmm0
  movdqu (%rbx,%rax,1),%xmm2
  pxor   %xmm2,%xmm0
  movups %xmm0,(%r11,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L278
  mov    %r9d,%eax
  and    $0xfffffff0,%eax
  mov    %eax,%edx
  cmp    %eax,%r9d
  je     L351
  mov    %r9d,%ecx
  sub    %eax,%ecx
  lea    -0x1(%rcx),%esi
  cmp    $0x6,%esi
  jbe    L117
L319:
  mov    %eax,%esi
  mov    -0x88(%rbp),%rax
  movq   (%rbx,%rsi,1),%xmm0
  add    %rsi,%rax
  add    %r13,%rax
  movq   (%rax),%xmm1
  pxor   %xmm1,%xmm0
  movq   %xmm0,(%rax)
  mov    %ecx,%eax
  and    $0xfffffff8,%eax
  add    %eax,%edx
  cmp    %eax,%ecx
  je     L351
L117:
  movslq %edx,%rax
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x1(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x2(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x3(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x4(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x5(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%ecx
  xor    %cl,(%r11,%rax,1)
  lea    0x6(%rdx),%eax
  cmp    %eax,%r9d
  jle    L351
  cltq
  movzbl (%rbx,%rax,1),%edx
  xor    %dl,(%r11,%rax,1)
L351:
  mov    %r14,%r8
  mov    -0x80(%rbp),%r14
  mov    %r9d,%ecx
  mov    %r11,%rdx
  mov    %r12d,%esi
  mov    %r14,%rdi
  call   <beta_PKCS1_MGF1@plt>
  test   %rax,%rax
  js     L366
  test   %r12d,%r12d
  jle    L204
  lea    -0x1(%r12),%eax
  cmp    $0xe,%eax
  jbe    L308
  mov    %r12d,%edx
  xor    %eax,%eax
  mov    %r14,%rcx
  shr    $0x4,%edx
  shl    $0x4,%rdx
  nopl   0x0(%rax)
L57:
  movdqu 0x1(%r13,%rax,1),%xmm0
  movdqu (%rcx,%rax,1),%xmm3
  pxor   %xmm3,%xmm0
  movups %xmm0,0x1(%r13,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L57
  mov    %r12d,%edx
  and    $0xfffffff0,%edx
  mov    %edx,%eax
  cmp    %r12d,%edx
  je     L204
L172:
  mov    %r12d,%ecx
  sub    %edx,%ecx
  lea    -0x1(%rcx),%esi
  cmp    $0x6,%esi
  jbe    L149
  mov    -0x80(%rbp),%rdi
  lea    0x1(%r13,%rdx,1),%rsi
  movq   (%rsi),%xmm1
  movq   (%rdi,%rdx,1),%xmm0
  mov    %ecx,%edx
  and    $0xfffffff8,%edx
  pxor   %xmm1,%xmm0
  add    %edx,%eax
  movq   %xmm0,(%rsi)
  cmp    %edx,%ecx
  je     L204
L149:
  mov    -0x80(%rbp),%rsi
  movslq %eax,%rdx
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  lea    0x1(%rax),%edx
  cmp    %edx,%r12d
  jle    L204
  movslq %edx,%rdx
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  lea    0x2(%rax),%edx
  cmp    %edx,%r12d
  jle    L204
  movslq %edx,%rdx
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  lea    0x3(%rax),%edx
  cmp    %edx,%r12d
  jle    L204
  movslq %edx,%rdx
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  lea    0x4(%rax),%edx
  cmp    %edx,%r12d
  jle    L204
  movslq %edx,%rdx
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  lea    0x5(%rax),%edx
  cmp    %edx,%r12d
  jle    L204
  movslq %edx,%rdx
  add    $0x6,%eax
  movzbl (%rsi,%rdx,1),%ecx
  xor    %cl,(%r15,%rdx,1)
  cmp    %eax,%r12d
  jle    L204
  cltq
  movzbl (%rsi,%rax,1),%edx
  xor    %dl,(%r15,%rax,1)
L204:
  mov    %rbx,%rdi
  call   <OPENSSL_free@plt>
  mov    $0x1,%eax
  jmp    L30
  nopl   0x0(%rax,%rax,1)
L122:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L24
L304:
  mov    %r9d,%ecx
  xor    %eax,%eax
L362:
  movzbl (%rbx,%rax,1),%edx
  xor    %dl,(%r11,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L362
  jmp    L351
L234:
  xor    %eax,%eax
  xor    %edx,%edx
  jmp    L319
L308:
  xor    %edx,%edx
  xor    %eax,%eax
  jmp    L172
L195:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int beta_RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md) {
  int i, emlen = tlen - 1;
  unsigned char *db, *seed;
  unsigned char *dbmask, seedmask[EVP_MAX_MD_SIZE];
  int mdlen;
  if (md == NULL)
    md = EVP_sha1();
  if (mgf1md == NULL)
    mgf1md = md;
  mdlen = EVP_MD_size(md);
  if (flen > emlen - 2 * mdlen - 1) {
    return 0;
  }
  if (emlen < 2 * mdlen + 1) {
    return 0;
  }
  to[0] = 0;
  seed = to + 1;
  db = to + mdlen + 1;
  if (!EVP_Digest((void *)param, plen, db, NULL, md, NULL))
    return 0;
  memset(db + mdlen, 0, emlen - flen - 2 * mdlen - 1);
  db[emlen - flen - mdlen - 1] = 0x01;
  memcpy(db + emlen - flen - mdlen, from, (unsigned int)flen);
  if (RAND_bytes(seed, mdlen) <= 0)
    return 0;
  dbmask = OPENSSL_malloc(emlen - mdlen);
  if (dbmask == NULL) {
    return 0;
  }
  if (beta_PKCS1_MGF1(dbmask, emlen - mdlen, seed, mdlen, mgf1md) < 0)
    return 0;
  for (i = 0; i < emlen - mdlen; i++)
    db[i] ^= dbmask[i];
  if (beta_PKCS1_MGF1(seedmask, mdlen, db, emlen - mdlen, mgf1md) < 0)
    return 0;
  for (i = 0; i < mdlen; i++)
    seed[i] ^= seedmask[i];
  OPENSSL_free(dbmask);
  return 1;
}
```