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

```asm
<is_immediate_ca>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rdx,(%rsp)
  test   %rdi,%rdi
  je     L69
  mov    %esi,%r12d
  mov    %ecx,%ebp
  test   %rdx,%rdx
  je     L69
  mov    $0x0,%eax
  call   <EVP_md5@plt>
  mov    %eax,%edi
  call   <EVP_add_digest@plt>
  mov    $0x0,%ebx
  test   %rax,%rax
  je     L6
  mov    $0x0,%eax
  call   <EVP_sha1@plt>
  mov    %eax,%edi
  call   <EVP_add_digest@plt>
  test   %rax,%rax
  je     L6
  mov    $0x0,%eax
  call   <EVP_sha256@plt>
  mov    %eax,%edi
  call   <EVP_add_digest@plt>
  test   %rax,%rax
  je     L6
  lea    0x8(%rsp),%rsi
  mov    %r12d,%edx
  mov    $0x0,%edi
  call   <d2i_X509@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L6
  mov    %rsp,%rsi
  mov    %ebp,%edx
  mov    $0x0,%edi
  call   <d2i_X509@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L11
  mov    $0x0,%eax
  call   <X509_STORE_new@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L59
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <X509_STORE_add_cert@plt>
  test   %rax,%rax
  jne    L113
  mov    $0x0,%ebx
  mov    $0x0,%r14d
L13:
  mov    %r12,%rdi
  call   <X509_free@plt>
  mov    %rbp,%rdi
  call   <X509_free@plt>
  test   %r13,%r13
  je     L6
  mov    %r13,%rdi
  call   <X509_STORE_free@plt>
  mov    %r14,%rdi
  call   <X509_STORE_CTX_free@plt>
  jmp    L6
L113:
  mov    D3(%rip),%rax
  mov    (%rax),%esi
  mov    D9(%rip),%rax
  or     (%rax),%esi
  mov    %r13,%rdi
  call   <X509_STORE_set_flags@plt>
  mov    $0x0,%eax
  call   <X509_STORE_CTX_new@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L13
  mov    $0x0,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <X509_STORE_CTX_init@plt>
  test   %rax,%rax
  je     L13
  mov    %r14,%rdi
  call   <X509_verify_cert@plt>
  test   %eax,%eax
  mov    $0x0,%edx
  cmovns %eax,%edx
  mov    %edx,%ebx
  mov    %r14,%rdi
  call   <X509_STORE_CTX_cleanup@plt>
  jmp    L13
L69:
  mov    $0x0,%ebx
L6:
  mov    %ebx,%eax
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L59:
  mov    %rax,%r14
  mov    $0x0,%ebx
  jmp    L13
L11:
  mov    %r12,%rdi
  call   <X509_free@plt>
  mov    $0x0,%ebx
  jmp    L6
```

assistant: ```c
int is_immediate_ca(const uint8_t *cert, const uint32_t cert_size, const uint8_t *ca_cert, const uint32_t ca_cert_size) {
  X509 *X509cert = NULL;
  X509 *X509ca = NULL;
  X509_STORE *cert_store = NULL;
  X509_STORE_CTX *cert_ctx = NULL;
  int ret = 0;
  if (cert == NULL || ca_cert == NULL)
    return 0;
  if (EVP_add_digest(EVP_md5()) == 0)
    return 0;
  if (EVP_add_digest(EVP_sha1()) == 0)
    return 0;
  if (EVP_add_digest(EVP_sha256()) == 0)
    return 0;
  X509cert = d2i_X509(NULL, &cert, cert_size);
  if (X509cert == NULL)
    return 0;
  X509ca = d2i_X509(NULL, &ca_cert, ca_cert_size);
  if (X509ca == NULL)
    goto err;
  cert_store = X509_STORE_new();
  if (cert_store == NULL)
    goto err;
  if (X509_STORE_add_cert(cert_store, X509ca) == 0)
    goto err;
  X509_STORE_set_flags(cert_store, X509_V_FLAG_PARTIAL_CHAIN | X509_V_FLAG_NO_CHECK_TIME);
  cert_ctx = X509_STORE_CTX_new();
  if (cert_ctx == NULL)
    goto err;
  if (X509_STORE_CTX_init(cert_ctx, cert_store, X509cert, NULL) == 0)
    goto err;
  ret = X509_verify_cert(cert_ctx);
  if (ret < 0)
    ret = 0;
  X509_STORE_CTX_cleanup(cert_ctx);
err:
  if (X509cert)
    X509_free(X509cert);
  if (X509ca)
    X509_free(X509ca);
  if (cert_store)
    X509_STORE_free(cert_store);
  if (cert_store)
    X509_STORE_CTX_free(cert_ctx);
  return ret;
}
```