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

```asm
<check_bitlen_rsa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x40(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    $0x0,%ecx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <RSA_get0_key@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bits@plt>
  cmp    $0x20,%eax
  jg     L121
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <RSA_bits@plt>
  mov    %eax,-0x4c(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <RSA_size@plt>
  mov    %eax,-0x48(%rbp)
  mov    -0x4c(%rbp),%eax
  add    $0xf,%eax
  sar    $0x4,%eax
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x5c(%rbp)
  je     L9
  mov    -0x68(%rbp),%rax
  movl   $0x31415352,(%rax)
  mov    -0x4c(%rbp),%eax
  jmp    L72
L9:
  mov    -0x68(%rbp),%rax
  movl   $0x32415352,(%rax)
  lea    -0x38(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <RSA_get0_key@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x48(%rbp)
  jl     L15
  lea    -0x28(%rbp),%rdx
  lea    -0x30(%rbp),%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <RSA_get0_factors@plt>
  lea    -0x20(%rbp),%rcx
  lea    -0x10(%rbp),%rdx
  lea    -0x18(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <RSA_get0_crt_params@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x44(%rbp)
  jl     L97
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x44(%rbp)
  jl     L97
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x44(%rbp)
  jl     L97
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x44(%rbp)
  jl     L97
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <BN_num_bytes@plt>
  cmp    %eax,-0x44(%rbp)
  jl     L97
  mov    -0x4c(%rbp),%eax
  jmp    L72
L121:
  nop
  jmp    L80
L15:
  nop
  jmp    L80
L97:
  nop
L80:
  mov    D4(%rip),%rax
  mov    (%rax),%edx
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <PEMerr@plt>
  mov    $0x0,%eax
L72:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L50
  call   <__stack_chk_fail@plt>
L50:
  leave
  ret
```

assistant: ```c
int check_bitlen_rsa(RSA *rsa, int ispub, unsigned int *pmagic) {
  int nbyte, hnbyte, bitlen;
  const BIGNUM *e;
  RSA_get0_key(rsa, NULL, &e, NULL);
  if (BN_num_bits(e) > 32)
    goto badkey;
  bitlen = RSA_bits(rsa);
  nbyte = RSA_size(rsa);
  hnbyte = (bitlen + 15) >> 4;
  if (ispub) {
    *pmagic = 0x31415352L;
    return bitlen;
  } else {
    const BIGNUM *d, *p, *q, *iqmp, *dmp1, *dmq1;
    *pmagic = 0x32415352L;
    RSA_get0_key(rsa, NULL, NULL, &d);
    if (BN_num_bytes(d) > nbyte)
      goto badkey;
    RSA_get0_factors(rsa, &p, &q);
    RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
    if ((BN_num_bytes(iqmp) > hnbyte) || (BN_num_bytes(p) > hnbyte) || (BN_num_bytes(q) > hnbyte) || (BN_num_bytes(dmp1) > hnbyte) || (BN_num_bytes(dmq1) > hnbyte))
      goto badkey;
  }
  return bitlen;
badkey:
  PEMerr(PEM_F_CHECK_BITLEN_RSA, PEM_R_UNSUPPORTED_KEY_COMPONENTS);
  return 0;
}
```