AuthzBasepGetSecurityAttributeValueCopyoutBufferSize

NTSTATUS __fastcall AuthzBasepGetSecurityAttributeValueCopyoutBufferSize(
        INT64 a1,
        UINT64 *a2,
        INT64 a3,
        _THREAD_PERFORMANCE_DATA *a4){
  unsigned __int16 v4; 
  unsigned __int64 v5; 
  NTSTATUS result; 
  ULONGLONG v8; 
  UINT64 v9; 
  ULONGLONG v10; 
  __int64 v11; 
  __int64 ***v12; 
  __int64 **v13; 
  UINT64 v14; 
  ULONGLONG v15; 
  __int64 v16; 
  __int64 ***v17; 
  __int64 **v18; 
  UINT64 v19; 
  ULONGLONG v20; 
  __int64 v21; 
  __int64 ***v22; 
  __int64 **v23; 
  UINT64 v24; 
  ULONGLONG pullResult; 
  v4 = *(_WORD *)(a1 + 48);
  v5 = *a2;
  pullResult = 0i64;
  if( !v4 )
    return -1073741811;
  if( v4 <= 2u )
  {
LABEL_3:
    if( ((v5 + 7) & 0xFFFFFFFFFFFFFFF8ui64) >= v5 )
    {
      result = RtlULongLongMult(8ui64, *(unsigned int *)(a1 + 60), &pullResult);
      if( result < 0 )
        return result;
      v9 = v8 + pullResult;
      if( v8 + pullResult >= v8 )
        goto LABEL_6;
    }
    return -1073741675;
  }
  if( v4 == 3 )
  {
    if( ((v5 + 7) & 0xFFFFFFFFFFFFFFF8ui64) < v5 )
      return -1073741675;
    result = RtlULongLongMult(0x10ui64, *(unsigned int *)(a1 + 60), &pullResult);
    if( result >= 0 )
    {
      v9 = v10 + pullResult;
      if( v10 + pullResult < v10 )
        return -1073741675;
      v12 = (__int64 ***)(v11 + 72);
      v13 = *v12;
      while( v13 != (__int64 **)v12 )
      {
        v14 = v9 + *((unsigned __int16 *)v13 + 20);
        if( v14 < v9 )
          return -1073741675;
        v13 = (__int64 **)*v13;
        v9 = v14;
      }
LABEL_6:
      *a2 = v9;
      return 0;
    }
    return result;
  }
  if( v4 == 4 )
  {
    if( ((v5 + 7) & 0xFFFFFFFFFFFFFFF8ui64) < v5 )
      return -1073741675;
    result = RtlULongLongMult(0x18ui64, *(unsigned int *)(a1 + 60), &pullResult);
    if( result >= 0 )
    {
      v9 = v20 + pullResult;
      if( v20 + pullResult < v20 )
        return -1073741675;
      v22 = (__int64 ***)(v21 + 72);
      v23 = *v22;
      while( v23 != (__int64 **)v22 )
      {
        v24 = v9 + *((unsigned __int16 *)v23 + 24);
        if( v24 < v9 )
          return -1073741675;
        v23 = (__int64 **)*v23;
        v9 = v24;
      }
      goto LABEL_6;
    }
    return result;
  }
  if( v4 != 5 )
  {
    if( v4 == 6 )
      goto LABEL_3;
    if( v4 != 16 )
      return -1073741811;
  }
  if( ((v5 + 7) & 0xFFFFFFFFFFFFFFF8ui64) < v5 )
    return -1073741675;
  result = RtlULongLongMult(0x10ui64, *(unsigned int *)(a1 + 60), &pullResult);
  if( result >= 0 )
  {
    v9 = v15 + pullResult;
    if( v15 + pullResult < v15 )
      return -1073741675;
    v17 = (__int64 ***)(v16 + 72);
    v18 = *v17;
    while( v18 != (__int64 **)v17 )
    {
      v19 = v9 + *((unsigned int *)v18 + 12);
      if( v19 < v9 )
        return -1073741675;
      v18 = (__int64 **)*v18;
      v9 = v19;
    }
    goto LABEL_6;
  }
  return result;
}

Referenced by:

AuthzBasepGetSecurityAttributesCopyoutBufferSize