RtlLargeIntegerToChar

NTSTATUS __stdcall RtlLargeIntegerToChar(PLARGE_INTEGER Value, UINT64 Base, ULONG OutputLength, PCHAR String){
  int v6; 
  int v7; 
  char *v8; 
  unsigned __int64 QuadPart; 
  unsigned int v10; 
  int v11; 
  __int64 v12; 
  bool v13; 
  unsigned __int64 v15; 
  unsigned __int64 v16; 
  size_t v17; 
  __int64 v18; 
  char v19; 

  if( (_DWORD)Base )
  {
    if( (_DWORD)Base == 16 )
    {
      v6 = 4;
LABEL_4:
      v7 = (1 << v6) - 1;
      goto LABEL_5;
    }
    if( (_DWORD)Base != 10 )
    {
      if( (_DWORD)Base == 2 )
      {
        v6 = 1;
      }
      else
      {
        if( (_DWORD)Base != 8 )
          return -1073741811;
        v6 = 3;
      }
      goto LABEL_4;
    }
  }
  else
  {
    Base = 10i64;
  }
  v6 = 0;
  v7 = 0;
LABEL_5:
  v8 = &v19;
  QuadPart = Value->QuadPart;
  if( v6 )
  {
    do
    {
      v10 = QuadPart;
      QuadPart >>= v6;
      *--v8 = *((_BYTE *)RtlpIntegerChars + (v7 & v10));
    }
    while( QuadPart );
  }
  else
  {
    v15 = (unsigned int)Base;
    do
    {
      v16 = QuadPart;
      QuadPart /= v15;
      Base = v16 % v15;
      *--v8 = *((_BYTE *)RtlpIntegerChars + (unsigned int)(v16 % v15));
    }
    while( QuadPart );
  }
  v12 = (unsigned int)(v11 + 97 - (_DWORD)v8);
  if( (OutputLength & 0x80000000) == 0 )
    goto LABEL_8;
  OutputLength = -OutputLength;
  v13 = (int)v12 <= (int)OutputLength;
  if( (int)v12 < (int)OutputLength )
  {
    v17 = OutputLength - v12;
    v18 = v17;
    LOBYTE(Base) = 48;
    memset(String, Base, v17);
    OutputLength = v12;
    String += v18;
LABEL_8:
    v13 = (int)v12 <= (int)OutputLength;
  }
  if( !v13 )
    return -2147483643;
  memmove(String, v8, v12);
  if( (int)v12 < (int)OutputLength )
    String[v12] = 0;
  return 0;
}

Referenced by:

RtlInt64ToUnicodeString