RtlUnicodeStringToInteger

NTSTATUS __stdcall RtlUnicodeStringToInteger(_UNICODE_STRING *String, UINT64 Base, UINT64 *Value){
  unsigned int v4; 
  int v5; 
  NTSTATUS v6; 
  unsigned int Length; 
  wchar_t *Buffer; 
  int v9; 
  unsigned __int16 v10; 
  unsigned __int16 v11; 
  wchar_t *v12; 
  int v13; 
  int v14; 
  unsigned int v15; 
  __int16 v17; 

  v4 = Base;
  v5 = 0;
  v6 = 0;
  Length = String->Length;
  if( !(_WORD)Length || (Length & 1) != 0 )
    goto LABEL_38;
  Buffer = String->Buffer;
  v9 = Length >> 1;
  v10 = 0;
  if( Length >> 1 )
  {
    while( 1 )
    {
      --v9;
      v10 = *Buffer++;
      if( v10 > 0x20u )
        break;
      if( !v9 )
      {
        v10 = 0;
        break;
      }
    }
  }
  else
  {
    v9 = -1;
  }
  v11 = v10;
  if( ((v10 - 43) & 0xFFFD) == 0 )
  {
    if( v9 )
    {
      --v9;
      v11 = *Buffer++;
    }
    else
    {
      v11 = 0;
    }
  }
  v12 = Buffer;
  v13 = v9;
  if( !v4 )
  {
    v4 = 10;
    v14 = 0;
    if( v11 == 48 )
    {
      if( !v9 )
        goto LABEL_40;
      --v9;
      v17 = *Buffer++;
      switch( v17 )
      {
        case 'x':
          v4 = 16;
          v14 = 4;
          break;
        case 'o':
          v4 = 8;
          v14 = 3;
          break;
        case 'b':
          v4 = 2;
          v14 = 1;
          break;
        default:
          v9 = v13;
          Buffer = v12;
          break;
      }
      if( v9 )
      {
        --v9;
        v11 = *Buffer++;
      }
      else
      {
LABEL_40:
        v11 = 0;
      }
    }
    goto LABEL_9;
  }
  if( v4 != 16 )
  {
    switch( v4 )
    {
      case 2u:
        v14 = 1;
        goto LABEL_9;
      case 8u:
        v14 = 3;
        goto LABEL_9;
      case 0xAu:
        v14 = 0;
        goto LABEL_9;
    }
LABEL_38:
    v6 = -1073741811;
    goto LABEL_22;
  }
  v14 = 4;
LABEL_9:
  while( v11 )
  {
    if( (unsigned __int16)(v11 - 48) > 9u )
    {
      if( (unsigned __int16)(v11 - 65) <= 5u )
      {
        v15 = v11 - 55;
      }
      else
      {
        if( (unsigned __int16)(v11 - 97) > 5u )
          break;
        v15 = v11 - 87;
      }
    }
    else
    {
      v15 = v11 - 48;
    }
    if( v15 >= v4 )
      break;
    v5 = v14 ? v15 | (v5 << v14) : v15 + v4 * v5;
    if( !v9 )
      break;
    --v9;
    v11 = *Buffer++;
  }
  if( v10 == 45 )
    v5 = -v5;
LABEL_22:
  *(_DWORD *)Value = v5;
  return v6;
}

Referenced by:

CmpGetAcpiProfileInformation
PiCMDeleteDeviceKey
PiDcInitUpdateProperties
PnpGetGenericStorePropertyKeys
PnpParseIndirectResourceString
PopDetectSimulatedHeteroProcessors
PspIsDfssEnabled
PspReadIFEOPerfOptions
RtlGetIntegerAtom
RtlQueryImageFileKeyOption
RtlpMuiRegAddAlternateCodePage
WdipSemLoadNextEndEvent
WdipSemLoadNextScenario