AuthzBasepFindSecurityAttributeValue

BOOLEAN __stdcall AuthzBasepFindSecurityAttributeValue(PRTL_AVL_TABLE Table){
  __int64 v1; 
  unsigned __int16 v2; 
  char v3; 
  _RTL_GENERIC_COMPARE_RESULTS(__fastcall **p_CompareRoutine)(_RTL_AVL_TABLE *, void *, void *); 
  _RTL_GENERIC_COMPARE_RESULTS(__fastcall *CompareRoutine)(_RTL_AVL_TABLE *, void *, void *); 
  __int64 v6; 
  unsigned __int16 v8; 
  unsigned __int64 p_FreeRoutine; 
  struct _RTL_AVL_TABLE *TableContext; 
  UNICODE_STRING *v12; 
  UNICODE_STRING *v13; 
  unsigned int v14; 
  unsigned int v15; 
  UNICODE_STRING String1; 
  __int128 v18; 
  v3 = 0;
  p_CompareRoutine = &Table->CompareRoutine;
  CompareRoutine = Table->CompareRoutine;
  v6 = v1;
  v8 = v2;
  p_FreeRoutine = 0i64;
  String1 = 0i64;
  v18 = 0i64;
  while( (char *)CompareRoutine != (char *)p_CompareRoutine )
  {
    p_FreeRoutine = (unsigned __int64)CompareRoutine;
    if( !v8 )
      goto LABEL_18;
    if( v8 <= 2u )
      goto LABEL_25;
    switch( v8 )
    {
      case 3u:
        v12 = (UNICODE_STRING *)((char *)CompareRoutine + 40);
        String1.Length = *(_WORD *)v6;
        String1.MaximumLength = String1.Length;
        String1.Buffer = *(wchar_t **)(v6 + 8);
        goto LABEL_17;
      case 4u:
        String1.Length = *(_WORD *)(v6 + 8);
        String1.MaximumLength = String1.Length;
        String1.Buffer = *(wchar_t **)(v6 + 16);
        LOWORD(v18) = *((_WORD *)CompareRoutine + 24);
        WORD1(v18) = v18;
        *((_QWORD *)&v18 + 1) = *((_QWORD *)CompareRoutine + 7);
        if( *(_QWORD *)v6 != *((_QWORD *)CompareRoutine + 5) )
          break;
        v12 = (UNICODE_STRING *)&v18;
LABEL_17:
        if( AuthzBasepEqualUnicodeString(&String1, v12) )
          goto LABEL_24;
        break;
      case 5u:
        goto LABEL_49;
      case 6u:
LABEL_25:
        if( v6 == *((_QWORD *)CompareRoutine + 5) )
          v3 = 1;
        break;
      case 0x10u:
LABEL_49:
        v14 = *(_DWORD *)(v6 + 8);
        if( v14 == *((_DWORD *)CompareRoutine + 12) && !memcmp(*(PVOID *)v6, *((PVOID *)CompareRoutine + 5), v14) )
LABEL_24:
          v3 = 1;
        break;
    }
LABEL_18:
    CompareRoutine = *(_RTL_GENERIC_COMPARE_RESULTS(__fastcall **)(_RTL_AVL_TABLE *, void *, void *))CompareRoutine;
    if( v3 )
      break;
  }
  TableContext = (struct _RTL_AVL_TABLE *)Table->TableContext;
  while( 2 )
  {
    if( !v3 && TableContext != (struct _RTL_AVL_TABLE *)&Table->TableContext )
    {
      p_FreeRoutine = (unsigned __int64)&TableContext[-1].FreeRoutine;
      if( ((__int64)TableContext->BalancedRoot.RightChild & 1) != 0 || !v8 )
        goto LABEL_12;
      if( v8 <= 2u )
        goto LABEL_10;
      if( v8 == 3 )
      {
        v13 = (UNICODE_STRING *)(p_FreeRoutine + 40);
        String1.Length = *(_WORD *)v6;
        String1.MaximumLength = String1.Length;
        String1.Buffer = *(wchar_t **)(v6 + 8);
      }
      else
      {
        if( v8 != 4 )
        {
          switch( v8 )
          {
            case 5u:
              goto LABEL_50;
            case 6u:
LABEL_10:
              if( v6 == *(_QWORD *)(p_FreeRoutine + 40) )
                v3 = 1;
              goto LABEL_12;
            case 0x10u:
LABEL_50:
              v15 = *(_DWORD *)(v6 + 8);
              if( v15 == *(_DWORD *)(p_FreeRoutine + 48) && !memcmp(*(PVOID *)v6, *(PVOID *)(p_FreeRoutine + 40), v15) )
                goto LABEL_23;
              break;
          }
          goto LABEL_12;
        }
        String1.Length = *(_WORD *)(v6 + 8);
        String1.MaximumLength = String1.Length;
        String1.Buffer = *(wchar_t **)(v6 + 16);
        LOWORD(v18) = *(_WORD *)(p_FreeRoutine + 48);
        WORD1(v18) = v18;
        *((_QWORD *)&v18 + 1) = *(_QWORD *)(p_FreeRoutine + 56);
        if( *(_QWORD *)v6 != *(_QWORD *)(p_FreeRoutine + 40) )
          goto LABEL_12;
        v13 = (UNICODE_STRING *)&v18;
      }
      if( AuthzBasepEqualUnicodeString(&String1, v13) )
LABEL_23:
        v3 = 1;
LABEL_12:
      TableContext = (struct _RTL_AVL_TABLE *)TableContext->BalancedRoot.Parent;
      continue;
    }
    return p_FreeRoutine & -(__int64)(v3 != 0);
  }
}

Referenced by:

AuthzBasepAddSecurityAttributeValues
AuthzBasepCompareSecurityAttribute
AuthzBasepDeleteSecurityAttributeValues