user: What is the c source code of the assembly code below?

```asm
<CheckX509IpAddress>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %rsi,0x18(%rsp)
  mov    %rcx,0x10(%rsp)
  test   %rdi,%rdi
  je     L170
  mov    %edx,%r15d
  mov    %r8d,%r14d
  test   %r8d,%r8d
  jle    L104
  test   %rcx,%rcx
  je     L142
L104:
  test   %r14d,%r14d
  js     L207
  test   %r15d,%r15d
  js     L55
  cmpq   $0x0,0x18(%rsp)
  je     L9
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0xc(%rsp)
  mov    D11(%rip),%rax
  mov    (%rax),%r13d
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    D22(%rip),%rax
  mov    (%rax),%esi
  mov    0x20(%rsp),%rdi
  call   <X509_get_ext_d2i@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L45
  mov    %rax,%rdi
  call   <sk_GENERAL_NAME_num@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jle    L29
  mov    $0x0,%ebx
  movslq %r15d,%rax
  mov    %rax,0x28(%rsp)
  jmp    L60
L116:
  add    $0x1,%ebx
  cmp    %ebx,%r12d
  je     L29
L60:
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <sk_GENERAL_NAME_value@plt>
  cmp    %r13d,(%rax)
  jne    L116
  mov    0x8(%rax),%rax
  test   %rax,%rax
  je     L116
  mov    0x4(%rax),%esi
  test   %esi,%esi
  je     L116
  cmp    %r15d,(%rax)
  jne    L116
  mov    0x28(%rsp),%rdx
  mov    0x18(%rsp),%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L116
  mov    %rbp,%rdi
  call   <GENERAL_NAMES_free@plt>
  mov    $0x1,%eax
  jmp    L77
L112:
  mov    $0x0,%eax
L77:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L170:
  mov    $0xfffffffe,%eax
  jmp    L77
L142:
  mov    $0xfffffffd,%eax
  jmp    L77
L207:
  mov    $0xfffffffc,%eax
  jmp    L77
L55:
  mov    $0xfffffffb,%eax
  jmp    L77
L9:
  mov    $0xfffffffa,%eax
  jmp    L77
L29:
  mov    %rbp,%rdi
  call   <GENERAL_NAMES_free@plt>
L45:
  mov    0x20(%rsp),%rdi
  call   <X509_get_subject_name@plt>
  mov    %rax,%rbp
  mov    $0xffffffff,%ebx
  mov    $0x0,%eax
  test   %rbp,%rbp
  je     L77
L89:
  mov    %ebx,%edx
  mov    0xc(%rsp),%esi
  mov    %rbp,%rdi
  call   <X509_NAME_get_index_by_NID@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  js     L112
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <X509_NAME_get_entry@plt>
  mov    %rax,%rdi
  call   <X509_NAME_ENTRY_get_data@plt>
  mov    %rax,%rdi
  mov    $0x0,%ecx
  mov    %r14d,%edx
  mov    0x10(%rsp),%rsi
  call   <CheckX509HostnameMatch@plt>
  test   %rax,%rax
  je     L89
  mov    $0x1,%eax
  jmp    L77
```

assistant: ```c
int CheckX509IpAddress(X509 *x509, const unsigned char *addressBytes, int addressBytesLen, const char *hostname, int cchHostname) {
  if (!x509)
    return -2;
  if (cchHostname > 0 && !hostname)
    return -3;
  if (cchHostname < 0)
    return -4;
  if (addressBytesLen < 0)
    return -5;
  if (!addressBytes)
    return -6;
  int subjectNid = NID_commonName;
  int sanGenType = GEN_IPADD;
  GENERAL_NAMES *san = X509_get_ext_d2i(x509, NID_subject_alt_name, NULL, NULL);
  int success = 0;
  if (san) {
    int i;
    int count = sk_GENERAL_NAME_num(san);
    for (i = 0; i < count; ++i) {
      GENERAL_NAME *sanEntry = sk_GENERAL_NAME_value(san, i);
      ASN1_OCTET_STRING *ipAddr;
      if (sanEntry->type != sanGenType) {
        continue;
      }
      ipAddr = sanEntry->d.iPAddress;
      if (!ipAddr || !ipAddr->data || ipAddr->length != addressBytesLen) {
        continue;
      }
      if (!memcmp(addressBytes, ipAddr->data, (size_t)addressBytesLen)) {
        success = 1;
        break;
      }
    }
    GENERAL_NAMES_free(san);
  }
  if (!success) {
    X509_NAME *subject = X509_get_subject_name(x509);
    if (subject) {
      int i = -1;
      while ((i = X509_NAME_get_index_by_NID(subject, subjectNid, i)) >= 0) {
        X509_NAME_ENTRY *nameEnt = X509_NAME_get_entry(subject, i);
        ASN1_STRING *cn = X509_NAME_ENTRY_get_data(nameEnt);
        if (CheckX509HostnameMatch(cn, hostname, cchHostname, 0)) {
          success = 1;
          break;
        }
      }
    }
  }
  return success;
}
```