RtlFirstFreeAce

UINT8 __fastcall RtlFirstFreeAce(_ACL *Acl, VOID **FirstFree){
  unsigned int v2; 
  _ACL *v3; 
  v2 = 0;
  v3 = Acl + 1;
  *FirstFree = 0i64;
  if( Acl->AceCount )
  {
    while( v3 < (_ACL *)((char *)Acl + Acl->AclSize) )
    {
      ++v2;
      v3 = (_ACL *)((char *)v3 + v3->AclSize);
      if( v2 >= Acl->AceCount )
        goto LABEL_2;
    }
    return 0;
  }
  else
  {
LABEL_2:
    if( v3 <= (_ACL *)((char *)Acl + Acl->AclSize) )
      *FirstFree = v3;
    return 1;
  }
}

Referenced by:

RtlAddAccessFilterAce
RtlAddAce
RtlAddMandatoryAce
RtlAddProcessTrustLabelAce
RtlAddResourceAttributeAce
RtlDeleteAce
RtlQueryInformationAcl
RtlpAddKnownObjectAce
RtlpInheritAcl2
SddlAddAccessFilterAce
SddlAddMandatoryAce
SddlAddProcessTrustLabelAce
SddlAddScopedPolicyIDAce