MicroHs 0.16.0.0 → 0.17.4.0
raw patch · 509 files changed
+32696/−19416 lines, 509 filesdep ~base
Dependency ranges changed: base
This diff is very large; some files are shown as “too large to diff”. Download the raw patch for the complete diff.
Files
- Makefile +60/−37
- MicroHs.cabal +11/−10
- README.md +26/−245
- Tools/Install.hs +141/−13
- generated/cpphs.c +1375/−1395
- generated/mhs.c +5593/−5248
- ghc/MHSPrelude.hs +41/−5
- ghc/MiniPrelude.hs +3/−0
- ghc/PrimTable.hs +0/−385
- ghc/System/IO/Serialize.hs +4/−0
- ghc/System/IO/TimeMilli.hs +7/−2
- ghc/System/IO/Transducers.hs +3/−3
- hugs/MHSPrelude.hs +106/−14
- hugs/MiniPrelude.hs +3/−0
- hugs/PrimTable.hs +0/−269
- hugs/System/IO/Serialize.hs +9/−0
- hugs/System/IO/TimeMilli.hs +2/−1
- hugs/System/IO/Transducers.hs +3/−3
- lib/AllOfLib.hs +12/−0
- lib/Control/Exception.hs +9/−3
- lib/Control/Exception/Internal.hs +24/−0
- lib/Control/Monad/ST/Lazy.hs +2/−8
- lib/Data/Array/Byte.hs +18/−7
- lib/Data/Bits/Base.hs +12/−0
- lib/Data/ByteString.hs +13/−13
- lib/Data/ByteString/Builder/Internal.hs +2/−2
- lib/Data/ByteString/Internal.hs +130/−6
- lib/Data/ByteString/Short/Internal.hs +0/−1
- lib/Data/Char/Unicode.hs +407/−7
- lib/Data/Data.hs +15/−3
- lib/Data/Double.hs +13/−3
- lib/Data/Either.hs +12/−0
- lib/Data/Enum.hs +31/−2
- lib/Data/Float.hs +12/−1
- lib/Data/Foldable.hs +40/−1
- lib/Data/Foldable1.hs +1/−3
- lib/Data/Functor/Const.hs +24/−2
- lib/Data/Functor/Const_Type.hs +0/−9
- lib/Data/Functor/Identity.hs +16/−4
- lib/Data/IORef.hs +4/−2
- lib/Data/Int/Int.hs +2/−0
- lib/Data/Int/Int16.hs +3/−0
- lib/Data/Int/Int32.hs +3/−0
- lib/Data/Int/Int64.hs +1/−0
- lib/Data/Int/Int8.hs +3/−0
- lib/Data/Integer.hs +9/−4
- lib/Data/Integer/Internal.hs +92/−302
- lib/Data/Integer_Type.hs +72/−112
- lib/Data/Integral.hs +5/−1
- lib/Data/List.hs +1/−0
- lib/Data/List/NonEmpty.hs +0/−1
- lib/Data/Maybe.hs +0/−1
- lib/Data/Monoid/Internal.hs +14/−4
- lib/Data/Num.hs +4/−0
- lib/Data/Ord.hs +19/−22
- lib/Data/Ord/Class.hs +30/−0
- lib/Data/Orphans.hs +33/−6
- lib/Data/Ratio.hs +2/−0
- lib/Data/Semigroup.hs +3/−3
- lib/Data/String/Interpolate.hs +148/−0
- lib/Data/String/Interpolate/Basic.hs +16/−0
- lib/Data/String/Interpolate/ShowS.hs +16/−0
- lib/Data/Text.hs +489/−42
- lib/Data/Text/Encoding.hs +35/−5
- lib/Data/Text/IO.hs +28/−5
- lib/Data/Text/Lazy.hs +309/−91
- lib/Data/Typeable.hs +3/−3
- lib/Data/Typeable.hs-boot +2/−0
- lib/Data/Void.hs +4/−0
- lib/Data/Word/Word.hs +5/−0
- lib/Data/Word/Word16.hs +3/−0
- lib/Data/Word/Word32.hs +3/−0
- lib/Data/Word/Word64.hs +1/−0
- lib/Data/Word/Word8.hs +3/−0
- lib/Debug/Trace.hs +3/−0
- lib/Debug/Trace.hs-boot +4/−0
- lib/Foreign/C/String.hs +78/−24
- lib/Foreign/Marshal/Utils.hs +9/−2
- lib/Foreign/Ptr.hs +2/−2
- lib/GHC/Generics.hs +0/−3
- lib/Mhs/Builtin.hs +2/−0
- lib/Mhs/Extract.hs +594/−0
- lib/Mhs/MutArr.hs +5/−1
- lib/Mhs/MutUArr.hs +5/−0
- lib/Mhs/Print.hs +25/−0
- lib/Mhs/Reflect.hs +458/−90
- lib/Mhs/Strict.hs +32/−0
- lib/MiniPrelude.hs +1/−2
- lib/Numeric/FormatFloat.hs +13/−1
- lib/Numeric/Natural.hs +1/−0
- lib/Numeric/Show.hs +8/−6
- lib/Prelude.hs +4/−4
- lib/Primitives.hs +16/−2
- lib/System/Directory.hs +53/−10
- lib/System/IO.hs +13/−5
- lib/System/IO/Base.hs +27/−22
- lib/System/IO/Internal.hs +1/−2
- lib/System/IO/MD5.hs +49/−25
- lib/System/IO/Serialize.hs +21/−0
- lib/System/IO/Serialize/TypeDescr.hs +97/−0
- lib/System/IO/StringHandle.hs +4/−2
- lib/System/IO/TimeMilli.hs +12/−4
- lib/System/IO/Unsafe.hs +1/−1
- lib/System/Info.hs +33/−5
- lib/System/Process.hs +4/−1
- lib/Text/Printf.hs +2/−3
- lib/Text/Read/Internal.hs +4/−0
- lib/dist-mcabal/autogen/Paths_base.hs +2/−2
- lib/gmp/Data/Integer/Internal.hs +0/−313
- lib/gmp/Data/Integer_Type.hs +0/−92
- lib/libmhs/Mhs/IntMap.hs +118/−0
- lib/libmhs/Mhs/Text/ParserComb.hs +189/−0
- lib/libmhs/Mhs/Text/PrettyPrint/HughesPJLite.hs +429/−0
- lib/libmhs/Mhs/Text/PrettyPrint/HughesPJLiteClass.hs +143/−0
- lib/no-gmp/Data/Integer/Internal.hs +523/−0
- lib/no-gmp/Data/Integer_Type.hs +132/−0
- mhs.conf +64/−1
- mhs.conf.in +64/−1
- mhs/MHSPrelude.hs +29/−7
- mhs/PrimTable.hs +0/−4
- mhs/System/Console/SimpleReadline.hs +112/−15
- src/MicroHs/Abstract.hs +94/−60
- src/MicroHs/Compile.hs +73/−41
- src/MicroHs/CompileCache.hs +58/−18
- src/MicroHs/Config.hs +1/−1
- src/MicroHs/Deriving.hs +7/−3
- src/MicroHs/Desugar.hs +98/−14
- src/MicroHs/EncodeData.hs +93/−180
- src/MicroHs/Error.hs +115/−0
- src/MicroHs/Exp.hs +18/−11
- src/MicroHs/ExpPrint.hs +45/−18
- src/MicroHs/Expr.hs +88/−8
- src/MicroHs/FFI.hs +101/−32
- src/MicroHs/Fixity.hs +2/−2
- src/MicroHs/Flags.hs +6/−0
- src/MicroHs/Graph.hs +1/−1
- src/MicroHs/Ident.hs +21/−7
- src/MicroHs/IdentMap.hs +45/−34
- src/MicroHs/IntMap.hs +0/−118
- src/MicroHs/IntSet.hs +1/−1
- src/MicroHs/Interactive.hs +206/−81
- src/MicroHs/Lex.hs +294/−111
- src/MicroHs/List.hs +3/−0
- src/MicroHs/Main.hs +72/−49
- src/MicroHs/Names.hs +44/−0
- src/MicroHs/Package.hs +0/−1
- src/MicroHs/Parse.hs +124/−54
- src/MicroHs/StateIO.hs +0/−1
- src/MicroHs/SymTab.hs +19/−9
- src/MicroHs/TCMonad.hs +17/−2
- src/MicroHs/Translate.hs +40/−315
- src/MicroHs/TypeCheck.hs +477/−177
- src/MicroHs/Version.hs +2/−3
- src/Text/ParserComb.hs +0/−189
- src/Text/PrettyPrint/HughesPJLite.hs +0/−429
- src/Text/PrettyPrint/HughesPJLiteClass.hs +0/−139
- src/runtime/bfile.c +554/−161
- src/runtime/c64/config.h +2/−1
- src/runtime/esp32/config.h +2/−1
- src/runtime/eval.c +10297/−8008
- src/runtime/imath.c +2740/−0
- src/runtime/imath.h +422/−0
- src/runtime/imgmp.h +351/−0
- src/runtime/lzma.h +1/−3
- src/runtime/macros.c +75/−0
- src/runtime/mhsffi.h +5/−3
- src/runtime/micro/config.h +12/−1
- src/runtime/stm32f4/config.h +2/−1
- src/runtime/unix/config.h +24/−2
- src/runtime/unix/extra.c +56/−5
- src/runtime/windows/extra.c +44/−16
- tests/Arith.hs +1/−0
- tests/Arith.ref +1/−0
- tests/Arith64.hs +1/−0
- tests/Arith64.ref +1/−0
- tests/ByteArray.hs +16/−2
- tests/ByteArray.ref +2/−1
- tests/Class.hs +48/−0
- tests/Class.ref +4/−0
- tests/Coerce.hs +0/−2
- tests/Coerce.ref +0/−1
- tests/CppHost.hs +48/−0
- tests/CppHost.ref +2/−0
- tests/CreateDir.hs +27/−0
- tests/CreateDir.ref +11/−0
- tests/Dynamic.hs +40/−0
- tests/Dynamic.ref +9/−0
- tests/Enum.hs +11/−0
- tests/Enum.ref +7/−0
- tests/Error1.hs +1/−0
- tests/Error1.ref +7/−0
- tests/Error10.hs +1/−0
- tests/Error10.ref +5/−0
- tests/Error100.hs +2/−0
- tests/Error100.ref +7/−0
- tests/Error101.hs +2/−0
- tests/Error101.ref +1/−0
- tests/Error102.hs +2/−0
- tests/Error102.ref +5/−0
- tests/Error103.hs +2/−0
- tests/Error103.ref +5/−0
- tests/Error104.hs +3/−0
- tests/Error104.ref +5/−0
- tests/Error105.hs +2/−0
- tests/Error105.ref +5/−0
- tests/Error106.hs +2/−0
- tests/Error106.ref +5/−0
- tests/Error107.hs +7/−0
- tests/Error107.ref +5/−0
- tests/Error107A.hs +5/−0
- tests/Error11.hs +1/−0
- tests/Error11.ref +5/−0
- tests/Error110.hs +8/−0
- tests/Error111.hs +4/−0
- tests/Error111.ref +5/−0
- tests/Error112.hs +11/−0
- tests/Error112.ref +7/−0
- tests/Error113.hs +10/−0
- tests/Error113.ref +5/−0
- tests/Error114.hs +12/−0
- tests/Error114.ref +7/−0
- tests/Error115.hs +12/−0
- tests/Error115.ref +7/−0
- tests/Error116.hs +7/−0
- tests/Error116.ref +5/−0
- tests/Error12.hs +2/−0
- tests/Error12.ref +5/−0
- tests/Error120.hs +6/−0
- tests/Error120.ref +7/−0
- tests/Error13.hs +4/−0
- tests/Error13.ref +5/−0
- tests/Error14.hs +9/−0
- tests/Error14.ref +5/−0
- tests/Error15.hs +3/−0
- tests/Error15.ref +7/−0
- tests/Error16.hs +2/−0
- tests/Error16.ref +7/−0
- tests/Error17.hs +2/−0
- tests/Error17.ref +5/−0
- tests/Error18.hs +4/−0
- tests/Error18.ref +5/−0
- tests/Error19.hs +3/−0
- tests/Error19.ref +5/−0
- tests/Error2.hs +4/−0
- tests/Error2.ref +7/−0
- tests/Error20.hs +4/−0
- tests/Error20.ref +5/−0
- tests/Error21.hs +4/−0
- tests/Error21.ref +5/−0
- tests/Error22.hs +2/−0
- tests/Error22.ref +5/−0
- tests/Error23.hs +2/−0
- tests/Error23.ref +5/−0
- tests/Error24.hs +2/−0
- tests/Error24.ref +5/−0
- tests/Error25.hs +2/−0
- tests/Error25.ref +5/−0
- tests/Error26.hs +2/−0
- tests/Error26.ref +5/−0
- tests/Error27.hs +2/−0
- tests/Error27.ref +5/−0
- tests/Error28.hs +2/−0
- tests/Error28.ref +5/−0
- tests/Error29.hs +2/−0
- tests/Error29.ref +5/−0
- tests/Error3.hs +3/−0
- tests/Error3.ref +5/−0
- tests/Error30.hs +2/−0
- tests/Error30.ref +5/−0
- tests/Error31.hs +2/−0
- tests/Error31.ref +5/−0
- tests/Error32.hs +2/−0
- tests/Error32.ref +5/−0
- tests/Error33.hs +2/−0
- tests/Error33.ref +5/−0
- tests/Error34.hs +3/−0
- tests/Error34.ref +7/−0
- tests/Error35.hs +3/−0
- tests/Error35.ref +7/−0
- tests/Error36.hs +3/−0
- tests/Error36.ref +7/−0
- tests/Error37.hs +3/−0
- tests/Error37.ref +5/−0
- tests/Error38.hs +3/−0
- tests/Error38.ref +5/−0
- tests/Error39.hs +3/−0
- tests/Error39.ref +7/−0
- tests/Error4.hs +3/−0
- tests/Error4.ref +5/−0
- tests/Error40.hs +3/−0
- tests/Error40.ref +7/−0
- tests/Error41.hs +3/−0
- tests/Error41.ref +7/−0
- tests/Error42.hs +3/−0
- tests/Error42.ref +7/−0
- tests/Error43.hs +2/−0
- tests/Error43.ref +5/−0
- tests/Error44.hs +2/−0
- tests/Error44.ref +5/−0
- tests/Error45.hs +2/−0
- tests/Error45.ref +7/−0
- tests/Error46.hs +3/−0
- tests/Error46.ref +5/−0
- tests/Error47.hs +3/−0
- tests/Error47.ref +5/−0
- tests/Error48.hs +2/−0
- tests/Error48.ref +5/−0
- tests/Error49.hs +2/−0
- tests/Error49.ref +5/−0
- tests/Error5.hs +3/−0
- tests/Error5.ref +5/−0
- tests/Error50.hs +2/−0
- tests/Error50.ref +5/−0
- tests/Error51.hs +3/−0
- tests/Error51.ref +5/−0
- tests/Error52.hs +3/−0
- tests/Error52.ref +5/−0
- tests/Error53.hs +3/−0
- tests/Error53.ref +5/−0
- tests/Error54.hs +2/−0
- tests/Error54.ref +5/−0
- tests/Error55.hs +3/−0
- tests/Error55.ref +5/−0
- tests/Error56.hs +5/−0
- tests/Error56.ref +7/−0
- tests/Error57.hs +2/−0
- tests/Error57.ref +5/−0
- tests/Error58.hs +2/−0
- tests/Error58.ref +5/−0
- tests/Error59.hs +3/−0
- tests/Error59.ref +7/−0
- tests/Error6.hs +7/−0
- tests/Error6.ref +5/−0
- tests/Error60.hs +4/−0
- tests/Error60.ref +5/−0
- tests/Error61.hs +6/−0
- tests/Error61.ref +5/−0
- tests/Error62.hs +2/−0
- tests/Error62.ref +7/−0
- tests/Error63.hs +3/−0
- tests/Error63.ref +5/−0
- tests/Error64.hs +2/−0
- tests/Error64.ref +5/−0
- tests/Error65.hs +2/−0
- tests/Error65.ref +5/−0
- tests/Error66.hs +3/−0
- tests/Error66.ref +5/−0
- tests/Error67.hs +3/−0
- tests/Error67.ref +7/−0
- tests/Error68.hs +3/−0
- tests/Error68.ref +7/−0
- tests/Error69.hs +3/−0
- tests/Error69.ref +7/−0
- tests/Error7.hs +5/−0
- tests/Error7.ref +5/−0
- tests/Error70.hs +3/−0
- tests/Error70.ref +7/−0
- tests/Error71.hs +3/−0
- tests/Error71.ref +7/−0
- tests/Error72.hs +2/−0
- tests/Error72.ref +5/−0
- tests/Error73.hs +3/−0
- tests/Error73.ref +7/−0
- tests/Error74.hs +3/−0
- tests/Error74.ref +7/−0
- tests/Error75.hs +3/−0
- tests/Error75.ref +7/−0
- tests/Error76.hs +4/−0
- tests/Error76.ref +5/−0
- tests/Error77.hs +3/−0
- tests/Error77.ref +7/−0
- tests/Error78.hs +4/−0
- tests/Error78.ref +5/−0
- tests/Error79.hs +2/−0
- tests/Error79.ref +7/−0
- tests/Error8.hs +1/−0
- tests/Error8.ref +5/−0
- tests/Error80.hs +2/−0
- tests/Error80.ref +7/−0
- tests/Error81.hs +2/−0
- tests/Error81.ref +3/−0
- tests/Error82.hs +2/−0
- tests/Error82.ref +7/−0
- tests/Error83.hs +2/−0
- tests/Error83.ref +5/−0
- tests/Error84.hs +2/−0
- tests/Error84.ref +7/−0
- tests/Error85.hs +3/−0
- tests/Error85.ref +5/−0
- tests/Error86.hs +4/−0
- tests/Error86.ref +5/−0
- tests/Error87.hs +2/−0
- tests/Error87.ref +5/−0
- tests/Error88.hs +4/−0
- tests/Error88.ref +5/−0
- tests/Error89.hs +5/−0
- tests/Error89.ref +5/−0
- tests/Error9.hs +1/−0
- tests/Error9.ref +5/−0
- tests/Error90.hs +3/−0
- tests/Error90.ref too large to diff
- tests/Error91.hs too large to diff
- tests/Error91.ref too large to diff
- tests/Error92.hs too large to diff
- tests/Error92.ref too large to diff
- tests/Error93.hs too large to diff
- tests/Error93.ref too large to diff
- tests/Error94.hs too large to diff
- tests/Error94.ref too large to diff
- tests/Error95.hs too large to diff
- tests/Error95.ref too large to diff
- tests/Error96.hs too large to diff
- tests/Error96.ref too large to diff
- tests/Error97.hs too large to diff
- tests/Error97.ref too large to diff
- tests/Error98.hs too large to diff
- tests/Error98.ref too large to diff
- tests/Error99.hs too large to diff
- tests/Error99.ref too large to diff
- tests/ExtraComma.hs too large to diff
- tests/ExtraComma.ref too large to diff
- tests/Extract.hs too large to diff
- tests/Extract.ref too large to diff
- tests/FFIName.hs too large to diff
- tests/FFIName.ref too large to diff
- tests/FFINameA.hs too large to diff
- tests/FFINameB.hs too large to diff
- tests/ForExp.hs too large to diff
- tests/ForExp.ref too large to diff
- tests/ForExpJS.hs too large to diff
- tests/ForExpJS.ref too large to diff
- tests/ForImpForall.hs too large to diff
- tests/ForImpForall.ref too large to diff
- tests/ForImpJS.hs too large to diff
- tests/ForeignC.hs too large to diff
- tests/ForeignC.ref too large to diff
- tests/FromIntegral.hs too large to diff
- tests/FromIntegral.ref too large to diff
- tests/FullLaziness.hs too large to diff
- tests/FullLaziness.ref too large to diff
- tests/HashOper.hs too large to diff
- tests/HashOper.ref too large to diff
- tests/IOEFileName.hs too large to diff
- tests/IOEFileName.ref too large to diff
- tests/Info.hs too large to diff
- tests/Integer.hs too large to diff
- tests/Integer.ref too large to diff
- tests/InterleaveIO.hs too large to diff
- tests/InterleaveIO.ref too large to diff
- tests/Interpolate.hs too large to diff
- tests/Interpolate.ref too large to diff
- tests/JSBits.hs too large to diff
- tests/JSBits.ref too large to diff
- tests/JSFlag.hs too large to diff
- tests/JSFlag.ref too large to diff
- tests/JitCall.hs too large to diff
- tests/LargeGetLine.hs too large to diff
- tests/LargeGetLine.ref too large to diff
- tests/ListTest.hs too large to diff
- tests/ListTest.ref too large to diff
- tests/MD5.hs too large to diff
- tests/MD5.ref too large to diff
- tests/MVar.ref too large to diff
- tests/Makefile too large to diff
- tests/Mask.hs too large to diff
- tests/Mask.ref too large to diff
- tests/Nfib.hs too large to diff
- tests/NumUnder.hs too large to diff
- tests/NumUnder.ref too large to diff
- tests/PartRed.hs too large to diff
- tests/QualString.hs too large to diff
- tests/QualString.ref too large to diff
- tests/Record.hs too large to diff
- tests/Record.ref too large to diff
- tests/RecordBind.hs too large to diff
- tests/RecordBind.ref too large to diff
- tests/RecordExport.hs too large to diff
- tests/RecordExport.ref too large to diff
- tests/RecordExportAgain.hs too large to diff
- tests/RecordExportDefs.hs too large to diff
- tests/Reflect.hs too large to diff
- tests/Reflect.ref too large to diff
- tests/RnfNoErr.hs too large to diff
- tests/RnfNoErr.ref too large to diff
- tests/Roles.hs too large to diff
- tests/Roles.ref too large to diff
- tests/RolesDefs.hs too large to diff
- tests/Rotate.hs too large to diff
- tests/Rotate.ref too large to diff
- tests/Serdes.hs too large to diff
- tests/SerdesDescr.hs too large to diff
- tests/SerdesDescr.ref too large to diff
- tests/Storable.hs too large to diff
- tests/Storable.ref too large to diff
- tests/TextOps.hs too large to diff
- tests/TextOps.ref too large to diff
- tests/ThrowMVar.hs too large to diff
- tests/ThrowMVar.ref too large to diff
- tests/ThrowToSync.hs too large to diff
- tests/ThrowToSync.ref too large to diff
- tests/TypeEq.hs too large to diff
- tests/TypeEq.ref too large to diff
- tests/Unboxed.hs too large to diff
- tests/Unboxed.ref too large to diff
- tests/Via.hs too large to diff
- tests/Via.ref too large to diff
- tests/Weak.hs too large to diff
- tests/Weak.ref too large to diff
- tests/itest.ref too large to diff
@@ -7,27 +7,28 @@ # OR, for Ubuntu Linux (after apt-get install -y libgmp-dev): #MHSGMPCCLIBS=-lgmp #++# # installation prefix PREFIX=/usr/local # Unix-like system, 32/64 bit words CONF=unix #-# Using GCC enables global register variables on ARM64, which gives a 5-10% speedup.-#CC=gcc-14 RTS=src/runtime RTSINC=-I$(RTS) -I$(RTS)/$(CONF) MAINC= $(RTS)/main.c #+ CCWARNS= -Wall CCOPTS= -O3 # CCOPTS+= -flto # useful, but generates harmless warning with gcc # CCOPTS+= -march=native # useful on x86, but breaks on some platforms-CCLIBS= -lm $(MHSGMPCCLIBS)+CCLIBS= $(MHSGMPCCLIBS) -lm CCSANITIZE= -fsanitize=undefined -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract CCEVAL= $(CC) $(CCWARNS) $(CCOPTS) $(MHSGMPCCFLAGS) $(RTSINC) $(MAINC) $(RTS)/eval.c # GHC= ghc-GHCINCS= -ighc -isrc+GHCINCS= -ighc -isrc -ilib/libmhs GHCWARNS= -Wall -Wno-unrecognised-warning-flags -Wno-x-partial -Wno-deprecations GHCOPTS= -O GHCEXTS= -XScopedTypeVariables -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances@@ -41,13 +42,17 @@ # Hugs HUGS= runhugs FFIHUGS= ffihugs-HUGSINCS= '+Phugs:mhs:src:{Hugs}/packages/*:hugs/obj' -98 +o +w+HUGSINCS= '+Phugs:mhs:src:lib/libmhs:{Hugs}/packages/*:hugs/obj' -98 +o +w+#+TIME=time # NODE=node #NODEFLAGS=--stack_size=8192 #-MHSINCNP= -i $(MHSGMP) -imhs -isrc -ilib+# The modules of base that the compiler uses too+LIBMHS= $(wildcard lib/libmhs/*/*.hs lib/libmhs/*/*/*.hs lib/libmhs/*/*/*/*.hs)+MHSINCNP= -i $(MHSGMP) -imhs -isrc -ilib -ilib/libmhs MHSINC=$(MHSINCNP) MAINMODULE=MicroHs.Main #@@ -82,11 +87,16 @@ @mkdir -p bin $(CCEVAL) generated/mcabal.c $(CCLIBS) -o bin/mcabal -# Compile cpphs from distribution, with C compiler+# Compile install from distribution, with C compiler bin/install: $(RTS)/*.c $(RTS)/*.h $(RTS)/*/*.h #generated/install.c @mkdir -p bin $(CCEVAL) generated/install.c $(CCLIBS) -o bin/install +# Compile tester from distribution, with C compiler+bin/tester: $(RTS)/*.c $(RTS)/*.h $(RTS)/*/*.h #generated/tester.c+ @mkdir -p bin+ $(CCEVAL) generated/tester.c $(CCLIBS) -o bin/tester+ # Compile combinator evaluator bin/mhseval: $(RTS)/*.c $(RTS)/*.h $(RTS)/*/*.h @mkdir -p bin@@ -106,7 +116,7 @@ #EMCC=emcc #EMCCFLAGS=-O3 -sEXPORTED_RUNTIME_METHODS=stringToNewUTF8 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sNODERAWFS -sSINGLE_FILE -DUSE_SYSTEM_RAW -sEXIT_RUNTIME EMCCOPTS= -O3 -sEXPORTED_FUNCTIONS=_apply_sp,_main -sEXPORTED_RUNTIME_METHODS=stringToNewUTF8 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sSINGLE_FILE -DUSE_SYSTEM_RAW -Wno-address-of-packed-member-EMCCLIBS= -lm+EMCCLIBS= $(MHSGMPCCLIBS) -lm EMCCEVAL= emcc $(EMCCOPTS) $(RTSINC) $(MAINC) $(RTS)/eval.c generated/mhseval.js: $(RTS)/*.c $(RTS)/*.h $(RTS)/*/*.h @mkdir -p bin@@ -121,17 +131,17 @@ ####################### # Compile mhs with ghc-bin/gmhs: src/*/*.hs ghc/*.hs ghc/*/*.hs ghc/*/*/*.hs+bin/gmhs: src/*/*.hs ghc/*.hs ghc/*/*.hs ghc/*/*/*.hs $(LIBMHS) @mkdir -p bin $(GHC) $(GHCFLAGS) $(RTSINC) $(MAINMODULE) -o bin/gmhs # Compile mhs with ghc, with code coverage-bin/cmhs: src/*/*.hs ghc/*.hs ghc/*/*.hs+bin/cmhs: src/*/*.hs ghc/*.hs ghc/*/*.hs $(LIBMHS) @mkdir -p bin $(GHC) $(GHCFLAGS) $(RTSINC) -fhpc $(MAINMODULE) -o bin/cmhs # Generate distribution C file-generated/mhs.c: bin/mhs src/*/*.hs+generated/mhs.c: bin/mhs src/*/*.hs $(LIBMHS) @mkdir -p generated bin/mhs -z $(MHSINC) $(MAINMODULE) -ogenerated/mhs.c @@ -139,7 +149,11 @@ @mkdir -p generated bin/mhs -z $(MHSINC) -iTools Install -ogenerated/install.c -ghcgen: bin/gmhs src/*/*.hs lib/*.hs lib/*/*.hs lib/*/*/*.hs+generated/tester.c: bin/mhs Tools/Tester.hs+ @mkdir -p generated+ bin/mhs -z $(MHSINC) -iTools Tester -ogenerated/tester.c++ghcgen: bin/gmhs src/*/*.hs lib/*.hs lib/*/*.hs lib/*/*/*.hs $(LIBMHS) bin/gmhs $(MHSINC) $(MAINMODULE) -ogenerated/mhs.c # This doesn't keep MicroCabal updated. I'm not sure how to do it@@ -162,14 +176,14 @@ cp generated/mhs-stage2.c generated/mhs.c # Build stage1 compiler with existing compiler-bin/mhs-stage1: bin/mhs src/*/*.hs+bin/mhs-stage1: bin/mhs src/*/*.hs $(LIBMHS) @mkdir -p generated @echo "*** Build stage1 compiler, using bin/mhs" bin/mhs -z $(MHSINC) $(MAINMODULE) -ogenerated/mhs-stage1.c $(CCEVAL) generated/mhs-stage1.c $(CCLIBS) -o bin/mhs-stage1 # Build stage2 compiler with stage1 compiler, and compare-bin/mhs-stage2: bin/mhs-stage1 src/*/*.hs+bin/mhs-stage2: bin/mhs-stage1 src/*/*.hs $(LIBMHS) @mkdir -p generated @echo "*** Build stage2 compiler, with stage1 compiler" bin/mhs-stage1 -z $(MHSINC) $(MAINMODULE) -ogenerated/mhs-stage2.c@@ -191,15 +205,12 @@ sed -e "s,%GMPFLAGS,$(MHSGMPCCFLAGS)," -e "s,%GMPLIBS,$(MHSGMPCCLIBS)," mhs.conf.in > mhs.conf # Run test examples with ghc-compiled compiler-runtest: bin/mhseval bin/gmhs tests/*.hs+runtest: tests/*.hs cd tests; $(MAKE) alltest # Run test examples with mhs-compiled compiler runtestmhs: bin/mhseval bin/mhs- cd tests; $(MAKE) MHS=../bin/mhs cache; $(MAKE) MHS="../bin/mhs +RTS -H4M -RTS -CR" alltest interactivetest--runitestmhs: bin/mhseval bin/mhs- cd tests; $(MAKE) MHS=../bin/mhs cache; $(MAKE) MHS="../bin/mhs +RTS -H4M -RTS -CR" interactivetest+ cd tests; $(MAKE) MHS=../bin/mhs cache; $(MAKE) MHS="../bin/mhs +RTS -H4M -RTS -CR" alltest # Run test examples with sanitized mhs-compiled compiler runtestsan: bin/mhsevalsane sanitizemhs@@ -210,8 +221,8 @@ cd tests; $(MAKE) EVAL="../bin/mhsevalsane +RTS -H1M -RTS" info test errtest # Run test examples going via JavaScript-runtestemscripten: bin/mhseval bin/mhs bin/cpphs- cd tests; $(MAKE) MHS=../bin/mhs cache; MHSDIR=.. $(MAKE) MHSTARGET="-temscripten" MHS="../bin/mhs -CR -oout.js" EVAL="$(NODE) $(NODEFLAGS) out.js" info test errtest testpipenonblockioem+runtestemscripten: bin/mhseval bin/mhs bin/cpphs bin/tester+ cd tests; $(MAKE) MHS=../bin/mhs cache; MHSDIR=.. $(MAKE) MHSTARGET="-temscripten" MHS="../bin/mhs -CR -oout.js" EVAL="$(NODE) $(NODEFLAGS) out.js" info test errtest testpipenonblockioem testjsflag testjsbits runtestinstemscripten: cd tests; $(MAKE) MHSTARGET="-temscripten" MHS="mhs.js -oout.js" EVAL="$(NODE) $(NODEFLAGS) out.js" test@@ -230,29 +241,29 @@ timecompile: bin/mhs @date @git rev-parse HEAD- time bin/mhs +RTS -v -RTS $(MHSINC) $(MAINMODULE)+ $(TIME) bin/mhs +RTS -v -RTS $(MHSINC) $(MAINMODULE) # timecachecompile: bin/mhs @-rm -f .mhscache- time bin/mhs +RTS -v -RTS -CW AllOfLib- time bin/mhs +RTS -v -RTS -CR -s $(MHSINC) $(MAINMODULE)+ $(TIME) bin/mhs +RTS -v -RTS -CW AllOfLib+ $(TIME) bin/mhs +RTS -v -RTS -CR -s $(MHSINC) $(MAINMODULE) # timemhscompile: @date @git rev-parse HEAD- time mhs +RTS -v -RTS -z -imhs -isrc $(MAINMODULE)+ $(TIME) mhs +RTS -v -RTS -z -imhs -isrc $(MAINMODULE) timegmhscompile: @date @git rev-parse HEAD- time bin/gmhs -imhs -isrc $(MAINMODULE)+ $(TIME) bin/gmhs -imhs -isrc $(MAINMODULE) timeghccompile: @date @git rev-parse HEAD- time $(GHC) -fforce-recomp $(GHCFLAGS) -O0 $(MAINMODULE) -o bin/gmhs+ $(TIME) $(GHC) -fforce-recomp $(GHCFLAGS) -O0 $(MAINMODULE) -o bin/gmhs # cachelib:@@ -261,7 +272,7 @@ # clean:- rm -rf src/*/*.hi src/*/*.o *.comb *.js *.tmp *~ bin/* a.out $(GHCOUTDIR) Tools/*.o Tools/*.hi dist-newstyle generated/*-stage* .mhscache .mhscache dist-mcabal Interactive.hs .mhsi lib/*.pkg lib/dist-mcabal mhs.conf+ rm -rf src/*/*.hi src/*/*.o *.comb *.js *.tmp *~ bin/* a.out $(GHCOUTDIR) Tools/*.o Tools/*.hi dist-newstyle generated/*-stage* .mhscache .mhscache dist-mcabal Interactive.hs .mhsi lib/*.pkg lib/dist-mcabal mhs.conf *.gcda *.gcno *.profraw cd tests; $(MAKE) clean -cabal clean -git submodule deinit cpphssrc/malcolm-wallace-universe@@ -280,9 +291,10 @@ @echo "*** Set environment variable MHSDIR to $(PREFIX)/lib/mhs" @echo "***" -everytest: newmhs bin/cpphs exampletest info runtest cachetest bootcombtest nfibtest+everytest: bin/mhs bin/cpphs bin/mhseval bin/tester exampletest cachetest runtest bootstrap nfibtest -everytestmhs: bin/mhs bin/cpphs bin/mhseval exampletest info cachetest bootstrap runtestmhs nfibtest+#everytestmhs: bin/mhs bin/cpphs bin/mhseval exampletest info cachetest bootstrap runtestmhs nfibtest+everytestmhs: everytest bootcombtest: bin/gmhs bin/mhseval bin/gmhs $(MHSINC) -ogmhs.comb $(MAINMODULE)@@ -314,8 +326,8 @@ ###### -VERSION=0.16.0.0-HVERSION=0,16,0,0+VERSION=0.17.4.0+HVERSION=0,17,4,0 MCABAL=$(HOME)/.mcabal MCABALMHS=$(MCABAL)/mhs-$(VERSION) MDATA=$(MCABALMHS)/packages/mhs-$(VERSION)/data@@ -338,6 +350,7 @@ rm -f generated/mcabal.c generated/mhseval.js generated/base.pkg $(MAKE) generated/mcabal.c $(MAKE) generated/install.c+ $(MAKE) generated/tester.c $(MAKE) generated/mhseval.js $(MAKE) generated/base.pkg @@ -356,6 +369,8 @@ @echo '* mcabal - cabal for MicroHs' @echo '* Libraries:' @echo '* base (bytestring, deepseq, directory, hashable, text, stm)'+ @echo '* Configuration (in $(MDATA)):'+ @echo '* mhs.conf – package path and build targets' @echo '***************************************************' @echo '' @@ -372,6 +387,9 @@ bin/mhs -Q generated/base.pkg $(MCABALMHS) @echo $$PATH | tr ':' '\012' | grep -q $(MCABALBIN) || echo '***' Add $(MCABALBIN) to the PATH +install-pgo: bin/install+ bin/install --pgo -i$(MCABAL) GMPFLAGS=$(MHSGMPCCFLAGS) GMPLIBS=$(MHSGMPCCLIBS)+ machdep: $(CC) Tools/machdep.c -o machdep.exe && ./machdep.exe > $(RTS)/MachDeps.h && rm machdep.exe @@ -392,15 +410,15 @@ # This gives about a 5% speedup on my M4 MacMini llvmpgo: rm -f *.profraw- $(CCEVAL) -fprofile-generate generated/mhs.c $(CCLIBS) -o $(MCABABIN)/mhs_gen- mhs_gen -imhs -isrc MicroHs.Main+ $(CCEVAL) -flto -fprofile-generate generated/mhs.c $(CCLIBS) -o $(MCABALBIN)/mhs.gen+ mhs.gen -imhs -isrc MicroHs.Main xcrun llvm-profdata merge -output=code.profdata *.profraw- $(CCEVAL) -fprofile-use=code.profdata generated/mhs.c $(CCLIBS) -o $(MCABABIN)/mhs+ $(CCEVAL) -flto -fprofile-use=code.profdata generated/mhs.c $(CCLIBS) -o $(MCABALBIN)/mhs.pgo ##### # Hugs HUGS= runhugs-HUGSINCS= '+Phugs:src:{Hugs}/packages/*:hugs/obj' -98 +o +w -h100m+HUGSINCS= '+Phugs:src:lib/libmhs:{Hugs}/packages/*:hugs/obj' -98 +o +w -h100m generated/hmhs.c: @mkdir -p generated@@ -410,4 +428,9 @@ @mkdir -p bin $(CCEVAL) generated/hmhs.c $(CCLIBS) -o bin/hmhs -+testhugs: newmhs+ rm -f generated/hmhs.c+ make bin/hmhs+ bin/hmhs $(MHSINC) $(MAINMODULE) -ohugs-mhs.comb+ bin/mhs $(MHSINC) $(MAINMODULE) -omhs-mhs.comb+ cmp hugs-mhs.comb mhs-mhs.comb
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: MicroHs-version: 0.16.0.0+version: 0.17.4.0 -- *** When changing the version number, also -- *** run 'sh updateversion.sh' -- *** Yeah, it stinks.@@ -74,6 +74,7 @@ MicroHs.Desugar MicroHs.EncodeData MicroHs.Embed+ MicroHs.Error MicroHs.Exp MicroHs.ExpPrint MicroHs.Expr@@ -83,7 +84,6 @@ MicroHs.Graph MicroHs.Ident MicroHs.IdentMap- MicroHs.IntMap MicroHs.IntSet MicroHs.Interactive MicroHs.Lex@@ -99,24 +99,25 @@ MicroHs.Translate MicroHs.TypeCheck MicroHs.Version- Text.ParserComb- Text.PrettyPrint.HughesPJLite- Text.PrettyPrint.HughesPJLiteClass+ Mhs.Text.ParserComb+ Mhs.Text.PrettyPrint.HughesPJLite+ Mhs.Text.PrettyPrint.HughesPJLiteClass System.Console.SimpleReadline Data.Double Data.Integer- PrimTable -- MhsEval MHSPrelude+ MiniPrelude System.IO.MD5 System.IO.Serialize System.IO.TimeMilli System.IO.Transducers System.Compress+ Mhs.IntMap if impl(ghc)- hs-source-dirs: ghc src- build-depends: base >= 4.10 && < 4.30,+ hs-source-dirs: ghc src lib/libmhs+ build-depends: base >= 4.10 && < 4.29, bytestring >= 0.5 && < 0.20, deepseq >= 1.1 && < 1.8, filepath >= 1.1 && < 1.8,@@ -132,9 +133,9 @@ -- includes: mhseval.h if impl(hugs)- hs-source-dirs: hugs src+ hs-source-dirs: hugs src lib/libmhs if impl(mhs) hs-source-dirs: mhs src- build-depends: base >= 0.1 && < 10.0,+ build-depends: base >= 0.1 && < 99.9,
@@ -1,269 +1,50 @@ # Micro Haskell-This repository contains an implementation of an extended subset of Haskell.-It uses combinators for the runtime execution. -[Try it in your browser](https://augustss.github.io/MicroHs/web-mhs/)--The runtime system has minimal dependencies, and can be compiled even for micro-controllers.-The `boards/` directory contains some samples, e.g., some sample code for an STM32F407G-DISC1 board.--The compiler can compile itself.--## Presentation-You can find my [presentation from the Haskell Symposium 2024](https://docs.google.com/presentation/d/1WsSiSwypNVTm0oZ3spRYF8gA59wyteOsIkPRjCUAZec/edit?usp=sharing), [video](https://m.youtube.com/watch?v=uMurx1a6Zck&t=36m).-There is also a short paper at [`doc/hs2024.pdf`](https://github.com/augustss/MicroHs/blob/master/doc/hs2024.pdf).--## Compiling MicroHs-There are two different ways to compile MicroHs:-* Using GHC. `Makefile` target `bin/gmhs`-* Using the included combinator file and runtime. `Makefile` target `bin/mhs`--These different ways of compiling need slightly different imports etc.-This happens by GHC looking in the `ghc/` subdirectory first for any extras/overrides.--Compiling MicroHs is really best done using `make`, but there is also a `MicroHs.cabal` file-for use with `cabal`/`mcabal`. This only builds what corresponds to the first target.-Doing `cabal install` will install the compiler.-Note that `mhs` built with ghc does not have all the functionality.--Also note that there is no need to have a Haskell compiler to run MicroHs.-All you need is a C compiler, and MicroHs can bootstrap, given the included combinator file.--To install `mhs` use `make minstall`. This will install `mhs` in `~/.mcabal` in the same-way as `mcabal` (MicroCabal) would have. It will install a compiler binary and a compiled base package.-You will have to add `~/.mcabal/bin` to your `PATH`.--Alternatively, to install `mhs` use `make oldinstall`. By default this copies the files to `/usr/local`,-but this can be overridden by `make PREFIX=dir oldinstall`.-You also need to set the environment variable `MHSDIR`.+MicroHs (`mhs`) is a compiler for an extended subset of Haskell 2010, with many GHC extensions. It compiles to combinators that are executed by a small, portable runtime system written in C. The compiler can compile itself, and all you need to build it is a C compiler; no Haskell compiler is required. The runtime is small enough to run on micro-controllers. -To compile on Windows make sure `cl` is in the path, and then use `nmake` with `Makefile.windows`.+[Try it in your browser](https://augustss.github.io/MicroHs/web-mhs/). -The compiler can also be used with emscripten to produce JavaScript/WASM.+## Installing -### Using GMP for `Integer`-The default implementation of the `Integer` type is written in Haskell and is quite slow.-It is possible to use the [GMP](https://gmplib.org/) library instead.-To use GMP you need to uncomment the first few lines in the `Makefile`, and also-modify the definition that directs the C compiler where to find GMP.+```+git clone --depth=1 https://github.com/augustss/MicroHs.git+cd MicroHs+make install+```+This installs `mhs`, `cpphs`, and `mcabal` (for installing packages) in `~/.mcabal/bin`, together with the compiled `base` package. Add `~/.mcabal/bin` to your `PATH`. -***NOTE*** To switch between using and not using GMP you need to do `make clean`.-You might also need to do `make USECPPHS=cpphs bootstrapcpphs` if there are complaints.+On Windows, make sure `cl` is in the path and use `nmake -f Makefile.windows install`. ## Example-The file `Example.hs` contains the following:-```Haskell-module Example(main) where -fac :: Int -> Int+The file `Example.hs` contains:+```haskell+module Example(fac, main) where++fac :: Integer -> Integer fac 0 = 1-fac n = n * fac(n-1)+fac n = n * fac(n - 1) main :: IO () main = do- let rs = map fac [1,2,3,10]+ let rs = map fac [1,2,3,10,52] putStrLn "Some factorials" print rs ``` -First, make sure the compiler is built by doing `make`.-Then compile the file by `bin/mhs Example -oEx` which produces `Ex`.-Finally, run the binary file by `./Ex`.-This should produce+Compile and run it: ```+$ mhs Example -oEx+$ ./Ex Some factorials-[1,2,6,3628800]-```--## Libraries-The `Prelude` contains the functions from the Haskell Report and a few extensions,-with the notable exception that `Foldable` and `Traversable` are not part of the `Prelude`.-They can be imported separately, though.--### Not importing `Prelude`-To completely avoid importing the prelude (which can be needed in base to-avoid circular imports) use the incantation `import qualified Prelude()`.-This will not even try to open `Prelude.hs`. It also avoids the automagic-(qualified) import of `Mhs.Builtin` that normally happens.---## Interactive mode-If no module name is given the compiler enters interactive mode.-You can enter expressions to be evaluated, or top level definitions (including `import`).-Simple line editing is available.--## MHS as a cross compiler-When `mhs` is built, targets.conf is generated. It will look something like this:-```ini-[default]-cc = "cc"-conf = "unix-64"-```--You can add other targets to this file, changing which compiler command is used and which runtime is-selected and then use the `-t` argument to select which target you would like.--## Files-There is a number of subdirectories:-* `Tools/` a few useful tools for compressions etc.-* `bin/` executables are put here-* `generated/` this contains the (machine generated) combinator file for the compiler.-* `lib/` this contains the `Prelude` and other base library file.-* `src/MicroHs/` the compiler source-* `src/runtime/` the runtime source-* `tests/` some tests--# Preprocessor-Sadly, compiling a lot of Haskell packages needs the C preprocessor.-To this end, the distribution contains the combinator code for `cpphs`.-Doing `make bin/cpphs` will create the binary for the preprocessor.--To bootstrap `cpphs` you can do `make bootstrapcpphs`.-This assumes that you have `git` to download the needed packages.-At the moment, the downloaded packages are forks of the original to-make it compile with `mhs`.--To identify that it is MicroHs that is the compiler it defines the symbol `__MHS__`.--# Contributing-Contributions are very welcome!--When modifying the compiler, run `make newmhs` or `make newmhsz` (the latter compresses the binary)-to generate a compiler that includes your changes.--## Libraries--The libraries live in the `lib/` directory. Adding missing functions/instances/types from the report is a welcome contribution.-Common things from `base` and GHC boot libraries that use a lot of GHC-specific code (such as `array`, `bytestring`, `text`, ...) can also be added.--## Tests--The test suite is located in the `tests/` directory.--To add a new test, create a `MyTest.hs` file and a corresponding `MyTest.ref` file for the expected output.-Then add it to the `test` rule in `tests/Makefile`:-```makefile- $(TMHS) MyTest && $(EVAL) > MyTest.out && diff MyTest.ref MyTest.out-```--If you want to test that a module fails to compile with a certain error message,-add it to `tests/errmsg.test`, for example:-```-module E() where-x :: Int-x = y-------"../tmp/E.hs": line 4, col 5: undefined value: y--=====+[1,2,6,3628800,80658175170943878571660636856403766975289505440883277824000000000000] ```--To run the test suite, do-* `make runtest` to use the GHC-compiled compiler-* `make runtestmhs` to use the MicroHs-compiled compiler-* `make runtestemscripten` to use the MicroHs-compiled compiler targeting JavaScript--## Primitives--If you want to add a new primitive, you need to modify a few things:-* in `src/runtime/eval.c`- - add a variant to `enum node_tag`- - add an entry to the `primops` table (mapping the name of your primitive to the tag)- - add a `case` in `printrec`- - implement the primitive by adding a `case` in `evali` (you can use the other primitives as a guide)-* in `src/MicroHs/Translate.hs`- - add an entry to the `primTable`, to make the primitive available in the interactive mode-* in `ghc/PrimTable.hs`- - add an entry to `primOps`, if the primitive should be available in the GHC-compiled interactive mode-* in `hugs/PrimTable.hs`- - add an entry to `primOps`, if the primitive should be available in the Hugs-compiled interactive mode--Then you can use the primitive via the `_primitive` keyword (`_primitive "myPrimitive"`).--# Thank You-A big thanks goes to the people who have contributed to MicroHs:-@amigalemming-@arossato-@benclifford-@claudeha-@dmjio-gay@disroot.org-@gergoerdi-@ikervagyok-@jmaessen-@juhp-@kolmodin-@konsumlamm-@liolin-@lortabac-@MaximilianAlgehed-@meooow25-@philderbeast-@rewbert-@sol-@Superstar64-@thielema-@thimc-@thma-@treeowl-@TristanCacqueray-@tvmaaren-@yobson---# FAQ-*- * Q: When will it get _insert feature_?- * A: Maybe some time, maybe never. But it doesn't hurt to ask for it.-*- * Q: Why are the error messages so bad?- * A: Error messages are boring.-------For more information, see the [wiki](https://github.com/augustss/MicroHs/wiki).-------# Finding modules *NOT YET IMPLEMENTED*-A module `M` is located using the _sourcePath_ and the _packageDbPath_.-Both of the paths are a list of directories and are searched left-to-right.-This lookup is used both `import` and modules given on the command line.--Note: If the module name given on the command line has suffix `.hs` or `.lhs`-it is used as a file name, rather than a module name.--First, the the _sourcePath_ is used. For each directory in the-path:- * the module name `M` is appended with `.` changed to `/`.- * then the suffixes `.hs`, `.hsc`, and `.lhs` are tried in order- * if the file exists it is assumed to be the source for module `M`--Second, if no source file is found, then each directory in the-_packageDbPath_ is tried. If the module is found, the corresponing-package is loaded and the compiled module 'M' from that package is used.--## Setting the _sourcePath_-The default _sourcePath_ is just the current directory, `.`.-The path can be cleared by using the `-i` command line flag.-To append to the path use `-iPATH`, where `PATH` is a colon (`:`)-separated list of directories.--## Setting the _packageDbPath_-The default _packageDbPath_ is take from the `mhs.conf` file-in the section `[mhs]` and key `packageDbPath`.-The path can contain environment variables that are expanded.-In addition $MHSPKG expand to the package directory relative to the executing binary.-Furthermore $VERSION expands to the mhs version number.+Running `mhs` with no arguments starts an interactive session. -The path can be cleared by using the `-a` command line flag.-To append to the path use `-aPATH`, where `PATH` is a colon (':')-separated list if directories.+## Documentation -## Installing packages+The full documentation is in [`doc/MicroHs.md`](doc/MicroHs.md). -The _packageDb_ directory can be given directly with the `-Q`-flag used to install.+There are some [slides](https://augustss.github.io/miso-slides/) with a general presentation of MicroHs. -The `mcabal` command can install to a particular package db by using-`--install=PATH`.+There is also a [presentation from the Haskell Symposium 2024](https://docs.google.com/presentation/d/1WsSiSwypNVTm0oZ3spRYF8gA59wyteOsIkPRjCUAZec/edit?usp=sharing) ([video](https://m.youtube.com/watch?v=uMurx1a6Zck&t=36m)) and a short paper, [`doc/hs2024.pdf`](doc/hs2024.pdf).
@@ -4,6 +4,7 @@ import Data.Char import Data.List import Data.Maybe+import Data.Version import Data.Word import Foreign.Storable import Foreign.Marshal.Utils@@ -12,9 +13,13 @@ import System.Environment import System.FilePath import System.Process+import System.IO.Serialize import System.IO.TimeMilli import Text.Printf import MicroHs.Config+import MicroHs.Ident(showIdent)+import MicroHs.Package+import MicroHs.TypeCheck(tModuleName) type CConf = [(Key, Value)] @@ -33,7 +38,8 @@ exe | target flags == "windows" = "exe" | otherwise = "" inst = fromMaybe (home </> ".mcabal") (instDirM flags)- flags' = flags { exeSuffix = exe, cconf = cc, instDir = inst, conf = confText }+ flags' = flags { exeSuffix = exe, cconf = cc, instDir = inst, conf = confText+ , libraries = getLibraries conf } install flags' @@ -51,21 +57,27 @@ time "mkConf" $ mkConf flags' time "copyRTS" $ copyRTS flags' time "copyBase" $ copyBase flags'+ time "registerBase" $ registerBase flags' time "checkPath" $ checkPath flags'+ time "pgo" $ optMhs flags' instBin :: Flags -> IO () instBin flags = do let mCabal = instDir flags mcabalBin = mCabal </> "bin"- exes = ["mhs", "cpphs", "mcabal"]+ exes = ["mhs", "cpphs", "mcabal", "tester"] mkdir flags "bin" mapM_ (buildBin flags) exes mkdir flags mcabalBin- let cpbin pgm = do- let exe = pgm <.> exeSuffix flags- copy flags ("bin" </> exe) (mcabalBin </> exe)- mapM_ cpbin exes+ mapM_ (cpbin flags mcabalBin) exes +cpbin :: Flags -> FilePath -> String -> IO FilePath+cpbin flags mcabalBin pgm = do+ let exe = pgm <.> exeSuffix flags+ dst = mcabalBin </> exe+ copy flags ("bin" </> exe) dst+ return dst+ mkMachdep :: Flags -> IO () mkMachdep flags = machdep flags $ "src" </> "runtime" </> "MachDeps.h"@@ -79,7 +91,7 @@ copyRTS :: Flags -> IO () copyRTS flags = do let mCabalMhs = instDir flags </> ("mhs-" ++ version flags)- let mData = mCabalMhs </> "packages" </> ("mhs-" ++ version flags) </> "data"+ let mData = mCabalMhs </> "packages" </> ("MicroHs-" ++ version flags) </> "data" rts = "src" </> "runtime" time "mkdir eData" $ mkdir flags mData time "copy mhs.conf" $ copy flags "mhs.conf" (mData </> "mhs.conf")@@ -92,14 +104,83 @@ out <- mhsOut flags ["-Q", "generated" </> "base.pkg", mCabalMhs] msg flags out +-- Packages from Hackage depend on base-4.x, and on bytestring, text, etc.,+-- whose modules are part of the base of mhs. Say so in Cabal registration+-- files next to the installed packages: one for base, and one for each+-- library bundled with it, which depends on base and has no package file+-- of its own. Tools like cabal can then read them instead of keeping a+-- table of their own. The libraries are given by the [library] sections+-- of the config file.+registerBase :: Flags -> IO ()+registerBase flags = do+ pkg <- readSerialized ("generated" </> "base.pkg") :: IO Package+ let mCabalMhs = instDir flags </> ("mhs-" ++ version flags)+ pkgDir = mCabalMhs </> "packages"+ baseName = showIdent (pkgName pkg)+ baseId = baseName ++ "-" ++ showVersion (pkgVersion pkg)+ (bases, libs) = partition ((== baseName) . libName) (libraries flags)+ base =+ case bases of+ [b] | isNothing (libModules b) -> b+ | otherwise -> error $ "The [library] for " ++ baseName ++ " cannot have modules"+ _ -> error $ "There must be exactly one [library] for " ++ baseName+ prefixes l = fromMaybe (error $ "The [library] for " ++ libName l ++ " has no modules") (libModules l)+ modules = map (showIdent . tModuleName)+ exported = modules (pkgExported pkg)+ bundles ps m = any (\ p -> m == p || (p ++ ".") `isPrefixOf` m) ps+ isBundled m = any (\ l -> bundles (prefixes l) m) libs+ register pid flds = do+ let file = mCabalMhs </> pid <.> "conf"+ msg flags $ "create " ++ file+ unless (dryRun flags) $+ writeFile file $ unlines [ showField f | f@(_, vs) <- flds, not (null vs) ]+ register baseId+ [ ("name", [baseName]), ("version", [libVersion base]), ("id", [baseId]), ("key", [baseId])+ , ("exposed", ["True"])+ , ("exposed-modules", filter (not . isBundled) exported)+ , ("hidden-modules", modules (pkgOther pkg))+ , ("library-dirs", [pkgDir])+ , ("ld-options", pkgOptl pkg)+ ]+ forM_ libs $ \ l -> do+ let pid = libName l ++ "-" ++ libVersion l+ register pid+ [ ("name", [libName l]), ("version", [libVersion l]), ("id", [pid]), ("key", [pid])+ , ("exposed", ["True"])+ , ("exposed-modules", filter (bundles (prefixes l)) exported)+ , ("depends", [baseId])+ ]+ where+ showField (k, [v]) = k ++ ": " ++ v+ showField (k, vs) = k ++ ":" ++ concatMap ("\n " ++) vs++-- A [library] section of the config file.+data Library = Library+ { libName :: String+ , libVersion :: String+ , libModules :: Maybe [String] -- module prefixes, none for base+ }+ deriving (Show)++getLibraries :: Config -> [Library]+getLibraries cnf = [ library kvs | ("library", kvs) <- cnf ]+ where+ library kvs =+ case [ k | (k, _) <- kvs, k `notElem` ["name", "version", "modules"] ] of+ [] -> Library { libName = field "name", libVersion = field "version"+ , libModules = words <$> lookup "modules" kvs }+ ks -> error $ "Unknown keys in [library]: " ++ unwords ks+ where field k = fromMaybe (error $ "Missing key in [library]: " ++ k) $ lookup k kvs+ checkPath :: Flags -> IO () checkPath flags = do path <- fromMaybe "" <$> lookupEnv "PATH"- let paths = splitOn pathSep path+ let paths = map norm (splitOn pathSep path) pathSep | target flags == "windows" = ";" | otherwise = ":" bin = instDir flags </> "bin"- unless (bin `elem` paths) $+ norm = map (\ c -> if c == '\\' then '/' else c)+ unless (norm bin `elem` paths) $ putStrLn $ "Please add " ++ bin ++ " to your PATH" buildBin :: Flags -> String -> IO ()@@ -109,9 +190,9 @@ ccf = cconf flags rts = "src" </> "runtime" time ("buildBin " ++ pgm) $- cc flags [get ccf "ccflags", "-I" ++ rts, "-I" ++ (rts </> get ccf "conf"),- rts </> "main.c", rts </> "eval.c",- src, get ccf "cclibs", getD ccf "-o" "cout" ++ dst]+ cc flags [xflags flags, get ccf "ccflags", "-I" ++ rts, "-I" ++ (rts </> get ccf "conf"),+ rts </> "main.c", rts </> "eval.c",+ src, get ccf "cclibs", getD ccf "-o" "cout" ++ dst] mhsOut :: Flags -> [String] -> IO String mhsOut flags args = do@@ -211,6 +292,7 @@ , dryRun :: Bool , verbose :: Bool , quiet :: Bool+ , pgo :: Bool , macros :: [(String, String)] , goals :: [String] , confFile :: FilePath@@ -221,6 +303,8 @@ , cconf :: CConf , version :: String , conf :: String+ , libraries :: [Library]+ , xflags :: String } deriving (Show) @@ -231,6 +315,7 @@ , dryRun = False , verbose = False , quiet = False+ , pgo = False , macros = [] , goals = [] , confFile = "mhs.conf.in"@@ -241,6 +326,8 @@ , cconf = undefined , version = undefined , conf = undefined+ , libraries = undefined+ , xflags = "" } decodeArgs :: Flags -> [String] -> Flags@@ -251,6 +338,7 @@ "-v" -> decodeArgs f{verbose = True} args "-q" -> decodeArgs f{quiet = True} args "--dryrun" -> decodeArgs f{dryRun = True} args+ "--pgo" -> decodeArgs f{pgo = True} args '-':'t':s -> decodeArgs f{target = s} args '-':'i':s -> decodeArgs f{instDirM = Just s} args '-':_ -> error $ "Unknown flag: " ++ arg ++ "\n" ++ usage@@ -259,7 +347,7 @@ | otherwise -> decodeArgs f{goals = goals f ++ [arg]} args usage :: String-usage = "\ninstall [--help] [-v] [--dryrun] [-tTARGET] [-iDIR] [NAME=MACRO] [GOAL]\n"+usage = "\ninstall [--help] [-v] [--dryrun] [--pgo] [-tTARGET] [-iDIR] [NAME=MACRO] [GOAL]\n" copyFileBS :: FilePath -> FilePath -> IO () copyFileBS src dst = BS.readFile src >>= BS.writeFile dst@@ -273,3 +361,43 @@ t2 <- getTimeMilli printf "***** %s %fs\n" s (fromIntegral (t2 - t1) / 1000) return a++-- Do Profile Guided Optimization+optMhs :: Flags -> IO ()+optMhs flags | not (pgo flags) = return ()+ | otherwise = do+ let mCabal = instDir flags+ mcabalBin = mCabal </> "bin"+ mpf <- pgoFlags flags+ case mpf of+ Nothing -> putStrLn "Not clang nor gcc, so no PGO"+ Just (genFlag, useFlag, merge) -> do+ putStrLn "*** Doing Profile Guided Optimization..."+ -- Build with flag to generate profile info+ buildBin flags{xflags = genFlag} "mhs"+ -- Copy to target location+ mhs <- cpbin flags mcabalBin "mhs"+ -- Invoke mhs, compiling itself+ let mhsArgs = ["-i", "-imhs", "-isrc", "MicroHs.Main"]+ msg flags $ unwords (mhs : mhsArgs)+ callProcess mhs mhsArgs+ -- Extra profile processing+ merge+ -- Compile again with profiling info+ buildBin flags{xflags = useFlag} "mhs"+ -- And install it again+ _ <- cpbin flags mcabalBin "mhs"+ return ()++pgoFlags :: Flags -> IO (Maybe (String, String, IO ()))+pgoFlags flags = do+ -- figure out which C compiler this is+ let c = get (cconf flags) "cc"+ out <- readProcess c ["--version"] ""+ if "gcc" `isInfixOf` out then+ return $ Just ("-fprofile-generate -flto=auto", "-fprofile-use -flto=auto", return ())+ else if "clang" `isInfixOf` out then+ return $ Just ("-fprofile-generate -flto=full", "-fprofile-use=mhs.profdata -flto=full",+ callProcess "llvm-profdata" ["merge", "-output=mhs.profdata", "*.profraw"])+ else+ return Nothing
@@ -1,1400 +1,1380 @@ #include "mhsffi.h" static const unsigned char data[] = {-122,76,90,50,173,108,0,0,93,0,0,0,1,76,73,2,0,0,0,0,-0,0,59,14,1,195,100,94,61,190,90,171,231,253,202,156,110,10,21,185,-4,62,118,44,91,134,160,232,84,184,183,170,81,174,167,43,75,114,73,39,-119,241,228,199,245,33,97,62,253,33,113,102,230,164,137,4,205,10,95,18,-137,55,51,57,174,197,168,128,223,231,139,181,165,214,200,219,210,151,166,105,-80,76,112,68,219,59,163,60,52,70,126,75,54,9,75,34,148,197,177,99,-3,41,148,15,223,58,69,232,153,195,187,194,191,84,73,93,31,79,210,21,-49,31,181,65,198,33,9,183,137,46,215,9,177,224,194,54,108,40,159,216,-197,116,89,137,30,234,92,207,11,163,76,218,192,176,148,72,218,17,169,132,-179,167,253,82,31,77,119,175,78,77,65,50,186,33,58,138,240,103,42,94,-114,64,186,254,246,46,4,132,16,110,121,108,65,16,243,134,222,13,51,76,-82,51,121,64,153,24,139,82,149,119,22,183,119,215,246,76,189,182,152,130,-179,172,145,128,27,22,122,149,227,66,131,129,149,225,210,252,10,87,195,20,-20,179,99,76,88,154,78,116,9,233,147,91,220,199,158,85,69,249,65,50,-102,115,206,216,129,47,158,161,183,131,172,34,206,28,146,18,185,85,94,99,-161,164,53,209,85,30,214,68,146,244,52,216,89,203,214,197,247,110,66,106,-118,188,6,244,66,110,27,174,154,116,178,89,181,4,55,171,151,178,2,92,-121,62,50,195,195,148,38,110,36,91,82,143,105,51,124,26,151,5,148,0,-128,51,81,142,146,102,46,197,133,133,105,48,153,229,22,102,140,254,232,86,-236,45,240,252,62,113,125,190,175,127,2,174,139,41,91,217,95,69,70,32,-248,37,8,181,193,76,139,6,30,215,27,150,52,138,65,15,139,75,113,2,-137,69,201,208,220,128,123,225,16,40,175,219,10,70,204,4,194,80,157,247,-38,12,190,227,74,113,11,135,146,20,58,143,88,152,217,202,21,212,125,17,-220,13,157,96,255,134,95,198,39,40,181,210,64,39,155,2,175,21,198,41,-53,148,26,122,80,254,113,70,16,88,242,73,188,190,182,43,205,179,73,92,-6,192,43,37,177,170,8,22,183,3,234,5,50,17,173,32,24,31,157,156,-188,70,58,193,16,135,16,170,17,208,93,138,121,102,185,186,99,131,191,48,-224,103,217,51,229,91,218,101,43,101,142,18,95,100,102,240,74,37,122,170,-24,65,151,126,41,111,202,251,202,101,93,46,99,213,13,160,156,124,80,32,-49,254,68,217,23,154,28,123,161,85,226,209,200,11,45,121,134,195,26,142,-50,146,158,202,85,13,247,147,46,32,232,156,76,74,238,203,85,252,70,147,-252,96,13,28,217,37,22,43,162,217,63,85,200,247,214,187,160,168,10,28,-161,105,54,168,164,112,11,90,36,127,96,192,87,19,79,24,29,154,225,93,-37,189,184,28,242,163,87,241,210,101,7,237,137,204,14,178,94,21,248,162,-104,138,152,194,218,78,113,100,56,158,249,91,40,226,202,109,60,73,244,223,-187,233,149,149,74,113,73,165,97,78,119,102,192,16,68,8,78,96,119,139,-46,232,75,18,70,59,90,229,2,227,214,179,36,98,100,149,119,75,229,74,-202,69,161,13,230,190,79,174,17,117,232,239,36,124,116,152,150,114,45,170,-58,64,89,225,204,151,109,159,17,107,73,37,163,201,118,220,149,60,214,223,-126,231,240,87,140,34,65,246,113,164,110,111,202,204,161,48,144,72,251,23,-133,15,86,90,147,42,131,99,203,23,237,105,190,68,184,162,159,123,216,138,-252,121,230,101,245,123,117,21,50,114,200,168,231,31,70,145,5,235,228,93,-235,225,165,78,229,206,109,12,112,113,47,170,122,159,152,19,99,159,196,19,-118,1,234,60,214,155,10,11,225,55,110,244,24,231,218,178,101,103,223,2,-173,115,211,13,210,106,77,197,176,137,175,202,29,35,169,123,191,164,120,173,-176,198,159,218,24,135,181,211,70,42,34,6,159,172,92,118,208,181,0,96,-224,16,129,146,129,35,26,73,173,30,32,13,13,235,0,233,146,53,178,250,-175,49,111,244,38,88,98,144,245,70,246,82,150,57,254,45,182,232,226,84,-91,75,16,117,215,168,3,134,126,138,34,174,239,181,227,71,109,92,6,58,-122,161,106,179,182,175,104,197,143,167,172,54,154,11,50,58,154,188,164,176,-255,153,250,224,132,244,115,224,193,168,184,106,73,135,39,65,254,201,15,252,-156,213,199,32,211,122,246,138,152,113,244,159,21,11,90,195,70,123,218,221,-245,201,152,103,38,164,119,187,61,122,77,17,69,240,104,140,64,228,75,11,-54,60,221,212,241,249,216,88,142,70,232,170,49,198,0,234,127,30,154,84,-221,240,218,15,86,83,48,166,189,118,63,160,129,221,217,126,195,213,11,187,-253,37,156,20,225,51,182,193,226,231,226,199,241,127,180,21,123,192,15,183,-174,25,142,139,191,220,219,68,96,23,155,239,228,26,91,161,16,154,44,154,-158,105,223,29,19,249,13,180,84,110,57,17,32,45,127,185,13,191,239,102,-147,143,59,93,218,252,249,143,189,9,179,225,20,129,1,185,30,56,32,165,-177,198,190,100,205,180,255,3,30,175,142,154,76,126,25,80,229,5,123,201,-57,134,194,201,123,246,198,179,65,219,168,76,234,238,48,53,16,84,137,46,-223,111,206,69,200,14,96,189,193,108,145,175,223,91,173,182,35,80,161,15,-36,45,91,132,20,180,136,72,121,1,43,143,253,164,1,165,180,92,63,41,-239,34,220,40,206,39,126,161,8,41,88,87,235,13,208,49,40,221,231,168,-95,120,164,100,45,134,120,131,132,154,64,170,135,69,88,251,10,29,88,168,-157,67,82,183,40,93,162,168,42,38,88,163,85,148,92,150,54,79,121,129,-64,58,13,111,93,143,160,70,1,194,39,10,181,141,111,206,19,4,155,210,-170,182,225,224,162,75,52,104,0,248,12,92,232,93,172,34,19,231,183,87,-98,11,1,145,158,145,171,161,59,193,44,82,79,194,234,240,110,10,109,202,-255,227,130,129,0,5,51,49,150,162,3,109,212,214,20,104,173,13,129,63,-88,142,112,164,119,207,67,126,187,183,41,63,21,221,94,21,107,90,223,55,-29,108,162,245,26,165,27,185,136,5,104,252,97,145,168,68,73,24,25,193,-97,17,204,124,80,13,210,208,133,236,71,191,119,46,59,158,14,140,105,63,-53,66,51,1,142,217,187,174,30,117,245,68,171,215,224,183,115,232,243,121,-53,222,191,152,152,216,127,93,27,46,27,180,109,247,130,128,227,205,133,136,-100,25,112,249,196,35,13,22,124,139,125,25,223,183,201,221,155,240,120,81,-32,88,115,217,102,248,207,67,239,252,136,21,224,37,195,234,181,114,105,130,-255,130,40,101,6,36,47,167,120,30,90,197,173,215,216,14,250,76,197,153,-113,86,99,166,230,151,178,32,142,46,18,189,87,156,33,97,101,251,242,138,-21,26,39,26,234,178,75,228,132,141,133,208,109,100,83,47,167,4,161,83,-79,24,68,120,223,42,182,39,41,68,201,132,125,125,110,215,234,168,20,40,-43,241,210,115,135,190,205,217,213,227,166,72,10,190,176,137,166,112,21,60,-60,2,5,150,32,237,221,228,40,51,75,64,118,145,26,85,69,5,222,110,-168,23,230,65,211,126,153,48,24,148,56,255,50,169,226,122,231,236,186,119,-248,143,86,105,90,73,54,217,130,117,231,170,114,7,9,77,92,154,28,182,-4,13,114,104,106,1,193,100,154,195,12,243,154,83,81,117,151,112,201,157,-169,163,0,43,36,182,96,164,212,157,133,74,34,22,99,31,138,213,28,130,-213,251,27,229,160,127,181,90,128,134,184,29,206,162,87,83,193,149,162,197,-60,50,227,75,177,65,112,136,153,76,218,94,131,182,253,79,127,180,204,105,-216,210,75,225,185,65,116,173,36,101,54,21,100,52,99,23,140,206,172,48,-109,130,52,241,220,18,96,150,70,161,191,53,191,32,234,139,20,169,159,32,-199,186,43,5,9,30,142,28,194,132,237,125,126,82,179,73,199,213,153,206,-225,51,138,117,255,45,133,95,33,175,225,112,255,89,213,176,109,5,209,164,-89,97,77,28,40,255,25,4,41,254,232,102,61,17,96,148,10,119,187,18,-32,143,245,58,58,136,2,168,146,4,55,239,117,29,164,241,119,99,84,202,-91,192,62,169,155,3,43,39,126,105,143,71,182,60,51,244,139,37,65,49,-108,34,46,184,174,218,133,172,243,50,95,126,137,176,240,135,231,97,6,105,-138,191,212,253,216,46,127,169,7,237,139,150,22,119,254,145,198,155,24,64,-229,9,144,165,88,142,89,96,149,215,216,143,48,132,63,234,54,29,144,231,-14,31,194,85,109,185,102,217,175,42,54,3,186,56,213,245,148,167,21,66,-73,81,94,228,29,34,129,243,118,235,6,237,253,246,61,182,93,99,151,18,-254,32,208,212,49,224,108,184,255,129,53,159,146,98,89,17,174,201,117,160,-14,148,136,123,71,123,108,205,184,201,75,30,232,2,169,92,219,28,5,147,-113,89,246,119,132,11,42,183,144,89,58,201,21,205,241,5,250,165,3,12,-74,129,99,114,76,215,238,178,69,242,195,1,99,154,164,129,47,187,52,107,-56,148,92,80,128,57,238,62,57,138,228,118,147,52,82,185,156,92,189,81,-187,231,149,22,52,150,91,145,122,149,72,8,14,107,253,5,140,33,42,127,-100,58,204,198,6,96,143,88,3,220,203,108,221,44,116,72,135,194,84,151,-199,152,170,17,168,117,244,17,122,114,119,221,44,73,152,33,201,197,76,107,-238,110,232,79,217,144,148,214,252,251,106,33,213,172,75,134,209,162,251,187,-53,187,5,63,244,108,57,201,107,49,36,139,62,93,2,5,43,53,232,20,-202,152,194,190,82,87,169,205,143,10,41,84,217,201,40,73,62,171,243,157,-200,121,240,183,175,4,180,98,166,191,218,101,168,161,126,204,0,6,211,218,-239,44,185,205,137,226,231,28,99,100,150,164,83,222,3,142,21,77,23,24,-178,9,105,43,2,1,202,41,155,156,188,74,106,218,98,186,212,255,157,235,-47,121,220,71,124,113,215,171,194,62,92,213,229,188,192,83,173,152,74,65,-17,136,205,251,0,40,246,4,184,102,145,76,222,41,43,85,242,67,93,141,-104,103,5,74,173,133,9,138,33,65,155,196,20,139,193,205,178,206,12,100,-220,20,174,166,7,248,68,180,180,89,61,78,166,33,242,253,150,62,243,27,-81,234,198,21,223,168,143,224,113,26,68,139,185,227,184,180,101,240,186,65,-14,0,9,138,122,153,184,18,16,31,12,140,238,237,253,120,54,194,64,172,-227,186,35,144,79,125,222,226,216,125,161,151,100,16,1,204,98,19,177,189,-64,181,85,237,164,177,183,100,41,64,12,126,130,3,180,129,93,245,95,201,-29,252,249,170,108,138,87,225,214,135,229,133,128,26,31,179,124,139,225,139,-229,164,178,177,156,158,236,37,239,122,128,140,68,40,120,139,13,212,102,59,-241,22,179,58,142,169,164,233,46,101,50,224,231,255,234,248,73,74,102,166,-249,140,131,241,72,88,174,243,132,115,163,232,106,83,166,186,135,159,81,60,-153,32,211,134,19,243,102,63,42,167,16,41,194,56,32,194,233,139,1,35,-45,188,150,76,137,38,55,48,123,158,156,171,126,63,61,164,213,223,165,11,-116,209,226,240,160,5,209,95,216,165,126,225,242,251,144,182,52,145,162,181,-253,176,19,108,55,61,122,50,54,183,63,193,206,79,212,9,192,231,201,229,-118,197,151,140,26,39,217,248,44,179,200,143,166,219,123,70,181,212,232,50,-17,143,215,137,29,156,114,170,116,206,245,142,69,30,182,221,6,36,158,84,-41,41,148,52,227,173,233,45,19,231,2,127,39,42,12,224,79,228,210,30,-254,186,215,92,129,211,95,154,146,162,180,157,25,192,82,185,43,189,129,61,-33,136,51,165,31,195,68,62,122,90,241,140,91,246,247,45,19,126,66,73,-147,111,249,221,218,36,92,98,213,254,78,96,164,94,231,48,255,114,216,141,-64,50,47,244,178,33,174,88,12,30,59,113,239,182,1,162,6,126,136,210,-41,204,94,138,192,7,167,96,186,93,140,215,215,196,111,182,193,14,13,11,-147,27,160,69,153,173,87,48,190,244,49,161,79,150,196,133,130,214,42,137,-85,198,140,194,13,90,28,3,137,171,124,227,136,134,99,79,124,5,233,61,-42,253,20,128,102,18,76,18,138,103,11,94,248,1,28,203,170,153,152,37,-71,110,250,126,70,85,22,234,16,186,241,251,87,218,180,165,27,107,86,210,-26,205,199,246,83,144,165,197,71,59,165,154,206,221,162,249,239,252,235,51,-50,179,82,67,152,41,168,188,249,44,130,62,38,145,10,96,51,126,148,144,-108,245,146,174,125,198,80,227,64,26,174,73,200,56,74,44,39,218,120,64,-128,49,149,192,166,236,33,179,191,54,29,203,166,99,8,130,31,210,225,50,-59,0,31,200,185,3,6,148,41,94,221,94,235,49,169,93,89,112,17,166,-206,255,83,58,205,181,183,253,121,251,246,192,232,63,242,143,103,172,183,16,-119,154,89,151,201,18,149,31,67,110,5,225,45,162,35,243,223,115,180,93,-6,109,47,48,185,21,189,109,117,121,150,172,208,46,45,255,165,87,17,165,-149,106,147,97,115,93,188,161,131,202,26,25,237,170,60,135,13,26,166,101,-228,104,21,48,29,237,192,173,188,40,240,250,46,234,26,229,142,236,144,200,-3,17,30,6,164,230,102,168,114,48,24,120,77,147,206,21,149,171,74,246,-222,242,92,245,56,226,139,177,210,47,10,147,101,96,154,86,30,252,24,93,-178,199,62,110,240,26,198,216,99,101,203,157,144,33,187,210,123,52,249,188,-181,220,108,58,160,156,243,85,196,161,55,133,75,230,174,212,52,19,187,55,-47,207,179,26,92,153,178,204,177,33,243,172,226,127,104,113,54,193,90,138,-16,248,1,13,239,36,43,79,54,115,70,51,52,107,21,150,191,217,187,227,-49,23,55,119,134,94,58,250,82,111,63,212,174,239,10,71,118,104,68,174,-162,14,188,107,255,27,4,93,144,193,223,91,115,57,147,56,1,10,208,156,-24,177,149,122,140,249,60,47,74,19,245,103,213,14,94,19,246,202,217,212,-151,213,176,250,46,13,5,243,183,223,253,158,252,104,42,128,117,138,136,198,-102,236,25,179,161,104,142,124,173,34,212,129,56,68,142,15,169,81,216,157,-228,63,58,118,68,17,202,165,31,7,6,41,120,22,113,16,151,45,36,216,-81,66,104,31,148,235,225,200,158,52,78,94,10,50,31,59,44,121,57,154,-233,128,153,64,122,10,111,52,60,189,161,233,244,240,162,243,214,242,220,175,-35,32,156,248,148,30,175,185,153,179,86,167,112,212,212,97,26,171,81,60,-42,40,208,121,241,198,171,46,87,41,242,35,67,243,133,8,203,92,130,141,-254,10,223,44,35,139,219,82,197,238,37,158,205,89,112,94,153,179,187,185,-169,129,99,78,198,199,157,115,84,131,167,59,140,233,16,64,165,105,30,19,-116,164,82,25,213,107,7,253,238,119,17,75,132,134,165,140,129,31,192,221,-11,196,196,184,214,210,118,165,151,199,221,23,123,49,12,192,186,127,103,6,-64,146,42,2,1,5,203,128,177,238,151,145,81,251,209,182,202,230,40,141,-50,251,217,107,55,84,135,14,241,16,129,223,195,65,158,47,92,199,6,245,-101,8,187,252,140,178,179,142,254,175,174,243,160,182,84,40,224,213,86,236,-85,0,94,97,165,112,78,36,161,54,230,0,47,62,122,245,77,171,24,198,-4,227,215,253,135,247,12,202,190,51,62,44,187,106,99,18,88,8,93,153,-165,167,126,56,120,104,238,131,148,69,71,247,110,194,62,74,205,198,249,42,-135,23,144,218,93,96,11,22,22,250,162,169,43,121,80,17,198,183,179,101,-247,65,184,38,40,198,165,40,162,181,151,87,152,244,75,87,87,22,76,201,-50,17,7,111,102,56,109,43,219,18,101,231,164,170,122,83,112,217,166,106,-80,198,65,166,159,243,181,75,167,111,91,107,161,160,149,235,57,227,179,45,-104,29,220,243,85,96,100,144,114,68,232,92,219,210,240,33,70,187,242,233,-37,5,23,7,18,63,81,58,14,195,6,186,103,169,173,76,50,195,69,23,-227,203,181,182,141,151,135,154,197,82,251,214,183,192,206,253,182,102,66,69,-98,224,224,202,88,105,233,152,153,55,194,98,109,131,36,240,249,168,99,165,-48,145,150,215,56,179,150,113,65,192,63,28,203,198,156,32,96,11,16,95,-252,98,167,54,64,104,93,159,137,164,10,48,33,76,17,122,20,131,63,212,-130,60,167,113,76,193,8,86,156,131,83,237,144,60,84,201,193,102,157,163,-132,206,198,199,54,249,90,3,138,46,34,144,94,109,153,173,105,43,147,49,-114,202,11,25,22,232,138,238,132,112,142,30,203,253,41,255,132,105,163,61,-214,13,174,125,118,58,119,139,27,231,103,166,232,120,11,238,113,166,182,163,-164,160,135,179,171,176,72,220,126,151,246,14,151,221,73,114,15,99,141,150,-61,222,129,203,6,242,77,179,92,196,204,148,202,92,37,52,79,73,5,48,-148,26,151,36,69,212,58,48,34,150,147,73,70,189,176,202,37,3,146,109,-1,53,55,149,64,15,21,249,95,9,230,72,10,120,91,195,114,18,100,220,-122,187,50,126,98,215,2,71,74,17,200,5,91,237,17,135,1,0,251,13,-243,36,154,33,163,216,50,68,61,1,158,81,124,167,61,238,103,234,64,13,-172,198,182,48,22,235,134,123,143,250,235,20,72,183,139,87,210,33,107,96,-247,193,241,130,207,206,135,145,112,185,250,193,37,230,210,195,137,141,208,112,-3,62,5,12,195,100,157,48,115,90,82,58,71,18,173,171,71,103,208,226,-123,33,118,198,247,7,68,24,125,28,174,250,170,222,193,121,122,179,135,135,-148,26,149,44,6,55,222,92,34,163,154,197,164,67,101,44,198,227,233,169,-149,178,219,17,25,225,133,222,240,90,203,48,162,248,220,30,205,99,39,100,-31,137,143,21,71,219,70,72,173,2,181,35,107,207,25,29,57,38,78,26,-104,137,74,52,142,207,120,197,245,80,160,28,18,34,183,67,53,252,242,213,-191,150,178,182,189,93,227,219,246,153,245,123,193,241,250,124,52,202,56,133,-48,87,148,22,127,139,124,218,235,71,30,221,154,34,213,207,148,234,195,112,-245,98,33,98,189,164,239,86,69,242,224,87,124,50,230,75,30,148,140,87,-8,223,60,219,230,28,213,185,217,33,153,44,85,180,38,105,220,209,141,228,-249,49,189,157,73,221,201,237,1,141,175,219,189,165,250,117,127,65,107,47,-161,201,111,28,44,219,230,51,190,160,58,148,173,244,152,224,233,211,190,181,-99,37,117,41,117,154,4,70,7,113,40,145,226,81,114,38,32,181,153,202,-154,70,246,14,160,160,199,249,190,148,202,61,104,158,119,242,195,21,93,18,-161,13,210,112,31,233,0,219,75,219,18,203,222,155,73,108,137,219,71,206,-142,169,223,21,217,28,1,77,139,193,101,46,53,0,31,61,35,152,206,151,-184,36,152,67,192,126,86,221,140,71,203,73,229,51,21,181,80,54,176,144,-218,62,76,180,233,32,219,153,22,22,56,82,179,199,241,187,203,249,255,139,-12,176,113,199,112,111,41,211,126,3,130,127,164,85,20,186,68,95,32,96,-4,204,66,99,28,130,69,3,209,19,196,60,26,212,111,224,186,13,172,21,-13,185,224,231,109,74,187,0,163,65,240,154,89,125,245,148,112,116,49,51,-54,146,220,230,214,195,147,237,239,20,126,79,85,244,143,27,217,22,239,101,-88,61,177,170,51,53,100,105,92,226,207,194,13,76,27,30,85,157,210,244,-69,233,107,178,131,184,254,4,157,202,125,79,239,158,88,206,125,71,209,152,-111,213,103,39,206,233,171,176,22,94,178,121,70,183,25,49,212,11,150,121,-101,127,30,160,134,1,136,134,214,2,128,161,194,167,82,255,70,64,186,151,-58,1,50,77,11,118,1,32,23,227,26,202,123,122,44,245,115,236,199,74,-38,59,39,58,40,81,247,252,11,112,36,214,139,145,173,149,208,81,205,57,-81,73,56,136,131,29,28,50,167,60,134,242,20,216,151,72,250,188,196,186,-42,240,215,129,98,53,133,176,38,41,224,17,74,149,228,245,53,38,172,146,-37,23,85,81,81,35,218,87,186,156,215,85,113,59,74,63,34,186,224,250,-20,66,201,25,200,163,34,55,50,6,86,228,226,245,213,255,40,87,212,245,-134,49,57,5,199,102,117,171,212,63,112,246,168,109,219,107,57,87,123,95,-74,212,22,181,74,227,150,47,26,127,124,254,206,236,45,149,31,27,174,85,-93,48,137,71,194,118,192,169,0,183,47,238,26,47,233,217,217,10,136,54,-187,188,69,242,95,34,20,10,195,135,237,24,131,154,60,68,255,194,74,25,-161,12,51,58,111,242,59,193,186,244,34,166,85,40,207,39,26,18,191,205,-34,44,80,102,242,170,85,38,103,146,48,18,136,148,21,185,107,60,19,34,-167,214,69,252,219,185,69,114,88,246,69,37,241,152,74,206,2,137,201,8,-182,168,14,246,181,239,187,106,4,118,251,24,28,84,117,2,208,120,13,83,-109,126,88,184,139,175,241,125,44,84,139,108,153,123,49,255,194,86,149,153,-103,211,92,41,111,17,194,164,204,30,28,136,31,105,244,91,29,77,15,199,-19,192,161,101,121,173,136,94,115,171,146,63,157,126,118,107,27,157,213,71,-250,112,31,218,4,220,24,254,21,114,143,103,35,37,103,188,146,38,231,178,-53,175,88,161,60,153,11,239,131,192,135,185,185,92,18,227,37,105,34,150,-213,140,24,10,188,215,26,133,111,246,67,40,114,201,6,224,238,204,4,236,-47,182,50,1,36,101,219,61,241,157,46,110,104,105,70,169,21,203,44,233,-200,89,38,189,74,227,239,240,104,255,32,254,130,88,177,150,137,234,218,164,-250,153,62,34,81,78,53,162,181,23,39,78,79,214,169,128,244,209,165,239,-152,139,48,232,116,110,253,56,196,201,7,37,124,15,89,146,136,233,224,43,-254,149,48,213,144,217,11,251,206,22,139,202,91,5,15,97,47,66,131,71,-143,194,224,164,161,109,176,202,43,128,153,140,242,31,13,159,107,66,3,36,-132,32,88,193,55,79,202,73,39,173,5,11,165,29,170,37,158,235,200,168,-206,205,97,11,75,183,77,40,77,45,5,125,58,195,154,234,37,238,59,79,-225,148,156,74,163,138,100,153,97,145,194,236,229,136,23,39,93,87,64,79,-52,114,121,206,244,216,60,157,25,223,42,33,89,218,173,55,162,38,87,215,-85,36,42,222,17,64,46,5,100,102,226,217,21,56,179,226,24,26,206,231,-209,198,47,45,249,168,121,179,38,39,40,229,126,93,249,239,25,5,98,76,-63,77,216,40,2,194,105,247,216,119,186,36,90,3,219,202,109,88,146,104,-140,4,172,154,93,238,49,150,96,147,241,247,195,108,187,184,144,24,169,59,-245,1,112,251,54,215,171,145,73,3,207,184,58,27,121,0,83,112,82,6,-238,21,17,43,212,140,234,140,4,228,5,18,156,232,92,17,64,97,237,148,-150,90,114,30,237,226,0,168,203,42,68,204,236,171,144,253,243,110,75,182,-47,249,204,119,191,99,221,221,160,146,173,73,212,59,63,100,207,136,9,13,-113,156,113,165,134,215,233,33,189,167,168,50,134,220,59,222,188,63,226,69,-156,87,235,98,59,120,51,209,193,213,90,97,181,145,162,73,121,15,7,254,-99,43,95,230,204,247,176,104,160,243,73,42,98,15,225,32,147,118,250,101,-87,174,11,171,225,240,156,213,74,3,247,152,219,236,236,152,159,236,162,172,-51,178,193,27,116,135,64,242,237,73,93,154,143,223,118,171,75,213,29,133,-9,87,199,86,51,252,157,97,104,47,27,48,159,236,22,127,172,125,59,87,-255,140,141,119,35,200,238,250,30,152,187,137,69,101,99,129,129,207,159,93,-206,229,51,151,10,217,29,208,111,2,121,192,195,9,76,21,185,67,107,18,-133,114,60,33,89,229,0,255,252,141,79,135,87,242,193,75,137,216,101,45,-197,121,18,200,152,105,104,220,153,139,138,58,59,34,79,35,146,66,109,237,-211,6,235,219,228,127,252,71,26,140,52,179,174,163,181,58,144,249,239,138,-119,44,158,137,245,197,55,60,19,231,182,210,117,113,143,233,80,121,67,149,-145,247,251,50,100,172,139,213,69,226,194,44,30,48,93,44,207,129,91,169,-14,75,36,141,101,15,216,35,139,85,144,170,209,97,40,70,221,211,41,71,-92,6,92,162,248,149,198,107,195,20,195,224,1,147,7,68,219,32,82,223,-237,86,205,208,134,174,75,140,138,4,104,22,61,64,129,151,0,168,244,86,-141,175,157,202,187,153,36,69,35,28,17,211,155,92,181,56,50,176,56,238,-82,5,194,75,0,67,165,137,86,204,176,15,93,41,53,210,171,104,159,196,-37,146,57,225,69,175,129,209,157,84,27,119,6,103,157,74,186,57,221,21,-176,235,64,190,128,135,99,92,5,16,219,72,47,162,161,211,228,87,105,32,-19,103,16,15,254,3,129,54,24,148,81,68,56,112,227,98,178,98,137,149,-251,173,228,183,95,255,115,169,4,216,150,111,132,43,132,167,160,245,228,75,-202,8,83,195,169,18,251,101,214,49,61,128,2,195,195,225,146,251,25,19,-75,134,226,118,209,252,238,110,101,21,249,74,152,194,165,7,117,67,64,21,-117,83,146,26,202,174,239,175,7,183,225,111,12,73,235,82,1,220,117,217,-165,233,254,60,52,220,60,20,37,231,195,155,150,55,45,5,17,234,236,178,-217,178,28,250,150,116,200,247,15,183,229,220,227,27,54,232,104,76,9,103,-10,191,75,48,144,121,214,77,154,74,7,233,184,225,96,158,134,244,1,219,-231,14,90,81,244,90,67,206,63,128,123,97,154,98,246,227,197,235,17,111,-122,94,186,251,22,57,132,209,94,228,56,2,133,238,61,141,6,112,38,209,-99,162,19,43,30,253,100,22,125,191,8,6,134,5,74,242,187,192,232,39,-175,130,42,72,204,54,67,150,142,25,219,72,236,194,61,164,224,190,189,113,-149,60,17,92,204,34,47,9,136,146,173,62,36,229,101,48,161,144,81,239,-118,39,5,130,242,113,112,142,128,72,237,81,239,38,151,211,73,26,255,173,-168,212,210,213,83,156,155,35,241,246,114,117,248,58,100,11,39,163,74,208,-10,138,23,155,238,62,15,252,42,138,196,183,151,35,180,179,94,91,39,148,-66,134,6,144,97,69,185,22,167,82,116,74,23,208,102,72,54,242,17,233,-61,248,170,30,0,44,62,229,181,28,93,21,155,93,247,224,63,254,89,250,-108,159,202,99,126,0,67,230,60,180,226,112,253,165,8,224,216,107,236,71,-129,127,80,152,44,41,54,27,197,171,8,187,203,90,42,3,185,35,204,184,-77,241,254,184,197,193,17,133,22,2,234,147,51,106,107,102,222,113,138,244,-22,225,172,131,220,211,41,10,134,237,147,116,204,55,152,130,77,150,191,11,-33,121,26,165,203,55,243,204,198,13,142,17,196,0,196,221,69,147,61,217,-242,251,243,189,156,129,222,153,214,110,63,200,142,13,147,19,72,135,254,192,-86,61,43,203,32,38,187,177,63,17,151,42,46,148,232,0,58,214,252,188,-66,119,246,50,87,24,65,152,99,244,240,36,100,5,48,0,55,219,130,42,-93,138,149,90,17,94,122,85,132,210,246,29,208,177,233,122,39,208,19,56,-220,109,145,236,40,163,91,115,204,202,26,78,159,32,181,108,216,202,144,197,-155,239,20,121,51,235,68,200,245,197,97,86,233,89,223,139,179,107,217,99,-154,123,249,92,3,246,195,252,252,2,167,244,81,153,10,243,191,3,57,36,-178,51,12,231,144,151,67,97,246,160,146,184,150,26,9,40,70,84,220,135,-111,243,102,2,10,21,181,23,133,133,21,242,52,164,50,16,179,4,230,10,-153,116,160,197,159,101,1,73,22,16,175,240,237,27,224,107,197,248,11,17,-41,52,44,187,128,9,51,221,225,122,104,37,118,200,243,84,250,6,154,57,-13,101,139,254,119,49,234,166,73,86,122,139,128,27,253,122,113,219,111,76,-14,14,44,56,122,201,21,72,98,93,98,177,212,250,34,254,96,73,154,81,-200,215,104,73,145,156,201,51,40,129,165,113,200,57,119,160,139,152,233,69,-254,159,30,152,136,67,231,115,240,27,208,147,99,183,229,120,144,125,59,78,-238,223,243,101,37,171,213,31,10,17,153,11,247,115,154,110,104,224,128,116,-85,140,116,195,184,137,136,94,79,9,232,19,239,82,204,195,253,207,143,60,-172,173,151,2,188,219,58,59,222,153,90,148,198,156,105,110,5,61,201,245,-146,122,23,194,94,69,162,29,125,207,188,126,123,93,168,39,3,183,38,226,-246,229,108,66,152,26,29,231,214,227,77,178,121,204,201,89,207,114,105,206,-17,54,89,204,49,163,166,35,116,84,37,105,75,238,95,121,84,245,31,13,-234,149,216,223,111,222,108,115,195,46,171,232,186,60,189,240,152,138,82,150,-182,24,105,110,162,182,254,91,216,150,45,225,149,251,172,69,139,182,61,135,-140,192,140,96,152,130,79,90,252,242,191,70,91,45,103,32,42,209,91,81,-19,202,91,40,93,126,189,92,188,214,183,244,255,146,199,49,157,77,79,106,-159,132,61,51,190,190,35,84,189,153,249,92,219,102,114,184,34,72,125,135,-247,169,255,226,150,159,178,191,19,222,87,91,24,62,37,91,37,34,21,108,-165,197,34,209,78,91,97,232,246,227,232,238,119,54,148,7,63,246,94,117,-19,238,176,130,188,97,180,86,83,194,79,45,195,255,129,82,196,31,192,235,-152,232,1,57,119,25,115,241,122,229,30,11,180,149,192,198,181,178,0,121,-93,120,199,26,222,11,117,216,222,133,206,179,121,42,208,50,150,42,221,4,-183,243,49,4,59,253,150,193,58,117,151,77,155,116,11,0,0,37,80,91,-176,253,51,65,155,189,179,226,231,116,112,62,221,10,6,117,3,63,0,185,-255,210,15,237,149,222,124,217,59,193,197,189,248,6,124,176,94,237,137,142,-79,241,237,63,159,119,45,144,175,30,7,27,98,187,183,203,109,255,29,202,-77,9,189,135,90,237,137,106,106,239,228,108,147,33,110,103,91,182,6,187,-252,118,14,63,208,49,46,253,245,195,134,245,1,175,177,129,227,29,166,116,-209,245,68,179,217,218,36,42,113,61,244,111,6,111,206,95,103,9,211,34,-175,227,189,253,24,170,6,138,168,245,171,209,71,216,187,235,245,224,200,83,-26,219,80,210,212,81,120,215,165,111,173,110,8,78,162,0,120,90,70,72,-36,20,68,177,158,105,164,194,111,90,55,171,119,149,16,98,102,31,206,59,-254,187,179,176,112,224,10,165,80,177,37,207,217,99,16,136,187,97,58,3,-96,112,135,139,139,180,131,79,123,53,42,47,149,156,86,16,127,195,58,214,-36,209,37,131,38,110,201,164,190,14,186,107,114,244,6,88,41,223,86,232,-188,250,153,61,162,155,220,229,142,145,243,212,56,59,202,154,154,97,159,115,-106,89,125,99,215,190,97,249,253,78,149,109,76,234,85,188,220,136,143,214,-16,58,136,76,17,162,36,51,65,77,239,149,240,102,120,235,145,30,4,8,-232,26,50,59,60,164,99,34,85,226,236,252,232,101,156,133,223,162,253,199,-140,132,130,220,192,123,247,207,217,34,71,112,158,54,36,150,63,2,218,218,-47,83,142,89,158,215,74,152,107,142,175,175,76,200,193,150,210,121,90,89,-75,34,80,179,197,172,20,55,147,93,114,196,86,11,161,239,97,65,104,229,-203,89,19,204,178,44,42,163,230,85,62,34,178,133,33,26,21,193,224,16,-119,210,231,185,69,253,197,228,220,81,146,96,83,79,210,95,164,60,158,174,-43,103,74,255,252,225,17,83,230,240,72,133,130,253,122,196,217,112,214,212,-8,197,239,79,133,152,42,166,204,60,196,48,192,235,210,97,45,232,6,213,-193,216,168,194,124,84,5,158,123,59,190,99,16,41,40,156,117,137,159,154,-155,222,199,32,20,230,51,82,146,167,28,167,101,43,217,222,131,67,79,119,-147,60,127,44,19,36,19,157,32,137,17,104,209,194,169,89,136,104,61,154,-206,154,95,62,195,69,230,107,105,151,215,18,122,46,34,145,116,75,32,253,-32,231,142,28,137,8,197,33,172,48,116,165,145,9,156,145,30,158,198,0,-249,26,249,236,112,224,206,4,164,126,65,80,6,157,148,223,145,104,241,193,-46,79,13,24,151,19,63,65,141,240,194,102,29,92,181,58,254,221,102,44,-224,124,191,199,125,229,108,42,182,196,14,109,193,184,168,45,192,239,243,237,-224,159,160,22,248,60,147,137,186,160,62,96,96,17,83,158,150,91,103,248,-234,194,206,65,38,209,112,240,244,14,104,217,121,8,96,194,116,176,149,105,-179,249,180,77,146,165,81,173,50,174,112,245,199,235,231,99,87,44,156,107,-69,235,243,70,7,136,124,40,116,137,198,89,152,34,67,155,231,118,160,146,-32,107,210,74,213,43,238,9,167,211,20,123,68,239,207,130,206,125,182,15,-116,252,8,32,183,103,146,253,58,105,193,136,81,196,94,127,46,163,121,131,-63,52,175,177,217,40,125,231,103,155,204,93,99,3,156,189,71,48,159,116,-44,125,232,132,111,215,185,166,235,73,52,28,148,54,147,4,120,177,174,92,-218,11,223,187,50,211,8,82,58,214,244,93,183,127,22,60,151,61,149,152,-151,53,68,175,75,61,87,107,202,214,89,168,100,177,251,79,67,185,10,7,-87,32,2,38,161,215,244,231,170,29,216,146,27,101,120,228,251,44,213,158,-83,255,215,215,242,134,227,235,1,244,45,190,127,39,126,138,242,104,74,129,-200,181,149,245,8,112,135,157,42,20,33,170,217,138,49,27,255,99,119,233,-44,251,243,6,196,226,59,1,164,187,213,175,1,118,29,133,26,138,134,3,-254,29,148,113,70,139,31,253,195,91,104,135,201,89,23,201,164,39,158,39,-33,65,187,165,10,79,90,251,154,190,166,229,192,249,213,35,35,250,159,113,-38,207,193,208,144,55,5,96,60,190,33,220,66,206,221,54,11,188,52,174,-40,142,99,71,249,18,5,7,117,126,164,231,234,73,154,26,121,206,183,133,-57,129,239,195,40,140,145,17,51,178,251,132,177,49,143,143,46,65,28,76,-249,74,181,147,175,119,24,38,37,148,57,85,196,18,61,227,255,249,217,92,-13,248,225,125,4,91,157,242,159,216,155,70,199,198,14,196,48,21,134,14,-217,249,193,50,189,212,208,217,56,95,33,120,165,184,156,99,220,130,255,117,-249,113,36,111,231,231,148,248,241,0,241,21,66,18,13,26,97,26,74,214,-75,48,247,183,215,111,108,116,43,104,20,121,72,46,235,151,154,243,71,129,-189,246,184,98,50,221,174,12,191,77,115,126,193,151,1,80,115,86,59,102,-248,50,134,56,90,21,212,234,73,129,60,71,166,238,121,20,189,50,57,193,-25,223,189,212,141,176,29,130,96,164,17,36,162,24,77,136,6,133,97,130,-125,192,57,4,173,232,13,119,66,157,83,147,133,2,20,217,92,100,233,64,-166,211,77,0,131,226,94,250,244,236,241,8,10,241,144,202,91,86,107,245,-99,235,184,66,93,168,116,113,92,168,119,93,185,204,106,106,133,198,228,224,-30,77,169,107,198,116,222,6,46,170,36,221,13,6,147,212,24,48,207,184,-2,148,81,30,117,146,7,84,8,214,242,76,173,116,255,87,94,206,160,64,-124,120,168,236,135,34,165,59,102,146,239,148,140,243,165,116,99,136,246,190,-149,142,173,172,200,65,0,141,127,134,110,27,3,17,168,244,51,253,209,41,-80,237,229,43,123,236,249,21,98,33,56,219,192,50,230,102,88,234,148,170,-204,81,225,64,246,54,54,36,192,123,189,203,202,76,151,97,131,246,168,172,-83,125,91,46,185,71,71,147,27,77,67,209,143,89,96,234,255,191,248,6,-89,123,191,164,232,129,74,34,201,247,159,255,181,127,51,113,6,98,45,220,-78,205,107,8,31,13,65,17,198,41,51,126,251,5,197,200,205,61,39,164,-128,196,216,73,76,207,41,39,75,252,61,127,93,27,145,90,25,128,197,238,-44,165,39,24,219,213,19,5,114,53,143,161,78,192,145,77,49,126,128,193,-176,28,98,42,1,17,171,189,37,82,183,8,159,246,29,90,126,228,212,195,-37,146,128,31,249,50,225,245,242,226,157,20,89,94,135,158,191,127,35,170,-112,235,28,90,208,220,49,196,127,236,224,242,180,3,226,87,255,129,236,90,-223,150,171,241,16,89,153,178,13,33,46,149,131,39,195,88,34,131,117,204,-125,136,137,5,121,76,20,37,194,159,82,243,212,74,21,32,81,15,54,239,-44,142,114,245,204,50,188,90,37,9,143,249,254,116,3,233,37,166,7,79,-37,53,204,166,11,139,25,131,24,64,5,26,19,111,135,182,12,99,135,219,-73,120,35,98,198,15,77,80,97,18,127,44,146,166,124,27,13,209,180,145,-163,42,118,232,207,125,215,201,64,33,28,247,53,82,24,148,173,193,172,222,-238,205,28,145,101,183,29,71,65,105,112,50,126,35,36,28,72,156,134,92,-39,139,130,25,62,63,173,80,174,56,234,212,99,115,24,173,108,95,241,23,-164,70,150,34,62,58,226,137,158,159,187,240,39,180,177,56,145,190,59,36,-29,223,11,23,210,208,135,24,248,83,239,208,127,152,56,192,156,220,221,108,-240,189,24,75,106,25,155,253,74,83,84,112,205,217,115,192,5,96,83,11,-239,33,84,115,59,24,0,86,220,147,232,162,62,15,91,95,105,33,48,24,-148,161,128,57,20,61,29,1,94,125,75,46,177,100,153,36,231,80,85,96,-235,111,69,81,96,126,168,146,38,247,178,42,2,195,92,213,146,106,56,103,-129,252,64,217,20,159,222,123,81,253,185,209,133,28,144,125,209,133,111,113,-30,66,21,14,232,249,36,227,35,15,124,232,119,217,54,197,192,27,235,186,-182,152,31,225,168,123,48,253,131,165,134,4,214,14,203,207,213,64,107,30,-118,121,35,231,198,205,103,43,37,30,205,69,167,140,62,197,7,81,146,249,-52,83,235,16,183,212,217,245,196,34,255,48,208,39,167,241,79,138,179,133,-117,67,148,51,169,27,80,144,180,64,180,12,10,138,228,10,29,141,113,182,-37,219,142,30,212,217,82,93,137,207,96,117,119,15,8,43,24,151,65,127,-149,121,110,217,18,55,121,182,242,9,182,0,206,178,242,27,187,62,90,148,-130,131,137,133,18,222,71,67,211,134,255,3,116,4,28,100,133,143,110,94,-157,72,50,83,28,248,230,231,252,132,60,218,113,6,72,200,16,193,223,3,-215,177,16,46,37,9,207,238,246,166,121,171,82,196,176,144,236,76,231,128,-82,126,176,47,222,206,104,123,36,209,5,9,81,248,78,110,226,65,38,175,-241,130,186,166,173,74,242,178,205,148,220,130,166,247,143,116,237,221,227,22,-86,31,155,168,34,180,244,93,200,250,0,97,38,161,121,246,203,22,3,192,-141,43,82,58,25,172,23,237,164,88,67,169,221,121,21,57,137,62,79,49,-164,13,7,16,123,235,248,86,105,254,3,203,57,95,76,24,126,75,180,20,-34,8,63,119,195,144,235,102,167,180,178,155,141,249,133,254,62,48,84,176,-12,208,84,201,192,255,157,171,245,95,167,92,252,142,226,233,146,232,81,255,-158,8,78,129,213,82,154,178,22,34,78,106,127,162,94,207,193,98,112,85,-122,12,234,119,41,185,244,41,123,217,190,193,52,51,168,82,137,53,148,223,-80,202,255,120,212,51,193,206,247,11,178,179,32,30,2,154,139,237,205,68,-190,67,142,91,74,93,250,147,29,226,0,214,161,23,105,219,236,225,105,13,-164,124,251,43,120,58,230,190,51,237,54,78,35,48,130,99,149,109,114,150,-94,93,27,138,12,225,86,123,15,83,151,54,53,99,83,82,171,83,225,208,-218,93,87,123,8,65,223,54,251,189,183,85,222,197,179,78,239,132,21,144,-8,95,5,253,85,208,245,63,28,12,190,115,242,34,139,20,169,28,177,104,-87,254,239,51,162,85,57,31,52,234,172,102,63,64,168,4,175,26,102,86,-167,4,197,85,213,201,162,250,147,186,191,241,81,97,9,196,185,199,241,84,-193,232,219,159,7,208,146,114,131,155,161,238,1,120,191,240,92,244,49,233,-75,217,64,37,51,57,154,224,77,242,236,214,92,133,176,203,145,80,186,182,-210,42,69,108,157,240,216,42,155,127,199,40,165,45,160,50,248,173,50,180,-214,138,151,150,38,211,83,252,42,35,38,69,83,235,132,149,62,165,28,152,-91,168,155,230,49,59,109,57,179,91,215,150,155,222,153,62,102,102,117,29,-118,44,72,40,221,178,237,28,159,233,8,61,195,216,96,53,224,222,73,174,-65,244,235,117,200,46,158,17,103,189,82,23,77,226,106,141,41,249,238,46,-195,103,66,80,72,165,63,43,34,98,195,147,37,84,198,148,30,90,144,249,-63,21,162,60,238,133,90,82,217,150,117,92,248,252,142,7,181,201,29,109,-184,149,197,85,186,175,38,140,213,125,172,236,172,239,168,60,19,228,159,99,-150,175,38,227,35,236,70,6,101,147,220,1,180,113,120,95,217,228,251,152,-23,171,7,124,203,147,67,3,212,61,55,88,79,58,243,89,94,246,43,61,-135,31,80,161,223,235,254,35,145,161,172,185,115,52,172,25,159,86,125,102,-184,252,253,212,39,26,231,111,99,246,248,239,154,183,143,119,37,66,30,127,-92,112,255,111,8,36,107,155,169,220,57,12,208,31,161,26,68,39,200,158,-158,222,183,241,220,137,132,156,67,24,213,214,168,145,155,195,128,156,140,194,-245,138,72,253,213,171,134,16,120,186,205,34,161,126,218,195,223,2,236,108,-228,252,131,122,125,186,218,86,162,28,49,139,152,189,146,246,22,233,53,163,-208,54,112,71,43,195,24,103,115,127,19,105,200,120,55,169,214,162,19,132,-101,126,169,18,239,51,245,15,180,240,218,253,243,226,118,43,57,155,243,72,-130,73,176,29,195,75,81,245,192,212,158,247,96,36,14,178,212,95,98,169,-170,251,246,225,184,40,118,163,210,226,131,221,39,243,233,181,234,190,168,149,-249,19,143,4,118,195,153,127,64,178,4,35,35,35,163,138,132,106,163,13,-13,230,147,227,155,24,228,12,201,48,176,217,145,6,162,244,153,139,186,188,-56,61,60,4,82,13,127,144,243,196,147,211,211,205,149,225,14,31,244,218,-173,56,14,221,24,213,196,247,140,56,52,149,136,77,37,202,91,88,110,126,-19,185,96,31,159,52,98,155,110,194,217,14,177,211,183,112,3,146,226,207,-188,83,216,128,35,156,33,152,114,155,20,141,159,67,19,95,15,51,120,189,-254,20,193,123,248,88,235,87,4,165,89,167,226,86,147,4,26,199,174,72,-231,6,35,119,219,140,52,87,213,56,199,182,70,104,182,54,49,169,228,168,-167,76,219,130,152,236,105,151,248,102,27,24,81,242,170,80,167,120,107,145,-17,35,89,64,45,138,20,189,133,248,76,145,8,69,79,102,180,117,165,80,-91,98,75,120,106,45,239,77,86,84,37,247,174,243,245,130,233,16,25,106,-137,194,241,127,133,139,31,203,35,180,28,208,131,206,83,101,194,117,46,56,-193,134,31,124,40,106,170,188,25,12,131,44,72,244,171,10,153,1,17,100,-32,149,115,67,120,154,56,29,198,118,114,3,113,29,30,5,175,241,7,38,-244,132,210,15,79,40,150,222,243,209,130,211,189,197,102,210,236,192,102,255,-70,235,34,92,71,15,186,230,203,187,31,109,131,162,185,242,8,21,49,248,-215,200,225,158,49,86,188,97,24,12,26,166,174,161,194,161,189,131,136,24,-198,54,125,76,30,171,88,24,1,220,189,253,45,9,86,105,50,212,28,50,-103,135,36,31,179,96,26,155,0,114,167,27,165,44,66,142,15,22,170,47,-140,247,77,63,52,106,206,42,176,255,254,112,155,11,188,16,198,123,230,62,-144,32,26,235,116,1,141,254,145,177,21,218,134,12,223,16,113,57,3,84,-214,194,0,13,150,203,211,95,117,14,243,231,50,14,77,44,42,109,182,137,-183,218,54,29,233,9,121,117,59,57,31,143,79,144,140,4,103,107,127,27,-98,232,161,203,240,67,255,67,25,183,127,227,36,180,55,15,137,141,46,170,-121,208,255,158,126,223,13,201,153,137,126,173,118,25,234,158,40,20,39,7,-194,82,242,223,220,100,93,204,243,182,8,184,136,119,3,184,168,210,63,107,-6,139,46,135,179,57,238,131,190,130,6,30,84,105,201,148,25,177,52,41,-176,192,42,20,50,33,14,252,95,170,102,223,167,176,153,179,78,247,70,201,-122,149,14,172,77,178,163,35,249,178,246,174,4,251,238,62,235,253,130,255,-226,141,243,227,109,227,11,62,144,80,149,162,35,106,103,137,135,82,50,139,-76,140,15,83,55,35,195,133,166,229,110,165,146,197,29,247,210,199,98,186,-106,226,144,66,117,14,84,138,225,73,191,239,111,37,63,112,74,145,91,245,-145,142,166,168,97,102,217,125,134,165,212,157,67,216,41,31,152,74,232,97,-22,179,41,155,116,4,72,37,255,181,16,193,154,29,123,171,28,89,146,156,-170,177,122,32,157,141,80,245,83,182,122,54,106,221,118,168,230,46,122,239,-122,122,68,209,20,21,68,170,158,142,178,242,74,3,88,193,37,206,171,209,-249,161,2,127,123,231,48,75,156,235,6,125,41,114,51,255,177,117,36,70,-245,25,248,239,248,40,124,61,113,193,53,156,67,96,234,104,46,35,214,184,-169,240,159,83,37,1,251,15,151,51,153,108,13,63,29,183,160,159,252,93,-15,37,79,23,17,74,150,139,61,75,82,185,247,106,64,129,199,25,73,171,-117,60,200,171,189,13,82,149,63,222,75,40,78,193,245,104,68,227,249,233,-96,58,119,69,188,29,159,241,206,32,51,5,174,211,241,233,165,119,131,120,-1,70,120,27,179,147,34,14,243,21,25,122,243,128,26,122,186,72,199,189,-48,37,206,81,213,139,182,163,62,190,61,235,62,240,33,127,184,57,183,96,-51,35,85,102,3,97,31,79,205,73,233,18,34,10,54,16,69,250,186,109,-69,40,99,178,215,113,203,213,127,104,236,199,245,229,168,0,14,115,155,146,-237,156,153,38,102,8,168,179,234,101,56,157,133,210,151,163,85,7,85,110,-179,160,55,63,45,41,137,199,31,176,105,226,238,67,101,217,146,92,10,151,-210,76,21,96,37,242,170,190,210,223,215,65,165,99,202,49,178,69,12,209,-52,43,22,22,175,14,70,12,16,100,140,44,9,85,26,206,67,172,195,234,-169,97,144,85,139,224,35,105,190,159,138,135,221,208,76,182,222,194,19,178,-76,38,170,55,107,96,248,168,137,125,198,222,120,124,176,3,42,77,16,199,-243,79,196,124,37,49,41,184,230,115,98,92,34,115,50,158,125,96,81,252,-34,43,241,155,134,232,237,122,135,218,181,45,243,85,85,104,98,218,135,153,-86,108,50,83,26,2,52,140,192,132,6,104,179,50,151,131,151,7,215,229,-252,20,131,213,246,242,241,173,19,207,138,165,100,77,67,222,142,48,32,49,-117,8,253,60,190,155,225,205,207,55,10,193,18,151,156,67,13,210,26,135,-41,102,139,40,255,20,189,117,53,172,75,76,61,69,153,229,43,131,224,111,-68,23,234,220,108,244,159,52,156,248,53,195,138,214,65,183,165,136,6,184,-234,89,164,130,46,190,110,139,47,170,187,149,146,33,26,247,26,3,135,126,-197,80,90,252,182,103,34,60,59,134,39,189,147,211,88,9,162,157,102,221,-243,64,71,183,26,18,9,101,142,120,130,60,7,18,110,37,48,102,89,79,-8,222,158,24,248,109,186,177,139,76,163,70,138,134,174,9,52,181,93,213,-61,170,2,198,69,125,111,114,60,76,248,121,176,50,98,180,188,46,92,49,-134,104,9,238,140,40,151,103,204,18,214,222,48,66,251,194,6,225,181,169,-58,55,220,235,253,215,169,208,13,194,85,43,223,111,0,67,118,9,249,142,-127,227,66,20,52,172,110,99,251,105,118,90,242,39,179,85,96,197,19,4,-66,92,168,0,193,4,55,250,87,198,222,164,46,210,196,89,74,113,125,170,-121,43,85,202,63,230,206,113,104,140,56,170,153,107,191,65,249,161,193,224,-208,19,50,121,185,171,58,240,0,125,24,68,220,172,41,64,150,213,62,183,-137,113,182,187,142,203,191,68,221,169,36,171,87,220,67,164,38,100,167,74,-253,24,211,5,19,79,85,30,169,99,76,135,10,44,35,23,247,142,227,36,-177,214,98,209,32,231,160,216,48,255,71,24,32,41,50,150,132,185,240,238,-84,124,244,29,236,185,159,179,40,29,168,233,142,140,4,41,31,49,201,130,-154,5,67,13,249,140,6,255,93,220,206,143,253,98,12,52,140,228,24,76,-255,142,71,216,171,111,143,64,159,200,94,22,133,155,167,14,49,95,4,148,-76,40,26,161,84,246,84,180,241,177,212,251,19,215,197,84,5,157,140,87,-138,230,105,132,249,139,218,119,155,153,160,109,25,117,254,54,13,24,203,135,-78,233,59,105,157,68,88,75,192,179,147,101,93,37,186,173,205,54,129,208,-231,225,59,57,69,229,87,61,141,118,51,218,162,86,208,30,51,76,111,241,-115,20,147,145,203,20,138,127,236,109,34,213,138,213,36,245,87,51,250,215,-251,242,29,6,22,85,136,51,249,243,229,97,61,198,27,23,176,69,27,159,-205,145,243,195,225,145,8,22,46,73,65,154,156,134,160,116,157,206,66,211,-140,14,200,115,207,120,84,251,53,145,249,56,141,147,42,223,189,68,159,251,-34,49,179,233,159,149,37,233,223,248,78,27,39,12,10,234,29,189,131,212,-91,208,37,8,67,191,35,115,80,27,214,103,214,195,120,145,194,128,51,180,-98,249,113,144,4,243,37,177,25,55,116,151,81,89,8,54,244,34,163,237,-17,18,56,160,132,10,213,191,138,130,251,51,83,225,94,179,114,206,41,236,-68,163,108,43,123,193,129,130,156,77,139,216,36,42,153,14,127,56,192,137,-137,120,31,34,31,41,187,105,240,38,104,57,196,216,86,89,230,139,234,40,-203,75,42,218,243,104,4,254,122,152,188,241,161,143,97,42,145,224,23,152,-214,30,73,52,34,198,216,3,220,144,165,97,97,202,210,53,210,35,75,159,-234,197,162,91,148,50,222,23,15,3,204,242,115,51,55,34,62,106,155,140,-80,149,193,97,55,138,0,200,71,252,123,56,72,156,11,208,236,52,115,57,-226,154,155,164,132,78,167,236,215,129,202,202,191,72,23,26,101,175,242,241,-14,88,111,140,69,96,179,76,11,238,114,171,105,38,16,27,32,116,175,105,-199,171,203,15,185,136,228,243,190,86,94,225,27,204,78,16,1,235,88,230,-218,145,181,83,148,250,46,188,6,13,36,200,84,68,104,200,33,127,86,195,-94,3,199,123,108,63,52,190,124,153,241,38,189,227,243,144,160,139,143,79,-196,200,14,22,179,91,172,132,20,222,238,193,164,150,168,61,143,174,34,104,-71,201,83,104,47,37,191,175,242,43,239,25,196,112,188,60,118,226,24,250,-10,219,228,207,163,112,225,172,110,101,119,248,188,67,79,50,71,247,227,122,-216,220,166,210,249,58,233,220,112,72,118,49,8,22,184,72,57,52,89,60,-36,157,192,98,165,9,80,131,163,79,18,118,196,165,171,15,42,242,180,88,-90,143,104,58,144,115,57,241,163,173,201,196,131,99,39,155,214,69,94,146,-69,112,158,100,0,190,241,53,29,155,139,102,35,147,169,95,89,153,199,16,-185,160,157,235,79,174,100,170,69,7,56,1,196,67,223,240,117,102,209,156,-156,30,60,57,18,204,44,166,183,185,2,116,148,219,17,38,21,166,95,60,-205,82,199,105,254,12,125,214,190,229,244,51,131,209,234,216,220,221,92,95,-114,21,213,10,171,212,238,200,43,9,196,81,191,45,255,240,75,175,224,74,-164,25,45,11,68,175,155,35,123,23,252,90,211,34,217,177,181,125,9,255,-119,59,248,0,35,175,83,103,115,97,162,144,253,13,43,17,235,202,182,139,-127,242,240,9,158,194,60,36,118,156,30,140,128,48,203,224,240,121,82,77,-245,248,137,136,70,142,200,102,149,38,239,6,255,58,82,65,29,123,118,234,-246,27,5,129,240,170,169,187,148,88,62,109,26,165,246,20,65,164,223,231,-154,155,52,17,152,153,110,246,79,187,43,212,44,6,47,233,251,206,60,90,-45,113,75,210,74,25,246,101,140,211,235,87,252,199,240,72,51,191,106,174,-136,13,225,218,74,11,91,55,97,106,138,239,66,45,117,103,207,159,52,65,-202,17,112,191,160,68,216,145,69,166,254,162,253,81,43,9,224,53,40,98,-195,57,42,3,34,64,84,73,252,15,169,245,174,178,155,94,61,221,127,147,-171,211,253,115,140,37,113,231,84,67,35,104,172,157,224,90,102,6,255,93,-234,78,177,180,198,175,163,117,238,11,203,243,206,43,112,181,159,144,152,30,-231,4,185,252,106,220,243,162,0,102,93,24,226,149,101,106,71,76,142,44,-50,240,223,111,55,71,7,143,136,77,152,8,209,206,23,0,88,32,188,81,-233,250,0,42,37,89,173,249,158,11,41,239,236,242,0,120,15,62,48,74,-33,6,159,22,102,189,134,97,192,103,20,202,1,54,253,163,0,122,58,73,-73,231,23,163,88,134,243,51,74,112,43,155,78,161,209,170,78,28,70,16,-217,162,187,170,164,31,254,10,237,182,19,5,230,132,4,223,218,58,206,85,-218,174,1,171,142,214,153,176,127,220,218,227,74,106,140,200,191,172,64,200,-246,122,246,157,64,175,251,128,152,137,137,82,237,4,75,128,80,84,42,127,-58,102,196,48,54,178,137,0,28,82,44,34,18,92,165,1,107,6,95,11,-23,236,81,15,132,129,70,58,158,83,83,103,211,87,255,189,32,43,96,180,-32,242,157,153,62,211,52,104,208,0,123,109,17,72,55,158,238,54,211,84,-140,80,136,51,206,86,206,217,232,112,237,80,244,140,208,210,173,12,206,185,-177,59,122,225,103,241,246,185,71,78,146,71,20,113,24,63,102,88,107,164,-74,223,91,137,222,125,4,163,22,114,111,13,78,238,176,21,66,7,99,19,-108,141,136,253,130,17,161,129,230,17,46,11,45,58,97,250,32,208,237,231,-76,255,84,204,223,245,125,67,141,99,206,50,108,108,217,215,121,221,116,121,-34,196,231,70,20,16,0,106,73,157,144,51,100,29,28,183,96,88,92,129,-203,220,242,111,227,125,108,189,202,27,233,182,223,236,242,233,145,213,82,134,-135,176,131,177,190,0,46,111,211,17,198,168,23,7,183,90,68,171,21,220,-221,28,77,124,102,218,157,195,46,59,210,203,176,207,48,173,141,35,173,80,-64,221,124,151,90,190,185,247,252,243,72,181,93,80,240,83,162,3,221,174,-143,75,68,226,26,177,13,59,75,112,103,124,62,0,8,89,87,6,64,225,-254,107,157,60,211,20,147,6,27,92,88,236,230,201,19,116,56,81,208,8,-255,112,189,122,132,127,212,117,210,38,119,138,102,7,20,55,78,7,134,144,-43,128,191,255,34,239,221,50,248,99,123,175,150,85,162,226,171,184,180,21,-243,159,99,88,169,206,220,147,244,114,58,123,136,44,226,79,13,226,242,31,-143,219,92,248,15,114,77,23,55,250,82,149,188,108,92,56,108,215,200,221,-48,95,108,181,194,31,110,212,166,54,175,94,101,186,168,84,98,57,146,99,-166,95,77,28,8,209,239,81,49,86,177,149,217,136,165,126,208,186,231,107,-186,54,138,144,232,79,5,168,184,90,67,58,68,123,78,119,179,58,227,104,-246,239,63,33,113,142,176,160,178,36,44,173,239,30,230,165,209,112,34,12,-125,33,38,142,250,123,243,74,249,41,152,203,243,234,32,50,192,166,133,223,-33,100,111,81,83,202,36,234,116,112,28,131,252,36,188,143,158,85,251,0,-212,200,208,39,225,153,30,162,255,78,24,240,101,103,139,214,104,112,137,188,-83,52,221,58,147,167,90,67,50,92,206,211,171,221,40,171,253,21,80,96,-137,113,255,170,217,106,168,160,101,210,191,206,246,117,103,44,129,158,131,76,-110,10,46,253,224,78,229,181,172,18,98,203,172,62,230,32,232,117,53,77,-184,194,74,23,184,213,176,28,14,208,41,13,154,238,141,190,109,90,253,46,-44,173,56,79,68,120,103,126,120,1,56,107,140,246,216,94,200,137,159,99,-238,191,85,94,179,70,180,203,248,144,232,231,50,237,235,187,108,118,161,196,-102,118,236,59,244,129,173,170,120,112,34,59,232,178,154,175,130,71,16,228,-161,106,125,124,140,44,7,132,41,211,44,52,18,159,195,172,142,115,163,45,-174,36,210,168,113,208,107,195,79,174,70,93,50,230,234,6,212,14,164,204,-250,46,182,126,127,90,86,35,214,27,197,81,209,188,169,7,20,99,217,233,-120,180,158,116,100,76,93,159,157,8,81,161,8,248,204,152,171,160,91,45,-199,37,38,188,134,72,71,40,250,32,122,190,61,122,249,85,112,130,184,89,-246,108,91,46,13,184,56,205,138,246,57,135,172,162,191,218,64,98,252,103,-32,14,84,22,115,151,20,201,173,31,252,28,189,128,172,30,29,55,211,165,-17,40,118,131,178,135,202,70,207,147,200,34,14,99,254,255,207,197,254,252,-131,232,183,209,57,232,59,110,71,34,175,181,195,199,143,228,19,230,242,104,-213,27,145,213,254,209,93,133,170,225,121,50,115,95,35,182,78,163,155,89,-247,124,214,114,126,16,191,194,100,15,192,104,30,209,159,185,225,98,67,242,-31,35,28,183,249,42,139,73,10,14,156,159,218,46,36,188,8,112,175,243,-49,68,92,249,91,124,151,59,12,164,147,62,162,49,109,216,93,81,206,227,-238,118,109,39,3,222,44,29,88,138,211,229,227,66,1,170,129,226,71,190,-175,49,255,119,103,71,188,247,51,239,127,56,112,202,30,249,165,70,85,63,-240,129,139,243,128,180,205,206,166,184,63,104,19,92,38,215,143,62,55,14,-9,172,7,71,5,234,172,78,22,149,233,28,58,6,97,184,233,98,224,8,-114,156,205,64,29,52,30,10,217,186,8,79,121,205,8,179,32,108,152,147,-17,176,230,114,181,71,161,7,236,251,227,93,148,152,67,121,118,98,234,216,-147,254,245,18,225,5,192,139,153,57,221,68,55,212,122,203,116,81,113,116,-237,71,65,215,251,20,59,121,168,185,31,139,141,223,46,160,131,185,34,91,-241,51,74,234,201,221,170,238,170,102,8,151,249,95,156,91,250,12,252,30,-8,141,49,63,43,85,32,195,104,113,0,9,0,25,116,177,146,146,168,44,-192,36,79,57,146,15,65,86,198,179,187,123,134,83,199,20,12,179,123,16,-226,47,190,21,102,113,98,246,206,219,244,114,170,77,18,130,4,48,43,80,-65,94,185,147,116,158,25,224,208,155,176,55,235,246,170,201,39,44,182,162,-196,83,120,7,151,3,209,42,254,172,251,125,170,145,135,209,183,99,22,99,-31,60,109,207,148,31,30,177,106,215,76,234,179,125,71,48,228,52,178,116,-215,44,22,131,47,43,27,125,205,0,210,40,217,152,83,84,130,166,237,47,-86,43,53,198,28,247,140,210,227,84,105,105,184,68,109,204,130,20,95,37,-161,180,118,187,129,158,232,91,203,241,158,142,3,130,102,5,111,82,47,81,-252,53,54,36,63,43,180,45,117,104,251,166,124,29,186,190,201,230,83,97,-145,93,16,219,169,161,55,132,249,67,64,245,141,106,22,90,203,140,76,152,-245,73,252,221,63,60,154,213,70,231,78,102,4,246,125,55,189,115,1,51,-120,74,2,238,153,202,74,49,11,246,84,183,45,244,198,209,23,228,68,147,-106,134,120,197,81,21,46,236,99,56,218,214,27,161,2,93,183,24,236,49,-246,136,172,4,199,207,82,149,101,247,78,35,32,54,118,29,134,49,207,94,-174,208,169,119,111,221,25,172,0,234,150,4,174,248,98,76,37,186,186,188,-138,239,232,136,17,19,174,205,121,76,189,219,76,125,24,121,33,149,1,34,-83,214,186,60,37,80,53,72,47,49,10,109,129,212,114,58,179,223,24,200,-251,100,91,195,107,100,206,124,214,6,76,218,47,10,124,58,97,212,250,195,-212,248,173,163,94,0,215,173,167,145,17,223,153,55,175,113,246,114,199,33,-33,145,220,9,81,204,77,235,199,63,214,55,235,133,52,117,173,157,50,95,-244,219,182,172,81,98,9,44,114,123,179,122,29,54,166,185,215,254,34,216,-213,168,169,51,160,112,224,199,16,197,180,66,189,214,213,167,253,84,250,179,-163,151,88,159,57,49,2,28,231,198,220,147,34,196,238,253,215,234,205,180,-251,111,162,25,16,246,254,83,167,85,23,137,135,213,242,105,16,233,193,91,-24,114,126,235,85,101,30,188,22,107,75,11,119,82,219,249,224,255,9,173,-169,202,14,161,146,26,53,5,39,14,249,64,185,208,215,233,36,234,149,75,-84,7,219,241,114,130,57,64,93,111,12,17,224,113,135,109,17,226,175,45,-162,139,164,72,88,25,206,162,110,30,206,114,3,196,194,182,242,186,154,60,-9,37,8,89,148,139,94,5,208,161,230,117,75,195,241,191,11,11,176,227,-3,82,103,250,133,17,40,16,8,191,54,152,190,181,149,56,237,253,190,56,-231,228,61,142,161,132,189,71,88,41,63,253,138,26,172,6,162,174,240,79,-64,159,108,174,54,132,35,22,245,236,63,167,121,204,211,123,89,216,1,55,-209,164,205,202,231,202,216,81,167,205,114,90,1,156,226,65,196,56,212,156,-162,34,193,115,58,244,236,81,136,62,250,35,191,63,43,115,54,215,233,22,-70,21,67,13,249,78,249,238,120,36,103,31,207,89,49,241,36,69,143,8,-56,248,169,46,238,218,252,237,58,234,45,80,254,108,139,189,9,234,186,50,-231,141,227,4,118,132,78,44,107,197,180,34,64,255,171,101,166,14,163,35,-223,7,44,114,29,217,110,11,30,242,208,63,228,198,148,206,180,59,89,32,-48,231,85,247,239,234,244,254,170,224,225,44,107,154,131,223,22,118,17,151,-46,122,35,6,164,38,215,228,29,239,244,200,190,190,201,206,64,163,19,181,-235,234,162,51,211,232,90,33,106,230,90,87,233,175,41,212,225,156,145,197,-98,129,209,21,246,125,76,45,236,4,227,47,246,134,104,56,225,207,238,152,-134,25,88,10,201,78,141,112,243,98,178,158,86,243,40,114,252,14,50,178,-203,169,255,174,228,198,62,126,207,233,144,216,53,233,127,245,211,227,210,111,-47,49,140,224,88,135,152,121,76,181,73,199,4,66,78,237,16,127,62,21,-231,173,235,108,146,130,201,205,96,137,236,44,155,242,52,143,74,1,227,53,-218,187,187,144,223,220,141,73,218,104,202,195,23,106,244,201,99,78,166,71,-202,150,255,52,126,71,175,207,70,22,26,39,132,148,88,84,180,66,226,152,-240,14,63,81,170,7,214,170,224,210,118,35,204,255,159,150,58,190,165,123,-246,211,110,136,216,69,101,198,247,228,82,211,7,12,3,229,45,154,14,210,-101,247,216,93,74,49,41,15,237,151,251,102,189,21,156,76,149,255,90,208,-203,144,167,177,8,41,124,173,175,27,188,201,21,31,181,38,14,223,41,254,-105,106,129,25,84,82,184,74,141,53,169,182,227,100,238,120,1,100,134,141,-127,65,24,32,250,26,117,46,165,8,70,152,211,65,227,80,44,231,239,103,-10,214,26,148,219,20,196,165,100,95,159,172,7,94,66,217,189,170,101,6,-159,173,86,131,16,34,205,225,171,117,137,205,185,188,9,246,180,144,191,53,-17,234,6,242,216,189,116,130,162,71,127,253,236,31,106,186,7,195,112,219,-209,204,74,50,72,25,126,141,48,121,85,21,96,69,7,179,51,13,225,57,-159,93,148,161,8,146,213,197,40,73,62,253,208,131,31,43,95,40,16,16,-49,76,28,100,120,3,245,209,122,142,32,90,63,199,53,191,121,147,65,187,-144,215,132,27,31,243,13,124,137,65,22,114,180,141,73,190,241,26,242,16,-136,46,251,26,239,53,2,90,52,27,97,151,204,148,235,218,0,60,245,160,-48,243,248,148,2,73,174,116,219,143,156,96,7,84,64,20,79,213,228,99,-172,31,244,47,62,78,37,142,13,52,75,189,184,111,97,0,148,69,104,170,-129,10,194,141,105,218,214,100,212,47,37,80,135,68,96,206,104,66,3,33,-44,159,79,54,27,62,145,199,24,84,251,105,31,244,148,118,207,216,96,123,-28,135,239,50,82,17,135,2,224,254,154,60,85,231,159,47,43,40,47,200,-235,49,85,200,25,51,140,144,164,7,58,149,16,154,198,233,41,220,9,46,-182,231,149,242,69,0,127,197,15,33,3,124,190,232,67,244,83,209,243,31,-68,7,78,13,56,31,155,46,217,80,99,202,234,132,127,50,14,90,197,141,-6,184,165,197,47,19,113,83,74,61,100,91,67,47,32,65,139,143,212,189,-166,176,235,194,75,191,70,165,172,198,157,241,6,36,163,90,13,244,10,13,-80,44,201,232,243,194,222,3,134,222,17,221,239,89,46,198,210,51,131,136,-208,123,37,239,67,25,228,224,191,9,29,24,122,176,148,101,199,193,130,81,-144,144,140,98,82,183,20,67,235,185,207,85,32,16,224,101,85,6,53,174,-161,198,182,172,0,213,106,157,59,22,152,168,202,135,61,51,177,27,141,15,-22,219,180,112,192,73,45,65,35,184,105,30,152,205,13,56,1,155,217,59,-7,15,226,152,188,88,49,73,142,87,180,227,228,216,180,49,35,227,131,111,-91,85,243,115,244,23,81,100,74,38,244,245,143,75,49,251,228,59,169,248,-29,98,228,115,66,191,120,50,12,100,246,237,187,206,229,66,99,7,245,111,-229,141,154,97,101,46,186,225,24,22,190,10,85,28,31,80,141,81,192,227,-174,172,231,36,99,22,219,4,166,19,26,223,91,119,235,202,52,189,174,158,-65,171,120,99,201,20,67,225,96,57,75,187,153,206,111,135,117,46,195,198,-228,219,209,160,247,224,82,171,87,30,202,192,204,242,30,205,1,10,26,132,-19,225,129,64,212,244,116,15,198,212,116,187,101,115,61,90,184,164,37,8,-243,71,179,57,250,7,109,50,210,55,87,141,162,138,56,6,30,80,218,90,-161,249,253,24,170,215,58,177,199,179,232,33,30,178,243,20,37,66,205,251,-159,227,19,153,26,190,134,75,145,150,237,77,239,226,137,110,72,213,4,147,-252,214,31,209,27,49,5,233,17,72,219,44,143,237,23,180,62,216,101,71,-149,172,162,189,151,131,181,206,196,43,183,15,33,41,222,72,156,175,213,204,-10,208,248,198,84,35,122,201,6,135,120,81,91,59,27,226,82,179,0,114,-123,211,167,71,36,38,132,145,61,202,102,148,223,46,112,90,245,240,153,64,-235,243,132,184,125,131,60,53,114,46,14,186,29,67,48,150,204,64,159,13,-150,176,251,100,216,137,83,249,120,124,82,26,20,81,213,104,182,113,213,27,-103,47,33,238,73,103,126,156,82,253,142,98,150,215,210,187,28,76,141,145,-219,212,103,220,85,249,252,116,9,198,196,140,221,15,236,22,186,132,117,11,-227,152,207,121,155,167,86,161,83,132,245,244,38,143,4,102,114,252,167,54,-141,170,48,149,57,4,85,62,8,151,255,219,62,3,207,235,35,63,40,104,-12,187,165,84,39,14,243,225,42,39,32,127,164,138,129,12,49,229,158,144,-77,159,201,171,51,86,42,252,149,223,245,87,234,112,198,152,23,133,168,209,-239,200,212,1,111,73,226,195,189,154,116,120,21,108,26,36,1,208,171,201,-167,128,205,146,46,45,169,70,116,77,192,163,189,139,22,155,215,54,209,126,-216,237,204,162,134,129,190,48,153,21,150,142,61,36,149,118,11,166,120,213,-13,140,127,108,238,238,135,104,133,137,91,94,16,249,134,212,137,148,131,153,-85,214,219,31,214,124,28,35,143,196,151,93,59,122,17,188,21,23,236,15,-5,161,139,41,191,255,92,51,41,3,48,173,157,194,98,173,199,43,220,137,-183,89,221,167,125,246,132,35,57,68,214,97,121,253,126,205,201,38,72,120,-144,221,228,108,183,81,131,195,81,109,220,12,64,5,216,211,171,236,65,138,-237,74,219,68,183,50,113,127,226,104,57,154,123,71,218,129,244,5,178,239,-22,184,7,160,52,148,94,17,28,208,150,45,173,229,115,98,152,28,215,137,-141,237,68,156,21,228,190,79,200,227,13,192,221,56,77,215,217,91,132,180,-38,14,238,249,119,59,193,110,76,197,110,18,66,227,151,200,50,205,31,20,-203,31,145,172,69,104,253,145,159,184,113,5,146,191,209,241,51,162,122,101,-185,190,96,68,158,43,228,116,21,192,200,61,234,246,59,106,163,212,10,198,-126,93,10,183,93,72,101,52,54,210,243,159,94,18,18,117,225,62,221,178,-38,51,208,255,47,122,109,254,240,246,28,19,147,102,220,90,121,138,58,8,-220,160,170,19,253,105,38,17,161,236,147,119,169,37,233,188,177,112,23,68,-176,170,160,64,103,133,206,150,79,255,109,11,131,103,77,205,3,0,188,246,-81,54,213,243,245,106,26,252,119,148,205,8,31,95,31,53,198,213,17,137,-95,64,248,90,23,33,235,235,113,228,158,7,2,39,162,11,209,152,33,175,-227,68,32,74,56,228,33,181,235,71,214,80,197,121,70,51,179,41,4,66,-26,221,67,124,80,168,111,99,135,46,193,227,110,249,46,250,24,151,46,173,-98,179,170,154,64,127,1,102,165,54,126,170,67,5,237,253,175,210,51,160,-117,191,242,211,145,1,20,27,194,177,208,161,132,54,88,231,132,150,161,105,-193,25,30,3,124,181,59,60,146,81,138,221,52,130,46,11,43,178,148,5,-127,36,190,204,239,220,86,100,71,228,110,87,6,2,29,95,79,178,50,206,-115,193,69,63,105,118,227,240,110,235,51,115,200,205,220,117,37,148,220,255,-207,51,180,52,212,100,67,84,150,38,79,139,177,115,186,46,98,31,182,237,-250,86,76,127,252,161,53,129,250,237,141,40,17,186,100,137,35,58,175,29,-161,182,62,137,167,19,119,57,185,200,36,41,73,188,144,174,71,56,7,102,-243,29,5,43,44,140,191,117,85,184,190,47,109,196,224,193,29,50,181,27,-49,123,247,44,161,143,187,217,126,40,101,78,113,66,233,237,89,162,170,133,-63,173,63,198,108,208,209,33,91,164,170,0,180,172,61,31,45,204,251,142,-231,40,123,182,17,109,177,89,83,177,157,45,89,143,88,15,93,234,67,191,-169,105,168,95,68,233,126,19,217,139,81,169,156,191,145,40,188,63,75,133,-28,57,63,242,20,36,176,7,245,111,218,51,193,65,150,197,17,212,112,78,-98,209,161,48,19,173,48,209,202,18,212,127,206,17,183,122,31,62,192,107,-186,14,97,94,102,100,114,198,80,107,67,104,2,54,34,141,85,100,20,77,-170,242,184,203,180,206,250,218,14,221,101,252,140,124,128,98,49,222,36,109,-28,109,81,105,12,39,237,151,223,251,172,15,145,37,162,98,164,23,153,135,-197,93,223,33,231,103,6,206,163,180,130,100,138,171,136,214,33,159,76,35,-193,107,214,4,22,111,81,59,127,221,230,156,113,172,154,22,162,106,0,214,-151,224,30,161,240,228,249,78,67,201,108,193,180,59,63,112,25,171,60,104,-23,248,205,37,239,75,109,173,179,99,156,119,111,69,138,196,163,242,5,176,-135,9,222,209,72,248,148,58,49,245,208,34,83,77,113,90,184,31,84,171,-253,133,73,158,147,217,213,168,169,24,160,18,172,131,202,248,224,78,135,218,-155,173,242,249,34,210,146,63,38,57,48,250,59,232,175,21,47,220,213,126,-139,145,194,16,166,166,130,200,32,222,99,40,180,228,20,237,193,134,231,242,-52,73,157,120,25,7,247,11,136,155,238,214,62,230,1,138,107,118,229,198,-213,236,200,65,81,186,14,29,91,109,169,88,42,155,189,119,205,224,194,155,-35,184,160,77,18,87,34,210,83,145,245,213,92,56,73,105,99,148,69,217,-130,40,193,217,84,126,105,228,12,55,138,162,45,140,1,14,34,100,144,172,-240,197,68,120,137,6,32,114,133,216,33,240,149,81,138,235,136,191,23,214,-107,116,201,61,47,161,132,147,22,18,74,188,186,230,91,233,84,164,113,190,-3,31,157,40,95,30,57,43,4,47,218,87,184,64,124,140,179,117,41,120,-154,225,49,40,175,166,87,106,229,56,153,181,232,37,104,172,106,137,192,242,-122,188,123,117,156,2,238,95,4,104,5,45,118,4,16,250,251,48,16,183,-193,230,136,233,125,36,132,242,8,222,175,81,24,250,204,161,88,227,114,241,-107,130,14,176,208,163,134,245,203,16,198,102,76,37,179,167,8,202,49,179,-83,45,213,235,252,127,123,206,93,195,169,43,133,81,90,186,224,59,73,252,-254,185,164,52,149,195,137,71,138,51,185,144,60,142,142,176,139,100,4,252,-181,170,36,23,110,150,232,100,162,49,48,100,249,35,34,177,207,138,199,244,-193,4,71,181,216,40,51,42,9,113,10,156,242,235,12,224,202,123,100,1,-153,119,186,190,241,52,76,109,23,158,184,25,121,125,127,2,165,185,78,21,-141,39,191,67,236,57,176,135,218,134,193,234,27,137,233,73,190,111,180,22,-26,237,210,210,193,207,102,118,19,159,236,66,113,39,115,201,122,44,205,146,-230,162,94,9,233,63,247,153,170,202,12,100,225,38,12,201,190,211,219,229,-39,101,205,69,227,183,60,46,53,23,69,144,199,202,221,12,116,90,236,21,-10,148,103,153,25,82,163,105,230,178,118,17,232,35,41,164,163,47,11,179,-60,25,85,216,102,170,16,161,202,158,1,100,40,248,42,126,103,152,30,242,-185,1,69,102,51,178,19,235,41,79,163,135,60,61,101,217,18,16,141,38,-186,48,49,113,224,44,159,204,255,180,67,69,19,72,15,119,9,161,84,250,-74,215,175,173,130,31,117,20,38,160,39,111,216,38,236,20,95,118,41,237,-203,90,43,227,150,198,171,145,54,66,225,181,120,46,58,196,198,19,125,153,-93,200,75,231,182,169,206,218,116,223,48,226,152,0,138,157,127,104,20,181,-248,196,199,254,235,156,211,235,79,65,111,74,214,162,140,224,209,234,123,15,-96,77,0,106,184,225,219,13,200,160,222,28,80,237,72,255,99,20,110,155,-36,225,175,31,128,89,110,60,249,175,181,171,233,145,71,208,175,78,220,52,-18,69,36,209,79,9,129,185,100,96,34,53,253,78,145,223,158,254,22,36,-136,188,129,15,86,162,67,102,59,237,103,243,233,101,19,20,122,20,17,70,-79,242,222,205,62,102,133,165,177,28,170,109,101,171,116,114,5,207,52,239,-187,164,209,48,41,30,42,58,34,122,130,159,55,77,142,170,0,9,48,116,-122,81,193,161,222,57,105,226,212,13,30,26,18,225,120,95,189,119,45,43,-22,238,4,59,207,78,23,122,91,59,18,117,111,8,119,56,239,59,70,76,-239,93,178,163,52,220,141,223,123,200,177,132,152,167,109,40,241,71,98,200,-116,49,81,240,178,251,147,55,75,215,203,201,85,135,143,248,214,140,204,15,-25,105,82,98,186,31,107,159,244,110,122,242,221,220,168,39,64,69,161,36,-36,108,254,142,133,168,93,135,31,109,55,170,129,95,201,95,164,125,95,21,-41,154,111,245,241,54,48,22,21,87,128,8,168,161,176,123,61,7,223,99,-250,74,59,190,47,53,18,154,202,19,20,196,126,191,108,244,218,63,138,131,-228,119,81,78,95,0,189,56,167,177,173,163,91,18,204,147,5,219,160,128,-181,182,119,59,244,193,216,146,229,12,122,163,81,39,109,44,136,163,212,151,-175,83,45,165,211,179,209,206,48,169,64,147,182,67,53,79,187,242,2,109,-198,56,175,30,6,211,242,8,160,205,118,56,135,19,30,174,246,21,133,255,-57,196,40,142,44,47,50,21,89,240,193,171,7,245,150,229,128,54,42,25,-54,114,230,86,22,139,158,206,51,85,204,204,78,102,234,198,236,212,53,117,-91,153,127,224,59,243,75,49,211,209,165,200,153,182,196,224,131,66,60,123,-164,39,121,14,223,184,133,105,156,255,166,149,82,193,154,26,41,203,163,241,-235,27,243,183,191,23,223,255,162,175,167,252,142,224,120,180,247,77,130,218,-243,75,190,213,80,212,24,4,255,189,79,218,76,89,41,162,220,98,27,167,-164,10,23,40,170,12,89,119,107,88,83,32,133,101,162,190,123,72,215,108,-205,45,174,212,249,140,8,94,94,193,35,93,71,29,38,79,182,190,232,93,-164,90,215,82,195,94,254,198,201,228,248,60,15,57,56,137,162,208,182,110,-252,67,223,208,79,146,76,215,5,162,152,191,140,14,159,182,235,168,213,78,-65,212,55,14,100,223,83,46,75,15,54,36,11,140,142,181,159,249,183,233,-66,6,125,199,203,180,26,88,208,197,96,65,163,212,243,49,92,102,233,40,-207,105,138,80,163,15,54,232,48,62,61,112,3,158,76,99,240,75,99,234,-162,35,28,250,134,201,30,228,251,27,211,216,215,205,132,23,48,42,69,41,-226,227,234,208,213,79,195,2,214,143,50,41,59,227,254,6,233,151,150,87,-5,201,34,201,114,56,184,186,174,43,222,153,27,4,20,118,118,197,42,185,-210,114,178,173,55,13,69,146,64,115,123,29,181,18,112,36,48,239,24,127,-140,166,126,189,37,115,136,49,145,30,121,12,100,209,42,172,217,100,249,63,-235,232,61,17,152,67,87,5,218,116,161,178,107,169,85,9,94,213,76,245,-207,194,237,219,58,10,149,206,105,192,228,142,226,203,19,255,50,242,218,38,-189,79,34,124,132,148,65,56,186,239,78,12,188,53,199,104,110,23,145,135,-62,208,186,83,165,100,222,246,135,198,179,124,155,198,98,172,52,130,214,117,-130,59,86,51,226,8,183,75,39,79,100,107,40,217,149,245,13,163,135,195,-80,184,187,155,201,97,251,102,17,54,150,250,167,152,123,117,45,186,168,172,-115,78,176,161,193,247,118,106,119,76,228,167,145,67,41,121,216,131,101,122,-145,23,9,102,144,109,155,92,152,69,61,144,69,53,181,236,68,67,239,139,-188,117,223,88,8,167,195,213,90,106,160,177,255,15,248,95,103,69,132,159,-146,186,251,141,169,162,177,13,160,12,191,58,41,244,135,156,140,235,236,6,-83,166,49,102,37,16,45,212,46,60,26,174,50,136,158,16,98,117,133,183,-78,31,73,84,63,162,5,124,206,150,10,118,200,95,208,90,239,191,27,193,-60,215,188,172,48,98,250,43,29,125,36,71,230,236,7,32,72,240,104,204,-230,172,189,148,156,144,84,71,37,203,144,20,208,233,201,237,20,123,136,191,-115,2,241,84,127,168,73,51,241,1,2,219,156,199,76,149,139,203,156,202,-230,151,135,214,173,76,88,249,121,68,67,153,68,44,89,194,8,227,190,225,-212,167,102,202,234,97,155,3,232,41,21,117,101,199,67,7,93,37,69,60,-12,17,83,59,225,216,63,116,228,219,214,20,168,136,99,20,71,246,248,135,-239,20,175,74,41,127,114,95,94,203,63,245,246,230,85,7,76,253,63,247,-203,127,83,141,225,218,165,147,7,204,31,126,1,10,19,29,27,152,238,236,-1,105,200,51,141,13,129,123,125,163,130,210,248,76,186,157,102,139,227,17,-98,22,34,255,6,120,250,62,34,27,14,144,5,41,72,248,88,72,225,244,-18,131,142,131,114,34,89,171,83,88,21,255,206,29,195,184,44,112,84,27,-163,180,252,134,134,16,46,44,175,209,177,19,67,21,237,111,195,80,187,17,-120,226,137,36,172,60,128,30,217,248,146,164,8,39,174,135,98,23,201,167,-116,229,97,34,251,73,58,86,222,199,165,237,125,22,88,88,52,55,66,64,-237,75,95,160,174,196,215,133,145,76,178,105,181,153,55,146,139,94,204,28,-169,129,63,117,182,8,90,112,127,182,136,210,170,145,138,126,10,231,132,153,-121,52,61,18,136,47,124,59,206,47,68,167,99,41,201,208,54,194,59,3,-69,120,126,106,72,37,32,138,95,86,83,153,19,152,220,227,12,17,102,234,-182,35,38,227,51,114,43,193,161,45,179,88,196,254,25,163,29,9,52,212,-40,81,218,110,156,48,69,151,153,45,137,9,248,148,81,97,144,215,41,67,-179,161,200,253,204,60,227,13,92,253,133,196,105,195,146,231,242,176,70,144,-166,97,57,131,244,184,7,13,220,233,93,171,230,26,168,71,157,205,180,227,-181,205,244,99,93,210,45,126,40,233,68,105,205,249,42,133,94,174,229,6,-142,115,111,195,43,138,92,171,152,66,141,243,32,205,56,121,37,31,225,93,-139,69,64,219,255,71,91,17,77,138,163,169,213,101,108,44,210,252,234,166,-13,135,164,224,43,138,48,212,10,133,208,151,1,23,237,56,30,84,166,252,-21,171,12,151,82,233,209,203,72,48,25,68,49,199,236,23,58,17,134,227,-207,58,30,172,210,97,215,25,106,162,63,84,29,199,196,175,85,1,159,37,-34,135,128,206,189,37,28,139,123,72,167,244,24,55,56,151,124,181,217,217,-36,215,63,125,79,139,171,164,175,111,122,112,233,156,178,54,236,58,81,180,-73,221,222,116,211,16,244,65,3,118,232,6,193,137,251,224,51,184,56,205,-191,54,132,126,197,13,226,146,252,30,127,92,158,191,37,198,111,88,105,172,-248,219,176,119,37,186,143,55,150,178,10,147,97,242,163,186,160,188,209,145,-198,46,167,225,248,218,38,35,236,132,25,199,21,141,121,171,179,177,91,83,-48,190,155,13,233,222,229,122,0,166,128,221,141,38,178,222,100,216,90,153,-169,84,43,90,209,60,119,180,99,158,211,2,44,181,221,117,137,170,170,194,-2,55,41,202,32,198,52,204,251,6,66,197,228,192,28,140,4,174,77,64,-104,134,249,139,185,237,18,152,207,162,62,4,161,114,240,217,85,246,123,105,-106,159,128,83,81,26,129,218,92,218,100,244,98,45,247,252,239,141,57,203,-164,168,113,252,126,16,201,37,97,45,193,175,147,216,80,37,230,33,218,85,-251,167,39,254,6,81,98,145,160,52,102,78,200,201,176,195,78,161,118,97,-168,94,182,55,113,156,0,10,117,18,150,176,137,122,139,118,58,205,151,107,-214,196,95,69,170,98,241,203,180,156,200,154,55,197,163,167,125,160,30,163,-125,51,249,5,108,191,152,46,9,66,249,115,141,181,7,177,180,121,196,38,-74,51,249,37,21,54,248,73,163,254,242,66,97,44,49,249,218,149,253,180,-8,230,151,141,55,103,26,168,133,226,224,161,152,138,212,132,161,116,220,182,-93,188,244,184,116,16,53,236,163,255,169,191,135,106,17,32,82,108,177,130,-59,211,16,65,58,4,91,96,97,37,93,51,48,227,132,139,220,34,117,71,-58,245,202,60,165,187,203,185,197,130,172,216,94,118,143,26,77,228,252,129,-67,50,197,68,237,123,156,127,194,186,211,125,225,76,251,104,233,66,27,144,-59,174,4,15,128,252,119,62,26,129,87,168,211,61,124,232,235,181,55,43,-107,52,186,192,222,17,7,141,223,59,89,213,202,124,15,218,224,250,63,211,-101,109,104,137,172,169,188,7,111,116,249,7,169,44,107,180,9,171,122,177,-16,93,224,87,246,197,40,139,109,86,230,205,53,200,151,175,173,158,39,196,-31,201,20,106,120,98,2,31,213,54,187,153,144,98,89,176,94,18,96,132,-23,153,70,86,203,242,235,10,69,122,30,192,32,22,19,249,142,154,214,151,-233,40,234,22,28,57,139,246,42,173,250,73,181,125,140,74,39,145,137,175,-56,22,42,177,187,178,188,219,7,41,53,19,170,204,70,167,211,47,83,247,-183,68,141,133,167,8,27,68,162,64,80,66,128,240,0,182,182,157,239,117,-155,164,18,82,25,52,160,171,220,131,245,172,178,28,99,8,41,190,93,117,-47,247,33,35,161,220,70,61,1,233,3,162,103,247,23,188,157,210,194,217,-185,236,8,221,100,197,208,128,123,169,27,22,213,25,205,71,12,195,3,203,-144,80,204,101,74,180,47,59,107,211,69,153,137,146,197,47,240,181,105,39,-54,222,212,242,198,23,44,41,146,209,251,84,84,23,125,115,50,239,198,100,-200,161,245,95,67,233,29,105,180,246,209,34,87,248,21,18,190,162,85,155,-38,254,38,54,175,236,248,28,59,58,72,171,71,100,103,103,106,124,193,27,-254,171,10,66,36,184,242,223,173,179,236,218,107,246,12,236,190,176,169,251,-177,120,154,196,249,107,78,139,128,168,229,54,179,18,147,49,26,103,49,184,-24,188,180,64,140,250,158,9,164,143,229,2,228,192,91,19,126,145,215,98,-23,203,218,176,89,231,56,40,170,111,26,177,170,26,52,29,151,228,129,79,-239,68,59,212,91,5,137,162,81,98,38,4,213,104,167,92,39,87,202,48,-199,139,229,248,68,109,107,115,247,46,235,115,166,254,17,180,160,171,206,10,-41,79,9,120,7,31,79,63,110,226,54,221,210,16,230,7,90,245,205,232,-99,30,198,52,238,226,220,36,254,218,17,26,248,98,11,247,68,203,121,115,-122,192,99,152,18,24,204,210,90,32,54,151,85,77,89,108,39,206,230,154,-72,167,130,168,48,168,91,235,93,231,73,33,142,27,156,61,170,70,67,54,-246,195,50,130,51,164,126,197,238,228,162,217,126,209,40,2,40,50,179,129,-222,234,43,204,103,67,193,49,221,107,244,86,206,107,228,16,90,203,204,56,-122,211,120,149,58,149,35,70,170,83,229,42,235,70,162,146,113,176,188,136,-124,212,44,79,99,131,206,150,202,121,104,133,102,167,76,230,6,201,185,212,-73,216,4,228,230,141,58,154,80,99,136,225,162,243,57,201,113,60,199,205,-33,249,140,93,95,137,35,60,28,31,114,112,2,83,115,141,217,148,222,176,-6,111,245,180,76,0,21,144,3,215,1,133,7,240,46,237,119,43,198,245,-224,207,234,222,223,131,158,70,212,41,169,87,152,46,1,194,130,131,239,177,-145,41,217,181,157,98,27,239,185,255,136,103,205,210,175,103,215,246,173,120,-185,30,20,161,36,161,33,161,37,239,65,231,178,11,250,147,253,232,52,209,-27,72,27,168,245,181,222,86,67,35,70,173,175,207,121,36,118,192,68,220,-8,249,119,220,37,35,75,245,254,78,248,30,77,217,189,16,159,193,131,226,-178,160,206,76,38,193,73,150,42,100,63,204,24,100,170,218,76,202,82,164,-141,139,191,85,229,63,91,13,217,40,72,185,97,112,187,71,143,72,125,191,-79,143,176,79,94,195,25,21,207,0,160,124,122,82,88,214,182,239,94,107,-66,177,39,244,106,29,125,16,82,102,47,92,88,172,8,172,129,247,120,118,-194,186,208,47,133,208,223,86,207,35,116,67,151,54,65,148,4,131,29,56,-137,109,68,7,227,187,165,238,52,2,28,178,112,236,113,119,234,111,251,47,-98,50,111,49,71,132,57,169,47,91,105,17,59,146,203,175,97,206,27,145,-7,66,188,126,87,221,88,104,147,133,103,8,173,169,186,47,120,45,83,167,-120,183,125,15,31,182,94,111,84,177,207,216,214,185,192,92,202,14,154,135,-48,55,134,208,174,94,165,230,243,75,79,245,253,202,3,63,16,93,106,72,-60,65,243,84,87,232,178,140,123,139,255,173,229,53,238,124,43,42,139,15,-20,155,83,102,167,211,98,41,249,67,77,4,201,108,234,85,173,39,203,141,-194,28,26,110,254,31,77,51,138,195,179,61,164,151,199,245,131,216,100,5,-27,204,92,35,232,79,177,49,254,70,55,27,177,37,235,149,99,189,161,53,-24,138,79,97,152,14,75,87,105,119,213,10,51,250,5,210,158,170,31,82,-130,214,22,48,145,66,172,196,203,89,106,100,217,32,250,186,179,30,110,77,-183,227,46,125,84,101,65,66,68,253,144,55,187,254,220,253,132,49,52,101,-91,50,149,76,9,181,213,97,199,173,185,204,178,57,125,103,151,121,194,81,-177,180,100,73,128,180,113,153,6,154,58,74,238,41,126,12,193,0,48,91,-43,69,133,164,91,129,33,174,190,3,218,161,234,203,176,37,24,117,83,230,-167,37,39,132,195,123,17,234,171,168,45,92,128,153,238,246,13,129,203,93,-0,216,131,102,167,174,71,190,120,72,156,19,175,221,121,237,62,108,151,117,-89,85,103,43,189,248,68,22,36,218,238,229,185,173,144,192,225,205,201,153,-149,66,88,248,74,8,250,192,169,69,134,64,215,187,106,233,125,189,212,234,-214,122,182,155,79,204,104,138,30,134,168,25,47,36,115,246,42,198,243,200,-200,174,238,246,168,207,233,236,32,89,25,93,179,145,19,155,141,173,232,17,-163,125,234,223,241,66,229,64,174,214,130,194,87,92,184,49,175,236,239,138,-244,102,66,166,198,149,110,220,210,174,95,143,90,232,182,153,87,14,140,214,-153,189,139,197,66,243,188,123,175,53,89,193,71,231,230,10,154,244,228,147,-153,91,137,128,127,157,160,201,183,16,39,245,101,200,67,28,1,50,163,121,-51,217,220,21,17,162,94,188,111,207,87,198,63,217,122,167,90,76,180,54,-21,186,4,8,159,46,40,244,23,241,254,152,156,86,97,161,216,150,27,24,-143,156,80,10,2,18,10,3,20,223,159,59,227,252,138,76,212,18,47,9,-177,211,237,24,45,103,227,29,71,57,127,164,53,19,167,170,193,35,15,134,-168,162,51,73,163,132,61,34,210,142,17,156,133,176,54,169,45,83,165,248,-8,187,178,70,132,131,203,195,109,73,108,80,184,248,72,196,37,173,8,202,-50,134,46,205,14,118,176,57,197,162,18,118,25,198,72,60,164,110,25,173,-27,115,153,193,131,161,176,48,59,120,224,145,161,78,202,242,163,135,170,72,-60,237,44,113,122,228,235,18,118,68,229,214,48,65,56,228,26,216,223,189,-152,140,102,106,15,223,140,202,102,62,226,177,38,22,96,171,242,81,63,221,-59,114,48,6,246,90,53,8,23,49,11,174,22,62,70,16,134,146,9,171,-169,60,221,204,68,129,163,117,213,172,135,254,245,240,188,54,145,164,84,9,-21,11,157,81,177,255,106,232,158,148,216,98,161,144,145,207,165,62,86,109,-185,134,11,77,89,34,249,50,68,16,197,81,85,186,24,226,32,202,63,186,-131,159,110,101,227,184,102,191,62,51,162,194,54,66,196,147,238,107,215,136,-176,16,90,41,164,88,199,230,44,38,22,251,95,121,5,176,5,212,221,108,-68,6,114,235,224,153,229,114,3,200,205,24,99,83,79,227,152,205,220,246,-73,168,162,188,246,148,7,159,83,13,140,70,16,211,166,43,253,132,161,188,-240,159,48,199,130,3,227,57,145,224,61,20,198,210,157,69,209,141,33,192,-109,199,219,254,141,20,216,222,32,189,125,122,162,170,72,9,147,171,127,183,-50,162,34,121,135,153,22,22,253,202,208,76,37,58,246,61,211,243,112,142,-244,1,176,210,208,103,80,123,197,232,181,191,161,137,8,191,147,83,87,40,-84,139,203,3,86,201,177,194,230,149,245,142,154,48,35,157,186,41,165,82,-141,144,27,139,237,198,28,120,2,131,94,56,100,31,88,131,92,29,197,126,-149,190,64,103,236,236,239,75,85,95,180,127,79,244,172,186,70,134,215,67,-179,111,48,158,53,163,227,37,51,148,142,144,115,17,2,221,5,157,144,72,-1,6,237,184,88,63,15,114,190,53,149,79,55,253,204,3,108,114,181,2,-25,182,209,253,76,5,81,189,250,133,0,82,252,136,160,49,225,234,139,26,-204,230,207,173,7,234,143,74,162,200,143,196,59,140,231,16,128,107,74,13,-230,10,222,123,170,159,227,196,140,239,148,171,67,83,91,141,213,76,217,94,-107,173,62,70,148,49,29,72,147,201,26,88,88,172,30,233,28,191,146,215,-246,147,140,56,196,138,96,125,77,67,22,112,149,106,84,71,83,251,203,235,-20,58,139,154,168,14,253,227,104,195,59,248,99,96,31,116,75,49,196,121,-109,161,214,37,226,52,84,105,28,254,176,195,173,48,68,187,187,103,107,88,-144,195,7,73,36,54,1,254,119,27,20,51,38,141,209,25,202,109,48,55,-201,21,203,163,83,10,95,79,179,239,128,13,180,94,176,181,104,223,52,130,-217,138,190,190,107,28,175,146,65,197,175,183,45,212,216,148,142,31,184,30,-129,18,180,17,187,167,88,254,15,169,148,98,165,184,21,79,208,187,157,161,-243,90,81,116,96,44,154,248,17,157,101,167,159,171,121,89,166,132,19,39,-223,72,80,123,61,28,24,85,42,118,11,255,204,133,32,142,133,168,248,72,-64,151,171,247,26,58,41,216,215,143,89,253,20,173,15,7,152,226,45,146,-253,203,91,12,2,15,81,51,62,224,49,89,129,244,143,100,234,151,231,27,-142,54,211,246,60,235,232,47,146,222,3,84,0,120,142,207,142,180,241,62,-16,125,57,145,151,58,34,183,249,123,255,196,81,58,191,138,10,47,21,93,-92,206,61,70,10,201,179,129,162,160,42,21,70,35,105,38,20,111,219,114,-207,43,35,128,147,38,189,213,177,205,203,2,61,58,145,195,53,133,164,8,-56,99,128,26,230,104,177,203,222,112,30,97,194,111,156,36,17,92,94,114,-143,149,44,87,94,121,163,74,26,116,141,170,83,239,154,79,58,131,183,95,-94,135,244,171,68,254,108,233,126,138,48,52,148,76,11,245,160,202,128,209,-122,115,225,249,202,9,81,144,69,78,248,23,33,108,206,15,119,45,110,63,-55,166,136,207,4,6,154,102,16,166,189,99,37,186,208,134,108,223,8,28,-10,222,27,111,142,184,80,71,170,11,188,120,137,37,166,242,158,9,169,206,-43,244,198,22,174,89,110,145,174,237,147,240,135,189,250,128,33,70,55,238,-95,176,24,227,174,120,169,179,44,92,170,95,225,164,60,177,216,249,201,212,-187,117,252,65,237,38,89,253,133,135,68,81,70,214,80,203,181,120,139,2,-189,100,40,203,40,251,128,96,249,85,36,84,91,220,3,87,152,113,130,169,-38,41,218,184,44,78,108,207,45,204,127,195,250,88,212,208,16,60,93,38,-158,4,185,79,183,15,34,198,197,202,36,96,159,125,177,115,254,233,33,243,-155,179,66,149,164,4,225,97,65,70,8,205,78,240,129,37,243,112,149,226,-114,126,223,207,246,19,218,250,68,148,154,225,27,7,206,196,244,150,130,205,-90,230,97,93,51,58,137,239,68,221,203,34,79,147,129,136,99,57,188,161,-181,31,76,60,83,71,151,158,104,126,255,53,59,228,139,98,203,201,188,12,-194,131,60,224,185,105,185,234,91,18,34,98,45,196,137,47,172,136,142,236,-182,197,157,152,236,79,168,138,221,238,172,152,225,6,67,187,32,6,111,145,-171,214,148,32,59,129,178,222,248,235,36,27,90,130,50,203,58,39,44,105,-224,4,66,104,186,23,77,72,249,241,100,141,74,145,44,224,3,225,27,41,-255,91,245,126,252,35,215,3,4,226,16,27,218,239,20,191,121,0,10,155,-74,202,177,9,105,149,126,11,24,219,12,219,153,199,197,179,40,86,17,140,-245,43,30,102,43,121,237,231,248,88,21,46,86,34,42,51,195,57,178,9,-250,250,245,223,226,143,188,182,141,108,110,203,54,29,15,48,236,156,162,62,-19,55,254,90,23,251,228,68,34,9,96,189,35,214,244,129,211,22,81,36,-17,63,226,180,57,58,42,239,200,132,19,65,34,53,242,17,203,119,139,197,-199,128,162,218,201,91,217,61,12,212,67,193,17,144,136,199,120,223,223,145,-5,177,203,245,142,89,93,49,66,123,82,232,108,151,93,22,16,137,219,161,-10,158,202,86,219,9,252,74,79,10,159,252,73,201,63,186,114,73,253,242,-163,160,190,14,8,166,123,65,140,76,7,55,207,228,109,59,28,255,81,1,-87,244,69,231,213,231,139,178,60,203,28,187,212,26,140,215,30,91,214,95,-22,150,59,227,127,197,70,129,247,72,160,230,103,118,94,86,115,223,214,106,-144,86,16,204,117,239,34,44,5,133,240,121,175,118,65,181,102,72,180,248,-244,224,218,196,246,33,137,131,98,65,154,234,108,204,106,97,185,143,70,159,-73,111,64,209,100,192,197,249,183,247,224,187,17,121,241,0,251,74,139,28,-151,66,100,62,67,40,163,231,179,156,101,158,103,3,180,146,117,26,37,57,-191,213,23,185,162,241,210,14,174,91,101,185,224,107,24,20,254,132,55,219,-142,59,239,38,144,173,227,200,43,62,254,86,107,212,255,53,187,173,134,201,-116,92,207,188,200,128,234,196,203,240,255,216,250,33,68,61,135,50,101,190,-10,137,126,175,4,177,63,189,159,225,0,124,108,59,210,199,197,184,8,57,-223,1,79,220,128,240,72,44,37,220,175,227,240,167,43,239,251,172,75,202,-108,125,121,159,34,12,129,148,92,211,66,52,79,151,8,182,252,47,88,160,-157,127,158,224,35,78,153,199,156,136,117,179,246,44,33,244,8,129,96,38,-48,201,224,109,23,203,46,209,184,201,156,53,57,46,165,204,8,250,144,23,-127,37,218,170,122,24,159,99,137,219,104,0,188,176,185,234,183,112,99,124,-129,10,26,72,117,187,187,18,62,16,244,228,136,20,78,160,136,23,131,88,-85,185,5,90,241,115,128,158,1,123,37,121,76,192,248,233,69,47,174,185,-0,19,212,154,115,56,66,226,215,185,171,85,106,38,196,114,89,245,0,29,-127,235,110,42,156,44,150,112,222,23,224,4,80,27,14,53,191,184,51,246,-80,161,6,99,241,6,164,65,225,131,254,235,254,79,187,57,34,31,217,108,-70,23,166,172,28,239,225,212,117,108,85,52,125,25,72,212,93,205,141,252,-116,151,173,160,3,2,118,88,212,36,210,154,173,128,185,218,27,9,183,179,-253,3,52,191,246,211,64,105,181,129,2,222,246,203,193,48,155,205,81,116,-90,169,78,126,238,65,164,92,124,31,98,255,206,106,218,80,62,61,242,18,-144,175,210,127,82,233,90,72,32,159,211,134,214,107,204,25,39,216,14,138,-156,132,250,134,121,127,128,159,191,34,54,254,198,176,138,240,169,176,211,64,-109,158,141,106,63,238,204,175,199,211,121,4,46,88,197,192,193,165,174,13,-176,96,131,7,101,54,95,110,229,230,104,29,146,46,6,49,122,51,228,245,-136,143,138,225,129,48,77,132,47,197,60,20,202,195,46,159,111,165,243,192,-58,201,201,176,188,40,245,129,203,134,151,116,80,193,18,68,65,150,131,144,-178,151,218,233,174,210,241,227,49,71,186,69,46,121,247,102,149,24,87,32,-224,62,236,37,93,210,69,98,53,60,61,151,80,120,178,31,117,11,159,251,-143,51,0,0,93,42,217,93,208,222,28,29,179,91,248,33,11,11,177,113,-142,119,112,220,131,49,103,56,178,167,1,43,82,225,92,31,7,17,155,200,-16,15,82,5,203,55,185,122,200,132,239,241,252,229,64,141,61,80,20,194,-174,95,73,140,31,17,213,247,163,90,85,119,41,125,23,54,166,99,46,181,-138,237,240,149,84,21,180,211,18,175,236,98,19,56,246,218,229,228,236,167,-198,13,89,165,77,53,159,104,146,206,18,193,9,200,10,186,28,177,189,80,-203,131,153,138,66,233,68,171,129,236,49,35,64,106,166,255,176,39,166,153,-146,133,83,71,62,190,148,36,129,106,170,81,128,65,158,160,222,119,176,207,-17,172,27,145,176,101,228,58,75,104,12,157,161,39,70,183,250,122,41,85,-167,38,61,140,224,200,35,170,236,62,109,124,72,145,216,45,162,112,92,161,-159,134,160,145,160,46,167,69,148,94,57,44,211,247,225,98,37,15,51,207,-148,13,93,176,167,45,118,131,57,86,27,160,96,121,189,65,3,138,62,44,-139,134,62,96,253,187,190,98,219,142,45,83,115,47,107,206,102,109,128,151,-112,232,44,224,28,185,229,115,55,204,76,118,89,210,203,14,100,103,162,147,-93,192,46,52,45,9,249,25,186,56,195,163,54,69,104,103,220,199,94,32,-85,56,185,163,199,150,79,172,107,237,178,68,46,199,149,214,173,84,206,62,-132,36,65,207,246,35,226,48,137,54,5,227,94,21,245,92,49,51,81,58,-58,137,15,116,191,61,14,53,8,177,41,63,60,157,192,242,83,108,108,84,-164,17,107,191,242,232,184,86,218,187,214,148,208,50,204,212,10,233,67,220,-53,38,91,25,44,20,196,0,208,139,25,237,161,252,145,21,48,95,27,112,-243,117,221,50,37,229,15,157,35,45,112,177,115,234,163,74,155,38,62,188,-106,108,13,112,243,36,200,145,231,127,232,67,187,150,152,68,26,17,13,211,-201,186,65,90,109,82,2,132,110,255,91,163,73,226,222,245,70,249,236,80,-14,0,112,30,72,15,91,105,203,185,103,116,211,37,226,58,211,116,119,18,-172,24,23,178,11,132,71,118,240,119,38,124,17,186,3,135,187,218,168,97,-70,140,103,220,38,115,249,114,62,76,10,226,47,73,31,187,21,81,23,191,-54,222,18,247,4,143,50,167,88,226,191,155,184,206,46,65,7,208,94,183,-58,187,123,107,22,45,217,47,226,139,105,144,239,68,65,111,2,78,170,111,-113,223,62,64,197,65,65,226,200,111,87,183,47,131,10,217,234,174,35,73,-72,86,12,158,129,193,127,10,187,45,49,2,155,224,223,168,100,29,229,110,-215,62,210,149,103,121,158,49,107,179,85,63,196,33,202,25,249,7,82,21,-232,25,60,48,175,73,139,125,128,100,166,142,219,103,164,156,138,116,66,190,-198,185,59,194,112,253,37,179,58,119,109,8,45,255,190,74,188,244,34,119,-153,183,145,169,13,174,35,10,50,217,214,192,250,239,12,244,109,177,178,5,-182,156,133,106,123,175,11,25,243,121,180,199,74,115,172,47,138,116,221,146,-39,147,178,125,35,19,204,45,45,184,49,30,122,148,146,208,18,115,244,129,-103,69,98,3,202,229,180,245,42,211,236,157,99,234,224,190,209,47,117,170,-34,149,99,117,0,31,20,92,227,130,210,0,47,152,63,95,209,78,4,61,-77,4,19,122,186,211,78,26,68,43,73,195,69,13,129,39,200,162,17,9,-160,145,136,138,154,186,148,124,84,29,112,240,145,23,178,122,242,183,64,139,-28,47,174,151,175,166,31,79,9,35,237,206,170,175,95,50,163,119,77,104,-232,183,1,14,133,0,135,77,70,36,69,152,222,60,4,87,140,252,202,31,-80,149,43,79,193,63,136,32,142,173,157,196,115,125,182,251,48,135,248,186,-141,182,185,137,103,101,41,17,40,68,108,71,25,26,14,136,37,44,193,235,-66,68,211,163,210,64,40,3,99,10,192,164,20,181,159,208,145,28,126,80,-65,101,35,185,203,155,110,112,166,134,254,78,40,67,198,197,218,225,233,192,-222,99,235,169,54,93,77,127,227,2,106,212,107,119,57,139,202,200,103,9,-130,88,234,35,228,225,181,62,129,239,204,104,206,28,41,178,130,220,87,135,-250,75,20,101,225,82,18,173,211,20,28,201,219,196,170,202,157,57,13,90,-113,227,128,24,42,132,58,133,152,246,246,103,34,118,238,83,29,87,71,55,-212,94,253,46,51,108,3,236,73,239,220,112,66,23,108,100,88,41,187,192,-88,20,176,69,97,142,181,101,108,229,254,250,213,151,198,254,189,40,34,193,-203,3,182,196,24,134,244,119,250,192,16,218,41,214,49,183,44,110,212,2,-89,220,127,95,48,86,169,99,114,193,185,249,101,3,131,71,207,114,12,75,-4,39,31,189,144,109,181,212,128,130,191,208,131,37,217,126,244,98,77,35,-222,215,113,26,31,200,152,228,107,106,226,82,15,187,112,64,162,157,53,155,-173,154,39,191,170,111,153,173,87,2,44,59,189,73,236,24,181,79,127,220,-171,192,155,7,247,143,43,123,189,60,34,131,64,62,191,162,35,149,103,20,-127,236,109,85,172,42,207,184,37,210,108,143,75,44,151,188,252,253,113,254,-142,237,149,127,116,124,186,55,209,31,40,99,77,128,204,20,211,187,104,160,-48,23,73,0,159,71,133,155,122,39,74,137,17,62,82,163,89,235,109,191,-215,233,45,199,191,129,209,196,163,125,114,145,233,163,220,43,197,190,146,18,-180,125,84,217,84,10,251,198,55,95,206,225,204,7,208,176,42,239,168,37,-228,15,243,141,217,135,42,235,63,95,13,81,67,36,36,71,196,238,82,231,-181,115,122,80,69,57,38,33,29,123,63,145,244,245,8,223,9,222,74,212,-141,73,162,6,74,195,47,79,213,59,24,107,177,246,157,15,35,201,234,32,-216,220,255,178,180,74,148,81,154,238,233,153,156,189,43,223,209,153,11,239,-17,231,113,210,35,92,58,234,192,25,206,27,126,64,125,52,61,243,179,94,-26,66,13,45,152,168,247,52,215,13,236,64,51,95,135,173,149,101,117,241,-173,121,116,136,211,184,42,212,35,59,6,234,219,137,189,55,80,210,9,130,-221,55,230,161,128,186,196,50,203,197,222,53,26,37,202,0,163,124,28,187,-81,84,183,248,195,171,90,148,14,45,225,252,93,139,167,241,227,183,106,54,-100,239,138,23,232,198,70,231,175,234,243,0,63,208,235,26,8,180,28,41,-40,25,119,235,172,179,226,74,76,12,46,25,65,187,248,242,221,187,209,205,-90,184,172,245,1,90,195,76,199,223,223,182,150,110,247,205,99,119,65,70,-7,79,76,121,187,220,9,54,85,182,16,80,241,109,21,0,183,97,72,56,-70,235,80,83,172,237,97,90,110,114,169,67,151,87,162,117,226,195,100,104,-2,8,218,162,121,33,180,63,249,194,97,87,8,49,178,242,58,226,163,237,-89,49,28,207,32,220,144,87,19,103,26,82,45,153,52,150,182,197,139,10,-48,18,61,163,230,250,6,61,231,184,165,129,111,197,228,186,178,202,242,117,-63,214,54,110,155,149,208,150,158,120,11,150,202,137,234,110,197,199,86,211,-197,27,212,43,197,110,17,122,135,57,7,210,56,241,125,164,132,110,37,141,-138,204,39,110,206,161,195,108,116,173,229,133,140,104,151,197,151,43,223,55,-18,234,35,48,250,159,167,24,160,168,203,232,201,240,179,54,139,102,139,178,-2,207,57,197,95,99,215,193,16,79,217,231,6,37,198,226,102,68,58,143,-233,88,160,100,14,8,110,56,139,16,229,4,118,71,203,51,206,32,58,131,-117,246,14,166,148,231,188,61,132,103,244,99,163,125,131,198,50,148,168,244,-217,4,225,135,74,114,248,97,154,136,123,132,234,94,167,156,164,3,24,54,-15,119,139,183,45,134,61,127,108,6,193,178,202,76,202,195,201,148,213,142,-120,50,212,215,202,221,105,197,94,115,102,38,206,253,110,118,213,83,104,188,-16,149,151,37,134,169,88,110,15,127,32,230,254,25,111,200,226,84,191,173,-218,235,147,239,13,30,96,59,252,122,91,67,206,26,27,233,223,134,153,72,-136,15,85,61,164,121,110,100,17,153,233,255,57,178,36,87,0,32,175,144,-237,100,110,108,98,149,55,57,46,170,243,103,247,249,118,78,26,157,140,21,-191,14,173,68,213,204,159,52,170,54,123,33,39,125,108,106,25,235,17,137,-240,7,243,126,6,100,223,48,107,193,201,205,20,134,27,112,244,189,132,103,-215,104,23,194,15,113,10,93,217,197,211,10,59,1,180,161,71,178,110,178,-31,66,49,18,124,153,4,233,150,26,142,231,17,26,194,210,206,186,15,101,-76,159,115,135,175,186,122,234,36,85,99,45,75,46,6,118,38,143,74,91,-211,153,80,204,16,40,249,228,13,26,137,179,66,145,0,94,119,144,213,227,-118,135,138,13,89,244,174,78,21,21,206,165,24,115,46,131,245,109,229,170,-168,61,114,214,181,77,80,39,148,195,157,171,48,242,177,239,155,179,223,33,-61,171,97,161,42,127,110,55,176,230,124,199,67,118,92,75,60,49,208,43,-119,133,95,232,123,137,89,37,102,169,177,202,200,179,46,111,163,88,49,26,-84,129,147,123,112,114,174,196,242,171,96,78,99,41,227,90,135,84,97,149,-53,8,200,200,7,119,196,49,57,68,118,29,228,29,59,179,192,176,36,248,-18,53,173,72,58,4,20,200,240,182,79,95,254,117,169,212,88,22,214,135,-47,130,125,12,27,39,95,116,153,170,150,86,136,210,173,193,223,213,15,226,-0,225,63,249,113,12,205,171,6,69,53,137,17,66,122,115,118,168,198,95,-225,203,219,212,44,14,226,143,222,225,81,178,166,195,56,26,212,6,155,30,-216,113,158,253,43,110,151,65,77,162,108,96,126,84,86,103,253,88,221,206,-51,99,206,85,99,63,153,238,101,150,68,144,244,87,114,103,22,190,200,121,-81,131,70,239,123,102,140,58,243,55,233,191,18,234,63,253,198,70,33,206,-139,119,13,97,61,12,5,134,38,74,209,131,143,201,24,154,19,171,137,103,-63,56,32,152,141,208,35,53,188,242,15,13,151,170,151,52,103,129,204,204,-75,65,19,85,42,7,224,49,1,65,84,13,157,238,132,68,10,252,148,19,-79,209,255,255,93,186,120,255,88,25,30,199,163,49,195,150,45,131,125,129,-25,127,128,214,253,11,113,224,221,93,208,238,214,43,252,6,6,59,162,156,-255,23,233,184,108,220,1,246,99,39,202,255,185,161,24,142,125,59,92,248,-23,25,45,221,123,6,115,219,43,86,53,7,74,240,128,90,2,203,143,235,-14,169,86,113,196,121,43,147,55,23,153,202,110,232,68,74,107,109,190,198,-205,162,81,177,233,68,119,13,51,216,116,187,211,63,248,31,37,172,241,67,-55,124,241,190,217,187,83,118,0,95,62,231,183,202,102,12,245,176,49,146,-52,52,157,238,164,127,73,153,10,243,244,120,157,190,116,154,47,240,115,192,-210,183,4,139,196,48,94,186,195,234,154,142,158,216,246,29,66,132,116,65,-202,208,84,113,28,62,48,50,132,200,204,247,114,225,239,117,153,174,205,130,-156,116,217,223,10,222,126,106,3,145,136,81,118,74,245,204,155,137,21,33,-24,185,180,31,109,116,86,43,193,91,6,45,93,176,92,119,145,96,66,215,-249,217,215,9,197,91,163,184,29,33,104,27,164,195,4,5,77,190,255,92,-213,120,135,138,82,167,184,255,77,132,209,171,144,222,56,114,132,27,179,165,-30,223,221,11,107,5,211,204,63,80,116,83,218,245,199,44,187,251,67,151,-209,94,217,62,104,24,195,20,126,8,251,191,182,112,165,222,135,98,240,142,-19,28,200,123,19,168,142,76,44,128,255,1,245,219,235,66,212,209,91,237,-123,115,2,249,53,55,148,112,133,134,247,227,102,22,119,247,247,141,25,154,-208,131,220,67,27,74,129,46,131,77,127,152,216,124,246,13,52,25,150,73,-187,171,229,176,194,190,144,245,86,53,84,44,138,253,165,45,226,19,33,86,-29,43,92,45,49,133,124,16,192,169,96,132,73,58,194,212,254,105,203,210,-101,106,188,175,194,33,0,207,27,140,32,90,34,26,123,165,137,63,150,12,-20,180,196,84,117,171,154,232,226,111,209,218,7,227,76,159,108,123,28,223,-94,206,66,181,93,145,97,100,252,119,199,198,61,40,30,49,192,57,114,149,-178,140,39,179,16,166,123,184,83,166,168,212,164,36,104,151,76,34,168,219,-38,163,216,140,238,116,53,130,226,126,242,90,220,207,240,173,51,13,218,102,-16,210,139,55,47,226,21,81,202,95,74,184,208,101,157,24,67,187,118,83,-188,206,68,146,194,255,132,120,105,147,84,106,226,102,103,103,88,156,39,98,-1,251,62,59,200,233,25,239,192,101,183,189,226,206,144,134,105,153,232,255,-177,94,171,33,24,182,79,232,30,26,109,132,80,190,121,187,192,25,47,234,-206,4,144,6,18,24,143,4,45,85,59,42,42,142,33,172,2,51,212,208,-144,18,41,18,92,4,142,37,67,129,103,12,221,190,144,172,217,175,185,121,-62,49,195,68,71,175,144,249,2,251,215,166,193,219,251,91,111,176,33,199,-96,176,231,14,184,192,100,122,141,97,220,198,170,197,43,197,201,194,65,199,-133,137,6,117,54,38,137,85,142,61,32,129,127,37,195,106,76,43,226,222,-226,54,225,205,185,130,146,213,73,121,232,141,164,218,181,67,88,128,143,27,-208,195,222,196,250,158,185,200,27,213,63,219,57,234,244,66,2,195,173,125,-116,208,26,232,209,238,86,111,229,104,36,174,185,80,39,220,24,71,80,81,-168,20,0,216,117,65,232,105,106,233,156,37,98,235,138,182,225,88,24,152,-36,29,46,186,211,213,197,153,136,245,97,25,223,43,135,253,152,152,41,206,-0,245,27,237,106,218,96,65,35,154,81,84,51,245,73,124,254,157,212,153,-41,48,241,76,208,155,17,30,206,122,140,35,7,41,37,251,172,197,30,8,-87,175,245,220,203,130,128,109,25,101,239,219,54,56,71,21,210,181,31,134,-72,155,249,50,67,61,255,33,107,54,218,116,101,226,48,255,194,190,77,236,-150,253,57,135,37,42,238,129,226,150,164,146,248,138,250,153,160,240,156,78,-238,151,226,198,138,84,113,35,144,18,250,77,187,147,17,36,14,123,168,203,-216,251,137,30,160,34,174,91,54,225,56,58,150,252,12,5,237,135,199,163,-99,232,112,134,107,234,232,120,205,121,245,98,194,242,143,29,128,122,37,96,-112,8,184,47,198,101,255,111,169,222,152,121,246,170,187,105,171,132,211,60,-173,223,218,169,26,105,222,147,150,239,135,9,94,204,125,92,145,170,82,97,-79,248,228,197,229,142,244,110,82,37,176,154,244,74,233,106,72,55,207,130,-56,16,162,49,138,222,236,96,174,72,246,247,204,154,255,252,160,233,251,175,-66,39,213,85,241,42,51,219,16,34,77,97,156,108,246,12,243,227,239,101,-75,38,204,57,34,171,65,134,79,238,208,87,34,184,190,0,5,169,31,236,-243,163,18,122,35,106,89,137,167,75,254,189,37,89,22,51,136,20,57,93,-11,70,30,245,233,199,214,135,120,196,251,16,128,49,126,4,213,118,50,163,-237,231,153,32,227,247,227,67,198,182,119,7,137,44,2,113,68,155,36,103,-77,158,73,142,248,153,26,116,250,174,149,44,171,136,229,244,154,230,145,127,-224,218,121,1,253,76,208,36,196,179,101,146,0,146,131,21,97,34,2,7,-75,27,6,206,243,46,71,102,66,182,192,54,120,26,131,198,161,9,102,129,-87,140,216,68,252,120,61,231,40,112,208,62,250,155,200,30,128,121,75,208,-177,108,44,52,72,68,49,181,206,52,93,180,60,78,74,250,195,210,143,120,-104,152,247,149,186,207,111,81,145,245,33,75,245,64,175,52,91,219,218,52,-11,201,23,70,172,17,189,2,168,49,16,186,123,178,220,116,164,98,251,143,-23,3,146,156,239,39,179,71,17,45,52,208,135,227,87,248,250,98,96,130,-28,36,49,16,163,131,94,22,7,62,241,74,112,161,47,211,251,119,140,192,-91,70,229,80,131,112,141,15,212,0,30,6,124,79,108,251,38,122,147,235,-91,250,163,55,195,119,217,104,108,67,20,59,176,13,147,0,41,85,139,104,-141,64,214,12,75,230,6,208,220,31,149,28,178,108,77,93,174,185,87,179,-225,74,160,250,20,44,6,196,153,218,204,67,126,198,250,196,70,103,91,163,-248,221,67,186,44,222,163,26,143,137,177,250,172,151,105,58,45,188,9,116,-193,252,88,113,82,158,229,88,202,73,24,71,253,249,138,225,222,57,135,188,-160,236,224,240,210,223,15,55,18,253,61,75,227,171,7,10,205,230,169,220,-165,69,230,195,4,177,207,59,184,124,172,65,114,145,23,140,153,197,175,76,-16,47,223,59,118,164,189,226,126,249,21,142,210,252,218,230,19,140,41,232,-247,69,7,178,71,232,197,215,206,21,207,93,105,18,159,9,110,75,220,253,-197,226,254,214,211,181,219,146,117,230,14,34,72,124,27,22,225,29,111,62,-226,76,96,46,49,101,33,97,211,217,121,237,87,143,33,213,63,110,171,111,-120,127,195,187,116,42,131,207,63,152,143,103,7,147,180,113,208,35,135,69,-176,151,151,210,250,212,221,35,66,124,99,64,51,26,116,78,37,255,211,247,-13,218,82,34,126,170,15,62,203,102,74,184,230,80,26,131,92,23,252,76,-179,52,240,14,45,175,196,253,198,165,253,197,9,167,37,233,53,69,89,173,-159,117,2,48,47,104,227,204,197,135,47,26,71,150,21,2,198,239,163,250,-201,212,158,110,81,111,204,105,168,6,4,233,152,104,254,111,184,184,70,230,-178,57,181,135,146,205,11,149,179,1,225,47,80,253,250,17,171,248,50,85,-226,82,243,170,90,211,16,0,82,103,209,158,158,89,75,41,86,169,155,131,-172,242,84,120,3,38,119,105,148,248,167,15,31,18,230,232,27,111,66,66,-45,108,197,119,178,2,43,229,226,133,94,30,174,124,238,249,72,26,90,90,-120,69,183,219,191,188,74,200,103,155,9,156,227,67,230,152,26,66,244,225,-173,144,202,60,3,66,112,1,232,68,222,249,231,18,126,78,217,221,73,251,-155,98,79,252,86,81,85,135,213,228,148,7,102,49,209,128,33,6,21,117,-218,198,42,17,116,80,35,238,221,6,50,19,95,127,234,137,119,202,144,67,-223,216,71,10,191,142,239,46,78,11,191,147,247,246,90,62,230,114,253,147,-220,242,34,191,42,89,11,248,103,95,21,61,188,128,44,201,146,184,186,3,-123,220,53,144,215,86,58,111,154,227,162,54,14,69,133,249,59,31,85,236,-103,224,51,206,150,161,38,63,216,77,255,56,103,117,37,67,88,240,144,204,-182,68,60,63,195,248,188,212,73,161,72,250,147,129,15,6,206,175,181,147,-135,67,245,8,55,158,70,124,43,192,250,177,83,250,76,205,51,172,150,43,-117,77,137,181,43,60,252,110,86,246,218,39,33,125,58,5,123,183,5,205,-38,113,40,225,28,194,226,79,224,228,105,230,134,54,124,88,163,54,19,196,-168,140,56,233,48,114,11,23,5,207,79,144,172,119,39,31,194,50,18,21,-77,190,118,132,78,203,164,162,191,29,103,10,111,110,19,251,58,158,226,192,-4,53,247,159,208,42,96,124,52,113,106,148,63,174,140,68,177,100,176,74,-81,76,233,21,110,136,15,190,239,45,91,135,158,207,200,200,10,47,17,24,-139,103,113,0,223,184,100,115,86,88,182,138,124,128,111,205,198,90,215,232,-30,62,246,117,170,89,255,177,68,79,59,217,61,13,157,45,102,161,72,34,-44,176,86,3,5,184,225,198,17,9,143,168,15,29,202,47,54,254,187,212,-181,34,133,253,136,40,154,191,32,196,55,99,57,116,117,111,42,3,177,178,-143,241,226,25,139,41,22,220,55,142,103,153,226,204,229,32,215,114,99,100,-50,242,200,26,111,229,215,102,20,40,4,50,54,241,91,36,87,127,243,189,-153,137,106,250,174,210,151,115,121,150,84,190,202,34,33,30,209,62,96,38,-97,213,58,198,194,168,254,152,162,223,7,255,92,238,144,139,217,166,114,209,-107,81,93,3,17,159,226,8,179,22,7,204,19,211,86,173,173,198,221,138,-127,94,168,14,129,114,185,79,221,231,217,251,113,158,252,126,210,231,103,14,-234,112,103,205,19,158,176,34,55,162,4,163,157,203,116,171,101,216,219,131,-82,248,240,225,220,103,122,55,209,154,129,64,116,8,67,92,178,111,200,51,-230,50,67,48,2,73,93,173,218,161,5,247,181,139,191,170,189,205,250,117,-165,136,146,101,156,77,74,85,142,28,122,83,189,125,57,84,168,235,146,208,-159,59,143,174,30,144,213,112,235,25,22,54,99,150,9,250,201,254,195,201,-237,58,99,206,55,118,106,17,10,196,176,41,85,218,154,67,146,91,70,207,-239,172,189,204,190,6,227,227,219,133,47,127,133,110,92,209,179,140,46,134,-188,205,121,111,234,185,187,223,80,238,149,189,152,12,112,5,188,235,247,242,-203,111,189,212,74,218,4,59,29,56,36,34,199,165,111,113,216,201,231,167,-21,3,82,37,196,68,90,176,43,48,49,142,85,160,42,75,45,170,209,95,-197,198,209,73,15,115,90,213,50,47,215,125,247,28,81,242,37,69,36,248,-128,126,53,168,168,226,78,209,184,121,44,185,147,87,58,28,61,62,31,139,-251,190,89,44,106,243,117,125,44,220,208,58,64,123,114,233,235,2,77,143,-92,220,146,243,186,3,52,145,54,179,34,11,7,14,68,225,214,189,23,111,-87,53,113,245,145,47,224,3,137,209,220,54,119,181,131,40,25,170,198,91,-166,24,238,22,66,246,240,109,98,230,186,79,110,209,69,89,238,55,51,212,-136,201,253,136,91,112,10,185,106,119,106,196,203,187,132,164,119,142,41,70,-134,253,67,145,41,52,210,74,174,255,45,242,216,75,102,210,81,208,223,225,-61,245,163,216,83,37,133,155,154,95,130,212,14,128,125,127,3,242,196,229,-223,185,128,228,248,72,213,250,178,126,50,226,183,60,118,207,206,9,128,253,-117,177,188,207,2,48,255,171,27,234,33,230,3,170,55,48,135,45,164,178,-5,35,116,86,37,124,224,238,150,110,54,97,87,21,36,191,55,230,232,213,-55,151,190,22,157,247,200,242,255,166,212,231,152,179,157,245,92,208,166,79,-207,106,195,133,123,72,186,18,177,14,98,0,189,108,149,118,78,56,66,128,-235,29,200,14,88,158,102,193,142,243,1,239,186,227,226,174,35,1,74,4,-251,232,104,142,208,78,102,57,174,180,123,170,192,217,191,78,26,122,44,127,-162,43,23,143,164,169,85,129,194,141,169,212,155,136,109,234,59,170,112,97,-14,92,220,217,119,234,128,38,63,227,8,227,200,95,108,199,222,233,115,189,-232,218,227,170,251,105,172,113,164,196,138,12,77,19,101,108,195,166,97,40,-78,169,94,104,94,99,200,235,232,209,56,32,39,233,5,191,39,149,159,18,-150,131,183,17,30,195,190,254,157,155,216,51,90,162,42,168,76,35,74,159,-174,79,41,156,232,8,122,17,10,76,29,79,244,45,229,184,189,105,199,247,-188,57,30,227,120,214,11,155,250,56,226,109,244,197,41,115,95,208,105,108,-75,171,144,97,181,226,19,158,175,225,55,43,160,148,145,3,42,53,61,192,-243,99,13,219,33,192,247,71,96,116,137,92,214,217,175,134,37,171,2,66,-163,77,175,160,205,5,110,236,171,22,85,195,90,239,230,195,88,156,61,92,-91,250,197,15,82,133,202,240,55,230,174,57,165,77,11,227,112,251,3,252,-229,197,208,136,112,82,35,2,172,129,153,207,184,63,71,244,115,26,50,70,-3,90,199,49,210,194,2,153,246,114,102,248,172,214,85,138,184,191,87,5,-25,93,135,236,91,217,119,112,69,48,41,51,94,73,235,37,133,233,6,8,-186,63,184,241,215,225,47,49,199,172,65,70,165,141,92,176,190,13,186,7,-112,146,6,248,99,141,19,84,182,100,220,138,77,218,255,255,191,140,235,9,-88,52,32,178,254,16,21,129,64,131,153,54,173,143,225,196,68,64,116,221,-191,254,39,70,172,27,1,51,252,126,192,11,164,193,30,231,192,30,29,197,-41,208,32,178,173,106,27,247,252,130,50,25,42,70,176,159,255,155,64,227,-73,14,63,104,252,243,241,116,98,155,204,210,107,239,184,126,200,168,209,91,-59,10,212,226,129,17,224,48,0,-};-const unsigned char *combexpr = data;-const int combexprlen = 27829;+122,76,90,51,93,0,0,0,1,0,59,14,65,195,100,94,23,118,51,121,+204,76,135,14,47,30,252,200,100,113,208,115,103,47,15,63,156,201,27,147,+12,237,251,144,98,109,106,180,245,21,172,2,127,128,73,41,150,53,56,30,+92,157,62,45,216,86,176,28,158,103,86,255,89,56,59,189,118,72,253,86,+13,225,91,184,107,2,25,30,111,238,209,39,114,84,174,22,64,186,156,7,+54,101,36,91,195,123,102,188,54,61,100,231,28,50,10,104,113,109,230,70,+238,164,54,58,219,17,229,38,24,40,219,250,13,119,105,18,233,209,145,14,+115,241,74,252,43,255,194,111,196,113,204,55,67,140,184,82,147,73,89,116,+128,62,37,238,210,83,97,206,182,19,53,189,231,136,21,2,247,42,165,90,+21,58,178,202,179,142,125,232,232,125,86,198,241,146,115,185,170,140,200,130,+96,215,53,148,215,209,168,221,207,194,107,165,128,87,168,127,212,251,142,112,+88,14,26,102,120,56,35,13,85,24,226,113,198,97,23,96,235,38,48,141,+124,230,237,246,126,191,7,112,110,208,85,20,236,175,34,46,63,226,28,220,+87,109,9,36,148,74,80,96,223,215,169,249,157,230,68,140,6,45,39,5,+76,230,93,219,175,76,239,34,156,23,70,117,0,47,20,65,209,168,172,15,+96,65,41,89,30,204,219,231,103,12,91,211,0,83,224,177,101,82,248,212,+99,237,63,87,71,201,159,61,81,209,113,17,97,250,1,38,251,206,10,154,+200,120,114,9,17,69,250,190,11,140,43,138,187,58,47,48,165,130,175,194,+68,174,230,14,240,81,119,251,203,44,41,224,218,200,236,213,181,117,248,64,+229,11,82,238,100,241,72,22,12,28,107,244,231,231,4,244,46,181,41,238,+197,145,52,144,93,75,220,213,101,152,196,229,84,47,52,248,77,36,80,237,+105,166,34,218,145,69,108,42,214,199,209,130,69,144,173,173,116,17,223,105,+122,21,191,187,181,156,48,214,187,255,77,92,179,94,112,84,87,133,215,147,+16,9,147,105,210,234,30,134,57,116,240,7,235,231,234,171,104,168,182,108,+207,172,252,110,47,194,173,69,27,117,28,200,218,246,105,34,225,120,234,152,+127,65,4,130,236,23,160,71,2,200,17,88,236,151,110,124,225,127,208,231,+182,31,247,2,110,1,126,74,117,243,145,235,190,93,232,175,175,63,62,77,+178,56,72,180,99,168,172,28,42,87,52,48,61,191,66,156,35,0,220,154,+238,113,6,181,90,163,226,14,2,144,25,28,98,123,80,129,165,101,57,101,+69,12,100,76,218,36,245,144,241,120,28,4,135,11,156,81,97,12,247,63,+80,95,152,161,95,17,212,50,185,17,163,90,230,66,76,31,10,87,149,75,+31,117,235,38,17,141,73,140,51,12,53,181,165,150,7,192,182,218,112,90,+120,217,239,236,59,244,198,171,212,23,38,20,242,182,114,181,242,214,107,5,+129,49,6,37,205,181,238,233,191,76,113,58,169,101,121,209,54,137,31,244,+132,155,1,238,198,95,29,11,63,10,166,143,242,71,50,32,32,138,108,200,+19,55,60,236,149,107,63,45,124,86,203,57,133,137,125,228,125,42,83,192,+182,78,10,219,22,207,244,72,163,236,48,179,31,215,171,213,157,15,89,35,+21,219,45,213,142,63,222,92,52,198,2,38,142,73,190,124,205,250,166,87,+166,3,87,84,202,197,151,17,71,217,72,134,100,195,134,45,174,193,22,88,+41,13,106,143,8,88,223,141,65,197,37,252,225,49,66,70,56,169,123,83,+44,228,176,233,240,11,14,233,98,209,140,194,55,134,147,91,172,170,207,143,+152,176,83,24,64,225,107,242,32,10,46,51,205,50,79,218,154,161,60,114,+255,94,130,144,184,131,180,252,169,106,35,186,26,248,46,167,8,195,185,84,+204,15,27,65,169,112,197,115,134,48,188,66,190,232,16,227,23,162,99,165,+167,233,211,94,112,222,169,114,225,40,143,77,186,160,43,47,160,184,184,44,+117,69,175,166,236,206,11,185,161,122,44,76,155,146,225,243,236,95,52,214,+49,28,191,83,52,36,57,234,234,107,76,230,108,6,71,191,199,8,113,204,+83,86,177,241,129,110,194,190,101,12,181,29,190,244,43,252,246,122,119,45,+219,163,167,168,44,179,10,83,12,138,178,44,50,32,110,0,227,190,173,148,+218,186,115,23,183,146,40,93,168,8,163,5,31,50,99,187,33,11,157,112,+26,5,169,199,182,38,105,220,44,193,95,22,43,156,160,33,219,121,160,241,+246,25,162,74,32,129,54,215,59,251,58,244,218,251,118,155,209,149,107,121,+84,30,4,92,79,1,203,52,162,223,40,17,157,18,99,207,234,201,125,132,+57,32,169,177,89,154,192,213,34,69,13,112,171,106,144,147,109,87,47,185,+199,81,143,107,201,159,247,40,48,253,62,48,173,40,137,32,59,190,184,191,+53,167,213,157,121,40,212,190,89,240,252,87,3,125,92,224,108,53,160,104,+42,133,101,212,145,93,179,155,165,33,162,181,25,24,252,24,58,8,245,79,+117,108,153,216,13,140,169,41,118,123,218,136,73,162,115,15,222,163,14,125,+28,59,56,254,152,132,81,111,0,169,52,106,254,110,235,108,11,54,232,133,+196,4,49,227,81,245,102,215,117,220,255,183,143,216,52,180,39,184,19,74,+149,5,0,109,222,23,15,67,144,152,89,100,233,233,103,38,222,172,100,94,+180,184,122,75,1,102,179,165,169,122,240,130,164,182,14,135,147,30,93,179,+134,228,154,122,230,217,162,189,194,135,1,229,24,80,30,166,90,54,174,205,+11,157,86,234,28,113,111,190,168,134,209,41,6,87,179,229,226,239,29,22,+78,58,150,33,128,132,8,142,203,23,178,123,68,11,167,156,127,69,139,122,+88,131,96,197,43,9,63,111,17,177,37,210,168,202,154,106,118,244,24,79,+60,232,165,89,47,59,175,175,86,41,183,11,236,139,153,12,79,105,47,196,+213,114,213,72,204,152,217,180,20,26,234,19,11,77,210,217,217,247,157,228,+240,183,102,117,179,5,178,247,234,108,180,254,129,62,197,3,185,88,232,175,+63,152,203,26,118,178,136,26,204,138,101,25,88,222,105,251,147,87,28,61,+173,255,111,170,11,154,231,30,243,41,226,128,254,193,187,134,56,119,201,1,+180,207,221,197,90,48,15,9,222,225,7,233,185,186,104,134,225,226,48,172,+199,100,154,201,85,225,56,141,100,200,141,41,149,103,89,160,30,15,175,39,+20,225,69,254,216,94,128,130,166,77,117,28,206,84,39,130,72,227,242,162,+82,81,249,107,215,217,211,162,110,15,141,132,191,97,19,56,138,161,112,120,+73,62,135,235,233,229,53,234,95,212,202,191,238,174,73,54,247,159,158,213,+28,187,53,33,106,163,219,213,219,109,179,109,113,65,74,223,252,16,194,175,+227,191,165,251,29,21,0,196,220,99,186,178,12,122,254,163,52,237,139,218,+189,10,64,35,211,46,160,60,78,24,114,45,172,113,196,90,138,33,61,221,+252,80,118,26,102,230,144,96,100,158,74,82,174,211,7,154,15,3,37,65,+44,14,220,227,127,234,223,131,5,198,103,248,216,114,149,55,180,243,97,238,+33,70,98,221,125,95,108,30,98,238,45,149,0,112,131,225,101,168,109,101,+63,4,32,229,32,78,79,124,42,164,18,255,112,89,26,247,4,158,155,35,+151,184,216,205,23,8,213,147,126,46,40,158,1,199,149,115,68,15,79,17,+85,229,90,190,107,10,104,202,249,255,22,204,171,96,245,217,245,118,116,236,+237,72,156,137,167,87,42,55,37,107,168,195,97,1,78,208,176,227,139,3,+72,180,27,14,180,192,98,191,176,22,74,75,163,250,120,1,251,174,14,240,+20,210,217,184,250,24,170,167,96,43,218,158,14,217,54,69,15,200,134,60,+204,4,241,3,44,13,18,67,243,40,173,37,127,126,39,145,60,252,247,122,+43,220,254,77,242,177,160,19,202,28,95,105,68,89,150,44,144,114,134,161,+164,81,82,172,92,141,53,120,186,243,28,69,72,75,141,159,242,41,89,127,+58,12,236,149,70,71,119,126,78,77,209,137,191,221,198,252,104,156,21,159,+134,2,241,120,192,227,151,227,151,51,88,189,153,50,80,8,10,147,45,108,+104,114,35,224,1,152,128,73,212,1,71,152,164,110,231,219,98,129,252,155,+240,197,221,79,42,64,249,120,118,101,214,248,202,196,224,97,168,12,88,138,+217,23,83,119,204,197,163,6,9,199,144,166,41,5,226,100,245,76,190,255,+84,185,223,151,86,71,191,42,164,248,151,186,51,212,184,17,139,204,63,230,+229,216,206,194,144,42,101,239,218,42,73,94,10,60,249,17,178,75,182,114,+254,50,154,72,216,90,41,143,32,147,71,78,168,227,72,10,98,119,177,27,+250,142,41,13,152,105,168,114,32,6,190,167,230,123,243,254,212,87,149,18,+221,133,200,49,184,165,50,70,255,114,203,114,69,54,127,135,137,115,239,131,+199,53,166,49,164,245,113,31,232,27,38,84,149,59,122,252,207,223,34,231,+120,154,14,248,24,139,168,152,151,162,162,192,41,120,45,6,218,96,117,186,+222,112,228,31,122,243,156,214,150,25,37,131,216,66,126,137,67,32,85,107,+155,14,226,99,77,205,3,226,28,96,195,32,191,194,48,102,199,110,29,32,+248,205,86,51,142,173,244,180,37,52,93,68,107,215,154,194,225,166,75,213,+23,43,13,141,24,5,176,164,175,56,159,160,121,255,136,210,17,152,67,50,+114,65,59,43,13,69,120,240,226,165,247,22,70,117,191,192,127,211,153,211,+243,246,236,65,26,223,221,230,186,93,52,219,50,56,148,60,43,183,53,66,+204,250,99,159,125,223,63,24,29,197,77,222,56,170,36,229,38,172,18,166,+204,130,44,82,220,35,149,251,94,63,69,216,99,166,49,51,109,53,73,52,+117,176,167,103,213,36,73,152,165,129,233,228,155,189,152,39,164,238,7,39,+140,185,208,56,48,88,159,25,139,52,69,141,161,100,163,77,69,39,71,111,+244,174,190,86,30,185,174,100,152,221,28,147,93,77,147,5,93,240,113,9,+54,192,12,120,178,44,230,81,189,14,164,141,90,201,233,81,115,188,135,162,+58,56,82,167,182,215,162,87,219,199,80,102,67,107,138,43,170,94,237,67,+33,5,45,7,211,238,197,83,94,131,29,72,26,213,45,233,53,1,77,201,+213,247,203,104,253,230,181,129,96,122,132,79,21,254,65,4,128,159,229,27,+197,43,246,154,203,158,224,106,2,164,127,254,56,79,235,71,204,31,50,189,+58,251,104,219,169,117,19,44,223,246,117,251,249,126,79,127,139,164,146,113,+95,246,170,56,18,20,248,121,34,20,162,9,41,84,193,23,236,231,55,38,+68,245,170,122,164,136,85,55,242,154,187,39,157,171,169,21,233,19,39,213,+53,211,68,8,45,61,247,46,92,76,138,156,9,153,208,117,43,135,187,114,+110,29,199,136,73,166,90,96,22,37,94,27,249,48,248,161,209,222,200,59,+238,6,51,110,85,56,223,240,188,163,114,95,188,168,174,25,137,253,230,220,+156,91,197,60,98,50,145,13,223,254,195,160,89,148,249,28,18,225,219,13,+148,11,18,117,8,72,44,225,2,156,74,116,252,171,211,227,122,225,184,77,+65,213,121,81,213,199,141,45,253,20,249,123,219,154,225,168,235,119,91,115,+28,137,43,103,147,188,87,47,151,244,166,79,42,173,41,20,95,104,255,172,+66,3,173,133,20,5,50,195,199,71,180,238,61,218,231,185,109,187,248,225,+158,249,126,166,27,61,163,105,223,138,155,13,146,12,96,68,229,18,180,203,+83,63,124,48,229,49,46,44,60,102,117,98,233,182,21,138,101,89,78,251,+128,176,64,93,74,186,186,124,216,125,179,247,76,165,9,117,23,32,253,220,+5,200,128,197,82,166,132,73,139,112,166,125,144,145,82,132,85,229,213,77,+103,62,150,79,147,191,25,253,146,144,64,233,69,218,224,223,96,202,189,204,+109,186,185,112,146,79,11,13,150,2,119,86,57,211,191,251,44,157,47,171,+231,18,162,110,30,203,9,88,245,52,59,23,237,10,189,23,208,11,199,136,+23,57,187,2,155,219,204,74,89,16,50,172,123,254,229,145,239,53,158,228,+120,186,37,232,220,240,228,213,238,113,102,205,255,73,234,83,214,196,226,214,+223,97,152,171,214,127,221,9,7,202,214,45,230,98,180,135,16,196,223,90,+38,168,169,98,7,40,210,92,137,189,75,8,181,156,1,254,213,91,124,158,+130,3,209,2,229,1,52,175,25,144,217,53,231,92,137,213,198,89,17,1,+219,236,16,203,231,47,249,45,50,107,18,18,125,249,100,223,238,243,59,27,+34,228,232,195,241,28,115,96,153,73,90,9,253,237,232,212,50,72,162,156,+242,167,32,241,1,196,251,34,255,105,205,40,68,229,137,40,19,95,103,110,+93,3,250,196,166,41,59,68,90,64,80,102,162,69,165,235,196,81,96,53,+6,22,63,85,178,55,79,66,207,33,68,76,172,219,78,37,110,230,217,84,+80,193,19,1,255,187,20,158,84,141,215,139,205,248,181,162,124,227,255,174,+34,215,170,33,201,63,125,141,102,70,184,58,136,246,171,164,85,174,218,51,+63,36,226,209,142,211,76,191,130,86,118,4,102,203,15,13,48,242,221,86,+228,91,247,77,177,156,233,127,19,173,206,15,247,107,7,203,172,43,67,165,+130,137,121,62,116,209,51,8,203,143,182,81,31,10,57,179,129,27,196,224,+42,104,201,16,141,251,9,221,7,20,68,89,238,178,198,182,104,106,218,90,+61,83,21,6,198,155,204,4,216,240,235,120,156,181,94,77,7,92,252,120,+115,53,219,29,103,154,244,149,36,63,133,43,2,103,210,211,55,42,103,203,+56,141,28,198,67,126,98,36,139,101,29,59,248,62,152,8,43,84,244,18,+41,85,46,76,220,106,202,251,255,178,208,117,240,131,211,220,9,209,100,235,+81,32,36,42,11,7,190,54,252,4,166,184,198,194,86,237,88,86,205,249,+237,150,65,119,153,45,183,87,253,81,112,3,245,232,75,202,160,184,48,183,+11,232,189,113,85,162,72,73,4,114,89,217,194,127,31,64,104,24,29,56,+106,0,165,89,126,11,55,145,49,205,235,188,26,107,183,111,36,213,146,37,+146,178,188,110,64,6,136,233,250,168,141,7,247,232,76,16,38,213,152,246,+136,201,138,95,235,182,161,170,210,237,240,133,175,7,161,219,1,59,144,57,+231,102,40,6,236,200,188,86,151,91,166,87,191,105,94,128,91,171,130,78,+46,94,100,37,240,253,243,47,124,203,131,142,163,237,50,241,24,112,149,172,+172,179,123,30,169,194,191,36,182,225,162,248,187,197,84,103,156,111,241,122,+109,239,22,9,165,106,214,230,217,86,21,52,208,119,183,216,167,68,236,139,+139,206,208,28,12,45,135,74,210,26,112,243,201,148,50,242,86,36,95,91,+172,115,220,183,78,153,42,197,28,125,45,74,249,124,91,6,62,2,229,214,+113,66,243,246,151,135,128,225,49,40,243,72,191,118,207,42,54,89,90,165,+186,62,155,215,200,3,121,102,4,51,202,50,66,146,201,134,251,196,139,35,+213,101,175,90,111,21,23,28,3,163,0,38,167,213,170,93,89,39,250,150,+117,83,214,119,31,155,223,42,215,19,34,149,228,90,124,183,167,159,170,244,+169,253,154,190,217,214,4,75,28,157,225,185,87,44,72,143,162,187,96,117,+40,131,138,3,214,9,85,243,247,216,207,209,252,49,210,46,156,123,175,41,+103,95,231,152,153,173,47,51,105,127,242,243,221,211,118,8,64,175,64,43,+205,78,8,214,104,246,162,239,108,164,52,73,145,59,225,61,48,170,201,86,+174,172,16,36,146,113,191,95,63,122,251,23,150,78,179,165,59,60,247,14,+55,23,177,115,248,70,230,180,113,49,136,60,41,228,174,122,130,85,224,153,+14,149,30,103,80,99,60,10,9,254,21,157,76,128,224,230,182,218,36,230,+5,51,179,177,35,133,170,219,80,94,164,63,196,100,13,167,226,39,9,88,+166,168,80,82,131,164,121,77,249,219,90,206,12,83,51,139,75,4,28,120,+178,40,174,7,200,89,140,188,97,6,145,72,58,103,194,50,8,161,207,118,+188,43,89,222,34,206,185,153,66,153,134,93,187,59,214,208,124,192,134,10,+31,207,81,172,189,49,71,163,17,249,244,158,23,220,236,25,121,160,119,214,+182,141,233,209,136,38,190,13,88,160,19,138,83,229,4,140,253,80,199,80,+81,57,248,31,93,222,97,231,99,187,106,254,119,71,162,51,94,169,90,155,+144,41,209,18,61,13,212,4,119,156,125,40,181,241,183,137,43,191,204,19,+243,120,72,162,103,207,236,216,134,29,213,247,56,17,231,198,243,61,139,225,+93,88,238,127,148,169,135,193,13,151,105,245,10,211,250,45,195,0,201,207,+52,70,72,110,171,76,23,85,251,180,138,201,214,254,205,236,71,215,111,102,+63,246,221,176,61,20,140,39,146,252,228,87,191,5,169,73,39,216,76,35,+89,80,37,198,155,16,31,61,72,80,132,218,211,230,176,104,8,61,251,79,+189,148,59,95,159,81,157,227,85,135,96,177,81,129,153,199,102,159,154,179,+110,117,30,100,107,151,128,97,0,114,19,40,143,72,13,12,54,138,2,126,+214,59,176,105,189,102,202,183,168,191,153,155,1,223,179,39,70,54,163,173,+145,254,5,65,250,157,193,228,45,228,16,57,152,236,120,205,154,134,199,219,+83,24,226,24,211,63,58,242,104,88,248,249,158,184,76,155,248,43,60,31,+116,88,29,35,134,146,62,113,166,0,20,235,238,114,136,140,117,202,41,218,+73,182,129,7,185,205,45,53,158,179,52,59,30,125,211,128,228,186,175,87,+120,170,82,37,81,62,181,180,108,221,110,39,23,109,161,127,191,139,174,51,+167,21,203,223,177,34,134,254,157,11,229,64,138,184,4,241,25,234,132,253,+62,90,245,137,194,215,222,52,224,44,200,98,18,176,103,87,14,105,117,60,+76,19,111,252,48,159,223,205,45,106,232,203,89,240,240,155,3,199,32,105,+189,110,217,132,158,165,78,29,126,56,38,177,27,210,135,89,148,10,42,68,+238,163,19,137,23,39,104,127,25,161,104,130,157,14,241,40,80,113,85,143,+70,207,238,183,50,252,175,206,63,196,205,206,102,121,1,120,18,176,105,71,+16,67,149,99,137,109,9,34,7,132,134,146,158,42,10,31,25,191,224,22,+253,53,254,238,122,25,60,137,244,37,22,114,54,165,38,152,145,75,50,40,+234,83,134,23,0,171,57,6,167,236,236,96,221,42,238,206,207,94,179,14,+65,108,253,209,54,117,190,42,156,20,55,93,8,25,89,92,172,191,175,86,+125,115,133,7,211,36,49,223,192,84,118,54,125,90,99,227,86,227,144,53,+114,121,18,222,176,90,36,52,58,249,73,119,66,55,164,232,193,143,21,145,+115,33,68,128,2,88,21,218,184,193,174,40,53,194,83,170,76,20,204,212,+89,152,175,187,221,15,95,238,26,76,69,133,96,226,238,102,88,254,78,77,+219,42,39,218,106,65,154,198,61,138,216,27,130,124,34,146,98,48,58,124,+116,248,170,194,113,241,234,101,191,147,97,218,115,229,168,4,249,255,202,243,+2,189,47,22,23,153,130,128,174,202,224,177,224,184,125,230,25,47,56,121,+60,209,204,217,37,217,203,8,27,205,200,45,231,3,179,14,49,105,134,11,+148,17,214,104,44,18,108,179,199,251,28,3,87,79,238,184,69,237,26,233,+62,129,33,122,67,76,132,138,11,171,23,143,189,251,236,138,172,15,4,131,+96,136,47,4,4,185,95,178,18,156,114,13,106,216,129,26,177,253,58,65,+42,208,154,126,5,54,6,27,54,82,226,172,190,79,88,64,161,231,254,190,+130,46,79,109,15,206,210,177,18,128,15,51,180,225,201,148,79,128,81,167,+26,180,62,242,149,101,145,174,140,177,145,53,209,30,28,84,219,86,182,234,+148,86,12,1,208,139,247,200,146,252,187,210,199,226,71,224,101,65,136,46,+96,57,119,74,139,31,189,76,225,183,9,29,133,192,181,200,53,208,150,60,+3,10,78,194,149,112,205,163,199,91,157,246,30,196,49,13,160,22,86,96,+208,208,184,32,169,41,237,134,16,38,196,210,170,52,136,175,174,240,119,30,+243,149,18,194,64,230,181,41,77,37,126,239,6,6,7,31,188,178,32,25,+113,230,126,142,60,107,42,111,245,245,146,213,87,99,81,0,172,158,174,197,+27,94,68,219,82,25,159,29,200,185,180,22,122,161,247,15,242,14,0,66,+223,67,179,99,87,86,98,236,70,86,199,68,160,58,205,150,55,13,185,39,+98,95,173,178,150,212,179,69,81,158,77,188,66,159,199,118,124,49,136,31,+251,10,166,236,79,80,201,95,181,157,187,102,231,5,58,43,14,20,63,238,+97,231,204,95,92,185,225,232,116,196,254,122,90,74,168,192,151,209,190,245,+2,13,130,146,238,105,163,3,239,95,211,101,214,228,55,61,130,179,215,23,+227,231,197,108,26,238,187,247,66,200,65,211,86,106,17,24,123,209,150,81,+213,9,229,18,147,17,239,206,181,54,250,37,240,177,52,238,165,52,202,40,+92,2,17,46,215,93,79,248,169,236,164,228,137,59,82,151,181,110,184,62,+83,5,18,34,162,190,255,47,37,124,116,180,179,191,5,191,149,142,8,116,+12,188,123,63,46,78,37,214,4,122,91,102,177,26,225,224,49,118,127,7,+248,84,54,163,242,146,47,253,84,147,18,196,189,165,193,245,205,49,202,46,+159,81,122,113,111,169,198,111,96,202,156,99,99,20,186,123,84,194,31,116,+102,16,205,189,34,219,174,57,96,229,181,134,160,227,245,96,207,137,183,35,+21,225,156,23,81,14,174,85,237,45,87,18,18,5,182,155,127,139,126,116,+116,54,108,242,205,103,241,156,109,78,40,135,61,239,151,98,247,150,176,71,+194,22,37,63,181,40,254,19,132,60,37,122,212,254,123,219,128,122,17,11,+50,242,117,26,117,83,90,142,103,252,159,211,249,27,18,148,129,155,121,214,+202,89,254,190,175,240,217,169,124,103,0,180,57,254,237,145,75,105,57,12,+233,169,199,81,83,152,129,94,104,150,147,142,151,71,109,148,73,106,42,121,+240,17,69,42,61,238,17,244,185,161,129,194,40,44,174,88,166,172,166,125,+128,106,151,181,199,157,179,254,247,209,3,183,155,30,166,28,144,95,42,144,+190,210,145,40,24,126,105,3,248,20,0,176,232,29,106,249,142,169,70,193,+177,208,140,2,232,200,122,114,119,253,115,178,233,150,72,98,188,197,9,138,+81,226,148,217,166,41,172,120,61,176,2,16,234,2,23,209,183,105,28,89,+81,26,119,67,169,255,247,27,220,174,67,28,167,193,41,137,188,254,227,109,+216,219,94,141,224,170,190,218,248,90,150,215,10,231,28,204,231,169,31,65,+186,169,171,32,199,22,247,236,195,60,22,64,247,212,63,1,164,23,72,146,+1,199,194,105,144,103,205,79,246,117,49,85,171,67,98,243,62,163,195,150,+206,48,112,142,184,20,210,254,96,83,158,60,70,8,62,220,237,152,235,1,+108,74,242,107,190,228,24,11,117,132,84,59,102,122,10,72,52,221,32,212,+126,245,160,79,179,123,85,253,17,126,142,123,150,77,206,68,210,202,247,226,+190,189,50,12,135,95,96,90,194,41,221,255,79,151,54,226,35,73,88,33,+201,49,255,248,64,207,54,101,239,2,134,180,207,221,235,86,30,29,226,46,+231,190,129,65,134,57,200,244,17,120,59,71,27,0,238,164,185,29,183,37,+61,67,228,180,22,93,18,48,24,112,196,173,13,182,103,198,8,212,192,81,+216,240,207,119,64,57,23,32,153,160,181,200,234,179,14,97,146,253,39,138,+193,186,111,41,217,244,171,152,214,76,43,186,115,216,146,182,202,227,2,110,+206,231,4,108,67,29,178,42,189,156,128,201,63,75,227,103,181,84,166,193,+182,190,211,14,137,134,43,42,149,135,82,98,92,162,255,201,126,254,66,205,+233,155,252,196,247,201,68,102,104,242,72,175,49,35,104,18,94,227,86,190,+73,150,164,102,37,54,251,174,71,234,5,57,104,226,163,120,205,152,228,48,+140,31,118,135,216,236,95,17,211,226,222,124,4,127,167,199,255,19,184,254,+84,71,222,100,147,230,209,218,143,201,105,255,54,169,152,54,56,32,246,152,+41,143,104,28,189,109,72,129,162,94,255,64,39,31,162,224,84,50,221,3,+127,127,31,53,51,167,20,175,206,97,89,132,84,114,0,105,185,43,60,2,+52,163,41,180,150,120,15,239,182,39,214,173,255,151,95,76,102,160,9,237,+236,120,255,131,135,251,8,141,143,148,240,243,73,60,249,0,249,53,98,240,+114,73,155,182,86,203,238,138,108,87,234,32,84,198,183,41,108,66,41,24,+227,173,84,105,16,141,164,116,216,177,38,38,190,159,3,209,241,107,70,130,+159,95,155,67,125,177,173,251,124,48,251,107,132,114,101,56,138,165,250,149,+82,9,25,97,90,201,68,88,125,55,112,242,57,36,114,56,176,236,68,207,+210,33,230,119,20,172,53,156,151,189,233,152,155,186,176,140,159,150,139,7,+134,8,146,131,88,108,252,153,14,209,189,34,153,103,84,225,21,244,125,17,+105,137,5,71,139,96,243,227,148,14,252,101,232,135,78,188,126,40,47,3,+24,195,47,158,44,53,191,98,59,96,175,62,162,150,36,161,217,64,179,54,+119,183,222,220,230,112,186,112,51,218,73,73,181,69,28,15,124,174,203,178,+29,221,39,233,49,98,208,34,194,151,49,226,48,116,90,118,55,120,210,196,+157,197,220,218,117,237,71,177,131,136,248,31,30,86,244,235,21,132,59,194,+47,128,108,172,81,130,24,228,70,150,219,97,195,138,66,66,89,171,232,54,+246,170,198,119,43,158,64,241,147,30,232,122,99,22,209,231,11,190,255,254,+152,246,139,68,127,240,242,228,150,190,182,201,235,1,180,169,102,50,227,41,+206,56,73,124,95,139,217,25,130,102,221,130,61,116,236,235,43,180,13,206,+117,104,32,205,167,85,147,153,249,95,209,124,105,132,173,7,190,122,173,222,+1,57,129,154,182,247,122,65,189,52,190,24,84,106,40,252,18,217,99,12,+13,207,191,163,193,87,233,166,44,247,157,18,206,160,214,41,147,193,110,119,+99,28,121,208,93,171,12,244,203,208,217,207,66,229,177,50,241,109,220,207,+103,53,11,52,43,164,245,146,18,205,185,27,252,109,148,60,1,156,180,148,+84,210,117,19,113,225,133,82,33,50,55,107,101,226,89,5,155,209,49,131,+201,216,199,135,119,50,127,220,91,83,75,244,143,172,9,206,179,41,245,234,+71,52,224,253,119,161,225,190,109,182,41,119,241,20,130,229,133,207,131,4,+127,127,251,235,74,90,29,163,64,172,134,16,53,144,128,39,74,58,213,45,+120,43,165,100,131,145,215,125,145,15,122,174,67,223,32,25,225,132,88,209,+77,39,34,7,99,209,236,222,112,119,169,24,202,236,73,81,232,60,129,142,+161,96,124,116,41,96,43,123,115,243,112,98,161,36,28,30,55,211,2,221,+254,117,117,230,149,250,186,42,175,76,176,127,66,212,106,165,108,219,124,208,+201,16,98,23,201,33,146,170,16,100,92,116,197,84,220,144,40,18,30,36,+124,255,230,14,158,134,99,43,64,35,25,136,68,0,98,48,98,143,255,103,+58,33,39,16,208,80,65,4,209,70,220,210,132,70,220,251,34,40,5,170,+178,224,111,117,238,174,106,183,54,132,205,228,216,120,221,158,183,214,183,222,+75,238,15,135,28,105,64,196,112,149,143,105,103,103,22,54,68,99,252,181,+39,47,59,245,223,93,74,111,156,246,196,244,180,215,33,159,237,168,123,123,+190,203,172,253,66,157,24,100,131,242,81,37,241,33,254,79,93,138,105,35,+113,252,171,199,153,189,32,32,252,204,218,189,223,33,192,240,199,191,119,11,+137,16,243,5,47,110,178,12,24,6,117,203,186,86,41,108,156,204,177,38,+95,74,13,223,90,86,148,58,246,130,76,223,54,144,23,22,28,32,215,195,+76,144,81,78,98,224,85,95,164,25,92,90,118,50,148,225,86,239,141,149,+201,231,8,71,241,135,190,195,109,35,165,27,176,116,171,99,252,107,22,207,+97,161,244,13,47,54,13,50,164,57,146,103,253,11,185,25,69,179,88,171,+156,125,150,249,43,237,45,108,73,74,180,19,144,171,105,221,6,170,40,28,+84,195,72,74,217,46,14,205,250,118,61,84,83,55,177,5,236,101,207,224,+64,199,105,120,21,81,164,162,162,78,34,40,64,214,123,118,33,96,152,8,+95,72,152,7,153,81,175,129,179,19,206,95,13,173,136,208,246,3,245,105,+155,36,55,237,181,89,9,222,84,244,194,19,231,190,147,96,26,160,196,108,+46,102,248,86,39,224,133,85,216,90,83,36,197,56,200,20,52,162,183,185,+194,121,144,77,98,202,144,171,0,140,117,233,72,91,201,127,210,16,199,86,+61,255,239,105,13,21,21,59,78,32,83,87,69,236,215,245,36,92,217,12,+13,116,251,138,39,170,178,190,52,177,131,116,4,172,222,248,239,72,122,106,+187,30,126,232,63,2,157,227,57,246,112,228,182,49,83,178,78,208,92,224,+194,169,155,157,227,235,112,193,52,76,114,39,119,106,202,239,53,143,79,117,+131,70,24,228,184,105,243,38,177,82,61,44,26,100,198,134,54,159,208,162,+219,160,244,184,198,172,112,97,242,128,232,124,170,86,161,73,2,183,109,14,+217,202,224,110,52,214,212,26,248,52,68,106,109,44,226,89,134,121,60,235,+17,77,80,54,34,214,110,32,38,149,55,126,168,22,43,115,28,138,195,102,+80,23,98,93,34,106,187,23,32,30,92,45,112,96,13,178,37,220,117,18,+135,177,190,205,64,165,102,168,178,98,247,24,223,102,150,36,97,188,181,0,+30,91,96,77,135,155,230,146,184,236,147,38,0,47,85,59,178,121,170,247,+94,81,63,108,57,5,134,206,49,7,36,121,57,183,139,215,3,90,111,224,+61,156,148,163,108,168,0,31,240,249,125,44,59,93,205,232,112,236,62,211,+63,33,59,29,39,228,154,186,193,174,229,7,131,28,40,244,10,243,182,138,+103,229,159,29,166,243,20,148,78,119,57,203,188,26,245,40,56,185,248,217,+166,237,40,111,149,25,195,162,104,158,44,220,221,9,159,54,57,206,131,61,+239,233,121,129,146,13,206,201,33,13,212,127,159,167,205,69,59,41,46,238,+76,153,116,176,141,208,118,2,215,11,96,239,110,209,218,249,74,112,36,7,+66,85,183,190,203,184,254,68,152,28,246,165,177,38,72,231,16,3,160,245,+66,100,252,18,192,53,180,217,145,208,107,129,216,145,220,105,58,86,0,162,+122,162,245,46,158,134,39,246,196,166,131,5,255,240,177,225,15,194,53,222,+165,252,59,129,51,105,109,97,202,39,90,211,50,233,213,181,169,127,20,205,+224,235,1,57,165,67,240,46,74,183,144,33,45,180,220,44,93,238,121,211,+143,30,122,182,120,118,52,86,53,40,115,91,54,197,222,226,108,48,153,141,+193,33,20,154,160,237,92,255,239,103,58,57,52,224,9,213,117,193,97,145,+98,76,125,178,71,180,139,246,30,20,80,253,238,114,28,252,191,187,218,170,+238,63,2,207,212,206,114,137,172,97,233,108,86,121,95,140,225,104,150,149,+138,124,13,234,46,157,202,74,61,203,123,171,252,81,214,63,216,58,41,118,+243,67,76,118,57,56,144,229,51,129,216,217,147,140,65,155,116,239,145,177,+225,194,172,122,96,142,113,225,90,252,133,184,165,206,224,39,18,246,80,33,+94,213,238,97,77,219,99,109,40,13,6,242,100,116,125,19,178,106,212,216,+155,85,178,110,224,222,122,84,54,224,202,184,48,77,4,248,104,45,122,99,+44,161,48,211,199,144,132,207,254,188,139,78,129,207,34,190,135,58,133,150,+165,41,250,93,175,211,202,255,144,113,72,13,83,225,123,2,114,31,226,89,+87,181,177,93,64,232,184,93,152,40,45,249,33,222,254,184,80,111,41,170,+247,2,38,168,169,93,150,100,133,28,16,88,153,131,198,225,251,87,142,138,+105,146,49,238,9,52,78,33,226,28,41,31,251,49,191,145,99,33,187,25,+78,94,199,197,183,99,246,123,93,2,209,81,16,229,244,171,1,136,230,196,+128,143,43,193,217,246,116,72,190,207,0,52,107,87,208,172,202,251,49,147,+158,179,11,67,156,130,208,121,164,185,55,12,3,134,124,122,46,132,214,102,+43,127,68,116,226,16,120,222,160,102,13,205,127,209,173,171,232,36,49,160,+126,154,77,159,246,59,148,77,208,229,108,233,120,251,221,102,34,109,147,53,+42,85,26,125,11,222,194,117,7,29,153,211,141,196,43,118,153,186,229,19,+189,152,25,40,1,189,167,41,134,62,52,66,113,223,220,147,106,158,161,123,+111,94,234,134,109,197,31,137,161,109,191,175,250,211,110,156,224,116,72,9,+203,182,21,161,144,134,58,187,91,107,195,227,196,96,88,237,53,77,76,97,+141,20,118,52,103,242,237,19,89,117,141,74,49,49,167,21,175,100,151,253,+78,136,13,213,61,222,5,122,143,116,72,239,50,30,144,116,196,250,88,191,+122,37,200,40,14,211,1,5,216,1,65,231,157,152,141,52,226,250,69,57,+222,40,0,37,39,197,33,227,227,202,77,216,233,136,246,53,22,116,112,31,+108,80,56,121,195,2,121,10,206,219,87,106,153,72,71,184,38,238,47,226,+149,191,115,108,17,159,72,203,135,225,208,168,217,86,234,66,199,225,205,172,+8,37,194,66,11,185,173,218,144,229,231,242,187,73,53,228,141,81,212,18,+151,234,79,75,80,246,143,71,70,31,95,11,108,41,235,182,35,124,248,254,+164,243,157,154,82,156,116,219,180,77,220,196,146,48,247,133,67,238,72,179,+58,16,100,89,166,133,115,30,238,217,197,95,161,143,145,23,226,113,84,80,+191,179,90,251,251,37,26,24,50,7,127,175,77,162,229,150,89,62,102,130,+124,10,62,229,188,203,106,180,14,54,245,147,156,59,94,181,130,99,35,158,+0,70,82,26,14,13,115,122,146,42,177,218,207,39,144,255,4,74,143,101,+107,11,251,213,249,17,7,92,236,42,148,196,202,77,136,89,163,134,210,204,+132,120,219,106,240,177,193,7,30,169,164,197,111,248,163,224,203,76,244,230,+10,83,207,210,87,23,12,167,185,191,56,16,11,100,134,239,55,136,19,102,+106,182,73,134,153,76,22,23,62,203,236,23,181,191,137,73,125,22,32,50,+91,221,173,96,71,217,209,27,200,65,125,14,77,86,204,38,240,8,34,91,+42,241,130,161,109,154,3,8,5,152,153,10,81,250,104,31,255,129,117,190,+10,63,0,250,126,105,142,69,123,100,130,117,28,155,53,180,42,182,83,67,+225,52,109,14,89,224,33,180,225,91,123,141,183,133,6,63,127,147,228,132,+123,109,137,2,72,15,165,236,76,253,120,14,96,183,89,91,138,59,53,118,+110,125,111,182,7,126,78,218,129,62,60,202,83,109,142,98,149,235,154,181,+23,221,235,11,145,136,245,139,4,214,233,139,227,2,187,178,244,124,36,144,+21,221,181,145,111,45,10,60,253,250,28,169,250,49,155,63,190,161,37,252,+160,182,108,6,8,186,95,24,133,150,46,50,68,80,48,1,21,87,24,38,+153,117,85,223,144,188,186,110,163,96,199,31,127,33,219,102,53,139,226,72,+22,191,116,146,217,33,88,117,36,0,64,124,50,187,135,130,199,177,239,21,+128,202,222,84,197,111,236,73,172,24,56,136,237,60,169,131,252,162,167,30,+41,100,206,193,33,63,201,224,105,235,219,213,123,240,123,92,79,46,104,80,+72,203,48,218,211,197,76,236,162,128,131,144,89,66,210,136,11,191,121,45,+211,159,248,82,60,143,14,159,112,31,47,74,233,121,249,204,45,35,115,242,+170,111,232,249,12,78,106,162,239,169,151,14,248,156,12,99,24,91,205,137,+53,131,252,106,168,224,23,239,148,151,229,110,138,18,138,53,59,73,225,70,+176,165,135,130,207,40,21,124,90,205,52,10,153,25,12,139,247,73,205,192,+84,219,7,60,90,103,176,66,174,162,170,205,165,187,204,241,57,238,70,210,+183,228,80,183,19,80,55,84,163,243,13,140,59,44,173,107,177,187,199,232,+53,226,113,84,3,141,6,179,197,166,84,173,96,240,249,32,186,15,236,248,+168,94,170,255,128,73,153,194,150,37,195,46,80,20,182,148,205,111,34,188,+131,14,211,10,143,159,161,141,219,7,48,143,15,126,48,219,127,205,218,12,+215,123,152,148,146,27,212,118,195,181,162,184,23,146,147,33,236,57,32,200,+109,129,110,250,191,82,140,213,164,204,9,48,61,215,249,164,178,32,140,143,+113,49,54,9,172,217,61,43,75,190,134,156,98,133,204,127,219,104,109,130,+109,209,15,69,244,240,137,213,151,105,41,136,38,0,54,158,27,184,145,70,+170,196,89,107,192,94,164,254,85,28,174,247,132,164,97,98,146,105,173,28,+122,118,238,71,159,123,229,127,58,19,152,180,6,171,240,49,191,23,15,113,+12,130,18,56,29,87,112,231,137,59,152,63,134,145,208,204,13,35,231,3,+185,114,163,185,180,137,216,130,141,89,201,65,68,13,68,240,141,11,139,250,+228,77,243,125,230,185,41,56,162,163,44,196,99,13,39,31,88,169,251,92,+131,238,217,199,84,173,117,223,88,28,229,216,174,143,95,49,150,47,67,20,+62,125,177,11,130,47,8,132,139,109,0,56,115,169,177,211,137,31,219,34,+183,253,226,233,138,80,194,183,238,89,136,45,203,31,167,153,177,113,59,209,+100,37,139,199,106,111,129,9,41,42,171,63,67,239,182,9,195,166,114,81,+89,141,21,250,145,54,87,204,239,0,186,114,13,23,205,23,222,59,228,195,+70,26,181,133,0,58,84,206,226,194,147,252,169,158,221,53,142,165,156,167,+143,50,5,125,66,80,187,142,203,59,208,104,49,171,37,188,193,226,214,43,+27,51,46,196,176,6,29,166,144,198,117,116,199,31,238,52,147,115,51,189,+108,140,71,247,149,21,24,208,18,198,158,237,188,13,157,255,39,227,233,243,+144,216,164,255,219,195,34,224,188,65,220,26,174,100,57,98,254,165,214,241,+175,160,231,240,20,0,189,203,11,230,35,19,236,35,111,209,65,63,168,205,+132,99,123,140,9,45,72,98,73,203,248,248,150,94,163,143,35,23,30,78,+219,104,81,115,19,119,18,33,99,153,239,170,255,118,238,255,82,105,66,31,+198,23,68,102,124,172,54,219,22,176,209,243,75,165,219,123,234,82,59,86,+196,74,161,37,123,105,18,143,114,82,15,1,125,120,225,208,147,164,241,33,+0,135,126,236,230,223,45,26,219,140,179,74,38,31,1,102,2,66,153,189,+193,167,39,37,177,102,205,222,171,121,153,34,176,134,220,255,242,4,223,124,+144,42,114,175,166,244,165,186,108,197,218,164,99,119,116,170,204,149,64,135,+72,202,57,197,237,57,237,102,18,110,109,246,199,229,165,42,253,58,49,170,+234,205,182,67,99,111,33,130,216,234,247,241,222,152,84,75,13,131,39,78,+211,89,88,255,142,115,111,101,121,33,126,10,35,26,166,162,96,42,252,200,+170,18,171,44,112,42,57,34,175,112,253,79,144,31,63,193,83,12,21,86,+81,172,250,46,14,127,18,138,195,40,6,57,53,170,144,214,197,49,181,94,+192,230,147,164,121,204,5,44,114,64,172,50,113,235,230,169,208,224,163,66,+127,156,63,15,45,37,50,212,226,25,65,9,178,197,132,52,12,167,197,121,+24,126,179,116,21,100,36,46,251,86,25,56,145,78,40,20,167,95,191,5,+191,146,196,95,149,25,57,17,212,88,52,5,120,55,75,169,90,97,145,123,+78,64,173,235,39,156,26,196,224,144,126,233,63,238,207,157,25,4,33,143,+109,48,106,222,17,216,179,23,146,247,30,116,135,168,121,240,247,170,146,83,+97,89,135,94,116,42,105,143,162,209,190,69,175,189,249,18,127,30,161,46,+207,244,37,199,187,106,174,160,86,167,4,203,168,236,3,124,51,136,134,159,+149,195,26,185,1,241,57,26,184,12,204,16,78,212,145,158,244,171,62,226,+212,186,96,193,173,178,182,230,51,221,63,98,77,181,42,155,11,174,218,130,+232,59,46,138,248,130,16,6,153,197,100,213,231,28,194,242,199,183,199,113,+31,224,215,135,221,94,8,144,89,36,36,242,76,140,38,59,206,56,199,10,+99,249,90,71,148,53,91,162,227,46,206,51,145,246,169,139,68,189,160,174,+105,142,161,88,22,147,10,155,99,8,59,107,153,227,92,208,119,67,84,81,+83,103,82,5,164,149,171,99,9,62,173,66,106,246,136,163,202,132,246,254,+47,13,221,216,29,154,67,207,121,1,41,201,157,43,1,218,242,94,29,90,+115,35,34,13,169,138,142,167,141,180,55,179,215,22,32,21,120,166,39,101,+229,84,207,224,24,138,20,52,49,69,150,40,8,249,128,70,84,10,76,56,+63,96,216,53,42,164,82,71,204,222,173,179,105,13,242,115,255,66,77,8,+0,176,78,138,61,132,215,52,92,64,153,201,159,66,135,30,175,162,144,110,+93,63,28,216,191,27,148,6,128,67,60,98,102,59,2,136,183,104,86,135,+31,107,204,128,122,160,160,214,236,187,179,40,78,248,150,7,56,148,106,98,+250,250,108,14,50,57,26,254,26,165,136,224,119,73,176,50,239,76,72,35,+202,56,196,179,45,146,24,33,32,81,89,234,220,243,126,67,244,18,57,51,+181,115,207,70,165,242,87,91,101,124,121,221,22,134,108,112,154,80,110,115,+27,111,245,32,94,163,129,168,208,233,205,197,82,93,30,222,167,135,141,19,+92,1,220,59,192,134,213,223,206,137,61,1,143,0,79,130,172,12,91,177,+69,15,17,175,195,90,212,70,61,150,125,176,201,159,112,172,47,59,223,144,+27,10,140,8,154,160,9,17,87,197,24,35,53,69,104,57,20,228,126,137,+173,26,2,196,127,226,113,191,191,239,244,125,114,79,188,59,101,38,59,22,+158,103,228,5,198,14,158,128,68,206,6,207,75,15,64,13,24,236,242,184,+213,85,96,185,29,247,165,225,196,227,223,25,57,194,136,65,208,184,181,218,+75,188,232,215,153,158,68,20,68,228,137,48,58,155,66,69,25,70,65,232,+103,70,220,167,50,145,18,54,113,140,113,251,179,199,127,90,227,139,68,13,+76,21,136,189,255,247,174,68,41,15,146,25,127,0,244,228,136,79,16,199,+244,94,178,198,9,162,232,120,41,68,129,87,125,22,162,51,73,248,36,245,+151,200,254,214,172,92,88,93,30,208,180,94,196,26,241,164,40,86,139,37,+83,69,178,66,235,26,17,100,11,82,170,155,237,234,61,179,175,211,237,208,+16,222,36,204,231,164,145,228,224,142,237,188,213,216,168,140,242,2,105,129,+247,184,143,2,115,130,240,91,121,139,184,221,201,121,129,134,189,56,49,100,+234,32,140,225,115,149,104,19,198,144,87,212,225,238,72,237,15,120,255,148,+227,250,27,51,87,62,130,74,224,5,30,146,242,162,221,146,219,22,108,16,+29,247,3,76,7,215,93,234,147,125,44,139,238,100,231,17,21,105,74,197,+101,203,95,218,81,70,107,64,46,9,134,164,184,158,92,52,154,75,112,143,+201,208,92,14,205,59,47,52,78,125,163,10,148,149,41,186,173,105,204,139,+184,206,109,30,206,54,233,145,141,53,81,108,32,135,79,90,190,45,33,159,+210,248,131,84,132,75,153,114,237,188,209,37,177,98,36,123,211,187,36,34,+196,159,172,8,108,243,9,138,226,139,123,98,5,60,66,221,198,63,145,226,+40,251,18,67,7,217,145,229,70,11,107,146,167,190,131,113,151,202,218,7,+94,98,155,20,247,100,86,236,75,64,109,19,244,116,79,235,21,30,216,33,+119,38,242,23,226,242,53,168,174,118,28,54,34,243,209,233,248,240,202,232,+221,148,193,146,229,165,171,154,200,158,103,148,4,166,66,152,97,254,31,88,+97,190,68,205,59,237,43,20,62,213,38,189,30,9,144,126,92,97,102,69,+124,136,194,172,66,230,119,193,111,186,97,235,150,181,200,252,218,131,117,88,+120,178,54,20,29,204,126,244,188,214,60,150,244,21,254,92,174,121,172,72,+178,130,62,157,204,242,246,239,72,92,187,212,102,168,33,229,254,28,132,129,+69,27,108,155,123,17,110,109,1,15,225,46,189,113,215,214,15,115,167,98,+176,178,127,126,3,86,157,220,191,5,203,32,158,242,30,104,3,254,48,24,+148,224,95,163,203,230,103,177,32,97,130,169,63,42,79,237,113,27,249,56,+67,147,154,249,1,176,132,107,54,228,23,148,33,130,89,177,221,15,48,73,+19,12,60,37,10,172,232,226,132,22,24,149,50,156,24,146,160,208,212,79,+105,13,236,41,226,17,47,238,67,101,118,243,214,28,189,27,213,41,199,98,+93,232,91,232,4,153,243,67,183,103,113,202,78,94,240,208,230,5,5,4,+30,66,110,221,245,212,149,166,197,130,122,60,100,136,32,200,62,216,235,22,+117,250,147,49,51,224,136,63,21,214,184,184,232,73,132,109,72,248,25,3,+108,48,146,201,140,181,199,37,207,248,230,38,153,213,23,146,83,231,136,152,+64,27,201,157,41,103,163,222,25,178,144,57,4,169,255,145,141,80,19,228,+71,73,203,135,49,82,142,15,170,121,37,81,214,79,126,58,129,97,98,45,+141,74,227,100,14,194,76,219,178,251,39,60,202,72,112,219,210,182,145,161,+30,93,56,137,116,207,77,134,7,116,53,190,235,243,122,6,193,97,33,223,+78,32,175,217,177,16,16,241,160,154,158,98,3,144,242,68,94,40,27,41,+27,32,82,52,168,215,50,146,68,172,20,155,209,121,58,157,206,60,193,68,+88,109,211,44,165,245,31,166,11,93,186,70,83,88,73,203,51,83,107,215,+210,120,44,202,42,50,134,115,248,61,81,52,8,241,74,140,239,88,239,232,+64,220,68,237,175,137,146,240,135,100,84,161,49,207,87,55,185,214,249,19,+45,250,183,158,4,88,122,146,15,194,34,160,78,27,206,120,75,206,67,1,+94,220,18,60,215,105,41,253,179,164,25,227,30,48,175,60,56,59,32,150,+237,209,179,255,223,23,25,236,22,9,254,85,36,162,95,49,171,1,162,40,+254,54,58,44,250,170,34,249,145,2,14,144,127,143,19,21,202,83,79,5,+211,201,99,178,159,39,129,149,145,72,103,162,58,103,35,17,34,108,119,102,+181,200,19,73,179,161,37,14,168,219,141,179,253,36,55,116,182,217,59,19,+43,91,69,235,47,123,96,252,45,247,140,154,95,234,191,110,99,107,160,96,+132,14,252,191,233,64,115,247,197,231,133,173,230,22,145,167,71,59,98,254,+227,203,192,166,109,185,56,217,236,27,112,171,168,102,125,160,9,163,228,81,+211,238,7,154,92,10,217,119,77,94,235,113,34,226,6,217,121,185,181,69,+59,205,9,158,239,173,203,131,245,186,194,109,188,149,30,180,158,92,211,102,+122,243,69,252,253,49,21,253,130,254,164,26,72,99,245,220,42,19,97,138,+129,188,194,84,96,10,231,98,246,90,111,51,19,143,212,221,228,195,168,254,+107,228,243,119,65,249,237,83,7,138,73,203,7,244,97,248,22,135,166,111,+120,25,86,13,123,33,52,109,43,159,107,54,126,187,46,38,16,224,107,24,+11,101,90,146,138,242,53,230,130,246,65,170,61,243,66,217,247,141,252,126,+227,102,82,187,38,239,31,13,82,226,220,217,177,136,192,154,56,175,157,11,+72,250,206,242,127,87,51,68,108,21,77,38,223,30,221,232,28,58,165,47,+10,75,228,60,198,126,18,114,139,176,83,170,129,144,31,89,15,171,196,137,+101,163,17,164,4,85,75,229,62,137,204,184,48,113,111,250,143,12,65,221,+153,146,226,197,70,94,46,14,38,241,187,20,184,56,112,99,230,161,212,181,+196,239,47,165,226,37,39,121,255,182,9,240,194,24,148,20,209,8,109,12,+131,170,121,239,125,151,175,62,52,100,195,105,180,7,193,142,8,245,175,47,+51,108,171,147,91,60,2,242,193,110,158,97,90,34,219,205,90,64,193,61,+158,4,193,109,162,47,197,186,225,70,254,201,44,5,52,177,72,190,210,220,+6,97,110,75,224,138,67,232,192,247,223,232,49,93,153,225,33,55,160,101,+229,231,254,143,201,156,177,178,37,190,39,94,175,100,143,19,30,20,158,145,+15,168,126,91,239,69,38,42,21,124,204,232,214,117,6,102,5,12,118,193,+221,167,168,146,65,127,91,110,204,111,240,242,35,181,141,238,80,28,60,177,+112,177,244,133,247,109,133,23,30,42,139,3,132,181,77,214,7,250,176,39,+61,80,168,90,70,173,7,170,12,57,60,139,242,62,220,50,113,103,229,85,+155,50,61,74,208,17,198,41,167,12,3,177,220,88,248,133,1,171,216,63,+222,196,176,66,142,129,2,215,104,68,53,6,81,5,225,198,205,216,114,112,+61,141,74,194,245,99,81,210,178,145,240,214,239,130,132,58,139,181,102,218,+149,167,82,23,71,204,231,17,224,234,125,201,41,184,109,209,148,192,230,248,+22,3,190,103,84,207,234,108,22,16,118,191,73,229,239,95,245,184,21,143,+215,24,165,247,180,181,10,148,103,155,63,100,202,226,16,61,47,17,13,170,+240,117,75,109,144,32,17,139,212,218,236,80,44,213,76,140,57,247,96,122,+169,32,17,93,128,107,88,17,177,57,195,125,30,247,150,178,103,181,125,126,+250,238,164,217,28,69,111,170,181,95,96,206,150,43,249,229,53,123,227,173,+130,147,61,35,192,185,22,72,207,232,80,239,147,160,128,145,197,4,226,92,+189,13,102,36,19,28,41,197,112,242,103,183,156,7,146,130,62,102,150,92,+149,152,4,70,61,3,92,123,136,231,50,54,94,97,125,70,214,168,124,120,+124,112,203,217,86,237,216,66,224,184,157,163,60,131,73,44,153,136,121,104,+154,125,206,238,70,236,220,24,106,124,111,155,120,39,34,137,238,94,66,1,+16,164,203,24,111,182,205,200,135,176,210,170,227,174,180,28,34,116,175,55,+159,215,38,166,104,40,219,138,174,28,79,40,222,69,23,106,216,63,32,42,+213,209,229,248,211,159,213,55,48,146,123,239,217,63,38,247,173,101,37,147,+175,50,204,220,109,167,239,205,187,33,11,67,229,96,95,75,99,73,215,145,+210,128,33,87,118,43,57,174,82,14,175,73,212,63,52,186,214,13,60,125,+141,82,3,144,207,91,32,209,245,164,208,220,68,131,157,233,18,5,161,43,+247,198,51,190,164,85,28,220,157,0,112,182,59,254,137,142,239,140,250,4,+89,236,69,135,156,198,98,138,236,238,135,118,40,117,243,124,173,159,201,248,+156,20,100,224,156,188,111,51,104,108,170,57,164,135,32,58,250,169,252,160,+240,108,10,91,97,90,89,145,155,234,217,29,234,247,65,115,192,182,248,201,+80,187,17,45,10,210,130,133,83,208,216,205,125,182,252,193,170,97,60,14,+39,119,59,1,27,179,125,46,37,252,106,161,143,166,221,18,154,208,2,115,+184,2,15,25,119,86,230,165,154,15,45,52,52,11,192,216,176,226,137,178,+173,203,224,71,203,115,47,192,162,155,173,151,222,88,232,158,170,164,12,140,+192,15,41,56,55,160,131,158,194,194,160,57,215,102,125,3,237,53,12,162,+163,174,97,115,211,188,211,214,151,158,118,120,42,116,251,129,229,18,219,94,+74,208,199,6,119,11,34,211,43,255,113,182,221,35,7,15,119,183,207,218,+49,31,168,21,248,60,233,126,206,108,140,188,148,250,43,252,27,193,23,26,+80,31,212,12,177,210,238,32,57,131,88,38,175,54,24,227,222,171,170,189,+190,243,178,23,98,49,30,26,43,32,43,21,244,50,79,35,77,129,109,33,+216,43,11,138,221,228,135,1,154,181,137,132,110,39,214,125,146,104,104,153,+26,222,160,109,135,212,196,72,211,218,62,196,44,126,139,224,85,86,189,81,+21,255,42,44,190,41,134,52,103,30,36,178,8,188,236,6,186,83,24,151,+119,17,156,250,98,176,50,229,160,113,147,248,226,174,157,194,65,112,23,162,+227,6,144,222,93,142,219,134,186,233,41,7,219,231,72,104,243,34,187,133,+99,226,206,58,205,73,13,79,51,16,251,61,55,217,75,29,168,194,168,212,+253,35,39,34,3,234,159,2,209,121,3,41,182,204,222,204,232,197,48,10,+10,252,186,133,94,83,225,241,114,135,38,148,167,240,70,126,34,49,135,132,+203,30,52,108,225,179,180,64,116,40,199,204,243,212,154,29,220,80,148,147,+72,139,89,72,215,122,233,3,139,236,53,102,102,147,68,184,55,140,44,102,+229,192,24,237,47,237,130,112,139,229,159,230,109,213,68,219,66,245,61,174,+192,142,72,107,14,189,19,75,154,91,226,247,42,154,111,163,111,59,127,126,+223,123,231,152,207,2,3,81,105,210,139,245,201,135,97,36,246,150,138,160,+100,206,103,221,105,237,101,183,177,42,86,148,164,156,126,46,136,105,37,199,+21,79,220,128,177,12,223,42,227,135,149,190,124,103,102,44,87,174,15,250,+107,169,55,142,54,233,97,216,30,47,226,191,233,172,45,18,0,232,76,227,+95,141,9,174,153,178,45,9,97,203,35,22,222,170,159,186,157,146,159,245,+3,67,160,45,103,147,121,186,138,35,216,86,27,39,144,211,248,16,15,86,+126,71,106,104,3,33,238,99,26,217,203,181,242,11,121,132,156,59,9,133,+160,48,35,1,238,196,130,170,116,71,54,7,193,212,45,10,227,222,32,247,+205,176,96,28,145,54,150,106,42,231,50,82,211,96,135,139,120,208,74,108,+99,70,126,103,133,170,58,202,191,241,85,94,150,41,77,199,174,48,211,220,+253,147,54,9,236,23,86,152,113,56,98,108,123,31,148,4,181,111,177,139,+237,121,229,123,216,37,60,21,127,112,125,192,103,39,242,251,239,242,118,78,+111,53,164,87,123,99,186,189,14,214,42,70,120,59,210,24,232,244,27,168,+186,47,122,5,95,156,29,7,0,228,137,15,126,179,19,249,234,115,66,241,+119,255,99,78,22,82,20,245,12,47,80,140,159,32,203,183,232,25,233,17,+51,189,188,207,151,43,218,14,94,76,104,61,156,51,248,252,97,243,120,193,+8,34,39,58,228,248,2,104,80,206,121,136,185,16,77,64,151,133,164,35,+61,51,101,25,49,181,125,171,248,187,91,83,105,175,237,39,109,168,202,14,+22,93,157,201,195,163,5,234,228,131,195,151,216,176,74,235,37,40,124,225,+24,71,238,251,131,133,215,39,27,144,60,128,71,29,70,27,29,17,161,129,+235,221,45,236,237,228,128,255,64,197,13,179,223,236,82,191,76,214,31,103,+48,96,179,163,248,134,88,189,172,16,128,144,13,67,75,140,206,80,129,112,+124,59,243,201,242,35,48,246,131,90,205,124,61,23,26,49,59,5,55,52,+215,236,179,8,27,218,88,138,241,198,20,255,18,118,97,82,241,206,35,198,+95,93,124,163,80,172,133,16,188,154,62,163,191,105,207,75,247,83,83,42,+103,210,69,138,111,108,118,126,246,80,122,51,30,200,9,17,243,19,22,152,+186,157,36,179,117,73,17,26,100,112,41,11,210,113,241,42,75,105,219,175,+177,147,49,107,38,59,65,191,51,16,107,45,23,75,164,144,42,49,228,32,+172,196,96,15,247,238,231,97,94,187,36,16,74,101,158,20,32,29,113,170,+210,184,26,186,206,203,94,28,71,3,205,164,231,227,232,126,195,165,17,32,+129,198,87,183,172,182,86,174,124,50,23,184,22,131,157,255,173,74,191,186,+85,55,227,220,35,194,6,209,110,52,118,105,88,45,201,134,86,246,82,115,+202,209,231,255,73,183,169,238,40,89,227,150,58,173,0,233,32,221,150,147,+180,18,198,68,20,64,164,28,191,94,81,63,134,99,140,120,141,0,216,114,+220,120,8,173,132,212,187,23,175,120,226,209,247,143,138,30,247,160,164,250,+185,216,226,193,205,241,192,243,98,164,42,37,186,2,192,51,89,50,252,114,+129,197,55,37,28,93,184,106,33,23,180,17,36,32,240,44,205,215,203,250,+170,222,133,26,111,33,121,184,229,185,167,252,26,104,237,54,254,36,85,111,+127,205,179,203,155,198,197,57,103,64,45,125,193,5,94,208,190,29,192,194,+24,210,106,141,134,116,67,205,116,210,72,52,228,18,18,62,118,199,211,218,+244,174,61,71,75,173,53,103,90,3,228,161,190,34,145,252,204,195,221,52,+178,192,229,128,207,85,39,68,10,148,75,36,115,205,87,44,7,53,58,147,+236,67,152,189,128,215,19,224,121,173,58,40,184,14,53,47,140,79,243,201,+32,135,104,72,27,98,200,220,53,9,245,137,63,112,249,73,140,218,168,210,+111,96,7,169,251,255,153,121,68,100,159,243,47,23,113,143,240,247,35,136,+17,164,47,109,142,182,230,243,30,140,112,88,58,55,90,251,47,254,172,90,+18,24,213,97,9,111,235,132,159,173,219,184,149,27,95,220,169,216,40,28,+241,118,171,34,24,131,138,157,102,246,36,42,252,117,31,174,23,170,76,97,+146,124,228,159,95,42,75,7,215,241,100,197,188,57,122,119,151,196,226,13,+60,68,33,93,128,179,36,112,41,68,21,130,131,248,221,130,57,26,64,237,+7,166,152,176,159,169,81,233,60,219,228,75,28,159,236,50,157,227,92,224,+141,81,1,207,74,175,243,68,50,219,99,167,39,130,64,12,114,47,70,227,+244,172,134,159,38,112,251,143,192,26,181,56,211,155,116,20,200,170,195,133,+122,109,125,40,39,234,171,227,72,123,112,228,127,254,49,140,196,69,237,83,+254,247,47,15,254,217,69,51,62,177,209,151,142,161,22,236,84,69,50,189,+213,1,240,175,229,65,37,42,110,188,205,117,49,160,195,221,225,118,231,26,+172,170,192,204,64,154,58,38,165,6,191,174,147,201,255,142,43,44,205,38,+245,100,145,178,56,21,80,158,53,174,182,15,208,36,190,13,53,255,106,42,+113,111,97,188,158,199,129,132,26,153,25,138,238,48,181,83,15,110,202,26,+53,137,244,223,73,145,32,197,63,196,173,36,118,98,144,195,222,88,62,246,+14,84,46,148,94,126,210,210,9,109,102,85,239,75,47,155,33,90,58,38,+6,224,175,176,230,110,248,186,211,159,189,90,242,81,47,227,121,112,245,169,+93,150,118,165,203,43,199,147,224,31,107,181,119,63,170,146,164,32,152,197,+151,24,142,77,214,73,181,188,18,121,75,168,185,41,238,236,113,130,143,108,+101,152,154,123,20,231,171,222,187,49,130,174,129,82,92,112,32,213,249,65,+45,37,207,50,131,81,104,235,202,77,129,241,160,86,209,253,246,84,96,145,+42,235,57,34,15,72,34,215,81,113,132,45,40,123,179,57,180,121,245,128,+126,22,119,47,178,16,244,200,159,170,238,54,246,197,56,199,138,54,67,37,+207,191,131,243,45,132,109,185,52,57,209,155,22,248,71,236,207,183,152,35,+205,195,79,97,35,234,208,198,30,56,131,245,21,224,127,111,197,49,200,141,+21,229,34,79,18,176,85,223,235,241,183,45,172,218,93,251,119,174,44,12,+6,47,204,202,242,179,214,218,16,51,38,108,212,254,240,219,36,160,72,144,+238,254,31,57,250,182,98,83,122,130,68,154,219,66,169,3,84,75,2,148,+42,28,131,81,92,167,235,157,126,170,87,32,255,31,78,127,41,40,129,54,+194,91,217,100,250,188,222,236,101,119,77,9,107,28,225,23,148,108,134,186,+143,31,158,127,6,237,98,13,187,170,71,245,113,26,122,77,127,120,5,248,+120,213,63,106,55,121,79,59,4,34,235,7,45,90,47,78,121,150,192,93,+209,7,159,157,34,218,150,63,106,18,146,131,80,94,223,157,194,100,192,208,+116,84,52,71,101,212,101,141,163,26,170,215,239,240,220,36,173,165,33,144,+226,224,158,48,142,94,242,13,42,188,193,44,121,100,250,233,203,249,122,239,+207,173,58,231,127,137,38,54,31,101,138,94,109,175,8,177,77,56,170,147,+125,237,204,130,56,205,53,234,217,155,205,26,180,160,37,0,151,226,148,238,+53,36,129,218,246,242,201,68,86,49,189,3,225,40,219,251,44,174,157,167,+115,234,100,89,69,15,117,95,110,39,137,187,214,47,176,154,94,126,20,91,+179,52,244,96,110,160,209,58,126,74,193,72,18,105,253,81,60,159,195,81,+116,176,4,80,231,55,235,241,124,36,202,28,26,199,28,221,231,249,0,252,+168,226,204,128,181,191,164,215,161,124,71,82,33,138,143,143,2,90,84,42,+34,210,204,145,56,236,141,220,82,67,159,76,80,205,175,214,237,72,125,76,+209,248,30,117,150,129,57,179,222,129,105,29,182,169,161,27,174,124,62,209,+231,163,184,215,36,170,231,59,14,26,197,119,191,88,23,130,179,196,204,143,+233,218,119,32,208,100,116,230,230,138,200,207,97,220,54,64,172,1,224,118,+230,34,58,155,87,108,98,219,87,166,134,2,147,71,66,100,116,242,62,43,+150,141,13,10,113,57,131,169,133,250,43,94,123,115,174,73,125,69,108,26,+193,214,158,214,167,176,182,207,177,9,46,124,203,14,156,200,41,65,164,106,+10,177,45,169,78,113,83,46,57,254,57,234,1,4,134,173,14,46,130,134,+110,120,218,2,10,172,64,103,142,243,75,253,241,66,41,222,159,78,53,7,+16,171,187,144,194,164,167,155,125,220,11,42,128,170,241,88,244,74,203,8,+89,142,151,200,24,100,70,117,176,209,115,92,106,104,144,216,168,29,151,139,+43,246,93,42,182,85,161,34,15,52,126,63,194,35,56,88,116,197,6,36,+229,82,87,230,214,108,150,163,253,155,164,252,112,71,129,84,84,61,128,160,+167,68,20,102,248,248,147,133,247,229,249,146,4,16,84,126,20,100,231,163,+237,89,163,193,235,212,31,87,143,39,74,16,215,200,38,29,202,192,240,79,+233,142,191,16,32,152,239,107,1,31,27,16,93,60,247,44,150,222,23,132,+142,185,100,180,166,203,255,157,59,223,206,89,234,190,83,200,240,125,190,61,+44,136,215,24,196,85,202,167,182,201,187,99,176,54,76,115,35,102,197,9,+192,254,129,157,97,182,3,137,56,212,211,251,171,189,37,170,42,173,110,41,+174,51,153,210,196,27,43,121,137,134,141,106,151,14,205,78,234,221,237,225,+37,2,51,54,112,31,170,175,168,107,126,135,235,133,224,253,255,92,240,144,+234,85,141,220,38,168,228,79,17,62,35,143,170,188,141,200,86,164,70,92,+69,123,49,240,170,82,89,236,68,201,48,112,53,169,140,166,160,25,119,116,+52,224,207,26,230,155,255,0,126,185,77,65,190,176,135,125,245,67,201,17,+100,73,40,149,115,204,94,27,103,73,54,212,186,113,187,141,140,106,18,204,+33,176,1,42,81,146,16,79,85,25,0,24,137,226,150,100,12,108,252,145,+233,166,9,186,228,225,181,250,36,191,12,115,41,245,22,201,141,178,198,28,+94,104,112,64,138,186,206,77,197,120,99,66,140,34,184,64,135,255,180,98,+165,118,195,50,53,39,172,202,148,155,37,24,67,112,197,165,130,22,102,101,+204,171,54,215,65,122,78,138,116,205,113,54,150,226,61,227,74,149,103,46,+185,12,16,101,200,208,78,174,157,91,5,131,105,57,117,0,150,242,2,50,+175,68,234,81,205,4,223,218,96,10,74,49,71,102,214,147,128,212,225,187,+216,20,166,200,182,64,138,33,232,47,179,33,10,240,38,48,114,1,84,180,+45,21,172,244,61,237,2,80,34,124,38,215,68,27,92,36,127,190,42,19,+42,78,218,107,96,155,97,227,83,209,233,181,118,88,162,55,48,60,251,212,+12,244,144,204,26,45,56,245,246,71,60,36,232,218,184,194,31,234,166,112,+188,47,27,152,239,198,66,29,185,229,221,112,182,167,112,93,119,41,80,85,+22,169,168,146,185,242,140,50,124,233,76,83,153,40,224,67,19,93,195,212,+151,77,230,37,144,206,5,228,7,15,212,206,103,6,134,176,182,255,169,155,+196,70,138,116,202,156,18,213,236,164,5,129,244,213,28,0,74,72,239,66,+251,132,126,86,65,179,217,98,171,87,8,223,1,5,168,211,215,24,5,191,+194,235,63,233,108,56,56,159,18,199,104,74,74,113,2,68,28,53,135,94,+141,213,30,209,224,74,207,114,93,110,196,47,212,124,200,156,135,219,112,253,+172,7,94,29,61,125,129,153,127,91,247,138,16,143,31,61,209,208,96,236,+203,70,225,17,166,148,16,186,102,243,120,223,27,104,253,175,20,198,179,129,+204,236,223,131,165,72,195,183,152,241,54,63,238,191,90,121,15,243,223,36,+53,99,141,3,82,159,222,19,194,79,206,9,49,140,251,190,193,49,2,49,+59,30,201,39,104,57,124,32,41,202,185,145,173,70,239,75,167,203,112,214,+239,126,244,126,140,76,168,173,207,79,183,148,102,26,29,13,8,148,187,14,+52,65,184,216,194,250,37,203,93,173,157,1,85,70,73,115,217,214,116,51,+31,125,48,221,241,165,211,199,233,137,17,106,65,150,222,28,199,95,58,9,+240,137,69,84,5,79,250,236,233,37,39,29,154,9,59,56,228,11,192,49,+205,141,21,250,199,80,254,184,140,114,92,176,160,232,252,225,148,29,85,200,+12,246,58,206,242,147,54,67,93,42,15,214,112,155,40,87,233,176,236,144,+8,112,131,252,192,35,64,47,236,140,86,73,158,161,56,150,225,249,0,124,+90,18,241,80,215,69,192,103,100,125,127,171,214,176,160,75,168,22,107,173,+165,89,245,217,140,142,146,177,98,230,110,188,167,156,181,194,143,5,97,0,+41,120,18,91,196,15,54,159,100,77,20,219,124,112,195,96,137,93,130,98,+187,139,64,14,73,72,43,252,149,62,74,247,20,128,208,161,25,204,115,214,+80,45,249,61,196,200,72,160,221,148,135,145,51,194,204,125,92,110,90,155,+113,37,160,242,229,117,163,116,89,117,173,149,31,232,241,51,5,154,234,181,+114,131,116,99,196,236,213,226,1,124,50,174,9,85,122,246,44,189,91,192,+68,97,79,67,114,129,187,73,244,215,85,234,44,235,79,154,146,157,27,57,+34,187,246,113,151,113,126,224,11,234,183,168,207,166,37,70,178,153,120,98,+78,163,168,191,142,33,70,35,232,126,217,103,180,13,24,250,1,89,182,22,+37,210,254,65,130,80,117,23,240,200,163,179,205,172,219,50,248,75,190,201,+142,252,137,252,161,233,24,57,211,251,96,250,151,42,51,30,179,87,146,207,+2,79,168,16,198,42,85,104,48,131,216,66,205,167,9,101,241,176,148,32,+97,191,153,172,70,192,139,118,176,120,65,198,23,77,175,47,74,230,120,199,+93,60,132,210,39,62,140,88,189,217,154,62,25,201,150,53,158,83,10,107,+241,112,45,96,38,190,93,249,126,39,148,27,129,46,57,111,124,248,110,83,+82,56,157,148,17,159,250,14,67,153,171,87,209,90,101,71,187,101,189,232,+235,48,86,248,9,247,137,177,129,200,188,210,33,8,89,119,126,235,142,11,+116,96,81,188,46,26,232,122,138,190,44,38,102,46,40,23,235,244,53,123,+46,227,174,82,152,45,22,148,187,135,149,212,183,81,242,177,143,103,210,108,+87,126,255,79,225,26,225,151,194,79,61,165,81,104,168,179,1,101,236,80,+149,248,138,149,16,2,56,187,38,109,155,68,210,73,6,101,80,245,167,10,+135,177,194,51,238,52,42,207,165,224,181,44,108,171,5,84,36,130,227,84,+244,152,56,255,231,161,209,230,173,31,189,31,11,250,69,110,200,93,55,62,+101,30,224,45,213,136,223,94,217,137,47,205,191,163,9,209,174,151,152,122,+34,165,43,59,140,113,133,21,52,54,167,175,56,186,86,34,111,144,32,97,+248,236,120,146,141,167,36,127,9,196,120,120,176,67,98,253,87,233,155,208,+22,186,65,104,4,182,52,43,44,53,204,82,108,134,136,189,176,11,162,168,+203,96,87,14,84,253,240,129,236,200,105,141,9,209,39,205,91,205,232,165,+202,223,104,64,65,240,128,168,127,169,170,199,78,255,127,251,173,243,85,47,+131,171,193,20,214,248,178,224,217,211,56,97,150,53,41,2,224,27,19,12,+113,106,143,195,159,138,173,78,109,245,154,96,69,2,245,93,241,73,31,54,+56,67,250,153,127,203,29,94,63,43,201,5,126,12,125,217,213,227,69,44,+255,6,250,137,90,43,219,252,125,127,244,129,92,157,227,203,228,134,218,23,+129,43,26,204,253,104,56,139,56,24,206,11,208,240,205,5,251,175,58,235,+129,197,142,247,227,131,167,99,4,92,77,68,42,64,128,144,20,19,230,122,+67,14,225,44,119,229,179,128,214,91,49,139,158,41,57,60,79,208,204,75,+47,2,131,162,34,180,255,255,31,31,137,131,236,182,109,83,32,85,21,71,+227,10,158,170,11,216,101,186,133,8,18,73,195,41,96,211,122,74,46,202,+100,131,124,161,199,24,143,81,20,114,118,58,168,193,53,131,234,111,110,148,+78,77,32,252,11,87,163,2,43,118,255,216,76,168,174,67,251,53,148,98,+112,216,84,186,51,80,175,49,148,167,233,101,143,101,234,9,234,146,19,226,+158,56,31,199,203,10,106,173,124,133,209,91,107,171,101,95,157,200,240,53,+232,197,220,124,138,112,170,255,184,90,57,117,225,45,60,236,53,95,48,202,+99,73,144,64,255,69,196,140,225,73,232,24,155,53,237,191,60,120,30,136,+211,79,205,57,226,122,86,49,36,87,84,81,75,110,60,63,191,85,35,98,+142,16,162,246,201,65,37,247,134,154,148,58,246,255,215,37,100,163,46,211,+128,80,65,229,83,21,154,188,249,104,192,141,127,54,216,90,236,252,47,121,+112,49,251,76,85,189,7,209,200,75,81,22,191,16,96,231,95,55,64,161,+210,126,47,121,184,30,185,36,142,25,229,148,177,69,84,23,161,80,115,64,+131,226,120,86,225,120,9,225,0,60,177,210,87,104,247,192,54,68,197,147,+174,21,4,16,183,1,64,11,136,130,228,78,9,20,219,81,44,149,204,137,+221,78,140,90,252,0,180,229,75,150,73,185,12,84,79,237,240,53,231,62,+89,119,15,3,93,24,242,14,81,149,241,210,193,232,17,139,11,163,221,249,+11,164,12,21,133,183,109,0,236,249,95,73,1,135,122,111,93,228,105,239,+141,29,182,98,51,222,233,229,128,108,129,12,246,80,90,242,227,52,27,59,+90,78,135,214,66,20,114,214,125,99,198,113,239,52,135,195,168,92,53,207,+167,50,255,134,215,233,236,195,247,225,59,241,24,246,195,65,36,7,71,140,+250,138,45,97,9,101,128,188,136,194,35,238,10,226,252,109,196,123,237,92,+236,136,77,210,180,206,52,229,12,57,87,214,222,215,189,190,240,161,126,137,+215,87,170,79,8,82,199,198,38,179,96,164,141,175,199,150,227,62,222,241,+142,228,169,121,152,132,84,152,57,71,214,81,67,227,197,186,91,231,69,186,+32,248,10,90,111,208,71,164,132,254,23,161,77,115,73,213,193,79,10,195,+16,32,25,239,113,242,228,182,169,143,4,120,238,79,99,62,72,19,61,100,+180,124,174,175,244,193,140,92,141,61,134,159,95,202,61,185,247,250,154,204,+38,209,132,117,29,32,41,70,21,137,116,37,177,247,223,250,187,79,72,115,+212,199,18,21,39,28,244,179,14,174,227,188,113,90,50,35,125,10,80,70,+95,161,21,206,104,115,69,22,5,214,44,6,131,59,231,179,238,12,237,223,+192,221,221,85,37,77,123,94,178,2,207,109,121,19,119,91,68,246,236,67,+172,222,96,158,251,197,237,149,3,128,159,243,159,171,60,206,213,131,41,125,+48,134,53,252,253,1,43,186,54,82,174,25,41,232,37,71,48,43,10,218,+106,207,56,203,78,165,246,159,38,94,86,21,233,127,137,156,78,55,114,226,+57,149,107,216,130,99,202,251,223,67,199,73,219,42,49,218,247,227,157,155,+87,31,158,135,68,143,18,85,196,13,133,227,171,22,201,233,187,91,16,215,+2,68,140,73,158,43,86,15,105,103,20,253,232,155,62,28,212,203,226,63,+164,53,173,38,98,91,247,172,36,150,4,181,164,15,199,251,188,196,76,205,+181,108,94,196,97,115,49,197,232,51,48,243,127,78,128,40,218,136,154,89,+138,171,243,182,116,97,117,183,231,27,109,34,87,30,113,177,43,2,167,1,+9,198,229,44,162,229,73,108,42,176,239,206,127,214,148,127,167,89,200,179,+156,112,60,174,145,191,92,73,244,24,122,33,202,184,238,184,176,26,57,3,+238,110,48,115,203,25,167,207,61,145,214,141,233,111,246,191,131,244,44,179,+150,84,194,136,112,91,25,63,103,4,67,117,23,29,74,79,105,49,129,21,+183,192,27,68,241,255,60,184,253,170,225,194,205,178,8,121,216,148,230,223,+192,216,86,93,38,209,238,109,214,79,119,250,186,169,215,40,93,143,65,221,+235,4,168,14,238,247,29,110,129,133,173,154,62,175,194,255,1,85,64,167,+173,66,224,77,83,177,212,84,109,139,120,54,111,118,23,186,5,152,68,51,+7,101,102,53,242,195,155,205,29,124,153,164,240,151,195,68,80,146,4,124,+0,147,244,210,70,152,242,117,105,197,110,25,254,207,133,3,18,147,5,116,+34,174,165,59,234,162,233,87,210,68,39,138,98,193,9,183,101,90,189,99,+220,130,37,197,121,173,226,214,124,150,198,222,19,162,110,181,142,240,145,71,+201,198,194,152,196,112,110,66,48,186,99,225,36,215,200,228,57,30,48,37,+130,60,50,167,255,68,126,157,129,154,163,15,239,89,191,87,68,123,246,229,+105,36,50,91,99,21,35,177,67,241,142,218,239,232,66,52,101,64,60,147,+45,66,1,166,88,149,224,209,224,180,159,196,14,217,225,227,126,38,249,164,+158,192,28,30,251,110,64,237,243,24,5,144,153,81,237,132,95,102,231,84,+88,65,244,217,128,212,215,143,116,78,180,70,231,113,123,144,167,151,110,107,+54,56,243,128,4,44,121,120,41,239,27,63,55,255,97,18,157,233,171,90,+201,91,113,248,243,151,25,11,193,212,12,37,80,96,170,124,13,165,144,25,+29,157,232,12,218,77,230,245,74,154,113,160,187,34,45,114,126,203,145,19,+218,82,197,189,89,156,164,165,212,121,14,115,112,230,82,254,101,84,108,208,+153,51,7,28,63,62,122,191,90,91,23,55,54,143,252,13,84,36,19,35,+30,65,147,134,199,35,2,159,114,169,141,110,207,224,223,51,209,84,27,130,+32,192,143,104,14,114,203,66,25,63,153,71,80,27,54,132,75,143,224,133,+148,210,7,210,53,46,174,94,16,30,97,42,119,111,163,210,110,228,21,195,+46,40,97,250,214,224,249,234,190,227,184,171,1,227,29,114,120,28,123,77,+105,87,227,36,225,253,129,204,50,107,92,160,24,220,51,126,239,14,169,10,+234,186,134,39,55,139,169,22,142,21,149,177,20,150,237,212,81,89,19,68,+93,102,129,200,219,39,122,244,117,145,151,47,67,75,218,157,33,65,53,60,+12,41,185,209,67,219,158,240,72,56,57,25,121,56,193,103,155,165,186,54,+99,216,157,239,31,108,211,51,247,118,203,160,99,79,22,134,54,192,19,42,+0,142,238,18,232,119,45,219,69,226,32,43,217,200,23,59,45,160,25,23,+44,85,66,220,110,203,188,235,60,193,250,49,235,72,59,223,219,57,219,102,+197,101,73,0,210,220,134,183,34,3,247,124,186,106,113,106,234,109,77,169,+180,62,209,107,203,114,143,185,99,72,62,117,187,48,21,125,56,152,245,191,+209,246,236,158,17,91,22,18,45,139,38,12,113,13,146,239,174,255,75,164,+5,120,106,42,138,213,235,254,90,141,28,91,229,238,164,199,205,1,164,141,+185,103,254,43,71,59,157,82,108,44,66,110,206,36,182,166,0,172,195,74,+160,140,43,114,248,198,1,27,107,119,41,87,221,148,133,67,96,111,99,139,+56,58,148,211,200,172,158,28,36,12,242,234,221,14,219,0,100,140,56,9,+130,235,0,45,25,92,111,79,26,118,9,111,98,149,135,84,131,232,228,224,+113,165,255,100,152,159,76,166,63,255,199,89,219,214,59,194,24,7,84,91,+224,162,15,80,106,125,111,205,187,183,26,196,17,167,123,95,137,254,36,23,+124,141,231,14,3,99,89,85,139,155,173,10,5,200,89,153,165,179,48,100,+95,100,219,221,109,128,178,63,202,177,195,98,239,31,60,19,187,80,236,134,+172,117,60,6,92,93,57,30,148,64,14,255,183,86,109,83,215,168,29,56,+245,202,107,85,210,73,104,204,248,42,22,58,80,7,159,241,7,120,31,216,+228,229,107,173,178,177,71,88,123,180,148,245,168,64,14,101,246,173,199,120,+96,85,136,186,172,63,198,70,252,12,178,250,120,49,130,79,195,96,117,190,+136,232,212,82,148,18,240,58,37,24,254,27,53,242,3,75,153,71,193,77,+118,178,128,73,251,232,113,87,245,211,51,35,22,164,147,69,79,134,197,202,+116,109,223,248,161,102,45,111,108,16,226,6,45,172,153,148,170,52,55,62,+205,202,240,232,254,130,212,77,88,110,166,115,158,222,48,65,254,60,234,79,+2,27,170,153,190,214,208,245,142,127,248,211,18,120,76,14,34,117,50,71,+108,216,139,90,108,190,238,192,223,184,151,62,56,28,233,65,95,34,95,140,+224,161,21,69,54,26,135,124,33,59,17,221,99,131,137,36,145,90,106,113,+184,197,42,137,63,179,74,48,104,101,72,198,181,146,224,71,187,112,165,48,+98,73,73,209,38,83,127,142,181,166,217,113,43,241,194,103,142,29,27,225,+54,232,179,228,28,144,182,190,157,248,20,125,195,111,129,187,36,84,144,88,+116,93,3,252,69,41,133,76,104,57,14,220,158,176,230,74,109,245,106,59,+158,194,119,243,162,249,233,21,134,187,253,4,196,135,0,149,71,118,58,18,+102,69,225,162,1,213,72,0,195,139,129,230,151,121,172,77,145,67,117,249,+203,202,214,78,37,88,100,110,104,2,166,198,91,114,8,105,108,116,0,2,+196,197,20,234,79,84,130,85,88,118,149,11,137,218,89,252,114,5,227,193,+100,21,195,255,109,102,146,95,54,239,58,18,236,32,157,88,243,133,170,231,+134,142,24,150,32,24,11,205,38,2,136,247,183,181,253,227,38,74,202,254,+100,172,53,91,193,207,167,23,112,189,165,133,139,238,68,244,238,243,167,155,+109,173,49,87,89,75,207,212,6,24,133,219,200,206,246,252,102,250,152,81,+166,81,220,84,82,165,43,95,57,24,207,213,35,42,148,73,248,246,121,69,+103,21,208,14,82,213,73,50,108,195,190,72,50,30,36,227,179,214,165,75,+127,149,19,78,58,157,34,112,64,98,130,39,51,230,1,42,50,59,93,223,+120,104,63,97,20,95,77,184,243,39,237,125,83,32,119,205,176,210,149,200,+109,1,53,42,38,4,15,90,169,24,228,237,17,153,185,71,173,185,54,34,+113,187,254,63,4,139,174,129,90,108,64,159,6,6,155,117,139,130,50,37,+217,247,93,129,245,79,41,95,82,134,189,153,151,163,177,241,237,17,156,250,+216,133,103,161,212,89,122,239,0,90,154,49,192,244,182,131,145,106,208,169,+245,238,229,203,183,156,138,254,188,200,53,236,248,153,152,205,233,81,41,105,+166,5,246,182,213,99,162,216,245,83,105,123,179,15,102,9,0,29,65,35,+157,230,91,161,37,71,88,198,216,235,93,194,112,104,91,65,54,237,101,246,+146,189,103,19,228,4,108,135,82,138,73,246,212,75,161,37,42,130,216,16,+239,127,20,99,206,147,121,255,236,153,8,78,135,176,38,106,112,45,165,139,+150,103,95,15,66,53,27,121,215,124,217,6,20,41,33,118,173,159,118,38,+12,168,109,199,173,227,48,35,165,15,119,160,77,152,59,85,118,5,214,186,+132,64,100,81,139,216,142,119,123,131,250,12,41,126,182,150,230,224,134,52,+167,106,39,57,96,95,175,224,187,90,182,107,184,92,107,213,114,251,185,231,+14,200,221,164,95,243,55,126,88,97,32,1,144,143,42,254,113,215,140,178,+163,14,103,30,248,153,38,170,241,37,229,187,233,24,179,125,149,103,60,200,+221,101,207,99,209,93,52,192,179,9,171,48,175,76,223,111,47,24,251,107,+210,44,254,199,247,209,77,32,106,118,39,74,227,43,236,104,92,112,47,11,+174,229,223,177,183,80,102,206,118,234,95,136,181,220,105,55,7,39,104,14,+44,47,221,79,148,239,78,181,157,21,245,176,109,212,73,144,88,167,13,45,+105,222,204,16,25,35,23,224,19,232,173,143,245,45,117,110,161,231,27,202,+101,172,35,129,94,43,143,101,184,66,150,216,212,137,223,10,139,168,148,106,+36,224,42,4,87,151,140,144,6,179,183,188,98,160,166,208,209,122,21,64,+26,112,82,242,37,83,172,23,36,200,207,232,240,173,154,221,137,66,249,133,+142,54,13,50,251,90,180,65,192,102,182,146,85,80,34,161,108,148,62,207,+23,124,125,222,183,130,133,56,239,157,18,17,16,242,63,150,51,23,61,172,+140,67,64,182,29,141,34,214,251,226,67,211,176,160,111,176,157,159,104,113,+202,116,63,65,225,200,7,145,219,193,10,16,17,153,29,131,14,9,45,216,+235,158,135,65,38,243,219,48,0,182,91,135,64,11,100,99,61,140,44,146,+24,62,17,218,72,133,165,15,215,84,181,93,2,110,247,23,89,85,18,62,+253,11,182,180,227,140,167,64,214,221,195,191,19,152,102,195,58,36,229,66,+223,125,176,158,43,9,129,157,2,64,64,176,127,85,33,30,254,137,241,221,+18,251,65,252,165,210,151,2,113,22,119,50,10,11,35,170,154,19,223,45,+25,236,251,120,98,193,188,226,234,97,156,24,7,130,92,178,250,55,255,82,+57,141,232,173,181,81,96,107,106,26,92,119,138,185,226,154,247,154,133,175,+130,28,81,93,239,155,142,56,109,233,164,254,16,12,230,37,163,189,228,51,+0,129,19,254,219,122,137,22,134,217,57,225,199,88,189,81,85,130,129,72,+192,118,234,75,13,138,89,247,122,168,97,98,137,56,174,51,86,144,148,101,+244,186,76,195,14,86,117,119,192,187,170,153,176,123,232,104,219,49,30,121,+193,109,150,91,44,66,21,63,31,241,254,172,118,184,50,199,32,101,20,110,+131,40,222,215,253,64,65,123,161,48,174,208,94,147,61,47,251,47,88,22,+142,5,255,6,90,61,231,223,205,71,55,131,126,212,181,22,144,146,113,123,+110,57,89,83,158,18,64,39,236,125,96,179,7,100,71,207,56,236,151,168,+62,134,166,97,206,169,187,238,158,136,149,167,172,192,93,52,69,212,191,120,+162,182,66,36,119,117,132,38,60,12,172,87,188,95,140,232,244,83,164,190,+15,240,253,155,7,233,245,208,223,13,27,1,207,242,208,220,212,209,213,60,+252,51,4,200,191,249,242,254,123,0,240,110,87,6,199,222,14,48,163,209,+239,34,2,52,136,138,244,149,9,55,250,86,62,102,161,111,249,162,213,5,+27,228,233,140,169,135,45,216,82,216,98,122,103,142,5,54,109,153,66,159,+235,238,161,36,159,162,4,242,247,3,18,99,48,89,97,96,114,26,60,195,+247,209,27,136,175,41,82,170,117,4,10,72,108,182,207,140,25,137,229,33,+158,72,75,252,130,200,84,18,239,31,189,249,234,116,94,97,222,243,42,29,+2,110,214,216,222,233,49,19,127,182,19,169,148,5,199,75,139,89,94,175,+140,153,230,43,117,160,224,0,92,87,226,133,79,194,106,169,59,55,91,92,+99,148,37,91,20,232,238,195,78,230,41,121,112,217,37,223,75,22,123,198,+43,87,176,125,230,150,192,53,49,206,238,223,93,240,69,54,113,242,160,122,+110,195,116,180,134,59,94,190,225,10,70,135,125,7,242,116,56,181,118,176,+5,33,19,217,37,134,112,135,245,253,36,172,136,148,67,117,205,88,252,94,+212,29,159,78,24,241,72,152,252,165,204,192,162,138,211,15,244,194,4,139,+217,211,113,34,219,52,212,102,100,198,78,201,215,148,117,57,89,106,200,68,+255,143,234,176,73,27,152,98,127,92,123,112,194,142,250,64,85,3,57,133,+235,106,119,87,179,106,20,68,223,234,69,219,187,85,95,173,181,68,145,69,+179,110,236,145,20,97,204,94,109,41,156,66,213,95,111,188,100,219,172,0,+57,62,69,232,46,232,180,115,207,196,39,10,129,150,159,67,97,58,253,189,+171,109,16,215,120,149,199,10,219,221,51,104,191,169,28,16,129,250,247,243,+249,26,233,249,228,79,120,75,33,135,52,251,160,35,212,36,151,235,237,56,+46,155,61,222,200,122,199,250,56,89,232,128,65,197,189,76,157,225,115,13,+196,66,48,176,14,121,93,63,130,34,121,44,2,252,179,120,214,173,44,198,+16,174,66,44,6,30,56,25,58,23,134,189,44,203,13,133,87,88,57,131,+99,59,119,238,74,198,31,85,135,18,184,9,38,70,217,154,85,225,66,4,+137,129,200,15,190,96,65,87,52,23,237,8,125,133,75,135,171,20,74,40,+161,137,156,15,241,7,99,85,141,202,159,118,154,190,162,74,124,181,11,24,+38,0,230,107,144,5,243,135,201,241,131,3,205,182,218,31,203,180,219,224,+251,185,188,138,152,201,37,28,116,1,234,243,109,116,206,245,146,27,81,223,+233,241,218,34,93,130,221,70,160,100,70,90,230,70,76,160,66,237,206,142,+66,38,214,249,11,56,234,115,242,152,86,199,214,164,71,224,187,165,32,154,+180,252,82,179,165,10,194,105,99,123,249,21,143,242,140,131,113,222,51,166,+141,173,233,231,76,155,85,233,92,63,152,108,223,50,25,234,164,236,96,243,+53,149,201,169,93,125,75,126,255,254,163,113,130,42,120,12,84,158,147,251,+129,124,198,5,176,192,172,9,72,2,64,77,90,125,214,245,236,117,134,47,+187,211,128,70,155,7,19,153,184,153,177,103,73,104,30,161,32,194,146,1,+242,231,250,195,55,244,170,239,70,8,137,24,213,53,97,127,11,150,133,155,+134,62,55,200,193,156,202,219,160,75,82,0,133,30,107,55,229,223,15,47,+153,65,215,59,178,34,209,208,74,231,70,68,45,11,0,213,2,186,231,1,+14,18,169,78,132,112,162,85,35,175,162,124,85,52,134,63,116,230,173,183,+17,167,28,239,83,180,105,192,90,127,117,197,163,31,70,249,172,106,22,209,+9,3,85,165,198,149,67,76,251,83,200,100,68,218,0,157,226,232,108,155,+220,209,42,149,75,78,246,168,131,186,57,232,50,158,126,114,125,136,237,255,+209,170,135,160,138,180,76,68,28,169,24,179,189,136,57,29,218,247,252,38,+247,200,109,156,179,8,250,187,57,125,130,135,89,70,143,69,218,97,128,236,+228,12,110,77,126,106,236,80,188,133,102,122,72,50,189,38,249,1,7,226,+159,99,76,109,82,204,19,68,224,102,131,90,144,37,105,1,182,226,5,209,+106,210,136,243,166,73,178,173,2,78,52,6,189,212,231,58,104,86,184,136,+226,105,187,12,133,13,66,239,70,179,185,72,242,39,77,75,71,179,163,97,+204,33,36,20,193,206,19,101,55,253,69,22,29,223,39,6,119,114,147,222,+106,234,128,198,93,179,134,161,99,119,35,141,79,83,236,210,85,22,142,9,+204,114,8,152,0,21,211,93,58,238,236,143,148,12,221,115,116,63,60,83,+142,255,239,174,238,200,91,181,43,224,128,217,42,40,173,238,235,37,34,16,+96,79,38,255,178,131,58,255,50,159,10,115,37,197,195,58,75,5,81,98,+36,196,48,82,119,226,103,88,147,144,245,218,41,216,193,71,149,88,46,102,+20,121,132,80,1,178,31,194,250,87,102,246,203,90,28,150,123,254,191,21,+247,185,44,200,216,208,240,244,16,195,92,122,66,13,243,85,160,207,190,187,+222,67,235,32,220,146,70,201,140,62,18,32,153,226,190,74,56,37,21,149,+143,91,145,27,38,64,239,38,46,103,76,181,97,80,0,150,55,6,28,216,+56,16,239,113,236,33,157,150,141,173,223,4,110,253,80,38,147,229,129,152,+189,106,240,135,164,140,249,250,139,50,229,204,66,37,240,69,158,24,231,162,+97,98,16,5,120,124,147,133,75,31,134,183,218,27,19,239,92,247,254,174,+239,164,114,92,87,41,28,114,189,126,66,220,217,206,196,179,38,13,152,62,+239,181,199,50,52,204,211,187,1,43,249,14,42,177,227,221,49,101,234,131,+30,166,24,101,185,203,80,84,101,150,17,68,55,85,168,88,180,175,146,57,+144,72,143,18,87,255,159,245,140,71,119,250,143,14,79,183,149,137,112,105,+107,216,89,153,181,212,5,18,232,123,45,255,161,97,195,105,141,73,252,42,+164,134,51,10,68,233,138,73,118,146,19,157,231,47,252,100,7,242,73,45,+175,198,116,117,177,100,203,246,113,2,60,129,78,1,38,79,247,40,183,192,+216,79,159,13,213,23,62,74,181,26,2,19,181,6,127,207,214,163,63,254,+125,219,139,164,70,33,251,37,248,215,200,137,25,199,240,20,108,119,153,122,+119,196,139,133,51,26,218,186,62,59,227,215,254,105,243,208,249,64,163,41,+233,19,115,178,221,229,247,58,203,251,48,140,222,127,80,164,179,61,90,9,+104,99,112,245,199,214,64,168,142,176,214,15,137,169,110,160,30,22,215,1,+119,226,196,3,54,251,253,213,114,230,152,70,26,14,255,226,218,42,165,169,+117,163,161,77,105,64,15,161,107,245,199,111,73,83,211,197,88,84,245,32,+211,160,67,181,116,212,102,70,219,232,179,155,17,204,36,45,212,223,60,52,+25,105,207,79,79,223,252,58,83,236,215,129,243,192,253,153,242,200,82,186,+48,246,105,205,51,73,68,211,217,95,157,82,5,122,138,212,47,165,162,126,+64,120,171,242,132,140,0,48,184,15,120,114,223,188,143,170,34,119,129,250,+84,94,110,209,157,5,26,118,132,23,151,3,22,148,97,234,252,201,20,51,+252,192,168,188,181,20,214,27,162,227,165,130,24,45,232,181,12,202,163,75,+160,127,223,184,50,127,27,196,146,86,250,59,81,181,26,56,225,108,66,93,+218,153,58,31,99,100,78,96,97,180,175,181,181,245,22,7,168,118,215,4,+43,82,163,50,173,152,231,111,184,144,251,179,13,45,116,19,133,186,254,5,+47,130,79,88,251,161,244,7,148,63,56,233,243,25,240,26,52,111,88,37,+36,22,77,171,190,169,213,200,43,26,114,139,249,167,138,38,51,122,80,74,+118,23,211,131,200,153,115,135,98,237,96,183,246,67,93,83,251,191,22,90,+129,48,56,14,240,41,201,135,174,147,169,46,1,244,146,136,43,95,11,192,+34,134,97,95,65,200,96,135,61,59,56,59,199,149,212,82,148,50,118,78,+70,45,143,172,237,210,34,232,199,33,31,224,207,222,139,113,86,97,75,145,+31,133,157,107,166,26,92,144,35,12,48,250,63,68,193,147,181,51,135,170,+17,248,235,150,206,105,46,124,220,215,156,216,53,169,208,140,35,176,194,203,+198,78,86,142,188,56,94,166,186,63,84,136,88,150,87,171,91,147,30,188,+94,39,28,240,230,163,135,138,96,93,0,49,145,115,222,101,78,67,44,186,+236,23,179,160,79,240,126,198,167,14,159,8,243,213,50,220,46,83,132,229,+87,8,223,144,45,22,137,70,35,128,85,106,236,238,86,30,131,144,151,218,+10,103,37,77,133,20,151,65,37,245,165,17,51,230,230,185,82,162,252,173,+50,212,118,109,83,253,32,136,243,192,85,76,238,173,217,1,246,114,219,252,+227,2,86,154,240,69,166,120,34,30,17,36,215,30,107,216,96,41,120,50,+215,49,238,48,66,199,35,26,221,134,198,38,1,127,32,96,158,41,186,222,+46,184,50,5,146,4,9,212,158,191,128,106,197,212,92,107,59,129,155,38,+160,136,206,110,149,149,207,133,179,248,21,198,140,243,37,195,202,217,134,232,+50,252,79,145,38,2,195,55,16,155,77,154,52,143,155,60,231,193,125,31,+166,61,156,1,112,196,163,223,38,91,79,172,82,248,95,22,17,80,216,248,+39,92,24,166,54,147,172,140,100,232,190,13,3,24,210,148,222,166,11,225,+52,69,244,109,213,136,89,203,22,59,33,179,150,177,204,92,95,187,180,7,+233,48,161,51,148,8,136,129,56,86,123,41,51,129,12,194,124,158,235,40,+27,225,253,68,206,17,12,205,212,133,75,7,186,67,150,4,38,107,89,31,+124,68,209,143,242,93,148,1,240,206,177,71,63,250,110,68,63,230,161,254,+160,242,240,57,175,207,246,152,202,6,179,235,191,33,75,246,43,44,203,47,+53,188,208,0,248,67,228,165,10,25,195,254,100,22,18,32,117,254,116,65,+131,141,1,152,210,134,18,92,243,143,102,68,179,31,151,19,9,73,194,60,+195,252,251,92,36,46,160,240,4,118,242,64,235,239,121,83,242,141,205,8,+253,139,140,29,22,61,220,139,237,113,51,182,101,47,167,144,223,91,68,118,+6,120,208,239,132,244,54,43,131,249,53,179,39,94,69,220,136,144,201,23,+2,199,75,232,235,196,91,207,108,36,91,54,131,61,63,47,90,107,72,188,+8,146,159,77,11,172,117,137,179,12,87,41,226,240,30,41,148,32,143,116,+97,41,248,33,230,213,228,68,16,17,212,75,218,81,143,182,50,179,50,86,+107,0,254,222,106,177,12,191,63,47,214,75,155,127,135,70,222,113,115,226,+238,135,33,69,252,82,121,106,31,120,185,109,47,237,171,48,249,79,194,155,+59,22,91,179,164,212,140,211,192,162,31,154,89,117,115,214,87,132,4,91,+96,101,18,110,209,83,206,86,128,5,213,39,216,126,121,202,49,202,49,6,+13,105,19,93,215,202,164,112,250,118,83,84,35,229,168,141,196,66,141,158,+67,79,113,44,99,127,117,55,134,6,169,222,81,128,107,169,253,64,235,176,+127,196,0,142,75,160,3,34,177,6,0,95,34,46,241,255,235,186,28,61,+247,117,83,2,13,13,113,52,69,185,224,20,153,254,187,244,174,129,47,21,+212,227,34,186,179,49,160,69,118,0,163,129,128,91,157,47,141,171,67,119,+56,107,194,67,176,111,194,138,221,213,167,159,78,221,166,32,154,142,28,254,+221,72,1,123,114,252,93,107,211,122,1,131,1,137,39,171,226,112,67,32,+109,126,30,129,101,183,214,124,69,245,64,95,23,236,4,164,12,95,247,215,+153,193,209,11,32,53,113,227,134,247,185,177,233,157,191,196,201,47,75,40,+193,117,85,34,120,76,210,249,198,116,232,80,153,141,149,164,32,120,51,122,+95,112,54,177,89,121,235,50,62,86,2,46,77,143,119,35,221,40,239,34,+153,35,88,204,90,170,250,190,163,77,161,86,174,205,68,245,94,129,202,193,+156,73,181,122,86,189,138,24,193,154,228,218,63,20,98,137,66,249,135,83,+239,4,151,172,223,179,155,161,90,240,148,41,229,189,164,21,1,102,139,93,+37,216,255,63,86,105,220,244,67,244,189,179,16,29,16,143,176,60,245,58,+11,203,208,139,107,65,83,154,86,115,204,132,131,238,99,143,100,101,6,216,+60,147,75,26,96,176,232,153,145,23,243,203,167,82,192,125,188,216,49,80,+142,157,243,156,172,37,239,150,232,142,43,48,108,150,198,8,110,208,0,95,+140,213,182,182,119,152,62,161,168,244,155,229,238,1,47,233,120,18,133,243,+93,69,43,33,157,47,41,218,212,111,66,88,139,1,84,143,119,82,205,148,+199,192,195,221,50,199,209,29,109,245,146,54,34,6,126,247,181,32,152,119,+236,52,15,154,84,109,77,152,207,167,2,110,143,27,148,98,25,145,39,21,+203,43,255,171,61,55,185,182,71,68,79,59,189,199,63,254,168,240,11,231,+79,57,47,44,53,211,95,202,210,230,50,37,221,84,169,114,29,140,31,3,+19,91,182,171,254,239,184,241,46,98,213,134,157,28,132,147,249,52,186,141,+72,94,125,239,100,62,26,28,35,119,255,58,211,141,145,78,136,131,43,15,+31,94,238,214,152,178,171,51,2,238,17,107,25,55,231,26,243,6,89,74,+163,89,75,148,96,120,16,187,75,95,57,191,44,140,44,52,233,171,59,235,+198,238,83,84,91,115,66,123,105,163,102,159,194,33,135,210,50,156,39,176,+74,150,188,21,17,165,165,149,30,106,70,182,131,62,26,26,89,198,160,251,+244,7,41,161,144,197,252,8,158,90,65,11,81,80,83,211,240,250,121,24,+122,42,62,122,133,164,19,17,165,147,82,243,145,239,166,152,10,42,222,145,+19,219,32,146,133,129,46,107,173,42,13,71,156,100,125,218,151,155,170,67,+53,83,97,250,253,88,245,192,102,0,216,179,114,57,201,150,233,48,13,187,+35,57,18,77,116,242,202,167,100,220,121,48,36,8,239,235,203,5,45,231,+6,147,0,229,71,135,93,52,189,218,49,108,74,120,22,165,154,191,131,99,+129,200,73,27,95,202,127,107,149,25,101,173,1,132,120,208,104,21,118,187,+116,188,225,134,133,29,134,45,61,135,166,191,135,89,129,190,10,140,209,217,+100,136,243,229,164,10,27,177,169,52,66,192,48,166,52,138,0,79,39,51,+223,102,26,207,50,220,155,67,204,64,20,26,145,110,204,78,48,194,178,37,+25,137,245,122,79,116,56,227,249,192,97,198,102,14,147,94,231,217,228,67,+125,188,237,52,208,101,189,236,226,101,160,81,76,174,159,217,93,92,50,138,+21,190,242,44,152,225,77,86,18,201,200,167,231,78,57,41,165,214,71,96,+51,153,13,134,90,139,131,126,131,65,167,198,200,18,208,183,137,227,189,23,+119,7,234,167,28,14,205,52,167,78,150,249,84,124,233,104,175,135,227,116,+216,73,218,19,206,131,10,164,59,84,93,252,60,4,49,65,60,209,205,138,+89,184,211,226,245,121,79,121,242,107,196,81,157,60,74,225,147,32,22,70,+131,177,86,245,105,6,200,148,71,82,66,40,141,77,202,94,130,147,162,114,+162,39,155,119,125,112,116,210,28,130,81,217,107,179,76,97,122,61,233,216,+158,76,111,229,196,254,152,26,126,99,142,44,210,102,60,80,135,60,93,109,+95,27,122,167,33,243,230,134,111,160,187,162,63,28,232,131,226,75,193,200,+99,143,125,33,87,211,172,52,151,115,53,146,122,71,129,199,138,126,223,187,+240,189,187,77,235,254,224,91,160,234,78,118,249,248,206,255,60,133,194,29,+188,61,140,52,35,31,164,138,254,80,213,99,239,156,227,138,250,80,255,105,+118,69,147,249,194,0,170,127,230,165,149,139,46,65,22,91,180,245,244,180,+208,199,138,127,255,181,40,210,136,12,216,137,156,236,163,188,88,175,217,240,+148,97,93,214,242,73,225,166,89,175,229,255,168,92,47,143,187,145,235,105,+56,29,226,244,115,83,118,188,189,69,156,37,129,11,176,99,97,222,207,158,+156,157,193,223,131,11,132,83,114,229,135,202,73,159,234,132,16,221,35,35,+37,236,246,118,19,190,219,203,172,35,167,79,144,134,104,171,60,108,64,10,+5,108,16,3,165,141,76,1,253,244,185,163,3,35,52,254,165,207,7,132,+25,61,237,7,153,109,89,249,29,208,61,71,34,13,201,204,227,34,72,130,+167,183,181,120,213,32,71,168,72,23,234,161,79,14,186,165,226,232,111,135,+255,178,198,15,101,102,146,16,27,64,72,28,137,105,120,240,104,230,23,50,+194,49,177,157,17,52,208,48,145,69,28,87,220,42,13,78,63,239,225,237,+22,142,135,174,88,6,153,212,145,220,41,91,182,255,70,226,201,234,8,37,+48,217,65,22,26,105,30,59,172,57,17,101,8,21,12,108,163,236,64,100,+100,174,204,228,97,125,63,100,33,235,237,93,121,7,141,229,45,7,98,95,+183,31,167,65,18,239,2,111,188,0,212,220,216,239,75,216,99,215,56,232,+179,235,48,185,216,22,62,101,131,81,136,3,109,28,192,37,107,9,90,238,+37,43,230,28,66,194,20,62,168,238,108,43,123,234,137,120,51,86,35,103,+235,124,30,197,206,252,239,44,1,174,253,26,219,34,127,210,216,182,187,73,+253,21,6,33,108,97,243,99,216,135,248,243,141,139,217,78,235,48,234,90,+83,198,90,106,210,222,163,40,182,179,70,67,163,239,207,58,204,224,75,101,+112,198,33,94,177,60,82,248,210,24,140,65,65,144,168,109,225,190,4,106,+17,114,183,13,61,251,177,222,244,226,231,98,20,17,91,194,89,106,230,167,+187,57,70,98,181,136,232,206,51,192,187,248,187,246,157,67,24,146,164,84,+69,134,225,7,190,192,66,11,68,96,251,98,223,129,184,156,178,32,195,170,+134,79,39,239,243,216,132,200,171,113,3,209,177,109,204,130,76,187,27,79,+199,211,177,70,175,112,75,33,234,192,87,125,250,81,211,77,30,242,232,129,+197,95,158,147,49,190,166,26,59,146,23,186,52,115,112,255,221,133,141,131,+15,62,30,165,181,120,13,44,9,81,136,80,138,208,16,43,12,3,174,207,+217,62,228,196,20,205,74,57,238,203,99,6,8,102,162,115,16,144,95,10,+202,73,27,34,55,160,196,81,255,82,27,15,129,170,49,15,1,74,23,15,+106,111,44,97,84,157,117,186,103,53,35,199,198,210,43,255,154,196,128,163,+246,134,130,34,99,204,157,103,162,25,207,202,46,68,143,211,182,116,139,242,+239,85,184,144,55,247,249,121,99,148,251,145,94,81,118,22,132,99,131,245,+114,249,241,112,198,127,234,218,40,8,50,98,245,179,118,66,235,102,156,45,+162,188,44,23,220,237,250,54,201,152,92,193,157,122,40,158,59,143,184,34,+157,148,244,145,196,201,176,141,21,223,202,172,173,104,207,6,226,190,11,63,+18,149,112,218,22,88,223,95,224,89,11,94,78,23,14,11,167,132,221,137,+62,15,94,153,220,77,227,59,75,66,143,63,149,169,112,231,199,22,242,190,+149,63,11,91,12,202,48,166,155,98,212,179,7,21,180,208,160,33,195,116,+168,28,226,71,154,54,6,221,57,153,121,28,103,124,211,188,154,10,220,110,+254,239,117,237,231,179,62,229,186,183,200,132,144,176,254,58,190,127,120,101,+214,198,62,171,153,131,21,226,208,79,252,63,68,159,247,132,191,133,112,135,+11,188,44,9,202,3,169,60,53,231,201,166,92,103,239,143,78,110,217,95,+26,172,113,238,234,88,193,5,214,41,90,30,12,212,177,162,216,252,179,19,+147,208,52,145,116,71,24,247,206,237,78,235,206,81,56,40,47,249,196,12,+157,222,96,199,220,205,173,166,144,180,219,203,109,140,118,0,151,10,25,201,+55,200,193,187,134,15,210,18,59,213,26,213,89,17,69,129,101,162,190,63,+43,47,220,76,158,213,67,48,156,50,76,243,200,98,30,158,113,30,153,36,+104,239,59,76,98,106,168,153,0,145,74,226,101,61,159,183,119,33,226,69,+112,116,113,123,65,252,53,137,89,103,212,255,134,234,166,84,15,209,217,120,+178,4,156,147,193,221,145,225,88,244,131,12,214,64,10,105,205,147,141,62,+24,201,191,87,79,26,10,242,131,116,42,98,156,143,213,108,215,44,57,52,+21,174,4,189,246,244,230,239,64,82,175,105,132,72,145,79,185,3,133,154,+80,242,228,20,151,189,151,177,200,201,152,149,209,153,245,161,14,204,151,144,+81,239,219,60,108,150,211,82,226,15,154,167,160,242,130,161,213,183,17,48,+129,193,88,61,10,104,227,181,65,46,182,206,80,210,75,101,131,251,59,14,+23,128,25,211,249,253,55,118,203,139,147,166,237,235,15,101,15,101,3,10,+38,164,135,190,150,68,153,153,234,239,89,119,23,164,115,164,221,227,137,228,+161,209,117,46,73,239,222,119,149,109,107,202,33,134,170,79,87,31,131,206,+189,165,25,43,247,4,31,14,92,170,115,215,17,167,8,219,10,151,87,156,+28,30,243,118,38,194,57,236,85,211,220,120,245,77,200,92,41,163,80,136,+222,170,154,45,224,151,76,85,175,159,98,73,131,86,113,100,202,186,170,80,+4,170,139,33,210,10,2,146,128,83,25,152,90,116,127,179,138,154,138,229,+178,33,12,25,90,169,198,59,27,29,142,229,148,216,196,233,43,231,204,62,+70,225,151,114,246,104,162,107,145,201,28,46,170,227,239,62,41,130,130,206,+72,160,94,28,126,229,149,0,201,87,89,94,253,245,20,166,83,72,100,54,+85,190,175,61,56,55,23,170,193,171,223,135,14,99,80,39,243,219,175,141,+47,149,172,132,17,53,203,202,79,30,214,8,126,233,68,12,167,174,39,198,+93,190,194,225,227,196,103,23,184,95,209,85,189,220,234,160,161,143,101,194,+143,153,89,108,203,244,206,236,216,195,177,113,227,67,8,200,108,136,91,162,+117,215,92,128,102,77,186,24,229,159,199,114,178,61,228,14,56,118,72,62,+145,0,87,113,219,247,6,222,183,24,93,52,148,116,170,173,24,250,114,97,+11,144,33,71,244,167,5,101,190,219,125,96,163,94,33,239,20,56,36,189,+158,71,7,53,182,186,187,181,111,112,41,91,124,238,74,81,39,137,178,125,+168,172,180,221,209,205,54,152,33,1,197,143,171,35,117,73,111,221,194,221,+122,64,62,89,63,224,170,105,8,125,71,184,25,218,210,202,33,237,196,123,+68,185,52,172,148,144,238,191,3,99,156,136,100,61,231,248,64,144,29,70,+156,246,247,250,104,206,35,8,64,230,7,119,14,204,116,109,228,0,23,26,+54,168,216,172,107,231,83,148,191,147,58,251,30,49,131,217,94,162,68,34,+87,186,92,51,138,10,228,165,91,233,66,92,221,12,118,34,20,221,106,153,+41,32,226,26,27,173,19,213,235,92,163,28,43,197,22,184,58,238,250,14,+123,165,209,114,129,191,147,171,32,185,183,30,243,148,86,51,114,132,175,1,+92,195,193,192,221,249,118,109,37,176,69,145,49,170,255,159,65,249,246,186,+201,193,22,161,181,225,173,188,167,200,252,248,101,203,245,169,245,52,86,211,+6,119,78,58,101,94,166,181,151,39,163,212,153,71,165,80,121,49,127,223,+46,106,230,107,132,28,170,69,244,134,251,9,82,77,47,68,104,188,8,251,+125,11,14,230,17,51,53,239,225,111,121,60,66,253,188,127,227,139,209,239,+62,91,17,153,78,15,215,223,252,186,220,245,38,138,150,38,160,154,107,152,+222,33,240,169,244,194,118,10,40,136,131,19,63,70,99,182,102,215,199,89,+135,103,171,3,154,204,123,189,248,154,120,240,116,152,112,20,9,179,229,147,+202,16,178,239,100,34,110,247,2,161,20,184,53,99,39,207,109,185,221,213,+151,75,185,225,0,60,179,213,25,171,177,143,168,51,205,141,64,32,118,36,+222,124,85,101,223,19,92,103,235,110,148,17,247,150,214,242,111,149,129,51,+238,237,102,98,108,152,209,25,48,238,1,150,138,157,188,4,206,149,31,28,+253,114,142,4,255,135,116,239,106,149,66,71,55,150,84,42,149,46,253,233,+237,147,117,40,201,234,151,135,120,21,253,104,75,232,42,235,239,252,67,143,+76,16,29,49,172,247,152,147,26,87,55,67,74,112,234,112,136,5,96,135,+75,138,195,36,49,81,113,166,44,83,86,11,250,223,155,246,54,199,236,48,+30,250,60,167,6,88,196,14,203,23,166,38,11,73,1,135,103,164,218,154,+138,57,10,96,199,8,182,175,113,101,128,33,204,130,135,145,164,105,185,26,+26,215,114,246,189,225,211,17,161,75,110,67,1,200,224,224,231,58,90,170,+193,130,202,63,74,144,35,1,161,105,250,44,158,232,89,196,93,106,7,135,+185,0,205,252,156,57,159,180,13,83,185,207,53,133,187,195,100,149,141,212,+113,42,109,64,14,229,90,95,131,233,110,6,193,214,214,35,198,124,116,144,+202,74,230,40,25,212,247,32,164,178,203,88,154,0,240,18,206,127,232,136,+184,140,150,121,139,230,159,191,226,67,149,107,217,71,189,46,178,206,174,167,+146,208,115,69,143,238,190,217,24,143,22,202,109,107,129,226,151,208,63,3,+135,104,21,28,104,75,232,9,181,35,146,88,94,235,209,130,22,154,252,176,+227,18,230,34,168,238,107,184,154,85,162,110,39,135,138,134,114,252,173,216,+148,144,92,248,69,120,29,111,4,85,163,155,53,30,22,91,74,219,180,14,+206,12,11,188,31,140,187,136,83,199,124,139,42,136,81,61,179,213,224,212,+250,24,26,150,160,70,227,218,70,111,14,197,19,109,217,3,246,73,72,44,+205,187,205,190,17,19,58,34,164,229,117,208,100,128,58,17,219,63,204,250,+167,114,202,237,128,14,61,38,129,213,26,244,155,248,56,13,175,19,228,245,+142,55,68,244,6,19,62,142,66,102,4,107,134,54,62,203,190,23,127,215,+228,162,144,154,253,130,180,158,7,108,117,74,155,80,251,88,219,181,51,52,+171,239,154,66,50,183,142,3,103,88,197,238,191,36,113,102,68,58,184,178,+180,15,136,124,159,78,64,86,55,194,84,243,37,249,232,94,77,199,59,197,+21,6,198,87,22,129,55,156,150,236,0,16,23,48,174,22,122,129,182,122,+146,167,60,210,132,192,253,66,226,36,94,220,78,58,132,150,200,130,232,255,+131,70,108,200,164,187,2,120,37,207,4,253,37,117,224,93,187,108,41,82,+101,50,143,168,54,88,167,169,219,249,87,225,208,241,255,144,198,5,79,177,+189,13,58,0,252,178,183,117,247,185,240,54,111,14,113,191,12,222,51,156,+255,218,176,218,117,160,250,250,135,135,253,40,1,187,43,116,162,190,241,143,+36,205,43,146,195,41,99,31,42,171,224,108,251,178,62,145,209,194,185,119,+209,171,2,229,78,163,62,97,230,56,178,15,96,39,174,234,67,144,141,40,+116,81,246,99,1,171,12,188,145,6,15,64,34,157,207,16,201,197,31,110,+145,223,224,26,24,38,139,10,162,198,219,172,20,66,109,191,164,162,47,192,+251,85,48,173,44,243,2,14,15,88,121,101,35,52,224,236,144,37,87,204,+137,101,153,28,31,119,126,111,54,164,43,166,38,19,189,115,204,3,144,75,+144,65,229,14,26,154,11,134,6,162,18,34,156,52,230,38,178,96,26,213,+101,238,215,28,118,72,75,100,135,106,135,207,244,253,201,183,60,101,226,35,+87,25,63,0,108,195,39,81,58,64,115,175,255,35,228,79,6,189,243,21,+185,56,201,109,75,227,220,110,38,141,174,55,175,73,147,152,163,35,232,183,+124,55,218,222,61,191,178,145,191,184,141,248,174,118,119,138,92,204,247,248,+184,103,1,119,113,77,21,154,55,95,182,234,205,126,66,255,230,176,109,85,+233,121,54,42,131,108,112,240,214,101,48,202,11,17,110,174,144,222,81,177,+175,217,73,63,237,240,153,209,164,174,38,219,121,238,28,37,70,128,109,14,+203,1,30,106,99,32,89,52,146,229,53,231,155,213,251,88,126,136,81,174,+206,132,234,191,243,173,118,97,145,196,244,179,56,157,164,158,28,51,103,203,+223,96,211,236,194,27,189,127,156,243,111,230,154,81,224,12,45,207,188,116,+30,49,124,204,116,150,240,160,20,150,51,173,217,196,93,34,24,47,206,6,+145,28,122,235,218,35,44,34,58,91,14,152,48,234,188,118,234,131,149,79,+90,51,127,37,211,138,149,210,246,117,185,51,141,34,63,105,173,229,211,232,+202,225,2,3,46,2,79,183,145,255,36,162,171,130,214,78,181,166,64,237,+202,231,235,142,65,32,15,148,168,232,114,2,57,76,195,41,137,26,190,35,+49,150,226,30,75,11,180,240,220,29,25,178,121,172,187,59,100,131,33,227,+164,62,139,89,18,242,169,5,203,88,59,193,150,182,188,59,137,252,169,206,+60,85,193,37,245,183,168,23,139,86,203,86,210,220,130,98,153,152,242,34,+172,236,137,73,189,36,74,84,122,166,189,16,127,245,90,15,118,126,201,192,+125,53,149,9,205,175,65,62,181,2,41,144,179,23,145,31,154,63,20,25,+182,115,66,217,227,168,242,53,157,118,150,188,252,169,92,71,227,34,138,180,+78,211,178,81,7,222,187,85,133,106,213,62,159,79,62,170,20,168,33,251,+148,163,45,168,233,59,167,155,192,221,154,164,242,93,208,183,154,205,37,219,+10,186,206,127,52,76,96,232,210,21,143,32,206,22,183,47,36,54,204,58,+191,103,10,49,195,48,3,169,2,72,185,119,91,85,119,151,18,203,19,242,+150,65,115,221,80,222,59,117,194,110,177,8,146,223,239,23,138,196,136,241,+4,69,74,236,15,171,9,54,185,35,65,198,153,97,239,216,241,233,91,135,+26,22,228,248,125,232,136,175,141,162,90,240,153,67,161,146,27,112,164,177,+205,52,195,239,71,19,140,164,8,200,201,24,235,169,73,188,152,124,25,172,+114,126,207,54,150,167,98,187,74,106,249,187,231,8,243,156,99,134,218,226,+6,179,33,108,149,237,65,149,1,115,238,81,194,226,126,171,146,85,199,200,+58,220,225,64,150,229,159,190,234,196,31,45,144,87,135,185,79,171,157,90,+27,201,55,143,189,93,40,114,252,202,232,130,208,149,112,85,179,223,181,196,+183,73,236,116,148,184,141,50,55,166,32,93,233,246,245,186,237,134,128,177,+51,245,107,50,85,119,4,54,191,56,82,128,33,15,108,218,160,180,216,105,+248,137,101,176,137,228,50,220,58,164,133,245,200,214,203,68,112,43,116,174,+202,19,72,108,60,239,82,238,69,16,62,115,6,105,113,106,86,114,95,106,+21,143,194,250,14,62,152,72,188,175,172,181,55,20,179,207,224,234,148,81,+125,172,101,26,132,86,108,93,252,75,44,142,225,163,33,59,11,169,232,67,+120,0,101,96,75,209,224,40,172,136,180,209,146,52,49,106,246,213,1,18,+19,250,1,2,46,141,203,174,78,76,24,164,49,147,219,13,176,201,150,193,+234,144,246,85,134,251,106,70,160,248,19,72,107,227,233,34,239,135,162,215,+78,124,181,151,94,163,104,133,63,28,212,222,191,206,228,56,222,246,61,201,+35,74,188,252,183,28,215,157,177,205,83,89,38,191,56,90,9,77,101,140,+130,177,111,199,194,241,104,14,204,230,139,253,216,184,48,170,249,85,28,40,+43,84,3,77,58,186,156,56,55,32,151,152,72,199,21,67,120,232,136,133,+145,181,43,127,115,190,128,30,228,249,221,183,116,107,255,208,229,244,129,245,+254,88,237,116,25,79,86,115,117,36,18,90,32,16,90,5,26,13,59,102,+21,246,78,123,164,166,136,67,133,166,15,155,165,68,165,93,202,243,184,230,+29,253,45,149,232,69,238,195,246,137,29,102,1,105,247,20,122,79,36,46,+207,168,199,128,192,162,118,127,246,171,254,221,185,105,83,144,111,39,67,177,+101,160,162,231,243,10,179,142,161,32,198,236,40,42,115,231,215,178,90,99,+188,137,233,248,137,0,18,121,129,237,61,70,52,140,23,245,214,133,98,73,+147,73,130,244,222,7,93,12,113,52,114,115,111,49,100,48,220,119,27,57,+88,131,63,109,6,41,216,145,146,15,116,152,56,182,185,151,124,169,243,197,+103,218,251,128,102,123,35,159,235,253,35,208,216,77,152,133,175,195,119,106,+103,220,92,131,42,91,25,212,255,35,132,192,46,170,50,185,41,78,27,227,+14,31,210,45,193,187,117,184,157,133,148,27,178,109,249,133,180,130,164,51,+34,36,154,93,231,175,228,243,184,111,12,218,64,71,205,41,206,176,230,142,+22,215,59,180,153,47,222,44,249,126,217,252,216,206,184,51,77,62,119,61,+250,57,223,165,196,252,120,227,71,214,142,148,134,18,114,56,216,43,28,187,+133,50,116,164,82,95,137,210,137,129,10,20,118,13,22,170,77,39,217,222,+162,52,244,252,206,6,215,167,157,240,139,69,18,128,2,110,230,123,47,199,+84,245,43,157,143,167,14,104,114,118,71,218,173,48,111,31,117,46,98,98,+90,47,91,207,105,123,25,67,13,31,225,168,105,91,129,11,159,175,225,153,+10,64,230,50,5,142,30,38,240,2,186,142,220,206,98,195,3,184,253,44,+93,0,42,174,64,248,216,106,124,226,241,186,29,170,199,26,87,161,34,184,+33,223,127,75,211,138,9,41,138,33,5,63,252,3,66,14,87,192,142,39,+207,141,109,244,229,53,143,93,137,162,9,129,126,14,27,31,150,58,204,19,+35,213,178,191,156,207,14,57,131,179,250,203,238,45,40,3,177,194,56,215,+149,118,42,133,84,194,168,105,28,243,227,134,12,60,71,43,27,78,222,185,+150,204,7,28,175,165,151,208,209,77,242,222,63,250,69,255,73,246,134,5,+251,61,20,167,183,142,181,64,100,93,132,42,57,119,186,13,163,228,181,103,+8,178,97,182,242,35,196,42,177,143,39,31,124,171,144,134,193,221,74,255,+173,217,226,157,198,23,140,118,190,195,232,86,91,85,183,219,10,72,126,56,+87,146,2,134,170,144,53,255,158,42,158,27,80,206,140,35,127,237,198,63,+40,7,150,251,199,221,80,132,156,147,164,134,2,197,236,142,101,88,120,181,+240,118,116,246,81,99,196,39,193,88,212,65,155,142,56,138,136,220,183,190,+175,192,16,239,28,215,251,13,198,140,40,76,34,61,99,119,160,198,206,109,+167,55,143,226,212,242,49,226,179,97,25,173,210,181,193,22,113,211,222,49,+26,116,248,34,73,234,173,164,87,229,41,202,72,15,161,137,186,128,97,119,+61,197,79,16,192,45,222,150,26,40,133,190,244,75,219,49,194,66,146,117,+170,12,181,107,6,221,237,16,180,178,131,212,225,111,38,56,206,37,32,7,+38,121,163,189,61,172,217,186,45,241,191,138,171,50,242,250,185,119,164,72,+91,28,117,137,153,32,29,118,142,36,44,215,188,103,237,241,186,129,144,84,+131,83,118,63,187,57,30,116,66,141,171,119,118,230,163,106,92,132,27,43,+229,251,3,238,211,74,189,197,137,253,147,195,43,106,14,141,68,53,189,118,+137,215,212,117,131,12,203,93,16,254,243,153,76,198,28,126,78,147,37,147,+122,40,89,142,49,59,124,156,64,47,228,33,211,40,89,190,38,140,184,101,+219,2,167,177,229,19,221,165,109,134,169,130,23,245,28,209,104,228,222,202,+27,68,241,70,190,131,85,21,132,153,2,19,137,217,162,49,133,16,220,59,+117,249,112,171,80,2,185,84,113,64,103,234,31,239,185,121,223,144,219,137,+238,186,112,130,187,190,97,234,184,44,224,204,200,251,117,163,216,47,102,128,+184,240,249,166,5,64,247,89,75,19,45,254,50,254,99,55,27,44,78,114,+46,4,181,237,160,170,22,236,10,65,125,91,42,184,124,123,112,29,203,112,+175,20,228,42,179,67,142,191,181,115,225,16,151,246,9,118,9,28,72,76,+107,179,105,19,238,42,184,144,215,190,130,231,50,89,41,200,84,188,128,168,+12,235,161,54,36,23,163,212,255,43,164,12,198,73,58,109,89,226,231,128,+118,69,103,139,196,43,142,196,141,242,234,77,130,113,66,204,93,187,63,22,+119,181,22,177,178,176,160,59,48,62,83,27,180,65,100,134,103,253,177,144,+80,98,70,69,1,218,93,41,210,56,110,156,146,133,240,244,232,192,151,116,+55,56,129,126,112,120,198,86,220,111,181,180,132,34,45,249,217,112,34,118,+106,237,78,198,198,148,72,238,36,121,163,48,155,55,65,160,204,154,112,65,+71,104,249,180,160,87,117,126,42,89,139,224,45,135,236,249,173,219,16,39,+73,145,241,50,197,102,179,4,154,132,96,56,191,155,201,190,140,189,168,161,+68,162,144,202,49,87,49,70,33,177,247,152,108,22,96,142,196,187,57,188,+5,18,61,141,4,165,76,28,146,205,221,250,40,103,97,173,171,172,206,229,+163,247,51,60,129,173,134,91,237,25,72,10,28,72,76,6,16,253,132,231,+27,125,95,23,215,94,145,178,212,27,170,11,237,206,84,0,205,1,184,110,+6,245,37,58,208,145,158,159,171,82,10,94,250,144,23,29,251,94,145,4,+122,68,101,35,245,107,133,142,206,120,135,227,156,181,56,204,254,244,98,176,+80,253,125,114,91,13,154,104,228,229,64,206,78,235,96,44,235,56,220,118,+13,36,183,2,37,53,133,219,201,169,180,185,202,9,21,119,123,197,211,182,+22,231,96,218,152,94,170,119,57,239,145,1,68,57,188,253,11,152,237,142,+188,217,232,144,157,235,11,192,251,195,223,179,117,47,21,185,59,101,105,213,+32,198,236,86,224,130,182,152,136,86,110,54,109,226,93,123,50,178,108,21,+44,20,175,215,133,108,234,38,42,46,123,102,237,48,28,179,113,108,164,99,+113,70,243,198,172,111,171,84,27,177,220,163,16,246,142,253,184,226,118,130,+222,127,143,17,191,247,223,54,60,228,189,10,246,17,204,113,98,85,162,109,+219,184,85,253,49,78,42,213,231,197,190,176,223,43,233,32,113,240,124,218,+182,79,130,124,148,65,20,176,96,3,138,41,133,156,225,45,164,27,115,105,+180,44,221,99,223,107,189,253,118,22,200,90,136,25,86,177,50,206,104,227,+210,145,123,177,139,41,16,15,30,217,165,94,255,116,100,225,10,194,64,167,+214,207,146,69,78,109,163,16,251,49,164,176,248,206,197,71,196,119,194,0,+86,9,220,80,176,97,121,176,197,48,20,201,21,27,90,242,154,141,20,155,+38,11,101,242,175,160,113,136,206,21,104,92,110,11,19,139,16,56,147,155,+34,177,249,183,150,66,123,55,246,62,105,90,211,218,189,113,137,241,192,181,+121,137,114,106,113,170,188,162,16,145,53,89,194,33,60,243,153,86,151,161,+132,96,48,239,97,102,71,249,100,249,222,21,244,237,31,255,220,139,225,140,+62,99,102,244,9,103,229,17,255,246,200,182,122,+};+const unsigned char *combexpr = data;+const int combexprlen = 27433; static const struct ffi_entry imp_table[] = { { 0,0 } };
@@ -1,5253 +1,5598 @@ #include "mhsffi.h" static const unsigned char data[] = {-122,76,90,50,184,153,1,0,93,0,0,0,1,251,25,10,0,0,0,0,-0,0,59,14,1,195,100,94,33,8,250,121,62,187,23,144,190,38,187,214,-246,253,55,33,165,135,161,197,26,73,218,127,251,30,207,92,4,10,239,90,-94,97,129,192,45,186,97,36,238,89,255,26,166,218,253,24,108,151,122,5,-142,93,87,151,206,167,192,245,252,118,58,254,151,243,99,191,215,188,197,59,-10,98,75,76,104,116,46,42,107,15,46,172,13,38,204,178,85,73,110,168,-245,119,215,3,196,39,78,19,47,65,104,6,79,94,163,165,112,70,54,41,-209,176,28,4,66,99,125,50,66,92,74,232,204,44,146,241,185,140,143,194,-147,191,173,118,164,92,116,3,99,186,191,147,37,140,147,30,28,234,14,120,-158,136,15,171,132,137,41,74,235,245,97,58,160,5,193,102,29,236,188,245,-110,235,69,111,125,148,61,16,195,129,84,109,218,31,179,103,122,91,212,123,-103,57,27,104,6,132,61,0,44,151,146,63,161,172,55,113,193,229,155,244,-33,72,123,237,95,102,108,76,154,161,136,223,131,59,76,82,50,155,4,233,-44,231,211,74,231,5,137,176,38,195,64,187,201,79,250,19,30,241,27,26,-152,221,17,129,245,17,168,107,129,58,166,62,241,104,215,51,142,142,139,126,-118,28,79,237,196,30,103,37,248,233,190,133,118,26,98,165,127,152,132,200,-197,40,217,232,53,163,154,94,38,200,123,198,9,75,182,48,220,191,77,122,-233,209,82,219,254,143,166,40,112,151,102,70,222,14,77,244,51,192,81,73,-83,195,200,116,11,110,223,226,75,133,123,79,238,227,26,116,172,34,168,102,-236,161,15,251,116,110,23,18,253,148,119,183,198,56,79,53,139,16,84,23,-11,67,232,244,236,134,32,178,30,97,129,119,251,15,94,71,190,175,76,117,-55,250,180,81,151,120,137,46,110,183,60,128,131,76,134,80,143,25,154,144,-157,32,110,108,92,106,2,142,134,61,205,189,159,215,161,60,17,186,114,238,-100,114,73,63,77,43,159,39,25,14,184,179,117,34,103,43,89,225,1,80,-108,104,27,92,120,100,136,209,123,140,252,175,187,48,105,9,33,188,129,15,-71,70,142,41,105,245,67,227,146,141,246,207,74,245,1,46,109,156,244,216,-124,141,181,216,21,125,141,168,0,151,168,175,38,7,132,167,12,109,192,139,-180,14,193,126,96,180,253,84,152,67,122,107,149,65,151,235,116,216,85,25,-142,82,26,2,83,186,153,205,252,147,112,1,246,165,225,247,129,233,205,25,-93,103,73,6,232,61,37,56,111,173,144,20,186,125,120,124,56,26,226,111,-182,93,117,145,167,143,9,52,136,197,63,98,220,46,249,159,231,191,200,146,-177,8,98,193,87,251,215,30,163,4,247,147,68,246,21,40,86,103,54,152,-98,179,237,57,29,246,141,192,93,49,154,158,230,62,64,167,107,100,228,116,-37,47,7,16,191,110,103,161,148,162,38,53,47,21,189,45,237,99,171,113,-220,156,139,168,236,183,133,17,142,87,213,36,86,21,217,37,15,114,52,78,-129,108,224,38,19,40,87,225,149,230,135,251,48,72,51,98,97,18,18,202,-223,6,142,117,68,45,61,102,35,140,116,127,231,245,82,137,148,153,231,120,-107,184,66,227,211,192,68,165,174,136,206,43,99,53,180,241,26,53,112,12,-103,241,115,42,13,210,193,116,136,237,165,126,37,46,203,74,170,74,169,39,-207,155,138,148,29,125,191,198,162,101,85,20,1,252,132,235,126,45,237,138,-251,243,161,5,209,115,117,111,147,202,16,159,222,241,227,138,65,21,162,92,-27,68,205,42,209,88,188,219,195,144,140,214,184,203,23,41,228,62,14,15,-65,234,9,254,175,113,234,57,133,42,203,44,139,146,213,159,3,34,246,217,-134,46,111,61,176,239,93,29,84,232,37,215,237,94,122,145,217,54,144,83,-159,183,241,179,244,132,13,96,5,114,38,174,219,19,69,108,200,215,46,5,-228,214,161,229,166,123,191,172,118,217,98,109,143,60,28,246,236,144,127,202,-103,66,167,41,200,196,77,223,188,146,232,103,149,131,128,96,168,229,65,115,-51,197,84,159,97,209,168,55,234,158,230,136,96,124,109,203,200,49,19,50,-213,2,169,171,47,136,57,100,170,104,151,236,94,74,96,217,141,220,143,240,-52,40,159,22,165,236,86,99,27,154,232,145,170,36,95,107,138,94,156,249,-168,62,37,128,36,36,173,13,24,226,37,23,232,157,55,76,11,152,202,214,-238,224,108,191,106,231,20,44,48,87,3,39,156,78,46,185,42,214,69,238,-101,116,96,55,175,0,239,23,190,103,154,36,20,169,251,169,133,70,168,55,-50,165,185,90,162,65,134,197,24,68,98,0,159,97,8,149,233,12,145,195,-71,94,143,118,172,162,106,43,126,180,242,216,99,64,112,231,148,135,156,26,-43,88,59,40,81,121,161,28,32,222,88,237,191,179,110,106,9,45,221,7,-189,172,3,200,149,35,55,110,237,135,21,2,59,115,65,118,51,18,52,163,-10,203,25,32,174,127,108,148,186,10,186,224,191,60,66,30,203,118,20,165,-52,165,196,215,153,56,141,9,169,90,8,41,41,163,132,21,68,25,114,89,-88,178,8,191,10,217,51,51,25,135,9,137,17,95,62,214,176,60,248,13,-51,190,66,124,227,255,54,147,114,240,202,87,207,226,8,87,81,126,113,8,-227,138,4,229,243,7,129,91,217,80,191,71,76,118,114,144,176,101,22,118,-58,226,55,123,222,106,134,68,133,230,129,203,25,208,152,61,95,51,56,5,-221,183,69,0,9,242,185,188,155,68,55,190,234,120,26,77,226,159,167,189,-170,191,252,2,103,168,206,78,0,115,161,212,56,19,49,234,237,186,221,199,-212,191,27,18,10,243,118,31,80,181,216,201,143,95,39,72,171,229,175,64,-146,244,25,220,223,180,239,46,23,235,75,139,228,146,163,40,200,182,186,84,-230,56,1,147,201,8,108,245,10,176,155,101,65,18,227,119,225,188,23,134,-151,121,249,148,178,159,122,180,161,157,35,48,131,154,207,228,96,234,9,250,-39,56,37,239,93,24,209,116,109,220,185,68,249,39,144,204,153,200,121,62,-225,85,227,239,207,98,195,1,155,246,183,92,172,95,160,236,102,134,172,79,-29,43,232,205,175,200,161,100,53,248,215,106,231,223,85,188,61,79,109,29,-91,133,186,148,226,155,158,215,182,230,216,176,4,35,64,65,0,67,184,186,-82,101,226,49,242,211,204,139,28,196,201,50,60,148,192,98,114,50,182,170,-47,73,207,182,136,41,198,129,225,112,126,193,36,232,98,36,234,207,9,71,-195,245,68,1,13,171,195,99,123,60,212,130,101,165,61,228,202,19,250,14,-75,200,55,55,140,54,245,224,184,75,174,240,163,212,190,101,143,128,152,15,-243,56,193,143,95,156,72,88,152,108,146,143,90,99,234,164,244,37,106,15,-26,114,30,15,69,238,203,124,174,29,234,35,63,111,237,102,164,151,127,222,-65,25,126,86,76,143,204,250,20,3,22,249,191,117,69,135,167,86,179,46,-20,92,94,211,112,22,18,195,249,239,38,198,202,95,98,122,230,199,222,67,-140,159,207,35,167,108,3,184,188,189,39,157,149,119,245,129,59,195,253,18,-85,226,194,233,105,161,49,137,159,93,59,226,101,64,104,40,134,169,100,34,-179,51,136,209,71,121,74,200,206,26,139,96,166,213,106,36,100,83,177,111,-20,185,255,96,130,231,222,60,25,75,22,52,36,107,181,72,59,22,220,80,-96,8,221,129,121,15,182,203,59,224,224,242,128,54,208,72,203,243,24,13,-127,120,154,184,60,20,170,238,38,99,174,236,5,186,226,15,64,249,222,166,-142,127,171,118,60,213,63,172,60,239,118,117,243,93,164,21,253,197,233,172,-143,74,107,57,32,8,77,237,121,163,248,189,227,38,193,94,196,136,65,95,-189,70,149,47,27,165,171,229,230,177,241,237,6,154,67,173,201,178,130,255,-163,225,10,125,201,175,180,38,75,50,66,60,181,250,160,229,231,75,149,206,-15,207,12,208,131,230,78,180,67,127,153,114,178,87,250,176,35,68,168,55,-172,101,176,207,48,104,66,147,106,166,180,249,237,251,235,79,222,130,121,179,-3,151,188,94,132,55,132,148,2,64,242,224,233,40,2,181,241,232,173,76,-72,130,23,162,58,162,49,209,38,44,120,62,83,0,180,0,7,62,26,154,-126,43,68,174,91,3,177,227,18,246,102,106,220,12,18,251,46,24,55,64,-3,143,37,23,130,173,149,138,212,73,183,5,108,167,221,131,141,46,170,13,-108,240,174,210,64,99,121,212,228,128,100,212,165,146,29,139,3,46,67,179,-220,244,144,202,55,0,33,217,16,217,142,180,215,46,234,210,118,101,19,3,-201,37,149,215,52,17,6,251,77,70,114,197,255,69,151,55,169,157,123,178,-53,212,179,74,25,158,225,134,115,113,44,185,190,162,157,43,35,231,14,207,-208,94,65,181,168,144,116,153,209,232,74,245,164,120,245,85,116,151,146,134,-213,171,183,119,182,227,47,40,170,169,9,242,15,208,252,134,242,96,181,165,-68,3,224,104,102,114,171,63,41,162,184,247,14,215,12,110,67,198,73,168,-110,54,115,188,224,27,220,162,150,158,198,119,196,204,176,201,38,214,150,196,-240,135,152,188,36,127,90,254,88,81,160,36,59,1,215,164,239,191,151,94,-120,100,123,39,247,123,118,140,45,108,47,174,26,185,47,242,81,179,169,134,-82,72,135,182,33,223,254,214,163,127,112,120,42,23,143,20,37,47,167,184,-109,172,39,123,76,191,54,31,97,213,152,28,217,106,83,157,58,223,14,237,-104,227,245,240,235,109,85,212,196,108,229,61,87,248,78,173,216,26,68,126,-48,2,36,38,54,105,129,234,240,75,230,123,87,156,228,210,171,61,152,59,-69,177,141,227,28,120,199,188,77,111,202,161,17,110,168,86,218,190,26,111,-119,23,125,242,206,198,222,232,226,127,62,9,103,253,80,152,129,111,15,146,-214,159,85,199,131,29,100,85,196,76,13,7,79,204,82,61,45,239,94,103,-33,249,23,4,181,184,25,100,143,246,34,15,97,208,63,221,114,226,155,12,-179,63,26,192,131,92,156,169,91,54,140,236,38,196,96,0,173,144,200,5,-38,244,230,195,68,3,168,133,220,141,136,165,46,126,219,116,160,136,95,197,-62,152,183,50,75,143,148,177,161,130,27,4,236,164,87,35,29,44,80,110,-227,255,150,20,9,218,135,219,4,127,124,31,81,45,74,124,34,219,192,240,-140,231,100,253,86,252,137,76,187,147,144,14,104,79,178,248,59,162,121,42,-96,217,8,3,4,105,179,157,79,53,35,240,216,46,240,113,182,200,220,181,-254,29,219,179,14,188,235,12,218,56,161,248,182,153,130,158,93,171,201,255,-18,230,123,172,33,37,131,95,160,130,221,159,79,35,78,211,89,82,28,213,-147,174,134,64,55,177,52,132,63,25,122,149,105,109,31,18,127,244,18,225,-164,201,185,223,247,188,251,245,236,17,121,55,84,172,122,127,38,28,227,23,-82,150,196,105,241,221,162,175,222,73,44,48,38,7,251,66,131,87,221,53,-177,209,75,223,99,237,246,236,173,111,89,160,137,85,195,243,254,117,185,170,-12,36,45,1,195,99,28,182,109,52,101,82,181,34,177,123,104,215,89,120,-193,188,20,48,190,61,241,92,79,227,104,95,156,99,205,168,167,209,198,88,-80,155,79,25,214,236,54,201,20,151,148,155,119,200,194,178,155,250,248,46,-241,8,108,10,111,43,163,120,36,104,214,62,91,39,209,27,13,123,96,205,-233,129,113,94,58,232,2,119,66,77,245,66,103,88,43,230,246,57,31,64,-90,9,190,190,119,57,228,62,94,158,159,58,94,231,173,72,228,196,81,236,-135,163,46,110,69,218,237,234,208,229,43,47,37,17,81,142,180,127,88,231,-86,154,250,212,0,94,78,91,74,40,162,87,245,154,44,64,129,134,224,33,-61,169,186,210,213,103,250,140,74,229,67,231,78,174,185,88,240,209,198,183,-164,208,180,10,109,245,158,135,160,51,226,101,151,120,190,6,251,78,171,206,-195,12,160,67,229,159,184,73,126,237,130,4,243,149,127,57,82,25,174,135,-63,193,132,71,129,246,212,164,149,109,199,71,59,119,77,114,12,207,210,66,-161,90,204,155,135,189,161,133,16,255,24,39,107,152,31,253,43,220,131,138,-23,232,221,158,83,194,1,67,101,177,244,220,89,27,134,250,23,59,41,135,-148,78,108,25,130,160,35,42,24,128,23,219,28,66,249,247,215,142,204,0,-249,112,25,99,19,240,119,57,170,0,88,201,217,225,98,59,248,201,113,254,-193,79,115,41,97,231,6,119,245,248,239,174,99,21,118,52,97,223,240,11,-209,194,183,0,102,213,200,67,211,251,25,162,12,88,108,82,61,205,55,127,-8,75,208,223,130,72,198,252,250,168,62,195,202,23,45,55,168,167,153,66,-88,64,32,13,146,252,194,100,62,126,54,28,0,255,96,163,136,144,114,85,-94,137,119,170,182,2,172,146,224,35,244,84,132,0,223,235,105,189,250,29,-205,245,2,12,243,23,135,239,52,120,158,240,150,47,43,142,249,126,255,92,-209,156,172,228,26,9,76,74,192,81,1,134,67,82,253,39,105,23,251,206,-173,210,89,54,195,68,160,207,219,102,188,252,127,0,30,163,68,176,34,194,-240,1,159,122,74,146,38,157,17,186,115,241,141,46,118,129,9,104,82,191,-121,88,57,57,41,128,162,243,41,43,108,1,150,114,187,22,87,223,237,13,-245,27,4,212,89,95,153,180,121,27,18,53,116,157,83,68,5,44,26,226,-173,87,18,9,110,17,235,157,213,0,128,140,162,253,52,123,57,136,89,117,-6,117,176,50,60,226,133,147,21,70,89,172,92,120,65,246,197,250,26,46,-219,27,205,183,34,95,33,111,171,92,164,232,89,36,115,1,212,106,32,191,-169,169,107,172,0,35,185,128,2,87,42,91,80,145,92,244,102,162,217,231,-226,32,215,177,176,240,22,44,168,109,121,27,159,237,244,53,47,167,241,62,-75,89,39,113,37,24,170,181,47,9,77,221,249,59,234,175,206,179,36,222,-251,244,214,85,151,218,141,39,112,141,124,121,23,61,17,202,119,89,205,67,-148,47,120,75,128,144,35,243,165,176,43,108,241,87,235,160,82,55,3,106,-69,91,131,207,156,37,242,186,145,112,138,202,207,214,87,209,8,43,145,238,-118,64,65,100,82,205,35,194,248,87,15,24,237,114,98,93,46,71,0,66,-220,113,18,12,46,127,42,243,52,32,167,84,62,52,231,175,146,219,182,228,-7,201,213,67,1,211,162,7,179,160,214,96,12,51,160,144,46,18,129,48,-24,122,195,75,108,125,57,181,67,110,73,202,255,172,61,203,72,128,47,165,-177,14,237,126,169,179,249,89,210,188,197,195,159,144,7,168,6,202,9,30,-142,181,72,79,186,31,56,188,100,190,142,245,174,19,108,178,82,170,238,198,-218,187,188,216,80,163,162,43,163,243,230,167,124,174,119,162,244,223,227,57,-201,137,215,128,239,246,104,163,229,124,112,243,224,28,177,52,53,155,199,165,-10,221,6,177,127,69,25,237,132,4,248,128,82,60,168,132,171,28,234,157,-36,155,182,147,107,3,166,64,33,125,12,196,187,166,31,78,219,82,16,183,-131,190,59,235,133,5,160,139,149,100,24,168,182,52,207,133,187,69,116,217,-245,148,4,114,5,106,145,87,104,32,147,241,247,29,174,26,144,75,245,179,-0,148,160,155,232,206,115,19,46,68,151,97,118,130,184,177,234,21,173,241,-251,250,151,109,120,67,189,42,230,45,199,145,75,219,219,207,140,189,51,62,-89,95,195,171,55,198,67,9,61,144,69,168,253,188,88,174,116,201,141,127,-175,211,75,73,51,166,40,181,91,64,15,238,34,170,81,75,177,10,51,13,-205,7,50,156,210,77,62,123,202,208,201,240,92,164,19,151,78,156,131,194,-180,158,57,117,236,116,248,0,188,155,215,55,196,208,30,234,55,91,228,118,-232,39,250,116,88,138,165,21,19,104,198,77,248,150,70,148,201,74,145,190,-189,157,137,51,59,40,129,29,42,31,88,108,97,207,119,98,35,8,122,75,-171,238,21,106,206,121,242,157,115,232,71,55,91,113,8,168,211,99,41,15,-110,9,154,85,181,61,171,2,171,130,90,167,135,96,113,126,6,17,9,30,-104,5,216,104,247,162,97,95,11,46,245,241,203,62,251,185,65,217,88,249,-64,128,105,138,20,7,83,211,120,216,74,2,141,201,116,235,230,203,71,42,-90,226,5,239,105,13,171,220,123,120,188,92,127,208,185,158,240,12,3,158,-58,248,172,140,42,122,52,185,133,13,83,212,228,125,181,153,234,109,239,16,-104,251,63,33,200,138,58,247,198,103,43,254,89,1,233,240,143,243,53,23,-184,216,96,147,225,40,16,50,240,54,190,175,46,36,182,186,186,206,75,164,-136,148,119,80,60,69,17,203,128,218,6,119,108,8,213,224,139,82,46,227,-139,175,249,104,176,71,188,117,137,129,16,217,14,21,29,80,139,92,91,211,-37,16,254,68,248,3,195,50,34,209,98,99,192,87,23,50,140,182,226,26,-80,194,57,117,152,71,40,43,173,222,239,18,50,181,40,96,120,199,61,80,-6,152,37,21,17,116,237,154,169,110,214,1,207,217,85,195,76,188,162,67,-236,42,211,141,213,176,21,137,144,13,188,25,161,123,91,59,173,95,152,247,-252,163,243,203,121,151,190,150,103,121,94,226,145,255,211,72,187,176,220,237,-251,36,134,234,16,26,126,205,163,44,144,202,77,222,87,250,49,173,134,245,-140,11,100,187,12,92,205,130,56,112,16,42,73,7,115,115,31,162,56,61,-146,40,207,230,169,228,156,109,16,90,80,59,100,156,163,233,177,63,156,164,-11,67,70,110,174,87,11,166,112,92,233,21,6,142,211,18,39,106,43,25,-2,54,134,125,110,234,148,243,191,168,134,128,80,56,174,175,245,132,105,77,-128,113,36,193,174,220,185,82,11,212,242,95,54,97,163,140,106,29,13,166,-109,116,184,123,244,210,174,71,76,151,221,252,171,177,177,1,203,254,120,149,-123,64,242,108,199,207,159,16,163,72,187,145,180,42,160,9,16,200,63,185,-13,98,223,123,148,142,142,175,162,78,108,229,146,168,49,148,144,48,121,141,-191,27,19,13,199,21,240,65,50,11,28,91,229,38,85,44,244,172,199,88,-205,228,119,56,153,86,154,91,66,103,142,252,43,41,33,171,59,34,107,232,-73,225,78,248,125,55,106,58,96,240,192,83,112,145,101,241,154,174,139,187,-98,243,206,51,44,94,183,7,174,200,99,34,127,105,153,231,11,34,22,218,-19,114,43,38,252,156,120,235,126,68,165,129,249,172,86,132,63,30,154,132,-59,51,237,100,14,249,119,227,116,73,44,17,21,106,33,162,167,3,247,241,-126,221,186,179,104,84,53,132,34,18,31,80,72,161,62,169,242,6,89,43,-56,80,239,113,4,77,143,151,255,119,117,73,92,141,96,11,209,232,12,97,-38,154,19,138,151,247,222,131,109,102,146,64,4,69,105,231,66,138,89,43,-189,234,154,7,153,47,151,101,210,167,43,25,136,5,98,145,233,227,184,140,-53,167,200,181,39,211,251,20,47,196,92,35,191,120,17,132,227,90,10,238,-38,151,118,156,32,183,113,164,202,211,92,255,141,45,46,43,215,199,82,10,-41,6,102,186,126,181,11,61,130,203,217,29,180,89,60,98,151,194,215,95,-252,172,50,146,143,66,90,242,27,35,241,153,246,252,5,168,213,216,157,151,-9,40,174,83,47,170,241,65,72,102,142,223,196,199,62,161,129,115,101,144,-175,60,14,4,129,121,84,23,9,109,161,217,211,7,49,188,117,176,121,134,-75,201,28,168,57,61,61,155,62,72,68,101,210,192,59,175,44,197,115,254,-10,119,25,201,173,56,163,103,113,162,84,41,130,116,17,15,121,87,239,228,-24,222,173,83,207,47,111,9,175,98,176,146,170,39,127,47,255,212,61,76,-14,233,220,137,234,187,68,176,148,217,166,161,139,202,126,12,112,83,238,221,-108,125,202,122,211,169,164,142,120,211,80,220,181,73,246,121,184,54,76,159,-119,180,144,246,121,113,50,212,23,42,64,184,69,32,64,236,156,11,146,217,-91,35,45,192,50,120,25,3,225,33,91,252,151,163,136,218,5,136,240,8,-69,220,212,141,123,151,180,192,99,90,2,237,178,249,205,114,211,129,174,141,-245,250,0,251,189,243,187,9,139,221,255,17,252,4,61,203,11,231,158,54,-156,241,122,100,25,14,31,160,97,22,96,123,227,91,203,107,21,20,253,124,-138,67,225,68,198,3,155,55,159,48,24,138,186,159,217,112,74,80,91,31,-78,78,239,241,218,160,249,105,241,33,22,189,232,33,128,195,43,95,110,178,-112,70,188,184,210,33,218,37,55,62,125,137,119,187,80,184,31,66,91,251,-115,71,170,244,203,176,70,65,101,8,125,245,236,230,229,18,8,154,26,18,-85,57,125,40,237,136,151,203,174,71,62,91,177,251,103,14,196,105,108,168,-161,7,120,2,171,146,6,37,91,34,140,174,109,75,45,163,84,17,120,63,-0,219,179,90,225,72,144,229,56,92,123,108,204,62,141,235,48,120,154,173,-70,141,51,183,186,33,199,44,241,215,121,127,103,95,120,28,155,189,25,98,-171,139,196,244,226,4,123,71,139,29,97,122,109,125,170,93,147,94,196,41,-154,27,202,154,151,248,97,50,221,52,46,196,35,190,241,247,50,94,79,134,-126,184,212,44,254,5,158,219,182,97,180,213,8,142,137,28,205,57,4,82,-234,182,20,20,212,126,186,246,132,240,17,66,124,170,144,176,187,51,148,30,-183,19,168,161,74,137,96,195,163,213,103,216,245,101,173,232,34,122,92,3,-36,84,41,96,175,176,9,37,196,112,65,156,140,189,32,193,215,251,245,249,-116,35,232,221,175,94,54,187,120,49,33,130,184,141,42,93,206,25,230,91,-20,18,117,104,164,199,134,86,64,90,30,100,236,197,57,147,181,245,228,63,-41,44,129,138,64,7,162,43,9,87,84,94,30,200,171,145,99,39,251,211,-243,39,167,176,175,92,83,210,140,242,228,101,186,175,71,199,180,20,62,149,-139,29,54,218,8,234,5,2,216,23,25,29,114,18,35,166,112,87,207,220,-164,45,206,183,13,30,108,209,186,23,66,113,193,57,104,63,37,97,108,154,-37,167,65,147,35,117,5,66,40,59,187,20,211,197,206,218,49,220,148,24,-97,237,198,115,191,142,133,230,136,72,13,46,68,48,203,232,155,15,226,41,-191,51,189,179,43,113,103,49,193,17,251,166,33,13,74,49,97,148,4,78,-155,125,69,185,161,236,32,24,3,126,96,99,128,230,64,236,96,205,93,0,-208,44,79,194,11,112,12,113,40,252,198,218,197,135,45,16,0,230,154,7,-131,253,56,178,161,90,40,255,178,57,198,111,221,97,35,112,181,231,159,229,-88,185,133,103,81,138,46,194,111,141,189,164,43,233,213,143,64,73,102,234,-237,139,40,208,102,129,211,247,92,240,89,243,11,225,90,238,5,51,101,199,-221,130,150,254,208,71,242,241,13,77,49,108,133,205,239,59,185,76,163,150,-25,38,216,50,146,35,171,167,50,53,227,72,214,168,190,59,210,252,176,120,-122,16,100,64,171,103,71,25,161,41,109,201,46,194,181,155,79,149,67,83,-234,154,66,12,77,113,19,74,23,240,114,22,190,66,141,45,245,115,34,37,-224,235,91,110,6,250,63,6,5,245,32,100,239,229,218,131,75,9,226,105,-105,195,192,93,111,94,2,145,69,255,47,218,29,218,90,68,231,121,43,179,-111,90,54,153,192,16,191,251,220,192,120,74,58,95,173,95,185,200,72,236,-11,95,181,167,48,134,74,187,71,20,151,120,148,43,76,24,155,253,247,123,-87,223,223,190,107,103,147,123,254,158,136,165,223,119,125,245,99,186,130,117,-79,237,53,107,206,242,200,118,96,33,231,91,4,146,219,180,18,145,231,113,-120,66,150,105,102,169,89,44,120,45,91,158,14,1,106,117,252,104,100,46,-27,175,39,226,123,246,167,186,200,235,247,35,106,231,168,247,254,231,167,248,-151,114,84,83,178,181,187,4,50,144,235,206,113,223,1,15,157,116,171,82,-40,30,203,57,129,210,165,251,116,140,10,78,194,40,91,45,92,47,21,236,-230,122,225,168,131,131,129,251,99,218,159,101,117,136,48,132,49,199,133,89,-57,101,107,102,109,112,211,158,238,12,134,140,10,21,32,14,204,192,223,23,-42,94,113,39,157,149,168,77,183,6,138,217,236,177,245,154,98,175,175,220,-129,214,12,39,156,105,234,100,153,214,118,220,113,99,52,67,165,245,254,232,-5,63,184,63,51,10,66,129,97,183,55,227,183,12,109,116,49,106,254,86,-231,167,119,173,245,50,34,212,138,88,20,56,19,218,77,60,61,194,137,207,-250,67,189,24,156,239,67,0,135,114,233,178,4,8,18,137,141,185,139,156,-155,129,125,21,209,236,129,59,216,162,158,53,103,217,94,216,129,221,151,146,-207,108,11,173,216,37,214,48,125,208,120,254,109,253,119,197,182,202,35,221,-174,203,37,239,61,146,197,99,10,51,46,163,189,66,82,203,118,242,34,175,-230,198,61,240,154,33,194,38,253,144,158,119,119,22,123,154,29,106,34,84,-0,118,116,82,24,47,82,159,96,58,108,190,9,1,11,248,250,17,208,126,-62,254,100,36,40,115,246,75,133,142,21,193,231,95,40,39,133,34,244,124,-78,111,114,92,46,125,153,35,52,46,72,233,80,103,118,170,74,84,115,39,-68,82,190,36,195,75,19,103,130,53,58,213,51,170,67,76,15,212,14,156,-141,206,171,171,84,255,214,132,183,137,168,0,19,62,62,131,228,52,84,168,-154,148,44,129,3,176,38,17,65,0,243,129,218,115,198,242,168,243,11,227,-39,174,25,252,26,231,61,26,49,130,143,245,147,121,18,139,127,162,97,165,-32,160,43,61,22,57,75,3,216,121,198,195,22,193,140,15,133,4,146,245,-13,49,131,215,26,78,183,38,198,182,70,59,183,175,36,28,110,21,118,228,-73,87,124,94,125,171,242,170,44,151,233,74,234,248,2,123,245,189,215,42,-113,60,255,98,215,174,37,137,216,56,247,47,128,19,224,155,52,119,237,245,-143,157,49,200,139,206,75,213,155,188,46,77,243,113,51,189,181,48,109,173,-199,125,145,27,22,83,142,76,220,88,239,65,219,117,130,99,34,203,125,37,-45,77,229,154,9,35,145,205,158,6,100,165,95,5,39,172,115,62,104,75,-218,86,246,213,246,174,122,217,84,169,55,50,93,140,239,138,37,2,219,13,-246,59,145,202,62,144,148,109,118,60,127,254,110,184,130,229,16,91,132,84,-116,220,162,115,29,36,170,205,127,80,56,175,46,246,168,190,120,122,70,3,-26,51,166,183,236,35,214,195,26,158,123,154,124,250,153,202,154,231,246,95,-188,148,241,169,14,162,90,157,131,19,191,122,50,116,2,4,208,75,157,145,-148,104,245,68,7,12,61,113,207,249,224,120,64,69,20,213,21,186,2,76,-41,39,88,168,245,253,8,175,176,31,11,58,43,175,128,6,96,210,164,142,-195,119,149,38,48,156,154,73,166,204,102,194,167,213,7,28,186,224,74,48,-24,21,83,127,8,81,212,41,59,253,68,127,92,124,255,25,19,120,42,167,-120,209,120,162,112,20,36,179,167,14,153,148,12,246,212,133,197,240,176,69,-232,120,26,216,162,1,30,214,155,42,113,82,77,150,212,175,185,208,222,29,-114,231,113,210,160,23,221,21,140,188,103,111,78,112,116,170,218,176,102,110,-73,13,43,83,71,153,116,17,112,202,145,130,179,47,69,156,86,101,107,133,-177,153,87,188,237,22,176,99,107,106,155,224,72,175,98,221,189,210,252,148,-76,153,181,85,143,25,186,152,198,117,71,150,39,51,31,86,228,210,203,141,-207,220,82,204,15,192,76,12,98,25,150,57,75,182,204,103,70,236,18,213,-66,251,30,38,143,10,204,55,183,0,252,4,242,163,77,230,192,146,93,16,-32,100,203,131,88,244,120,136,208,207,241,161,237,202,35,134,77,228,30,33,-149,56,204,198,212,59,240,164,58,49,19,37,43,13,59,39,11,201,181,197,-28,175,36,126,76,168,23,156,40,191,200,163,151,134,104,201,119,66,192,188,-51,251,27,131,220,209,153,4,153,23,153,64,228,237,57,23,109,80,170,77,-220,117,229,65,36,34,117,7,206,134,228,198,87,239,170,241,177,166,49,213,-133,10,189,14,103,36,21,209,151,23,170,224,254,24,102,202,58,179,172,186,-83,134,199,146,60,65,173,164,200,16,116,136,62,206,6,140,162,23,62,30,-14,191,50,16,248,46,237,182,127,20,141,89,162,170,5,249,187,119,163,84,-97,237,39,218,63,233,207,211,20,3,13,209,142,69,121,76,211,245,51,143,-6,213,239,72,8,72,49,132,75,202,24,173,97,105,237,108,237,148,73,238,-186,216,150,220,210,31,224,151,210,217,151,187,109,20,37,182,67,3,117,156,-41,212,2,111,56,69,46,63,127,173,210,13,112,45,156,243,157,101,171,75,-197,34,111,27,204,157,51,244,4,93,223,74,60,55,88,151,192,112,150,143,-174,202,50,8,250,233,111,15,221,25,125,179,79,46,13,79,172,213,126,104,-239,242,148,29,233,87,64,151,103,43,125,123,240,156,43,28,144,129,146,201,-211,69,85,64,94,205,18,65,11,111,222,173,230,187,29,105,215,68,115,92,-42,210,46,232,63,226,95,136,176,89,126,51,245,144,105,63,134,251,246,20,-127,222,82,177,179,150,234,228,16,47,47,75,80,32,175,131,123,128,16,216,-254,205,230,95,137,230,185,112,63,255,138,39,87,39,147,57,87,106,167,14,-195,246,202,107,36,168,173,92,68,20,156,250,112,66,181,63,107,243,233,39,-170,162,65,81,146,6,187,37,54,90,93,143,255,136,21,247,96,102,21,226,-55,56,232,232,239,135,233,115,114,166,216,251,91,240,181,160,148,243,209,187,-193,186,130,202,18,105,96,8,17,34,64,127,247,11,224,151,222,181,118,16,-132,8,232,17,116,86,171,117,57,200,77,86,91,18,176,240,144,104,34,87,-133,232,179,67,61,247,38,41,205,106,62,163,77,179,62,169,138,207,120,94,-214,9,63,239,56,150,153,6,247,90,67,175,79,53,166,48,230,25,247,75,-58,196,7,177,81,241,69,189,202,46,90,51,105,172,196,117,66,232,3,68,-190,176,120,155,226,148,227,243,178,23,41,195,237,132,155,173,16,163,110,165,-124,83,103,140,14,79,46,47,227,41,35,192,43,104,243,169,170,174,191,239,-90,87,206,123,252,151,148,52,28,190,2,123,197,113,175,146,85,254,249,33,-232,188,7,174,27,39,104,149,204,45,158,150,96,251,102,57,0,200,177,34,-221,131,10,36,116,20,13,0,41,198,231,168,55,196,239,37,129,12,120,148,-148,234,38,131,195,17,136,38,126,212,201,244,137,8,172,203,46,70,142,195,-219,28,22,18,71,28,66,92,88,87,225,11,67,179,111,143,50,193,253,98,-180,106,73,173,229,185,103,23,156,198,91,107,41,45,97,131,92,241,86,186,-238,69,171,141,32,201,165,210,129,61,136,93,16,195,20,131,52,210,250,5,-54,149,30,151,83,94,31,49,174,175,72,48,155,93,184,237,8,210,235,3,-13,21,66,50,133,8,166,153,128,31,168,104,170,176,154,73,194,73,196,203,-221,40,174,12,222,249,250,254,119,159,63,73,142,54,43,209,160,100,227,167,-105,199,115,71,67,45,162,139,39,14,255,198,180,63,160,155,71,184,149,154,-25,101,51,164,251,252,31,231,57,253,50,234,214,81,126,196,72,93,226,64,-120,109,160,13,64,190,79,211,125,244,129,166,90,54,12,111,220,11,91,215,-122,224,24,134,134,233,163,157,106,90,22,148,84,67,214,13,99,21,27,242,-234,9,75,76,160,58,28,51,117,240,60,126,220,251,172,52,115,4,86,137,-193,34,212,30,251,153,80,188,209,59,51,53,251,72,47,193,52,32,144,40,-2,94,25,60,73,19,121,152,205,201,81,160,216,240,16,195,254,133,159,105,-83,129,128,58,62,110,139,5,250,111,219,169,204,191,127,242,197,48,68,205,-161,5,8,160,224,161,114,204,214,26,31,182,228,253,100,238,103,156,248,60,-129,169,26,136,210,14,145,195,107,156,44,144,14,140,133,128,149,83,110,196,-184,22,15,226,93,190,226,242,242,215,37,12,181,30,211,226,177,126,1,118,-154,86,35,187,147,178,93,99,120,232,15,252,58,189,201,172,158,196,183,188,-223,34,120,126,254,230,216,187,96,150,212,48,233,149,127,63,235,48,6,242,-67,183,2,183,90,174,90,239,117,15,1,38,159,18,72,86,204,119,100,195,-224,107,57,6,118,216,147,50,25,130,14,117,199,185,173,229,108,193,106,140,-174,91,218,208,230,85,30,34,154,144,132,142,76,63,34,31,26,15,9,33,-24,4,23,149,251,149,145,125,112,225,244,89,117,222,14,169,191,59,70,175,-110,210,75,56,13,28,6,95,220,34,122,50,207,67,164,121,113,2,146,38,-115,186,114,202,182,196,16,169,245,188,1,180,238,29,29,206,255,200,89,232,-49,31,48,100,108,168,122,188,0,239,241,233,214,60,53,143,145,235,70,152,-144,91,182,23,28,119,55,188,122,132,114,21,144,164,245,41,116,236,207,185,-231,53,61,104,198,48,171,237,47,203,128,161,63,245,162,91,118,131,161,61,-54,238,194,135,65,26,220,173,143,111,101,57,241,18,84,4,245,93,36,15,-98,11,234,45,136,203,250,123,214,49,80,118,175,129,148,121,53,181,229,222,-229,44,225,159,63,190,8,88,140,111,46,95,202,56,5,194,57,87,119,131,-197,222,41,27,49,240,247,213,125,241,254,117,43,157,211,40,202,95,222,89,-61,228,110,220,74,13,80,110,182,28,74,244,187,91,99,218,158,26,255,167,-232,151,221,220,187,198,255,64,93,50,253,243,90,93,211,20,244,220,5,70,-88,20,66,246,252,139,208,64,170,242,142,2,8,194,181,145,157,27,52,118,-137,145,127,136,181,3,74,166,190,97,236,214,103,252,89,32,198,175,204,166,-239,168,157,253,62,212,238,141,222,158,35,227,134,125,250,96,39,118,69,234,-97,206,20,201,138,19,147,188,46,10,73,238,78,122,14,177,185,13,1,151,-199,104,239,65,228,18,248,86,184,11,18,8,197,245,159,87,246,32,216,95,-220,241,202,84,249,200,251,245,141,99,18,143,5,165,228,224,77,174,66,171,-30,136,234,130,155,219,90,252,224,249,193,47,120,105,111,124,195,186,254,124,-214,27,164,233,6,145,98,197,180,242,174,226,123,242,42,247,12,181,49,99,-103,97,123,253,0,164,92,34,182,6,104,244,1,72,6,45,122,211,64,129,-75,242,240,172,178,194,181,77,127,89,132,53,181,187,208,22,206,157,4,179,-184,20,142,21,180,109,165,229,156,138,253,46,183,119,217,145,35,111,222,115,-144,158,41,180,98,60,130,157,21,144,93,228,202,186,174,163,124,98,66,216,-255,244,181,169,119,69,48,242,139,199,42,11,147,32,116,216,93,118,160,105,-179,240,171,98,64,242,164,37,28,1,191,238,76,199,202,47,171,251,107,101,-168,187,7,20,149,220,110,230,62,166,120,252,188,220,32,247,25,67,104,138,-202,118,33,205,80,148,169,77,214,146,184,98,231,223,81,100,218,221,36,17,-174,245,222,241,118,151,149,201,148,153,21,215,65,114,4,71,172,92,160,234,-144,219,170,28,9,149,8,7,144,120,162,147,113,123,3,8,121,138,30,102,-58,150,218,4,202,135,22,176,38,23,202,231,83,84,179,77,216,197,45,47,-182,236,169,75,31,210,243,202,13,45,78,1,91,135,125,31,4,36,192,128,-118,162,231,158,75,239,199,121,106,198,180,190,215,64,237,254,58,209,202,46,-140,233,230,236,195,60,208,94,13,144,7,30,135,253,241,183,200,38,239,87,-2,116,119,51,242,249,202,92,187,73,140,238,77,96,123,193,237,204,224,8,-113,217,237,21,134,5,162,178,111,79,25,139,149,200,212,196,102,160,6,24,-28,113,49,57,183,61,62,32,45,107,201,35,52,85,200,175,73,54,53,186,-189,227,76,69,55,43,195,91,36,55,254,44,94,14,211,147,5,154,125,251,-200,108,101,145,125,42,125,199,15,132,192,175,235,62,72,121,183,21,32,29,-38,2,116,44,36,93,27,35,214,49,118,180,220,254,63,177,213,91,19,246,-139,219,201,47,136,55,202,168,174,57,223,232,172,202,221,138,113,178,125,146,-231,226,197,66,217,102,135,187,75,35,172,9,74,28,49,115,186,83,190,7,-199,36,151,143,82,225,133,115,167,134,132,32,6,228,154,223,44,47,15,154,-86,173,152,171,30,171,104,32,90,189,159,185,45,243,2,88,206,128,13,75,-14,115,223,21,184,215,151,131,63,245,93,202,104,52,65,61,237,248,43,174,-19,10,33,91,133,100,127,143,103,224,218,132,20,104,107,79,235,138,31,5,-182,55,33,147,243,209,56,35,207,112,171,137,220,51,115,19,233,91,176,95,-18,134,231,207,154,96,3,71,140,105,62,40,230,123,153,131,188,11,185,94,-245,37,155,235,1,65,74,153,115,150,135,155,177,200,233,192,244,234,167,55,-154,158,62,19,85,221,116,156,224,127,160,138,240,211,216,142,43,166,19,222,-145,175,122,58,167,98,187,94,176,15,83,182,220,113,239,133,154,142,158,129,-81,9,52,176,36,92,218,184,184,139,169,106,96,199,171,174,241,48,19,132,-188,174,39,212,62,33,18,218,152,179,237,183,130,24,245,165,250,188,90,4,-62,247,23,201,28,102,88,160,34,23,149,6,202,103,152,222,196,230,141,170,-181,119,40,202,73,125,102,176,137,188,40,114,165,218,5,136,94,42,77,215,-172,201,97,141,137,196,92,123,106,176,48,52,147,139,102,146,62,209,154,83,-235,15,142,243,184,128,73,1,194,223,75,93,80,60,123,45,55,248,183,7,-249,0,150,55,171,41,10,243,206,92,144,224,96,254,146,81,77,118,0,237,-130,16,221,149,68,133,192,181,85,244,232,214,158,65,142,86,154,140,80,147,-60,193,154,70,103,94,41,43,202,2,177,155,98,254,90,108,122,59,3,69,-208,7,210,110,70,16,238,7,218,217,226,104,32,31,189,255,81,220,220,144,-17,3,218,112,46,189,192,80,240,42,56,137,41,152,179,150,69,236,250,150,-177,120,36,12,46,70,87,199,70,73,125,13,130,199,43,107,168,231,59,17,-165,15,61,64,1,128,173,0,97,199,6,122,169,75,157,43,53,91,212,204,-252,104,245,211,27,172,16,62,74,124,118,150,114,41,19,207,1,250,149,175,-22,167,135,58,187,149,240,96,93,10,193,86,82,101,147,17,35,109,200,40,-142,129,170,223,2,17,63,140,206,219,102,120,51,177,31,102,229,11,48,31,-111,180,162,22,248,128,13,214,174,218,142,66,106,185,98,97,239,105,176,106,-182,39,22,108,16,199,20,47,201,150,166,127,18,71,241,192,245,37,109,226,-142,42,37,85,71,175,25,143,29,12,5,236,39,13,99,216,236,67,191,239,-73,88,16,159,24,142,139,108,222,18,218,92,42,206,215,113,171,248,75,152,-193,109,48,116,200,44,149,149,250,200,32,68,34,62,0,201,148,78,89,89,-254,51,15,84,93,23,90,116,120,212,139,23,138,139,178,102,115,160,83,114,-197,8,252,249,186,234,19,41,96,78,0,62,219,28,101,31,233,182,24,48,-56,152,10,188,136,102,247,33,102,215,153,246,35,4,255,150,149,82,187,36,-31,174,61,61,248,63,141,111,17,122,106,233,204,13,175,149,213,145,67,113,-167,74,85,82,248,37,110,19,49,109,97,217,123,212,0,146,254,199,176,210,-246,124,89,86,18,160,91,85,117,193,208,166,245,207,175,169,132,15,19,22,-195,121,74,105,152,129,207,224,40,177,82,77,243,214,133,20,174,150,120,140,-242,251,157,196,67,226,242,186,20,19,176,139,127,1,241,10,235,67,81,96,-76,138,198,246,107,151,249,141,232,140,20,118,60,174,163,102,155,209,190,95,-32,10,64,149,190,176,142,156,166,216,244,55,246,31,207,29,75,10,147,155,-176,78,7,59,223,154,3,31,72,229,190,22,255,222,26,179,109,168,200,162,-83,192,210,142,180,180,32,135,191,174,182,4,35,120,251,155,42,33,76,32,-73,2,172,72,47,166,168,7,174,138,243,225,138,229,211,106,48,136,41,160,-21,180,129,109,111,146,191,84,249,19,243,64,70,124,173,160,115,133,170,190,-152,31,158,14,164,151,29,136,234,158,60,215,116,26,244,52,139,153,126,166,-143,151,161,162,157,34,124,245,42,94,211,163,157,167,168,18,22,215,122,165,-239,93,159,206,17,19,145,53,131,56,104,155,45,116,9,167,178,170,101,225,-242,136,53,196,106,48,149,254,137,1,2,55,44,74,103,111,97,216,109,102,-35,139,8,154,136,232,224,118,192,31,109,155,179,137,109,30,238,218,93,122,-88,36,87,75,221,187,200,13,224,75,65,31,3,163,175,183,24,185,161,139,-216,168,175,24,40,121,140,65,225,132,205,192,206,168,138,183,17,18,194,98,-0,148,223,224,141,95,235,144,141,172,53,199,181,156,30,113,96,183,15,203,-51,35,179,78,54,68,155,0,20,137,64,148,160,163,43,238,214,53,39,188,-72,211,47,173,226,118,39,150,226,176,116,136,73,199,25,111,223,157,142,39,-178,49,27,39,196,223,37,140,223,33,134,187,163,51,156,203,60,35,81,196,-205,193,215,3,113,110,112,128,186,57,178,50,240,36,186,243,175,215,5,152,-195,67,48,64,214,15,24,127,67,19,200,0,28,254,161,119,124,99,139,12,-83,45,21,214,25,94,123,194,134,226,77,60,53,120,139,98,51,232,246,123,-161,160,51,142,192,64,40,13,65,183,89,64,222,11,253,79,224,124,106,86,-145,174,252,9,226,233,17,48,210,71,43,49,64,12,86,16,197,234,156,100,-13,148,22,94,6,226,112,247,191,162,149,121,226,195,142,32,38,81,123,89,-240,206,209,200,151,158,27,28,90,131,15,27,140,12,220,220,141,240,130,6,-35,151,56,92,101,196,210,56,140,115,66,176,190,97,104,7,224,234,16,19,-76,160,65,141,124,216,183,227,192,143,77,5,195,139,167,16,38,122,188,6,-228,186,93,39,11,113,14,211,232,21,41,59,111,61,34,213,221,56,91,251,-184,95,228,191,139,26,186,235,42,16,100,165,219,131,33,72,252,135,56,252,-187,24,248,146,30,247,51,123,36,166,107,16,96,25,169,165,197,232,230,132,-243,4,126,173,113,240,54,209,97,114,166,183,197,208,6,117,86,147,231,217,-100,233,78,193,244,219,209,221,88,138,188,203,254,1,181,19,247,213,10,184,-146,200,146,154,153,45,232,139,253,95,195,133,200,241,176,200,203,217,59,65,-185,44,232,193,42,200,185,52,154,243,226,1,144,132,190,92,79,219,153,52,-84,93,65,49,18,138,39,148,72,178,83,224,6,59,92,148,88,183,244,153,-181,96,231,213,208,207,156,217,172,206,84,67,185,134,186,224,125,17,153,208,-11,100,172,208,42,252,163,211,169,137,148,203,100,53,108,28,134,1,109,35,-74,130,191,187,65,196,132,61,123,72,73,242,0,99,252,27,238,38,122,109,-239,119,254,132,81,100,79,11,27,131,94,100,133,205,101,242,45,192,115,147,-201,113,184,84,249,222,254,182,191,140,55,117,170,188,147,202,109,161,119,3,-105,130,99,199,123,253,121,168,69,189,108,35,236,119,186,118,233,133,10,125,-35,83,56,1,93,109,31,211,86,228,238,117,218,207,120,58,151,19,105,245,-30,146,48,57,45,34,103,116,63,0,106,76,249,3,197,14,151,36,54,84,-185,38,98,156,85,30,171,230,118,119,99,230,206,177,81,238,173,47,122,190,-223,241,84,115,204,85,82,206,176,37,206,209,108,198,78,85,58,160,243,192,-82,4,218,111,150,106,163,147,102,21,236,44,109,101,30,53,166,114,117,138,-15,189,197,29,157,11,55,59,231,182,81,190,133,105,194,236,94,7,204,252,-82,46,95,237,12,155,154,100,148,150,236,247,167,2,81,99,165,218,112,83,-68,65,94,231,49,83,195,156,84,108,164,184,140,1,73,229,98,6,204,221,-50,61,0,179,148,49,47,240,187,157,6,71,223,228,253,46,112,60,111,213,-36,186,253,174,78,238,204,45,111,115,144,228,124,250,254,173,223,212,180,232,-84,140,128,158,127,247,182,233,234,169,234,114,114,14,50,200,182,112,18,2,-99,90,101,28,142,253,50,9,196,170,110,179,52,44,167,158,50,209,201,139,-81,189,162,249,235,179,50,123,6,2,68,175,181,209,157,57,51,89,148,236,-181,64,22,72,144,18,85,72,114,227,53,249,234,207,88,104,152,28,157,118,-186,11,43,237,192,87,0,214,94,136,113,155,32,100,85,180,145,220,52,185,-78,47,131,232,6,160,8,215,163,243,151,86,27,187,47,68,92,211,145,100,-177,209,153,104,209,12,191,15,71,58,184,178,171,186,170,246,89,56,252,29,-70,103,92,216,99,246,156,55,3,215,204,237,178,147,16,174,154,222,137,225,-109,103,216,84,190,192,110,128,134,134,105,14,91,214,56,206,151,40,118,35,-175,33,121,23,91,177,159,115,248,186,57,146,239,211,104,143,100,46,193,217,-162,122,8,8,114,27,191,101,40,181,245,146,52,191,187,124,30,253,206,73,-237,35,52,97,15,116,252,155,59,235,104,131,245,193,107,83,196,35,196,239,-235,158,219,212,94,15,240,27,164,208,24,20,251,135,50,120,46,214,151,196,-13,22,236,85,94,153,50,242,16,160,28,162,252,43,185,95,195,197,7,78,-60,72,132,57,26,115,142,65,142,165,127,111,9,201,54,153,176,255,241,76,-96,207,242,7,150,156,250,78,155,30,50,154,229,14,187,54,233,217,192,243,-211,81,134,102,215,135,143,75,56,25,46,50,251,150,0,169,101,98,74,148,-32,141,135,83,102,59,216,148,241,194,163,55,118,78,24,177,104,69,63,235,-98,229,215,146,203,142,0,96,203,215,31,4,85,88,9,49,152,222,108,150,-79,87,93,183,211,81,217,147,181,166,145,17,92,250,181,3,40,133,43,33,-55,103,139,62,67,214,127,197,31,39,106,59,70,82,168,107,41,31,102,227,-155,168,14,76,22,96,74,18,65,241,36,158,138,6,159,140,79,194,225,111,-190,173,82,193,166,63,33,216,222,97,146,238,176,163,168,4,101,122,213,239,-79,73,92,7,195,213,154,171,55,140,74,133,155,126,163,203,223,231,159,191,-65,76,93,33,19,208,8,254,239,237,75,98,219,134,175,183,253,66,250,213,-160,196,99,186,41,71,155,234,207,93,160,225,150,211,150,68,55,247,235,45,-200,73,119,69,213,90,103,220,131,109,110,76,248,20,218,128,59,99,76,92,-104,237,101,49,146,15,60,157,226,253,120,183,31,235,29,141,221,90,163,130,-170,163,1,71,63,94,33,112,120,9,135,149,186,142,152,89,15,174,252,205,-180,5,180,206,148,158,14,14,52,124,145,51,2,251,158,109,171,196,255,123,-134,40,141,249,43,74,83,118,3,102,71,99,193,245,250,139,188,83,92,134,-75,64,187,246,103,45,10,235,59,81,207,253,122,60,121,153,33,227,100,185,-110,161,212,131,37,233,214,110,211,120,48,175,110,17,153,13,23,127,189,180,-122,60,5,30,16,136,19,125,59,97,189,92,142,220,51,24,78,223,187,201,-209,51,236,31,18,231,51,5,24,33,133,152,16,107,141,255,73,83,198,12,-20,253,166,42,52,230,23,21,121,252,15,161,49,33,239,20,171,33,90,198,-94,14,127,240,182,93,30,65,121,94,251,118,124,204,250,203,244,174,183,222,-234,109,40,47,70,49,129,194,39,164,171,113,51,99,232,244,177,134,48,234,-51,161,209,232,39,38,227,218,122,202,173,55,229,113,12,255,202,93,91,191,-21,109,70,167,212,153,133,118,181,58,1,122,107,56,207,98,183,234,192,192,-60,191,49,14,54,40,48,64,219,148,25,144,82,83,243,97,252,12,128,195,-234,200,80,188,176,124,28,57,33,43,35,212,90,48,194,52,100,217,77,148,-45,78,240,220,12,48,230,42,5,21,0,217,85,5,24,136,186,72,70,33,-98,202,88,144,223,169,150,90,17,66,25,184,150,74,166,194,45,89,150,249,-153,6,191,55,189,213,65,16,129,108,176,110,127,10,142,248,250,240,162,48,-124,239,15,90,40,251,216,140,61,78,245,5,164,188,165,190,246,18,229,134,-36,203,77,7,116,2,70,22,56,118,4,144,225,196,77,25,150,80,143,96,-66,212,171,192,43,161,60,136,64,181,212,124,158,88,102,116,205,30,14,132,-90,37,229,93,26,204,76,176,48,7,130,101,36,68,73,209,154,176,72,173,-99,95,238,79,150,8,221,40,253,120,229,74,251,159,224,59,167,174,35,122,-122,183,70,24,21,53,245,97,188,47,154,133,75,61,101,36,29,148,30,188,-131,219,171,19,173,46,160,110,90,42,119,94,190,31,164,157,9,175,6,233,-208,35,9,14,198,244,77,140,238,82,4,193,87,26,189,4,106,184,80,252,-1,213,166,220,82,185,25,100,21,5,199,104,23,9,30,19,4,44,58,205,-56,143,193,66,79,92,146,124,5,25,189,88,123,126,178,184,112,25,200,162,-46,95,109,107,94,187,145,81,177,4,95,112,79,37,164,50,217,83,92,253,-65,7,102,103,210,96,41,197,223,211,24,138,165,135,119,4,148,149,75,202,-228,217,200,126,174,136,17,117,25,2,24,123,187,20,62,12,88,71,146,85,-108,120,52,215,100,20,48,10,1,107,169,168,115,7,223,9,46,138,82,40,-208,251,54,108,141,149,8,154,3,248,88,212,117,128,228,130,186,215,179,79,-128,237,140,114,67,93,154,191,146,175,196,139,235,19,199,92,34,106,130,216,-67,44,10,56,73,157,74,255,37,229,9,213,214,183,158,85,103,214,23,135,-99,43,142,4,149,244,168,136,198,188,104,193,183,225,145,55,221,210,201,15,-2,83,177,18,44,52,228,29,174,143,4,78,138,97,34,60,176,44,129,91,-188,56,12,77,142,91,17,3,77,11,4,245,234,156,49,220,57,196,247,168,-98,178,55,204,74,175,253,102,56,255,85,167,23,226,139,32,161,120,115,17,-47,31,190,28,116,88,173,187,119,191,19,42,62,27,70,207,137,76,136,91,-28,46,70,192,1,146,198,36,28,134,71,89,142,78,181,157,178,82,176,204,-243,130,97,165,119,14,183,132,189,20,231,166,98,246,167,87,153,20,156,148,-59,121,114,89,122,146,122,40,140,161,77,95,156,36,75,113,156,230,229,169,-180,99,82,225,62,37,141,47,134,63,32,120,138,224,206,26,122,68,3,84,-235,128,202,155,200,185,133,229,225,179,39,5,173,57,157,103,243,103,221,238,-241,119,150,148,232,149,18,246,231,125,187,197,237,228,152,176,126,71,70,49,-68,189,136,31,175,12,148,213,233,222,141,214,195,106,105,80,171,197,66,243,-107,98,198,228,102,32,160,113,13,71,215,225,116,200,223,3,197,87,132,204,-200,78,91,246,214,39,187,84,161,4,16,128,59,79,166,127,51,95,182,164,-21,72,161,2,232,208,100,166,114,88,24,126,155,175,18,202,193,224,176,215,-172,22,146,43,244,163,196,117,147,208,243,156,109,79,105,180,96,38,120,117,-182,174,0,42,55,52,70,201,2,136,130,187,228,23,112,160,61,171,17,83,-79,94,23,251,21,33,25,184,44,139,68,46,94,99,226,214,88,161,233,130,-231,81,144,202,157,196,18,123,201,42,202,1,85,120,101,25,165,246,134,21,-146,40,63,17,208,147,174,182,234,12,132,218,8,148,152,110,44,248,18,85,-78,130,140,171,244,32,66,210,157,204,131,116,192,0,198,158,114,128,145,254,-71,247,187,215,62,32,247,164,65,196,134,108,192,225,229,228,94,51,231,73,-234,174,34,172,221,47,94,59,137,184,59,123,41,49,134,17,110,86,251,90,-95,160,58,45,43,173,76,159,254,148,52,147,126,6,56,169,193,96,190,110,-61,111,211,199,187,75,86,210,241,60,140,210,158,184,82,211,127,238,53,145,-211,165,237,134,125,52,28,31,76,158,215,175,176,249,15,199,21,34,231,179,-31,55,90,166,193,233,200,190,157,255,101,159,155,156,234,170,162,241,203,243,-204,218,52,34,2,252,1,39,142,41,98,92,200,86,129,124,158,172,253,81,-148,217,64,22,133,226,173,188,37,38,208,201,203,253,202,1,96,65,178,244,-120,191,12,190,217,145,102,194,196,173,37,188,3,45,100,63,54,207,239,5,-170,208,129,124,82,237,213,148,218,64,21,203,68,157,44,225,175,92,216,26,-222,173,34,132,75,27,3,89,34,124,52,251,75,193,29,92,158,153,14,168,-101,229,27,165,61,24,129,60,101,166,67,70,161,105,12,37,77,114,9,53,-198,35,238,222,219,65,132,168,236,156,87,170,226,200,160,82,50,115,219,91,-23,110,151,210,248,82,152,75,191,114,68,4,82,177,126,65,128,128,171,153,-205,9,136,102,84,142,85,188,171,76,38,75,180,207,118,5,203,169,96,156,-119,216,54,84,18,170,75,71,179,82,134,205,10,157,32,141,194,76,4,116,-94,107,108,251,247,42,135,78,137,221,64,189,182,114,223,225,229,10,68,96,-12,12,231,39,229,225,9,29,122,238,57,107,205,54,131,98,80,208,230,231,-152,112,36,104,166,71,61,135,47,220,187,135,215,163,2,219,114,5,119,125,-195,127,162,158,126,29,1,184,190,109,146,81,215,136,30,89,39,124,65,100,-181,148,182,120,45,159,94,185,163,185,2,151,169,231,200,97,115,15,140,94,-196,185,35,94,44,62,104,226,0,176,130,83,218,249,39,52,95,19,0,113,-83,60,24,203,240,9,97,229,9,97,80,182,54,86,193,68,43,237,229,101,-34,144,43,144,56,212,101,96,155,247,198,114,231,0,106,67,180,147,53,142,-81,135,159,208,20,13,218,47,167,139,155,191,205,177,139,78,159,88,50,224,-250,193,72,44,134,109,102,48,73,238,62,47,28,126,205,162,71,196,237,109,-58,104,191,217,38,159,138,128,241,249,104,74,135,186,163,6,216,172,187,62,-202,173,118,207,200,56,26,230,36,85,128,72,221,18,91,34,116,187,24,133,-91,80,194,175,43,201,53,51,39,243,192,2,242,153,95,200,94,200,26,59,-40,194,192,250,126,233,166,179,20,191,115,218,255,70,22,130,236,22,132,36,-11,129,1,134,129,240,245,93,218,18,146,227,71,164,171,203,236,133,180,248,-217,133,202,220,133,169,88,216,41,62,108,127,199,9,62,64,139,139,69,242,-182,177,132,18,0,6,38,253,114,161,119,83,183,194,156,124,241,180,78,194,-165,42,110,170,242,108,110,4,160,58,24,181,18,199,51,253,204,70,15,128,-191,144,245,91,133,242,109,206,254,197,75,34,84,225,88,115,197,99,218,208,-120,188,149,117,176,186,113,22,55,181,125,172,133,242,66,4,131,149,252,26,-232,145,13,233,88,90,84,136,118,26,72,242,245,209,5,243,214,49,154,136,-249,108,219,188,243,20,35,38,212,246,58,2,195,187,137,3,255,161,170,76,-131,191,157,137,102,166,225,143,146,56,103,76,90,143,136,245,49,16,206,156,-6,152,234,110,91,232,224,9,254,49,79,109,139,98,165,170,23,57,204,211,-83,159,57,87,198,219,31,159,134,249,227,53,138,43,56,170,101,170,163,42,-84,76,82,5,23,223,244,111,199,204,88,167,204,185,63,175,138,64,242,163,-38,25,193,152,171,26,52,26,244,236,208,254,94,19,165,101,37,226,63,16,-23,183,213,180,124,22,234,181,18,26,232,37,171,64,80,180,143,106,181,223,-31,172,35,140,129,79,245,143,248,35,7,255,143,233,136,189,41,183,39,3,-121,101,158,16,181,231,198,86,210,30,16,96,115,226,232,235,220,96,223,156,-102,247,97,151,64,245,72,161,9,250,71,91,18,180,14,60,1,217,66,106,-248,2,152,189,235,20,199,169,56,34,226,138,77,244,8,132,125,115,178,86,-32,90,83,212,38,224,90,11,16,118,12,84,10,32,234,156,204,109,220,34,-117,178,76,246,90,99,235,210,244,23,143,43,215,96,193,177,155,188,242,38,-244,19,90,207,35,24,152,109,33,52,67,46,107,228,189,220,97,245,20,1,-87,218,131,159,155,61,30,173,242,156,126,181,232,84,164,69,8,183,201,58,-11,104,77,227,152,227,48,160,250,50,181,76,27,205,49,110,2,221,170,112,-36,83,91,103,59,82,28,162,109,200,2,197,199,238,104,105,170,222,219,213,-33,85,81,49,112,77,26,108,248,94,249,39,25,253,111,9,243,200,168,159,-84,16,116,253,77,192,123,56,190,135,22,250,201,205,54,217,27,69,90,165,-40,183,31,180,191,76,52,141,224,22,103,12,189,208,196,141,129,142,199,221,-48,49,197,248,32,112,183,94,100,191,22,119,15,141,88,175,174,175,204,152,-129,33,147,172,244,18,71,105,209,122,26,46,210,197,182,170,200,109,155,152,-173,107,164,59,195,131,117,1,129,206,70,22,47,104,250,235,118,23,42,129,-225,227,132,237,204,185,250,191,17,43,176,217,129,100,3,188,130,113,65,64,-183,235,75,128,249,205,55,175,135,175,80,168,136,254,68,159,228,66,192,124,-8,219,248,194,128,111,107,195,77,30,25,190,118,12,228,213,223,254,120,12,-247,35,67,182,136,213,186,227,136,130,90,73,226,202,142,34,148,17,155,60,-212,213,104,135,208,108,46,188,173,196,16,143,45,218,15,192,184,130,43,94,-150,80,190,93,114,2,183,143,113,196,35,133,185,97,51,59,220,33,76,22,-47,148,13,241,131,210,108,244,201,7,20,28,171,64,197,127,100,47,178,91,-67,181,246,177,171,162,197,244,158,198,77,176,32,171,101,123,180,47,89,83,-234,235,106,234,2,149,200,88,40,98,237,6,164,168,200,46,1,213,179,152,-32,113,79,253,243,230,213,29,96,144,227,44,198,223,218,103,189,233,189,218,-175,243,61,189,68,118,84,251,199,167,229,56,229,74,22,161,245,180,113,159,-195,248,62,229,222,228,102,225,171,34,165,0,71,215,52,162,48,170,172,175,-13,35,84,14,246,227,149,126,199,237,119,185,114,99,84,152,36,151,55,108,-90,230,239,123,9,138,206,154,142,251,254,237,238,252,0,27,175,43,2,223,-183,93,243,216,204,224,51,161,175,162,245,196,69,160,237,243,17,190,90,164,-199,71,242,64,16,167,26,18,53,11,68,177,157,110,241,22,25,238,250,251,-150,177,99,12,100,85,8,69,251,245,142,185,173,193,215,129,116,160,187,112,-106,211,126,27,65,167,164,187,68,79,204,242,87,202,156,180,172,59,235,158,-147,45,254,4,48,42,86,170,98,179,205,219,29,77,72,204,83,140,48,237,-226,121,122,116,79,111,91,4,1,50,71,31,12,240,203,57,231,15,87,181,-12,130,113,172,89,85,60,10,198,235,32,151,138,249,0,143,125,181,68,204,-248,164,229,148,122,99,229,234,244,176,32,91,140,10,144,209,211,232,86,239,-223,4,189,113,179,111,171,58,157,173,174,4,201,5,245,117,108,70,79,55,-219,16,130,59,123,187,34,198,136,194,203,152,34,100,150,73,104,84,101,189,-215,23,166,236,119,16,17,242,226,190,119,51,165,71,60,54,142,94,248,215,-74,140,37,186,196,253,114,71,247,253,103,200,108,151,115,68,51,25,21,73,-174,80,62,150,42,181,142,154,216,88,64,217,226,69,228,128,57,63,223,243,-142,216,172,85,160,214,122,35,7,170,204,168,8,120,121,182,161,146,55,155,-125,181,17,162,54,162,254,7,181,171,21,145,222,242,106,103,10,249,185,21,-134,2,183,181,30,204,239,174,132,78,165,65,115,161,158,169,238,40,57,66,-8,28,126,197,1,115,155,21,152,248,45,185,28,46,151,205,180,185,66,65,-55,106,144,60,95,82,99,117,45,142,110,213,146,51,208,165,32,83,33,238,-227,9,182,234,206,80,233,122,90,87,25,244,193,97,242,50,24,0,145,63,-193,154,36,174,242,174,34,127,51,156,131,45,156,163,193,228,128,155,240,183,-198,153,111,188,155,39,93,220,224,40,52,93,100,41,172,40,228,59,103,28,-61,203,174,195,124,209,27,165,207,185,211,75,88,178,122,158,151,60,86,237,-251,225,88,105,8,56,67,72,186,236,196,199,234,149,75,97,206,255,53,142,-225,132,216,94,39,118,230,211,107,187,88,55,86,59,124,35,187,125,103,26,-54,90,24,52,2,230,195,16,157,141,96,220,132,245,199,200,80,207,166,199,-114,25,203,71,7,74,71,150,219,156,40,42,106,244,208,97,16,206,113,144,-180,55,175,212,81,81,227,150,107,191,43,173,164,12,40,72,96,105,46,45,-43,163,162,165,250,49,77,96,48,239,121,93,245,125,245,25,121,26,22,65,-85,2,106,139,221,130,60,47,73,104,17,226,184,145,244,215,180,123,18,214,-70,16,32,187,45,0,106,13,130,103,133,43,221,10,132,197,139,222,54,217,-146,174,100,217,92,78,70,77,168,202,117,63,51,128,102,74,215,11,82,223,-226,172,142,7,180,66,149,42,18,126,189,11,88,97,45,234,142,75,146,16,-24,211,75,144,37,185,60,234,23,202,28,31,182,157,108,230,4,210,37,4,-180,103,126,155,114,151,172,1,78,206,202,205,38,171,147,50,147,10,5,27,-248,163,92,151,104,34,114,93,13,39,188,180,15,115,114,153,245,146,122,191,-165,169,46,67,176,67,33,214,101,120,143,223,112,248,102,127,157,42,186,163,-192,156,71,227,191,52,197,123,167,189,168,115,150,211,116,31,23,83,31,83,-113,244,100,132,220,11,201,179,221,185,201,3,187,9,99,179,102,39,14,39,-54,110,163,88,228,237,217,70,184,91,76,21,158,90,241,41,150,37,208,165,-204,131,155,107,69,96,47,25,157,2,90,208,159,162,125,209,113,119,170,20,-200,13,34,37,116,47,192,18,72,153,167,125,40,106,59,10,174,98,101,191,-15,188,21,164,63,131,213,54,248,237,22,60,64,40,142,147,91,31,230,208,-6,155,137,1,221,195,186,127,21,174,223,25,230,138,7,205,190,101,242,246,-154,232,20,182,79,26,181,167,240,8,196,148,62,198,231,228,223,165,92,103,-120,144,229,30,51,163,114,208,98,190,170,88,135,79,124,65,88,59,125,68,-7,247,9,98,174,16,186,222,107,8,218,18,184,99,169,53,100,189,99,201,-77,183,248,89,152,222,218,120,30,17,241,235,29,71,155,237,121,172,81,195,-114,247,36,234,99,225,235,131,203,148,50,103,2,82,213,151,148,21,148,243,-206,35,26,253,120,84,157,70,120,56,203,108,211,21,52,108,72,141,146,204,-230,183,234,116,100,29,38,237,184,27,90,179,52,191,66,6,125,232,83,58,-141,2,214,129,175,193,77,114,129,155,61,223,22,154,137,5,169,225,132,122,-230,156,231,124,30,106,10,215,219,10,125,137,239,103,232,153,209,132,112,85,-122,110,171,204,154,71,224,124,171,103,215,198,101,214,93,240,1,157,188,51,-189,152,246,66,109,107,239,111,172,16,225,40,63,57,172,72,35,183,105,36,-217,231,92,228,174,199,57,211,128,2,56,126,69,177,102,87,164,7,141,138,-107,97,205,109,37,8,136,72,32,231,12,11,7,60,73,83,253,232,181,120,-159,125,229,216,233,225,131,241,106,108,253,248,149,80,208,69,194,0,16,120,-55,52,48,143,64,224,245,170,215,134,107,53,89,95,140,155,68,192,60,0,-155,37,89,44,72,144,235,241,74,2,224,88,95,213,50,19,137,174,112,54,-226,176,185,107,174,254,220,64,53,121,26,28,216,186,16,51,185,220,254,27,-209,120,252,21,101,97,104,29,106,228,150,192,201,80,215,69,210,197,239,20,-156,60,141,24,45,182,185,148,136,82,152,84,154,47,65,41,189,208,40,231,-220,252,88,145,62,247,150,1,10,121,137,220,148,90,6,137,62,132,15,49,-76,192,131,168,149,169,115,221,37,35,243,99,236,28,228,31,23,175,161,71,-67,8,104,220,8,74,145,157,28,76,250,88,200,117,190,26,135,107,158,228,-185,128,28,48,32,79,180,190,148,53,132,106,148,186,148,131,252,85,239,89,-196,52,54,74,94,50,172,90,133,187,124,151,83,112,224,80,90,19,33,224,-211,116,124,167,12,96,142,15,169,66,15,123,167,178,248,109,206,16,234,245,-5,167,138,138,94,107,147,37,217,226,191,134,0,239,115,165,72,51,145,216,-229,202,229,162,23,23,180,178,194,175,15,235,162,38,85,89,16,124,133,217,-206,28,124,67,76,48,174,243,211,29,44,109,211,206,179,205,252,175,37,205,-38,159,161,84,64,175,34,168,208,179,105,203,96,222,239,116,73,206,28,63,-166,31,215,214,180,19,99,111,113,5,153,131,22,227,205,18,171,76,213,110,-164,247,43,28,30,53,216,239,82,14,228,171,170,212,244,212,71,12,17,69,-211,17,181,42,181,224,223,196,157,13,193,187,35,182,4,132,63,60,140,91,-163,225,141,8,13,223,34,3,14,184,84,42,105,10,68,61,63,203,216,229,-36,62,30,8,89,177,192,112,120,154,63,135,170,172,89,54,37,198,178,21,-182,76,192,182,22,125,46,249,127,157,153,120,144,185,190,158,76,242,69,183,-21,201,92,167,167,20,188,153,144,54,46,197,137,21,154,69,179,244,216,109,-14,228,42,243,39,69,135,93,156,75,54,204,9,144,131,120,95,127,152,119,-172,21,144,77,191,57,15,78,69,103,215,101,129,55,175,42,220,250,253,220,-219,61,30,22,117,221,6,229,15,205,153,233,127,180,53,30,35,147,188,242,-42,29,175,82,109,161,37,158,149,103,150,4,158,44,43,19,187,196,155,100,-159,79,99,100,104,196,201,96,94,197,59,64,247,157,175,234,243,40,105,110,-236,20,221,204,136,106,210,253,29,162,216,68,180,77,72,211,157,147,64,198,-102,167,183,5,131,159,48,234,189,3,181,74,64,162,91,136,232,31,107,224,-172,176,224,53,212,254,1,156,155,221,8,170,251,218,144,43,55,122,60,251,-41,225,43,36,12,226,123,105,131,53,127,206,241,42,108,55,127,51,97,120,-40,215,48,148,180,36,243,185,47,210,14,183,209,31,172,62,54,11,114,116,-87,132,210,11,157,217,176,22,22,113,155,168,187,93,153,94,143,96,134,193,-244,194,180,138,236,226,2,175,129,142,217,86,203,43,236,236,41,171,40,74,-247,32,198,14,77,145,112,41,179,216,141,228,129,241,11,9,205,148,146,22,-128,192,97,110,190,131,152,14,132,101,29,204,232,130,154,33,154,32,198,235,-163,179,28,225,63,105,107,245,86,42,139,81,13,203,90,73,199,169,58,30,-158,210,252,159,142,94,163,22,37,121,232,98,255,74,103,133,129,237,222,160,-17,179,136,235,201,187,58,64,59,2,243,225,108,224,129,226,232,154,49,35,-176,178,9,254,149,229,27,137,137,160,112,163,130,0,255,162,72,223,74,90,-74,180,79,231,252,70,124,62,162,246,69,155,246,7,84,126,127,23,104,195,-142,151,165,31,78,152,68,15,15,92,103,5,55,80,197,129,213,210,163,234,-198,73,132,125,7,189,150,184,14,17,209,50,33,110,21,155,219,195,75,157,-66,246,179,27,139,17,160,207,37,102,74,70,138,128,183,71,33,169,222,20,-166,195,100,172,154,115,221,241,63,17,68,142,167,63,20,142,91,164,72,54,-122,107,80,3,2,67,116,93,177,99,225,216,239,119,19,65,203,242,240,132,-192,190,96,10,143,180,155,43,195,194,66,181,241,131,54,0,157,74,84,148,-136,240,109,233,229,190,61,210,235,50,151,203,122,245,194,187,186,60,76,75,-89,150,12,200,105,235,220,167,212,131,171,217,141,3,203,125,97,133,63,221,-162,135,55,90,56,48,200,21,74,155,95,157,15,14,61,69,181,232,109,140,-201,74,71,12,129,127,92,186,45,161,194,113,127,6,93,80,230,75,15,126,-98,200,76,187,163,150,8,61,148,173,127,208,217,245,189,181,223,26,19,81,-50,115,108,58,239,244,233,248,31,214,38,244,12,90,1,162,148,71,201,116,-45,187,92,226,156,26,14,202,13,72,198,163,15,16,178,33,220,235,24,211,-119,99,250,239,173,222,210,53,190,2,157,24,91,66,20,25,109,168,194,209,-40,167,164,29,128,58,213,162,176,203,190,14,54,7,214,16,125,233,195,39,-126,38,83,96,33,181,103,209,131,31,173,90,8,147,134,40,16,94,98,86,-228,157,210,67,244,145,113,227,41,46,73,37,255,217,220,39,45,57,39,106,-224,165,129,231,149,183,15,209,104,216,28,146,128,176,19,162,151,235,103,24,-161,254,1,3,194,75,38,202,123,21,197,234,65,6,165,227,235,123,108,151,-27,240,160,0,150,198,243,156,134,238,79,228,198,49,193,209,71,134,119,201,-19,75,131,65,154,150,142,120,173,230,207,210,161,196,72,50,117,194,30,23,-40,227,102,74,104,177,101,117,78,251,170,147,88,100,143,238,128,105,141,3,-127,144,29,124,110,184,178,68,130,107,224,214,12,228,207,21,51,238,66,68,-130,115,87,196,195,75,70,105,40,186,240,221,6,46,77,129,99,222,130,92,-10,249,230,64,227,88,54,116,188,95,152,19,131,37,136,67,76,12,149,209,-40,108,191,122,128,155,186,46,160,117,166,25,10,23,215,159,8,158,14,45,-187,133,10,127,33,114,200,76,17,92,30,164,182,236,115,81,171,177,78,211,-216,215,104,216,7,22,231,239,29,239,42,201,193,154,219,91,174,250,79,189,-146,228,43,180,244,0,235,17,108,176,238,234,24,114,167,169,26,37,22,47,-93,167,156,244,98,14,182,178,209,29,83,124,202,242,205,245,24,211,247,220,-189,206,227,82,79,145,152,32,95,140,248,47,204,141,235,46,1,44,185,65,-231,157,224,50,250,102,161,195,213,129,194,169,18,110,62,127,63,87,218,192,-83,202,47,13,46,184,159,213,178,150,108,82,56,173,17,154,120,206,18,77,-33,248,140,98,81,64,241,81,250,79,120,137,130,223,92,76,241,103,244,189,-137,252,113,177,196,143,98,100,66,213,119,89,23,30,120,149,132,181,165,152,-235,24,31,85,6,31,5,224,73,189,63,106,126,101,103,177,193,124,16,254,-119,146,115,78,98,220,16,102,192,63,122,194,106,140,225,208,120,54,243,193,-252,218,113,103,219,77,51,10,13,32,13,6,205,238,40,176,222,9,225,226,-204,133,173,170,194,103,197,234,127,114,175,233,67,254,25,42,106,220,51,114,-216,22,71,224,116,173,130,55,198,238,228,43,15,126,20,107,128,110,36,56,-196,16,35,231,114,63,130,82,228,209,252,228,22,170,250,138,11,72,251,249,-224,89,143,65,87,115,253,48,34,97,234,155,224,44,119,127,25,219,126,167,-223,39,123,151,135,64,146,208,18,114,251,254,246,55,214,110,18,242,142,238,-255,183,239,165,146,121,96,209,111,169,219,203,212,70,115,125,126,217,128,119,-28,202,145,24,110,149,1,62,34,209,107,135,39,119,22,132,70,86,38,14,-37,75,96,119,82,135,71,195,87,124,23,54,186,239,184,226,14,169,157,82,-36,80,125,86,209,131,237,237,7,146,232,118,181,88,31,214,61,127,4,148,-225,156,2,98,38,48,105,7,135,127,69,85,249,44,83,241,15,253,112,190,-142,172,93,27,224,191,105,254,187,1,225,135,57,151,51,255,22,173,224,185,-160,55,14,23,13,41,77,4,24,155,87,217,196,224,220,162,17,242,39,36,-244,246,191,95,13,92,97,158,126,18,190,21,197,251,136,58,232,134,197,158,-27,21,39,38,28,18,85,176,17,234,104,188,43,79,73,97,238,190,66,41,-174,146,75,189,54,50,127,179,173,56,112,72,43,156,137,151,46,36,30,110,-133,134,32,203,239,189,183,137,136,132,105,135,30,250,51,106,19,16,247,215,-237,98,118,154,77,174,190,93,207,34,49,208,1,97,63,134,165,157,9,253,-141,134,228,39,248,22,24,89,184,60,241,237,245,141,225,64,224,98,198,72,-202,235,10,150,87,137,253,239,216,80,106,235,59,32,74,130,18,154,235,75,-37,74,92,178,47,248,60,70,110,231,33,83,66,240,54,91,137,21,54,183,-27,43,144,107,237,54,6,170,81,162,105,175,201,190,208,61,217,38,33,124,-36,92,223,166,193,67,112,128,141,174,162,139,176,191,208,225,116,170,115,82,-51,211,147,226,38,165,214,203,134,139,167,167,17,15,4,177,202,248,162,148,-60,7,171,12,151,211,125,227,164,93,10,149,7,109,42,115,99,154,195,253,-223,86,108,230,103,115,165,168,150,45,97,13,109,227,88,36,247,185,176,100,-219,45,68,130,34,23,179,33,245,16,218,91,40,90,62,126,108,189,223,39,-121,42,72,24,63,52,42,62,168,60,119,121,45,55,221,11,54,77,185,194,-141,215,27,184,207,111,33,228,96,58,83,243,16,241,183,118,254,74,19,94,-121,205,113,41,142,85,57,176,73,69,185,217,104,228,16,207,189,233,215,210,-129,11,142,68,110,44,97,230,203,15,136,125,166,253,141,159,18,10,118,144,-91,203,220,185,244,100,18,201,155,61,138,25,9,222,46,37,15,92,27,77,-12,120,14,14,142,59,244,43,238,191,212,10,150,20,67,70,183,136,91,23,-61,76,9,228,103,19,132,34,155,180,63,1,255,34,147,47,36,243,32,104,-72,43,184,57,132,16,80,51,229,149,224,212,104,195,96,169,190,141,47,219,-221,108,204,104,26,159,134,228,92,154,88,23,165,104,213,74,152,218,161,57,-191,57,182,38,61,235,59,176,83,52,130,17,173,104,53,93,97,125,182,129,-235,33,203,178,243,131,139,87,214,125,64,81,4,158,205,35,125,105,58,30,-97,143,91,95,46,117,231,237,199,138,242,98,105,106,155,213,196,250,9,134,-53,208,45,37,64,62,209,15,62,108,240,212,85,29,44,255,39,77,144,122,-40,191,204,31,173,160,156,73,98,229,142,244,135,188,176,120,106,51,98,79,-243,184,247,89,52,171,219,240,94,136,186,96,148,218,215,251,249,93,47,58,-42,157,114,218,212,141,236,129,235,165,209,87,146,128,94,245,208,100,66,232,-192,87,40,194,224,87,222,129,243,99,77,108,237,224,160,26,203,207,19,198,-136,225,23,219,255,122,107,14,61,139,153,180,242,109,105,176,55,32,92,133,-67,98,138,212,96,178,42,1,231,154,39,224,30,98,59,54,204,135,1,189,-81,88,20,229,58,62,46,253,152,68,218,178,35,236,160,142,7,43,16,93,-32,219,55,56,101,71,63,206,220,148,228,191,38,42,207,5,233,12,62,35,-27,77,200,226,242,79,25,224,135,3,57,22,103,31,74,53,135,2,88,90,-100,40,147,107,70,203,85,106,0,103,48,5,132,120,218,19,244,84,232,165,-195,1,98,250,208,17,12,98,85,8,30,33,60,237,154,200,230,23,19,16,-76,160,125,138,111,194,47,128,233,201,41,70,124,197,50,2,123,91,132,131,-33,167,172,31,52,78,128,160,3,113,245,140,43,14,12,41,214,130,213,10,-7,22,190,180,253,169,248,225,134,166,27,62,16,129,219,133,104,183,190,132,-156,142,66,98,83,191,126,103,28,247,190,220,9,234,157,175,212,72,74,51,-201,174,181,134,41,82,83,136,31,41,244,59,162,108,233,230,14,190,33,0,-112,249,249,62,60,127,197,215,98,127,172,116,254,211,207,176,224,38,242,142,-150,115,50,36,31,229,234,181,18,73,63,129,243,255,170,175,169,177,146,181,-52,183,8,236,41,64,204,222,205,195,14,75,223,60,230,174,7,42,146,255,-177,31,108,241,40,45,53,109,239,130,206,25,196,78,21,37,232,68,241,140,-240,131,213,248,86,125,243,177,46,226,254,27,140,180,236,194,1,82,237,253,-94,220,209,16,198,125,102,135,195,27,39,38,149,169,7,49,185,40,84,241,-24,47,115,195,123,102,233,110,182,204,79,224,126,202,244,180,6,171,253,78,-116,98,56,74,115,156,182,115,167,110,15,34,126,144,45,181,123,169,42,70,-121,248,228,63,110,208,4,207,101,31,123,106,144,149,154,243,140,38,155,122,-79,71,17,156,170,36,232,90,86,120,132,219,226,154,130,134,225,99,208,178,-159,97,54,129,202,11,158,86,160,144,158,94,120,64,4,20,71,19,3,111,-65,112,221,166,148,31,154,140,71,74,141,3,141,105,87,123,49,73,120,64,-67,224,125,71,158,181,46,134,246,131,124,117,19,33,89,115,160,124,138,93,-152,79,55,221,201,79,168,51,39,114,213,80,255,205,23,88,212,211,65,225,-30,254,90,189,9,173,160,92,147,195,158,25,252,54,42,68,167,221,6,1,-73,34,164,50,48,69,25,235,4,78,226,38,131,25,194,191,234,140,210,72,-144,18,52,66,107,33,106,36,222,216,255,184,240,202,187,76,236,158,106,108,-111,244,144,113,23,91,211,109,152,94,180,235,117,149,227,2,120,100,69,24,-151,54,66,10,207,221,37,125,17,0,139,246,176,78,182,36,75,209,221,252,-43,130,40,255,218,230,42,52,145,245,7,163,109,206,16,49,30,174,78,206,-103,225,229,167,138,178,137,39,33,230,177,160,150,147,68,95,127,235,133,250,-201,96,221,239,88,247,169,207,76,224,121,243,81,189,144,181,234,200,87,201,-243,80,71,238,172,217,45,77,162,38,77,27,17,241,185,173,169,176,175,58,-111,20,226,240,241,106,249,60,131,14,4,63,214,238,212,95,237,59,190,188,-185,12,74,108,37,248,53,215,218,75,204,241,149,22,28,157,147,25,193,222,-157,57,96,142,107,84,51,142,97,112,188,98,156,72,254,126,127,30,10,79,-117,254,52,225,61,146,60,115,58,32,227,107,233,255,143,236,136,84,226,148,-239,100,89,49,93,9,40,10,241,78,17,244,74,212,130,242,224,162,215,209,-244,250,179,97,8,210,14,223,91,193,61,237,2,179,42,22,17,127,194,146,-232,73,92,26,186,195,230,55,62,76,32,205,158,51,5,99,63,118,203,15,-28,101,57,62,125,51,189,29,6,207,49,71,58,201,211,179,162,23,21,126,-6,150,41,209,32,90,21,63,9,239,200,189,135,130,193,190,230,92,160,68,-135,138,249,139,164,121,103,177,17,26,147,82,111,40,147,89,205,229,188,176,-149,123,156,134,142,65,42,168,72,148,142,242,178,253,1,15,174,179,112,77,-179,185,99,99,216,8,254,49,144,211,160,114,65,135,75,196,101,72,167,113,-113,37,100,105,213,45,167,154,181,75,226,31,151,144,176,92,16,244,143,106,-19,106,188,3,161,249,122,125,2,178,14,4,166,136,223,41,141,165,169,225,-80,174,180,38,51,94,63,64,221,248,5,88,174,249,26,22,106,167,69,226,-119,205,171,159,226,68,123,240,60,159,179,45,93,89,236,11,211,159,189,149,-181,33,154,73,133,58,222,153,72,89,151,78,24,181,28,148,207,48,97,229,-26,101,19,168,247,31,18,152,145,47,98,43,1,139,165,11,80,9,159,87,-57,86,105,199,242,129,120,65,241,38,166,54,166,34,164,226,64,159,66,178,-130,207,142,150,50,98,175,223,87,16,43,13,82,162,160,175,64,159,82,127,-200,120,163,212,15,194,84,188,122,209,198,21,241,78,74,113,150,147,252,6,-139,169,171,36,2,23,23,68,3,63,14,172,233,189,12,30,53,242,71,216,-199,9,106,38,162,115,58,250,244,65,231,186,168,221,221,26,160,86,174,110,-221,2,120,147,50,200,96,56,37,202,237,74,226,198,206,30,22,238,197,243,-197,107,115,136,103,126,249,234,144,109,119,198,212,167,89,240,8,134,164,217,-194,91,21,198,225,1,177,117,241,219,225,42,228,18,251,225,68,253,55,192,-205,148,90,21,92,181,17,219,152,98,101,188,193,76,56,201,204,220,179,167,-137,97,217,78,207,158,27,120,255,95,24,19,92,43,168,196,193,205,51,162,-113,101,58,186,222,130,15,73,251,236,24,105,104,228,48,198,244,171,129,217,-91,254,129,7,160,185,21,209,23,246,150,215,161,98,2,52,114,143,234,96,-183,234,180,191,205,50,152,22,180,42,224,66,239,213,254,208,160,47,24,51,-64,94,148,26,6,248,131,158,239,217,27,130,143,225,197,22,248,130,167,65,-108,35,209,102,161,232,230,141,171,0,123,50,209,242,90,219,95,28,47,57,-103,42,247,163,68,98,2,93,211,172,193,217,231,39,202,78,20,5,174,246,-111,219,236,138,56,194,197,36,90,226,137,176,106,118,211,180,7,147,167,6,-235,66,79,52,118,235,14,141,118,89,253,222,238,240,47,204,39,65,5,83,-99,4,121,253,155,197,133,103,203,76,37,30,90,145,241,105,175,184,36,2,-102,85,81,203,21,239,36,188,167,48,169,151,53,113,245,167,8,171,237,179,-165,114,19,107,98,35,159,59,40,180,225,94,194,254,34,82,118,232,128,216,-245,233,226,140,239,42,2,39,122,25,18,205,143,162,140,160,249,236,99,56,-20,71,253,196,45,217,139,89,190,147,28,159,45,145,247,213,49,11,56,2,-86,107,123,188,143,40,48,36,96,0,84,97,145,144,236,95,186,246,165,150,-135,46,202,208,68,229,121,213,90,152,84,73,200,56,219,157,220,167,221,22,-235,249,246,23,170,162,98,198,128,24,184,223,100,50,54,195,31,216,101,44,-158,1,79,46,118,43,132,76,156,99,43,241,108,240,105,171,205,11,152,117,-37,133,148,213,203,83,94,161,30,228,175,56,241,250,19,96,128,251,182,183,-22,99,182,8,162,140,44,61,24,148,79,20,109,135,123,106,53,170,40,35,-205,40,75,163,53,251,141,208,103,141,224,109,56,227,252,75,113,38,249,43,-140,197,151,64,183,34,26,24,225,222,59,134,145,12,1,213,15,174,128,138,-113,222,32,243,170,239,22,138,186,212,32,109,87,23,160,173,191,219,187,250,-62,196,253,134,135,180,32,74,172,96,5,148,121,108,4,162,35,68,149,214,-49,145,8,186,60,136,178,213,92,131,22,211,125,246,40,168,5,237,42,254,-196,107,207,175,218,47,192,46,242,174,229,120,191,7,224,173,207,2,160,60,-162,13,209,17,207,10,156,196,61,77,216,47,113,173,121,217,166,8,88,19,-86,138,44,87,40,152,31,125,171,104,57,59,109,59,57,48,33,4,53,25,-130,116,103,10,109,244,152,140,221,58,65,149,81,171,80,251,158,216,219,128,-49,27,131,205,217,127,159,214,33,5,241,37,144,218,70,143,32,96,230,166,-170,96,106,154,216,214,47,234,229,47,211,52,224,28,136,219,111,158,144,26,-152,86,87,25,213,28,130,142,25,208,52,242,107,152,3,150,174,133,18,206,-224,137,140,33,124,216,129,99,26,169,80,148,149,235,0,206,34,107,64,145,-30,247,79,1,188,2,240,236,13,216,125,188,132,80,48,44,115,85,43,208,-8,32,99,243,101,227,17,165,217,245,172,76,87,85,206,138,147,45,135,192,-137,218,183,242,82,120,145,192,75,253,133,91,74,100,137,113,180,160,228,205,-72,253,78,5,200,172,156,57,48,60,23,72,11,142,94,17,71,192,10,16,-83,140,221,3,255,14,165,128,176,91,140,52,10,138,195,74,61,207,74,90,-208,184,36,93,136,60,77,79,184,229,160,112,227,255,77,179,29,213,166,21,-129,71,124,65,249,138,176,235,33,204,25,179,191,190,24,166,41,179,61,116,-250,151,207,11,156,41,133,14,160,223,53,61,159,87,68,87,87,92,251,163,-216,124,191,142,129,163,241,23,178,254,117,55,39,117,211,145,255,109,125,137,-249,57,27,177,24,228,36,25,166,133,104,112,189,77,77,122,210,11,22,230,-119,3,28,218,181,41,235,75,223,239,53,54,26,18,242,25,27,243,149,178,-248,200,145,212,197,149,234,158,217,22,23,50,3,121,213,48,91,110,182,168,-199,93,155,130,11,22,220,208,252,63,66,179,200,146,117,119,1,110,107,150,-135,32,214,215,5,47,34,110,170,219,157,231,149,141,6,57,103,38,64,65,-36,98,4,231,26,15,116,57,179,51,212,68,51,214,139,75,60,13,205,237,-56,178,181,208,228,122,221,233,160,169,99,2,222,129,115,97,170,67,125,78,-194,175,148,253,159,46,118,172,131,228,116,42,43,55,22,77,1,165,176,121,-170,51,24,139,239,185,106,123,151,55,249,200,220,138,180,67,239,71,190,30,-45,128,35,29,31,95,25,95,105,194,210,71,234,141,13,25,82,28,228,63,-132,251,148,137,78,74,180,57,82,208,185,166,118,135,108,197,192,154,95,71,-46,188,204,68,22,31,250,196,215,44,71,218,31,151,164,37,51,239,166,9,-104,6,229,83,227,186,139,206,51,6,225,23,166,87,232,110,24,120,142,88,-239,36,215,45,105,49,0,56,173,246,23,141,14,158,148,222,190,17,128,124,-49,126,213,152,42,29,169,0,96,80,161,117,237,136,100,122,31,233,27,101,-208,22,97,173,223,57,106,246,14,210,55,41,73,36,14,195,80,148,198,50,-75,4,111,154,235,4,182,11,62,23,81,25,117,244,71,157,43,166,61,135,-203,135,3,36,129,48,157,158,179,220,95,60,72,175,222,123,75,239,13,100,-29,226,137,131,228,17,23,140,94,240,199,121,115,221,149,87,253,199,35,20,-85,94,58,190,97,208,220,133,28,139,176,137,172,214,241,1,250,215,86,107,-96,204,19,116,189,193,221,8,120,11,119,3,90,38,195,47,187,114,101,229,-196,237,93,148,68,46,231,111,59,74,172,213,180,174,138,59,51,142,9,28,-145,172,210,156,193,242,175,93,205,160,41,1,145,89,11,165,192,134,175,49,-78,108,5,93,21,254,10,67,92,175,97,132,103,215,115,194,241,224,210,159,-30,204,120,253,97,201,89,173,230,83,134,121,4,128,10,232,161,85,193,113,-163,119,143,168,144,185,242,36,150,253,170,11,3,232,247,169,97,54,69,218,-25,200,56,124,134,232,236,120,221,79,19,244,247,245,233,137,232,228,61,214,-32,244,131,127,121,201,222,236,218,104,211,125,208,108,172,144,123,162,217,180,-189,71,59,225,204,79,96,115,164,163,226,238,235,234,162,101,230,94,191,15,-248,46,211,124,68,5,70,196,24,65,79,235,49,30,223,144,9,19,245,215,-0,75,87,237,174,18,28,56,213,141,41,64,113,12,207,115,241,233,41,125,-25,209,223,42,165,247,95,254,81,255,105,191,203,210,20,194,90,238,82,224,-109,49,132,127,49,230,41,231,150,165,219,149,90,112,128,97,135,30,74,91,-124,234,48,249,79,30,169,237,159,67,239,241,90,89,30,224,47,143,94,97,-111,115,15,45,182,212,67,100,202,239,90,254,129,18,125,209,74,156,158,199,-252,138,254,94,89,68,29,126,223,2,123,232,77,71,30,153,134,251,13,31,-233,88,70,197,15,89,226,153,103,191,84,250,57,132,227,127,105,125,71,199,-115,121,34,41,156,57,174,122,57,80,51,15,52,92,78,168,242,98,187,141,-131,1,184,215,155,83,202,169,162,137,6,154,125,125,77,243,206,43,240,199,-37,212,209,56,158,114,55,40,209,203,218,39,3,30,70,180,53,237,96,76,-208,244,115,58,110,30,154,86,171,118,173,186,137,146,11,157,119,125,239,72,-79,193,99,229,4,190,77,28,26,204,136,172,34,241,36,38,35,2,135,135,-88,38,164,122,190,94,203,154,147,71,229,15,244,74,170,119,59,253,89,205,-31,155,100,59,195,143,142,246,80,93,183,202,241,124,10,215,198,94,154,25,-214,128,130,194,3,49,241,40,210,67,17,112,84,198,8,144,178,29,121,212,-145,129,47,4,75,47,190,60,79,116,208,222,208,116,175,208,100,172,21,229,-142,156,100,233,1,242,155,127,159,180,217,64,223,243,27,11,182,137,113,186,-253,50,183,216,52,253,138,70,253,165,207,57,54,94,153,184,191,162,162,199,-97,170,216,204,145,253,103,14,132,52,171,242,250,19,151,26,155,31,214,190,-82,190,21,124,123,137,194,169,158,137,5,233,99,96,121,145,1,91,10,102,-198,171,179,228,167,102,35,141,47,61,20,60,66,191,159,94,208,7,168,36,-228,247,230,104,124,237,179,176,239,3,91,102,60,211,144,64,218,102,119,7,-127,166,108,190,150,161,33,161,82,132,153,212,236,110,229,161,213,32,191,224,-171,48,49,106,151,221,217,86,236,129,213,232,108,84,68,11,55,208,8,193,-107,158,150,36,202,114,121,166,24,224,251,236,55,142,90,99,190,93,250,81,-148,225,67,105,26,160,220,36,247,141,201,121,109,53,142,153,225,44,150,97,-50,79,19,54,171,65,191,61,3,175,149,194,23,114,14,125,127,40,245,255,-171,88,116,79,170,65,183,180,119,239,213,122,117,51,44,177,143,145,177,123,-82,129,120,100,126,237,138,25,70,237,22,6,187,107,239,104,186,71,17,234,-196,218,143,77,110,247,91,207,142,61,97,86,45,73,158,10,36,117,146,62,-239,167,8,240,20,48,137,107,94,52,169,199,149,175,209,241,223,198,103,16,-59,172,177,33,174,174,45,71,25,105,236,138,234,21,52,192,159,51,37,154,-208,166,142,100,77,132,206,197,229,103,166,16,84,127,148,16,36,51,102,193,-223,65,51,172,233,61,136,5,184,18,17,209,167,196,189,0,119,77,228,242,-72,137,82,174,121,211,234,148,241,243,6,137,133,68,214,69,145,137,215,186,-53,140,247,239,100,66,202,58,24,36,92,129,189,156,187,44,42,39,198,200,-184,212,219,93,44,154,243,145,110,190,157,66,123,86,197,133,85,18,229,182,-150,171,90,224,252,91,98,225,58,30,221,184,248,91,77,204,82,13,203,219,-246,168,164,220,24,11,140,167,168,52,1,171,218,204,184,41,93,186,78,95,-183,49,181,237,66,21,171,186,147,198,107,184,125,27,243,106,204,186,120,23,-133,162,239,217,137,142,140,41,220,34,67,189,25,249,169,170,71,184,38,149,-143,191,191,111,162,141,66,32,201,145,220,218,220,88,74,97,166,130,12,242,-85,82,56,225,11,93,249,242,122,39,131,122,159,37,102,113,133,57,95,86,-112,236,160,77,43,115,249,125,160,128,244,184,188,126,83,130,235,35,194,46,-250,81,61,207,187,31,204,110,73,206,76,150,73,149,46,70,197,138,128,212,-7,217,159,34,79,118,10,130,74,114,134,145,54,1,20,96,154,188,136,157,-212,23,237,53,123,6,153,235,50,84,185,114,109,93,216,51,4,168,244,241,-75,3,167,118,19,61,179,6,108,190,89,253,231,31,217,6,168,109,168,66,-106,95,224,58,205,206,48,111,99,150,103,247,129,40,13,99,190,60,75,16,-157,221,109,102,33,100,51,31,17,9,253,49,168,38,245,153,51,144,232,189,-149,39,72,118,28,145,161,213,219,173,90,0,67,131,248,159,231,14,186,236,-174,209,17,69,2,125,240,1,78,2,100,78,163,232,140,104,112,234,88,15,-249,119,119,240,96,207,128,133,89,43,14,197,121,163,140,193,156,140,232,153,-32,121,127,123,3,244,179,38,206,9,144,245,47,219,106,75,127,223,101,31,-235,236,57,122,139,210,7,60,159,7,90,202,108,48,16,127,125,82,151,93,-95,82,197,88,35,172,46,251,107,247,152,99,213,147,171,153,47,144,223,145,-147,186,192,166,122,226,39,50,130,47,50,26,117,175,18,163,207,25,93,229,-92,186,179,75,224,209,218,39,49,189,178,221,60,17,185,30,62,38,14,1,-151,113,177,69,147,189,75,81,86,144,239,64,57,185,179,7,177,143,254,96,-174,129,110,33,96,84,22,9,72,224,207,64,184,142,194,56,219,139,192,64,-42,117,121,184,205,156,8,153,145,2,81,107,112,67,160,4,233,26,194,4,-168,200,200,29,107,60,213,150,220,80,248,224,54,205,142,58,85,80,23,172,-45,240,228,79,175,163,82,140,169,119,177,130,67,8,84,145,66,207,49,6,-27,245,133,121,138,237,245,75,123,245,85,245,185,45,0,233,255,51,43,221,-217,53,46,13,225,246,221,215,235,8,101,163,119,29,246,219,129,117,43,58,-246,62,144,156,236,121,127,3,140,11,225,239,254,216,116,5,143,0,232,97,-23,162,47,211,14,69,227,162,14,244,206,19,186,255,128,105,228,242,38,239,-113,192,145,241,235,15,22,245,49,59,32,243,203,167,55,23,237,239,233,171,-233,23,233,168,87,203,118,205,255,140,161,21,192,82,35,187,214,39,230,132,-98,189,208,35,37,172,62,168,79,212,218,49,138,67,148,214,129,170,154,195,-70,119,59,238,170,115,248,55,151,219,30,29,170,101,82,192,246,63,91,106,-121,11,48,170,77,148,193,57,107,194,157,120,250,98,172,127,38,189,168,249,-74,159,166,154,83,247,114,159,1,8,51,240,194,175,126,67,138,9,49,224,-193,74,226,148,39,78,148,225,95,29,39,136,141,83,186,35,117,40,230,255,-210,95,101,137,218,171,49,190,189,198,193,120,180,49,153,27,131,99,11,46,-209,149,108,226,223,228,99,192,152,161,128,148,222,106,225,204,143,78,33,133,-4,80,145,204,203,4,114,255,224,176,41,210,182,213,167,80,148,42,7,180,-169,17,107,133,143,103,152,47,46,187,83,103,226,22,180,214,131,234,202,74,-102,67,22,0,235,238,212,120,248,119,29,27,78,22,33,171,253,82,193,7,-213,183,157,19,139,187,131,68,4,59,66,207,63,99,141,70,192,210,12,103,-127,119,36,136,225,248,131,192,45,254,198,194,72,23,109,175,114,51,95,70,-16,185,230,98,50,25,92,73,159,156,103,205,73,38,51,177,57,123,123,127,-3,77,113,9,197,114,111,242,152,110,92,1,218,192,69,193,49,177,27,135,-122,248,252,190,147,208,86,40,120,127,104,211,161,163,61,77,71,50,235,183,-87,245,8,141,106,152,51,152,52,82,206,204,108,33,67,36,181,102,218,240,-94,231,163,149,38,78,228,145,184,52,40,139,110,158,229,23,184,106,254,179,-28,47,230,251,212,68,240,132,213,81,226,188,25,188,151,75,75,17,98,112,-184,108,206,217,9,240,148,67,52,172,175,61,23,237,68,102,224,242,110,234,-156,151,145,34,118,89,19,162,51,44,4,211,17,231,138,140,130,61,138,6,-133,40,211,16,189,114,177,181,162,184,6,181,113,166,99,197,104,197,202,192,-115,14,233,31,100,146,3,232,195,111,211,251,36,189,90,105,253,149,100,74,-28,244,174,1,235,222,21,0,59,204,139,153,46,33,73,155,255,234,168,66,-148,159,30,123,165,201,195,214,188,9,3,210,45,85,10,57,227,209,34,253,-135,65,239,50,59,254,231,34,126,58,89,170,0,187,242,146,79,184,146,115,-183,75,69,251,251,106,160,54,200,9,168,118,192,200,145,75,210,61,170,28,-246,19,184,220,23,22,137,249,179,65,234,180,248,214,207,88,176,33,3,225,-206,127,13,204,35,122,233,100,159,250,67,64,159,44,35,167,77,57,27,71,-65,93,117,8,23,222,56,198,152,25,110,96,82,25,208,38,55,80,95,99,-158,103,91,27,126,65,151,53,64,108,139,171,106,28,20,165,141,174,92,186,-95,184,145,185,6,146,227,25,87,50,14,49,210,217,97,23,227,115,232,147,-222,206,89,56,33,223,34,110,136,191,10,123,195,21,93,126,110,211,146,85,-253,139,254,0,228,110,55,44,206,146,26,13,144,163,240,249,83,75,212,123,-190,82,219,167,110,152,178,148,101,210,121,40,251,37,255,248,156,116,60,221,-230,124,121,155,204,179,225,187,147,36,97,49,2,199,96,80,248,92,192,134,-37,42,134,3,19,219,134,88,130,172,91,142,157,216,202,58,185,11,120,114,-165,173,105,7,248,130,156,134,138,187,157,204,254,136,185,89,61,76,187,192,-88,215,176,142,24,149,82,205,234,222,35,40,19,234,187,126,30,239,114,30,-208,121,194,54,86,23,159,19,2,189,93,186,55,172,121,138,144,197,16,116,-175,173,75,67,28,156,102,235,101,182,132,174,90,220,84,133,229,64,200,4,-177,112,9,140,131,6,214,122,94,163,151,0,228,57,187,125,46,28,111,117,-152,251,211,6,58,253,132,31,24,62,209,55,225,198,53,202,161,90,182,234,-146,108,115,75,27,155,118,38,12,154,41,170,170,62,85,207,180,59,176,143,-137,96,119,132,130,98,230,40,2,68,83,109,27,30,122,230,107,69,243,48,-164,184,101,81,83,203,16,158,230,69,130,161,180,59,156,210,140,168,146,183,-24,146,131,122,59,34,123,124,149,155,55,207,182,65,151,187,78,21,197,52,-101,32,249,49,185,138,127,34,120,222,38,138,245,145,121,206,15,20,219,90,-165,246,31,231,121,78,82,182,21,108,253,85,98,59,179,186,247,203,18,52,-191,50,66,198,105,196,46,197,20,44,241,48,212,163,85,77,222,234,197,226,-186,98,90,14,97,72,80,132,65,224,217,44,21,139,85,173,51,56,197,237,-13,50,47,207,32,172,248,176,111,77,215,4,197,32,168,198,192,39,117,226,-201,135,38,153,208,96,2,163,148,233,38,138,81,205,42,200,189,84,132,76,-142,204,142,146,95,70,174,121,116,180,34,116,244,200,5,55,190,43,46,5,-76,114,89,238,159,104,100,1,37,233,69,84,218,163,147,169,104,55,176,213,-89,162,95,148,233,202,216,180,206,103,106,49,108,26,63,149,138,27,159,87,-107,74,252,121,66,51,32,141,183,251,149,201,19,16,97,101,46,239,91,248,-253,21,218,250,190,180,188,139,172,66,33,233,30,104,230,60,79,167,187,108,-29,2,208,5,65,188,241,255,223,132,55,135,247,3,72,57,37,98,92,199,-97,135,30,56,167,166,148,165,2,71,107,131,123,242,6,252,100,141,102,127,-216,213,84,72,77,116,222,184,74,181,102,109,178,56,248,79,81,166,67,147,-56,1,62,44,213,154,52,57,70,179,103,254,76,131,16,234,56,237,40,196,-178,124,179,198,79,197,146,243,202,171,42,139,63,99,250,128,75,246,231,248,-204,168,27,23,147,214,125,242,198,185,33,86,54,42,105,203,33,172,3,196,-194,20,0,112,25,204,103,67,193,21,126,226,220,16,161,62,137,192,154,174,-51,21,84,179,167,104,21,98,21,150,183,90,141,106,134,131,88,138,55,199,-87,72,205,73,115,14,245,74,98,198,230,1,165,175,0,19,134,85,202,238,-200,3,24,26,73,237,253,78,73,159,210,178,12,28,158,103,126,24,67,100,-208,194,121,245,205,238,148,109,54,44,102,13,214,168,68,24,59,49,92,110,-165,28,103,169,200,134,173,101,46,21,108,19,172,152,193,191,106,37,132,19,-157,14,75,116,203,213,251,184,135,3,237,35,187,21,52,180,25,172,86,225,-230,181,203,42,233,243,68,38,98,108,102,27,191,243,67,50,125,205,240,168,-137,173,236,45,175,120,193,25,34,147,74,167,142,56,242,80,135,160,10,98,-18,3,178,228,203,54,29,86,91,151,16,17,19,68,48,226,22,71,150,29,-255,0,21,17,106,162,60,132,225,60,9,55,218,141,35,226,116,104,238,112,-127,250,116,173,27,189,37,42,58,41,239,125,99,86,102,79,97,75,226,222,-223,2,138,95,27,185,241,243,216,67,160,8,56,175,117,227,143,251,94,110,-52,230,242,255,211,98,161,240,67,3,249,182,215,5,241,244,247,13,116,19,-179,78,112,221,185,177,225,186,9,119,21,34,63,208,29,36,36,232,224,134,-67,226,101,35,126,232,109,220,180,7,111,181,195,249,50,120,111,227,120,228,-96,24,94,14,5,15,76,16,131,243,45,0,132,210,159,246,77,142,207,66,-58,214,230,189,183,75,64,232,148,100,47,22,233,247,29,227,181,245,24,162,-126,52,119,159,102,60,111,244,214,63,72,147,63,49,178,97,243,155,129,119,-62,128,12,147,99,58,246,211,89,7,69,184,102,180,250,85,202,153,37,111,-6,210,233,137,95,116,172,86,117,104,137,191,2,151,103,187,84,102,0,47,-61,203,34,124,31,107,122,55,158,117,121,124,95,36,21,29,44,195,31,124,-74,120,252,79,136,204,211,248,75,26,87,103,100,65,156,110,8,182,54,82,-34,49,34,32,252,202,117,91,40,67,175,15,163,121,34,183,108,142,162,129,-6,189,252,215,39,208,38,36,206,247,173,194,59,26,204,100,20,73,53,30,-164,143,208,254,141,250,165,94,101,156,182,135,104,63,213,80,136,64,37,91,-205,161,232,104,75,98,3,114,96,25,208,44,40,189,32,52,89,177,232,130,-104,248,61,2,190,116,136,140,196,255,90,95,76,73,75,11,148,208,228,133,-77,19,35,180,0,138,12,178,12,52,97,202,187,11,184,198,83,53,246,1,-124,59,224,130,203,19,17,180,166,213,70,78,246,236,216,19,167,96,226,21,-221,186,140,84,41,227,168,107,252,67,156,106,131,212,189,5,214,217,215,234,-108,188,13,32,144,145,217,72,231,150,22,22,65,169,245,75,251,119,105,111,-174,132,183,103,243,247,24,83,116,107,230,185,44,176,50,61,60,14,13,57,-82,47,22,215,9,250,114,5,229,162,171,170,237,241,39,196,92,81,28,145,-28,227,242,43,142,38,2,82,192,204,242,67,51,128,86,17,54,119,232,142,-90,78,188,17,159,235,197,240,46,174,240,130,112,247,103,217,113,51,100,45,-213,67,182,105,120,22,156,17,55,172,230,124,252,1,212,110,74,87,120,106,-59,153,188,160,253,209,69,78,190,30,20,218,26,76,73,227,65,204,192,197,-172,191,6,216,16,87,173,171,74,131,75,79,88,58,171,2,80,248,15,192,-245,186,198,27,253,20,91,44,64,70,14,109,196,35,3,246,130,226,138,70,-83,218,68,244,253,166,190,223,136,177,222,42,105,102,174,42,232,87,21,157,-207,200,105,26,157,227,63,73,254,222,32,236,20,14,21,222,37,139,244,89,-50,94,203,248,121,92,13,233,187,199,149,68,69,228,19,89,174,41,60,33,-197,189,251,112,223,230,87,96,137,52,124,225,197,126,170,215,201,100,22,64,-58,132,157,255,176,204,173,22,170,210,25,10,109,59,53,63,171,249,85,34,-53,52,202,213,48,27,82,88,70,153,210,186,153,70,187,196,113,79,86,36,-34,150,217,254,30,11,138,186,162,226,135,205,121,128,249,96,144,147,198,224,-92,254,236,214,82,133,61,215,45,42,204,174,153,157,183,155,251,116,62,144,-104,99,243,31,29,115,111,21,66,220,238,23,245,103,229,175,217,209,103,166,-220,77,11,112,254,77,34,241,55,143,127,223,40,20,230,47,24,241,108,78,-130,234,239,77,90,45,122,156,182,180,60,134,85,31,137,208,202,152,68,236,-35,84,26,67,2,235,58,237,132,70,193,231,5,229,130,100,213,18,44,137,-106,102,216,81,136,18,185,246,85,253,190,226,90,49,65,40,206,176,92,82,-174,221,13,238,11,210,39,82,234,245,190,68,7,254,171,227,141,23,145,52,-168,68,252,50,196,160,199,31,49,146,109,69,99,97,118,243,111,122,90,158,-106,144,61,102,198,7,186,80,220,181,177,125,74,191,70,209,26,81,39,231,-149,69,204,6,182,198,5,91,45,57,103,16,86,224,67,78,142,84,189,238,-96,229,247,159,178,86,180,121,123,220,240,217,173,130,181,48,62,19,45,73,-9,244,41,98,117,3,155,249,241,250,210,226,57,155,40,81,24,171,36,47,-110,226,153,77,14,17,176,131,226,215,58,34,183,77,88,91,140,107,116,165,-150,190,248,28,236,28,141,186,25,92,48,88,120,130,160,108,162,115,132,170,-243,45,226,109,153,111,67,65,27,253,240,187,160,76,17,141,219,125,177,14,-2,100,151,80,140,155,11,105,165,103,10,17,54,219,91,171,95,69,54,89,-235,210,184,161,210,34,150,207,196,206,104,1,34,198,128,10,174,112,120,88,-161,136,169,207,12,140,39,102,114,225,11,54,35,66,103,222,111,113,86,241,-44,232,60,212,125,228,160,96,4,172,37,205,67,159,229,186,132,43,19,218,-243,251,24,147,234,249,3,230,131,217,55,134,224,240,211,58,114,210,72,9,-143,189,218,114,200,95,147,31,250,175,167,21,60,186,39,247,89,3,69,225,-233,247,126,173,199,142,130,182,245,30,211,78,46,76,28,207,180,252,0,57,-170,95,255,244,195,141,250,208,142,89,144,159,127,53,120,106,231,13,181,58,-80,2,101,199,162,48,188,248,42,62,88,221,255,238,183,152,18,183,86,78,-124,24,181,237,176,61,187,74,12,69,35,167,131,197,98,49,183,78,210,211,-82,12,193,94,156,39,255,78,254,43,249,65,158,96,158,81,85,222,209,209,-77,141,218,162,245,41,188,0,156,211,245,48,231,5,233,163,96,157,238,151,-40,9,184,133,76,8,4,1,40,110,231,208,97,115,170,200,92,238,10,57,-72,197,42,39,10,214,163,126,76,122,149,88,105,89,213,106,10,29,94,241,-11,95,131,247,129,185,136,8,121,170,25,225,21,84,92,53,100,47,206,155,-159,232,175,224,25,92,203,172,99,199,195,59,65,22,94,92,161,246,232,255,-176,122,122,164,242,84,99,73,201,43,81,204,17,153,196,94,180,220,218,190,-200,114,252,202,128,143,234,121,93,165,84,86,51,64,241,155,78,21,82,199,-212,129,3,64,233,117,203,32,108,230,161,176,5,192,108,100,182,23,227,48,-210,211,224,90,132,67,138,207,107,48,175,148,53,151,99,113,86,198,3,166,-151,112,119,217,134,42,222,8,138,75,103,222,51,186,14,223,207,195,62,180,-118,39,242,49,86,75,245,117,31,249,166,246,117,36,97,145,234,104,40,89,-184,33,38,173,155,220,164,97,106,69,65,225,81,226,185,51,140,8,16,65,-55,4,246,137,124,8,154,127,215,56,249,215,232,20,168,133,183,181,14,147,-42,111,78,243,46,123,121,178,145,72,2,204,130,47,190,132,144,159,254,80,-40,157,141,138,30,22,193,110,225,48,244,201,242,143,107,251,75,171,85,163,-192,31,84,211,6,161,10,64,162,201,3,71,206,27,172,91,174,217,203,20,-72,40,231,30,172,55,80,166,218,80,148,69,137,219,26,185,109,95,168,97,-70,16,109,144,154,228,190,248,245,134,243,113,116,190,33,87,79,237,23,172,-11,168,58,84,80,29,239,221,108,84,56,221,156,72,199,101,66,26,204,136,-208,1,223,103,169,254,130,46,183,28,89,4,97,113,58,94,107,80,218,218,-238,44,125,53,168,253,113,165,114,44,183,98,40,214,200,71,151,250,118,183,-34,120,126,66,230,140,238,200,220,121,139,32,171,186,14,222,216,96,226,29,-51,113,222,121,66,83,151,66,149,152,145,74,97,192,161,45,5,140,141,227,-3,162,147,1,40,39,161,110,60,4,90,45,228,102,128,89,151,2,114,12,-68,197,38,112,131,81,189,179,76,136,1,51,1,4,30,29,95,248,146,10,-166,171,60,2,41,251,152,147,89,162,139,149,192,138,115,6,56,58,186,171,-96,95,230,226,144,215,3,71,179,56,104,184,173,112,70,171,49,176,82,163,-209,60,133,22,93,145,219,170,66,177,191,3,49,220,150,71,223,83,45,204,-158,3,236,92,209,159,12,151,147,95,133,8,239,56,153,222,28,199,140,43,-122,88,149,225,121,50,212,121,165,134,103,95,233,164,151,26,254,128,221,73,-144,220,143,207,43,42,90,227,20,155,194,208,89,19,123,90,101,6,241,36,-118,32,215,241,41,144,4,64,216,235,222,107,210,115,43,66,191,4,158,151,-132,212,198,252,130,200,2,144,186,7,134,174,239,232,135,138,94,4,48,206,-104,41,127,123,47,101,23,29,140,42,226,28,65,139,206,46,176,195,149,87,-39,75,133,92,166,0,132,25,64,117,114,65,241,29,59,200,8,150,176,150,-68,134,88,121,63,65,183,8,29,231,242,206,229,201,22,32,243,58,126,90,-64,221,15,254,212,239,73,51,87,3,152,133,50,165,132,129,197,177,167,168,-25,64,25,174,69,253,243,201,177,166,241,181,129,173,38,77,250,183,81,213,-112,150,200,75,127,132,236,209,16,219,30,142,18,193,234,221,178,165,208,191,-37,137,235,246,42,164,164,179,179,40,74,233,13,33,37,144,206,124,173,125,-188,173,96,19,127,213,157,22,222,41,110,191,179,25,207,192,243,219,221,16,-197,241,238,245,159,38,147,240,250,155,41,140,3,189,252,45,155,11,191,95,-213,207,215,191,41,52,126,187,170,208,236,178,175,77,205,36,89,251,252,31,-123,88,62,73,224,42,196,177,193,160,64,142,43,153,211,255,221,215,75,133,-109,210,87,211,161,232,55,132,185,176,167,215,200,56,237,39,133,3,243,148,-213,125,89,123,192,91,74,7,237,208,10,241,255,244,78,123,58,176,85,242,-176,95,244,6,36,94,144,101,132,109,153,247,247,35,69,114,77,196,54,73,-213,146,170,224,104,217,31,61,176,215,149,159,139,218,149,127,182,120,225,48,-127,218,231,215,77,124,46,203,66,106,9,139,60,65,206,187,114,216,255,179,-221,68,107,73,42,222,162,115,198,78,132,214,102,116,52,166,129,228,22,174,-94,204,53,246,241,35,155,178,213,64,51,252,89,246,16,226,224,177,106,124,-102,16,199,27,216,239,129,11,209,101,126,183,162,52,130,35,218,48,250,57,-41,193,167,221,133,215,121,250,94,97,123,241,7,214,12,186,67,39,40,221,-1,208,20,52,246,113,227,211,123,130,19,40,178,98,139,96,45,120,71,240,-51,161,247,88,62,111,94,163,223,196,189,153,19,173,46,42,49,30,190,159,-51,137,156,34,75,123,99,108,24,188,176,148,183,116,229,125,201,20,75,7,-172,129,27,203,70,41,137,166,7,149,90,234,84,5,152,199,128,106,65,205,-59,35,109,163,144,39,8,25,140,128,139,144,7,18,251,124,13,24,29,203,-31,167,5,149,180,195,125,178,41,37,133,17,43,190,25,101,148,182,121,114,-87,96,227,73,145,54,36,92,154,19,83,121,144,65,12,39,231,135,147,101,-206,124,220,193,212,21,149,171,110,176,252,28,4,56,55,182,13,215,109,124,-242,204,207,210,29,207,238,45,72,203,36,239,149,255,230,223,54,190,102,204,-93,23,250,79,9,150,236,120,111,33,98,217,120,118,215,80,55,171,202,155,-38,236,223,134,33,224,119,139,161,42,200,90,83,216,79,98,168,174,120,88,-4,169,251,3,122,198,65,66,150,115,35,131,120,36,105,248,171,103,115,184,-169,173,251,112,36,220,233,253,122,106,122,74,13,95,75,97,21,12,170,131,-163,118,127,187,136,67,10,142,1,179,197,33,183,56,215,72,231,101,227,16,-148,86,21,52,87,178,115,201,81,113,131,135,250,202,63,225,25,64,192,60,-88,123,94,109,89,110,7,242,241,209,30,36,244,92,29,96,169,220,5,134,-249,109,165,162,154,149,124,85,106,151,186,245,142,228,238,102,110,59,49,84,-161,139,172,78,7,91,9,234,184,231,227,82,101,90,203,253,114,135,153,61,-128,98,5,96,211,7,127,127,108,22,50,64,57,51,144,61,200,92,39,160,-177,37,60,213,108,170,221,226,90,70,7,35,9,88,116,167,230,40,88,196,-89,127,184,1,89,174,182,33,98,144,246,16,24,215,195,131,22,13,116,127,-77,113,141,100,162,111,200,29,19,13,77,66,104,252,123,213,39,15,175,75,-53,148,243,137,203,209,186,127,215,168,248,181,219,44,118,103,95,211,158,205,-35,149,189,36,239,86,248,47,46,105,173,97,243,64,135,253,89,131,21,38,-28,15,252,182,142,86,188,133,100,78,71,206,161,126,208,104,105,149,221,122,-159,84,211,238,251,216,180,103,235,33,200,62,76,141,61,53,94,111,148,29,-22,73,186,185,52,181,45,150,118,94,33,72,243,60,251,92,12,145,198,113,-185,57,188,254,173,30,64,194,206,214,89,155,184,217,198,17,148,28,22,36,-97,84,9,101,26,19,5,166,70,73,158,197,230,106,154,252,217,255,121,214,-76,132,53,83,76,110,40,70,214,242,106,234,72,194,164,61,126,159,65,76,-36,156,21,64,211,38,252,11,122,97,168,209,128,195,161,233,212,228,228,234,-240,230,214,178,102,129,163,77,136,114,9,100,86,131,114,26,254,61,230,11,-24,205,40,110,171,137,97,32,186,202,152,253,142,100,154,160,35,80,4,204,-87,35,4,65,85,246,182,58,34,235,53,85,115,98,248,72,3,49,130,44,-145,255,183,97,247,117,164,168,197,133,116,99,65,241,139,167,145,153,54,34,-23,0,23,168,45,10,155,156,66,246,96,153,42,17,25,153,195,105,194,29,-91,61,68,253,89,173,94,210,244,162,50,71,5,184,137,80,17,78,45,217,-15,197,27,125,0,129,231,45,243,158,6,15,233,15,20,30,57,32,88,83,-51,153,147,253,199,152,98,40,6,241,210,145,42,49,58,12,10,71,198,4,-0,2,219,242,249,36,45,53,132,219,48,227,220,56,102,124,62,125,11,76,-0,177,186,167,11,247,106,71,127,65,82,114,11,115,14,139,110,39,78,252,-80,236,179,4,42,62,176,246,23,71,181,59,231,255,246,153,152,61,110,64,-102,72,81,173,83,116,49,18,64,46,252,153,205,142,182,72,231,188,245,11,-156,103,175,55,235,78,83,23,57,74,208,207,85,171,31,199,241,137,20,173,-158,192,27,138,99,50,44,116,21,199,5,163,210,123,154,12,11,119,251,250,-209,84,29,187,162,198,114,147,102,19,208,26,228,119,234,35,135,141,130,77,-211,22,223,133,59,141,19,19,76,22,185,107,200,158,0,147,155,105,240,150,-208,133,133,193,177,75,212,248,166,253,105,212,127,25,221,161,242,111,227,169,-113,183,30,52,33,142,85,137,234,30,144,230,148,41,101,223,184,205,237,3,-69,100,53,5,175,43,244,26,200,220,30,219,182,225,169,17,140,53,241,47,-226,221,104,80,62,1,13,104,0,191,140,176,243,72,34,232,204,72,81,18,-3,56,80,83,192,139,248,34,29,210,119,218,80,212,1,27,191,134,93,8,-94,3,148,130,2,107,65,3,81,106,81,249,74,181,132,33,48,101,175,141,-145,208,74,134,217,30,130,200,214,255,169,233,39,127,205,217,12,152,89,121,-111,108,176,61,171,14,9,130,124,84,231,119,58,3,233,241,119,3,51,237,-124,252,235,116,183,147,169,40,216,188,248,37,75,21,48,169,201,185,66,14,-82,17,73,163,27,159,185,96,238,25,22,114,153,38,223,174,160,32,12,174,-230,249,46,91,154,10,221,78,145,141,230,235,70,233,251,210,36,233,92,255,-61,218,45,134,218,130,21,37,152,60,189,144,127,25,42,242,241,54,182,103,-45,72,207,210,17,101,16,239,144,32,11,93,244,137,169,239,41,84,12,47,-252,196,132,243,112,171,95,254,191,158,11,139,165,147,56,218,67,234,82,38,-249,117,1,78,190,56,84,149,216,2,46,240,91,85,83,107,122,252,67,141,-76,24,165,190,189,228,111,224,195,55,156,57,160,36,55,237,78,169,18,76,-190,218,168,193,166,114,153,213,113,123,146,156,88,142,26,115,81,107,97,31,-155,206,0,163,60,253,85,159,184,0,157,208,207,239,4,209,122,41,54,185,-196,87,175,188,174,204,198,31,151,60,136,162,196,86,116,68,211,133,20,137,-213,172,39,39,63,185,232,177,151,109,92,193,159,142,116,121,243,185,61,67,-68,78,172,117,135,25,66,158,251,187,141,195,98,114,165,238,104,175,241,77,-46,222,35,124,142,188,30,14,44,84,50,132,170,203,142,208,132,110,125,90,-42,170,68,158,196,78,92,103,73,32,206,175,180,60,115,250,220,202,162,171,-239,235,205,227,251,214,81,242,204,41,121,179,177,74,24,170,232,237,20,235,-70,15,9,137,246,36,193,247,84,173,47,100,89,101,40,174,66,242,124,64,-128,165,129,120,168,233,90,138,163,48,100,135,78,105,163,104,151,86,68,87,-151,39,104,125,228,96,138,187,111,26,244,47,9,66,67,48,167,0,167,26,-125,19,21,21,12,236,174,235,210,23,220,29,173,210,9,72,36,70,56,117,-185,32,37,48,193,246,179,214,42,95,101,62,43,29,254,232,21,238,186,52,-192,201,173,135,245,106,18,119,119,179,69,201,252,57,201,254,86,35,209,32,-89,185,166,217,189,248,70,195,17,111,253,95,119,165,125,146,199,59,127,116,-63,74,219,132,162,243,247,231,192,113,166,242,197,170,237,188,87,99,20,232,-127,141,82,87,0,6,39,240,115,8,72,98,119,122,172,249,115,172,19,221,-65,55,224,131,1,4,185,142,50,111,42,27,224,187,83,84,234,148,230,161,-81,222,145,134,69,126,238,86,9,63,153,225,32,221,246,128,44,203,92,133,-71,138,19,36,211,11,193,128,94,140,105,75,87,232,172,17,165,49,198,145,-255,31,92,136,217,174,5,14,226,66,36,175,139,165,140,148,128,68,185,161,-147,227,17,250,11,169,139,194,205,178,130,2,98,192,160,137,121,125,249,36,-77,142,159,54,70,224,55,47,131,240,97,90,237,41,138,60,45,163,236,162,-236,183,3,42,220,143,82,99,220,76,239,166,63,106,115,111,196,62,205,154,-214,181,85,246,225,54,220,187,137,30,31,52,138,91,214,181,228,157,123,236,-129,157,122,104,18,122,139,38,14,194,29,46,210,74,147,68,112,144,50,140,-76,115,218,58,106,210,154,2,16,93,211,252,51,160,53,196,233,5,62,50,-152,157,134,192,190,215,38,18,95,5,184,207,100,189,174,101,13,211,41,207,-127,251,172,198,3,146,206,68,190,237,152,234,94,154,82,157,154,145,17,91,-53,100,58,89,84,116,209,43,233,251,89,80,244,125,139,129,166,62,179,105,-123,138,29,205,21,17,103,108,9,205,184,8,196,175,190,78,48,168,82,1,-59,168,5,53,125,156,123,16,63,162,35,93,88,97,56,191,145,75,92,145,-209,35,191,89,90,174,34,138,26,13,129,254,177,170,70,170,140,49,200,79,-13,200,85,138,138,60,186,106,210,81,133,48,190,227,89,237,158,133,213,226,-41,97,175,137,229,146,182,69,219,193,17,118,175,161,207,66,231,94,97,0,-146,15,155,249,132,134,143,122,50,181,210,180,247,129,29,75,9,128,58,108,-57,82,151,37,204,11,96,80,246,206,212,172,211,134,177,168,239,167,226,11,-27,171,168,73,20,231,126,65,7,169,39,183,145,162,114,28,145,111,190,74,-232,66,241,9,204,164,131,70,106,254,249,102,101,102,186,89,189,255,88,69,-114,19,82,166,168,149,146,65,119,217,66,192,119,163,36,44,185,64,95,197,-169,86,96,36,7,35,155,224,194,232,181,142,229,149,180,95,70,200,157,153,-172,250,130,109,52,140,160,176,146,18,74,175,137,194,18,175,202,47,155,250,-124,187,8,69,2,255,230,146,122,31,61,228,209,195,199,121,87,20,37,68,-162,71,124,236,167,91,230,32,117,252,82,136,224,229,11,98,92,16,101,42,-71,37,64,185,217,120,131,93,46,186,223,198,157,207,188,145,243,10,115,204,-76,194,28,218,51,232,15,54,128,188,36,243,195,87,56,86,11,163,101,253,-49,136,42,138,183,199,47,163,252,52,30,153,18,218,182,83,80,47,195,44,-152,219,170,40,168,206,243,168,94,78,88,127,228,125,250,215,185,166,74,11,-18,196,115,33,44,165,49,169,27,204,155,188,191,247,205,20,248,99,35,12,-44,157,7,209,170,239,237,146,155,86,86,6,250,95,175,118,223,161,59,195,-7,217,251,170,68,27,31,129,233,159,13,85,255,135,242,238,238,128,32,130,-245,166,221,74,85,135,204,253,137,145,156,139,200,211,96,116,211,125,44,13,-128,185,103,230,133,143,89,198,132,96,119,49,201,43,173,66,252,125,12,46,-0,145,224,196,196,89,0,93,242,65,113,9,53,235,191,225,127,154,225,57,-143,233,22,73,57,251,185,192,197,243,222,86,196,32,70,17,230,22,162,71,-160,215,55,43,22,242,43,233,88,176,212,193,44,33,153,249,30,126,128,1,-1,171,87,159,176,54,139,227,126,154,140,163,19,41,133,95,50,211,76,213,-234,247,214,235,10,87,152,93,72,142,147,15,235,236,97,137,85,129,212,201,-43,34,100,210,244,96,213,114,48,174,112,250,11,190,98,164,67,245,129,199,-94,218,131,167,27,232,51,53,106,107,35,119,99,210,96,223,47,55,156,198,-169,229,101,192,100,67,109,139,186,115,180,82,180,39,144,176,143,252,211,97,-182,27,20,138,51,216,187,214,101,179,217,207,66,158,71,144,162,73,90,47,-65,227,28,54,249,158,141,92,168,62,160,47,198,76,200,252,60,42,248,213,-174,154,78,104,42,177,171,135,86,81,63,18,231,242,54,67,3,84,242,220,-55,61,199,35,43,2,113,170,42,228,200,99,165,19,103,180,150,36,215,47,-175,168,251,80,42,127,209,167,219,30,175,15,147,39,22,165,60,213,231,109,-195,75,195,193,97,30,77,249,242,240,216,174,145,233,11,2,65,249,76,128,-222,16,247,186,221,7,34,65,15,254,214,96,26,112,33,93,115,164,95,128,-158,148,131,219,86,49,144,18,77,196,197,68,126,131,81,255,211,145,126,252,-212,253,157,101,214,68,145,190,247,64,236,160,33,203,210,75,85,197,89,27,-173,126,38,216,145,181,16,250,207,55,24,181,130,188,35,192,130,255,92,206,-62,54,199,9,175,69,18,114,52,140,219,248,91,157,223,32,197,78,98,2,-138,38,38,4,196,207,90,238,172,181,71,245,42,206,161,102,249,122,82,48,-167,243,196,124,145,146,85,112,91,162,25,201,108,74,101,29,59,87,146,98,-244,197,11,242,110,140,144,61,165,182,121,31,191,66,169,243,27,221,38,178,-139,173,43,182,146,134,43,79,23,167,13,177,121,157,46,237,44,105,39,141,-1,94,25,203,145,25,58,143,122,129,197,183,190,181,44,24,104,47,247,203,-182,212,134,75,245,143,245,124,115,126,96,201,230,98,72,226,102,192,113,37,-97,210,169,94,26,85,72,90,145,94,0,106,58,27,24,150,194,17,146,221,-220,24,103,57,17,180,184,131,175,218,128,18,189,104,62,30,233,132,42,191,-141,64,230,31,159,236,21,192,180,182,13,91,57,179,130,30,158,89,67,229,-53,53,181,206,128,140,100,69,193,28,118,254,155,96,166,57,150,223,219,72,-228,38,115,56,239,254,165,154,142,35,134,22,217,71,166,63,210,46,211,95,-42,68,18,213,204,116,85,100,43,44,49,177,185,223,233,164,186,216,20,37,-13,148,9,241,71,128,134,18,247,51,60,89,244,83,70,3,127,7,42,94,-244,32,27,185,248,84,82,9,202,210,133,183,86,211,17,253,166,112,79,91,-162,54,9,243,188,226,190,118,15,142,169,23,92,135,97,134,136,207,211,250,-250,24,91,206,134,1,169,58,122,196,70,46,217,123,213,147,112,84,54,39,-192,34,172,88,6,234,91,95,43,141,209,136,208,193,96,206,191,50,127,11,-128,63,28,100,50,17,245,9,20,7,44,201,128,115,131,75,110,180,196,179,-23,41,99,243,195,19,45,178,223,15,39,20,16,139,51,64,207,245,1,129,-202,140,225,255,44,197,211,119,125,145,140,94,145,217,153,114,138,157,249,76,-122,169,39,247,254,145,25,39,208,178,157,80,49,104,143,62,1,5,225,116,-151,253,180,206,146,251,206,228,4,30,190,60,77,88,170,200,63,112,205,242,-241,228,242,159,210,64,28,84,97,158,158,28,213,129,152,7,164,202,7,17,-200,104,191,147,44,57,38,175,121,251,155,84,240,157,173,39,95,112,218,248,-205,76,153,238,192,190,132,85,109,105,26,14,188,5,134,53,9,237,48,105,-98,230,3,63,220,60,251,45,124,99,245,166,56,4,33,88,159,221,216,178,-116,200,196,81,196,39,182,129,218,53,234,77,94,85,4,77,244,152,76,3,-201,134,98,37,58,233,40,183,84,106,218,208,54,128,72,161,76,247,15,150,-3,235,211,160,251,95,132,63,92,168,95,231,4,63,9,161,97,152,38,211,-49,190,70,33,249,104,24,151,151,176,150,206,71,114,207,226,135,156,72,36,-92,151,51,44,156,228,142,84,10,121,219,104,77,134,233,58,181,207,173,16,-105,54,7,76,9,12,21,75,63,199,12,21,135,123,144,255,241,248,58,231,-127,142,212,57,120,53,204,250,52,140,253,53,245,90,167,250,75,83,160,176,-221,26,71,154,92,138,140,78,186,188,185,18,228,173,115,132,81,192,164,150,-4,34,106,247,204,221,144,135,146,160,243,57,8,127,237,104,154,113,177,181,-46,100,84,250,237,133,155,206,181,88,140,31,101,233,231,45,154,67,84,88,-93,246,90,185,171,18,188,27,174,248,240,71,95,223,181,245,2,3,81,254,-37,39,80,151,95,159,114,64,115,186,223,45,175,251,88,13,182,113,10,225,-233,47,192,96,18,203,96,27,164,50,123,238,229,30,80,156,244,240,205,77,-50,37,12,100,222,44,50,92,227,229,97,99,251,225,36,191,125,245,253,229,-43,103,105,93,177,159,158,147,177,163,247,70,50,160,230,90,24,181,117,139,-61,136,45,186,206,74,55,208,159,181,60,1,136,54,113,89,10,182,29,111,-229,168,82,19,210,22,124,174,182,112,211,31,140,38,251,18,217,218,117,153,-133,139,244,33,25,41,194,18,194,232,104,159,55,141,177,153,45,70,108,80,-213,76,0,127,79,164,119,168,107,114,180,233,29,208,26,225,135,131,59,180,-175,204,228,23,6,73,25,84,57,252,243,250,142,21,60,234,246,205,189,112,-142,32,73,74,132,204,5,70,93,218,232,176,176,112,232,228,30,4,163,220,-46,158,36,186,227,70,145,120,63,103,176,156,26,11,177,239,188,172,245,86,-15,227,156,194,30,202,255,183,84,52,189,184,53,33,170,137,113,124,163,72,-36,219,244,197,154,156,86,177,83,168,166,90,54,194,224,230,65,100,33,171,-158,91,35,203,55,228,36,8,26,95,217,4,106,51,48,188,151,99,59,159,-184,223,234,159,231,86,109,94,159,114,18,153,21,95,105,107,129,168,220,116,-95,234,105,141,72,213,223,10,120,168,86,13,187,172,25,158,71,30,86,188,-0,189,63,21,99,73,35,53,121,225,59,152,97,88,211,243,219,141,122,230,-32,43,232,206,58,60,149,100,56,238,67,131,37,192,64,77,179,225,103,184,-158,147,111,238,5,10,194,93,163,81,120,131,13,181,128,246,29,153,43,26,-88,187,102,36,56,130,125,25,190,132,14,11,186,10,81,125,9,111,141,254,-113,140,143,147,128,66,144,89,153,53,30,33,181,146,182,122,54,180,165,242,-54,216,23,92,185,111,120,97,187,253,154,159,143,14,0,67,105,230,231,139,-204,139,7,41,206,59,84,96,9,39,114,163,137,134,127,153,171,81,217,193,-202,81,103,122,35,54,162,147,185,68,192,39,213,215,116,191,170,205,102,87,-189,128,163,9,228,69,16,32,114,139,233,22,147,238,229,210,231,141,231,132,-176,246,237,148,251,71,65,182,130,184,132,16,60,73,29,108,140,28,29,158,-5,52,203,37,192,6,223,50,133,189,149,43,77,162,130,153,26,177,191,51,-158,226,173,222,50,170,200,88,195,192,101,103,50,157,72,70,138,247,68,138,-146,13,54,141,132,204,174,243,248,239,29,142,105,51,204,171,81,127,97,83,-92,42,149,242,245,245,219,19,128,71,44,62,250,54,142,152,1,227,89,248,-65,13,191,106,134,28,247,85,38,220,219,74,126,211,43,194,253,196,187,195,-125,27,181,101,23,122,194,252,113,173,181,249,198,236,165,75,151,24,85,90,-204,15,161,212,220,16,23,231,64,25,78,113,156,69,130,206,3,148,179,234,-234,230,97,165,116,201,128,230,35,29,184,85,96,54,202,250,134,254,169,132,-8,14,201,149,117,33,232,242,196,218,98,195,128,191,244,183,118,7,109,213,-64,187,52,246,180,30,39,4,30,128,29,98,121,89,114,119,70,7,211,114,-72,150,175,0,117,80,190,22,21,21,248,183,211,66,61,95,134,208,223,211,-198,202,225,196,127,246,72,56,174,103,7,144,236,19,88,173,106,178,145,17,-137,91,157,122,9,91,194,124,120,139,163,47,92,186,100,19,228,206,4,254,-103,174,175,142,188,35,230,15,170,218,65,90,241,93,172,134,74,79,206,116,-51,217,158,75,113,36,1,135,182,135,178,200,2,198,30,27,19,86,130,172,-104,108,38,201,206,56,95,187,8,169,30,201,236,149,254,51,153,190,127,103,-109,213,27,14,239,207,184,194,29,117,253,103,193,54,233,212,2,243,238,31,-255,62,121,217,154,181,254,128,211,54,183,108,47,25,182,151,12,198,86,19,-121,35,170,9,250,197,185,118,105,50,93,81,89,197,92,224,113,8,134,152,-199,82,154,114,183,92,3,174,171,69,118,242,128,193,142,12,89,42,22,236,-205,3,143,195,137,192,36,78,96,137,201,127,80,66,220,134,110,181,66,22,-197,226,150,86,168,14,41,106,144,210,43,109,210,140,2,31,77,30,216,233,-186,185,5,142,233,222,153,26,8,126,80,62,43,128,114,70,170,118,185,148,-53,217,158,146,61,223,34,121,184,138,242,246,74,193,68,231,165,160,57,47,-156,32,12,82,50,100,4,140,25,36,156,97,50,201,93,0,192,101,101,45,-118,24,174,251,212,208,244,133,100,159,219,170,178,24,58,154,218,97,186,180,-44,57,14,105,185,141,239,160,166,33,163,142,121,131,205,120,228,137,44,151,-216,126,189,22,227,129,191,59,11,166,171,255,142,188,126,154,194,134,179,139,-165,18,118,211,39,25,30,233,152,79,146,145,159,112,134,69,248,153,247,126,-243,251,0,25,39,132,229,138,50,134,151,81,81,0,36,222,44,224,75,61,-212,149,74,117,116,64,205,23,44,148,239,201,147,164,229,70,217,76,169,87,-141,71,129,223,167,54,54,165,100,239,235,100,24,183,178,226,48,243,221,196,-249,176,158,186,206,85,200,167,18,150,107,216,105,75,18,53,179,24,46,107,-38,167,250,185,21,246,126,200,14,13,84,184,121,21,87,212,75,151,120,167,-104,254,164,150,33,175,13,183,115,25,201,122,110,124,135,46,183,238,157,158,-111,64,84,29,37,24,233,20,176,205,106,114,166,252,182,61,255,229,172,177,-38,159,223,93,27,233,90,216,176,212,247,55,47,39,102,44,185,17,40,11,-111,17,195,73,89,165,76,120,123,239,146,19,145,223,46,90,35,69,199,95,-40,252,59,148,143,180,181,51,136,95,43,57,6,76,80,248,250,251,16,143,-36,206,43,202,107,15,137,216,120,245,164,78,210,180,131,101,130,199,217,206,-253,78,169,47,102,194,26,29,185,185,115,200,119,27,84,182,172,187,63,250,-179,185,205,125,22,49,82,53,170,197,29,211,50,8,143,106,213,148,78,91,-91,49,12,21,82,26,75,40,18,85,144,90,74,144,169,168,177,175,130,105,-125,151,217,22,43,224,239,245,208,73,212,145,139,67,210,195,6,191,140,216,-116,255,197,214,13,79,90,205,205,117,0,5,138,157,12,94,176,119,218,206,-224,164,56,90,156,201,83,151,154,27,227,47,29,162,155,153,111,237,245,113,-70,45,43,255,103,185,227,24,131,40,160,132,127,215,38,252,11,107,160,24,-238,147,102,83,139,98,226,191,73,234,39,37,252,241,33,35,57,214,48,116,-161,83,27,9,233,39,97,227,202,110,62,233,70,227,198,232,89,52,158,102,-145,67,96,59,88,203,202,66,55,103,151,224,50,73,135,177,73,171,130,61,-207,151,69,164,1,70,144,213,69,234,135,131,32,157,135,167,127,36,244,7,-212,137,144,254,116,47,5,143,16,43,141,81,166,93,79,187,195,82,180,26,-53,136,25,146,53,34,233,132,136,72,9,229,93,243,107,170,119,23,117,242,-104,78,201,200,75,240,250,106,215,39,27,162,121,70,228,5,198,234,253,235,-88,199,65,169,57,236,13,114,39,159,36,37,84,131,195,249,73,51,74,117,-201,242,28,149,60,236,83,8,209,200,0,187,110,168,81,82,90,200,199,226,-146,170,208,90,52,121,173,9,50,144,3,74,21,10,157,145,95,39,129,77,-201,82,58,219,216,79,229,33,15,137,59,239,46,25,227,199,164,147,61,15,-112,80,201,157,56,240,179,134,19,27,81,202,217,125,70,142,62,189,115,196,-52,145,88,135,234,97,226,155,204,240,80,127,108,13,108,125,209,154,206,12,-208,44,228,160,187,131,39,58,255,157,116,101,172,123,7,177,193,171,91,138,-84,137,5,196,63,162,204,47,181,194,158,179,210,173,10,140,94,156,193,202,-119,179,165,144,34,246,208,40,237,125,200,31,242,165,111,93,33,253,58,232,-208,10,121,146,87,171,25,103,7,208,177,132,146,230,45,151,135,177,228,154,-186,80,138,209,207,163,66,212,219,105,88,9,95,73,0,203,235,205,150,243,-89,177,23,209,123,224,55,63,15,218,96,134,37,105,224,115,98,145,156,127,-160,5,119,229,58,241,195,6,136,116,239,206,195,167,201,156,1,44,165,101,-210,88,246,5,147,133,66,101,34,252,171,78,101,73,159,168,16,216,238,224,-188,89,251,108,85,53,217,31,162,208,117,240,30,254,251,15,36,156,232,246,-152,124,2,126,194,233,246,51,157,87,104,67,172,168,176,37,162,222,217,232,-66,162,252,23,178,224,216,65,166,136,197,252,177,93,12,57,50,221,149,182,-165,95,160,116,5,250,100,114,170,50,37,194,97,227,119,30,166,77,71,10,-100,149,89,19,127,62,80,69,254,250,100,42,110,241,66,183,180,198,171,39,-108,231,75,202,139,35,140,211,216,127,206,8,75,133,77,21,250,180,111,211,-224,219,230,112,31,71,134,21,115,210,154,68,186,17,188,78,34,98,188,102,-15,205,225,51,157,236,123,19,49,144,9,52,163,231,102,98,30,116,5,202,-246,72,94,119,82,121,245,189,129,152,2,149,214,141,93,137,46,48,204,16,-197,144,202,193,71,155,197,12,198,242,138,230,84,139,199,12,15,165,28,122,-201,117,151,17,106,109,177,130,0,223,158,21,243,73,167,196,85,190,67,81,-63,201,33,162,83,127,162,140,187,33,114,194,206,20,174,116,44,225,184,123,-199,58,244,5,176,156,121,177,120,85,22,132,127,249,215,168,58,69,19,59,-167,129,88,77,241,249,237,45,207,199,66,178,54,172,128,89,247,176,158,181,-191,187,170,209,211,236,210,231,94,237,12,26,36,1,106,126,211,24,184,97,-109,206,218,2,135,31,106,100,58,6,232,180,29,11,194,156,58,203,237,158,-110,200,187,36,221,96,60,244,89,50,131,182,85,198,182,241,247,155,43,104,-112,172,119,74,213,230,139,94,190,110,131,215,98,44,39,230,47,230,127,64,-9,101,66,83,105,197,150,4,47,247,71,144,213,234,33,207,230,34,190,82,-100,184,12,255,139,206,205,111,192,90,91,49,130,49,106,82,70,180,53,244,-205,47,167,124,164,8,86,81,172,209,97,66,185,180,104,197,130,70,74,248,-176,32,164,37,146,44,117,145,171,210,229,242,218,51,159,26,111,29,183,226,-171,209,102,134,37,61,13,176,78,34,31,10,210,230,230,117,207,176,247,78,-177,71,131,18,20,78,156,206,206,93,97,172,29,169,40,17,52,154,71,17,-98,124,14,21,209,171,142,148,236,203,78,48,200,132,119,182,189,47,228,189,-156,176,47,226,194,168,2,95,133,60,135,34,120,141,175,193,5,53,100,111,-111,178,237,236,12,151,26,219,230,89,137,162,237,109,240,61,197,210,99,135,-72,136,11,113,215,201,94,69,10,221,152,193,56,78,46,56,30,205,172,58,-48,58,198,39,184,33,0,208,23,87,221,250,41,147,36,215,66,94,219,178,-247,44,139,43,35,133,41,197,179,202,16,229,66,127,58,52,180,213,145,128,-140,91,194,233,168,91,144,238,69,250,165,215,43,140,82,73,127,189,153,58,-103,100,98,40,115,117,241,220,198,141,60,71,242,35,195,48,242,110,145,169,-230,7,245,222,168,253,151,26,63,76,94,96,187,208,23,207,154,124,45,83,-147,64,70,146,237,25,117,201,178,201,19,82,167,70,106,156,136,213,194,18,-120,60,58,242,128,195,251,11,59,190,26,11,30,168,35,191,126,19,61,199,-224,82,32,253,208,215,167,238,241,105,0,108,154,223,53,186,6,124,54,143,-191,220,154,175,111,51,16,98,33,186,18,247,207,230,238,115,249,184,7,148,-233,221,162,47,158,132,136,96,251,157,51,98,96,165,119,68,104,67,149,196,-141,11,181,135,114,192,77,23,229,154,253,111,145,227,210,151,106,197,123,188,-112,104,4,96,168,228,44,11,23,59,185,96,240,55,192,67,235,173,37,232,-8,89,223,212,254,219,144,241,60,119,183,17,116,9,174,156,66,139,95,43,-136,208,81,161,229,226,4,2,2,125,26,153,18,215,63,2,233,90,247,133,-214,161,80,130,237,30,159,234,139,211,171,228,87,200,77,116,100,35,143,211,-154,255,113,205,183,245,16,68,124,192,73,44,184,180,94,12,220,116,90,17,-229,67,201,33,196,184,180,11,155,145,59,102,149,151,181,34,99,216,100,71,-91,101,210,206,21,87,220,106,63,76,64,96,205,232,44,40,73,40,208,239,-254,117,199,51,247,1,187,47,151,95,142,6,23,8,2,57,110,11,49,116,-226,237,254,253,82,12,68,168,62,213,241,193,249,246,248,57,31,251,231,170,-9,172,170,159,235,82,164,220,87,103,162,221,242,141,43,239,29,211,226,116,-120,96,236,28,157,234,248,103,204,253,29,17,248,143,20,52,41,64,222,217,-41,228,133,220,234,31,171,97,191,6,116,160,107,215,126,205,242,58,121,82,-4,122,130,200,22,218,71,191,17,172,206,183,219,76,10,40,211,108,28,0,-144,132,39,40,22,112,217,198,125,35,77,126,231,254,205,117,64,67,43,25,-47,186,123,191,50,108,63,226,163,179,223,86,209,193,28,155,20,199,164,32,-84,25,90,30,68,82,146,100,49,144,189,106,138,110,89,233,177,49,91,160,-226,12,26,27,59,0,100,91,188,244,188,244,44,149,238,140,111,5,228,219,-8,41,19,44,99,45,192,67,198,243,93,242,121,126,96,116,84,174,151,22,-128,186,139,36,137,95,118,174,158,104,157,40,77,150,231,14,127,46,222,82,-149,114,30,22,215,2,195,138,127,240,102,178,59,246,120,82,50,192,142,232,-171,59,33,73,0,239,90,90,150,42,201,215,95,50,104,42,2,242,1,8,-29,180,54,75,120,16,101,211,230,24,204,15,221,214,58,252,78,247,248,229,-217,82,67,76,66,55,127,36,165,134,16,8,138,97,215,241,168,108,136,32,-35,42,83,88,133,83,111,12,36,221,130,244,24,32,254,22,230,62,226,47,-3,73,23,234,37,55,110,67,21,118,42,193,94,43,16,111,170,164,190,155,-101,202,192,140,88,92,209,40,137,15,199,176,122,0,184,245,23,51,128,75,-11,231,92,239,229,254,52,158,12,191,159,230,201,74,223,222,190,91,104,60,-68,5,248,225,29,145,80,190,201,22,242,23,145,50,148,253,32,232,100,136,-37,94,21,163,33,29,167,71,49,73,215,78,124,213,205,47,82,185,40,10,-140,7,234,51,17,117,193,141,26,151,197,72,99,106,147,182,230,43,104,100,-152,13,23,225,184,39,13,237,160,233,201,25,207,77,0,107,232,214,130,92,-16,112,112,63,157,237,149,180,224,216,53,245,79,82,58,223,26,147,78,160,-225,133,184,12,82,124,92,152,21,156,162,27,173,117,242,197,246,118,76,75,-109,15,108,60,127,164,228,196,224,113,86,209,80,17,225,183,11,232,90,58,-91,100,7,165,81,116,141,182,206,50,14,218,10,151,135,234,194,181,107,255,-18,196,231,254,229,168,187,204,13,151,234,126,241,59,49,241,184,255,34,93,-53,77,221,185,147,193,146,27,112,174,104,14,12,92,149,251,94,183,78,140,-89,119,251,60,139,148,48,75,46,240,231,239,237,251,219,227,38,30,17,246,-62,12,0,157,187,240,152,232,187,15,163,101,222,208,93,178,117,10,143,0,-68,171,108,221,24,66,182,253,84,240,32,162,160,141,100,174,122,219,104,246,-220,128,203,244,26,14,213,201,7,236,236,123,124,32,216,52,53,87,107,136,-180,244,233,69,192,167,207,74,175,150,138,27,170,82,85,83,125,208,197,79,-128,67,50,251,82,213,56,135,4,103,225,53,129,3,111,4,205,29,63,180,-208,212,189,108,30,166,53,194,18,6,67,215,173,89,175,115,202,38,165,209,-77,180,98,146,162,116,65,98,159,251,47,81,73,223,87,61,175,214,148,218,-244,160,101,225,178,224,46,72,254,58,227,84,206,40,93,194,105,148,176,117,-26,105,52,30,197,201,92,171,0,219,22,112,111,164,19,224,22,247,64,157,-87,227,7,87,229,171,105,105,31,100,110,32,7,91,189,87,169,132,13,41,-208,105,228,207,14,232,118,73,253,164,230,102,218,31,146,43,160,117,104,98,-100,166,86,151,107,84,20,204,55,27,227,151,174,191,178,145,115,31,26,216,-45,190,89,187,146,87,37,44,170,125,240,114,109,189,250,18,180,114,22,137,-35,190,89,246,142,192,130,143,116,113,149,91,143,206,229,59,223,10,163,209,-101,178,231,108,37,25,107,213,157,77,56,0,173,46,28,231,197,231,119,197,-160,20,204,109,239,204,218,216,190,25,128,53,225,54,44,253,183,73,235,251,-69,22,176,69,158,149,86,58,27,144,129,149,68,25,222,117,74,213,251,126,-191,20,200,100,54,87,22,51,17,243,53,100,122,220,197,225,58,62,171,208,-58,122,168,48,104,1,197,104,55,34,73,194,151,130,242,101,150,133,70,202,-187,117,166,4,142,53,82,13,155,248,70,97,151,216,33,223,197,208,38,155,-191,66,194,117,243,229,88,99,211,133,206,204,122,159,221,84,107,141,38,252,-252,198,111,102,224,30,103,81,230,28,194,191,178,251,236,128,89,197,51,235,-187,237,113,112,60,83,217,74,88,113,160,173,177,136,17,194,59,87,136,233,-177,192,222,195,40,102,251,58,178,192,191,105,211,176,56,132,214,78,27,27,-25,69,78,188,142,67,25,223,7,102,174,187,62,75,45,30,108,137,244,136,-31,117,145,115,127,132,83,138,15,132,134,156,90,46,211,11,139,131,72,57,-155,5,253,197,78,226,11,8,85,121,209,69,104,205,51,201,239,192,84,11,-121,48,217,168,17,127,93,43,138,45,91,192,38,155,95,191,68,192,185,100,-111,145,124,98,202,235,168,172,155,33,92,132,81,176,237,192,135,0,78,222,-179,57,30,209,163,172,44,136,17,119,56,52,12,193,55,151,186,239,93,104,-78,179,121,50,130,242,236,120,171,175,120,213,68,164,117,211,100,3,216,60,-85,57,168,255,207,250,150,89,162,39,39,140,100,27,1,130,109,155,8,164,-138,226,86,152,70,126,144,102,93,135,204,65,95,151,121,86,25,54,75,99,-155,85,130,242,0,226,84,17,225,240,132,4,74,198,183,56,139,88,12,203,-132,192,94,136,215,173,21,76,196,212,150,100,254,237,24,177,89,180,61,106,-59,176,106,247,120,216,104,178,96,81,141,115,36,178,84,248,11,39,237,247,-177,53,105,187,207,233,218,116,123,103,139,165,113,173,10,107,238,176,160,61,-50,136,153,163,127,52,181,204,224,65,142,218,36,176,106,106,117,85,42,87,-27,115,196,62,89,227,254,252,255,21,103,233,235,65,146,71,123,40,106,132,-3,80,68,49,67,69,134,119,180,98,106,155,106,190,179,194,191,164,162,5,-188,49,108,209,26,128,222,104,49,8,217,222,19,74,181,167,124,240,26,230,-33,68,47,105,39,49,48,165,113,203,234,63,204,209,97,9,82,87,75,220,-29,60,173,200,185,239,122,11,188,31,224,32,127,29,253,44,243,50,204,197,-255,75,88,153,78,85,116,64,234,101,46,247,141,124,250,138,49,36,105,254,-55,167,202,220,187,230,40,89,205,71,18,127,237,168,46,81,80,203,144,190,-91,73,164,182,66,45,101,215,18,66,121,35,158,251,105,6,61,196,252,197,-39,153,114,128,176,121,184,240,192,122,127,59,222,181,184,46,178,228,103,114,-107,9,218,92,121,86,220,132,243,210,51,51,184,96,58,195,148,140,229,238,-84,99,176,40,176,238,179,47,103,197,90,177,49,51,68,141,135,237,148,243,-104,123,175,123,84,232,8,143,14,71,129,116,138,236,150,207,89,216,25,13,-173,169,79,144,132,141,140,205,191,52,240,117,107,53,233,49,222,169,125,235,-202,17,27,27,91,49,40,76,186,18,181,129,24,253,56,250,45,115,114,88,-22,195,155,67,125,242,177,254,176,217,232,74,206,40,182,241,69,126,195,30,-117,24,5,77,20,68,176,218,183,71,123,102,185,3,207,214,52,237,95,154,-42,62,44,51,116,42,63,128,128,158,156,17,170,243,246,171,95,235,82,203,-88,154,219,67,228,248,104,254,249,108,34,160,230,176,123,105,12,157,168,7,-221,50,165,154,157,119,69,74,58,201,12,194,215,203,129,184,184,215,237,183,-208,197,108,184,49,116,107,233,56,188,80,199,150,220,158,156,16,8,3,59,-12,57,88,107,144,97,17,180,42,198,120,202,106,177,216,107,218,149,195,159,-21,60,15,8,6,143,211,243,235,173,10,76,0,243,92,183,220,245,35,181,-248,90,54,82,115,149,36,142,234,210,253,252,212,192,138,55,230,238,164,104,-160,103,206,167,101,18,65,188,170,199,124,67,23,233,46,210,192,109,74,46,-6,2,196,242,101,229,151,22,250,45,251,17,249,70,238,243,208,110,247,82,-140,221,99,5,29,128,130,90,25,247,16,0,163,63,195,150,99,172,150,187,-123,225,55,52,97,96,13,237,31,195,158,175,9,25,230,113,93,30,213,127,-25,177,152,101,110,161,192,29,61,224,71,184,97,236,211,68,16,66,205,50,-128,202,163,43,196,173,149,198,2,2,133,69,103,78,53,109,238,195,39,240,-86,169,200,49,138,184,253,134,67,30,146,244,75,125,103,93,89,159,232,68,-151,146,157,149,11,117,129,102,238,106,165,241,142,243,36,236,217,175,253,167,-145,19,111,194,169,115,184,172,78,250,76,22,160,242,73,46,183,50,75,88,-54,3,247,31,173,142,177,153,169,194,7,22,243,43,180,76,3,82,210,202,-244,128,101,48,160,247,6,56,174,67,189,240,81,128,59,172,82,71,62,25,-198,102,147,53,132,235,136,124,136,20,252,169,68,116,140,222,0,78,36,21,-151,101,119,40,140,159,224,6,215,251,6,194,19,165,132,26,248,15,10,154,-72,181,19,120,207,70,247,33,5,6,181,34,16,216,57,185,174,58,148,230,-21,98,239,215,241,151,246,84,219,122,231,98,203,159,29,215,112,134,251,203,-235,126,205,196,15,96,204,61,74,50,251,72,62,152,53,35,197,219,189,113,-30,187,238,193,32,39,107,244,228,112,47,96,124,150,0,32,249,2,6,72,-116,28,224,89,33,100,240,19,75,118,173,172,243,188,148,208,252,170,116,151,-78,10,182,240,159,71,137,203,17,139,19,179,237,203,233,177,181,242,41,48,-210,62,235,77,121,65,213,29,255,37,200,5,104,54,130,101,188,238,56,100,-201,136,81,107,145,136,218,182,93,17,29,239,218,43,117,184,200,132,164,156,-140,247,219,222,26,18,129,249,189,14,217,170,144,44,171,121,230,38,206,206,-247,51,149,130,70,235,97,44,78,72,232,36,190,93,249,238,121,148,189,162,-178,156,205,18,175,248,135,218,84,124,213,119,149,222,4,243,218,24,52,185,-126,229,214,233,60,144,249,128,76,107,189,12,247,151,143,103,51,73,229,107,-115,148,88,42,55,97,218,195,31,65,176,59,243,124,11,16,252,81,157,222,-62,36,67,255,109,211,105,76,132,217,152,42,135,92,3,175,18,109,40,252,-240,175,90,6,159,191,104,97,4,92,238,120,79,241,237,198,100,144,149,102,-241,239,124,249,209,117,82,71,192,15,237,39,211,60,122,57,94,10,6,20,-215,104,221,25,208,112,209,116,140,50,63,2,241,156,18,220,41,15,53,88,-120,74,178,222,211,214,16,90,232,56,180,46,189,230,113,17,67,194,118,150,-119,22,193,210,11,101,181,9,24,42,251,214,229,242,134,140,229,126,73,58,-186,35,198,173,253,142,29,69,11,140,132,145,95,155,5,91,254,42,204,200,-229,67,232,113,177,140,101,28,154,67,61,160,10,58,33,67,208,147,190,244,-74,75,75,114,224,227,84,26,158,73,160,108,182,19,224,30,53,211,115,114,-13,64,12,145,224,233,70,143,37,219,239,82,239,140,49,219,194,90,114,192,-202,45,95,193,147,14,164,107,137,70,120,30,30,178,78,229,116,254,183,75,-123,105,112,171,168,9,157,219,235,41,152,70,50,217,75,39,99,133,39,60,-77,113,120,125,143,90,117,4,184,42,13,223,77,196,181,69,90,98,65,153,-143,228,209,232,9,81,78,12,170,51,30,16,252,81,45,181,193,202,183,161,-62,96,200,160,134,248,27,13,250,80,34,63,125,250,7,220,204,106,204,188,-109,215,203,143,23,188,0,240,92,252,150,47,186,50,142,194,10,112,242,197,-155,191,157,206,22,169,208,105,235,12,4,34,221,27,27,205,86,34,56,76,-212,56,168,112,145,178,183,178,18,162,89,155,23,92,157,194,88,193,179,68,-33,113,46,45,235,219,70,183,154,228,97,84,125,215,44,54,227,245,12,83,-212,207,220,179,91,245,25,31,38,100,223,208,94,220,169,199,151,228,201,113,-4,110,116,231,34,190,47,162,246,151,48,231,74,196,137,17,239,245,189,229,-234,228,39,140,107,38,6,103,28,51,111,240,21,46,177,118,58,84,66,198,-149,150,247,193,5,130,186,166,41,100,230,92,139,50,109,205,46,10,131,172,-55,200,115,89,53,95,3,146,217,97,136,254,228,54,196,199,0,70,237,125,-197,47,70,206,102,159,198,13,146,42,36,47,131,109,40,107,157,149,173,132,-31,29,110,192,64,79,165,174,128,188,77,252,232,207,49,235,200,80,96,196,-186,90,74,242,182,2,23,10,0,125,58,59,189,65,154,195,138,28,191,104,-89,171,117,101,240,205,182,89,215,198,245,206,43,225,46,85,231,173,30,197,-54,126,164,33,127,177,132,53,109,1,211,45,131,79,108,35,232,254,157,95,-160,10,142,178,51,195,83,7,89,174,64,173,128,14,70,29,118,185,159,223,-178,67,187,224,69,159,70,77,72,81,174,131,4,123,47,219,66,112,124,126,-12,40,113,215,54,243,8,179,77,246,164,1,110,103,86,209,49,60,175,94,-159,253,193,242,135,25,114,191,246,50,198,194,142,254,245,26,98,254,98,197,-110,46,249,233,127,123,130,218,210,140,230,91,185,10,107,234,155,230,210,55,-114,129,61,21,42,70,144,164,252,98,216,23,22,222,193,146,5,107,128,61,-150,235,17,244,110,18,79,230,134,166,245,215,165,94,96,247,29,140,100,27,-205,13,245,45,202,152,127,47,75,65,153,83,174,192,159,140,29,102,235,196,-106,214,35,249,151,210,237,242,249,132,249,34,59,59,140,111,118,131,221,246,-102,252,55,188,188,253,5,239,36,216,197,245,17,61,133,184,220,223,156,81,-220,81,143,79,119,177,190,102,80,163,62,102,85,18,109,40,212,214,221,209,-49,193,84,188,83,233,25,119,27,47,112,148,210,81,30,159,56,158,202,162,-81,151,142,167,202,105,161,150,6,218,168,62,141,42,46,21,150,248,193,223,-174,64,213,110,180,233,10,1,103,117,128,135,184,12,218,78,72,73,202,121,-223,43,240,126,34,92,219,247,172,253,215,75,124,93,33,146,193,152,60,64,-124,101,59,229,240,218,199,229,168,173,197,75,25,79,62,123,105,242,30,121,-161,179,245,65,28,180,253,95,133,35,134,246,233,138,62,132,3,200,255,108,-70,182,220,70,96,201,130,239,139,195,130,127,8,183,106,154,67,77,88,150,-121,64,230,224,18,117,188,255,180,51,125,249,9,115,129,75,4,170,98,87,-36,80,198,138,38,105,20,99,197,187,39,244,238,161,174,65,26,245,143,79,-70,249,232,170,31,203,218,158,68,79,205,67,204,78,30,147,200,93,177,159,-92,236,207,117,170,193,88,243,145,28,88,215,226,21,170,20,133,230,248,196,-28,47,140,190,94,33,144,203,53,229,158,140,87,94,0,107,15,238,216,79,-86,17,232,32,117,171,67,158,63,247,152,242,236,48,54,18,227,219,166,99,-120,253,159,158,205,208,212,81,123,117,8,113,5,83,207,19,153,132,67,124,-39,17,121,51,3,1,72,151,223,214,60,198,222,20,116,12,160,14,30,242,-28,222,85,31,99,108,91,33,174,150,181,179,109,85,29,137,221,36,225,108,-172,68,120,10,153,245,211,89,132,99,101,48,158,108,197,242,156,136,249,201,-166,147,101,118,18,72,137,233,166,46,135,42,57,119,228,142,249,241,38,168,-226,90,69,26,101,213,202,57,39,239,186,183,202,9,114,143,127,214,150,183,-92,182,159,171,144,209,134,187,26,219,205,102,201,234,249,94,136,62,232,121,-200,213,80,212,237,105,96,180,169,198,95,48,38,253,112,26,116,20,117,239,-55,200,170,56,4,238,9,205,238,211,98,71,74,129,223,96,31,121,90,138,-104,79,39,193,126,208,149,91,112,228,229,126,130,222,244,235,174,229,189,159,-166,52,121,147,26,44,83,9,208,144,200,146,30,195,14,72,250,53,11,113,-18,162,255,185,212,191,163,207,24,187,0,163,22,100,65,45,181,139,243,13,-0,233,140,191,105,160,130,144,147,41,30,38,244,241,190,126,87,53,158,114,-239,67,94,101,101,131,59,27,176,136,149,232,136,95,106,187,40,244,155,99,-36,215,205,95,131,209,152,107,64,25,22,68,208,146,219,39,11,101,196,4,-72,79,24,225,39,161,173,200,72,135,226,104,2,121,37,6,18,235,234,138,-53,198,212,79,15,121,124,50,241,46,176,137,22,24,155,141,217,178,205,144,-18,48,198,152,8,12,200,83,61,180,45,105,146,243,86,132,77,3,113,125,-86,205,45,222,68,41,62,166,225,204,6,56,186,55,83,37,96,28,192,206,-23,60,101,19,56,60,125,26,95,152,220,228,38,35,167,143,192,10,132,194,-105,187,163,121,232,115,114,196,34,97,227,197,132,89,196,143,232,176,130,167,-58,217,182,82,98,206,89,111,199,202,209,5,106,93,176,62,127,208,146,208,-20,14,151,38,112,233,79,83,118,82,189,58,246,94,52,242,65,211,215,173,-88,123,28,149,132,81,164,221,10,183,3,114,218,166,240,123,178,74,182,210,-221,249,245,38,9,96,1,91,126,35,202,235,73,12,213,204,240,165,155,100,-59,229,176,158,158,228,31,81,250,31,141,130,158,228,89,231,129,191,254,205,-248,197,158,144,182,165,118,192,16,83,4,247,50,102,9,123,26,128,83,51,-164,171,167,165,74,35,84,63,118,88,240,214,148,199,77,73,218,101,51,220,-191,64,49,134,62,65,179,82,154,4,76,188,212,72,202,246,199,186,225,208,-136,40,161,125,97,94,211,127,148,213,163,65,144,72,48,230,56,148,37,12,-96,112,73,167,187,190,113,90,97,117,56,219,152,137,106,211,115,99,186,141,-54,152,126,90,190,225,243,2,89,146,129,179,29,59,65,30,241,213,79,240,-56,206,152,56,146,24,21,209,103,70,150,63,96,122,179,242,66,133,11,190,-226,1,173,184,162,255,154,114,206,162,173,186,141,143,148,7,35,223,151,199,-55,75,232,220,110,142,237,209,83,66,231,198,208,23,175,138,34,81,220,157,-38,15,211,184,4,113,29,33,42,84,148,93,58,171,63,34,50,234,185,113,-59,165,66,96,173,51,40,239,30,202,37,117,20,192,7,34,20,200,81,156,-73,134,18,247,197,230,197,167,96,245,3,239,215,210,156,100,1,209,41,84,-123,133,226,123,3,189,17,118,168,179,9,130,178,140,76,199,249,134,235,2,-78,251,146,160,156,174,187,115,241,171,144,175,104,84,137,54,237,167,84,151,-215,26,102,89,177,52,207,77,100,171,8,2,173,39,144,88,225,0,210,122,-193,205,112,222,230,54,204,13,58,59,63,29,83,224,77,186,240,209,238,201,-53,233,219,65,22,222,62,209,143,206,64,230,150,108,243,167,180,55,25,92,-65,143,245,197,140,78,125,116,62,254,164,161,91,62,231,141,163,50,112,179,-130,123,177,177,75,73,173,172,35,141,236,193,197,231,245,142,85,181,109,127,-30,178,105,207,14,104,77,36,174,111,82,217,22,211,139,18,35,124,45,196,-104,154,150,182,12,153,125,142,113,168,214,104,91,182,239,59,232,151,109,250,-34,209,144,122,196,248,61,120,13,232,117,167,250,37,231,12,148,0,245,195,-251,39,148,204,93,95,34,170,39,178,46,87,167,24,107,123,101,144,223,6,-163,31,147,35,248,156,9,19,188,176,67,112,200,65,49,201,19,119,72,105,-154,212,81,93,132,73,216,159,179,90,204,23,106,13,222,200,72,193,96,17,-145,205,51,8,17,206,143,72,184,71,126,134,7,136,0,167,0,83,68,249,-70,21,245,114,196,47,94,212,208,54,196,128,174,2,163,176,185,116,223,191,-137,4,45,76,225,97,230,101,105,154,34,163,68,17,195,139,45,182,41,46,-250,169,182,249,213,70,34,102,219,109,225,78,232,12,140,97,198,243,225,81,-242,113,34,170,207,53,141,216,186,103,214,230,243,89,143,236,24,14,179,105,-197,179,206,135,135,176,73,15,17,87,165,195,194,57,168,189,139,179,92,5,-191,23,69,117,72,34,150,202,183,235,24,158,224,67,180,112,210,67,189,6,-224,181,160,39,216,125,18,16,156,77,116,195,253,19,185,24,177,154,67,216,-161,234,27,75,14,216,218,174,156,226,39,119,191,142,57,119,243,89,148,85,-137,207,4,159,96,37,99,212,123,165,115,230,185,91,244,156,39,145,62,127,-149,255,241,9,9,231,211,83,179,165,178,51,163,225,14,101,190,5,142,130,-19,18,183,217,7,13,72,116,115,74,85,193,35,88,103,181,91,1,174,87,-54,158,248,101,70,90,157,134,231,208,239,27,182,255,189,194,54,60,101,26,-128,163,135,142,123,42,146,227,99,7,155,170,25,35,26,127,20,65,138,59,-235,223,44,61,187,200,218,228,157,124,111,52,79,106,5,35,254,74,83,174,-190,129,241,126,121,53,155,206,202,180,233,226,234,46,60,156,102,9,116,11,-119,29,218,31,42,176,164,27,51,26,14,212,76,35,55,24,235,136,15,183,-144,160,188,215,8,186,66,87,130,74,98,255,32,37,118,98,67,38,75,228,-220,226,184,98,125,176,13,48,85,65,14,53,158,199,220,113,103,250,103,15,-149,214,52,140,30,163,117,223,106,201,38,108,15,208,136,11,223,244,193,38,-132,184,126,138,176,86,50,249,192,245,209,85,106,7,242,115,201,115,19,30,-84,51,106,3,157,77,65,178,193,250,111,5,237,248,196,98,65,150,96,140,-16,148,92,130,17,177,189,166,204,96,214,14,37,33,173,181,198,181,118,116,-189,93,64,65,82,206,136,199,223,171,31,131,122,169,76,236,109,152,86,228,-247,63,209,55,126,248,146,87,46,241,246,124,103,184,40,185,114,203,142,208,-216,227,9,155,181,9,142,237,41,47,97,144,149,60,93,243,232,157,188,64,-7,138,163,142,36,230,0,51,16,95,105,66,115,76,92,31,141,17,103,82,-192,77,116,54,47,146,176,2,167,3,253,167,244,135,193,187,101,113,57,206,-81,244,155,70,5,52,13,130,0,169,23,217,252,193,114,81,245,99,253,209,-202,171,69,119,52,3,20,83,19,151,66,212,221,220,212,190,130,8,182,152,-10,125,218,72,100,174,234,144,117,180,210,36,154,220,199,249,222,28,84,219,-83,60,208,119,56,74,37,176,199,85,29,131,19,176,233,142,231,138,199,133,-174,64,230,100,245,43,182,0,251,217,144,133,171,61,40,74,128,202,223,222,-58,73,47,202,17,159,153,0,171,93,121,2,20,2,81,65,9,3,198,252,-201,121,182,66,143,172,191,38,102,74,135,90,49,50,4,138,148,145,241,49,-221,125,159,226,240,86,21,175,230,72,217,150,206,190,55,181,23,35,224,145,-199,49,192,69,76,1,215,189,0,10,216,190,180,34,41,237,145,67,113,230,-99,48,221,94,108,68,139,120,220,68,126,206,89,23,87,30,27,181,13,214,-140,90,252,64,244,116,181,93,253,243,4,101,254,8,240,215,153,208,178,166,-31,234,149,219,130,91,217,223,41,26,169,193,73,66,24,209,122,144,208,238,-158,63,61,80,242,138,240,128,22,59,216,5,31,132,46,56,241,166,4,118,-195,75,42,190,241,48,53,124,63,163,100,22,187,1,206,8,165,38,174,190,-115,86,68,88,247,205,102,97,95,142,30,238,139,116,202,1,247,72,235,182,-183,34,43,39,133,198,238,95,141,250,95,235,176,134,198,127,155,182,173,244,-117,211,40,243,249,55,28,241,243,49,128,14,130,3,150,198,108,211,75,63,-101,125,9,9,14,76,74,28,67,143,210,51,65,4,139,173,160,142,106,19,-118,124,128,168,162,152,128,230,106,164,134,74,128,214,109,211,99,62,213,51,-7,163,90,36,186,111,133,46,68,26,6,8,5,208,31,90,238,9,242,55,-205,196,86,68,155,112,228,183,6,151,178,192,165,140,183,18,76,177,137,194,-27,192,205,54,184,253,107,108,216,200,243,76,71,220,26,247,235,252,235,137,-90,29,205,73,206,101,236,245,89,176,241,241,58,196,234,72,50,224,152,252,-185,7,241,206,147,66,243,93,133,25,20,29,62,59,194,186,89,189,60,104,-184,225,224,183,117,121,169,66,167,232,38,153,69,21,36,131,23,90,152,254,-15,238,158,116,169,70,47,254,163,37,224,192,199,79,230,94,3,52,150,188,-5,225,168,224,96,162,107,214,61,221,14,52,202,141,228,29,214,219,193,183,-41,75,33,88,68,59,7,110,112,179,36,94,176,146,68,209,28,209,61,146,-160,225,11,21,183,240,153,206,215,32,91,125,222,141,161,114,243,110,243,129,-122,32,134,74,19,234,49,33,70,159,43,11,124,42,7,215,8,30,72,71,-82,240,157,165,179,227,101,229,21,169,64,37,95,205,211,29,41,130,231,184,-254,122,96,226,133,66,98,40,131,250,194,207,69,230,121,238,228,22,233,37,-34,139,237,70,253,225,9,144,26,11,110,118,207,101,233,193,196,174,212,91,-232,11,165,202,104,227,43,127,136,171,96,205,147,233,72,199,79,222,176,197,-126,169,238,139,77,59,229,103,87,17,197,79,131,60,96,44,15,129,82,189,-0,12,231,236,251,203,69,188,136,167,181,179,73,142,152,120,138,241,116,125,-77,117,165,76,0,187,235,162,156,142,25,18,32,235,80,66,194,43,189,138,-92,94,234,56,28,133,215,18,43,231,46,214,0,133,237,123,98,11,172,227,-52,253,160,238,166,11,35,157,83,254,103,114,103,181,114,181,237,137,173,235,-22,105,196,5,207,182,32,237,55,39,157,212,185,37,226,198,239,175,34,237,-0,24,19,217,241,166,40,248,5,76,221,229,114,138,200,60,10,30,22,3,-177,152,243,203,220,99,12,203,95,110,68,2,169,255,7,208,68,69,97,136,-118,168,226,131,157,102,126,78,206,34,154,7,62,111,205,157,210,155,220,215,-255,191,224,49,115,19,207,193,14,178,56,76,22,169,61,173,99,39,244,39,-121,142,129,161,27,24,152,223,94,142,198,114,155,20,215,255,120,4,116,102,-62,126,68,241,236,121,78,218,113,226,43,109,188,15,186,33,28,55,4,63,-106,147,162,185,112,15,28,253,1,45,191,153,132,102,64,38,29,241,52,70,-96,184,185,86,208,82,17,52,250,233,108,133,184,41,53,115,13,119,42,130,-161,4,47,77,254,192,0,157,41,145,155,10,14,180,123,66,72,247,253,232,-186,5,143,133,7,90,122,201,13,225,142,20,88,11,249,246,16,184,217,231,-151,17,110,23,149,216,79,142,209,58,227,213,124,48,11,245,33,199,100,86,-101,91,202,249,78,35,228,247,105,154,150,127,53,171,194,72,63,214,7,246,-151,1,190,80,241,247,109,134,171,177,161,87,6,241,14,35,85,151,218,151,-189,74,84,175,175,132,200,81,148,236,208,255,108,129,5,93,6,234,92,138,-82,254,241,88,113,221,15,75,227,217,180,121,73,18,255,206,247,53,67,106,-117,163,202,229,235,5,130,49,119,248,12,87,8,1,101,109,208,29,36,151,-127,64,46,104,14,220,175,240,201,149,247,223,20,63,64,124,231,106,162,143,-24,174,41,75,173,201,36,113,112,151,197,210,19,210,159,213,81,135,43,196,-175,151,119,5,174,58,97,154,34,234,78,3,38,81,79,122,48,155,76,133,-131,92,177,248,107,126,183,83,230,144,173,3,148,206,80,207,126,94,193,102,-47,52,183,54,203,241,53,77,97,146,161,160,41,4,17,133,136,68,105,132,-215,36,113,14,51,83,165,219,187,68,174,36,206,233,169,234,10,72,18,237,-27,63,92,33,243,70,96,65,232,131,229,126,60,124,241,39,6,10,135,160,-184,1,234,121,5,168,60,128,244,83,41,53,31,24,247,110,210,47,237,25,-27,122,50,214,220,94,211,17,240,88,3,86,205,160,242,160,2,53,205,78,-168,158,108,69,99,101,145,215,241,227,91,246,227,94,126,103,53,53,135,144,-15,230,158,166,79,173,148,201,169,51,172,211,24,140,248,222,239,125,240,87,-145,213,26,159,226,12,249,20,226,116,19,198,5,227,239,42,31,220,125,16,-9,152,156,210,173,20,75,201,71,107,193,52,183,186,44,33,149,188,252,231,-214,57,4,224,26,110,246,62,228,222,103,118,45,41,203,84,227,170,194,72,-73,82,222,108,157,73,167,40,112,42,158,213,14,7,226,234,7,195,215,87,-89,44,246,168,98,0,64,194,131,169,47,134,28,121,192,13,199,181,31,104,-52,34,4,145,59,248,88,153,120,179,118,181,24,58,155,62,128,67,21,206,-174,235,206,149,48,17,97,4,161,45,189,166,1,132,237,218,65,11,71,208,-125,106,114,164,205,87,147,58,56,54,69,151,229,17,127,81,77,98,134,164,-99,212,182,83,10,182,22,35,56,252,50,188,176,220,105,28,1,40,196,236,-211,18,21,157,16,221,142,119,228,174,155,207,5,194,127,152,205,149,220,211,-4,79,28,85,55,170,95,138,41,122,196,64,25,79,137,151,193,43,145,85,-72,52,140,138,134,104,14,52,117,53,52,210,246,151,211,6,59,126,128,58,-39,165,164,134,239,201,17,47,45,92,112,162,124,132,68,173,240,231,241,99,-157,113,192,57,150,30,215,101,24,251,21,139,223,221,154,229,133,137,112,44,-135,209,177,177,167,181,232,136,168,100,13,213,103,40,27,81,37,118,64,132,-205,58,59,103,99,29,55,138,157,4,102,149,171,82,145,200,108,28,30,141,-243,71,225,7,98,185,79,9,138,91,42,51,66,244,180,210,234,195,236,150,-2,145,178,109,206,190,29,158,99,47,164,86,244,110,7,197,139,235,93,30,-250,16,64,83,64,152,245,205,124,193,30,201,11,37,133,38,129,220,197,224,-164,118,196,132,230,208,49,254,131,6,214,32,84,116,238,0,175,192,216,132,-179,111,146,215,244,17,81,66,76,93,36,192,219,12,162,169,210,177,106,128,-182,31,42,244,175,65,252,241,186,114,187,203,116,144,221,109,91,208,163,60,-164,238,69,56,197,164,174,19,108,253,73,117,56,25,58,164,8,12,182,207,-94,64,75,249,57,241,170,156,204,55,99,107,37,194,77,33,63,67,44,250,-236,18,37,113,247,88,57,80,131,102,118,68,201,219,200,92,130,198,29,203,-144,197,171,125,160,95,33,234,238,145,67,170,174,37,176,186,147,172,89,18,-135,236,172,234,53,251,83,14,130,219,159,235,11,194,212,228,221,221,33,215,-207,143,127,89,136,11,33,251,202,226,167,64,60,8,142,204,42,93,246,92,-122,71,104,243,51,10,13,65,133,149,5,137,69,15,206,202,15,223,223,142,-25,163,11,211,128,126,241,245,157,96,170,9,29,57,226,92,58,101,184,204,-204,165,223,219,35,60,46,177,137,171,238,212,127,7,106,148,156,21,197,56,-184,205,142,89,128,218,107,174,225,150,58,183,226,69,223,185,170,129,42,134,-234,189,3,182,247,115,12,148,208,237,239,205,155,114,28,23,236,57,222,81,-194,2,80,254,93,244,155,139,57,22,212,60,72,10,23,77,135,131,76,227,-118,106,31,214,144,152,94,60,109,73,202,188,64,53,209,124,213,81,125,146,-52,141,186,94,206,43,195,198,255,175,114,52,197,186,88,226,70,204,5,146,-21,239,90,71,96,254,176,195,165,36,0,250,43,159,196,123,43,23,217,39,-57,108,222,32,215,27,69,182,135,206,122,123,64,108,33,69,218,15,236,30,-237,149,146,75,68,48,156,228,5,108,55,152,24,179,1,59,147,21,10,96,-56,220,133,84,221,40,94,235,2,39,134,188,39,48,61,252,87,99,156,121,-146,192,82,204,169,114,204,84,197,164,128,176,224,228,18,243,39,10,255,83,-189,117,32,1,8,248,23,66,190,24,40,22,38,15,98,192,151,231,78,11,-196,111,145,88,92,85,224,47,160,33,64,40,95,74,17,215,32,93,225,53,-118,37,239,142,145,245,114,161,132,9,237,62,165,9,92,187,152,188,184,234,-167,136,99,100,2,22,0,159,227,143,65,247,232,28,156,31,209,62,208,160,-228,14,73,181,252,130,114,201,79,53,234,1,23,113,183,241,83,150,64,233,-199,140,0,160,62,12,131,47,72,17,248,70,145,206,139,13,81,82,218,93,-187,176,37,135,239,202,159,3,156,3,170,228,131,26,214,50,152,183,238,207,-145,87,241,180,5,139,115,248,227,82,62,246,174,148,186,153,218,57,174,238,-39,14,54,52,74,145,140,59,247,252,191,83,201,94,209,214,194,9,178,151,-129,187,125,56,61,11,133,247,142,51,122,1,240,179,193,25,119,129,93,177,-219,207,118,75,168,99,216,51,153,17,37,240,47,44,208,190,38,211,65,106,-187,129,217,101,146,10,80,206,61,58,0,130,130,69,234,72,231,172,95,212,-249,208,92,249,3,14,113,181,65,237,85,130,60,89,96,113,217,37,43,79,-36,8,157,85,176,20,228,82,222,121,4,44,202,8,207,4,162,4,1,190,-135,166,106,204,80,86,10,14,145,220,31,59,239,84,186,208,107,81,15,164,-67,34,70,34,170,43,168,250,131,173,151,101,23,90,108,65,189,43,113,37,-25,45,197,10,203,17,229,136,24,219,74,58,95,86,38,176,102,216,73,24,-76,24,53,245,255,96,144,69,155,10,228,5,208,150,111,85,221,253,215,196,-238,75,129,101,16,244,64,244,113,196,136,0,0,88,237,159,190,225,199,126,-138,103,39,11,107,161,162,93,214,203,104,108,202,96,60,39,199,23,5,99,-122,227,239,88,252,150,8,216,181,68,22,75,156,134,241,135,10,66,3,29,-10,242,7,188,139,110,219,16,130,167,74,186,114,102,161,55,194,64,125,248,-48,100,148,121,233,87,118,128,132,203,180,81,146,104,144,148,145,154,60,190,-177,187,36,104,83,85,168,190,168,15,0,7,91,172,10,53,153,1,16,238,-100,41,118,99,148,221,119,56,130,176,75,79,191,60,185,60,116,105,139,104,-197,84,4,139,212,135,45,134,174,193,68,118,133,127,59,155,215,57,6,181,-2,185,152,50,185,191,68,186,222,16,212,136,182,88,216,25,153,72,164,19,-167,223,172,157,238,52,74,245,103,25,209,168,221,96,218,131,172,134,98,0,-167,127,16,104,152,159,92,29,100,79,241,90,45,186,50,190,180,21,221,21,-140,139,163,237,108,98,14,101,17,72,126,77,65,123,159,251,114,173,122,185,-142,236,222,173,121,218,65,75,16,251,242,35,89,87,46,183,146,161,163,214,-180,175,199,112,63,49,132,26,123,161,141,139,81,251,93,17,20,244,232,178,-225,81,70,253,150,130,108,68,151,149,117,46,199,85,116,201,190,115,152,23,-51,38,130,80,162,154,219,153,137,14,248,58,43,246,100,74,92,152,79,9,-207,183,157,99,254,246,197,76,180,60,124,168,148,222,155,80,239,140,3,135,-95,36,237,223,133,205,203,68,37,33,107,124,253,19,232,224,173,72,220,215,-233,189,35,116,22,185,154,95,225,192,208,249,243,193,46,35,78,62,238,165,-95,199,119,105,147,143,164,52,162,248,45,251,75,77,176,248,38,197,108,226,-234,199,101,69,230,232,122,14,227,2,129,229,240,14,174,31,48,90,219,86,-245,125,190,11,79,197,28,58,102,20,79,231,44,52,102,100,157,255,111,148,-59,180,109,150,116,2,113,186,231,233,120,122,13,54,81,55,106,107,213,73,-224,106,17,37,117,160,158,156,179,168,42,46,56,16,243,17,221,197,190,253,-92,118,118,143,238,255,167,229,24,217,74,67,78,136,112,141,198,99,185,20,-121,135,145,128,94,109,241,224,70,73,146,55,226,83,70,138,25,1,177,30,-26,227,187,24,141,150,94,72,58,55,56,173,237,51,86,54,57,149,59,111,-36,184,147,3,2,40,30,118,23,249,151,157,251,52,252,0,50,115,251,42,-116,71,56,153,115,112,27,72,100,208,101,52,226,49,97,207,98,198,132,182,-203,255,59,251,106,207,31,212,68,99,46,11,45,154,112,152,150,63,109,154,-81,22,210,85,129,65,178,63,91,136,19,134,169,251,243,68,86,144,19,206,-180,29,140,4,12,184,238,108,103,121,36,219,20,221,111,195,225,199,50,238,-234,118,162,116,58,130,4,71,54,29,18,2,118,26,253,194,178,119,160,87,-134,186,137,159,7,123,192,167,252,52,170,181,18,64,168,247,24,37,71,185,-98,249,228,125,140,18,120,250,133,86,130,255,55,182,221,99,1,60,33,91,-58,104,36,9,114,247,157,250,205,96,97,5,57,198,8,252,64,189,162,79,-63,100,239,206,230,98,132,204,47,221,10,250,240,190,7,68,198,244,154,92,-173,226,106,214,40,23,247,89,114,172,239,148,48,170,45,134,59,98,3,10,-183,126,186,40,199,23,46,161,92,3,36,129,243,167,155,113,123,3,219,62,-174,87,54,51,123,206,253,124,22,34,207,125,232,142,166,219,48,26,72,165,-202,164,7,180,131,33,81,112,255,219,90,87,162,159,99,243,20,16,135,118,-123,8,251,237,123,5,211,49,159,62,24,193,137,127,226,118,199,27,255,140,-130,231,204,140,126,60,174,226,82,48,215,183,145,251,51,114,192,86,76,121,-129,169,107,205,40,147,244,169,141,189,179,159,202,157,61,51,79,50,145,87,-1,9,196,91,124,235,18,161,4,54,154,176,108,160,205,251,54,97,102,211,-253,105,233,15,133,68,106,157,56,111,18,248,130,119,136,37,239,147,47,140,-92,44,152,172,211,149,203,199,54,144,120,91,60,75,103,70,220,37,188,226,-56,176,84,20,230,220,35,59,239,52,24,236,182,97,181,237,176,209,131,164,-197,93,37,121,212,29,133,20,61,181,228,105,90,68,121,39,186,50,130,212,-192,231,61,195,4,251,50,228,106,68,135,136,131,219,155,142,245,231,203,130,-247,196,62,240,124,131,42,82,220,207,177,146,169,139,0,13,41,245,213,98,-78,233,136,163,176,176,9,85,173,51,206,145,148,14,192,230,187,96,68,21,-253,137,191,9,96,100,33,99,166,234,154,158,110,252,108,184,131,145,244,177,-142,29,147,107,69,133,14,238,32,65,36,120,215,31,76,156,175,96,254,142,-237,240,156,104,128,155,147,58,223,86,184,197,226,127,102,84,67,216,181,213,-196,12,71,29,94,159,185,93,194,82,202,211,122,227,246,52,69,92,213,239,-176,248,50,239,159,209,46,131,226,115,78,54,89,115,112,149,25,117,8,167,-149,33,146,158,163,44,198,177,134,133,182,191,143,97,32,39,5,16,84,26,-168,226,16,251,208,200,246,6,142,237,96,75,249,28,203,190,220,149,178,21,-251,3,148,36,125,237,74,159,231,227,196,198,142,109,125,208,14,221,206,43,-232,164,55,238,135,124,138,241,123,116,41,31,154,78,116,154,7,87,7,72,-167,199,114,76,168,43,112,113,135,65,169,166,77,177,222,52,243,226,140,67,-125,174,152,141,156,108,86,12,218,132,144,221,141,199,247,22,221,246,99,217,-241,136,78,124,177,7,104,102,214,224,114,201,190,249,241,88,129,124,85,249,-223,166,238,249,92,180,18,205,36,57,178,154,213,58,166,174,251,27,7,203,-67,188,85,74,165,108,198,242,77,145,71,131,85,67,61,161,142,81,53,189,-79,116,150,247,146,172,73,170,144,253,194,239,11,187,210,145,76,51,75,53,-45,228,205,224,174,127,92,199,85,235,180,13,156,197,135,194,23,91,252,165,-95,53,164,205,144,221,42,126,162,117,205,116,166,137,134,53,61,248,130,112,-244,240,232,58,200,32,40,238,71,111,134,52,79,26,133,79,70,215,220,184,-152,132,129,50,117,85,150,199,208,146,176,66,59,180,217,200,84,180,86,201,-76,153,198,18,220,127,170,191,116,174,159,121,101,193,176,142,13,21,124,243,-181,84,94,154,227,242,12,252,113,118,187,48,60,31,185,156,70,213,101,239,-102,231,185,82,149,162,208,175,82,219,80,237,86,144,39,3,147,128,159,97,-131,165,59,100,123,180,145,156,180,189,94,245,32,23,11,126,99,193,98,227,-241,158,208,118,134,17,147,179,29,203,144,131,115,148,43,245,207,138,209,18,-168,160,151,140,100,22,124,253,22,55,207,224,104,43,54,84,25,63,185,196,-94,242,112,116,38,16,161,68,122,117,178,233,65,161,151,124,94,165,24,52,-17,215,43,200,154,136,19,122,125,202,50,110,5,154,220,206,145,89,77,159,-189,79,30,119,202,156,228,98,249,106,115,253,6,75,93,184,114,155,100,223,-87,175,174,8,14,186,184,28,49,255,126,221,198,171,250,227,35,120,64,79,-108,34,126,83,202,105,34,242,125,53,123,42,16,37,133,115,215,24,192,62,-116,180,252,133,34,226,158,152,147,212,216,211,120,176,39,85,76,231,85,21,-121,184,211,217,186,209,93,32,105,117,252,36,207,236,104,17,173,40,244,66,-127,163,129,240,192,160,218,98,2,231,53,150,1,136,227,37,111,69,42,147,-226,49,182,33,136,61,142,254,117,17,8,71,91,94,225,133,216,13,79,111,-218,206,16,109,140,90,75,18,56,121,73,103,10,185,47,86,237,122,201,157,-45,99,80,233,116,15,246,167,168,56,199,177,133,202,33,34,90,217,162,145,-219,92,253,147,14,95,234,216,176,210,39,230,49,45,165,159,65,94,172,142,-98,215,16,117,117,212,112,129,81,116,225,89,159,116,42,41,222,187,212,111,-201,167,95,30,212,105,56,117,32,121,220,75,153,149,211,59,54,244,252,236,-187,53,4,107,6,93,53,196,237,234,122,69,168,118,224,207,227,232,235,98,-42,186,255,83,75,89,59,138,150,201,26,215,206,112,88,209,176,176,165,126,-120,240,193,115,217,36,38,198,59,34,221,153,33,163,55,23,21,30,192,174,-189,195,246,25,88,61,142,47,33,214,240,246,97,26,192,130,91,183,235,60,-251,169,77,86,152,66,87,186,227,111,224,193,63,255,94,207,132,28,0,31,-173,215,131,163,63,50,135,56,103,164,76,12,154,61,211,253,217,134,9,81,-49,69,165,186,124,177,14,169,245,135,226,106,95,179,169,220,165,240,183,9,-99,181,203,132,84,100,203,1,232,84,81,187,168,39,141,217,115,106,109,39,-42,195,136,163,218,241,99,129,190,139,219,191,111,170,74,229,239,198,243,139,-116,49,11,210,19,252,0,235,20,161,54,80,172,42,105,68,131,213,127,207,-250,255,77,36,218,153,119,191,88,104,99,109,161,182,58,18,76,92,26,155,-87,126,12,238,63,99,245,221,73,39,47,25,42,59,244,200,83,245,140,23,-93,96,177,185,9,103,80,1,150,96,99,72,118,143,78,230,227,139,1,172,-147,83,7,66,205,3,158,115,114,110,193,29,70,72,225,77,125,144,248,83,-87,211,21,87,31,57,26,62,114,211,111,16,61,233,174,5,249,226,205,24,-133,136,18,134,10,175,111,114,51,249,104,160,190,149,246,187,84,228,120,93,-1,219,182,221,84,225,0,184,218,2,14,138,136,24,120,110,159,131,9,192,-17,2,204,174,211,180,161,233,138,90,135,221,117,121,80,217,31,29,242,205,-102,244,69,117,237,196,162,55,39,14,141,10,157,37,162,185,119,167,203,197,-72,109,123,204,180,38,145,32,250,254,233,31,18,124,218,23,150,55,241,238,-112,117,145,15,207,87,94,196,103,195,237,188,119,137,68,120,23,221,161,183,-127,197,137,83,142,125,9,130,92,228,245,215,146,155,37,62,211,89,52,105,-131,241,128,27,65,244,190,115,174,130,194,213,21,215,141,229,181,92,152,41,-246,178,19,51,54,4,12,211,236,98,119,240,103,120,129,231,16,155,70,78,-145,241,15,210,113,118,179,184,132,42,208,100,213,174,97,255,14,34,33,43,-38,224,159,178,33,222,10,4,227,240,145,176,246,70,170,134,138,162,143,78,-51,122,165,75,35,144,35,168,37,152,28,48,245,246,254,180,227,233,39,125,-111,240,236,191,206,178,208,239,71,215,152,170,71,245,109,88,131,72,186,226,-205,190,125,50,142,159,191,169,143,151,75,99,57,157,62,89,131,34,96,166,-254,95,43,79,57,91,28,248,125,52,91,73,228,180,206,126,68,5,167,160,-121,170,95,127,190,3,29,112,155,8,104,25,122,36,122,201,174,193,153,119,-23,50,201,201,21,209,58,80,98,154,88,92,111,131,79,175,120,30,196,212,-85,107,42,195,234,125,236,225,223,252,201,209,48,228,142,159,249,147,251,5,-120,45,180,110,16,33,103,79,161,58,148,229,104,26,157,53,94,19,210,243,-83,236,172,93,155,177,178,103,169,146,25,128,105,173,29,59,52,183,167,235,-200,219,153,2,192,191,139,182,91,179,37,216,166,6,166,8,106,74,68,121,-105,222,179,99,147,95,72,14,66,142,123,154,142,15,27,33,153,142,58,137,-21,108,134,103,7,74,218,247,94,159,63,140,63,80,70,34,152,246,176,137,-239,46,154,57,208,30,14,247,82,82,118,175,203,207,41,54,21,122,45,126,-152,148,129,1,189,75,205,43,21,51,141,213,33,103,248,66,241,51,43,65,-231,80,154,78,28,191,146,192,144,94,113,109,157,232,239,1,218,51,124,140,-40,26,46,170,180,139,166,105,0,25,112,239,212,10,205,12,103,37,102,172,-152,93,113,49,170,53,128,34,56,137,182,57,64,27,14,136,25,205,46,230,-139,88,184,32,99,48,212,86,191,120,182,58,151,140,112,67,246,77,40,191,-46,109,103,209,8,14,135,89,85,211,16,90,10,193,234,166,184,153,237,43,-115,17,18,114,107,56,87,85,122,37,186,197,91,103,185,28,136,197,162,232,-55,241,225,121,207,206,181,164,164,198,89,197,133,156,231,230,48,202,226,92,-128,18,147,250,35,238,174,83,28,210,241,85,203,131,162,20,120,91,99,107,-146,212,197,201,217,137,5,30,184,61,74,128,50,150,75,203,141,169,132,234,-100,148,144,61,127,19,163,187,135,124,200,100,220,27,192,70,17,254,79,76,-115,176,115,247,22,122,81,106,73,245,123,10,16,28,36,247,9,98,63,128,-140,65,39,148,26,173,13,64,212,158,39,187,14,49,180,7,93,182,128,54,-35,11,84,79,9,227,106,177,80,135,97,88,43,162,242,224,213,179,201,171,-181,25,230,219,135,179,143,253,85,127,137,64,2,77,114,74,243,77,154,10,-180,5,132,92,104,205,35,216,4,80,216,78,89,120,220,54,208,179,202,117,-111,107,250,145,84,207,119,165,219,86,39,237,122,244,118,65,35,63,1,100,-219,85,71,7,45,64,97,222,209,239,189,63,231,206,26,187,13,118,23,147,-177,71,225,125,133,127,72,158,253,202,154,153,25,46,42,29,246,184,69,182,-40,226,58,82,7,61,78,97,189,20,167,130,61,236,191,122,135,50,57,57,-133,130,156,155,102,200,36,20,41,188,253,117,11,86,132,252,200,83,85,248,-111,81,250,224,156,210,232,27,31,83,149,137,185,211,81,219,49,32,205,163,-166,242,240,178,76,159,99,37,135,169,151,98,66,73,116,24,127,223,99,27,-178,230,23,207,203,16,69,86,32,148,136,4,66,134,59,88,145,42,166,20,-5,122,41,2,214,213,129,70,237,198,48,73,144,172,18,13,139,43,213,155,-23,88,92,18,8,94,93,137,104,80,118,235,156,200,80,206,86,183,149,108,-60,43,36,83,58,199,41,120,151,30,73,89,184,151,157,163,157,171,203,42,-182,41,220,165,153,106,151,97,240,183,215,219,68,107,139,47,235,54,130,211,-51,255,195,142,233,60,186,241,71,36,160,243,26,196,128,84,124,32,146,19,-62,30,26,53,214,133,208,102,62,119,49,72,202,210,121,204,225,111,20,243,-217,29,5,37,207,234,184,114,74,170,182,54,113,221,168,254,238,177,159,31,-17,254,170,77,130,229,198,235,58,230,6,241,230,92,218,151,89,102,29,229,-84,141,201,15,91,33,116,18,56,166,158,253,206,223,201,74,155,63,208,230,-120,195,161,82,134,54,250,38,45,123,55,255,130,145,112,42,129,152,203,252,-255,216,33,90,138,102,0,108,137,254,122,92,168,243,39,162,236,15,235,9,-18,136,252,14,223,153,202,231,49,157,87,198,142,175,132,192,57,27,128,32,-214,38,49,244,10,56,194,65,83,224,111,32,232,244,70,40,84,172,71,23,-212,67,165,12,198,189,251,114,189,75,166,186,88,64,211,179,212,127,168,179,-154,103,187,69,200,160,37,116,17,203,101,242,56,128,250,139,168,168,193,246,-193,11,94,193,170,41,133,203,60,229,214,176,93,50,207,26,240,133,219,143,-98,159,1,169,48,34,85,97,88,47,28,104,157,204,96,75,117,153,54,215,-197,37,31,32,196,213,2,138,137,183,34,4,22,103,224,220,168,231,52,185,-159,111,184,46,82,8,202,2,212,155,43,255,153,5,230,157,28,241,10,90,-144,219,76,62,194,14,161,105,186,123,113,203,171,1,46,198,147,217,108,255,-239,70,231,20,250,150,143,147,118,67,124,20,204,124,51,129,242,172,55,225,-10,169,59,244,180,255,177,115,63,66,118,228,16,217,153,231,217,191,171,184,-109,104,229,240,200,31,135,0,159,206,235,151,118,0,62,27,69,130,155,206,-238,170,213,127,163,65,34,213,155,239,110,0,186,29,136,178,166,114,24,60,-115,145,222,13,1,142,124,165,144,85,35,137,122,25,69,65,116,13,148,86,-169,9,12,237,161,78,67,253,38,216,57,131,120,194,89,221,105,91,36,38,-216,7,222,66,104,180,239,253,172,145,194,89,28,105,191,148,115,75,50,154,-90,130,99,185,68,215,128,150,133,93,89,240,26,12,231,254,30,175,36,96,-214,110,116,0,223,31,87,145,201,40,156,176,246,175,1,25,51,206,164,48,-209,224,5,207,53,75,226,105,138,232,217,102,58,146,112,224,231,211,31,112,-130,202,132,227,16,230,208,164,155,154,201,143,134,78,50,64,232,103,205,6,-124,9,56,18,22,27,129,241,116,42,65,103,222,30,173,181,118,186,107,128,-134,95,194,192,180,144,61,136,196,54,199,198,35,19,7,164,246,160,180,215,-60,8,215,147,127,57,90,102,238,78,248,164,212,233,69,113,14,227,197,139,-179,220,19,1,99,35,146,67,84,11,146,226,19,109,151,73,143,105,66,95,-242,24,51,37,173,129,59,176,190,102,227,115,186,139,80,14,52,203,44,152,-5,92,194,185,152,247,230,183,229,58,54,222,68,204,212,112,48,82,157,37,-208,220,174,255,34,151,103,212,158,212,126,150,69,89,134,190,86,23,136,106,-0,84,217,151,194,229,17,13,241,189,208,201,111,230,77,139,111,17,218,18,-164,162,78,141,106,238,146,80,199,160,49,171,230,161,92,59,254,246,98,54,-69,49,122,18,139,30,63,75,213,187,193,5,230,160,241,53,80,207,149,51,-42,170,134,255,65,198,215,50,120,128,143,5,40,8,98,120,206,184,17,170,-81,63,220,59,125,174,7,14,115,165,160,11,182,75,123,64,15,154,132,9,-148,177,53,143,152,254,17,246,32,102,236,237,223,245,48,157,90,234,181,77,-177,25,173,36,188,75,115,251,212,15,255,11,23,168,148,34,89,87,8,127,-149,174,67,138,14,220,40,189,189,93,73,28,29,213,194,191,125,103,83,19,-84,242,248,31,119,18,47,135,73,41,203,182,223,191,71,19,7,226,46,148,-251,246,251,72,200,188,30,172,210,24,152,210,252,191,147,194,41,155,213,90,-212,40,254,220,247,195,228,70,147,158,31,24,52,55,65,251,166,183,203,81,-102,222,155,66,49,209,18,68,133,166,201,249,5,222,223,69,116,2,192,91,-35,183,87,4,22,22,107,68,109,177,35,10,36,81,185,113,220,248,167,108,-232,250,246,52,200,17,111,52,223,202,115,147,82,176,182,207,135,124,129,172,-57,74,19,155,29,179,33,233,134,137,221,113,69,237,203,242,175,240,243,165,-189,15,85,253,227,142,68,39,10,143,32,205,23,255,28,181,197,103,234,243,-107,30,186,26,19,185,255,70,116,22,108,32,114,135,64,12,218,191,191,58,-163,125,41,194,165,98,135,39,224,92,198,161,199,146,125,201,80,107,227,208,-76,217,60,168,67,56,99,113,245,64,224,240,225,161,178,44,114,123,106,255,-41,246,149,22,79,220,94,134,62,190,19,37,136,63,252,24,169,231,165,155,-139,1,159,252,51,71,21,101,232,192,98,105,197,9,222,60,181,67,75,223,-199,23,126,214,194,179,86,83,0,0,179,164,226,42,74,212,72,164,247,147,-29,38,204,118,119,214,8,155,72,111,6,149,109,254,133,51,53,52,108,180,-126,24,205,45,213,81,28,109,34,196,125,83,78,117,230,110,242,187,94,200,-177,51,163,3,255,116,137,193,241,238,124,236,172,119,188,236,36,8,5,85,-17,32,156,66,99,8,250,109,170,14,64,162,113,254,33,252,166,13,247,137,-251,241,248,50,172,177,118,5,112,108,29,24,111,227,42,126,3,42,245,206,-116,55,3,81,2,96,134,234,31,204,2,84,64,253,201,76,139,30,98,45,-77,31,52,228,89,61,108,79,196,22,205,156,49,162,193,9,63,253,68,224,-6,216,103,16,34,144,236,100,85,124,129,221,189,234,31,118,172,157,71,23,-36,132,127,92,16,206,167,158,2,137,139,94,113,143,120,100,132,163,163,24,-20,226,195,176,79,194,175,219,169,154,131,248,241,179,220,33,239,90,20,196,-96,104,198,15,155,109,0,92,35,149,244,132,55,96,124,246,199,252,242,194,-102,202,195,53,122,29,110,37,73,170,30,60,230,125,175,214,28,254,158,217,-84,3,127,200,12,62,5,190,165,147,121,8,109,178,149,160,167,157,210,30,-125,181,241,53,69,53,162,119,173,244,87,121,227,183,49,59,249,77,18,255,-194,213,134,17,59,110,70,234,28,48,187,122,19,200,34,60,195,39,7,230,-26,251,114,28,34,29,62,184,110,158,43,36,232,42,35,213,203,202,202,83,-57,201,229,233,211,80,238,122,236,182,88,42,41,112,53,252,9,198,168,91,-228,95,157,121,155,3,13,116,126,140,69,237,1,119,28,116,149,103,236,41,-76,21,255,172,10,34,228,126,84,193,17,242,61,119,120,114,203,152,27,38,-185,56,29,103,211,244,232,133,225,72,52,138,205,200,37,139,210,155,78,151,-140,181,84,202,89,144,102,159,28,185,252,212,77,33,103,16,84,137,36,39,-86,76,12,133,23,182,73,148,154,47,246,160,85,76,135,22,33,87,86,110,-181,136,241,68,3,15,52,117,230,1,182,41,46,46,144,175,1,223,192,124,-132,63,46,32,149,179,223,92,229,169,173,210,45,156,236,179,87,112,224,122,-89,59,172,174,224,43,179,200,223,33,230,107,23,142,137,80,187,167,137,56,-1,247,247,102,138,30,40,60,25,169,141,56,123,203,73,51,179,157,164,109,-145,16,77,245,95,222,178,39,102,174,42,131,249,129,243,69,124,220,100,170,-251,253,224,86,183,109,45,194,57,51,63,140,94,85,106,90,218,129,215,204,-111,64,176,18,240,21,22,96,30,252,249,130,161,9,252,48,51,133,205,177,-194,107,198,102,118,230,87,189,165,108,136,101,196,138,60,228,130,188,207,122,-58,244,192,195,226,18,26,152,116,215,173,105,45,88,127,101,51,53,223,110,-121,217,255,145,141,91,177,43,3,185,104,202,177,7,182,144,47,124,27,88,-91,57,207,3,245,243,62,120,4,206,76,191,48,32,24,134,88,251,17,198,-167,81,102,171,9,75,164,238,114,43,189,225,133,12,161,45,206,101,249,67,-2,118,184,54,125,151,46,211,241,178,180,174,41,215,249,222,93,184,2,0,-114,138,232,173,110,149,36,34,243,150,147,91,167,185,122,142,119,244,193,12,-45,8,0,223,21,124,128,209,200,47,199,172,130,238,235,71,45,220,196,125,-195,241,142,153,249,102,101,46,12,143,234,54,17,108,30,196,139,86,161,125,-162,124,27,66,35,10,45,50,211,80,177,113,22,110,163,88,146,10,67,115,-24,198,4,162,233,16,80,104,97,132,174,99,11,3,52,157,64,214,33,97,-194,52,53,136,38,38,197,22,206,209,128,181,164,101,153,164,42,131,203,163,-165,217,252,16,236,11,252,176,52,188,77,137,154,148,171,145,66,38,154,135,-16,36,24,33,231,84,95,225,255,132,62,239,140,172,1,94,154,233,72,94,-252,208,44,86,123,17,189,82,25,130,176,223,253,128,134,50,160,191,200,47,-160,253,239,12,52,55,45,57,234,143,107,35,47,176,74,47,99,242,250,170,-61,221,189,215,68,76,89,45,66,41,202,175,141,94,66,129,147,4,233,147,-138,58,90,28,223,231,51,193,33,143,96,74,194,80,173,16,225,220,142,175,-97,196,127,33,4,13,107,192,185,9,252,77,167,33,12,129,41,69,66,229,-146,2,83,115,138,216,223,22,76,112,184,120,33,57,16,250,152,13,195,22,-32,109,152,187,164,5,107,79,167,75,245,127,120,241,74,151,211,9,230,183,-225,188,7,79,45,88,46,48,164,215,26,165,152,131,10,157,105,1,117,58,-69,120,200,100,132,231,247,216,185,83,6,8,194,245,84,194,144,129,78,119,-65,106,49,57,188,160,195,112,3,97,43,251,67,33,151,69,8,127,43,218,-76,44,105,55,11,204,4,98,196,124,59,12,141,187,97,31,115,22,237,6,-46,154,162,155,76,89,13,133,207,142,80,218,216,210,238,223,196,112,115,208,-20,168,107,221,143,41,189,151,160,47,121,232,19,69,189,201,151,13,213,20,-102,103,237,230,19,68,23,108,204,193,1,42,232,205,1,187,10,50,37,52,-135,153,239,198,206,246,162,86,248,191,49,162,92,227,168,11,199,242,81,243,-106,1,223,143,147,135,194,86,245,214,213,252,132,22,24,10,157,29,121,27,-213,253,104,82,196,220,252,73,39,33,91,231,208,181,56,212,61,203,48,116,-121,29,233,8,9,212,2,59,89,83,172,88,75,117,104,19,126,101,243,11,-15,202,106,143,18,129,237,49,179,23,139,222,251,66,225,16,223,187,228,2,-251,167,86,5,34,213,201,131,6,163,171,218,153,248,246,8,43,205,56,102,-44,85,60,244,236,141,104,174,183,255,20,221,60,59,51,85,42,133,52,23,-158,18,4,161,9,255,67,19,129,240,147,56,1,82,198,233,103,99,110,164,-123,244,156,92,20,183,68,241,153,105,117,232,229,116,203,89,175,98,53,1,-154,118,58,18,70,84,10,0,37,185,75,187,244,76,0,238,249,129,29,253,-154,104,169,60,9,162,65,80,175,34,230,158,11,44,203,247,186,133,218,77,-57,45,173,34,3,13,75,108,147,53,116,30,218,205,25,206,186,33,4,150,-78,108,155,88,197,199,98,152,242,19,210,95,233,90,74,74,181,201,23,83,-100,51,145,202,206,237,134,72,118,222,233,85,205,255,152,219,116,186,91,72,-235,176,157,170,172,85,104,150,5,94,181,31,244,246,76,115,56,180,3,3,-240,229,90,185,211,197,156,142,13,77,251,168,220,210,223,130,221,188,66,2,-207,2,185,20,201,2,106,202,228,135,70,185,30,217,90,134,198,47,58,103,-72,252,176,74,206,142,147,47,209,51,99,182,204,46,229,52,97,171,210,17,-135,224,86,55,3,254,22,117,151,214,210,52,162,168,78,20,60,12,69,243,-230,43,98,104,89,106,104,230,124,134,66,253,152,94,241,66,216,151,218,136,-79,116,198,79,37,172,102,225,22,224,12,15,219,11,111,246,233,23,120,43,-183,180,171,140,50,156,86,5,159,163,36,91,237,66,6,157,176,45,220,250,-50,220,66,96,89,253,45,13,216,208,102,250,41,197,249,232,41,60,47,18,-161,177,120,31,76,42,48,174,98,136,107,100,75,160,107,202,21,223,35,48,-183,192,75,103,226,92,52,126,123,89,77,159,181,99,90,155,86,235,31,117,-216,86,157,94,15,192,246,157,213,194,37,49,197,146,255,216,92,192,169,173,-13,86,130,174,164,71,250,10,69,118,232,142,108,53,86,167,100,87,69,95,-61,251,104,114,206,216,248,250,167,62,77,62,133,212,135,214,127,151,214,230,-132,69,153,255,185,119,82,132,49,135,154,151,88,35,167,230,11,59,193,152,-96,224,190,251,159,115,160,102,183,171,50,200,85,119,252,55,211,82,143,174,-52,8,4,246,90,32,30,47,57,91,242,251,187,145,181,247,171,20,186,169,-154,70,40,240,45,70,233,110,175,76,14,7,95,219,65,145,123,2,214,39,-125,127,24,195,1,38,56,160,135,143,182,243,174,202,29,48,212,227,90,92,-245,26,88,5,166,184,142,142,148,245,171,45,189,177,212,140,81,60,185,60,-95,0,99,38,243,6,42,140,28,249,31,48,26,135,202,209,184,234,224,79,-12,193,138,252,191,156,19,220,101,76,163,184,86,56,93,188,133,199,77,203,-60,82,55,94,80,6,245,247,26,26,255,136,230,246,82,237,98,211,56,151,-144,162,93,171,228,227,62,235,102,169,109,210,69,124,134,171,187,17,93,111,-8,190,112,110,234,242,202,45,47,159,203,78,92,223,37,158,253,84,232,106,-106,46,38,83,242,30,47,155,104,141,187,171,221,36,208,132,20,18,197,53,-254,22,72,132,24,116,162,191,144,55,217,180,246,129,143,64,131,91,140,135,-56,215,94,63,144,153,197,26,217,83,39,94,142,68,168,66,164,223,80,109,-224,215,180,46,174,171,83,92,38,204,196,199,182,98,37,251,226,241,70,121,-100,86,173,122,200,12,196,30,110,149,92,8,235,37,145,182,55,95,69,24,-168,79,238,36,9,33,95,119,234,68,110,104,187,239,114,64,0,150,98,198,-33,47,228,49,106,117,167,31,8,140,113,9,252,85,190,112,56,186,105,222,-219,123,112,252,235,223,203,146,215,150,215,38,149,242,201,222,158,60,200,251,-252,93,27,197,49,127,53,131,64,43,87,52,132,169,141,243,131,138,135,16,-3,6,40,168,247,208,214,134,102,35,23,94,41,86,71,35,192,72,0,193,-135,68,59,105,116,171,11,241,164,40,100,181,92,16,197,188,9,101,201,20,-11,21,209,7,9,139,139,1,123,170,42,51,0,172,67,211,233,130,150,78,-213,94,113,33,238,202,231,230,213,218,93,236,177,111,220,13,206,46,40,175,-193,144,52,109,90,32,22,124,20,172,95,123,224,254,178,141,57,138,71,156,-6,87,130,175,135,27,44,74,49,116,181,74,73,151,194,247,17,201,180,69,-202,188,77,208,254,169,73,127,79,158,191,188,153,104,50,105,170,211,225,180,-150,125,140,52,139,242,155,203,63,232,87,155,247,199,11,18,197,211,38,211,-226,242,224,114,67,252,35,126,189,238,17,122,23,234,98,250,9,39,115,107,-138,249,247,223,153,67,179,168,158,85,158,56,232,124,155,238,127,126,62,39,-70,172,37,236,208,93,240,166,34,140,12,78,4,163,19,231,191,247,226,71,-43,34,106,1,197,179,34,138,16,157,252,186,92,139,13,243,8,78,43,181,-76,183,163,108,171,172,69,186,189,143,99,185,101,139,112,35,52,197,197,81,-195,102,133,172,58,142,85,184,227,84,93,8,38,250,101,218,51,2,216,117,-171,57,205,49,228,75,56,4,202,242,120,97,68,7,236,10,198,205,252,2,-237,18,7,123,91,11,90,66,235,123,96,241,226,166,128,103,86,113,95,10,-82,252,95,244,176,75,213,47,123,184,8,64,138,241,24,16,180,171,15,13,-20,113,212,232,202,183,183,3,170,128,91,55,69,250,237,47,143,240,76,146,-110,6,90,107,230,109,88,22,220,166,241,222,242,255,232,62,122,225,224,159,-100,79,41,2,247,189,208,224,177,187,99,214,176,235,186,13,101,81,122,23,-32,119,217,7,39,82,131,40,242,54,41,202,11,245,25,50,217,159,48,178,-96,246,140,74,61,132,252,192,128,19,215,201,32,242,82,33,213,252,22,251,-39,157,203,32,22,177,91,232,222,238,46,173,127,169,68,186,238,47,225,228,-158,191,244,161,178,9,196,98,178,35,207,202,136,137,65,152,247,209,239,25,-41,57,220,78,84,146,56,89,19,132,224,14,141,128,174,51,166,78,229,185,-83,203,149,96,95,75,60,150,245,79,81,120,226,166,254,92,41,112,193,195,-35,250,157,13,251,40,60,119,80,177,105,44,231,114,21,42,206,54,229,170,-140,29,101,89,71,219,4,20,63,122,63,240,147,108,217,198,25,168,21,157,-121,211,163,96,237,57,163,23,111,18,158,239,214,250,184,217,219,9,207,161,-151,152,122,38,189,28,104,129,188,111,190,255,221,22,157,196,39,183,185,75,-148,51,1,245,86,13,4,179,131,80,219,254,238,78,27,210,81,235,149,210,-65,121,225,134,218,236,91,181,72,5,212,217,17,117,214,116,71,36,117,173,-0,83,120,187,99,227,172,56,249,22,22,106,77,218,119,219,232,217,32,153,-49,173,235,219,39,31,122,191,130,87,208,76,74,127,115,186,200,152,18,120,-59,43,10,213,50,195,81,150,204,133,198,21,190,175,176,23,102,165,147,190,-151,210,176,158,158,153,103,1,220,87,71,75,224,102,218,2,57,79,119,207,-0,173,77,180,197,186,58,67,17,176,113,154,115,33,53,140,116,191,232,132,-177,110,245,96,74,216,60,184,120,252,3,231,85,40,152,79,234,251,33,14,-93,73,197,51,23,248,4,71,208,153,135,187,162,83,162,27,39,230,207,63,-5,205,81,244,232,50,40,74,206,215,132,139,245,114,212,20,88,21,233,134,-191,124,0,122,25,208,146,13,147,125,11,107,188,240,247,163,210,155,124,249,-252,39,240,156,27,251,81,135,219,252,32,220,223,207,223,156,204,195,118,212,-108,205,242,192,193,71,220,156,170,172,85,48,41,208,14,24,181,77,137,168,-54,32,170,18,9,2,233,139,35,163,130,180,24,151,79,114,184,160,87,63,-193,208,113,58,10,122,196,202,110,184,202,202,40,41,92,176,153,83,45,161,-215,230,185,76,228,104,15,162,104,206,253,143,79,144,215,128,114,33,196,32,-46,244,147,244,247,116,239,76,208,203,254,139,210,85,57,226,0,132,43,34,-142,253,242,132,236,143,49,130,68,198,60,174,50,219,168,230,44,238,188,82,-94,3,127,30,83,253,197,219,88,240,72,109,234,169,51,17,246,177,31,99,-54,248,160,189,127,226,142,138,160,205,2,120,186,203,112,75,115,33,171,76,-6,144,198,108,87,244,36,185,177,54,22,144,233,208,231,193,27,133,66,195,-184,94,178,206,227,126,87,157,34,141,87,171,25,53,17,196,160,54,54,125,-192,194,170,136,6,172,237,47,178,78,0,229,107,11,63,105,227,39,21,33,-168,130,11,86,123,213,231,87,226,44,3,9,62,10,245,184,127,217,28,17,-242,27,95,22,33,141,69,231,10,233,58,4,13,40,81,176,167,43,216,95,-123,6,97,222,177,175,119,128,59,42,76,188,177,222,20,116,201,9,41,56,-199,68,6,117,84,87,83,26,79,146,100,190,57,200,218,212,77,27,235,93,-48,8,70,59,23,213,30,205,64,47,219,152,106,100,102,227,115,156,143,153,-95,75,151,96,25,126,237,198,66,88,78,113,151,242,89,91,171,77,93,215,-110,100,197,244,186,90,178,146,60,245,15,10,104,244,22,157,198,6,159,75,-125,22,13,247,248,248,66,51,32,211,85,84,0,232,36,14,28,130,172,106,-234,3,134,127,0,14,40,211,142,155,179,234,241,192,203,20,50,30,174,30,-128,8,120,26,169,63,208,2,104,202,186,39,109,94,162,90,23,206,18,247,-172,63,17,192,203,213,194,131,124,87,210,244,231,77,78,113,112,99,226,200,-152,82,162,145,188,95,23,208,41,18,194,65,172,238,8,7,224,224,137,154,-93,21,198,238,171,166,4,30,224,254,43,205,197,175,205,124,146,37,154,17,-116,38,185,150,18,184,58,176,212,129,150,164,23,11,215,78,98,48,238,114,-173,60,187,78,177,183,60,163,157,201,20,208,39,161,135,16,119,192,88,74,-19,82,125,103,176,71,125,73,227,26,132,83,167,60,51,143,46,153,249,29,-238,223,38,82,247,225,136,35,116,20,219,208,134,49,231,45,81,210,219,252,-175,22,168,119,136,157,177,48,99,253,65,187,227,232,52,4,86,166,201,53,-54,171,55,251,19,36,92,124,105,212,47,246,68,204,28,92,216,173,81,80,-100,228,239,163,120,199,154,90,207,162,113,203,169,152,4,126,100,151,151,169,-215,223,8,81,188,103,93,100,69,208,25,212,59,61,41,146,227,112,33,39,-118,142,66,221,112,49,173,97,168,137,118,168,82,87,199,110,246,238,193,68,-61,178,63,165,81,71,142,0,250,50,176,120,140,39,78,192,233,110,218,34,-232,64,80,74,131,240,44,240,106,77,183,200,225,3,98,31,27,42,75,1,-120,207,25,70,25,171,72,164,67,143,69,18,51,12,144,128,22,123,18,92,-168,50,169,67,229,214,117,61,244,116,246,151,143,45,49,84,128,12,101,237,-117,153,23,253,55,9,201,228,118,50,78,198,115,222,138,59,222,129,240,218,-116,82,223,33,245,224,46,9,235,20,204,149,125,14,62,173,34,2,56,183,-183,243,45,132,15,50,188,194,88,59,186,138,166,192,11,144,209,141,46,20,-225,79,249,169,106,61,251,31,217,114,115,83,26,225,249,212,175,239,168,79,-146,30,111,122,178,200,144,207,103,55,38,40,183,206,176,22,53,204,251,33,-159,156,5,160,124,211,79,199,28,170,24,30,220,1,116,196,188,160,164,24,-195,161,35,238,214,11,184,35,150,175,104,199,215,156,170,103,222,111,77,126,-253,21,117,41,175,173,250,103,56,8,76,150,57,139,62,101,234,139,229,112,-37,137,123,97,148,179,77,175,97,191,205,149,51,108,214,84,89,57,101,171,-253,87,180,168,198,220,220,62,121,253,74,191,0,10,131,122,96,99,3,1,-99,188,124,17,151,44,0,133,81,198,53,244,165,194,250,226,73,59,70,82,-117,11,244,126,208,17,195,42,229,233,58,161,191,41,252,41,124,70,3,163,-151,42,235,0,90,11,11,140,199,144,162,229,169,204,39,31,190,57,86,39,-146,145,201,99,103,62,141,3,32,12,177,62,86,244,120,123,222,143,82,40,-174,250,15,58,214,141,87,49,178,183,206,165,10,73,109,240,7,156,244,31,-171,181,174,91,14,55,200,8,138,6,50,90,169,236,218,58,62,215,18,105,-232,207,242,104,14,105,228,25,194,66,183,249,116,227,218,215,58,67,80,191,-247,213,2,80,138,5,103,22,252,168,6,237,226,215,187,190,221,152,103,106,-51,155,19,95,124,241,199,251,20,75,191,111,48,42,128,152,7,46,151,121,-8,111,51,17,22,27,157,206,179,110,227,248,157,27,176,8,254,9,241,120,-202,39,108,248,217,73,199,82,13,65,1,90,166,243,104,48,126,79,193,80,-171,105,215,167,199,255,40,250,230,173,38,88,92,12,211,113,117,70,159,65,-28,200,116,17,219,236,193,44,112,247,127,193,4,139,119,32,114,73,133,127,-61,141,115,230,180,120,98,89,171,0,150,251,76,50,204,129,148,148,165,188,-70,32,163,230,38,0,99,172,167,23,183,187,177,41,164,144,56,200,25,106,-25,41,144,31,55,95,106,0,197,131,232,184,150,116,236,39,83,248,208,190,-253,245,212,133,33,84,35,6,218,209,56,32,174,50,250,147,178,125,246,9,-47,157,104,236,116,67,32,251,205,117,234,125,228,142,72,87,200,179,3,127,-55,210,216,110,233,135,205,128,170,48,105,188,46,172,88,77,12,147,158,139,-80,246,131,254,229,125,112,99,208,39,221,120,146,117,128,94,24,3,152,162,-152,206,105,10,216,29,175,219,73,230,122,164,47,182,156,84,21,48,167,46,-252,32,111,147,15,121,161,128,255,145,28,173,229,215,67,17,203,38,222,19,-36,214,156,150,68,66,46,237,81,216,201,101,224,121,48,199,182,146,21,221,-56,158,33,167,120,176,57,95,152,158,55,240,1,234,45,94,73,50,155,43,-108,51,16,39,232,123,104,176,107,112,213,179,74,202,253,235,59,189,61,185,-193,174,72,253,8,203,116,68,29,180,186,240,56,104,102,151,90,255,190,65,-46,56,224,207,183,199,44,128,69,1,29,18,83,128,132,249,136,122,121,61,-176,113,114,132,238,100,252,155,240,72,104,4,231,252,229,5,192,9,88,86,-35,214,163,245,109,151,42,135,138,219,60,130,15,244,24,21,24,204,92,0,-88,40,254,46,22,95,230,187,255,4,112,156,173,248,103,63,112,101,129,82,-86,32,50,202,61,170,98,239,239,126,35,205,31,207,77,149,228,54,39,170,-232,167,54,227,1,218,149,253,77,82,190,186,159,181,234,60,177,148,67,62,-191,147,54,37,209,54,37,6,191,0,206,47,10,218,101,61,217,95,173,66,-93,233,42,60,50,227,47,199,157,81,161,249,174,105,224,247,192,189,139,254,-97,76,78,250,48,40,101,208,158,158,159,11,124,212,243,243,204,171,130,12,-112,171,79,13,124,253,27,165,204,120,28,130,126,117,246,53,8,95,146,76,-171,167,195,167,233,73,194,172,178,32,227,61,68,70,122,223,214,22,59,186,-61,4,106,95,189,186,103,197,60,154,112,236,101,17,27,125,234,186,106,167,-102,182,14,34,176,130,78,93,88,145,95,228,235,247,255,78,146,4,136,157,-221,144,165,153,250,80,247,178,6,124,16,206,168,173,182,42,168,229,68,92,-162,240,178,67,241,15,63,105,138,68,3,241,139,117,56,33,130,175,53,93,-184,188,180,185,101,114,161,190,67,10,214,55,209,226,102,82,225,5,230,60,-80,175,203,93,101,107,56,21,130,119,215,179,87,183,149,65,70,176,26,102,-65,83,21,166,13,212,47,177,11,93,172,48,215,69,55,158,170,248,33,154,-199,14,74,197,225,16,49,31,149,214,67,204,128,235,90,243,108,246,212,17,-50,176,127,63,41,11,44,227,26,97,102,195,74,15,241,187,102,97,153,156,-49,3,29,56,163,6,243,233,236,173,59,61,103,109,25,71,151,236,186,35,-76,233,49,96,132,76,247,187,195,87,133,103,78,238,201,105,9,61,254,225,-136,180,200,239,68,137,91,108,148,48,161,105,27,214,247,94,20,140,221,86,-253,151,150,154,77,44,28,48,202,206,147,153,205,84,215,105,190,162,169,172,-38,11,231,192,162,171,71,88,124,204,95,122,219,85,241,182,15,114,102,100,-29,174,80,26,221,87,228,83,92,170,247,201,178,224,132,32,210,187,249,119,-64,152,208,49,181,243,175,136,159,180,104,87,167,118,53,2,34,211,192,140,-166,14,4,158,227,13,219,194,33,132,10,72,107,98,224,39,189,116,77,197,-117,75,213,10,6,250,206,64,47,54,212,80,103,110,249,0,251,42,244,241,-104,41,99,49,6,94,106,96,57,144,114,125,210,64,133,204,138,100,33,4,-135,148,27,21,231,101,165,19,109,215,34,129,78,248,165,34,167,140,106,75,-15,234,65,91,154,42,148,15,165,10,191,244,133,132,228,183,145,5,215,10,-3,251,140,58,132,139,65,156,159,51,171,121,176,190,83,208,229,73,156,251,-207,154,113,226,111,187,85,86,146,154,246,238,109,249,194,128,47,119,61,85,-214,207,225,63,93,148,70,198,176,49,148,170,90,214,129,219,34,124,199,231,-94,171,212,47,21,3,162,43,151,144,42,193,105,143,198,141,217,63,219,191,-14,209,54,167,48,144,97,64,138,81,250,2,99,52,36,129,103,75,15,16,-117,126,15,38,168,135,79,209,89,50,247,216,71,233,207,5,242,153,53,30,-93,167,238,110,47,35,248,9,1,159,75,14,98,181,178,21,134,71,54,171,-65,35,60,106,174,205,18,113,215,49,46,51,124,104,25,13,17,31,244,13,-167,19,123,153,19,176,161,1,238,17,134,217,166,155,64,216,14,54,119,21,-105,253,231,248,123,26,250,12,59,32,97,141,213,101,77,128,110,107,214,150,-73,58,171,89,74,187,154,36,34,81,73,233,70,255,154,156,208,102,221,100,-151,23,101,141,71,35,45,65,79,58,216,127,222,155,181,248,11,100,126,225,-147,42,89,243,52,122,16,59,86,218,154,1,230,250,117,116,89,160,23,85,-240,78,96,136,52,48,122,15,59,26,20,252,56,17,85,234,199,94,209,80,-139,215,18,121,56,75,158,45,236,13,96,124,247,69,214,175,49,245,78,88,-185,79,142,199,247,95,127,15,181,100,183,65,211,41,72,61,141,213,18,254,-176,212,211,71,77,214,72,193,8,207,170,228,185,140,192,62,197,129,82,80,-75,169,103,186,153,82,79,221,219,84,198,184,150,224,79,116,65,115,84,12,-67,95,55,221,109,153,94,233,231,21,252,156,178,47,237,149,209,213,203,13,-70,87,237,10,33,99,61,200,148,44,198,212,42,208,209,190,175,114,169,117,-62,27,49,221,138,235,191,146,187,152,247,160,125,246,0,106,175,252,176,147,-68,49,192,0,116,223,241,110,238,251,141,139,94,94,140,158,159,38,223,76,-193,17,193,122,54,35,72,77,84,34,111,152,24,70,174,85,204,248,106,62,-21,147,48,128,64,121,51,11,75,86,179,48,232,50,114,167,42,208,159,130,-121,51,66,155,218,96,67,144,194,181,52,128,80,194,30,218,58,190,183,58,-72,100,71,238,135,93,247,227,107,71,74,214,247,91,55,213,28,108,233,13,-230,91,32,195,16,104,222,232,33,124,153,247,98,109,112,215,224,174,159,21,-61,52,198,157,194,47,174,83,149,76,200,85,37,169,119,49,214,15,227,78,-109,113,142,76,93,50,179,21,199,177,126,31,152,107,162,227,98,27,98,151,-219,4,178,28,161,83,249,172,18,213,69,242,191,181,200,232,229,30,158,131,-232,196,243,249,39,197,194,55,2,108,155,194,216,174,182,227,78,188,221,151,-116,254,44,105,108,42,205,210,127,91,86,148,24,129,176,196,89,229,83,8,-236,155,254,80,4,172,22,80,59,240,76,88,162,95,168,136,88,59,2,173,-39,126,152,17,153,76,230,62,149,183,158,248,81,209,124,77,86,229,175,41,-0,119,104,155,52,54,208,186,240,162,125,67,187,249,100,162,136,116,135,236,-118,219,115,216,85,34,90,167,205,149,48,203,33,6,232,75,75,27,10,209,-196,240,78,8,238,4,50,76,199,224,98,214,200,211,55,146,124,168,228,47,-146,122,206,75,127,151,172,75,8,28,201,12,44,232,249,157,78,8,115,73,-52,41,82,137,146,162,83,9,193,43,110,194,103,160,169,83,151,42,4,112,-65,17,24,201,203,205,83,11,139,194,110,30,124,249,190,117,140,252,216,227,-200,59,11,141,156,183,66,190,76,99,222,131,252,162,58,101,83,50,141,253,-213,173,210,57,78,130,171,65,71,73,229,253,81,181,205,234,75,233,19,31,-0,183,104,116,62,118,243,169,135,201,251,5,127,54,118,238,64,84,107,192,-182,53,8,84,211,26,210,247,174,203,68,118,184,10,54,43,15,155,82,21,-54,109,152,33,112,73,41,83,56,148,27,179,43,145,206,6,86,175,206,250,-219,43,106,79,67,161,34,136,70,192,254,198,79,1,1,130,162,33,227,137,-5,231,118,113,38,98,57,241,68,125,132,114,234,110,148,179,15,153,241,181,-55,158,47,65,126,120,125,204,155,4,237,50,255,118,83,158,189,126,171,78,-101,142,23,215,232,185,42,53,66,212,203,28,235,97,0,174,188,5,10,23,-163,30,49,49,211,110,18,149,134,170,241,21,200,55,152,45,185,48,59,85,-54,61,115,198,46,118,178,187,247,39,252,108,198,244,194,250,70,67,112,174,-249,237,97,15,31,202,87,237,8,82,115,139,200,166,127,141,213,242,134,108,-221,41,57,178,133,187,214,81,10,221,7,141,58,132,75,141,93,162,239,116,-193,0,175,106,100,216,161,64,13,87,200,153,228,3,198,116,195,41,160,4,-240,198,86,214,62,183,245,108,181,4,214,165,247,138,234,13,24,93,71,164,-227,53,30,250,61,207,4,255,81,244,186,122,113,20,25,186,238,43,191,51,-198,105,232,136,177,56,185,226,89,234,59,157,35,123,245,52,35,160,107,171,-220,106,20,226,103,134,212,151,95,165,211,33,109,224,8,13,191,40,243,155,-233,150,8,66,18,200,93,215,118,125,238,142,209,74,205,174,126,207,217,235,-99,213,172,119,133,237,220,209,195,107,215,117,95,226,76,12,72,52,103,218,-104,59,31,30,250,224,77,239,136,44,135,223,151,183,205,87,190,114,250,199,-31,101,126,80,54,43,229,152,251,220,93,65,231,161,210,122,144,207,82,232,-123,231,180,0,163,102,110,30,122,42,240,177,160,97,205,132,50,137,152,204,-250,74,235,95,225,94,253,6,83,98,37,70,54,187,36,196,237,94,197,200,-26,13,193,89,38,130,90,168,108,234,0,198,4,37,250,225,129,61,24,38,-86,11,57,4,40,169,171,110,3,152,244,36,179,223,202,130,25,8,26,97,-178,33,31,114,238,205,113,13,159,189,189,86,79,73,162,204,196,228,160,60,-165,227,210,77,255,62,233,160,140,219,231,117,51,163,140,106,63,253,23,133,-10,244,97,159,177,230,204,82,115,78,1,217,62,61,134,42,196,115,56,85,-149,172,187,7,207,20,5,148,189,188,49,107,45,14,190,127,226,64,232,228,-206,206,158,92,145,75,136,11,27,253,22,71,144,40,8,153,249,163,101,110,-68,229,123,159,231,42,108,124,78,65,154,59,90,134,169,235,54,112,195,243,-21,26,126,87,34,5,213,223,16,155,125,10,200,117,74,214,5,229,88,122,-64,78,87,190,136,171,112,205,231,135,208,50,40,52,169,112,237,143,158,141,-207,136,141,245,169,239,14,217,234,190,93,176,22,253,88,170,231,51,208,57,-78,253,108,171,214,92,13,64,119,247,57,137,255,117,24,16,219,134,189,16,-149,28,90,243,83,254,165,230,152,75,17,183,190,18,37,164,150,51,250,84,-178,55,30,101,95,213,237,57,161,167,81,84,62,180,189,220,4,208,234,221,-1,178,81,16,243,15,154,141,16,180,214,73,232,148,176,211,87,187,234,77,-65,24,241,132,234,198,175,188,51,108,92,229,50,104,196,144,19,253,119,214,-139,59,78,158,24,194,222,68,160,107,164,84,124,204,101,24,222,49,110,8,-36,28,63,245,219,103,237,218,228,35,52,206,244,109,115,148,7,85,228,213,-116,24,204,161,15,16,49,241,95,163,228,203,46,73,124,204,176,190,176,188,-73,95,250,216,196,25,204,252,231,114,204,20,127,76,19,118,37,2,126,149,-176,209,24,239,190,29,189,83,164,191,253,130,24,156,87,81,254,139,51,137,-195,132,182,218,200,66,51,133,53,55,75,198,159,75,195,230,196,117,49,248,-126,243,45,73,244,227,226,176,24,66,252,250,208,54,240,119,182,63,149,40,-158,252,228,224,124,186,252,145,129,237,32,225,25,246,133,95,243,147,194,171,-131,133,42,97,229,122,160,28,225,42,181,209,138,64,180,180,175,129,210,165,-193,253,178,20,191,205,56,214,154,190,81,137,115,203,177,133,11,67,126,236,-65,19,229,173,210,102,90,209,73,90,213,168,47,146,25,92,118,216,179,82,-228,73,8,242,227,22,99,153,87,93,61,119,97,247,145,55,118,224,205,85,-197,91,225,124,148,189,50,72,254,136,34,151,12,162,30,60,64,40,112,33,-25,195,102,237,52,246,186,178,207,159,153,120,184,221,165,74,54,234,94,235,-105,18,150,251,200,191,167,77,59,37,249,248,144,180,215,97,38,37,132,42,-46,70,226,140,111,77,154,146,169,22,21,219,75,19,213,200,153,128,19,246,-80,71,151,161,73,191,229,94,247,116,212,72,5,130,199,34,73,204,250,225,-248,5,149,55,197,169,243,140,93,148,171,80,9,125,73,245,86,18,165,165,-28,230,210,166,112,21,195,17,35,193,120,232,210,115,75,4,250,19,191,226,-110,27,39,156,123,71,58,208,239,211,183,173,245,203,229,190,23,182,127,223,-108,66,145,147,142,188,84,176,151,201,231,7,226,59,226,69,180,111,60,27,-211,66,238,192,180,3,110,32,115,194,206,197,41,57,60,133,169,144,207,73,-239,4,60,40,110,117,197,13,243,118,42,110,172,48,38,122,57,85,218,45,-180,81,42,223,197,253,21,160,228,234,94,156,176,245,118,253,158,225,70,102,-198,229,31,164,35,134,103,16,195,179,106,113,133,23,0,46,19,145,179,118,-28,170,46,3,254,233,222,209,193,74,111,153,247,250,149,194,229,218,205,43,-221,123,110,194,80,129,182,227,244,47,235,222,253,229,101,50,94,37,76,54,-95,230,115,188,165,101,128,33,108,249,204,40,245,179,242,16,104,181,183,60,-61,146,44,222,127,92,16,56,187,176,77,15,196,251,188,222,50,51,71,233,-209,170,205,5,253,120,83,213,13,93,227,1,201,115,156,104,22,125,161,153,-146,230,229,33,91,171,20,127,56,252,19,237,207,58,42,10,49,126,237,8,-251,155,136,80,7,107,38,229,191,195,173,66,199,205,59,188,132,5,14,239,-13,182,215,181,243,224,68,151,238,91,212,170,147,73,157,160,55,165,246,250,-203,181,47,168,132,112,127,117,127,69,174,237,160,225,98,13,138,146,155,149,-238,184,128,114,69,179,17,5,148,155,59,0,79,20,198,115,107,30,195,66,-122,120,198,114,228,106,145,68,255,214,205,141,51,24,254,45,82,149,90,58,-73,141,33,124,143,138,229,61,63,232,195,236,30,203,127,75,124,139,56,121,-100,180,66,232,170,193,79,110,127,35,10,221,185,124,222,3,112,99,48,254,-9,217,118,142,38,153,211,108,99,242,54,30,88,180,80,168,92,115,89,196,-62,224,169,155,210,162,9,216,60,211,218,161,252,99,254,116,254,8,140,106,-202,146,32,235,43,234,127,10,37,241,6,135,33,100,79,27,192,190,205,142,-62,232,146,25,186,197,49,3,246,211,156,7,92,118,150,91,125,223,65,196,-5,169,58,71,26,92,224,65,193,133,87,7,5,88,176,135,111,188,182,97,-20,152,18,138,242,102,127,248,203,5,78,215,182,53,227,132,56,239,216,182,-132,121,236,232,33,69,110,47,95,37,190,117,103,218,255,40,101,175,102,188,-85,200,44,223,57,246,148,184,92,220,101,31,187,87,186,171,20,20,200,43,-225,73,182,125,120,89,126,43,192,239,32,138,10,74,33,252,74,208,34,142,-120,3,205,134,53,106,164,196,40,63,178,58,189,210,227,217,227,107,65,63,-74,151,196,211,70,1,120,196,106,186,0,224,70,120,197,61,223,111,94,146,-19,71,84,29,68,79,230,26,117,159,237,230,102,205,42,142,138,206,174,213,-157,3,51,174,35,103,40,53,69,217,5,153,40,88,82,243,105,163,201,185,-90,169,158,52,250,169,35,53,19,130,43,103,113,61,212,106,33,15,82,133,-213,173,43,97,253,68,147,248,164,212,29,148,175,107,251,98,51,46,124,101,-171,168,119,179,212,113,110,184,119,135,60,198,211,167,80,229,42,130,3,122,-55,170,185,152,16,139,55,85,234,174,39,240,133,178,190,243,120,165,171,35,-208,29,28,198,204,27,24,170,113,31,181,20,20,104,205,6,61,16,27,230,-56,61,128,209,169,169,128,225,51,93,161,181,98,68,105,222,206,184,236,92,-232,61,215,102,13,242,64,210,156,93,229,179,164,41,88,242,167,175,168,70,-154,98,2,215,153,58,124,197,82,217,19,210,213,246,8,79,60,146,116,98,-88,48,237,28,136,98,63,62,102,25,45,151,102,43,11,119,188,134,190,109,-200,160,60,240,113,145,130,207,84,128,112,44,185,6,173,126,207,106,228,75,-205,241,20,120,142,172,129,33,225,93,152,163,173,76,79,227,42,211,112,84,-225,92,115,112,137,163,17,16,46,194,165,82,27,37,205,252,51,143,205,24,-34,241,227,181,220,115,189,244,95,1,17,30,254,170,233,194,215,131,249,22,-214,3,8,192,152,6,168,169,170,30,1,67,228,94,214,203,24,28,217,81,-119,184,70,46,50,14,229,246,214,120,136,184,233,66,11,202,111,175,57,26,-186,79,74,164,231,75,122,103,40,105,152,66,203,131,133,208,116,22,216,111,-101,215,232,178,26,255,141,1,213,184,253,172,174,108,227,0,4,10,75,67,-199,134,59,238,102,82,194,208,193,187,208,33,135,87,159,148,176,115,76,17,-8,45,213,29,39,187,100,84,154,9,119,81,216,96,128,122,39,87,11,73,-252,154,123,107,103,130,53,243,106,237,198,73,31,241,30,88,93,65,254,209,-88,88,77,85,35,174,163,250,245,18,83,2,25,131,234,176,107,188,64,136,-29,74,165,255,165,120,113,213,183,207,119,24,11,35,252,253,233,244,172,203,-86,103,109,216,63,143,62,18,43,113,112,55,7,142,17,103,54,159,228,170,-92,206,135,132,243,206,212,12,195,137,79,199,226,142,126,86,175,95,97,129,-143,99,168,213,179,203,36,193,79,40,177,170,68,105,94,245,68,233,9,43,-96,27,240,179,96,176,33,99,239,24,144,159,127,237,177,227,158,101,252,156,-38,237,97,10,149,230,183,91,79,59,178,144,9,156,248,23,174,142,104,80,-218,220,113,244,191,138,161,43,230,27,14,248,185,181,205,212,184,194,235,136,-14,149,35,255,210,62,11,250,232,127,216,39,165,4,120,9,34,121,145,38,-3,113,65,248,92,192,178,193,23,185,61,225,181,106,101,104,14,106,114,161,-91,110,202,155,55,64,19,20,78,123,172,70,126,47,13,54,69,135,126,218,-230,107,111,146,167,218,137,30,126,68,99,168,122,253,240,50,205,192,171,244,-28,214,90,96,128,62,164,160,152,222,31,155,137,133,185,176,74,247,81,136,-42,194,48,72,137,144,240,173,194,83,7,246,48,13,242,20,195,80,147,213,-184,55,234,220,146,236,77,169,176,154,172,179,173,184,161,160,169,33,83,135,-216,64,137,116,80,181,59,197,131,2,217,239,13,194,187,159,7,237,206,115,-157,165,216,11,25,51,30,4,129,12,30,198,53,137,186,127,56,76,243,23,-173,0,94,161,100,228,108,34,183,44,152,38,128,146,212,77,98,255,235,110,-84,190,32,87,122,181,137,51,215,156,175,50,127,158,172,32,170,87,94,121,-105,153,47,89,149,138,176,94,241,45,99,81,67,244,31,91,77,240,15,249,-60,156,62,16,24,239,102,41,182,176,218,234,20,144,235,199,198,112,229,17,-120,123,91,245,90,82,18,251,67,227,38,2,8,105,98,6,106,82,70,62,-106,232,52,137,163,53,233,42,90,191,131,119,117,200,75,100,212,191,72,69,-78,33,191,10,174,180,76,178,133,206,5,109,250,77,62,127,72,16,229,135,-51,29,4,12,149,193,238,154,39,193,95,18,4,134,36,117,125,250,153,171,-255,31,17,214,150,172,196,46,150,24,147,193,203,219,244,240,1,196,152,126,-74,108,96,142,234,138,48,215,199,35,181,21,233,172,130,1,177,103,10,1,-204,147,209,183,166,163,255,194,133,100,248,20,72,139,35,116,60,76,159,163,-7,239,10,167,231,58,141,56,72,158,74,251,224,150,192,219,72,48,221,173,-6,222,114,226,51,193,61,53,180,59,236,93,112,175,213,128,245,227,195,113,-46,1,86,16,74,246,38,180,24,61,121,135,234,154,181,9,246,169,179,47,-243,92,204,219,136,133,104,95,253,64,246,250,3,247,80,213,220,145,2,33,-113,246,193,191,144,218,190,99,85,38,164,30,207,199,73,30,150,132,62,62,-195,136,31,11,57,11,55,180,131,61,215,137,86,227,83,237,133,139,205,24,-24,215,151,196,188,112,4,179,191,247,73,233,228,40,153,247,239,51,151,99,-227,169,45,164,196,108,37,182,165,215,158,233,16,65,46,68,160,137,7,177,-150,75,52,89,124,221,167,159,213,77,168,13,30,117,204,135,131,115,17,160,-231,42,29,176,105,231,119,108,130,83,59,125,39,92,112,94,28,247,241,180,-155,212,67,205,131,42,50,47,127,138,162,127,8,74,164,78,17,126,130,74,-237,11,117,63,226,124,194,56,176,31,70,238,211,250,75,148,58,126,242,37,-18,122,121,219,220,6,100,153,160,158,113,44,7,225,67,127,135,69,28,111,-244,217,189,42,240,222,55,146,60,211,192,255,74,151,146,174,126,221,18,193,-96,153,181,40,53,204,67,64,149,171,60,217,91,28,25,13,44,12,101,219,-165,113,219,118,176,159,82,216,54,226,61,174,218,85,174,82,240,248,43,193,-42,171,99,98,58,20,176,214,160,190,109,225,177,90,68,197,166,111,251,125,-133,154,141,117,108,117,96,179,153,242,96,182,26,170,217,71,37,186,28,239,-34,224,58,52,222,216,185,66,89,219,186,117,197,166,14,235,239,52,234,43,-57,65,145,182,70,134,173,233,202,26,196,121,197,23,182,97,7,141,8,45,-223,19,192,217,13,207,124,240,180,197,204,155,155,10,209,14,206,54,173,38,-144,189,151,174,159,49,42,90,127,150,101,162,205,240,166,167,208,25,175,133,-157,156,225,135,51,210,6,197,215,209,143,218,192,129,4,169,106,27,114,113,-111,210,139,149,139,125,92,138,40,53,146,217,126,209,17,197,93,72,88,156,-59,166,220,23,63,68,167,87,211,226,187,185,63,198,39,75,79,208,106,140,-128,126,232,190,254,218,30,223,187,92,197,117,10,26,146,43,202,90,20,182,-44,232,1,155,4,134,134,142,247,52,120,59,99,65,169,153,102,232,24,139,-90,222,240,89,181,184,190,140,77,109,85,192,53,209,13,97,249,30,66,73,-123,241,174,180,89,238,141,90,196,109,217,73,59,254,131,171,77,199,92,108,-162,249,27,28,24,213,82,75,178,98,183,190,250,29,149,78,17,18,251,104,-50,118,173,176,246,140,87,234,9,94,87,163,181,117,78,136,184,92,38,207,-254,62,222,26,39,97,237,244,165,103,200,183,230,21,170,85,255,242,163,143,-222,250,207,219,70,212,56,174,193,52,197,142,73,110,241,45,209,168,132,61,-232,231,158,252,126,83,217,199,157,9,163,245,126,87,152,133,183,41,2,231,-123,14,61,166,140,60,78,189,125,1,238,13,90,21,123,219,207,144,209,246,-232,33,122,206,2,231,126,85,3,112,246,157,228,154,159,174,220,224,194,211,-166,27,69,0,115,201,39,13,2,150,94,158,124,16,2,225,231,101,84,64,-148,66,222,223,87,30,92,226,91,179,170,219,75,29,184,44,90,121,113,180,-90,40,192,249,232,164,107,187,16,68,148,238,89,145,218,14,142,38,2,207,-159,65,123,216,146,95,244,140,159,117,222,125,215,239,55,79,34,244,148,52,-9,42,91,85,92,254,3,128,159,55,88,17,226,25,151,192,251,57,239,202,-41,181,154,151,126,243,238,12,124,114,167,105,85,69,244,250,30,239,9,210,-138,46,35,72,16,225,33,238,174,43,134,224,232,83,112,160,253,88,225,57,-249,187,231,148,0,184,72,63,130,164,197,3,38,53,212,147,179,46,196,163,-82,181,147,152,84,73,135,76,43,153,52,33,169,64,59,98,33,154,67,45,-211,126,200,161,80,172,190,63,126,215,152,3,1,36,219,166,232,156,88,122,-245,229,189,245,135,15,156,123,3,43,214,24,246,253,26,182,54,76,25,193,-104,45,246,118,134,248,87,141,0,55,8,77,19,193,146,159,134,40,208,142,-21,211,202,213,115,251,204,7,206,136,228,27,81,175,11,78,81,76,45,202,-32,214,159,229,56,69,65,31,216,94,214,124,51,124,169,214,241,120,78,254,-144,3,155,57,165,126,172,47,14,95,55,187,56,207,103,207,105,49,78,43,-178,155,26,247,182,31,144,57,146,29,45,53,91,200,182,115,103,247,129,139,-127,131,162,82,92,161,85,44,194,164,41,2,227,223,163,157,169,235,183,134,-86,215,56,7,12,119,14,54,172,91,255,35,192,29,140,115,205,120,154,102,-38,141,7,25,178,16,51,146,92,99,172,131,150,223,107,231,177,226,228,115,-125,231,241,172,170,83,110,164,70,157,124,249,224,205,165,167,67,81,172,70,-147,155,120,81,146,97,169,45,123,169,61,217,179,12,41,58,51,180,109,111,-6,168,68,129,123,81,219,174,251,249,153,126,75,56,219,236,203,212,12,81,-236,183,35,150,136,48,186,102,212,68,102,136,175,104,97,81,33,254,171,83,-42,222,45,74,130,223,32,175,18,14,74,110,103,82,143,91,15,133,110,86,-238,40,143,64,80,155,14,177,10,133,106,176,169,241,199,189,248,40,216,2,-171,106,61,196,156,0,211,109,101,104,35,192,102,126,23,56,79,132,164,104,-48,134,84,182,129,11,211,144,91,188,95,230,159,11,134,14,171,165,249,109,-90,160,245,38,61,152,218,142,51,21,41,17,238,108,36,69,82,36,36,15,-183,137,43,222,120,253,203,244,69,50,237,233,222,142,69,129,49,123,202,246,-118,157,1,246,99,72,213,106,254,103,242,56,23,222,35,62,42,159,60,40,-40,202,30,175,132,190,238,46,178,160,227,7,162,38,100,17,74,197,0,58,-167,251,249,122,134,142,118,133,22,91,244,84,97,235,180,74,211,235,57,254,-150,130,174,190,18,2,116,98,136,164,146,93,17,73,169,135,159,20,3,150,-245,31,185,229,121,111,146,6,250,75,188,216,80,198,228,107,207,151,252,118,-171,59,85,128,28,126,90,139,205,14,183,68,60,220,146,51,32,110,78,161,-115,167,93,48,73,185,183,199,18,115,97,158,234,159,231,178,14,31,131,214,-129,233,143,219,26,253,21,67,156,192,134,130,147,124,147,57,174,46,203,121,-36,232,141,254,0,13,160,173,109,131,38,251,70,218,208,211,70,4,118,231,-209,38,56,12,161,111,152,83,97,112,167,62,204,121,227,28,4,70,142,225,-91,194,25,197,238,86,29,237,240,16,129,31,125,124,198,27,74,32,66,140,-210,41,45,204,209,160,204,250,233,134,183,165,34,140,59,176,63,182,233,210,-79,3,84,213,172,117,246,65,43,34,98,53,27,57,160,118,36,39,152,230,-255,76,122,15,12,33,80,168,46,243,104,14,153,222,158,158,166,115,9,24,-239,255,202,168,124,218,34,35,156,49,47,219,241,37,237,18,177,151,222,128,-162,219,34,166,23,23,212,159,145,148,229,163,64,36,168,244,50,239,209,209,-198,122,125,177,138,242,8,204,125,178,224,34,45,177,97,131,30,188,237,144,-142,233,185,51,41,111,114,220,229,39,230,236,88,5,43,211,125,20,184,149,-80,239,23,29,88,103,218,56,230,42,46,150,233,11,9,140,226,61,174,215,-151,84,32,241,9,197,20,163,80,201,226,140,226,75,123,5,39,236,12,240,-24,31,84,22,85,40,134,143,201,150,237,159,239,149,1,136,76,195,205,48,-42,114,143,0,87,224,240,26,205,122,193,78,105,34,222,173,6,90,204,201,-141,4,174,42,179,105,10,32,52,61,32,166,49,235,34,156,129,127,172,183,-97,5,115,205,192,93,72,62,68,252,167,156,216,134,62,55,115,156,189,224,-25,232,74,88,58,105,86,97,248,220,48,216,161,206,124,98,9,159,105,118,-247,189,206,40,170,202,26,24,70,7,41,122,81,131,69,97,57,171,243,63,-229,184,189,245,82,134,231,11,135,11,48,233,211,152,139,150,229,30,58,255,-43,213,213,5,89,95,74,5,156,65,247,109,47,77,75,149,17,46,111,229,-115,11,59,151,170,160,77,112,103,152,52,122,226,57,2,38,177,118,78,239,-159,62,187,253,162,107,72,251,139,47,6,108,112,180,209,145,63,2,138,227,-208,253,210,203,226,130,82,44,181,171,106,102,129,108,171,113,17,233,137,86,-126,245,221,16,120,212,81,57,1,101,125,158,91,26,79,215,75,9,236,254,-162,201,186,68,11,70,251,22,153,149,248,148,150,98,29,107,254,189,233,125,-55,214,210,32,43,23,10,55,189,218,193,98,82,242,236,16,170,183,11,110,-77,35,31,158,20,169,111,11,210,129,43,98,211,195,230,32,74,151,9,135,-151,128,136,73,201,19,199,62,54,57,83,37,170,130,52,180,127,174,248,252,-18,115,206,241,126,48,183,157,221,245,95,90,119,178,129,104,13,70,130,178,-15,225,160,46,217,80,88,223,254,128,156,67,116,155,93,103,122,156,221,63,-30,115,228,232,71,52,128,247,121,47,29,46,103,16,197,51,62,35,100,222,-231,103,79,153,72,242,76,42,210,236,147,240,31,15,157,227,15,165,41,176,-31,145,110,212,14,38,92,177,28,107,118,197,232,84,106,160,147,64,116,75,-252,21,116,193,150,178,175,32,162,46,206,15,106,206,30,81,255,17,244,135,-198,39,233,160,11,70,225,232,13,56,43,60,98,51,170,173,34,32,206,49,-69,17,124,228,160,109,151,158,213,241,111,23,132,23,24,239,210,74,59,2,-78,175,192,248,16,250,40,178,107,218,192,241,150,125,144,76,151,189,44,250,-79,76,190,221,125,249,146,6,85,236,66,107,30,178,45,189,240,239,215,137,-190,2,207,153,138,1,145,15,59,71,206,76,53,186,63,48,94,77,177,239,-59,203,251,34,185,226,89,58,166,234,121,29,145,158,179,147,212,90,32,239,-88,115,40,82,184,215,202,217,35,51,126,1,46,133,243,216,230,38,57,136,-137,140,207,22,239,0,134,240,194,200,204,4,113,171,159,44,237,144,130,105,-23,212,255,35,227,141,81,75,246,0,86,98,87,208,254,236,246,63,129,63,-188,160,128,245,144,164,63,225,41,149,208,224,156,153,178,159,27,17,15,42,-97,11,26,163,187,75,83,83,151,175,210,205,59,43,206,225,120,26,75,216,-169,17,72,42,220,26,80,246,179,8,176,192,112,9,203,128,192,62,67,176,-246,232,95,27,52,161,44,7,252,112,76,118,37,168,218,158,167,234,206,13,-231,215,162,49,170,192,28,198,3,220,2,6,139,118,193,140,165,137,220,108,-88,104,56,243,205,124,59,89,181,117,238,249,137,28,223,42,184,254,213,105,-150,179,108,73,78,116,42,79,68,14,195,57,113,243,9,57,217,214,95,246,-172,82,66,224,186,168,213,116,143,69,117,78,124,140,246,86,78,172,119,67,-112,199,161,143,205,254,41,145,152,161,101,36,184,1,162,230,22,57,56,141,-189,223,143,170,205,117,29,233,186,234,124,138,42,231,88,81,133,114,222,134,-189,10,72,44,48,74,83,177,218,187,224,8,199,197,204,249,239,148,245,231,-130,157,111,184,60,14,125,4,197,220,217,177,214,26,54,144,90,30,237,165,-231,5,93,125,151,78,246,55,139,11,192,168,170,206,241,174,103,204,232,124,-90,48,69,120,7,102,241,157,26,114,155,185,214,207,56,74,242,103,242,118,-74,134,16,232,221,139,224,253,191,50,20,127,141,1,6,190,194,166,122,138,-139,173,139,105,47,116,237,213,148,170,17,188,189,238,193,137,191,214,139,3,-62,146,62,18,199,78,246,233,221,246,99,33,229,172,10,56,145,47,4,197,-37,37,190,254,85,55,121,21,162,69,245,88,2,145,202,20,179,193,197,53,-54,90,103,210,138,217,81,143,123,228,116,29,78,222,196,88,223,179,201,45,-126,31,93,146,53,135,199,17,213,7,91,61,244,26,164,25,8,190,36,25,-137,153,3,139,221,46,194,251,215,102,233,61,230,226,18,120,103,87,85,166,-32,251,77,101,228,238,157,130,216,90,65,217,137,135,215,94,231,148,198,121,-164,188,92,156,9,238,199,166,223,102,55,99,78,185,192,229,63,164,214,214,-123,164,208,18,57,9,183,230,162,72,159,1,206,208,194,57,182,53,48,214,-57,109,172,139,175,60,106,236,246,143,232,91,43,239,236,36,94,190,252,243,-254,167,212,208,219,16,45,205,155,146,250,161,25,65,86,188,236,12,130,118,-233,170,178,192,18,151,20,212,36,208,226,113,17,81,200,55,7,215,57,199,-237,139,203,245,17,94,10,79,117,178,240,49,246,108,105,59,211,216,167,203,-213,17,43,105,22,157,217,225,187,135,136,180,176,130,209,158,101,188,5,17,-59,115,79,243,157,49,85,204,7,82,127,44,45,1,225,77,189,110,49,110,-209,83,227,65,46,49,16,205,251,206,187,67,95,56,93,198,124,112,129,97,-75,152,156,72,22,22,177,62,43,93,246,61,101,131,196,18,88,230,133,1,-189,163,93,6,100,48,76,184,117,63,245,56,182,80,110,245,102,143,249,242,-142,82,129,96,41,212,59,0,174,229,130,102,138,247,78,141,29,213,178,61,-3,243,227,252,91,8,251,71,67,91,67,175,187,193,202,77,172,155,138,236,-200,131,231,197,16,159,113,223,79,37,173,192,173,61,228,164,15,234,57,138,-59,201,199,106,58,254,50,112,103,10,245,40,89,157,106,147,181,123,242,85,-255,54,64,247,225,183,35,210,68,160,43,57,254,225,159,239,44,98,51,20,-127,138,21,32,78,56,16,157,130,53,246,118,103,6,245,79,132,180,110,81,-42,156,231,107,5,153,172,37,88,35,182,155,183,152,211,13,248,42,4,222,-82,186,89,180,153,211,81,243,187,6,243,69,178,94,254,72,188,210,115,49,-10,1,37,85,132,21,140,187,184,59,5,55,244,233,144,249,164,25,249,161,-12,193,83,225,40,212,53,100,155,61,143,65,244,24,249,230,195,198,109,166,-210,90,137,181,232,145,120,12,154,25,170,52,88,35,231,69,195,130,123,226,-152,131,121,199,223,134,35,41,141,76,127,58,236,15,239,135,192,109,244,48,-71,68,32,67,250,32,252,162,182,237,142,123,54,153,62,64,223,151,128,13,-188,148,199,23,37,226,106,214,9,208,171,138,48,27,201,60,141,111,53,123,-119,160,163,140,96,67,71,50,132,196,92,223,241,181,34,50,206,8,119,163,-238,159,76,248,131,111,116,224,59,22,125,120,135,204,72,136,213,190,234,127,-167,248,218,46,156,71,181,39,119,141,153,13,123,190,161,199,207,225,130,120,-101,167,142,102,104,201,199,41,154,212,38,26,71,127,240,16,112,17,191,66,-135,76,4,109,45,122,158,33,6,31,131,11,232,19,165,229,108,51,135,140,-137,196,146,142,237,108,19,54,216,229,196,243,207,115,176,207,140,27,2,19,-203,27,188,241,79,83,235,249,229,163,157,146,63,79,144,197,153,247,55,168,-155,187,121,110,60,153,226,76,89,195,88,96,226,211,111,47,136,160,96,16,-97,62,196,22,19,27,143,46,192,188,139,182,246,233,71,26,202,154,38,214,-113,231,214,46,143,247,244,140,8,148,16,47,242,85,202,241,54,255,40,231,-184,176,224,53,130,212,202,26,241,79,66,231,113,19,65,59,255,125,106,16,-35,116,51,121,93,129,168,169,197,11,132,102,16,50,212,130,69,132,149,0,-8,102,72,24,180,124,84,230,94,111,39,173,166,95,186,236,232,102,184,119,-18,233,133,76,169,79,63,194,63,50,133,103,59,254,116,22,249,63,187,137,-82,105,62,140,115,233,241,223,98,161,183,140,244,203,28,64,128,125,93,22,-67,89,42,42,211,226,174,198,229,205,73,3,89,204,155,183,156,59,157,47,-244,156,124,61,53,138,18,218,201,197,201,214,187,118,50,227,33,194,248,18,-18,5,108,123,18,138,223,3,201,249,215,206,134,36,65,157,241,54,134,207,-155,167,31,157,2,104,255,255,239,172,145,41,48,61,181,221,68,0,75,111,-5,137,239,173,43,145,226,227,197,99,192,215,250,70,191,142,69,16,254,209,-146,109,187,237,180,90,30,81,14,179,154,110,31,192,91,113,80,149,172,86,-111,3,7,165,25,125,225,161,70,184,210,192,143,127,136,234,216,27,52,51,-193,64,245,200,108,190,162,214,1,221,79,232,83,14,101,38,50,33,155,220,-106,70,65,78,249,208,139,134,6,160,194,168,231,162,7,39,184,121,67,12,-49,18,112,48,200,142,19,60,242,28,135,141,28,68,126,184,70,6,219,94,-134,228,4,35,67,254,206,68,61,152,184,160,95,131,109,192,63,47,46,138,-202,185,108,54,128,107,171,104,38,156,202,21,41,180,131,240,192,177,73,132,-113,164,235,164,27,120,193,221,231,162,134,60,167,241,197,117,205,35,76,104,-197,152,67,202,212,60,233,81,88,147,221,127,227,233,130,116,234,37,77,75,-240,122,225,47,30,175,38,32,59,185,86,145,225,227,26,153,97,164,40,119,-133,178,100,187,119,241,153,138,10,132,184,216,196,40,121,250,253,101,216,89,-180,185,201,86,147,223,66,36,173,80,53,55,229,109,177,171,216,252,45,180,-50,151,144,85,0,14,148,119,161,56,192,73,82,73,128,40,116,160,115,228,-170,154,225,3,110,117,88,177,199,238,245,176,2,180,170,45,144,137,204,62,-175,180,192,106,80,97,121,207,28,92,95,223,75,194,209,208,129,49,200,73,-6,177,23,63,127,91,188,29,23,147,18,5,125,6,117,167,134,35,27,69,-95,117,150,106,26,97,116,45,48,88,23,82,204,186,118,181,189,49,101,190,-155,142,167,249,113,210,20,255,176,116,21,25,207,135,198,91,138,249,32,22,-203,88,36,174,115,70,31,26,74,15,170,18,83,252,66,115,191,183,227,253,-68,240,63,54,243,65,249,225,32,40,251,17,109,197,144,67,193,223,106,30,-19,187,134,59,8,196,82,223,15,172,245,12,122,164,156,126,0,45,205,225,-32,114,18,80,23,115,135,125,155,227,115,228,211,151,215,39,73,216,79,132,-6,69,202,170,198,201,76,252,49,201,232,98,220,135,190,159,75,244,239,40,-163,27,90,7,17,81,191,196,3,196,182,60,98,73,194,121,149,59,145,86,-176,13,59,155,100,129,214,126,152,143,202,66,126,218,129,12,214,45,171,91,-92,67,137,94,207,86,75,145,42,144,194,120,251,100,188,117,197,137,199,110,-175,209,97,76,254,231,19,115,119,47,37,25,149,215,197,215,193,117,70,2,-54,239,213,27,190,148,252,27,13,33,161,70,228,1,45,253,125,221,107,129,-109,78,203,231,221,137,218,15,113,133,81,208,69,133,46,33,69,239,74,45,-139,1,197,57,36,91,20,240,77,192,187,54,99,136,78,150,49,76,158,166,-26,148,165,244,68,210,12,36,88,3,32,228,206,79,101,212,241,44,34,87,-15,202,55,175,134,201,168,194,204,130,70,32,208,64,100,57,27,248,222,229,-16,191,172,94,1,38,19,206,36,24,197,244,32,73,166,184,149,201,233,136,-40,54,191,54,190,114,74,195,156,231,34,160,208,44,133,182,241,130,142,221,-241,64,204,77,160,202,221,233,255,213,240,16,123,166,68,17,2,35,58,190,-92,174,252,43,162,121,222,128,70,71,16,6,9,115,21,252,93,192,24,109,-112,153,98,159,250,164,152,112,41,91,122,183,96,251,129,227,224,237,163,213,-229,110,209,117,174,225,131,9,32,166,29,146,235,96,70,213,182,6,24,139,-159,92,214,154,163,13,38,173,140,95,185,215,61,133,90,252,27,0,132,188,-207,65,179,209,106,253,99,188,62,28,24,151,198,26,36,110,3,105,179,69,-25,252,146,103,87,140,233,184,202,32,115,11,55,212,105,37,30,52,97,42,-33,143,79,162,9,201,103,23,55,187,20,74,161,21,51,13,91,197,64,199,-174,253,249,12,55,11,28,224,237,140,52,190,52,56,152,197,36,111,73,123,-201,212,41,86,240,120,103,71,202,113,60,126,99,138,20,17,129,149,113,142,-16,82,108,226,118,227,226,199,122,23,154,132,198,53,226,244,251,196,77,19,-72,106,170,62,164,133,45,63,188,213,150,101,119,54,179,68,132,192,122,151,-193,210,91,153,32,224,48,57,209,163,243,186,212,132,222,58,35,209,41,16,-249,189,110,18,118,38,253,92,105,228,18,211,132,123,81,69,21,42,221,167,-218,161,198,189,23,59,156,24,50,187,220,126,29,62,156,63,177,196,83,115,-140,102,19,75,113,73,150,153,195,247,31,179,239,70,32,24,201,113,221,189,-222,102,120,87,201,118,228,182,76,22,39,143,249,234,190,38,241,182,25,50,-19,80,46,24,128,136,126,219,101,148,254,58,22,225,197,157,134,224,155,218,-228,104,16,97,254,230,116,57,228,129,199,189,154,184,64,95,18,103,178,172,-225,199,187,213,182,81,244,129,88,79,42,172,109,33,240,73,94,237,11,174,-71,135,73,146,77,56,151,196,189,187,254,58,110,19,7,160,193,28,140,20,-171,11,231,16,48,4,95,132,68,177,164,116,198,14,122,173,119,236,124,105,-83,165,148,252,8,9,29,170,14,150,13,76,222,105,177,211,170,74,254,97,-88,101,234,189,105,45,83,214,223,44,187,199,163,112,157,136,111,214,225,243,-229,213,115,59,83,112,186,175,127,250,97,93,6,21,164,236,141,67,118,22,-30,128,235,43,44,227,46,5,91,110,223,225,122,6,230,100,209,79,73,142,-4,35,118,104,165,51,213,199,58,144,187,76,11,115,23,130,141,230,207,96,-138,223,115,159,161,22,165,200,51,43,226,120,154,6,191,11,209,164,32,144,-59,117,82,3,65,84,86,24,172,80,136,74,200,147,184,196,130,230,48,122,-91,104,164,89,21,22,134,80,200,158,158,147,194,66,222,158,19,44,16,252,-204,206,196,157,82,56,17,8,124,46,115,166,1,77,182,167,42,126,122,14,-153,29,3,87,244,84,225,56,232,41,67,156,204,254,75,58,208,202,116,66,-97,119,96,178,146,49,111,83,251,18,190,182,113,135,145,236,179,121,99,90,-101,105,63,70,33,179,15,167,231,175,173,227,47,212,145,131,156,244,217,150,-66,181,109,225,242,243,63,100,117,235,228,105,23,218,133,178,216,250,59,196,-98,208,2,112,155,41,87,212,18,9,83,41,249,110,185,97,42,92,15,153,-243,95,48,127,66,148,199,195,120,195,3,244,190,106,45,118,183,17,184,1,-148,102,235,60,117,66,95,36,130,101,202,201,153,240,34,240,213,224,143,67,-10,253,144,210,188,209,56,38,39,137,2,194,133,186,223,212,254,162,151,208,-172,162,154,66,176,132,39,207,144,31,93,47,82,25,247,196,208,221,105,192,-7,92,90,109,101,109,146,47,167,161,62,254,215,22,152,98,254,215,181,45,-252,68,79,177,80,75,184,149,76,156,223,148,65,96,145,89,230,240,14,97,-109,23,215,79,35,117,148,201,16,4,198,135,129,102,0,19,204,184,64,162,-112,81,6,179,9,248,46,108,111,190,115,231,25,65,110,132,29,80,39,120,-64,182,190,129,242,79,98,250,13,108,186,134,3,182,126,18,9,246,99,139,-213,242,50,43,79,180,121,5,120,32,54,47,41,108,174,4,188,225,89,70,-203,109,182,219,232,120,56,1,221,48,197,28,87,234,2,138,63,124,196,64,-102,184,204,219,137,240,162,87,155,113,183,12,228,67,202,176,175,132,64,23,-195,111,253,113,5,2,22,88,137,18,18,93,149,248,5,107,78,31,77,133,-180,215,3,97,84,255,52,217,103,12,145,7,91,164,14,8,224,26,87,215,-3,221,43,196,187,148,15,126,21,141,4,14,146,127,57,165,27,97,185,121,-122,106,179,120,54,24,227,11,64,100,44,196,98,39,91,32,72,236,205,42,-86,246,114,85,42,222,98,172,209,251,64,185,169,251,234,208,237,72,118,144,-210,67,106,182,16,191,130,200,50,220,141,169,244,166,158,125,196,108,31,71,-200,138,248,123,152,249,250,187,175,193,48,38,170,89,141,218,243,49,37,49,-15,217,6,244,127,205,170,40,217,235,160,189,254,235,19,221,50,182,97,185,-72,249,53,171,136,9,148,20,51,234,141,165,135,9,98,195,43,200,138,101,-158,41,136,244,173,41,131,69,247,114,21,77,163,36,66,141,150,77,60,192,-74,131,246,219,163,183,230,234,227,62,164,61,27,124,61,155,125,132,43,56,-160,178,8,223,215,73,107,204,130,17,115,118,180,210,151,110,27,96,13,199,-215,194,202,231,203,251,33,58,32,28,161,237,162,185,66,233,121,252,163,25,-119,184,194,248,255,187,86,204,248,179,180,245,240,181,117,12,203,20,124,226,-122,186,109,63,41,111,202,230,183,99,240,119,53,106,63,133,114,136,227,56,-156,250,108,36,25,58,227,147,155,210,238,253,93,240,143,117,117,132,55,105,-57,245,192,138,22,208,4,129,162,171,183,217,184,103,161,20,208,174,129,124,-121,246,167,93,239,92,185,229,87,234,5,152,160,209,155,153,135,102,43,201,-61,206,93,146,104,228,102,72,16,124,195,23,109,24,79,32,39,111,56,44,-21,81,200,206,184,208,167,119,197,84,93,71,155,238,8,46,161,79,176,47,-59,111,6,38,148,79,29,120,238,199,69,214,102,82,28,75,139,212,57,52,-218,29,127,19,27,154,200,67,243,153,221,28,107,9,162,12,233,1,89,207,-153,248,33,10,75,228,62,235,138,48,41,147,181,77,14,71,43,46,202,109,-87,232,116,193,92,166,119,34,13,158,5,136,213,241,91,215,186,28,124,144,-156,239,137,70,255,133,161,212,166,146,19,94,24,233,223,215,86,66,221,64,-6,187,252,254,56,181,172,95,87,8,75,165,111,226,193,156,25,145,57,127,-30,125,94,61,135,184,250,129,163,245,120,130,163,94,208,89,104,252,138,7,-69,124,105,73,179,121,98,220,89,161,40,68,51,2,243,143,103,70,247,178,-87,167,72,145,50,42,184,223,130,215,222,227,59,118,81,172,144,180,166,172,-189,180,52,255,22,85,135,112,176,83,59,96,193,105,129,34,206,246,23,164,-63,214,184,244,38,78,73,238,97,132,198,132,177,56,163,89,53,254,168,164,-149,153,15,109,114,82,114,82,24,9,82,37,93,185,72,40,252,4,174,240,-187,73,86,12,221,117,27,222,129,126,137,80,254,182,238,115,67,77,168,123,-34,46,12,235,6,75,65,33,44,57,26,95,206,247,173,208,37,103,4,12,-218,186,32,176,207,128,152,119,231,71,108,184,145,179,0,189,168,166,2,17,-145,73,254,113,191,55,206,140,64,108,166,83,234,42,97,32,149,232,117,76,-132,129,153,221,114,116,209,38,207,247,47,28,74,95,110,56,246,162,230,141,-238,196,81,45,249,7,189,209,58,5,247,0,151,243,53,236,172,251,55,157,-62,148,185,158,208,96,251,154,14,5,8,62,237,186,4,51,172,186,0,3,-182,199,106,190,182,222,95,155,202,208,16,178,49,164,162,232,151,10,168,44,-156,211,81,21,132,38,74,31,206,13,23,11,135,62,78,185,201,229,254,198,-5,230,58,18,72,202,70,177,22,42,166,6,13,197,4,11,99,22,244,7,-254,162,245,246,148,196,100,7,153,254,152,9,87,144,154,1,136,213,208,58,-97,16,217,124,224,102,47,30,66,22,228,90,126,22,75,172,74,23,143,194,-63,87,105,47,55,191,134,28,19,202,15,225,57,54,166,252,85,139,220,85,-139,12,105,176,59,78,60,1,149,100,132,243,187,13,184,181,172,151,12,149,-86,75,154,245,241,210,143,13,181,44,248,93,65,134,64,116,87,7,83,204,-32,144,6,85,82,130,1,8,180,64,211,250,174,219,40,96,204,2,194,58,-68,135,121,114,42,155,249,5,78,112,29,169,34,209,167,230,78,222,46,237,-78,195,82,179,96,217,139,195,84,253,130,155,249,21,64,125,69,185,154,140,-115,192,31,34,138,186,104,71,198,227,236,96,98,156,127,73,112,10,94,61,-19,58,15,34,29,144,124,249,101,155,188,197,120,162,119,167,145,76,15,55,-107,233,251,119,202,78,238,254,35,255,80,193,134,184,171,142,41,6,52,55,-25,131,68,236,180,59,38,103,59,110,64,214,15,205,74,206,123,127,120,102,-214,252,90,116,89,55,118,172,127,16,39,72,137,168,17,184,58,51,120,126,-41,192,179,162,170,105,52,32,113,189,109,40,80,93,225,253,245,188,137,224,-194,89,233,147,32,51,184,104,42,49,204,184,246,17,107,151,2,72,95,220,-147,232,170,223,68,59,61,178,211,25,13,184,148,133,109,83,53,110,181,25,-21,51,195,119,171,167,169,124,92,154,113,200,223,177,164,135,80,101,211,13,-154,112,223,102,213,47,85,203,206,81,148,235,212,247,74,249,200,36,249,169,-144,59,230,222,190,125,39,4,21,95,95,250,104,43,155,10,3,124,147,39,-226,112,174,143,70,0,187,134,255,194,40,190,228,164,221,193,39,230,9,185,-101,71,35,1,247,107,238,169,8,164,32,215,147,43,136,93,169,215,54,203,-113,131,100,152,196,169,143,194,105,36,4,183,84,8,32,166,41,9,229,133,-243,36,19,155,214,125,255,224,46,78,67,92,241,221,92,37,211,221,83,184,-232,46,251,100,58,117,44,48,184,35,63,140,148,109,142,57,95,196,130,83,-5,158,235,99,184,12,7,58,11,173,160,83,189,53,161,118,69,119,98,174,-101,140,146,22,63,25,200,246,11,89,36,211,104,171,4,254,80,168,78,106,-58,39,233,164,0,53,74,144,52,115,40,196,83,5,252,147,207,98,101,70,-109,161,10,45,15,182,139,132,33,159,181,89,154,152,63,147,148,237,229,248,-224,37,166,38,21,47,162,97,225,57,224,111,88,196,42,240,146,4,88,137,-175,59,194,109,247,125,183,101,175,57,170,85,104,232,247,151,5,1,159,157,-214,58,3,196,187,108,57,51,89,9,201,76,112,250,247,91,5,37,98,31,-125,208,225,71,205,72,143,184,51,24,235,167,30,229,146,232,102,75,174,206,-75,73,19,172,215,175,131,145,94,60,100,164,158,64,142,218,154,21,58,10,-56,2,212,193,127,102,247,245,196,5,191,224,35,59,105,65,211,161,12,43,-1,229,126,66,116,220,150,135,207,224,41,153,63,64,218,152,254,200,153,137,-35,173,124,71,162,55,72,212,199,121,161,234,102,110,44,2,214,151,9,142,-246,188,205,82,93,18,69,147,36,123,77,101,211,27,80,106,189,111,61,108,-206,252,104,197,187,180,55,251,182,137,244,94,224,21,244,78,193,169,101,47,-104,83,36,122,154,159,17,142,145,180,236,43,241,239,161,137,216,82,203,137,-44,226,225,106,168,207,18,10,93,178,237,80,113,233,93,66,47,33,181,119,-23,181,141,220,156,93,97,183,41,198,192,159,55,209,22,183,88,24,154,61,-151,90,135,54,20,204,95,231,54,216,151,21,81,102,168,89,145,33,23,131,-77,135,250,244,115,109,54,190,3,11,92,175,62,195,50,137,114,85,60,249,-159,61,248,68,3,219,72,31,186,234,106,208,232,101,6,106,221,102,12,31,-72,25,255,21,234,200,118,187,46,175,210,227,187,172,130,11,7,10,53,18,-114,103,67,249,110,4,122,189,153,118,151,168,58,104,20,117,58,192,213,75,-242,209,254,253,12,215,181,226,49,161,175,255,90,95,118,196,192,119,110,104,-32,185,15,8,25,232,122,206,126,229,165,226,59,49,215,8,0,162,188,243,-252,100,130,144,238,83,182,205,209,219,138,107,66,195,66,145,26,33,183,26,-192,134,191,60,22,90,32,252,149,82,235,26,13,46,169,159,114,37,234,80,-163,99,79,26,210,148,27,101,242,93,116,88,210,137,215,0,24,194,170,213,-56,82,139,215,121,177,108,182,125,207,193,44,219,94,104,48,45,17,191,152,-205,0,28,224,191,170,18,1,0,120,245,90,89,52,87,239,22,26,236,40,-77,136,138,242,134,63,228,19,156,116,101,239,227,117,145,95,115,130,74,255,-55,54,192,255,24,158,25,26,162,66,191,35,115,51,169,90,55,19,52,69,-233,192,49,175,29,104,156,28,71,254,206,3,73,153,100,168,158,241,153,57,-42,54,139,176,211,73,45,218,108,113,242,131,5,74,52,128,205,172,206,252,-61,136,204,174,252,129,72,0,69,161,1,21,99,218,244,222,223,89,32,23,-135,141,231,102,224,78,217,105,240,88,95,121,173,18,165,25,115,182,68,229,-188,244,203,96,159,130,21,183,36,12,247,123,29,17,197,163,33,177,147,161,-138,174,2,142,37,253,176,254,64,186,125,172,67,4,204,59,58,149,0,143,-50,177,9,76,207,84,135,165,7,213,252,255,112,250,59,142,96,241,99,185,-225,206,227,252,79,143,243,19,129,46,185,169,239,50,201,80,180,160,225,219,-161,175,117,181,187,131,244,88,71,128,208,253,190,100,16,80,73,180,144,56,-69,47,226,150,116,95,60,105,195,176,246,70,202,64,59,17,6,128,149,121,-211,55,184,144,108,109,107,211,2,80,192,41,195,228,111,1,228,14,227,105,-147,83,67,186,14,157,113,139,86,87,180,100,201,19,107,226,170,166,130,249,-117,202,21,142,174,70,234,194,26,56,101,221,64,161,167,188,232,69,49,230,-137,18,155,196,56,214,35,208,94,252,211,154,237,136,206,197,216,79,83,130,-107,50,238,42,236,67,121,152,116,69,116,251,101,138,147,16,231,248,156,55,-190,12,47,63,225,239,72,171,6,192,109,250,156,144,92,135,213,221,230,232,-77,80,175,116,185,161,135,12,160,29,239,38,31,81,158,158,29,141,27,115,-39,72,178,157,205,105,84,168,195,35,61,250,10,46,130,83,84,251,138,129,-129,128,164,159,213,165,152,18,29,51,23,82,214,241,181,45,123,180,172,21,-238,146,206,1,176,131,196,131,127,134,24,8,119,210,27,205,42,145,247,249,-164,227,54,240,25,252,67,164,88,32,154,145,26,178,120,85,21,82,66,218,-44,30,74,152,114,181,216,27,196,26,0,15,84,223,1,75,69,48,237,202,-219,11,0,106,69,17,99,14,249,119,246,28,225,55,207,39,121,121,85,80,-123,208,57,23,151,192,23,234,123,1,198,32,3,178,221,92,69,180,181,10,-73,169,78,211,155,48,221,13,157,168,150,15,243,171,133,103,85,116,78,245,-131,66,78,137,14,186,53,67,242,29,252,238,195,174,181,139,254,199,252,235,-158,192,49,110,180,76,65,82,250,113,28,136,19,154,23,83,97,252,41,166,-42,15,218,35,215,54,91,141,3,172,136,0,132,176,245,94,221,76,229,233,-42,207,99,235,236,53,7,120,218,185,36,128,31,148,214,46,17,139,209,29,-217,215,222,76,66,142,185,31,235,9,224,158,41,55,61,84,37,25,210,160,-30,212,221,243,216,169,7,235,7,184,127,184,2,139,74,200,241,150,195,45,-35,142,157,54,149,89,46,104,184,29,115,210,7,114,212,209,168,11,234,249,-149,42,71,174,33,55,118,133,39,245,214,9,130,122,161,11,255,10,165,198,-214,104,87,41,90,100,168,212,150,212,211,254,63,30,31,176,34,238,44,140,-101,141,140,210,101,124,86,146,220,238,145,81,24,125,226,250,109,206,15,150,-83,149,173,117,203,153,96,199,193,26,111,148,231,134,116,85,11,72,16,63,-183,115,79,162,198,108,74,252,189,54,143,0,82,180,81,145,117,236,1,243,-102,178,118,200,233,237,248,145,73,14,142,231,191,64,213,101,167,173,230,238,-161,156,40,57,58,64,15,218,129,82,205,221,81,197,109,234,48,155,124,187,-72,158,134,38,76,141,192,192,142,103,139,35,151,63,204,231,53,113,247,90,-22,109,234,117,64,208,84,2,46,194,52,133,240,110,116,195,205,52,82,55,-116,45,229,23,93,41,255,3,73,60,64,198,194,165,104,106,150,26,141,166,-214,115,213,186,157,141,191,97,147,26,115,230,147,255,236,171,253,140,214,67,-201,80,77,143,118,16,229,25,198,4,26,19,47,22,60,138,235,107,143,82,-58,64,250,126,148,62,75,132,116,51,95,168,66,61,202,23,126,153,150,250,-129,198,176,40,43,95,238,69,28,252,92,167,125,106,104,99,134,51,69,108,-120,13,135,112,117,164,183,110,211,182,105,70,178,113,229,203,92,207,140,173,-186,60,128,249,214,67,240,54,15,166,250,194,161,162,197,38,16,209,215,163,-184,48,165,154,244,69,141,126,168,89,217,162,104,174,225,73,129,232,201,190,-139,117,230,23,111,100,198,62,154,236,49,205,186,187,239,44,69,131,0,54,-122,31,190,102,121,34,182,215,191,75,30,88,83,90,126,222,22,234,41,62,-72,252,44,125,111,133,149,169,46,192,126,223,155,92,127,215,9,93,238,202,-135,100,201,10,166,130,116,182,51,236,126,112,184,1,57,144,139,195,237,27,-214,224,237,145,92,108,135,95,4,88,146,205,5,90,223,150,54,173,175,36,-70,40,20,15,15,173,111,228,167,198,176,231,77,6,62,235,15,57,85,111,-31,129,80,50,159,88,15,207,21,86,159,26,164,18,47,75,4,43,54,95,-143,253,208,81,172,44,91,49,97,48,80,33,162,91,33,90,176,232,175,203,-51,211,96,46,149,237,143,176,235,177,70,125,169,236,255,211,129,9,70,183,-87,51,42,177,81,34,66,243,235,135,156,196,125,30,1,183,94,199,148,168,-136,213,224,32,143,143,161,122,19,89,77,150,218,68,207,54,211,81,79,174,-157,176,115,11,63,250,188,121,124,235,63,216,119,104,5,116,146,40,195,35,-59,158,121,147,189,28,227,57,236,244,70,209,215,157,12,139,1,37,213,118,-185,108,53,127,74,182,171,190,105,231,42,207,34,197,91,69,251,239,75,58,-212,208,43,146,167,153,4,175,28,206,240,229,78,62,128,76,26,29,110,200,-90,49,69,200,45,33,96,232,165,190,98,139,199,110,111,30,205,192,174,96,-20,49,173,207,132,25,226,158,102,175,45,53,101,3,14,183,51,57,173,203,-85,208,136,203,46,31,84,45,186,8,63,151,141,40,129,194,225,220,162,65,-80,88,52,133,168,150,107,148,185,170,240,16,122,48,212,43,142,218,138,231,-61,12,153,126,127,128,179,107,49,173,9,87,243,15,86,81,186,27,123,130,-149,160,34,3,124,214,91,214,230,188,214,95,181,189,178,21,238,179,47,213,-200,68,155,73,210,48,106,61,116,20,195,206,74,129,210,6,154,133,226,75,-35,26,95,126,100,206,69,219,115,160,103,97,158,47,168,1,172,151,83,208,-241,47,105,134,43,149,109,116,132,113,61,169,62,213,254,35,225,126,231,83,-82,46,235,83,124,212,111,220,158,190,13,11,123,129,142,54,47,107,119,177,-249,223,36,254,136,194,32,194,215,214,16,205,11,30,145,29,13,80,106,247,-196,14,61,87,158,131,82,207,174,138,17,238,246,95,92,39,133,118,33,232,-63,107,26,182,230,36,236,98,161,69,176,83,226,100,34,46,141,151,110,52,-210,175,185,132,33,82,239,4,174,58,132,175,161,102,204,175,221,14,76,24,-201,87,216,114,106,77,20,233,147,219,222,184,4,178,140,199,158,79,110,208,-204,162,90,71,130,108,213,125,199,50,230,26,117,164,130,38,205,173,121,210,-101,125,200,204,92,45,18,100,225,80,119,118,211,249,62,71,233,56,119,71,-170,58,105,67,162,214,192,190,69,142,33,40,253,51,213,154,230,208,90,55,-73,70,133,242,132,89,23,80,148,20,7,250,105,75,161,121,138,75,5,134,-55,83,213,177,194,214,31,229,177,135,15,14,36,35,169,254,227,150,178,75,-204,21,241,211,245,160,175,39,134,26,252,165,67,160,224,203,43,222,213,142,-173,16,102,35,151,249,25,203,55,200,8,49,23,214,186,245,159,181,229,78,-135,205,56,204,194,133,235,176,89,160,160,47,122,77,10,74,245,36,8,166,-87,38,95,67,179,68,15,135,124,203,117,109,48,72,43,18,112,177,237,112,-93,241,49,51,249,29,56,145,15,154,93,26,185,234,142,61,16,195,219,226,-126,15,13,148,179,77,4,78,115,15,74,236,69,72,26,153,229,232,214,253,-160,148,67,57,236,46,35,154,209,216,239,21,42,251,79,19,2,187,2,75,-89,187,157,107,166,118,229,98,220,9,127,153,193,53,99,20,61,114,50,91,-242,76,37,59,105,246,158,168,10,79,208,209,177,143,34,141,204,76,151,19,-253,53,254,177,235,198,251,174,210,163,202,139,76,171,115,170,241,192,103,91,-186,40,221,73,211,157,60,167,156,194,227,98,169,124,40,153,156,122,173,124,-152,28,80,112,113,185,249,72,144,91,95,171,95,60,181,132,241,208,133,182,-108,218,85,84,210,167,34,7,127,113,245,87,17,83,127,196,63,23,224,38,-52,155,128,198,92,101,146,239,177,135,120,218,72,219,205,48,145,102,155,72,-83,122,36,209,227,138,131,125,69,15,193,105,14,19,236,219,22,31,179,254,-37,174,115,241,138,207,89,129,127,218,83,104,59,245,149,186,9,245,58,39,-168,135,116,255,154,57,205,116,55,63,74,182,121,61,229,251,242,128,178,63,-173,19,193,102,37,250,32,169,189,116,98,111,249,89,117,124,24,35,35,145,-119,153,27,199,95,148,57,185,125,183,149,118,230,160,85,74,161,33,46,96,-155,148,0,47,153,230,23,18,81,5,180,49,216,39,201,134,73,200,69,228,-41,154,22,171,152,60,89,229,154,79,130,203,167,132,195,64,229,25,50,74,-38,17,77,213,243,94,38,33,60,196,166,143,33,185,226,53,3,180,70,75,-86,37,149,96,196,63,97,16,137,221,176,124,242,47,180,178,111,150,42,184,-145,158,169,161,175,253,227,216,197,40,16,55,212,249,245,237,87,71,245,68,-235,225,19,105,85,198,217,68,189,16,101,186,207,45,9,246,191,3,43,79,-194,154,94,209,240,94,51,247,48,90,38,200,154,117,119,240,108,156,15,42,-87,175,129,108,205,176,80,193,114,206,146,35,140,101,136,154,58,232,87,185,-205,183,157,91,148,11,127,71,68,23,196,119,67,158,8,19,223,200,138,241,-204,134,157,181,16,77,1,211,193,251,100,158,111,231,118,233,64,87,111,117,-113,68,194,250,71,222,77,208,33,157,206,236,143,128,94,161,234,45,251,38,-231,166,168,110,84,121,25,47,147,134,129,204,99,108,223,114,136,30,241,196,-109,32,166,11,62,159,218,40,109,93,153,100,80,150,38,132,236,119,112,173,-97,127,217,244,217,129,116,118,148,56,169,213,11,149,78,67,13,232,41,198,-124,216,202,168,196,246,129,148,167,170,103,198,176,36,177,45,139,124,97,189,-243,104,191,130,159,44,180,218,98,3,136,231,32,96,218,143,174,30,251,168,-167,128,23,173,5,236,114,165,159,69,225,156,90,12,95,151,31,182,83,212,-217,125,85,99,58,255,70,249,180,170,102,45,128,134,4,157,37,52,114,145,-86,176,97,215,96,19,98,191,117,248,132,108,111,184,135,150,225,228,27,123,-162,11,69,134,121,9,107,244,75,24,51,18,165,250,205,208,45,144,125,125,-88,35,100,36,127,99,64,103,211,42,205,8,53,243,36,80,41,92,197,241,-68,83,24,69,54,22,208,78,250,9,170,156,116,5,23,205,140,175,171,69,-192,74,217,245,60,226,98,197,204,244,114,1,92,71,54,29,202,25,181,249,-183,145,255,118,127,210,148,173,249,195,174,132,70,29,186,185,175,148,163,118,-122,3,205,210,248,155,145,142,209,236,249,226,255,76,216,252,85,228,117,210,-88,66,151,28,98,160,180,18,72,145,50,251,220,105,61,104,185,135,108,7,-140,22,144,11,215,1,228,192,144,193,21,138,50,153,157,100,72,196,253,66,-13,213,59,50,21,172,156,166,124,152,6,25,73,210,47,38,120,90,82,30,-101,78,66,142,42,9,231,116,144,45,227,166,47,44,89,164,126,67,112,90,-176,154,72,239,192,122,171,138,178,143,199,54,106,171,85,53,194,220,48,113,-118,28,4,116,237,251,162,229,225,54,250,52,57,222,116,238,138,223,131,143,-7,206,64,225,184,250,178,130,176,230,140,146,207,8,25,60,113,52,168,94,-175,40,245,141,164,137,139,158,68,202,253,34,186,170,252,95,235,201,93,36,-67,46,61,138,144,110,224,150,235,73,201,104,97,179,124,32,139,30,214,24,-84,134,188,71,115,254,168,159,161,242,160,149,158,17,205,50,178,93,68,8,-144,54,103,255,85,179,243,44,16,142,214,100,73,116,253,144,222,133,197,59,-226,67,255,19,192,111,73,18,85,135,32,41,107,206,161,59,157,233,131,68,-21,36,70,138,224,141,212,151,110,253,182,80,227,79,40,100,140,247,234,142,-244,132,2,88,34,250,28,237,143,89,245,72,108,60,147,91,6,140,156,60,-180,31,59,157,50,177,127,111,60,30,174,130,245,41,162,59,14,83,50,71,-13,136,129,37,242,88,160,48,228,65,129,77,102,60,125,97,50,120,135,249,-140,54,252,51,120,207,198,167,56,159,172,238,231,103,12,162,35,244,183,70,-71,123,225,188,178,162,76,140,171,240,27,193,116,52,82,136,103,133,200,132,-165,38,82,30,57,50,15,197,221,198,61,182,236,8,164,35,174,251,75,56,-0,116,82,182,59,196,247,167,81,250,153,119,117,38,25,181,63,74,183,218,-13,6,172,137,80,214,64,5,208,200,200,25,34,70,43,252,98,67,67,5,-224,0,251,193,200,27,244,20,159,245,139,0,4,240,55,117,197,191,230,59,-20,71,73,198,34,131,155,40,47,208,17,235,84,105,8,209,247,70,253,37,-150,57,123,133,192,213,206,118,75,61,184,158,188,240,242,235,185,136,149,172,-60,75,214,226,48,55,198,197,228,18,92,69,35,122,146,174,205,244,137,159,-67,171,27,62,238,25,171,163,135,206,186,107,6,54,186,59,77,136,157,38,-65,207,78,236,110,95,67,125,96,95,59,22,125,74,12,21,46,69,150,43,-223,65,112,140,38,177,16,105,47,8,192,114,97,159,180,179,179,89,111,193,-98,75,191,27,168,189,194,66,162,165,16,202,126,36,251,217,245,114,26,137,-173,106,48,3,19,131,130,61,204,60,90,209,75,37,113,63,140,90,82,64,-85,64,83,55,50,240,146,80,214,211,130,69,130,158,71,31,137,221,140,147,-146,255,127,167,89,185,118,230,204,222,5,143,222,116,183,54,54,243,209,200,-224,250,143,236,226,250,121,138,42,244,250,230,48,21,105,206,58,194,218,49,-48,106,255,159,71,249,1,96,193,246,95,122,158,4,76,13,66,173,182,56,-112,216,92,66,183,183,227,50,44,142,108,238,213,129,176,51,47,64,230,216,-45,137,176,210,196,31,81,116,8,68,16,22,200,100,75,50,197,100,144,82,-32,246,151,24,31,172,49,98,193,126,55,14,72,196,243,1,133,230,208,93,-206,133,120,223,195,171,165,131,128,139,82,85,50,10,122,150,39,120,23,212,-11,206,160,147,228,20,61,32,70,157,203,231,248,155,16,247,154,187,248,196,-45,255,208,83,43,142,110,239,222,27,85,101,116,76,231,187,106,5,34,231,-34,239,255,107,54,89,53,201,206,56,208,175,217,25,236,152,96,4,93,207,-111,212,134,41,250,47,38,238,171,215,96,174,19,214,173,47,225,209,151,217,-151,130,106,151,43,209,222,43,204,16,46,31,60,41,252,168,43,147,204,55,-12,94,238,43,45,160,198,35,0,14,58,202,48,226,75,134,115,177,185,81,-219,13,33,245,143,80,44,27,85,214,69,119,113,153,92,28,171,91,246,48,-186,247,115,57,85,188,55,68,173,207,207,229,110,81,222,81,168,50,113,178,-157,125,190,117,52,243,60,114,156,193,194,242,187,70,210,21,246,191,54,97,-225,37,125,46,150,220,106,116,201,44,189,210,60,196,103,248,43,248,210,155,-225,229,225,240,37,32,138,236,232,42,177,131,188,129,36,162,219,199,120,166,-150,194,116,73,85,79,82,113,213,202,236,52,48,144,153,63,136,212,254,40,-105,141,87,136,195,156,148,114,91,152,104,77,193,33,97,229,112,138,85,255,-246,186,92,196,101,10,31,3,3,165,0,112,92,146,88,178,198,135,229,64,-66,10,169,21,154,88,98,57,195,57,4,12,57,166,45,30,202,248,181,223,-226,109,89,197,90,227,207,150,1,149,208,146,148,90,68,232,164,211,149,42,-198,79,232,1,36,174,152,203,156,48,97,254,28,62,87,68,95,151,173,92,-105,213,63,22,38,238,107,247,186,123,136,188,110,157,111,83,160,78,40,19,-146,133,238,246,5,198,45,181,56,22,218,16,27,20,222,129,33,12,134,170,-115,248,121,19,103,242,24,152,220,90,2,52,131,99,143,38,102,35,45,251,-202,244,99,119,240,133,60,227,100,39,95,104,78,9,187,174,14,53,245,106,-61,211,132,22,111,126,213,13,153,104,22,3,165,249,60,35,139,255,132,246,-171,140,116,139,171,29,73,240,149,151,99,175,92,37,49,12,54,50,89,183,-168,221,164,211,56,246,222,185,204,181,71,162,187,35,142,177,49,80,97,23,-95,204,229,224,84,57,187,27,142,179,149,21,34,233,120,187,105,230,127,207,-47,55,160,132,188,24,202,58,76,7,184,27,182,195,149,42,122,248,208,243,-244,26,237,15,78,65,71,237,238,125,214,139,0,102,160,23,158,151,119,40,-201,22,47,99,112,247,125,174,85,189,55,218,121,237,41,110,119,10,69,237,-84,16,227,193,93,114,50,137,243,144,3,32,33,99,226,246,134,97,175,178,-241,84,96,75,40,129,145,218,199,169,247,80,251,110,127,207,161,251,156,69,-103,176,192,189,223,10,39,158,96,40,228,215,188,80,105,177,187,37,27,162,-218,43,34,235,67,225,140,193,187,88,53,11,181,67,105,219,198,169,221,25,-72,102,89,245,199,169,35,92,15,241,157,108,234,183,118,240,83,30,107,167,-86,67,218,124,221,217,190,180,55,182,208,211,168,3,101,26,85,142,145,244,-192,67,135,88,144,93,91,92,44,253,63,73,226,164,191,14,91,237,232,37,-24,23,174,69,4,62,52,214,34,178,172,57,121,38,147,8,181,201,34,147,-75,220,221,41,189,221,217,181,77,216,55,182,91,51,18,0,1,93,49,118,-20,33,168,161,37,188,100,120,115,249,135,69,244,93,33,175,96,247,0,100,-230,35,91,206,210,88,25,214,18,102,118,53,28,176,119,159,93,111,162,42,-67,94,139,129,194,203,63,255,55,53,240,123,27,197,238,35,4,91,175,3,-8,12,201,198,22,158,225,38,86,35,3,219,8,220,161,81,213,32,136,27,-155,251,47,157,182,197,61,53,227,228,205,211,207,151,196,49,189,14,60,204,-171,151,34,170,99,120,67,149,92,117,40,109,158,156,56,247,102,143,88,209,-127,15,190,126,188,64,194,152,33,77,19,82,5,3,19,66,77,171,55,68,-43,30,38,49,49,128,92,205,26,247,3,16,52,163,245,136,247,133,0,157,-236,21,149,168,99,92,153,235,110,209,228,196,1,170,187,111,40,31,164,165,-99,172,148,47,107,221,210,228,254,111,109,108,249,205,3,129,9,27,86,38,-66,78,254,218,71,237,223,153,6,198,47,113,20,193,10,55,181,179,234,70,-51,252,124,83,79,215,124,237,127,35,200,172,176,54,47,130,122,10,151,214,-8,29,90,13,34,103,224,177,78,167,41,225,198,121,228,45,109,177,42,228,-232,199,149,252,167,81,69,240,115,134,12,247,228,242,151,180,138,80,74,163,-145,223,140,186,76,217,204,70,217,28,83,36,224,220,86,59,144,169,68,24,-181,43,249,254,244,131,176,166,162,26,59,154,102,255,5,229,111,43,213,222,-206,136,95,118,100,206,134,251,90,99,101,225,119,171,203,253,248,218,238,225,-216,180,145,186,214,168,224,244,49,131,49,102,246,225,27,31,206,1,38,111,-237,69,129,108,84,52,157,241,90,219,34,5,1,40,132,162,125,33,183,139,-153,192,0,196,42,77,152,78,182,102,122,155,233,252,101,54,178,118,21,17,-184,106,17,188,251,79,142,169,22,147,164,88,24,115,82,63,170,226,155,12,-196,54,186,115,187,53,150,215,225,241,117,115,254,5,66,30,123,181,21,201,-159,57,44,240,56,95,92,225,17,193,128,248,132,73,219,197,24,34,76,165,-196,188,11,231,73,150,68,117,110,38,95,240,60,128,122,200,160,170,83,225,-18,32,191,170,153,113,124,58,111,119,61,229,103,3,191,117,117,246,183,38,-166,132,111,50,170,76,229,77,202,84,106,241,131,128,121,149,149,168,131,140,-57,3,101,75,17,44,59,22,188,71,187,195,237,90,57,221,203,104,231,117,-72,82,149,0,124,222,73,233,244,190,27,132,172,3,178,17,34,183,76,108,-9,138,136,224,143,236,229,19,230,153,149,146,172,23,6,193,128,69,114,153,-48,146,60,199,113,75,202,175,54,56,4,65,150,152,109,177,49,20,103,25,-211,90,191,206,192,38,45,96,143,6,184,179,121,6,12,32,65,174,66,101,-202,6,117,49,33,32,9,189,143,145,167,210,148,165,166,113,231,115,201,48,-218,234,164,18,78,59,83,218,118,22,10,64,13,198,27,94,8,17,138,146,-91,172,206,202,100,122,17,206,51,121,221,29,45,125,134,131,148,255,122,50,-6,154,143,168,115,50,46,4,197,73,64,223,255,193,87,71,70,204,99,186,-54,192,143,86,131,19,154,88,1,131,47,104,45,220,134,117,75,91,97,61,-165,166,132,254,117,11,236,50,97,216,10,25,102,149,157,41,79,210,244,248,-156,179,181,32,135,184,82,23,201,63,123,141,86,130,129,26,42,194,82,51,-190,48,91,103,46,37,39,219,170,242,75,216,240,87,89,158,216,34,210,179,-114,69,219,113,111,101,251,192,24,150,246,152,183,41,10,250,203,251,29,17,-111,12,242,251,105,149,223,97,129,233,129,235,239,36,29,36,64,239,199,23,-179,115,148,115,19,122,126,47,122,223,213,105,227,112,59,206,131,224,67,173,-248,120,212,175,67,207,180,124,55,84,206,24,91,171,38,192,75,190,167,249,-112,240,83,229,168,245,141,207,67,131,142,71,14,1,128,168,167,248,141,152,-213,138,38,1,210,143,122,191,188,118,38,206,148,203,79,247,24,125,153,226,-71,181,69,88,167,202,131,213,46,204,70,197,124,193,179,115,82,25,212,175,-23,228,187,139,11,100,90,108,175,224,208,83,77,126,166,163,26,170,181,68,-35,228,244,52,255,61,199,45,218,80,163,95,195,5,51,223,152,123,132,20,-204,19,154,255,82,138,157,185,44,158,214,225,171,103,158,187,175,147,36,204,-154,93,162,117,7,40,90,30,79,176,186,162,135,167,14,100,237,160,215,198,-158,54,203,171,14,209,6,151,31,14,38,249,134,135,51,69,24,163,72,120,-105,234,61,254,222,182,215,147,50,87,60,56,222,31,119,161,43,237,175,78,-71,116,125,200,179,244,138,182,172,166,163,48,215,147,241,104,34,210,96,152,-61,148,21,69,11,178,114,13,176,178,212,152,174,75,46,26,240,65,209,42,-98,186,54,50,133,12,9,47,49,236,246,193,196,42,49,159,137,166,64,196,-245,111,120,40,140,54,40,166,128,215,21,44,78,82,179,251,95,134,65,163,-17,7,242,143,193,185,0,117,199,131,33,169,165,83,210,128,142,25,213,234,-252,65,237,113,135,245,204,100,51,114,18,169,60,167,2,20,93,76,104,247,-74,140,29,60,62,252,112,195,250,113,118,226,152,108,220,172,56,172,11,44,-38,11,53,82,83,201,7,92,65,121,234,102,163,214,98,202,76,255,83,43,-87,223,154,82,30,121,247,71,129,59,143,146,54,28,182,140,46,69,162,44,-22,94,158,241,127,172,169,33,162,145,110,50,185,15,119,126,51,106,33,168,-191,34,129,207,89,245,211,122,173,158,43,71,254,107,173,55,235,225,57,254,-9,14,29,157,133,107,33,114,123,125,131,75,94,226,68,225,252,147,103,14,-109,27,184,108,101,189,4,17,84,5,48,214,99,38,107,119,189,93,243,119,-65,4,43,17,82,86,207,149,32,111,61,184,154,253,243,136,40,20,83,152,-43,255,250,135,211,9,140,80,225,97,50,83,197,140,212,221,229,35,165,155,-98,88,40,218,241,110,41,170,221,39,77,61,254,89,192,36,202,67,42,131,-202,156,226,106,32,74,236,120,229,76,216,206,26,102,176,189,45,214,247,188,-52,13,49,60,33,236,158,192,215,247,201,174,148,38,25,7,225,121,183,76,-183,82,193,64,253,178,86,139,223,137,188,72,16,74,122,134,133,200,48,113,-105,97,92,29,219,242,77,87,66,45,199,178,10,223,213,90,251,191,159,225,-7,44,141,28,155,140,253,29,44,40,85,244,21,148,23,37,249,227,246,173,-19,186,15,6,187,41,29,182,68,126,46,177,68,134,71,151,172,240,151,124,-223,84,112,218,113,254,142,249,40,164,250,171,111,72,8,190,219,27,155,81,-72,164,112,74,99,78,6,134,164,75,119,86,53,35,244,2,213,185,123,92,-114,6,98,148,229,152,10,215,251,200,170,119,91,134,242,129,209,76,198,227,-173,51,5,248,242,76,75,168,255,100,52,136,152,194,50,188,90,117,109,40,-128,244,154,17,91,177,74,58,32,177,248,73,141,91,170,91,225,201,88,183,-200,9,50,244,161,163,24,151,182,4,234,139,192,43,108,169,147,80,146,227,-15,101,123,210,41,99,172,182,174,188,29,209,148,4,255,96,227,231,219,73,-57,246,46,106,168,51,203,91,9,4,105,157,22,138,253,94,196,152,202,52,-250,196,250,15,3,80,246,61,249,2,62,80,97,24,37,210,202,153,221,61,-40,182,162,24,54,107,88,30,221,255,233,86,155,80,122,19,37,241,219,228,-81,223,144,1,218,175,62,146,235,227,34,216,248,68,156,112,194,85,44,199,-101,210,38,62,238,131,20,221,186,151,52,254,200,246,176,118,138,115,99,223,-86,159,43,249,51,149,80,150,183,196,55,163,227,192,208,217,184,167,22,87,-32,224,27,149,218,84,110,173,84,48,220,25,76,18,217,58,61,192,225,105,-13,134,44,130,105,95,89,121,128,210,190,123,28,144,120,202,65,221,76,74,-51,108,53,8,184,246,123,19,141,187,128,204,180,121,80,3,149,40,29,153,-135,169,71,114,69,153,189,68,151,225,46,200,152,34,157,10,125,167,123,235,-87,51,161,148,193,112,70,121,241,1,202,147,4,192,136,246,9,36,209,5,-189,69,176,254,36,160,0,212,123,175,13,26,39,2,207,19,211,108,49,145,-247,125,157,156,148,81,199,185,233,224,219,193,246,120,199,185,190,149,187,102,-29,230,141,24,250,238,213,116,236,248,217,133,197,193,108,223,124,0,15,8,-46,243,179,36,146,150,15,109,157,77,143,197,1,34,111,70,194,149,207,212,-98,40,93,108,205,98,220,54,224,29,171,220,138,225,108,10,92,131,153,174,-188,208,154,124,204,57,141,127,249,221,28,204,225,150,151,206,200,190,27,194,-167,186,111,172,19,143,105,157,196,34,73,65,89,223,47,57,80,30,28,255,-90,124,82,229,102,143,10,11,244,117,226,25,158,255,244,98,180,9,35,111,-221,155,113,187,93,11,171,25,24,56,118,30,98,191,109,106,25,47,162,0,-250,164,69,108,71,225,241,168,177,183,159,79,182,173,82,87,103,28,62,16,-146,165,95,110,164,240,97,207,126,47,118,120,215,154,200,28,143,50,38,239,-232,33,145,229,54,168,64,223,50,45,59,14,111,199,135,168,204,111,18,204,-179,229,121,116,29,225,178,248,36,246,231,164,8,110,239,192,59,134,29,142,-131,64,189,45,229,104,4,101,86,208,139,167,249,95,126,221,7,68,100,91,-67,12,238,228,184,63,206,252,197,17,123,86,79,99,103,61,240,255,104,47,-159,138,154,245,131,113,30,71,49,112,171,215,110,109,93,225,112,88,197,118,-121,180,91,69,97,151,157,119,65,91,228,5,132,91,242,242,54,200,39,135,-47,146,215,118,148,219,208,197,139,68,35,24,57,102,176,55,14,2,47,190,-91,251,195,170,136,71,89,90,141,171,170,245,154,34,128,130,21,90,148,179,-74,174,168,21,148,113,4,227,95,57,65,62,93,213,112,215,88,59,42,18,-117,64,214,147,196,117,9,232,117,106,204,198,179,168,131,199,50,22,174,132,-86,44,138,236,143,184,21,9,228,235,244,209,35,169,177,240,39,164,59,220,-25,194,245,13,168,214,88,105,182,142,74,46,72,123,112,151,22,2,91,178,-203,124,31,73,209,66,73,89,180,156,176,142,251,156,164,61,161,179,131,4,-71,8,30,206,53,223,57,25,48,155,183,141,250,189,170,217,98,209,108,177,-55,149,24,196,229,151,177,123,244,7,145,104,119,85,212,85,136,182,69,3,-177,180,147,14,186,235,208,126,228,232,6,119,238,2,49,73,133,252,167,79,-127,66,14,175,12,82,21,227,102,220,63,152,23,104,51,54,43,163,59,174,-248,143,3,248,248,7,17,48,2,130,6,198,21,186,50,236,12,232,15,45,-53,54,66,190,186,99,147,162,190,80,217,34,91,166,114,88,194,148,55,190,-70,69,244,176,162,191,175,235,225,46,90,151,170,150,108,29,250,236,191,59,-129,149,65,171,38,59,17,153,73,190,128,30,54,34,79,153,22,194,127,101,-96,205,8,15,22,57,28,164,30,69,112,154,203,65,210,43,142,93,72,89,-54,102,162,233,57,95,41,110,180,148,37,144,67,146,2,130,253,9,18,214,-99,160,22,32,66,138,109,81,148,134,28,115,24,76,9,154,184,7,121,233,-126,119,21,70,73,155,14,4,87,71,162,26,145,38,90,35,78,50,86,240,-182,36,248,117,19,180,119,58,96,111,127,131,216,16,149,109,148,116,253,83,-6,235,37,216,29,34,146,244,241,132,145,227,136,138,34,67,24,23,111,94,-235,199,179,50,168,88,205,117,104,239,61,87,88,233,125,46,61,45,17,241,-40,153,84,203,82,39,131,171,175,218,171,235,9,176,192,240,136,215,233,12,-70,210,231,169,120,246,151,81,192,141,94,104,248,137,7,209,166,82,209,98,-87,139,52,1,175,125,210,11,169,85,95,153,111,35,234,168,203,66,232,188,-62,136,57,68,92,244,217,96,160,68,58,194,57,68,56,123,108,17,66,97,-81,198,164,94,255,209,153,43,200,137,65,134,139,78,1,52,216,45,235,243,-238,1,135,216,144,149,172,0,166,133,218,46,240,121,12,68,147,111,206,53,-71,226,127,232,112,88,108,17,15,232,169,176,29,36,13,232,180,194,76,23,-129,24,205,6,204,82,235,149,44,52,172,180,183,28,204,110,149,131,125,145,-195,88,251,198,98,81,251,237,181,129,14,47,229,128,4,77,34,60,80,73,-68,173,135,20,231,123,65,163,30,134,167,209,39,199,5,8,250,33,3,66,-155,38,151,63,109,46,212,18,67,189,218,6,141,82,255,191,104,39,234,121,-150,19,142,154,49,127,68,68,13,35,222,46,156,250,9,101,216,93,47,76,-66,148,106,120,182,155,213,24,188,89,186,8,49,127,133,187,188,56,67,17,-88,0,79,8,211,57,44,204,213,106,179,197,73,71,73,23,189,227,152,136,-173,239,106,184,44,96,149,136,94,126,254,28,47,145,178,197,43,59,6,147,-143,154,216,137,23,160,178,64,77,24,185,36,72,87,6,255,74,250,253,14,-192,103,238,223,120,232,62,239,60,181,233,181,57,3,250,237,120,207,76,225,-196,171,228,234,102,241,40,192,175,33,123,190,14,222,81,157,111,158,42,221,-198,229,195,44,87,215,120,187,32,236,236,20,165,173,214,34,220,27,47,38,-20,71,70,251,230,11,119,33,3,98,213,189,1,220,199,198,21,63,74,194,-128,245,30,68,210,136,192,127,196,125,5,177,184,26,115,202,71,85,80,218,-144,224,188,203,92,131,11,163,117,234,230,50,198,114,35,244,255,178,213,185,-219,138,94,210,228,118,249,241,130,32,51,215,160,56,169,198,228,251,6,47,-140,149,157,10,25,79,109,5,13,218,240,2,208,193,52,124,39,165,168,100,-42,167,33,59,59,179,237,8,30,40,167,251,139,115,176,111,31,18,117,90,-214,249,16,155,236,113,242,106,36,247,173,40,54,186,143,159,53,17,22,33,-93,126,7,131,192,188,83,153,104,154,94,150,74,4,143,251,255,175,90,150,-106,3,172,227,78,46,241,126,108,232,233,133,120,50,151,54,50,43,23,107,-129,59,171,152,213,91,240,208,148,237,54,63,22,135,214,198,243,136,68,173,-37,165,50,179,41,127,96,202,183,39,122,164,157,138,25,242,168,201,129,136,-8,213,167,210,86,26,7,102,114,191,78,188,164,33,132,160,65,55,125,215,-88,76,207,124,224,174,18,101,84,1,155,187,37,200,189,167,255,14,60,177,-162,161,207,35,18,165,74,12,205,209,104,104,248,131,141,127,208,117,4,228,-251,40,52,166,72,29,23,231,137,42,214,43,243,6,137,14,192,136,111,142,-62,4,136,137,158,181,108,206,27,35,60,135,184,238,112,146,224,123,232,254,-73,161,8,151,54,238,179,49,69,141,5,8,170,124,173,155,248,54,195,223,-237,101,143,17,176,47,241,9,140,183,244,9,7,215,25,152,157,155,138,1,-142,96,85,146,173,127,167,226,156,155,216,137,43,163,34,3,10,22,191,202,-239,48,156,118,141,132,38,111,47,212,24,120,60,234,236,100,124,45,135,196,-24,168,44,5,77,98,105,56,28,72,38,244,219,65,210,159,178,74,143,215,-188,241,241,41,44,13,141,185,68,247,201,177,152,57,61,41,194,51,82,228,-128,152,157,248,26,188,56,139,100,28,165,14,205,72,191,173,1,215,177,141,-66,126,185,228,240,219,42,205,241,154,134,105,6,116,219,118,136,123,235,160,-169,13,39,38,17,244,125,183,48,221,80,143,196,125,49,52,213,60,32,195,-102,29,73,113,219,207,51,159,110,166,188,234,190,164,25,243,216,121,149,177,-238,98,121,213,134,132,173,142,164,7,182,102,148,76,69,169,168,118,29,127,-30,188,109,39,131,193,139,100,12,118,187,207,63,48,58,96,3,253,176,51,-24,242,104,80,244,207,132,147,188,242,79,162,251,7,81,117,96,253,180,72,-202,81,127,39,40,22,200,241,138,31,130,207,218,161,208,103,130,37,69,237,-49,79,208,83,58,136,216,81,86,9,242,246,30,17,188,198,180,27,131,156,-117,154,67,9,44,83,82,192,182,118,192,192,136,74,234,183,78,190,52,83,-148,45,167,21,35,59,89,228,122,197,171,58,45,117,24,70,59,216,240,75,-149,227,57,38,235,4,100,38,16,142,145,194,232,173,134,83,252,219,223,253,-133,1,51,70,147,177,190,253,248,87,146,39,196,57,46,232,75,255,174,194,-142,123,17,125,80,241,18,148,185,152,191,155,195,185,50,37,43,78,113,89,-21,220,24,152,20,128,182,253,95,180,120,126,185,146,106,169,34,17,118,35,-241,49,93,164,29,106,6,65,224,6,102,126,201,82,252,207,185,44,113,44,-115,127,6,44,236,174,15,177,3,151,205,233,108,5,159,206,152,104,72,172,-51,242,140,79,123,109,46,31,61,166,61,29,92,168,119,185,241,82,30,152,-196,202,135,158,96,28,25,42,238,14,64,59,190,182,16,238,227,183,111,218,-209,198,16,170,86,46,255,13,36,151,135,97,217,214,252,255,108,241,252,173,-129,43,224,92,75,157,135,161,35,65,160,47,52,234,120,57,154,5,122,255,-24,160,125,18,234,53,38,117,99,162,57,37,60,28,217,185,30,176,169,105,-210,141,10,105,91,89,98,90,227,188,29,189,247,221,57,221,40,80,239,223,-141,5,60,120,17,33,245,167,220,139,171,86,35,238,52,79,9,207,223,139,-12,225,183,14,143,78,111,182,127,26,11,19,177,24,48,211,71,112,234,120,-247,137,111,244,25,79,164,45,22,192,17,165,97,221,229,105,173,178,91,218,-31,216,24,253,123,37,50,180,180,134,77,36,2,182,149,243,138,186,250,241,-37,162,176,145,102,232,33,75,149,244,26,159,221,23,156,84,210,214,92,89,-206,239,163,163,160,81,239,91,181,50,130,225,110,54,232,183,176,250,62,47,-122,59,134,201,27,194,152,162,43,71,127,18,155,119,1,64,183,175,47,166,-229,90,242,32,54,147,14,2,87,83,250,1,220,63,199,156,70,238,108,239,-132,146,44,127,213,218,143,255,164,20,212,222,126,35,237,43,54,111,6,190,-53,250,144,83,14,28,160,170,180,61,33,178,201,147,140,110,83,225,14,176,-145,127,20,90,38,145,208,188,239,54,18,185,38,247,172,181,80,101,242,88,-51,159,243,52,171,32,134,140,165,242,188,24,93,63,249,138,192,122,167,68,-44,221,17,129,107,27,131,49,191,211,157,103,49,7,195,154,217,217,14,60,-194,252,194,240,45,172,201,92,146,214,127,140,182,240,57,63,134,247,218,142,-141,151,46,197,242,249,128,210,107,42,60,196,208,36,63,96,219,106,12,250,-104,242,222,160,36,3,120,164,196,199,47,27,234,112,212,7,177,95,96,182,-51,230,190,101,156,85,25,97,218,0,235,94,108,22,85,108,170,15,201,13,-108,137,40,92,220,85,111,88,94,52,61,214,10,201,133,118,224,246,89,128,-66,36,175,122,227,77,1,111,251,49,13,213,230,184,104,236,205,180,201,254,-148,51,127,87,61,172,184,134,130,75,195,93,157,43,190,156,27,98,171,224,-69,240,169,172,19,247,31,205,115,13,51,137,187,72,11,215,226,193,26,215,-207,101,140,145,249,87,197,179,222,55,80,1,200,245,65,170,72,53,230,175,-120,103,249,176,183,84,30,207,192,109,241,16,233,177,122,51,217,58,156,56,-243,131,135,9,249,37,46,54,48,109,236,159,68,45,212,150,74,13,48,216,-154,161,138,71,168,130,123,123,131,173,172,147,221,60,52,254,250,147,21,213,-65,207,154,211,154,153,48,103,56,66,60,48,144,57,8,10,48,90,59,181,-17,77,190,125,174,125,107,7,231,189,29,91,98,201,72,96,244,163,191,114,-153,80,57,208,103,155,241,17,248,248,119,132,175,162,216,165,227,76,114,130,-211,28,55,233,205,152,185,45,108,47,108,104,62,119,168,47,246,230,243,61,-172,90,3,34,169,129,109,136,185,170,229,214,26,122,81,37,20,124,158,40,-220,10,21,9,231,8,158,8,125,100,161,123,209,225,234,115,3,90,45,169,-37,171,40,72,76,44,64,56,164,203,133,202,146,67,78,154,250,225,141,52,-213,50,114,4,140,108,120,100,136,81,170,253,231,129,119,131,127,28,158,227,-22,141,245,75,117,111,239,254,237,40,196,88,108,168,223,167,239,167,38,129,-122,97,166,230,93,65,40,72,117,207,180,54,203,30,70,150,63,70,129,9,-254,102,13,229,221,75,51,156,108,124,25,201,23,249,162,73,137,91,226,13,-199,183,181,22,75,206,203,229,41,175,139,46,41,100,229,146,21,74,89,90,-156,78,98,199,236,229,148,133,117,192,235,144,122,228,79,253,116,101,110,248,-228,96,141,171,194,92,202,175,246,5,37,56,13,109,59,62,42,141,222,157,-165,34,180,174,101,200,239,194,195,63,232,103,99,145,230,115,173,250,121,226,-0,200,21,124,7,245,153,204,204,49,153,35,76,192,188,110,40,237,14,184,-49,77,41,86,109,97,213,92,15,216,129,23,83,9,59,215,241,75,13,95,-17,128,129,254,141,197,181,39,197,98,206,176,92,151,104,13,165,214,1,47,-177,70,117,63,149,231,152,168,192,92,210,218,189,67,115,34,253,41,79,136,-32,191,51,122,249,33,147,56,17,102,114,124,197,214,151,141,218,145,0,177,-235,240,221,41,139,232,133,37,218,70,86,93,205,14,80,5,119,58,45,153,-8,191,179,85,178,3,202,152,217,196,214,57,224,200,225,20,111,107,59,100,-216,154,97,244,137,164,120,113,69,208,114,140,182,239,122,123,66,221,84,114,-198,63,254,211,134,26,15,99,177,64,220,156,15,250,215,64,202,170,90,66,-97,135,214,218,150,49,61,88,169,226,52,146,115,41,174,165,45,55,236,20,-250,148,109,162,255,81,4,152,112,251,211,75,173,61,203,238,116,63,47,253,-195,127,102,79,24,129,125,29,25,114,153,219,67,88,30,40,63,250,247,123,-78,85,179,109,184,151,120,46,48,69,176,99,45,135,143,68,74,101,229,2,-47,45,187,28,238,67,248,182,234,176,131,89,248,32,41,84,174,187,169,248,-151,106,224,47,2,145,209,160,57,140,78,181,43,92,123,100,2,171,174,238,-204,80,169,188,208,41,218,253,20,249,135,94,17,15,50,26,19,221,115,194,-36,30,199,204,248,119,235,196,48,198,44,35,159,242,208,213,8,221,133,183,-50,43,111,221,180,2,199,181,134,33,13,201,189,105,186,123,77,230,236,209,-173,252,254,135,26,18,15,152,128,66,60,120,237,242,29,27,58,113,182,183,-206,97,176,117,111,252,59,252,13,155,67,109,145,12,119,180,98,97,227,135,-44,102,202,80,69,146,126,44,30,179,220,26,174,229,29,224,183,120,125,112,-155,96,226,194,206,48,222,60,253,179,59,31,212,60,191,83,115,157,200,9,-118,88,58,2,51,112,86,165,117,7,133,186,69,180,71,92,216,197,58,174,-56,23,251,191,14,172,99,53,84,173,146,203,170,80,80,44,228,55,146,13,-147,146,148,99,185,116,196,173,123,220,92,223,157,220,171,5,117,172,98,150,-144,134,183,147,85,188,222,200,182,4,126,19,22,115,239,169,206,252,232,71,-107,15,162,255,101,86,19,51,109,32,48,18,54,89,20,167,133,168,140,135,-233,210,254,150,209,252,228,91,23,136,29,220,253,97,3,69,174,10,75,188,-101,82,26,169,182,143,209,102,176,216,126,152,142,226,230,64,96,63,0,195,-230,37,106,66,58,141,70,63,102,106,200,151,129,74,165,230,248,39,68,184,-6,86,87,15,208,172,135,92,27,75,215,165,173,17,72,207,231,248,215,163,-180,182,108,25,236,116,62,201,175,248,120,125,193,76,62,86,20,129,99,4,-216,57,12,38,185,27,109,229,79,95,29,29,242,135,84,25,157,149,183,66,-118,214,232,193,31,140,27,26,236,197,217,218,2,98,151,185,6,123,114,217,-0,191,219,186,250,148,135,43,200,142,197,140,9,149,91,167,136,155,209,45,-201,248,203,228,10,78,109,143,202,117,244,216,205,40,211,202,224,96,192,225,-228,221,219,103,165,189,252,8,123,180,129,182,127,75,115,41,203,187,73,229,-242,230,191,125,27,5,34,15,246,253,157,9,73,174,91,145,141,162,193,12,-147,247,215,245,238,237,184,179,199,53,158,130,99,199,114,17,137,241,161,2,-124,172,60,169,251,51,136,135,28,3,187,70,24,58,143,181,108,51,109,70,-220,148,194,77,219,95,206,80,235,149,88,221,122,244,242,182,178,66,251,15,-30,122,173,68,160,224,42,170,11,17,141,215,145,216,5,99,199,205,122,129,-46,81,208,25,126,120,43,165,120,117,23,79,142,3,125,193,174,201,64,228,-117,228,162,190,194,24,74,133,176,40,48,99,140,163,209,165,100,84,62,252,-254,226,131,215,203,108,245,188,106,116,75,238,122,28,1,43,219,184,244,0,-188,68,48,187,196,18,7,100,23,48,140,61,149,132,71,42,231,134,4,153,-46,152,206,237,46,174,254,99,47,239,110,196,103,23,217,235,186,161,240,11,-251,107,202,196,236,172,215,200,126,204,222,251,195,118,91,102,69,171,98,162,-152,234,177,166,239,244,169,46,95,47,20,140,48,207,106,219,192,24,35,195,-149,162,81,144,170,130,227,199,125,195,149,10,110,213,76,254,148,49,86,168,-239,44,181,5,115,42,71,224,130,98,157,85,171,211,124,236,216,105,30,136,-77,155,59,54,19,84,210,157,67,76,170,81,239,185,102,119,103,85,159,231,-216,90,39,81,171,108,137,41,8,77,133,20,180,91,86,118,93,198,78,107,-92,97,7,114,179,244,111,206,90,123,92,214,125,16,84,191,111,163,198,239,-115,111,90,83,13,224,193,230,189,156,190,184,184,161,141,131,216,224,72,18,-205,254,22,239,164,99,93,135,26,92,100,27,100,0,210,253,17,112,179,250,-178,188,251,147,224,174,208,35,68,51,109,204,250,110,47,132,23,81,237,124,-5,126,15,131,137,155,147,246,22,205,238,179,54,70,129,22,255,129,147,150,-138,131,10,212,163,88,43,126,222,82,151,219,111,221,161,248,227,38,126,74,-230,190,234,229,86,36,113,99,1,181,212,105,4,102,184,38,87,171,205,32,-50,89,23,212,48,193,234,193,126,11,66,180,176,177,50,252,254,141,196,24,-216,86,200,98,106,212,31,181,60,39,210,226,28,29,7,145,100,228,104,155,-159,114,156,65,3,167,68,89,27,128,87,128,123,16,174,113,209,115,252,158,-220,4,18,181,123,144,115,234,206,211,166,2,197,30,126,229,114,248,169,47,-136,93,154,246,230,144,115,151,230,190,6,76,200,2,211,215,235,233,218,171,-21,34,37,122,12,43,26,218,242,223,22,16,170,100,205,190,80,155,234,148,-254,175,167,118,73,185,115,81,224,210,158,186,195,169,255,74,193,131,185,180,-18,217,84,59,169,145,5,140,206,100,49,192,82,51,196,159,238,254,150,20,-28,186,189,19,155,112,10,60,184,150,80,144,58,249,168,211,220,206,99,177,-217,137,231,125,32,122,152,209,6,137,130,96,96,246,58,148,135,170,254,239,-123,65,66,165,165,89,201,122,153,252,140,21,30,246,153,1,181,162,137,63,-178,150,101,192,143,79,222,66,84,51,117,101,138,131,197,160,236,19,244,50,-154,193,157,28,13,130,124,71,168,136,62,157,5,184,124,189,190,184,43,136,-42,195,19,108,44,42,137,66,104,204,245,19,120,36,202,70,89,95,54,136,-101,132,77,43,211,62,184,143,229,22,104,27,137,154,143,220,84,140,21,11,-151,56,50,192,1,8,65,43,249,107,213,239,241,8,23,15,38,115,248,201,-25,113,151,10,52,163,128,37,248,63,20,245,193,142,19,178,89,98,227,68,-171,140,87,103,149,131,104,64,118,159,65,155,229,243,54,129,200,108,178,225,-20,216,131,125,57,219,161,168,81,15,121,188,42,119,54,186,113,108,30,51,-111,227,18,40,196,64,50,90,248,221,110,199,88,149,26,48,49,211,23,154,-243,126,63,205,53,12,32,62,75,7,189,237,99,84,216,68,113,86,181,254,-251,193,26,110,32,103,147,234,10,39,208,107,164,72,154,76,203,229,111,214,-199,220,252,200,20,228,218,31,247,155,25,48,212,214,197,140,236,32,204,226,-46,44,106,35,174,23,94,27,136,227,194,43,197,99,197,179,204,114,135,223,-5,236,112,99,71,128,208,98,60,205,214,85,2,206,30,168,196,163,79,36,-5,98,190,81,234,230,77,31,179,179,85,84,15,192,53,179,112,202,250,4,-51,72,168,222,232,177,208,5,32,186,189,83,7,154,191,166,57,240,62,1,-178,72,194,70,84,57,50,67,214,99,71,105,20,84,138,178,196,69,62,100,-41,10,86,199,47,142,198,216,8,113,100,35,104,147,195,205,4,190,129,66,-150,12,197,103,92,140,9,24,229,139,154,132,207,37,165,157,236,237,121,166,-4,148,75,141,202,209,141,247,187,201,210,48,255,36,14,244,207,126,0,202,-70,197,81,246,187,27,129,108,121,65,238,77,133,117,130,51,144,108,212,100,-252,14,124,48,200,50,231,225,251,29,205,158,148,201,55,210,203,115,41,195,-186,201,92,66,11,102,179,77,170,158,17,48,51,228,222,153,248,146,95,141,-119,127,52,84,239,76,210,66,172,4,25,105,123,150,92,201,116,148,17,69,-221,20,58,46,212,221,148,172,107,19,188,223,108,19,125,225,78,15,116,96,-80,236,102,5,107,97,51,243,183,105,10,152,212,137,61,176,132,191,145,158,-58,227,112,78,127,94,202,151,29,202,61,101,145,169,167,104,25,68,82,200,-180,138,142,36,13,53,202,7,19,208,176,177,117,27,204,46,109,110,54,116,-2,170,97,85,56,236,157,3,232,40,235,197,199,120,255,112,208,211,134,55,-49,137,2,131,12,122,85,120,232,178,147,212,32,227,179,7,172,245,82,174,-147,218,136,143,134,112,113,75,136,243,108,28,6,228,241,176,166,71,10,204,-14,152,147,245,187,13,150,182,42,209,141,58,229,77,113,50,158,168,157,195,-81,182,34,3,193,192,230,53,32,163,25,185,153,226,195,207,196,88,82,141,-172,38,35,16,152,131,201,220,71,187,116,137,99,18,107,168,194,117,20,77,-247,131,113,158,87,30,225,223,43,166,155,29,98,22,252,82,131,189,157,54,-35,184,79,108,25,94,16,40,175,246,36,74,96,93,65,27,65,155,226,142,-151,210,153,140,41,252,0,113,177,136,58,182,104,14,168,26,72,89,211,53,-60,73,192,148,99,249,222,75,174,39,166,132,152,18,20,132,134,59,237,167,-60,13,194,91,140,90,16,4,143,47,155,202,8,33,57,102,45,255,74,111,-41,8,7,240,184,178,168,22,211,250,187,89,43,43,149,224,81,183,24,193,-149,129,246,17,173,30,76,41,223,103,105,116,92,26,233,180,86,65,250,194,-67,2,153,122,151,77,7,49,151,184,50,166,79,189,67,154,8,215,168,250,-90,75,108,238,104,37,193,60,207,231,150,17,89,185,167,132,54,44,253,110,-200,60,224,129,106,78,32,15,0,188,145,112,22,134,190,200,37,6,207,168,-171,223,236,69,246,241,222,192,122,1,110,171,171,152,204,69,152,30,32,244,-239,22,248,169,119,99,105,152,108,200,212,213,108,84,194,255,95,93,249,91,-25,175,23,40,1,122,222,153,222,168,198,5,147,51,179,55,233,119,2,78,-126,183,161,170,101,255,207,94,170,120,234,117,124,21,103,230,185,56,210,133,-145,124,46,179,180,44,194,215,178,145,42,17,226,97,9,14,39,153,33,13,-68,107,126,173,1,54,164,127,95,114,192,246,178,204,94,252,116,118,118,161,-136,85,27,18,218,148,61,120,112,184,176,188,132,149,159,119,134,30,222,120,-177,179,152,245,185,79,98,220,189,199,48,236,176,119,55,4,122,0,217,156,-202,11,248,20,173,241,84,175,143,211,226,214,71,249,54,255,11,163,151,43,-222,20,232,88,161,76,153,189,131,115,102,66,209,113,1,161,245,122,223,114,-137,90,63,147,89,51,202,203,118,32,58,116,134,21,128,233,198,228,119,73,-217,235,130,247,71,114,22,79,29,67,191,116,17,73,40,199,84,192,126,70,-238,59,115,0,235,48,111,46,201,167,56,241,158,126,191,48,45,151,250,139,-183,34,146,77,156,79,7,176,93,61,189,41,239,160,75,4,255,9,57,55,-251,164,49,208,118,245,27,109,94,13,184,166,124,93,139,134,64,175,13,133,-108,56,55,52,246,88,76,93,108,162,141,225,223,30,203,145,58,232,31,7,-151,78,75,121,255,110,221,19,154,191,126,122,118,226,114,128,221,35,193,92,-221,92,116,142,17,163,65,118,123,148,31,191,246,48,4,4,80,129,18,199,-228,107,230,190,169,72,199,32,148,94,73,132,179,93,187,74,114,212,35,106,-94,78,123,248,146,212,124,136,62,34,163,94,204,10,73,16,208,164,150,172,-41,228,7,64,201,243,59,46,74,62,161,250,85,220,198,225,101,34,213,19,-96,232,196,118,101,186,105,8,179,175,104,245,7,12,79,122,112,165,201,140,-54,15,125,112,24,251,160,169,123,43,9,50,93,251,132,40,119,212,215,219,-61,191,102,41,174,160,246,161,223,7,0,163,138,134,94,250,117,78,43,136,-213,14,12,135,254,55,118,24,12,80,188,203,136,105,0,154,179,119,222,57,-3,141,217,140,209,124,43,45,213,40,131,40,197,63,218,78,2,161,117,150,-186,254,237,105,95,156,62,120,70,94,37,6,198,160,230,204,190,123,44,216,-105,78,24,246,108,218,148,176,19,163,247,216,126,230,164,67,47,21,101,194,-77,71,141,119,159,185,145,13,156,1,176,32,19,93,24,85,244,194,123,245,-224,14,74,234,185,242,123,220,3,132,129,9,201,226,41,237,211,225,239,147,-10,145,100,24,80,185,172,3,69,231,124,157,29,59,97,145,111,209,84,61,-218,53,99,2,169,245,241,74,120,9,71,154,142,0,145,218,205,186,112,176,-18,253,59,37,50,9,91,224,209,53,147,123,60,48,61,29,236,66,124,177,-228,115,216,2,234,168,64,26,182,126,154,42,212,190,99,94,84,100,163,85,-197,199,53,207,172,129,89,223,205,127,219,119,19,179,240,215,15,83,254,112,-5,1,38,91,69,74,56,12,216,152,46,36,133,23,222,43,102,204,193,114,-183,157,128,30,242,1,133,117,191,137,160,36,197,92,20,81,53,242,226,253,-242,34,183,214,43,117,107,244,27,197,84,46,86,214,238,179,70,196,115,125,-247,76,209,66,251,187,247,187,178,36,11,224,27,151,6,206,187,27,166,222,-219,226,39,193,86,204,221,197,209,81,197,195,29,150,217,231,147,70,157,38,-193,66,95,159,170,89,82,124,253,70,209,124,183,160,85,62,13,17,210,206,-145,215,234,102,141,105,146,107,242,38,206,168,193,97,147,86,242,164,81,201,-126,55,172,228,252,158,85,18,38,91,162,142,146,144,189,107,82,115,96,49,-227,214,151,141,52,177,136,0,134,249,238,101,36,74,175,69,160,62,129,13,-244,164,141,251,174,214,144,169,128,232,152,137,178,201,230,100,151,194,82,159,-68,141,137,126,28,89,88,184,31,129,39,116,145,136,68,136,92,211,128,189,-234,31,63,129,82,252,148,60,109,90,184,21,3,215,184,208,240,21,64,29,-56,91,136,194,97,104,18,7,196,114,230,242,114,203,207,116,53,185,235,80,-54,157,244,12,7,240,23,174,170,53,99,134,165,146,166,179,42,202,250,90,-196,122,103,129,138,78,142,235,70,16,69,135,253,22,160,222,154,52,6,74,-212,9,176,130,168,91,165,220,79,200,146,30,202,87,33,224,85,175,175,249,-247,179,196,169,164,201,92,124,209,245,18,213,139,124,214,0,99,72,194,179,-98,85,43,49,45,104,123,241,64,159,201,219,66,121,88,3,255,28,19,153,-49,90,85,6,130,179,132,151,178,94,236,133,180,114,111,9,54,51,148,49,-156,21,130,249,232,44,61,39,243,14,97,92,36,91,199,221,60,18,153,33,-129,183,18,207,46,58,23,141,21,70,97,35,185,36,48,132,147,240,59,254,-221,20,14,5,69,145,146,50,218,83,106,30,191,163,243,4,204,188,9,117,-102,80,158,59,229,121,200,136,166,237,41,137,188,160,155,199,122,193,142,169,-83,198,7,225,219,1,236,80,99,109,91,67,86,103,107,189,40,206,195,220,-179,249,120,50,49,27,199,66,32,52,70,203,108,175,90,126,162,9,232,83,-160,236,224,30,204,167,210,68,70,130,124,90,198,7,246,149,222,14,24,73,-97,54,157,4,200,39,218,192,149,193,74,31,190,218,53,232,5,87,157,27,-94,204,89,240,149,186,93,203,236,10,128,158,24,103,124,19,62,196,227,52,-109,15,89,163,162,157,8,229,47,176,78,117,203,199,126,42,49,179,26,29,-8,130,36,254,92,225,151,168,180,23,79,12,248,79,69,245,67,99,34,31,-14,70,127,168,90,207,47,204,53,146,204,218,45,177,38,61,55,68,116,84,-32,151,148,63,236,90,232,10,162,144,99,95,131,55,239,239,219,150,196,100,-4,156,243,205,210,71,141,122,70,231,140,6,53,85,234,101,0,240,190,72,-113,83,242,176,216,17,105,50,131,93,247,100,118,203,128,120,56,208,1,74,-198,54,239,157,93,173,255,191,48,117,143,245,174,173,52,148,185,188,97,25,-4,79,232,224,121,11,70,54,172,239,2,15,225,131,177,199,218,63,22,10,-193,37,233,168,64,180,200,104,84,122,207,72,53,222,62,66,139,13,230,168,-130,90,107,166,96,213,150,240,186,238,227,119,42,64,99,244,227,85,115,35,-131,239,152,192,176,210,55,212,146,24,112,94,243,41,53,41,75,149,174,128,-45,89,184,204,137,53,250,223,102,228,164,41,199,136,123,80,9,21,101,104,-148,98,121,37,177,228,19,99,142,186,29,41,166,12,176,137,145,160,192,63,-229,181,204,191,182,25,244,143,135,213,116,107,226,211,110,26,167,100,147,252,-134,60,12,177,101,183,124,75,190,79,161,154,105,170,177,30,53,237,28,166,-10,40,138,121,172,232,40,22,213,83,218,235,54,198,71,93,103,165,132,67,-173,7,176,252,229,150,138,91,114,66,122,69,155,172,208,188,3,219,219,87,-67,198,104,13,159,122,77,214,140,162,43,186,179,147,206,244,63,228,96,150,-180,97,221,222,44,71,43,255,43,40,95,222,245,165,226,148,11,46,114,72,-227,31,64,254,116,95,188,22,145,197,169,237,165,10,47,19,138,103,233,81,-53,30,115,38,99,202,164,251,197,42,134,137,223,66,147,66,73,174,124,167,-146,5,36,186,138,245,63,93,154,173,192,2,97,62,50,217,203,216,216,65,-40,104,102,58,91,134,2,117,183,196,239,86,104,184,143,128,166,181,198,78,-9,19,219,171,120,204,58,195,157,249,106,108,34,71,232,205,108,179,2,61,-17,168,192,30,22,20,245,182,92,55,250,182,200,138,156,69,84,102,177,114,-5,142,189,19,71,206,169,242,239,99,83,16,139,211,5,121,251,241,195,184,-147,111,248,117,84,18,92,215,228,145,85,190,214,67,50,48,171,170,23,2,-91,136,13,215,157,142,136,82,2,247,222,162,106,193,200,224,54,149,73,16,-141,58,175,231,55,240,229,23,164,188,31,97,110,235,27,254,23,190,81,40,-115,70,72,89,140,165,230,9,177,106,242,237,220,141,16,114,251,2,75,235,-196,140,97,112,11,203,193,123,186,140,145,113,10,65,86,32,183,52,192,83,-211,42,90,95,189,211,46,235,31,21,22,254,82,77,188,157,159,185,52,243,-38,167,233,113,107,120,225,244,114,10,211,252,126,23,108,151,76,53,135,246,-16,89,234,3,219,44,210,164,39,70,35,253,14,31,95,29,7,0,113,250,-154,197,30,74,126,1,13,208,237,78,217,113,231,59,26,119,202,251,116,161,-185,186,116,249,82,50,63,158,122,48,127,15,214,46,8,220,95,209,129,123,-207,255,193,54,82,45,205,181,214,190,88,137,134,209,148,201,243,58,211,83,-24,152,26,160,148,82,175,231,199,90,246,138,238,3,241,200,89,109,39,255,-132,16,27,152,128,243,236,72,211,139,141,203,91,174,220,180,68,238,7,64,-84,96,115,236,129,1,171,199,67,84,89,204,119,44,192,224,233,250,120,179,-188,221,214,238,65,69,89,77,73,153,184,251,240,180,33,61,248,178,206,193,-227,46,234,4,184,89,57,116,93,13,194,114,181,149,188,145,215,217,216,126,-226,123,107,201,161,6,61,172,80,187,144,66,51,55,123,104,42,166,196,119,-100,6,186,198,123,242,4,94,177,91,167,93,36,144,254,37,170,117,81,40,-81,143,210,157,181,84,155,107,142,180,39,246,140,224,173,180,163,181,241,243,-149,158,185,120,164,157,101,10,143,164,7,24,166,42,90,81,123,142,150,202,-75,214,88,229,126,166,74,51,110,11,85,217,169,175,195,216,130,19,198,83,-15,246,112,208,247,92,148,246,204,158,247,176,250,176,130,64,6,37,171,181,-75,239,138,209,98,204,20,92,200,187,166,199,217,42,234,40,84,141,179,53,-94,37,3,19,13,139,76,230,208,27,147,239,18,77,161,59,229,147,93,119,-53,169,110,254,232,33,216,239,231,50,22,241,32,197,246,8,46,99,151,249,-85,69,128,57,153,165,17,78,11,232,215,139,30,236,50,25,240,178,100,221,-60,41,75,85,142,33,125,192,203,125,45,53,176,37,216,106,7,201,107,151,-42,143,52,234,220,140,230,184,233,9,118,67,252,100,1,179,3,188,94,175,-127,151,128,164,91,217,193,188,54,7,43,80,79,55,184,240,32,13,227,23,-168,136,60,97,28,246,13,190,100,196,219,205,123,110,181,130,99,129,209,18,-197,107,55,58,23,229,125,150,46,254,181,209,92,225,89,171,197,63,46,169,-204,85,42,166,236,162,156,104,206,114,53,159,15,233,216,33,217,74,180,212,-76,115,228,157,164,151,210,66,125,9,3,253,208,126,35,46,211,108,84,136,-44,148,85,4,211,138,188,88,145,161,10,221,17,157,221,119,122,126,227,125,-100,5,231,29,5,30,161,232,46,217,92,7,33,173,135,179,101,103,210,107,-27,193,60,227,221,62,234,165,216,2,162,147,101,104,222,37,228,87,151,55,-37,22,104,100,53,27,51,55,110,170,121,79,182,100,105,65,63,48,169,150,-18,18,217,140,141,66,146,5,122,77,171,104,56,252,191,64,76,240,34,66,-216,121,187,158,4,208,198,133,109,216,99,19,35,56,61,166,231,5,55,20,-137,185,213,147,216,23,25,67,28,19,36,140,97,250,25,1,243,9,164,218,-125,224,152,215,27,229,18,76,137,159,25,234,253,220,245,184,67,146,108,146,-251,57,112,225,38,137,244,106,201,171,126,129,51,227,198,209,244,48,222,27,-127,134,204,80,164,255,111,2,48,171,236,5,220,9,174,64,214,37,164,54,-50,193,162,166,243,205,33,129,58,90,75,28,93,181,21,163,13,156,65,2,-128,119,180,72,75,223,245,254,77,100,197,136,217,9,218,121,7,84,175,160,-84,94,204,99,3,132,111,71,105,189,17,103,170,141,221,200,66,124,97,132,-95,93,178,24,132,42,59,171,33,169,53,207,32,106,167,141,106,55,76,226,-52,224,223,228,62,148,54,250,36,90,197,194,175,254,127,29,30,123,172,225,-140,234,111,243,123,137,135,194,232,196,5,162,57,246,46,84,95,11,246,101,-59,61,13,55,37,227,252,153,190,221,19,107,64,115,109,41,185,240,29,226,-168,58,157,74,210,156,65,185,87,38,133,222,48,131,50,72,118,253,12,27,-99,100,228,135,107,132,50,38,52,27,146,4,142,179,158,237,202,65,103,65,-211,224,144,180,84,143,186,57,225,209,217,45,91,15,62,53,58,173,244,70,-210,207,91,195,68,237,67,216,136,20,72,101,18,193,238,207,25,152,108,248,-247,72,41,29,84,226,209,85,183,10,186,207,176,52,197,131,32,9,54,201,-172,123,80,202,115,227,94,121,14,101,212,154,223,147,238,219,143,179,193,7,-156,134,6,20,41,223,195,242,209,6,141,219,253,185,45,27,243,22,56,207,-235,105,185,95,203,192,50,235,9,11,214,92,129,18,4,32,78,5,67,62,-65,88,133,116,233,218,249,144,109,116,133,180,186,84,106,144,134,107,102,58,-121,15,211,203,210,107,159,59,247,222,84,216,214,30,84,85,132,11,210,19,-158,181,58,8,247,104,193,185,182,174,219,12,205,167,92,210,177,22,112,4,-180,176,63,36,164,154,45,14,133,66,201,31,169,152,98,227,128,110,11,39,-56,246,249,244,12,90,195,187,249,93,38,166,194,247,17,225,88,9,213,1,-242,104,62,15,108,75,46,23,45,23,210,63,123,236,52,173,40,10,139,119,-31,184,159,19,120,162,35,147,245,140,93,94,84,172,17,98,85,200,151,237,-25,104,149,44,204,213,51,249,48,109,55,183,91,172,59,155,54,203,55,78,-139,88,117,164,122,143,16,165,145,43,82,116,199,62,87,128,180,69,108,62,-204,194,5,165,146,22,140,148,149,197,61,212,251,251,168,36,40,193,67,20,-156,238,161,204,63,173,101,156,162,218,55,136,225,219,125,241,204,160,15,38,-234,117,38,207,104,178,61,32,207,249,122,83,243,95,129,135,126,187,84,243,-158,2,42,197,141,13,68,47,124,248,25,237,195,97,137,154,79,248,173,191,-67,90,11,55,130,236,94,40,104,33,175,162,23,144,199,37,66,174,43,89,-29,98,128,183,189,163,88,240,103,213,191,151,196,143,5,245,99,170,25,207,-48,18,107,151,79,196,202,36,97,69,152,123,180,72,127,197,216,220,136,145,-239,28,182,162,243,59,172,207,22,37,228,33,177,158,90,251,244,71,78,117,-86,139,143,221,8,188,177,167,121,72,32,142,34,141,242,97,192,196,60,101,-217,194,27,23,125,168,81,14,62,169,50,148,102,195,123,36,90,62,3,116,-114,25,143,50,177,179,81,53,16,66,150,98,54,138,208,80,51,146,26,198,-85,28,10,209,205,125,186,144,142,134,51,1,162,231,14,69,23,27,213,30,-127,25,146,127,164,109,221,240,161,116,185,79,128,240,30,239,23,206,131,110,-239,224,112,150,218,31,176,181,129,17,24,64,109,2,48,174,204,128,208,188,-197,0,50,164,209,23,232,27,127,164,168,153,140,238,213,115,18,224,33,79,-225,78,161,81,117,143,164,68,20,206,36,120,19,81,3,240,198,91,184,89,-182,179,16,87,93,11,41,195,99,162,190,89,240,246,224,6,46,207,35,27,-65,51,32,243,67,3,61,108,68,108,36,75,95,136,126,219,113,220,252,158,-22,71,215,96,72,115,104,82,24,70,140,225,76,95,53,87,17,113,243,222,-78,49,158,153,144,96,67,81,245,1,135,254,127,55,26,180,204,79,21,197,-157,34,252,160,238,163,88,157,29,198,37,10,162,172,24,222,90,161,251,39,-40,122,41,43,125,71,211,80,238,93,252,221,107,149,0,33,99,49,43,118,-6,115,118,186,181,198,221,134,172,127,227,107,5,217,106,48,189,184,114,186,-223,253,80,46,211,13,37,32,80,187,154,232,254,227,92,177,177,218,86,100,-125,228,197,186,253,150,114,162,151,124,159,128,14,50,240,115,2,114,65,207,-183,247,231,201,226,192,232,95,85,81,139,88,143,141,162,26,112,106,192,104,-7,72,32,162,230,204,14,213,228,255,134,12,133,235,119,119,91,38,242,250,-58,211,152,64,108,199,50,255,145,28,97,64,35,218,185,251,210,77,56,53,-40,252,5,232,146,34,177,178,2,246,18,112,188,252,29,37,195,167,38,105,-142,160,94,166,97,94,92,87,108,79,104,189,107,0,144,152,82,111,16,97,-122,100,245,135,77,49,82,125,94,229,253,151,45,112,144,74,170,246,161,142,-169,14,192,97,238,192,125,82,46,58,119,140,43,190,230,55,149,227,76,78,-143,176,140,92,129,124,220,253,67,112,172,246,24,151,25,176,202,51,70,156,-34,137,15,19,224,172,153,119,167,106,17,50,107,13,169,11,139,142,165,72,-133,160,58,21,165,97,188,60,163,59,121,235,205,144,108,106,233,207,4,237,-127,71,158,87,32,113,123,218,186,241,92,3,109,115,54,119,230,238,150,19,-32,163,82,107,223,79,228,5,236,95,88,40,191,157,28,198,199,67,208,111,-206,38,211,76,5,149,175,203,92,10,111,192,109,197,196,213,145,188,144,106,-181,117,147,61,204,42,81,209,254,1,74,168,185,82,207,104,58,169,114,177,-134,156,176,49,222,27,236,28,9,222,21,57,84,150,195,122,198,33,171,141,-40,106,126,25,191,163,78,91,121,77,103,199,28,62,202,8,246,255,181,142,-236,97,195,52,195,190,155,64,45,14,205,157,32,221,206,6,128,84,122,205,-213,177,246,229,246,182,50,140,22,187,108,177,255,227,239,97,24,159,127,83,-18,24,42,46,115,101,132,47,63,242,160,146,71,208,52,62,28,220,110,110,-35,255,59,201,160,9,238,201,12,70,200,31,195,38,174,179,253,122,178,83,-246,54,12,230,145,253,247,190,176,163,94,163,75,53,162,226,1,244,70,163,-206,128,74,234,221,68,222,189,209,205,28,242,174,134,146,208,219,26,9,33,-97,144,75,126,64,122,183,144,97,59,207,196,210,36,179,79,14,131,212,216,-129,158,241,5,142,201,166,135,125,230,184,97,85,94,220,26,87,103,192,250,-55,22,226,222,197,251,196,151,111,228,215,171,195,162,24,202,120,52,215,61,-215,181,219,246,154,44,105,230,66,179,167,175,17,150,212,86,134,30,204,59,-13,197,109,73,212,192,169,131,195,27,14,134,193,39,136,50,187,217,219,189,-47,7,250,21,234,162,114,70,101,204,17,47,182,57,101,7,169,57,186,0,-195,161,153,250,172,188,173,152,191,24,64,86,194,41,88,110,148,15,95,37,-145,6,202,17,20,32,163,85,7,225,204,136,88,207,60,240,184,51,27,49,-99,175,209,181,222,165,101,6,236,193,105,170,110,117,170,112,222,211,24,245,-248,59,199,27,94,196,40,49,181,54,103,234,42,102,11,97,203,178,93,86,-117,3,174,254,129,164,148,109,233,30,3,179,109,246,3,220,78,75,247,114,-250,249,212,18,136,170,82,219,48,63,41,192,86,76,39,113,107,147,130,25,-123,102,44,62,46,209,209,17,7,147,88,248,68,152,142,85,222,229,208,168,-233,139,35,10,215,54,181,172,243,65,26,204,174,50,20,131,28,215,23,150,-138,48,255,100,36,25,122,45,96,162,5,151,126,136,27,212,236,125,102,2,-126,135,84,208,9,9,129,73,12,73,228,135,181,19,112,124,222,236,132,42,-203,232,29,223,177,194,51,32,144,25,223,198,238,82,178,202,198,53,226,28,-52,12,151,20,68,13,1,153,91,86,221,223,108,165,118,28,181,235,210,140,-155,54,48,62,190,19,75,164,25,217,6,87,222,38,7,17,21,183,23,154,-153,219,109,236,116,165,56,92,242,247,144,39,13,143,64,102,49,248,121,99,-25,207,116,88,74,71,10,18,194,121,122,252,43,2,43,224,57,35,213,188,-110,172,119,57,177,81,88,53,243,182,157,177,59,103,163,84,113,154,51,104,-102,217,228,255,185,112,236,230,37,47,75,110,87,139,87,106,134,219,201,138,-249,92,198,209,124,228,38,125,62,48,226,92,2,83,126,77,25,152,239,136,-127,122,14,237,44,7,15,207,216,9,30,23,181,248,169,84,53,244,142,120,-32,221,127,46,76,172,54,128,216,190,72,28,199,167,155,175,112,148,222,252,-68,10,90,215,246,53,120,42,146,237,152,5,46,158,112,14,32,206,109,194,-213,183,145,193,222,124,212,45,24,82,23,19,94,36,72,34,232,141,70,239,-148,55,115,218,162,78,12,193,12,188,27,101,16,115,111,155,223,71,102,166,-220,254,189,228,159,81,175,176,94,167,178,45,238,112,16,162,201,196,2,176,-212,90,242,19,125,92,188,195,33,102,186,134,141,63,124,239,113,40,240,236,-67,154,210,186,59,133,185,161,202,36,168,75,127,198,209,227,247,85,22,57,-63,14,185,40,122,40,38,86,5,158,22,185,201,127,59,239,148,105,200,155,-24,78,210,58,196,111,32,136,145,146,28,188,65,41,130,198,94,144,194,149,-21,183,110,2,75,95,62,93,27,173,116,206,1,36,92,136,164,190,150,45,-252,229,252,61,153,198,161,29,150,108,195,210,134,119,140,94,247,130,170,143,-23,254,35,111,65,176,44,204,98,202,148,115,20,128,242,199,123,53,40,12,-239,40,61,55,163,162,180,47,70,163,240,45,128,84,22,215,217,255,177,95,-32,166,75,17,255,225,60,184,175,153,207,42,138,167,50,188,247,221,56,9,-112,221,5,81,30,148,6,147,100,17,10,87,16,178,181,92,121,98,18,204,-237,136,32,123,5,70,140,106,34,115,200,78,233,191,158,71,28,19,203,61,-136,158,158,241,190,138,14,14,126,231,188,184,30,127,218,61,26,70,34,247,-106,96,58,169,206,129,222,158,47,52,107,155,64,233,8,3,10,251,214,217,-225,117,179,5,29,206,213,142,79,89,246,192,151,161,191,34,77,227,227,201,-116,150,225,188,74,81,255,212,79,64,52,43,203,235,197,229,197,177,19,153,-184,67,130,207,145,65,176,21,82,100,28,28,96,225,162,181,178,169,247,254,-240,17,109,193,4,199,210,48,173,204,95,143,146,101,108,103,146,217,179,99,-110,62,237,79,114,175,242,150,60,176,42,53,217,196,55,170,62,191,150,62,-168,234,70,166,103,247,198,118,53,1,60,80,159,222,30,46,112,150,8,159,-241,139,188,204,109,209,95,10,51,220,35,176,54,208,241,39,184,251,36,52,-31,204,235,63,176,223,141,18,188,62,42,23,103,75,239,31,39,252,214,205,-217,79,180,58,5,121,132,162,134,143,116,80,128,137,93,51,97,126,167,34,-22,209,7,155,41,92,19,166,56,255,193,239,246,231,43,139,230,54,167,240,-137,183,188,37,113,31,249,219,240,241,253,38,117,6,73,129,168,186,170,22,-143,200,171,12,226,20,150,138,61,138,14,139,52,221,240,232,217,25,38,99,-223,235,46,36,97,151,49,218,119,239,156,209,255,250,186,111,245,102,232,144,-118,177,231,96,185,168,75,249,206,79,134,47,7,109,146,250,172,38,161,97,-209,49,196,162,164,224,62,176,189,62,176,166,110,63,98,39,198,82,149,242,-221,239,152,20,110,232,142,199,217,9,111,71,190,173,77,150,180,130,179,13,-145,84,143,34,54,161,107,54,1,120,253,15,0,237,57,206,106,51,198,186,-26,249,234,172,112,160,251,221,96,247,221,148,175,249,3,1,8,243,0,101,-139,252,211,113,200,163,216,201,234,157,103,113,154,218,5,22,44,190,228,118,-40,0,122,33,244,107,219,234,229,215,203,127,164,73,171,129,202,105,6,24,-239,29,204,133,16,103,121,149,48,148,47,15,189,149,7,51,166,56,8,229,-252,65,251,62,176,1,29,205,230,70,193,74,187,249,228,254,137,37,204,143,-67,130,178,29,65,213,209,194,224,245,186,59,53,167,129,135,126,119,84,234,-67,84,11,180,230,191,173,192,89,49,63,125,133,143,110,93,214,115,196,53,-228,225,118,48,239,248,186,237,172,104,117,212,150,88,255,40,95,101,36,4,-30,22,134,13,83,46,76,23,214,58,225,10,245,22,130,79,124,127,45,36,-138,97,57,98,60,251,88,237,218,53,25,10,94,156,195,40,172,182,61,172,-34,196,9,127,191,79,196,5,2,31,179,39,13,85,246,144,85,133,168,104,-29,10,199,12,210,221,194,122,98,155,157,5,182,237,96,241,144,142,253,158,-89,181,70,29,2,161,3,200,15,238,251,99,236,8,210,81,93,19,214,82,-20,137,118,144,167,101,42,158,117,122,31,122,175,221,195,141,169,217,112,191,-80,51,148,107,250,185,40,28,252,129,22,211,67,179,53,36,38,116,254,223,-208,209,56,221,155,33,7,221,132,53,202,140,20,181,220,2,55,184,87,208,-165,141,133,21,54,85,43,222,109,245,23,149,81,239,210,140,24,80,42,193,-187,16,52,243,170,220,59,130,141,156,163,13,158,69,148,208,151,120,116,39,-209,47,169,70,108,213,202,73,128,32,106,233,99,135,207,97,32,229,152,4,-232,248,92,231,20,184,223,168,163,55,38,130,27,167,155,7,207,201,71,133,-72,204,135,90,97,187,250,250,168,202,24,205,12,127,208,110,102,147,151,247,-140,43,252,137,33,142,125,247,170,252,27,233,49,91,162,188,84,199,154,177,-71,127,174,218,40,176,168,104,183,180,45,110,196,124,239,172,186,234,64,191,-132,177,86,79,191,18,70,21,231,26,13,82,135,1,91,135,27,105,27,74,-187,119,108,102,203,236,12,235,93,154,125,116,79,203,185,162,78,172,30,232,-117,118,42,115,209,5,84,89,92,115,53,107,63,46,167,134,98,219,203,50,-181,206,190,79,47,112,244,126,7,152,13,119,54,34,94,230,174,7,77,45,-114,25,122,150,128,27,83,238,204,145,236,129,60,136,31,40,155,98,147,157,-23,26,88,213,195,216,60,93,208,117,116,110,106,156,236,116,149,91,223,139,-254,218,223,109,22,58,179,154,152,184,20,91,133,64,28,79,55,2,123,197,-108,46,143,58,162,115,207,84,161,185,110,106,76,196,15,103,12,117,37,96,-73,34,3,199,149,250,159,220,161,191,1,128,121,140,126,149,135,140,176,111,-58,137,200,244,3,174,174,129,241,93,83,159,229,151,73,74,15,53,43,75,-244,93,203,211,209,201,98,103,126,64,87,194,175,68,70,155,15,151,193,145,-154,187,229,105,72,102,159,53,32,233,196,141,87,89,102,5,229,191,110,33,-217,168,219,36,193,71,107,92,46,210,162,46,240,143,54,30,153,248,125,3,-119,218,3,211,78,208,231,75,243,98,237,54,94,188,181,189,144,184,199,149,-71,222,5,161,20,204,13,67,200,158,173,91,38,198,7,199,116,163,161,37,-33,61,91,27,163,138,91,39,165,218,97,17,9,183,214,89,112,17,16,238,-162,115,238,24,202,109,11,157,65,116,220,3,237,15,105,241,166,31,196,160,-114,21,8,161,123,152,225,129,40,253,176,15,90,236,159,137,104,112,114,247,-190,118,188,216,194,92,26,225,135,127,21,69,69,21,194,101,64,250,229,231,-179,98,180,9,249,163,207,42,132,123,238,87,133,213,115,223,6,126,254,10,-8,61,10,161,52,182,135,103,157,36,85,12,182,17,121,188,96,95,71,65,-79,129,139,131,129,39,177,190,170,135,143,35,36,0,214,194,74,210,31,90,-27,169,136,83,167,111,212,253,6,102,94,245,155,47,82,247,94,222,238,63,-11,133,210,67,44,132,242,18,78,212,112,15,208,95,209,165,94,31,244,230,-96,94,163,44,154,93,154,205,19,236,57,200,126,84,38,22,68,12,98,124,-77,44,239,129,190,19,72,29,210,197,180,55,176,152,25,14,121,119,214,255,-48,158,65,167,205,230,166,36,248,24,90,40,25,147,92,235,187,23,119,219,-252,97,174,147,185,21,242,232,95,61,100,239,92,202,179,107,80,163,169,136,-162,116,85,216,198,75,254,69,174,14,223,4,135,88,81,89,54,33,231,191,-233,127,196,206,101,83,66,36,98,214,132,10,175,245,188,108,248,9,222,50,-13,84,149,103,66,119,61,94,186,219,69,181,19,144,124,220,102,182,48,196,-183,161,156,248,236,60,15,150,112,42,247,150,8,92,49,255,103,26,101,113,-125,182,214,195,111,226,220,250,227,17,21,102,248,131,25,59,112,8,127,83,-32,123,252,223,234,196,182,16,222,254,37,94,143,71,248,51,209,11,165,233,-238,182,119,17,167,224,161,182,145,183,44,17,144,12,175,202,64,115,188,143,-250,230,49,52,253,23,50,170,174,209,137,218,169,226,56,128,68,226,118,169,-250,44,159,71,88,205,3,72,174,107,200,219,219,192,190,229,27,141,210,86,-135,31,147,13,126,243,168,30,137,210,107,49,170,183,17,217,103,66,41,85,-86,205,139,99,202,118,209,68,227,51,96,40,37,2,172,26,168,200,125,134,-186,223,141,230,203,63,228,52,153,177,171,243,196,48,203,67,38,57,20,133,-148,122,102,89,103,241,221,160,5,161,103,69,230,55,133,24,74,97,23,20,-237,109,60,25,49,57,191,214,233,117,212,93,140,82,203,239,48,178,238,223,-192,74,210,184,219,191,129,124,216,147,236,187,39,91,0,45,93,15,45,101,-173,170,194,7,213,176,34,199,151,200,133,5,53,77,60,40,100,125,147,135,-166,104,57,227,6,39,211,127,6,148,71,194,41,82,112,34,211,67,147,244,-144,168,184,140,44,62,114,38,157,246,77,32,234,38,192,131,29,175,148,219,-56,171,186,236,51,159,96,142,177,139,140,1,162,70,227,93,88,212,217,30,-142,119,232,19,101,136,222,132,186,27,165,88,167,32,5,67,244,35,47,131,-83,75,218,4,7,102,43,135,200,86,67,211,122,139,208,195,155,207,204,178,-74,208,236,173,204,24,56,57,204,181,65,28,122,138,103,118,195,113,99,67,-68,188,31,246,104,94,187,242,173,48,10,20,214,32,144,189,212,240,245,171,-192,240,18,110,187,107,118,230,131,207,9,43,128,231,61,169,192,247,240,82,-249,105,65,123,135,50,101,58,135,134,248,13,224,40,62,102,167,68,133,216,-93,33,222,38,54,72,79,191,92,254,73,173,106,70,18,140,73,41,231,14,-181,94,242,172,124,19,250,91,188,206,3,79,200,136,129,149,245,5,9,251,-25,226,104,101,210,157,201,142,61,147,69,87,59,233,12,129,13,67,137,244,-208,74,88,41,68,180,150,157,247,37,166,10,131,84,180,66,176,196,215,242,-28,44,76,225,62,250,26,197,32,67,36,73,250,20,247,129,44,51,62,183,-43,199,61,197,137,165,254,142,221,111,32,52,153,188,85,10,87,56,6,217,-26,36,138,248,140,65,113,229,65,67,252,104,255,87,203,179,125,39,221,32,-244,2,225,219,178,107,53,246,119,202,154,248,123,253,31,33,107,188,175,83,-58,158,1,219,177,218,178,42,157,157,139,127,81,231,250,182,239,249,124,215,-21,184,250,0,172,136,231,198,138,234,7,47,49,203,65,185,227,26,192,215,-16,69,69,223,132,39,243,65,120,178,165,107,250,65,0,108,53,199,102,102,-166,87,31,194,51,98,5,42,52,84,36,184,173,133,148,168,224,128,76,5,-58,130,78,231,33,235,212,168,209,46,65,109,24,195,48,16,222,252,86,92,-212,117,70,239,165,212,125,133,161,191,17,234,58,58,99,143,96,80,250,157,-90,22,61,113,125,235,39,52,252,78,149,165,104,242,226,98,192,185,205,94,-190,225,55,49,0,229,130,162,52,129,67,100,156,200,52,193,86,158,211,162,-20,149,25,239,119,215,214,108,255,197,27,17,22,94,233,106,165,48,232,170,-244,222,220,1,127,247,196,252,203,238,85,82,101,50,50,122,37,38,187,150,-249,240,203,249,226,192,246,33,205,215,165,64,239,243,54,252,180,156,189,98,-140,106,18,131,17,170,6,41,234,17,102,105,71,96,200,105,72,144,84,109,-230,200,139,22,8,192,79,69,143,106,40,113,255,51,23,157,30,57,228,160,-78,9,18,243,211,153,137,236,138,197,207,128,112,122,231,167,179,140,249,135,-182,213,38,48,223,35,235,69,57,20,90,216,7,135,228,165,203,102,74,35,-57,53,12,113,64,216,54,2,183,8,171,101,225,155,165,237,181,149,236,165,-110,230,117,50,235,190,115,10,54,185,221,14,249,97,203,27,78,69,249,74,-57,166,133,21,33,168,171,237,70,33,232,15,212,224,190,44,45,140,192,255,-213,134,4,71,146,83,111,223,106,106,60,155,88,60,79,150,242,6,147,64,-148,90,45,174,186,221,101,200,197,64,158,108,171,181,131,209,217,94,47,230,-83,184,254,13,152,218,42,238,156,37,140,10,119,251,68,161,104,23,144,216,-117,48,29,226,219,176,216,55,144,24,114,146,17,78,72,31,147,252,12,47,-234,84,36,142,41,172,23,171,10,151,68,216,81,193,32,204,175,77,239,139,-54,45,1,219,186,47,182,194,249,185,63,247,206,5,158,60,203,222,29,210,-241,83,93,101,90,252,169,183,35,94,51,84,237,78,18,185,164,207,39,183,-93,166,198,192,197,19,86,162,8,134,157,166,140,41,191,100,57,124,202,208,-72,188,72,150,151,162,99,214,135,83,127,64,84,35,129,91,156,16,123,138,-63,182,249,179,105,224,32,106,197,223,191,53,40,1,255,7,57,40,241,148,-196,154,153,146,96,112,179,5,114,149,216,61,242,222,219,125,193,5,249,180,-200,248,9,80,32,32,69,174,150,234,138,87,214,57,90,111,171,140,126,239,-65,30,125,236,103,71,228,203,77,76,190,107,128,190,84,172,182,83,70,38,-221,157,214,15,26,41,155,93,160,119,76,234,7,62,54,48,215,249,190,224,-24,92,184,229,111,166,138,218,100,65,159,235,64,170,163,97,181,158,98,26,-83,20,51,139,183,82,13,101,13,74,117,191,216,162,217,19,20,246,249,236,-52,145,136,73,32,210,230,48,212,72,33,117,195,154,110,192,170,87,49,174,-206,2,191,81,10,9,85,155,249,84,215,78,252,143,227,72,107,243,133,219,-115,33,101,253,51,103,78,221,240,166,92,212,125,87,226,82,226,51,174,66,-235,97,37,67,183,100,190,60,216,1,7,158,190,160,172,150,49,203,52,154,-153,71,208,28,158,5,237,214,5,196,111,41,11,42,187,156,202,252,191,190,-104,137,176,61,113,154,180,105,14,111,35,163,214,141,173,146,10,123,178,140,-162,112,107,30,57,241,76,254,243,114,45,115,26,240,79,20,45,189,104,243,-231,131,171,216,121,48,172,28,50,197,61,121,217,203,47,104,184,74,131,132,-61,32,22,80,226,179,129,169,94,123,161,186,227,19,17,66,245,249,168,234,-185,215,65,82,6,113,116,56,72,148,125,103,2,63,50,90,189,223,139,11,-165,42,129,149,13,14,57,22,53,251,180,29,80,36,35,74,88,203,247,225,-230,85,195,241,97,94,126,192,196,229,67,128,124,70,165,192,154,20,136,135,-130,249,187,113,157,108,205,250,215,5,77,212,81,214,255,210,122,176,54,131,-136,112,213,183,13,18,5,104,34,141,88,8,236,106,248,115,233,239,106,65,-103,180,2,231,56,41,68,224,9,42,102,107,165,190,247,109,163,166,121,35,-225,250,245,75,232,193,135,181,94,254,122,157,133,251,185,25,93,51,193,210,-168,153,140,44,19,210,84,64,4,139,16,18,224,116,35,93,77,185,124,138,-104,145,35,72,140,139,51,13,105,112,50,8,18,170,214,37,205,248,175,131,-67,142,236,67,37,231,67,27,219,50,214,164,172,218,144,120,243,222,200,70,-228,188,46,215,148,236,33,250,94,162,20,33,80,56,108,56,37,10,139,64,-159,19,62,211,149,252,57,165,99,39,41,45,72,170,237,224,58,67,82,175,-169,54,209,231,182,74,45,92,51,167,22,245,83,222,91,18,248,94,181,77,-227,23,201,203,24,184,186,188,183,62,228,26,63,181,197,213,55,101,8,206,-32,125,46,95,242,82,115,211,35,79,195,33,162,55,110,129,45,114,33,110,-131,157,157,46,138,90,78,155,92,17,227,101,203,196,93,19,159,137,138,115,-183,247,244,172,19,141,96,60,137,240,155,226,59,162,64,227,123,216,219,126,-28,28,47,117,116,53,145,109,219,206,223,137,171,96,5,161,142,216,27,13,-106,97,229,152,102,166,118,177,247,124,89,117,199,235,125,161,89,250,198,134,-157,214,178,217,150,27,51,159,165,213,114,195,125,26,104,160,55,141,91,79,-89,201,83,245,140,223,237,188,19,51,228,183,96,126,238,237,240,109,236,99,-154,214,3,223,118,107,222,163,171,203,217,75,74,1,249,132,84,139,109,28,-174,144,46,143,20,52,224,201,118,191,245,30,64,198,125,51,143,6,66,188,-219,220,164,61,135,93,22,85,63,54,80,32,239,92,180,242,135,172,202,236,-54,154,123,33,226,228,114,152,103,19,62,199,237,255,68,228,112,144,229,139,-205,239,160,42,173,90,93,115,18,40,45,184,185,107,72,113,194,34,245,121,-219,40,89,116,209,102,77,100,33,77,124,131,119,55,208,195,214,6,19,158,-212,17,249,10,43,50,62,238,100,236,164,44,21,223,254,224,38,212,252,71,-148,70,85,56,109,84,24,161,67,40,218,45,65,56,157,5,190,225,53,165,-213,91,205,156,53,80,31,242,10,119,17,184,206,125,255,147,69,86,198,201,-73,121,127,20,5,6,86,225,177,174,161,30,65,182,226,94,250,229,115,233,-193,129,231,12,207,222,170,194,222,143,255,252,10,71,66,5,50,212,38,144,-244,153,166,46,150,135,166,164,208,231,208,55,252,197,69,5,166,210,31,62,-103,49,186,186,21,213,224,22,46,18,142,95,19,105,195,30,0,174,178,0,-36,244,9,144,36,207,12,247,161,71,199,91,168,182,81,41,147,207,155,54,-55,99,105,58,87,237,81,186,96,63,166,111,183,146,203,49,118,251,86,220,-98,196,253,35,113,81,102,2,90,206,140,69,153,167,88,221,77,178,139,215,-106,190,5,199,157,14,163,227,223,112,30,14,50,133,69,198,127,222,107,67,-156,84,142,43,202,173,1,80,183,58,201,191,124,149,211,1,33,80,233,23,-123,120,99,228,29,29,20,245,148,174,121,249,170,209,138,14,33,3,209,10,-97,193,144,127,124,60,51,189,177,12,187,150,204,90,33,23,7,156,159,122,-176,43,229,238,81,47,106,97,122,103,15,241,210,92,49,47,220,115,83,213,-40,240,90,179,118,173,8,51,248,76,252,74,105,85,196,118,175,103,163,181,-250,128,225,96,39,149,109,162,39,56,97,121,178,27,146,42,51,200,70,193,-252,219,228,158,195,220,21,201,219,234,96,44,27,85,147,255,67,84,105,4,-122,130,228,162,241,142,246,51,14,200,183,195,178,13,37,137,234,13,69,118,-74,13,139,247,127,76,234,82,208,189,37,80,57,228,163,76,239,232,219,238,-220,48,173,100,110,73,237,16,12,64,227,211,175,56,201,77,83,106,204,233,-184,141,136,170,2,101,250,209,125,70,104,125,158,216,58,140,139,236,172,103,-139,36,185,126,62,241,66,83,241,89,177,220,176,7,98,243,178,46,65,179,-192,221,48,243,220,169,249,222,177,114,29,102,75,178,109,203,146,104,84,194,-232,97,177,181,246,183,236,159,81,137,167,140,90,174,109,203,134,15,162,39,-191,197,237,34,12,113,143,17,229,64,223,78,202,96,199,90,39,122,111,231,-7,56,10,178,254,51,208,225,83,193,84,151,127,58,194,185,217,38,40,254,-126,15,191,115,20,47,103,17,43,85,224,189,253,119,21,54,90,104,43,141,-138,245,217,229,160,21,63,234,120,106,116,50,45,196,139,172,181,50,7,155,-200,161,56,127,201,58,152,86,176,217,74,3,137,108,121,24,123,204,94,44,-227,119,122,132,82,229,71,37,45,81,183,175,94,191,103,179,230,71,207,156,-10,107,100,239,235,16,212,125,64,207,102,72,240,6,120,23,251,65,65,198,-94,65,177,111,155,150,98,140,79,205,207,107,15,145,91,142,248,163,224,34,-76,93,40,187,81,149,97,15,79,88,219,139,30,132,137,60,88,202,143,112,-104,30,176,111,24,209,171,120,97,197,237,176,59,213,212,141,109,109,244,190,-154,6,131,207,113,194,36,185,214,36,239,40,73,84,187,28,151,9,203,180,-43,250,22,213,130,4,36,243,213,166,24,56,196,248,76,220,20,33,104,100,-48,143,153,234,124,59,189,40,117,205,7,250,32,63,202,203,226,98,235,147,-118,137,9,21,205,15,132,227,48,33,154,253,176,187,8,46,92,60,81,138,-82,145,45,32,43,235,229,205,11,180,105,68,200,172,152,166,20,198,51,129,-77,117,165,38,38,163,126,100,157,71,222,77,53,239,131,53,86,52,167,6,-13,197,167,236,191,100,44,117,114,134,111,47,62,196,141,206,131,195,220,3,-82,4,58,84,25,184,2,111,176,137,52,88,254,235,248,107,59,245,135,171,-207,241,181,90,186,123,49,219,255,222,109,232,62,64,97,38,76,190,103,49,-134,98,8,2,113,103,56,15,254,208,217,129,28,70,119,5,164,66,188,198,-68,155,17,110,21,176,164,229,25,231,93,67,143,48,115,184,162,83,1,55,-20,110,200,130,49,111,204,225,72,115,110,207,233,148,243,70,16,85,34,99,-145,99,197,231,165,25,162,245,233,165,201,96,234,201,217,127,125,232,130,180,-177,10,24,85,157,255,95,174,41,217,138,154,131,175,8,25,114,212,85,74,-236,137,64,25,27,252,0,14,145,125,172,95,225,168,233,43,215,169,180,193,-243,0,173,44,176,47,117,108,237,250,189,211,105,254,73,23,205,222,40,4,-21,188,114,166,66,43,68,144,70,173,185,181,239,61,116,134,11,212,4,90,-238,157,42,8,70,51,77,84,145,198,162,153,122,170,131,155,42,150,114,89,-111,11,14,228,149,214,58,123,213,166,128,103,130,50,178,120,98,103,26,223,-131,169,104,100,182,208,163,72,63,212,31,203,134,151,195,10,229,136,220,233,-13,41,235,138,103,214,168,33,135,209,187,69,39,161,182,142,35,70,224,131,-25,129,225,41,114,223,154,91,24,253,149,204,213,86,61,153,146,225,140,72,-142,111,128,151,132,171,249,96,155,102,228,136,139,229,169,117,6,17,223,67,-167,133,191,92,56,79,170,47,217,149,6,159,120,32,42,230,123,171,92,76,-114,41,29,30,248,169,197,100,164,117,177,237,186,99,154,247,84,139,241,121,-92,233,70,158,125,177,86,227,137,6,43,88,46,178,197,76,42,129,254,193,-24,18,171,19,192,153,210,185,99,179,109,175,174,202,49,49,122,207,92,36,-62,83,227,109,153,235,104,3,76,131,26,241,246,176,114,11,62,199,160,222,-196,17,161,116,194,163,238,200,128,176,100,114,147,138,166,180,122,54,179,59,-120,215,49,229,238,102,202,80,56,212,63,91,43,246,9,233,233,32,101,59,-248,73,93,138,128,169,122,153,72,132,149,102,213,200,86,249,236,57,122,77,-225,156,53,249,10,205,212,65,234,106,153,3,123,127,126,37,227,253,132,5,-206,229,33,160,199,39,120,90,179,50,66,166,172,22,96,235,107,12,69,130,-6,167,128,17,30,196,86,213,126,246,28,126,47,214,251,26,35,47,65,176,-55,1,69,53,89,101,144,231,83,93,5,238,20,88,211,30,170,214,63,74,-178,202,221,64,112,16,48,238,236,164,41,39,84,2,200,212,121,225,111,204,-6,60,36,22,199,167,164,189,127,156,75,51,249,13,117,122,95,59,23,119,-207,97,137,70,171,33,152,13,209,10,2,232,195,135,242,96,27,205,128,229,-128,181,198,187,211,212,105,73,58,45,211,126,101,12,170,45,123,16,0,105,-185,103,3,230,80,30,73,148,153,66,25,156,115,97,38,187,169,112,182,48,-127,1,66,129,88,193,208,4,130,54,222,76,58,10,215,38,193,194,30,24,-103,177,132,223,24,79,118,3,138,211,94,28,248,167,79,48,50,11,254,30,-104,158,107,54,131,57,150,211,195,163,3,237,41,123,87,41,65,247,247,68,-125,53,237,6,230,46,133,185,20,186,67,161,146,240,7,71,157,244,85,186,-58,79,15,23,62,2,237,178,65,188,190,173,220,233,169,87,27,236,118,6,-62,227,58,217,246,224,246,240,97,160,119,61,155,5,127,19,193,136,19,181,-29,230,206,249,101,136,182,121,192,59,69,214,226,136,148,155,87,227,205,57,-45,128,174,146,135,231,112,215,183,87,50,20,63,25,220,69,114,62,200,156,-157,182,125,113,200,244,78,126,99,82,215,188,148,1,74,129,139,247,25,254,-113,21,137,148,150,84,217,114,232,95,156,90,7,40,219,139,140,54,174,42,-191,189,135,252,197,213,106,151,79,96,13,62,164,111,75,32,174,66,73,59,-109,60,29,77,33,30,36,178,43,62,108,138,72,218,36,164,210,195,147,95,-239,134,227,38,128,175,142,145,81,178,173,168,169,158,239,114,235,12,141,97,-11,107,253,204,136,128,214,11,77,126,175,91,246,210,140,205,32,228,217,135,-28,135,78,187,119,211,134,168,72,232,74,223,155,116,192,145,6,42,87,114,-66,9,138,188,55,43,101,217,205,31,34,0,237,100,41,115,86,107,5,188,-176,135,70,4,212,155,161,19,172,183,219,131,137,41,43,172,103,13,226,158,-67,140,114,96,221,37,225,58,231,57,163,191,190,105,56,146,94,239,52,13,-41,255,154,213,216,237,201,121,44,192,26,145,40,168,242,94,165,196,117,138,-246,10,133,46,46,209,56,133,108,47,59,253,48,44,91,254,49,167,29,237,-180,8,15,255,203,119,229,93,67,13,202,147,217,161,24,195,112,141,152,88,-16,201,11,90,14,58,35,223,208,80,182,108,121,44,119,155,175,117,73,135,-201,236,174,212,165,231,65,217,222,201,125,96,190,30,1,240,94,157,195,4,-207,44,246,82,131,233,14,107,175,206,198,161,96,173,30,147,51,63,67,104,-61,141,227,40,34,126,230,234,133,250,58,163,145,34,68,34,188,88,150,69,-129,204,245,119,110,182,246,110,9,155,173,179,146,99,215,68,104,67,40,231,-6,100,192,41,225,122,118,15,71,167,203,201,223,71,115,69,102,111,235,154,-92,177,188,2,66,145,210,111,35,232,204,64,224,101,245,145,191,124,249,35,-251,176,9,154,136,72,127,116,26,12,81,113,46,34,147,129,62,107,177,7,-225,192,45,202,12,85,168,235,234,73,171,39,129,246,198,170,184,233,142,106,-20,20,121,36,112,243,149,110,215,90,44,49,78,143,172,245,247,28,97,172,-69,191,237,199,140,9,235,86,182,150,193,138,61,240,82,90,197,116,156,57,-209,125,192,249,205,167,118,200,243,32,200,162,77,132,156,118,10,83,99,30,-87,147,215,196,41,89,173,218,86,12,31,24,157,59,242,123,246,37,41,71,-47,16,63,56,211,40,110,39,153,184,97,67,22,188,98,35,144,83,33,249,-178,143,26,151,242,101,83,25,188,169,239,73,94,110,72,146,130,69,23,143,-237,36,230,223,165,214,170,239,124,217,155,32,140,72,66,92,7,154,152,182,-52,46,193,11,96,42,167,56,225,95,49,86,160,39,131,133,94,29,139,29,-29,96,228,133,132,15,142,43,25,237,23,192,6,18,204,40,189,199,80,27,-12,145,93,41,79,161,231,80,98,187,19,40,34,199,210,129,197,204,87,201,-148,27,108,197,184,177,160,43,245,138,45,74,234,147,235,166,129,67,183,115,-152,81,175,14,104,205,104,238,241,233,49,38,61,20,104,118,76,195,175,114,-11,119,239,45,155,233,71,212,33,161,211,67,234,107,2,8,162,185,12,219,-3,190,28,137,164,154,87,126,188,19,56,11,161,34,93,203,201,173,104,246,-224,188,1,239,149,27,33,82,88,172,173,7,168,208,142,235,5,27,77,21,-6,136,121,143,84,1,243,189,134,230,28,47,2,146,206,161,218,82,93,52,-26,150,164,120,249,107,43,153,232,188,164,202,248,225,213,46,195,139,109,35,-1,59,220,245,83,174,135,23,49,216,2,216,189,141,113,79,188,29,108,78,-108,177,115,41,99,43,231,181,17,124,220,151,139,2,191,218,188,65,255,0,-114,213,74,180,176,16,43,57,249,130,82,137,255,167,21,37,59,116,8,161,-148,243,96,252,18,97,80,76,52,227,229,102,64,244,39,129,195,163,178,167,-49,38,245,234,176,241,97,3,103,140,176,216,162,137,107,242,174,59,100,221,-70,68,160,8,130,167,237,38,115,41,215,255,66,150,4,189,185,203,143,181,-29,95,162,196,223,1,230,247,70,19,255,114,153,61,87,116,241,190,106,30,-216,135,242,167,235,166,109,4,125,112,27,147,81,237,168,215,94,158,55,26,-104,238,197,238,116,163,37,53,90,100,105,3,195,160,77,118,88,127,115,57,-236,144,224,191,60,221,146,183,223,44,50,89,120,160,33,124,59,5,169,253,-130,70,13,228,102,14,103,250,238,218,76,241,244,110,103,49,84,68,131,146,-175,69,121,64,192,231,212,248,16,199,8,122,131,53,173,240,168,197,242,145,-43,25,176,17,111,109,224,169,167,236,20,239,32,76,169,158,225,178,128,70,-62,79,136,35,7,25,172,121,185,139,96,62,116,84,192,46,49,216,144,62,-32,88,141,249,17,144,127,171,27,252,4,75,5,190,165,178,162,119,46,94,-163,168,189,75,238,206,43,2,212,229,39,116,233,215,163,127,95,94,207,11,-178,101,159,77,154,132,187,191,157,56,110,80,238,137,15,157,77,120,249,63,-128,131,72,103,90,22,174,252,79,191,106,83,177,8,183,60,179,101,5,49,-143,81,153,135,182,9,58,202,168,145,126,242,123,193,7,247,0,207,188,38,-168,13,99,116,129,82,230,250,99,234,197,115,76,126,15,19,192,103,136,4,-162,231,249,52,180,180,64,166,32,79,49,86,56,190,62,51,9,230,152,22,-148,164,121,86,102,57,38,112,15,74,32,92,171,64,65,135,250,85,223,73,-159,82,188,120,139,10,30,114,188,46,135,167,80,5,79,132,248,83,117,226,-165,208,97,111,146,57,197,30,179,117,205,212,42,253,30,6,71,127,183,121,-92,117,54,107,160,82,38,21,162,172,123,65,29,71,224,255,215,213,156,81,-213,63,44,175,248,203,238,198,234,153,64,107,158,114,166,121,170,230,230,254,-182,87,43,77,62,2,96,202,200,190,86,142,7,232,227,128,58,32,53,254,-240,131,108,135,74,15,134,93,187,176,133,40,175,66,44,123,53,33,27,22,-154,120,156,153,187,95,220,93,255,3,85,141,122,201,237,59,12,0,241,128,-10,100,60,152,181,149,134,68,121,136,37,227,65,230,243,70,95,108,249,98,-230,200,130,196,189,62,34,131,162,24,113,10,175,105,237,23,247,4,255,233,-178,185,40,21,10,139,194,247,226,108,85,174,20,63,123,243,6,199,1,12,-16,68,161,123,98,85,92,204,109,219,253,227,180,81,210,172,79,44,191,154,-152,98,67,81,156,226,32,36,142,254,176,251,188,244,40,176,32,23,120,232,-15,79,138,126,19,115,208,55,204,148,119,106,189,179,126,191,88,232,235,223,-71,149,36,207,14,125,96,83,112,162,20,69,73,167,74,215,245,202,241,239,-58,178,163,142,146,244,169,36,178,197,57,107,136,143,25,244,10,134,255,164,-84,151,221,236,201,210,68,66,253,226,98,189,142,58,157,23,48,53,37,39,-248,240,214,243,102,154,235,31,245,33,157,17,164,141,116,152,110,14,184,20,-102,17,237,227,207,88,39,128,249,37,14,31,167,160,202,118,194,168,94,193,-239,124,68,154,202,11,247,70,55,238,21,139,99,254,136,215,241,109,200,137,-86,63,135,253,195,126,230,34,183,176,204,185,61,210,250,161,125,37,175,95,-230,177,22,234,205,89,36,134,139,97,91,249,215,233,30,161,20,245,32,207,-230,20,162,134,87,70,65,253,123,47,59,36,88,208,111,158,17,223,55,244,-103,96,203,92,122,226,249,121,90,228,203,136,215,31,103,95,255,110,6,21,-20,18,202,156,134,251,143,40,10,129,77,18,63,185,39,174,63,43,42,46,-12,254,149,147,64,200,43,143,192,117,82,244,238,157,135,219,113,196,49,164,-203,1,58,220,63,193,236,45,43,233,154,162,7,97,188,185,42,125,171,80,-76,113,84,97,198,59,222,10,220,201,121,12,185,140,23,213,102,92,2,219,-44,158,5,56,149,210,123,238,180,133,152,143,108,40,112,139,16,52,116,108,-94,203,36,103,93,124,78,77,41,191,9,174,91,129,148,191,71,211,142,186,-95,246,120,18,56,32,231,68,200,113,141,234,206,184,123,35,46,114,123,249,-63,154,136,169,55,200,18,160,129,0,24,104,95,176,57,126,170,216,13,245,-113,38,228,185,130,45,197,160,108,196,1,58,131,221,169,179,41,84,125,96,-78,184,178,4,40,61,137,89,249,203,242,179,31,2,186,26,159,238,32,52,-171,36,215,38,20,171,36,91,154,238,95,254,223,214,80,29,225,17,158,44,-12,5,244,74,175,193,112,153,51,59,189,254,232,72,140,102,1,39,239,4,-190,69,147,56,217,224,231,134,111,58,165,196,204,80,122,13,221,82,60,23,-48,25,254,232,127,83,109,100,133,190,167,179,188,146,98,243,27,181,64,158,-26,212,114,58,92,242,68,197,50,109,220,74,54,233,40,124,124,24,59,255,-255,243,63,150,30,30,22,170,137,178,209,29,41,36,196,205,119,118,192,96,-103,13,49,130,6,93,25,211,78,159,190,152,153,242,48,236,106,226,238,248,-81,195,202,167,245,97,175,60,114,155,14,219,105,125,168,96,211,217,86,145,-15,46,49,113,120,177,167,99,106,93,38,214,85,218,232,180,115,118,20,135,-23,103,170,146,96,175,36,16,27,208,96,38,13,247,154,7,22,249,15,126,-180,72,214,208,207,185,229,88,8,203,64,212,161,35,59,39,100,166,170,132,-35,254,143,222,50,192,213,189,131,102,226,157,87,103,22,102,171,200,76,125,-88,234,29,238,194,39,141,151,230,232,102,41,40,103,9,29,239,107,107,23,-139,95,94,7,190,97,78,205,118,148,184,145,227,222,55,20,18,47,228,102,-182,117,166,17,134,108,43,27,214,6,7,239,219,115,188,119,118,253,88,219,-122,148,18,158,219,255,110,66,158,178,121,189,34,235,60,1,241,55,58,99,-244,223,175,32,223,184,106,223,47,157,45,150,182,4,198,105,123,58,2,90,-53,128,5,211,20,32,241,89,34,255,103,248,217,216,234,15,203,49,175,203,-155,60,124,119,191,100,13,52,116,231,48,64,47,220,114,47,107,97,197,25,-137,96,197,79,133,171,226,189,255,50,165,112,210,202,79,207,78,134,92,177,-64,221,175,210,49,0,214,231,23,138,116,247,253,14,120,173,173,251,48,113,-160,214,7,117,110,43,145,149,226,84,126,183,199,175,161,111,128,168,239,154,-82,171,88,213,187,65,40,116,116,76,119,130,121,52,139,42,38,31,169,232,-88,121,97,101,250,30,160,74,5,98,37,88,11,161,81,27,156,249,136,187,-118,167,147,41,85,122,100,168,226,87,129,25,115,163,139,203,237,89,155,199,-153,233,43,59,145,164,84,210,197,81,24,139,6,169,231,35,225,181,145,248,-238,224,252,83,59,207,247,210,182,182,9,4,77,129,185,132,166,43,165,48,-171,182,116,213,254,242,202,84,111,99,224,34,71,140,1,54,252,43,132,37,-38,154,149,183,238,197,138,249,100,145,76,161,236,65,241,253,127,208,147,217,-193,207,219,73,33,231,93,187,240,189,157,165,154,194,57,218,176,39,210,54,-184,60,83,81,5,101,107,151,238,93,95,110,163,200,62,25,96,115,150,58,-133,17,149,94,106,176,121,239,121,75,15,195,46,217,166,4,178,236,95,0,-177,172,138,243,176,130,63,112,162,62,193,176,179,110,251,0,83,115,173,54,-76,213,5,180,53,55,48,226,97,252,232,54,88,171,18,109,141,158,114,94,-247,65,161,122,74,189,150,37,49,227,237,121,146,139,105,27,163,135,98,39,-101,197,123,36,140,67,54,67,48,0,76,13,36,184,146,54,183,163,199,215,-65,120,147,122,165,5,184,171,11,190,35,135,42,254,213,73,154,252,11,49,-167,52,214,107,13,238,205,187,152,178,166,227,65,39,223,198,120,254,250,159,-173,195,247,78,182,255,154,163,211,238,48,142,139,187,249,42,215,151,249,102,-7,228,103,124,225,209,155,134,177,106,53,49,77,103,98,247,55,70,4,251,-56,33,239,101,77,99,193,227,192,118,90,249,34,49,99,152,184,184,177,194,-30,92,7,84,71,105,133,17,8,191,222,123,186,125,17,86,50,132,225,203,-3,56,226,150,170,48,80,241,205,164,48,9,153,252,71,208,101,208,55,131,-244,139,22,173,98,138,192,51,201,232,116,142,206,164,244,255,241,127,169,107,-200,43,75,180,205,185,200,214,225,28,216,212,50,101,212,204,27,169,109,0,-115,232,212,16,28,248,50,139,42,240,212,134,28,70,57,237,28,130,44,69,-28,47,204,108,73,93,61,107,64,100,102,78,97,217,216,13,205,216,252,244,-145,158,33,85,227,251,60,121,51,127,172,134,5,103,213,216,43,166,75,25,-159,156,231,226,226,188,112,113,186,222,8,110,140,165,35,184,32,168,180,51,-75,153,166,44,6,38,132,51,174,143,130,55,177,83,244,24,114,211,136,33,-231,230,203,193,63,0,13,44,12,51,133,200,0,128,175,73,251,34,103,59,-145,65,215,40,226,237,223,205,13,18,52,253,193,230,81,182,15,231,39,12,-98,164,43,243,143,51,149,196,108,214,84,28,131,127,238,129,231,85,244,87,-254,194,27,107,172,138,47,82,8,99,190,125,156,26,161,74,202,128,16,30,-12,116,126,10,202,250,138,226,72,226,218,220,96,198,44,228,178,68,136,206,-126,50,36,179,50,81,193,212,239,174,158,220,44,193,217,133,174,11,71,0,-167,154,20,183,61,103,42,49,205,251,141,193,2,166,128,210,10,163,130,61,-54,41,160,71,14,83,191,22,228,133,119,184,179,66,30,33,125,161,122,97,-16,9,152,16,171,126,167,198,242,186,181,14,61,138,233,175,62,65,216,249,-212,66,243,173,227,41,10,63,141,121,201,180,43,236,157,100,190,43,243,140,-218,249,110,86,12,250,203,144,7,129,90,115,130,201,23,135,144,155,100,102,-93,66,193,238,45,25,69,242,129,122,244,204,69,157,88,112,117,128,13,181,-142,70,88,22,223,24,24,60,26,26,178,221,52,251,154,29,231,54,122,179,-94,195,100,111,125,79,18,113,157,180,14,41,148,207,13,212,38,33,209,154,-129,164,112,173,109,12,218,53,144,149,110,50,232,222,6,1,192,253,169,138,-155,146,232,3,40,239,38,75,244,135,154,111,209,45,15,218,93,129,4,23,-174,183,179,182,221,123,31,231,158,242,247,6,200,142,218,157,253,181,119,91,-233,169,64,82,72,119,65,129,19,136,68,104,169,124,208,167,71,106,134,209,-81,124,86,192,255,167,56,26,87,247,194,90,187,230,139,206,116,246,158,214,-89,31,176,124,191,100,217,127,141,69,118,178,100,67,43,238,204,21,151,238,-131,24,202,237,108,69,105,101,18,87,219,199,173,42,194,141,67,151,55,34,-251,127,170,171,197,63,100,65,147,28,226,6,124,13,254,164,89,157,216,109,-128,153,219,79,21,171,152,114,163,55,50,149,224,219,86,19,177,111,118,152,-72,166,250,30,9,132,21,168,210,59,18,120,180,30,176,204,104,114,26,121,-123,77,11,233,89,102,76,100,125,6,145,216,112,91,213,244,220,180,82,234,-6,231,34,39,164,6,52,218,199,41,129,190,75,92,30,172,184,109,53,53,-177,1,12,37,175,166,58,238,178,181,43,245,92,110,214,142,246,179,226,2,-126,16,229,194,59,75,109,196,218,37,36,59,216,177,31,46,52,46,147,122,-106,137,248,148,35,221,164,164,126,129,215,110,161,231,94,65,71,2,78,24,-150,255,108,49,191,195,250,213,110,248,132,214,43,189,109,199,161,157,149,236,-61,31,181,135,50,197,131,210,30,232,227,179,85,38,136,51,212,31,198,73,-233,20,1,46,153,125,131,123,38,151,38,109,17,163,208,177,80,59,36,44,-15,121,178,140,29,25,95,213,77,242,196,44,162,210,0,75,172,86,239,109,-29,153,10,237,179,251,73,159,99,252,241,137,162,42,218,255,103,104,12,154,-149,38,197,118,65,53,85,228,58,80,10,227,213,135,18,232,230,90,204,128,-201,42,227,29,176,28,152,78,141,10,241,101,243,96,97,43,247,46,103,200,-95,241,127,156,15,90,64,171,4,11,152,86,11,156,122,137,193,142,64,73,-214,228,97,35,193,91,242,241,55,150,108,10,185,88,128,222,217,109,122,228,-184,42,8,98,197,101,131,38,24,216,224,228,245,7,41,37,237,188,211,198,-5,25,135,153,202,58,224,187,127,199,136,101,76,224,238,190,11,204,226,46,-216,221,130,88,246,88,71,253,171,233,137,93,60,87,213,158,118,92,113,8,-176,200,124,43,238,46,214,15,187,75,191,21,123,169,254,30,66,157,198,49,-185,156,193,100,56,219,78,154,39,13,167,13,180,16,48,206,106,43,34,161,-252,150,237,72,76,10,90,156,131,121,80,157,122,58,208,250,205,179,137,55,-249,47,108,25,64,59,56,46,160,240,162,35,155,166,213,229,222,55,168,77,-197,104,187,34,56,21,193,26,35,57,213,100,72,14,68,195,67,170,125,114,-99,94,188,104,5,78,250,215,95,166,161,166,113,86,1,191,110,223,81,39,-168,131,145,75,202,17,121,211,182,155,24,152,99,119,238,213,214,225,247,84,-90,99,80,15,228,35,123,255,38,94,209,104,80,176,122,197,24,179,233,97,-26,90,132,69,43,201,104,193,168,125,70,191,73,0,202,168,128,223,85,226,-73,103,67,117,170,135,254,27,233,183,93,132,230,188,217,224,245,17,231,41,-95,79,204,237,20,248,239,120,57,56,68,239,144,50,175,12,212,246,216,222,-77,90,43,23,77,165,120,77,184,81,50,39,249,38,122,242,235,184,188,28,-12,117,216,174,20,113,34,248,82,225,94,85,99,105,226,61,150,82,147,29,-226,174,32,248,175,180,100,228,43,170,238,248,118,83,27,186,67,140,227,96,-6,216,101,244,162,237,247,147,23,74,104,85,168,121,147,163,218,194,204,228,-178,216,52,170,184,117,72,31,76,46,127,172,104,96,96,2,123,101,120,33,-104,104,51,21,142,193,11,254,177,201,8,106,37,86,7,85,21,4,254,48,-196,47,41,249,227,101,102,137,45,113,239,101,248,100,61,79,143,60,236,209,-115,252,177,9,134,47,232,248,160,241,141,147,178,125,228,143,143,167,116,161,-32,203,63,39,198,108,155,190,174,245,191,245,253,35,249,77,242,79,181,243,-171,96,163,51,236,160,207,101,127,174,126,134,82,146,19,154,239,76,196,189,-209,215,43,88,84,132,161,122,169,217,141,108,80,96,25,64,242,27,125,45,-102,75,237,6,121,101,57,69,37,200,83,4,40,198,70,45,107,22,46,85,-15,213,85,64,232,56,7,96,67,4,16,138,26,232,131,11,23,169,174,122,-91,212,166,214,239,113,232,142,225,203,243,98,125,133,234,174,245,14,27,11,-49,85,188,55,184,96,176,216,53,154,82,123,131,109,164,225,212,232,43,255,-95,205,170,146,117,152,133,188,219,179,122,116,104,198,188,219,160,108,219,160,-22,43,129,222,92,242,182,130,188,207,200,140,79,244,202,242,16,208,96,153,-13,156,64,60,195,151,146,238,189,92,155,10,83,195,171,190,144,54,119,75,-232,199,165,161,152,132,33,71,79,171,175,180,176,135,147,95,121,177,35,116,-145,40,147,211,85,154,152,197,138,158,223,155,240,251,150,17,219,34,125,189,-49,170,198,133,46,157,58,151,206,226,42,73,82,186,228,87,32,72,89,219,-57,7,54,215,245,103,170,153,75,17,135,67,157,144,63,89,172,52,177,116,-144,131,148,74,232,44,143,248,97,66,242,67,22,205,102,63,9,122,208,83,-1,170,135,220,142,183,7,72,33,195,130,16,95,107,253,189,70,126,91,159,-147,206,103,236,93,91,247,34,177,52,160,162,248,205,201,172,149,120,165,38,-130,226,207,129,48,46,97,192,108,115,248,28,109,198,224,97,40,138,25,217,-32,33,161,101,101,227,70,38,30,155,201,45,191,173,62,27,37,12,117,217,-240,166,239,69,238,137,12,231,13,35,11,166,105,107,108,28,21,114,11,12,-72,13,19,181,6,221,129,30,92,108,38,229,212,52,70,85,50,251,3,13,-247,224,25,46,40,199,13,144,242,33,78,242,183,103,158,194,231,242,217,226,-80,249,178,112,232,219,232,169,6,99,164,72,187,7,159,52,82,128,151,20,-179,67,153,110,20,92,94,2,252,41,220,112,238,79,67,208,53,252,102,170,-45,255,75,87,35,28,170,211,133,0,68,144,0,151,18,111,161,161,183,211,-174,254,54,71,253,14,231,66,20,249,123,237,3,180,190,74,17,167,171,107,-250,42,231,145,67,12,41,98,39,206,194,151,252,176,35,61,70,47,222,26,-213,22,150,61,163,68,189,151,63,10,148,237,100,0,156,70,10,105,119,123,-236,91,70,217,225,51,3,212,159,160,70,252,149,205,33,179,204,88,148,254,-76,87,149,36,38,39,234,41,203,73,200,159,146,131,111,121,255,157,18,49,-223,143,78,85,85,89,202,74,106,14,243,2,21,57,239,174,118,138,248,108,-252,57,80,224,100,78,133,245,102,86,163,187,175,96,145,173,24,13,213,181,-45,8,146,58,35,51,134,219,112,78,0,209,143,20,150,4,60,81,71,77,-187,205,109,241,74,102,165,237,59,92,34,48,221,61,60,191,145,71,250,151,-182,161,231,104,218,8,214,109,175,238,134,44,183,115,217,127,25,148,162,83,-71,105,136,235,120,150,63,213,49,129,59,112,233,43,34,160,130,98,165,211,-173,26,179,213,113,71,139,183,231,109,196,251,162,117,180,168,157,253,96,8,-218,244,94,170,125,134,138,7,119,175,37,109,28,122,162,191,188,28,171,122,-93,255,41,225,185,29,100,249,158,225,100,81,62,109,196,35,248,153,200,152,-43,54,179,156,198,207,107,37,197,132,248,205,144,191,69,142,229,103,105,171,-105,180,58,255,147,230,197,200,254,137,38,9,241,31,239,222,67,153,224,92,-111,214,172,221,2,206,120,185,155,150,92,206,193,28,15,224,13,15,219,195,-216,207,160,130,96,90,142,87,15,29,63,174,226,195,213,166,58,103,180,11,-215,17,80,115,197,9,4,152,154,34,183,178,69,32,34,121,117,31,230,226,-92,41,201,48,36,7,247,139,129,63,109,117,68,216,48,93,125,169,52,57,-58,134,106,235,158,139,247,114,234,116,184,168,43,157,157,62,64,49,172,26,-185,186,2,91,161,59,71,238,143,142,100,227,105,0,2,168,135,202,46,240,-11,71,84,52,240,174,145,119,137,87,112,25,232,44,88,110,127,74,111,82,-166,96,137,128,180,36,33,248,215,78,52,94,194,195,34,190,117,20,215,53,-202,156,218,69,36,81,10,40,28,81,163,204,213,51,235,215,143,174,87,184,-121,215,98,234,49,66,18,213,248,100,19,142,98,21,170,21,138,122,19,167,-245,64,241,147,162,57,208,0,246,88,149,221,75,1,46,4,183,30,201,242,-237,5,219,185,106,202,116,237,10,251,58,106,148,214,239,237,78,45,203,68,-242,193,187,70,85,178,191,59,212,146,60,76,2,184,176,115,88,104,194,232,-30,245,223,198,87,132,49,0,110,226,210,232,201,98,173,206,146,98,216,149,-1,104,43,39,64,92,151,40,75,30,42,255,152,3,24,113,80,211,46,8,-214,6,94,8,133,191,113,180,80,249,192,118,142,10,151,190,201,160,42,76,-129,107,68,160,103,115,201,183,238,224,40,198,233,8,0,204,229,105,2,98,-136,22,177,201,142,194,232,136,188,60,221,202,199,126,154,20,40,153,145,158,-85,129,87,122,234,23,163,119,137,187,117,183,240,193,99,93,80,167,126,109,-251,171,183,16,229,7,228,183,177,144,190,131,186,125,235,217,74,187,112,232,-42,255,113,95,62,28,152,45,96,152,165,112,151,84,227,14,149,241,103,162,-7,3,11,184,173,37,170,115,109,39,47,245,235,186,18,222,41,80,58,183,-15,224,230,69,226,7,126,134,13,27,27,121,19,118,84,229,3,112,188,145,-197,126,215,86,149,139,135,19,108,96,250,232,175,107,188,249,232,158,176,246,-93,68,83,99,159,44,54,34,210,131,174,229,200,212,138,26,125,20,239,194,-53,140,39,14,141,44,38,234,139,138,99,88,192,202,33,25,50,114,142,34,-32,21,128,227,187,76,77,241,196,80,237,196,155,115,85,133,121,206,26,82,-203,12,58,191,72,199,177,135,225,135,158,23,65,117,12,203,182,6,31,199,-16,158,5,108,141,164,199,54,22,60,100,163,205,35,38,104,228,151,147,136,-84,65,174,82,224,24,230,175,49,229,92,180,146,81,216,227,22,203,175,187,-131,184,32,76,219,143,72,230,176,94,36,43,200,254,97,40,175,203,189,135,-224,240,228,103,44,57,6,177,50,222,86,218,108,82,242,49,111,136,159,204,-144,143,95,66,113,95,149,184,99,189,213,86,40,36,40,181,48,115,34,247,-245,197,112,219,88,151,38,199,100,248,30,235,237,183,73,124,26,36,20,176,-149,254,209,74,178,127,127,116,116,219,161,60,86,154,158,196,191,185,87,185,-69,51,197,39,37,143,244,176,94,102,68,144,137,145,123,192,22,41,152,247,-30,155,121,38,202,249,157,106,74,240,31,61,10,201,246,56,5,62,171,20,-220,250,2,249,204,193,187,212,105,223,45,50,245,87,69,203,235,144,213,40,-107,132,25,71,156,21,132,157,192,249,27,141,151,209,93,98,187,24,112,67,-197,93,251,237,76,122,71,175,102,130,1,39,97,95,245,200,220,112,133,13,-94,216,128,122,244,246,154,213,168,30,188,200,162,47,218,212,84,214,110,136,-103,252,3,40,10,162,248,78,19,172,104,106,114,176,165,18,49,19,178,17,-138,181,29,253,55,28,192,60,221,115,5,210,65,44,219,147,176,134,243,36,-57,233,68,131,63,93,53,198,88,103,92,10,254,220,160,157,224,112,111,34,-174,66,11,74,134,120,169,120,152,137,172,188,146,196,143,8,58,53,132,131,-248,231,0,195,201,149,182,90,217,103,59,105,240,249,102,113,95,130,248,93,-186,140,132,21,13,232,16,238,162,119,56,174,246,244,198,220,201,97,56,41,-13,93,60,225,210,245,140,14,39,51,53,186,85,131,241,253,196,158,80,63,-173,53,55,105,110,145,171,202,34,97,194,6,74,18,195,89,84,178,67,89,-14,137,65,234,253,7,8,193,51,240,204,189,189,100,103,157,22,101,98,115,-170,76,56,62,102,135,201,209,42,74,195,163,241,14,3,23,19,161,222,20,-57,231,243,118,180,11,186,75,14,195,103,68,40,138,238,253,160,85,193,193,-228,103,102,247,48,253,110,213,129,217,5,15,206,198,94,25,188,63,251,64,-134,110,94,86,38,246,135,104,140,55,205,40,118,150,250,85,212,78,199,97,-92,194,162,201,250,144,48,178,83,235,26,118,80,57,145,190,83,67,244,117,-241,157,186,151,197,58,237,179,101,160,56,215,252,218,193,223,237,25,140,110,-149,185,125,154,186,199,138,194,30,162,62,220,68,211,126,18,85,117,87,212,-87,123,246,173,202,236,43,126,183,10,222,175,241,71,84,175,213,147,138,237,-193,108,77,115,231,86,52,205,56,208,109,132,227,202,172,88,159,33,209,130,-66,105,58,42,245,50,167,118,171,225,250,194,4,107,128,184,110,210,1,237,-231,224,116,175,171,132,94,139,13,145,207,168,130,48,161,240,161,255,235,21,-126,85,159,127,12,20,176,133,221,99,153,160,171,162,109,7,68,172,86,15,-138,180,90,229,169,92,6,153,10,46,209,109,220,233,132,72,230,56,6,28,-254,204,242,223,199,96,171,71,220,221,170,125,210,233,254,48,19,55,3,120,-29,108,154,193,66,157,20,48,56,54,96,154,97,79,87,98,70,84,58,122,-0,211,124,193,250,186,225,250,98,145,28,102,70,239,11,232,137,245,151,62,-193,156,96,104,244,158,54,211,252,70,85,92,146,1,214,248,111,59,173,243,-227,1,0,182,149,6,210,31,181,62,68,51,224,47,195,57,249,137,210,123,-111,68,98,192,195,30,135,20,149,65,208,105,192,50,146,139,194,146,107,32,-151,208,60,75,29,205,252,206,222,41,252,66,205,19,94,11,229,125,131,132,-85,200,193,24,172,35,179,87,149,182,145,229,37,148,209,175,182,168,45,32,-248,5,84,33,179,250,152,185,198,217,188,198,231,223,192,125,50,97,87,144,-243,210,44,181,107,24,192,27,142,135,163,147,123,236,24,26,19,219,235,172,-42,5,141,228,233,211,148,140,169,55,13,86,40,102,216,93,120,90,92,84,-129,108,52,45,249,55,119,82,180,247,255,245,58,158,145,167,234,94,141,21,-180,205,8,26,109,38,73,73,42,237,8,118,233,88,78,102,191,51,187,86,-44,209,46,88,193,41,111,115,208,142,244,243,150,215,35,252,78,196,84,28,-182,226,83,227,115,183,120,44,176,174,33,202,180,190,5,2,190,47,14,16,-14,58,232,70,95,43,41,25,14,173,45,215,231,35,59,81,153,214,167,254,-165,10,239,24,0,78,44,150,187,198,107,185,28,43,116,88,239,239,52,33,-22,225,19,255,16,145,237,195,167,117,135,70,16,221,81,86,69,64,143,175,-242,178,63,131,126,133,140,154,9,5,162,187,117,92,87,66,97,216,76,18,-19,228,35,38,233,183,158,198,47,70,203,253,50,22,241,211,173,5,211,49,-251,218,44,14,199,10,130,34,209,107,189,85,29,145,83,96,78,219,103,64,-248,90,183,121,153,114,9,147,135,180,238,78,230,189,110,41,44,191,117,34,-40,84,255,145,128,131,185,159,60,119,147,32,238,105,222,106,252,129,15,146,-31,195,63,209,126,132,85,21,66,184,76,141,252,6,182,162,211,224,115,15,-82,186,24,76,75,245,190,104,45,189,199,128,254,156,175,150,17,154,140,37,-232,65,230,116,224,16,232,33,200,157,250,236,180,32,163,43,223,40,114,132,-11,215,74,224,15,203,21,108,182,165,166,107,86,199,192,60,222,124,17,171,-152,44,171,151,156,34,112,137,7,41,167,220,64,172,228,10,196,105,134,196,-130,27,227,203,34,255,62,63,64,101,205,237,214,25,224,176,60,149,183,190,-191,43,189,197,244,238,160,22,106,36,249,45,120,101,246,216,243,215,107,254,-183,80,164,110,126,197,197,212,84,7,62,73,228,240,118,157,235,179,239,24,-185,104,98,248,255,159,99,164,180,153,106,250,230,206,193,139,168,148,143,137,-146,51,187,227,184,96,73,110,67,44,147,120,10,112,210,241,171,165,92,195,-53,103,106,43,114,249,157,83,211,219,180,196,18,22,237,231,234,192,11,170,-106,144,133,24,201,104,201,198,156,109,57,123,39,65,56,126,165,17,237,136,-187,182,29,102,255,183,165,240,239,252,255,188,105,50,213,57,84,68,12,225,-188,63,212,191,111,83,250,116,43,171,66,148,165,222,149,206,238,143,86,110,-85,208,131,236,109,64,99,140,78,233,219,244,111,246,233,120,196,81,238,216,-12,194,159,115,42,161,40,160,20,178,222,31,54,105,37,109,156,38,199,41,-208,42,119,190,4,23,200,186,193,239,172,218,208,68,122,95,203,247,177,219,-238,89,29,164,177,179,135,35,111,229,56,64,243,52,193,138,50,83,184,107,-78,229,135,21,248,201,189,228,59,18,76,119,158,115,152,165,240,86,134,24,-74,74,96,63,181,36,214,177,143,145,139,225,46,220,213,33,47,54,114,3,-243,16,134,179,192,122,6,95,47,157,195,56,111,73,222,137,12,18,52,139,-203,113,242,100,29,51,246,37,17,110,172,65,14,196,67,32,184,7,254,11,-180,116,199,167,141,168,74,136,210,189,246,194,210,49,5,221,240,10,128,158,-179,78,223,36,136,2,92,46,19,28,172,243,17,189,67,57,239,222,80,133,-161,210,4,178,120,167,234,233,125,200,227,253,204,218,149,129,220,225,98,36,-236,55,10,138,72,98,108,121,137,130,253,86,212,101,108,80,25,118,228,217,-149,100,196,208,225,155,245,6,157,53,63,188,176,225,225,81,217,23,186,35,-101,53,255,130,164,106,255,7,45,57,209,100,213,113,116,59,136,83,189,89,-9,33,104,203,5,135,176,193,93,128,32,214,170,119,135,174,104,187,237,186,-214,73,132,114,198,202,216,142,219,205,25,117,85,26,168,146,197,33,28,3,-228,47,67,125,133,94,5,210,238,223,71,159,65,182,138,233,31,193,172,62,-221,34,30,132,1,130,168,44,132,42,79,84,56,149,192,101,148,126,51,53,-33,177,116,146,108,4,104,159,138,20,11,199,1,194,51,2,245,5,83,107,-25,78,82,126,202,11,58,201,94,184,243,174,207,84,35,70,11,135,97,191,-53,108,58,154,153,6,234,84,150,146,80,110,154,57,160,90,112,0,200,0,-61,49,110,92,135,64,113,85,253,15,36,225,90,129,149,216,80,253,173,151,-187,57,46,40,90,34,241,168,227,54,157,9,6,252,98,172,82,113,151,98,-62,179,55,52,207,98,129,216,165,191,42,177,205,10,138,215,116,72,2,40,-197,24,246,66,245,202,119,161,159,117,124,148,226,196,144,239,93,57,69,131,-179,255,204,3,119,202,34,140,144,47,131,120,203,254,16,110,3,214,137,178,-209,133,191,156,101,132,58,220,0,160,5,243,111,62,18,15,42,172,231,123,-115,250,32,209,238,207,111,142,213,253,48,43,222,253,23,223,32,220,40,50,-67,137,17,0,95,113,111,108,92,48,12,41,172,236,180,214,254,209,173,196,-164,188,23,60,196,126,112,149,196,246,131,132,55,28,60,115,11,67,168,151,-214,254,126,163,4,70,224,46,123,28,70,178,246,126,192,64,100,196,83,194,-252,33,28,83,234,132,111,134,49,47,141,127,81,215,103,154,135,226,252,37,-240,62,136,93,6,72,86,170,100,86,121,142,128,104,138,60,186,107,186,235,-36,170,30,59,189,172,40,235,10,107,212,38,213,59,160,204,84,54,180,241,-218,164,91,12,150,90,179,194,77,97,30,36,45,241,74,189,198,178,35,40,-190,45,197,30,61,148,14,192,215,86,201,92,59,229,88,70,136,79,3,151,-128,56,172,82,198,146,102,242,134,249,85,163,132,160,8,128,165,190,133,237,-173,57,249,74,78,89,169,78,233,122,149,131,22,209,198,127,8,43,27,241,-238,20,230,87,196,183,66,108,125,79,214,211,38,63,47,185,181,75,208,193,-151,66,125,44,147,136,115,206,183,20,99,243,22,212,55,179,224,30,44,18,-141,0,158,96,95,173,31,202,30,248,156,205,77,198,230,169,191,7,65,140,-145,130,152,215,112,105,169,248,32,123,95,63,127,223,153,45,34,173,171,98,-249,16,76,86,76,61,141,202,40,254,172,23,191,36,197,223,176,96,138,208,-129,222,243,156,240,42,26,45,225,125,163,175,234,218,121,92,212,129,195,105,-182,58,85,57,34,134,67,95,79,230,1,223,206,243,252,113,169,34,3,105,-142,163,182,229,13,87,88,213,195,112,162,209,254,75,14,9,224,214,44,64,-119,135,86,194,224,204,26,159,201,20,255,245,222,80,238,178,185,222,29,165,-78,33,100,197,247,101,102,3,246,157,129,188,100,117,44,180,142,53,89,41,-203,188,239,241,223,8,20,1,8,222,36,39,82,57,138,30,211,241,131,117,-221,21,48,243,80,206,118,111,167,85,198,87,162,206,13,162,31,254,179,13,-78,76,140,61,168,62,164,170,167,142,66,215,248,52,208,127,28,201,128,25,-235,159,37,5,53,69,85,157,230,77,96,73,62,18,61,115,40,32,129,178,-250,83,132,107,50,207,233,248,242,199,30,195,118,182,40,118,156,149,159,17,-58,245,254,235,192,7,251,11,211,231,103,207,241,112,24,25,153,144,109,40,-53,76,217,214,26,212,131,155,218,162,41,3,146,182,61,25,6,109,64,106,-122,45,100,223,107,108,83,0,4,61,112,245,117,146,68,149,130,118,183,21,-54,23,65,95,236,57,185,8,200,116,174,20,247,114,161,5,206,89,17,92,-110,19,115,223,72,89,186,24,11,207,66,252,83,196,144,78,176,99,57,18,-233,4,180,193,105,98,178,161,9,27,128,39,220,169,164,126,30,249,195,50,-195,247,123,197,167,97,73,49,234,186,91,44,198,200,3,69,32,214,105,124,-76,173,139,250,6,152,26,170,34,86,208,42,104,23,237,220,208,121,107,249,-78,203,183,191,33,181,194,55,183,77,95,50,123,236,172,91,202,182,42,98,-195,233,56,193,152,7,18,125,5,38,167,171,28,114,192,212,211,89,114,200,-162,98,117,187,86,119,135,77,240,170,173,173,49,15,214,130,161,118,254,170,-128,27,223,72,247,149,147,125,88,190,165,117,210,247,72,104,105,153,115,178,-34,93,13,5,6,122,240,223,96,233,207,231,105,100,145,250,200,212,71,162,-86,208,0,228,64,78,37,253,30,190,173,104,172,140,124,74,24,67,195,252,-50,42,199,110,154,101,29,94,77,172,224,241,7,246,44,57,130,155,74,229,-225,216,22,4,21,46,232,25,159,168,118,107,107,22,23,198,144,6,45,229,-95,163,35,105,73,225,249,38,33,159,69,92,248,99,97,174,246,200,75,241,-152,119,149,42,30,130,99,248,37,3,132,80,154,197,141,22,174,75,216,99,-96,239,0,173,85,39,225,14,149,191,170,4,170,189,50,6,102,37,101,79,-244,247,143,59,232,253,126,122,113,253,235,56,62,191,149,36,158,8,34,91,-183,22,20,254,148,88,199,115,117,154,99,25,203,172,100,41,2,245,63,225,-229,203,57,64,97,2,71,59,96,35,140,149,154,130,45,241,86,249,52,3,-187,28,55,216,187,95,190,37,167,216,255,107,169,218,207,215,242,210,63,79,-158,235,139,158,66,148,169,79,124,153,178,242,114,208,98,198,0,224,116,61,-114,14,208,54,115,17,172,14,44,96,190,28,159,150,146,188,237,247,130,130,-25,73,179,136,171,1,14,188,107,138,227,252,4,96,12,164,36,253,204,93,-170,151,60,92,59,170,171,85,157,20,185,116,164,107,42,31,225,84,96,75,-4,223,189,39,134,111,168,23,234,202,139,3,147,23,111,212,35,142,71,57,-196,196,37,7,254,159,114,94,45,53,225,77,176,131,16,219,206,99,88,53,-251,0,158,126,96,185,206,236,199,145,71,99,135,233,70,209,158,44,191,11,-180,221,163,40,139,189,19,213,93,146,227,157,148,32,138,244,190,20,150,251,-21,210,85,213,253,241,175,69,39,25,202,182,44,42,216,169,120,188,63,187,-7,45,105,201,109,107,25,94,70,209,140,23,157,155,109,12,245,216,167,184,-93,50,36,215,87,121,98,61,243,180,176,15,21,145,55,119,70,83,71,219,-159,7,190,233,210,154,161,134,82,9,250,56,122,243,78,202,100,183,192,4,-73,185,74,54,69,9,143,192,235,135,102,81,164,12,86,182,157,230,224,182,-60,51,239,140,229,174,26,217,248,90,55,36,149,229,86,230,98,80,22,108,-228,7,161,200,69,198,44,151,162,137,65,3,85,96,151,61,35,29,203,112,-59,146,61,100,101,217,220,120,65,88,96,174,134,234,156,138,46,175,217,216,-219,106,62,166,170,4,70,20,67,192,35,173,232,52,224,187,180,52,94,129,-221,118,146,74,246,202,25,206,169,187,104,28,80,133,133,94,115,51,41,214,-76,101,177,99,141,114,213,234,132,72,84,115,39,58,38,22,201,112,100,165,-30,19,51,135,45,255,77,83,64,60,62,173,47,38,134,238,42,162,255,5,-129,62,85,222,202,200,31,64,41,11,189,201,252,85,94,250,7,193,81,3,-245,164,79,28,232,106,54,138,136,207,71,84,254,172,216,19,83,133,133,112,-40,117,56,172,214,71,90,59,62,252,79,212,213,80,252,147,62,156,26,252,-211,51,125,221,119,181,197,82,14,188,52,39,21,211,142,100,106,123,9,220,-146,162,238,243,91,52,7,135,126,176,81,178,124,15,124,76,114,160,84,130,-218,249,68,128,1,252,211,12,87,10,124,106,113,189,153,151,160,121,245,146,-219,240,187,3,254,114,255,108,154,226,215,198,178,153,245,16,147,137,100,206,-148,238,61,157,138,65,21,248,146,93,147,159,166,162,200,29,191,40,132,201,-23,188,68,17,95,175,7,211,189,178,162,64,202,42,17,236,195,196,74,168,-119,4,239,126,182,245,4,227,242,92,235,201,255,65,80,30,99,139,54,252,-146,102,91,34,251,169,249,66,3,147,104,2,170,61,186,72,2,9,157,32,-48,115,199,141,23,136,236,247,61,11,28,78,211,78,118,113,201,27,83,3,-154,179,13,140,208,111,172,134,33,66,131,60,21,96,171,108,132,155,238,183,-94,85,141,247,187,163,142,63,27,248,77,178,72,225,176,158,195,42,136,247,-72,159,205,122,244,19,12,179,61,173,223,22,98,193,75,252,238,79,131,33,-226,180,76,152,55,12,48,68,53,43,1,186,169,115,185,82,210,173,207,55,-171,220,46,247,167,41,15,202,193,153,237,175,155,184,236,237,146,36,94,186,-43,88,176,218,122,128,194,227,118,139,85,78,131,95,156,168,77,199,44,114,-11,202,36,127,67,157,175,97,105,153,230,40,226,225,229,138,159,239,31,82,-17,163,36,108,13,75,41,121,237,94,142,42,40,113,102,200,36,162,253,162,-217,30,237,55,179,144,0,143,153,136,57,165,54,212,168,232,31,62,13,157,-109,13,43,46,191,145,80,171,11,213,1,59,109,146,88,199,12,250,239,109,-148,223,223,233,194,70,160,242,120,37,88,189,231,18,115,21,245,213,196,52,-240,193,108,34,5,195,101,141,191,20,165,234,99,48,91,52,24,191,197,235,-152,86,207,239,143,20,179,162,202,140,59,115,88,243,239,76,173,69,127,59,-104,138,90,187,175,51,64,211,80,225,116,59,68,16,26,74,210,22,102,133,-96,225,23,174,197,31,208,154,119,242,188,243,129,243,129,69,35,11,88,28,-227,158,13,80,17,94,249,238,166,80,186,214,177,244,243,15,207,61,131,115,-238,115,40,50,120,204,153,116,80,208,242,231,241,20,21,149,135,225,26,157,-224,124,226,1,161,155,198,218,51,80,16,49,127,47,18,52,255,207,137,121,-69,174,78,152,204,167,53,246,176,182,160,55,61,162,182,30,66,185,65,182,-175,95,199,221,188,143,167,204,54,204,4,178,26,4,171,132,168,39,220,11,-48,123,236,33,169,247,4,118,175,38,118,199,32,129,194,1,43,210,81,90,-70,85,241,95,137,105,66,183,17,163,238,79,172,147,59,255,71,145,183,140,-238,104,88,19,42,248,237,73,144,37,134,235,154,245,8,209,202,92,248,18,-23,24,55,209,115,178,87,173,153,112,24,87,190,192,101,68,152,221,95,178,-240,14,144,18,191,78,240,128,4,254,137,201,239,201,168,85,185,6,65,187,-57,0,192,220,181,17,211,110,230,113,179,197,28,131,84,31,36,37,164,233,-222,197,198,35,68,34,156,198,234,12,116,42,201,74,30,6,237,119,225,244,-207,28,125,42,245,112,9,76,184,3,134,235,38,241,53,74,189,72,159,97,-39,254,42,100,43,239,158,88,24,61,75,179,186,149,102,218,253,61,247,15,-133,210,245,229,65,168,224,67,183,209,250,139,124,60,166,183,4,160,154,56,-220,115,128,242,163,62,247,152,97,77,243,209,28,209,240,159,200,58,249,56,-67,149,185,130,129,27,53,118,173,227,30,211,106,254,210,182,216,218,227,153,-2,131,142,59,248,113,96,45,178,98,13,223,106,66,146,129,127,66,81,41,-7,204,13,229,138,107,42,75,169,85,96,172,66,212,0,150,97,38,116,207,-238,112,202,8,99,95,206,82,98,63,186,245,82,220,211,198,154,199,143,77,-84,57,192,42,4,127,56,31,73,159,207,149,13,184,200,103,42,20,142,153,-238,226,41,145,207,135,1,115,223,25,188,139,172,214,239,150,242,159,97,46,-95,24,50,155,157,130,107,33,54,114,86,134,85,108,25,210,204,228,27,151,-21,159,51,15,126,18,96,223,155,48,145,141,134,146,157,101,179,107,251,123,-215,219,117,128,125,197,223,95,210,135,167,55,12,156,123,235,63,96,205,60,-200,198,79,107,64,151,230,41,136,29,223,246,22,8,69,135,95,38,85,7,-21,0,240,158,78,142,223,151,136,142,18,231,83,236,18,191,39,183,134,218,-35,145,193,191,14,5,240,122,176,232,46,19,192,78,23,3,207,167,189,171,-153,120,24,36,154,44,147,49,62,157,194,20,115,184,223,140,117,111,173,114,-75,57,45,174,0,83,36,132,163,31,56,143,172,238,230,190,142,242,181,2,-195,89,184,222,204,134,186,28,129,122,95,176,76,39,164,125,210,223,158,26,-84,224,238,222,82,118,149,208,193,212,143,67,30,94,198,113,201,87,129,250,-12,170,233,102,246,132,153,231,143,242,171,7,15,58,90,4,245,72,52,234,-121,99,46,127,224,209,155,16,150,60,38,19,23,192,56,248,64,172,91,130,-185,245,64,249,9,196,246,221,50,117,237,141,169,249,86,190,73,34,148,32,-224,3,109,227,0,129,144,93,83,51,104,23,84,219,97,132,212,15,59,192,-218,212,196,160,17,244,157,32,171,204,136,228,206,84,35,188,79,38,231,97,-6,131,121,45,20,165,124,145,12,14,246,29,1,66,157,68,108,177,34,68,-132,64,175,225,233,9,101,151,67,36,238,55,228,102,102,10,109,7,233,173,-190,184,59,94,140,93,77,243,211,65,11,77,47,91,3,101,17,240,125,105,-228,192,85,54,247,238,166,120,95,57,93,216,61,43,30,124,90,131,35,236,-93,16,238,226,177,102,23,240,216,212,48,99,112,240,136,185,255,66,52,221,-143,54,151,234,118,126,173,193,161,5,255,208,227,186,65,57,29,20,61,154,-21,92,84,239,130,74,97,112,216,199,170,40,191,122,125,78,43,127,34,10,-187,221,183,64,85,103,40,26,85,80,134,114,202,253,63,25,180,193,192,193,-85,82,162,140,59,236,78,215,204,157,98,230,172,158,178,22,38,147,94,87,-13,189,174,243,136,226,34,173,113,47,118,117,75,91,160,93,237,88,113,39,-130,103,127,207,31,247,231,55,224,151,219,105,21,124,214,216,122,50,246,212,-26,142,64,225,131,78,124,77,150,233,67,63,152,202,101,207,197,10,28,144,-130,178,200,168,249,167,43,102,173,170,98,160,2,218,166,132,12,224,241,35,-233,90,148,186,70,136,127,100,81,115,203,219,6,173,120,2,80,187,214,201,-52,29,71,208,186,137,26,37,94,107,14,35,2,254,12,34,43,138,197,95,-204,227,211,85,123,30,172,109,98,165,230,249,126,46,135,120,70,94,171,158,-41,126,214,238,252,235,206,60,21,171,140,32,193,239,72,225,134,136,99,32,-179,158,147,46,110,230,86,237,95,84,82,175,161,155,42,177,91,208,213,104,-74,134,134,179,63,76,172,243,199,22,210,187,16,86,183,138,9,104,126,42,-211,144,207,49,23,68,4,73,96,99,77,45,5,2,205,208,0,213,83,237,-27,42,123,167,34,96,66,21,64,150,45,236,227,17,138,126,5,113,39,250,-143,68,26,34,177,69,44,116,43,99,158,178,170,73,123,227,223,160,52,227,-42,235,183,167,232,173,45,125,118,160,141,47,156,226,36,244,49,213,230,214,-31,60,221,200,171,66,183,183,107,184,15,112,101,52,42,116,35,0,2,36,-191,165,117,111,61,245,72,142,112,15,48,247,127,173,216,183,157,217,115,111,-156,23,3,232,52,204,138,52,158,79,5,199,73,80,231,197,24,25,173,19,-115,74,2,93,46,14,61,86,40,106,129,28,46,135,146,156,59,170,149,179,-173,106,152,74,47,114,23,88,144,202,109,121,33,188,12,65,211,65,172,159,-250,148,117,255,35,67,209,123,58,95,234,35,90,184,214,125,5,94,209,246,-78,146,13,106,144,95,144,245,176,242,253,187,68,59,170,239,204,191,6,157,-90,37,83,186,80,63,157,80,222,146,68,44,182,191,243,31,189,1,109,109,-143,166,72,228,217,170,183,52,222,90,100,193,107,128,249,6,53,226,81,131,-216,141,194,63,100,134,178,11,102,212,32,127,78,71,187,126,170,242,228,13,-248,122,238,227,217,53,144,65,88,104,128,150,10,98,163,3,89,239,154,15,-187,132,221,252,28,102,132,20,185,141,20,159,71,158,175,225,19,194,157,39,-217,253,234,127,196,128,233,200,81,118,4,227,208,149,206,20,2,159,168,74,-249,57,14,139,182,102,37,234,237,121,41,88,78,144,243,165,83,63,170,91,-34,37,118,155,199,49,6,68,8,80,42,246,156,37,190,166,99,96,108,36,-39,183,139,50,14,92,175,123,38,29,46,218,241,34,76,65,221,179,208,36,-66,32,215,3,45,136,164,173,36,6,250,34,158,169,47,248,171,58,150,250,-51,52,59,150,248,96,179,5,236,159,246,101,171,182,153,29,17,167,197,148,-158,63,251,60,104,160,109,89,211,242,190,95,248,96,10,12,13,228,106,240,-11,96,80,7,227,102,20,119,52,130,95,189,185,86,61,114,29,167,183,45,-248,163,115,115,21,146,227,205,64,251,115,56,201,218,29,8,16,215,232,48,-103,52,87,102,1,115,143,143,66,238,245,216,163,213,82,78,164,110,110,154,-212,160,37,27,104,255,255,152,46,56,99,222,233,48,219,87,94,254,251,251,-211,34,91,2,234,74,95,185,4,247,206,237,5,204,73,33,184,85,212,15,-146,98,154,73,60,221,55,216,161,211,251,229,204,178,140,111,62,178,226,145,-4,50,191,245,221,203,37,138,252,70,11,189,232,8,179,167,13,139,92,235,-46,28,144,241,25,162,36,105,62,73,68,218,66,180,175,59,14,108,80,157,-41,239,158,105,182,202,65,119,92,118,4,206,167,71,72,183,110,106,18,139,-179,151,27,231,182,187,147,114,49,90,92,87,24,249,20,186,190,121,136,35,-99,251,179,107,232,209,101,226,108,135,228,150,192,20,72,76,208,222,135,15,-179,117,175,208,201,242,67,131,64,67,32,175,71,239,74,154,107,130,225,32,-145,53,160,66,134,48,205,38,243,234,47,165,52,42,199,50,155,170,139,79,-234,26,68,91,87,0,95,197,183,92,84,170,133,84,189,189,226,106,184,169,-214,230,122,254,117,39,227,91,127,89,145,207,119,83,96,95,23,113,182,20,-211,108,242,17,56,85,35,212,33,182,117,221,228,138,51,88,96,99,216,26,-28,40,255,193,82,1,191,181,134,187,184,67,168,109,124,30,78,18,200,97,-31,3,253,60,220,238,201,153,241,127,92,102,225,237,147,94,49,52,76,127,-157,113,77,133,54,59,137,5,10,139,101,189,3,2,202,246,165,170,230,233,-142,124,168,231,240,17,85,159,35,239,152,253,4,252,43,0,255,198,71,4,-197,213,10,231,12,151,216,66,183,93,132,249,245,142,78,175,221,117,125,134,-183,171,115,78,109,234,58,2,51,140,142,247,192,35,135,153,209,15,190,203,-102,109,166,217,191,90,206,159,208,209,198,111,229,225,208,178,155,2,53,37,-0,70,250,122,84,51,114,251,9,130,175,200,230,161,146,156,253,89,101,239,-132,182,70,221,139,25,155,38,153,251,160,78,43,217,135,169,49,125,136,116,-67,245,78,140,54,107,177,16,186,39,18,75,59,137,220,76,110,33,18,231,-117,93,134,148,115,23,68,246,2,170,103,216,100,82,40,196,72,246,132,7,-8,129,29,189,3,239,240,107,215,218,133,60,213,132,39,129,94,73,63,255,-161,162,199,25,116,100,239,38,80,59,148,4,89,167,168,183,255,240,141,10,-155,176,159,17,51,162,101,183,234,85,218,71,215,236,28,85,166,170,75,180,-31,239,21,14,236,119,16,43,36,44,223,18,37,3,246,111,5,222,249,127,-210,78,101,3,181,198,250,107,97,53,229,85,206,109,164,137,90,225,227,198,-90,89,147,174,130,175,45,116,71,36,110,190,146,206,31,96,116,37,167,144,-146,153,25,146,116,1,238,235,66,224,237,185,24,1,236,89,166,117,15,217,-71,202,247,153,73,210,147,144,92,95,129,17,214,226,18,35,185,229,227,59,-115,244,20,45,241,251,142,116,138,85,202,38,180,166,58,142,11,9,179,1,-22,204,191,77,228,42,15,17,176,96,74,184,213,81,41,98,19,110,127,26,-227,162,165,151,186,240,149,192,204,192,170,114,64,145,220,85,129,85,70,94,-243,225,92,73,165,78,249,182,227,142,246,134,224,7,18,137,203,53,205,190,-3,245,215,167,79,1,201,165,40,252,101,183,116,161,160,219,150,212,86,52,-155,220,143,165,46,59,218,207,107,192,35,41,193,130,244,195,135,72,28,121,-81,124,26,103,86,249,11,91,172,73,133,153,46,216,72,250,106,44,151,184,-60,199,188,147,88,224,231,155,84,99,172,240,61,178,60,168,12,93,207,44,-84,233,56,156,18,61,36,46,220,2,185,56,29,149,72,99,48,70,145,78,-75,97,110,137,201,58,19,89,138,91,210,243,96,33,59,9,240,154,213,120,-6,252,219,71,173,204,94,101,56,80,242,167,105,150,9,195,101,126,88,216,-89,63,83,56,229,244,155,26,69,206,137,18,247,180,152,48,255,61,42,197,-218,221,136,52,160,163,156,103,171,123,144,188,140,139,145,173,45,247,141,181,-162,4,70,83,57,93,5,108,174,139,19,0,158,105,178,8,47,70,100,55,-167,179,245,97,155,0,76,122,0,116,210,2,224,231,82,13,132,143,138,110,-200,2,10,159,109,2,20,44,68,128,28,233,154,13,119,239,249,252,231,184,-17,223,214,252,176,58,87,11,8,96,76,116,28,233,240,15,53,43,110,110,-43,19,123,223,52,49,75,59,180,63,182,255,16,68,189,146,93,212,199,178,-26,89,47,181,75,217,199,179,228,167,154,103,158,21,175,13,235,139,47,98,-70,190,31,8,157,6,210,161,50,204,77,33,220,143,129,79,44,117,239,240,-207,201,106,117,17,175,163,188,250,180,138,238,126,59,146,155,122,70,139,204,-238,161,201,93,28,37,101,72,209,170,153,204,138,245,90,67,81,41,55,104,-177,40,188,76,13,119,32,41,36,217,28,93,124,41,63,36,91,130,63,153,-116,96,250,76,49,82,24,170,132,15,142,146,150,17,41,13,116,206,70,250,-72,155,161,79,97,116,57,242,234,23,92,216,86,121,99,29,98,176,57,67,-234,120,126,45,196,64,5,86,53,221,91,226,55,75,155,94,13,155,146,77,-9,241,216,29,46,112,135,58,229,3,164,110,45,238,121,205,187,75,192,226,-125,238,190,67,207,94,69,80,235,21,68,175,45,237,105,11,16,61,191,201,-104,243,173,179,139,235,69,153,99,63,223,106,120,25,65,177,211,20,49,73,-59,138,76,67,187,141,212,195,236,31,235,147,168,225,52,91,86,124,161,104,-22,34,15,251,115,76,63,74,219,84,203,94,136,161,7,232,50,195,29,161,-251,126,147,0,10,1,216,168,145,95,69,128,122,216,188,25,75,131,232,19,-154,34,62,189,155,132,212,144,145,141,164,118,176,191,130,72,46,42,15,131,-67,189,92,1,133,213,103,148,45,109,162,224,46,248,8,126,80,14,66,20,-191,43,63,32,234,193,168,234,221,112,202,186,209,160,39,2,80,113,194,241,-161,168,21,233,205,25,227,55,10,8,185,71,148,87,250,49,179,195,34,135,-203,144,154,140,129,102,19,89,181,131,190,216,38,232,102,157,48,233,167,172,-193,146,26,195,83,175,157,198,199,84,67,167,79,109,36,16,137,149,161,238,-244,16,226,40,118,165,32,40,48,234,36,7,65,58,176,195,119,204,173,126,-226,76,133,211,225,245,103,249,232,41,25,105,77,198,84,118,120,37,98,201,-204,209,19,255,98,30,109,46,121,228,174,22,197,19,243,148,130,45,131,166,-192,10,86,19,29,117,16,4,246,193,158,97,158,254,187,91,43,89,189,2,-91,13,36,167,238,80,13,170,216,76,189,53,123,133,11,222,217,40,89,159,-120,117,58,112,250,238,78,220,17,157,66,103,200,87,161,208,31,59,7,74,-37,250,252,14,226,17,34,232,23,187,45,195,144,108,206,13,63,193,45,199,-79,139,238,116,29,151,228,139,189,231,94,38,32,4,98,169,136,124,200,77,-235,190,33,28,75,16,254,205,139,47,57,98,78,21,94,49,25,218,235,80,-141,213,222,163,51,89,185,183,99,37,195,65,18,162,19,233,216,171,116,39,-20,24,187,48,95,215,134,193,186,228,242,205,76,248,157,56,238,202,46,76,-83,5,42,205,96,94,111,251,152,18,226,183,152,230,55,139,172,75,139,86,-99,207,4,96,186,166,20,171,66,121,137,99,37,27,81,32,146,25,44,116,-231,77,126,27,140,167,255,21,218,238,58,251,44,221,225,195,231,176,87,135,-108,48,181,160,88,120,178,185,122,92,151,6,133,76,171,138,243,206,131,142,-170,144,212,150,129,147,38,11,194,113,219,10,131,50,152,65,198,133,144,14,-162,212,47,127,222,232,68,95,77,94,161,195,77,73,121,83,82,134,71,156,-97,150,137,111,151,140,65,246,217,98,64,107,115,117,141,42,237,241,241,114,-7,83,20,195,27,103,234,182,159,240,131,4,185,153,149,152,173,51,31,188,-255,24,168,203,23,86,164,123,221,83,173,30,246,36,118,61,148,153,35,143,-214,104,210,112,216,59,107,48,195,216,19,123,110,56,6,106,216,111,210,115,-34,221,63,139,208,254,184,56,49,47,7,15,236,192,245,140,108,96,4,77,-196,41,131,52,106,224,29,40,121,243,252,210,7,14,205,139,99,35,71,183,-205,240,11,198,92,202,245,193,120,167,197,181,154,77,62,89,114,101,247,38,-201,44,150,171,254,152,201,3,100,225,24,71,254,14,232,209,119,45,194,136,-60,35,143,169,21,18,151,25,218,171,234,198,139,2,143,193,24,140,217,19,-44,55,0,75,60,130,39,65,49,50,95,218,154,213,191,222,141,184,21,52,-50,72,26,94,58,229,14,183,81,59,151,230,146,252,156,41,241,51,109,4,-32,126,28,151,173,206,120,136,123,244,109,223,111,154,159,151,143,4,31,119,-19,241,150,151,154,127,150,104,205,67,211,246,46,238,243,118,27,143,86,100,-250,29,12,55,247,144,245,172,92,251,119,129,221,242,228,229,77,90,237,178,-189,197,123,76,227,9,234,45,247,99,232,229,32,178,253,223,98,59,84,52,-0,135,82,0,195,178,160,153,3,61,216,124,39,228,137,175,220,135,136,1,-157,142,30,233,139,110,216,86,220,163,232,80,94,250,215,10,229,54,173,34,-211,146,58,105,116,56,74,241,204,116,19,158,42,184,51,70,191,29,174,91,-58,125,234,215,151,81,93,149,249,78,219,133,18,131,117,19,191,145,1,2,-246,144,64,201,229,235,61,126,196,58,80,192,234,67,154,218,7,220,124,174,-135,227,71,37,57,229,157,199,79,140,243,90,210,2,118,203,49,9,200,18,-240,185,64,91,153,132,75,114,82,60,159,52,24,121,160,194,197,234,181,11,-110,82,127,240,226,179,104,222,6,207,183,97,122,18,112,100,250,130,209,55,-228,30,102,121,111,110,23,244,152,81,133,185,254,144,14,132,55,158,53,208,-93,236,10,249,192,45,161,178,252,97,36,149,126,132,76,169,76,146,78,232,-174,125,209,147,209,92,221,94,35,70,2,58,196,63,84,190,211,193,241,209,-4,52,180,91,185,155,84,239,254,239,202,233,37,138,82,205,191,98,96,6,-75,29,182,84,162,16,130,190,75,251,218,139,226,44,172,73,145,144,9,233,-212,39,140,22,108,238,92,217,32,113,226,41,184,62,70,31,127,210,46,40,-88,220,55,9,68,154,229,64,238,146,246,101,137,8,43,42,226,110,99,251,-72,242,44,57,73,123,122,235,189,250,105,98,162,67,47,56,3,63,199,196,-7,223,83,138,28,17,59,49,199,55,240,176,176,211,166,17,42,198,210,36,-7,105,241,66,104,199,87,237,127,119,181,121,100,135,168,209,211,65,63,149,-168,212,111,136,197,120,241,150,255,185,148,154,250,84,184,118,222,114,56,120,-84,231,171,223,181,234,172,166,185,122,140,19,235,140,183,97,247,248,36,191,-114,205,147,169,217,43,210,62,196,207,253,104,155,50,23,92,161,28,43,135,-114,28,104,24,251,207,135,109,70,148,143,35,11,87,86,0,56,11,141,217,-152,140,200,103,164,102,224,215,249,201,103,216,186,48,176,220,54,7,83,218,-123,116,240,192,17,254,43,233,27,167,242,45,221,162,25,142,75,245,44,97,-116,47,165,237,195,13,102,235,87,250,20,26,122,155,208,31,200,214,29,22,-92,42,32,139,160,199,146,210,231,185,206,222,139,233,136,16,216,188,137,163,-242,123,149,173,96,239,40,28,90,27,124,88,127,153,45,9,227,117,16,162,-4,118,123,37,34,13,184,82,249,242,81,44,23,212,160,124,50,187,183,48,-245,5,171,48,63,230,103,13,181,102,204,98,210,51,12,120,26,226,33,162,-199,200,167,126,221,129,156,195,204,15,153,49,189,17,151,238,173,99,40,101,-87,92,2,88,88,100,150,202,145,180,207,17,204,65,152,178,170,165,220,135,-56,62,1,202,229,86,151,59,67,150,246,158,167,248,191,60,75,198,137,191,-128,148,134,114,172,15,175,73,223,40,174,52,214,222,110,32,244,6,198,213,-190,103,180,253,180,181,60,17,186,176,9,133,7,170,35,141,150,146,54,88,-236,215,236,7,229,226,200,220,1,85,173,38,113,30,159,213,8,22,207,28,-189,104,140,220,181,173,163,225,59,33,53,52,169,229,235,59,52,237,235,0,-226,145,210,163,161,220,244,100,124,224,102,218,217,226,253,83,90,161,219,209,-99,43,91,27,53,237,31,18,249,118,41,149,177,150,37,236,75,18,65,112,-44,131,1,201,177,56,33,198,241,1,121,76,241,41,135,58,44,65,146,59,-16,67,255,147,209,196,131,77,177,225,136,181,148,231,43,157,240,54,237,84,-5,180,221,231,198,0,25,234,16,7,168,218,69,208,163,13,242,119,249,118,-67,57,60,135,127,235,114,32,255,100,126,79,9,216,177,53,26,115,76,70,-185,4,6,106,150,60,16,189,237,1,184,85,53,137,57,31,216,66,37,59,-78,196,161,35,13,184,104,146,128,198,188,233,34,201,156,1,147,94,194,70,-154,96,85,169,53,106,202,199,54,98,154,215,52,174,80,142,11,63,184,130,-215,244,76,65,146,88,156,64,76,45,219,204,124,228,87,161,116,199,220,32,-132,223,185,153,232,185,182,213,120,40,192,211,166,17,9,114,119,3,94,152,-211,185,211,226,208,2,12,6,92,73,30,251,225,184,141,233,73,235,102,151,-156,31,102,133,19,180,247,212,248,32,96,151,4,189,161,73,107,247,169,2,-151,45,223,231,216,38,149,80,146,159,173,250,210,254,159,235,88,56,192,196,-27,61,230,72,150,226,65,73,142,229,189,231,35,205,250,232,226,252,215,42,-78,126,82,70,186,125,6,115,47,126,75,178,247,177,138,249,59,145,18,198,-147,186,167,240,28,170,202,100,197,147,19,24,221,222,168,74,201,235,139,177,-80,105,69,94,116,56,19,151,9,137,199,229,127,48,130,125,182,61,173,157,-208,78,74,223,38,194,150,5,105,77,100,225,63,56,152,96,140,33,150,24,-218,134,108,152,138,92,136,189,56,229,180,39,226,235,146,192,255,171,248,0,-222,86,3,219,180,64,83,211,95,196,144,226,41,101,119,224,28,195,205,42,-222,115,97,208,193,41,224,18,121,210,162,173,179,58,223,23,24,38,246,22,-84,14,191,198,34,36,225,98,122,173,47,25,110,249,6,126,253,95,106,125,-97,39,177,82,79,65,184,243,235,95,194,35,89,229,222,63,248,114,116,202,-182,77,15,206,154,74,58,102,114,188,35,244,24,103,61,127,199,50,56,237,-180,105,202,186,107,190,178,241,159,40,202,3,182,1,81,167,41,102,181,55,-62,172,157,13,104,71,249,88,141,6,204,148,134,187,221,146,32,133,159,111,-78,143,47,126,229,79,67,76,226,100,115,214,84,11,169,75,85,248,171,188,-4,41,115,60,186,254,133,97,49,228,192,53,29,215,153,242,74,69,228,156,-228,20,241,245,50,74,135,224,147,211,202,184,48,105,230,252,102,212,133,36,-117,133,25,16,68,190,45,51,201,249,226,250,164,199,204,209,192,159,1,232,-214,137,76,65,101,243,57,26,144,90,103,212,97,31,55,10,63,41,2,122,-112,27,202,226,129,16,224,32,117,85,194,141,71,63,161,249,89,63,127,172,-12,62,240,57,0,2,20,183,231,11,236,165,61,94,140,78,163,210,55,58,-254,25,148,230,149,211,245,159,67,59,200,142,172,248,105,225,79,52,112,48,-106,17,22,164,68,135,105,79,117,190,29,120,247,37,252,29,155,253,161,173,-156,77,74,255,50,162,67,211,15,18,253,110,16,240,58,4,253,208,70,192,-152,229,106,167,160,0,9,208,181,242,80,22,160,219,101,3,154,229,100,3,-61,164,110,149,245,162,17,192,78,97,123,43,130,147,18,37,225,53,39,10,-203,134,194,151,90,99,84,121,246,236,127,153,226,0,134,184,104,242,31,144,-33,150,217,139,234,132,254,193,97,146,206,52,75,120,29,93,175,101,221,73,-117,239,219,65,202,229,129,175,249,184,103,10,105,143,198,106,22,82,114,142,-198,243,143,194,157,107,49,57,217,215,160,238,125,75,165,115,205,200,251,146,-23,146,2,36,9,145,194,250,154,87,225,10,231,197,172,105,199,144,53,150,-167,120,136,145,145,168,163,197,119,44,58,120,229,73,28,8,36,103,217,22,-49,182,240,137,28,223,230,16,121,27,252,85,195,240,144,226,90,237,198,138,-183,187,77,145,80,21,200,99,39,76,215,40,154,191,106,205,66,160,119,189,-181,87,183,53,26,103,37,94,172,165,89,9,47,45,214,234,4,195,101,152,-80,34,176,180,225,66,232,83,106,95,179,183,171,41,236,205,121,205,207,54,-15,212,242,140,2,234,159,232,112,7,27,90,221,34,186,166,185,198,109,44,-62,114,45,224,190,93,83,201,191,148,185,176,139,237,197,32,59,178,152,165,-175,192,222,185,201,163,13,66,168,43,70,128,12,150,85,248,117,63,187,222,-29,60,176,181,220,43,130,31,55,116,195,34,181,190,42,221,69,141,247,129,-252,49,139,77,185,80,138,234,231,37,60,31,65,166,91,64,207,106,95,176,-232,160,22,109,158,34,160,129,127,235,214,212,34,188,136,76,24,226,52,238,-235,239,204,3,42,237,110,73,134,237,1,103,17,190,138,132,102,88,133,30,-216,207,79,89,68,244,165,28,12,67,99,92,194,24,33,11,43,92,11,197,-21,76,175,223,60,14,101,194,172,29,168,241,94,103,28,31,67,146,247,37,-180,13,80,208,211,51,236,173,142,126,22,242,255,100,205,189,66,228,188,206,-233,143,176,39,80,98,249,176,203,190,64,203,149,30,150,235,189,26,19,201,-141,104,153,91,33,167,23,128,133,1,147,71,202,166,221,79,165,135,145,140,-3,95,55,79,74,154,40,232,178,220,242,120,50,139,185,118,54,255,217,34,-56,247,41,216,158,101,77,146,23,134,24,42,192,26,36,109,207,87,227,104,-31,32,174,1,246,73,87,149,69,91,56,112,164,3,139,27,255,81,224,29,-123,190,211,22,108,191,131,116,183,245,48,19,154,7,241,101,131,149,53,79,-254,130,67,151,101,237,32,60,164,57,249,166,211,155,190,204,151,129,204,34,-114,135,184,73,54,100,80,165,60,216,33,173,4,100,246,226,115,203,17,219,-187,139,152,132,118,140,113,97,67,86,112,214,110,4,214,105,163,255,157,17,-189,29,224,140,144,94,247,45,254,253,10,108,214,132,190,213,155,38,47,207,-175,131,131,101,67,252,35,163,90,206,17,45,69,128,151,47,111,115,194,70,-140,85,164,171,38,165,220,222,216,66,113,251,116,125,93,203,110,232,33,92,-38,238,213,100,230,182,20,170,237,11,93,78,49,116,235,107,181,241,47,131,-161,190,41,191,86,130,247,179,232,144,185,62,209,133,8,181,52,229,122,29,-44,142,51,254,180,16,27,45,5,170,202,211,136,214,229,55,179,179,150,245,-178,158,88,123,151,222,246,134,225,14,180,203,8,5,237,159,128,206,14,220,-31,2,184,132,137,111,65,93,42,131,62,187,180,23,163,25,39,49,126,21,-171,175,209,67,197,244,62,26,66,58,4,65,41,178,214,138,43,43,236,207,-185,209,81,95,238,49,108,3,152,33,142,106,167,182,6,238,99,245,112,190,-109,136,118,49,142,139,195,121,109,45,19,5,175,76,2,178,233,177,13,55,-181,230,80,71,249,173,231,15,58,7,202,12,2,97,250,188,16,152,212,87,-136,92,196,194,190,180,56,240,242,9,237,226,159,116,213,184,20,234,222,189,-70,111,213,157,231,85,180,57,180,14,114,152,177,229,41,35,222,217,115,42,-66,144,131,247,199,88,8,174,250,199,53,31,7,44,188,157,84,138,239,6,-59,16,66,112,214,190,245,179,40,104,88,141,141,115,158,231,165,110,197,252,-206,66,63,104,35,49,109,9,7,109,160,10,132,20,87,40,191,156,193,30,-247,158,49,92,222,116,14,6,189,14,122,50,214,255,162,169,167,100,123,177,-79,203,198,79,128,70,145,213,24,230,163,44,204,138,138,250,13,157,254,85,-17,202,190,126,104,236,245,170,149,126,86,63,218,216,146,179,190,248,209,160,-90,158,63,245,99,35,225,175,110,189,57,155,131,138,70,86,22,143,247,13,-75,63,152,165,206,45,97,252,16,197,59,36,213,199,246,196,187,242,53,51,-166,73,19,152,59,87,143,210,8,176,213,222,73,162,161,5,169,97,55,120,-102,197,0,109,122,23,134,11,97,56,58,172,241,176,30,61,199,31,157,134,-223,148,232,149,142,251,14,7,206,55,229,37,87,17,197,236,152,237,158,180,-56,247,21,140,234,79,144,12,110,106,58,131,139,186,29,20,199,203,176,186,-58,34,126,119,139,178,20,244,10,246,77,245,108,136,237,7,249,98,102,206,-146,24,167,102,158,75,238,143,108,15,117,219,66,19,118,28,41,239,41,126,-37,88,18,139,12,132,40,192,145,68,168,101,226,178,43,65,71,30,229,39,-52,46,68,203,226,150,173,100,195,110,140,24,151,59,109,102,9,65,185,170,-5,9,221,121,45,75,128,80,222,41,166,71,17,118,178,40,169,98,103,139,-23,203,36,166,134,179,113,124,185,11,240,6,171,196,22,84,58,115,60,152,-3,96,75,138,222,118,83,60,54,160,38,84,241,183,7,237,15,169,158,116,-40,165,0,79,139,196,217,138,244,211,149,228,235,3,20,55,79,122,6,50,-20,150,201,225,242,194,39,169,84,214,25,138,239,191,235,146,1,87,159,70,-194,187,196,47,155,131,170,251,173,200,37,108,53,127,175,63,140,221,33,173,-180,179,98,148,105,77,240,80,230,4,144,96,38,155,234,92,165,245,123,174,-0,0,194,87,187,71,36,172,228,115,114,25,231,35,249,47,3,168,153,86,-211,2,104,180,170,148,47,20,97,213,158,30,39,116,250,245,215,171,214,151,-116,31,188,162,154,237,137,99,86,180,188,134,177,193,127,101,75,108,40,136,-99,215,230,102,10,24,147,58,233,91,153,184,81,87,97,174,194,0,184,53,-90,213,27,31,42,219,219,0,99,153,116,101,161,52,167,92,188,226,161,45,-218,46,197,147,218,5,17,15,97,248,59,87,212,57,178,192,131,65,236,135,-99,138,248,157,134,5,171,201,101,66,116,219,203,105,36,234,243,89,153,130,-78,170,217,160,23,138,82,65,203,5,135,255,47,119,151,253,179,32,184,90,-153,10,129,199,89,210,244,250,232,7,74,36,246,115,93,47,0,118,155,20,-237,100,116,26,224,150,77,221,156,125,248,88,51,136,237,248,98,214,27,234,-233,100,147,59,213,84,153,43,43,201,138,14,114,192,59,191,206,70,63,22,-95,28,94,34,241,43,164,231,216,134,116,223,17,236,219,109,53,79,68,63,-187,23,96,29,217,173,153,30,248,144,50,173,109,81,0,82,22,200,213,202,-228,218,132,120,199,58,51,133,189,21,62,163,134,10,57,254,238,171,8,235,-194,45,169,229,104,54,68,198,190,126,105,124,92,244,152,140,84,103,96,154,-155,221,207,203,71,49,127,226,221,68,62,19,66,59,171,234,69,104,127,114,-101,162,255,122,187,8,98,139,28,190,55,29,37,255,99,79,217,144,169,28,-205,102,227,147,49,163,25,42,155,113,48,199,180,80,92,28,217,77,246,150,-255,100,163,34,176,15,221,214,243,125,220,249,248,1,134,41,108,154,252,219,-123,71,129,12,17,133,11,219,221,168,196,212,235,180,217,133,131,225,90,167,-209,88,64,69,86,40,193,116,55,187,200,43,65,144,182,204,15,92,100,240,-193,172,193,195,104,75,86,124,20,126,173,55,134,10,228,126,238,215,71,20,-102,230,220,104,1,39,36,227,192,198,224,4,88,25,98,242,91,6,46,254,-124,248,202,24,140,122,163,211,114,134,72,19,44,215,148,193,150,95,223,184,-184,167,225,44,239,172,127,231,214,211,146,40,86,94,96,54,24,42,123,251,-105,135,250,21,194,225,218,210,141,20,60,234,20,170,8,175,202,238,1,154,-240,222,73,240,130,101,197,27,7,221,59,45,180,231,215,82,36,185,90,6,-137,14,17,109,100,236,85,230,84,176,129,115,210,68,0,91,240,66,1,30,-119,196,205,140,10,47,232,2,32,214,192,24,9,230,85,142,180,152,189,30,-39,157,253,104,16,224,129,0,20,75,61,127,195,0,101,114,165,36,226,28,-187,164,186,225,111,85,208,109,222,18,39,114,147,107,104,135,89,29,17,155,-140,32,202,136,168,178,172,107,37,15,207,33,219,136,147,125,212,203,242,241,-58,80,72,144,121,250,60,157,14,203,35,13,135,64,218,56,223,115,197,1,-206,211,62,81,176,179,65,234,114,38,46,10,222,68,107,187,63,59,210,147,-146,46,145,108,10,144,200,173,149,75,252,199,245,95,4,32,149,193,137,254,-61,212,142,245,153,103,1,234,240,108,111,111,63,169,228,206,149,203,244,89,-148,58,233,71,130,50,73,132,147,4,132,192,78,42,181,148,44,247,53,199,-157,178,213,233,155,185,244,154,37,39,4,102,181,159,122,225,65,170,27,253,-6,50,25,163,150,66,3,95,200,27,21,227,86,84,85,63,111,186,91,135,-108,53,120,41,131,111,181,233,98,180,98,63,3,30,16,134,69,179,15,116,-235,146,126,216,137,154,80,59,112,100,86,13,221,90,151,246,160,227,164,115,-21,177,244,10,137,172,149,114,250,168,97,81,17,52,146,48,226,59,104,144,-83,79,78,254,217,9,29,127,25,95,215,42,105,125,95,25,69,168,225,136,-155,215,31,66,22,103,190,221,104,108,43,183,187,42,10,200,16,67,129,254,-253,215,109,177,197,127,253,78,195,78,65,138,95,63,177,14,13,148,55,213,-49,231,97,123,47,134,142,105,52,28,244,67,173,132,199,93,126,10,219,242,-206,92,6,14,234,153,45,65,183,54,209,170,97,74,193,176,188,95,58,159,-235,187,11,11,191,230,206,16,33,73,41,234,166,123,30,156,218,21,224,235,-151,146,58,117,88,96,154,70,175,29,190,196,173,42,106,10,105,209,19,179,-185,243,228,240,200,87,177,112,151,204,246,151,0,66,227,109,161,215,204,104,-81,83,151,242,116,192,168,192,108,200,32,74,175,249,214,50,121,166,105,73,-18,247,110,72,45,241,114,247,160,148,216,19,178,241,148,251,161,144,212,247,-196,198,155,161,150,109,140,69,62,201,146,31,158,111,113,56,224,124,26,212,-30,38,18,184,33,200,175,49,44,130,170,243,136,249,138,93,253,44,32,242,-50,245,199,254,89,79,124,186,170,71,224,157,228,132,162,233,224,35,123,238,-210,39,32,205,73,119,255,156,13,204,43,198,20,118,49,110,126,177,94,64,-191,247,133,147,126,170,117,11,20,13,179,58,65,53,192,246,232,53,11,247,-152,215,132,68,145,155,12,152,232,123,2,183,188,174,127,93,37,223,47,107,-33,180,171,61,187,201,83,42,66,65,144,250,218,137,59,227,199,186,58,195,-171,252,241,107,0,62,56,12,161,16,140,80,192,95,16,89,27,184,253,124,-209,103,188,43,113,64,36,2,229,167,184,99,24,79,225,106,186,21,101,137,-43,200,106,56,3,136,0,148,60,114,149,210,146,237,219,220,52,66,130,245,-15,193,189,203,42,69,39,52,123,97,183,39,183,244,218,49,90,93,153,186,-196,113,40,77,72,210,39,45,169,100,10,109,24,155,0,20,47,124,250,90,-59,80,202,96,89,40,253,88,246,177,30,40,219,27,227,91,85,113,18,109,-225,177,47,144,40,103,253,105,95,46,48,84,36,133,213,79,30,247,49,13,-61,37,1,171,190,20,240,119,191,231,232,32,13,148,73,129,208,110,76,111,-218,24,62,119,251,173,117,127,42,180,209,251,124,225,103,29,105,72,232,85,-98,83,72,126,69,205,22,146,253,59,159,95,232,117,213,168,121,96,215,189,-79,166,158,59,150,205,173,133,63,0,167,118,173,101,104,3,60,227,170,109,-145,41,211,26,9,204,16,203,41,246,23,71,173,7,141,161,145,185,40,245,-1,48,83,6,38,117,140,53,31,81,157,212,33,201,198,71,183,234,204,109,-238,158,30,91,150,89,102,134,51,199,62,11,182,216,194,208,110,127,37,156,-29,48,199,121,96,52,131,126,186,19,246,106,125,120,188,170,135,151,239,110,-24,115,75,78,252,211,17,199,149,116,158,131,115,101,130,3,100,130,228,23,-119,128,244,221,104,192,165,37,112,59,167,205,125,235,29,156,52,220,83,39,-24,86,77,7,251,69,159,49,25,84,242,187,164,115,248,88,14,189,188,35,-213,140,220,140,9,197,222,248,81,186,153,53,160,92,122,219,153,73,38,121,-188,174,134,210,69,242,164,3,21,23,81,42,97,232,184,144,73,39,42,30,-165,166,75,154,159,146,141,255,142,42,170,240,36,181,109,21,77,136,136,51,-176,111,11,220,115,172,145,11,27,121,141,158,76,244,238,43,250,191,74,96,-41,85,51,29,23,76,177,9,208,159,131,3,140,248,56,132,104,132,209,157,-143,102,167,82,202,21,242,52,207,160,18,183,250,23,154,164,63,113,170,176,-17,79,5,108,250,196,139,211,186,4,69,175,74,1,14,207,101,10,5,199,-210,185,165,199,84,202,254,194,104,65,102,84,40,81,90,81,214,165,159,222,-167,128,110,118,226,151,234,91,248,172,192,65,164,56,148,80,160,108,90,20,-12,243,167,183,119,167,70,136,138,77,74,184,79,60,184,160,65,150,171,218,-7,13,167,113,68,16,238,72,129,149,228,179,2,74,172,121,2,138,136,82,-213,77,37,171,158,210,74,173,146,75,134,27,24,63,0,101,221,18,29,30,-95,108,229,212,160,103,133,87,152,198,180,14,196,120,251,50,211,139,152,47,-182,238,220,50,208,185,62,217,175,194,202,201,147,69,222,71,157,238,116,43,-43,133,68,54,202,246,98,123,81,201,252,189,77,113,58,194,143,17,254,92,-201,95,252,121,91,116,245,89,192,176,109,49,191,126,234,158,40,100,49,56,-3,234,152,129,226,168,77,4,160,42,56,114,5,52,181,1,132,2,118,6,-29,255,205,106,100,104,53,150,248,225,87,147,159,205,219,132,17,128,208,93,-99,73,42,203,145,227,156,156,176,207,217,113,124,102,28,86,45,157,254,10,-211,184,199,47,215,44,67,186,178,245,49,211,220,155,36,62,245,74,100,13,-170,136,70,105,88,126,248,67,255,102,198,154,123,164,214,182,94,110,149,145,-213,143,207,159,249,30,27,167,100,45,156,236,244,147,94,205,82,48,204,236,-198,103,103,252,36,94,242,48,184,156,106,154,58,13,235,42,178,202,194,184,-153,20,157,130,235,24,222,6,31,61,118,80,229,166,220,72,240,158,202,64,-150,140,138,76,36,106,124,203,177,150,240,103,12,170,251,150,105,218,237,234,-83,92,194,205,130,36,9,21,229,191,35,170,71,125,80,184,222,30,239,19,-58,179,250,99,60,191,88,18,194,151,249,34,125,238,4,18,237,94,135,206,-60,212,88,46,80,100,28,22,229,174,41,210,101,110,141,131,252,45,101,36,-221,175,14,182,40,50,249,209,185,115,129,82,53,228,209,223,214,204,146,136,-187,23,63,114,22,200,236,155,142,168,126,34,197,187,226,159,246,222,118,62,-212,158,149,153,202,142,115,222,24,17,254,207,26,131,108,82,191,118,217,47,-47,127,253,13,121,138,46,170,16,139,112,72,127,130,71,249,102,109,205,217,-41,20,17,249,3,207,68,255,120,208,19,73,161,205,54,219,27,232,253,101,-217,226,121,95,144,219,119,248,97,250,74,214,250,179,140,65,166,229,66,185,-126,66,176,174,70,29,91,218,89,68,236,220,234,51,114,165,98,239,225,59,-189,64,50,42,0,204,205,143,233,145,165,145,231,205,74,114,166,169,214,208,-132,84,97,88,254,232,145,206,251,183,109,184,51,55,17,228,107,85,196,76,-153,229,79,215,165,77,92,54,208,75,200,30,151,43,134,175,226,184,114,230,-28,105,248,34,181,83,116,16,247,253,47,54,122,3,117,205,10,138,140,112,-228,86,172,18,217,180,254,195,26,116,158,207,156,69,82,207,30,11,25,233,-254,242,112,30,168,197,247,202,99,238,141,104,197,184,147,46,97,107,89,73,-194,181,247,185,198,2,95,128,168,36,167,223,69,72,5,133,119,17,225,180,-96,126,13,39,93,111,122,66,93,151,167,174,147,16,34,26,29,129,253,24,-200,168,144,58,200,31,94,231,226,139,93,222,183,96,254,254,143,161,204,254,-39,157,167,248,111,69,82,251,134,151,130,126,65,255,149,243,201,35,41,191,-30,145,29,87,62,223,61,254,83,88,127,57,15,176,5,125,66,236,191,154,-184,110,174,233,126,46,95,11,143,18,20,232,158,177,58,33,201,95,127,19,-132,108,255,188,117,230,198,137,187,39,244,144,239,178,44,241,103,19,73,132,-65,108,84,196,148,179,150,39,21,44,203,151,72,104,65,125,43,191,250,194,-253,55,64,47,171,233,115,8,198,32,238,69,34,208,143,16,194,101,8,181,-45,237,195,210,44,197,79,238,220,132,249,190,21,200,184,79,162,104,26,100,-192,82,170,105,90,37,37,55,210,121,18,62,188,81,27,179,146,232,239,82,-3,167,131,64,207,142,43,96,69,94,176,198,138,61,117,232,51,174,183,246,-198,106,16,78,253,115,232,4,250,226,20,91,69,86,211,46,70,37,247,182,-44,142,119,123,128,152,122,158,209,0,46,46,115,90,158,10,52,41,210,232,-104,63,113,105,183,26,236,26,141,254,117,174,185,143,48,108,220,186,119,85,-183,122,122,24,7,194,191,42,135,183,185,241,170,118,167,87,159,49,101,195,-88,66,111,100,150,236,173,81,98,189,120,237,14,165,224,56,51,84,27,237,-45,201,248,101,129,151,144,247,229,107,5,204,229,234,136,78,57,57,178,65,-139,184,206,38,118,142,34,220,80,125,19,112,195,219,89,111,94,166,110,222,-163,141,45,196,122,166,146,212,169,31,89,209,212,63,232,45,244,94,143,243,-239,108,67,94,53,223,123,76,81,177,7,179,167,107,68,255,165,242,77,219,-140,179,142,24,250,109,241,81,232,124,32,232,129,118,90,237,27,189,91,52,-135,156,251,237,149,76,108,178,51,137,248,109,206,21,221,144,97,225,218,234,-226,161,250,211,35,81,27,187,110,85,74,55,99,49,153,48,30,97,226,101,-32,200,10,211,12,204,236,4,116,159,198,199,94,107,252,35,203,168,66,158,-110,115,26,134,28,195,174,191,63,123,168,253,28,76,15,98,69,201,32,167,-19,154,66,65,78,81,18,94,126,67,158,36,33,14,173,14,128,91,144,109,-5,167,93,80,195,163,247,5,174,109,25,166,170,155,238,1,169,15,54,3,-184,20,203,140,83,59,241,110,157,135,236,55,169,250,64,244,233,68,203,222,-107,93,193,231,59,64,67,71,169,78,240,209,11,31,79,23,170,47,212,23,-246,136,58,185,18,49,188,245,138,95,75,184,246,245,58,77,24,221,41,238,-177,141,118,180,235,172,208,65,2,188,237,4,124,234,96,98,66,130,183,136,-209,51,244,38,154,97,21,71,125,217,241,124,210,150,206,108,158,111,221,35,-116,35,157,21,135,37,136,222,182,167,104,194,78,147,98,73,28,192,86,142,-124,55,247,69,120,197,227,127,129,30,93,188,46,237,176,131,169,168,137,33,-44,164,152,81,149,13,18,37,85,33,191,114,249,254,180,63,82,12,62,197,-243,92,184,29,9,52,220,74,200,7,134,117,219,92,101,198,212,94,4,116,-105,19,250,196,79,84,130,198,219,245,165,73,158,160,164,144,233,87,133,162,-251,85,135,254,32,59,193,12,15,10,118,84,10,0,68,96,200,99,5,224,-93,170,65,251,191,207,62,6,208,70,47,59,62,185,163,216,144,167,240,4,-45,7,124,188,189,68,145,72,253,237,161,58,191,104,26,122,64,212,213,219,-153,215,152,57,194,99,126,81,197,240,81,167,200,219,31,180,212,97,45,218,-230,37,167,239,216,3,2,83,58,248,214,63,253,136,168,8,0,224,226,124,-131,88,171,20,15,138,171,182,197,190,96,88,117,189,208,222,249,32,75,60,-199,99,68,49,243,169,100,191,215,21,154,123,45,204,69,111,195,240,166,78,-232,156,186,133,35,193,243,19,122,62,157,232,155,211,105,18,12,20,172,167,-218,9,168,225,58,183,59,208,227,33,139,95,25,28,75,72,93,211,98,21,-93,191,168,223,172,245,117,203,223,129,105,115,108,151,143,76,247,120,204,34,-30,222,233,192,198,72,216,150,148,178,132,4,96,185,127,126,172,195,49,92,-24,141,200,62,115,111,213,188,18,133,253,206,82,127,114,78,169,60,48,14,-189,249,176,79,251,151,129,211,54,181,133,238,251,250,214,88,75,57,95,42,-69,207,217,177,123,72,205,152,211,6,148,26,147,27,205,78,188,174,153,9,-208,12,231,204,14,85,61,247,175,223,63,112,228,175,73,147,154,188,153,3,-184,87,110,176,26,48,13,133,17,65,223,108,187,221,217,161,168,87,182,236,-219,130,191,49,88,239,62,12,43,92,39,121,192,97,165,117,78,51,156,82,-149,33,118,80,36,48,147,180,157,74,48,152,8,33,70,189,35,92,27,227,-161,205,94,10,246,102,218,162,23,154,36,179,190,130,177,156,45,214,161,95,-161,2,24,241,180,36,163,128,25,22,2,214,202,255,45,213,162,189,181,82,-199,100,93,214,18,74,148,243,136,131,54,246,146,73,69,226,217,142,131,223,-84,89,202,124,76,193,140,209,182,138,67,244,78,35,111,22,10,47,238,55,-202,191,93,210,44,180,4,218,148,106,152,208,57,193,36,234,96,225,253,100,-171,69,3,220,127,235,67,113,213,54,240,140,27,159,180,25,112,124,37,33,-136,8,151,153,65,136,142,14,255,48,85,178,247,14,94,159,175,163,103,172,-84,142,1,60,238,192,137,76,5,66,7,233,130,59,191,183,48,182,128,147,-191,211,236,88,200,219,159,71,212,61,195,128,214,29,82,90,253,173,159,7,-93,171,32,52,79,39,208,35,91,227,252,50,195,126,162,32,18,101,108,206,-218,31,37,101,144,110,1,57,125,195,176,123,253,31,80,37,141,130,140,228,-80,36,7,195,104,58,135,159,103,125,131,155,184,199,203,27,140,5,69,116,-223,90,49,101,81,244,103,53,179,98,20,223,209,227,161,170,241,211,150,173,-147,90,157,243,143,75,251,158,220,99,9,186,11,109,44,152,83,3,149,54,-108,109,231,71,228,200,238,35,227,23,161,48,219,215,147,135,42,5,200,173,-91,91,151,14,11,87,78,160,186,135,141,69,63,93,96,157,139,234,153,237,-154,81,118,129,153,250,180,202,134,150,188,249,181,4,170,80,157,86,105,12,-171,233,226,106,30,236,247,110,127,57,68,67,184,178,171,252,146,44,200,230,-64,170,51,75,80,206,80,6,246,7,34,16,19,202,202,27,83,239,248,246,-149,237,254,78,237,94,47,89,47,89,213,41,163,50,119,232,127,124,44,99,-243,223,185,58,207,175,202,40,40,188,84,67,16,141,101,18,148,155,16,131,-126,61,105,97,201,180,190,95,150,68,139,158,67,42,22,249,206,50,26,163,-206,33,131,142,100,121,96,91,213,159,80,235,23,9,193,242,57,61,90,193,-6,3,55,174,89,235,133,30,219,162,84,220,206,216,244,73,4,61,103,131,-175,129,121,3,136,63,147,51,195,21,194,100,237,82,209,23,83,126,58,42,-101,154,140,89,180,23,229,69,2,213,4,204,32,246,234,239,104,115,25,205,-208,104,52,66,84,66,130,71,119,237,123,139,74,79,205,251,163,214,96,133,-244,141,92,38,98,125,157,30,228,15,37,190,254,244,186,27,227,16,174,174,-24,133,4,103,56,56,119,99,93,67,152,252,144,247,196,191,237,45,139,4,-14,61,218,125,91,73,46,104,159,211,241,144,100,28,208,28,25,175,23,117,-145,24,15,11,90,109,160,210,192,238,178,209,193,63,216,175,64,197,79,55,-186,209,140,99,252,3,209,217,56,36,227,100,221,44,191,127,103,50,252,154,-196,230,87,211,48,95,144,165,22,254,102,253,62,172,199,174,221,180,222,166,-77,90,119,238,233,207,251,148,6,63,24,244,133,86,131,98,7,8,164,115,-59,76,240,246,33,102,249,32,77,78,41,97,72,124,70,22,23,247,126,210,-51,124,62,24,250,244,233,155,51,180,194,158,209,85,74,43,130,249,64,16,-103,24,21,243,201,159,38,85,101,173,131,240,19,75,100,30,181,118,248,50,-200,57,79,128,6,105,19,112,142,109,110,149,218,206,1,113,221,237,37,255,-156,135,239,98,136,153,145,164,26,59,171,143,139,11,210,93,116,204,111,35,-249,162,215,146,186,134,192,102,255,65,181,165,240,0,26,219,13,45,18,132,-197,252,236,145,146,45,228,0,45,102,134,160,32,122,241,13,125,41,112,1,-181,104,145,69,60,130,193,32,249,239,135,184,212,152,173,41,38,35,239,184,-133,178,10,49,84,206,196,226,114,225,141,93,228,186,230,232,47,4,67,236,-253,115,39,17,35,2,238,207,163,202,93,22,96,66,51,241,192,243,35,155,-126,140,219,154,147,191,41,9,72,186,118,126,179,184,201,144,176,227,26,101,-128,194,179,107,159,2,1,80,140,249,55,42,87,159,176,90,240,194,44,145,-173,177,105,103,90,170,205,63,25,179,135,124,230,178,15,184,70,52,170,108,-120,84,123,106,182,126,247,18,189,148,135,163,174,53,154,147,157,71,98,37,-83,137,87,140,38,216,79,237,82,90,83,208,125,131,46,237,73,128,176,122,-31,159,20,152,177,151,37,117,233,192,92,24,59,165,183,40,119,194,142,231,-199,164,169,184,109,137,221,115,8,180,85,249,21,157,250,0,94,4,123,201,-182,102,113,68,226,56,115,247,100,174,159,105,33,201,65,8,130,246,245,182,-228,120,222,49,132,216,109,24,67,211,164,133,243,188,224,114,57,92,52,85,-157,235,25,39,80,24,129,44,221,66,241,142,172,125,200,81,21,42,54,25,-122,134,92,24,73,216,251,19,33,10,32,148,211,6,177,210,190,123,169,134,-121,138,145,105,173,129,111,79,116,228,57,193,49,53,107,14,98,241,86,236,-102,160,95,45,245,74,97,90,171,212,38,117,16,24,243,101,196,205,99,127,-18,25,200,179,176,164,46,15,248,195,121,152,58,109,101,45,21,226,66,106,-97,218,194,30,122,29,92,225,147,151,248,204,135,63,187,139,223,120,11,242,-172,129,15,103,16,66,71,214,47,175,0,94,6,246,247,238,142,64,226,236,-123,35,150,205,11,54,106,138,145,58,83,198,25,207,204,3,155,184,218,4,-174,226,173,43,224,17,175,193,56,142,100,249,195,162,179,119,6,69,91,239,-180,222,139,113,147,90,235,212,59,159,100,218,221,1,166,184,198,70,103,230,-14,11,163,70,200,208,107,46,188,27,71,28,231,148,113,7,81,131,99,3,-59,89,61,1,208,28,206,98,195,153,166,74,247,227,117,35,25,19,89,85,-37,134,1,236,44,175,132,200,209,41,116,230,183,216,252,121,0,229,199,84,-108,230,73,185,16,76,249,8,18,229,208,243,128,5,36,189,193,216,10,152,-101,142,83,110,35,174,5,183,85,113,230,155,177,193,128,183,176,104,112,49,-176,168,168,192,241,194,48,53,198,132,201,5,122,222,73,55,0,51,36,111,-59,105,188,101,219,226,184,91,134,120,118,112,227,181,126,185,169,93,214,22,-66,1,56,235,50,240,220,138,18,16,13,200,157,100,216,125,3,97,79,195,-81,3,216,90,184,115,129,82,133,254,237,81,170,163,251,5,123,88,233,171,-120,108,101,145,153,9,224,104,93,77,69,223,208,48,156,22,189,154,16,68,-195,222,47,48,62,75,29,10,236,193,239,170,232,100,58,19,233,72,208,116,-132,43,84,102,219,101,180,56,209,199,76,100,131,134,44,68,188,175,44,243,-234,55,19,60,30,32,183,84,12,72,201,75,237,195,108,76,193,160,105,24,-58,88,154,156,101,31,183,119,87,92,24,22,210,96,212,234,22,133,168,172,-176,192,231,249,52,44,88,208,88,47,48,152,139,179,71,142,148,219,61,160,-248,212,214,158,99,130,29,150,92,3,30,159,126,213,109,43,31,183,43,136,-17,154,181,231,231,146,97,160,74,206,146,226,207,80,82,170,93,173,58,205,-48,79,21,53,172,21,117,16,161,114,212,140,32,12,112,188,215,167,1,116,-85,179,181,130,105,176,217,152,66,230,70,77,49,30,216,39,13,247,71,230,-190,226,12,128,59,218,139,84,75,71,142,220,197,164,171,194,38,221,173,132,-48,227,42,6,234,78,155,165,249,13,116,221,119,31,24,169,109,216,180,189,-138,46,100,43,182,128,95,204,235,244,252,82,130,117,174,161,38,16,194,101,-53,31,166,100,131,195,239,233,125,179,245,112,144,28,195,46,199,173,189,44,-127,158,195,178,200,65,189,143,105,106,128,102,5,92,229,150,136,235,55,216,-36,41,41,102,146,54,168,137,28,46,251,132,18,176,117,37,241,243,171,12,-19,209,92,192,152,131,195,119,139,25,98,253,25,46,134,96,47,132,106,192,-113,130,173,220,114,185,93,131,85,112,78,99,140,7,42,140,72,59,160,77,-143,11,97,26,153,177,237,209,155,220,197,151,55,187,210,42,221,197,141,238,-27,165,169,13,73,99,112,95,48,77,72,23,225,232,80,95,130,0,186,37,-49,67,20,248,17,141,182,117,207,59,5,56,225,197,32,181,139,166,218,98,-62,210,94,212,58,55,147,132,28,56,219,100,139,39,218,110,124,95,96,123,-192,155,7,221,130,158,127,44,246,68,200,106,150,239,45,58,61,250,81,255,-160,253,146,218,190,218,121,101,229,103,95,140,161,88,91,35,192,72,92,126,-6,137,8,239,53,203,193,243,6,10,180,229,181,192,84,24,29,213,95,235,-164,248,84,49,59,140,106,127,167,163,75,141,1,177,86,173,33,110,67,89,-183,157,17,164,207,125,218,44,123,235,57,12,162,177,128,41,235,105,32,2,-155,95,235,197,252,228,182,91,70,108,95,164,2,182,232,136,143,187,83,142,-249,172,184,133,135,50,128,234,4,97,88,197,250,67,109,231,231,107,175,201,-218,17,84,10,247,139,251,218,151,241,96,181,141,30,79,255,199,241,205,135,-81,106,59,88,123,72,97,250,156,130,29,75,150,27,174,6,113,58,221,216,-248,171,229,99,63,228,173,168,228,139,146,63,210,78,114,201,224,100,214,48,-168,49,27,76,90,119,97,158,233,12,123,250,149,177,97,54,235,82,119,154,-97,113,177,197,140,71,172,27,188,177,105,0,154,39,110,208,232,5,139,44,-242,163,92,96,167,92,246,1,130,183,77,3,51,233,183,95,180,70,227,8,-216,11,159,92,38,48,33,140,29,229,2,64,110,231,142,170,161,129,144,160,-181,85,169,73,173,68,127,179,139,174,254,91,50,112,157,124,202,91,124,125,-199,21,34,169,139,58,207,118,129,178,66,213,115,30,218,54,89,101,6,171,-169,182,83,216,145,17,236,212,5,154,224,8,209,44,20,115,140,26,128,252,-25,46,244,50,159,86,40,254,60,138,173,181,29,87,23,56,168,39,151,120,-50,90,224,206,65,51,117,95,170,74,148,122,255,182,201,89,73,125,201,69,-63,77,56,168,132,14,16,180,83,235,3,38,191,194,210,85,79,106,20,84,-103,197,66,235,205,122,89,51,196,195,251,160,200,14,22,75,195,7,62,7,-169,200,84,215,254,145,0,177,57,20,76,179,144,72,233,141,220,237,87,19,-41,32,252,242,39,7,33,20,2,206,42,79,186,82,247,213,95,136,95,176,-196,209,253,43,48,4,56,139,132,187,169,10,154,244,233,94,181,123,21,189,-30,12,199,91,159,113,204,66,210,114,11,199,172,70,226,158,126,64,163,208,-244,191,33,151,118,78,54,0,71,72,103,144,112,183,39,246,149,60,215,135,-12,230,224,240,190,223,176,229,219,159,2,31,18,231,93,36,70,136,102,39,-40,188,245,67,141,254,244,2,147,195,1,186,199,173,182,241,74,57,218,170,-49,72,125,244,194,196,130,193,4,210,85,130,152,1,65,143,132,86,64,79,-255,121,119,205,196,180,80,74,215,154,205,242,188,49,187,208,193,20,93,44,-225,78,243,88,184,156,66,114,201,251,99,68,74,83,114,5,76,147,82,112,-6,251,49,202,202,42,44,219,223,114,168,38,164,54,43,253,40,149,44,225,-228,2,235,200,153,13,47,206,76,142,29,221,166,206,133,181,59,44,202,103,-177,31,117,48,219,249,176,205,155,66,90,54,215,52,24,34,72,100,58,1,-61,67,246,103,188,214,91,53,96,179,171,48,222,39,212,213,242,33,92,132,-209,147,69,50,222,38,149,102,215,136,206,203,237,81,226,28,107,4,69,248,-88,173,136,214,39,237,198,64,2,29,72,25,7,182,165,213,93,133,7,160,-51,239,91,8,146,122,54,101,190,203,140,33,162,78,173,148,26,2,56,223,-36,0,186,14,111,211,183,98,171,245,220,253,254,155,252,121,86,56,190,49,-37,100,137,71,89,39,37,230,50,175,156,54,98,157,99,236,79,130,185,24,-224,111,184,68,99,170,38,218,3,131,173,153,1,17,63,184,4,91,248,223,-68,241,1,184,200,26,199,187,144,63,133,4,54,212,169,118,125,52,144,57,-27,216,133,165,246,79,90,202,193,75,63,135,254,115,253,75,101,87,48,158,-16,31,38,253,119,75,241,139,107,82,254,25,225,3,171,202,233,64,20,75,-213,190,187,114,82,68,31,24,148,69,250,217,210,178,177,107,157,45,101,44,-89,40,106,216,121,48,10,42,201,220,175,98,215,136,208,201,166,178,56,157,-129,30,192,29,16,138,124,183,97,107,218,19,102,59,147,188,0,51,66,43,-125,7,135,254,73,19,217,64,245,39,6,20,132,156,194,102,133,79,53,180,-238,178,87,215,232,233,181,20,153,250,195,110,131,122,128,111,21,44,0,242,-39,138,118,17,19,119,115,223,76,7,95,6,183,177,189,53,46,168,190,105,-209,234,196,138,144,151,86,178,50,226,252,94,31,199,157,243,212,198,110,185,-116,118,162,170,204,172,211,228,53,200,176,12,75,192,208,175,215,98,127,125,-124,119,30,182,185,255,31,150,5,161,146,173,118,35,110,71,13,27,222,120,-193,124,115,19,75,2,28,155,43,99,41,55,31,223,90,100,238,15,43,101,-186,73,131,226,143,23,172,167,107,114,250,171,216,58,247,12,175,57,83,209,-119,189,116,35,171,129,71,16,110,98,230,230,27,202,16,43,166,176,154,146,-23,72,144,46,124,83,208,55,50,77,36,203,10,158,212,88,43,138,144,39,-236,162,199,33,64,111,180,152,36,72,96,32,162,34,158,99,80,140,80,20,-208,182,179,51,2,167,56,202,189,55,105,120,128,178,127,151,214,143,0,14,-241,57,112,118,110,197,147,211,140,43,219,29,41,117,90,249,224,105,246,194,-182,203,235,107,9,136,227,13,215,168,42,48,233,241,46,125,123,165,221,92,-36,54,39,49,234,140,89,59,123,128,253,127,212,71,173,191,16,150,231,60,-215,108,213,215,87,53,176,60,253,79,122,23,225,181,110,113,127,242,211,53,-199,33,130,225,207,248,17,238,87,11,15,235,239,165,0,205,35,30,63,63,-112,222,73,73,230,190,207,194,242,149,32,87,76,57,56,69,120,83,155,230,-113,136,40,31,193,55,175,30,115,175,252,188,208,30,243,2,236,106,134,63,-252,0,80,68,171,18,176,7,222,49,193,188,79,21,253,203,37,159,52,17,-80,54,31,4,187,238,254,208,7,104,210,62,255,180,134,94,52,240,183,106,-245,173,40,127,94,166,67,1,163,235,88,205,249,250,133,39,220,78,131,9,-64,233,117,7,203,91,35,241,48,206,148,115,24,121,193,219,184,129,195,92,-32,51,175,126,241,203,35,216,131,221,76,148,156,74,84,249,153,126,80,142,-137,35,132,222,252,40,144,200,224,174,132,27,22,243,12,31,150,95,186,129,-212,95,237,143,60,180,215,127,75,168,95,175,21,191,112,79,100,55,193,112,-134,188,45,175,67,211,162,56,209,224,44,141,122,52,158,255,98,125,9,67,-223,197,252,245,221,177,101,180,107,14,252,50,78,49,110,196,134,76,179,126,-123,115,117,7,157,63,190,239,251,223,30,37,124,80,97,0,219,37,243,157,-195,64,180,110,6,217,198,129,22,143,174,197,120,148,88,149,174,165,253,241,-70,234,28,31,190,6,136,146,79,151,250,106,233,158,3,145,38,129,237,205,-23,125,215,175,235,66,188,185,32,232,197,252,81,161,92,249,64,255,165,24,-111,123,151,196,71,43,72,108,170,90,10,212,137,186,204,94,238,20,109,15,-26,18,56,35,149,123,153,195,143,34,134,206,112,100,27,7,131,106,82,14,-29,62,232,101,62,197,228,164,170,150,121,168,16,197,27,167,141,63,215,63,-85,117,184,172,93,77,86,116,197,177,240,96,24,122,173,33,11,185,193,96,-40,30,124,50,38,102,237,206,179,185,11,92,225,17,152,28,83,225,190,128,-31,242,30,163,25,226,114,92,97,19,23,242,27,121,95,42,125,53,34,167,-227,115,87,107,107,202,44,5,15,214,126,50,81,251,47,7,88,22,124,19,-240,90,69,217,48,233,37,41,141,1,235,177,242,5,29,22,99,115,94,137,-204,47,115,61,200,46,222,174,159,97,241,43,146,151,27,236,138,247,102,180,-80,67,134,101,236,159,255,246,142,175,127,253,92,26,26,66,83,26,30,194,-206,254,92,152,200,55,139,228,69,254,229,64,207,227,72,69,168,39,2,64,-28,253,236,74,84,149,171,50,19,52,238,160,141,162,23,161,64,32,31,195,-144,142,91,35,81,50,47,132,159,91,255,105,215,91,166,122,80,192,74,147,-32,139,193,67,109,230,147,59,233,41,79,13,142,93,69,38,246,122,188,70,-3,182,233,207,23,29,155,28,202,243,82,250,12,40,7,251,101,11,33,122,-177,139,211,165,18,27,127,228,207,35,74,222,193,10,83,230,39,199,47,211,-121,194,3,22,50,105,127,76,17,133,66,72,39,65,38,64,186,192,58,58,-126,148,155,131,177,162,160,67,217,144,252,197,91,243,239,35,101,128,240,249,-125,114,25,133,166,4,126,107,56,75,158,21,140,174,73,88,131,85,188,77,-118,67,69,198,176,165,131,1,233,27,103,214,43,155,29,48,201,79,185,133,-216,222,251,136,84,169,146,165,178,175,157,184,125,70,211,208,59,147,186,169,-61,161,178,11,203,220,165,198,16,123,229,39,201,86,18,44,112,87,207,101,-69,59,17,234,173,245,124,198,110,148,40,213,202,45,119,155,39,169,189,137,-224,225,0,211,124,108,17,204,64,121,39,82,75,126,179,238,160,10,171,110,-141,204,147,37,208,99,194,34,239,106,144,127,107,132,221,245,252,67,29,195,-28,118,39,0,141,133,26,42,139,234,247,177,165,109,43,40,223,42,46,110,-172,9,103,58,46,240,219,210,117,244,213,140,187,198,41,57,106,133,180,34,-39,29,139,30,164,93,20,249,238,169,19,201,56,149,102,124,92,40,121,19,-60,79,108,180,182,76,198,245,30,220,169,16,198,159,240,161,25,78,58,20,-111,5,168,147,102,175,162,32,189,42,139,175,47,30,250,29,142,255,240,133,-118,213,109,67,84,73,10,144,141,149,9,241,136,170,225,31,140,154,199,134,-128,120,36,198,139,70,25,197,72,97,185,79,56,58,4,21,146,181,80,238,-20,145,86,196,87,160,209,249,24,7,172,79,221,250,242,167,199,234,65,242,-240,237,242,245,79,208,19,138,125,4,40,122,173,131,45,94,180,115,230,162,-99,133,12,248,148,97,113,2,134,211,9,133,97,16,239,167,1,120,31,111,-195,251,99,161,195,77,69,206,52,53,59,62,44,6,148,253,127,185,202,200,-113,238,244,198,208,162,51,228,177,254,169,59,150,10,20,233,131,213,109,26,-60,159,86,249,200,76,227,156,184,213,184,97,211,201,188,20,102,214,121,180,-195,181,245,131,12,248,76,113,209,97,55,175,51,187,29,170,11,152,26,32,-32,124,84,175,219,6,171,229,58,95,69,148,175,143,26,241,215,63,76,44,-200,170,223,181,228,48,174,134,36,116,161,183,246,5,74,178,8,191,91,92,-245,14,165,187,154,44,146,44,140,65,51,142,147,52,255,14,98,183,220,248,-88,4,21,156,50,119,8,117,0,126,76,107,56,150,115,49,95,33,37,222,-11,209,177,249,202,10,94,5,20,47,85,15,241,122,119,160,207,132,41,22,-10,107,31,65,47,63,105,173,230,27,21,73,196,62,82,154,152,36,64,171,-70,238,132,133,207,48,140,6,19,112,49,25,108,216,177,237,44,166,92,206,-184,30,68,164,220,131,200,143,120,245,186,8,96,183,161,25,107,214,34,62,-68,237,189,185,182,215,62,52,200,126,221,223,126,36,212,210,136,107,252,90,-65,124,119,86,32,39,221,10,212,20,94,125,80,200,170,59,241,138,18,24,-177,196,90,242,69,15,237,221,143,132,244,14,197,82,69,220,55,217,83,114,-103,137,41,230,144,184,132,3,10,173,12,37,193,217,232,95,1,53,32,46,-15,2,46,75,251,191,39,109,80,245,154,62,24,148,135,154,3,200,70,78,-168,15,150,214,116,134,7,51,203,57,7,231,172,173,45,38,248,164,186,100,-217,192,254,248,160,40,96,34,40,80,210,253,204,107,44,25,149,58,233,50,-42,68,122,121,153,181,39,251,11,170,23,2,159,52,92,170,89,12,209,243,-196,166,242,112,45,222,20,200,154,189,178,40,93,178,203,52,155,9,78,144,-111,12,74,70,100,111,193,108,38,17,214,228,9,212,243,198,244,101,72,75,-249,90,7,252,194,180,33,208,125,101,76,10,121,221,233,43,117,27,27,212,-170,65,104,207,5,12,1,78,53,30,54,118,73,15,233,182,200,228,117,108,-213,244,225,58,139,96,52,194,174,199,8,42,39,126,162,119,237,84,23,199,-31,41,30,41,170,150,104,144,140,80,241,233,7,120,205,156,173,248,44,184,-195,119,28,0,46,35,185,181,32,200,64,70,181,242,223,70,132,115,161,121,-103,159,59,29,72,39,1,157,23,167,102,18,252,66,52,245,44,7,204,233,-171,97,125,164,6,28,90,209,135,220,19,126,205,221,71,125,153,124,239,90,-205,196,160,75,243,109,249,192,103,56,221,227,203,164,155,127,24,213,67,4,-153,111,87,176,91,222,37,155,144,250,208,128,137,84,27,121,156,213,87,106,-95,168,64,220,227,233,47,80,122,201,163,82,152,37,252,183,239,63,1,31,-3,202,99,107,53,95,138,68,123,157,63,88,40,218,27,247,212,124,106,119,-234,25,255,202,33,252,112,136,2,32,205,66,157,35,12,220,7,141,140,197,-139,74,170,81,217,35,151,196,61,133,21,195,174,166,22,244,243,221,44,146,-78,242,96,214,163,46,236,87,152,11,246,227,196,53,224,184,87,29,68,58,-188,25,207,207,197,2,131,103,137,219,158,87,253,89,63,77,188,235,21,76,-9,100,70,62,62,13,90,73,142,162,241,233,159,237,97,167,217,161,205,138,-130,52,186,123,133,52,29,27,201,230,68,189,232,2,22,178,99,133,195,38,-29,56,183,68,11,175,73,192,145,180,66,231,153,11,165,188,185,90,222,0,-49,224,171,39,113,223,83,120,35,78,176,242,30,239,251,233,34,4,90,255,-166,108,29,1,44,138,57,156,146,22,112,78,138,223,46,91,70,190,64,34,-31,208,118,11,148,109,1,176,9,163,53,203,55,93,183,196,222,141,168,9,-162,255,209,127,101,255,135,57,26,245,243,87,80,214,10,219,4,0,110,218,-137,180,194,180,227,138,104,132,192,181,74,117,143,77,98,232,143,71,245,217,-50,71,26,176,239,134,246,7,216,222,110,182,133,194,184,202,176,72,204,198,-9,14,245,84,150,22,244,222,66,252,121,197,234,173,170,50,223,26,118,118,-251,186,104,6,123,3,201,82,56,36,112,152,37,151,205,42,217,129,255,199,-130,41,222,150,188,52,10,82,27,192,197,254,244,164,89,135,70,57,195,160,-27,47,196,111,79,254,241,233,212,83,3,123,180,90,56,169,104,29,139,205,-126,28,134,31,112,207,224,96,20,131,82,14,240,155,28,93,252,152,220,113,-112,147,228,201,79,186,153,183,201,41,100,22,56,250,49,202,64,181,166,163,-199,227,170,82,168,228,211,63,46,203,244,134,6,132,217,217,95,152,52,188,-70,70,183,187,37,104,209,49,139,58,121,47,58,75,173,59,231,111,16,32,-127,121,89,69,186,191,134,141,180,222,119,32,198,136,3,44,16,118,11,37,-76,20,254,205,66,6,236,23,189,220,33,156,208,19,19,110,216,101,105,252,-51,15,230,127,62,118,69,145,200,54,138,32,208,231,84,141,221,153,183,96,-13,20,43,98,55,53,0,128,246,149,241,113,125,196,86,32,233,151,155,86,-73,246,41,178,216,212,235,201,158,189,178,78,55,18,130,244,31,126,82,187,-35,11,245,31,106,198,23,10,21,20,5,203,129,148,244,95,212,25,170,208,-111,114,49,237,71,249,208,249,243,198,191,154,225,221,157,157,206,222,244,76,-243,202,64,115,150,60,199,216,140,139,108,82,54,132,247,155,184,90,147,48,-89,203,250,100,115,86,110,81,136,211,75,52,161,7,248,17,62,9,164,19,-64,89,35,30,59,183,174,192,35,118,165,72,245,188,81,2,215,140,138,67,-61,121,3,110,29,4,207,82,169,100,126,30,38,223,115,96,201,229,33,211,-223,47,29,195,162,226,55,85,243,41,6,121,177,50,118,119,9,202,165,134,-25,241,49,47,222,249,63,57,194,147,205,54,59,180,54,145,202,114,13,163,-244,188,109,244,175,207,116,31,73,122,139,253,170,225,25,89,0,205,173,66,-168,97,66,161,133,207,185,70,79,197,215,44,81,224,174,75,94,160,212,128,-64,75,100,7,90,18,187,81,175,164,7,109,81,168,140,237,7,76,30,150,-15,11,245,243,14,56,63,212,172,221,31,196,14,147,78,239,29,6,170,133,-92,42,129,41,204,72,42,38,23,13,72,146,31,177,2,124,220,149,249,172,-188,253,119,34,187,65,192,105,225,196,163,87,162,62,156,49,0,143,0,79,-88,144,157,24,33,159,164,21,5,30,169,61,131,75,142,74,134,105,24,192,-175,74,17,192,148,53,221,237,73,120,198,101,170,57,52,90,168,99,29,18,-79,104,207,252,244,209,184,22,176,173,100,153,189,36,39,181,220,103,27,31,-105,18,252,182,11,43,61,93,99,59,15,215,98,37,72,13,159,49,140,89,-236,182,212,202,255,177,17,168,19,21,143,7,113,207,111,160,228,243,4,56,-113,236,186,255,215,19,214,22,132,16,26,43,25,184,141,223,204,154,7,71,-206,58,211,140,19,143,115,30,55,142,70,223,43,123,215,167,178,113,229,25,-234,49,95,165,126,97,74,210,70,88,255,107,30,142,136,134,176,78,243,191,-28,67,50,1,205,52,79,31,123,45,155,130,191,18,115,217,191,219,38,30,-181,215,229,243,155,32,236,142,49,47,130,249,220,220,17,193,31,86,182,47,-48,29,153,228,147,62,50,191,103,226,177,148,227,92,254,113,57,250,65,143,-169,24,31,216,149,2,136,20,47,67,75,126,41,77,9,242,104,167,189,117,-176,143,30,65,214,194,203,50,137,1,35,93,162,9,64,67,188,24,43,34,-227,104,201,52,162,189,184,65,135,3,66,132,141,45,117,174,133,210,169,80,-160,162,184,249,252,43,166,220,14,165,115,55,88,222,180,78,140,230,173,244,-52,59,228,63,167,24,163,9,174,68,89,124,98,167,157,54,212,67,44,47,-237,151,127,217,37,178,245,169,176,61,222,86,61,54,80,236,204,57,87,245,-49,11,116,102,200,194,126,85,112,229,190,17,245,180,111,15,44,156,124,229,-243,108,189,228,22,189,33,180,31,188,161,8,200,193,10,0,-};-const unsigned char *combexpr = data;-const int combexprlen = 104896;+122,76,90,51,93,0,0,0,1,0,59,14,65,195,100,94,33,13,90,193,+48,231,200,180,51,132,17,169,14,250,117,232,196,54,4,208,198,175,184,230,+64,22,207,215,158,84,98,197,13,62,57,212,238,150,235,83,172,224,131,231,+200,129,102,127,244,108,50,230,33,248,169,142,53,143,223,143,204,172,81,144,+182,3,198,79,99,214,61,157,37,215,153,105,58,136,205,196,121,124,132,231,+26,19,75,248,148,184,120,253,180,225,229,68,232,0,81,205,9,77,227,118,+116,27,194,1,198,148,202,44,7,135,80,31,171,213,88,100,141,101,201,86,+11,49,240,115,240,136,172,21,63,210,203,86,131,37,120,186,208,10,136,223,+188,42,103,148,235,151,219,64,154,181,172,247,107,188,46,77,103,197,109,182,+56,151,162,121,237,126,211,171,239,41,151,8,239,158,206,10,62,207,214,140,+171,172,105,80,90,55,138,148,209,96,73,119,31,219,92,186,166,78,96,154,+131,1,250,32,24,9,216,50,215,204,148,203,170,129,131,115,118,26,88,163,+203,4,154,147,240,69,10,115,125,127,215,207,168,196,250,157,237,149,12,137,+195,231,185,199,61,110,162,113,204,129,126,1,9,238,58,191,146,225,205,92,+166,164,245,51,87,200,200,234,70,105,210,143,160,41,89,128,37,104,192,219,+87,35,50,28,140,94,199,214,253,231,19,170,135,231,195,13,116,20,147,248,+37,92,173,249,11,181,179,201,67,189,246,178,116,92,218,133,224,26,195,110,+184,240,235,198,100,31,178,173,152,41,100,51,161,235,177,35,101,139,186,249,+3,160,196,108,159,137,249,115,242,173,150,7,136,72,92,70,123,168,220,42,+110,132,170,137,170,155,211,240,43,175,7,0,102,101,1,184,141,254,91,48,+32,25,67,68,75,146,79,158,223,246,59,143,144,33,98,255,143,21,29,192,+61,206,206,171,143,98,149,58,134,161,32,193,65,63,54,76,178,170,9,159,+211,224,91,48,205,232,86,80,66,252,220,11,241,62,141,145,232,29,139,175,+199,37,0,199,68,103,98,90,53,213,115,43,93,121,230,41,35,167,51,87,+248,222,55,190,188,83,74,195,144,202,8,210,139,59,219,61,55,234,134,164,+87,89,193,95,115,54,213,238,92,163,118,207,92,136,112,3,253,74,73,246,+188,107,96,191,34,59,63,86,160,154,236,91,203,225,24,108,119,23,22,242,+173,240,141,216,246,83,246,73,48,71,220,91,179,225,34,78,103,46,205,69,+64,14,227,90,40,86,243,63,195,26,34,93,198,71,174,49,203,58,70,91,+136,97,44,235,251,54,101,37,36,51,243,165,35,245,101,212,151,143,10,216,+2,159,122,237,140,218,39,173,56,194,212,243,242,52,36,24,162,155,202,205,+149,27,29,190,65,111,87,12,60,120,201,59,232,72,133,33,192,193,109,166,+194,79,75,30,93,159,88,174,169,118,47,141,255,195,159,229,73,6,118,165,+195,77,189,214,125,84,99,144,85,14,66,56,32,124,246,119,40,182,222,130,+3,42,42,100,235,98,89,199,226,83,32,141,246,107,109,63,160,98,97,197,+192,59,95,21,52,29,119,116,188,207,56,9,113,9,23,86,57,135,186,212,+167,113,46,221,145,160,115,81,96,25,146,78,64,183,210,117,170,109,229,111,+135,32,76,183,179,237,31,133,197,242,88,248,204,227,22,38,65,48,66,147,+32,89,153,76,160,114,67,137,19,99,255,22,2,176,99,150,181,56,149,58,+97,97,114,223,235,2,76,223,119,168,154,151,60,166,255,107,125,71,20,232,+179,46,31,223,6,15,229,46,221,218,81,30,53,181,39,173,218,30,82,207,+129,183,219,205,78,201,162,63,233,154,228,141,144,203,100,220,195,246,77,190,+197,235,221,125,129,42,82,168,209,209,192,121,46,162,205,23,150,30,2,78,+68,126,237,81,218,251,179,131,211,45,101,39,95,141,81,153,191,180,27,214,+161,39,217,238,237,230,163,169,108,162,17,151,202,88,214,5,227,96,103,154,+186,226,2,166,171,236,175,70,156,149,57,93,111,212,233,36,97,142,71,41,+94,185,222,56,32,88,53,119,96,220,75,226,222,132,169,103,88,235,241,99,+22,18,6,95,87,189,236,114,10,32,141,167,96,141,28,1,11,134,252,135,+248,6,3,13,111,202,228,18,42,134,28,167,253,47,54,140,224,88,103,91,+34,244,170,113,36,91,33,212,27,253,183,166,252,151,52,250,33,200,62,129,+235,180,194,82,58,83,168,29,4,163,39,164,195,81,102,92,167,255,240,235,+130,77,140,216,50,30,30,125,199,56,76,141,231,162,95,31,2,1,238,46,+9,71,114,30,247,160,39,105,235,101,121,121,142,90,136,91,143,245,164,205,+198,248,120,61,13,65,233,197,252,255,165,220,3,50,240,32,49,141,191,253,+116,16,104,209,65,7,170,50,62,36,63,178,146,180,169,156,89,98,186,15,+107,72,195,37,239,250,204,16,151,19,12,107,153,122,225,177,253,247,213,227,+67,155,218,133,13,225,214,182,163,218,199,243,125,53,115,151,101,31,175,219,+15,32,51,230,63,86,61,8,190,182,155,127,134,151,210,167,66,41,102,188,+63,52,222,140,151,237,182,85,90,221,254,9,14,0,187,26,194,66,116,190,+57,69,251,113,196,24,104,70,117,16,49,142,193,247,109,158,145,101,226,23,+26,130,179,57,98,187,170,135,10,174,135,93,226,73,176,200,56,28,2,200,+109,88,81,110,235,142,169,220,37,233,44,30,5,233,14,122,41,229,170,181,+23,69,7,216,234,54,48,197,128,21,95,0,137,136,132,57,187,28,97,193,+82,131,39,31,96,156,74,194,59,221,156,96,29,134,109,245,218,130,81,58,+175,84,78,92,65,76,252,145,233,31,172,196,215,151,110,149,37,240,147,73,+234,29,250,210,159,74,82,108,205,121,144,118,200,181,35,191,69,148,39,108,+8,150,74,160,140,54,154,195,183,112,29,245,200,244,239,79,253,229,62,186,+117,73,95,249,249,213,133,170,4,227,231,171,198,157,226,107,149,191,204,120,+184,199,89,128,32,196,26,221,48,132,54,4,68,185,166,206,241,45,62,140,+237,245,42,19,1,185,108,57,184,36,32,22,168,162,167,209,230,104,187,203,+169,220,120,58,24,174,156,21,119,59,189,153,145,49,28,22,178,11,61,98,+48,168,171,48,188,101,231,29,74,52,33,109,116,232,78,179,137,133,81,167,+69,31,173,185,211,78,176,185,187,226,139,40,96,158,163,239,15,67,2,31,+79,148,75,160,128,4,117,62,240,145,245,41,216,2,124,87,114,126,225,140,+196,29,175,209,128,184,100,10,67,147,37,90,20,206,243,140,227,35,76,53,+234,110,104,28,85,172,211,60,18,60,120,38,109,73,108,165,200,167,185,246,+188,61,88,199,0,110,113,41,109,200,222,230,227,9,121,247,235,105,33,176,+36,141,222,203,38,38,215,249,19,63,230,200,153,235,181,161,190,47,10,183,+95,196,3,38,166,249,164,158,15,8,189,43,244,86,17,36,195,210,143,177,+199,209,52,195,143,15,42,201,183,94,131,252,231,12,205,66,133,135,50,143,+89,178,143,16,203,209,254,44,255,249,206,84,176,63,227,251,127,42,161,118,+8,177,168,50,159,184,40,157,67,0,87,22,12,202,159,220,160,96,232,240,+184,173,80,178,155,20,243,82,194,104,35,37,241,118,114,242,214,186,172,79,+216,236,146,77,251,166,94,192,85,91,15,105,131,172,175,149,202,19,209,138,+140,53,6,77,186,246,28,127,83,69,141,156,240,134,6,22,63,146,162,186,+80,154,23,59,54,167,7,246,23,86,171,191,59,88,229,72,232,79,63,198,+232,68,214,119,203,44,186,167,55,219,101,219,129,194,182,55,228,157,190,188,+66,47,121,92,204,4,133,109,163,96,158,35,188,162,251,83,28,125,215,2,+224,108,135,153,213,180,213,161,53,31,23,208,190,253,101,45,137,38,251,83,+244,126,49,249,255,24,98,51,164,188,69,232,93,34,77,17,21,205,215,58,+148,189,170,215,193,228,3,91,251,50,223,58,253,158,154,13,233,130,196,191,+69,19,96,134,57,252,183,199,72,200,59,231,121,107,213,26,21,125,218,53,+132,251,225,7,148,192,88,21,17,229,87,30,206,197,181,11,0,111,75,237,+62,254,41,241,84,21,199,234,229,227,117,23,14,226,228,174,160,225,167,144,+118,170,149,74,123,59,41,136,185,151,42,139,123,129,165,247,101,72,226,128,+27,36,26,23,238,61,2,89,14,190,92,75,166,130,17,24,237,86,63,16,+68,205,30,66,68,234,235,204,205,29,168,109,130,160,162,34,222,47,34,65,+158,4,41,88,82,170,184,12,194,4,28,100,174,255,181,98,210,16,8,91,+176,135,77,12,139,50,133,51,121,236,142,169,174,155,147,70,46,138,214,106,+193,5,63,143,108,70,125,184,209,222,23,72,139,148,249,205,224,79,12,22,+182,48,68,77,209,140,37,48,233,20,52,28,99,33,82,173,99,197,199,169,+157,74,94,127,82,174,249,189,161,50,242,232,30,67,132,236,33,158,165,229,+207,69,24,248,93,104,250,210,78,254,137,72,173,124,8,3,75,81,151,103,+86,96,56,210,33,213,254,38,137,160,43,54,89,27,84,198,144,130,82,15,+176,191,97,139,221,68,130,1,127,240,201,77,213,20,189,227,138,226,97,194,+166,139,239,202,224,120,56,104,84,225,51,220,244,9,119,228,207,28,91,54,+0,15,222,26,144,151,189,215,213,246,132,106,40,148,209,212,40,19,119,150,+85,200,84,50,240,51,41,161,229,104,227,51,253,194,64,250,150,137,138,152,+63,248,215,246,38,190,191,240,210,229,201,48,101,155,255,235,142,199,50,144,+230,230,158,78,207,3,63,32,21,167,55,227,209,0,232,232,56,196,218,46,+196,52,48,233,11,149,174,208,136,234,36,241,29,60,126,194,116,215,63,35,+95,231,193,194,30,4,62,236,89,31,204,120,101,46,232,84,127,199,45,133,+235,242,241,58,138,87,45,211,17,159,120,114,75,46,138,153,85,172,88,65,+163,240,98,97,122,147,87,16,70,83,252,141,227,37,178,187,163,50,88,89,+172,233,20,144,207,168,75,128,150,200,20,130,194,130,36,169,124,106,245,177,+4,223,77,172,242,15,60,215,86,62,14,17,239,170,155,243,183,82,148,111,+39,163,180,81,219,4,193,190,93,100,237,32,127,192,76,79,240,49,192,106,+245,218,90,186,240,179,22,139,127,143,57,209,6,255,200,21,187,111,126,148,+31,18,24,60,70,245,12,251,121,91,30,131,128,86,127,67,228,61,69,180,+238,46,111,164,56,200,179,71,95,184,34,66,120,128,67,111,249,171,248,193,+202,178,31,55,118,170,90,139,73,179,187,184,136,186,162,245,170,105,81,228,+202,71,216,70,236,235,236,114,128,229,197,124,42,179,122,196,198,136,15,6,+241,136,63,145,141,178,104,240,242,119,159,44,117,172,63,189,186,121,186,157,+45,198,56,176,15,212,132,246,215,130,46,96,241,213,1,47,229,237,46,40,+48,22,143,20,81,176,211,159,216,255,128,12,82,15,42,51,67,248,187,158,+178,93,182,113,223,115,254,11,53,94,57,70,229,94,195,69,184,172,133,104,+88,185,91,153,153,139,8,192,10,185,163,71,15,247,53,129,229,202,88,48,+237,19,221,172,254,217,73,250,246,14,223,65,18,87,174,60,176,10,47,223,+117,119,212,248,120,197,236,71,209,205,139,211,224,60,245,122,156,54,114,122,+146,144,224,193,105,61,8,0,143,94,239,32,163,121,207,163,171,168,206,211,+109,51,180,52,167,222,142,38,90,159,234,234,208,154,226,187,212,102,229,50,+126,41,146,240,33,178,61,66,148,252,63,156,110,179,14,54,157,196,215,126,+233,47,89,205,98,207,32,158,136,22,184,3,140,113,66,89,108,73,114,103,+158,15,116,57,55,47,107,201,97,192,187,11,95,37,134,186,18,17,230,162,+178,242,176,117,96,250,60,21,250,123,159,137,75,104,34,60,237,167,251,240,+81,134,3,207,19,141,234,9,210,210,114,193,4,149,217,152,82,91,79,13,+42,120,250,190,105,251,106,137,57,233,66,249,216,168,187,89,80,219,98,68,+165,183,239,15,70,49,215,13,53,117,241,72,112,141,198,156,114,110,45,163,+142,96,132,241,149,197,68,253,34,39,86,41,134,103,34,140,145,50,209,85,+185,43,62,154,88,58,197,133,123,23,224,142,235,250,55,80,252,103,183,228,+59,231,176,146,31,59,155,186,75,182,52,65,151,25,187,94,249,101,217,13,+190,125,150,252,163,171,200,230,38,51,62,102,48,78,109,20,89,90,21,180,+24,115,215,201,139,188,173,49,8,68,30,39,22,253,98,89,214,78,54,113,+158,53,55,69,222,68,46,137,14,99,47,215,131,62,29,94,173,71,2,104,+141,182,216,206,189,254,159,244,150,199,154,37,192,215,157,140,7,120,89,64,+165,143,124,162,89,137,169,249,231,96,14,216,80,175,228,140,237,61,4,253,+80,176,181,189,80,75,153,169,42,230,9,47,198,135,62,196,90,55,109,89,+127,5,84,119,13,8,10,6,204,246,192,135,6,100,77,143,159,211,151,155,+126,185,21,155,140,51,196,46,170,139,149,125,151,167,74,189,221,46,249,80,+9,135,173,165,235,110,240,192,82,132,82,93,81,193,199,247,38,69,148,191,+168,251,183,225,132,63,91,101,197,137,180,96,189,11,26,222,45,142,155,179,+70,121,154,224,170,105,12,240,107,2,248,108,10,81,176,133,128,93,217,125,+250,142,21,1,26,172,8,199,164,145,45,99,222,22,159,164,192,198,59,182,+155,42,151,177,146,81,12,145,28,110,175,78,24,84,28,86,80,161,54,90,+83,198,43,207,230,140,11,40,188,131,145,63,141,28,166,161,193,2,174,193,+249,70,75,169,154,188,145,131,7,152,4,45,100,62,76,15,146,93,6,31,+53,205,223,198,173,75,205,193,38,14,137,47,119,190,111,185,54,178,47,106,+114,69,228,78,154,113,149,5,57,71,63,177,106,132,69,140,99,132,48,84,+158,255,171,57,245,117,22,181,103,140,172,172,105,179,102,129,178,27,120,134,+242,105,143,146,213,23,251,107,105,0,72,212,229,39,247,92,252,153,214,195,+225,161,62,48,113,103,142,34,114,92,114,58,124,245,13,229,252,118,74,177,+247,106,226,237,184,137,65,6,208,29,130,240,1,181,138,128,142,153,196,53,+160,164,239,235,251,100,11,209,66,202,125,203,171,98,73,134,133,71,160,137,+73,233,29,231,123,247,190,30,142,160,74,108,249,133,253,42,167,195,205,147,+29,100,229,179,49,29,117,72,174,62,53,144,141,244,241,116,45,86,112,232,+188,199,161,55,104,225,120,41,3,162,64,58,18,99,74,57,58,108,163,82,+207,117,141,112,227,172,200,123,18,31,24,61,99,27,172,211,7,51,20,231,+74,228,177,122,53,115,112,210,220,193,126,7,172,167,206,7,164,20,20,49,+187,138,205,92,229,219,237,50,114,110,53,20,212,82,98,183,55,4,16,9,+135,22,63,2,139,129,126,130,219,183,145,133,197,102,33,49,205,97,226,38,+234,96,113,37,110,225,144,74,182,16,219,118,200,56,13,105,215,235,214,208,+70,216,84,56,165,110,54,105,213,95,27,123,205,227,247,63,151,157,197,119,+61,207,23,41,32,16,197,143,188,216,254,209,11,157,164,245,59,47,234,122,+173,223,202,37,206,48,204,107,112,126,23,196,33,228,113,175,152,161,130,2,+72,32,249,81,129,191,81,113,233,2,231,163,5,237,142,95,255,167,191,99,+33,99,70,10,132,175,172,4,211,4,246,245,245,222,91,116,171,107,104,60,+71,193,59,228,186,232,169,107,199,188,114,129,62,150,14,201,84,73,198,39,+52,218,102,36,132,154,158,102,254,91,22,87,165,179,96,52,240,228,214,92,+33,155,244,134,115,225,116,160,25,35,8,74,222,56,69,34,7,46,58,149,+172,156,115,101,48,171,234,26,16,195,76,202,164,13,70,105,133,70,113,178,+54,107,7,98,50,249,100,62,58,179,81,42,236,250,197,190,151,64,254,243,+33,155,226,182,29,12,129,23,124,96,174,124,136,216,93,199,24,111,99,104,+112,247,54,133,13,91,160,230,249,54,36,38,212,144,123,152,10,139,119,57,+71,20,234,47,207,174,88,127,165,63,104,205,74,156,116,109,241,91,49,125,+49,93,160,82,62,44,56,76,157,216,59,137,19,83,106,137,66,254,183,39,+119,203,155,209,154,53,169,87,59,247,147,134,191,112,213,206,49,57,144,218,+147,86,41,130,214,33,160,127,127,4,218,220,62,184,169,150,18,84,212,62,+131,27,246,239,41,0,7,132,31,248,28,71,197,159,159,42,140,246,232,84,+241,86,24,149,66,143,180,97,60,65,204,135,240,58,74,65,255,201,151,234,+111,53,75,188,188,96,66,32,167,71,3,22,116,11,18,111,220,1,102,249,+255,20,224,56,144,74,188,154,62,36,121,194,184,177,60,51,67,187,40,37,+56,33,193,153,68,169,92,81,242,242,100,65,55,235,190,245,139,255,106,129,+216,106,124,127,73,64,55,37,7,242,107,80,201,115,131,104,132,150,225,50,+227,90,66,217,196,76,36,45,80,118,231,62,17,252,166,35,182,81,240,62,+40,67,125,212,127,251,12,37,255,213,53,175,199,164,135,239,60,47,111,191,+143,209,37,62,164,152,153,159,20,43,98,194,20,201,221,163,166,77,91,51,+202,110,105,6,91,131,235,233,6,162,103,20,91,7,146,182,112,13,219,170,+132,76,79,188,81,80,126,25,149,7,201,11,163,156,92,201,172,196,235,20,+78,252,48,26,227,84,217,6,129,168,142,244,207,255,207,177,180,231,8,207,+230,240,2,228,109,107,120,241,93,84,25,251,115,170,199,244,96,94,240,74,+80,75,244,181,227,64,218,242,72,144,174,243,235,55,217,168,188,135,103,216,+22,196,41,193,146,28,67,13,223,104,82,118,8,217,35,16,7,55,59,124,+43,81,238,66,199,52,241,55,205,78,77,82,127,9,114,228,46,93,27,117,+140,68,150,106,213,197,135,47,45,115,190,63,201,42,232,28,51,223,144,113,+103,24,126,50,46,247,124,158,135,65,233,207,28,83,72,20,35,212,74,74,+163,182,24,19,206,77,181,143,219,11,87,164,71,236,35,178,54,182,68,105,+233,89,92,8,201,127,11,176,234,29,54,90,25,131,7,79,227,197,236,100,+210,136,119,148,221,54,85,208,4,235,36,63,211,27,42,74,48,218,167,203,+20,98,184,114,176,228,12,116,244,71,126,220,59,141,241,176,87,219,147,100,+143,144,150,201,29,176,233,12,172,148,127,222,63,181,178,83,42,81,3,175,+64,132,229,105,251,34,18,89,141,193,61,87,91,178,198,177,186,67,88,4,+31,144,74,202,150,208,149,44,145,139,225,202,238,24,55,251,204,120,5,69,+108,54,195,148,159,217,129,69,224,141,16,198,30,205,243,187,65,163,75,57,+248,61,255,218,39,91,30,197,81,255,225,133,108,224,113,64,62,89,172,45,+166,37,89,197,200,232,18,177,106,125,117,107,182,254,245,161,36,45,246,42,+166,3,44,20,52,255,162,72,64,249,172,164,246,71,127,112,133,170,154,184,+56,253,217,49,33,234,101,144,246,98,213,158,57,131,245,108,219,237,172,99,+54,29,56,109,11,242,231,144,95,70,98,124,88,129,185,18,161,34,53,225,+38,29,190,136,3,30,219,188,42,21,31,198,6,4,37,89,168,172,176,216,+237,49,245,252,124,133,165,104,117,85,236,227,236,128,151,233,27,120,56,247,+233,11,212,154,134,12,212,89,96,122,2,35,40,43,85,245,21,106,243,1,+34,130,191,33,117,4,131,233,111,51,122,33,187,33,54,75,58,11,145,199,+189,168,212,141,222,81,24,63,249,220,1,60,157,218,185,250,137,232,202,151,+92,80,4,26,99,105,162,201,227,96,44,62,144,209,17,175,165,53,39,21,+119,37,74,208,30,74,143,99,147,33,160,186,70,245,127,47,27,250,211,218,+80,72,225,216,104,172,51,167,1,176,73,224,166,48,225,221,116,187,219,36,+93,141,8,59,153,67,154,133,215,176,1,120,108,76,86,2,171,125,93,119,+79,241,206,238,77,239,219,35,76,157,102,236,223,3,105,86,179,240,198,83,+252,41,91,128,112,0,52,72,231,22,76,169,123,69,103,154,151,234,171,132,+23,66,105,213,186,145,249,182,162,16,66,235,132,157,58,205,247,97,112,51,+46,194,120,70,83,219,191,141,5,222,11,195,102,201,141,44,111,198,78,82,+204,100,49,184,157,69,175,122,13,50,161,156,149,121,38,50,197,88,198,90,+246,97,201,146,121,6,245,16,236,82,54,3,123,27,82,185,107,85,235,127,+194,86,254,164,44,242,159,157,115,91,239,231,241,190,253,173,113,14,190,187,+95,162,121,29,17,77,168,187,191,89,196,24,117,216,27,134,200,2,215,194,+245,160,192,87,64,131,141,149,201,236,118,111,114,178,47,89,254,251,123,28,+223,147,247,240,125,167,110,38,82,9,127,118,56,235,45,179,168,78,135,141,+158,106,73,185,232,161,205,109,80,40,142,27,248,35,84,62,84,161,33,177,+211,30,143,155,242,228,2,230,29,166,214,13,169,133,241,1,249,47,80,54,+57,183,253,165,240,152,127,88,243,254,173,201,33,20,150,149,120,202,196,121,+164,140,222,186,103,113,245,180,84,100,108,26,89,127,237,221,164,100,207,9,+53,133,251,250,17,150,54,150,213,144,7,169,250,27,255,208,103,52,97,7,+235,235,149,3,76,56,187,168,250,235,14,6,54,117,171,204,55,218,198,141,+182,167,51,138,65,106,153,22,37,114,142,124,49,239,55,67,171,122,116,176,+221,221,31,130,220,207,152,242,200,96,229,180,231,154,54,48,165,168,122,254,+82,185,33,220,112,55,164,176,182,132,208,112,208,87,114,235,156,236,141,241,+40,51,38,53,130,207,103,249,131,129,195,208,81,218,42,201,6,58,172,125,+23,246,196,91,88,204,117,211,105,244,155,73,219,143,122,126,62,222,220,217,+202,153,182,218,78,2,195,231,56,165,203,85,98,191,223,135,174,30,46,80,+228,221,82,166,214,66,18,31,227,140,83,113,166,57,95,1,125,4,209,130,+123,60,226,37,42,207,224,6,83,170,147,36,107,221,67,249,147,133,157,19,+222,46,205,22,190,143,22,139,184,19,209,229,54,243,96,36,111,114,11,96,+40,2,53,99,39,82,64,0,168,176,138,58,131,25,66,109,0,194,188,88,+206,182,11,108,196,83,159,68,150,181,237,137,26,99,15,233,222,220,30,73,+110,56,29,93,86,43,20,166,253,84,93,46,128,112,174,75,81,210,10,54,+86,237,67,177,61,20,158,92,223,235,135,43,220,165,47,63,92,195,87,38,+19,136,197,121,177,112,93,228,115,118,185,84,199,28,250,236,133,140,33,134,+60,200,142,44,17,32,97,115,22,102,89,230,106,207,252,192,148,20,56,254,+109,164,219,102,177,174,128,155,182,182,99,126,178,32,44,15,157,102,78,7,+35,247,2,230,20,138,240,106,162,89,29,22,128,146,117,142,50,116,163,202,+208,125,250,251,162,226,47,73,52,9,111,202,91,43,98,168,99,133,178,113,+165,104,119,2,62,95,229,80,129,178,139,103,221,96,191,231,58,33,105,99,+100,17,36,102,185,243,1,195,116,86,175,107,189,226,156,68,182,25,65,219,+196,0,122,121,144,94,210,182,44,91,15,2,78,92,63,242,69,158,143,3,+217,66,69,199,197,189,176,80,221,129,132,127,222,72,245,199,3,19,198,68,+153,227,56,27,46,178,93,121,142,132,77,158,20,60,204,54,158,240,187,134,+98,105,171,178,214,141,81,14,97,185,208,141,177,3,99,207,33,199,77,28,+116,186,25,177,149,158,163,101,149,128,175,58,28,95,103,6,105,106,85,199,+60,152,14,134,81,195,1,172,142,180,185,201,187,162,47,158,194,67,239,153,+149,73,47,53,222,211,222,16,175,216,50,89,16,36,56,67,185,186,45,62,+43,163,90,146,181,146,148,51,179,237,19,18,169,12,123,25,101,24,89,189,+165,8,18,240,201,183,236,188,179,78,171,239,247,201,236,161,1,105,218,3,+145,225,226,202,23,102,136,253,172,178,31,198,92,72,241,235,198,41,49,96,+134,2,138,42,237,68,94,92,114,59,230,202,104,221,123,208,151,39,124,81,+251,106,77,131,233,29,224,179,120,102,242,62,133,94,71,172,132,9,58,247,+192,4,20,203,176,227,123,223,49,1,160,165,77,209,73,85,234,99,34,56,+209,90,210,121,70,78,151,158,18,56,107,28,19,196,62,198,244,248,178,154,+246,148,248,24,207,184,199,253,80,254,140,49,159,152,27,113,252,172,242,150,+46,104,248,83,213,18,204,214,87,195,61,53,193,220,146,141,170,101,171,148,+46,18,105,222,157,12,176,210,101,188,116,21,208,123,149,78,17,25,204,180,+191,0,18,66,104,74,54,50,112,82,123,115,97,0,111,101,146,30,200,201,+36,23,137,28,144,64,220,164,249,180,12,198,118,197,166,88,89,71,220,6,+43,27,149,31,194,199,149,154,38,114,172,116,51,129,15,188,155,80,198,39,+128,209,102,64,181,177,34,130,67,147,0,131,69,146,75,246,171,119,242,100,+51,234,149,208,224,216,180,98,136,255,132,40,146,90,201,135,183,218,109,136,+1,110,158,221,195,227,152,2,26,248,203,199,83,79,148,115,238,229,70,203,+186,28,11,42,152,24,162,50,93,14,62,206,71,7,61,197,61,36,229,247,+26,164,168,185,251,82,215,45,68,163,246,37,111,63,230,81,6,206,111,138,+243,145,133,14,177,97,194,180,129,14,162,101,224,46,119,93,59,52,128,125,+87,132,128,64,164,133,144,23,87,165,205,134,139,241,206,137,83,179,182,211,+193,248,214,162,31,145,162,93,207,29,184,253,161,154,240,147,176,149,77,165,+53,13,147,59,138,169,97,86,178,121,163,233,159,241,18,118,145,12,97,51,+141,196,166,81,183,26,241,176,112,242,62,226,113,249,39,73,18,254,168,143,+7,100,27,91,230,209,149,66,57,158,179,121,34,170,11,146,157,208,151,189,+22,245,199,120,2,44,143,221,26,95,119,47,125,191,185,153,194,96,126,214,+158,173,14,88,160,202,190,247,98,240,33,28,98,123,157,47,91,87,212,253,+158,65,6,239,115,18,204,106,161,157,97,194,173,76,153,25,228,87,201,36,+226,65,28,73,141,130,41,151,242,27,122,134,59,244,252,102,143,202,7,36,+136,244,225,128,11,230,88,12,42,22,68,23,57,104,192,85,248,119,231,167,+17,177,147,255,159,115,121,211,167,44,144,173,184,84,23,210,121,164,47,2,+167,201,196,62,4,144,48,39,171,154,65,54,223,250,80,23,180,31,151,170,+223,188,15,15,204,187,17,72,96,56,194,176,140,82,71,63,44,228,116,237,+73,185,207,84,110,228,255,83,158,169,151,95,93,245,152,7,202,181,167,235,+30,49,162,209,127,88,146,196,127,33,129,248,163,37,167,108,121,107,76,38,+118,5,233,43,79,255,230,172,45,33,83,128,237,205,253,154,110,255,61,194,+108,242,195,183,225,247,113,122,57,31,201,34,29,185,200,78,190,102,242,156,+197,66,212,163,1,159,70,71,211,93,12,63,186,122,41,44,86,195,245,47,+240,199,136,5,143,172,231,28,148,73,101,167,96,99,91,56,116,34,189,219,+158,161,97,226,83,236,255,247,237,32,114,124,219,3,37,36,81,24,43,80,+240,175,167,155,115,137,3,234,20,96,26,94,237,150,46,236,108,11,157,208,+252,196,213,175,29,143,18,250,248,134,152,93,137,65,25,0,132,39,217,31,+234,202,13,34,244,212,199,81,138,224,67,157,30,9,112,207,234,149,211,100,+28,34,115,190,187,222,138,5,111,200,128,63,10,50,170,155,224,255,238,128,+111,133,188,201,230,141,40,167,247,109,229,93,87,57,175,7,232,70,133,194,+77,149,21,152,134,171,88,85,160,80,121,64,76,120,238,194,80,211,158,52,+27,239,74,187,70,202,42,99,34,85,159,231,54,33,227,39,67,223,122,97,+172,145,46,169,65,45,150,8,86,187,189,80,7,90,153,122,136,151,116,72,+94,0,250,246,94,12,236,2,145,56,121,143,128,105,212,208,213,229,137,91,+2,252,246,85,135,202,142,149,39,105,123,228,107,38,217,177,97,11,64,216,+125,17,74,11,159,43,39,225,212,124,245,175,250,17,198,39,108,44,84,40,+242,141,174,52,188,219,110,90,30,197,203,82,208,167,232,221,23,184,190,61,+89,191,105,1,106,135,148,71,159,191,48,26,155,26,92,97,10,96,199,98,+226,160,9,24,103,218,78,111,163,169,19,20,114,121,254,200,127,239,217,126,+188,84,13,228,58,16,130,153,6,208,253,56,213,103,188,125,175,180,111,159,+102,249,29,60,108,22,124,218,151,121,10,51,131,172,90,150,218,82,112,191,+12,27,182,134,44,115,80,168,226,35,1,141,138,80,67,68,128,61,1,123,+13,83,152,20,195,252,208,95,10,234,237,97,18,167,114,12,189,24,97,239,+244,197,236,142,224,191,142,131,110,176,113,198,3,80,59,68,69,135,9,102,+163,230,166,90,146,174,91,205,205,164,255,104,146,38,73,252,71,38,101,95,+97,51,197,25,122,113,106,93,106,13,117,249,233,79,203,42,220,245,51,69,+17,157,192,189,208,147,85,38,93,82,16,51,224,6,196,63,54,127,24,107,+61,30,229,40,191,55,151,195,2,76,3,152,55,104,35,93,55,135,107,66,+23,173,102,225,65,127,192,20,198,192,188,36,252,124,225,55,77,159,174,124,+170,22,13,13,119,174,38,150,209,223,167,239,198,212,74,237,175,206,6,242,+92,70,200,212,209,244,73,183,254,4,25,242,189,117,4,70,67,0,224,119,+29,224,203,182,249,4,246,160,254,226,6,232,21,16,133,84,158,27,74,91,+14,232,210,203,159,46,181,90,86,114,54,188,118,135,78,116,50,37,33,160,+237,216,249,224,152,85,72,247,248,130,145,206,180,26,219,178,124,200,246,137,+108,127,141,214,192,122,155,20,62,179,99,24,131,16,87,18,126,121,247,191,+246,122,88,241,244,97,5,120,54,109,99,152,225,98,198,5,200,108,106,231,+117,249,188,157,200,121,3,237,85,78,237,98,42,159,78,227,165,214,211,44,+171,160,67,55,26,211,39,233,126,92,190,40,119,168,60,123,93,27,225,209,+116,180,223,84,159,186,205,248,178,147,124,221,237,121,52,96,172,59,144,126,+210,209,115,42,140,6,64,17,135,208,201,20,27,186,25,225,60,0,102,147,+8,58,228,71,90,201,16,77,229,173,134,130,225,53,195,45,243,18,86,184,+202,76,71,109,25,87,187,64,62,180,197,2,55,146,237,213,125,241,143,144,+86,114,246,33,192,12,127,97,37,91,42,62,180,130,156,34,77,134,1,243,+121,77,117,104,60,70,106,164,222,207,147,41,133,35,151,79,201,30,219,125,+243,205,184,135,211,226,190,243,219,67,114,54,132,99,214,150,22,52,179,150,+112,194,181,181,230,63,116,170,216,218,131,46,177,238,100,173,72,152,161,149,+14,231,78,189,172,54,119,235,238,5,161,185,89,191,151,149,138,226,128,3,+179,151,92,249,163,181,47,74,159,160,69,223,106,96,164,47,81,11,163,146,+60,54,83,93,212,24,9,154,79,251,204,16,41,145,66,183,46,212,189,194,+52,212,78,14,245,254,155,204,96,81,101,129,181,206,101,134,37,186,184,198,+80,51,77,56,89,159,101,105,229,91,64,71,200,232,199,102,69,102,241,176,+128,5,110,245,56,47,217,137,160,111,117,128,254,62,133,95,63,225,128,19,+214,5,113,71,86,45,63,36,15,151,168,132,61,204,91,9,176,61,234,78,+96,218,227,244,90,191,204,36,38,129,83,109,254,113,68,239,8,51,72,109,+87,177,218,202,190,111,128,4,238,35,229,196,90,109,156,16,38,218,155,70,+119,20,125,140,199,180,243,230,188,37,29,20,150,68,91,131,83,151,56,16,+113,135,173,10,90,74,123,21,21,242,30,195,39,194,248,73,208,18,110,55,+241,243,109,229,20,168,113,250,225,206,198,102,75,241,45,121,147,20,173,8,+212,240,128,172,128,80,87,111,83,12,238,198,58,40,80,67,176,97,199,112,+131,225,151,218,179,149,137,66,12,246,192,21,44,97,168,253,13,99,146,145,+147,249,151,152,164,236,191,48,83,44,184,226,191,184,203,125,227,87,44,181,+105,66,102,180,38,7,138,181,170,182,182,140,186,13,99,30,122,163,83,142,+217,167,35,189,138,21,254,197,172,101,109,190,115,12,147,32,28,25,144,99,+145,195,180,67,12,83,44,44,76,21,198,49,138,224,210,146,195,184,243,185,+55,53,114,208,198,125,153,101,156,148,123,183,102,251,43,168,75,247,70,48,+213,67,4,248,198,163,31,123,131,72,188,108,191,183,74,150,243,156,66,234,+48,71,152,81,214,67,128,52,3,192,117,173,235,117,62,68,191,226,58,208,+173,251,215,233,186,141,248,223,206,58,229,71,132,201,194,55,0,193,219,131,+51,39,185,6,31,52,19,76,4,137,92,80,171,218,44,180,226,90,82,250,+47,181,66,119,145,112,165,176,80,133,64,191,37,189,59,76,43,71,64,161,+143,233,147,180,165,107,227,45,250,241,251,144,96,150,23,132,108,58,97,14,+192,130,145,120,183,122,155,137,50,222,255,22,58,96,169,155,225,128,239,96,+83,235,36,123,6,193,76,136,163,12,115,161,87,159,52,22,140,226,125,6,+92,173,80,132,115,213,106,225,225,42,90,67,168,219,176,204,97,3,174,161,+132,223,175,95,180,65,196,155,195,4,237,3,216,28,148,113,89,43,46,198,+97,189,236,238,79,238,111,211,170,237,53,129,209,4,72,22,67,105,30,87,+50,12,255,193,63,104,138,11,124,131,76,218,72,151,35,63,249,145,189,79,+163,246,200,120,143,161,40,1,92,137,219,163,20,50,140,108,131,187,16,30,+234,37,114,218,168,71,131,41,193,15,151,173,205,93,212,139,236,47,96,49,+239,165,147,57,7,128,114,98,244,134,77,116,237,162,97,66,181,158,84,92,+121,231,92,239,215,143,216,1,189,74,51,0,91,77,88,100,215,110,153,203,+88,1,200,233,103,206,73,239,132,201,18,164,236,102,146,242,216,183,158,180,+53,111,229,140,17,36,113,183,225,206,100,195,159,95,96,224,123,164,147,171,+221,61,222,231,26,45,82,126,4,111,161,113,22,104,19,119,212,133,165,55,+67,217,4,87,144,122,46,176,214,87,23,207,96,155,169,206,122,178,179,175,+101,181,104,48,160,109,233,168,43,210,71,228,207,1,21,179,238,146,29,114,+109,76,52,187,189,109,108,29,54,6,16,147,124,54,115,163,10,183,40,41,+117,50,31,231,237,152,240,244,13,232,49,166,156,176,42,56,61,0,160,115,+238,142,238,98,207,190,57,205,122,67,233,59,9,27,240,0,167,14,253,14,+223,254,144,250,251,104,228,160,172,238,214,42,49,62,171,73,96,22,185,60,+103,33,111,88,169,75,51,115,207,234,211,101,10,96,239,206,96,12,208,243,+252,124,104,57,31,114,131,32,22,213,28,220,164,128,16,124,35,1,175,8,+251,12,142,172,219,9,236,59,51,58,52,213,41,253,42,1,72,210,46,142,+209,102,112,235,145,1,138,100,50,36,138,120,58,197,253,61,222,148,170,47,+122,157,129,31,105,139,226,18,170,194,34,66,91,95,222,9,232,181,122,11,+254,147,239,183,100,156,46,193,69,114,84,231,182,185,54,53,195,146,94,21,+217,241,177,190,149,2,142,78,138,96,9,253,14,24,49,168,178,10,18,20,+60,253,136,41,55,164,101,168,95,6,165,90,97,144,118,206,167,156,15,124,+92,106,158,220,232,194,205,49,126,231,36,222,54,47,165,118,241,219,73,225,+80,14,172,198,207,61,74,177,131,195,156,248,238,39,95,229,43,143,75,77,+0,191,57,101,183,13,207,151,25,28,221,53,153,9,14,0,121,154,61,18,+112,114,170,65,7,44,132,117,25,114,89,4,29,61,186,172,57,104,191,15,+205,127,209,59,159,148,117,124,160,188,92,219,196,127,137,49,255,203,160,173,+75,2,79,153,179,133,107,157,207,130,58,94,187,189,40,194,188,194,172,251,+62,174,146,243,98,138,60,126,4,173,59,137,108,177,168,81,49,82,91,253,+197,239,247,132,71,194,242,130,135,161,186,48,231,40,133,128,130,240,112,115,+197,125,13,15,191,137,119,77,8,51,27,203,236,25,219,37,202,33,162,138,+30,245,193,55,183,18,244,249,192,247,121,147,207,45,251,211,144,136,173,184,+103,168,101,192,169,80,134,137,231,105,164,96,18,126,182,157,1,72,213,24,+73,35,30,24,78,174,246,142,224,182,154,170,106,78,33,242,177,86,50,251,+3,23,205,121,10,146,86,59,67,102,249,155,51,106,93,55,3,91,101,69,+209,40,242,58,55,48,5,84,197,182,125,196,196,253,134,136,74,138,1,144,+208,177,54,37,64,80,185,96,70,228,5,238,23,34,11,118,171,60,31,254,+0,70,174,9,208,136,219,85,58,112,122,220,86,107,21,104,129,56,191,106,+146,10,79,48,191,119,194,206,248,209,105,2,26,30,59,37,27,161,202,33,+174,28,156,57,137,204,149,248,204,214,92,224,60,48,206,178,115,95,129,189,+104,251,0,79,0,186,10,66,10,175,246,241,71,148,1,200,93,156,76,90,+213,171,106,106,81,229,102,116,155,3,80,14,216,202,9,84,180,205,3,9,+204,226,45,214,198,220,7,254,193,220,118,143,83,182,2,227,112,163,231,50,+31,89,200,8,199,186,0,42,73,97,225,153,91,215,213,174,127,102,129,175,+94,100,193,21,254,54,161,178,97,76,219,238,167,16,197,63,159,1,8,71,+249,121,94,48,179,151,23,61,177,82,58,17,130,111,32,197,72,148,82,49,+227,125,127,228,233,120,191,160,20,207,185,68,16,176,230,99,197,20,154,198,+19,133,243,163,117,183,1,83,45,98,57,27,63,135,226,85,219,56,167,125,+188,182,152,159,204,192,174,48,15,175,69,35,5,219,115,181,220,92,213,183,+189,246,195,83,76,109,9,177,9,8,171,6,59,130,107,23,231,254,250,26,+111,240,165,73,238,37,151,219,108,82,72,105,95,129,222,211,164,99,24,198,+16,137,229,103,64,82,136,83,141,193,126,251,98,148,78,47,38,176,253,54,+90,182,136,144,27,117,114,27,23,4,92,105,132,209,160,40,37,247,138,207,+56,142,75,124,15,20,152,16,140,30,13,137,109,95,158,157,75,109,240,3,+149,242,20,18,17,14,154,168,76,124,182,29,14,70,1,134,118,183,253,214,+161,72,226,196,133,218,205,139,215,124,39,253,160,57,65,203,239,28,30,210,+101,191,33,68,251,14,59,169,131,106,12,4,26,43,40,164,79,75,53,249,+229,89,152,76,152,161,32,37,14,234,220,98,101,163,11,6,253,100,78,136,+177,13,17,136,31,228,79,152,3,112,106,9,163,60,78,60,167,122,107,106,+197,113,132,255,50,89,156,29,98,111,205,180,93,99,128,173,205,16,32,158,+60,239,170,112,51,56,247,222,159,191,233,23,245,226,107,2,19,255,86,199,+187,178,112,48,16,151,94,27,67,117,74,175,255,203,247,239,218,39,151,157,+170,242,175,90,181,21,107,123,174,56,183,8,172,17,181,247,211,50,90,14,+203,104,51,250,197,66,245,189,179,71,62,33,104,148,51,209,204,153,82,61,+128,7,239,187,243,42,198,175,207,150,73,31,159,120,55,47,183,175,3,43,+104,40,229,174,12,37,147,77,132,3,186,59,159,178,125,3,179,28,82,212,+249,254,252,215,57,114,145,178,129,74,136,230,18,177,150,183,253,250,61,173,+175,169,67,118,29,47,250,46,251,202,214,88,206,225,202,142,202,207,63,80,+123,233,237,250,98,160,247,52,242,228,45,31,133,190,219,92,187,166,23,247,+141,213,5,166,184,103,45,215,169,220,6,232,110,55,191,19,185,98,8,139,+53,218,211,154,186,17,249,242,148,230,37,141,80,91,242,187,116,119,119,103,+47,75,100,216,220,173,156,47,158,50,83,128,254,58,50,255,84,123,59,185,+111,90,26,61,133,82,143,188,26,130,7,224,179,45,156,208,114,161,63,186,+98,86,3,187,54,119,10,217,232,101,246,194,144,193,250,90,91,232,11,4,+87,10,14,174,79,45,18,239,123,106,130,224,82,170,136,49,244,224,136,230,+196,55,8,216,99,196,210,87,11,185,237,128,11,15,61,9,30,56,166,250,+174,134,5,187,84,110,175,49,149,170,157,171,38,59,97,58,131,238,144,221,+30,77,207,59,137,137,54,241,255,144,198,221,104,33,48,49,38,9,250,251,+230,170,255,12,32,4,253,174,44,223,124,154,136,48,22,47,146,251,104,167,+54,22,113,228,79,108,149,121,170,59,67,22,82,59,42,69,214,30,231,215,+170,122,16,210,132,113,105,121,24,189,175,57,207,213,26,17,161,100,96,88,+56,232,223,32,113,230,103,31,243,186,2,96,190,13,54,98,199,21,37,252,+166,220,209,188,126,179,55,70,101,216,133,165,74,196,123,175,214,75,212,78,+149,254,86,9,47,148,190,162,141,68,16,47,120,229,69,43,106,73,115,70,+253,171,32,212,78,7,213,166,5,42,155,225,69,26,91,207,148,94,191,87,+31,211,89,60,45,39,209,232,23,147,16,173,11,129,107,69,101,187,101,141,+180,98,169,10,58,204,93,194,208,126,136,22,26,168,212,211,197,134,22,101,+188,229,205,122,241,197,99,240,9,126,3,181,250,239,28,242,200,134,203,21,+72,128,172,220,26,24,146,244,125,117,219,144,113,186,62,186,222,5,184,110,+69,110,147,123,128,155,213,54,119,201,69,106,66,175,234,255,6,176,65,4,+122,239,77,211,68,161,90,78,87,44,28,181,22,47,188,11,94,200,255,32,+42,145,163,175,175,71,223,232,30,117,183,106,4,35,176,162,212,1,104,182,+128,122,149,140,192,179,51,167,247,39,21,244,44,196,142,85,56,202,162,208,+174,46,170,29,60,135,115,229,112,28,255,4,85,8,237,223,165,246,75,96,+156,120,252,97,91,218,216,254,207,47,131,184,28,216,28,39,70,68,64,6,+69,245,213,107,127,73,131,157,85,132,137,127,24,29,18,238,161,132,173,87,+39,246,119,162,13,127,57,130,12,25,94,77,114,157,172,124,185,108,50,60,+236,137,99,121,157,69,43,182,2,62,2,240,122,135,73,73,48,226,144,252,+109,227,13,229,196,110,139,149,95,221,146,20,2,123,202,134,198,200,242,111,+151,62,72,151,140,30,154,174,99,62,188,239,136,209,57,221,93,105,161,230,+25,140,122,104,124,94,158,60,18,233,128,104,141,148,138,28,177,165,76,239,+52,113,201,153,159,99,191,127,88,100,153,238,5,6,95,89,217,39,201,55,+140,53,200,23,84,51,139,34,228,74,194,153,208,141,27,65,107,237,75,89,+146,2,158,110,124,86,36,71,125,141,235,247,181,154,107,248,68,9,56,154,+211,255,55,129,114,229,190,198,106,254,49,18,67,21,18,41,99,209,144,24,+26,57,129,52,51,105,84,168,157,227,209,192,248,159,45,3,65,243,71,51,+97,171,246,184,86,250,169,239,187,41,128,104,249,211,189,206,88,246,247,90,+205,62,100,104,170,163,1,104,232,14,212,186,13,170,138,207,129,33,246,67,+70,188,169,191,18,4,64,223,76,151,60,144,181,90,237,111,106,130,108,56,+244,231,70,243,26,28,93,227,34,84,84,4,122,207,232,65,154,62,160,241,+44,47,127,172,107,90,190,23,244,191,5,108,103,93,46,160,24,54,64,86,+214,87,214,236,246,227,252,25,205,12,110,235,210,179,209,35,147,104,230,104,+235,52,61,65,185,154,231,42,127,76,108,42,9,181,88,189,28,180,168,215,+179,116,180,165,241,46,123,37,170,177,228,46,130,36,139,85,47,150,229,8,+211,93,234,190,16,176,116,148,179,187,13,108,114,27,82,20,103,127,186,143,+157,41,145,95,0,105,120,64,4,65,235,250,79,37,224,162,159,135,244,54,+116,150,137,171,126,205,30,52,123,13,69,177,72,170,107,225,42,224,181,54,+244,211,38,189,1,119,245,89,18,81,19,255,79,63,234,68,26,97,219,116,+82,220,220,81,78,179,144,250,214,51,102,186,36,25,98,76,88,129,60,40,+161,207,236,230,6,243,184,129,146,174,9,129,223,24,145,194,179,201,163,242,+183,128,31,83,203,54,104,68,110,36,51,219,90,176,170,15,27,9,152,77,+128,176,8,219,122,55,144,12,25,31,159,251,103,148,200,29,41,20,47,191,+41,188,91,203,29,255,199,103,197,186,157,27,31,17,116,231,103,195,174,57,+80,152,198,3,148,103,167,142,177,107,99,138,130,223,204,127,29,35,32,99,+143,185,151,254,106,80,3,53,111,99,194,105,120,127,120,204,201,219,133,69,+191,182,77,86,90,71,58,195,66,197,189,94,134,142,151,162,109,108,108,34,+118,56,8,178,232,255,51,131,7,146,12,161,37,217,233,246,51,184,83,32,+134,236,101,106,22,56,24,198,93,252,224,22,166,59,201,112,23,100,228,30,+201,95,231,34,50,104,21,207,25,16,243,4,249,109,182,246,195,185,42,202,+109,114,155,137,105,121,49,75,186,179,29,71,17,221,168,209,200,37,16,128,+113,53,205,157,205,44,237,33,150,91,214,130,239,200,53,142,178,109,39,141,+191,180,8,203,75,111,138,170,3,231,205,139,48,1,35,48,68,163,14,92,+151,206,220,46,156,46,180,254,38,211,60,24,104,76,29,103,117,107,0,192,+9,94,64,61,204,200,19,94,9,234,185,106,73,82,64,57,7,39,249,135,+106,67,53,248,118,232,52,162,153,128,38,2,195,87,61,10,235,15,216,132,+207,254,178,56,6,214,112,54,146,196,227,31,68,209,30,144,37,235,176,61,+181,215,83,218,197,65,61,51,20,243,156,190,214,177,124,229,113,56,191,65,+39,129,158,226,139,170,150,98,98,115,1,134,47,144,122,189,85,172,185,134,+231,61,17,236,109,152,50,160,178,190,12,112,91,71,228,10,96,98,95,25,+253,204,64,40,244,123,232,242,168,47,16,3,25,147,155,118,144,114,56,94,+33,20,186,8,249,80,218,125,153,102,109,70,172,170,188,106,33,18,87,2,+10,178,174,143,42,62,37,107,58,122,6,39,16,196,29,8,197,45,202,163,+253,127,252,57,183,62,220,120,122,147,188,79,166,178,79,30,213,219,240,142,+100,121,45,215,2,192,136,132,106,63,84,29,204,46,100,183,202,70,253,0,+250,73,254,206,242,230,101,206,212,159,246,113,146,4,173,135,67,160,219,55,+61,171,138,169,104,183,194,70,202,93,145,0,242,101,69,156,190,205,4,146,+137,136,176,241,190,31,7,99,130,98,39,103,27,118,47,38,159,22,153,6,+177,6,219,83,108,86,60,194,211,127,224,243,6,249,245,223,111,81,176,110,+89,186,214,229,8,60,115,104,113,94,68,176,58,11,150,58,168,7,2,35,+81,155,85,194,84,166,89,220,5,135,28,73,175,146,207,110,53,30,56,195,+111,163,253,228,192,76,42,213,239,201,14,39,4,123,126,89,208,167,22,148,+8,14,36,47,169,235,36,223,35,120,154,164,218,141,178,203,25,93,209,170,+255,30,55,15,181,164,189,144,223,147,6,159,92,255,170,7,229,125,200,73,+91,30,155,79,133,232,207,186,168,144,222,39,26,179,111,193,41,116,244,175,+192,193,254,141,115,194,57,234,74,122,22,140,215,166,72,196,86,197,117,150,+189,34,19,103,64,142,19,76,46,67,75,238,59,198,236,150,161,204,64,158,+246,109,161,161,201,195,93,132,63,77,206,184,198,239,211,63,105,203,156,238,+141,114,159,203,237,3,36,65,107,77,241,208,130,115,152,51,225,147,75,60,+243,121,146,134,233,20,109,169,21,6,165,42,3,1,58,66,175,95,23,6,+55,73,223,110,158,60,33,153,181,249,254,113,64,197,24,202,194,117,99,93,+151,10,171,147,236,173,123,84,166,196,118,5,123,164,162,123,221,75,54,252,+104,93,10,88,104,39,152,222,126,176,202,85,216,74,244,122,222,98,208,221,+43,255,112,105,223,177,209,139,106,64,17,57,44,215,128,15,57,131,209,24,+65,182,22,141,73,9,183,41,142,191,228,137,101,72,149,185,95,29,33,195,+85,190,121,207,85,50,43,62,30,161,168,154,187,137,232,165,115,220,197,141,+179,69,50,170,246,120,126,49,127,182,218,221,122,158,151,134,109,100,99,110,+102,103,118,4,204,76,36,207,228,7,245,32,40,217,119,50,86,110,228,15,+206,179,56,41,71,76,217,55,192,131,77,207,251,243,133,89,117,49,144,67,+69,210,142,167,56,63,220,141,136,238,1,129,200,170,181,107,228,29,148,110,+53,248,192,168,49,87,95,33,82,229,51,232,184,24,219,171,134,90,89,218,+49,23,44,252,142,167,211,91,125,247,139,28,20,131,151,102,203,69,170,139,+140,178,145,253,193,255,26,97,86,225,209,65,204,48,110,121,170,188,205,160,+181,222,255,148,21,92,119,100,241,77,81,115,28,115,92,227,52,67,180,31,+181,66,117,41,81,110,144,127,9,185,210,55,222,196,250,215,140,176,74,18,+177,210,68,53,177,172,209,215,130,215,207,248,157,210,145,10,82,3,71,53,+35,190,26,178,18,57,67,98,155,97,251,91,20,165,147,48,159,197,30,247,+98,47,102,160,90,112,2,136,83,154,119,85,210,255,103,62,120,151,77,29,+74,149,18,68,25,143,17,54,179,184,97,247,213,210,158,93,90,227,67,205,+238,118,24,140,236,49,113,252,3,9,180,161,214,189,201,79,76,179,235,23,+167,168,59,107,121,126,179,7,98,137,85,12,178,7,115,83,141,131,125,98,+170,62,75,114,75,46,110,200,190,45,178,51,144,144,59,78,115,14,77,188,+100,69,75,25,162,80,0,241,92,153,5,248,97,182,110,9,234,50,117,97,+80,121,49,18,248,72,178,94,54,246,12,155,219,106,79,222,67,162,99,212,+12,216,132,93,59,94,217,108,128,222,213,110,31,190,21,185,13,229,243,224,+115,233,84,161,247,57,162,89,87,233,65,59,209,75,193,49,131,149,248,194,+123,134,27,251,73,244,212,93,106,66,116,14,21,27,4,174,49,93,101,223,+238,107,184,111,254,228,245,219,59,186,242,166,65,206,158,41,39,200,167,25,+169,135,65,175,171,254,228,109,185,93,210,138,194,117,5,109,191,210,92,242,+97,93,183,236,219,3,161,218,19,133,164,74,194,0,105,143,140,252,104,91,+106,157,14,106,115,22,102,12,103,104,84,63,249,12,108,73,171,0,126,203,+179,135,61,0,136,133,115,27,86,251,84,156,179,45,206,166,75,20,98,152,+63,93,114,183,228,49,43,193,234,60,193,99,252,37,115,159,73,59,17,95,+134,84,49,169,214,33,249,30,70,41,93,154,108,226,237,74,42,39,96,170,+0,158,234,242,204,254,211,23,188,124,215,145,203,108,113,170,122,190,134,213,+89,119,136,200,17,243,166,170,41,110,208,212,57,63,16,17,143,4,32,180,+52,131,250,119,153,250,172,237,176,128,199,24,239,7,217,209,37,140,172,200,+149,82,57,156,207,205,108,117,197,231,122,67,251,252,107,233,94,164,222,194,+206,64,192,82,154,237,41,18,133,251,36,100,71,100,239,6,13,71,218,123,+157,109,50,113,158,213,159,59,177,128,242,44,84,186,54,101,2,22,0,249,+158,119,176,53,153,70,147,149,105,98,205,74,225,221,178,155,149,254,205,20,+70,38,73,0,201,180,208,255,182,165,83,170,188,191,174,69,40,254,218,32,+142,167,73,216,205,123,180,66,181,115,2,155,161,244,187,22,237,201,2,121,+134,28,164,82,97,245,218,131,41,183,53,208,213,0,57,74,72,172,142,187,+49,3,150,208,72,155,118,139,117,212,21,23,231,193,197,193,7,198,13,66,+214,172,137,41,18,138,251,142,238,112,229,178,74,194,247,188,44,252,244,83,+240,200,184,215,44,56,41,253,245,84,59,144,158,180,58,222,226,216,55,64,+239,225,35,226,92,196,44,141,205,201,255,116,51,182,183,13,92,115,97,135,+84,162,169,24,225,91,139,239,234,157,42,145,90,177,156,250,43,5,232,1,+197,67,153,178,0,114,105,134,167,89,95,113,102,67,194,171,61,120,129,99,+2,183,92,170,227,229,77,219,211,95,126,43,84,106,37,18,177,202,129,82,+207,155,252,118,42,107,85,27,202,163,137,221,82,239,15,161,199,233,20,27,+162,212,234,66,191,76,184,231,73,50,254,94,76,228,132,182,28,37,101,169,+61,40,57,84,142,223,228,200,232,44,88,36,135,67,44,166,255,131,115,22,+191,45,60,98,114,209,128,205,54,141,110,122,60,74,208,199,143,201,226,198,+148,196,98,232,81,121,87,182,191,145,206,215,17,42,63,42,14,191,194,161,+110,252,26,251,10,26,152,210,253,207,120,177,162,30,234,126,145,47,210,167,+218,62,74,81,126,193,148,87,32,97,250,83,106,9,129,181,239,63,91,44,+136,151,0,41,83,241,209,212,80,60,223,112,254,209,4,96,1,45,111,2,+102,52,3,74,134,61,187,165,140,126,53,42,188,54,249,236,136,171,12,23,+138,124,1,27,125,227,158,0,164,94,220,106,236,204,47,188,232,56,118,43,+116,31,107,16,235,80,46,245,61,48,120,187,8,44,2,14,190,127,243,223,+232,62,37,143,239,123,68,191,249,52,145,159,228,222,33,241,255,196,89,217,+245,138,174,69,5,5,81,16,174,176,247,51,11,116,227,47,0,35,193,26,+193,79,115,67,152,246,38,170,152,119,15,74,75,213,251,60,99,219,0,83,+244,136,26,127,161,39,110,131,65,95,242,93,41,230,162,80,114,133,138,137,+34,30,95,173,147,88,200,198,235,13,204,96,156,142,208,118,115,9,124,57,+96,38,121,59,168,43,202,80,207,123,245,167,171,170,90,29,145,139,182,90,+195,217,182,23,254,109,223,197,249,6,64,100,26,236,70,145,183,152,241,166,+217,224,109,151,255,201,237,235,14,72,32,222,147,211,224,101,215,180,83,20,+15,74,17,190,43,155,84,219,26,235,47,82,188,86,210,144,182,184,239,180,+10,213,116,5,2,147,148,67,210,184,37,91,237,39,71,197,148,5,60,116,+13,210,150,255,69,153,161,226,243,88,109,16,0,73,56,254,205,253,248,200,+4,117,163,88,248,244,254,181,142,124,136,219,197,176,36,3,170,40,254,248,+73,145,46,28,40,26,72,23,69,63,232,174,59,158,250,83,210,237,103,15,+33,112,157,54,155,63,213,42,117,102,179,245,218,201,47,90,232,195,171,211,+15,28,112,59,208,217,101,66,165,193,216,60,154,167,222,63,80,9,243,160,+91,88,42,178,113,48,209,53,242,59,158,118,149,71,24,109,15,2,10,85,+128,179,141,143,119,245,93,148,164,184,152,240,23,142,140,126,166,155,133,134,+27,62,44,81,10,66,99,154,18,152,68,1,227,7,20,251,71,114,21,145,+28,219,138,237,235,153,112,151,49,83,112,181,175,211,167,125,109,57,30,119,+116,15,229,168,105,157,197,230,200,123,242,23,181,235,27,245,241,99,96,175,+210,250,186,126,136,66,247,5,189,57,216,186,172,127,196,238,40,110,134,74,+25,84,143,211,112,109,250,202,36,62,95,150,33,194,107,196,101,17,65,87,+67,65,105,83,182,188,86,243,160,61,125,252,55,177,252,176,58,79,15,246,+238,82,64,121,221,78,4,159,55,171,226,179,242,49,236,2,79,119,147,189,+248,119,23,133,93,122,222,125,92,180,83,22,98,51,65,187,84,188,212,6,+167,68,56,153,54,231,204,51,255,104,60,153,255,70,119,228,186,248,26,31,+78,172,65,192,80,52,107,248,98,88,150,109,32,136,24,140,106,188,244,242,+28,13,242,191,136,135,157,243,118,128,194,157,231,103,168,114,30,125,132,2,+119,74,112,156,240,198,140,33,147,114,9,174,72,117,97,0,17,4,170,105,+97,79,63,55,248,74,83,73,100,66,233,175,29,247,169,188,39,246,191,160,+10,212,80,47,94,141,61,6,106,36,161,73,196,106,31,200,139,173,125,234,+248,68,93,65,189,172,248,143,103,88,78,122,73,218,71,90,73,7,76,152,+168,51,247,174,33,87,20,37,208,32,6,129,175,65,50,74,230,252,94,98,+2,38,196,7,21,156,117,182,29,30,48,16,67,14,143,135,62,12,103,179,+183,219,88,30,141,78,136,29,112,107,43,70,253,216,130,31,165,15,223,250,+71,115,36,148,215,215,154,60,159,232,159,149,124,27,158,73,105,151,71,213,+176,46,221,142,68,149,119,240,132,182,168,186,41,78,207,27,99,40,187,238,+150,238,55,233,20,189,175,211,123,204,208,225,66,48,191,7,138,108,81,223,+254,103,93,126,60,36,46,43,18,31,110,251,104,59,19,135,233,218,183,21,+252,236,106,56,79,150,52,97,190,31,211,61,228,210,35,117,49,46,105,154,+191,107,177,100,2,91,92,109,105,13,138,147,182,57,62,21,130,217,157,64,+52,58,207,251,217,132,183,222,150,95,181,137,55,255,50,127,123,48,106,56,+101,150,145,62,204,72,42,76,135,156,45,194,197,177,100,239,119,252,150,224,+196,171,29,132,82,79,131,157,199,47,66,144,3,200,105,198,252,140,173,82,+156,90,131,90,233,68,224,219,176,207,145,238,56,255,217,215,93,105,67,114,+234,41,112,134,12,48,240,195,152,2,61,229,126,43,255,203,211,166,25,197,+207,169,151,112,98,154,88,5,166,199,62,210,137,239,225,103,157,60,51,8,+166,220,90,244,158,142,67,235,251,235,85,51,56,147,20,35,48,2,247,71,+185,94,193,109,74,150,195,238,195,22,151,158,125,166,160,151,134,95,190,201,+139,79,33,217,161,151,217,170,164,87,139,144,135,86,152,57,68,16,221,113,+204,30,212,211,48,184,53,61,74,57,225,121,227,109,157,50,62,213,67,206,+153,210,140,80,72,59,5,221,84,44,106,201,222,78,73,171,7,147,109,166,+10,196,232,26,107,164,110,159,95,53,132,182,161,140,98,67,57,107,197,189,+92,194,74,131,216,63,72,185,106,4,20,96,98,197,185,6,13,205,143,244,+250,133,193,102,218,238,174,229,135,33,205,150,154,37,192,234,184,148,18,224,+84,123,68,49,89,127,21,61,105,153,111,78,40,243,43,23,232,215,189,69,+106,101,195,189,219,141,201,77,57,5,108,152,108,80,77,93,194,244,26,212,+187,101,165,246,171,25,148,220,153,63,98,236,195,3,26,57,82,231,252,34,+115,247,125,131,97,152,103,60,19,198,83,192,3,113,24,45,184,119,176,98,+76,176,157,133,29,16,89,129,181,198,12,117,86,117,108,40,204,44,234,178,+243,231,200,88,42,233,190,252,225,227,239,232,181,32,23,115,166,17,120,194,+217,89,25,17,38,224,179,5,180,155,167,229,94,122,194,140,206,81,91,77,+150,226,49,227,223,79,110,6,125,8,217,50,139,15,68,42,244,183,246,240,+111,214,182,132,124,154,175,39,111,98,12,100,219,92,219,123,19,36,133,213,+39,60,84,234,112,235,32,200,221,69,206,196,149,79,176,72,145,242,223,247,+134,126,77,65,169,118,57,245,86,0,188,220,184,115,158,211,107,149,29,17,+86,217,47,241,158,5,91,49,5,154,13,34,144,17,51,157,141,180,12,24,+145,25,114,76,137,199,65,101,37,204,6,184,36,199,93,13,165,38,194,106,+217,227,65,106,147,202,16,135,239,84,54,55,251,96,177,71,234,34,222,109,+96,83,148,47,231,254,4,2,122,254,226,29,18,23,152,5,63,4,49,243,+113,230,193,199,225,116,33,238,241,138,180,97,36,85,56,211,4,44,61,213,+251,216,152,234,241,222,209,196,134,142,184,225,58,126,27,91,158,45,154,98,+36,82,120,188,52,243,66,38,70,236,6,249,39,255,79,92,129,100,183,97,+212,19,233,91,245,180,20,134,45,196,216,231,131,93,181,207,65,221,252,22,+218,205,96,231,209,151,26,220,169,214,76,178,32,60,148,84,217,135,208,224,+183,217,135,134,89,5,3,227,149,171,80,208,198,7,55,118,157,242,252,137,+238,85,23,194,146,22,92,29,160,153,204,155,102,191,106,227,18,35,91,124,+244,179,122,140,52,203,185,95,38,106,14,52,88,149,147,56,145,211,202,208,+139,155,47,205,175,2,165,33,158,6,221,250,143,53,164,164,222,60,43,144,+242,190,60,169,102,34,61,55,122,69,164,44,146,88,45,35,144,26,234,227,+184,90,206,231,219,84,133,182,81,68,109,175,38,181,60,111,106,208,149,97,+120,248,106,3,234,66,234,150,242,227,223,243,219,35,220,76,11,90,71,161,+227,6,201,194,98,146,17,176,110,166,253,117,230,225,253,219,254,188,19,126,+207,43,171,207,84,172,17,177,246,177,53,30,130,254,230,204,128,103,29,26,+23,125,204,181,95,153,33,16,151,215,132,21,2,89,218,48,115,115,115,12,+124,177,92,136,118,70,84,185,17,144,129,57,195,190,1,120,249,88,157,149,+113,76,176,154,86,234,211,61,23,215,163,151,127,89,229,158,11,223,255,125,+86,95,54,45,135,145,125,4,20,86,12,72,236,221,18,70,207,213,174,209,+230,152,213,150,57,158,96,137,195,14,116,233,12,41,38,21,19,230,68,64,+254,98,116,66,189,143,140,240,208,2,88,121,164,151,67,165,161,124,36,17,+130,83,172,178,124,252,195,80,12,106,35,188,113,43,83,58,213,123,247,16,+144,97,168,200,32,134,240,115,143,9,0,158,237,146,178,139,26,191,103,252,+35,179,56,113,201,115,232,26,115,75,236,207,178,109,141,195,130,161,130,253,+204,81,136,106,175,109,118,151,16,16,241,146,57,206,53,83,104,169,1,14,+11,85,218,88,193,189,121,64,104,234,235,125,216,84,185,146,69,50,157,61,+7,196,181,58,79,102,215,218,147,164,125,231,212,84,129,96,104,231,8,221,+193,2,3,65,194,0,166,6,25,149,32,18,75,140,131,98,151,213,150,215,+230,246,252,10,198,111,210,161,167,151,201,223,57,183,48,102,211,115,60,251,+181,143,192,98,101,240,200,66,180,159,98,17,167,156,40,45,82,71,138,27,+53,24,117,192,133,99,154,190,23,140,81,4,243,174,63,104,89,85,235,191,+66,253,218,156,48,99,13,24,177,88,148,200,18,172,202,230,159,148,232,96,+172,116,72,72,27,117,80,4,245,37,121,243,101,54,183,104,238,30,239,255,+182,40,83,99,126,61,148,156,25,115,102,47,220,238,142,18,254,90,98,202,+87,168,225,93,36,208,215,105,148,221,11,110,63,47,60,49,235,17,141,238,+172,247,56,228,186,44,126,181,3,150,187,15,246,171,241,250,143,53,76,94,+235,2,217,8,155,83,207,142,195,204,246,179,139,99,22,144,188,218,47,99,+182,88,181,49,157,80,36,221,88,71,24,168,29,124,212,220,162,95,55,76,+251,183,18,179,18,127,17,149,177,162,225,213,17,168,235,251,106,179,166,182,+87,250,252,210,233,78,153,11,54,174,166,235,250,202,31,73,160,161,57,50,+160,117,157,15,235,20,129,46,25,174,92,234,248,40,231,158,23,243,109,85,+250,11,104,93,238,167,108,195,214,215,217,40,94,255,248,131,8,228,241,107,+162,137,201,18,142,231,25,194,126,82,98,204,20,240,0,54,50,196,17,107,+183,197,118,128,141,146,134,67,171,132,68,30,219,211,170,231,141,131,158,61,+55,227,112,184,177,74,198,255,92,76,233,161,132,77,5,209,16,220,20,27,+79,100,83,93,143,146,154,90,67,76,16,241,59,100,251,245,139,30,250,202,+210,63,212,151,149,246,184,93,11,148,34,42,220,134,232,209,221,165,118,254,+197,34,16,152,93,227,64,134,199,176,43,18,201,186,50,35,176,58,192,82,+101,124,230,234,48,179,201,50,76,232,29,133,90,204,164,90,243,51,160,243,+156,131,254,5,15,44,61,10,175,207,112,50,230,37,105,122,179,52,70,160,+159,224,55,226,177,127,136,201,255,106,129,42,37,177,109,208,135,145,200,62,+21,22,238,187,5,23,55,152,232,151,55,100,153,141,214,61,59,59,89,140,+28,250,11,146,112,147,128,230,205,249,13,204,80,90,105,212,205,96,13,206,+47,140,90,205,0,246,197,107,212,247,239,43,135,55,245,51,59,169,210,73,+60,247,39,132,187,36,123,91,239,56,164,169,210,19,232,40,50,245,181,98,+136,141,188,226,243,12,199,95,111,111,147,159,179,10,62,251,252,240,91,187,+119,33,235,188,189,75,216,71,42,100,85,61,161,35,241,173,57,171,134,76,+111,72,226,64,93,7,213,77,13,176,192,37,193,192,177,96,101,241,126,82,+185,143,74,214,248,220,3,79,140,47,217,172,47,66,0,200,231,72,119,62,+110,125,32,0,224,154,207,137,199,239,20,38,211,141,182,129,238,75,208,139,+216,9,4,62,183,28,1,93,210,141,85,2,242,103,24,81,186,66,151,235,+157,168,39,180,23,54,56,77,236,46,69,30,189,197,69,218,69,101,164,209,+0,255,249,188,129,71,33,79,43,189,131,0,152,178,116,244,125,80,229,207,+169,173,222,228,116,200,169,211,108,12,239,246,125,15,85,6,160,79,103,181,+120,130,8,111,58,111,41,214,160,166,119,122,82,57,23,126,255,13,177,230,+139,21,255,101,240,122,184,222,125,53,151,148,88,190,100,146,38,191,185,93,+247,1,241,88,9,169,18,113,41,43,171,56,108,75,229,104,161,35,153,126,+89,74,171,76,102,173,254,198,213,36,113,152,112,139,215,239,73,119,17,149,+118,204,25,11,86,29,23,158,63,186,220,74,36,1,135,239,43,216,181,230,+71,190,168,204,175,44,178,241,144,178,179,187,126,41,183,205,253,163,54,100,+82,216,215,132,164,239,97,105,198,228,177,149,16,3,69,226,37,34,88,119,+34,206,31,59,148,47,191,138,129,230,152,233,123,135,91,22,121,221,65,86,+24,119,69,193,37,29,68,160,33,116,49,32,34,142,253,223,214,109,178,112,+136,9,118,114,110,17,228,121,204,213,182,105,221,50,58,65,177,42,48,108,+166,2,108,63,60,251,176,235,252,35,248,11,70,204,212,95,128,82,0,58,+112,19,94,99,101,171,129,160,98,185,96,150,76,88,66,240,211,192,138,61,+197,136,223,76,16,179,224,220,103,242,2,208,84,161,83,70,40,200,248,135,+53,46,64,230,167,112,56,161,37,32,78,90,114,231,128,17,30,16,113,228,+110,17,242,147,122,148,28,7,36,47,249,249,108,203,8,247,69,61,25,63,+115,47,25,149,148,64,55,24,88,121,49,21,247,89,141,42,69,22,194,109,+132,56,174,189,202,94,64,59,176,234,120,242,47,57,217,212,51,78,193,62,+209,170,124,32,158,192,48,221,176,90,50,201,153,162,222,114,9,212,114,17,+110,175,93,194,55,43,110,172,235,73,210,208,10,82,243,247,66,110,166,175,+192,145,247,68,64,106,96,182,48,223,225,84,218,173,243,131,225,117,195,51,+254,74,53,64,120,54,56,127,63,72,108,1,50,111,33,255,254,144,224,137,+180,222,231,168,229,17,46,202,169,75,22,73,24,89,60,47,206,248,200,153,+14,22,85,172,112,163,30,188,231,198,125,112,229,228,219,179,62,150,128,212,+92,96,222,204,154,106,44,230,193,245,108,8,52,34,76,198,109,43,119,34,+9,207,131,25,133,157,49,247,46,238,91,12,152,234,35,121,66,208,75,140,+6,151,178,75,239,165,110,245,71,131,21,146,232,214,206,92,57,93,238,123,+112,17,186,236,192,229,124,71,174,76,55,9,168,64,206,238,200,191,3,222,+170,189,249,201,117,170,213,56,155,231,126,58,86,122,226,85,182,153,123,0,+22,25,171,40,128,119,107,96,32,8,50,186,10,206,15,99,162,249,161,10,+13,227,154,82,254,220,214,77,58,105,4,59,147,183,44,67,188,151,119,26,+28,43,46,136,48,111,11,117,251,137,187,239,242,140,90,41,238,39,179,98,+39,94,115,247,224,204,14,155,161,221,242,29,100,159,217,77,68,127,224,152,+254,78,209,182,95,32,21,114,124,112,207,104,42,246,93,72,38,111,221,101,+203,117,171,250,19,9,31,99,123,38,183,115,110,208,143,64,117,115,177,6,+242,26,219,197,244,105,183,31,130,14,108,71,130,112,123,132,49,233,136,249,+73,15,123,209,64,216,96,128,212,172,226,216,123,134,59,92,61,9,2,137,+215,69,3,94,239,132,60,119,207,68,57,164,127,197,100,166,7,200,61,193,+117,176,224,120,133,6,185,87,80,71,161,50,23,85,164,186,236,37,154,224,+199,185,2,29,118,39,159,26,155,69,41,217,141,144,74,193,244,155,52,200,+120,136,18,193,189,86,39,127,205,214,77,152,219,82,19,174,71,165,253,46,+48,193,142,201,34,31,112,250,46,6,225,182,61,233,246,85,31,34,26,132,+104,126,148,83,131,38,172,131,71,209,181,40,38,131,21,116,79,228,137,19,+66,206,235,173,227,67,182,60,77,90,19,193,64,115,39,209,247,68,51,37,+67,235,67,225,14,166,50,244,149,64,94,194,216,185,30,198,4,154,242,82,+102,81,232,253,4,8,57,232,20,168,113,30,230,233,67,127,165,34,113,208,+32,70,39,199,134,223,103,211,252,222,7,60,26,97,124,137,165,82,190,81,+47,252,245,243,107,43,167,118,16,171,116,161,59,109,121,69,209,252,5,79,+87,219,115,18,21,122,142,56,118,241,20,71,167,114,14,6,185,64,150,190,+236,135,67,179,248,89,127,234,176,141,233,100,137,3,156,234,239,98,152,19,+53,242,64,135,192,67,73,66,140,145,193,8,253,46,127,244,200,223,254,12,+91,188,118,175,157,133,144,149,214,111,130,192,211,191,93,140,78,162,51,72,+163,241,38,89,164,165,234,196,147,110,4,198,18,12,152,134,26,143,116,205,+139,74,117,46,169,82,123,89,2,7,253,76,156,35,111,94,186,15,0,62,+7,5,178,189,69,121,21,128,191,223,29,156,164,208,255,131,83,215,102,31,+17,166,52,181,143,88,226,21,102,111,12,206,226,7,188,239,92,90,87,170,+48,70,181,100,127,131,29,181,52,85,48,166,109,80,32,185,59,248,132,102,+41,185,120,107,62,100,150,154,32,101,99,233,9,92,209,163,132,156,52,63,+118,53,195,96,208,189,132,3,118,115,26,119,169,142,235,236,121,115,178,3,+243,147,158,108,135,192,49,87,59,43,234,138,207,179,185,229,181,172,17,79,+0,207,129,237,209,207,68,109,156,24,170,251,157,178,135,240,67,162,254,148,+65,251,78,237,50,102,56,136,215,45,180,87,99,41,132,180,52,144,164,165,+91,19,58,150,101,173,247,18,55,254,70,102,177,64,114,238,160,228,31,254,+254,14,215,118,162,250,123,48,212,152,115,150,110,145,114,248,95,50,185,31,+119,139,150,24,94,177,32,98,19,198,88,112,228,131,7,195,57,33,226,210,+201,29,8,77,104,143,3,31,86,123,192,15,67,22,63,53,114,143,196,10,+92,190,85,150,253,136,182,107,63,34,116,93,7,199,57,27,223,106,195,35,+87,221,140,255,203,206,243,193,156,92,187,49,102,99,83,67,97,169,162,194,+140,238,202,240,49,180,249,97,245,234,215,224,250,114,119,163,178,163,238,51,+198,167,30,42,187,194,250,249,43,192,17,107,202,0,47,2,6,12,177,215,+187,89,6,157,144,255,20,113,135,151,240,36,77,160,251,115,44,227,188,105,+9,228,191,252,130,132,249,227,245,90,95,154,19,132,196,175,206,14,14,248,+135,7,240,204,146,50,252,92,187,176,144,37,172,101,246,225,69,117,16,225,+153,109,81,121,110,136,161,215,219,199,84,252,79,195,30,76,175,53,248,200,+58,8,0,220,241,166,165,67,216,80,215,72,93,18,232,58,9,14,183,9,+74,25,172,173,54,22,239,154,230,82,220,202,247,193,114,64,169,236,186,78,+233,123,105,15,22,214,52,79,8,56,101,152,43,75,191,2,14,14,184,215,+123,99,57,92,160,210,90,59,195,202,230,158,54,176,34,212,108,103,212,55,+84,46,225,241,16,163,91,120,239,138,61,125,5,210,254,251,6,107,112,220,+146,104,124,226,153,77,131,248,50,230,120,123,155,78,162,34,169,108,58,103,+60,112,242,176,122,253,74,145,245,107,194,231,57,205,137,140,84,143,10,40,+206,94,38,30,210,101,2,194,182,100,50,93,98,141,135,97,254,56,188,66,+248,210,45,146,118,14,1,197,7,93,91,133,248,73,139,190,68,147,176,88,+79,142,136,105,84,191,174,23,245,200,153,114,133,253,92,164,16,104,106,108,+144,109,69,76,96,44,76,164,58,202,20,68,21,3,193,85,112,16,154,20,+224,105,207,102,231,71,134,231,144,155,9,6,229,206,49,208,130,172,135,155,+254,253,42,10,217,193,68,83,193,210,183,34,3,236,233,103,61,182,171,28,+185,17,55,96,188,229,24,115,44,129,173,181,145,3,13,124,232,206,170,223,+251,21,248,52,228,116,28,219,98,85,6,49,115,147,124,165,255,116,209,244,+22,108,16,172,121,210,91,61,75,238,93,157,1,24,118,133,2,98,29,92,+159,209,133,144,146,44,179,193,47,90,87,203,246,197,207,152,217,211,65,129,+251,90,170,120,163,224,29,81,85,116,161,185,170,31,127,179,35,115,97,123,+183,110,181,74,32,82,78,104,99,61,255,214,179,114,154,39,67,247,225,69,+252,60,24,115,165,196,31,149,94,45,242,25,156,7,35,156,48,226,217,164,+116,67,187,41,17,214,26,90,84,174,62,238,57,52,203,148,218,227,120,27,+127,229,199,101,136,112,160,246,213,220,221,22,203,226,131,207,190,54,80,89,+12,215,171,15,225,223,152,31,39,175,254,35,136,243,49,9,218,62,26,153,+34,131,204,60,208,120,238,214,239,72,102,52,159,70,62,115,248,103,120,54,+163,121,223,26,251,29,19,148,69,152,86,104,54,54,72,135,233,76,248,12,+157,106,151,170,118,54,42,140,220,254,214,165,22,53,17,11,137,156,245,145,+68,35,141,135,150,217,101,27,173,70,84,98,221,167,123,1,2,131,235,199,+70,156,146,201,170,28,213,97,14,144,219,70,21,21,238,123,100,159,178,129,+97,244,171,239,149,127,237,93,37,19,222,69,102,83,147,174,99,128,32,150,+107,125,126,212,31,44,174,72,253,50,8,33,77,248,201,202,3,248,26,154,+76,177,0,235,39,38,250,200,227,91,201,43,29,198,156,101,200,159,106,91,+80,152,96,102,25,85,196,182,109,140,254,211,19,60,60,183,237,89,230,23,+253,62,240,147,29,171,8,100,182,98,22,164,223,205,203,18,33,247,192,165,+102,77,103,170,161,60,159,203,221,222,130,169,195,13,67,88,184,122,9,247,+203,193,28,211,125,112,238,221,75,86,70,253,250,171,203,148,181,137,100,55,+24,4,247,109,226,148,193,148,229,104,22,30,29,153,192,177,207,223,170,149,+198,92,11,37,173,44,60,211,210,176,199,136,61,242,190,126,85,100,27,183,+16,252,7,102,86,47,227,71,239,56,91,216,88,206,25,29,167,195,15,228,+49,229,222,149,16,128,32,200,40,5,7,251,152,17,233,15,55,235,231,17,+104,175,253,140,42,229,190,162,70,35,224,35,126,152,192,126,196,99,24,136,+205,201,100,105,143,249,18,211,11,119,190,99,84,28,67,96,153,246,36,62,+151,103,229,129,7,130,217,97,18,139,96,103,69,16,220,155,62,102,124,45,+191,117,34,10,209,30,196,245,73,71,111,7,48,219,30,175,173,31,81,68,+11,115,22,58,69,54,251,220,234,98,80,172,29,54,53,30,216,190,73,255,+116,189,142,107,130,205,115,120,14,183,187,211,147,144,11,100,35,209,252,114,+194,52,18,220,189,107,45,107,67,13,169,128,28,247,3,228,30,118,209,112,+65,196,154,31,178,135,39,162,57,87,17,33,6,72,214,212,98,52,106,87,+42,205,61,251,27,168,79,92,33,59,160,72,50,203,161,115,53,199,159,200,+239,70,19,37,180,72,159,250,163,7,24,232,141,139,142,15,130,71,206,183,+74,56,143,43,99,166,188,246,179,148,237,228,40,211,68,198,57,190,89,85,+16,7,179,70,165,241,236,20,158,228,255,92,178,220,87,74,31,13,168,63,+38,51,175,5,176,142,201,147,206,223,54,72,109,3,120,191,73,127,106,110,+35,69,25,37,158,119,73,239,113,130,141,47,56,242,149,188,69,219,36,17,+27,167,237,155,65,10,182,243,94,234,51,172,163,194,190,106,245,166,120,160,+3,126,213,247,180,29,177,26,218,160,175,152,162,85,43,124,180,56,140,32,+82,52,119,124,93,3,196,250,165,163,203,53,20,176,245,88,33,131,197,86,+57,12,249,188,109,46,55,109,197,153,11,235,210,118,113,113,228,150,166,216,+42,75,131,168,242,196,108,78,59,82,236,110,22,31,137,81,174,19,169,88,+3,111,91,152,208,153,171,87,128,182,101,1,83,213,32,26,199,202,34,70,+141,87,196,155,220,222,243,144,152,113,50,177,77,230,190,43,236,108,135,88,+228,254,155,242,207,192,130,154,214,88,103,18,156,204,202,126,112,236,79,219,+235,10,38,51,76,138,170,53,84,152,141,90,177,148,76,41,82,55,130,164,+245,185,203,157,200,220,182,155,23,143,242,231,137,64,33,55,74,105,15,13,+181,183,89,79,111,212,175,216,243,117,126,11,29,202,135,156,194,106,244,251,+63,169,93,254,138,240,186,150,23,250,201,215,195,196,234,67,204,18,24,51,+92,67,59,249,103,140,125,112,204,80,184,214,213,194,186,205,248,185,221,175,+151,93,92,222,138,125,34,16,90,240,135,20,238,76,37,50,197,237,154,198,+32,232,62,168,204,196,118,95,104,49,29,139,186,151,25,130,34,65,244,44,+31,152,175,33,208,46,12,71,14,12,191,60,234,103,54,121,157,78,165,26,+78,9,23,161,169,41,141,122,37,206,18,86,182,185,32,128,228,199,106,145,+16,195,101,233,108,19,218,10,17,220,136,199,56,121,52,29,117,150,93,7,+147,144,225,253,187,241,68,53,212,189,122,61,155,18,65,92,21,4,230,94,+138,117,252,96,48,242,32,5,201,68,229,154,176,248,6,191,13,182,215,64,+61,186,142,212,16,248,153,199,15,186,69,189,47,151,182,70,102,176,112,64,+135,182,195,184,223,113,136,56,184,247,78,240,225,185,208,179,66,204,98,126,+177,21,45,23,52,2,159,222,41,41,27,240,60,39,239,14,8,145,25,200,+136,86,127,53,171,77,33,198,102,70,232,177,211,169,63,47,246,35,238,231,+155,3,250,244,7,102,84,148,252,13,79,249,147,3,81,178,148,171,96,197,+210,185,211,132,251,28,64,243,237,125,242,17,13,99,78,76,85,42,246,14,+24,232,7,192,205,228,31,17,102,47,160,74,186,82,84,134,159,103,82,74,+121,249,196,168,193,224,16,214,75,159,48,112,211,7,101,82,172,184,227,218,+99,210,212,248,184,161,215,81,55,120,223,74,136,210,209,121,114,15,19,11,+105,75,250,231,42,65,104,134,195,227,116,90,130,76,166,127,117,122,69,255,+114,83,183,17,170,156,235,57,201,173,46,38,169,107,20,166,188,228,241,228,+19,94,194,61,149,163,88,66,118,210,207,171,172,57,41,223,151,187,201,18,+176,54,226,58,176,21,145,15,178,0,66,26,189,39,144,115,37,62,177,85,+210,208,84,231,84,220,29,142,11,94,180,24,185,226,190,22,86,20,45,155,+124,32,138,90,204,80,104,29,19,38,122,50,123,116,0,124,166,77,19,236,+135,43,79,182,20,229,153,132,5,30,215,114,224,26,54,5,151,120,69,200,+219,13,3,235,216,170,31,250,134,31,165,10,217,96,139,77,31,33,247,228,+175,165,255,206,135,231,98,247,226,83,214,72,67,68,155,69,21,233,150,49,+76,161,199,54,202,140,10,142,87,42,232,89,104,143,74,1,223,237,141,114,+33,129,32,1,232,162,249,239,106,50,204,128,152,154,55,79,193,36,254,102,+194,94,36,111,9,65,134,80,234,149,72,192,95,74,197,5,72,73,109,242,+56,212,218,236,129,139,214,253,125,246,219,71,114,11,53,23,186,192,104,211,+14,201,68,245,169,119,97,214,254,91,8,194,181,4,56,186,23,84,23,185,+227,211,126,143,101,103,41,122,208,172,132,208,203,79,140,50,202,211,229,244,+18,235,131,17,88,70,2,231,95,215,34,30,160,197,129,159,220,53,5,11,+176,196,166,186,94,203,191,145,89,99,65,169,163,143,213,211,37,81,78,250,+5,189,170,174,116,136,96,132,89,77,24,37,118,164,153,168,136,83,38,84,+243,177,202,10,102,144,218,240,167,61,213,42,75,170,61,46,238,227,57,228,+148,253,227,162,54,213,118,122,175,113,153,50,246,255,72,124,102,44,40,125,+151,194,192,228,250,109,21,183,231,159,105,251,198,133,65,217,79,24,93,46,+189,91,103,12,235,0,145,113,36,16,244,78,44,212,139,92,223,63,236,8,+161,223,38,77,170,91,74,112,203,77,180,250,3,227,91,159,78,57,110,23,+113,12,231,37,148,15,133,184,152,2,234,245,101,221,153,107,202,21,70,4,+179,142,83,20,153,125,97,17,153,19,205,136,40,138,180,6,187,53,76,3,+60,79,214,185,60,90,181,35,47,97,81,138,213,53,81,56,164,229,79,38,+189,191,224,13,156,137,117,145,117,138,90,173,220,42,112,237,7,3,77,44,+81,61,73,202,9,176,69,101,89,144,153,165,224,92,137,214,217,45,16,153,+30,227,103,178,26,105,199,59,214,5,39,42,18,212,122,214,198,29,65,60,+223,21,45,149,239,199,8,173,42,40,82,43,228,50,210,32,127,148,38,196,+176,9,71,89,64,103,91,140,160,55,140,193,63,179,28,173,174,87,244,227,+127,41,166,122,244,185,89,196,155,8,244,22,64,206,186,181,56,163,228,24,+230,21,89,61,17,46,57,56,164,228,9,115,180,138,63,163,199,205,83,229,+183,59,95,18,162,14,236,208,18,196,121,117,146,225,105,44,69,105,186,118,+123,59,180,171,202,10,18,176,69,195,134,113,169,199,240,108,4,54,152,83,+165,173,43,200,237,240,119,21,204,70,161,13,239,217,190,140,124,212,188,38,+95,17,244,249,176,237,83,11,96,134,75,155,234,134,109,81,249,247,213,195,+162,240,184,22,62,42,209,248,162,84,101,56,203,29,73,168,31,110,99,202,+30,74,200,180,192,233,179,133,50,198,185,196,81,184,163,170,74,124,97,34,+210,76,17,198,26,155,92,172,165,223,118,141,128,166,102,103,113,222,241,135,+88,0,149,23,85,125,95,66,197,22,178,45,209,65,249,196,140,11,107,2,+139,5,210,216,78,117,199,78,245,13,237,244,167,32,118,115,5,33,50,216,+218,167,187,152,229,84,231,206,253,210,177,94,113,174,73,103,242,176,55,155,+75,168,117,197,224,168,98,216,252,177,87,72,186,4,35,231,102,84,244,132,+119,80,9,226,219,214,223,163,186,235,28,37,16,1,183,234,248,41,177,163,+253,9,228,212,19,221,37,217,43,92,40,110,195,103,99,77,248,2,136,0,+105,98,250,224,166,74,133,123,42,241,20,77,29,191,208,15,122,127,134,235,+35,237,49,180,97,51,159,104,109,103,168,186,225,133,134,53,33,79,57,36,+127,42,27,127,124,112,20,14,26,120,156,194,168,105,233,46,132,48,68,207,+74,50,36,129,245,200,217,197,177,104,199,149,0,250,211,177,187,71,92,175,+50,208,153,159,60,140,117,232,227,59,0,241,21,14,178,163,208,181,62,214,+188,189,239,98,224,186,111,25,32,191,98,48,10,0,240,195,45,217,38,181,+15,203,248,153,52,211,187,109,119,125,100,24,233,102,24,236,21,115,151,99,+206,107,213,15,180,1,29,177,250,78,15,187,175,120,77,82,208,113,169,80,+56,184,33,113,129,80,132,68,109,177,208,184,236,70,95,98,148,232,28,108,+145,91,184,242,0,145,186,18,56,75,81,182,131,35,94,55,125,239,230,237,+192,156,127,56,29,129,77,176,86,252,54,115,198,51,178,167,158,214,19,57,+179,6,142,245,60,131,32,248,22,249,197,68,208,68,132,185,95,106,144,68,+240,136,72,128,202,248,140,8,128,60,40,76,254,138,136,146,85,168,104,229,+13,178,31,237,240,35,36,48,64,245,17,189,71,61,180,207,217,245,231,208,+216,93,5,54,107,8,141,139,226,141,138,142,221,197,228,15,187,124,69,138,+16,183,106,248,178,4,7,19,122,130,247,212,158,5,42,139,37,195,15,188,+106,83,253,117,69,65,206,2,204,18,32,96,189,145,87,121,40,58,164,182,+32,95,15,148,165,113,241,188,195,203,22,183,195,63,199,16,228,94,8,91,+61,42,170,127,228,19,251,38,59,187,191,172,233,209,162,14,3,188,195,48,+21,230,107,231,87,74,137,223,152,69,196,29,9,67,51,26,78,135,124,46,+130,54,11,112,75,177,82,59,40,227,101,89,228,88,117,150,221,209,227,5,+105,105,173,67,5,175,38,92,146,57,167,119,101,16,130,196,108,201,247,133,+71,14,62,210,69,208,197,111,89,242,98,236,165,83,193,75,201,239,26,160,+235,25,163,126,118,99,130,118,228,172,80,161,244,147,71,207,89,70,178,107,+73,200,59,43,11,187,172,108,186,245,36,117,45,6,121,242,170,107,254,72,+173,125,168,2,117,155,141,66,72,211,40,109,62,223,113,73,166,148,54,189,+203,157,242,144,244,146,32,219,169,195,170,99,148,16,243,185,149,242,182,52,+158,233,190,75,192,88,136,250,248,229,95,26,138,223,174,188,169,17,225,44,+129,165,200,213,229,227,148,209,200,31,165,163,213,27,19,38,249,72,223,199,+192,87,185,66,104,37,81,17,39,41,28,68,78,0,79,102,208,152,135,90,+246,141,125,96,77,245,88,88,74,145,94,89,214,31,108,155,112,106,120,208,+184,194,140,109,105,35,188,15,249,130,109,26,231,166,33,51,171,127,237,196,+52,112,253,116,234,9,94,218,220,230,129,141,95,69,206,135,98,105,82,37,+77,84,199,96,31,167,232,129,32,8,130,61,71,126,239,116,73,195,33,16,+193,199,141,168,251,189,157,245,154,130,214,80,11,141,156,158,248,22,138,164,+144,104,246,199,93,41,103,89,205,128,165,181,110,87,158,163,137,10,210,38,+205,239,187,232,145,79,223,72,26,53,203,156,251,250,193,163,139,136,137,124,+170,238,211,76,74,214,55,3,226,191,6,42,122,247,2,226,238,214,254,155,+46,201,171,74,189,16,212,249,141,202,91,222,253,185,94,196,204,96,113,201,+180,198,1,137,0,200,227,171,243,201,228,242,173,56,18,244,127,200,149,218,+70,149,67,27,172,163,52,245,181,123,116,129,234,156,57,224,242,219,29,191,+225,104,245,27,0,174,175,36,110,103,234,145,10,183,129,180,216,212,21,22,+30,113,246,188,218,117,72,114,231,192,164,11,81,105,177,181,142,210,183,240,+175,24,24,70,41,250,49,124,38,95,164,54,200,19,119,3,134,220,219,224,+234,208,91,129,81,48,31,75,243,147,245,10,156,69,23,109,172,111,142,30,+176,114,217,196,112,34,190,254,179,83,23,186,19,89,251,166,144,188,88,159,+221,100,198,154,76,154,1,241,92,55,231,38,37,204,144,198,235,68,104,63,+174,62,44,143,173,133,30,32,65,194,51,161,122,245,240,224,177,36,196,95,+21,182,232,41,40,227,238,61,235,27,179,80,255,107,26,94,48,211,208,174,+34,237,180,224,224,168,90,19,236,175,145,8,217,145,249,70,71,177,226,51,+89,53,151,137,107,175,66,168,166,170,85,170,120,111,49,153,176,12,221,202,+197,82,153,55,20,13,109,233,113,10,217,135,246,131,52,192,111,214,218,56,+102,88,106,1,80,140,51,159,123,52,169,137,68,140,114,121,192,120,253,243,+44,221,152,174,229,240,82,78,27,217,231,154,82,118,32,63,251,135,86,5,+205,77,122,39,21,4,164,180,250,132,205,207,221,166,35,111,127,249,134,82,+161,8,217,238,216,101,53,239,204,251,18,218,206,229,216,91,18,207,4,191,+246,95,222,24,162,3,86,178,18,210,211,213,45,118,203,199,106,229,117,203,+100,71,17,214,149,216,162,203,115,120,5,238,153,19,181,13,155,112,230,196,+215,11,229,164,74,247,50,37,144,238,66,159,217,98,87,131,229,207,105,224,+142,91,22,170,43,196,115,97,44,224,143,39,99,164,183,106,55,72,63,223,+167,85,103,61,210,164,60,173,131,131,176,209,146,109,237,112,6,242,203,105,+193,241,15,250,250,234,86,122,134,159,103,20,91,245,137,88,163,8,153,193,+242,145,238,43,219,54,128,246,204,173,94,35,210,139,152,82,23,35,64,102,+81,109,174,234,125,28,21,164,42,76,225,252,10,8,114,146,89,141,33,18,+148,79,1,169,202,52,226,219,120,76,70,179,35,27,202,22,212,205,94,160,+56,126,32,89,77,135,182,155,9,118,119,242,48,185,107,118,182,88,209,97,+29,249,39,92,36,247,51,9,97,133,141,183,77,16,178,62,15,202,245,130,+45,89,139,60,57,228,15,146,200,5,174,158,169,84,118,254,175,252,207,241,+89,242,164,32,40,18,4,254,94,7,94,18,16,158,205,187,100,224,254,59,+48,199,128,36,231,228,51,117,216,180,90,98,46,103,212,1,131,76,81,248,+123,117,197,168,204,213,86,65,116,121,33,6,251,31,47,23,69,183,250,64,+89,141,224,73,193,129,125,71,250,128,19,249,84,87,23,146,87,214,241,108,+151,115,69,240,197,141,254,184,183,88,45,61,179,176,36,127,109,148,155,148,+52,185,21,15,0,139,83,181,18,147,159,244,156,124,148,213,158,78,220,173,+176,87,201,219,105,36,225,133,90,166,154,217,47,42,240,58,144,243,240,181,+111,122,51,19,176,198,56,180,181,84,180,1,246,86,30,173,79,30,245,202,+247,178,193,235,100,111,71,228,55,149,206,103,58,84,201,147,136,38,18,7,+114,19,12,5,74,65,239,162,213,37,246,85,123,31,32,76,182,198,167,124,+57,169,86,17,120,124,145,36,207,144,92,234,150,68,38,204,200,95,57,86,+198,147,254,0,97,15,247,185,210,123,151,170,28,168,39,74,100,210,212,255,+207,103,87,67,127,57,236,105,44,74,228,188,231,168,155,4,108,113,132,236,+169,122,182,28,102,42,243,184,188,216,230,212,242,14,197,184,218,191,9,29,+61,182,3,165,154,43,92,196,184,135,46,171,197,162,115,90,165,208,7,192,+247,206,27,172,185,121,4,11,170,104,120,96,239,147,184,93,198,214,224,33,+241,221,12,64,173,155,67,159,99,16,213,35,241,136,201,172,88,26,193,248,+52,33,229,187,75,21,107,7,246,179,167,105,17,22,63,86,182,23,7,83,+242,195,27,21,209,78,19,42,248,185,240,243,213,2,196,126,148,133,202,174,+1,46,93,28,18,210,241,128,94,100,171,105,220,231,147,83,122,67,9,82,+92,93,124,212,44,90,98,97,81,200,24,215,236,107,14,236,17,220,41,64,+30,78,40,43,48,217,198,176,249,240,34,223,244,101,255,208,78,104,25,215,+152,143,133,242,44,110,226,152,140,2,201,130,86,114,13,144,122,205,191,56,+192,152,93,19,128,162,191,120,178,199,42,145,44,223,100,79,26,31,221,148,+169,231,15,161,33,160,199,32,97,41,98,255,254,192,72,133,245,175,239,77,+88,192,62,71,21,163,252,74,49,1,81,106,37,35,179,49,241,13,102,209,+196,197,33,181,252,209,226,114,109,61,86,218,229,14,239,102,180,150,194,89,+60,12,13,72,219,152,198,25,11,227,171,190,255,147,52,102,57,143,38,255,+207,70,150,161,70,87,60,118,139,134,63,83,249,172,100,222,74,77,129,21,+22,88,180,96,183,204,210,66,17,180,236,45,129,194,103,227,242,233,38,226,+206,219,107,165,32,194,52,111,2,191,237,167,117,81,135,129,154,34,94,24,+201,37,28,189,115,82,238,197,145,35,100,83,101,83,133,116,123,229,186,151,+234,154,76,83,60,238,231,144,139,78,24,124,154,107,225,89,48,48,113,149,+177,174,139,182,125,26,160,129,137,18,114,52,100,106,43,197,180,80,212,114,+97,141,17,119,31,168,96,81,34,30,126,167,242,40,99,139,249,93,66,72,+21,111,226,221,44,52,34,81,171,95,6,100,40,234,153,198,106,143,216,71,+96,235,202,10,253,251,204,174,240,176,5,35,208,97,148,35,138,71,27,71,+67,191,224,31,213,142,67,191,185,121,210,65,203,64,126,237,154,118,24,100,+164,86,91,221,6,42,79,4,10,110,237,78,184,76,157,31,94,227,249,50,+76,84,33,100,65,223,184,213,234,167,120,99,158,252,87,253,230,216,41,21,+248,132,194,254,25,204,106,170,81,191,22,212,109,71,124,84,155,186,21,44,+110,52,183,209,181,14,116,8,166,4,156,109,107,234,146,132,233,47,158,81,+22,214,122,221,22,21,178,87,15,101,90,185,127,32,171,28,4,68,106,61,+123,105,145,135,52,199,11,228,142,39,144,132,101,189,45,44,115,91,206,156,+86,208,150,249,137,237,154,121,30,84,245,70,12,111,115,236,57,223,227,202,+239,70,62,131,80,6,188,42,20,237,78,236,6,76,176,73,69,102,85,44,+168,39,36,49,133,215,75,136,106,81,38,205,174,219,108,196,109,151,242,181,+111,59,35,194,141,3,128,172,215,149,199,199,170,81,96,29,75,253,213,19,+134,189,195,68,229,9,248,207,12,66,177,226,218,213,87,7,53,88,158,63,+124,64,69,164,70,24,167,24,85,112,39,109,218,84,70,162,242,5,11,231,+67,110,67,99,76,233,255,236,234,222,66,140,71,6,112,210,125,198,64,136,+6,194,16,95,4,204,92,95,155,196,235,201,32,127,213,241,83,248,102,126,+133,249,72,183,237,198,78,24,131,156,4,75,80,27,110,32,118,143,200,206,+110,227,162,220,43,142,120,176,222,122,221,251,131,90,27,123,34,72,147,160,+210,196,168,170,35,23,61,12,85,250,224,106,123,32,155,194,59,90,57,174,+220,136,211,93,75,85,171,156,77,189,50,56,208,109,146,149,28,141,157,124,+253,55,219,122,152,212,235,198,75,23,221,147,40,66,93,73,98,99,252,40,+69,206,24,183,80,1,64,140,17,104,238,181,228,151,157,18,219,90,234,79,+203,192,76,154,109,130,159,199,129,98,199,92,160,194,19,246,237,158,3,241,+250,28,14,1,79,104,7,9,91,80,78,174,192,132,29,249,44,107,165,213,+180,99,55,214,102,79,26,231,103,223,55,94,107,34,74,3,27,149,55,60,+66,25,151,92,89,121,174,193,3,92,169,19,226,157,133,108,116,21,41,68,+28,16,168,167,192,60,25,176,93,92,96,201,138,65,123,160,137,220,139,108,+130,78,110,69,109,251,148,229,248,85,15,115,15,242,155,121,208,46,131,101,+98,51,193,55,62,124,155,197,97,20,30,168,251,188,111,242,129,88,223,191,+39,167,113,21,91,31,149,88,204,232,134,251,82,44,234,252,29,102,254,248,+17,198,222,110,251,190,144,177,202,126,116,71,209,108,95,98,211,180,17,151,+210,142,79,103,202,113,204,242,53,154,210,205,91,36,255,242,6,245,132,214,+182,132,12,109,206,237,38,199,181,114,188,66,77,206,133,220,180,217,34,113,+209,181,171,41,77,22,170,221,95,189,201,61,83,252,166,135,24,21,89,38,+22,3,159,188,148,146,227,190,93,70,18,56,203,170,253,91,238,235,239,183,+99,44,252,72,90,232,106,165,153,143,205,60,224,216,252,253,56,251,217,96,+18,125,98,150,185,2,222,16,190,205,185,102,215,223,150,102,223,242,193,214,+27,93,165,68,214,215,162,236,176,27,115,41,73,134,183,150,92,188,179,26,+66,11,109,36,187,197,38,198,234,251,192,90,110,228,253,100,21,23,130,89,+254,234,114,105,206,208,178,155,170,226,111,53,8,166,108,77,38,203,34,122,+3,44,226,34,167,247,202,201,169,190,102,41,139,41,109,135,120,27,173,213,+110,52,123,103,240,219,48,65,229,155,132,32,171,98,231,31,2,202,81,233,+214,180,14,93,205,11,242,244,141,24,143,66,206,105,234,41,216,226,88,132,+31,175,61,171,63,175,146,77,51,140,107,21,98,247,131,137,194,182,28,29,+226,177,151,235,97,224,110,33,27,219,138,191,245,29,79,71,187,228,239,163,+182,158,105,252,131,63,159,71,106,107,189,34,1,144,80,226,211,254,125,145,+16,235,147,250,26,77,116,207,212,18,66,163,37,126,143,3,115,91,119,32,+157,192,16,231,53,234,92,216,65,115,255,101,188,224,44,80,233,64,208,196,+236,17,174,138,149,172,246,52,58,142,225,98,49,243,12,132,51,109,224,62,+24,114,65,214,87,236,193,126,235,48,30,51,158,192,56,14,211,180,149,194,+188,86,223,193,19,94,124,124,156,142,145,43,181,156,232,143,109,124,242,65,+65,178,208,255,110,65,95,5,214,166,43,127,74,189,80,252,116,63,81,215,+103,18,73,77,142,71,42,38,171,206,67,46,209,156,7,158,171,12,143,35,+245,15,53,76,184,67,240,242,52,4,250,199,10,123,167,255,149,185,232,222,+22,244,39,28,109,133,19,186,221,191,77,46,130,189,220,16,156,19,110,146,+166,152,178,21,92,187,32,66,254,186,206,96,162,174,177,218,25,85,158,212,+200,89,232,141,217,20,17,231,117,110,98,73,207,43,95,227,52,114,40,195,+92,57,192,113,92,31,107,175,184,228,90,253,171,151,144,78,111,240,109,23,+97,76,228,52,31,223,25,112,54,115,213,8,78,184,88,191,87,240,84,132,+240,246,5,176,212,217,189,242,24,175,22,202,177,150,168,219,113,195,42,91,+37,133,159,244,157,185,118,104,168,145,183,119,4,65,70,177,207,53,97,136,+158,80,241,96,55,184,3,122,235,228,200,222,190,167,77,136,43,90,248,233,+37,75,20,172,5,18,177,35,74,7,234,121,209,110,134,171,153,81,12,6,+148,82,62,119,72,232,170,229,136,114,192,42,172,244,87,124,238,94,177,217,+64,220,248,72,126,93,42,50,160,37,202,242,169,85,209,180,228,154,58,129,+80,193,130,10,48,147,133,42,210,193,122,21,101,73,9,140,116,235,32,245,+25,70,53,237,224,109,16,114,207,156,198,251,252,88,127,161,174,81,111,104,+102,214,207,206,23,174,79,38,17,192,112,66,73,32,18,103,233,129,130,28,+79,232,100,200,62,79,172,222,8,226,73,17,205,3,200,243,12,113,185,3,+155,110,111,79,28,97,220,154,146,75,31,179,241,40,239,251,150,113,109,131,+75,204,183,252,27,186,79,230,109,138,17,62,187,38,176,107,18,2,95,178,+108,153,144,78,150,165,239,176,118,225,181,255,215,244,87,146,38,179,197,204,+219,1,253,67,99,139,85,251,63,14,114,37,40,164,67,213,25,226,97,92,+147,65,67,121,244,13,220,42,176,131,243,89,39,3,147,219,112,249,211,76,+148,67,119,213,237,125,154,1,131,158,170,206,46,146,217,138,36,231,47,217,+243,54,151,56,15,230,136,151,60,104,121,241,215,2,31,188,192,51,169,210,+83,26,77,85,216,64,15,220,236,79,180,127,155,63,133,133,230,93,151,34,+240,5,154,47,213,171,44,88,234,169,88,159,94,54,227,162,187,59,119,16,+179,208,201,215,144,235,59,209,83,240,40,75,108,39,207,82,159,211,131,175,+171,114,212,25,7,18,100,18,180,250,4,106,111,244,172,12,248,253,119,206,+158,38,159,141,215,48,238,187,111,92,232,16,92,55,46,89,234,74,188,201,+76,239,14,115,58,31,143,115,197,41,29,4,92,27,177,103,230,153,148,240,+96,17,114,184,25,55,175,88,72,6,250,144,102,219,191,76,15,118,42,147,+103,62,164,20,72,45,106,110,109,42,193,10,85,32,195,29,134,243,75,166,+170,100,190,100,149,230,56,51,217,21,39,98,114,17,86,128,109,29,183,194,+227,242,0,78,84,46,94,87,95,58,147,112,23,78,27,198,208,38,121,117,+208,66,210,82,32,54,225,91,138,71,140,34,182,31,56,97,184,114,13,226,+114,254,83,115,91,135,132,173,208,34,195,176,210,245,184,129,55,147,226,60,+144,245,48,90,155,243,60,60,163,27,127,64,254,129,39,28,11,154,66,127,+64,0,152,187,230,99,63,61,113,175,153,132,124,25,80,33,57,169,67,150,+167,119,169,233,98,118,183,144,243,11,132,27,192,64,165,187,97,63,85,185,+141,170,15,9,102,221,200,58,20,255,44,22,110,7,166,12,206,179,120,73,+8,249,165,175,175,36,211,97,144,15,212,85,248,183,23,145,27,37,247,118,+50,185,112,185,230,168,179,110,172,248,27,177,172,167,70,119,85,84,152,142,+156,35,110,48,229,60,80,181,85,218,95,115,178,201,45,231,199,54,41,154,+13,102,161,142,2,91,80,141,235,77,39,4,141,60,246,177,69,49,29,146,+53,94,28,204,188,231,50,249,239,139,74,101,46,9,96,140,152,231,208,164,+226,253,52,248,151,58,32,249,209,9,183,127,202,168,17,169,64,105,249,103,+214,48,84,76,255,62,94,98,79,242,122,97,218,54,41,98,169,201,3,173,+70,71,69,203,199,250,60,65,4,209,112,25,18,100,174,181,40,190,68,52,+119,252,30,132,157,210,40,66,149,194,254,225,92,210,176,120,154,208,192,230,+24,220,204,105,59,200,212,42,5,149,226,14,235,120,3,141,118,4,70,129,+205,172,131,145,164,99,111,232,52,203,236,87,85,98,130,13,152,49,175,6,+162,57,0,99,183,9,189,253,21,15,171,175,55,209,254,90,202,219,135,157,+113,106,63,24,158,60,4,177,238,158,209,178,58,90,62,145,147,46,73,207,+114,210,139,173,228,181,170,197,62,83,113,180,89,51,185,200,21,161,191,193,+161,69,88,72,138,119,93,206,167,159,170,9,58,68,237,166,156,208,106,44,+179,47,34,39,40,81,243,221,188,153,236,203,197,58,79,255,246,55,219,162,+44,88,213,22,11,32,246,213,130,68,247,82,11,147,102,167,69,98,64,181,+28,0,5,81,242,239,93,110,108,243,162,96,10,85,234,109,93,80,90,21,+213,208,99,230,239,113,34,179,41,15,180,12,31,113,65,232,3,243,74,35,+227,113,76,102,12,86,129,89,144,86,228,164,7,147,31,185,238,136,187,189,+228,207,42,10,60,124,211,0,87,33,251,22,80,204,91,252,73,153,26,156,+162,187,196,150,143,161,4,152,126,60,206,9,189,31,59,247,84,39,111,196,+160,164,173,119,46,246,29,99,188,245,201,151,222,248,7,249,79,130,189,202,+127,67,140,234,111,126,231,136,148,92,174,247,142,244,183,242,195,92,102,78,+201,182,151,56,70,125,87,75,91,252,157,85,222,14,72,254,127,69,237,97,+74,137,174,5,187,236,70,203,230,255,211,124,177,107,50,227,25,6,255,201,+229,125,208,63,48,30,127,10,240,7,155,46,230,173,123,253,186,133,166,243,+130,155,120,248,58,212,227,186,234,231,8,238,64,189,78,194,16,209,89,78,+242,58,144,116,104,173,106,210,46,231,10,84,57,72,200,144,245,86,57,162,+132,10,155,6,93,41,56,180,89,140,37,127,96,32,181,148,215,117,249,29,+5,103,49,63,220,42,48,53,138,56,101,48,206,37,254,169,66,0,201,149,+11,248,119,112,50,15,88,152,131,134,151,3,89,236,65,211,204,147,118,224,+27,78,179,34,248,145,32,241,241,239,198,19,1,235,130,238,148,143,94,149,+148,102,71,171,56,32,160,211,79,174,145,160,249,154,11,140,65,22,233,199,+17,210,128,8,203,17,103,163,223,162,233,55,233,188,0,37,88,100,253,234,+71,183,164,160,86,67,52,208,121,252,19,244,102,3,42,116,4,6,188,193,+204,189,145,150,143,63,87,226,214,109,247,168,253,232,90,187,250,40,141,78,+101,87,71,41,37,66,84,213,38,107,140,199,252,216,147,136,84,9,122,253,+136,200,49,98,133,52,8,162,44,30,138,242,94,166,193,213,7,136,54,212,+14,103,230,45,79,54,200,184,193,23,106,188,42,131,166,85,252,43,156,232,+114,126,227,57,171,158,188,250,134,214,166,11,185,230,110,17,91,164,67,49,+245,160,232,21,74,225,64,29,6,11,179,101,52,62,78,201,55,58,146,170,+226,9,171,58,190,107,219,144,176,180,44,92,7,118,187,140,86,248,59,100,+55,59,125,182,141,111,165,233,242,249,190,42,183,137,176,75,230,189,11,87,+9,65,116,93,7,98,150,5,50,250,195,184,190,214,22,9,20,242,105,162,+228,110,255,190,52,234,207,7,141,116,115,74,215,205,70,75,29,34,246,134,+238,115,125,131,147,40,207,151,151,114,61,206,99,223,244,154,153,108,135,96,+227,216,164,230,254,131,253,200,171,167,71,32,120,38,192,0,71,93,245,99,+4,140,152,188,105,16,227,18,47,148,169,205,2,198,140,63,213,175,224,132,+150,91,100,17,206,95,81,218,29,72,64,188,228,51,164,156,125,160,23,252,+176,157,69,54,146,125,89,228,224,234,228,173,199,149,61,91,220,115,34,199,+191,1,58,82,26,24,55,251,245,227,200,88,72,225,51,198,217,246,194,47,+118,155,229,168,85,57,36,218,6,28,209,104,122,243,240,169,42,184,20,139,+91,190,72,93,205,161,54,25,214,224,58,158,99,7,9,251,46,62,134,137,+222,224,71,218,0,158,51,243,172,123,47,77,193,182,156,180,224,72,138,109,+25,56,204,194,221,44,128,118,252,34,224,106,237,43,145,44,227,245,180,173,+218,10,238,224,63,106,53,161,8,2,3,248,236,132,18,99,195,120,234,111,+144,44,252,191,250,119,76,56,152,204,87,187,1,10,156,244,46,163,254,42,+158,117,175,112,20,135,141,140,180,126,239,125,160,160,209,87,102,44,84,134,+248,21,195,27,228,69,226,239,242,106,24,233,193,140,247,88,238,0,65,244,+190,137,175,79,86,88,77,12,242,226,93,1,96,89,179,114,2,83,195,18,+130,112,12,233,143,199,150,12,224,212,207,67,215,255,101,89,72,197,114,100,+254,99,253,38,238,31,180,54,214,238,196,158,103,177,80,206,41,104,70,152,+204,161,244,160,178,166,56,129,65,114,125,172,195,45,241,249,148,34,165,255,+234,152,44,98,155,153,120,199,160,58,14,230,201,170,168,252,29,23,139,238,+182,67,204,43,150,252,107,243,24,151,236,3,148,229,74,232,88,110,62,184,+168,117,54,175,189,9,216,116,159,0,220,189,220,21,91,133,166,172,153,109,+253,61,199,8,73,99,227,124,216,50,58,187,248,77,252,117,231,204,64,233,+229,210,67,165,70,190,177,128,73,253,4,184,224,14,71,72,176,204,6,62,+248,252,175,239,7,4,63,189,186,113,222,149,57,80,159,78,126,51,161,123,+157,228,194,87,211,52,51,200,164,5,144,156,79,50,123,223,142,112,139,196,+248,228,145,131,229,228,107,61,231,247,191,155,7,13,107,67,4,154,162,245,+18,238,18,116,179,126,82,49,33,163,51,213,229,137,83,117,107,83,15,198,+10,1,213,218,0,110,217,0,42,126,29,228,214,146,58,102,237,247,217,226,+186,19,232,99,151,64,78,115,229,217,201,83,234,118,128,45,182,42,119,33,+169,91,155,175,161,229,135,9,238,219,235,99,6,34,184,6,204,149,57,93,+231,102,154,182,3,29,245,69,247,9,230,176,105,142,218,118,213,205,16,75,+152,243,126,15,217,170,91,201,36,32,72,28,25,5,230,199,89,95,237,244,+123,76,12,255,142,134,29,177,129,141,142,27,10,161,58,7,191,34,208,243,+19,165,247,111,237,206,22,75,120,208,84,215,187,158,160,115,100,159,212,71,+110,228,32,21,207,137,150,216,16,88,86,183,201,153,243,98,138,128,50,143,+46,113,211,57,187,16,46,129,74,118,12,195,234,232,195,12,117,136,171,0,+66,114,206,128,236,46,108,46,115,111,171,167,3,97,63,52,236,166,92,246,+33,107,254,28,116,55,80,59,158,27,252,105,86,19,236,178,0,120,57,30,+6,8,144,40,29,226,198,18,167,142,53,23,21,20,160,36,250,231,147,128,+63,229,115,24,193,6,113,77,195,155,114,111,230,223,192,206,63,190,113,191,+3,66,180,112,230,156,126,78,134,139,48,253,52,37,15,59,147,2,137,200,+64,171,96,177,119,128,188,139,49,27,174,105,196,130,212,255,53,70,183,169,+8,176,106,42,185,126,219,5,171,10,180,96,161,248,161,119,156,230,185,158,+19,220,190,194,212,187,225,248,146,232,174,179,106,81,190,224,223,220,0,237,+38,55,133,181,241,72,167,80,130,253,139,127,155,69,203,197,11,151,133,211,+42,205,33,155,162,214,108,41,184,231,42,137,208,184,221,92,105,218,221,206,+51,235,165,100,165,195,246,160,186,202,26,154,232,231,200,2,17,115,185,128,+232,55,25,255,3,33,201,181,164,145,180,208,97,219,88,100,226,16,171,130,+17,13,175,225,182,3,4,105,88,132,170,255,252,53,114,178,222,117,197,18,+240,213,134,153,229,168,165,12,20,251,79,94,184,144,93,68,58,120,236,188,+213,179,162,248,85,255,191,68,97,215,36,74,78,97,86,198,125,227,72,196,+210,19,95,19,128,195,40,44,104,125,62,60,53,141,78,235,49,46,247,67,+171,40,131,238,160,0,14,186,125,117,47,22,15,111,186,192,130,200,161,156,+210,78,64,244,1,179,96,47,121,123,244,90,146,111,169,174,87,216,90,252,+12,43,41,52,3,62,123,98,54,72,111,68,31,107,62,48,142,162,200,248,+54,178,0,211,96,74,227,218,151,144,235,42,252,43,211,43,200,198,27,239,+199,139,210,59,249,65,11,39,126,134,8,133,60,181,209,227,83,207,202,195,+252,249,247,67,2,202,231,221,141,59,43,121,198,83,15,233,213,171,1,163,+53,97,158,139,209,229,145,155,248,128,132,57,205,71,127,120,19,221,18,42,+224,71,55,204,142,13,212,175,30,59,103,58,26,111,127,251,25,187,10,122,+185,220,55,104,29,79,131,151,84,110,8,158,157,42,63,196,0,4,28,17,+244,233,44,113,158,97,141,183,73,209,149,100,205,63,28,185,134,12,206,204,+85,45,129,3,56,111,4,94,93,68,154,108,167,231,66,68,155,152,194,150,+144,172,71,122,28,214,67,191,11,46,140,63,227,72,158,17,131,211,68,12,+159,244,185,235,47,90,162,104,128,28,176,23,130,212,126,91,186,112,179,211,+231,91,116,106,170,103,150,216,202,210,219,217,137,99,0,179,80,112,46,229,+62,14,14,58,21,220,81,135,50,109,249,7,16,242,244,56,9,202,27,46,+36,166,198,127,10,229,91,110,162,160,176,33,85,235,176,250,15,112,117,68,+208,139,210,164,30,187,233,149,236,27,203,180,15,219,19,130,205,127,68,26,+24,56,122,155,247,241,143,223,213,9,185,122,147,125,47,95,90,176,21,193,+199,193,26,159,19,202,221,42,156,178,77,55,228,70,195,151,195,195,176,203,+91,167,39,238,183,44,136,105,167,247,128,27,148,88,180,28,119,174,223,61,+249,95,238,145,38,180,110,146,194,185,57,97,219,61,156,197,116,245,210,50,+89,3,88,230,106,227,200,39,252,246,150,54,135,48,0,97,247,25,43,253,+231,246,232,140,147,20,188,227,137,78,148,208,109,37,153,49,146,77,140,50,+26,200,173,115,16,172,225,239,55,103,250,103,79,82,104,47,3,28,85,130,+38,64,161,99,161,106,36,0,194,134,150,240,221,152,68,150,30,158,171,44,+83,214,98,133,204,194,64,152,140,152,14,243,1,239,118,211,154,43,3,231,+156,107,233,217,28,61,163,38,46,66,75,110,40,1,178,33,67,107,56,222,+111,155,76,14,98,207,49,112,152,46,99,170,35,173,14,169,53,132,157,115,+92,153,62,126,196,4,31,176,236,148,98,156,153,44,75,255,228,169,218,140,+22,27,78,231,197,184,105,209,60,50,178,228,133,191,32,115,137,98,230,52,+149,107,236,141,214,255,236,51,197,57,204,222,67,83,225,162,221,64,95,102,+8,81,42,166,247,151,163,178,244,185,94,71,3,42,237,210,203,11,156,248,+181,165,127,137,187,0,53,203,220,234,90,138,177,54,162,216,110,231,173,124,+240,148,83,124,94,100,224,86,246,232,67,119,43,244,225,141,220,237,106,60,+59,162,119,146,240,191,252,133,27,171,80,159,236,198,21,205,19,35,121,35,+57,49,175,19,163,217,75,89,90,221,77,198,124,205,191,188,92,235,81,184,+185,195,121,167,112,19,9,2,164,170,109,10,223,18,195,220,10,137,55,143,+127,215,186,60,93,175,198,38,103,64,126,173,61,177,59,165,81,81,181,120,+66,27,247,171,228,110,173,199,55,247,124,231,100,4,189,181,165,212,232,211,+32,36,249,174,115,120,69,20,91,247,23,123,92,106,74,145,28,250,62,120,+3,253,149,23,228,63,91,210,77,90,207,194,135,239,242,48,13,147,125,178,+96,208,38,72,65,236,30,62,47,228,69,223,128,203,108,78,43,246,122,41,+221,157,248,116,26,3,3,85,102,96,38,193,246,2,220,10,204,232,15,235,+243,147,215,53,8,24,247,240,184,181,183,13,243,211,170,188,79,193,15,200,+246,55,107,141,64,170,15,160,157,116,112,230,103,170,38,120,137,247,242,255,+19,112,194,152,31,116,194,86,186,16,206,233,152,42,214,160,23,142,120,5,+240,252,189,83,238,197,19,232,246,72,145,31,178,203,27,77,197,224,143,32,+115,161,158,184,27,245,231,187,133,203,23,21,29,249,150,175,76,157,126,150,+169,53,226,69,65,1,196,59,126,167,36,160,30,173,242,21,115,156,140,226,+99,67,47,154,210,2,234,38,199,130,33,254,92,161,235,147,47,117,24,64,+213,61,93,60,165,121,37,80,106,132,209,200,44,185,193,93,126,120,171,157,+70,241,240,83,122,76,108,156,219,9,72,8,213,144,149,223,157,168,179,73,+34,250,142,248,135,184,34,66,3,172,130,104,146,127,153,57,100,35,208,44,+154,29,80,126,129,52,116,246,138,22,164,181,235,173,198,95,192,193,157,144,+101,76,197,210,251,10,69,208,207,223,233,112,11,96,51,218,45,0,46,219,+210,246,241,59,95,19,88,56,124,140,95,207,135,104,142,75,155,75,97,197,+67,177,30,115,1,1,111,3,207,112,120,143,235,115,66,78,183,82,15,100,+45,99,242,99,253,200,215,39,47,40,231,87,133,14,197,134,195,178,202,140,+119,158,30,137,177,144,34,126,62,193,143,101,85,69,94,94,246,227,227,172,+11,138,110,110,168,104,55,222,113,46,247,164,169,94,235,12,174,3,160,168,+90,40,16,163,244,169,137,250,115,135,210,62,238,191,78,88,184,12,29,28,+82,72,197,190,119,214,24,135,3,202,161,76,61,127,43,220,96,195,201,218,+182,228,112,228,0,201,1,82,87,230,52,41,145,178,230,189,171,168,202,105,+29,23,20,178,159,38,28,65,175,50,46,166,91,177,214,28,64,226,83,159,+107,24,217,210,139,99,15,144,62,157,133,158,133,82,189,211,214,78,142,196,+39,174,165,123,105,201,135,245,61,195,60,128,179,234,232,253,81,16,140,214,+92,204,114,59,9,193,50,169,239,150,19,124,188,151,129,137,102,178,207,81,+26,21,204,232,5,69,211,100,16,173,191,155,120,201,44,211,13,251,79,13,+227,144,203,75,40,85,203,51,78,46,182,186,237,65,8,159,101,124,221,136,+203,20,37,107,164,62,87,34,37,234,209,229,93,9,2,191,175,166,63,85,+132,62,156,217,47,232,64,246,46,49,170,240,202,76,81,29,58,163,251,97,+122,67,255,205,200,73,163,168,224,170,9,181,70,226,249,197,214,115,71,241,+72,53,248,61,247,172,36,215,131,46,155,207,3,188,154,38,233,141,30,244,+71,231,28,111,96,54,251,95,110,165,150,36,213,101,13,13,35,42,184,157,+144,112,3,191,240,211,178,239,215,44,91,179,65,41,84,217,56,151,42,196,+9,24,161,253,251,32,123,110,86,215,27,50,178,58,144,233,83,95,109,244,+84,165,125,174,172,13,130,9,232,241,73,93,128,85,85,161,8,176,153,37,+240,200,238,51,77,153,101,40,65,26,229,11,3,219,195,96,87,237,125,237,+166,115,117,159,71,208,252,244,3,96,120,224,4,87,135,143,245,31,96,79,+85,55,26,99,172,128,151,113,47,211,58,51,113,45,107,202,116,177,109,17,+35,200,165,20,228,42,37,239,251,170,251,223,167,159,235,163,233,204,121,16,+0,124,110,148,10,77,195,96,178,223,203,112,148,213,166,17,201,242,120,217,+165,169,192,191,216,229,57,244,237,212,203,159,114,226,5,223,100,191,15,67,+245,93,162,41,210,132,12,7,166,203,244,215,27,14,47,199,252,219,140,142,+209,254,141,100,94,224,94,100,45,210,61,51,108,208,199,157,135,152,186,48,+92,126,47,40,231,195,85,5,101,10,246,136,218,7,205,177,101,132,62,110,+11,100,129,176,46,90,206,66,61,203,254,110,4,41,50,233,147,86,168,224,+219,239,144,149,205,7,46,113,121,123,99,216,111,7,9,161,194,43,74,159,+179,159,19,106,19,255,122,169,38,237,23,24,178,105,252,101,197,163,165,209,+107,199,6,195,243,6,167,76,182,33,75,36,86,206,249,222,205,116,74,14,+178,75,21,65,107,43,7,26,155,138,145,128,195,218,216,38,178,225,159,141,+159,230,62,24,149,135,124,213,143,134,83,5,187,34,9,111,214,4,237,113,+154,126,187,46,98,33,40,31,207,205,4,253,129,135,32,91,69,144,193,99,+155,213,28,66,248,65,51,134,29,24,2,180,125,102,125,169,148,108,45,203,+14,108,65,213,248,227,144,161,186,108,31,94,252,101,130,65,162,23,144,45,+70,13,87,55,143,242,107,22,227,36,225,224,224,180,180,104,94,196,160,56,+122,50,124,102,125,70,35,152,26,19,228,151,34,1,41,63,40,174,51,51,+30,22,229,10,79,83,69,12,209,57,160,15,64,80,6,2,16,75,144,70,+3,81,138,53,102,139,9,20,5,125,113,74,23,134,93,121,125,18,145,176,+27,104,52,175,229,139,168,84,171,36,129,134,108,78,68,82,194,24,65,41,+80,113,100,208,235,173,142,108,78,206,91,107,55,4,16,129,135,178,158,86,+240,0,139,19,57,117,189,73,69,6,199,177,225,28,59,230,213,138,182,255,+92,45,191,232,40,162,34,104,128,92,213,2,75,42,158,231,80,244,68,151,+220,162,116,26,201,11,151,131,4,45,127,28,177,201,133,198,105,238,67,187,+92,28,182,233,83,113,196,0,154,86,133,55,23,148,88,16,239,200,252,170,+71,65,71,101,154,171,225,59,219,249,152,138,30,144,35,159,249,238,24,4,+173,154,140,127,138,53,222,143,101,238,23,178,192,15,236,61,235,150,207,111,+28,15,231,56,152,252,68,116,22,54,186,37,87,156,167,99,172,234,87,203,+169,203,105,80,154,195,142,156,81,25,130,161,10,199,112,246,82,131,175,46,+246,101,172,144,34,30,51,239,210,115,252,22,92,16,19,179,250,208,213,166,+221,229,11,90,198,94,126,193,85,42,142,102,23,172,248,113,249,4,136,192,+130,13,151,248,174,10,151,242,254,4,84,150,25,105,255,105,17,213,119,73,+211,249,100,198,136,85,183,233,24,217,15,165,142,195,36,193,219,107,102,58,+232,138,85,71,172,237,74,190,127,184,78,114,75,202,110,171,118,135,250,26,+96,144,39,70,36,121,51,110,64,155,235,167,200,14,193,161,244,89,61,37,+196,255,45,239,26,10,41,75,134,62,33,221,100,129,203,245,156,196,116,9,+227,80,216,149,15,208,193,251,201,58,199,167,237,92,135,158,251,207,125,116,+131,77,221,186,117,58,177,180,40,23,45,249,181,128,6,229,94,41,169,162,+123,0,136,83,152,178,115,184,60,145,221,205,31,68,43,164,194,55,31,158,+181,26,184,62,169,17,79,243,54,241,196,136,152,7,184,191,86,242,146,7,+155,145,254,191,226,243,117,220,213,206,213,81,240,163,237,133,101,74,103,189,+18,93,16,136,117,65,30,73,128,95,22,174,25,14,208,92,240,106,241,13,+195,96,223,99,162,167,101,166,82,28,106,127,113,115,28,71,18,84,194,185,+90,172,169,87,40,174,227,166,232,9,190,68,106,131,169,126,159,254,110,241,+95,95,24,108,147,239,108,96,25,159,91,18,226,55,249,250,77,145,52,184,+56,22,201,119,45,137,102,216,123,238,55,91,158,133,216,230,175,115,116,65,+169,4,124,135,46,190,166,203,165,47,135,190,183,244,234,138,93,147,241,106,+46,53,57,208,40,17,254,74,140,251,133,199,98,234,149,195,160,202,228,36,+174,35,111,42,174,118,59,157,197,5,156,19,244,41,19,238,114,71,184,245,+219,182,50,65,159,116,134,224,54,95,135,167,198,38,183,21,248,10,25,109,+57,111,147,37,51,68,145,108,116,54,166,85,245,189,209,193,5,113,196,112,+3,234,39,34,29,160,218,8,29,67,95,132,146,191,106,101,4,44,75,105,+130,210,117,193,46,215,194,62,14,3,207,248,84,39,231,217,104,169,53,162,+210,15,198,194,10,161,84,57,11,225,245,60,167,88,161,116,155,223,4,2,+81,196,230,12,210,217,88,220,111,13,238,236,64,137,18,221,14,177,155,248,+48,103,211,129,246,102,180,133,150,157,253,160,224,68,130,127,18,253,143,43,+51,64,111,64,141,81,225,77,70,37,101,128,199,51,39,211,143,191,191,4,+214,154,162,229,232,159,94,230,54,169,255,221,217,234,101,8,92,245,148,55,+219,237,66,97,150,146,144,145,159,236,210,234,215,152,224,169,79,181,37,183,+126,241,193,151,33,149,238,234,112,108,171,127,32,56,35,118,240,109,223,23,+13,243,20,223,31,192,129,230,20,253,237,28,36,19,92,116,110,201,137,126,+166,221,232,239,31,240,206,202,37,173,8,192,23,166,68,8,105,43,32,53,+149,242,224,102,96,204,200,54,40,185,165,70,97,241,92,153,146,63,159,56,+129,9,137,240,132,16,234,181,229,241,18,207,27,23,19,217,161,200,21,231,+225,19,52,143,43,91,178,100,249,120,85,100,64,143,9,119,58,215,213,210,+230,236,176,94,139,236,221,110,129,212,91,158,234,248,121,164,76,167,208,49,+57,68,47,4,122,124,39,72,170,128,16,214,196,246,44,75,193,28,92,242,+170,133,36,221,116,81,148,158,203,72,226,108,183,18,208,205,210,228,168,56,+188,134,154,228,201,87,151,220,45,169,168,180,40,77,17,38,62,238,212,36,+95,73,175,253,26,84,78,238,138,233,71,199,135,217,95,248,7,218,24,222,+117,136,121,38,253,43,178,232,9,30,127,73,99,149,29,104,7,24,235,224,+65,40,83,201,236,66,246,248,213,56,220,86,42,26,72,135,44,220,174,244,+125,214,125,90,235,19,59,38,190,83,61,174,210,68,27,12,238,66,243,147,+122,17,175,199,157,117,79,179,142,54,43,205,20,56,17,126,84,101,172,196,+18,213,6,189,136,153,54,231,98,46,123,57,94,125,193,236,232,122,230,248,+105,249,231,25,124,34,194,120,168,168,83,1,131,138,153,48,91,142,165,100,+36,159,51,87,8,199,60,119,128,114,234,194,61,42,232,49,92,248,20,143,+91,179,98,89,64,212,112,239,227,131,18,94,205,66,159,190,205,128,16,35,+56,189,34,2,81,178,8,108,29,52,131,200,241,95,120,58,145,26,89,6,+212,204,117,177,210,59,218,33,22,70,178,52,50,4,91,135,174,175,231,29,+181,98,59,13,244,94,200,35,64,97,13,252,117,170,196,84,250,194,198,129,+106,80,236,249,12,13,200,24,107,203,227,191,207,223,242,110,234,224,135,60,+37,78,246,165,192,167,217,120,33,196,79,195,104,72,41,2,228,69,100,88,+79,50,120,82,211,123,26,216,75,137,88,61,3,9,138,160,138,168,222,121,+181,131,167,237,113,236,69,40,56,135,33,7,160,81,117,16,216,202,158,62,+27,30,4,189,83,68,99,16,31,53,139,105,108,33,101,23,186,223,199,38,+123,222,122,138,107,98,153,203,148,223,91,94,252,22,157,84,97,15,24,231,+128,108,241,216,226,163,68,31,142,81,138,250,72,6,115,44,91,237,42,229,+40,33,55,50,14,179,182,53,142,12,200,23,233,103,241,56,37,26,167,6,+151,157,32,113,109,104,42,220,96,167,221,104,199,237,40,30,94,118,120,230,+138,215,85,64,87,179,79,176,188,224,112,236,136,133,16,172,140,147,16,182,+208,248,132,242,28,194,126,214,71,16,187,194,14,56,106,100,111,203,180,238,+77,126,141,24,107,141,209,249,138,30,212,165,170,224,127,217,123,183,139,246,+138,243,124,46,14,121,48,77,27,9,238,114,141,77,174,225,250,206,230,75,+7,101,56,114,124,140,148,5,68,96,218,31,110,175,16,29,227,201,217,167,+231,148,123,188,236,44,201,147,151,246,61,28,100,110,124,140,60,141,0,240,+79,162,209,65,153,254,231,32,141,199,253,16,253,219,224,208,141,219,96,106,+95,254,148,98,151,163,118,153,2,85,43,37,225,243,127,171,187,156,126,228,+229,51,37,103,116,48,124,64,69,255,30,154,209,119,82,37,117,241,36,68,+78,127,177,246,71,212,206,207,169,198,77,191,0,45,223,85,107,69,29,63,+96,88,27,248,194,3,69,106,192,17,66,54,121,168,35,229,19,201,22,156,+85,147,94,105,123,186,54,28,37,37,3,204,232,168,51,222,106,124,240,255,+75,96,204,63,62,131,3,103,166,147,6,167,19,228,173,4,54,78,35,128,+228,173,227,129,158,249,185,92,225,55,181,87,99,18,49,179,155,201,108,250,+208,47,180,66,213,136,159,178,16,6,239,37,222,5,42,236,131,18,238,206,+216,101,125,123,1,38,31,76,136,207,222,253,23,50,75,63,205,201,201,149,+239,217,240,99,203,227,232,239,211,8,206,100,92,17,120,78,175,79,140,185,+96,111,233,173,214,5,69,164,77,27,181,227,245,121,240,80,153,19,41,65,+109,97,196,60,102,137,213,147,250,150,98,22,22,19,52,173,95,166,117,243,+159,255,22,160,113,42,186,238,67,208,111,215,189,57,83,243,15,99,250,160,+245,33,232,6,156,145,80,10,248,185,52,146,22,64,31,43,211,37,29,223,+90,135,249,117,175,26,193,216,247,65,242,107,129,241,95,238,68,176,46,138,+16,31,157,50,164,254,221,77,72,55,229,85,180,170,174,250,128,97,100,47,+169,236,196,193,68,4,76,27,106,9,115,111,94,195,239,59,214,20,58,164,+164,31,235,125,117,153,192,151,187,136,175,53,61,85,21,126,84,134,209,213,+74,78,46,20,60,26,170,138,181,239,240,204,116,226,4,79,50,95,97,71,+23,54,79,211,144,196,103,204,23,27,162,14,230,27,54,232,76,136,38,206,+66,194,4,169,84,26,2,203,96,174,20,0,214,155,185,140,206,114,222,45,+28,72,113,93,146,128,97,33,58,83,6,55,185,9,239,146,146,223,165,219,+199,61,11,117,7,90,86,202,115,177,162,119,225,110,212,229,95,157,159,99,+66,51,132,50,132,207,139,238,41,236,207,232,91,210,237,15,8,40,179,127,+227,3,32,24,109,128,102,44,146,216,195,146,204,4,7,0,251,92,166,76,+148,228,105,241,63,189,235,41,182,237,71,80,88,17,109,192,48,31,94,28,+221,250,14,151,92,165,63,136,218,47,195,90,136,30,247,184,78,195,92,18,+174,94,201,10,148,204,197,212,133,227,206,47,84,167,215,1,188,15,191,67,+151,119,249,194,164,199,51,157,193,242,209,17,145,177,94,84,118,207,4,228,+217,184,203,36,251,166,29,160,26,250,92,240,162,119,131,107,47,230,193,186,+175,113,219,86,218,231,47,71,31,68,46,195,115,255,147,177,207,250,34,223,+197,176,16,122,255,108,99,185,0,100,245,61,111,17,144,250,1,83,218,51,+194,250,30,133,59,69,205,102,42,138,190,81,218,152,35,78,168,141,125,11,+171,156,218,166,240,89,154,73,94,184,42,253,125,210,75,229,11,233,161,33,+134,185,99,247,100,132,203,2,100,19,69,221,97,199,19,215,21,181,47,163,+48,41,110,235,187,67,85,21,85,140,8,38,116,217,142,152,124,33,191,31,+166,237,151,73,202,82,181,207,16,200,75,232,177,137,232,31,213,189,77,59,+184,106,159,40,56,249,84,240,41,12,74,36,122,67,107,90,145,45,78,43,+169,2,88,4,39,73,176,127,203,0,194,34,121,32,209,40,15,94,229,156,+188,124,241,38,221,171,19,212,98,22,18,72,239,5,214,115,6,66,138,55,+1,193,246,50,154,112,224,182,38,81,29,149,0,63,135,254,55,172,183,123,+110,43,233,117,117,162,112,159,180,194,180,50,247,50,33,95,127,83,11,45,+166,28,115,156,30,149,158,78,167,188,67,111,131,211,141,34,156,86,104,221,+111,14,54,135,101,152,78,219,130,57,64,15,113,228,37,125,237,177,150,75,+29,141,66,6,254,36,152,135,110,23,233,213,153,155,94,123,157,38,37,56,+73,239,69,39,142,41,122,158,100,18,223,106,231,214,108,52,191,18,252,61,+85,165,29,54,35,5,146,108,117,215,183,157,199,191,213,47,181,22,55,198,+127,232,227,253,131,253,232,235,191,103,160,228,45,124,33,108,111,149,197,109,+150,226,166,234,225,3,229,75,214,73,245,125,67,42,214,94,95,73,44,191,+207,213,141,122,208,168,103,189,113,29,230,159,23,78,71,136,124,131,226,223,+219,45,191,23,229,38,92,38,137,153,228,181,93,153,20,102,157,202,77,61,+184,213,138,128,228,134,205,45,177,223,10,200,204,107,248,136,140,215,88,38,+93,73,121,153,126,52,212,65,186,63,240,214,208,135,1,217,78,254,177,238,+169,248,210,30,211,24,32,231,234,90,31,181,187,233,46,129,109,53,37,3,+56,88,226,92,199,35,69,59,155,37,220,191,238,198,191,177,211,19,46,234,+168,8,13,76,170,118,47,13,173,195,11,211,165,111,119,231,38,229,214,54,+45,47,106,190,79,60,16,51,188,90,162,150,121,237,12,114,112,119,195,230,+10,45,43,124,186,255,172,71,74,206,120,163,177,126,165,55,204,64,75,150,+154,147,100,51,71,12,95,28,198,163,131,159,144,159,112,98,35,22,146,71,+29,173,147,46,95,200,221,105,144,15,154,199,188,1,91,76,33,26,243,9,+90,122,191,146,146,237,14,115,97,253,94,74,183,184,113,94,134,27,23,162,+74,22,173,36,10,232,70,10,55,105,123,220,208,241,203,147,73,168,165,1,+245,100,96,53,219,40,52,78,17,183,169,247,23,10,41,75,68,219,202,9,+97,206,196,66,143,46,166,29,204,243,136,226,85,145,212,223,110,53,127,50,+37,97,217,2,144,207,160,16,156,8,107,161,237,128,35,143,37,163,102,39,+245,87,65,219,126,231,21,251,5,226,174,14,98,31,49,37,51,100,33,55,+159,222,162,179,254,93,24,176,114,115,132,61,140,108,77,7,205,208,177,109,+22,254,25,175,82,188,41,205,156,195,118,71,50,85,242,112,45,250,48,16,+250,228,134,46,239,3,54,53,69,0,209,237,155,73,91,143,162,6,3,90,+38,156,94,87,37,137,190,179,176,241,159,183,81,159,73,165,74,158,56,144,+26,114,32,253,89,146,155,130,207,224,151,189,225,110,169,128,120,166,36,229,+239,99,88,222,147,215,250,10,64,56,75,239,186,111,32,213,122,113,17,193,+104,33,36,56,222,33,236,213,214,171,132,78,157,82,10,172,8,14,63,81,+196,202,146,134,186,105,114,76,177,78,60,72,18,62,93,191,5,44,22,2,+139,233,204,140,200,66,200,19,197,171,232,103,19,3,248,174,127,235,177,251,+72,121,10,121,161,212,28,68,48,255,133,67,110,185,204,146,117,143,81,77,+99,88,214,142,212,9,151,221,13,179,191,166,245,252,128,86,201,116,177,108,+131,252,57,119,213,82,62,19,120,81,113,113,242,119,126,71,95,238,85,220,+65,53,49,76,14,74,221,208,74,88,95,246,136,12,135,181,153,95,113,241,+112,27,100,217,63,53,168,27,217,217,210,79,69,125,230,43,42,185,233,66,+213,240,182,42,170,132,206,174,15,103,95,158,190,174,41,140,16,131,127,178,+122,146,254,59,47,116,75,34,22,46,28,60,81,201,19,207,147,145,26,170,+160,134,63,228,15,152,49,69,2,187,37,135,167,16,226,98,15,186,159,82,+124,110,72,115,217,117,84,67,5,255,119,10,248,78,235,235,170,141,14,144,+130,190,123,168,105,219,95,96,233,228,49,22,237,74,226,204,231,143,223,206,+160,58,212,168,40,107,210,76,248,24,96,214,125,104,230,212,254,170,55,93,+18,176,179,97,58,59,4,71,63,90,240,62,36,4,155,73,50,40,169,213,+166,69,13,33,116,25,108,216,170,244,173,187,218,114,207,58,172,119,90,230,+201,196,213,197,4,245,74,181,241,210,59,21,221,202,146,22,159,58,95,67,+198,134,143,165,82,135,29,184,230,247,110,56,170,36,184,253,177,49,9,189,+31,43,125,122,184,26,195,41,220,218,252,69,235,147,169,131,1,134,175,148,+172,217,64,125,171,41,208,250,114,72,43,218,233,209,25,124,61,15,39,21,+212,123,38,227,25,32,139,211,223,69,18,108,59,222,70,109,123,130,79,95,+70,238,62,145,234,29,179,232,19,115,171,182,198,108,77,136,197,157,87,197,+72,196,78,38,209,101,97,147,34,115,253,166,58,26,93,203,238,222,216,227,+40,210,224,219,34,79,249,150,158,57,194,235,142,127,123,224,136,187,220,217,+157,248,216,80,91,55,196,140,42,103,237,77,234,143,165,185,67,220,151,21,+138,120,66,28,81,203,139,86,63,220,220,77,25,172,56,63,168,220,153,212,+19,235,118,191,133,188,126,71,243,172,131,140,83,70,37,238,35,56,231,230,+230,108,248,148,234,100,49,211,148,37,245,125,154,250,225,85,54,3,238,125,+193,178,42,173,19,38,153,7,67,184,26,207,191,121,162,191,91,158,181,171,+200,66,82,249,92,212,225,140,225,104,253,84,157,240,204,0,106,134,105,168,+0,240,33,177,145,185,183,178,40,162,230,103,222,194,230,90,213,252,149,124,+62,109,170,28,160,50,77,34,26,100,108,186,231,236,36,187,120,110,106,254,+18,50,29,94,125,189,205,140,237,162,62,106,186,39,164,128,187,28,243,108,+105,204,185,48,183,140,145,49,161,106,184,72,156,205,113,239,196,219,1,131,+133,222,35,163,140,3,72,75,149,84,149,90,175,141,48,128,35,10,50,107,+128,195,227,12,153,157,225,88,143,102,6,126,68,203,248,86,196,78,44,130,+207,62,120,54,190,3,63,30,34,223,99,13,18,125,108,141,83,237,74,102,+12,142,166,76,28,119,1,210,185,24,104,96,175,159,170,137,74,106,117,226,+29,8,41,101,187,157,58,194,252,170,15,191,19,143,181,52,220,16,65,14,+114,251,193,198,121,100,221,1,242,133,89,172,114,154,86,10,151,212,28,223,+79,237,49,74,131,114,177,133,207,25,55,115,40,132,245,177,162,173,81,1,+46,35,197,125,122,228,135,109,178,89,243,4,110,3,26,91,240,47,205,21,+223,201,57,248,16,171,73,109,92,57,89,54,234,138,204,69,124,75,194,4,+204,39,131,7,118,32,128,147,99,102,113,98,10,41,86,81,129,120,236,214,+50,70,181,151,29,85,124,31,202,225,21,184,2,154,154,185,6,195,56,59,+45,122,80,78,77,42,25,112,208,4,47,165,62,43,145,178,132,107,126,208,+173,12,10,120,235,77,108,230,211,253,175,238,152,159,8,86,107,224,243,202,+35,12,193,39,198,90,8,47,173,203,85,242,121,226,189,121,145,57,214,178,+85,116,152,103,183,67,49,39,50,3,120,155,68,104,172,121,166,107,232,167,+47,24,13,20,138,36,77,175,39,102,227,206,204,84,136,164,214,204,3,37,+6,113,131,44,240,177,249,157,136,222,67,97,160,96,231,224,251,111,100,173,+32,148,189,47,232,175,68,69,254,19,15,141,231,219,185,182,241,62,16,107,+101,222,172,149,228,111,212,156,119,60,164,207,208,125,91,175,235,74,214,166,+53,164,46,143,137,171,195,231,204,93,47,121,187,228,232,89,222,209,27,179,+57,93,86,71,236,120,240,207,25,161,124,163,190,106,209,194,166,9,81,224,+45,244,172,220,166,254,169,124,22,120,9,247,115,17,196,215,91,175,228,193,+171,41,154,114,13,9,15,100,158,74,161,110,86,7,97,123,149,193,178,151,+242,11,93,173,61,49,165,78,57,113,83,23,12,130,77,236,90,179,106,68,+157,119,71,235,107,65,33,111,197,142,26,17,23,138,203,234,130,57,46,224,+93,140,57,74,66,218,228,114,235,17,252,46,238,101,5,79,120,203,126,244,+130,148,112,62,253,238,126,183,233,29,101,28,53,156,68,29,175,236,4,109,+115,184,130,33,178,28,70,243,128,170,69,198,236,98,48,216,183,12,167,42,+156,29,142,145,254,207,251,237,62,208,100,21,126,102,223,48,115,78,244,75,+205,157,82,152,35,175,27,39,107,221,162,209,118,236,52,157,190,238,120,87,+111,27,123,42,178,59,115,73,93,31,162,131,139,137,226,59,124,193,133,192,+42,93,1,103,43,98,33,6,207,11,247,215,45,102,167,168,134,2,251,39,+117,255,21,162,54,154,180,7,149,82,95,201,74,23,43,22,5,64,198,90,+110,234,6,237,222,166,95,80,93,130,43,179,187,0,52,23,238,83,115,43,+227,246,192,180,98,247,189,167,191,250,136,101,224,112,217,228,80,47,180,211,+159,248,6,82,64,83,230,1,149,166,118,43,110,61,176,112,110,208,192,240,+79,83,225,9,252,191,193,124,25,36,224,48,232,60,220,168,63,204,130,220,+35,78,241,93,49,55,131,160,173,77,114,118,138,4,128,129,110,90,53,246,+204,49,40,174,225,251,182,231,68,188,217,190,140,147,244,140,211,171,105,238,+60,198,96,149,135,133,246,68,96,112,11,105,61,94,187,83,159,61,64,90,+173,13,207,182,108,193,27,247,54,20,108,148,162,235,37,245,252,247,211,10,+189,59,180,206,252,184,237,137,251,64,114,155,236,36,151,85,254,150,23,1,+43,42,107,121,14,183,119,181,69,211,49,186,34,235,129,40,73,248,117,145,+115,159,128,51,35,8,114,113,70,94,111,58,197,214,143,167,213,163,161,98,+14,15,139,229,34,185,219,67,36,165,40,93,69,242,205,199,206,4,239,52,+179,16,147,81,102,13,23,200,231,169,192,3,52,190,68,178,137,88,226,106,+153,84,250,185,218,128,66,118,197,178,92,26,245,166,249,163,164,164,159,86,+113,122,20,167,83,121,217,201,184,54,211,219,167,245,186,37,104,122,92,208,+100,40,230,37,183,124,24,164,72,229,181,51,120,240,97,164,4,245,202,218,+119,70,189,76,27,184,189,196,191,145,226,141,179,55,130,3,33,127,187,96,+123,11,184,244,176,31,32,241,100,88,199,109,153,216,216,162,116,105,22,41,+14,194,98,110,206,103,14,158,18,117,111,161,139,1,80,123,65,147,246,30,+175,206,75,111,183,251,72,136,132,77,48,118,25,21,197,178,109,53,196,88,+234,125,126,65,78,111,205,84,186,206,117,40,1,181,126,81,48,157,101,255,+203,11,129,182,103,149,27,108,52,100,162,250,133,46,181,152,186,4,173,105,+182,206,114,64,33,251,10,238,91,129,201,31,146,77,112,97,182,197,159,102,+20,81,19,152,98,245,45,87,10,159,99,182,53,187,42,53,0,154,22,30,+12,44,131,218,43,8,175,186,140,96,9,87,25,31,239,241,78,241,85,238,+216,125,219,176,182,70,227,7,6,191,77,133,12,192,227,149,62,177,50,83,+37,170,134,215,5,226,20,66,204,26,186,109,131,17,151,166,166,236,97,96,+90,72,125,206,183,78,215,203,143,108,17,129,112,252,253,45,193,10,209,38,+113,30,150,88,204,255,203,131,65,227,89,84,114,101,144,30,96,52,51,44,+101,14,31,79,86,148,188,135,15,15,64,233,231,46,182,195,198,47,165,221,+51,223,54,235,177,21,156,253,130,16,72,250,88,214,208,187,103,228,30,191,+1,13,239,209,10,240,229,124,234,113,65,41,213,108,29,126,122,158,49,174,+128,195,44,48,163,248,243,224,216,33,115,233,7,140,220,153,20,0,244,179,+227,65,66,107,79,44,122,51,50,224,175,240,90,152,5,89,19,82,193,127,+21,249,235,144,239,144,149,43,132,149,161,228,133,109,197,125,30,16,128,140,+51,192,8,159,102,159,28,206,152,224,169,168,250,115,71,32,196,84,51,0,+167,87,244,250,113,144,49,170,176,44,165,246,4,16,121,187,95,70,237,237,+187,63,233,32,118,221,195,120,39,139,66,186,216,201,219,136,159,5,54,188,+56,199,128,11,47,202,40,183,189,55,188,242,150,108,70,137,54,114,45,73,+18,9,80,163,12,237,250,124,84,158,230,87,73,253,195,78,75,107,219,145,+64,229,84,144,92,187,73,11,168,116,140,156,249,194,128,65,78,43,3,125,+86,66,13,42,109,111,50,195,50,28,146,37,97,32,250,39,164,16,63,73,+36,220,202,143,130,76,41,66,255,24,152,228,14,79,2,155,17,40,70,33,+47,133,91,219,23,151,119,243,227,67,192,18,149,116,1,185,89,43,140,210,+40,85,87,8,250,178,52,209,135,36,106,89,209,150,19,98,204,131,100,57,+41,136,24,143,164,67,195,231,125,16,205,27,254,213,213,45,90,48,8,125,+116,163,43,72,196,24,82,162,255,184,104,109,103,97,210,53,238,41,140,242,+175,210,37,108,113,33,232,227,212,103,160,132,87,213,142,112,190,233,41,248,+33,52,9,162,117,112,185,16,105,33,57,195,40,204,20,97,82,194,25,135,+0,254,96,247,92,177,60,205,32,84,118,248,239,39,116,41,137,201,235,43,+199,52,229,184,2,251,168,186,212,32,105,84,38,2,150,125,63,199,240,179,+224,170,120,103,73,246,255,18,246,161,45,138,184,202,147,97,3,50,84,87,+90,114,95,227,164,51,27,37,219,234,205,76,168,30,95,140,56,133,216,119,+57,175,104,89,97,139,136,48,86,203,67,78,95,66,73,244,4,126,212,77,+203,149,154,179,214,2,64,105,157,185,166,209,108,237,21,90,1,31,157,23,+148,225,13,187,228,132,83,220,190,1,80,114,4,164,197,185,5,233,158,63,+103,251,34,235,34,17,129,105,112,113,117,157,119,193,150,164,176,64,108,16,+255,242,59,38,77,118,191,65,121,245,212,65,33,209,184,75,175,243,76,135,+212,202,211,87,8,69,114,145,225,30,134,120,222,205,155,106,57,196,183,81,+133,20,104,0,243,18,178,161,141,23,145,66,4,40,48,110,216,20,120,238,+128,82,129,153,35,218,197,2,155,70,206,246,23,254,125,56,3,26,166,143,+137,242,178,216,55,164,193,69,77,39,133,135,159,36,18,162,1,96,122,139,+102,140,172,6,203,14,193,39,148,149,12,250,204,61,0,125,137,66,12,139,+216,106,2,254,157,42,13,173,165,245,216,172,101,151,11,122,111,241,45,60,+106,92,111,214,18,227,102,218,55,102,103,139,90,228,16,177,229,220,145,182,+158,25,57,237,229,143,11,82,78,110,94,237,132,5,192,150,207,79,187,126,+86,171,251,88,115,212,108,68,255,44,42,69,58,139,144,91,41,49,247,34,+101,177,119,98,218,165,39,7,29,10,206,1,216,8,127,40,3,41,185,240,+10,33,152,242,254,62,192,103,102,249,137,135,235,36,120,168,197,157,220,36,+214,195,107,171,207,138,181,216,243,81,125,174,120,91,37,208,53,253,113,130,+81,60,129,71,136,127,70,19,134,165,224,43,7,13,240,172,244,22,71,230,+21,245,97,191,7,240,111,205,143,57,117,86,163,33,2,138,160,186,170,94,+126,81,172,58,128,89,17,197,223,67,222,80,195,187,25,66,198,7,40,6,+207,63,178,159,69,203,106,46,231,59,132,86,116,74,216,214,75,193,155,80,+192,17,37,93,120,189,38,75,59,90,52,206,153,38,250,160,135,181,166,243,+201,230,105,115,187,6,189,87,42,180,218,121,34,123,236,236,127,219,79,101,+80,244,155,241,89,213,11,43,185,75,65,45,53,44,96,242,214,216,12,186,+145,166,67,116,23,182,75,251,91,72,63,224,241,191,220,49,246,85,6,124,+11,176,226,66,75,71,64,79,204,43,218,169,68,144,121,161,251,88,191,22,+26,3,239,197,78,209,254,82,85,148,39,167,163,30,112,187,59,209,193,157,+207,110,84,36,219,65,39,11,12,233,154,186,75,98,81,120,31,131,106,161,+113,92,141,85,121,246,210,23,187,102,88,2,211,62,51,54,109,124,61,149,+169,238,164,48,108,209,229,228,50,245,193,192,78,218,21,54,105,167,91,20,+127,149,155,29,191,208,194,65,146,193,0,158,30,58,13,162,193,9,186,138,+84,129,7,32,220,176,160,84,200,221,159,21,184,204,224,227,59,31,124,151,+133,141,128,134,226,145,46,29,87,166,49,220,140,141,97,208,40,207,230,249,+45,237,149,65,10,66,186,55,243,98,165,143,183,68,179,50,217,23,170,0,+119,87,228,44,236,15,138,233,43,197,217,94,183,188,33,234,113,77,48,11,+251,248,129,97,174,51,52,45,130,82,108,202,174,93,148,207,90,29,96,240,+68,31,133,118,193,162,46,43,23,24,121,98,51,162,161,145,232,223,148,111,+240,220,171,214,123,227,207,187,177,159,155,62,77,144,93,206,103,249,225,232,+160,49,40,174,197,211,189,136,195,126,57,72,248,29,246,119,58,30,16,215,+8,198,32,90,184,221,73,148,30,1,74,100,183,95,104,106,27,151,162,142,+19,116,197,211,199,169,12,169,102,193,104,39,241,1,159,101,124,152,190,191,+102,231,49,1,218,3,2,239,65,88,8,57,81,194,68,248,5,43,91,216,+127,235,109,80,196,86,90,185,177,201,229,74,202,63,140,224,131,254,206,177,+60,174,188,31,55,122,141,146,77,182,71,211,160,220,125,0,226,13,72,237,+143,187,26,164,218,160,252,164,126,239,194,176,196,92,249,254,159,56,17,64,+204,128,250,15,204,154,70,73,146,152,143,57,231,138,81,170,36,141,75,217,+107,240,113,8,235,86,4,30,95,94,76,204,157,47,141,159,46,136,229,56,+153,160,144,210,73,135,87,76,69,151,118,236,226,135,236,162,175,230,230,46,+70,166,121,190,137,195,185,26,39,201,188,41,58,71,95,134,62,37,68,137,+194,227,214,87,49,18,49,196,53,219,225,53,246,10,174,132,104,28,34,14,+69,212,151,222,16,96,43,32,199,191,209,128,233,18,117,167,191,164,88,32,+216,243,214,177,101,103,145,100,190,26,181,219,82,237,14,6,198,61,18,48,+165,54,78,150,137,8,61,147,186,209,248,241,50,181,152,93,24,124,156,186,+102,48,103,126,245,227,121,95,191,21,125,188,184,37,44,83,150,237,26,135,+15,149,156,225,139,116,237,175,71,211,195,179,172,127,79,83,132,102,169,156,+147,119,19,83,236,130,105,2,30,204,45,82,159,148,201,109,95,206,26,201,+201,32,86,242,144,103,138,141,101,148,127,235,115,77,106,218,162,1,111,172,+199,17,168,163,129,75,53,5,6,17,180,183,238,139,177,229,112,22,57,22,+102,192,149,80,6,84,24,133,77,66,240,191,189,112,250,133,249,53,148,50,+96,225,199,197,67,28,24,237,9,18,134,81,119,40,2,55,131,32,42,54,+107,225,105,228,191,225,25,44,184,118,248,71,202,23,222,79,127,47,134,65,+172,211,152,65,8,212,79,190,225,107,99,227,171,107,118,27,148,5,169,12,+164,224,196,22,165,218,118,117,58,188,224,205,124,8,122,151,77,145,248,135,+234,179,86,35,43,231,133,222,84,173,166,186,203,120,49,8,82,78,173,119,+126,129,43,84,25,253,160,139,102,6,38,235,206,174,42,129,70,233,205,153,+253,30,152,2,26,194,13,237,175,203,43,68,117,193,84,54,58,244,9,227,+162,186,59,205,93,93,59,232,85,41,143,254,235,138,64,95,188,59,237,70,+251,200,254,173,20,193,224,14,139,219,170,120,30,176,176,88,130,161,229,161,+76,148,234,108,121,36,71,23,74,42,16,3,187,203,120,248,132,48,50,233,+31,223,193,13,235,172,24,181,23,204,154,81,255,36,28,97,177,104,118,89,+226,113,52,84,181,189,147,185,151,6,91,65,217,198,8,70,5,119,145,96,+117,69,196,17,31,152,37,237,49,255,41,236,130,190,59,237,155,207,111,144,+146,194,141,187,199,192,139,90,219,60,117,105,14,110,102,236,158,222,57,221,+187,0,45,148,67,32,169,161,44,73,79,94,137,58,141,212,210,132,179,114,+68,39,147,234,7,67,224,170,231,6,227,31,189,163,49,255,55,72,58,232,+48,40,161,50,38,81,171,230,128,62,85,117,65,236,245,203,58,107,151,176,+174,178,87,211,221,145,236,158,2,26,131,112,90,173,208,60,0,254,255,78,+132,63,128,183,117,35,203,64,244,203,34,95,117,225,92,248,60,102,214,43,+184,90,148,137,157,49,122,3,85,110,39,5,138,234,2,90,229,1,207,235,+110,224,223,55,132,215,107,119,192,184,251,135,132,163,242,161,63,184,229,55,+75,134,119,43,4,99,191,240,139,114,134,203,205,37,237,57,172,132,69,185,+201,246,33,185,196,50,204,39,61,90,170,196,233,225,199,29,71,237,101,196,+232,86,13,181,124,197,231,37,2,42,149,197,163,142,69,198,81,77,197,49,+33,193,78,227,113,7,46,84,100,105,72,181,157,7,22,57,61,108,134,78,+216,219,92,253,45,161,229,49,185,138,217,50,14,33,192,221,227,204,1,235,+18,104,50,66,74,145,26,89,19,235,78,224,11,20,161,240,171,112,9,26,+5,71,161,210,77,9,158,53,86,19,178,79,209,158,121,222,203,75,154,211,+125,180,255,37,10,199,61,238,252,75,203,194,85,113,215,241,254,8,214,164,+156,4,170,42,116,135,66,104,165,52,41,41,156,247,247,161,29,103,231,54,+13,244,56,74,161,136,178,151,106,17,226,226,24,189,234,232,39,211,3,244,+186,209,141,217,47,110,75,65,22,74,250,61,91,71,244,125,0,57,33,172,+248,225,90,251,239,106,248,62,39,161,81,139,133,146,89,118,191,15,200,96,+200,159,255,86,132,19,115,25,74,113,100,215,60,223,134,240,139,18,187,186,+106,53,26,196,196,47,6,241,124,67,167,133,138,213,237,226,23,112,39,167,+93,18,188,173,163,73,61,27,111,62,212,162,177,245,57,146,213,91,198,106,+155,28,28,188,222,77,1,234,100,69,160,96,219,55,107,94,150,99,126,73,+158,206,94,119,247,101,236,51,189,17,194,251,4,5,146,175,116,100,115,175,+184,151,22,163,27,182,92,129,48,246,53,165,179,45,245,130,129,200,124,254,+61,120,106,215,8,229,26,38,101,227,114,50,109,131,140,176,137,209,21,247,+150,187,93,109,251,216,1,29,99,238,105,92,141,222,169,253,31,30,250,172,+60,157,129,89,167,249,37,57,238,224,160,45,49,138,130,204,144,23,206,211,+90,157,22,62,244,236,150,205,110,248,177,17,29,228,135,46,222,155,167,108,+17,70,29,233,182,156,32,188,193,158,109,15,238,189,100,123,208,182,97,176,+193,13,246,12,62,20,41,75,63,43,48,177,12,233,200,112,224,112,79,243,+149,28,6,7,185,253,89,210,69,44,238,131,158,174,140,181,221,206,103,100,+106,198,199,67,63,9,28,211,194,223,48,169,214,177,218,68,198,79,30,241,+183,14,209,85,33,67,136,51,186,71,158,17,103,235,65,89,20,58,1,170,+230,141,78,25,49,181,129,128,103,47,202,145,149,194,104,132,35,32,30,92,+14,142,4,100,129,197,204,243,144,251,182,105,152,138,177,73,240,101,99,160,+28,28,162,21,88,151,246,140,227,162,223,142,248,173,229,11,153,211,35,227,+51,90,218,74,81,61,91,231,17,245,139,0,85,171,144,238,200,16,89,186,+19,138,166,13,59,77,81,46,108,49,4,85,8,169,42,247,129,54,121,228,+100,201,75,148,60,213,136,73,98,254,175,191,51,81,121,131,220,96,186,196,+116,132,75,248,3,76,149,15,29,76,248,93,160,152,167,255,74,124,217,29,+77,161,163,18,24,77,152,48,48,168,236,12,195,142,238,56,111,113,86,115,+50,221,234,176,242,103,136,11,38,1,136,214,163,39,113,212,42,132,132,214,+6,31,183,184,45,175,223,138,71,28,89,92,99,186,246,48,215,219,88,214,+170,245,26,37,234,172,233,30,87,34,159,242,116,114,63,240,164,27,68,113,+135,207,122,52,72,100,90,3,249,82,35,47,226,213,206,49,65,189,181,231,+152,44,197,86,198,32,125,121,151,80,49,160,200,180,102,242,230,217,237,44,+22,208,153,187,72,253,122,91,175,183,10,81,201,180,199,46,97,90,235,207,+209,230,215,141,242,198,35,196,10,65,175,15,189,35,13,121,224,77,180,82,+195,48,21,64,132,55,214,163,209,29,52,52,11,137,51,51,43,167,178,45,+69,64,81,32,155,148,156,57,54,48,41,144,80,13,32,179,223,185,152,36,+80,3,127,15,139,72,112,32,11,198,239,226,63,179,146,47,106,142,33,5,+100,213,88,192,124,131,18,31,23,85,95,116,179,15,9,80,28,47,107,110,+69,92,133,47,240,48,199,24,241,90,94,114,6,78,167,79,0,224,255,6,+41,218,52,17,74,250,223,240,249,89,41,105,106,189,251,145,137,207,131,29,+36,107,1,83,9,0,196,244,11,182,164,178,147,9,102,190,145,252,233,213,+16,237,47,8,188,168,203,27,52,212,25,237,113,190,58,200,100,238,71,78,+192,212,245,229,194,245,130,96,163,143,129,114,79,89,232,170,209,158,239,230,+184,149,31,232,225,204,16,140,113,178,193,40,102,210,1,104,215,96,156,120,+218,15,248,123,69,73,233,195,191,230,202,204,98,80,198,43,58,127,208,111,+178,98,234,211,68,80,109,107,205,44,0,172,115,225,13,157,202,158,255,167,+237,11,147,160,34,1,225,144,125,244,2,42,2,166,22,126,142,220,67,192,+205,43,142,149,160,53,216,38,152,189,75,188,164,243,145,79,1,42,28,178,+203,12,89,105,47,134,87,114,75,166,110,174,188,125,87,234,177,247,169,50,+113,81,33,103,175,105,149,210,87,27,249,118,228,88,248,221,109,153,95,227,+77,109,50,101,232,181,183,92,2,179,244,156,171,63,98,137,114,28,137,238,+205,111,161,11,230,251,152,174,252,30,140,41,128,149,241,153,158,209,14,230,+57,201,232,210,10,243,35,162,198,177,62,40,252,46,196,251,198,116,46,84,+188,206,113,28,92,119,137,25,139,147,184,245,65,165,116,122,156,30,228,42,+230,39,67,143,140,201,157,198,235,9,23,238,83,14,187,13,154,35,249,34,+18,107,113,13,216,190,103,55,22,218,143,89,239,37,17,129,140,194,104,44,+197,19,82,143,254,59,153,222,45,15,27,178,254,121,220,90,85,91,174,157,+87,231,239,37,204,160,200,104,127,26,135,60,208,8,21,23,15,196,212,32,+154,147,182,162,139,101,249,166,156,98,79,48,50,104,87,87,66,112,174,88,+136,254,234,35,148,16,20,184,245,158,90,46,151,89,77,20,148,55,156,135,+58,13,19,109,56,198,38,128,207,141,84,193,202,237,141,61,9,88,206,80,+190,189,124,232,237,0,26,236,202,2,204,121,231,64,49,99,49,127,154,251,+27,46,189,71,113,214,100,1,209,69,63,174,220,201,105,128,67,71,62,143,+179,9,43,224,52,90,76,102,54,58,46,66,75,66,44,242,146,69,127,54,+176,161,178,203,115,102,171,52,120,248,27,199,71,163,170,38,107,91,234,72,+146,146,129,45,219,60,102,183,245,182,103,152,34,45,35,196,30,138,206,185,+171,5,27,40,177,43,89,85,249,152,142,221,2,233,220,33,184,63,118,26,+22,34,73,90,114,178,177,127,94,6,40,167,122,168,0,11,187,3,234,239,+188,81,178,32,108,29,32,201,188,74,206,168,187,77,196,109,16,153,146,135,+43,112,76,217,48,127,171,53,66,110,3,20,196,78,198,17,44,128,88,15,+21,6,55,98,67,190,206,137,181,129,195,247,126,51,57,130,241,111,180,161,+180,150,178,255,114,90,190,109,117,195,102,149,220,253,120,46,201,238,244,181,+41,254,11,173,167,102,144,87,45,205,137,33,139,100,140,208,225,41,164,90,+48,136,15,245,212,68,157,79,56,225,114,9,225,151,196,102,156,120,134,73,+178,180,80,111,93,227,5,11,161,152,239,100,254,32,115,94,24,160,5,58,+38,37,213,236,167,138,49,167,193,237,188,3,8,188,111,33,67,237,196,46,+140,168,26,124,88,182,168,90,250,189,110,252,154,253,180,192,157,143,116,186,+57,174,154,18,70,23,126,97,124,48,45,205,84,49,78,136,134,168,86,92,+185,163,226,10,55,238,113,60,231,162,87,78,90,171,221,113,208,122,82,140,+10,194,235,119,96,163,106,86,9,248,62,176,75,171,200,13,17,38,30,149,+110,20,125,110,47,243,157,169,79,48,100,41,83,201,208,213,220,59,19,96,+203,48,228,113,137,73,120,235,21,44,206,116,71,187,185,103,202,60,147,194,+139,73,241,67,8,145,16,90,171,32,251,32,244,81,65,21,139,14,213,115,+240,124,110,127,250,98,153,241,171,129,13,179,33,232,94,84,158,147,55,149,+5,105,178,12,223,199,217,183,53,135,124,142,117,224,15,228,69,112,168,103,+168,94,252,24,75,223,50,53,172,156,51,95,62,154,76,129,131,237,2,163,+113,2,8,209,122,207,74,199,206,200,94,77,51,49,229,235,217,11,202,113,+21,196,238,70,191,197,170,229,143,116,48,27,46,97,159,70,216,87,134,168,+119,170,154,1,135,102,73,197,144,199,163,83,216,248,173,7,155,39,34,203,+187,28,171,229,243,232,77,203,111,119,10,255,26,116,102,178,144,241,110,26,+138,183,250,7,126,196,6,32,62,114,223,192,208,244,222,181,80,139,136,0,+202,157,101,186,46,225,215,160,209,45,189,228,212,81,194,73,126,101,56,107,+73,183,187,126,105,219,196,69,193,205,82,40,88,67,8,53,193,254,26,164,+218,210,231,13,54,106,161,249,24,221,116,88,105,206,237,33,69,166,193,16,+203,219,177,229,162,94,234,47,55,230,220,134,245,55,206,144,184,136,26,209,+123,93,228,107,75,239,182,216,64,6,8,127,247,53,158,145,73,119,79,170,+66,98,167,74,111,251,158,142,133,235,51,105,73,64,4,133,104,4,127,130,+234,130,10,14,217,129,181,227,192,96,237,237,102,133,246,87,21,159,43,189,+227,131,45,232,187,104,104,207,225,139,187,101,89,203,129,85,55,240,72,169,+5,144,95,197,29,238,23,34,43,248,27,98,235,99,31,119,203,180,211,115,+237,88,214,33,127,245,109,100,100,168,210,238,195,140,175,90,174,212,201,52,+46,184,160,118,224,31,138,168,75,123,202,199,113,126,12,182,59,123,51,52,+199,131,45,89,240,76,221,40,23,239,174,110,252,29,17,135,151,229,28,90,+68,119,135,50,36,202,198,199,150,245,173,130,12,223,3,12,18,121,132,178,+195,198,108,31,23,0,136,30,213,10,190,194,125,229,221,107,123,140,181,174,+205,186,115,105,33,22,139,122,85,131,172,220,255,45,62,60,10,103,31,110,+193,247,192,66,194,196,116,57,209,202,95,220,46,237,154,47,101,77,71,192,+58,169,37,49,121,9,122,176,14,231,162,206,28,196,237,3,252,182,29,5,+78,7,17,60,64,119,225,195,180,238,116,236,58,214,103,57,208,155,186,121,+134,114,72,183,16,95,231,214,131,111,155,129,254,106,17,247,248,141,13,247,+141,118,148,188,40,71,117,153,191,145,150,122,76,229,235,249,112,238,231,21,+18,81,183,237,156,241,251,10,147,112,36,37,78,191,244,204,237,173,245,147,+80,208,231,210,132,115,166,194,230,82,228,151,157,242,40,4,20,255,54,55,+255,161,195,184,231,75,192,175,32,64,75,187,188,213,231,53,77,175,247,33,+176,190,172,13,91,146,127,8,11,3,211,131,165,165,79,40,254,231,95,23,+167,137,241,75,201,36,71,15,120,238,220,42,250,218,228,215,168,217,233,45,+164,113,28,221,88,153,27,45,200,234,106,143,44,181,69,208,45,85,11,122,+223,8,226,242,24,63,8,115,173,230,183,159,202,228,49,121,226,189,51,46,+93,154,2,123,127,20,207,168,41,236,24,96,152,53,53,10,248,110,34,45,+162,242,13,156,207,50,59,254,117,178,107,151,73,207,74,119,106,146,98,63,+74,143,40,86,150,59,113,23,63,74,196,135,179,89,241,104,74,231,7,203,+83,178,217,231,152,86,67,244,13,120,55,141,54,31,160,150,190,137,250,128,+25,207,126,68,111,29,4,44,78,94,84,3,212,6,40,145,180,201,143,220,+216,65,102,179,83,56,180,86,3,252,93,2,8,219,170,74,231,38,43,97,+38,42,18,140,171,187,144,145,13,210,95,25,88,162,58,168,28,39,119,197,+230,40,82,229,76,223,14,240,229,76,121,245,38,202,202,218,117,53,25,118,+66,32,150,10,80,199,244,21,130,62,65,124,174,99,235,131,119,145,67,29,+134,19,14,75,251,196,85,248,112,115,25,242,87,55,136,101,155,73,155,31,+154,29,216,214,110,72,44,178,255,46,31,19,207,164,53,14,99,164,101,76,+211,127,78,17,7,236,185,79,67,63,174,108,173,31,218,37,178,76,155,95,+133,170,2,78,253,224,188,74,131,195,159,254,229,248,46,77,120,187,169,134,+98,216,46,150,88,25,108,35,171,236,241,34,59,170,0,125,216,185,14,191,+223,95,248,161,42,227,25,210,50,90,21,245,191,194,160,21,157,87,234,64,+57,251,71,62,27,111,94,177,9,196,195,27,252,109,180,32,234,32,15,75,+69,86,248,173,247,35,160,179,134,79,237,119,163,20,161,31,239,180,101,134,+238,148,214,201,212,106,58,124,140,177,97,4,181,216,101,239,255,95,154,169,+13,207,95,17,150,183,33,76,99,71,135,84,174,138,61,238,229,194,136,93,+73,96,9,250,210,235,215,230,62,107,156,15,204,109,79,243,221,198,82,189,+215,178,5,208,246,207,184,235,29,22,210,138,46,165,218,174,83,135,222,69,+63,115,158,196,9,67,176,204,167,165,170,89,101,95,242,153,159,231,62,223,+13,32,103,86,209,194,194,184,170,83,47,93,98,149,55,15,89,118,178,153,+189,185,233,50,77,90,46,66,66,103,87,252,197,210,204,109,114,118,78,47,+16,204,92,190,55,215,215,4,171,192,125,221,189,219,91,204,129,88,101,68,+146,108,38,48,225,227,204,251,8,83,144,246,81,111,231,137,209,243,233,105,+179,199,187,115,236,161,52,130,24,98,193,208,34,87,135,116,254,58,243,98,+35,72,9,241,62,151,13,73,114,97,108,192,254,184,212,176,177,195,230,89,+173,229,127,157,244,174,214,184,97,90,118,42,43,80,140,159,141,252,20,82,+235,240,71,168,72,208,72,161,105,202,30,142,173,253,79,7,220,215,38,12,+249,134,36,80,102,234,119,250,66,136,169,253,3,62,8,234,77,242,94,126,+148,111,128,24,9,0,200,117,232,17,132,90,253,162,90,154,248,166,163,43,+128,144,108,114,113,97,232,167,211,123,242,179,144,90,179,247,171,255,149,135,+23,133,237,209,62,220,94,84,3,66,107,151,13,25,162,5,28,246,75,228,+38,62,206,16,90,242,223,143,89,207,186,13,220,213,202,55,219,243,183,97,+80,96,23,77,73,156,79,185,22,177,89,71,5,154,150,149,95,37,207,254,+188,118,120,140,136,37,91,96,209,199,11,186,147,170,68,132,124,203,85,109,+184,179,91,46,202,220,36,77,154,54,68,94,87,81,206,219,250,39,0,242,+77,214,176,110,120,43,230,237,222,200,127,235,53,12,121,140,236,98,207,87,+5,235,201,106,241,7,79,231,54,64,100,42,181,89,213,95,214,22,223,124,+17,169,91,75,167,154,70,20,117,5,235,8,205,107,115,131,1,144,253,96,+214,118,185,21,2,231,182,211,20,35,64,59,86,74,242,99,37,141,29,222,+214,62,241,110,131,214,182,22,146,223,238,90,202,47,243,250,204,64,186,210,+178,38,216,68,249,59,149,232,173,123,31,85,0,13,108,177,243,60,187,110,+42,123,122,110,179,113,90,192,193,131,108,105,132,87,199,63,29,228,219,5,+135,130,99,13,33,51,139,59,52,205,212,6,66,5,120,78,180,3,79,139,+93,205,4,135,63,207,111,68,42,194,126,197,94,243,37,207,55,66,66,231,+64,233,189,28,225,72,206,60,29,164,76,135,51,38,234,71,6,109,167,148,+213,230,242,228,187,127,69,11,158,36,184,22,171,137,125,251,218,44,122,155,+171,71,207,38,39,84,3,38,101,110,161,1,122,184,41,179,229,122,245,46,+230,208,211,145,171,80,184,41,186,231,157,163,211,16,221,70,124,219,198,123,+27,180,205,57,95,0,172,41,149,180,130,132,122,23,194,27,164,93,83,218,+173,20,152,66,244,202,4,35,89,246,68,253,233,208,116,14,53,113,36,208,+102,250,52,34,71,47,127,60,162,155,73,63,25,236,154,0,21,5,229,94,+106,253,221,154,131,142,193,207,148,41,58,217,34,77,13,71,57,229,203,146,+187,189,96,31,180,37,146,58,246,90,102,208,66,245,33,27,94,244,28,78,+6,129,194,127,150,106,191,144,240,54,31,84,129,20,142,131,60,97,111,118,+205,159,252,29,23,237,184,103,205,240,206,37,94,168,18,232,167,112,68,111,+212,167,27,77,64,59,90,75,192,54,131,4,253,158,185,55,24,226,196,217,+132,236,208,227,63,136,171,131,202,99,5,117,77,13,66,131,65,113,59,85,+239,208,83,215,36,209,81,223,205,209,158,137,12,189,165,33,96,231,167,185,+39,98,250,145,221,86,231,28,85,183,192,231,77,251,183,172,29,150,145,250,+147,25,58,65,227,109,207,145,187,94,124,157,193,177,1,67,24,57,253,141,+78,240,89,34,45,56,55,203,122,224,243,229,20,241,72,141,12,121,137,220,+222,94,166,233,118,177,151,228,196,246,177,223,206,197,225,73,147,173,186,35,+106,114,51,77,211,122,0,6,94,248,67,200,81,205,112,75,72,67,91,47,+34,209,134,0,216,103,198,161,4,49,10,0,14,21,3,191,73,179,2,15,+104,115,53,245,203,93,11,47,181,132,203,182,20,26,60,67,150,221,82,3,+50,92,201,77,136,18,194,3,131,15,225,167,40,49,69,85,17,157,164,4,+146,231,238,108,188,24,123,43,212,206,126,74,73,88,255,223,83,35,57,52,+66,240,99,193,251,11,17,113,19,203,63,130,191,251,18,222,127,212,183,147,+66,110,88,215,150,42,149,17,191,226,161,78,136,7,247,237,213,55,6,198,+231,45,116,20,127,63,94,34,151,2,146,135,243,218,95,255,11,104,89,97,+115,222,144,19,49,40,182,196,211,39,237,125,21,117,120,95,16,185,148,80,+216,226,177,168,19,251,223,169,197,130,41,17,151,224,130,138,219,64,181,33,+11,28,214,80,166,238,190,1,162,117,79,14,162,119,89,59,96,241,32,138,+54,33,170,170,130,57,217,53,172,234,131,211,178,40,59,58,27,228,133,38,+118,79,48,195,93,68,7,243,126,207,66,71,119,104,191,94,184,247,247,116,+95,187,72,46,232,47,113,16,59,215,219,90,25,114,253,84,107,246,146,151,+22,225,148,196,218,252,216,255,103,11,27,70,134,226,168,95,231,106,150,252,+59,130,207,83,241,33,188,40,74,169,211,189,116,169,29,27,196,108,234,57,+136,195,170,142,189,181,80,193,161,142,117,204,138,231,66,82,25,233,203,106,+206,158,160,69,177,123,227,93,187,223,23,169,201,113,239,248,81,164,90,191,+118,187,250,138,248,165,148,137,177,10,45,33,47,64,108,82,177,0,63,221,+78,82,250,110,198,164,41,195,41,103,250,142,210,79,35,235,108,33,57,189,+140,131,86,117,173,72,236,63,28,116,160,135,175,188,105,60,69,253,19,165,+248,247,128,249,242,74,88,136,1,252,12,78,170,93,230,248,187,22,49,190,+80,255,52,65,75,4,100,156,129,46,131,143,239,67,239,10,239,82,83,65,+217,167,207,15,201,92,26,15,105,98,107,186,84,143,138,130,240,10,203,161,+34,64,20,211,113,15,49,192,229,49,105,123,107,251,143,39,73,71,96,229,+66,45,161,122,24,137,25,223,188,115,48,77,88,192,171,144,135,97,130,18,+32,251,84,209,179,246,206,248,9,116,152,243,25,131,3,58,106,108,31,34,+234,30,213,107,161,216,150,142,48,226,12,91,20,114,84,136,102,3,140,61,+1,28,174,139,122,155,231,43,99,95,213,80,89,240,106,38,85,226,38,121,+61,8,67,180,22,7,100,150,88,77,201,86,210,30,6,142,68,3,37,102,+19,66,3,3,134,243,4,171,140,37,77,148,231,213,189,67,30,185,201,246,+111,146,130,50,174,96,220,156,15,224,165,67,168,157,26,213,86,0,179,140,+100,29,180,162,90,208,97,160,164,77,119,205,128,69,174,6,183,173,48,82,+117,207,138,64,120,98,92,57,13,146,173,150,246,193,205,206,83,193,74,149,+109,54,66,243,125,252,97,7,203,228,111,1,50,150,160,90,254,190,69,1,+238,169,124,219,34,150,140,122,146,139,77,240,153,222,172,230,197,155,38,161,+7,197,188,172,234,112,174,73,186,163,32,106,106,111,135,150,94,91,172,124,+7,8,148,211,192,41,18,70,188,153,97,88,101,12,126,249,211,182,221,84,+181,96,27,202,34,112,58,105,20,162,94,64,87,119,85,237,117,51,170,9,+254,57,108,9,20,213,65,10,36,159,56,29,120,23,91,199,130,44,149,25,+74,16,45,145,226,235,42,169,180,95,49,235,40,137,6,132,118,77,69,159,+93,225,102,142,93,216,132,161,44,58,8,230,79,216,35,80,238,2,245,241,+85,95,8,137,88,182,109,141,15,185,222,116,137,123,122,217,175,170,248,68,+149,211,195,92,164,119,13,85,216,34,161,82,26,222,45,68,58,12,236,58,+7,33,221,7,175,164,25,237,103,227,44,211,33,162,233,79,78,151,114,97,+109,43,137,147,131,108,246,88,64,112,97,36,51,138,206,69,123,31,239,106,+209,213,188,149,182,191,60,220,242,65,76,19,31,183,198,229,115,81,21,199,+243,250,111,65,174,14,176,177,67,30,164,219,38,85,83,4,93,189,117,106,+234,136,237,17,188,70,28,241,231,40,170,199,149,247,214,38,111,68,33,99,+177,105,193,150,7,75,105,227,53,219,135,121,114,78,203,54,193,153,144,230,+135,172,107,23,185,46,7,147,46,243,245,229,60,11,247,133,26,137,214,68,+110,9,111,106,116,222,254,172,18,109,105,119,155,78,107,39,21,199,115,90,+30,195,144,252,248,157,196,89,81,29,135,93,209,5,2,207,205,204,125,223,+21,98,64,99,106,206,122,150,92,134,27,80,115,25,17,28,170,197,145,30,+153,11,120,243,124,252,238,23,117,186,219,25,188,241,53,155,131,46,155,48,+177,40,70,233,165,86,29,44,251,229,130,130,128,22,253,89,205,169,7,125,+66,193,187,115,114,64,69,167,137,58,208,137,120,143,78,15,76,62,112,12,+238,18,63,162,118,131,191,99,233,238,23,82,73,14,190,196,35,198,213,151,+203,254,159,106,206,225,10,163,231,210,166,92,53,72,105,180,209,150,152,50,+110,80,230,91,152,135,57,51,20,58,200,141,75,131,28,107,57,187,82,14,+78,77,210,89,53,137,105,97,67,253,29,10,227,32,80,241,9,55,199,82,+13,17,204,121,209,152,179,220,186,5,45,202,118,251,87,93,147,244,176,32,+255,131,238,181,107,189,236,113,95,59,195,132,140,8,188,162,188,135,2,143,+129,86,58,121,132,154,26,132,181,1,35,87,159,228,232,7,244,147,136,186,+147,50,100,39,3,84,223,113,84,36,183,165,51,5,114,226,126,169,223,33,+23,184,90,179,2,169,250,244,255,173,115,177,232,91,29,28,177,246,141,142,+250,192,84,13,58,20,109,195,54,186,4,84,114,62,136,241,84,134,181,205,+214,122,40,18,236,59,142,32,228,104,103,209,130,85,213,56,61,124,110,15,+224,101,184,17,200,200,96,156,132,184,32,94,98,21,74,218,12,248,116,77,+91,50,108,15,190,10,159,52,135,144,181,179,162,194,211,106,49,42,133,63,+187,42,3,114,79,250,88,112,119,212,220,253,18,186,76,90,99,44,91,115,+74,86,107,169,78,194,48,51,89,155,98,46,104,231,37,246,237,118,109,103,+117,203,30,225,237,44,80,225,26,175,126,67,103,180,63,10,12,71,213,177,+198,109,110,216,69,242,208,86,255,110,80,85,158,166,72,201,217,219,71,74,+228,212,2,180,45,24,233,208,184,202,96,53,45,39,254,132,92,147,114,246,+161,102,184,36,183,144,51,50,45,185,244,245,37,28,210,180,68,253,100,73,+198,118,74,51,119,90,142,129,219,248,145,51,117,165,191,124,113,93,221,84,+3,175,89,199,246,139,35,216,112,193,136,247,212,106,234,170,12,206,5,21,+72,71,162,225,181,186,99,136,19,103,85,18,113,245,180,144,48,0,7,5,+166,183,173,56,146,137,49,34,230,177,114,252,73,128,15,247,133,125,83,21,+75,180,252,248,0,33,138,151,188,221,84,176,117,1,194,167,184,49,130,190,+20,119,1,187,254,149,243,250,164,110,53,59,151,165,198,87,191,119,216,49,+254,81,99,156,158,135,154,58,104,65,17,93,66,128,148,175,130,113,35,167,+39,1,200,180,214,55,192,169,22,65,75,112,108,253,150,196,37,47,219,183,+165,109,123,59,203,36,230,28,235,139,109,46,122,117,156,116,21,100,183,214,+45,198,182,35,173,138,191,52,92,7,88,209,236,170,23,143,206,54,224,32,+160,241,16,237,15,212,114,94,7,249,27,47,9,19,39,186,84,160,212,220,+171,229,138,201,135,243,161,147,111,167,161,122,136,2,42,149,29,45,9,180,+246,53,108,110,63,106,106,82,9,161,81,150,106,228,88,87,86,30,154,127,+25,132,17,242,5,210,42,111,9,194,204,136,108,17,216,25,194,253,73,127,+52,84,110,108,210,184,97,19,253,31,94,173,119,161,127,32,180,84,204,166,+189,97,154,130,105,214,237,63,14,102,237,87,99,164,10,56,194,229,97,68,+24,71,36,227,21,226,128,186,141,108,180,109,29,223,179,88,177,251,78,48,+89,189,106,89,185,149,196,76,21,192,227,81,108,29,211,84,130,232,161,130,+179,143,204,83,27,42,33,191,46,10,225,235,160,103,52,52,112,159,114,15,+223,76,41,167,228,240,124,213,63,64,65,138,8,187,64,1,56,184,193,144,+99,9,127,142,133,253,86,177,110,166,201,221,127,65,151,103,156,164,168,195,+180,141,23,24,178,79,10,38,28,112,131,81,223,231,203,125,181,204,218,60,+101,3,170,242,237,245,80,31,182,253,255,158,78,36,139,235,232,142,240,82,+148,125,53,137,198,0,29,41,13,176,69,184,151,137,178,93,67,12,167,239,+191,112,216,118,54,193,247,151,43,29,206,93,33,113,157,250,205,225,246,58,+96,150,143,69,221,48,226,201,125,196,194,89,120,233,163,92,248,233,167,175,+0,16,240,72,208,38,68,13,248,201,128,200,148,225,111,44,167,17,217,172,+44,36,16,85,152,81,179,82,116,126,216,231,144,210,85,133,63,153,147,142,+77,231,170,185,133,113,117,183,172,185,136,64,24,226,160,75,151,99,149,200,+235,171,69,239,7,39,215,238,141,159,228,101,69,241,249,52,176,108,238,127,+50,55,89,180,187,43,114,163,13,65,246,70,209,186,118,205,185,197,215,255,+215,1,68,88,108,227,142,60,17,112,71,115,78,49,241,156,6,38,53,2,+113,16,85,209,206,0,164,242,170,60,76,228,195,233,106,219,44,162,158,184,+72,158,197,241,112,168,153,143,49,20,162,92,162,170,153,23,250,194,127,110,+40,208,42,109,220,53,123,22,61,252,210,0,0,158,227,208,220,248,189,152,+144,235,164,126,211,223,79,137,231,243,222,232,177,24,109,206,16,247,104,146,+252,156,50,206,13,68,11,1,20,216,208,76,93,0,254,47,167,34,210,31,+12,239,31,234,232,32,143,131,49,232,59,16,49,196,196,212,83,121,120,75,+93,170,90,240,37,115,197,79,52,95,204,23,174,164,237,169,200,161,58,207,+179,78,71,103,205,163,198,106,100,164,132,48,79,36,224,240,193,249,163,146,+6,45,11,101,210,248,13,81,105,233,72,223,172,142,5,13,32,198,112,140,+209,109,155,66,246,175,17,242,147,251,174,14,211,251,31,169,224,46,15,51,+199,199,172,152,25,251,7,224,38,245,145,202,176,82,123,218,176,187,197,230,+234,103,234,175,164,207,18,175,218,246,119,242,8,78,248,200,159,113,92,59,+188,92,16,154,254,76,197,219,8,60,143,47,149,184,79,154,207,148,30,130,+72,193,164,210,138,69,34,39,137,192,4,62,182,235,230,215,228,40,189,206,+1,4,77,104,1,26,175,60,104,159,147,126,112,205,128,226,185,81,10,148,+128,123,230,87,50,62,218,116,176,235,69,33,56,172,8,49,191,253,147,157,+102,212,176,206,134,137,234,108,119,33,170,193,81,157,1,2,104,33,60,76,+31,102,121,97,112,208,68,33,204,47,207,155,244,162,224,121,81,132,232,127,+215,120,142,149,201,7,163,174,223,50,97,105,235,113,7,244,109,126,7,202,+16,65,115,124,65,2,181,172,184,137,240,102,234,245,59,82,93,254,153,71,+186,18,211,129,182,91,107,251,70,35,105,148,129,178,227,57,3,178,57,45,+254,15,75,5,214,14,99,91,255,29,35,8,139,232,156,44,138,218,59,203,+46,101,97,143,231,133,124,44,143,94,163,116,147,32,163,145,78,19,116,134,+197,227,58,238,110,17,8,88,47,94,44,22,0,173,190,167,207,160,204,12,+47,157,46,252,180,104,117,171,80,221,245,210,59,213,181,244,103,181,121,228,+70,91,35,246,130,19,234,60,73,56,57,241,185,153,192,87,31,238,202,45,+79,7,52,128,182,138,207,195,76,199,203,230,227,223,148,185,138,119,222,94,+38,215,202,161,142,142,145,2,96,228,135,0,187,49,116,161,75,197,5,243,+202,140,25,142,158,245,249,35,136,230,144,238,219,245,42,221,4,230,63,31,+7,101,245,98,21,149,134,138,49,112,208,155,83,206,167,243,199,223,178,244,+140,241,223,97,226,181,112,212,181,160,13,254,166,57,150,127,92,187,45,210,+3,35,236,208,93,251,181,51,40,99,75,150,196,164,123,30,110,77,117,129,+111,189,158,115,215,75,61,24,133,68,200,216,17,64,244,39,232,105,216,142,+163,188,247,47,26,121,181,13,14,168,223,56,247,42,24,149,113,140,43,254,+74,255,25,35,111,194,8,252,202,39,78,165,136,45,184,233,60,190,98,30,+171,54,23,217,137,9,89,228,89,33,247,67,152,234,19,90,74,247,231,143,+194,135,101,102,87,137,140,52,146,192,89,143,22,153,200,75,148,217,72,83,+41,136,98,77,55,82,210,93,24,211,250,52,41,230,224,238,227,121,5,38,+220,60,168,236,49,248,56,112,183,61,34,151,253,203,168,139,165,169,194,119,+174,20,35,150,135,195,118,197,62,104,107,233,205,154,15,68,54,250,28,86,+127,93,219,52,167,82,16,112,33,57,187,252,245,19,184,52,214,56,101,17,+68,198,213,219,220,105,12,232,213,36,249,221,11,227,79,27,155,66,43,48,+150,103,205,136,52,5,0,97,144,21,191,88,63,203,25,251,45,141,205,183,+118,168,252,144,70,72,16,32,208,200,160,100,95,134,17,154,85,103,54,154,+87,9,9,89,223,191,102,206,188,86,99,167,199,225,241,174,48,84,154,135,+57,213,204,129,85,24,5,171,179,11,78,68,151,198,68,24,191,254,115,165,+160,55,154,190,199,21,218,252,78,117,131,237,239,140,144,218,152,241,86,31,+233,75,173,44,55,80,142,188,55,201,21,104,217,248,94,55,158,150,200,104,+194,144,6,226,241,55,12,25,180,114,152,146,98,170,211,232,213,180,216,200,+105,92,22,50,232,138,93,241,42,159,128,167,186,128,59,165,150,130,180,40,+29,59,78,241,136,56,175,63,32,175,210,205,27,124,86,180,200,233,61,177,+211,165,42,32,86,191,249,227,171,130,181,253,226,233,217,126,112,200,72,56,+44,189,170,111,168,40,104,190,9,243,90,94,200,211,12,234,54,57,29,21,+93,236,17,76,47,129,110,20,105,82,96,84,202,80,33,215,177,116,53,173,+106,124,61,96,251,48,45,38,147,116,150,41,220,247,123,152,183,12,92,237,+31,3,46,216,246,145,127,176,243,14,212,171,19,217,146,210,13,68,213,156,+94,78,153,17,167,39,77,3,212,68,147,181,226,240,148,224,141,252,111,162,+15,112,213,124,131,140,19,234,191,0,153,29,148,228,162,109,67,230,147,116,+116,151,121,237,211,7,148,34,74,240,249,119,28,131,121,196,103,50,207,205,+22,21,89,39,251,186,149,196,213,112,70,111,228,113,46,125,224,159,248,237,+31,53,189,55,211,229,5,136,110,241,28,0,127,194,181,17,193,82,230,148,+26,91,244,17,64,128,226,36,169,120,78,242,119,17,141,217,71,31,207,207,+51,12,199,183,12,190,102,96,174,158,203,105,220,157,171,119,138,87,156,213,+222,190,95,32,153,88,218,51,144,255,229,217,166,172,132,85,163,77,107,114,+151,98,108,115,202,227,194,213,37,209,44,130,183,133,57,72,108,195,21,115,+30,223,160,65,206,193,112,83,27,160,234,199,59,210,142,200,123,102,193,17,+140,110,130,69,191,19,185,64,132,130,177,251,108,30,255,196,174,59,114,137,+135,132,252,181,41,54,157,105,230,14,187,36,153,15,133,163,241,39,68,231,+48,190,26,149,238,222,22,195,104,203,89,225,0,52,16,55,66,156,83,44,+71,5,50,173,175,254,234,194,199,99,21,112,227,159,202,217,172,37,113,98,+51,38,205,202,231,97,16,159,1,83,77,48,217,148,185,229,154,255,6,78,+122,136,107,122,209,175,74,81,166,207,150,178,137,116,184,203,46,114,191,114,+134,255,225,238,191,65,87,253,240,166,156,45,3,178,105,161,164,140,147,52,+193,44,228,44,87,85,146,105,111,9,116,135,183,155,200,13,204,101,3,226,+20,45,134,219,72,179,160,43,203,222,153,177,44,203,101,104,191,252,246,245,+249,23,249,144,200,2,15,171,36,198,148,81,182,154,51,62,97,176,160,207,+49,59,104,2,228,158,129,192,58,49,96,24,3,127,68,22,171,169,152,149,+150,213,230,132,61,126,168,157,241,247,234,189,39,136,198,1,93,120,167,92,+199,202,204,39,79,180,61,213,150,211,75,131,205,47,118,64,26,96,111,45,+227,205,52,193,107,200,232,110,89,103,61,190,34,5,73,153,0,176,39,126,+95,62,143,175,143,159,128,161,32,149,102,11,11,62,234,161,108,53,184,204,+83,6,26,164,163,157,49,232,144,38,86,211,200,201,248,238,184,111,255,165,+246,230,242,99,23,213,205,249,130,244,27,111,120,56,113,38,140,0,67,41,+162,181,89,68,42,127,6,179,46,191,141,149,38,173,122,225,248,44,5,247,+187,239,18,7,223,164,214,162,164,73,71,181,39,31,73,220,211,37,102,109,+41,22,54,141,50,194,105,226,85,80,94,128,74,169,44,13,164,235,74,179,+118,237,238,58,221,195,164,80,171,62,40,139,246,228,21,191,38,51,2,208,+8,255,115,208,141,158,194,119,166,231,116,13,45,27,192,212,93,120,149,190,+53,63,226,206,135,108,22,2,82,34,162,55,199,155,183,204,45,70,124,120,+215,181,147,32,150,98,76,24,227,222,143,216,67,167,238,189,163,100,44,33,+164,91,245,203,254,220,29,234,234,202,87,149,24,251,62,135,132,246,225,184,+140,119,231,154,61,204,202,199,98,250,211,159,184,254,153,168,136,217,37,52,+15,89,140,227,91,187,74,136,99,170,60,10,182,64,20,6,229,46,50,47,+164,174,131,3,107,198,199,67,10,37,235,128,6,238,199,230,183,198,143,15,+86,166,169,16,154,174,195,254,45,62,40,103,30,2,102,1,193,66,175,229,+155,8,255,123,133,102,236,209,35,222,122,155,63,149,126,141,83,215,53,144,+173,14,199,79,118,117,34,208,241,221,226,242,77,73,110,95,165,93,145,32,+210,105,142,210,48,29,238,141,49,107,56,172,153,184,179,35,162,235,250,252,+241,200,241,44,197,212,15,22,188,157,183,94,120,226,196,86,148,232,79,208,+206,75,135,161,40,188,77,240,66,178,177,37,49,48,6,175,117,95,188,113,+50,244,37,239,4,62,172,28,80,16,77,170,228,72,121,58,107,104,182,225,+53,157,49,75,204,18,10,67,177,24,142,217,112,225,127,190,68,42,159,199,+71,172,95,94,75,101,103,26,18,41,63,59,121,43,58,170,222,161,255,61,+222,230,36,141,33,195,244,115,207,213,115,123,175,181,20,133,18,171,29,254,+170,248,247,105,251,244,135,157,200,37,225,129,123,199,167,153,154,174,194,236,+5,211,255,222,86,148,142,67,128,29,173,39,165,148,214,144,196,62,17,67,+131,46,150,204,55,6,12,181,61,194,152,9,154,132,28,23,28,56,103,89,+184,138,243,242,10,94,143,155,253,166,211,48,148,246,14,19,42,62,176,73,+244,87,162,248,124,176,149,208,215,20,43,72,200,174,217,148,54,239,114,179,+46,177,66,87,73,128,130,227,93,151,94,129,131,68,138,241,171,43,41,33,+187,193,50,89,82,108,192,233,137,29,59,24,88,4,126,88,184,243,205,132,+51,34,217,221,16,240,16,99,131,192,52,56,84,55,54,42,225,166,93,151,+198,227,8,218,74,172,254,78,50,61,31,206,141,67,183,103,201,151,193,83,+62,9,202,248,231,36,75,46,134,113,84,191,245,109,179,99,159,107,102,231,+236,232,30,35,62,49,222,150,145,198,196,108,130,76,59,59,110,139,240,117,+26,92,241,111,163,247,62,69,214,55,111,9,193,194,142,103,112,196,190,32,+101,74,130,36,156,99,160,0,65,8,221,107,31,176,205,57,115,15,25,81,+67,108,34,155,210,40,137,145,232,231,240,89,101,77,134,119,64,88,115,44,+186,214,156,209,195,49,103,169,65,225,146,39,67,64,18,22,175,250,85,243,+101,230,82,65,152,121,199,252,74,46,131,90,149,77,226,183,28,70,162,57,+223,149,188,21,215,84,6,64,50,57,25,226,167,37,113,123,65,27,233,201,+164,207,185,241,117,186,118,34,53,120,249,47,112,89,225,140,85,164,61,124,+83,42,39,23,149,88,113,124,193,130,11,217,223,37,127,112,183,75,47,98,+115,131,237,200,61,88,202,100,16,159,100,87,106,35,169,127,170,165,86,106,+178,91,11,228,118,209,14,108,103,121,84,170,10,234,153,228,65,173,140,224,+231,23,128,79,52,27,68,3,93,239,166,240,64,185,94,228,70,24,83,232,+183,30,80,131,138,230,104,134,196,193,246,99,60,91,0,122,172,25,254,56,+68,161,235,213,246,165,208,202,61,170,248,175,54,147,181,137,17,119,132,150,+135,222,157,187,29,118,25,176,140,187,92,251,62,164,200,79,40,119,98,149,+204,182,171,185,221,226,219,199,52,166,67,11,157,183,139,13,114,177,89,40,+40,236,252,50,200,96,240,109,30,16,96,112,184,98,189,37,118,37,198,129,+13,30,241,103,247,217,92,212,169,210,249,29,134,181,98,252,38,127,218,230,+104,210,152,160,242,108,244,193,200,103,222,27,155,10,189,144,0,129,18,48,+68,0,170,247,118,98,75,85,91,23,166,110,75,164,26,212,254,176,235,67,+225,238,29,222,16,120,220,253,171,121,36,128,158,1,80,38,141,42,115,143,+12,205,82,70,177,138,197,42,129,201,105,242,87,180,215,85,40,118,60,182,+121,102,85,191,19,212,18,26,71,34,246,120,129,21,169,248,254,158,83,0,+139,14,88,197,177,156,20,239,13,213,120,174,160,2,29,37,191,133,45,106,+105,77,177,148,216,78,23,146,28,151,165,96,241,116,93,188,244,143,118,191,+189,70,217,92,215,106,151,18,213,156,231,19,167,207,21,146,116,232,128,57,+113,126,22,2,173,225,191,243,104,74,206,19,42,14,133,249,173,61,130,225,+94,194,70,240,187,86,134,163,107,196,63,111,167,255,93,6,103,248,219,251,+215,50,162,35,139,227,80,92,201,45,19,230,195,221,33,49,54,170,109,139,+106,142,108,126,56,123,171,96,111,4,237,104,242,37,168,132,112,22,220,192,+162,99,163,241,110,162,103,116,57,80,130,222,5,93,106,90,39,136,197,183,+180,112,195,183,126,132,226,225,6,42,197,141,54,88,193,179,190,246,22,184,+10,61,187,158,88,195,185,140,171,23,141,145,91,6,20,83,170,170,216,145,+226,24,62,35,153,60,49,140,22,98,141,140,9,10,14,123,92,95,84,117,+138,142,18,109,17,179,166,160,54,57,32,187,213,27,113,224,96,154,218,136,+26,125,117,156,254,133,197,148,56,80,117,192,112,63,213,211,25,95,159,11,+160,93,81,214,32,19,135,132,192,252,149,111,31,137,27,193,73,135,53,225,+78,198,164,37,63,177,54,14,17,142,139,144,145,158,19,114,158,57,195,118,+242,81,80,193,167,170,154,43,16,80,130,124,110,244,140,246,125,140,90,109,+215,239,167,218,59,149,99,36,115,160,96,150,113,37,93,246,158,94,142,243,+3,118,109,232,224,124,26,153,105,131,151,117,37,166,115,123,6,12,102,174,+68,46,82,39,129,80,205,37,96,197,0,67,61,89,205,176,117,201,92,46,+231,98,189,112,245,96,53,249,151,1,248,240,27,194,172,227,47,104,11,105,+42,198,145,147,238,71,88,119,123,74,104,109,70,206,215,165,26,119,24,9,+93,200,74,10,31,73,0,186,81,43,155,233,128,36,247,172,26,173,36,255,+210,236,16,5,144,191,233,207,155,197,14,164,145,136,221,249,212,165,240,74,+159,178,137,120,251,238,244,18,247,230,28,225,160,174,253,61,15,134,80,192,+165,34,186,216,77,100,32,18,76,72,150,16,163,71,178,171,8,233,134,104,+170,32,69,19,105,189,216,1,93,54,67,160,241,187,60,133,87,47,112,84,+202,125,89,169,179,188,203,195,28,168,54,47,233,207,186,232,147,5,177,172,+74,11,85,234,125,131,183,190,4,23,166,223,12,255,191,89,148,242,107,163,+127,162,85,58,110,77,146,125,160,2,9,72,18,43,154,130,240,249,136,55,+237,47,253,197,89,24,160,233,97,52,250,222,251,194,172,26,222,213,33,165,+111,196,183,14,113,27,241,126,159,230,203,115,39,208,78,181,72,163,107,90,+164,253,73,224,224,209,191,184,245,173,180,111,129,129,88,148,227,235,198,8,+21,74,117,4,12,40,65,102,156,235,241,69,78,11,53,169,182,88,209,140,+89,99,242,48,46,208,121,132,149,100,105,246,150,236,86,110,39,45,66,177,+23,178,155,41,196,157,20,159,202,223,195,159,205,169,188,138,86,36,47,93,+19,144,163,127,246,62,24,217,170,170,57,240,178,226,1,179,77,45,254,121,+64,63,12,126,4,104,197,21,106,219,84,1,53,183,37,127,169,218,148,12,+99,5,49,70,215,69,110,2,38,232,76,219,250,91,184,88,199,180,147,174,+211,172,4,152,88,185,192,243,185,7,197,196,161,101,236,178,146,241,233,184,+105,132,238,231,133,216,174,98,27,253,140,237,181,175,84,10,136,58,62,33,+110,159,68,148,52,5,41,125,56,5,10,61,185,35,34,118,54,142,112,57,+209,20,153,37,206,170,53,81,5,190,170,69,228,153,30,206,236,216,182,222,+36,39,220,167,122,212,170,158,218,152,204,168,90,126,152,203,104,204,27,87,+216,128,167,136,235,172,180,233,16,148,89,149,133,214,187,77,58,92,252,63,+86,148,175,167,68,48,1,246,96,114,246,27,172,3,6,120,58,21,213,73,+71,194,163,111,196,175,25,171,116,178,169,248,189,44,14,10,208,1,29,152,+239,87,7,102,207,72,213,186,204,154,130,30,181,82,161,66,176,9,110,100,+238,81,232,170,227,42,120,241,117,38,84,128,183,245,198,196,122,175,94,55,+109,178,84,156,226,190,192,95,106,41,76,113,233,30,235,231,129,44,172,84,+58,79,24,211,220,92,194,149,33,148,238,35,247,189,91,105,26,63,89,41,+204,253,211,132,229,26,107,118,210,227,5,162,250,208,125,50,186,147,201,42,+251,49,150,233,170,243,141,235,36,208,237,159,131,17,200,17,37,40,122,139,+8,246,244,102,16,184,137,63,93,203,149,80,157,177,175,254,41,144,145,148,+64,160,122,5,33,10,249,93,117,213,226,185,47,248,225,221,84,11,37,85,+133,214,156,131,173,87,82,185,217,193,210,184,153,31,80,43,204,201,142,11,+178,64,251,244,72,210,31,156,215,44,79,19,143,143,141,223,49,217,72,175,+121,129,144,179,140,167,218,190,99,98,181,237,45,37,250,86,159,150,97,255,+239,234,45,152,137,231,224,205,197,82,186,9,162,24,35,171,146,132,34,105,+249,68,199,59,74,130,97,239,80,122,224,15,236,131,230,20,173,244,251,59,+96,39,176,184,5,12,2,198,110,101,82,43,153,41,58,80,41,174,156,127,+10,66,122,80,21,155,229,95,26,240,117,10,47,159,6,226,35,197,195,121,+101,204,220,162,108,37,8,250,211,145,218,247,244,70,172,36,174,68,0,234,+106,231,69,116,206,129,187,74,146,207,20,20,192,124,191,129,55,44,49,66,+79,70,117,173,246,180,179,140,113,159,74,76,227,207,125,107,199,111,150,169,+226,39,223,85,126,253,228,232,206,132,203,153,53,27,190,114,142,228,9,65,+1,79,28,55,249,205,222,32,246,244,106,184,111,53,219,247,36,101,207,103,+54,52,172,146,40,110,45,63,73,133,237,29,17,160,79,37,55,181,125,184,+185,87,124,5,234,115,145,172,2,31,98,135,187,232,54,237,163,175,157,64,+165,42,119,113,126,92,21,27,15,185,94,29,13,227,91,73,228,120,237,71,+11,122,218,42,84,194,165,125,135,87,139,180,134,176,135,7,84,243,78,208,+85,238,236,206,119,192,181,1,243,185,104,171,6,51,166,3,201,80,16,5,+2,220,232,94,126,48,136,117,131,169,190,127,185,119,63,179,2,195,35,99,+179,22,59,83,124,245,140,55,167,18,249,169,90,206,192,67,73,212,205,201,+203,138,244,27,250,42,11,159,178,176,169,91,94,113,68,226,220,30,178,206,+219,193,213,47,164,43,22,244,16,75,251,15,97,217,241,26,71,124,140,189,+170,95,223,67,57,158,28,222,233,91,159,238,105,101,24,213,83,195,90,13,+242,2,27,202,62,197,51,4,203,85,167,146,2,228,146,129,80,239,154,120,+78,133,220,201,254,177,146,244,114,143,172,91,199,178,26,238,122,189,112,236,+10,57,24,29,113,248,74,195,137,92,16,27,242,150,125,247,202,230,207,197,+116,162,245,248,148,244,180,100,147,92,118,131,249,15,136,89,4,160,70,149,+201,244,201,175,36,182,172,39,227,27,205,247,191,30,14,9,224,69,64,178,+12,100,241,54,185,106,77,254,110,150,227,119,222,147,223,157,160,194,13,181,+28,4,59,156,60,135,96,249,232,123,224,147,30,173,250,52,183,226,130,77,+238,29,146,229,13,248,231,64,30,239,108,255,172,215,228,166,145,55,111,100,+88,86,57,88,110,198,216,219,231,55,141,66,59,64,223,52,173,130,178,199,+165,210,76,172,123,161,16,205,174,73,89,235,15,185,212,215,112,49,232,176,+169,199,132,218,141,29,248,58,26,69,237,249,40,69,59,29,132,121,132,152,+142,18,103,25,219,23,241,44,128,18,132,160,213,121,35,224,78,139,157,250,+188,218,35,214,41,71,30,27,80,47,29,214,133,88,162,38,57,132,45,54,+242,44,13,230,135,149,24,152,18,129,59,190,122,175,104,9,165,37,200,71,+5,82,54,179,216,245,143,12,65,196,0,126,115,71,63,199,168,136,168,171,+235,210,60,160,230,2,179,209,138,215,178,77,160,5,26,196,252,196,103,216,+93,10,90,73,160,237,40,63,87,138,227,140,57,110,126,246,254,74,213,9,+252,137,212,151,48,110,178,222,171,127,169,228,111,26,21,120,238,86,188,246,+176,44,122,252,203,7,162,8,202,16,80,182,38,30,122,40,144,92,40,121,+82,112,120,112,15,225,22,97,199,198,125,12,142,91,82,56,57,10,104,195,+54,148,230,188,168,29,185,213,147,66,59,109,236,21,41,118,28,135,236,187,+225,20,2,26,164,255,199,234,149,60,157,247,177,120,254,212,81,99,106,228,+192,219,65,215,231,54,193,196,186,170,182,191,12,64,192,72,247,220,16,224,+167,226,12,96,3,75,0,206,38,164,148,137,28,216,246,108,72,183,133,149,+138,88,0,8,101,93,233,34,221,111,254,104,209,167,234,95,33,114,139,202,+170,134,136,121,194,206,8,7,61,67,209,123,117,133,58,66,64,143,141,93,+177,198,98,181,165,70,58,102,250,29,142,90,164,169,228,30,159,13,172,58,+15,14,43,163,181,221,74,156,161,238,187,193,231,5,86,149,137,70,212,19,+250,52,120,68,72,105,107,159,93,232,242,224,160,206,59,20,251,147,176,140,+2,139,221,158,189,30,67,187,238,185,17,237,217,27,210,146,225,46,68,97,+250,10,162,234,178,14,174,62,167,98,75,124,100,158,33,45,163,190,77,227,+11,150,40,160,200,59,130,123,175,63,159,110,111,70,22,69,133,196,171,173,+13,96,15,169,158,87,137,77,29,102,61,10,233,137,98,176,217,157,177,61,+29,209,72,61,85,93,25,132,189,54,102,43,122,56,196,82,91,42,61,61,+160,0,73,38,220,162,242,243,189,237,60,143,143,68,170,184,119,120,151,211,+55,218,149,150,144,35,158,108,246,115,124,31,5,129,44,161,187,101,249,243,+249,121,33,87,165,37,157,254,81,133,11,130,165,143,133,180,193,54,197,148,+141,137,0,64,169,176,221,84,53,254,137,134,247,91,86,153,163,128,216,38,+129,68,38,135,210,21,218,93,94,193,78,224,82,67,1,115,202,95,67,63,+220,78,57,123,194,14,229,108,170,38,206,140,91,163,218,73,13,162,96,63,+139,225,237,205,67,86,52,129,143,100,184,227,22,221,121,21,101,36,141,29,+233,79,89,57,120,238,150,10,104,130,22,161,34,140,145,216,146,191,139,10,+184,132,72,213,126,230,100,236,49,147,80,18,20,232,230,21,13,20,53,205,+155,30,25,100,4,172,48,193,225,35,119,151,227,248,109,142,89,76,19,80,+200,42,213,149,69,120,185,134,234,76,179,224,126,137,44,169,1,110,106,218,+234,195,26,126,199,249,84,13,145,114,176,75,233,127,114,54,10,106,217,192,+207,83,177,13,195,113,221,31,210,109,121,218,130,174,203,220,73,236,19,117,+98,132,26,220,92,129,143,163,240,204,193,72,253,112,138,166,244,61,196,111,+87,194,144,104,205,113,34,5,60,186,78,185,41,46,153,111,62,174,85,16,+216,12,25,9,157,132,163,230,172,157,15,20,195,121,5,255,46,181,20,241,+226,26,106,210,107,176,122,111,13,61,22,51,126,84,251,63,94,102,52,174,+172,181,241,180,204,238,177,47,111,211,167,8,96,31,173,57,132,24,3,181,+28,91,179,116,114,125,52,111,9,191,156,44,166,130,163,9,114,70,95,91,+8,42,93,185,39,180,180,94,212,245,92,27,30,117,88,129,8,158,12,232,+195,208,4,121,206,244,191,144,255,104,23,132,219,151,162,194,119,152,15,208,+8,107,2,183,1,25,64,123,227,167,77,64,4,76,81,152,65,131,168,128,+192,19,123,22,58,26,140,248,113,103,70,103,194,56,74,11,249,160,78,211,+175,151,192,62,84,77,122,195,206,215,161,109,54,49,194,76,32,117,216,47,+50,110,18,193,132,61,160,168,98,125,93,232,61,34,6,11,112,72,82,123,+86,124,242,98,82,201,26,80,144,97,90,3,195,135,192,39,93,175,112,95,+15,180,63,161,216,189,199,40,187,52,110,61,106,107,211,1,213,250,41,4,+61,26,134,133,141,69,225,14,105,198,67,238,209,49,69,59,221,66,175,243,+90,149,132,246,246,232,199,229,210,208,117,195,21,23,89,46,67,253,85,92,+38,112,135,120,162,16,5,191,122,25,32,84,212,229,22,9,216,244,189,82,+99,87,64,69,233,168,214,95,241,89,78,9,215,35,105,7,16,135,138,35,+101,198,35,64,114,23,69,84,211,122,172,233,249,250,186,44,62,42,81,161,+129,187,206,249,138,98,145,108,133,65,132,137,86,74,105,99,73,156,110,250,+196,231,242,49,177,30,255,232,255,1,249,117,252,103,112,45,17,218,83,22,+167,234,255,56,246,120,105,232,203,121,130,188,195,130,204,102,231,134,212,95,+230,52,86,212,170,225,128,203,55,78,6,93,205,191,76,79,16,68,240,0,+59,156,179,82,95,46,230,216,20,204,109,127,181,215,66,29,158,53,171,92,+160,101,198,175,62,250,229,64,182,114,240,91,169,90,197,220,78,62,238,96,+101,248,39,9,235,4,208,250,1,165,5,169,183,132,191,33,16,26,80,120,+202,50,199,35,61,249,91,5,183,126,33,188,112,244,16,41,159,35,76,233,+19,56,246,236,18,96,104,212,211,203,51,34,173,100,191,117,226,49,53,245,+17,67,49,211,162,174,198,32,194,37,234,189,132,79,201,121,136,129,230,72,+33,6,248,35,224,31,175,184,158,212,14,128,42,156,128,105,14,105,215,142,+52,54,52,71,126,170,204,57,194,90,95,96,134,106,140,217,183,229,201,30,+152,79,208,88,238,168,151,217,147,136,43,206,201,64,110,191,121,228,88,154,+21,154,58,200,137,133,215,217,21,84,114,147,90,113,50,99,251,5,124,44,+63,227,254,35,141,4,233,214,53,13,91,103,210,33,119,34,4,30,129,202,+102,60,32,140,163,48,64,203,47,201,33,52,165,79,251,146,255,23,33,162,+2,217,179,188,207,21,7,118,119,85,74,255,132,21,10,149,182,184,120,252,+115,186,79,175,148,2,154,186,11,167,127,177,37,46,131,38,170,50,162,20,+10,58,103,5,70,46,241,119,158,56,60,195,186,26,142,214,196,139,238,21,+211,120,32,207,59,132,53,146,40,225,174,43,114,78,238,207,58,70,249,190,+31,129,247,214,188,62,145,36,209,101,155,92,9,19,40,39,61,184,142,197,+64,177,22,85,233,87,191,74,251,45,132,176,81,191,127,122,192,157,8,41,+147,133,144,157,119,41,52,234,63,15,185,76,68,37,55,84,226,108,201,238,+29,128,154,67,95,20,193,132,202,119,11,54,158,238,102,106,112,182,237,246,+219,75,59,133,216,219,147,200,248,234,192,208,150,127,120,226,244,243,10,30,+59,194,3,50,242,243,76,50,43,167,19,220,39,238,138,234,60,250,217,123,+114,29,20,229,159,88,3,229,233,88,101,118,194,192,31,77,194,175,14,234,+183,10,109,193,225,126,132,35,175,2,247,86,71,94,14,188,161,39,86,51,+145,69,239,72,239,44,88,231,209,51,238,27,124,142,42,132,82,54,245,115,+85,233,95,137,64,123,7,219,230,58,122,223,249,33,73,201,41,96,21,92,+212,135,19,29,38,13,38,28,31,253,31,172,184,151,136,181,236,108,253,216,+44,84,218,165,143,248,80,234,10,117,43,84,244,73,64,117,56,79,20,101,+149,68,207,66,14,44,161,193,41,158,36,77,203,79,54,34,106,172,18,214,+119,158,140,165,182,13,156,213,247,193,28,135,28,108,0,221,68,234,93,134,+13,253,213,131,131,73,239,42,38,220,161,157,22,94,87,236,134,160,154,4,+241,235,216,166,243,202,153,115,148,9,181,79,131,215,187,197,6,104,157,175,+180,111,177,201,124,26,143,42,0,95,93,4,252,77,193,75,163,248,88,166,+98,61,204,80,98,193,82,11,151,211,9,119,2,168,107,51,91,166,186,23,+79,145,54,249,243,92,243,9,7,41,100,4,235,121,213,2,247,17,254,224,+174,164,78,137,21,147,51,239,128,237,110,68,14,208,232,56,130,113,85,3,+103,158,177,240,44,192,230,241,67,63,36,219,72,197,175,169,195,59,243,79,+24,188,71,196,179,73,121,25,214,69,80,80,244,68,167,77,231,250,190,51,+25,74,34,116,142,104,166,182,68,5,73,20,116,144,185,15,8,28,25,5,+209,200,203,125,230,240,30,195,147,231,223,208,14,212,217,187,11,157,163,239,+46,42,67,72,128,220,18,11,217,84,173,126,190,181,205,46,70,80,192,103,+241,63,37,248,110,34,21,254,52,195,18,103,151,227,175,99,189,196,211,140,+38,22,98,54,136,249,60,17,46,221,99,190,12,190,154,131,51,68,125,27,+59,136,253,27,126,223,139,209,100,165,199,92,65,244,124,27,88,124,191,181,+233,232,229,141,55,75,191,169,160,196,37,94,34,183,85,42,198,73,46,141,+129,220,32,20,58,30,201,87,215,223,50,116,80,97,142,234,104,19,80,11,+20,4,72,145,89,43,14,88,170,181,232,83,247,52,164,54,236,148,192,32,+177,213,98,199,29,162,196,190,11,75,35,173,173,121,214,191,249,203,22,69,+115,162,133,163,112,254,17,74,115,123,105,130,224,52,129,252,122,239,215,192,+214,201,232,103,233,177,223,125,81,48,243,163,105,26,51,78,120,62,97,135,+183,67,205,31,150,239,32,128,127,177,156,19,183,136,22,146,45,250,23,125,+119,232,190,86,205,45,251,255,126,241,52,186,221,42,128,230,115,182,151,72,+153,234,15,220,111,215,217,33,35,137,89,117,238,24,131,28,18,38,131,55,+140,51,188,40,248,86,158,88,1,88,19,100,250,111,151,82,60,139,49,127,+133,50,55,4,187,197,35,175,34,18,169,138,1,33,156,159,214,252,229,120,+37,133,104,237,198,35,252,12,247,74,69,173,130,171,178,244,38,121,76,135,+253,79,186,179,125,220,123,177,5,81,4,245,172,205,172,253,178,231,239,49,+12,99,209,146,251,232,98,72,5,225,217,190,126,113,231,89,110,72,112,101,+248,64,186,86,47,36,59,95,202,158,91,154,49,119,180,85,36,234,215,49,+181,99,61,124,120,116,243,202,245,61,36,164,195,52,169,68,13,17,232,228,+66,235,17,82,96,100,115,104,116,201,58,216,215,232,8,235,107,69,205,46,+29,191,120,188,124,95,152,195,209,114,197,17,98,33,127,36,226,235,115,163,+171,244,157,2,203,86,74,77,244,218,208,138,174,94,167,152,172,11,98,92,+208,204,125,68,181,112,203,116,163,14,109,209,83,94,139,125,253,140,202,192,+44,233,151,128,53,11,96,34,199,133,104,66,193,69,88,33,199,185,72,170,+149,133,170,227,250,200,232,87,217,87,196,31,89,56,184,24,44,220,154,247,+132,62,255,210,218,227,233,133,232,10,158,84,108,190,41,19,132,22,139,113,+37,156,219,217,134,57,54,51,246,115,204,227,151,3,233,197,33,59,42,240,+253,79,207,26,209,2,230,123,185,62,9,1,121,117,124,168,98,133,247,145,+183,164,106,35,38,97,246,138,8,224,209,2,62,64,98,88,0,133,99,153,+251,201,18,131,49,44,54,97,197,84,86,121,19,200,216,37,248,92,242,137,+51,116,53,42,51,144,165,115,214,223,140,70,225,209,82,115,41,190,84,235,+31,205,255,217,15,17,231,57,183,91,103,132,142,63,8,59,209,245,51,120,+98,170,67,35,198,83,77,60,127,116,122,249,80,169,141,10,112,248,85,128,+21,141,250,87,169,3,60,213,19,105,138,105,187,114,44,187,220,35,237,208,+194,53,132,60,90,108,23,127,52,44,15,138,21,253,200,56,121,65,144,52,+229,21,143,156,169,156,25,132,163,200,117,160,250,33,50,230,131,66,189,180,+221,79,171,129,247,97,83,86,185,98,31,194,30,71,92,137,120,186,46,125,+85,198,15,3,89,181,136,155,188,174,129,240,103,250,101,27,155,147,84,139,+64,201,83,10,138,92,78,36,213,203,101,21,253,210,54,53,157,140,29,19,+18,111,157,187,109,118,234,24,92,101,185,188,97,250,180,44,34,194,63,224,+219,219,56,102,31,14,152,200,158,69,15,242,222,40,239,50,141,237,6,219,+172,241,180,74,49,180,89,218,171,169,109,102,68,215,248,128,224,35,152,128,+207,9,234,155,217,131,232,254,74,88,255,7,103,27,97,179,247,164,116,219,+250,156,137,60,128,195,31,79,33,176,45,83,120,9,30,249,63,118,162,123,+175,242,181,44,156,79,148,206,124,83,81,133,199,23,222,41,135,126,187,34,+79,109,238,213,25,174,227,52,87,31,102,181,254,24,162,192,113,100,142,117,+132,57,67,240,12,93,50,79,104,232,166,84,188,78,154,10,205,82,241,241,+104,244,100,61,208,57,247,26,103,167,157,179,9,12,224,217,216,7,120,231,+141,240,171,183,254,107,98,203,123,196,214,91,74,171,15,138,219,184,56,173,+171,168,178,135,137,210,149,169,29,129,220,97,147,103,15,21,169,111,245,153,+58,202,104,133,184,66,84,211,212,213,153,168,100,61,123,233,200,53,103,204,+64,91,224,235,60,127,153,150,129,111,128,117,67,230,122,96,235,223,171,2,+166,155,156,150,11,38,118,194,172,245,206,161,158,217,187,98,148,149,26,36,+53,20,155,178,202,79,80,133,108,203,155,159,97,206,194,102,3,39,74,214,+124,123,191,229,176,62,226,53,195,235,95,38,8,28,0,39,31,244,188,106,+119,203,125,165,206,251,135,200,45,90,191,166,133,161,189,73,244,41,158,207,+185,75,194,87,25,227,214,214,203,60,186,73,40,166,254,174,235,47,241,114,+4,224,136,209,75,120,95,16,188,13,110,216,13,146,62,76,192,71,238,121,+93,214,89,130,175,149,71,148,127,230,25,201,205,34,115,185,40,6,255,41,+120,57,123,73,219,198,150,4,252,178,207,22,202,61,210,215,58,255,148,80,+49,220,45,200,86,59,75,109,223,132,137,245,46,143,91,58,253,202,251,206,+144,241,68,79,194,50,120,231,212,50,196,251,73,231,199,149,97,180,117,253,+49,248,51,183,136,21,34,62,184,117,61,36,31,125,160,58,48,91,195,204,+73,243,127,208,0,244,136,217,80,204,204,82,31,181,89,123,26,220,142,160,+127,241,26,58,120,171,112,252,132,4,255,139,215,1,71,24,224,102,45,255,+5,136,50,131,88,243,200,3,236,97,69,10,34,136,147,227,161,177,192,33,+74,206,185,68,102,255,30,100,167,100,203,98,51,90,212,220,69,44,154,194,+72,0,249,37,19,209,94,130,122,68,144,101,12,61,62,149,0,35,81,47,+140,89,62,235,188,20,222,90,114,242,69,168,172,106,147,145,148,52,225,18,+152,14,92,170,60,126,39,4,170,30,26,20,59,199,174,37,209,240,60,26,+15,152,118,239,129,122,226,6,228,104,153,81,188,144,26,202,72,37,59,63,+166,44,218,78,142,100,35,28,86,16,224,187,30,136,218,95,79,254,90,82,+161,233,213,5,162,68,206,208,169,43,114,169,10,242,231,52,88,80,132,78,+24,56,250,105,8,7,154,101,222,111,143,79,147,157,143,32,238,195,235,92,+181,156,140,66,41,159,89,25,62,170,150,143,96,90,51,103,101,62,21,119,+144,213,52,109,45,249,144,117,241,96,50,154,110,206,100,78,82,226,112,43,+222,99,251,10,1,111,58,58,38,159,35,231,53,108,40,238,167,6,73,189,+31,37,251,212,86,127,249,59,144,36,8,149,175,12,14,166,52,172,219,84,+13,33,106,132,103,199,205,42,104,106,211,105,95,37,23,49,53,167,13,20,+83,218,141,248,189,208,95,255,10,93,104,124,188,215,209,99,81,94,17,15,+100,212,160,18,233,192,229,223,184,167,12,152,59,104,114,69,58,250,6,219,+161,57,26,199,213,51,196,222,9,74,99,36,196,236,109,31,171,146,64,10,+157,145,55,12,84,233,93,135,150,225,210,176,66,20,83,253,23,198,3,252,+238,185,45,1,133,27,134,11,85,5,24,22,231,255,145,41,59,187,80,252,+173,108,68,188,195,22,134,72,159,26,178,230,93,115,222,131,230,199,1,40,+202,40,36,244,145,63,89,253,68,18,172,244,1,146,205,176,127,210,233,249,+74,163,3,196,50,55,45,162,175,97,20,137,181,103,198,32,24,200,111,196,+237,49,189,201,183,73,141,179,30,152,67,151,158,178,100,45,132,108,53,30,+83,224,204,18,220,120,139,75,66,83,12,43,80,17,16,243,239,210,22,232,+132,40,215,108,28,21,51,211,38,10,75,83,41,241,69,28,18,93,66,57,+154,179,249,151,91,212,33,56,53,4,141,157,207,100,175,122,83,57,136,212,+50,138,180,117,61,248,17,235,13,245,139,71,49,136,200,220,167,148,113,13,+231,136,165,77,180,131,137,48,52,108,154,202,157,42,229,139,118,254,227,201,+29,187,18,215,21,28,58,193,218,182,154,249,11,52,101,179,183,247,85,77,+41,38,249,23,207,83,144,7,199,157,191,40,188,237,27,212,149,171,165,78,+253,47,171,18,241,55,5,160,208,208,63,136,10,255,211,208,59,208,150,65,+123,186,135,157,17,65,131,65,146,197,200,129,115,181,178,177,171,147,37,61,+190,18,80,88,41,180,63,76,202,35,237,167,109,153,25,40,57,178,92,166,+3,74,109,5,105,224,102,171,213,14,12,58,132,22,206,210,251,106,204,174,+166,2,71,68,194,108,112,199,148,162,166,84,8,21,186,138,57,92,116,191,+42,198,111,213,235,242,85,148,143,192,12,63,247,114,170,149,57,22,14,21,+166,139,214,2,6,99,115,129,30,142,52,106,61,240,164,57,153,234,178,27,+208,159,238,127,107,154,118,96,249,169,193,37,71,63,2,43,141,216,115,63,+1,163,199,242,102,9,25,48,102,1,88,84,47,27,147,80,96,66,210,110,+22,218,160,88,208,229,238,103,221,158,135,70,7,78,252,167,38,66,100,245,+155,250,40,24,167,240,231,239,244,203,86,220,146,75,64,29,105,131,73,249,+6,112,117,48,9,61,128,246,206,24,12,9,41,216,221,163,34,250,30,155,+118,254,229,112,57,108,2,25,131,90,54,72,234,223,234,169,116,247,56,138,+55,136,92,97,53,68,64,206,121,48,158,239,171,170,128,9,229,74,179,215,+63,26,122,177,57,123,60,39,66,230,115,64,89,40,93,152,145,68,240,1,+172,135,26,140,33,169,183,107,180,228,117,57,10,157,14,176,33,68,116,93,+54,97,248,81,220,246,211,62,9,159,102,212,146,68,246,65,19,120,192,88,+243,152,209,219,96,146,9,165,174,236,246,231,24,81,48,63,196,236,242,58,+221,208,162,160,228,163,69,188,175,217,87,255,37,138,58,186,76,145,209,80,+104,169,207,128,88,142,43,11,37,65,191,169,79,75,27,171,126,222,58,24,+251,18,255,33,255,155,228,52,19,196,177,128,206,254,168,19,104,33,249,112,+158,51,68,236,216,143,198,159,254,218,61,200,10,12,243,150,212,137,163,91,+250,119,193,145,198,111,166,122,44,66,232,12,186,81,229,115,175,94,254,213,+72,167,118,17,243,93,254,211,39,186,33,220,93,235,60,6,44,124,95,126,+187,157,133,56,162,38,103,214,93,102,139,123,134,186,235,27,137,75,126,109,+110,26,27,63,100,193,96,190,244,0,248,37,202,102,243,195,172,59,122,182,+112,58,35,37,168,161,196,112,31,212,121,151,29,101,65,164,97,249,231,136,+64,85,219,244,118,143,111,40,143,213,91,140,136,90,21,70,209,23,105,46,+238,90,150,215,143,161,65,104,55,121,99,98,108,37,221,134,254,218,224,248,+9,62,239,231,40,4,232,72,115,111,209,255,228,220,26,166,170,166,238,139,+83,244,22,123,162,104,70,47,246,158,61,157,98,150,237,12,63,45,44,187,+51,32,25,51,167,30,187,216,137,145,42,220,225,245,76,177,198,8,146,49,+74,72,26,232,220,99,5,203,188,178,184,64,251,35,207,129,76,253,50,96,+226,67,200,51,113,45,103,108,137,128,130,77,232,75,176,46,209,219,20,134,+112,28,21,105,33,134,102,138,120,120,117,181,92,202,138,127,130,175,241,165,+31,143,239,98,238,171,137,0,200,131,205,209,30,37,87,90,163,116,141,18,+36,24,51,64,118,197,173,229,109,57,129,13,54,189,80,182,23,158,111,165,+222,73,108,148,226,132,101,82,57,36,253,161,85,248,95,32,42,37,202,230,+66,162,172,215,81,225,125,33,194,227,204,57,134,158,253,146,34,222,244,121,+231,246,44,115,226,54,37,181,105,80,94,237,63,208,74,183,240,188,227,29,+190,221,146,251,13,31,183,205,159,5,49,41,191,156,52,62,202,68,101,109,+250,232,156,154,147,112,198,82,60,58,30,183,183,93,188,155,139,18,188,222,+14,230,56,178,205,0,58,141,107,148,160,97,54,153,68,61,1,27,218,184,+49,176,82,104,161,103,228,88,44,231,71,85,96,134,179,175,28,129,105,236,+196,117,197,140,78,75,233,235,160,23,142,70,198,165,86,196,135,188,247,78,+127,182,89,71,207,102,124,33,231,129,56,77,112,43,125,247,110,185,108,211,+177,255,166,103,110,183,124,10,149,176,5,44,122,154,142,96,250,174,181,155,+101,65,183,190,31,176,167,189,64,109,90,49,129,237,251,64,81,196,140,84,+52,242,25,18,1,92,43,15,97,28,233,66,132,202,233,39,90,75,154,102,+118,207,17,44,229,80,186,247,222,166,180,91,46,215,144,62,146,60,196,209,+75,211,124,203,160,231,142,0,88,191,199,91,98,47,146,74,146,91,151,182,+234,154,88,54,93,107,86,38,133,48,210,76,49,16,65,122,249,124,16,10,+121,64,221,144,250,148,102,63,112,107,19,145,167,123,240,144,7,51,133,18,+40,245,213,16,86,232,62,23,35,39,67,224,92,79,149,209,166,178,191,90,+126,220,183,52,138,235,78,53,92,83,97,0,203,65,132,248,139,167,125,106,+206,183,125,229,116,57,100,101,60,118,38,56,175,247,233,238,245,250,30,12,+153,55,104,169,16,117,106,171,118,55,28,220,85,36,226,212,134,35,103,8,+103,240,160,247,186,85,21,150,222,16,232,68,102,182,189,134,23,140,121,110,+26,221,145,26,48,144,152,253,226,64,114,159,53,95,127,174,173,175,163,221,+57,81,174,236,176,105,127,203,243,176,60,178,131,26,41,102,180,95,144,231,+108,203,101,82,70,125,10,193,66,55,69,197,165,181,207,48,222,190,213,127,+114,34,152,212,160,54,203,90,153,141,252,162,1,105,139,174,240,8,11,64,+137,250,237,153,78,220,244,10,126,123,188,191,123,174,79,115,87,165,32,46,+166,176,133,201,147,91,191,87,226,54,250,1,191,145,77,236,23,74,0,175,+199,35,92,249,252,206,225,76,214,247,45,33,114,155,49,255,37,123,42,114,+161,145,204,36,125,198,36,126,27,159,72,173,27,66,77,188,77,95,89,21,+154,104,12,254,129,169,35,96,152,236,180,210,25,114,152,96,233,11,19,88,+26,56,188,194,201,203,219,74,189,93,109,247,194,58,150,12,254,136,161,142,+204,119,228,96,177,74,153,20,154,112,139,0,132,19,203,71,46,136,76,187,+21,113,127,48,152,58,230,203,85,39,186,3,29,251,224,146,198,17,126,2,+185,208,186,47,49,17,166,137,128,47,177,142,8,29,65,179,10,231,135,71,+212,127,173,243,26,97,105,93,110,218,148,42,27,100,234,129,41,229,243,38,+115,137,164,223,217,120,208,81,179,66,35,181,10,14,206,113,179,125,53,18,+241,232,194,164,26,122,215,41,42,92,81,96,205,71,225,60,241,8,199,26,+20,191,169,127,216,100,188,80,251,17,166,153,165,116,184,90,147,4,220,178,+206,187,157,211,203,245,118,244,115,182,136,88,98,152,69,144,156,246,226,95,+220,96,125,197,34,8,212,114,82,79,56,84,162,156,55,13,40,250,22,151,+10,49,180,160,101,18,110,162,8,152,174,104,160,198,143,127,42,175,59,131,+122,44,99,140,214,147,254,93,111,205,79,252,242,161,100,148,148,160,159,38,+158,111,129,180,44,249,195,241,10,245,136,73,59,217,168,16,114,158,154,70,+178,88,197,154,126,183,228,136,35,111,156,130,143,71,130,18,209,112,157,225,+173,194,202,40,129,206,25,214,68,24,220,141,172,199,63,148,20,29,250,189,+39,92,3,253,238,159,100,139,70,27,128,233,249,205,113,17,153,217,29,7,+128,36,28,195,81,145,59,186,61,178,36,3,175,202,197,238,188,109,116,3,+214,126,179,98,47,177,68,236,145,29,109,224,226,147,11,15,8,1,42,203,+59,187,244,182,22,29,160,193,22,113,171,3,54,9,67,63,162,99,43,39,+82,208,35,164,239,128,161,236,83,21,190,250,158,105,166,227,77,77,255,176,+168,188,122,143,111,96,162,167,39,18,164,55,96,127,2,189,69,114,218,43,+111,74,139,201,155,167,40,130,218,57,109,103,121,20,83,164,90,89,36,237,+121,117,109,210,233,214,25,0,220,55,40,65,172,205,148,170,121,23,55,2,+97,239,32,184,10,86,174,19,53,146,157,146,16,98,255,26,30,227,130,104,+125,37,240,155,108,83,151,152,6,205,255,211,191,212,203,46,45,80,159,23,+161,28,8,244,99,246,101,210,114,20,116,134,13,208,209,203,166,30,92,183,+183,152,167,236,33,112,47,176,86,144,164,52,207,151,69,161,120,29,57,60,+53,117,126,214,234,235,238,227,64,143,171,46,10,232,96,145,236,173,45,79,+134,40,47,181,144,143,251,178,186,201,11,31,26,141,37,101,237,137,128,12,+208,225,94,222,107,209,5,11,103,213,110,68,46,113,138,210,180,124,196,148,+163,148,254,68,165,129,223,123,174,80,0,116,31,6,61,230,210,63,137,0,+183,42,102,248,158,168,161,215,45,93,76,247,230,125,186,31,15,67,9,29,+242,234,42,34,232,251,84,91,26,101,100,64,124,49,207,61,66,106,189,234,+113,54,78,157,156,44,54,47,168,75,91,149,238,220,69,243,156,144,106,58,+38,255,75,18,233,118,175,31,50,111,212,116,28,112,119,208,11,23,251,1,+236,78,254,149,248,220,65,26,91,27,163,186,201,65,106,45,228,110,13,19,+76,2,9,70,52,19,235,10,3,217,177,207,199,89,39,159,221,122,2,127,+124,7,44,222,13,43,216,228,40,232,47,119,237,177,130,140,50,92,121,32,+41,143,206,109,197,189,218,83,243,3,92,60,248,170,123,113,30,188,218,228,+103,198,132,234,176,65,243,199,221,216,247,84,179,250,33,91,255,117,66,77,+83,252,166,124,138,155,88,151,128,200,88,126,8,167,8,182,88,2,194,113,+170,67,95,220,241,188,188,69,71,93,116,111,196,238,152,168,180,121,202,213,+135,42,252,61,231,109,184,110,129,224,147,105,77,24,5,9,147,162,37,203,+176,216,215,135,79,86,81,31,85,94,188,22,244,150,119,206,147,235,241,144,+11,103,144,86,19,131,179,23,239,86,244,206,223,243,20,89,112,213,179,54,+83,253,65,191,103,201,149,186,203,144,138,86,229,254,241,157,53,110,72,188,+45,241,10,121,156,97,114,125,224,39,185,15,156,88,34,176,238,188,243,185,+35,249,80,244,154,31,104,10,41,165,43,181,192,37,79,59,193,7,131,101,+195,50,46,39,129,37,225,208,146,0,56,211,116,228,184,46,105,228,59,172,+9,211,226,30,148,215,170,98,111,122,114,115,154,182,155,15,243,166,169,120,+90,106,199,253,20,17,184,135,226,235,4,151,90,159,53,126,157,11,222,237,+229,129,103,182,184,206,203,221,248,53,213,239,140,73,236,170,230,91,105,248,+214,229,234,93,224,107,104,242,70,93,95,165,46,64,126,30,163,102,16,198,+199,28,255,53,44,4,120,199,226,177,120,45,32,3,111,139,95,157,92,234,+72,127,140,221,181,86,225,71,33,38,29,23,213,140,68,74,217,27,130,116,+66,169,47,22,101,224,170,46,22,133,40,104,170,114,148,29,236,224,205,248,+197,40,114,53,118,31,142,175,52,248,152,118,70,187,68,161,85,167,227,16,+141,17,156,209,222,115,161,116,162,243,246,205,232,204,247,128,127,19,45,30,+53,35,106,203,51,3,78,35,12,51,4,193,236,193,72,234,168,222,131,108,+223,209,16,97,160,157,177,183,32,254,98,43,68,0,122,30,78,79,30,42,+98,160,229,184,45,80,126,188,129,254,20,204,35,246,127,51,159,148,88,107,+131,67,220,4,167,60,48,161,244,214,150,170,91,235,97,35,17,249,210,20,+182,229,157,17,65,16,181,40,144,232,223,83,105,173,40,191,185,98,44,73,+183,3,109,235,204,150,79,136,123,214,64,222,174,87,123,212,54,94,3,217,+183,7,65,183,182,250,223,212,0,128,65,46,204,32,150,170,168,92,8,16,+95,237,195,156,67,253,105,21,81,173,154,251,184,254,221,80,105,143,239,72,+222,234,81,77,126,151,244,64,247,157,42,88,92,181,121,40,19,121,106,81,+181,184,55,90,177,2,191,85,203,44,2,10,5,197,72,88,98,158,92,148,+87,71,56,18,109,201,115,97,186,236,139,206,64,71,94,133,6,79,42,190,+22,187,2,65,31,255,79,32,6,44,114,11,146,82,239,71,78,31,105,225,+187,115,218,88,0,212,182,183,200,133,18,164,200,237,87,144,230,7,1,248,+242,49,159,122,232,85,195,53,116,149,249,64,228,60,212,94,81,18,122,117,+100,253,10,191,18,127,111,34,211,31,141,81,152,45,54,251,108,44,64,22,+51,105,141,155,91,228,255,136,77,15,46,83,179,52,132,71,248,94,195,124,+211,141,76,80,66,234,204,108,22,25,81,22,7,43,213,196,39,25,131,46,+27,44,209,9,82,188,98,85,220,127,181,121,51,190,190,175,75,4,60,204,+205,76,20,2,49,215,208,70,167,3,163,154,62,64,66,25,230,238,117,241,+31,43,191,15,172,106,224,24,149,98,76,89,82,48,45,26,152,225,180,42,+179,88,214,38,5,25,189,234,47,2,154,173,60,151,95,21,218,116,7,114,+116,142,144,58,146,40,105,39,51,167,190,6,106,92,81,243,215,92,64,203,+120,117,246,206,114,52,206,204,82,61,6,111,201,232,173,22,249,72,72,251,+34,196,58,73,101,7,54,62,172,237,208,30,67,230,55,160,49,173,72,99,+238,29,39,158,34,45,40,116,210,150,234,230,23,104,110,85,188,69,52,189,+191,121,24,108,6,94,140,130,172,188,114,232,198,126,36,168,15,82,143,106,+35,160,241,42,189,173,177,69,28,167,156,160,153,117,16,65,228,212,148,58,+238,255,250,123,194,219,250,81,238,131,53,155,158,182,208,66,133,151,61,66,+243,63,41,112,23,161,101,78,126,247,156,102,154,118,252,89,122,234,66,46,+32,230,108,70,220,247,115,40,158,175,102,98,70,240,200,59,186,244,199,71,+207,223,211,213,255,248,2,44,58,133,36,85,160,66,93,112,128,103,66,31,+52,247,174,48,86,238,176,25,124,62,92,232,123,69,147,92,80,83,22,196,+94,60,100,209,79,141,146,38,83,136,24,149,74,215,238,60,16,176,232,214,+174,148,61,190,219,122,252,52,137,96,164,232,6,172,167,107,69,0,235,162,+91,60,179,13,136,7,69,150,205,181,100,69,159,49,239,144,4,191,10,178,+212,135,187,195,10,83,202,24,66,181,252,9,65,255,52,205,94,203,37,138,+27,213,26,115,132,85,112,88,124,77,129,36,91,244,212,180,165,215,127,121,+177,209,122,6,8,130,167,121,210,176,188,153,165,151,73,183,13,120,122,29,+111,53,18,81,80,60,146,244,25,11,178,170,178,41,52,161,153,49,203,64,+197,223,92,199,162,11,176,247,61,205,74,239,249,147,181,224,231,230,157,223,+83,162,160,229,78,111,170,214,150,199,244,90,210,168,53,204,99,78,85,55,+8,132,33,136,81,76,172,220,121,200,213,41,194,190,18,57,157,164,160,20,+67,240,70,144,58,109,50,22,207,1,28,189,150,117,233,50,236,118,253,249,+117,144,71,176,90,2,144,151,45,160,55,177,240,191,29,69,64,112,166,124,+131,47,139,68,117,241,113,190,222,198,235,218,0,131,233,173,119,118,195,7,+20,121,9,71,80,106,48,214,118,121,170,218,7,62,52,41,43,3,15,241,+209,47,106,144,35,32,103,52,11,147,62,172,127,196,9,194,188,147,155,219,+30,45,241,153,37,36,187,102,216,67,240,219,90,80,120,14,185,42,70,6,+184,219,11,68,205,129,121,73,236,125,210,38,62,24,66,60,186,124,161,118,+0,204,252,230,235,151,220,109,254,158,144,201,175,161,48,107,55,231,118,158,+150,167,157,141,203,141,220,7,249,157,104,57,140,202,24,113,214,21,9,173,+255,191,72,65,55,30,180,145,100,63,232,240,68,48,63,26,107,27,249,234,+1,23,130,213,78,185,147,246,136,250,63,197,49,14,181,125,108,44,79,108,+49,115,60,69,234,160,157,133,10,90,23,141,238,110,211,30,93,227,86,69,+22,51,33,82,80,201,63,250,239,104,18,58,211,92,37,231,242,68,145,135,+16,255,146,84,93,156,36,101,253,212,73,140,47,150,150,169,15,20,127,19,+234,78,158,201,162,160,145,184,217,160,216,8,54,211,155,245,77,18,161,237,+41,253,158,77,59,239,103,255,118,71,207,227,124,220,246,254,46,38,200,172,+50,146,180,131,2,200,53,147,218,27,75,237,162,93,139,42,175,207,223,165,+19,24,23,183,211,184,63,246,226,162,183,11,255,196,57,63,255,201,232,131,+11,43,19,108,234,122,223,154,181,111,212,49,143,96,150,200,71,184,7,167,+182,253,238,240,138,142,123,203,61,140,151,229,183,59,50,216,224,215,141,40,+225,125,47,67,153,119,170,189,243,101,166,229,103,60,63,186,202,247,14,225,+147,112,166,145,204,131,166,68,50,175,196,0,183,54,17,218,68,46,94,209,+2,140,189,95,58,135,131,186,7,146,125,169,221,175,181,203,201,226,31,215,+3,75,165,82,133,14,220,85,202,87,205,66,192,114,239,54,106,199,116,113,+230,240,154,172,10,101,113,60,40,38,195,48,245,231,165,70,17,190,124,209,+127,84,208,209,223,37,30,198,123,30,251,67,211,70,131,156,230,23,208,235,+168,86,53,176,105,200,165,72,41,244,58,170,234,223,65,183,169,57,208,54,+216,234,244,0,32,191,64,70,86,22,226,119,205,75,155,45,217,230,72,128,+61,10,193,138,47,189,10,238,121,124,83,164,17,14,111,79,199,29,170,87,+177,161,55,175,147,173,62,147,196,34,44,215,63,42,17,78,181,243,229,115,+192,12,217,164,33,244,255,61,95,245,94,65,216,111,162,142,124,11,194,56,+120,234,60,238,244,199,95,212,40,55,206,104,28,76,60,68,19,40,24,185,+136,90,139,89,96,25,237,61,132,133,162,101,67,134,147,125,101,13,171,77,+182,56,111,19,14,112,78,134,9,248,182,153,120,137,192,10,211,168,138,101,+130,57,4,35,65,22,190,230,22,123,123,6,17,146,92,145,211,178,19,173,+240,176,132,53,171,30,82,163,71,223,52,58,178,6,102,144,186,1,169,91,+167,126,243,178,35,200,183,122,87,183,3,138,188,99,193,169,248,13,226,228,+183,246,255,46,14,246,61,165,138,246,128,239,244,234,215,195,78,130,117,100,+176,170,162,220,158,39,54,2,4,174,56,158,2,133,66,59,84,100,86,61,+191,67,168,24,248,63,134,163,161,182,126,250,66,80,28,41,116,44,214,134,+72,179,9,182,236,230,215,145,134,69,60,47,108,121,62,60,49,178,114,128,+234,209,10,17,244,31,101,144,8,112,26,214,148,182,61,203,31,141,249,130,+239,251,70,255,18,56,27,247,76,178,93,65,172,130,164,196,7,19,39,41,+63,149,193,65,241,35,113,153,249,67,14,132,64,224,226,82,145,193,235,104,+146,128,45,243,115,195,23,148,25,136,61,222,134,119,127,166,116,243,30,117,+223,250,47,65,65,235,141,238,230,48,51,158,112,162,157,89,123,148,192,153,+167,118,242,235,204,223,122,115,37,180,4,81,167,0,25,66,22,79,206,17,+59,177,182,215,112,142,253,250,252,197,247,206,208,42,161,205,145,163,30,144,+167,7,171,163,190,105,29,225,63,165,39,245,244,104,112,55,182,20,200,145,+74,162,52,242,167,85,233,30,33,218,165,124,234,228,45,231,214,242,10,76,+159,210,218,243,180,145,109,124,143,10,87,151,168,40,77,95,188,55,56,64,+244,228,113,25,183,45,246,73,225,239,159,66,141,54,175,96,122,6,204,240,+132,111,31,36,94,128,199,39,163,171,33,21,51,98,120,8,60,179,109,165,+92,215,43,148,214,111,134,0,153,237,18,190,100,196,120,63,173,91,78,187,+61,111,235,175,194,105,77,147,137,78,116,233,44,161,207,247,21,9,198,52,+183,170,101,238,109,42,41,213,191,15,27,95,114,98,87,232,90,31,79,203,+128,116,227,106,95,186,175,109,228,78,209,168,63,216,84,170,191,84,156,31,+195,21,233,58,87,227,54,25,221,165,26,158,227,70,132,178,2,101,101,12,+105,67,25,188,117,210,34,192,133,72,136,53,220,49,130,78,127,75,254,112,+8,196,166,109,117,173,91,18,37,239,58,212,133,155,137,255,100,229,56,217,+86,250,31,168,118,218,122,88,95,65,81,124,95,29,148,75,153,15,135,242,+72,86,196,87,24,10,70,50,83,62,104,140,56,112,62,2,55,32,85,11,+159,22,136,134,89,95,220,56,134,215,27,118,122,240,176,82,134,216,207,200,+121,47,1,172,232,171,250,217,148,23,188,109,189,234,18,68,234,183,189,207,+100,214,185,49,172,124,253,172,35,69,134,205,53,223,144,79,14,94,152,213,+29,169,0,70,7,187,128,200,214,83,202,161,63,66,117,180,15,85,78,185,+139,125,240,66,133,95,12,122,21,84,93,137,51,31,119,55,0,153,249,101,+59,184,134,245,156,239,242,9,134,226,233,43,65,207,125,233,37,138,175,126,+31,145,230,231,208,32,163,21,173,132,101,113,128,145,120,238,76,103,131,3,+96,4,67,60,136,156,46,31,126,212,255,32,134,216,146,148,74,213,241,84,+149,41,150,165,192,37,138,193,129,67,209,62,251,201,244,87,231,13,151,70,+70,222,94,16,155,178,160,247,61,208,105,70,109,63,106,245,172,208,231,68,+88,172,229,239,197,91,250,237,49,202,120,142,95,135,86,88,52,219,25,234,+163,72,20,158,182,230,177,155,185,179,56,57,37,195,241,11,186,186,212,39,+157,176,108,172,46,235,95,138,94,9,154,174,207,166,112,95,246,223,9,184,+136,251,65,254,108,118,158,215,53,146,75,44,47,177,20,172,240,66,193,158,+167,113,83,28,74,254,246,201,100,70,50,102,173,24,5,116,185,0,16,236,+53,64,172,190,251,175,183,125,55,29,72,7,137,216,167,240,212,10,150,223,+147,19,200,182,214,186,3,103,61,150,111,140,81,40,93,94,223,150,196,219,+48,18,248,193,160,188,171,254,253,125,250,229,52,90,26,119,43,116,40,137,+229,198,248,208,200,110,36,11,125,150,50,197,27,203,179,123,254,34,43,213,+62,137,90,72,82,193,161,136,44,217,226,133,164,174,107,79,96,6,219,177,+193,208,142,215,87,245,49,115,245,125,3,202,247,148,100,39,235,51,211,53,+11,177,107,3,17,254,228,164,144,231,114,250,71,68,73,224,255,236,55,74,+181,153,221,162,64,212,201,127,111,64,171,174,42,112,107,15,224,64,70,113,+160,250,140,176,243,53,70,131,25,62,0,88,249,206,180,135,182,116,78,179,+178,228,105,176,108,159,166,78,186,134,91,209,112,122,235,253,49,253,57,221,+116,251,177,35,106,88,88,224,11,115,143,107,36,84,214,152,150,54,1,193,+105,233,137,27,237,194,226,197,96,73,93,153,9,36,152,228,1,87,252,17,+67,180,193,153,52,88,203,96,81,133,58,5,245,233,243,235,191,58,53,139,+36,141,229,133,143,155,81,129,195,8,113,40,60,161,128,170,224,101,142,57,+183,183,202,233,138,71,119,40,66,142,24,254,226,80,23,67,209,131,52,33,+203,106,0,187,123,29,210,106,184,196,41,18,214,160,225,116,54,112,107,91,+228,221,85,108,113,131,217,171,84,50,101,228,10,22,81,90,4,216,205,231,+141,76,65,91,157,114,40,81,87,64,88,135,221,29,45,105,113,114,28,58,+97,90,66,210,223,138,212,168,13,251,152,6,62,136,37,214,188,78,0,21,+45,39,96,106,3,103,49,124,91,103,145,246,245,199,236,39,193,56,200,229,+126,131,40,103,56,43,236,171,28,13,223,6,227,71,190,151,115,11,226,9,+228,189,26,94,215,102,28,185,162,222,150,182,90,75,75,203,253,219,62,37,+99,76,56,9,216,124,193,251,174,165,92,81,154,121,255,179,192,166,81,170,+146,19,7,236,250,138,209,34,30,28,106,214,143,30,127,174,109,86,66,5,+74,213,234,119,182,251,249,43,2,172,85,75,89,56,93,242,220,123,100,251,+30,57,110,34,89,129,188,185,245,101,231,35,167,129,36,102,68,100,148,220,+71,21,71,81,175,164,54,233,243,203,188,41,158,243,119,20,229,244,252,43,+254,79,76,202,46,238,228,158,58,66,162,20,60,249,214,215,64,141,226,37,+216,40,4,102,215,24,92,47,75,4,92,93,103,171,91,70,23,194,15,251,+41,160,41,226,43,86,39,253,44,250,54,163,137,212,207,219,171,55,36,4,+174,197,198,72,70,70,122,167,191,134,189,189,66,97,251,200,248,165,108,37,+134,147,237,204,205,203,58,208,120,255,24,64,158,146,102,21,239,28,183,26,+187,175,47,217,86,2,65,148,41,135,83,122,7,214,141,67,188,164,243,14,+75,215,220,232,201,110,152,24,123,184,137,185,202,82,124,224,233,194,254,248,+8,178,129,24,169,19,103,203,237,146,152,83,198,114,86,172,208,141,167,146,+138,104,15,20,167,34,46,189,6,171,168,53,243,78,232,236,216,240,178,218,+48,54,67,211,177,204,248,90,108,189,39,31,37,171,184,231,93,205,211,224,+86,251,27,88,48,144,41,80,227,239,112,161,42,1,226,111,44,78,86,103,+61,159,177,75,11,209,88,252,18,3,24,244,60,8,59,31,65,219,66,87,+132,62,82,29,70,218,1,65,252,3,143,213,103,225,62,145,59,64,89,57,+25,225,199,139,116,46,156,77,8,102,95,38,28,235,144,35,107,23,132,222,+175,51,253,50,201,175,145,142,71,167,196,95,210,15,86,67,90,68,255,17,+180,143,189,8,225,17,156,212,213,242,84,5,42,239,124,26,88,89,102,135,+63,132,14,143,191,21,90,20,134,15,134,174,130,87,53,74,230,118,177,7,+143,251,80,251,61,61,214,183,243,10,166,194,132,113,164,217,37,143,9,157,+152,22,76,206,205,29,151,177,96,45,33,103,189,123,125,25,82,229,26,255,+190,65,136,7,198,117,91,55,114,35,82,79,143,58,168,97,233,127,179,83,+158,46,33,250,114,229,176,196,207,72,63,252,41,213,235,94,245,131,40,231,+27,160,61,150,17,88,18,146,219,175,147,160,196,182,141,56,207,209,181,232,+46,11,73,211,92,151,201,35,121,134,13,208,252,104,183,207,235,20,58,207,+152,96,168,91,111,222,233,190,35,121,229,136,73,147,149,64,89,18,25,106,+5,205,171,199,60,77,21,101,104,114,111,247,26,133,2,205,120,151,8,129,+56,94,2,44,249,143,85,212,36,100,94,50,54,99,159,177,63,223,4,177,+12,126,237,234,245,255,233,252,66,220,229,16,48,144,157,32,43,74,76,206,+10,99,194,192,159,112,71,49,19,231,117,106,156,60,210,65,225,190,68,38,+22,248,226,32,114,148,17,159,229,144,246,86,195,135,89,76,2,47,94,130,+169,186,85,184,124,117,131,39,218,92,60,8,251,196,143,63,61,169,117,70,+34,229,229,150,1,243,84,243,19,93,96,160,132,5,255,110,5,229,108,16,+119,95,175,249,209,244,91,237,7,70,116,127,194,187,255,129,109,118,221,231,+239,233,96,89,29,19,188,120,163,247,155,215,70,99,170,145,157,44,233,46,+77,151,148,210,234,61,29,170,23,221,169,25,104,227,54,201,169,191,26,109,+55,239,78,247,220,0,162,36,211,85,54,66,44,152,159,125,32,220,89,85,+171,61,65,242,162,116,17,207,107,173,131,35,88,23,223,70,145,174,170,126,+134,69,145,173,8,39,243,120,59,10,8,33,232,249,203,216,115,185,172,181,+70,246,205,90,21,169,174,24,49,191,4,33,204,117,55,31,106,87,128,138,+49,209,188,4,37,11,200,126,172,126,228,100,183,89,64,24,87,103,85,20,+55,154,247,166,46,71,209,117,224,204,33,203,67,95,248,144,100,80,108,139,+53,99,213,16,1,178,134,68,16,47,184,91,87,106,196,147,66,164,16,1,+167,192,114,183,215,5,12,71,170,53,126,16,37,217,68,162,118,4,122,90,+94,185,82,17,113,81,179,201,109,193,246,107,186,185,27,30,146,4,88,2,+26,222,107,31,250,195,115,78,67,20,159,173,200,58,12,192,170,21,101,53,+110,40,133,130,58,187,20,110,209,109,196,141,111,35,97,202,249,142,122,115,+35,146,44,15,190,145,216,92,37,42,70,151,178,252,250,129,87,86,53,226,+114,45,159,162,52,145,172,101,63,96,25,207,204,3,188,126,253,103,171,91,+85,207,145,254,93,194,49,47,111,248,159,178,77,164,148,179,161,82,127,70,+86,47,249,251,20,219,48,238,22,127,87,238,150,134,86,252,163,222,27,186,+68,54,155,87,124,76,118,166,133,212,158,107,247,253,232,215,195,28,17,78,+84,101,72,89,43,189,107,141,179,73,238,227,230,126,216,137,183,103,32,93,+217,226,173,148,148,206,69,204,48,92,115,26,222,192,170,74,112,124,101,56,+41,176,147,66,218,98,35,215,51,49,44,29,220,125,158,47,190,10,206,207,+100,142,115,199,173,197,6,87,163,191,50,167,184,146,147,220,154,155,56,46,+253,48,145,85,51,152,117,218,221,243,166,196,232,59,149,61,179,7,146,142,+11,151,85,193,180,180,206,90,201,149,125,72,182,127,80,191,209,154,150,248,+8,124,104,122,247,62,49,55,230,55,37,35,38,197,214,26,129,41,69,229,+249,238,173,26,242,182,178,176,236,27,152,59,38,226,199,182,255,21,212,220,+58,69,124,91,115,136,226,30,80,81,235,227,223,116,254,36,233,128,50,235,+152,120,144,143,212,170,167,163,151,170,233,40,187,36,228,228,65,97,114,213,+158,124,147,168,29,126,231,129,203,93,110,80,187,245,26,43,70,20,38,38,+32,52,96,102,186,96,212,154,221,209,77,68,51,96,57,85,223,77,68,173,+75,64,211,44,66,30,17,112,154,114,162,209,12,61,243,201,84,5,49,235,+83,164,41,10,97,104,207,203,59,90,141,218,223,63,242,134,72,65,171,61,+186,100,175,224,24,211,228,122,68,234,44,160,27,65,177,93,95,254,31,238,+84,75,157,164,52,34,96,93,32,188,172,210,73,229,3,133,44,206,64,196,+205,242,58,210,113,95,78,50,193,124,172,100,254,176,96,37,51,199,13,192,+54,20,254,169,20,69,191,105,7,246,29,231,232,160,141,161,232,137,114,0,+90,67,40,1,26,17,225,6,224,26,118,9,244,118,164,251,226,154,63,150,+195,208,215,59,153,97,95,142,101,83,91,116,121,96,150,19,87,125,182,241,+15,187,249,204,63,77,154,138,65,1,142,216,32,210,81,75,176,107,248,150,+196,170,252,13,12,9,106,129,181,52,31,232,95,14,47,218,241,115,71,182,+251,121,29,25,98,80,248,188,114,99,142,60,91,23,249,104,215,122,42,211,+245,58,210,219,123,177,183,63,132,224,32,19,205,133,217,130,183,97,12,185,+231,185,4,126,251,221,174,27,215,19,148,39,83,9,108,26,117,134,102,160,+90,177,210,171,26,234,213,58,61,61,75,25,97,180,152,158,161,124,219,162,+28,50,207,205,118,32,163,40,219,193,104,16,64,245,66,35,226,32,254,191,+228,5,54,125,238,135,235,110,105,107,141,91,245,233,17,16,214,117,222,210,+83,179,36,2,169,82,76,126,121,241,216,189,140,216,117,121,100,89,145,20,+160,132,32,27,214,162,80,71,245,174,219,132,27,91,205,96,100,158,33,59,+47,124,236,18,254,106,92,249,36,191,21,205,64,150,87,233,206,165,30,206,+139,182,104,202,102,2,82,245,5,56,109,50,171,75,213,219,250,168,183,17,+218,147,158,33,121,214,168,180,160,17,172,78,241,86,209,68,228,162,20,170,+83,178,220,140,148,196,225,75,149,213,8,118,174,244,87,206,190,21,110,179,+212,121,239,35,253,234,61,182,143,34,27,229,68,141,119,11,14,97,52,112,+33,13,201,145,234,40,235,60,193,169,166,199,110,81,39,143,94,62,187,179,+9,168,128,69,148,9,1,208,22,163,221,120,47,188,196,43,121,169,107,59,+247,254,129,95,211,72,197,182,72,60,151,117,110,49,209,205,4,104,232,150,+123,103,174,216,7,205,181,46,36,169,88,174,224,174,89,240,26,119,206,225,+222,224,34,219,179,83,93,192,236,253,204,213,75,37,94,87,147,146,166,234,+82,44,127,181,225,43,190,67,147,152,89,71,119,183,216,41,135,113,148,167,+0,156,67,178,96,105,200,22,133,120,14,54,194,43,135,92,203,134,9,76,+195,165,15,123,139,134,19,232,246,93,19,254,223,142,185,129,154,48,12,76,+78,25,244,236,101,32,18,127,101,241,10,21,42,214,78,125,25,146,148,248,+177,93,92,200,140,183,117,74,84,172,217,54,216,166,46,33,11,49,62,175,+186,209,19,88,229,201,38,7,219,156,91,238,199,51,92,70,230,127,174,92,+239,209,18,246,36,29,196,181,219,207,249,164,233,169,88,200,235,67,96,245,+94,78,187,245,166,243,166,38,115,243,8,201,166,70,253,232,69,10,42,67,+200,212,149,44,12,155,139,236,182,167,31,252,32,107,5,138,6,44,167,131,+180,168,202,61,86,10,101,27,186,30,30,51,128,124,152,20,130,228,225,27,+195,14,157,26,210,111,188,102,205,225,113,83,145,197,152,161,3,23,31,159,+88,122,68,221,63,169,165,77,203,21,151,31,8,105,85,113,36,182,231,178,+19,72,134,178,45,3,245,40,16,153,71,58,191,60,5,164,21,119,243,173,+162,37,96,172,40,85,30,152,88,165,135,146,225,17,251,78,51,217,236,231,+219,157,125,198,207,71,91,218,96,144,142,205,254,171,6,248,70,66,165,103,+195,243,106,105,243,123,156,231,181,94,154,249,1,16,32,29,227,74,112,191,+96,42,159,35,147,217,50,218,34,248,202,101,150,163,131,155,8,228,149,39,+242,242,112,109,179,243,103,222,192,7,179,134,63,62,73,123,131,193,201,196,+170,90,100,178,144,251,209,205,240,10,127,151,84,78,131,105,122,214,9,73,+196,16,203,178,186,122,36,39,138,109,98,229,59,5,192,76,115,88,249,16,+154,198,29,4,220,106,91,100,176,109,48,100,60,167,88,244,233,165,245,115,+155,97,2,217,59,58,177,5,7,148,194,87,30,169,154,6,253,22,247,163,+141,58,20,44,238,217,121,101,40,7,11,243,228,46,246,188,8,255,86,165,+222,58,167,71,115,105,117,204,53,44,158,237,185,197,10,187,35,238,115,237,+59,26,172,4,71,154,210,213,26,142,101,61,253,21,216,29,58,78,199,142,+166,76,191,3,208,166,220,71,51,14,84,97,235,193,145,115,134,170,238,151,+135,104,134,193,23,20,250,171,195,186,161,11,24,175,97,35,111,217,94,51,+22,254,110,3,95,234,202,58,54,63,109,124,106,244,243,167,119,36,232,105,+73,67,41,179,142,224,234,21,45,30,25,115,252,133,191,131,191,164,187,9,+126,120,106,60,83,98,6,93,53,196,188,214,152,50,87,235,104,43,20,162,+212,210,159,77,42,0,13,94,48,146,68,121,39,82,135,1,105,160,59,56,+15,77,202,87,65,204,156,178,169,230,191,196,29,32,142,147,64,110,33,76,+236,63,89,12,26,170,166,217,121,142,1,253,199,104,93,75,219,209,147,226,+67,80,194,163,154,188,101,30,201,42,187,142,20,78,138,116,59,107,10,207,+19,28,236,72,5,15,152,119,96,170,99,34,237,195,166,196,29,212,92,179,+37,193,32,241,147,224,170,210,93,143,82,178,148,40,224,39,143,206,216,192,+44,161,224,168,156,166,86,11,145,228,212,161,104,27,11,126,128,204,240,143,+68,63,180,108,170,3,194,56,14,241,122,163,4,151,105,170,242,144,67,225,+68,188,158,75,148,232,139,204,4,194,76,212,46,176,166,116,128,43,253,147,+231,85,253,197,141,132,133,160,49,177,137,143,6,21,234,141,230,30,235,86,+93,136,148,130,41,68,135,225,59,125,209,243,56,69,231,116,154,77,33,79,+202,194,146,167,80,153,123,131,247,185,227,18,222,106,0,152,240,131,199,30,+128,52,23,231,152,237,189,240,163,58,69,14,152,140,64,227,13,82,119,210,+253,213,87,176,33,188,88,35,225,102,246,18,98,172,163,187,155,54,191,154,+23,255,80,95,173,34,49,123,1,221,48,173,71,192,163,79,240,169,66,68,+255,78,185,34,224,36,3,131,201,186,146,52,149,55,49,77,35,157,254,45,+157,155,26,112,194,193,207,16,178,20,181,202,56,222,57,241,206,123,135,119,+130,202,250,30,168,245,190,201,148,172,238,102,58,62,217,104,12,230,36,35,+73,223,72,190,191,111,114,135,48,201,231,220,34,90,219,6,12,14,38,249,+60,12,90,14,54,16,43,108,0,95,219,233,196,143,239,199,145,133,77,247,+156,104,9,130,171,253,100,202,140,68,239,64,128,10,34,159,143,205,10,230,+106,87,242,163,11,193,138,243,248,157,167,212,50,203,211,14,226,110,94,155,+237,218,136,212,185,149,34,180,207,40,156,25,213,154,35,47,47,235,67,202,+240,163,167,236,172,214,111,233,171,214,3,5,151,10,208,238,49,3,47,85,+114,209,133,0,221,98,72,150,101,223,217,244,152,66,71,233,168,151,176,56,+28,78,155,196,101,149,10,104,255,55,45,198,45,251,3,27,144,164,254,24,+52,218,62,14,167,229,199,255,18,46,84,220,252,222,91,80,179,154,147,221,+73,174,210,183,49,14,119,0,178,82,167,78,32,89,113,97,15,2,156,130,+11,237,142,179,87,108,106,112,237,98,145,225,157,56,244,123,26,6,104,130,+156,227,220,11,205,124,34,217,26,129,132,184,45,165,77,126,72,47,61,119,+172,65,178,205,241,244,12,197,214,101,172,167,44,254,121,195,184,217,49,27,+206,126,101,59,73,50,220,188,9,90,200,170,86,222,92,135,38,157,134,52,+183,126,220,198,192,236,24,99,120,82,250,195,118,234,68,110,122,236,248,156,+91,87,184,52,64,126,147,226,184,77,106,6,19,74,214,56,75,85,39,194,+196,117,91,232,234,29,18,226,248,220,175,80,179,30,34,160,103,40,62,88,+189,87,208,51,127,31,244,203,84,115,156,248,130,116,176,238,9,96,9,238,+250,205,35,31,44,66,16,34,248,22,80,172,245,102,87,226,82,120,242,60,+232,82,23,43,20,153,29,97,9,156,201,237,154,159,56,111,67,118,83,3,+106,171,216,231,30,193,239,189,162,220,119,200,190,61,148,44,8,8,169,55,+15,50,78,23,142,14,165,110,14,59,213,53,84,85,235,63,75,171,77,121,+188,250,116,74,214,243,143,30,199,45,105,14,204,219,59,193,150,47,20,75,+73,167,124,194,214,153,99,129,198,175,3,25,211,104,67,77,131,221,192,174,+45,228,48,136,39,159,56,123,24,197,118,24,204,224,159,251,217,21,75,248,+107,27,136,37,141,229,135,187,235,107,86,88,46,249,223,193,112,142,240,158,+34,155,128,238,186,0,12,125,145,166,156,211,31,132,148,169,123,221,155,127,+124,74,112,169,171,136,92,68,249,123,211,255,173,227,115,192,120,49,224,129,+19,69,65,161,248,225,112,84,88,12,243,153,17,129,214,223,136,252,131,164,+161,218,20,27,24,21,166,34,169,246,17,153,250,73,236,178,210,83,139,30,+49,71,3,85,199,46,91,175,148,112,142,35,189,90,142,57,203,117,75,245,+35,151,4,112,144,60,186,104,197,53,241,201,159,138,232,125,64,95,77,91,+79,86,75,30,69,245,146,159,165,247,208,158,211,247,41,128,177,167,20,31,+35,200,218,2,242,178,205,49,119,146,249,140,236,206,165,6,88,191,0,75,+28,168,222,121,216,90,85,173,51,65,226,55,56,205,18,218,165,165,49,134,+103,84,181,202,49,201,1,128,83,89,197,97,157,168,180,160,181,237,54,21,+45,60,89,171,109,178,226,31,167,245,137,104,64,211,113,230,56,102,70,182,+134,78,200,174,123,63,58,202,245,182,4,48,50,55,247,90,134,93,108,142,+179,122,128,99,189,254,29,142,161,148,78,93,56,53,235,190,95,178,66,173,+139,235,68,251,98,221,238,244,66,179,208,230,3,243,49,29,232,152,57,116,+35,215,229,243,44,9,242,51,205,210,189,8,73,165,160,135,28,89,182,163,+132,147,201,144,167,243,232,41,81,190,184,109,196,235,32,67,190,9,103,196,+178,26,213,232,51,240,172,242,243,40,49,243,89,217,247,236,141,5,175,204,+165,98,5,68,16,133,149,218,203,0,161,182,186,21,81,14,75,203,191,76,+180,170,174,52,82,65,132,228,91,209,113,71,158,137,128,168,72,227,68,211,+200,198,30,9,35,247,154,86,92,198,247,76,255,29,146,109,48,253,221,99,+213,124,207,228,7,12,221,4,113,93,202,21,35,53,189,219,18,123,249,240,+161,38,116,98,181,30,87,153,33,252,73,152,235,183,192,51,82,246,6,61,+203,37,109,167,4,59,21,50,224,16,98,98,217,184,210,225,228,76,115,181,+192,160,169,33,89,251,250,21,161,247,232,85,11,85,12,108,67,196,229,147,+26,241,176,177,61,243,69,66,72,232,68,110,36,196,237,180,64,251,231,190,+88,221,250,234,82,8,164,112,90,16,171,8,95,253,130,161,50,111,41,60,+244,176,142,162,71,75,124,136,156,227,243,127,185,6,106,62,51,248,208,235,+56,87,10,202,82,129,142,201,63,68,131,15,111,160,244,167,108,167,68,169,+22,25,91,211,169,147,151,28,0,115,155,53,103,97,47,153,194,168,170,152,+39,82,254,35,10,159,41,23,76,209,119,81,107,63,170,41,70,184,47,4,+23,76,172,235,150,117,159,18,187,157,79,24,51,163,41,52,102,224,13,171,+202,109,159,172,87,66,91,172,50,236,177,180,83,45,72,216,219,23,102,244,+243,43,73,50,205,149,41,244,121,18,159,130,223,69,55,162,188,106,238,217,+181,32,116,25,235,74,81,221,127,27,166,92,192,87,254,143,228,175,199,199,+136,96,246,163,229,18,15,68,100,3,132,230,94,123,226,175,24,213,201,252,+7,232,195,1,248,100,219,80,30,68,108,3,18,68,58,38,98,187,114,254,+143,53,112,101,18,112,169,66,234,148,119,121,66,136,155,26,150,178,167,65,+171,214,230,200,220,47,56,157,194,92,91,110,252,38,38,36,185,142,64,77,+148,30,213,162,37,232,241,8,79,1,223,225,206,186,41,155,207,112,30,7,+176,118,176,82,125,24,215,10,212,134,206,64,251,39,136,151,91,190,38,133,+2,250,215,72,23,26,182,208,138,62,121,89,37,12,69,194,239,149,129,187,+197,249,166,181,97,114,211,57,36,180,211,163,245,85,9,249,157,193,13,255,+98,123,153,225,171,125,196,186,101,72,153,242,99,187,158,92,111,54,188,105,+91,110,48,202,36,198,219,29,205,152,185,151,75,108,168,209,140,37,240,217,+57,197,70,242,215,50,255,250,174,65,172,123,164,186,249,50,42,15,183,45,+156,233,201,165,134,175,99,120,144,71,131,176,1,239,248,6,107,64,69,26,+79,152,205,114,66,111,197,113,125,134,7,223,122,0,172,104,12,90,16,168,+89,101,151,153,103,11,133,55,12,203,45,2,110,70,40,159,238,220,0,64,+201,238,66,188,147,234,240,193,166,81,149,179,58,142,3,89,161,138,63,140,+186,64,206,192,54,55,200,200,54,200,119,252,20,21,80,101,149,130,193,147,+89,70,175,146,96,249,179,192,82,29,7,192,94,175,152,26,71,173,218,85,+95,112,209,122,88,70,19,170,119,135,217,93,30,76,191,111,26,231,82,219,+230,92,148,82,206,31,180,48,221,135,12,38,124,68,12,95,206,212,14,11,+146,138,161,201,221,41,156,68,73,119,150,132,215,43,230,30,82,35,2,122,+53,112,241,228,62,93,56,3,186,120,67,124,186,176,24,17,68,45,49,129,+191,198,75,94,41,29,252,48,208,230,29,165,80,176,159,242,125,235,95,41,+58,246,224,159,65,86,3,103,109,76,254,88,166,89,229,143,219,36,190,174,+63,244,172,44,128,44,18,5,138,157,200,146,225,211,249,80,131,16,60,12,+169,5,71,194,160,58,117,161,131,244,171,170,172,55,93,27,237,211,90,185,+42,196,73,170,148,92,103,85,194,31,103,43,46,131,41,166,129,165,250,33,+160,88,59,200,43,238,101,189,2,170,105,161,52,66,94,173,7,43,182,20,+81,231,176,184,185,243,176,42,61,247,214,10,173,226,128,50,219,196,40,154,+92,29,210,79,9,189,183,82,73,229,50,36,19,247,40,242,113,153,224,185,+129,218,26,17,82,175,15,16,101,56,195,250,137,242,196,27,196,123,141,86,+66,52,138,19,57,233,93,102,198,167,188,238,160,123,214,194,179,118,192,246,+39,184,233,130,242,90,171,171,214,179,112,221,207,4,55,121,87,20,187,198,+13,67,146,168,62,216,135,70,128,18,249,250,166,229,108,245,242,6,158,126,+36,107,198,124,18,191,165,179,211,217,56,199,82,222,194,116,98,139,181,173,+59,77,159,111,101,106,147,59,96,234,27,242,119,99,103,94,151,108,166,188,+138,33,223,195,160,223,16,115,123,99,138,104,213,95,132,170,34,185,18,41,+75,236,9,38,59,4,197,177,19,116,158,52,228,113,198,210,179,97,251,186,+188,105,21,84,88,62,246,186,251,255,23,100,227,144,77,158,70,252,68,36,+128,107,231,13,206,98,82,233,200,103,195,5,125,125,99,186,59,78,178,208,+37,43,97,45,171,240,234,145,112,102,121,19,36,49,248,129,220,40,167,117,+11,147,85,216,10,246,171,255,23,81,217,247,241,36,198,9,225,59,223,92,+196,197,36,11,157,167,173,4,234,123,58,147,88,214,240,241,96,16,33,150,+210,80,205,128,155,114,172,46,231,89,63,190,107,75,156,183,220,119,92,252,+205,90,48,37,19,58,149,6,114,148,59,21,18,35,16,61,75,79,16,34,+55,243,4,115,172,6,32,102,228,186,151,11,3,112,253,81,131,146,75,104,+166,100,96,30,144,242,50,200,214,121,29,200,190,229,75,26,185,226,155,223,+163,123,175,4,53,164,129,203,197,197,185,102,76,161,164,66,124,31,202,85,+80,74,76,47,4,170,149,15,173,51,192,206,181,219,33,113,136,170,157,238,+150,200,214,149,62,166,128,136,75,169,128,190,227,133,177,193,153,63,9,181,+211,58,109,24,76,152,225,37,8,104,42,111,206,47,231,31,47,84,227,230,+83,147,14,13,113,169,116,101,27,133,50,72,88,95,246,252,226,50,170,201,+123,72,4,43,151,167,178,163,86,137,71,36,173,224,108,225,146,28,74,30,+223,29,157,236,26,246,225,104,95,229,45,28,235,95,92,107,12,186,187,32,+215,167,163,248,198,89,50,110,98,240,221,244,123,211,133,140,118,253,161,27,+67,17,127,72,34,96,37,125,45,139,144,51,41,32,228,163,241,195,4,0,+199,127,104,201,212,124,58,123,113,16,174,18,188,231,52,98,245,227,0,86,+120,131,243,2,51,170,51,30,84,82,53,78,212,108,29,31,113,161,157,157,+124,160,221,221,82,29,200,141,249,59,126,180,86,115,46,120,26,80,141,124,+19,131,179,230,93,73,60,180,22,202,104,149,90,183,248,146,117,67,208,234,+35,44,63,188,2,141,67,122,121,28,143,194,204,68,181,82,208,82,37,141,+202,191,183,255,198,176,177,131,192,21,251,32,200,15,190,16,147,39,231,61,+228,234,32,159,75,39,47,121,75,165,4,228,117,28,46,24,208,185,106,155,+57,187,148,216,217,7,218,182,90,188,65,105,68,220,193,96,145,215,206,147,+248,137,196,213,126,82,171,127,221,9,197,90,43,124,161,230,190,255,29,243,+199,43,99,125,89,227,69,99,30,12,1,206,223,36,171,24,18,99,41,223,+207,67,92,67,89,34,114,12,94,187,18,175,145,76,168,161,101,82,221,34,+101,185,124,120,67,150,204,89,207,134,11,72,168,53,89,59,186,152,248,179,+215,100,13,130,162,232,212,115,232,194,125,7,84,40,209,132,241,2,16,8,+84,173,39,220,90,40,169,150,178,132,194,22,187,86,110,214,121,80,158,197,+113,100,213,240,29,126,55,3,34,39,120,96,98,112,229,64,130,174,145,182,+127,114,138,206,70,193,227,196,132,63,10,246,141,6,95,176,186,14,192,226,+225,163,206,61,45,15,163,134,173,74,229,3,248,102,150,250,203,102,141,49,+23,164,194,77,86,131,73,111,43,79,197,210,235,179,59,128,189,214,168,55,+181,231,15,131,168,1,32,251,201,149,160,89,53,136,188,81,99,125,192,25,+81,168,167,43,247,79,77,53,4,181,165,211,62,104,46,176,243,151,77,69,+201,73,110,215,140,36,26,188,63,210,232,148,190,76,194,238,82,88,64,173,+154,110,72,169,231,95,223,45,194,21,132,203,242,20,251,202,143,104,176,203,+71,11,14,243,180,6,119,137,115,159,195,62,7,48,240,60,229,207,177,26,+164,174,141,165,221,141,27,222,121,44,80,155,199,186,108,90,202,239,205,163,+43,124,169,185,254,130,160,200,138,73,200,140,116,123,132,180,234,82,218,200,+234,241,66,110,176,127,194,47,235,226,206,135,71,40,147,90,71,102,22,77,+130,22,28,62,53,159,217,6,92,183,58,238,89,227,91,96,72,87,139,182,+123,254,21,7,44,98,202,109,103,137,223,88,216,35,127,98,46,92,78,78,+228,29,149,52,226,198,103,135,30,21,239,206,86,176,89,166,195,83,69,241,+7,74,225,9,31,115,254,47,11,245,155,156,237,23,159,247,204,218,99,34,+79,78,139,132,6,22,193,209,224,66,202,94,175,186,239,136,8,9,92,157,+148,236,155,250,169,252,172,247,117,45,79,144,105,249,160,209,129,93,64,100,+85,163,113,194,212,63,131,209,219,148,205,192,107,14,155,28,98,40,91,73,+248,179,249,251,202,6,169,156,92,52,224,49,150,63,104,248,251,94,43,246,+212,43,38,201,218,65,133,159,20,23,28,12,220,182,80,187,22,40,0,88,+58,136,12,132,65,177,6,34,63,244,169,96,91,160,228,142,126,164,75,35,+235,197,87,214,178,134,2,94,51,38,6,189,79,134,201,160,130,55,224,12,+199,75,240,154,20,32,220,226,199,217,245,94,136,26,77,253,187,145,194,239,+79,58,137,134,23,162,174,67,7,92,10,138,51,146,109,152,158,250,8,232,+167,152,82,190,35,82,80,81,182,194,184,184,137,250,37,59,113,155,243,16,+159,206,230,204,2,5,109,147,155,33,138,124,129,131,210,23,206,214,159,87,+198,71,136,32,52,141,75,144,107,96,71,146,222,227,7,152,240,46,112,195,+206,125,48,149,134,153,46,210,194,157,189,201,186,195,19,107,27,114,168,8,+213,214,211,107,0,4,156,190,7,117,141,132,233,184,8,154,130,132,102,155,+74,84,179,131,188,16,232,153,112,147,98,18,22,20,169,17,132,15,195,10,+210,237,36,118,183,108,198,77,206,136,183,224,54,47,69,3,173,62,1,255,+124,151,118,163,161,223,108,113,208,114,44,222,164,28,43,230,108,197,105,130,+179,161,188,25,156,108,185,75,70,220,229,119,38,182,21,207,61,172,26,0,+41,201,66,129,196,168,163,242,174,186,120,174,201,182,97,31,12,102,174,160,+33,171,110,51,174,241,239,162,112,36,203,213,51,134,129,182,113,174,232,170,+242,5,177,197,28,188,149,109,101,168,208,166,186,193,121,158,112,217,125,98,+180,160,76,166,0,109,186,240,76,213,170,20,202,163,118,110,121,232,114,251,+26,32,86,192,215,209,118,85,43,228,247,52,187,20,7,39,220,41,236,111,+227,16,83,64,216,74,52,136,194,126,85,58,191,197,182,188,41,216,84,5,+192,24,110,101,228,44,112,171,61,122,247,30,117,118,211,87,231,225,97,41,+153,53,236,150,87,38,77,40,72,37,118,18,185,124,137,172,46,144,23,182,+175,49,245,162,116,226,233,10,7,233,181,2,113,108,163,231,96,32,169,230,+151,207,173,14,174,164,19,236,108,252,106,218,203,156,220,177,50,138,141,150,+82,119,6,123,198,193,212,77,55,93,124,4,30,47,187,60,58,22,221,4,+26,64,45,104,42,47,1,254,229,232,56,20,253,182,18,55,142,231,127,168,+52,152,223,99,78,32,228,174,25,131,204,5,156,58,124,80,155,74,32,114,+137,252,26,212,185,44,32,232,41,166,149,53,94,26,253,112,30,14,189,168,+138,187,67,63,232,12,95,84,215,231,234,229,68,51,248,217,72,26,167,38,+5,103,54,148,50,29,246,67,238,99,136,41,43,166,104,105,193,239,106,82,+131,206,8,107,26,199,151,9,190,57,52,234,194,34,229,123,247,204,129,22,+214,71,165,151,161,38,191,87,48,17,229,87,183,187,35,11,190,66,183,178,+52,231,179,253,163,60,183,0,183,189,13,55,11,252,13,253,5,238,219,169,+145,109,74,4,239,65,78,24,123,75,82,230,151,123,113,51,139,83,138,111,+171,23,87,173,160,95,10,124,120,11,158,204,90,240,240,185,35,69,181,74,+232,41,68,32,147,208,149,214,54,138,212,16,214,38,163,119,168,17,184,136,+77,190,123,153,243,87,6,114,74,82,234,87,79,111,55,173,155,2,72,210,+233,106,173,129,67,252,147,103,185,90,34,118,1,145,167,126,51,44,126,26,+203,3,149,206,149,245,143,105,193,51,69,98,225,13,95,99,82,101,239,158,+156,153,87,126,71,110,216,145,105,5,98,0,241,78,104,184,190,243,5,191,+104,100,165,143,223,255,26,101,127,195,148,3,106,240,166,145,142,63,25,96,+81,41,156,227,53,215,168,128,25,5,205,126,161,58,79,190,222,129,21,49,+100,248,28,17,27,58,43,52,42,29,38,176,238,82,11,154,20,5,123,28,+95,181,13,66,219,139,29,23,231,221,215,250,242,174,147,53,163,212,165,244,+22,146,155,129,145,132,115,50,189,199,62,23,0,84,232,242,161,1,211,88,+239,187,72,225,169,105,212,98,232,192,239,20,155,241,219,252,79,134,97,127,+100,223,207,188,114,40,146,236,249,52,5,3,52,168,177,102,140,181,2,98,+201,178,204,185,249,21,48,83,125,110,70,85,208,243,64,210,29,177,217,88,+50,83,48,58,7,92,102,242,25,121,198,212,54,79,65,140,128,33,119,116,+15,136,65,49,35,42,93,99,14,185,209,35,233,141,206,159,28,249,106,124,+225,218,46,124,124,80,244,173,213,4,154,244,209,213,116,249,199,178,121,127,+9,148,104,94,19,145,38,56,117,246,79,172,234,113,10,184,221,21,17,226,+25,184,80,50,191,233,185,22,211,208,121,114,33,77,203,168,189,145,36,146,+68,243,27,198,174,20,36,104,170,244,120,188,159,144,85,73,0,220,87,99,+170,137,97,127,183,117,70,191,79,106,17,138,34,103,125,34,206,13,25,39,+174,255,72,117,238,156,70,121,128,32,2,178,64,8,126,106,8,35,25,178,+48,77,52,171,117,40,212,124,3,93,55,191,87,15,135,230,78,173,79,54,+55,79,114,71,67,62,162,72,31,48,250,177,40,189,168,231,145,176,21,89,+152,153,106,110,183,48,176,59,106,235,65,86,18,27,101,209,107,149,149,20,+120,130,43,114,93,251,153,0,68,15,182,83,21,45,92,48,95,172,12,202,+91,173,91,18,81,16,35,158,101,213,112,206,201,160,255,27,152,244,108,42,+201,67,16,210,124,109,115,205,247,92,7,71,167,57,28,227,16,190,167,250,+71,45,69,14,39,82,37,47,109,247,148,188,141,27,48,175,138,161,241,213,+212,220,197,43,189,244,199,106,62,65,245,75,168,50,67,241,78,235,77,28,+250,216,221,78,132,183,216,189,145,162,148,211,54,27,64,47,164,17,163,239,+120,156,34,5,146,52,174,8,223,74,43,171,163,176,79,31,201,208,226,60,+216,232,161,111,87,243,82,227,29,131,124,118,195,80,196,67,202,67,103,175,+171,158,164,175,104,141,106,191,134,222,74,178,35,116,116,148,130,155,148,219,+78,133,119,92,156,237,111,190,131,185,0,187,112,234,9,204,79,218,179,111,+43,75,178,157,147,104,245,47,50,10,2,131,172,110,99,226,94,189,124,153,+34,63,174,222,20,60,38,223,128,213,122,100,198,181,4,62,111,15,71,226,+210,185,209,208,222,51,138,217,92,190,31,10,217,63,34,55,179,179,167,34,+183,210,224,25,154,183,86,170,37,189,163,114,87,198,167,78,95,1,201,90,+97,106,3,164,205,106,91,5,47,170,70,165,40,101,120,140,77,36,189,180,+212,245,189,146,201,254,252,104,202,221,2,106,133,9,41,71,159,101,88,71,+11,225,200,103,133,232,22,153,34,28,223,101,162,42,135,31,155,43,161,214,+48,140,211,39,157,68,73,46,122,28,22,203,158,2,222,200,97,5,42,101,+132,167,107,33,190,210,99,95,51,236,21,4,164,198,75,53,54,125,69,96,+112,249,75,205,162,51,128,150,127,254,51,134,85,252,191,195,211,174,246,25,+82,216,27,29,63,129,235,241,19,189,41,208,178,191,255,85,69,95,72,200,+186,173,194,81,38,59,46,49,6,36,0,182,161,112,106,166,85,55,124,21,+176,127,154,144,8,25,70,104,154,180,31,251,35,245,25,138,42,71,65,150,+118,225,13,27,202,192,188,247,115,155,112,43,135,10,40,180,193,133,12,114,+144,169,48,66,19,43,208,60,194,34,115,238,22,87,109,54,107,1,187,111,+234,94,155,239,213,174,19,42,100,207,130,66,216,179,122,82,84,100,101,92,+59,166,152,53,131,213,59,34,15,185,44,191,34,255,124,154,214,209,39,216,+191,111,0,162,147,224,47,183,154,63,187,231,163,66,202,10,149,111,20,164,+134,68,79,230,4,174,188,153,28,187,64,48,64,162,7,220,43,94,4,94,+96,97,19,230,167,198,86,146,25,125,131,74,98,208,209,236,147,192,239,108,+140,109,91,88,58,194,236,169,167,88,122,177,82,207,16,137,242,27,103,125,+192,159,224,19,175,50,99,234,65,79,215,64,211,91,194,217,57,238,100,190,+5,206,114,91,168,230,101,185,252,184,166,35,160,183,155,201,207,239,73,6,+120,240,193,27,169,234,44,5,138,151,210,71,51,108,255,93,120,93,56,83,+232,28,200,238,41,228,42,102,103,233,175,94,106,1,229,246,162,182,76,222,+223,92,9,171,233,191,175,136,200,164,239,24,15,171,27,114,3,241,250,243,+197,114,132,99,153,61,192,105,171,92,174,200,14,44,103,207,232,205,239,16,+27,107,136,168,2,130,136,182,189,2,233,196,178,155,225,54,130,149,48,186,+62,51,52,72,121,231,235,101,149,158,30,149,10,122,208,230,47,77,6,108,+183,197,233,176,204,98,225,252,227,75,2,26,89,68,175,233,178,79,190,249,+94,46,59,233,105,25,85,11,100,13,46,186,239,194,246,143,148,203,25,3,+245,45,67,92,46,212,233,215,189,3,128,231,151,247,24,243,146,200,229,37,+31,129,103,235,61,3,111,3,107,127,33,140,180,127,33,216,79,19,99,211,+6,27,223,9,89,195,161,144,187,128,26,103,223,31,48,141,146,225,63,37,+0,8,61,192,89,185,17,9,65,93,62,92,81,24,75,139,137,147,96,126,+220,74,168,174,189,214,70,66,8,23,251,175,248,87,205,23,254,65,166,209,+18,92,157,64,15,213,136,23,87,106,51,67,139,87,25,67,228,205,54,230,+232,123,78,114,251,113,161,212,105,108,117,15,17,229,16,73,47,60,66,170,+185,230,147,237,98,195,44,36,44,208,61,241,70,46,44,198,173,13,79,252,+72,2,18,87,117,58,136,54,53,147,224,178,180,113,221,104,55,89,51,120,+153,117,49,79,18,63,0,96,254,199,251,33,2,2,151,255,173,231,230,186,+25,218,163,149,199,101,17,68,116,192,32,80,96,155,242,57,124,144,163,38,+184,244,168,64,20,7,201,159,126,168,45,188,99,135,149,31,236,10,238,10,+10,252,224,49,75,6,175,54,240,51,85,200,90,58,220,87,243,173,13,224,+195,120,140,32,202,28,62,223,228,242,149,166,180,8,130,161,45,51,24,74,+147,221,20,179,38,62,92,100,11,154,31,173,236,181,34,163,45,224,67,109,+93,100,143,110,46,148,171,236,7,74,177,207,122,29,136,73,78,100,205,127,+8,52,160,103,207,64,170,82,195,220,228,134,138,149,76,250,133,66,170,39,+23,41,86,132,112,209,231,111,40,173,138,78,253,141,249,67,224,34,180,243,+198,161,120,237,14,36,46,40,110,239,48,109,85,74,188,180,240,38,254,36,+153,61,98,29,49,31,194,171,12,28,147,151,235,140,19,65,63,247,109,108,+188,58,166,61,133,212,123,129,128,71,135,47,201,227,158,214,110,81,112,119,+99,214,41,3,224,10,39,46,244,241,255,74,109,55,255,132,185,124,64,214,+43,50,123,161,141,220,63,92,66,169,208,229,136,41,78,76,207,100,54,63,+193,187,222,215,24,86,123,233,180,221,149,204,165,33,73,24,238,144,226,6,+16,24,29,13,113,169,28,89,13,92,155,235,55,181,253,76,226,16,209,53,+24,211,30,6,244,203,30,17,250,147,91,3,167,161,85,19,80,224,201,135,+242,241,234,168,190,206,41,91,67,209,39,182,150,31,245,178,197,101,84,131,+194,99,128,165,201,200,243,139,163,24,179,236,130,211,184,74,234,40,239,140,+154,146,125,247,157,218,122,147,16,32,1,149,142,251,111,16,202,254,247,199,+182,88,234,179,86,245,70,136,215,28,142,109,29,103,44,9,133,191,88,60,+201,96,147,74,54,249,42,83,207,4,54,102,2,57,140,159,233,109,87,231,+197,54,97,30,104,56,133,124,17,28,102,79,81,147,142,218,226,147,237,192,+217,151,212,79,208,36,201,243,159,169,32,118,239,156,195,54,135,73,236,33,+106,126,125,2,81,197,159,184,114,82,101,221,174,29,115,118,81,168,188,207,+142,12,148,207,167,3,180,193,250,242,122,130,23,57,38,170,138,99,69,197,+96,191,212,97,24,14,74,92,236,209,155,151,150,135,170,84,79,71,240,207,+230,124,198,223,237,118,199,144,241,210,15,59,75,179,237,137,89,159,246,227,+223,64,37,145,74,211,108,40,114,253,224,83,206,45,246,28,84,28,77,107,+200,90,165,180,237,24,243,52,13,199,165,13,255,113,161,251,67,175,39,73,+193,79,219,192,137,178,227,178,165,203,168,70,255,13,27,3,1,127,131,88,+201,125,61,161,87,24,5,87,230,236,188,111,19,147,148,114,85,80,56,185,+5,195,17,51,136,158,136,59,152,238,222,96,206,57,110,8,134,71,255,72,+87,152,29,212,162,39,76,158,4,35,221,166,135,103,154,171,100,136,158,72,+74,208,138,227,46,237,141,7,96,46,41,199,255,99,156,134,103,48,91,254,+198,232,182,75,119,40,129,179,56,80,146,108,102,252,184,196,214,155,78,158,+40,68,147,118,191,186,171,147,187,133,136,251,40,96,99,9,132,68,211,250,+73,56,80,135,94,177,46,53,85,90,174,142,72,249,16,50,47,4,133,137,+240,138,86,208,201,163,181,7,160,208,193,211,94,148,196,215,42,206,103,172,+6,162,147,179,127,174,129,140,169,78,241,202,118,169,211,113,52,212,40,142,+18,242,241,133,107,224,105,81,249,150,211,242,125,249,203,34,174,145,134,185,+178,249,41,218,94,239,92,215,212,109,111,190,30,212,24,129,12,251,110,125,+137,127,248,232,97,57,223,80,187,169,77,83,89,215,205,43,83,194,45,98,+85,194,176,87,66,134,210,85,217,231,47,70,58,125,45,159,168,29,70,207,+85,228,27,90,145,243,196,3,35,32,9,65,219,218,162,159,250,29,185,169,+91,19,225,4,141,204,83,121,93,3,145,18,184,2,140,58,111,255,125,128,+74,78,143,56,92,232,93,47,244,133,245,34,20,254,198,16,155,198,113,88,+24,21,68,93,196,253,231,230,9,115,117,90,233,101,89,136,112,167,230,134,+118,140,123,202,160,118,106,151,35,74,0,186,127,25,112,73,209,197,133,49,+196,148,202,233,96,45,219,133,153,228,235,79,179,151,29,112,126,17,11,248,+164,42,235,75,126,176,13,195,213,9,102,129,112,154,229,55,240,56,68,168,+223,167,29,252,72,247,184,176,170,114,183,180,41,48,146,61,122,251,101,46,+31,122,110,70,224,72,217,250,191,145,135,251,89,23,13,154,235,74,70,194,+10,255,76,138,19,203,23,162,217,227,156,82,141,142,16,147,225,83,62,236,+209,245,42,223,29,31,7,31,140,73,72,220,224,123,167,149,115,37,129,111,+253,159,108,226,87,178,108,162,224,215,74,72,60,1,206,228,193,35,161,205,+224,166,247,170,251,20,176,66,49,219,126,109,2,54,117,254,3,244,117,92,+231,155,168,187,127,225,68,43,68,36,218,225,237,140,16,166,75,200,20,221,+98,74,16,42,209,14,210,174,70,48,20,239,20,196,104,16,122,209,180,94,+135,113,146,237,13,36,105,175,18,220,170,118,169,108,206,228,180,196,227,208,+136,137,87,235,137,105,61,173,129,215,69,142,233,3,44,76,15,142,248,68,+72,213,154,98,235,66,157,159,224,237,201,124,129,51,245,4,252,91,17,100,+228,103,34,242,45,178,52,53,125,71,82,172,101,112,177,126,116,136,179,126,+181,83,238,195,76,110,251,102,202,95,17,234,8,218,252,152,163,79,68,221,+236,83,202,10,196,107,71,154,164,121,162,182,4,83,130,73,198,197,202,161,+210,71,230,255,141,192,48,229,76,165,204,177,42,46,37,203,170,250,136,247,+136,209,239,180,215,167,82,184,206,174,204,91,236,198,125,145,191,168,216,27,+8,47,33,55,3,108,11,157,176,184,191,159,44,3,51,171,168,146,213,169,+74,111,139,237,183,5,73,3,237,207,168,197,253,66,233,137,145,155,17,42,+79,140,249,240,191,147,128,164,65,104,177,77,57,207,55,115,15,172,94,190,+58,251,242,133,225,224,1,199,197,203,39,61,32,128,116,18,207,47,38,159,+43,138,187,93,104,59,195,146,224,200,250,1,40,74,188,65,125,37,177,217,+59,179,153,237,39,37,140,63,141,205,45,205,163,199,208,224,244,247,103,42,+233,248,202,246,120,77,106,128,230,22,134,131,142,56,54,206,138,59,186,94,+51,242,80,30,177,75,206,210,140,222,176,45,33,98,205,253,205,168,93,211,+49,120,186,103,201,230,43,175,76,200,188,219,203,98,113,232,67,122,5,136,+180,73,191,129,81,22,27,16,106,74,142,246,91,218,248,132,177,170,129,32,+136,88,204,229,219,99,77,155,3,99,37,34,16,208,25,70,134,147,147,252,+43,59,77,164,165,235,43,32,201,17,188,139,13,173,216,9,132,62,206,50,+142,200,38,162,52,78,194,32,231,113,100,221,89,144,179,202,98,133,4,154,+181,211,144,151,224,197,45,22,101,8,137,223,130,162,87,42,164,84,225,81,+136,82,62,12,12,149,169,171,143,172,196,50,106,178,10,174,135,117,253,147,+68,212,101,184,9,166,94,154,36,104,237,37,18,255,58,157,7,227,158,60,+172,19,119,107,87,156,171,192,135,3,94,49,89,22,50,112,71,188,80,172,+111,199,211,62,230,11,222,76,21,161,62,206,144,212,23,186,175,52,74,81,+195,6,188,79,180,198,114,183,14,3,193,8,51,164,212,51,224,56,180,54,+33,148,187,8,228,147,76,68,180,72,45,210,135,108,131,166,8,0,76,243,+214,162,63,212,38,64,116,128,148,133,19,43,134,159,105,179,199,218,112,42,+12,121,183,228,242,92,185,70,142,28,125,253,16,242,255,203,5,19,254,156,+127,10,225,253,150,64,175,127,145,150,235,11,178,195,204,91,209,46,222,115,+98,159,25,18,118,22,186,184,113,166,87,85,51,57,228,97,198,133,106,219,+159,209,153,185,160,111,79,215,250,123,81,144,116,92,27,105,45,124,193,57,+13,164,254,46,224,29,68,40,154,203,121,66,111,164,94,191,33,60,191,208,+96,247,69,228,18,191,28,0,83,198,191,86,32,123,252,132,84,23,33,149,+32,206,89,190,212,37,176,90,243,46,233,25,195,43,89,40,228,104,187,205,+13,156,79,253,190,174,114,217,33,207,95,216,94,143,243,183,182,107,156,75,+117,75,192,85,135,121,202,140,231,39,237,31,48,185,47,94,207,163,164,183,+89,155,165,243,253,186,184,17,251,182,25,24,236,233,10,217,105,4,0,132,+247,107,231,179,214,187,112,7,117,37,135,165,84,197,157,48,4,231,190,139,+250,246,192,86,246,57,120,7,40,253,90,40,184,40,37,251,212,108,61,234,+201,35,122,193,17,157,125,192,83,95,107,116,31,183,24,41,244,150,206,22,+134,65,65,33,1,3,78,207,117,163,99,5,110,219,185,198,161,118,74,236,+52,209,63,233,13,82,59,94,98,162,118,217,214,225,225,203,222,186,8,78,+145,10,225,83,239,20,252,218,44,108,142,176,47,240,51,65,64,70,222,86,+132,7,241,79,143,213,138,229,222,232,39,50,222,222,161,204,76,0,142,25,+73,27,156,249,133,155,175,152,81,30,120,224,165,4,141,222,236,229,37,183,+178,131,209,210,175,139,147,13,89,141,64,99,219,138,131,6,180,115,237,133,+203,198,83,71,106,212,163,248,176,75,215,76,29,26,48,70,228,70,229,12,+73,135,123,154,135,230,204,143,166,172,32,101,223,185,44,132,196,241,245,16,+57,187,21,237,64,255,184,7,212,32,222,38,29,247,247,165,116,71,205,214,+129,43,163,234,35,198,65,240,145,132,203,43,49,250,110,179,227,63,14,161,+22,105,72,23,216,147,141,153,12,99,6,178,187,170,46,251,113,191,163,3,+28,131,165,132,192,123,232,254,157,229,89,93,101,171,185,110,94,229,168,182,+95,90,76,153,167,168,96,36,213,170,194,135,95,119,67,160,57,181,24,122,+226,132,236,83,219,39,223,222,85,90,177,95,69,82,138,21,243,179,13,172,+11,113,135,221,154,235,65,253,124,225,142,242,189,222,18,167,35,233,139,41,+96,46,209,125,238,184,18,206,224,207,211,188,144,121,4,223,16,215,87,71,+252,248,244,176,190,94,185,20,110,194,21,121,24,45,205,245,250,81,48,203,+12,84,121,51,221,153,19,94,62,120,227,93,252,208,229,137,22,21,191,72,+136,211,45,239,211,135,107,123,106,177,86,171,140,253,6,151,29,45,223,237,+53,151,102,199,215,181,67,196,178,191,161,249,66,123,22,203,8,142,78,80,+30,152,132,137,102,27,188,157,121,113,195,193,57,56,66,136,91,25,199,188,+151,56,90,181,49,39,134,150,101,100,208,155,103,6,173,132,195,5,187,22,+11,248,108,221,148,24,24,191,127,60,30,129,216,10,246,6,50,212,103,145,+110,207,124,129,24,192,100,174,68,133,141,3,202,223,195,209,122,132,45,127,+243,127,20,128,56,246,180,144,91,198,133,183,11,73,9,214,67,10,166,248,+241,174,55,105,168,178,17,122,113,44,253,55,41,77,106,128,15,109,161,22,+116,15,249,112,54,13,5,172,77,75,158,64,13,31,170,78,6,120,163,176,+156,100,239,129,213,74,22,70,188,190,147,150,231,213,179,160,7,34,245,249,+255,230,8,219,175,88,227,45,235,226,226,105,163,87,76,212,235,198,164,126,+51,168,105,136,136,89,84,184,129,99,204,209,53,227,174,37,65,63,174,214,+12,64,30,39,115,61,185,216,39,54,160,79,67,248,27,191,68,29,124,185,+90,122,226,150,7,241,16,196,149,242,36,78,17,96,148,147,125,70,9,61,+135,46,126,153,254,98,183,48,203,247,210,243,247,62,156,140,98,84,25,114,+52,214,218,108,69,70,115,80,10,189,243,209,58,173,81,24,88,187,132,25,+28,115,162,72,59,57,140,78,58,123,46,200,173,125,254,253,179,150,204,6,+254,254,62,15,170,117,107,88,56,130,135,9,220,226,79,173,182,38,151,75,+146,147,102,234,11,96,247,154,156,22,78,68,173,173,211,33,116,101,153,223,+29,54,196,205,7,244,99,197,207,177,124,117,225,246,218,4,198,2,68,25,+79,111,209,72,164,54,4,114,138,47,254,133,244,71,167,40,234,177,221,92,+236,118,149,187,246,51,244,248,126,68,7,32,178,205,245,90,148,175,219,201,+213,182,205,193,236,134,189,170,82,54,124,226,210,142,111,80,211,84,113,119,+82,128,169,43,113,218,24,165,138,111,63,71,138,250,134,45,84,130,233,1,+24,14,147,125,161,53,223,70,233,217,52,15,188,127,216,35,253,125,86,176,+155,76,88,225,11,147,110,83,90,241,255,241,10,208,55,221,156,168,36,130,+98,120,114,16,96,205,81,248,85,235,63,114,38,89,173,9,76,48,57,218,+244,12,91,97,57,141,167,251,66,35,8,104,80,107,143,62,213,42,243,71,+20,25,8,123,235,252,21,126,186,154,50,2,220,167,73,211,10,132,118,180,+127,212,162,120,32,79,73,129,149,168,254,130,13,134,42,31,52,225,192,211,+175,84,62,253,185,174,242,66,241,213,255,138,37,167,215,217,174,215,44,162,+46,211,83,43,234,218,51,196,197,245,54,11,99,220,221,222,84,39,160,90,+149,206,146,134,90,156,154,114,148,53,205,211,132,215,94,77,228,121,24,62,+125,237,177,42,156,22,221,88,67,199,38,58,143,68,186,186,237,114,205,24,+148,41,71,36,52,78,0,234,30,226,36,19,25,203,72,173,35,138,13,140,+251,95,117,190,41,12,112,128,174,130,244,214,150,118,65,75,187,16,44,150,+214,3,19,50,91,136,200,143,210,241,228,0,110,19,81,71,52,226,69,44,+242,246,237,174,62,247,35,233,249,240,99,124,42,8,231,170,156,231,206,21,+50,175,84,161,120,88,223,222,239,3,80,193,72,121,70,213,117,245,174,160,+149,102,229,227,181,23,62,227,28,103,136,188,106,96,177,87,202,52,18,168,+182,51,121,239,145,131,242,135,9,12,27,254,168,157,226,64,224,27,113,4,+110,90,80,12,223,187,4,53,24,52,128,72,149,162,175,27,95,231,101,57,+76,184,60,66,12,83,134,192,17,218,244,119,113,240,120,68,18,96,98,73,+240,38,149,185,230,136,186,40,234,126,252,88,17,91,208,189,170,223,1,235,+42,29,229,139,114,73,36,209,51,97,200,16,228,247,102,225,97,149,2,66,+61,42,35,239,150,167,140,70,43,225,240,70,120,178,53,83,242,9,53,230,+188,208,196,107,216,116,204,169,13,119,107,136,51,92,186,248,168,68,120,27,+240,214,234,115,146,110,244,146,113,92,225,200,172,232,151,254,229,26,242,79,+93,31,225,86,47,94,225,138,159,23,212,161,191,31,151,181,229,133,190,147,+191,175,135,226,65,82,107,46,141,88,163,6,239,254,104,73,22,45,94,52,+191,155,1,113,240,88,33,145,173,238,100,120,174,244,147,55,41,49,201,134,+179,72,19,241,236,103,165,71,154,126,17,251,122,241,127,0,118,136,134,67,+108,197,71,205,88,251,9,219,95,143,57,78,52,101,128,26,74,82,122,167,+254,210,18,225,122,79,10,90,60,142,150,247,161,90,163,194,96,171,220,27,+45,95,69,108,205,87,233,191,118,241,134,57,128,237,98,179,20,45,45,56,+74,181,14,127,129,12,186,152,1,242,23,201,205,95,197,64,11,183,245,213,+52,136,207,60,88,245,142,68,175,92,205,143,229,146,72,240,126,59,91,23,+65,106,45,226,99,26,241,32,212,139,60,117,125,196,162,207,188,224,195,74,+24,79,36,43,184,2,54,139,113,13,16,169,212,29,16,250,170,144,28,206,+242,79,133,193,149,46,248,74,214,223,173,72,206,64,214,108,184,51,245,176,+238,115,107,222,253,204,186,69,239,70,83,185,45,173,81,203,163,29,220,97,+149,80,67,141,127,50,60,187,56,124,43,37,121,66,246,44,180,166,136,31,+219,213,122,66,79,146,108,44,234,2,15,122,93,30,25,231,197,202,176,56,+28,62,243,104,156,223,37,175,189,20,194,185,20,55,82,158,103,114,58,14,+226,10,18,192,128,158,188,189,185,17,155,233,101,241,5,40,199,75,197,209,+77,186,242,210,186,59,231,98,43,132,183,161,98,241,218,34,170,219,96,190,+156,183,52,110,17,157,184,196,107,39,255,39,251,64,27,4,75,210,81,202,+185,17,169,199,220,113,132,52,96,206,10,21,197,210,217,103,136,3,5,89,+65,224,185,193,150,89,52,54,193,137,124,234,81,89,112,148,68,219,54,70,+164,49,201,254,142,1,127,157,203,22,105,253,103,211,245,22,175,149,183,119,+175,135,237,41,13,112,225,176,163,179,198,87,28,50,116,233,16,184,85,33,+146,49,85,223,87,168,68,127,181,114,172,2,70,75,36,117,178,143,82,151,+49,162,134,226,147,105,148,8,48,232,240,92,185,98,155,9,23,73,157,196,+171,177,49,112,220,43,205,146,58,5,20,137,214,215,155,30,136,219,18,104,+182,9,64,208,176,189,227,151,169,76,233,121,216,201,108,18,110,233,75,116,+149,172,207,18,105,97,237,159,164,167,117,241,137,253,197,213,192,209,160,70,+49,21,242,82,119,110,155,87,83,225,26,244,36,179,21,247,87,6,185,48,+214,235,192,84,214,254,106,100,116,71,218,13,98,9,31,191,3,76,123,28,+158,93,203,151,145,176,49,98,78,112,44,12,110,81,25,222,135,156,223,213,+3,242,5,216,224,212,203,135,216,80,167,221,255,106,214,4,116,21,18,80,+38,50,101,47,126,61,162,254,123,108,54,18,46,184,89,71,90,29,224,102,+65,121,255,229,160,73,63,65,183,90,61,49,235,177,96,108,109,248,122,182,+166,128,226,232,83,111,144,150,249,171,18,205,148,158,23,112,30,171,25,180,+9,18,248,17,89,161,162,203,44,124,114,185,184,114,213,126,108,173,204,81,+67,188,139,72,196,130,29,148,209,32,116,9,128,47,106,51,193,81,254,209,+25,125,78,103,231,47,238,39,105,110,196,55,231,52,28,252,128,104,227,21,+115,66,63,95,97,129,33,219,194,225,227,195,78,204,174,108,60,19,90,201,+135,189,116,133,65,27,118,219,69,175,20,28,17,24,193,248,129,13,229,125,+230,148,161,172,107,42,69,227,95,63,196,4,88,234,168,118,92,25,62,129,+69,255,86,5,5,223,19,75,118,169,78,226,167,172,71,210,31,131,7,129,+131,29,61,78,213,129,245,68,207,15,207,33,150,172,236,2,90,246,35,139,+246,145,27,88,82,66,125,85,32,201,81,76,214,173,245,11,118,57,37,235,+123,155,228,111,98,131,184,121,58,198,180,240,138,226,76,146,88,247,54,193,+62,202,20,247,214,31,206,42,49,115,173,191,224,11,152,92,55,179,188,6,+16,15,21,205,34,81,162,218,168,206,47,13,80,34,255,120,148,121,213,110,+15,254,81,133,28,141,175,142,52,200,121,168,89,145,151,153,68,85,235,236,+203,219,68,33,88,84,35,139,131,56,138,100,174,163,90,100,182,153,60,147,+174,176,249,15,184,231,158,46,183,116,161,183,93,213,63,22,103,128,6,122,+171,186,184,212,100,82,53,28,26,173,83,147,72,3,79,171,187,37,130,214,+193,44,17,9,220,190,71,186,236,3,249,22,65,205,226,247,127,159,49,171,+129,113,157,1,65,0,149,240,34,159,169,52,12,155,24,163,40,127,86,32,+72,10,42,18,151,107,213,102,150,29,61,248,170,182,144,91,254,136,157,33,+47,50,59,21,50,27,193,132,255,137,35,27,152,153,46,9,213,72,48,253,+22,241,131,149,218,115,69,116,134,253,19,103,238,25,30,3,118,54,49,35,+187,244,71,16,20,164,18,153,86,48,243,1,222,16,191,143,13,247,242,250,+207,133,182,152,126,224,165,108,241,174,90,9,106,225,250,193,8,118,113,103,+124,215,64,34,3,11,208,143,249,104,148,15,221,4,38,226,53,21,31,58,+160,104,255,254,170,43,21,243,36,154,226,98,148,102,67,10,131,238,242,199,+147,122,254,138,101,11,128,225,103,156,192,186,108,30,80,139,249,60,156,41,+100,174,225,223,53,141,58,85,156,213,124,42,144,7,144,229,252,89,164,50,+109,252,59,63,108,21,114,213,220,55,171,195,175,58,125,244,247,131,93,33,+116,189,38,237,126,41,205,223,36,72,33,43,154,2,66,144,39,49,192,232,+15,209,234,80,237,123,146,22,177,0,122,142,150,48,54,71,139,211,176,35,+52,48,179,224,146,11,219,199,155,230,80,137,76,115,56,26,210,29,89,88,+172,126,236,151,251,178,11,144,152,124,208,200,146,116,34,124,171,178,180,18,+183,18,74,74,170,0,74,25,47,91,72,186,86,216,15,13,107,223,140,54,+135,59,12,28,160,99,241,223,82,220,248,176,251,241,38,206,227,125,100,101,+48,76,120,197,255,245,253,49,235,134,7,26,53,85,50,212,135,102,197,195,+4,191,167,34,26,204,27,30,248,5,35,15,109,154,117,209,96,13,133,223,+12,148,83,213,14,251,125,152,72,223,159,124,157,69,117,14,209,241,83,235,+80,248,242,155,40,186,253,243,166,67,126,63,119,164,237,23,73,175,93,70,+186,219,47,185,223,191,220,211,16,29,93,51,89,239,250,230,81,144,234,209,+89,241,136,24,144,33,15,179,46,182,156,156,24,246,249,2,40,2,159,146,+17,124,193,87,176,118,35,79,28,143,20,230,150,209,38,120,201,64,142,0,+201,187,102,120,216,238,222,181,79,47,132,24,212,17,54,90,100,246,28,197,+187,144,82,219,147,234,108,98,180,217,82,167,177,30,192,129,191,19,120,215,+144,107,24,78,45,76,226,205,86,252,69,3,219,162,85,40,53,251,93,130,+177,242,0,205,78,168,38,124,148,1,54,34,98,193,5,39,234,239,180,180,+0,212,221,17,29,234,140,62,207,148,7,65,114,118,181,22,132,221,141,239,+236,147,96,66,143,222,100,75,10,18,33,116,195,177,241,120,146,203,175,162,+38,5,141,152,165,172,171,22,202,2,134,95,155,165,124,186,42,74,190,22,+105,180,180,53,210,88,236,139,90,194,18,106,125,40,1,118,173,118,32,203,+35,0,69,57,37,118,184,67,94,222,65,126,155,189,139,147,219,48,177,52,+250,160,200,199,49,154,252,4,97,158,76,27,125,84,213,113,12,164,198,112,+92,124,238,144,245,145,110,241,73,53,174,31,18,3,138,85,232,3,243,124,+45,252,172,171,248,118,144,222,167,218,19,236,199,140,139,3,120,188,222,128,+174,95,116,36,125,154,138,104,12,170,32,255,113,200,172,167,83,170,248,174,+170,117,35,25,95,65,194,49,181,131,230,168,150,240,208,148,92,232,53,4,+198,14,147,173,81,1,8,188,150,128,43,69,70,243,48,70,120,94,105,191,+141,236,149,159,90,171,201,67,112,73,140,117,54,13,18,7,71,135,51,4,+241,233,228,98,11,138,70,59,47,71,228,243,123,205,202,254,104,144,33,31,+106,190,71,252,192,226,126,125,137,179,131,158,231,238,245,136,99,151,107,122,+72,18,22,96,208,110,21,177,121,108,103,78,140,77,39,106,66,219,129,75,+145,113,153,80,237,61,94,179,158,207,65,57,129,144,210,55,33,165,152,255,+4,106,14,30,85,62,233,100,27,176,101,135,102,173,148,18,106,118,156,7,+244,129,11,137,48,60,173,237,136,175,195,109,169,85,150,125,157,185,0,157,+155,209,166,200,123,231,175,78,183,77,67,240,217,168,73,247,37,225,7,177,+145,245,246,115,186,2,27,138,219,1,194,236,16,93,89,127,75,186,170,113,+130,44,131,63,180,97,75,83,124,70,82,231,57,144,193,98,185,95,155,119,+219,104,232,172,110,41,93,244,23,28,84,148,132,5,45,120,204,71,48,67,+167,204,70,165,25,97,251,46,35,79,136,113,27,248,126,156,10,70,95,117,+83,118,116,11,194,172,33,218,31,104,164,217,95,234,170,161,172,243,251,41,+222,210,150,139,29,61,49,59,206,11,127,11,143,172,150,8,71,214,55,5,+100,27,89,82,234,9,27,187,43,22,112,84,117,63,137,47,218,186,198,195,+242,161,81,119,245,144,62,181,197,45,159,142,72,97,171,224,15,224,248,167,+61,217,94,156,74,40,143,165,151,91,68,197,225,18,94,250,37,242,115,110,+26,238,146,172,115,211,119,92,34,52,247,121,46,110,151,126,70,53,39,232,+137,5,231,163,16,21,223,50,211,111,180,255,94,59,89,227,137,181,136,246,+66,204,245,186,55,215,228,158,152,116,167,90,149,200,172,0,79,132,189,107,+103,236,112,95,92,35,10,91,192,69,239,123,197,153,160,35,186,115,238,100,+239,99,131,212,225,133,234,133,94,167,19,147,71,246,206,75,19,9,175,125,+36,189,73,37,166,76,215,121,128,28,46,15,80,208,238,193,130,254,173,16,+92,114,108,131,218,77,250,167,234,196,221,174,245,91,98,184,34,80,71,56,+51,196,47,120,132,62,65,158,99,10,168,58,86,178,231,106,136,221,57,75,+234,91,242,56,50,203,243,86,68,133,112,196,150,63,128,52,63,27,234,50,+219,118,235,230,199,96,125,16,107,21,220,54,55,99,244,201,14,47,46,116,+62,32,138,255,38,11,94,63,10,202,233,14,100,156,104,175,228,151,73,186,+64,27,19,109,151,127,122,178,46,33,160,83,171,26,235,94,244,123,39,125,+137,89,7,213,105,92,174,59,121,232,33,21,130,179,66,214,127,125,153,125,+7,64,71,223,62,255,153,30,22,11,118,226,24,117,168,158,209,97,168,198,+111,98,210,184,208,32,62,36,39,146,42,250,137,53,220,208,65,88,224,153,+134,205,22,134,54,181,115,116,70,164,181,56,174,224,107,4,236,212,208,78,+98,213,12,192,221,139,63,66,142,157,8,237,17,18,144,173,46,92,181,11,+82,254,126,132,182,109,20,140,62,160,45,133,244,159,191,122,185,198,212,16,+74,66,58,31,31,97,112,57,60,154,121,178,112,74,132,20,214,68,239,220,+86,243,178,190,219,30,100,136,219,161,99,38,73,97,68,76,124,104,63,227,+13,207,25,246,31,64,31,166,155,198,111,208,55,130,152,34,191,31,102,95,+90,159,51,232,72,122,229,63,184,94,77,53,203,36,137,26,100,148,223,29,+242,89,125,76,110,132,170,124,29,104,154,119,248,64,129,191,116,127,205,125,+214,34,128,223,64,204,198,29,84,202,220,231,169,109,219,70,162,170,4,3,+248,205,47,125,9,145,207,110,133,114,248,158,11,145,175,50,110,146,211,5,+205,65,139,155,76,100,211,28,18,181,206,201,107,46,87,204,195,215,198,52,+16,225,250,131,242,1,129,38,28,235,160,126,5,232,173,146,142,153,145,12,+85,13,6,93,217,117,183,149,231,67,214,56,179,188,220,152,79,166,6,209,+27,249,153,26,17,12,118,255,5,43,240,97,36,62,133,239,13,38,134,56,+56,90,252,108,79,36,227,85,167,81,92,26,9,86,54,56,132,122,225,248,+73,82,223,145,173,205,186,130,68,52,123,229,133,107,191,109,67,181,200,166,+99,104,29,227,251,239,126,48,122,43,6,96,87,152,21,2,140,90,90,235,+214,109,236,121,185,226,143,164,249,140,88,16,187,54,61,144,121,175,68,48,+101,119,162,152,28,51,202,48,6,233,36,83,218,193,255,66,1,29,133,208,+236,32,159,7,68,212,109,105,79,200,35,100,19,235,243,41,168,141,1,121,+99,248,53,228,203,127,245,132,57,253,44,40,246,246,2,2,7,72,60,43,+60,122,127,208,153,143,248,228,196,117,72,168,191,211,46,62,250,129,201,232,+40,142,70,203,49,112,248,169,54,148,208,253,227,216,125,99,93,255,101,144,+74,149,64,222,72,90,57,24,172,43,6,178,179,253,235,131,18,235,192,222,+22,216,8,100,107,234,148,251,43,162,23,244,154,22,221,69,102,234,241,5,+76,78,207,191,49,155,121,111,109,138,101,135,17,173,182,184,211,242,131,100,+40,104,20,208,163,65,191,194,155,128,137,199,87,134,7,95,188,143,189,191,+198,136,76,171,198,59,138,161,132,170,57,168,247,239,92,199,195,207,94,95,+118,186,241,68,113,115,251,243,67,74,62,229,90,78,189,62,156,135,49,42,+208,233,38,110,127,36,136,87,224,4,65,146,222,215,226,247,152,47,216,149,+222,255,89,169,187,132,124,222,94,243,43,231,209,72,253,151,130,4,14,229,+148,198,95,170,157,153,187,69,251,124,111,3,25,252,153,114,114,51,99,137,+157,100,12,247,239,61,206,0,169,42,149,26,168,108,80,138,238,120,111,67,+193,61,75,212,224,201,99,20,1,176,167,136,17,148,106,105,19,63,238,62,+102,247,156,229,200,11,129,108,39,44,243,128,43,210,181,117,255,253,6,115,+78,129,77,191,205,103,106,175,155,101,236,119,177,201,30,23,186,253,47,182,+26,247,242,218,242,39,217,152,180,19,64,141,57,222,141,170,215,163,204,104,+231,219,135,34,255,233,128,243,88,216,242,208,202,241,194,195,213,38,198,160,+200,188,176,35,78,243,239,138,219,206,253,91,209,158,112,58,76,224,191,47,+217,28,76,101,148,137,17,16,33,186,115,216,109,141,5,2,88,64,242,208,+14,13,157,191,77,235,58,222,152,198,32,252,70,109,18,255,47,230,129,142,+219,82,154,152,52,160,105,246,195,44,243,137,5,180,136,110,0,236,235,147,+156,57,153,121,84,27,46,173,98,162,25,87,195,140,163,209,197,219,98,91,+51,194,79,81,56,36,74,158,122,77,192,166,3,115,160,210,104,105,112,149,+200,79,102,58,255,125,168,185,177,209,40,65,182,52,143,149,10,96,36,255,+31,237,115,212,4,26,27,235,130,183,32,28,248,136,252,247,206,242,67,160,+225,143,213,235,245,234,228,202,65,125,42,204,79,243,60,65,31,198,17,78,+166,56,200,132,192,118,229,230,229,147,233,45,187,34,62,182,21,18,183,228,+125,205,37,117,65,50,95,106,170,105,96,47,130,87,64,76,159,137,240,225,+107,73,0,120,97,7,159,197,154,255,241,225,116,70,200,138,76,68,73,238,+180,45,175,99,30,90,227,79,9,55,21,205,4,143,26,111,109,150,184,102,+111,227,78,110,104,136,100,237,0,67,230,9,81,113,204,101,241,129,12,125,+118,199,138,59,139,167,174,69,9,157,0,237,122,161,124,124,195,35,95,255,+179,140,33,23,5,129,135,196,151,71,223,155,65,153,31,126,71,198,253,127,+125,64,100,106,118,90,7,125,199,223,206,246,226,48,35,238,25,120,99,176,+240,105,2,225,169,159,250,252,89,73,54,115,197,86,0,47,218,155,51,59,+54,236,182,183,244,75,148,194,176,161,97,214,193,219,208,23,44,249,158,101,+70,196,213,185,185,153,37,21,18,206,83,176,158,117,123,124,57,116,231,103,+171,44,106,24,243,184,40,53,128,62,24,145,185,197,227,245,102,188,36,102,+41,65,155,151,77,188,147,85,41,177,4,25,161,209,165,220,25,49,97,107,+117,206,61,80,84,210,9,191,161,176,11,144,57,124,187,208,252,149,239,66,+48,57,60,1,177,138,128,162,145,70,192,131,22,220,246,24,57,146,161,120,+189,209,15,205,232,211,169,65,224,7,101,196,38,205,165,58,214,88,129,138,+12,179,15,89,159,192,89,44,140,57,141,70,58,1,162,34,26,45,150,216,+119,108,16,150,47,242,165,91,184,205,148,8,69,40,184,20,214,41,13,158,+240,30,231,124,95,164,112,206,207,43,39,223,83,49,143,153,142,59,106,220,+251,76,250,134,197,15,14,231,207,12,42,79,105,22,75,36,87,0,243,25,+195,135,237,164,94,166,253,56,146,74,71,137,127,157,171,142,109,18,28,225,+99,131,59,97,220,212,57,238,128,149,38,156,22,45,108,95,135,127,74,22,+7,1,216,209,91,86,143,110,213,43,219,157,235,18,178,57,143,192,133,186,+83,168,120,210,194,73,150,224,126,47,83,196,56,252,21,26,172,237,29,200,+206,27,216,250,118,246,116,186,74,100,66,211,209,76,172,213,184,98,59,127,+169,89,182,126,98,32,187,121,64,64,186,76,67,156,29,23,97,58,217,87,+172,84,210,80,172,162,54,11,230,67,97,183,51,9,251,155,98,101,253,208,+87,135,49,106,84,13,200,234,151,181,195,82,13,220,149,20,138,251,121,250,+152,103,253,12,188,226,25,193,163,81,247,154,132,89,167,239,23,221,102,152,+134,16,208,21,167,95,87,239,19,78,246,49,19,13,128,196,178,191,72,19,+35,231,108,182,58,156,103,106,156,195,109,172,166,152,150,183,166,212,248,54,+8,43,138,66,93,240,54,245,94,155,33,43,94,163,48,117,243,90,57,191,+125,183,84,183,205,76,36,186,47,245,121,223,68,121,56,16,145,143,8,136,+111,119,105,153,94,169,179,184,186,80,213,26,132,6,159,91,111,213,46,30,+23,139,60,95,35,143,251,225,49,31,175,138,64,27,55,66,235,208,193,113,+191,6,39,254,128,112,185,97,37,244,25,94,75,40,92,177,102,69,24,242,+176,135,240,218,39,49,194,158,81,121,71,209,28,102,6,54,29,155,165,194,+205,169,135,167,25,186,1,241,98,143,132,44,45,104,196,97,67,150,112,247,+61,42,38,161,218,100,85,155,106,192,5,142,123,53,112,50,166,49,118,222,+204,98,63,105,236,104,132,192,53,155,145,160,18,11,195,223,53,48,249,250,+124,44,159,235,39,17,192,237,33,93,7,246,144,244,179,22,157,176,203,92,+216,29,247,196,33,210,4,124,99,11,229,195,113,129,141,85,129,158,43,136,+219,90,25,158,67,247,183,103,102,53,192,232,148,198,178,149,218,207,197,189,+69,56,219,62,245,177,217,40,147,125,202,76,86,177,247,148,8,140,83,68,+94,132,37,141,186,171,79,90,188,184,29,83,102,2,199,146,41,8,118,98,+52,252,145,85,60,161,149,189,63,234,9,26,204,190,105,222,94,126,46,115,+47,248,188,39,58,44,111,224,53,188,238,127,67,210,37,168,121,121,134,120,+70,34,97,141,169,198,14,224,60,120,225,90,227,14,137,10,199,4,47,5,+235,180,222,254,40,49,31,84,220,0,118,104,52,66,188,98,242,87,1,210,+119,240,49,174,77,159,92,72,14,239,206,201,49,91,123,98,155,66,161,152,+131,155,7,214,158,59,106,228,80,232,187,115,86,183,110,78,178,91,252,162,+192,65,120,37,4,238,135,219,35,121,230,231,85,239,65,214,176,242,149,64,+141,44,98,181,104,26,182,86,246,198,144,228,124,44,124,14,68,95,185,135,+106,224,136,3,231,62,61,20,121,25,158,44,101,126,255,221,95,213,94,79,+41,217,115,70,151,29,65,138,53,87,149,147,67,17,23,81,253,224,219,0,+216,17,155,69,202,207,58,227,5,177,23,0,213,138,117,171,214,169,0,3,+114,16,26,48,137,247,222,178,219,212,0,140,217,79,236,83,207,67,255,217,+7,213,246,152,59,18,247,25,169,2,63,229,7,190,9,128,63,9,171,82,+130,50,93,89,123,196,43,108,37,250,138,166,192,101,216,37,119,209,216,78,+161,173,221,84,31,142,77,203,110,69,135,182,63,175,240,46,245,239,182,33,+252,26,171,136,91,159,249,29,201,159,197,148,196,129,190,4,253,221,48,17,+211,55,76,153,48,198,146,152,248,171,248,174,119,63,189,228,144,245,97,175,+188,23,209,87,253,187,227,73,97,160,66,13,15,18,251,81,152,53,110,193,+158,169,210,61,92,57,212,157,205,18,87,197,178,215,90,188,58,170,230,6,+97,4,15,125,183,21,238,40,94,7,62,57,240,129,201,93,239,144,167,191,+39,199,76,131,206,10,37,145,21,224,166,45,0,185,67,71,227,7,47,225,+102,16,163,75,45,32,138,61,48,141,196,203,227,49,105,255,1,165,42,79,+7,36,166,101,77,179,95,61,131,231,148,254,126,116,122,90,135,169,115,116,+93,72,26,39,78,251,85,236,251,84,17,55,216,15,35,250,28,89,164,19,+68,174,46,65,177,10,105,56,3,91,153,237,180,254,212,220,190,107,182,158,+74,210,54,55,66,242,37,200,219,29,22,162,155,242,145,66,195,197,36,226,+89,245,232,233,75,91,140,228,138,213,239,128,125,127,164,102,133,11,13,180,+47,10,135,14,83,2,193,68,127,154,86,17,189,249,94,206,36,35,74,21,+204,173,248,152,52,121,60,182,246,19,254,116,17,52,98,3,225,36,127,47,+173,62,142,218,240,108,239,233,52,141,152,68,92,126,248,65,211,73,106,172,+119,116,100,57,231,158,38,54,210,239,52,114,129,0,36,103,129,109,185,242,+74,225,196,32,201,11,185,150,248,193,41,57,94,140,140,128,102,240,163,38,+29,226,234,158,230,45,238,81,28,197,77,232,222,139,192,167,230,189,210,155,+39,84,84,229,119,129,210,0,132,92,245,3,202,99,255,121,133,127,2,239,+198,193,212,39,36,201,64,196,88,78,247,89,248,65,93,186,81,177,131,70,+197,19,241,137,242,182,134,50,218,28,39,85,147,224,207,45,162,39,28,251,+249,43,145,30,12,70,7,42,218,195,12,221,78,135,242,147,109,27,209,239,+238,255,253,167,97,131,201,113,216,8,15,162,99,118,8,33,101,97,201,166,+215,58,7,215,199,27,136,65,143,49,239,88,139,85,96,59,236,236,212,117,+173,12,224,48,52,55,112,6,139,22,119,155,44,65,243,141,59,71,76,59,+3,159,51,252,216,148,157,134,42,188,183,204,122,166,250,133,132,48,136,103,+44,247,20,188,215,176,188,27,225,246,86,99,54,158,57,255,22,185,169,35,+42,177,12,193,90,216,217,12,180,147,117,140,177,213,120,72,52,219,235,210,+208,227,35,196,199,77,94,173,3,142,250,45,85,215,84,208,141,96,15,235,+173,210,92,175,104,185,163,248,137,140,207,209,19,53,185,204,53,80,248,120,+65,239,43,138,228,211,172,223,40,139,126,47,56,14,146,110,24,136,54,59,+43,158,152,192,139,112,133,132,75,254,134,232,66,2,64,203,122,112,219,151,+101,200,248,1,149,175,4,103,215,11,62,146,199,119,160,148,43,197,152,250,+29,39,125,243,229,64,189,39,87,224,9,12,65,34,167,74,250,35,78,49,+158,106,170,105,253,29,119,72,240,127,15,7,33,21,78,75,81,80,10,91,+197,48,6,137,45,139,62,85,103,210,236,182,62,77,231,59,41,209,134,224,+58,194,196,220,3,99,98,186,65,110,199,25,213,13,219,87,254,61,3,81,+222,140,99,111,12,206,178,14,16,245,93,72,160,50,47,183,247,124,111,118,+74,14,50,13,156,255,37,110,55,171,49,5,51,242,215,211,7,112,30,103,+153,235,70,178,232,153,81,230,76,228,187,97,40,223,11,63,119,85,221,175,+203,157,112,192,236,16,216,179,67,153,76,64,155,210,196,216,234,236,120,249,+84,115,252,132,82,171,96,86,25,10,173,230,240,172,166,213,210,141,214,228,+101,46,225,146,82,78,132,73,198,232,17,134,139,131,10,76,21,119,191,238,+43,190,162,63,192,59,85,203,245,75,88,1,102,119,250,119,115,135,22,133,+156,236,85,178,245,211,77,139,106,60,189,148,183,26,164,224,95,228,43,65,+61,170,179,20,24,166,201,34,221,49,3,144,19,107,247,30,110,18,229,131,+215,199,215,75,214,88,112,51,149,163,143,88,16,156,51,205,219,246,32,166,+238,157,44,161,78,62,16,247,215,151,216,153,131,168,39,18,142,80,113,13,+20,112,223,81,41,142,71,10,162,28,152,250,57,36,219,118,193,191,188,189,+95,229,125,192,9,173,107,141,97,160,35,78,2,199,163,42,207,127,36,89,+20,111,149,242,129,25,13,35,41,134,96,42,99,244,81,55,7,117,45,103,+208,125,125,180,53,16,116,162,180,75,191,252,42,155,230,79,76,214,18,223,+149,58,251,73,64,20,251,133,208,0,150,87,217,73,235,181,61,224,44,15,+219,111,241,146,56,161,248,238,238,188,6,57,78,39,214,159,240,101,46,203,+12,106,28,49,223,125,235,103,190,181,79,31,249,235,243,224,236,234,59,109,+254,238,64,214,11,7,148,14,108,17,157,165,57,118,255,231,208,136,98,53,+99,165,94,38,161,43,86,61,140,227,26,234,173,131,72,115,92,240,144,61,+239,140,132,101,75,100,22,154,218,251,248,12,33,70,32,74,144,191,104,58,+237,41,146,147,235,34,253,82,60,124,59,72,105,202,207,147,13,6,72,39,+244,231,147,223,12,62,178,71,109,230,210,216,249,102,176,186,9,20,185,158,+248,17,150,152,155,177,99,0,253,63,174,232,240,6,169,166,206,121,7,185,+121,3,185,124,203,188,44,184,231,238,78,175,154,249,250,205,105,222,76,140,+220,126,216,211,149,56,156,73,224,93,190,68,234,199,207,105,59,106,95,160,+93,107,142,11,19,251,94,226,161,24,116,48,231,54,2,106,29,192,247,39,+191,199,216,5,128,1,230,28,166,78,236,43,220,166,19,121,173,220,166,143,+236,167,182,224,78,96,13,54,111,62,111,107,129,200,189,200,12,36,115,68,+166,67,173,92,225,76,45,95,161,136,108,24,18,71,59,42,134,194,139,231,+134,248,243,154,130,234,159,191,200,10,55,205,173,254,199,148,222,127,112,120,+84,162,68,79,123,193,88,187,147,123,44,246,56,47,245,227,44,240,169,43,+47,135,177,74,50,153,14,227,149,32,92,125,55,24,185,193,25,21,246,201,+91,135,120,110,133,97,227,203,106,2,141,55,92,97,155,122,61,205,231,99,+250,36,59,75,84,159,172,25,69,16,117,5,247,70,49,233,208,116,170,26,+197,251,3,75,105,56,43,39,109,44,210,238,51,154,125,177,246,237,220,218,+198,91,60,105,111,17,43,187,56,66,103,236,163,252,67,128,243,116,121,42,+100,198,240,206,73,47,111,20,224,9,133,22,244,137,42,140,225,28,82,175,+86,226,115,36,87,87,68,51,8,18,177,134,42,105,88,118,32,70,108,212,+144,212,237,154,125,143,13,53,65,214,198,108,59,162,62,218,86,139,147,237,+71,166,134,148,115,245,42,225,251,78,219,226,145,36,238,211,222,241,106,80,+214,16,86,255,12,133,147,159,194,255,121,135,58,84,41,57,232,29,85,48,+114,183,187,95,248,239,174,42,103,11,32,6,236,98,221,71,53,52,212,238,+78,85,44,153,106,74,213,100,31,132,205,205,184,250,119,142,230,76,87,174,+130,25,30,122,245,222,245,34,12,194,23,50,72,62,173,246,3,120,246,177,+162,58,13,49,184,170,201,242,25,24,47,228,236,108,219,97,220,244,251,8,+165,78,139,254,252,93,24,166,140,32,1,11,67,98,13,215,196,174,51,214,+54,14,136,133,74,96,58,132,221,225,25,234,162,165,90,105,77,198,36,214,+80,88,117,174,125,97,192,141,152,255,39,227,230,170,194,151,151,91,130,146,+149,255,143,6,215,177,12,9,243,239,225,140,238,229,73,52,103,112,190,201,+117,32,105,43,90,253,216,133,255,222,97,91,54,129,250,193,148,216,234,151,+14,184,253,14,237,200,207,213,96,156,243,161,157,152,69,98,247,28,223,241,+41,250,255,94,140,232,221,173,135,53,135,185,84,191,159,105,112,4,26,57,+168,8,65,18,30,23,139,147,36,212,54,232,95,208,245,245,220,234,143,69,+163,27,219,153,245,42,187,14,244,77,162,208,177,233,174,159,81,100,183,222,+191,150,211,37,126,58,156,202,74,49,48,152,254,254,73,67,85,186,58,52,+195,255,92,219,249,183,254,70,25,35,10,16,26,22,188,120,119,158,199,148,+24,42,106,60,225,175,208,207,147,8,193,117,51,134,28,226,107,239,232,84,+205,55,110,12,64,17,122,248,190,200,200,67,75,224,239,153,93,228,21,133,+247,190,39,251,236,197,131,103,202,202,34,125,202,163,111,171,224,220,254,181,+29,220,56,101,59,176,4,76,233,77,229,118,125,174,27,169,62,209,83,6,+73,24,128,151,141,217,144,144,242,54,178,126,212,19,198,60,115,97,99,16,+24,216,142,235,133,185,137,78,98,161,136,67,175,117,123,164,63,71,219,78,+119,48,235,6,2,194,197,99,59,92,249,115,96,117,221,152,79,101,185,221,+174,151,76,243,100,67,245,5,105,2,95,165,142,242,174,159,114,242,101,133,+231,18,0,179,138,145,237,139,198,24,125,9,182,96,155,101,118,179,93,195,+165,123,157,155,58,210,112,32,171,242,0,39,116,197,205,182,2,99,62,247,+14,12,235,27,95,32,154,63,6,90,114,180,217,187,231,205,41,114,153,124,+163,99,236,154,47,116,196,78,203,196,155,171,255,23,194,44,42,232,101,226,+246,253,220,133,31,33,160,55,181,29,252,77,179,189,176,204,45,9,241,79,+245,54,104,114,95,82,216,106,41,135,249,87,187,15,136,47,104,48,33,141,+160,130,191,189,35,127,182,196,103,27,241,29,43,204,93,37,71,24,196,236,+133,84,84,160,210,105,150,135,161,173,121,247,233,221,222,70,231,251,160,168,+39,203,154,101,218,255,156,110,8,58,240,1,117,234,107,36,189,187,213,107,+118,44,81,46,225,208,19,239,223,50,158,3,81,68,242,183,62,136,151,195,+61,84,191,116,189,248,188,181,44,148,95,179,60,199,151,175,107,151,112,76,+227,217,217,91,36,91,172,163,143,197,249,102,165,121,39,249,159,130,43,205,+155,87,255,239,67,170,104,169,77,90,112,80,102,103,123,60,196,233,71,5,+155,85,104,243,58,198,190,8,123,104,238,40,12,101,98,194,143,9,87,78,+57,44,216,170,191,89,201,191,87,23,5,134,56,147,204,30,76,65,20,192,+212,196,219,195,171,217,142,10,124,236,59,46,131,239,80,217,12,168,171,20,+181,27,204,254,151,190,106,105,187,147,223,27,207,209,72,84,133,108,201,225,+150,199,255,4,98,15,229,37,131,210,219,93,46,175,186,29,183,171,79,27,+71,247,218,61,105,30,36,212,127,160,0,125,111,178,6,116,199,70,10,25,+70,197,128,140,166,30,118,94,20,114,131,41,240,190,80,179,168,76,89,6,+94,121,214,77,63,238,71,151,141,125,48,166,99,62,226,33,50,12,193,175,+91,251,100,35,77,125,154,141,104,94,170,221,183,68,70,91,8,89,238,162,+130,125,172,171,101,165,149,181,255,45,110,65,111,209,236,161,109,123,85,133,+223,162,119,21,252,67,217,228,47,212,78,149,215,9,20,17,232,83,253,62,+64,132,210,252,12,80,109,253,6,33,73,85,83,184,178,95,77,57,107,199,+242,118,161,44,249,1,144,39,34,44,206,160,9,53,234,83,175,83,132,171,+121,140,182,152,93,183,41,171,96,121,89,244,104,8,199,96,30,43,33,152,+135,179,35,151,196,75,253,226,73,59,131,41,200,0,243,88,167,181,34,8,+90,156,163,251,214,239,74,38,115,109,114,230,10,214,0,191,243,11,197,138,+133,227,27,242,51,210,210,189,93,235,124,163,110,98,14,28,72,78,66,96,+180,123,209,149,160,238,200,101,132,60,65,170,37,150,255,125,120,125,105,28,+229,205,89,170,53,102,228,49,228,119,143,201,53,18,20,72,140,96,58,177,+157,6,162,11,251,112,49,215,244,21,154,250,205,202,179,30,142,35,101,13,+239,83,197,108,154,48,205,88,154,117,75,5,80,164,4,18,157,248,242,178,+14,141,32,127,172,105,136,211,175,247,67,114,126,116,12,47,178,160,50,199,+160,190,76,126,91,7,84,10,14,224,247,178,53,136,93,1,56,155,234,69,+176,191,152,41,242,12,129,15,230,113,236,18,158,47,214,172,156,216,195,167,+174,162,149,222,70,172,8,244,181,180,88,203,249,74,33,106,65,83,158,51,+50,14,125,46,153,170,78,100,236,110,12,42,114,246,101,192,255,142,247,106,+144,208,131,68,208,47,246,37,80,179,31,109,181,143,140,94,147,178,101,151,+210,248,230,22,57,205,228,242,171,34,8,20,87,58,81,160,209,24,56,117,+80,9,165,200,74,221,158,173,33,213,108,212,164,183,253,36,66,158,141,238,+107,125,46,32,20,125,247,129,244,195,165,141,187,203,45,224,11,241,241,74,+182,215,136,39,99,114,143,204,181,32,246,20,55,148,152,248,237,163,179,141,+62,57,139,29,151,19,41,186,0,15,161,196,30,40,109,115,124,48,247,192,+173,224,145,102,195,5,110,27,60,15,72,201,194,157,176,81,44,172,22,218,+201,197,126,169,166,55,241,46,217,153,41,5,240,197,217,130,245,248,152,73,+205,109,180,166,216,140,235,36,198,234,7,123,94,241,235,146,198,159,67,236,+40,188,252,11,200,72,69,225,74,234,230,36,233,180,133,236,179,24,108,99,+113,64,212,124,166,199,52,204,147,220,225,9,83,141,215,175,223,176,252,157,+57,36,170,112,54,27,84,27,13,109,134,163,100,33,114,82,68,211,91,37,+192,59,64,100,136,249,87,62,191,63,79,72,40,118,6,120,37,239,166,168,+190,232,176,196,220,76,143,192,249,104,47,144,157,128,44,114,119,250,115,159,+199,41,23,70,36,244,76,187,114,102,151,143,217,50,200,111,242,94,114,223,+61,231,101,46,6,12,10,227,128,16,218,146,146,65,252,253,39,240,81,205,+156,80,35,175,7,225,8,146,70,192,225,37,44,16,103,202,34,124,93,130,+148,41,226,122,214,140,211,18,143,88,198,42,165,105,75,36,249,167,192,118,+202,146,52,179,148,162,94,242,213,153,210,247,112,62,184,72,124,177,25,232,+239,234,159,33,181,195,63,141,81,214,169,8,214,137,94,158,219,220,101,137,+75,95,120,120,106,234,10,177,153,117,96,48,217,47,114,97,122,158,178,254,+97,34,72,250,84,156,37,164,47,101,231,144,74,217,21,165,175,188,117,94,+62,181,131,36,14,122,195,142,165,138,98,97,199,177,52,175,30,198,114,200,+77,64,62,156,32,31,43,158,233,71,91,150,226,54,245,218,179,172,143,53,+102,35,54,145,6,151,212,240,95,253,141,54,232,186,134,182,245,3,1,179,+167,81,150,7,78,21,112,212,76,235,4,136,81,83,17,199,23,145,12,70,+208,96,94,170,100,10,201,232,69,81,143,227,3,61,251,58,57,15,170,46,+141,29,2,171,139,92,234,181,224,6,161,145,61,178,164,81,30,133,132,240,+226,162,171,73,56,35,119,113,243,21,113,38,123,255,13,58,161,59,101,248,+48,0,147,26,187,13,116,48,67,104,208,250,22,230,204,108,198,164,63,229,+180,133,23,169,139,147,111,252,173,169,101,232,249,197,254,237,34,138,22,77,+161,182,53,238,181,191,250,185,175,22,118,226,124,61,136,129,255,195,235,36,+34,243,54,44,231,212,57,91,141,48,169,1,26,244,69,248,135,106,113,35,+110,177,154,7,232,146,122,1,210,180,157,18,73,103,171,58,254,128,56,11,+74,166,178,200,53,200,91,82,22,144,91,98,91,77,203,59,131,47,195,226,+10,48,84,69,67,148,14,229,189,133,148,42,101,101,112,55,237,51,11,105,+24,28,161,63,70,181,233,242,234,255,18,209,172,38,146,79,126,130,63,125,+124,234,89,121,54,253,142,180,191,254,162,237,49,243,235,36,142,25,8,152,+34,37,120,205,113,51,176,78,232,41,132,231,238,126,91,0,194,90,184,240,+23,59,153,93,33,56,127,99,45,156,43,195,211,140,164,1,181,120,210,142,+246,99,191,183,37,168,146,207,112,74,45,251,185,178,198,88,41,20,147,22,+137,226,75,100,129,150,76,186,102,15,229,183,46,238,197,210,21,103,164,188,+211,169,243,173,6,113,217,222,61,213,199,24,43,144,26,208,222,244,119,222,+193,182,125,155,83,142,172,142,15,195,158,170,183,217,184,23,7,102,9,94,+137,86,3,18,36,158,125,245,125,196,96,7,0,182,248,204,48,106,121,29,+45,17,192,129,77,200,35,43,244,132,198,206,233,242,203,202,108,165,64,204,+67,110,155,24,53,135,110,150,45,114,2,43,242,75,128,24,241,149,37,124,+142,223,136,28,138,20,130,93,165,204,86,114,146,232,117,159,26,63,123,235,+50,23,76,183,71,184,255,17,61,3,62,95,144,7,199,40,240,141,197,67,+169,98,111,88,19,93,95,202,39,113,29,89,191,51,181,57,191,61,218,101,+31,226,166,119,74,114,158,39,72,72,238,26,188,89,190,164,195,166,113,253,+49,102,27,59,174,44,5,225,228,102,88,96,149,17,119,20,105,118,188,4,+122,74,215,174,28,27,163,107,22,188,138,122,141,179,136,232,136,239,104,61,+242,218,41,28,243,21,208,90,45,127,73,36,183,144,236,173,172,221,72,33,+94,44,105,104,236,114,161,156,231,190,202,187,17,182,6,236,225,192,158,194,+156,183,205,240,186,121,202,78,31,54,13,216,139,212,98,93,119,100,68,164,+44,86,55,113,139,77,99,233,100,73,24,98,207,66,252,57,119,214,106,169,+175,210,237,217,199,222,6,94,226,23,214,128,156,119,79,67,4,221,106,75,+33,195,57,79,178,222,34,128,179,45,16,94,120,136,144,243,37,54,70,2,+196,40,224,179,20,238,10,99,163,247,250,71,132,10,216,161,136,116,171,5,+14,35,50,218,242,28,162,233,20,53,101,183,176,2,18,42,190,221,185,246,+34,6,117,212,24,177,15,143,137,0,251,173,175,196,75,97,194,226,213,219,+179,48,233,70,74,154,26,67,128,29,221,82,69,18,4,254,131,170,34,109,+142,62,10,163,108,215,156,183,236,23,71,179,24,40,250,14,254,152,196,79,+142,243,59,121,69,107,193,236,181,16,6,45,13,26,236,141,240,157,206,47,+172,163,169,45,110,101,186,157,183,114,134,147,242,145,125,186,63,26,147,212,+32,137,60,174,138,120,82,231,253,152,154,14,143,108,241,166,185,104,162,124,+73,23,198,225,204,95,251,231,140,215,92,145,249,149,220,190,82,214,91,82,+230,249,38,124,91,17,173,13,107,67,242,180,76,201,246,224,116,75,199,86,+60,252,229,176,15,165,130,214,95,211,192,48,218,154,26,2,127,152,90,251,+115,176,103,205,70,117,166,0,23,17,92,237,12,132,70,153,112,199,59,180,+237,212,219,123,114,154,236,18,51,22,152,58,247,104,137,97,84,38,94,250,+157,221,116,90,177,207,211,29,108,152,140,3,214,242,2,189,100,234,159,245,+200,164,111,220,104,139,210,208,190,168,81,233,88,162,123,177,174,119,46,106,+47,40,66,140,119,164,55,254,146,135,155,157,161,138,39,62,218,121,247,223,+53,27,200,167,145,3,115,17,7,36,111,79,241,174,61,198,210,253,160,221,+229,155,72,173,209,161,65,46,81,182,0,77,188,111,216,159,47,169,38,147,+199,176,255,235,216,173,174,127,115,205,85,136,42,155,239,146,4,83,180,44,+192,200,227,117,111,228,85,228,146,150,6,67,20,76,132,204,170,63,182,201,+241,131,137,174,240,9,173,30,109,3,122,241,231,75,101,209,255,28,27,219,+101,246,66,135,152,161,134,32,9,195,194,9,85,250,127,127,44,238,39,160,+105,2,5,21,144,181,47,192,33,90,146,195,78,200,162,148,212,9,202,247,+2,222,228,111,92,218,62,171,185,10,209,147,146,81,46,173,84,109,214,91,+222,114,25,228,51,188,87,201,200,98,167,139,163,243,152,58,215,118,181,81,+95,228,161,206,195,172,193,88,56,90,212,53,248,20,27,243,28,111,137,250,+73,19,152,162,21,249,186,196,83,250,87,186,221,120,135,11,222,62,179,49,+167,83,117,205,214,171,205,134,79,71,56,208,67,176,158,36,52,40,69,20,+219,127,152,90,88,76,134,21,113,153,156,222,6,64,106,138,38,106,137,158,+150,232,60,29,203,108,21,46,213,245,132,214,151,241,103,135,246,178,167,161,+233,225,23,247,175,159,148,216,54,150,216,17,132,44,208,185,31,60,139,119,+23,201,30,188,163,163,47,53,83,61,56,146,45,2,211,169,218,182,83,118,+165,120,191,252,130,190,81,19,60,2,77,237,30,52,242,173,139,83,173,90,+17,156,119,104,215,221,128,42,79,236,4,89,67,154,88,227,232,139,248,92,+82,234,74,167,122,236,252,164,22,62,231,96,86,9,8,147,70,60,47,70,+128,185,244,141,95,156,121,146,114,145,248,28,253,113,52,194,38,189,19,24,+112,115,90,25,137,162,116,175,63,56,222,80,1,104,69,166,78,199,48,91,+104,232,2,55,159,150,213,25,141,224,250,101,41,33,248,29,70,252,209,240,+147,207,210,176,183,25,23,10,94,132,222,104,237,222,177,4,149,40,162,50,+207,118,235,244,202,146,145,239,234,5,105,86,186,183,195,101,237,153,64,234,+125,171,154,33,125,173,181,167,173,122,154,167,118,254,138,130,25,172,81,248,+151,205,3,185,183,42,213,219,72,189,117,139,72,95,140,97,11,191,181,222,+20,81,245,81,69,40,148,252,14,123,240,194,198,46,105,5,229,208,24,97,+195,134,123,208,138,71,216,184,25,222,216,175,81,113,13,193,68,125,168,41,+138,30,89,11,204,238,65,120,110,89,110,125,165,32,126,182,165,156,45,29,+21,59,196,47,254,47,61,13,201,170,4,27,104,117,17,195,215,249,53,181,+69,8,119,179,146,174,5,211,13,145,136,206,129,252,48,193,77,17,23,190,+194,226,244,227,35,123,65,49,51,58,200,81,133,209,36,213,169,90,24,180,+100,206,239,193,125,134,167,200,99,215,119,39,220,49,225,224,130,192,26,207,+142,81,123,239,11,216,130,95,103,79,160,58,225,126,103,31,20,107,176,40,+249,190,66,239,223,124,32,248,113,166,149,192,7,181,165,68,68,211,56,170,+157,207,110,185,244,153,114,240,103,86,96,205,156,186,117,24,219,185,233,52,+168,237,78,10,105,233,120,164,56,209,101,98,139,124,14,149,125,219,2,149,+189,41,43,49,176,13,153,112,152,238,122,13,160,202,238,112,148,178,230,228,+147,45,117,146,146,63,12,176,18,137,123,59,225,127,95,70,41,150,74,65,+115,102,86,82,39,183,170,35,148,36,245,125,221,202,71,78,181,105,169,177,+40,194,45,57,122,20,99,100,147,196,237,42,162,132,92,47,154,144,215,62,+223,172,189,171,114,169,221,215,160,149,90,16,95,235,195,79,217,9,198,47,+61,202,131,233,231,35,25,132,76,173,64,29,67,90,49,146,244,24,175,127,+239,105,9,225,121,95,13,43,28,224,237,85,161,254,139,100,159,166,115,11,+75,56,66,187,168,133,17,205,32,241,185,92,97,190,140,89,175,174,109,174,+231,219,254,155,116,65,51,251,228,136,137,32,178,184,224,224,28,136,177,187,+36,28,111,16,181,147,49,130,52,103,63,18,196,0,198,76,150,64,207,21,+206,53,108,28,180,168,49,160,56,98,132,43,203,71,145,232,245,154,133,164,+234,58,115,232,204,148,58,27,89,176,160,29,211,71,207,22,125,241,26,186,+140,188,110,52,29,208,55,69,200,225,87,91,222,149,192,191,191,136,135,93,+224,138,230,222,142,215,146,153,154,223,18,245,239,31,16,164,80,130,228,230,+221,198,174,15,86,105,30,206,13,38,169,214,180,102,64,10,22,48,126,218,+63,252,163,88,58,237,33,183,183,199,212,75,87,86,134,18,44,254,82,170,+5,3,37,231,177,122,28,85,3,218,48,71,40,114,155,231,213,37,177,182,+247,224,240,87,37,235,74,182,159,120,28,46,252,171,151,33,159,6,103,30,+80,90,200,198,129,254,234,8,92,59,11,180,245,89,248,35,27,150,99,2,+79,133,63,75,130,53,37,33,49,61,149,172,155,129,10,243,194,96,188,182,+202,91,170,77,118,85,159,75,5,169,37,85,48,255,134,98,185,196,150,80,+204,101,191,194,250,215,218,222,49,182,143,23,202,191,46,142,207,29,187,177,+35,202,61,89,43,4,71,19,74,205,184,168,79,209,71,195,222,132,50,239,+191,171,4,139,49,252,239,180,137,146,41,129,163,51,103,237,75,168,184,88,+56,72,187,83,99,17,110,166,250,63,107,97,101,237,193,82,220,51,2,243,+173,179,32,16,250,125,72,99,200,102,193,53,226,121,37,167,242,236,68,226,+47,109,65,246,37,187,56,85,190,161,230,8,98,222,60,65,34,248,80,255,+75,174,207,130,20,159,212,43,19,184,29,139,36,191,190,239,132,255,77,253,+96,56,27,195,224,249,191,203,133,184,204,89,189,39,253,133,12,188,212,103,+132,196,220,168,105,0,18,177,255,68,101,133,56,3,47,203,17,123,101,152,+138,185,172,161,43,194,1,25,139,214,216,28,195,22,22,38,49,160,88,25,+181,113,238,61,210,135,112,79,3,178,193,89,152,242,92,58,193,252,78,130,+109,5,121,160,219,76,42,37,40,194,217,253,133,32,136,226,179,239,201,94,+152,97,183,217,116,234,7,253,55,151,207,23,72,51,122,103,174,157,66,12,+239,119,80,175,7,177,165,166,136,51,110,92,93,231,154,154,188,180,5,69,+57,250,83,134,153,198,255,252,254,201,217,229,45,34,217,162,39,107,73,108,+49,10,56,167,36,206,133,145,65,151,187,45,172,64,130,35,7,239,138,137,+171,190,64,107,16,184,230,56,176,178,222,164,94,145,27,5,161,236,164,46,+195,242,66,4,144,159,175,184,167,32,210,196,85,162,234,82,119,49,108,33,+235,55,74,98,33,27,10,4,194,56,115,16,113,12,206,94,50,40,54,145,+179,166,250,186,173,173,181,59,10,163,136,142,192,149,40,197,10,209,158,73,+121,67,141,39,166,254,249,243,203,20,235,199,71,49,26,111,156,168,66,176,+43,111,82,253,127,145,65,209,36,7,121,95,78,200,69,28,125,55,137,109,+28,74,230,96,149,71,216,206,173,187,210,69,99,0,145,23,37,120,180,58,+173,228,155,63,91,7,174,163,34,223,160,250,91,212,45,59,74,183,152,144,+62,212,108,205,110,141,243,250,12,203,182,107,109,115,42,240,33,147,33,186,+212,127,96,58,118,64,243,156,232,123,239,161,191,95,40,43,34,202,215,124,+201,26,183,88,167,221,187,116,49,124,239,246,172,10,139,25,79,57,154,60,+18,135,126,87,85,35,208,12,73,153,136,99,70,100,34,172,74,226,232,197,+220,174,45,17,248,149,82,150,128,189,175,239,17,210,97,117,176,154,234,59,+71,86,182,183,80,118,128,227,206,210,240,250,254,59,80,3,129,114,133,130,+121,179,243,220,98,201,136,199,237,25,188,93,29,32,165,128,104,186,238,52,+148,17,166,51,236,51,216,17,183,76,239,132,109,36,181,29,202,119,56,222,+76,165,149,90,20,199,85,234,149,175,101,213,155,252,0,72,63,26,78,59,+35,8,173,81,28,173,224,149,243,13,55,173,98,34,194,88,241,81,226,192,+172,62,57,206,193,207,184,154,18,175,24,109,77,64,87,41,194,250,210,9,+119,135,243,39,151,141,91,8,85,25,172,91,196,193,80,209,26,107,140,12,+173,55,180,168,27,45,205,64,122,122,96,189,98,137,5,89,203,130,194,189,+166,240,182,156,239,94,165,51,106,73,231,141,135,201,209,165,19,194,215,76,+31,137,184,62,147,92,92,48,96,224,215,110,237,111,118,64,230,75,72,90,+70,68,154,224,167,237,106,204,95,136,111,65,173,128,95,56,112,177,160,155,+225,143,151,43,88,90,1,154,115,245,154,105,173,214,99,1,67,30,91,111,+82,219,69,69,120,229,223,238,61,26,115,195,44,51,16,114,213,18,112,58,+181,47,201,227,77,170,241,149,50,195,19,58,19,64,32,33,127,57,156,13,+12,226,136,205,225,171,198,124,246,75,113,69,203,15,170,174,86,196,39,225,+165,30,146,230,5,105,28,14,235,143,89,173,30,122,138,198,154,60,71,142,+49,171,248,240,248,232,160,101,219,42,2,107,147,239,209,125,137,238,136,99,+104,120,248,233,247,10,240,7,0,140,19,12,75,164,84,87,64,212,216,230,+115,159,97,66,74,144,90,225,130,20,204,101,157,66,78,54,205,240,53,108,+249,251,147,137,127,38,40,146,239,26,21,30,185,17,34,94,203,23,155,214,+112,173,148,65,210,183,212,16,38,248,95,232,48,24,63,231,146,135,238,167,+164,116,85,12,120,30,246,244,198,140,69,163,224,50,141,105,111,155,224,192,+251,107,131,53,30,158,39,64,59,47,227,139,18,45,131,200,67,215,208,251,+102,153,53,231,198,163,51,127,85,200,118,2,106,46,135,238,197,53,18,121,+104,60,217,87,167,150,42,244,61,17,236,37,55,178,230,157,53,33,203,3,+62,218,8,162,120,89,209,172,245,134,102,2,1,34,50,217,232,83,89,201,+43,109,189,105,176,26,250,37,57,132,143,51,39,241,139,62,214,253,147,253,+94,237,182,46,208,5,202,119,30,216,212,107,31,188,157,27,4,93,224,3,+132,4,215,60,137,153,139,15,6,7,111,73,102,131,34,48,72,1,160,204,+247,50,172,98,217,126,33,254,43,209,239,134,253,27,95,193,127,54,232,231,+55,38,142,55,218,25,210,198,230,180,122,197,75,33,44,7,130,197,14,63,+106,74,173,188,21,19,73,13,111,41,218,13,218,108,80,100,55,32,15,154,+52,86,232,174,139,156,131,144,147,4,105,244,55,21,23,123,29,233,6,116,+71,140,157,51,63,97,240,244,19,129,212,66,3,147,180,72,209,9,118,236,+190,158,78,229,59,139,93,21,2,158,252,140,54,164,222,153,130,235,209,181,+89,8,105,92,133,6,34,74,171,141,231,84,188,241,10,49,73,67,66,99,+108,114,76,202,30,72,64,47,58,5,235,214,106,78,50,238,97,184,54,72,+72,86,233,197,209,137,146,14,139,175,190,8,12,215,255,214,253,250,232,252,+39,13,10,8,48,199,113,52,235,172,249,98,227,85,185,124,31,27,103,47,+74,227,11,145,100,153,111,162,126,81,13,145,10,163,243,89,22,104,41,3,+107,135,138,28,150,188,10,59,171,221,247,215,59,80,47,235,218,180,36,140,+247,88,64,98,13,74,151,233,185,219,86,226,93,22,75,222,39,216,31,211,+42,41,30,17,9,45,164,171,59,13,144,93,205,160,165,11,46,41,186,23,+155,227,57,214,246,81,52,82,16,20,197,170,246,78,160,14,190,147,253,168,+255,251,96,54,253,212,149,208,43,28,191,19,227,253,167,234,41,51,97,117,+103,253,255,168,8,189,155,202,186,119,209,166,213,115,88,46,200,24,98,247,+142,24,204,144,232,200,184,6,51,91,179,34,205,50,124,211,250,33,116,146,+228,132,185,162,16,238,187,51,126,157,199,198,239,254,163,171,182,175,0,2,+140,101,242,36,197,39,4,120,220,123,209,23,229,236,141,23,144,44,119,7,+85,109,41,34,122,95,163,17,67,22,42,20,49,172,69,122,52,234,149,204,+143,69,78,158,98,148,60,249,81,34,120,27,129,194,103,89,168,153,215,172,+121,204,75,101,178,165,183,74,27,203,191,128,29,141,128,160,168,18,138,10,+205,103,47,72,90,111,230,120,127,81,178,119,83,117,44,36,84,122,21,39,+53,21,255,122,6,129,220,38,89,73,210,222,86,136,4,16,171,38,196,86,+144,107,79,63,125,28,156,240,35,35,43,48,206,195,211,98,158,197,103,177,+154,22,167,212,254,250,95,48,58,125,249,250,143,128,161,29,43,113,219,42,+40,119,237,231,46,36,53,74,81,116,75,98,188,8,178,86,97,224,19,186,+67,24,67,127,17,33,172,225,172,198,131,38,70,214,203,16,201,138,225,3,+209,167,188,189,60,21,29,33,2,7,156,243,41,37,121,147,172,181,162,255,+185,178,102,90,142,116,100,186,20,56,31,222,188,4,127,93,193,30,1,240,+30,13,86,68,228,197,249,217,22,208,75,107,75,57,172,121,129,71,107,31,+21,31,137,159,153,229,42,139,143,48,48,36,140,91,102,14,20,245,240,102,+71,64,58,223,89,140,60,88,62,61,170,226,186,49,62,26,127,147,42,127,+205,107,245,90,192,155,146,182,149,123,136,50,176,53,41,161,242,246,51,251,+36,145,197,128,146,141,134,144,194,89,175,80,98,79,155,103,219,134,167,54,+212,146,97,7,150,1,132,19,28,163,149,88,238,160,80,245,194,162,0,137,+118,122,114,78,195,213,243,67,89,103,151,34,103,147,236,49,20,244,168,180,+233,89,214,134,147,50,249,113,182,195,97,215,226,95,157,242,203,232,164,113,+112,158,242,126,157,132,80,225,220,163,171,21,60,145,57,16,120,185,246,128,+84,5,193,125,41,100,245,25,180,248,101,118,75,175,147,120,103,199,77,146,+48,223,172,60,159,108,136,61,227,19,65,172,246,229,101,139,149,115,149,81,+199,170,95,188,217,18,104,235,138,137,134,171,196,118,139,132,161,98,23,165,+27,166,167,137,62,17,144,218,35,24,223,175,179,246,119,114,216,145,211,95,+172,170,32,139,212,10,49,143,226,54,79,204,221,18,141,123,75,133,165,122,+97,191,108,70,166,148,212,182,156,62,127,97,14,81,31,183,76,123,154,241,+22,157,6,79,255,190,199,219,63,143,42,184,94,27,155,92,55,141,156,165,+200,98,211,52,46,47,91,150,165,131,87,249,206,43,139,253,11,42,190,105,+99,97,0,107,215,204,38,190,25,181,216,188,116,148,25,186,196,203,124,254,+114,227,206,172,154,190,23,82,251,234,219,58,209,112,130,0,113,159,114,97,+52,22,66,183,148,126,100,184,73,147,190,44,49,227,134,138,212,177,212,195,+43,105,50,113,110,120,108,237,2,14,95,151,182,89,152,243,56,218,163,196,+60,35,243,250,217,254,50,159,142,203,32,203,200,227,70,164,81,91,75,58,+201,103,223,42,162,117,132,161,177,47,18,172,183,27,192,213,161,223,16,197,+233,243,136,223,205,6,99,222,111,73,141,187,169,54,236,127,10,176,40,229,+167,105,45,94,52,180,38,210,65,182,58,189,231,134,189,135,246,147,188,44,+110,46,160,200,28,76,43,215,12,165,151,180,147,234,6,20,209,34,159,101,+100,253,59,37,44,49,33,3,13,57,141,211,228,72,82,167,215,159,81,6,+60,91,213,62,85,226,197,173,83,113,246,61,5,115,110,27,77,235,32,212,+211,208,108,11,94,68,1,223,215,184,153,135,27,158,174,46,187,39,83,141,+245,123,128,61,206,4,18,164,10,90,118,229,66,228,76,66,131,187,122,18,+200,148,177,64,222,8,200,37,143,155,13,84,152,106,133,132,126,50,20,81,+167,49,33,201,42,241,208,209,223,135,83,126,55,250,119,84,109,237,75,200,+27,158,73,247,72,17,48,230,88,205,159,226,11,6,185,37,116,110,46,5,+181,111,145,241,253,227,50,223,87,73,157,122,90,53,63,207,249,186,98,111,+136,24,208,107,242,250,219,84,196,37,162,27,158,111,77,113,119,229,158,136,+12,153,12,5,42,89,112,73,36,101,207,63,246,110,220,226,76,185,6,136,+255,12,78,149,35,224,124,0,13,172,187,121,131,33,208,202,73,238,5,35,+82,171,19,167,54,247,201,128,148,233,223,209,106,179,0,205,238,40,147,22,+26,210,157,181,152,40,27,14,212,237,27,65,233,156,211,54,214,249,50,138,+154,253,242,207,190,230,17,220,152,234,59,213,128,221,202,58,154,163,199,129,+214,79,34,247,213,124,250,214,38,231,214,13,249,69,35,71,88,207,162,106,+48,173,227,86,173,99,80,213,209,17,112,192,116,191,122,122,244,129,168,171,+50,226,141,111,206,143,100,208,35,161,134,154,154,1,205,35,121,214,34,53,+159,200,233,44,6,114,173,44,32,216,212,183,198,36,157,29,104,84,100,246,+80,134,140,254,116,59,246,24,73,252,158,46,147,107,73,121,233,244,148,36,+193,223,103,26,223,241,230,15,92,236,66,185,54,201,239,196,207,170,106,128,+6,215,241,195,23,222,191,211,230,154,156,189,228,26,150,184,38,60,252,2,+58,190,46,214,105,35,187,125,9,114,203,4,216,210,76,142,138,27,79,139,+60,164,73,33,107,185,212,254,27,175,109,62,88,82,129,253,230,91,165,252,+45,64,38,225,205,54,194,251,32,184,118,126,34,100,121,105,63,96,97,85,+195,87,218,72,93,254,241,230,78,37,215,63,6,137,11,88,127,239,34,250,+157,182,96,207,12,5,155,148,197,201,15,167,34,200,244,69,174,61,245,128,+83,179,190,117,253,203,6,151,204,100,35,49,25,59,52,106,54,182,13,68,+245,211,214,56,150,168,198,55,242,193,27,162,48,94,13,117,123,1,116,245,+118,221,48,122,33,223,4,245,26,51,52,11,184,247,69,84,113,211,33,255,+224,86,92,64,43,33,167,130,181,74,19,71,172,110,78,158,216,164,107,240,+217,136,238,8,2,157,130,27,149,69,108,143,26,213,72,151,217,91,140,244,+87,66,191,143,103,83,8,72,250,187,133,8,250,239,171,193,4,68,106,234,+192,2,2,20,125,120,106,202,50,186,101,38,57,83,145,77,171,192,113,51,+14,195,30,157,1,244,165,37,119,3,46,137,11,124,161,250,188,14,94,94,+246,181,78,89,207,120,157,109,43,99,199,160,242,95,78,243,94,177,8,29,+138,94,38,96,160,239,124,105,102,186,126,104,47,47,11,200,44,92,100,36,+91,144,12,201,50,151,227,84,69,93,100,98,15,236,36,228,193,238,48,44,+122,117,255,213,98,212,199,136,92,37,118,233,96,8,236,170,40,60,248,222,+96,164,230,177,244,21,16,236,180,106,130,162,124,222,184,98,138,30,161,211,+66,162,0,5,109,54,152,81,188,134,53,244,161,174,243,168,128,197,6,73,+29,28,39,169,182,27,60,97,75,242,112,18,213,168,148,141,3,166,47,201,+200,76,172,80,183,70,138,106,135,243,2,96,7,250,67,215,251,23,32,73,+217,193,17,251,117,174,249,175,229,129,72,194,238,166,83,8,147,63,100,42,+254,140,222,13,59,248,41,24,38,9,186,101,147,215,27,132,100,176,164,89,+220,223,169,90,226,198,109,93,57,90,45,136,125,30,125,153,74,14,151,126,+174,88,124,54,211,137,69,118,234,32,24,62,212,136,106,115,42,213,124,50,+209,106,224,52,232,163,32,206,233,9,77,251,59,118,221,123,44,103,194,222,+86,190,179,165,145,236,82,145,77,78,119,216,183,71,68,187,84,232,43,19,+244,13,98,9,26,91,54,243,113,123,150,139,10,181,116,63,4,86,129,144,+233,235,130,86,53,6,151,81,136,142,226,238,194,186,57,163,43,20,49,118,+185,244,145,24,208,80,219,145,134,171,84,67,199,60,236,150,82,91,143,44,+217,95,178,254,231,25,133,125,177,175,29,85,32,215,106,141,232,210,225,234,+111,70,35,104,19,246,218,200,103,146,120,21,25,238,123,106,81,126,241,84,+242,150,186,253,176,26,239,65,79,235,225,84,95,199,159,72,29,137,86,71,+216,109,93,72,84,164,98,75,176,29,4,140,19,201,91,121,145,85,224,78,+203,5,106,118,224,186,64,59,122,58,63,238,154,80,176,89,63,161,3,144,+112,129,41,209,48,116,36,199,61,159,132,208,82,212,177,204,16,175,151,77,+239,63,192,63,58,141,223,100,88,23,218,101,229,85,142,218,150,153,1,51,+39,0,38,85,47,28,212,28,62,178,22,9,185,124,60,72,113,10,142,67,+159,147,245,214,94,84,207,27,33,155,40,111,72,199,216,236,155,6,214,120,+97,117,120,175,113,121,156,204,246,27,59,21,154,130,244,155,201,88,205,130,+241,249,2,29,119,152,125,167,45,187,62,83,61,101,81,26,156,239,111,72,+214,24,135,89,90,223,247,93,87,136,198,202,19,4,68,159,221,176,247,14,+14,142,85,109,62,5,207,130,98,191,72,200,33,247,210,3,196,107,142,244,+39,9,4,47,130,25,147,14,126,194,27,252,1,174,155,97,202,175,191,147,+28,25,101,98,192,63,208,145,61,111,154,105,72,224,254,225,211,181,113,126,+240,232,158,203,139,62,189,4,135,73,73,235,33,37,148,237,221,55,155,86,+33,130,75,164,146,50,216,128,238,185,139,156,111,165,3,107,202,151,90,95,+19,98,153,146,144,202,155,68,22,195,223,39,203,222,10,248,76,101,144,26,+61,160,10,22,197,12,176,179,24,193,1,42,136,35,140,13,122,40,65,38,+92,249,211,171,255,158,57,17,23,242,240,66,229,183,125,208,114,239,60,203,+73,131,154,238,116,53,137,244,70,111,197,209,50,36,58,240,120,30,234,102,+101,168,3,112,205,108,203,67,135,244,243,48,12,127,136,162,240,250,54,43,+184,28,66,34,250,106,80,117,183,177,43,60,245,241,187,131,186,168,75,151,+118,123,11,43,201,115,213,40,12,215,204,140,81,68,155,131,85,73,127,39,+76,55,236,219,1,24,236,82,40,13,151,232,124,207,106,78,96,131,238,190,+12,222,162,44,21,171,64,142,180,249,96,97,162,76,166,50,117,96,237,160,+142,197,198,41,64,50,166,68,220,41,88,208,239,87,28,14,239,157,126,200,+95,76,33,68,91,42,146,253,52,54,53,107,120,206,76,46,195,150,85,21,+225,203,91,211,61,162,188,111,182,187,47,150,233,255,209,71,166,85,53,133,+27,55,176,217,168,79,216,41,4,148,177,98,48,185,219,241,86,168,208,6,+163,80,130,175,23,125,15,120,20,240,175,1,4,249,5,141,221,85,243,108,+197,186,76,63,8,243,123,24,18,144,24,27,134,118,60,83,141,70,103,14,+174,136,60,118,234,76,27,178,99,190,162,215,71,74,209,226,12,27,99,16,+36,51,174,40,146,195,176,255,174,38,78,195,14,107,166,155,58,241,57,24,+48,202,91,131,63,224,139,56,40,191,253,149,83,99,60,178,41,46,224,209,+27,120,141,215,10,224,234,31,103,127,4,92,98,58,244,69,25,166,116,206,+54,242,75,25,61,69,162,95,32,4,121,127,165,187,101,226,234,156,215,81,+201,154,50,190,172,48,112,51,106,188,174,173,208,20,61,107,157,151,215,85,+228,189,76,231,223,75,119,62,139,0,212,161,223,143,151,135,151,235,66,117,+198,149,123,244,120,252,251,14,79,121,172,77,196,241,85,180,70,209,184,30,+14,65,116,253,199,56,3,110,197,179,164,223,76,6,69,198,138,181,212,232,+132,160,150,70,227,86,21,106,159,224,124,17,158,66,195,155,42,68,245,109,+9,97,230,169,53,197,73,112,246,239,47,152,245,149,96,240,31,250,146,74,+56,19,36,234,219,21,218,126,78,212,155,164,6,218,59,82,116,108,180,48,+90,172,89,229,94,76,0,183,152,90,156,113,246,126,98,251,26,237,122,171,+156,246,101,230,82,235,119,115,230,173,141,16,164,58,129,119,191,93,149,191,+160,138,202,104,111,185,166,174,96,236,25,126,182,118,6,201,42,16,72,151,+36,170,143,162,227,165,217,153,237,32,81,227,105,113,202,79,76,56,118,104,+190,235,58,248,198,248,249,228,230,221,60,242,123,101,20,162,18,154,84,127,+84,54,96,129,30,63,244,46,100,132,86,223,165,230,89,164,127,39,32,102,+93,13,167,82,53,84,88,64,236,32,184,42,201,201,245,53,41,149,100,209,+154,253,164,69,63,136,73,199,54,227,111,229,10,137,118,138,155,81,96,39,+159,243,207,148,80,102,35,92,177,226,99,174,161,229,119,54,92,120,81,26,+5,66,112,37,4,93,200,192,18,15,134,189,233,37,217,173,33,210,39,207,+197,243,34,108,143,159,0,82,125,100,247,17,30,5,157,69,20,154,201,218,+70,29,191,1,142,36,221,241,138,185,69,13,66,167,116,46,76,79,140,103,+52,112,53,168,237,109,133,29,199,33,0,188,33,245,201,90,28,26,50,9,+214,110,33,52,153,39,241,179,187,17,194,177,56,53,7,242,73,40,239,186,+199,102,105,166,31,70,231,118,219,82,120,66,114,217,87,162,216,185,130,243,+178,118,29,182,215,237,218,193,145,81,131,45,166,205,18,166,174,227,248,233,+122,223,176,207,12,233,2,15,81,102,53,109,184,228,75,62,202,21,219,152,+140,140,76,150,24,212,83,11,143,6,216,107,243,154,60,80,148,235,31,103,+200,217,143,76,8,68,64,56,66,92,57,20,88,209,79,159,41,90,183,126,+155,32,58,222,237,84,45,2,232,83,140,142,20,38,168,241,84,215,241,3,+142,59,102,29,156,39,87,155,184,134,242,100,202,93,77,75,83,1,119,208,+25,106,190,83,153,130,236,111,118,98,136,110,53,18,118,77,252,21,136,162,+25,19,176,55,226,131,31,114,119,135,163,220,10,114,214,216,88,135,222,99,+241,125,225,74,21,169,72,131,160,75,49,14,4,129,11,166,157,30,234,173,+196,116,45,201,240,169,214,21,160,143,134,148,28,148,86,232,37,96,80,57,+205,129,233,230,51,54,211,85,110,43,48,93,13,227,98,164,211,118,141,139,+122,175,132,237,160,80,87,165,228,216,185,41,131,139,228,40,203,165,221,18,+19,108,248,209,71,13,180,8,82,59,246,91,80,37,204,59,215,126,166,37,+40,249,59,78,157,91,86,163,111,148,17,141,73,118,134,127,151,117,162,31,+232,58,86,67,203,7,198,29,146,237,203,75,110,127,174,103,5,181,229,85,+42,202,73,87,37,8,47,197,18,129,173,67,57,208,120,12,204,151,52,40,+112,94,174,57,95,114,145,145,53,137,218,227,5,88,84,10,228,194,80,73,+128,244,25,135,41,40,134,200,205,70,248,197,127,46,72,25,63,212,180,125,+40,9,131,23,38,218,27,246,87,7,242,196,61,248,97,24,165,2,184,119,+171,10,148,244,121,162,214,147,233,82,28,252,195,227,62,224,201,16,135,186,+70,135,120,244,173,216,233,41,62,43,174,13,172,199,218,165,99,2,0,107,+82,46,148,16,232,118,49,167,104,142,137,0,174,202,50,206,62,132,225,170,+10,180,250,166,179,150,233,6,146,35,218,66,32,7,167,8,166,150,56,109,+57,149,173,186,157,157,187,173,207,200,150,125,199,223,54,98,31,151,204,192,+206,187,21,117,31,186,87,81,133,162,108,127,179,142,73,109,41,222,53,6,+229,34,248,119,5,188,160,252,112,164,132,42,203,51,25,26,223,2,167,61,+105,22,53,197,156,58,123,116,225,88,171,201,228,18,117,204,230,196,68,248,+46,162,8,128,255,190,58,147,53,28,13,16,167,78,69,89,45,205,9,5,+48,42,229,237,137,129,142,39,94,126,56,16,188,120,134,7,116,6,131,130,+35,101,59,37,37,81,169,152,149,192,254,53,82,77,27,161,248,40,6,240,+130,45,213,215,11,212,68,189,51,57,83,154,31,210,247,115,100,16,16,220,+156,87,239,121,65,117,131,137,217,6,84,163,123,184,35,80,115,38,86,238,+192,150,147,138,99,178,60,158,238,150,173,148,191,120,195,173,126,179,61,19,+2,195,7,232,246,196,116,199,85,240,19,216,186,156,116,163,149,158,249,182,+242,67,168,234,173,153,226,24,124,10,60,246,26,9,66,182,29,3,115,203,+73,145,167,187,85,20,14,255,150,245,91,70,207,59,253,164,109,179,204,208,+39,172,4,243,166,230,158,240,5,140,172,99,226,233,11,196,116,230,178,121,+216,225,15,33,57,213,66,155,74,223,111,15,229,235,74,222,36,196,225,223,+102,126,230,133,78,233,87,254,209,217,204,156,216,139,123,160,169,199,162,176,+175,15,136,15,102,119,178,32,255,124,162,74,90,97,148,174,44,182,139,72,+239,85,232,15,41,5,140,118,124,156,37,24,187,112,98,244,205,118,139,236,+38,187,146,103,3,196,39,156,231,18,224,184,239,226,31,5,173,100,233,230,+236,156,55,72,222,111,246,56,52,8,114,130,193,14,176,150,195,47,182,215,+21,170,89,177,197,199,112,85,214,249,57,87,192,237,8,8,60,30,219,0,+183,188,82,197,153,7,71,247,138,125,117,247,128,19,197,148,65,196,191,114,+224,77,99,201,224,255,10,136,133,196,160,10,107,201,182,201,169,129,28,98,+255,72,77,170,156,21,161,218,8,231,195,167,130,16,124,108,217,129,20,155,+194,144,213,190,32,73,155,238,165,219,139,2,159,101,242,28,240,12,7,173,+195,65,49,204,42,133,100,87,206,94,25,147,135,190,165,201,123,90,185,158,+243,28,92,54,82,3,214,1,155,165,12,111,213,154,80,26,246,17,220,89,+145,242,64,203,176,235,194,97,25,204,37,113,32,61,102,122,81,214,159,146,+33,79,12,75,236,49,135,88,237,153,139,220,147,100,254,247,148,206,36,176,+204,74,147,244,205,119,93,143,18,135,31,72,219,36,163,11,142,161,58,78,+213,12,213,218,89,86,169,75,230,243,224,195,142,0,96,246,18,216,18,74,+26,161,58,248,210,70,109,63,149,75,111,25,122,122,139,34,86,78,171,250,+180,21,149,200,14,152,169,60,188,28,72,171,91,146,195,58,65,190,64,32,+13,167,199,112,213,86,158,200,94,181,95,170,58,156,30,125,105,245,156,170,+49,85,82,111,51,164,113,180,194,141,212,97,142,36,182,232,231,185,12,92,+228,23,176,145,119,38,49,139,95,91,109,108,8,184,194,227,10,238,94,140,+11,238,172,45,194,10,131,81,179,205,139,230,1,43,13,115,75,221,172,50,+243,250,79,51,167,139,173,197,208,41,171,207,103,32,17,156,157,69,7,75,+112,17,71,199,173,70,167,84,15,142,96,21,153,183,173,158,122,135,148,76,+232,104,134,126,242,241,9,27,152,214,104,2,171,145,143,212,229,255,3,116,+194,189,182,34,115,170,183,247,251,43,31,41,104,41,157,2,30,150,137,64,+102,34,50,144,4,51,48,53,123,201,249,73,186,187,108,198,13,163,67,138,+143,236,27,214,107,109,55,44,238,198,163,225,157,13,165,90,84,177,217,26,+179,198,166,21,190,37,147,246,101,197,49,130,135,162,128,153,246,232,27,124,+104,208,79,239,70,101,213,128,120,237,37,117,84,89,240,243,251,179,238,19,+146,203,177,143,179,23,147,52,69,52,174,194,94,39,100,223,148,76,45,140,+71,17,94,216,101,164,200,255,187,14,132,232,19,162,207,185,240,125,250,37,+125,157,47,146,151,4,54,51,138,23,149,156,247,244,177,64,75,66,96,46,+178,122,174,36,223,61,173,125,99,74,111,220,71,91,96,177,71,186,4,187,+207,82,228,140,69,224,190,35,234,34,201,154,78,71,46,221,142,14,3,107,+225,82,119,48,58,130,174,11,141,172,239,57,181,196,134,196,21,52,104,154,+183,2,121,17,35,137,86,182,49,110,215,77,206,242,75,176,223,152,106,207,+147,184,222,16,107,85,199,200,227,5,132,18,79,122,66,198,3,104,173,59,+22,49,220,241,126,185,146,122,85,3,76,13,77,147,67,34,96,188,19,112,+228,34,173,53,115,57,187,230,36,129,217,170,221,54,121,118,184,179,122,74,+159,228,241,210,145,123,38,184,104,223,183,235,59,59,170,195,147,64,246,147,+253,140,146,52,111,65,82,113,3,208,102,88,104,87,222,113,126,160,219,233,+128,195,122,7,14,137,153,99,213,126,105,78,91,74,49,201,182,94,128,157,+62,244,87,248,116,185,60,91,161,133,140,90,79,153,2,28,170,153,130,85,+230,100,49,236,155,76,179,138,18,74,183,117,215,15,185,77,172,231,247,200,+138,139,246,217,151,153,252,151,37,244,10,0,32,23,223,65,202,216,46,132,+95,202,169,151,73,201,245,86,161,118,147,102,172,100,126,70,35,135,242,60,+247,8,112,53,50,144,167,96,195,159,249,223,28,242,196,8,71,127,231,238,+93,191,147,255,70,94,249,231,77,27,75,209,194,231,26,125,231,202,30,119,+170,192,151,182,253,253,229,64,135,246,231,39,114,78,221,190,69,179,116,255,+118,95,76,102,218,64,46,155,244,172,164,230,47,30,84,190,249,229,84,203,+210,230,146,170,134,183,169,54,110,107,242,195,219,249,203,124,75,192,105,113,+32,5,55,117,84,137,77,201,40,238,226,242,56,138,145,34,113,127,135,87,+0,242,102,212,212,24,158,0,153,212,72,110,93,241,220,90,206,13,222,125,+1,244,124,114,60,206,129,185,183,223,202,246,130,47,216,1,33,252,241,226,+55,77,36,30,137,18,239,106,159,75,99,250,252,173,224,191,166,78,162,101,+161,149,47,121,34,196,241,4,155,173,20,202,63,199,97,209,13,224,133,187,+201,253,217,176,135,96,192,148,239,83,44,173,137,76,75,159,172,152,148,26,+48,203,122,88,49,169,165,252,177,111,184,110,222,211,122,244,36,111,94,119,+55,78,241,235,38,1,70,25,137,5,59,174,40,249,129,126,39,121,91,253,+190,23,136,193,113,171,177,8,147,46,108,11,100,54,25,74,252,172,134,193,+151,34,252,127,142,5,53,220,44,95,183,164,237,195,80,86,55,46,132,32,+207,119,50,184,117,153,128,243,230,166,76,173,138,192,129,255,61,51,51,210,+182,47,7,236,7,70,209,39,33,155,175,125,45,253,115,99,241,161,25,78,+202,85,210,14,246,145,244,112,147,181,74,128,52,188,140,23,2,120,68,137,+101,144,56,144,167,129,49,171,25,157,62,254,90,131,195,78,26,144,65,53,+114,118,40,10,191,155,207,213,77,84,90,62,79,10,199,62,177,132,251,116,+142,60,245,51,229,46,228,37,162,52,117,25,114,5,173,245,113,156,22,73,+189,240,26,77,43,158,219,210,36,246,156,150,197,179,56,98,72,236,175,249,+195,163,197,154,69,66,17,34,208,241,144,244,247,184,84,161,74,120,156,75,+81,207,92,122,179,77,102,83,139,204,213,232,107,205,2,8,164,103,27,88,+161,198,86,178,77,81,81,72,136,153,16,80,129,41,208,237,184,214,161,1,+206,38,204,229,85,139,132,24,123,98,220,83,165,3,146,65,253,31,108,157,+171,144,172,230,191,100,163,202,24,49,179,94,89,116,156,62,179,174,68,61,+230,161,106,68,214,18,181,32,19,71,151,110,176,88,7,105,120,167,252,100,+177,212,126,86,133,168,123,144,33,142,172,181,223,254,44,3,145,112,6,140,+52,85,70,177,67,77,93,241,121,223,21,8,239,203,8,57,110,157,240,216,+158,210,121,95,176,26,31,68,147,159,169,202,181,236,157,79,28,11,75,227,+61,93,74,24,14,17,28,252,213,227,124,18,13,13,186,98,61,4,124,101,+223,135,74,164,126,79,109,189,10,105,181,199,29,154,178,73,76,44,28,92,+247,200,66,31,31,235,0,61,66,107,52,155,37,252,200,55,122,40,15,13,+16,107,176,87,10,224,183,99,102,86,13,122,205,128,146,137,214,137,147,26,+104,136,62,158,88,6,237,80,83,45,94,60,3,252,235,61,124,69,72,255,+50,159,40,244,201,139,168,17,173,98,232,38,193,63,79,181,249,134,65,168,+140,140,226,15,196,207,187,46,226,80,182,229,243,9,7,147,239,214,48,151,+253,119,88,170,141,188,191,171,193,221,47,121,81,95,6,15,236,9,148,167,+38,121,221,98,182,64,111,22,12,222,172,216,224,71,176,225,52,229,247,239,+245,13,164,101,138,224,224,207,244,67,222,103,109,148,32,1,136,12,251,16,+169,234,49,95,218,35,251,172,254,146,255,71,80,86,202,205,59,163,54,165,+42,96,242,172,52,29,30,8,197,75,167,20,30,17,199,7,107,43,99,76,+234,127,152,129,252,80,101,96,143,242,108,174,22,79,203,221,93,205,80,131,+183,102,203,114,37,186,114,118,2,220,136,208,71,194,110,233,67,179,138,38,+150,244,45,71,123,163,58,194,141,123,119,209,89,17,127,239,70,253,253,62,+180,122,165,162,204,78,81,100,30,198,47,211,151,128,196,128,98,40,53,137,+228,255,208,172,196,31,170,99,23,208,244,219,215,250,118,52,143,75,56,177,+102,67,71,52,57,52,175,13,205,232,139,31,188,83,251,246,128,13,89,173,+128,104,133,154,188,57,111,199,49,67,64,238,236,94,89,120,86,134,77,173,+246,111,121,73,38,109,184,48,202,23,145,125,149,146,177,64,222,9,141,92,+63,141,113,22,79,125,213,101,111,126,208,18,58,223,123,186,76,80,154,196,+158,102,156,117,188,58,173,91,191,70,147,47,104,143,155,168,16,51,198,229,+128,110,241,177,169,86,100,196,20,88,249,148,65,250,27,16,223,146,89,10,+106,162,42,208,4,18,75,183,35,114,77,82,187,37,165,24,40,94,233,196,+28,220,192,130,5,6,251,166,127,235,85,62,21,8,23,101,19,149,62,26,+122,33,48,201,245,85,180,111,122,242,90,189,52,68,255,73,139,126,167,31,+132,205,37,233,206,25,34,167,111,244,134,97,196,213,32,70,111,190,238,196,+21,117,29,72,85,255,204,25,67,164,85,162,67,82,210,146,106,92,99,133,+21,231,91,16,171,138,151,41,143,153,133,66,92,54,232,87,169,39,151,239,+215,40,99,105,133,68,122,72,3,118,189,226,131,172,19,142,195,86,204,50,+24,51,187,65,121,208,215,101,91,71,195,149,208,234,204,5,219,5,149,102,+14,151,39,185,150,160,240,253,197,214,90,81,10,102,230,206,158,167,182,95,+78,21,124,160,201,64,35,71,64,46,103,218,193,2,218,41,214,76,103,80,+166,245,228,80,123,100,38,85,15,207,233,23,135,210,36,159,70,46,174,33,+190,118,144,6,125,18,250,20,47,247,61,216,12,172,78,42,212,133,3,228,+229,144,205,102,68,229,64,125,181,98,97,136,145,207,117,196,210,188,94,152,+48,84,235,214,211,12,114,222,92,161,143,104,214,161,143,87,126,93,126,138,+249,72,226,238,14,75,81,34,185,218,152,140,250,168,37,78,98,120,38,135,+182,210,175,96,78,197,228,205,139,107,1,10,214,111,154,195,89,89,37,229,+191,249,221,96,220,86,224,235,50,250,98,83,99,240,43,116,251,54,211,55,+248,154,79,179,68,4,4,36,66,161,143,60,163,194,118,215,112,221,92,188,+185,162,73,160,240,129,46,203,0,87,46,230,74,49,72,171,145,59,176,106,+117,144,16,8,131,98,143,185,111,146,204,199,11,191,207,126,21,99,102,241,+186,145,213,130,229,9,91,33,190,216,64,150,9,243,181,0,74,29,52,10,+204,42,226,219,243,74,248,91,244,11,86,133,88,20,157,243,195,7,133,5,+15,155,245,135,150,13,82,49,243,65,30,60,101,187,163,242,239,195,129,192,+94,115,248,181,239,45,243,225,237,192,126,91,14,129,210,11,109,246,238,154,+136,157,37,38,249,126,175,195,85,62,72,212,177,96,195,239,173,101,159,117,+73,162,96,68,163,78,68,2,29,204,139,55,107,103,112,121,39,232,2,129,+153,16,69,173,100,97,105,24,4,21,208,230,14,125,9,115,0,144,200,237,+66,26,130,135,175,250,155,222,59,240,8,178,212,151,210,233,129,186,76,41,+86,143,216,170,138,40,212,109,139,219,98,172,187,58,119,220,150,226,246,42,+213,66,229,210,185,112,47,16,248,122,112,184,13,158,21,249,221,158,210,200,+71,194,48,101,253,3,217,102,250,63,68,99,48,65,6,216,13,137,50,156,+184,237,122,55,164,228,46,66,186,206,138,248,99,123,125,234,202,212,69,138,+157,246,81,138,134,219,220,75,85,205,91,1,2,73,106,44,49,126,43,52,+107,130,66,76,95,75,37,204,192,42,69,84,108,117,91,39,7,171,232,51,+111,120,25,35,151,40,241,54,49,142,229,208,91,228,7,30,177,207,210,69,+225,2,212,185,186,144,201,250,59,33,201,203,61,172,206,83,108,185,218,64,+242,122,190,193,118,75,56,235,31,188,174,90,137,250,151,34,101,165,182,157,+20,91,121,93,16,155,158,150,105,50,163,55,97,239,7,77,113,108,74,167,+238,35,198,72,212,24,217,140,177,36,28,52,72,245,229,162,115,162,87,131,+89,248,48,151,120,86,19,127,177,185,52,47,130,87,60,234,218,55,153,36,+184,109,39,12,26,177,254,153,242,205,108,93,75,131,33,198,173,71,96,188,+65,146,157,202,77,207,61,85,94,199,55,1,202,2,72,79,207,152,126,224,+181,196,147,142,28,84,238,181,242,165,186,68,201,78,243,149,4,209,222,19,+209,16,178,222,127,95,248,178,240,48,92,168,105,235,172,38,139,210,44,183,+177,180,134,100,43,109,91,234,223,233,215,202,235,250,235,33,74,61,251,190,+85,160,57,185,245,17,5,10,186,69,248,158,31,242,174,54,114,242,181,174,+239,133,201,222,69,202,249,161,177,45,143,68,29,229,28,20,51,164,101,61,+39,120,169,131,39,31,195,122,73,250,73,240,170,213,228,177,232,7,201,215,+34,223,1,29,64,10,99,155,60,86,85,72,247,202,85,117,174,216,191,103,+91,5,50,92,51,191,74,140,161,49,210,22,2,137,236,45,34,159,81,198,+223,245,148,133,23,231,91,147,51,180,247,241,77,248,107,44,86,62,189,155,+243,149,179,240,178,73,241,8,81,49,248,253,181,176,38,82,153,3,79,22,+184,32,57,246,175,110,60,219,234,2,99,99,207,116,211,20,1,165,67,117,+33,28,43,27,163,207,245,68,192,142,77,136,132,80,191,199,124,240,103,27,+132,18,102,135,34,54,224,170,131,124,108,105,235,40,254,34,57,249,98,141,+52,20,183,31,167,133,192,49,106,58,9,231,93,54,228,24,174,45,145,166,+202,116,91,78,120,235,248,94,189,164,204,130,105,67,208,10,68,198,179,54,+55,147,60,90,14,173,166,196,100,171,140,192,95,6,122,107,184,117,192,118,+155,223,122,130,190,161,248,1,227,179,227,245,70,155,185,203,230,127,165,249,+12,81,160,232,50,23,107,57,69,144,28,54,169,40,83,141,253,170,129,244,+144,241,217,148,105,245,224,177,139,156,186,43,145,206,183,89,237,198,184,204,+123,149,202,102,47,180,70,165,82,32,107,164,58,150,239,90,195,141,32,147,+6,77,196,144,28,112,128,213,164,82,230,200,237,38,33,67,88,239,15,239,+126,99,120,59,211,63,51,21,201,12,203,93,193,59,74,31,99,96,8,105,+61,5,106,70,236,19,64,245,33,78,157,153,61,192,22,34,54,6,153,115,+213,110,88,126,74,106,113,195,3,240,79,214,126,237,181,221,208,107,136,49,+61,145,162,1,18,117,199,216,127,108,218,207,241,208,173,149,142,188,243,16,+1,199,126,139,59,114,116,95,217,98,75,82,115,9,178,95,65,128,143,2,+88,105,113,74,31,121,251,61,2,12,83,60,52,213,249,95,77,94,172,89,+239,120,12,210,184,187,30,82,175,179,16,194,207,57,38,215,14,9,6,100,+147,101,191,165,222,182,237,60,228,197,30,211,143,177,166,213,193,83,16,236,+33,186,198,57,234,5,70,205,76,127,222,38,11,11,248,184,60,187,66,78,+13,99,84,26,10,69,203,27,168,144,179,175,27,165,63,0,184,225,167,81,+77,218,157,113,242,24,184,70,198,93,5,213,167,6,121,124,175,120,149,209,+224,148,223,54,254,205,135,112,83,158,37,12,17,180,35,5,13,146,15,31,+46,196,230,109,235,243,92,227,53,39,15,56,250,57,175,63,143,59,252,226,+36,109,235,145,246,228,206,157,138,121,42,245,2,100,32,152,163,63,203,9,+172,14,184,114,80,135,148,146,102,79,246,44,72,212,231,137,140,189,125,110,+94,63,154,45,214,65,194,105,37,9,123,71,130,46,80,81,223,107,94,124,+92,60,152,71,179,214,226,25,150,65,92,116,180,114,81,60,233,132,162,7,+227,45,23,115,171,231,106,79,229,147,73,59,112,62,125,236,65,150,224,242,+185,247,160,123,238,121,202,6,87,100,159,248,255,139,240,61,255,128,239,243,+4,207,49,17,164,15,74,41,27,21,13,74,138,241,58,56,118,19,158,231,+91,176,40,188,201,253,157,35,112,251,250,221,235,55,23,32,191,91,148,66,+66,250,131,69,142,152,71,226,219,248,240,128,128,195,44,101,7,155,14,144,+165,217,126,220,115,188,158,109,29,236,13,236,70,189,98,154,160,10,188,143,+191,133,121,4,107,94,37,79,128,24,108,42,16,14,144,104,16,44,48,224,+254,25,83,78,64,86,253,87,155,249,240,123,34,158,106,80,16,246,232,224,+254,105,185,13,111,131,153,205,17,198,2,59,17,78,63,165,121,187,201,246,+221,223,252,111,71,155,232,82,204,21,178,17,28,236,101,114,69,187,79,222,+167,120,110,54,180,145,249,110,245,86,212,143,246,162,117,241,143,217,106,224,+182,191,238,142,233,179,233,112,140,25,252,131,122,110,178,5,210,227,207,227,+164,191,252,5,46,194,4,145,180,148,195,199,252,155,149,47,205,228,104,117,+89,235,219,92,194,43,159,146,228,239,209,109,170,4,84,172,236,76,8,67,+130,66,83,90,62,20,229,16,78,86,6,69,189,206,250,187,222,193,238,182,+189,101,156,48,199,45,224,168,100,160,218,109,54,215,219,124,80,85,99,50,+233,71,45,88,36,214,84,169,132,184,191,92,63,19,201,218,146,94,17,129,+234,222,64,75,188,40,223,155,103,124,211,150,66,232,184,101,170,118,11,205,+49,233,252,217,250,57,85,7,156,71,77,76,177,17,191,135,67,99,149,221,+7,164,38,72,196,167,98,165,122,85,231,2,47,39,125,15,138,140,220,223,+97,7,125,126,23,79,71,230,37,146,45,51,108,27,191,167,137,243,46,236,+105,23,204,245,68,56,108,201,168,155,228,204,21,120,207,105,173,126,50,145,+27,176,251,172,240,171,79,107,251,180,181,186,141,169,101,247,130,222,100,187,+55,245,11,241,84,39,103,24,61,80,171,128,233,140,52,211,104,195,242,147,+155,159,143,91,42,190,145,111,89,196,216,108,77,76,94,75,6,66,114,64,+123,31,225,19,22,131,172,221,50,168,206,87,248,52,210,84,195,14,234,130,+148,170,127,93,132,178,44,47,88,17,12,147,88,248,29,89,217,110,8,187,+65,110,53,228,234,61,212,114,158,188,214,5,145,78,105,28,223,45,134,235,+194,75,252,40,81,158,212,159,59,208,195,27,35,193,15,232,198,229,190,84,+129,139,247,132,137,179,84,103,138,233,41,111,24,62,230,53,36,160,31,233,+186,54,237,195,20,99,160,107,121,205,166,82,213,20,33,146,103,150,53,95,+96,224,38,121,83,246,150,180,13,207,234,240,118,183,215,163,62,138,44,131,+229,146,122,164,158,115,254,41,129,254,13,81,218,11,213,198,215,216,107,177,+41,168,100,88,106,100,151,72,173,156,248,201,161,114,84,157,54,156,167,81,+200,78,91,137,200,152,159,162,107,200,70,12,235,131,67,139,226,65,239,117,+254,178,116,7,205,39,67,13,60,228,31,229,15,180,210,73,196,177,243,180,+3,141,40,91,81,107,20,156,0,3,116,39,170,143,115,146,138,126,35,132,+70,247,181,16,190,96,231,193,220,234,250,79,216,194,231,19,190,51,196,187,+94,78,156,140,148,90,108,235,43,58,72,210,239,253,17,197,49,113,65,125,+112,146,171,108,131,29,219,244,156,199,117,169,17,202,190,57,222,86,131,157,+80,159,236,63,161,153,2,66,63,9,75,26,58,218,31,116,94,214,126,236,+32,167,114,48,206,106,168,9,131,193,113,75,189,43,149,160,119,167,18,208,+79,10,135,138,41,78,8,101,137,68,77,235,143,169,74,45,133,252,29,10,+132,175,29,107,33,11,11,108,209,217,35,231,147,217,57,49,78,57,166,129,+196,19,137,169,105,177,85,193,85,128,185,112,195,171,99,123,119,131,12,114,+237,101,51,78,60,179,94,127,209,150,143,20,23,21,86,91,94,108,215,186,+150,154,148,16,243,86,168,184,251,40,104,110,47,216,109,155,54,133,31,239,+140,74,59,25,52,177,15,168,160,235,60,123,152,56,1,205,191,19,33,67,+223,178,71,154,95,60,133,95,203,73,47,117,181,83,0,244,224,215,117,235,+11,117,2,34,135,181,158,82,83,66,244,10,121,162,43,12,101,6,176,134,+101,209,208,189,146,98,195,40,211,219,106,255,128,94,32,175,157,90,104,134,+107,101,66,255,16,97,246,144,218,225,5,217,155,28,186,12,141,119,42,132,+19,145,167,217,65,158,239,242,78,215,69,159,233,164,23,38,32,152,248,253,+130,235,28,31,106,235,104,208,191,104,83,148,245,36,238,125,247,190,201,233,+189,143,22,201,75,127,163,175,117,177,131,245,132,120,155,55,252,67,222,237,+153,108,141,243,196,87,156,68,106,200,228,50,250,49,96,107,64,245,171,104,+225,29,208,226,241,6,112,151,29,4,9,58,111,241,223,12,243,244,89,10,+61,237,22,132,9,177,58,235,27,129,170,96,100,2,42,149,167,169,109,89,+124,34,23,90,130,224,214,251,204,95,82,93,98,27,218,129,202,220,144,95,+143,142,4,201,33,71,205,247,234,114,26,103,38,110,3,94,196,81,176,196,+148,155,13,145,60,218,200,54,65,208,73,184,198,245,2,55,17,141,158,242,+174,29,251,80,244,172,75,126,199,6,182,85,150,93,16,107,146,254,70,86,+132,131,228,221,124,16,209,237,15,35,124,90,125,142,169,196,34,161,146,51,+45,37,66,104,170,168,138,70,200,242,170,150,67,234,120,226,49,229,181,201,+157,57,120,30,4,41,27,154,147,222,40,133,193,247,105,231,43,188,196,97,+93,147,195,76,42,209,125,246,255,154,28,80,8,61,17,95,166,38,196,164,+41,9,10,40,127,95,173,12,62,4,40,150,138,159,252,128,254,208,110,12,+115,100,61,130,190,105,46,44,95,85,116,191,20,227,22,33,239,173,151,64,+115,140,43,108,128,213,239,250,163,245,131,49,143,47,179,77,212,153,176,248,+41,230,26,150,168,32,217,129,130,24,115,14,249,51,203,92,216,42,3,77,+242,137,48,228,170,123,149,211,65,211,184,55,71,192,1,231,3,245,188,106,+109,177,20,78,79,52,216,9,211,224,129,63,52,207,32,49,122,89,223,74,+160,227,31,144,2,63,34,254,151,171,62,50,43,18,212,82,197,189,230,168,+67,205,228,108,238,27,46,16,140,147,207,54,179,65,237,169,138,197,89,48,+172,140,218,113,29,169,43,132,108,240,78,73,241,154,16,20,194,214,13,179,+116,18,13,18,62,33,250,133,63,69,137,30,91,80,63,46,206,125,212,255,+130,238,202,176,75,25,43,31,112,31,156,199,99,104,134,202,205,211,148,127,+9,21,176,209,215,119,30,131,86,85,64,56,38,247,194,134,92,74,90,79,+54,19,229,29,2,155,74,227,98,251,139,209,158,73,2,171,41,249,250,115,+203,177,132,128,116,104,184,57,24,144,147,139,70,31,242,52,35,232,231,194,+231,132,121,165,134,37,149,126,48,89,157,50,1,131,81,200,214,156,13,12,+31,233,206,180,107,195,4,106,213,43,236,161,66,142,99,116,41,75,136,131,+194,63,74,172,78,242,51,143,101,58,3,119,110,223,247,151,131,114,251,39,+242,36,170,239,18,133,235,10,236,171,117,250,201,239,231,16,150,136,33,29,+151,188,134,203,144,7,26,1,156,170,158,170,61,50,51,136,197,120,152,141,+51,56,240,182,212,102,46,15,174,199,110,39,185,254,147,53,253,6,244,70,+249,12,86,24,104,39,152,52,228,104,239,113,214,198,0,118,82,110,201,19,+114,113,155,242,248,12,17,133,23,162,127,5,141,205,200,68,250,150,190,97,+227,18,13,56,215,187,221,55,35,12,52,149,241,240,102,193,221,97,117,180,+162,180,78,65,202,47,124,101,25,122,110,157,123,140,48,188,70,216,122,166,+24,174,19,44,182,140,134,63,87,230,67,167,110,18,248,92,160,130,153,212,+56,86,121,226,77,90,148,43,130,23,50,205,36,24,32,14,83,169,82,242,+75,195,138,212,28,201,26,109,237,130,15,203,234,86,168,246,174,90,123,49,+168,29,27,246,143,18,39,243,178,145,120,53,235,74,68,75,131,50,162,169,+152,154,187,2,35,89,48,73,110,220,60,181,241,236,94,244,67,57,251,43,+79,231,203,179,59,17,157,122,118,253,73,208,98,38,60,179,156,97,76,109,+55,114,143,167,24,8,47,40,188,39,131,65,223,5,9,64,222,212,200,43,+66,107,99,135,201,103,250,158,131,36,16,54,254,155,13,130,159,16,49,187,+159,141,104,188,219,140,146,245,252,113,247,180,118,82,236,213,224,85,21,136,+221,243,98,188,64,122,200,43,30,110,221,136,106,62,212,213,15,227,228,234,+170,158,199,76,208,250,86,201,94,53,134,18,90,134,81,31,108,147,193,65,+182,27,61,25,109,34,94,4,48,156,123,94,176,40,192,11,186,205,127,208,+210,55,78,50,208,108,187,230,30,77,106,25,47,167,165,141,142,242,42,78,+103,81,88,157,184,99,47,35,16,122,6,137,160,46,204,174,168,238,21,36,+89,146,139,132,198,167,198,38,100,242,243,38,120,136,138,136,129,204,122,144,+161,158,146,67,233,76,76,123,103,243,183,226,221,87,185,67,14,249,198,146,+155,255,11,152,26,77,200,124,20,37,121,65,178,62,115,125,97,17,249,92,+24,200,248,116,8,219,154,169,109,143,27,231,128,251,55,105,162,186,115,177,+218,238,128,23,166,40,38,167,86,171,222,113,81,183,20,197,53,79,109,30,+39,107,101,203,157,89,90,24,148,190,84,231,223,78,85,41,69,147,253,68,+202,44,39,79,172,209,100,250,230,18,62,171,139,184,1,92,172,233,117,166,+47,79,184,72,127,255,135,167,75,70,92,72,76,189,55,72,200,38,133,202,+102,54,71,159,164,250,229,17,172,200,131,73,20,46,105,117,80,5,171,210,+135,60,104,140,17,14,216,13,216,238,111,236,37,199,97,122,212,68,113,224,+109,63,172,220,57,114,146,90,111,12,191,212,241,19,229,174,210,26,65,255,+206,5,126,75,84,101,182,33,149,219,146,202,42,15,82,22,211,177,167,242,+118,89,160,192,106,172,1,1,62,82,224,197,86,248,218,102,69,229,157,35,+166,197,54,177,230,83,105,221,93,174,187,73,215,5,62,186,82,200,155,246,+33,188,35,177,39,234,166,74,94,91,220,67,218,95,227,169,35,127,80,177,+213,250,74,238,213,172,183,214,6,149,27,23,89,120,221,154,183,4,205,120,+7,70,80,76,182,113,72,64,57,55,96,52,47,252,131,250,44,98,234,37,+137,63,117,192,15,228,191,5,60,15,93,205,178,60,136,148,198,29,57,119,+58,149,13,242,148,186,4,127,144,28,206,37,91,209,36,166,180,233,170,58,+12,221,115,5,45,19,197,186,74,85,227,158,17,60,130,126,96,247,192,237,+8,51,153,105,252,188,69,235,164,130,43,107,103,234,208,232,161,243,13,150,+138,121,87,52,255,61,132,27,174,157,239,190,242,108,103,117,21,174,252,227,+188,24,13,93,191,255,19,161,114,185,117,147,88,59,32,153,101,234,119,79,+251,241,65,31,226,216,181,194,0,54,101,147,184,40,211,211,186,89,159,2,+203,113,50,192,66,4,183,50,109,18,31,168,244,35,146,11,70,93,166,68,+135,68,123,207,234,137,74,99,176,75,176,230,106,38,209,130,107,215,204,169,+81,99,6,68,76,62,140,105,55,244,63,90,134,214,177,70,34,103,93,137,+70,195,225,165,224,19,33,145,39,114,95,96,100,147,156,56,121,130,111,140,+98,155,192,34,21,89,210,218,121,8,194,123,175,48,147,86,214,118,25,234,+197,0,47,83,183,111,172,16,86,46,62,65,250,220,238,146,9,192,120,243,+27,12,89,33,43,196,55,122,128,122,140,230,78,70,127,42,88,58,48,127,+220,231,246,158,89,1,54,212,141,138,167,38,48,38,75,190,65,14,254,177,+199,189,141,115,16,130,21,44,153,170,68,7,13,118,129,43,190,114,161,31,+227,152,118,17,72,213,218,166,151,242,114,232,200,26,134,113,226,151,246,238,+141,8,238,22,50,83,136,213,199,58,244,147,79,5,2,69,144,154,62,184,+44,207,15,115,225,6,72,83,127,149,246,83,149,232,246,41,52,191,88,24,+86,229,60,32,74,231,166,70,132,170,186,127,162,217,147,97,58,133,126,13,+67,160,215,112,29,36,51,210,248,20,65,145,154,36,141,29,2,49,10,127,+150,191,180,125,105,194,79,24,80,181,31,94,72,103,210,73,62,94,1,192,+87,117,213,231,189,66,219,99,168,60,21,142,221,235,30,97,19,19,12,91,+164,182,205,182,53,149,21,118,41,173,202,0,64,21,47,7,72,7,65,73,+155,129,118,221,159,198,90,189,215,45,224,42,75,154,200,18,116,62,119,26,+75,160,206,191,113,12,218,165,198,217,98,103,194,48,232,93,162,208,152,77,+95,211,92,141,209,229,175,58,89,190,229,216,231,146,182,69,179,181,83,151,+208,221,3,110,85,135,178,16,80,214,182,156,5,1,167,161,150,98,20,166,+145,133,8,232,232,42,228,167,120,204,0,77,183,214,139,220,81,159,202,217,+139,170,248,82,221,189,252,86,99,233,56,129,4,209,67,139,126,161,101,170,+218,112,90,123,68,208,61,29,110,174,38,206,210,19,129,233,157,107,236,60,+171,97,47,158,5,103,8,41,103,67,227,56,229,94,10,156,101,248,109,211,+131,68,26,161,241,232,184,177,173,160,63,170,237,81,2,243,29,74,240,132,+105,72,125,77,175,113,128,192,219,240,17,199,64,201,96,8,139,213,29,55,+135,232,196,72,179,118,156,92,129,98,151,41,220,184,108,105,189,224,46,48,+30,209,238,155,121,135,217,7,5,8,50,70,170,158,206,221,81,195,214,157,+205,107,128,151,169,57,59,215,234,41,210,193,179,52,215,222,95,98,98,197,+208,174,232,160,170,57,113,36,171,89,166,150,146,99,221,7,223,224,159,252,+211,57,1,196,116,118,154,76,205,161,155,32,29,129,197,15,51,14,35,194,+235,50,162,31,18,41,69,91,43,208,39,88,54,104,243,168,32,245,187,132,+189,115,211,42,43,107,155,124,208,42,100,110,136,209,236,92,161,96,98,51,+204,118,126,119,164,235,245,86,204,40,152,200,38,122,145,248,48,239,245,106,+68,166,181,30,156,176,231,225,186,11,122,97,184,68,66,235,233,163,76,6,+133,182,119,254,155,229,117,100,84,35,98,75,160,235,135,210,0,209,114,57,+151,243,57,210,229,18,179,170,26,6,84,53,160,220,86,91,111,63,222,124,+11,223,42,234,96,221,116,181,138,141,218,193,219,76,178,168,88,79,181,17,+39,146,155,113,31,145,198,115,147,186,77,88,178,44,145,67,25,247,112,58,+112,200,158,175,52,27,83,16,159,213,20,72,222,96,44,39,251,212,124,144,+240,200,195,217,238,36,56,251,143,8,138,242,63,198,121,5,39,245,227,22,+36,172,97,245,239,57,143,137,71,221,139,85,137,228,109,0,194,87,186,108,+91,151,240,71,177,169,183,21,251,56,220,86,179,188,38,6,30,10,162,180,+136,57,164,209,237,211,70,231,132,98,170,159,55,128,52,40,47,24,9,222,+96,61,202,73,14,2,201,69,80,85,183,191,83,99,158,7,179,47,122,79,+5,93,75,235,228,198,201,146,182,34,14,91,37,4,201,32,229,70,253,171,+148,4,179,183,132,195,78,53,186,30,178,251,242,244,159,244,119,187,67,169,+217,91,175,229,213,139,37,23,216,169,175,221,184,47,151,43,186,210,126,138,+222,162,130,96,218,75,69,168,248,48,124,229,196,238,37,165,214,78,93,160,+254,241,127,174,44,74,253,194,101,51,79,85,69,165,35,203,161,1,40,14,+37,178,238,176,245,98,209,183,31,210,63,38,168,209,12,158,69,244,240,243,+193,108,199,80,216,111,6,65,87,22,130,232,143,12,149,64,36,194,80,237,+203,192,45,123,207,96,102,96,245,35,6,129,92,120,58,148,235,19,94,13,+84,242,231,185,188,55,10,57,53,129,166,149,229,124,97,37,208,14,80,142,+155,219,149,209,87,212,181,222,45,188,13,92,55,179,130,192,197,228,148,147,+30,210,151,107,104,161,44,190,68,80,228,177,250,88,138,221,129,142,226,70,+47,149,252,132,216,8,208,210,53,191,58,11,189,122,205,92,96,137,246,239,+154,241,123,61,45,228,1,14,136,156,168,148,233,219,156,235,132,63,215,44,+100,94,197,177,159,131,205,4,198,58,49,246,51,60,1,233,204,155,216,71,+15,239,19,7,184,201,42,75,247,52,139,236,36,8,228,52,25,248,127,174,+182,127,38,170,1,80,164,227,246,160,184,166,234,207,25,0,227,44,78,243,+59,130,58,87,222,102,207,19,44,132,66,130,129,176,173,109,253,117,246,192,+235,231,165,44,128,158,71,39,147,217,120,170,166,51,187,151,229,132,251,95,+45,95,198,27,134,40,80,199,188,96,92,249,220,46,59,135,85,200,125,241,+74,96,215,30,118,69,222,85,220,3,151,107,91,223,19,189,29,143,235,35,+35,24,173,172,98,72,164,236,17,186,49,192,139,193,252,199,214,99,214,202,+137,203,101,219,166,53,21,250,219,45,125,43,58,244,146,216,233,128,34,124,+228,41,248,199,75,108,179,14,25,242,203,169,82,96,228,184,205,200,187,253,+33,203,119,10,178,42,74,60,33,190,247,221,37,219,190,235,33,108,178,60,+207,26,47,252,171,169,156,162,122,38,123,141,117,84,49,48,247,102,247,34,+206,115,66,38,107,244,227,106,111,238,112,234,73,198,193,37,103,246,152,244,+67,63,188,179,131,222,1,184,173,71,202,68,84,2,221,195,62,94,192,196,+73,90,67,164,48,30,179,171,230,120,39,214,127,20,29,115,100,207,82,19,+63,84,158,145,150,123,6,91,241,242,119,254,255,233,37,200,84,126,216,49,+80,6,49,141,69,208,227,181,201,51,140,201,166,12,8,59,168,21,133,195,+245,199,21,70,197,78,202,16,139,207,243,39,177,232,16,197,142,39,142,185,+0,95,61,98,208,22,122,132,121,71,80,206,158,245,51,112,55,195,52,94,+175,49,200,148,227,175,236,109,87,156,52,96,71,185,81,146,94,211,145,54,+39,63,118,79,54,221,190,199,235,163,236,127,236,224,0,252,231,92,200,172,+111,180,33,21,247,27,10,140,143,210,126,85,241,73,14,46,176,13,62,114,+21,78,225,92,0,135,210,60,24,224,242,154,38,169,218,5,238,128,3,105,+47,49,40,23,43,28,15,175,200,145,108,129,108,118,112,228,105,115,163,52,+124,211,158,226,143,53,87,255,182,201,183,35,49,150,216,141,8,249,209,244,+68,48,144,81,129,112,202,7,12,73,214,178,173,68,125,163,50,208,120,85,+151,164,183,193,148,239,239,136,1,103,161,85,225,224,152,128,241,200,98,251,+11,51,231,40,3,202,192,28,97,183,223,201,157,226,148,248,128,19,142,8,+181,82,249,191,102,183,143,127,152,146,121,30,74,234,199,104,15,197,39,54,+104,144,246,74,189,131,148,111,169,57,8,57,227,155,64,4,214,216,201,145,+225,250,124,101,47,78,84,101,176,76,121,212,61,153,39,174,250,99,67,138,+68,185,166,83,38,138,79,191,141,136,214,159,222,161,125,222,242,159,27,254,+100,67,246,171,17,117,46,78,139,18,73,111,10,163,50,72,27,254,28,225,+205,39,14,233,218,191,69,161,159,131,61,202,237,216,15,37,126,105,5,82,+161,204,87,77,11,17,141,59,56,33,23,117,206,205,3,142,71,24,199,2,+126,152,115,103,240,45,126,173,0,211,136,149,108,22,64,68,119,221,85,134,+242,27,139,87,99,169,188,11,141,60,137,35,117,10,205,7,65,44,207,202,+89,67,108,161,95,174,210,97,186,150,89,57,43,48,52,248,143,188,148,216,+84,90,99,151,78,227,38,10,152,30,171,131,106,79,57,201,47,21,54,70,+252,174,80,179,50,81,46,134,202,211,202,148,126,166,170,74,187,176,225,84,+25,101,204,107,106,69,18,86,50,193,157,86,106,156,248,159,139,169,129,211,+43,61,202,129,231,127,143,112,231,4,32,157,6,138,175,136,218,113,89,222,+145,35,24,93,122,41,147,135,55,185,159,139,211,192,83,117,94,93,144,200,+45,185,142,239,8,67,122,75,163,14,89,108,53,61,189,156,98,77,217,223,+246,249,244,52,202,157,113,87,200,119,83,76,187,250,199,104,117,208,181,243,+37,71,39,136,119,169,255,12,76,67,137,26,15,72,200,130,27,200,107,114,+76,239,188,167,71,67,70,18,70,59,96,169,245,242,26,47,227,35,97,1,+108,235,160,79,131,196,108,120,204,59,246,92,188,59,31,221,226,191,217,52,+101,162,84,65,108,127,127,226,103,19,198,102,248,82,240,236,77,98,222,84,+12,213,185,163,164,240,159,102,19,225,116,28,11,65,240,147,127,91,109,173,+249,220,54,177,29,120,139,66,34,13,15,95,121,54,150,105,108,12,196,184,+235,110,197,179,73,105,96,145,249,83,60,148,255,107,152,245,148,36,221,75,+40,233,152,26,73,141,233,133,254,185,151,190,118,135,44,55,138,84,228,33,+38,216,148,136,23,208,39,106,84,134,104,228,16,140,1,34,210,118,20,108,+120,1,247,110,222,194,108,232,95,149,66,25,137,44,177,97,149,175,148,61,+27,140,242,116,127,7,128,167,61,36,237,242,67,80,182,221,25,227,46,195,+184,180,177,247,217,43,98,124,30,24,63,226,130,36,102,38,245,187,62,94,+80,83,39,192,226,60,187,231,198,92,6,143,34,139,105,125,77,250,255,1,+88,31,34,59,138,112,125,53,162,218,222,55,146,240,252,31,194,206,175,46,+73,10,34,85,150,202,246,217,74,191,130,173,29,41,115,83,97,44,41,252,+17,75,122,160,95,94,251,120,19,172,156,241,198,241,208,150,96,21,72,134,+109,233,205,21,144,193,126,246,38,44,36,59,244,21,128,172,69,104,49,34,+120,42,46,37,36,80,26,2,71,118,207,31,120,14,252,109,55,128,204,82,+251,187,61,172,228,48,53,211,180,1,135,52,137,57,213,99,180,227,134,239,+138,17,25,207,46,69,103,202,124,187,24,226,94,90,23,199,141,196,147,93,+5,101,230,53,72,201,87,113,242,107,151,120,207,130,134,190,101,85,185,172,+103,128,202,6,225,145,87,203,87,63,154,208,139,119,209,242,205,110,67,14,+108,208,163,251,57,189,74,169,63,194,214,128,160,140,33,248,148,172,112,36,+111,42,161,204,68,196,2,226,96,20,44,224,222,166,97,117,252,195,149,18,+79,104,46,93,224,136,60,1,14,178,220,225,159,75,149,30,223,132,36,217,+12,222,161,13,147,211,156,69,38,168,130,23,154,18,29,97,154,68,226,8,+195,136,186,198,140,206,97,252,237,82,127,84,78,53,142,227,130,55,221,97,+251,121,227,157,26,150,215,27,114,243,248,126,131,241,59,23,48,157,45,31,+85,249,193,215,157,7,46,101,249,103,183,207,74,97,123,161,207,231,242,190,+3,214,21,80,126,87,126,253,11,48,1,94,107,73,185,179,13,6,108,137,+78,159,74,161,177,205,212,173,112,151,235,55,105,109,212,134,71,61,108,162,+200,131,142,186,2,230,78,171,32,1,65,90,4,87,202,90,71,64,76,8,+158,146,2,142,10,18,251,119,4,169,64,24,252,86,246,116,66,206,218,51,+160,173,236,97,138,46,190,35,109,208,98,123,147,124,5,229,197,168,29,110,+103,205,206,134,206,200,249,204,65,201,111,108,92,153,87,161,97,146,137,16,+249,174,156,54,91,97,190,30,25,226,49,137,85,4,175,73,214,51,123,99,+112,76,151,204,175,72,157,222,3,112,224,73,29,60,236,59,71,99,152,119,+222,157,64,19,169,44,208,167,196,148,212,93,168,152,123,42,228,8,250,102,+171,113,103,169,117,114,176,117,4,102,165,202,12,124,189,128,0,108,114,210,+65,218,78,162,235,121,196,222,237,218,176,153,28,16,244,39,120,136,108,7,+229,238,159,42,107,162,27,113,1,29,95,86,167,54,156,37,22,32,245,55,+174,3,6,177,135,170,68,141,77,41,162,216,186,250,152,45,34,52,129,236,+39,58,24,0,245,26,147,92,81,220,134,30,81,46,21,25,75,124,198,154,+214,104,240,216,118,171,64,61,186,54,254,145,104,158,7,180,157,27,187,143,+124,77,232,116,43,105,79,184,120,127,206,91,13,66,103,12,203,58,140,199,+30,241,17,20,123,75,58,239,66,137,167,188,158,189,128,223,107,9,27,65,+31,158,184,83,72,103,169,109,50,169,39,96,223,59,163,243,144,48,80,20,+103,24,9,182,174,86,25,100,118,37,207,116,214,82,154,99,167,155,83,144,+46,180,77,91,97,27,163,18,166,88,172,56,249,107,62,130,105,120,74,250,+210,162,58,47,53,157,101,138,46,16,53,147,233,63,42,151,90,157,22,104,+17,176,161,251,221,169,34,0,45,126,189,199,147,248,48,204,235,70,207,145,+2,254,175,224,186,52,53,55,24,223,116,16,31,248,191,170,51,68,66,122,+247,153,225,77,38,39,0,142,232,210,30,110,67,89,39,112,195,243,112,52,+93,222,169,28,169,117,254,108,165,139,178,5,78,115,23,228,74,128,125,144,+44,166,217,212,59,245,247,66,253,88,90,195,173,195,83,108,187,185,46,218,+163,5,45,51,109,218,176,190,192,210,169,78,232,144,160,45,187,78,124,204,+215,18,232,177,220,110,239,186,1,72,99,134,93,48,238,48,151,23,63,45,+70,190,107,190,64,174,92,34,95,191,159,21,38,79,245,90,239,141,141,243,+211,165,117,47,143,162,212,211,129,10,49,168,179,73,138,177,121,155,0,180,+71,201,24,28,178,41,41,97,176,240,237,231,59,140,63,59,0,179,200,173,+246,171,128,84,242,242,241,207,169,194,247,230,225,168,26,3,21,36,99,89,+235,79,216,235,125,96,58,196,244,174,144,179,31,110,152,136,92,230,243,204,+226,61,92,21,161,88,249,121,71,224,125,230,88,244,190,241,197,30,78,207,+107,239,72,234,39,165,103,1,75,37,250,251,201,198,23,116,12,92,86,94,+27,238,245,210,255,229,121,225,165,115,7,48,78,61,142,47,118,127,168,90,+21,101,134,247,230,208,201,9,248,152,16,155,65,45,52,181,49,225,148,74,+94,78,88,212,64,55,62,156,88,106,160,187,161,55,51,134,148,119,1,198,+51,142,23,173,87,99,168,161,230,136,7,51,86,125,66,229,210,50,208,82,+82,90,63,190,95,13,207,212,32,253,70,230,57,100,14,218,216,132,46,95,+129,85,188,26,239,87,23,205,136,131,15,248,253,148,230,149,195,237,74,159,+178,200,4,109,207,214,39,179,66,11,166,49,226,50,12,253,71,208,162,173,+52,87,201,95,236,182,50,24,149,22,136,213,16,109,139,131,62,236,251,173,+1,220,14,202,103,164,23,126,230,169,34,53,166,20,59,149,211,88,61,200,+104,77,167,53,202,79,117,179,173,88,72,208,168,70,6,86,94,130,155,229,+82,116,135,95,206,227,16,58,182,252,134,48,224,136,26,246,198,129,83,68,+61,170,26,116,103,189,100,54,95,114,141,156,161,246,158,209,134,166,156,120,+164,77,67,78,206,13,212,2,31,102,25,106,192,253,201,218,139,164,119,180,+87,23,1,175,153,248,80,33,116,241,96,104,148,55,55,184,99,107,126,122,+127,212,177,213,141,18,61,169,92,86,105,197,248,124,17,194,91,233,251,241,+109,165,100,8,208,249,48,192,164,35,5,55,94,235,56,173,161,144,165,111,+80,57,167,136,197,52,141,18,143,172,177,150,220,138,172,118,33,204,83,69,+65,62,61,132,53,61,201,71,33,57,44,218,216,139,52,192,47,165,41,183,+105,172,225,125,201,64,119,14,214,225,109,138,174,102,136,162,236,154,56,4,+234,237,253,128,61,112,174,77,165,52,29,210,48,196,154,186,30,38,57,152,+227,88,53,88,247,248,113,160,43,127,185,100,146,42,32,241,218,245,53,238,+23,119,39,13,245,129,108,30,23,130,56,107,140,121,233,40,217,191,129,100,+199,152,119,213,183,105,93,253,129,141,111,105,171,160,134,228,193,207,104,181,+12,132,129,69,248,228,141,253,40,99,38,200,132,206,254,139,180,179,34,205,+151,150,130,233,192,176,176,204,74,108,135,168,150,115,90,8,155,10,251,131,+79,52,173,160,128,133,212,69,254,193,144,191,46,168,219,151,2,235,188,4,+197,242,42,79,182,38,187,169,94,154,141,47,132,71,219,88,105,226,194,192,+14,244,145,207,176,28,5,132,171,171,187,177,148,64,25,61,61,252,119,213,+70,226,196,176,78,3,42,229,253,230,205,202,18,145,34,85,75,127,142,144,+72,116,85,206,47,29,182,43,164,4,105,130,79,10,129,158,143,231,179,16,+42,152,123,195,18,251,208,230,23,243,209,137,103,150,229,64,229,40,253,169,+94,181,147,23,73,177,61,220,42,158,75,57,117,30,200,135,245,228,175,215,+135,187,214,231,150,222,123,250,60,175,23,127,168,76,3,115,198,36,232,105,+255,242,247,146,102,99,71,84,91,207,176,108,122,151,156,195,62,56,144,127,+38,248,112,58,2,198,197,222,90,118,154,10,124,51,71,200,139,45,34,49,+49,36,154,235,239,15,141,70,175,150,125,124,1,25,156,80,15,126,142,218,+213,163,112,248,42,29,147,62,43,94,223,42,151,177,222,114,12,225,89,187,+26,249,72,180,24,202,31,172,222,49,211,183,166,236,1,69,192,105,177,85,+51,167,108,175,107,81,32,102,223,229,143,197,78,68,104,17,96,97,146,203,+223,129,198,231,135,146,144,29,45,146,254,253,28,93,61,82,70,158,27,27,+84,174,16,221,190,77,243,228,159,102,172,114,165,117,131,7,59,112,99,154,+60,8,232,160,7,32,187,26,248,209,84,252,224,134,85,229,178,146,72,89,+152,136,232,116,130,54,212,62,162,131,251,0,222,89,73,187,98,178,183,145,+67,229,180,3,126,149,227,148,138,24,190,93,196,172,3,201,68,129,100,82,+79,22,83,16,159,99,149,42,29,246,83,241,117,55,160,24,118,217,146,154,+162,180,57,45,27,61,158,159,150,219,143,202,160,170,199,47,212,169,102,199,+195,102,147,38,80,37,177,207,83,74,55,25,154,187,126,218,12,226,56,16,+28,54,36,202,45,108,49,231,41,151,187,107,179,60,102,212,68,173,128,227,+11,67,71,119,200,81,225,181,158,111,188,223,164,151,63,89,160,5,25,216,+129,90,210,202,25,214,139,116,32,187,61,250,136,76,153,173,204,82,188,88,+174,76,165,12,196,212,137,240,86,5,156,249,112,251,46,150,107,108,140,122,+5,231,249,63,100,102,164,224,75,95,215,16,86,78,24,120,206,198,178,35,+235,133,91,57,139,12,219,156,44,135,98,20,182,134,154,173,31,161,90,45,+77,126,60,151,35,86,47,44,157,65,141,63,9,107,133,21,198,134,231,142,+226,92,179,240,178,209,47,201,53,53,80,25,25,49,66,53,79,100,66,206,+62,181,76,149,69,5,189,94,164,167,31,236,224,202,155,204,158,228,81,127,+65,161,237,90,136,64,49,67,180,132,252,127,131,154,245,0,51,130,137,220,+185,92,170,218,123,88,11,163,128,135,76,124,9,80,133,212,68,194,65,111,+41,58,200,196,110,230,160,113,191,118,196,21,172,109,233,51,105,2,192,111,+94,20,125,18,254,155,39,206,73,204,230,189,189,8,237,142,195,153,167,219,+54,133,158,23,226,193,201,48,22,141,149,46,110,153,103,202,255,20,227,200,+183,100,147,31,163,99,36,129,10,174,238,135,35,79,77,61,246,117,67,189,+153,143,38,122,105,5,195,122,131,68,153,151,68,157,46,148,146,218,36,209,+58,222,122,125,150,126,79,218,226,195,4,206,122,22,171,178,51,197,147,71,+32,94,137,221,155,191,105,57,217,185,86,22,172,83,100,179,124,98,33,37,+30,164,84,186,81,202,233,54,204,130,255,99,234,14,22,181,71,188,143,170,+254,125,115,84,72,137,95,175,175,82,175,247,192,64,143,148,132,183,150,51,+131,192,61,88,242,234,110,186,184,48,255,235,221,59,32,140,168,182,38,22,+244,18,218,171,122,102,227,20,35,210,171,83,23,89,243,70,137,122,102,119,+250,216,213,226,5,224,158,20,165,169,173,106,88,160,223,42,152,115,207,130,+200,161,37,14,202,103,188,177,225,113,48,71,136,106,238,87,1,139,229,135,+170,184,117,200,198,166,210,96,91,190,57,148,136,15,157,200,9,223,110,70,+192,150,243,102,131,254,98,119,53,3,157,243,233,202,235,252,14,130,88,86,+243,214,205,22,54,128,150,221,61,64,56,216,68,99,217,215,198,82,9,0,+191,178,40,181,114,38,42,49,18,26,160,114,227,188,134,43,33,24,130,171,+43,118,100,200,97,39,14,85,56,93,165,142,36,49,245,194,123,183,155,242,+81,38,16,41,165,71,246,50,250,3,203,215,90,67,64,87,167,191,40,209,+99,175,213,137,247,58,155,132,130,204,187,124,70,234,48,248,224,55,42,230,+205,117,46,232,115,10,223,253,237,254,45,116,120,211,255,17,19,167,127,165,+132,220,186,179,162,73,203,83,229,79,44,154,27,187,240,22,59,68,208,72,+120,95,15,3,185,106,171,175,237,66,38,254,175,80,34,132,15,129,12,20,+240,32,162,10,78,82,100,128,97,58,192,15,80,250,110,254,41,46,103,146,+223,165,98,120,164,169,113,216,7,86,210,132,202,40,183,32,213,68,176,121,+144,104,85,69,88,215,49,80,5,230,198,213,75,210,135,77,28,249,100,58,+35,27,241,67,106,39,87,230,142,2,113,249,45,62,150,123,145,37,78,228,+149,39,66,90,194,87,54,96,187,45,202,139,241,13,242,130,73,177,195,136,+234,220,128,189,144,78,157,25,36,194,122,247,30,3,117,138,225,106,72,145,+112,46,31,20,244,66,130,65,248,228,123,4,113,137,69,118,1,92,188,22,+163,10,48,86,233,71,112,63,254,115,147,136,103,98,107,236,228,174,7,162,+173,208,194,201,88,97,255,42,52,39,57,125,236,206,219,169,11,156,145,238,+35,119,29,127,12,135,126,80,140,21,209,182,245,139,26,77,133,138,33,30,+62,179,134,228,132,214,69,232,160,20,139,153,160,43,232,216,137,205,0,13,+209,50,213,166,197,10,45,110,207,132,144,158,25,67,247,47,170,4,180,137,+40,20,63,55,136,214,65,33,140,98,54,252,161,103,238,34,141,137,172,216,+92,111,118,198,197,98,196,33,34,36,171,97,200,73,220,142,246,86,102,70,+211,121,213,48,240,101,255,190,255,103,254,28,17,232,40,245,126,119,184,165,+55,102,49,88,87,238,83,95,149,169,251,148,143,7,191,155,81,10,196,252,+182,49,122,103,96,121,37,59,61,37,166,221,190,171,237,207,39,154,72,125,+158,119,154,31,245,196,240,120,11,176,157,127,232,248,85,82,190,25,44,53,+238,53,205,22,21,36,155,61,138,137,103,193,136,123,207,88,3,42,211,170,+225,25,214,45,249,223,226,242,76,29,181,177,122,113,213,105,116,202,223,184,+180,16,182,19,14,138,47,89,80,45,217,80,23,64,210,123,224,157,12,105,+193,1,56,94,220,47,246,234,70,39,174,209,22,229,99,166,67,6,247,214,+99,130,25,239,118,154,178,200,237,209,82,91,242,48,102,95,244,211,20,36,+72,55,69,120,153,255,232,208,136,70,12,246,229,176,127,169,107,107,21,128,+166,182,166,15,148,217,234,31,237,154,3,140,134,156,22,215,96,59,208,177,+125,65,143,244,30,162,1,147,214,197,175,17,146,40,170,112,46,4,148,211,+189,250,242,253,253,73,114,194,148,121,176,216,138,78,109,169,63,20,45,61,+109,87,44,51,180,145,199,127,46,196,192,5,108,171,182,106,236,137,110,241,+182,244,159,17,72,153,149,116,63,175,2,161,9,141,157,75,125,177,236,78,+196,32,220,80,187,255,87,64,82,214,8,223,188,81,184,139,64,178,140,17,+190,191,140,197,185,25,41,97,79,237,91,170,249,213,19,149,127,94,246,90,+163,159,68,63,16,241,68,67,13,54,172,55,186,53,220,189,193,90,125,145,+15,172,3,237,156,87,13,49,50,185,127,246,239,107,17,220,205,209,220,75,+239,195,67,163,36,192,35,9,22,54,202,156,145,3,56,125,7,168,207,155,+175,99,23,128,31,233,5,19,117,177,218,16,200,201,141,247,253,133,35,227,+28,73,92,96,240,237,177,4,10,9,38,232,24,237,143,109,212,248,146,129,+175,106,72,24,169,251,108,252,67,108,225,231,93,69,86,254,241,137,201,66,+10,73,200,118,137,236,167,164,185,126,227,109,72,58,208,64,91,102,91,32,+226,5,110,143,200,232,141,151,119,96,56,87,51,172,226,53,29,231,132,21,+47,198,175,255,56,155,117,79,108,16,250,105,84,37,32,213,167,13,11,146,+252,87,81,192,42,204,219,182,180,164,108,231,82,69,178,226,51,136,22,32,+205,224,135,249,90,174,125,189,217,192,72,15,195,82,56,52,36,230,166,116,+92,165,156,35,123,49,203,193,111,103,173,161,79,169,203,48,112,205,17,113,+63,79,202,176,166,70,234,70,195,97,29,192,240,57,81,127,176,131,223,198,+2,219,214,86,7,88,229,56,135,255,30,194,9,104,79,106,162,179,134,28,+44,67,98,105,196,198,132,163,247,5,20,154,229,185,132,34,133,73,240,230,+211,2,70,75,87,55,196,249,106,74,41,110,240,177,148,45,162,150,166,127,+42,59,147,109,6,165,241,163,18,131,61,241,243,85,56,250,235,31,6,17,+219,174,238,73,42,11,125,191,198,19,105,172,90,249,225,102,220,89,130,164,+7,144,43,175,142,235,189,147,127,85,210,14,212,139,232,57,99,164,146,166,+86,233,116,22,12,251,134,121,98,74,174,217,5,136,149,210,87,69,76,195,+159,81,180,242,225,242,235,209,182,106,181,78,67,8,89,127,102,45,73,108,+222,77,110,161,46,105,17,247,102,218,121,111,145,60,192,77,216,231,175,170,+102,90,161,215,153,21,191,195,132,76,39,127,130,222,6,38,130,65,134,201,+206,47,10,38,248,84,84,162,36,85,196,90,222,70,39,41,204,202,152,176,+191,254,161,201,194,32,6,234,49,225,217,160,47,87,39,232,66,223,160,11,+134,144,174,253,227,93,94,104,97,86,33,202,152,130,158,211,11,192,221,247,+99,248,245,163,244,245,171,164,64,41,35,95,4,114,247,50,214,60,248,199,+201,65,166,183,68,87,85,107,77,73,76,11,236,19,135,89,188,189,202,159,+195,66,72,6,118,71,77,88,237,133,241,97,167,54,193,34,48,18,132,122,+69,0,103,29,223,133,163,230,199,123,200,77,112,227,39,225,188,85,95,33,+241,195,109,253,243,167,108,51,116,222,111,247,66,221,239,15,205,235,217,44,+162,28,237,25,101,53,40,0,207,219,184,115,182,4,238,217,74,236,72,37,+45,180,45,71,89,187,40,214,103,188,23,172,142,29,178,106,116,121,174,121,+132,156,111,85,172,225,235,210,97,144,71,228,252,158,24,166,83,133,55,58,+168,32,212,43,199,234,201,115,20,28,113,169,163,205,245,171,159,243,39,251,+167,67,191,204,10,238,34,53,240,113,7,193,147,118,164,211,59,121,204,59,+73,13,246,173,105,252,243,184,110,161,35,225,226,74,241,6,64,78,34,52,+61,130,13,246,36,42,201,231,179,53,215,230,150,162,73,81,99,117,245,221,+30,132,160,174,187,46,185,33,255,175,121,103,22,101,249,16,32,66,59,138,+232,190,77,116,180,171,61,136,107,183,131,218,45,24,223,108,86,140,9,232,+139,150,11,137,64,171,199,149,250,1,182,179,38,166,210,155,152,209,91,94,+100,0,157,179,110,63,28,148,186,154,4,83,51,125,80,207,161,125,202,226,+191,134,98,154,113,78,244,196,59,184,253,21,51,248,242,1,152,161,53,191,+21,193,112,131,160,26,130,108,22,109,79,250,76,210,233,55,94,152,107,206,+157,14,198,165,255,213,59,2,133,55,55,2,68,233,48,53,159,242,99,57,+236,126,25,117,148,189,132,156,206,124,23,217,197,146,118,91,128,25,89,123,+114,113,162,239,242,118,214,5,81,5,101,232,226,218,73,184,56,204,85,43,+110,162,228,206,14,136,161,162,193,19,12,1,110,212,9,251,59,149,105,236,+136,248,197,146,157,219,121,23,175,36,22,103,197,51,231,144,198,194,34,41,+160,96,105,176,86,232,55,84,179,227,214,212,60,198,22,161,193,20,242,255,+32,19,99,89,182,161,139,93,5,5,65,65,98,154,48,58,86,110,111,178,+226,64,102,140,240,164,52,31,48,206,181,249,235,27,30,115,85,212,79,53,+32,94,254,166,67,146,27,158,186,20,175,61,16,97,66,73,120,15,240,179,+108,195,244,212,227,45,201,242,30,30,145,201,28,80,120,69,108,158,186,32,+74,42,179,80,105,104,167,55,164,176,50,217,152,33,113,195,49,138,176,62,+222,55,225,101,78,139,65,80,38,87,107,67,193,112,35,232,99,64,179,79,+158,50,64,192,163,12,47,144,252,27,222,5,136,95,241,130,0,4,62,89,+10,107,15,77,87,160,254,9,0,47,189,116,248,58,250,88,84,202,230,17,+116,254,5,112,27,92,200,249,149,102,5,180,174,195,237,130,229,167,42,177,+53,71,7,199,103,208,61,208,33,240,84,237,177,43,92,8,204,70,167,61,+99,2,15,24,139,221,157,185,32,83,248,105,83,162,12,150,234,112,27,73,+77,224,133,53,187,221,14,0,224,9,16,72,190,199,247,17,9,27,81,36,+130,76,36,86,50,208,137,53,98,119,117,171,159,126,27,44,233,110,204,89,+20,136,215,137,177,179,115,223,113,150,156,119,171,111,98,65,18,66,14,75,+167,207,255,5,87,99,204,22,207,102,156,212,142,58,193,235,130,52,105,101,+208,173,233,99,229,131,46,186,1,187,30,99,249,216,244,38,147,71,92,186,+184,31,223,34,171,140,241,217,84,46,189,120,180,67,217,22,52,90,34,152,+244,159,43,187,20,60,242,148,43,161,5,248,222,198,203,51,110,9,14,108,+125,88,158,123,121,209,31,205,37,235,32,76,169,80,33,221,247,251,194,206,+163,167,255,109,30,216,190,128,10,247,129,2,252,131,12,45,204,234,163,15,+73,153,232,25,116,168,78,65,82,26,214,158,89,184,23,218,108,249,25,246,+254,192,55,234,208,77,58,204,29,41,134,131,25,90,231,44,56,60,99,45,+230,246,0,112,201,166,212,231,215,130,53,90,181,68,162,249,48,254,145,237,+68,201,226,124,187,120,7,9,252,154,93,141,100,240,98,36,88,160,74,154,+13,175,233,108,245,231,53,207,39,23,218,29,203,41,92,231,245,98,39,59,+216,220,210,124,47,166,128,146,174,156,219,222,16,221,226,187,215,108,139,45,+191,33,179,124,197,228,147,96,51,13,170,226,244,19,35,238,190,187,68,142,+245,165,45,227,130,243,13,219,38,61,31,197,180,200,225,130,14,158,236,255,+104,134,101,120,33,130,85,208,253,22,155,14,90,1,103,137,252,248,27,129,+140,100,125,46,195,187,44,179,69,106,214,138,168,62,205,113,212,153,92,211,+115,53,115,137,105,250,175,235,252,158,82,101,75,24,9,27,72,127,234,161,+90,148,131,129,238,186,142,190,132,11,162,11,57,2,182,93,43,228,235,79,+248,154,19,255,152,86,9,103,70,45,101,197,203,253,138,218,244,31,71,168,+91,192,208,80,123,249,211,124,150,34,131,43,245,73,52,185,194,167,159,148,+99,41,96,23,50,134,208,128,38,76,53,242,26,233,64,221,118,177,209,129,+202,28,88,255,209,240,140,182,204,233,235,211,250,111,136,57,251,138,255,107,+182,225,38,44,0,55,255,76,41,11,235,41,54,236,130,172,159,184,218,187,+238,37,213,71,156,216,229,170,114,130,252,183,61,62,215,26,46,150,22,227,+117,72,136,192,189,157,103,29,118,14,54,161,200,255,40,47,235,159,91,136,+176,228,182,227,212,4,250,99,210,43,227,164,25,150,31,211,186,85,224,132,+15,156,63,41,223,2,51,8,142,19,103,125,107,164,204,115,157,202,89,102,+92,130,246,107,98,181,129,97,234,25,70,241,118,53,144,101,47,120,59,253,+65,10,228,245,103,204,161,78,144,174,60,106,135,175,102,49,2,195,28,1,+191,176,231,14,246,98,34,108,21,194,181,146,177,27,164,40,111,123,246,109,+191,155,19,235,220,22,35,167,49,245,40,114,149,198,25,86,176,233,211,145,+58,226,17,127,175,183,49,56,49,36,121,5,192,204,61,181,254,156,162,160,+59,90,84,154,53,16,24,225,233,59,207,225,49,232,189,162,188,108,98,146,+179,181,223,27,45,118,41,170,43,243,213,254,143,87,182,194,30,122,22,32,+200,205,90,188,232,207,23,146,61,28,219,42,131,33,128,132,79,150,106,221,+174,167,1,29,176,232,209,193,176,37,252,242,23,175,58,172,230,166,8,11,+45,244,123,197,75,8,43,208,247,212,140,11,22,54,25,51,49,248,250,178,+114,177,110,241,200,159,5,231,182,37,116,82,207,161,253,9,172,50,167,255,+120,36,44,204,206,64,176,175,23,50,162,107,44,247,101,145,25,237,23,185,+40,228,13,56,168,16,12,126,74,165,159,197,71,133,124,14,93,52,49,121,+108,58,9,170,127,210,81,11,166,246,220,130,68,24,73,172,81,227,3,116,+202,250,160,108,74,105,247,27,204,142,34,110,17,227,168,108,97,62,211,123,+42,101,179,106,146,58,180,81,232,109,154,85,111,250,229,244,20,241,192,193,+171,212,221,158,111,153,209,252,32,234,250,222,0,77,153,94,153,78,53,112,+5,65,241,52,166,212,77,44,5,211,133,108,15,186,233,216,214,140,153,254,+5,201,165,66,192,13,251,218,33,27,98,211,165,181,240,103,233,52,142,118,+188,11,185,161,124,70,244,32,5,215,113,77,129,254,7,33,99,205,68,36,+225,97,22,103,57,164,203,174,233,78,116,227,253,52,217,107,189,147,146,222,+199,196,157,242,124,173,57,116,97,106,148,143,209,138,218,12,88,95,206,2,+220,55,104,29,54,170,223,53,210,106,49,93,150,193,86,85,128,38,162,153,+116,116,225,236,223,110,97,232,188,28,78,195,8,223,6,152,96,224,59,181,+15,124,144,71,209,140,152,141,237,44,104,144,203,29,181,72,38,234,13,9,+187,176,125,105,119,245,121,67,221,174,242,55,20,234,225,93,60,125,3,142,+242,224,224,174,68,249,50,249,27,74,85,26,102,38,35,13,237,34,35,200,+42,247,219,119,26,47,3,190,143,160,171,78,19,222,90,238,13,162,21,221,+3,80,128,179,8,172,176,15,190,50,76,57,229,223,79,0,29,142,16,160,+247,192,197,247,28,57,228,120,236,59,227,194,171,239,174,91,7,249,253,181,+182,212,145,190,201,159,208,156,110,31,212,211,254,172,103,141,51,90,63,139,+124,251,64,98,64,38,73,27,215,46,244,193,2,95,7,158,242,63,219,182,+192,239,143,3,177,208,85,237,85,246,72,197,36,0,252,112,71,15,89,4,+86,218,202,59,245,27,173,251,82,128,63,68,159,132,71,169,29,43,6,252,+85,219,28,182,51,41,127,143,57,2,119,199,125,58,7,189,160,152,23,32,+77,228,177,156,81,216,85,76,76,107,213,79,136,19,100,15,85,70,183,50,+120,63,37,197,165,151,59,244,120,251,166,237,178,206,212,77,187,197,41,131,+178,169,77,251,168,152,148,105,1,138,72,104,140,36,232,173,251,137,67,41,+41,35,203,15,214,30,2,46,246,37,32,220,57,77,231,113,200,17,46,125,+110,90,34,170,19,135,224,116,2,172,104,20,133,125,110,137,98,84,97,109,+145,69,232,223,187,113,33,156,255,224,198,175,53,63,241,19,240,159,60,233,+137,167,140,87,177,213,247,172,237,111,82,56,248,78,185,232,203,36,139,51,+239,26,16,233,136,50,174,230,79,154,190,55,205,100,152,0,202,40,138,137,+57,81,237,234,108,73,219,77,228,72,73,14,230,129,51,92,47,161,186,34,+177,38,236,66,28,88,165,27,182,241,172,42,155,53,126,113,215,31,145,58,+187,143,167,249,37,115,77,101,129,217,24,86,124,233,250,149,140,1,108,194,+91,94,150,173,176,156,83,62,19,18,222,94,207,69,244,105,38,250,105,228,+37,106,95,152,91,99,43,147,67,72,130,109,25,220,182,175,58,236,59,181,+197,167,67,51,200,67,204,11,12,56,29,97,15,11,109,5,67,201,181,168,+142,78,190,235,149,188,44,247,47,142,21,253,154,17,35,127,242,235,102,246,+75,124,197,191,187,122,45,209,190,21,128,184,6,25,145,130,75,25,100,61,+16,177,11,41,179,74,49,96,186,253,183,28,52,104,177,198,158,239,203,178,+150,89,148,251,160,72,28,100,22,248,165,210,40,129,106,3,61,226,160,173,+167,163,138,51,238,195,88,16,146,146,125,76,88,141,145,75,61,22,150,220,+135,114,7,215,184,139,44,29,64,198,58,153,155,24,52,134,100,146,190,38,+94,150,55,133,22,139,84,210,196,50,22,196,171,50,74,125,154,89,183,183,+167,250,113,162,59,143,80,58,235,84,254,26,131,143,221,12,143,254,103,39,+43,226,14,214,66,255,117,61,165,246,110,154,64,253,19,11,5,188,196,141,+127,126,69,37,137,226,174,199,227,102,87,59,204,91,252,139,7,66,221,79,+33,73,46,33,135,253,225,193,167,93,138,240,47,80,110,29,171,19,50,92,+115,9,68,125,108,40,180,229,153,51,142,39,157,81,201,204,138,133,8,33,+246,25,12,31,203,47,242,180,40,115,218,91,236,129,73,17,122,140,47,166,+1,241,162,118,178,214,234,14,213,219,26,130,255,124,88,20,47,83,7,23,+100,44,251,147,195,51,31,86,176,209,54,87,128,214,67,9,170,81,211,35,+208,122,112,49,76,205,179,221,24,50,172,241,151,10,66,71,136,35,237,187,+187,3,15,110,195,212,180,167,25,38,84,248,238,249,117,182,128,141,160,41,+83,66,155,99,109,147,110,54,123,51,57,45,147,209,205,10,186,241,95,5,+197,125,84,27,83,202,5,242,63,22,147,96,82,98,110,182,253,135,75,9,+170,191,46,114,60,240,194,228,10,147,170,171,47,92,73,241,215,190,209,138,+111,93,184,4,99,247,88,248,128,14,214,77,235,21,16,113,233,87,77,129,+254,107,253,153,191,195,39,169,48,38,193,206,53,228,200,221,71,151,39,170,+119,21,54,248,252,242,30,22,156,234,228,87,219,61,11,73,43,229,226,22,+145,252,168,39,224,210,76,46,20,132,82,137,240,0,246,194,232,21,163,167,+189,126,97,82,94,207,97,12,207,101,85,14,120,77,78,213,112,31,110,210,+29,233,18,178,208,82,51,94,24,27,184,233,123,150,200,73,9,15,186,128,+16,26,139,13,75,251,198,82,120,120,1,182,216,76,179,20,24,31,114,165,+27,178,142,191,247,165,114,110,250,35,165,64,120,226,63,94,88,31,160,236,+89,234,141,223,178,238,123,37,45,3,110,124,88,144,184,170,68,247,69,95,+154,231,175,100,153,73,115,170,99,121,92,106,34,211,98,126,97,106,8,1,+84,241,121,145,16,125,19,219,4,175,31,98,138,55,203,143,51,120,123,208,+38,20,60,237,233,128,248,80,21,232,169,45,4,150,58,15,89,87,29,219,+71,125,154,151,248,124,234,44,20,166,104,239,248,208,186,110,251,158,192,244,+38,59,153,191,25,67,145,108,100,140,74,20,205,47,61,3,21,218,183,199,+8,231,15,130,158,106,66,163,84,28,71,147,203,83,57,184,117,90,105,187,+84,167,0,98,37,197,107,139,49,194,241,89,187,212,144,63,139,7,52,219,+236,109,147,151,151,246,119,188,38,26,190,163,42,244,9,102,111,167,220,221,+144,153,151,193,196,207,248,16,153,75,204,207,214,96,98,173,17,58,63,29,+153,127,235,209,104,119,142,75,132,146,134,152,63,196,73,195,217,87,13,237,+133,248,40,121,77,23,127,217,90,166,40,136,199,109,193,0,239,53,77,116,+14,219,62,206,86,132,176,81,178,206,105,222,192,32,39,9,191,14,255,187,+208,53,45,54,188,29,218,28,63,133,113,113,105,185,174,198,207,50,199,198,+174,8,29,181,17,228,198,21,92,234,136,179,177,15,186,41,215,237,45,140,+179,218,34,6,91,245,124,15,159,64,55,107,241,77,126,39,91,76,239,156,+4,78,64,138,151,212,253,99,115,199,166,44,129,42,65,168,204,168,170,185,+122,142,219,93,206,2,117,238,99,150,52,24,170,83,225,250,129,27,17,111,+137,2,174,2,107,136,17,141,191,255,22,68,25,252,142,189,131,192,239,125,+169,106,11,33,159,66,215,189,170,184,92,139,175,21,190,22,136,44,164,130,+220,13,176,223,255,138,48,173,186,92,31,3,237,37,178,181,47,128,86,70,+31,125,240,191,180,106,138,244,89,236,26,232,57,176,92,56,55,10,127,245,+31,67,191,155,35,23,199,227,86,9,64,182,129,35,121,90,199,254,119,173,+222,132,80,145,234,255,213,242,222,2,164,49,237,232,255,61,136,66,91,240,+82,108,246,64,37,111,164,56,77,137,200,76,105,129,85,215,224,65,216,86,+237,237,56,218,17,252,114,190,105,29,188,212,177,183,24,152,27,160,97,97,+7,247,82,203,78,60,66,226,184,74,179,40,45,231,27,202,132,127,118,65,+104,217,101,178,202,142,29,190,174,197,100,21,155,163,15,222,247,188,118,186,+200,227,108,218,233,173,210,126,139,223,46,20,18,212,166,213,62,195,185,7,+192,158,180,203,179,59,27,224,173,69,95,246,197,15,244,127,195,44,34,254,+236,170,240,59,66,217,165,98,178,188,127,198,6,137,91,130,125,161,52,46,+147,243,250,228,179,71,166,39,10,153,172,215,123,62,153,39,39,82,40,173,+222,245,220,32,114,163,245,103,118,243,59,27,43,64,81,239,146,100,180,142,+41,133,21,166,135,136,249,204,235,235,7,119,69,146,97,57,239,12,159,202,+48,190,147,196,182,140,66,68,249,132,233,12,198,86,144,201,41,57,3,192,+118,134,176,97,166,16,99,72,157,45,212,234,104,152,71,25,86,17,226,148,+3,183,182,3,246,161,201,33,198,73,201,101,172,46,43,195,100,76,231,175,+245,136,222,221,176,40,239,20,64,164,182,215,90,110,138,129,44,28,43,240,+63,235,147,88,152,66,231,73,235,37,207,52,233,251,86,147,221,14,189,138,+223,175,160,172,112,197,203,215,149,129,151,33,253,63,218,73,208,71,112,198,+33,249,172,148,206,188,224,254,7,0,90,143,1,121,117,4,44,44,203,110,+251,59,255,135,203,195,195,216,184,159,253,127,163,238,255,98,222,233,120,221,+244,227,69,103,161,152,200,174,177,76,4,198,91,28,48,109,225,61,28,191,+23,207,151,116,25,93,89,17,25,70,145,127,69,230,158,70,126,47,77,71,+175,17,222,82,145,114,44,125,79,56,143,148,255,25,87,8,191,147,24,109,+159,236,84,64,97,137,10,37,253,216,36,84,41,101,114,181,155,0,123,60,+122,196,168,109,6,57,106,15,81,216,51,190,127,33,20,154,248,38,157,127,+63,97,13,6,36,156,120,234,17,35,178,230,155,144,243,158,44,47,124,10,+121,213,15,4,158,110,238,178,78,196,15,105,103,238,106,39,192,183,235,234,+194,158,164,115,15,187,133,93,15,237,49,65,112,221,8,147,114,30,111,31,+130,0,171,203,86,215,29,228,232,82,5,112,250,128,25,19,160,117,0,49,+110,34,178,170,214,198,197,13,232,90,213,250,127,86,222,190,39,34,179,155,+130,252,117,249,50,35,149,90,63,30,163,98,1,225,81,3,105,193,100,149,+215,239,159,94,205,70,211,159,207,167,63,6,76,108,68,211,0,158,2,83,+77,159,98,65,101,3,65,112,127,7,142,103,161,56,32,87,45,100,157,86,+3,238,164,233,23,177,126,113,128,56,94,166,196,131,131,34,81,196,165,101,+28,232,143,204,148,161,210,219,61,93,240,3,192,25,147,195,201,34,190,23,+101,12,0,124,121,112,126,126,96,1,164,224,195,66,122,47,208,74,239,52,+102,11,232,116,57,55,127,113,39,175,167,70,244,162,37,43,176,181,126,182,+250,149,197,164,142,248,37,101,213,117,145,109,110,251,235,94,42,152,145,225,+67,205,115,179,217,255,92,23,49,70,160,244,248,189,255,29,15,11,64,235,+46,153,28,150,113,234,176,181,196,100,230,196,39,215,219,51,53,80,167,245,+62,246,105,202,142,87,232,181,231,112,10,42,128,72,60,107,14,154,22,238,+132,60,161,123,89,134,185,189,86,84,73,153,0,32,55,166,223,39,14,195,+103,45,95,180,45,55,102,17,152,67,87,225,21,159,125,139,58,176,15,38,+254,132,9,247,197,46,221,237,133,245,160,17,37,128,132,161,222,62,80,165,+192,146,162,177,115,116,222,71,241,53,170,151,215,211,89,85,101,78,80,47,+126,200,40,70,153,48,195,192,249,229,91,155,138,210,228,255,187,161,3,26,+5,164,90,54,84,8,174,153,239,93,19,31,142,44,85,140,149,42,183,223,+39,165,199,205,36,249,5,207,156,251,153,251,24,67,198,102,134,119,46,45,+224,104,130,166,178,14,146,96,187,80,18,89,76,181,87,109,233,249,47,122,+29,32,182,185,145,126,196,119,16,38,157,118,221,137,47,183,116,184,171,54,+138,255,65,2,37,198,64,81,209,193,253,247,29,69,164,245,133,99,53,201,+186,96,168,6,59,105,66,204,156,208,8,194,135,67,225,230,132,209,232,254,+164,222,88,255,96,236,194,246,70,111,77,99,44,213,69,110,214,128,120,199,+252,83,166,135,73,82,31,69,110,127,190,152,28,107,166,14,177,79,239,222,+21,12,120,157,164,116,8,203,214,191,252,7,130,230,129,224,20,20,96,209,+131,26,176,15,203,183,127,201,56,146,146,53,208,209,223,224,83,126,14,242,+159,139,192,48,18,219,118,203,135,6,212,160,245,20,8,143,241,202,254,215,+47,12,206,220,62,110,10,87,30,229,253,42,38,245,228,25,174,80,177,215,+189,50,215,186,11,137,226,229,16,54,33,226,67,45,200,178,51,224,24,171,+88,21,29,87,111,8,26,6,18,58,151,137,168,94,79,187,132,9,184,140,+78,107,152,196,134,79,113,56,184,73,195,109,62,176,255,88,30,106,173,209,+21,145,145,113,29,206,36,244,2,49,24,12,136,242,51,248,195,59,67,108,+230,116,87,149,201,136,177,153,185,138,141,117,193,130,209,16,147,156,99,14,+141,226,189,43,30,80,255,248,199,38,77,129,166,143,79,168,11,205,62,10,+131,24,151,35,70,219,177,141,83,235,48,86,245,57,223,209,206,158,76,133,+54,46,135,201,94,209,99,206,200,127,161,119,30,47,213,122,223,53,95,37,+244,190,128,196,109,51,175,225,104,231,169,28,118,11,214,101,106,108,86,216,+36,219,56,71,216,126,64,231,60,95,146,138,176,123,20,28,22,53,252,100,+203,210,168,209,60,40,124,182,34,237,179,159,213,254,114,89,16,247,82,48,+156,196,250,37,110,162,102,184,115,209,69,148,143,87,114,147,114,57,250,4,+87,135,241,195,164,216,64,117,243,228,46,215,28,2,254,195,52,145,8,3,+219,112,156,133,110,154,78,80,22,42,218,211,41,116,112,12,127,68,182,66,+26,93,242,144,0,147,175,75,216,7,57,52,218,53,130,64,167,36,95,117,+82,195,249,109,234,25,208,93,164,101,30,37,184,65,87,64,115,210,128,193,+219,90,209,177,98,162,176,125,186,12,237,64,151,208,13,234,163,46,100,2,+106,199,115,214,31,241,222,169,136,138,44,136,168,5,129,201,199,53,200,4,+17,103,196,235,61,72,210,26,28,152,68,110,22,123,36,20,52,94,42,138,+184,213,136,38,51,160,223,83,74,254,104,41,42,249,178,126,108,9,20,134,+29,71,122,222,157,79,192,212,87,25,55,245,131,243,40,170,221,205,180,180,+218,16,107,95,63,56,255,86,114,20,216,139,12,53,209,71,227,121,107,11,+185,34,124,208,113,105,94,230,140,110,86,19,248,14,33,2,48,126,81,163,+178,59,47,90,50,55,54,159,184,9,248,187,3,140,204,13,41,197,230,54,+101,121,183,60,69,206,127,118,221,21,203,158,128,4,190,180,246,245,33,0,+181,249,86,136,29,230,232,140,224,29,48,189,139,254,33,25,166,59,188,171,+55,249,120,70,214,17,50,110,15,196,3,192,95,56,38,92,189,182,76,225,+27,95,58,53,174,245,54,117,160,77,207,91,193,62,2,24,201,176,247,233,+50,122,111,62,253,66,155,181,132,111,167,251,192,190,30,151,235,85,180,176,+85,108,217,91,202,51,115,230,86,78,5,69,18,124,3,112,158,209,71,209,+131,174,5,220,81,196,220,179,207,118,166,150,182,201,219,94,253,221,93,125,+146,214,58,146,128,105,254,123,35,10,32,116,94,69,35,135,187,122,235,98,+44,84,153,85,29,225,171,162,181,46,134,200,21,141,231,114,206,23,26,59,+118,62,224,162,3,144,94,36,133,85,240,110,17,33,209,146,75,141,49,167,+171,32,218,211,32,47,20,130,209,125,127,254,216,149,115,48,79,223,88,123,+3,51,67,130,152,35,33,168,76,233,140,137,50,119,229,139,123,132,97,72,+228,11,88,177,80,177,91,200,168,219,5,127,59,216,73,192,69,59,7,197,+165,4,251,24,90,14,89,189,19,236,14,210,220,166,112,80,52,130,222,113,+47,57,105,140,224,170,176,238,156,146,219,72,97,217,176,133,128,24,236,131,+60,62,84,69,126,205,251,2,130,58,194,234,64,152,41,37,22,6,80,100,+105,21,246,116,117,119,78,146,57,9,158,113,154,65,137,7,5,66,87,72,+109,55,136,167,217,44,71,147,10,129,87,78,152,228,159,129,168,81,79,183,+102,201,126,122,52,2,235,82,193,40,172,149,61,11,184,182,152,141,53,98,+87,95,20,100,156,202,24,41,249,252,43,101,58,151,15,239,126,75,20,84,+236,106,75,88,17,157,82,138,131,144,120,47,233,245,87,206,251,96,197,158,+80,219,205,175,190,116,5,64,29,189,58,209,197,204,126,109,14,134,153,223,+139,39,253,6,95,96,10,87,78,184,132,130,9,39,64,119,115,59,160,12,+193,126,148,244,60,114,225,85,47,201,66,227,86,240,4,91,52,177,193,206,+62,57,67,69,239,197,77,208,203,70,78,19,37,224,157,106,21,51,26,50,+75,170,231,173,53,204,243,109,222,203,213,106,35,0,210,67,115,220,211,211,+203,120,25,187,137,77,149,175,72,98,225,154,127,233,42,76,188,61,156,123,+248,191,172,121,94,95,54,19,63,143,196,3,67,69,158,167,204,104,166,189,+220,231,128,213,81,65,65,53,38,240,186,71,14,252,229,42,214,15,60,55,+70,63,220,251,238,96,38,1,193,145,128,73,10,156,70,50,117,94,106,6,+189,1,188,33,77,215,29,245,234,130,251,36,67,17,129,93,107,60,54,254,+204,246,94,78,140,98,189,82,123,73,121,33,252,78,174,196,73,30,222,239,+220,31,171,23,75,54,201,47,108,35,243,27,0,136,109,245,102,81,114,78,+241,189,147,74,122,74,191,63,26,244,174,72,189,195,90,183,215,201,252,71,+54,150,250,32,224,246,234,151,57,212,228,199,145,117,65,197,195,175,242,255,+161,53,186,238,129,214,170,250,169,58,31,158,242,204,49,66,37,197,37,17,+240,133,49,5,240,241,236,5,63,112,41,140,45,116,24,54,214,26,113,135,+183,86,217,67,38,93,33,193,227,210,166,20,82,130,246,220,103,39,11,188,+73,182,118,211,180,186,14,38,66,19,120,62,155,221,65,101,41,12,200,198,+4,184,41,42,161,107,2,191,46,102,53,7,56,81,42,153,167,143,199,232,+22,124,101,194,211,199,39,49,242,203,107,64,24,81,227,134,31,94,62,171,+91,215,169,254,52,150,15,151,180,3,115,137,86,153,168,192,140,42,129,184,+227,160,158,106,209,3,255,0,67,136,44,168,230,25,145,5,117,18,217,169,+89,83,149,247,65,182,215,5,10,199,134,49,101,242,166,179,127,31,180,7,+119,253,25,255,90,119,54,44,55,11,76,55,1,2,92,164,218,9,196,159,+19,246,103,90,217,151,96,125,200,198,165,99,200,85,55,5,127,199,80,183,+72,255,43,27,55,171,128,191,188,44,48,14,177,124,0,223,101,127,42,189,+135,94,114,24,230,170,156,134,97,237,185,32,86,19,158,55,17,35,136,217,+2,36,131,224,231,230,77,6,195,12,67,206,78,222,136,120,61,248,213,178,+213,57,192,5,60,95,77,46,25,220,238,242,11,112,144,246,44,30,239,186,+106,52,167,247,219,117,133,76,74,117,69,31,79,141,234,225,61,30,164,53,+40,125,155,203,24,61,97,107,202,66,54,90,209,214,237,197,253,115,147,105,+75,98,56,76,155,113,27,197,132,72,5,29,10,165,134,203,143,91,81,234,+46,206,20,77,148,51,19,208,159,94,81,1,10,29,185,18,239,12,4,183,+115,110,148,148,92,21,251,37,232,148,79,66,227,93,12,147,192,212,66,16,+110,167,15,209,30,220,186,178,231,201,210,205,42,105,112,118,149,140,39,28,+157,115,189,22,166,236,63,187,237,13,241,159,80,41,114,185,3,1,225,171,+22,59,73,166,252,255,169,95,197,39,243,119,104,203,180,82,24,174,100,227,+157,198,143,109,14,82,225,169,47,179,89,117,41,32,59,55,148,26,246,99,+154,4,43,244,51,131,221,9,201,120,93,176,249,119,183,150,98,44,129,148,+36,228,0,24,244,72,164,153,227,74,27,67,254,158,72,126,161,213,135,141,+116,144,38,43,86,88,65,169,51,102,148,193,65,79,41,88,22,135,62,31,+202,0,174,37,6,177,225,34,171,190,93,134,64,105,127,52,18,238,109,114,+141,251,221,9,168,144,231,40,247,15,146,15,247,117,219,185,255,244,81,47,+17,144,11,140,122,53,247,56,139,7,177,48,84,48,80,5,250,40,253,35,+182,116,187,4,128,101,88,137,125,85,125,160,8,8,27,246,163,252,246,0,+166,222,140,27,116,129,39,50,126,128,89,44,249,84,149,152,87,105,63,15,+99,130,235,132,90,137,187,38,100,92,225,92,219,174,236,14,13,151,198,82,+145,184,89,14,180,92,122,250,57,217,79,223,120,32,133,15,4,33,115,60,+86,54,182,194,46,241,218,68,75,133,61,10,219,183,70,110,64,216,185,12,+43,101,214,163,235,23,100,143,235,36,137,11,237,89,220,184,214,9,24,79,+2,187,154,44,47,95,204,160,69,211,23,177,188,198,149,1,137,17,152,101,+217,195,171,104,95,137,11,247,152,27,15,216,112,169,244,160,242,171,195,115,+44,127,204,7,249,28,101,117,133,98,251,220,98,150,81,14,94,96,115,253,+55,178,84,176,151,127,174,175,205,198,103,120,76,201,49,218,14,122,211,80,+211,200,252,57,154,194,251,109,177,213,45,158,146,141,114,28,145,50,138,154,+32,122,248,62,120,21,81,178,159,149,73,28,148,155,13,237,93,54,144,225,+144,11,3,232,183,224,242,86,254,112,219,130,96,143,39,19,224,195,226,226,+146,17,118,175,142,143,211,243,211,70,37,78,106,236,28,132,201,228,142,33,+131,2,144,80,171,16,236,6,129,202,11,34,206,127,97,124,205,58,145,89,+16,30,6,229,55,97,197,115,87,182,187,200,16,106,187,29,32,189,73,164,+70,82,109,35,160,137,145,34,130,67,96,118,167,43,104,117,66,148,111,175,+222,128,81,105,14,127,151,160,251,188,142,10,115,243,27,31,91,245,62,195,+167,29,130,82,196,28,93,223,226,47,182,6,254,176,135,12,106,104,66,71,+10,109,56,26,73,80,33,7,223,88,93,141,48,139,40,236,177,114,132,164,+253,72,96,104,231,121,74,237,81,76,181,151,203,187,34,61,20,195,125,39,+240,49,132,177,245,241,235,76,87,222,125,160,147,200,110,233,169,11,250,84,+108,0,96,63,177,63,210,181,186,63,14,228,240,134,32,255,211,230,76,163,+24,194,85,198,237,203,162,219,164,164,14,91,68,46,73,150,155,94,115,239,+17,37,96,104,53,210,168,70,129,28,188,87,102,158,180,227,45,87,219,220,+138,194,187,133,22,26,69,179,113,243,75,147,186,149,200,251,191,74,222,30,+84,177,108,40,201,226,30,97,208,90,253,184,152,215,78,120,7,148,148,101,+211,122,248,148,37,230,128,234,215,87,112,9,122,54,195,240,137,224,235,253,+157,101,38,142,70,187,140,232,102,212,229,84,222,91,218,35,28,92,210,248,+60,214,136,109,210,154,41,81,117,208,156,43,157,179,41,215,92,194,156,216,+249,126,7,123,142,250,65,205,174,177,69,223,113,21,164,117,75,138,85,118,+172,88,114,2,61,7,216,233,189,203,129,214,151,61,79,118,80,212,69,50,+24,245,59,247,44,199,55,87,116,221,70,72,60,21,214,219,119,102,60,247,+149,140,118,44,61,11,132,188,158,195,246,220,139,94,208,165,8,125,219,162,+115,100,188,186,64,88,33,148,171,121,163,148,214,154,198,111,237,10,165,253,+187,223,63,8,183,224,1,118,194,76,39,187,70,27,75,238,191,234,233,43,+243,64,44,1,209,121,176,187,183,162,75,185,127,249,125,163,7,75,254,157,+111,176,124,132,211,121,58,19,10,243,224,252,24,214,170,111,11,45,193,149,+131,50,208,175,22,58,205,51,181,139,33,62,205,233,137,117,51,67,19,25,+103,30,99,129,244,241,216,51,151,183,146,190,202,223,82,3,144,15,175,170,+116,158,50,45,135,140,149,219,118,195,190,132,151,72,155,158,152,80,3,30,+25,255,98,131,113,166,109,99,218,169,91,219,83,123,137,255,236,9,174,217,+86,189,150,180,17,60,56,23,85,17,240,133,195,80,180,192,166,163,149,85,+122,237,84,96,190,49,50,121,68,161,124,78,57,179,253,219,170,91,207,21,+213,233,0,29,99,108,176,225,136,20,180,208,138,159,158,40,213,19,38,80,+250,178,29,155,59,208,116,47,39,179,109,141,132,26,37,35,117,14,14,33,+49,155,127,213,53,63,127,105,183,151,233,145,208,176,17,29,28,193,251,166,+88,58,188,169,77,69,236,21,14,186,140,159,132,162,72,76,89,223,234,140,+175,210,231,59,109,13,207,232,89,212,122,4,144,8,168,193,215,245,34,162,+128,69,125,125,36,19,65,2,173,135,215,22,70,96,212,212,206,72,87,15,+70,246,227,187,33,72,70,31,3,233,14,147,96,96,154,252,95,173,92,60,+207,166,60,106,180,213,225,194,146,42,38,124,20,5,132,196,76,243,60,53,+227,87,141,196,78,107,233,244,219,92,193,177,248,139,61,71,16,63,173,37,+230,21,8,135,116,127,73,208,127,182,226,120,239,33,203,3,60,193,32,64,+52,161,50,223,96,197,173,13,102,177,16,54,38,27,188,253,219,255,203,62,+32,74,124,30,20,114,174,35,68,153,185,146,37,13,18,26,193,204,134,117,+34,226,251,196,109,237,76,125,4,208,47,219,55,24,53,132,44,33,202,142,+132,158,211,3,2,238,156,255,254,180,170,71,170,197,48,63,231,128,237,9,+135,114,34,115,238,62,90,236,159,239,237,84,99,248,110,246,79,117,211,192,+211,62,123,151,231,67,64,156,191,83,225,2,78,186,78,30,154,214,111,23,+46,34,75,111,202,128,22,52,241,125,72,200,83,254,238,21,156,8,113,201,+15,249,100,232,207,232,20,239,245,146,39,26,145,229,8,134,15,217,172,44,+167,75,88,149,24,246,115,41,234,218,141,207,0,75,17,20,125,139,150,120,+234,230,68,31,97,206,45,12,32,38,124,40,51,6,83,97,120,76,59,132,+71,93,42,91,88,44,14,154,176,219,173,88,174,215,13,113,146,39,2,79,+222,19,216,109,36,141,69,172,2,250,196,139,170,143,253,10,136,237,227,149,+81,45,84,5,255,223,208,13,175,25,115,53,220,17,176,36,86,242,101,9,+26,138,67,198,25,45,222,85,97,140,13,55,227,230,89,143,6,230,251,239,+220,208,28,16,109,107,247,158,108,145,73,158,77,237,202,94,213,255,1,28,+216,183,5,69,41,129,190,85,133,90,137,49,90,122,143,9,150,160,32,193,+67,44,2,162,48,172,235,32,237,240,197,213,57,164,134,199,1,32,38,111,+84,201,40,176,98,186,30,9,107,126,169,185,181,30,76,52,90,61,53,220,+200,207,253,88,200,52,200,235,156,125,133,0,213,66,118,155,253,231,170,121,+76,101,102,144,98,216,140,5,130,249,78,159,241,15,215,83,199,75,180,12,+160,87,140,160,213,187,110,238,252,234,61,99,12,118,191,83,35,38,119,109,+103,67,45,74,41,220,232,192,61,1,157,50,160,96,38,143,125,115,254,129,+202,240,100,144,189,2,33,69,126,7,190,120,146,26,115,209,85,114,82,163,+197,253,234,219,143,1,71,203,70,199,28,18,229,130,2,50,254,129,82,186,+190,177,162,245,160,93,215,18,51,175,142,168,75,18,189,7,199,48,75,43,+72,171,167,145,85,218,107,217,63,144,46,41,60,195,84,147,160,32,68,124,+4,108,121,103,246,180,73,234,151,65,97,212,223,133,96,227,112,44,98,142,+50,174,22,69,159,7,209,89,125,83,184,139,238,184,118,124,196,231,153,192,+186,92,141,183,124,202,207,40,22,237,185,50,254,157,95,51,47,152,221,37,+126,191,61,88,145,211,105,212,13,184,173,5,47,79,164,206,39,84,70,148,+78,163,79,166,209,52,99,30,77,37,194,236,30,163,184,179,23,137,46,177,+182,137,179,233,2,159,81,7,15,124,212,207,7,181,99,149,9,155,221,157,+231,200,86,144,39,146,50,26,188,31,214,140,172,238,190,155,116,123,176,206,+234,38,212,42,100,231,7,155,217,147,195,71,171,7,131,110,57,92,77,38,+109,212,58,181,75,74,212,154,212,120,70,166,183,254,203,10,4,121,8,245,+44,201,50,215,17,14,145,181,232,2,59,49,159,183,176,190,102,6,108,9,+46,169,16,232,141,146,40,68,195,244,89,76,8,124,250,134,253,177,192,108,+4,54,163,78,141,246,95,33,242,189,52,224,134,255,176,68,188,194,121,239,+233,242,193,215,143,109,77,41,144,12,18,225,42,144,100,254,250,86,223,120,+125,72,97,9,80,94,247,69,228,90,69,1,4,131,232,200,215,126,44,112,+252,108,187,94,75,96,113,1,226,183,40,196,212,32,46,28,157,129,120,122,+251,44,189,128,142,60,0,191,155,93,236,73,75,234,63,188,156,221,5,13,+94,152,30,27,0,231,215,232,102,4,40,173,135,131,202,102,63,125,207,62,+0,115,179,250,215,92,77,106,53,153,159,163,137,180,128,62,13,155,187,77,+213,140,197,85,227,12,194,199,110,172,195,41,70,237,97,223,239,196,236,132,+209,13,0,160,160,251,252,64,180,54,199,250,225,32,28,118,124,28,174,5,+108,95,201,38,144,229,30,106,196,133,15,193,144,95,88,120,127,168,86,21,+176,65,148,201,112,100,75,9,88,173,33,97,70,63,110,15,59,36,144,70,+67,179,116,184,177,197,26,165,67,62,197,142,135,182,164,36,36,123,102,118,+57,69,186,238,236,196,27,157,237,248,162,20,131,74,252,40,192,41,144,35,+248,97,210,89,254,101,68,27,67,41,128,228,73,193,97,96,35,236,145,73,+219,158,254,39,31,197,66,119,21,72,130,56,4,148,243,162,13,92,43,241,+94,229,45,183,217,47,210,183,57,2,149,231,188,147,164,47,105,184,147,7,+170,98,181,210,36,250,226,68,7,182,68,1,63,39,220,233,235,104,56,188,+9,252,217,73,38,197,86,126,75,18,41,47,175,203,225,9,237,185,121,61,+133,89,52,135,223,150,45,69,147,90,232,126,178,156,104,228,236,85,8,209,+149,72,171,162,138,145,198,157,121,209,84,197,62,41,61,241,161,215,202,186,+232,178,116,88,199,236,203,153,86,224,82,111,128,127,80,51,61,115,163,119,+194,27,138,245,161,96,131,129,123,98,97,111,181,242,70,208,224,79,50,116,+212,90,49,23,121,86,5,27,208,179,38,0,46,195,24,178,174,140,22,37,+100,130,30,40,32,95,131,18,194,114,95,49,192,210,243,142,151,252,215,219,+39,240,50,148,100,107,178,165,57,156,149,145,115,157,150,42,187,248,209,216,+36,108,107,74,247,157,99,11,95,94,105,245,141,129,168,196,66,186,220,17,+208,106,111,213,46,56,78,39,126,181,124,212,81,102,5,157,245,254,197,70,+40,143,62,48,152,73,152,208,168,195,93,48,240,107,98,102,25,239,4,222,+121,177,185,79,140,2,116,10,229,82,176,121,199,196,100,204,157,214,82,49,+63,66,185,29,114,121,5,253,249,2,229,195,197,252,210,216,33,63,58,127,+39,39,197,170,183,225,86,92,16,166,98,165,116,52,72,148,88,31,208,214,+167,108,70,40,201,75,70,140,208,202,49,242,203,170,53,224,248,4,238,147,+199,115,179,45,141,200,234,192,249,175,21,161,176,24,201,65,63,228,63,41,+203,38,171,57,186,114,252,73,28,59,91,161,225,127,55,172,216,59,40,122,+7,176,238,131,101,16,242,26,56,195,156,226,192,174,255,175,210,191,239,217,+190,172,60,205,240,28,27,1,111,255,87,140,6,60,241,93,30,73,3,110,+252,252,33,159,46,95,216,166,64,124,171,24,116,156,53,91,154,111,203,56,+193,58,19,24,150,14,160,155,38,42,169,210,216,113,198,17,234,243,58,105,+144,193,234,221,53,109,201,124,224,164,23,77,190,233,92,223,8,251,211,231,+122,128,207,204,107,220,122,144,174,116,100,42,43,134,218,15,5,75,154,249,+227,64,237,111,46,64,243,39,72,164,191,128,88,87,22,156,53,131,221,241,+232,116,229,77,211,63,103,71,170,246,96,144,10,236,196,57,212,242,226,169,+127,41,184,147,108,22,20,127,20,204,223,127,76,96,249,226,82,8,99,49,+97,162,95,207,238,75,169,150,18,31,35,148,252,26,5,159,140,159,218,144,+226,227,118,123,138,161,215,168,193,72,24,110,168,22,234,110,225,244,27,177,+21,43,192,85,80,94,91,246,146,122,23,134,97,156,151,55,103,87,12,173,+199,97,85,51,186,73,40,175,17,40,173,204,120,102,194,137,205,0,251,25,+77,159,59,213,13,114,66,118,32,20,162,249,241,25,201,93,177,56,211,234,+123,74,113,172,92,32,158,68,117,224,165,91,198,161,150,185,153,247,195,158,+155,250,100,241,87,78,231,165,176,99,63,216,172,131,90,138,171,239,17,0,+184,73,7,93,21,230,88,188,68,154,240,147,204,16,82,169,98,111,110,56,+39,213,140,90,79,125,136,197,144,152,125,98,14,101,191,53,22,209,67,96,+244,103,73,27,205,12,15,198,144,132,60,127,186,158,213,5,5,204,198,131,+165,101,11,81,0,209,251,174,171,216,47,123,147,82,215,83,236,142,243,49,+190,137,133,158,51,134,79,1,75,56,196,123,121,116,252,47,61,49,10,196,+6,111,172,152,85,179,133,10,134,32,151,22,118,244,17,108,45,248,250,140,+38,35,251,51,216,118,92,22,5,45,154,172,217,126,178,189,237,29,95,145,+139,90,160,207,107,58,57,7,63,143,102,116,211,209,24,50,107,191,115,165,+17,125,85,139,199,194,56,90,194,220,104,138,178,153,201,238,185,120,183,22,+225,19,218,239,167,229,92,85,0,160,193,147,52,106,228,79,226,244,158,125,+166,228,163,150,236,73,37,146,139,194,149,243,153,240,165,72,137,119,104,59,+194,238,8,135,56,114,9,179,143,241,125,166,199,223,91,199,248,59,44,119,+249,150,155,235,205,175,50,73,183,230,119,78,165,21,27,255,82,98,80,39,+191,203,5,221,138,0,62,181,232,78,180,21,3,162,66,178,26,212,145,210,+185,29,211,134,189,221,75,12,223,49,37,251,159,61,70,249,222,115,24,2,+146,150,87,29,143,117,17,53,53,142,190,247,61,237,135,165,90,239,52,250,+246,227,144,104,126,123,244,252,191,170,157,16,25,12,38,224,247,112,233,176,+247,212,208,13,237,249,49,43,225,36,124,233,75,39,80,70,64,161,46,254,+76,233,111,242,121,2,115,213,142,100,39,132,40,1,121,19,235,144,191,169,+253,30,174,127,212,221,248,157,27,164,39,192,114,4,171,39,90,77,67,50,+158,167,19,26,110,44,94,93,173,124,68,91,195,174,162,158,205,29,244,52,+182,138,118,85,116,43,231,62,234,73,102,163,105,25,124,177,159,138,67,18,+56,90,178,239,212,97,202,113,63,18,11,220,171,87,190,74,104,120,17,49,+154,184,69,39,28,165,10,58,65,105,41,153,250,177,18,229,74,220,42,190,+104,133,237,78,188,21,153,122,252,223,228,244,251,191,46,124,240,135,194,152,+145,171,18,155,227,199,148,71,128,105,225,102,98,250,89,44,149,35,133,163,+33,196,115,21,212,153,63,162,103,139,89,193,237,150,248,169,32,167,177,21,+105,149,46,129,85,62,213,64,98,50,215,174,178,130,100,135,59,206,82,124,+107,3,253,9,102,14,48,61,235,238,237,37,247,150,146,54,105,32,122,118,+28,161,72,255,17,181,103,228,188,141,4,160,160,212,122,203,180,142,76,246,+232,154,135,240,100,112,220,130,73,73,35,207,247,133,6,60,161,160,188,234,+81,84,64,247,203,207,92,57,99,21,33,54,102,11,106,194,81,0,152,162,+238,116,43,248,159,10,192,236,71,179,241,135,97,145,94,11,193,34,27,189,+237,213,189,64,15,88,188,183,245,243,171,162,132,224,108,18,253,149,90,112,+158,212,132,105,71,12,170,230,133,182,5,237,43,21,197,202,122,89,240,143,+122,96,71,49,249,29,12,56,22,127,97,171,50,32,252,220,133,238,140,145,+235,118,247,252,235,16,66,61,169,222,54,193,237,76,185,148,125,197,221,251,+44,89,49,153,4,67,112,155,163,24,146,174,126,31,244,116,148,174,99,23,+156,92,173,79,140,73,134,220,191,153,150,166,191,158,123,158,75,67,200,56,+204,128,246,26,247,127,147,243,58,250,214,143,114,54,253,198,119,122,201,100,+160,156,215,144,231,85,106,192,82,252,52,117,241,199,121,235,221,84,155,167,+147,35,184,16,47,72,11,172,41,33,45,152,193,44,143,67,65,35,121,162,+97,66,137,91,87,117,247,124,28,169,102,168,4,183,32,66,62,77,215,244,+195,74,56,95,140,184,218,4,225,137,154,211,70,83,21,215,160,173,245,255,+153,124,43,9,164,141,25,118,50,5,187,159,14,221,25,56,184,113,133,63,+107,204,4,89,201,217,194,42,109,115,164,71,179,244,182,63,255,217,125,113,+3,223,232,129,160,64,139,113,39,250,101,249,158,67,249,66,3,119,113,233,+203,158,46,1,30,224,247,74,41,77,159,27,36,79,159,122,30,114,177,8,+198,211,77,63,130,104,51,39,81,158,85,246,12,56,65,42,195,37,71,140,+4,182,124,178,77,48,113,163,230,216,137,226,109,183,120,6,128,96,223,65,+126,33,135,137,239,106,130,23,18,114,61,206,155,207,221,237,208,19,174,73,+199,119,27,195,193,71,26,81,200,32,173,240,28,194,229,167,96,48,51,100,+120,73,254,212,5,200,235,114,241,15,57,86,33,203,157,50,220,40,145,80,+206,237,117,212,30,141,206,176,158,48,109,47,110,100,91,94,148,245,192,53,+249,213,245,26,240,248,8,89,139,102,121,129,159,171,207,38,103,149,178,161,+180,221,179,174,26,135,232,57,192,63,131,184,181,218,214,141,173,5,12,16,+246,108,201,41,252,178,19,95,143,179,203,191,184,255,215,206,196,47,223,24,+120,74,45,97,41,102,128,81,94,76,57,179,106,182,75,174,3,60,3,83,+170,218,166,142,171,181,252,24,97,200,95,211,96,212,37,226,235,131,250,77,+147,121,107,127,220,174,254,197,76,231,159,29,1,130,1,84,173,141,181,14,+36,41,252,4,190,106,154,161,37,23,65,197,117,112,149,49,227,211,138,101,+131,40,115,32,3,97,86,161,238,177,69,203,23,9,168,111,218,218,205,188,+39,86,113,125,99,156,35,170,205,122,175,250,252,128,109,160,12,244,138,86,+141,132,100,86,67,92,219,58,212,203,246,153,77,217,166,230,250,41,83,70,+33,26,38,111,77,201,200,149,200,17,224,190,247,220,124,74,189,121,109,241,+240,85,188,51,217,166,200,89,234,115,247,182,33,132,102,65,203,124,123,215,+4,212,137,254,245,22,2,89,225,207,129,170,165,222,39,232,68,239,244,113,+186,174,214,231,5,229,45,38,218,208,28,31,130,22,114,183,156,221,195,127,+35,194,64,167,29,89,68,189,98,167,151,158,234,36,179,36,76,63,24,29,+36,44,164,27,206,236,42,19,225,119,187,228,193,113,15,178,137,69,146,254,+11,170,203,114,124,184,246,25,140,208,70,136,88,255,209,211,217,23,127,229,+63,106,234,115,240,255,33,229,53,174,235,105,45,171,149,27,207,185,69,7,+237,152,134,228,200,179,82,85,66,161,228,99,29,3,124,64,161,45,143,120,+207,85,97,46,159,58,130,244,211,75,29,96,10,172,213,203,44,121,214,101,+100,30,8,166,59,130,11,162,122,151,40,7,17,101,255,20,18,18,239,161,+254,38,56,70,67,112,178,99,211,177,115,200,118,69,115,139,95,95,243,115,+187,176,139,70,234,116,202,149,79,233,83,18,54,165,211,175,23,17,233,96,+146,158,248,253,20,243,97,142,171,67,148,108,235,237,233,7,248,199,1,5,+41,143,127,122,160,46,238,193,56,119,120,187,106,26,187,88,185,103,183,92,+175,203,185,59,148,73,197,154,139,156,24,136,133,235,199,31,19,52,198,17,+168,84,145,38,61,247,206,97,177,128,51,249,9,212,24,223,234,183,104,183,+247,204,132,19,109,9,97,55,238,218,156,238,174,190,16,92,230,141,193,145,+188,205,110,82,121,232,210,235,74,192,247,3,149,108,247,65,170,10,193,189,+18,65,215,30,119,49,186,97,96,229,218,216,69,96,134,27,104,28,147,248,+208,159,90,151,199,209,200,106,29,250,81,33,230,110,183,130,252,32,38,69,+159,165,45,231,16,154,237,140,0,188,122,85,193,205,24,147,51,182,214,243,+187,146,120,166,194,192,130,134,186,60,138,43,26,58,92,156,20,152,110,253,+24,221,224,203,181,74,128,140,130,197,75,238,102,248,226,175,235,145,49,60,+214,167,246,253,127,163,86,189,167,154,236,177,13,250,42,190,148,93,8,244,+197,116,228,30,173,220,227,18,113,49,43,120,66,163,35,12,5,164,53,232,+211,46,195,173,75,93,149,252,117,98,222,76,113,17,120,14,209,214,157,182,+135,103,67,243,224,164,26,134,207,166,228,144,76,235,119,233,20,161,176,12,+120,143,243,106,200,30,65,142,144,4,76,8,238,148,125,175,110,136,150,49,+91,115,108,87,254,131,203,20,207,21,154,219,54,154,175,93,111,161,145,185,+13,103,214,122,128,225,170,203,70,65,8,85,207,31,23,16,250,172,160,243,+255,80,249,230,185,86,224,48,196,122,250,157,217,145,207,35,148,113,30,84,+65,199,253,154,202,180,38,104,114,67,146,160,183,181,191,220,201,199,162,204,+94,246,132,32,221,173,83,108,197,167,58,229,102,86,218,231,197,7,205,23,+54,146,23,243,20,42,88,61,255,241,63,145,56,13,221,42,16,114,235,82,+111,12,245,66,129,24,140,188,135,49,243,87,139,159,146,15,248,212,233,15,+69,33,150,69,44,88,128,32,221,213,209,54,21,255,106,194,101,134,185,42,+194,171,103,173,191,197,240,116,215,188,155,47,138,90,239,125,152,38,170,244,+160,206,22,98,152,179,44,134,175,193,12,35,159,42,136,179,103,200,13,156,+230,30,82,142,255,158,157,107,67,65,171,117,147,85,167,176,240,153,45,192,+89,81,75,54,129,132,225,97,58,30,104,208,227,56,100,246,240,156,102,86,+89,20,174,70,79,194,3,95,181,225,192,80,109,14,84,157,220,205,24,22,+206,143,116,254,90,164,205,206,192,211,254,96,211,189,3,118,175,18,186,136,+131,52,51,202,233,118,131,207,63,38,215,33,25,236,134,231,75,55,252,236,+138,35,124,64,102,94,105,49,52,232,230,143,169,100,141,162,4,107,178,227,+213,153,238,70,61,201,71,30,94,176,61,173,91,77,228,120,243,19,36,41,+52,251,33,2,90,233,244,237,253,164,84,3,176,101,164,241,254,38,180,118,+114,60,249,11,173,108,222,117,206,98,233,176,105,116,35,177,194,144,185,99,+76,13,105,211,60,153,52,236,140,51,37,40,129,89,128,248,165,241,24,237,+249,200,116,204,100,168,60,138,64,88,43,17,201,44,120,191,176,129,140,111,+244,12,72,42,83,170,123,191,124,136,137,171,19,199,142,175,114,43,54,217,+155,153,135,129,176,248,120,37,144,67,152,26,124,203,5,202,241,93,241,170,+185,24,161,244,175,241,145,9,179,68,251,130,227,117,163,106,112,93,31,147,+60,163,82,231,33,231,175,134,252,33,190,178,39,92,17,79,3,240,237,75,+238,103,82,23,94,241,201,149,160,185,205,138,255,240,10,43,68,211,46,90,+147,122,91,124,38,23,179,114,217,77,198,153,92,248,8,211,78,152,210,66,+4,248,19,62,8,2,200,37,140,242,123,39,116,129,111,123,69,187,4,241,+253,246,184,216,203,23,238,248,41,105,55,46,161,162,198,220,24,189,27,232,+127,235,254,147,182,6,132,113,249,94,188,152,70,222,64,50,247,58,35,217,+156,218,156,179,162,225,169,224,136,25,1,244,34,26,244,113,215,242,25,51,+69,9,137,219,59,165,36,227,214,201,5,13,204,151,5,105,150,100,32,198,+221,87,236,212,175,30,241,72,11,123,241,246,22,82,113,91,178,194,248,69,+158,126,43,237,93,211,240,217,153,251,189,119,137,176,89,21,156,92,137,192,+196,195,191,172,126,238,253,115,157,80,194,140,90,123,104,186,183,201,255,177,+70,121,142,131,19,28,119,84,106,250,78,210,246,254,148,243,189,1,59,235,+88,85,104,160,217,84,140,248,199,58,210,128,226,45,51,10,2,108,151,255,+107,113,229,185,244,255,33,234,82,109,92,131,170,234,142,7,136,41,160,78,+141,230,246,190,24,21,151,248,95,233,91,207,240,108,207,20,137,43,6,154,+151,40,214,107,178,71,77,57,55,140,160,175,181,91,188,15,187,240,47,99,+201,222,235,91,20,205,124,45,125,217,164,30,29,64,122,70,90,150,114,31,+199,244,7,136,163,167,245,97,174,164,73,126,187,68,31,193,37,56,212,67,+70,170,215,190,77,36,87,249,239,102,186,151,210,145,209,83,198,147,43,230,+89,128,26,90,109,41,223,171,38,3,190,206,165,21,68,230,30,133,130,66,+147,25,155,209,109,9,127,189,163,207,188,136,70,42,45,177,239,72,224,255,+112,134,39,36,206,39,234,91,43,184,155,119,188,10,227,146,121,148,144,68,+67,142,61,62,250,162,60,126,125,78,27,72,157,188,191,249,249,89,11,34,+174,144,244,216,186,11,21,180,99,12,97,241,7,143,231,161,101,219,164,19,+222,132,194,14,15,38,23,246,125,105,204,101,20,166,135,140,81,21,222,152,+2,247,94,238,17,199,236,215,179,42,14,7,205,220,248,209,208,195,255,69,+166,79,144,117,12,237,39,177,117,144,155,167,167,95,219,206,106,4,199,228,+1,136,112,227,86,35,252,183,233,218,197,4,214,189,97,208,33,38,5,118,+109,57,140,201,244,98,116,67,200,123,246,162,189,222,114,192,229,35,236,103,+201,58,22,210,244,22,250,195,16,104,70,27,80,133,106,187,48,86,10,57,+104,156,214,122,79,138,166,222,14,170,226,153,86,197,107,13,13,124,249,178,+190,212,135,71,250,42,150,82,101,77,4,64,237,171,73,115,200,218,250,173,+172,159,12,153,158,51,239,102,183,17,50,255,146,60,97,19,30,97,130,62,+99,73,57,148,194,96,24,177,245,213,183,253,61,43,57,57,143,0,16,106,+209,81,119,196,255,126,19,194,246,108,190,27,241,199,47,52,112,52,163,209,+37,129,165,248,46,232,58,178,96,235,64,82,183,192,140,185,42,237,156,22,+99,103,67,214,37,229,217,214,144,72,80,37,181,159,156,20,203,118,33,18,+60,87,109,167,160,134,199,122,108,245,126,179,236,19,233,50,132,134,60,58,+224,195,125,30,105,89,65,156,190,71,114,146,246,254,49,224,68,25,146,56,+254,100,168,210,152,191,95,106,20,0,3,220,53,46,244,172,241,190,231,113,+8,11,205,32,1,136,179,129,251,183,183,91,96,99,142,30,167,67,220,0,+160,223,27,20,212,43,197,142,172,185,137,199,59,146,48,198,145,73,80,158,+65,78,9,43,198,163,138,74,82,125,249,39,21,188,138,188,23,172,172,55,+167,143,80,253,239,31,29,162,42,202,68,213,18,88,59,7,236,226,127,170,+58,115,167,118,124,200,79,227,153,16,171,69,58,55,31,155,167,240,56,57,+187,133,16,54,181,111,230,64,154,20,238,60,209,142,232,130,209,188,193,157,+58,25,132,177,53,156,75,149,146,186,244,117,79,159,129,58,172,101,234,242,+71,142,84,151,229,76,0,110,109,114,156,210,134,76,239,163,9,241,237,5,+135,124,177,235,157,241,125,147,136,183,177,227,205,101,207,138,225,95,227,47,+86,248,93,52,103,205,234,99,10,218,11,239,24,197,67,10,133,242,2,92,+194,224,149,69,56,171,84,94,168,141,215,10,218,2,63,28,234,74,125,215,+128,34,253,167,249,237,169,200,171,183,62,250,59,154,138,100,94,34,93,254,+59,252,22,185,85,238,122,147,6,79,39,161,182,186,251,241,96,178,199,44,+157,239,203,44,98,121,246,37,6,137,163,244,7,173,244,178,214,238,2,186,+47,198,124,110,195,226,137,228,37,127,111,178,229,125,125,226,8,196,220,130,+10,112,208,30,115,38,224,250,130,110,148,86,152,145,178,65,67,151,38,221,+101,21,235,0,120,227,20,97,30,62,145,36,80,232,18,243,227,21,52,132,+98,53,203,9,140,80,18,183,228,160,246,55,199,255,196,153,12,101,117,183,+118,106,254,234,191,83,110,151,222,93,146,129,193,30,178,200,73,145,42,7,+93,29,201,228,113,15,7,121,136,161,211,175,17,193,73,205,89,106,185,51,+62,123,30,166,206,223,39,168,175,214,91,127,157,46,111,128,52,161,216,98,+138,12,51,35,39,117,68,24,36,64,15,52,237,235,168,82,97,61,143,6,+89,144,128,116,66,175,66,79,22,110,86,122,182,237,220,168,246,153,194,243,+125,136,202,126,18,210,183,95,47,108,3,142,169,77,92,167,35,243,239,27,+112,27,181,254,45,238,19,59,199,7,179,119,106,60,106,48,39,228,227,90,+6,29,29,146,243,147,215,235,173,122,51,3,201,254,206,61,113,168,109,219,+255,138,192,0,136,116,162,226,194,23,176,180,138,105,239,245,114,124,35,182,+60,218,62,36,157,192,18,9,99,50,225,91,124,115,188,214,250,183,253,127,+116,7,63,115,108,252,51,169,185,208,241,37,147,166,68,99,231,161,11,13,+236,58,63,233,104,186,161,184,104,191,91,235,135,186,92,253,166,184,41,202,+206,80,159,104,247,69,83,77,181,137,98,252,73,251,94,210,213,53,147,65,+164,188,129,244,9,67,210,113,27,76,55,9,37,113,23,52,107,88,252,97,+6,181,143,157,53,55,45,178,52,1,254,196,152,153,204,49,194,44,190,2,+19,244,62,243,244,101,23,144,135,43,8,133,114,27,139,108,250,104,3,221,+238,142,11,167,67,142,130,39,130,36,2,143,239,11,251,158,15,110,85,7,+144,184,126,27,251,245,86,220,178,182,18,219,250,39,158,13,41,41,172,150,+128,160,105,194,208,105,30,65,176,128,57,190,16,79,3,86,227,214,145,85,+157,49,189,213,121,220,119,168,117,227,135,209,124,136,37,127,241,20,162,96,+70,120,27,229,142,136,97,211,239,115,110,226,184,166,213,34,15,18,136,255,+127,61,163,238,247,254,242,99,48,249,109,104,78,58,142,11,123,35,1,104,+17,243,8,13,90,76,193,223,208,127,154,218,152,187,185,39,140,41,168,136,+154,5,209,151,196,4,17,16,202,136,177,155,143,13,96,207,233,229,152,165,+64,227,30,44,152,45,25,232,186,107,148,68,169,224,193,100,241,94,64,141,+153,60,225,41,110,30,117,218,246,80,81,250,168,196,224,233,207,129,175,126,+228,28,177,89,176,14,136,17,252,0,60,53,187,139,186,26,67,14,5,150,+73,88,40,88,201,195,95,56,253,92,242,2,55,120,155,180,62,185,108,199,+215,70,18,82,75,236,166,41,25,208,135,58,187,68,239,59,247,222,11,120,+206,10,168,34,200,44,39,99,149,60,203,253,141,38,179,13,179,157,87,113,+1,23,255,171,168,40,91,170,148,75,250,171,100,105,180,68,145,142,225,132,+4,9,120,121,199,42,90,242,6,92,20,14,152,64,110,254,54,118,240,2,+252,159,51,9,95,103,111,203,239,239,60,184,153,87,144,76,125,90,207,106,+2,199,225,26,225,45,3,134,67,64,148,221,170,250,236,103,255,205,246,41,+224,221,98,37,58,223,174,13,102,61,27,35,80,119,178,148,240,153,188,22,+164,167,179,99,224,136,243,215,191,153,26,240,228,133,248,157,204,226,233,23,+228,128,255,153,145,5,108,227,246,153,53,85,111,72,189,194,43,159,212,91,+203,142,102,202,66,124,143,220,148,114,63,150,134,216,244,31,149,172,89,22,+140,139,13,180,17,84,50,13,136,52,127,213,172,238,197,157,19,202,217,3,+255,156,134,224,242,40,168,181,12,36,149,5,139,159,227,109,105,254,221,121,+101,125,42,71,15,237,21,253,68,56,21,176,107,72,74,90,187,78,246,102,+207,241,184,85,30,116,17,78,36,246,162,73,6,194,36,211,22,66,41,82,+11,246,239,131,241,170,30,217,97,84,214,42,2,195,47,239,26,201,142,121,+232,124,134,200,26,246,169,250,105,190,20,237,101,162,35,204,187,99,203,20,+41,64,151,45,249,185,169,89,144,165,93,170,31,203,129,135,83,193,132,73,+140,186,222,185,238,122,177,216,213,133,36,255,11,39,150,17,213,3,8,20,+72,218,83,127,144,74,49,245,254,220,232,127,49,210,20,36,199,197,53,192,+31,158,59,109,20,240,191,156,73,67,155,243,195,140,249,253,13,240,175,167,+249,237,3,133,136,155,96,249,218,37,59,12,199,209,7,130,204,223,7,121,+186,145,245,149,83,139,183,98,187,231,182,195,55,7,175,202,173,46,120,245,+12,69,130,99,139,52,104,224,149,75,15,108,139,91,183,160,86,210,213,113,+168,40,26,25,93,173,42,192,30,45,133,170,147,175,227,11,226,240,150,108,+106,71,178,137,105,12,117,182,178,155,189,23,48,6,97,246,196,202,252,45,+167,193,135,163,123,227,137,52,218,143,227,132,27,245,239,120,242,112,72,181,+168,212,60,153,83,129,106,107,4,140,77,110,41,152,141,174,120,64,93,71,+192,95,175,72,155,176,244,139,181,8,86,73,67,138,136,180,211,81,226,221,+232,16,94,66,103,143,65,82,39,27,251,13,74,175,197,202,239,60,212,119,+220,171,29,72,250,24,63,102,73,133,26,215,219,39,186,69,213,46,172,249,+255,254,58,177,72,193,66,121,245,174,129,187,54,223,88,32,224,3,27,161,+46,164,74,202,11,21,79,165,89,227,41,3,51,91,196,163,125,131,146,113,+129,227,60,110,172,13,99,23,85,39,141,47,160,78,235,79,119,73,236,12,+246,137,222,50,182,39,136,241,207,95,96,94,92,46,182,210,223,229,31,87,+105,207,149,181,184,123,136,236,211,84,8,189,180,88,106,189,134,212,237,60,+122,255,76,128,91,183,200,217,193,251,26,214,205,7,141,170,27,74,187,80,+78,218,90,190,71,89,53,151,141,34,102,142,92,87,203,138,91,128,89,187,+155,91,125,147,80,203,48,50,143,18,121,74,28,206,0,52,200,0,92,208,+183,27,15,223,47,183,79,250,56,241,3,55,182,84,224,26,126,110,216,97,+186,190,69,128,73,190,213,255,236,126,35,30,59,169,204,129,58,178,73,130,+61,96,124,211,166,8,171,41,140,7,50,90,9,206,206,246,80,46,107,178,+167,76,223,121,54,131,241,158,185,70,134,35,206,1,127,228,31,48,14,6,+239,122,63,90,162,106,54,187,129,15,233,174,2,221,128,27,49,189,174,254,+34,101,168,120,81,199,201,100,12,247,174,137,5,175,220,129,29,104,75,58,+99,165,19,229,21,145,182,142,79,32,225,50,21,144,127,236,158,97,32,57,+200,7,129,106,51,95,246,227,42,24,13,78,81,182,93,121,252,116,253,151,+17,23,153,103,176,112,93,163,237,50,145,144,194,222,32,21,25,64,118,124,+169,25,87,220,70,163,218,141,143,189,17,210,220,154,41,42,71,8,94,83,+179,231,115,176,69,25,192,211,11,69,174,91,75,32,72,37,44,159,58,210,+186,133,57,22,120,94,182,59,184,252,68,106,226,106,40,193,154,45,171,247,+209,136,135,33,247,50,211,116,238,14,12,145,12,45,25,15,30,50,250,152,+15,165,35,241,172,101,29,168,35,237,161,11,141,82,15,235,7,100,104,238,+139,226,202,197,145,52,47,73,230,61,230,53,212,238,253,123,82,95,245,217,+177,75,197,194,77,242,209,68,118,155,86,133,124,179,26,10,224,41,229,236,+210,99,32,18,235,160,209,48,253,156,169,205,194,130,116,250,58,132,142,206,+25,9,108,143,191,162,171,86,10,45,191,150,187,20,227,123,73,139,65,176,+200,235,57,144,101,250,6,152,37,132,65,143,201,237,221,57,219,82,11,1,+57,7,151,49,47,181,40,154,212,164,124,123,138,152,44,172,96,56,59,251,+172,3,201,13,226,191,171,67,100,14,131,84,208,248,64,45,45,42,20,110,+163,6,211,80,208,218,34,130,12,242,31,35,197,110,114,143,100,179,211,228,+146,109,227,6,46,92,47,49,17,134,86,241,208,64,88,219,237,163,211,186,+98,64,229,15,6,208,216,187,148,106,112,172,168,238,209,8,146,134,63,39,+201,145,69,248,174,188,40,89,54,164,10,86,132,175,252,173,200,193,252,86,+223,48,183,51,182,83,101,185,23,230,171,133,178,243,157,14,216,72,239,54,+250,132,127,128,20,102,216,32,53,194,67,47,251,243,255,93,179,40,125,158,+60,206,166,69,28,43,195,101,99,47,245,34,220,37,69,103,226,154,177,50,+21,228,15,50,40,253,35,159,143,75,156,97,55,214,27,248,56,231,160,93,+162,45,165,96,176,38,188,229,236,0,9,15,10,2,134,178,64,91,36,214,+108,162,194,50,39,66,8,191,22,223,81,251,120,34,214,69,129,141,17,125,+246,57,191,218,125,245,48,185,159,200,171,154,111,95,113,45,60,202,251,152,+73,218,52,92,236,7,92,136,26,146,88,105,82,64,25,127,200,13,172,115,+73,221,149,227,83,44,244,49,5,5,90,238,13,212,34,231,233,232,88,197,+239,183,234,118,162,153,197,162,139,61,78,83,203,125,11,231,174,226,59,248,+75,25,167,145,105,168,73,161,37,205,83,97,163,175,194,245,209,189,107,206,+195,64,55,140,20,91,178,34,80,177,150,129,140,140,164,133,246,159,2,119,+161,201,93,126,199,138,90,219,44,127,234,191,127,227,35,175,34,168,48,99,+247,97,245,192,15,196,238,179,136,12,106,124,219,47,6,233,38,112,120,20,+4,187,231,92,215,187,98,233,146,75,199,61,201,83,179,236,61,248,108,131,+246,48,244,160,91,216,76,180,200,79,59,145,121,219,253,87,189,127,60,96,+99,158,138,199,51,20,202,140,179,168,53,214,25,179,27,150,199,13,185,187,+63,12,115,133,126,31,99,72,56,138,134,253,199,248,243,10,109,108,99,175,+112,140,247,4,25,101,19,161,124,255,13,156,57,2,178,0,144,46,211,122,+208,145,194,77,31,177,121,73,175,142,135,190,77,82,109,107,33,196,150,173,+107,225,251,5,44,213,94,168,34,201,242,200,177,52,114,63,156,162,100,75,+184,94,154,50,236,109,30,8,198,119,22,67,59,19,243,224,87,190,111,44,+177,195,203,142,253,218,235,201,241,18,209,67,134,199,91,128,21,56,203,104,+129,14,78,117,253,196,151,84,73,154,235,136,95,31,158,160,89,64,49,6,+92,149,67,35,51,159,83,93,191,75,254,168,113,183,45,42,136,97,36,159,+31,224,215,28,91,37,246,54,208,190,127,157,55,172,52,53,218,215,199,250,+194,80,158,244,224,195,194,164,113,216,135,193,22,43,173,200,82,9,10,195,+149,42,125,162,161,236,255,98,216,208,228,187,97,5,15,13,58,99,192,61,+82,45,42,37,214,101,105,113,50,3,169,48,108,182,188,229,99,120,167,17,+62,85,47,190,49,218,6,143,184,96,149,170,220,129,220,157,79,2,48,117,+151,206,147,99,179,101,47,122,232,105,221,60,134,183,82,236,126,185,86,237,+72,7,82,159,39,151,65,37,179,27,108,48,142,234,207,162,33,165,147,134,+10,183,247,230,152,65,3,131,145,182,83,37,118,141,36,168,68,84,80,179,+134,242,242,74,152,21,116,72,87,172,108,232,146,237,117,133,123,10,251,217,+145,66,214,72,197,185,23,155,174,46,248,63,178,45,252,55,90,96,68,169,+236,239,104,62,65,105,38,242,28,106,193,161,159,85,246,61,114,50,173,15,+138,131,147,191,7,224,163,243,72,128,210,155,223,71,212,22,66,236,52,106,+202,226,163,12,38,27,169,143,28,66,164,53,108,215,50,35,26,88,100,81,+21,238,80,202,60,41,187,184,25,230,216,62,155,255,251,65,99,47,22,95,+189,20,64,124,141,161,195,151,187,49,52,208,183,108,21,111,122,184,148,166,+104,192,86,133,157,37,206,244,115,133,126,147,161,214,186,81,202,33,238,160,+141,114,252,103,177,172,147,104,217,23,74,170,57,96,189,29,19,220,204,0,+19,139,192,233,213,80,118,83,112,58,181,114,143,231,233,252,99,191,148,232,+11,114,253,253,42,10,148,118,241,80,91,115,190,168,166,51,193,12,218,237,+185,128,121,15,121,201,84,138,103,152,241,20,157,29,34,21,25,55,244,234,+190,129,45,151,228,208,100,64,255,71,57,206,48,116,211,203,169,60,48,107,+252,230,245,243,157,156,177,27,83,94,153,184,93,251,43,20,186,73,250,200,+142,199,143,203,251,205,5,204,104,72,61,191,47,19,109,191,24,42,49,250,+11,134,172,202,54,63,166,151,9,169,97,226,54,213,127,35,111,119,246,157,+120,190,128,224,74,30,113,124,68,128,197,53,96,245,72,143,148,63,83,164,+74,210,169,171,8,93,36,93,12,154,56,66,233,87,32,59,30,180,178,124,+68,112,100,91,15,61,138,43,92,178,216,70,230,143,251,52,2,192,81,116,+86,250,6,98,76,145,177,255,254,215,103,212,54,184,250,255,244,121,21,222,+231,146,78,103,150,4,244,220,89,115,133,210,5,126,228,73,101,108,38,227,+187,4,53,156,6,39,124,250,107,241,99,1,53,69,168,193,71,152,113,41,+114,52,114,77,111,213,234,41,95,95,208,43,73,131,106,163,184,80,242,158,+127,151,242,73,14,221,248,168,1,105,35,154,118,135,23,223,166,200,52,133,+246,26,126,96,91,161,162,8,192,156,166,15,124,31,6,201,2,83,142,169,+155,191,18,161,211,222,140,3,6,101,80,81,180,179,136,101,2,140,21,45,+217,75,26,48,84,254,9,171,189,240,58,93,112,204,63,157,166,179,221,104,+23,226,32,193,242,240,52,195,88,142,4,246,53,170,86,248,20,250,1,190,+3,212,54,223,128,53,45,124,132,107,45,82,225,81,247,78,9,97,13,103,+148,132,184,5,79,109,223,211,78,134,83,37,188,98,199,161,57,51,239,92,+116,127,150,111,227,151,78,6,167,175,4,53,35,150,12,57,160,85,155,7,+225,179,130,55,216,199,200,23,71,10,115,2,82,110,159,252,58,17,44,239,+224,147,143,38,79,23,100,29,246,155,217,94,44,88,18,36,44,176,231,82,+143,92,198,137,174,184,51,214,233,178,79,44,156,149,235,61,159,174,231,1,+122,21,135,123,216,156,191,216,207,52,22,210,186,228,117,249,164,19,106,86,+232,160,216,243,179,27,75,226,96,234,187,179,160,119,249,189,211,162,54,56,+191,120,140,189,219,22,121,216,29,95,239,232,173,89,247,224,161,182,184,72,+167,22,83,206,241,13,117,168,186,84,8,80,61,55,100,141,101,37,59,27,+172,88,234,1,59,140,4,193,36,122,40,209,9,22,212,38,168,163,236,125,+171,101,251,94,91,242,88,198,28,151,84,20,171,145,194,200,214,248,130,75,+73,60,105,132,42,35,3,105,132,174,178,135,110,161,105,151,221,109,10,122,+35,243,63,199,100,124,200,162,89,115,142,30,8,117,201,91,13,52,254,107,+169,51,72,34,109,159,248,159,148,148,111,211,119,10,232,17,227,7,231,42,+84,54,108,242,84,146,36,195,79,154,125,203,164,239,128,37,195,66,116,89,+226,77,1,14,189,237,31,138,22,46,123,212,186,205,109,167,174,95,44,144,+246,86,138,246,75,154,201,242,84,75,194,166,107,17,75,41,185,151,26,47,+119,106,219,66,8,40,61,14,46,222,89,109,238,176,15,13,74,204,13,213,+193,119,45,152,230,117,194,101,147,232,36,213,159,17,74,250,81,191,59,19,+227,190,15,144,138,19,58,26,7,221,179,48,102,55,148,92,48,53,29,70,+186,31,147,16,70,189,160,250,163,81,113,183,32,101,61,1,122,52,51,167,+21,206,49,29,111,217,205,110,44,3,163,166,252,20,214,15,81,9,225,91,+14,84,80,154,82,89,86,137,106,91,126,173,171,108,91,0,172,150,94,22,+67,156,213,180,43,246,74,22,169,20,174,29,57,127,195,138,16,76,156,201,+85,68,2,229,190,139,110,201,228,168,24,90,34,52,107,118,62,58,188,17,+94,192,214,87,214,162,74,189,217,57,11,45,235,61,224,2,12,36,95,38,+142,106,164,96,163,151,146,139,32,112,86,182,49,187,149,80,65,179,2,33,+129,52,164,19,226,8,154,38,50,93,96,196,107,21,217,202,104,4,218,237,+151,157,1,122,95,100,56,155,109,163,117,94,161,108,85,100,225,37,21,194,+136,160,145,190,243,8,208,58,72,195,47,0,196,243,188,156,86,176,122,140,+189,26,205,111,58,138,83,20,136,40,195,127,189,220,213,155,62,75,113,211,+150,15,33,192,167,246,108,123,124,209,213,17,171,70,198,229,103,178,125,52,+99,63,136,75,191,41,226,235,112,241,239,217,134,117,248,199,225,14,0,114,+18,99,103,203,249,174,84,171,197,33,101,227,167,86,114,206,71,67,156,37,+156,183,208,175,73,197,227,188,120,216,104,101,159,43,192,22,62,174,35,77,+144,62,11,49,205,84,241,53,55,138,21,142,70,221,95,1,151,105,79,196,+153,63,127,10,8,137,79,197,19,150,254,37,220,184,192,149,21,54,71,190,+170,176,182,158,147,103,180,107,80,189,181,70,209,117,239,168,211,8,3,206,+114,11,208,107,194,82,146,162,177,35,138,139,34,54,73,162,14,41,84,165,+226,167,61,59,215,42,200,197,21,81,36,174,85,199,77,64,116,56,136,214,+208,191,11,186,38,42,63,2,125,142,185,167,147,105,63,151,73,49,34,132,+246,99,23,84,131,234,247,132,29,202,60,24,98,199,84,36,152,115,143,21,+213,170,56,113,86,245,140,189,164,102,47,63,180,142,128,191,146,62,89,164,+9,239,212,146,20,118,210,48,17,34,130,185,143,36,232,251,77,228,35,79,+148,14,217,39,127,73,235,89,42,180,126,205,53,8,165,203,207,13,130,209,+152,225,195,89,3,245,178,30,1,150,2,137,184,181,248,59,7,179,214,40,+244,193,109,184,120,14,31,83,85,237,187,170,253,225,220,19,172,99,162,179,+11,79,93,233,99,160,163,118,9,151,1,168,77,249,83,73,178,244,167,55,+99,1,119,253,250,107,42,141,244,45,65,252,216,165,177,136,244,221,112,165,+67,4,118,247,4,159,159,188,180,179,34,242,118,155,109,200,153,161,209,16,+230,71,182,117,67,27,215,67,56,92,93,104,41,237,86,35,226,183,155,13,+185,101,134,185,160,106,67,92,231,205,132,68,226,186,113,175,198,69,74,175,+92,188,213,7,185,16,39,177,157,240,140,84,22,128,217,38,101,90,156,27,+172,61,106,202,162,23,16,21,71,0,68,54,7,119,136,74,57,17,181,76,+59,89,32,194,13,190,110,31,117,229,252,97,173,63,75,101,211,94,254,187,+0,2,191,193,154,105,21,124,72,178,62,158,93,21,57,212,57,253,215,174,+72,9,129,196,138,194,25,188,125,38,255,145,142,221,66,152,30,70,93,218,+132,247,31,168,232,66,102,197,120,160,1,52,221,234,211,43,116,156,211,162,+27,126,44,227,47,178,210,145,126,179,46,148,119,203,21,223,179,52,59,14,+123,167,138,69,157,108,192,244,13,233,37,151,210,250,79,243,169,186,87,254,+61,15,204,74,54,180,80,200,131,145,125,7,54,41,246,242,192,229,107,1,+144,148,227,162,204,65,158,134,139,49,108,49,222,78,44,228,133,144,111,238,+167,122,47,223,95,231,60,207,118,56,197,82,4,54,14,82,219,105,199,200,+175,75,236,133,24,168,226,149,168,252,19,162,29,75,56,165,66,68,68,255,+109,217,2,146,1,148,72,227,155,206,52,238,66,172,64,98,141,129,161,18,+11,178,237,46,140,131,34,232,159,162,10,38,175,212,185,216,103,248,218,184,+137,34,241,46,80,202,20,143,100,196,13,234,104,231,246,251,147,19,168,206,+122,244,223,252,91,85,54,242,214,100,145,49,56,241,207,168,137,91,66,196,+27,140,67,58,91,178,33,52,84,175,155,108,87,145,187,82,244,75,234,208,+25,22,207,14,98,252,16,158,1,221,135,243,253,49,186,189,127,35,111,143,+133,199,210,13,147,53,3,190,11,206,123,148,225,80,70,209,167,201,189,221,+42,166,37,95,53,222,180,61,183,157,111,71,249,15,135,251,184,40,233,98,+84,79,75,99,25,126,225,192,12,214,116,143,181,139,174,90,248,44,12,234,+22,254,242,126,90,200,203,246,252,103,29,90,136,17,71,85,106,108,157,155,+101,156,36,192,193,125,122,232,20,247,166,61,91,200,185,131,202,229,64,23,+166,14,128,185,88,110,164,9,167,33,161,171,20,170,74,23,144,71,208,233,+13,235,248,99,99,178,98,219,250,110,245,216,36,27,102,11,75,25,237,5,+223,110,12,157,191,151,187,43,80,38,16,69,106,184,38,213,27,214,210,47,+213,164,92,94,20,26,236,198,243,63,75,6,25,147,34,10,145,122,233,108,+196,140,198,138,196,136,185,252,191,202,131,229,71,73,34,184,129,29,242,203,+196,5,143,186,76,17,221,186,161,208,47,244,234,111,76,63,131,126,255,62,+46,113,101,234,227,46,23,249,36,15,123,6,203,72,78,250,179,147,168,142,+36,89,78,0,86,18,60,88,26,189,122,107,237,140,152,177,243,78,138,58,+23,235,87,161,96,100,243,44,223,136,203,194,47,112,87,245,135,53,190,46,+250,68,38,251,137,245,93,245,227,214,0,63,164,15,147,169,190,196,210,152,+3,156,101,12,126,145,245,187,136,217,44,251,69,16,204,72,139,197,3,67,+220,117,0,240,60,94,16,230,141,98,7,131,68,251,248,74,212,97,54,107,+123,246,182,196,93,118,163,225,28,73,231,89,144,10,208,143,103,53,60,0,+50,230,12,116,156,104,153,155,123,231,166,203,26,176,173,115,250,195,129,182,+87,87,77,204,131,63,24,62,39,202,200,197,155,199,13,64,138,108,5,255,+205,155,49,69,211,160,244,26,48,70,186,51,91,249,43,149,215,156,185,100,+101,125,133,53,237,253,24,86,170,245,86,157,144,64,253,117,158,168,224,42,+250,135,27,115,177,143,228,223,68,246,56,33,76,19,252,186,206,167,192,103,+202,178,143,141,205,87,217,115,182,99,98,236,245,82,65,145,168,27,146,100,+198,250,165,170,42,176,73,54,50,109,123,182,135,252,72,61,59,175,215,109,+92,180,127,43,178,183,196,150,92,10,193,139,20,215,81,17,185,4,44,93,+96,102,14,65,191,182,25,36,127,78,137,252,148,56,128,103,70,200,120,106,+110,41,223,185,128,158,199,238,210,134,253,66,168,147,196,27,71,93,215,38,+136,200,185,121,19,254,133,80,110,51,93,206,36,196,247,1,73,190,192,89,+229,250,120,83,141,169,13,120,0,91,134,45,105,203,96,218,107,92,70,248,+104,67,103,136,158,102,25,21,149,66,210,10,174,128,89,90,119,46,69,229,+99,234,230,186,70,88,187,64,235,18,244,94,9,147,209,169,206,87,197,81,+243,177,160,192,179,154,117,219,20,65,3,174,254,67,2,233,111,8,67,64,+254,90,33,154,15,32,247,175,27,165,10,103,175,82,119,205,20,231,128,12,+98,237,175,19,111,102,112,78,252,15,53,213,49,253,198,155,51,192,153,147,+99,31,197,154,16,6,67,168,146,225,180,230,137,123,253,73,249,249,171,164,+148,165,89,59,154,50,218,220,218,50,56,141,146,44,167,95,183,142,212,201,+108,189,217,114,33,93,140,175,156,17,218,110,84,241,90,97,133,6,64,66,+175,99,134,75,95,69,168,255,70,167,160,188,154,150,155,137,36,244,64,160,+153,180,193,43,186,206,114,172,58,208,80,160,171,3,96,100,3,158,76,38,+181,132,69,248,103,131,239,143,51,185,246,228,178,187,204,23,105,40,71,97,+239,146,214,0,186,101,43,193,198,175,233,254,9,37,9,220,195,94,111,70,+24,123,105,240,48,188,173,104,54,202,98,162,173,43,107,190,86,71,143,7,+102,18,72,103,103,230,248,247,186,32,113,218,26,57,213,54,78,20,212,66,+61,25,207,19,108,194,126,242,16,193,225,96,16,116,155,222,5,218,41,96,+72,62,193,150,218,69,40,217,199,151,65,167,125,210,213,242,179,243,203,217,+165,56,254,166,185,52,12,43,222,85,55,204,160,252,6,86,61,199,255,111,+0,135,103,145,165,41,206,207,170,137,124,78,134,61,4,254,127,39,151,244,+206,127,77,146,241,194,201,173,0,11,44,165,80,184,150,131,52,182,6,114,+163,85,170,112,240,211,232,118,126,85,74,189,199,58,168,187,7,248,75,41,+189,190,153,102,52,213,192,73,201,253,9,31,236,218,57,176,244,132,196,193,+71,215,21,12,242,110,219,79,61,254,153,101,150,252,24,180,130,252,157,126,+167,181,58,192,235,21,252,228,213,68,249,80,187,62,82,148,102,244,190,248,+176,0,87,219,12,176,115,88,189,174,6,237,116,194,178,197,139,135,125,147,+80,167,134,241,189,201,14,82,177,141,15,5,76,49,92,102,156,201,214,197,+119,151,188,229,25,95,120,194,148,178,222,96,26,113,162,229,19,144,123,97,+64,122,87,18,147,120,19,71,177,46,98,161,193,91,127,211,222,225,148,229,+38,212,31,151,52,28,238,83,179,216,150,205,226,192,174,201,53,212,246,52,+10,42,58,104,94,234,7,200,82,33,202,123,26,107,165,124,6,2,155,199,+121,122,252,177,130,153,247,31,157,208,189,184,101,65,62,178,202,121,244,82,+71,124,104,98,233,45,189,48,4,127,220,105,182,249,125,158,231,17,208,56,+173,1,29,207,73,134,14,152,182,13,39,203,224,108,122,199,158,165,162,218,+191,163,128,143,68,145,175,154,3,25,9,188,232,215,223,4,32,105,210,5,+17,57,182,170,152,144,202,230,40,125,193,224,111,236,34,224,138,57,168,6,+46,239,224,248,167,236,180,28,6,184,211,122,183,97,255,211,229,69,27,167,+150,205,1,243,18,200,23,40,166,56,142,97,44,196,231,10,71,16,74,160,+167,147,228,236,145,108,102,68,183,104,67,125,112,46,213,137,182,171,66,244,+95,72,236,246,127,32,74,238,220,235,116,183,216,104,123,227,92,211,143,185,+173,125,169,135,232,95,87,88,182,161,84,11,81,57,221,32,77,27,65,152,+130,119,150,123,246,27,7,6,226,135,71,159,12,125,130,225,138,176,81,124,+209,96,196,200,58,169,54,116,70,50,81,72,4,213,3,23,132,232,59,139,+151,63,188,75,154,98,108,78,14,237,101,25,25,37,204,137,106,173,74,228,+73,148,173,103,168,210,114,118,52,253,157,122,2,16,40,178,225,80,12,233,+1,220,247,199,32,206,49,135,223,141,64,245,113,63,138,16,220,22,115,34,+56,74,210,42,94,182,206,78,113,198,72,252,129,67,184,195,155,99,100,242,+230,243,254,105,100,200,247,84,108,231,101,169,141,216,83,56,32,159,75,102,+127,160,29,243,4,119,31,0,67,31,40,131,119,245,34,2,185,236,126,27,+18,174,54,73,188,55,103,228,211,127,210,137,224,204,179,159,132,236,183,1,+170,204,129,49,22,88,243,156,156,174,237,29,234,63,54,175,224,224,38,236,+191,128,113,161,203,131,108,76,98,199,156,95,49,89,118,118,253,106,116,23,+190,110,17,175,246,78,51,50,219,59,150,140,85,239,239,56,138,193,17,144,+234,4,42,49,219,32,117,197,179,110,129,43,203,163,242,204,39,225,129,87,+247,57,10,231,53,234,229,100,156,203,185,59,142,145,173,142,210,196,127,132,+15,204,180,88,144,198,64,168,217,165,241,58,14,109,101,59,33,242,119,189,+6,5,103,217,26,195,29,232,236,245,158,246,148,77,21,80,171,17,16,194,+42,122,17,46,52,243,12,202,73,250,242,203,35,80,219,112,102,70,153,247,+236,70,25,187,41,87,143,102,137,19,247,211,203,151,206,59,124,192,77,57,+161,107,69,158,139,62,158,154,28,52,27,253,92,93,174,211,117,1,209,42,+122,165,157,58,20,41,217,167,40,212,192,125,105,9,98,76,135,65,232,248,+176,187,212,73,81,226,175,51,30,106,106,84,30,198,8,239,226,249,58,196,+94,15,58,93,120,213,58,137,103,111,150,20,24,198,98,166,168,201,162,56,+179,183,74,231,99,133,29,60,45,89,82,60,26,237,40,4,49,27,218,201,+168,89,67,14,27,201,91,243,163,179,172,8,95,250,27,105,164,93,220,5,+16,96,9,148,12,105,32,3,8,93,246,86,108,179,39,138,249,20,18,229,+215,197,105,127,237,182,107,112,161,28,137,80,19,196,234,36,72,123,21,167,+159,159,191,203,235,184,238,77,218,221,178,20,49,136,180,159,36,56,39,97,+32,109,27,130,22,85,146,216,76,47,217,255,18,104,91,126,148,12,47,253,+156,161,249,85,153,235,166,57,160,69,136,132,248,53,167,253,228,219,27,141,+13,147,216,163,208,240,175,125,108,90,249,137,203,182,100,110,164,193,172,135,+174,200,108,164,224,126,193,233,165,181,191,146,129,181,253,188,68,228,178,66,+182,168,252,211,8,156,76,3,161,55,197,1,168,113,63,50,203,89,229,181,+187,58,64,138,253,126,239,74,229,11,13,190,58,185,114,37,72,109,66,166,+165,96,252,167,156,154,201,191,179,214,70,78,71,173,76,180,252,218,164,9,+192,227,13,215,97,114,84,247,71,203,128,47,46,86,115,190,44,220,105,163,+39,153,77,185,79,57,238,137,170,199,155,174,4,87,18,212,122,34,30,171,+88,215,208,201,143,43,13,60,181,35,179,52,114,55,179,52,23,39,122,73,+167,141,116,59,182,110,219,22,146,214,156,19,151,178,244,215,81,18,61,209,+181,129,227,107,255,23,229,155,169,118,116,96,171,43,58,129,39,41,21,165,+182,250,12,144,213,93,199,154,181,141,3,158,93,146,22,204,74,194,29,215,+85,209,93,18,29,223,202,83,12,179,30,246,230,121,151,14,170,100,196,53,+61,22,44,84,222,71,113,141,135,230,158,127,150,205,171,169,191,88,123,223,+133,81,31,30,112,92,208,158,204,25,27,148,37,173,115,15,69,19,6,51,+22,252,252,140,76,156,66,66,72,183,32,24,218,247,171,51,172,163,172,120,+177,124,120,141,104,54,165,228,231,180,183,190,239,20,140,33,255,147,194,98,+232,255,25,239,13,57,200,105,165,223,90,82,212,109,218,137,13,154,109,255,+68,95,202,176,143,90,142,32,44,104,120,96,20,28,48,66,41,22,97,119,+118,239,80,135,207,177,126,42,155,56,121,209,241,197,162,52,42,135,43,195,+152,223,224,68,83,234,140,35,122,51,124,228,41,109,65,14,151,147,44,189,+142,170,211,186,60,54,226,206,216,65,136,66,159,35,23,213,233,196,246,53,+189,175,174,206,0,82,97,12,116,98,91,101,153,111,157,133,68,188,92,131,+70,150,235,137,203,52,135,18,199,160,43,1,231,2,118,181,127,204,143,201,+12,36,16,112,121,234,47,87,194,242,73,26,55,82,69,245,195,65,171,79,+206,185,21,255,13,252,115,95,17,234,221,168,254,254,40,250,189,113,70,169,+191,119,223,134,217,172,67,25,5,228,48,233,196,191,107,60,93,204,95,215,+14,195,172,7,191,220,58,42,203,101,254,31,159,252,85,107,206,60,144,227,+15,67,157,226,46,164,107,140,238,201,232,81,73,140,200,87,31,3,124,233,+102,182,49,101,212,4,121,44,203,101,191,163,69,234,39,199,139,134,6,188,+255,251,38,90,10,+};+const unsigned char *combexpr = data;+const int combexprlen = 111785; static const struct ffi_entry imp_table[] = { { 0,0 } };
@@ -1,6 +1,17 @@ {-# OPTIONS_GHC -Wno-orphans #-} {-# LANGUAGE CPP #-}-module MHSPrelude(module Prelude, module Control.DeepSeq, module Control.Arrow, module MHSPrelude, Type, Int64, HasCallStack) where+module MHSPrelude(+ module Prelude,+ module Control.Arrow,+ module Control.DeepSeq,+ module Control.Exception,+ module Data.Version,+ module Text.Read,+ module MHSPrelude,+ Type,+ Int64,+ HasCallStack+ ) where import Prelude import Control.Arrow(first, second) import Control.DeepSeq@@ -9,10 +20,13 @@ import Data.Maybe import Data.List import Data.Text(Text, append, pack)+import Data.Version+import GHC.Exts(Any) import GHC.Stack import Data.Kind import System.Environment import System.IO+import Text.Read(readMaybe) #include "MachDeps.h" @@ -44,6 +58,13 @@ Left _ -> return Nothing Right h -> return (Just h) +openBinaryFileM :: FilePath -> IOMode -> IO (Maybe Handle)+openBinaryFileM path m = do+ r <- (try $ openBinaryFile path m) :: IO (Either IOError Handle)+ case r of+ Left _ -> return Nothing+ Right h -> return (Just h)+ openTmpFile :: String -> IO (String, Handle) openTmpFile tmplt = do mtmp <- lookupEnv "TMPDIR"@@ -55,10 +76,6 @@ ------- Read -------- -mhsError :: HasCallStack => String -> a-mhsError = error- -- errorWithoutStackTrace- _usingMhs :: Bool _usingMhs = False @@ -74,5 +91,24 @@ wantGMP :: Bool wantGMP = False +wantImath :: Bool+wantImath = False+ compiledWithMhs :: Bool compiledWithMhs = False++-- A value of unknown type.+type AnyType = Any++---+-- This belongs in MicroHs.Error, but Hugs cannot derive Tyoeable+-- and GHC doesn't allow explicit Typeable instances.+data MhsError+ = MhsSyntaxError SLoc String String+ | MhsTypeError SLoc String String String -- header, expected, actual+ | MhsUndefError SLoc String String -- name space, ident+ | MhsAmbigError SLoc String String String -- name space, ident, alts+ | MhsOtherError SLoc String+ | MhsError String -- no location+data SLoc = SLoc FilePath Int Int+ deriving (Show, Eq)
@@ -0,0 +1,3 @@+module MiniPrelude(module MHSPrelude) where+import qualified Prelude()+import MHSPrelude
@@ -1,385 +0,0 @@-module PrimTable(module PrimTable) where-import Control.Exception-import Data.Bits-import Data.Char-import Data.Int-import Data.Maybe-import Data.Word-import System.IO-import System.IO.TimeMilli-import Unsafe.Coerce-import GHC.Exts(Any)-import Foreign.C.String-import Foreign.C.Types-import Foreign.Marshal.Alloc-import Data.Array.IO-import Foreign.Ptr-import GHC.ForeignPtr---import System.Environment-import System.IO.Unsafe---import Debug.Trace---type AnyType = Any--type IOArr a = IOArray Int a--_primitive :: String -> Any---_primitive s | trace ("_primitive " ++ show s) False = undefined-_primitive "dynsym" = unsafeCoerce dynsym-_primitive s = fromMaybe (error $ "PrimTable._primitive: " ++ s) $ lookup s primOps--primOps :: [(String, Any)]-primOps =- [ comb "S" (\ f g x -> f x (g x))- , comb "K" const- , comb "I" id- , comb "B" (\ f g x -> f (g x))- , comb "C" (\ f g x -> f x g)- , comb "S'" (\ k f g x -> k (f x) (g x))- , comb "B'" (\ k f g x -> k f (g x))- , comb "C'" (\ k f g x -> k (f x) g)- , comb "A" (\ _x y -> y)- , comb "U" (\ x y -> y x)- , comb "Y" (\ f -> let r = f r in r)- , comb "Z" (\ f g _x -> f g)- , comb "J" (\ x _y z -> z x)- , comb "P" (\ x y f -> f x y)- , comb "R" (\ x y f -> y f x)- , comb "O" (\ x y _g f -> f x y)- , comb "K2" (\ x _y _z -> x)- , comb "K3" (\ x _y _z _w -> x)- , comb "K4" (\ x _y _z _w _v -> x)- , comb "C'B" (\ x y z w -> x z (y w))-- , arith "+" (+)- , arith "-" (-)- , arith "*" (*)- , arith "quot" quot- , arith "rem" rem- , arith "subtract" subtract- , arithu "neg" negate- , arithu "inv" complement- , arithw "uquot" quot- , arithw "urem" rem- , arithw "and" (.&.)- , arithw "or" (.|.)- , arithw "xor" xor- , arithwi "shl" shiftL- , arithwi "shr" shiftR- , arith "ashr" shiftR- , arithu "popcount" popCount- , arithu "clz" countLeadingZeros- , arithu "ctz" countTrailingZeros- , cmp "==" (==)- , cmp "/=" (/=)- , cmp "<" (<)- , cmp "<=" (<=)- , cmp ">" (>)- , cmp ">=" (>=)- , cmpw "u<" (<)- , cmpw "u<=" (<=)- , cmpw "u>" (>)- , cmpw "u>=" (>=)- , comb "icmp" (\ x y -> fromOrdering (compare (x::Int) y))- , comb "ucmp" (\ x y -> fromOrdering (compare (x::Word) y))-- , arithI "I+" (+)- , arithI "I-" (-)- , arithI "I*" (*)- , arithI "Iquot" quot- , arithI "Irem" rem- , arithI "Isubtract" subtract- , arithuI "Ineg" negate- , arithuI "Iinv" complement- , arithwI "Iuquot" quot- , arithwI "Iurem" rem- , arithwI "Iand" (.&.)- , arithwI "Ior" (.|.)- , arithwI "Ixor" xor- , arithwiI "Ishl" shiftL- , arithwiI "Ishr" shiftR- , arithwiI "Iashr" shiftR- , arithuiI "Ipopcount" popCount- , arithuiI "Iclz" countLeadingZeros- , arithuiI "Ictz" countTrailingZeros- , cmpI "I==" (==)- , cmpI "I/=" (/=)- , cmpI "I<" (<)- , cmpI "I<=" (<=)- , cmpI "I>" (>)- , cmpI "I>=" (>=)- , cmpwI "Iu<" (<)- , cmpwI "Iu<=" (<=)- , cmpwI "Iu>" (>)- , cmpwI "Iu>=" (>=)- , comb "Iicmp" (\ x y -> fromOrdering (compare (x::Int64) y))- , comb "Iucmp" (\ x y -> fromOrdering (compare (x::Word64) y))-- , comb "itoI" (\ x -> fromIntegral (x::Int) :: Int64)- , comb "Itoi" (\ x -> fromIntegral (x::Int64) :: Int)- , comb "utoU" (\ x -> fromIntegral (x::Word) :: Word64)- , comb "Utou" (\ x -> fromIntegral (x::Word64) :: Word)-- , comb "fp2p" unsafeForeignPtrToPtr-- , comb "A.alloc" newIOArray- , comb "A.size" sizeIOArray- , comb "A.read" readIOArray- , comb "A.write" writeIOArray--- , comb "A.==" eqIOArray-- , farith "f+" (+)- , farith "f-" (-)- , farith "f*" (*)- , farith "f/" (/)- , farithu "fneg" negate- , fcmp "f==" (==)- , fcmp "f/=" (/=)- , fcmp "f<" (<)- , fcmp "f<=" (<=)- , fcmp "f>" (>)- , fcmp "f>=" (>=)- , comb "itof" (fromIntegral :: Int -> Float)-- , darith "d+" (+)- , darith "d-" (-)- , darith "d*" (*)- , darith "d/" (/)- , darithu "dneg" negate- , dcmp "d==" (==)- , dcmp "d/=" (/=)- , dcmp "d<" (<)- , dcmp "d<=" (<=)- , dcmp "d>" (>)- , dcmp "d>=" (>=)- , comb "itod" (fromIntegral :: Int -> Double)-- , comb "seq" seq- , comb "rnf" rnf- , comb "ord" ord- , comb "chr" chr-- , comb "IO.performIO" unsafePerformIO- , comb "IO.>>=" iobind- , comb "IO.>>" iothen- , comb "IO.return" ioret- , comb "IO.print" ioprint- , comb "IO.serialize" ioserialize- , comb "IO.deserialize" iodeserialize- , comb "newCAStringLen" (fmap fromPair . newCAStringLen . toString)- , comb "IO.getArgRef" iogetargref-- , comb0 "IO.stdin" stdin- , comb0 "IO.stdout" stdout- , comb0 "IO.stderr" stderr-- ]- where- comb0 n f = (n, unsafeCoerce f)- comb n f = (n, unsafeCoerce f)--- comb n f = (n, unsafeCoerce (\ x -> trace (seq x n) (f x)))-- arith :: String -> (Int -> Int -> Int) -> (String, Any)- arith = comb- arithw :: String -> (Word -> Word -> Word) -> (String, Any)- arithw = comb- arithwi :: String -> (Word -> Int -> Word) -> (String, Any)- arithwi = comb- arithu :: String -> (Int -> Int) -> (String, Any)- arithu = comb-- arithI :: String -> (Int64 -> Int64 -> Int64) -> (String, Any)- arithI = comb- arithwI :: String -> (Word64 -> Word64 -> Word64) -> (String, Any)- arithwI = comb- arithwiI :: String -> (Word64 -> Int -> Word64) -> (String, Any)- arithwiI = comb- arithuI :: String -> (Int64 -> Int64) -> (String, Any)- arithuI = comb- arithuiI :: String -> (Int64 -> Int) -> (String, Any)- arithuiI = comb-- farith :: String -> (Float -> Float -> Float) -> (String, Any)- farith = comb- farithu :: String -> (Float -> Float) -> (String, Any)- farithu = comb-- darith :: String -> (Double -> Double -> Double) -> (String, Any)- darith = comb- darithu :: String -> (Double -> Double) -> (String, Any)- darithu = comb-- cmp :: String -> (Int -> Int -> Bool) -> (String, Any)- cmp n f = comb n (\ x y -> fromBool (f x y))- cmpw :: String -> (Word -> Word -> Bool) -> (String, Any)- cmpw n f = comb n (\ x y -> fromBool (f x y))-- cmpI :: String -> (Int64 -> Int64 -> Bool) -> (String, Any)- cmpI n f = comb n (\ x y -> fromBool (f x y))- cmpwI :: String -> (Word64 -> Word64 -> Bool) -> (String, Any)- cmpwI n f = comb n (\ x y -> fromBool (f x y))-- fcmp :: String -> (Float -> Float -> Bool) -> (String, Any)- fcmp n f = comb n (\ x y -> fromBool (f x y))- dcmp :: String -> (Double -> Double -> Bool) -> (String, Any)- dcmp n f = comb n (\ x y -> fromBool (f x y))-- iobind :: IO a -> (a -> IO b) -> IO b- iobind = (>>=)- iothen :: IO a -> IO b -> IO b- iothen = (>>)- ioret :: a -> IO a- ioret = return- -- Can't implement this- ioprint :: Handle -> a -> IO ()- ioprint h _ = hPutStrLn h "ghc does not support cprint"- ioserialize :: Handle -> a -> IO ()- ioserialize h _ = hPutStrLn h "ghc does not support serialize"- iodeserialize :: Handle -> IO a- iodeserialize _ = error "ghc does not support deserialize"--{-- iogetargs :: IO Any- iogetargs = do- args <- getArgs- return $ fromList $ map fromString args--}- iogetargref = error "ghc: no IO.getArgRef"-- -- Can't implement this- rnf :: a -> ()- rnf x = seq x ()-- newIOArray :: Int -> a -> IO (IOArr a)- newIOArray i arr = newArray (0, i-1) arr- sizeIOArray :: IOArr a -> IO Int- sizeIOArray arr = pred . snd <$> getBounds arr- readIOArray :: IOArr a -> Int -> IO a- readIOArray arr i = readArray arr i- writeIOArray :: IOArr a -> Int -> a -> IO ()- writeIOArray arr i a = writeArray arr i a--- eqIOArray :: IOArr a -> IOArr a -> IO Bool---fromBool :: Bool -> Any-fromBool False = unsafeCoerce const-fromBool True = unsafeCoerce $ \ _x y -> y--fromOrdering :: Ordering -> (Any -> Any -> Any -> Any)-fromOrdering LT = \ x _y _z -> x-fromOrdering EQ = \ _x y _z -> y-fromOrdering GT = \ _x _y z -> z--fromPair :: (a, b) -> Any-fromPair (x, y) = unsafeCoerce $ \ pair -> pair x y--fromString :: String -> Any-fromString = fromList . map (unsafeCoerce . ord)--fromList :: [Any] -> Any-fromList [] = unsafeCoerce const-fromList (x:xs) = unsafeCoerce $ \ _nil cons -> cons (unsafeCoerce x) (fromList xs)--toList :: Any -> [Int]-toList a = unsafeCoerce a [] (\ i is -> i : toList is)--toString :: Any -> String-toString = map chr . toList--dynsym :: Any -> Any-dynsym acfun =- let s = toString acfun- in--- trace ("dynsym: " ++ show s) $- fromMaybe (error $ "ghc: unimplemented FFI: " ++ s) $ lookup s cops--cops :: [(String, Any)]-cops =- [ comb "getTimeMilli" getTimeMilli- , comb "fputc" fputc- , comb "fgetc" fgetc- , comb "fopen" fopen- , comb "fclose" fclose- , comb "putb" putb- , comb "add_FILE" add_FILE- , comb "add_utf8" add_utf8- , comb "free" free- , comb "exp" (dio exp)- , comb "log" (dio log)- , comb "sqrt" (dio sqrt)- , comb "sin" (dio sin)- , comb "cos" (dio cos)- , comb "tan" (dio tan)- , comb "asin" (dio asin)- , comb "acos" (dio acos)- , comb "atan" (dio atan)- , comb "sinh" (dio sinh)- , comb "cosh" (dio cosh)- , comb "tanh" (dio tanh)- , comb "asinh" (dio asinh)- , comb "acosh" (dio acosh)- , comb "atanh" (dio atanh)- , comb "atan2" (dio2 atan2)- , comb "expf" (fio exp)- , comb "logf" (fio log)- , comb "sqrtf" (fio sqrt)- , comb "sinf" (fio sin)- , comb "cosf" (fio cos)- , comb "tanf" (fio tan)- , comb "asinf" (fio asin)- , comb "acosf" (fio acos)- , comb "atanf" (fio atan)- , comb "sinhf" (fio sinh)- , comb "coshf" (fio cosh)- , comb "tanhf" (fio tanh)- , comb "asinhf" (fio asinh)- , comb "acoshf" (fio acosh)- , comb "atanhf" (fio atanh)- , comb "atan2f" (fio2 atan2)- ]- where- comb n f = (n, unsafeCoerce f)-- dio :: (Double -> Double) -> (Double -> IO Double)- dio f = return . f-- dio2 :: (Double -> Double -> Double) -> (Double -> Double -> IO Double)- dio2 f x y = return (f x y)-- fio :: (Float -> Float) -> (Float -> IO Float)- fio f = return . f-- fio2 :: (Float -> Float -> Float) -> (Float -> Float -> IO Float)- fio2 f x y = return (f x y)-- add_FILE :: Handle -> IO Handle- add_FILE h = return h-- add_utf8 :: Handle -> IO Handle- add_utf8 h = do hSetEncoding h utf8; return h-- putb :: Int -> Handle -> IO ()- putb c h = hPutChar h (chr c)-- fputc :: Int -> Handle -> IO Int- fputc c h = hPutChar h (chr c) >> return 0-- fgetc :: Handle -> IO Int- fgetc h = handle (\ (_ :: SomeException) -> return (-1)) (do c <- hGetChar h; return (ord c))-- fopen :: Ptr CChar -> Ptr CChar -> IO Handle- fopen name mode = do- sname <- peekCAString name- smode <- peekCAString mode- let hmode =- case smode of- "r" -> ReadMode- "w" -> WriteMode- "a" -> AppendMode- "w+" -> ReadWriteMode- _ -> error "fopen"- openFile sname hmode-- fclose :: Handle -> IO Int- fclose h = do hClose h; return 0
@@ -5,6 +5,7 @@ writeSerialized, writeSerializedCompressed, readSerialized, readSerializedH, readSerializedBS,+ writeSerializedCompressedBS, ) where import Data.ByteString(ByteString) import System.IO@@ -24,6 +25,9 @@ readSerializedBS :: forall a . HasCallStack => ByteString -> IO a readSerializedBS = errghc++writeSerializedCompressedBS :: forall a . HasCallStack => a -> IO ByteString+writeSerializedCompressedBS = errghc hSerialize :: forall a . Handle -> a -> IO () hSerialize = errghc
@@ -1,7 +1,12 @@-module System.IO.TimeMilli(getTimeMilli) where+module System.IO.TimeMilli(getTimeMilli, getTimeMicro, getBootTimeMicro) where import Data.Time import Data.Time.Clock.POSIX -getTimeMilli :: IO Int+getTimeMilli :: IO Word getTimeMilli = floor . (1000 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds <$> getCurrentTime +getTimeMicro :: IO Word+getTimeMicro = floor . (1000000 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds <$> getCurrentTime++getBootTimeMicro :: IO Word+getBootTimeMicro = return 0
@@ -1,8 +1,8 @@-module System.IO.Transducers(addLZ77, addBase64) where+module System.IO.Transducers(addLZMA, addBase64) where import System.IO -addLZ77 :: Handle -> IO Handle-addLZ77 _ = error "ghc compiled, cannot compress"+addLZMA :: Handle -> IO Handle+addLZMA _ = error "ghc compiled, cannot compress" addBase64 :: Handle -> IO Handle addBase64 _ = error "ghc compiled, cannot base64"
@@ -8,15 +8,21 @@ first, second, module Data.Monoid, module Data.Semigroup,- (<$>), Applicative(..), (*>), (<*), (>=>), (<=<)+ module Data.Version,+ Int64,+ Word,+ (<$>), Applicative(..), (*>), (<*), (>=>), (<=<),+ Exc.evaluate, ) where import Hugs.Prelude()-import Prelude hiding(fail)+import Prelude hiding(catch, fail) import qualified Prelude import Control.Arrow(first, second) import Control.Applicative-import Control.Exception(Exception, try)+import qualified Control.Exception as Exc --import Control.Monad.Fail+import Data.ByteString(ByteString)+import Data.Dynamic import Data.Int import Data.List import Data.Maybe@@ -24,12 +30,16 @@ import Data.Ratio import Data.Semigroup import Data.Text(Text, append, pack)+import Data.Typeable import Data.Word import Data.Version+import qualified GHC.Exts as Exts import Debug.Trace+import System.Directory (getDirectoryContents) import System.IO import System.Environment import System.IO.MD5+import Text.Read (reads) ------- List -------- @@ -92,13 +102,8 @@ ------- IO -------- -type SomeException = Exception- data TextEncoding = UTF8 -displayException :: Exception -> String-displayException = show- utf8 :: TextEncoding utf8 = UTF8 @@ -112,18 +117,25 @@ lookupEnv :: String -> IO (Maybe String) lookupEnv var = do- r <- try $ getEnv var+ r <- Exc.try $ getEnv var case r of Left _ -> return Nothing Right s -> return (Just s) openFileM :: FilePath -> IOMode -> IO (Maybe Handle) openFileM path m = do- r <- try $ openFile path m+ r <- Exc.try $ openFile path m case r of Left _ -> return Nothing Right h -> return (Just h) +openBinaryFileM :: FilePath -> IOMode -> IO (Maybe Handle)+openBinaryFileM path m = do+ r <- Exc.try $ openBinaryFile path m+ case r of+ Left _ -> return Nothing+ Right h -> return (Just h)+ splitTmp :: String -> (String, String) splitTmp tmpl = case span (/= '.') (reverse tmpl) of@@ -153,15 +165,17 @@ openTmpFile tmplt = do mtmp <- lookupEnv "TMPDIR" let tmp = fromMaybe "/tmp" mtmp- res <- try $ openTempFile tmp tmplt+ res <- Exc.try $ openTempFile tmp tmplt case res of Right x -> return x- Left (_::SomeException) -> openTempFile "." tmplt+ Left (_::Exc.Exception) -> openTempFile "." tmplt ------- Read -------- -mhsError :: String -> a-mhsError = error+readMaybe :: Read a => String -> Maybe a+readMaybe s = case reads s of+ [(r, _)] -> Just r+ _ -> Nothing _usingMhs :: Bool _usingMhs = False@@ -178,9 +192,15 @@ wantGMP :: Bool wantGMP = False +wantImath :: Bool+wantImath = False+ compiledWithMhs :: Bool compiledWithMhs = False +-- A value of unknown type.+type AnyType = Exts.Any+ -------- Control.DeepSeq ------ -- NFData class and instances for primitive types.@@ -210,6 +230,7 @@ instance NFData Ordering instance NFData () instance NFData Text+instance NFData ByteString instance NFData Integer where rnf x = (x == 0) `seq` ()@@ -246,3 +267,74 @@ (>=>) :: forall m a b c . Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) (>=>) = flip (<=<)++getExecutablePath :: forall a . IO a+getExecutablePath = error "unimplemented getExecutablePath"++listDirectory :: FilePath -> IO [FilePath]+listDirectory dir = do+ r <- getDirectoryContents dir+ return $ filter (\s -> s /= "." && s /= "..") r++-----------------+-- Emulate modern exceptions++type SomeException = Exc.Exception++-- NOTE: The runtime system knows about this class.+-- It uses displayException to show an uncaught exception.+-- Any changes here must be reflected in eval.c+class (Typeable e, Show e) => Exception e where+ toException :: e -> SomeException+ fromException :: SomeException -> Maybe e+ displayException :: e -> String++ toException e = Exc.DynException (toDyn e)+ fromException (Exc.DynException e) = fromDynamic e+ fromException e = cast e+ displayException = show++--instance Show SomeException where+-- showsPrec p (SomeException e) = showString "SomeException"++instance Exception SomeException where+ toException e = e++throw :: Exception e => e -> a+throw e = Exc.throw (toException e)++catch :: Exception e+ => IO a+ -> (e -> IO a)+ -> IO a+catch m k = Exc.catch m h+ where h e = case fromException e of+ Just e' -> k e'+ Nothing -> Exc.throw e++try :: Exception e => IO a -> IO (Either e a)+try ioa = catch (fmap Right ioa) (return . Left)++---+-- This belongs in MicroHs.Error, but Hugs cannot derive Tyoeable+-- and GHC doesn't allow explicit Typeable instances.+data MhsError+ = MhsSyntaxError SLoc String String+ | MhsTypeError SLoc String String String -- header, expected, actual+ | MhsUndefError SLoc String String -- name space, ident+ | MhsAmbigError SLoc String String String -- name space, ident, alts+ | MhsOtherError SLoc String+ | MhsError String -- no location++instance Typeable MhsError where+ typeOf _ = mkTyConApp (mkTyCon "MicroHs.Error.MhsError") []++data SLoc = SLoc FilePath Int Int+ deriving (Show, Eq)++isRight :: forall a b . Either a b -> Bool+isRight (Left _) = False+isRight (Right _) = True++rights :: [Either a b] -> [b]+rights es = [ b | Right b <- es ]
@@ -0,0 +1,3 @@+module MiniPrelude(module MHSPrelude) where+import qualified Prelude()+import MHSPrelude
@@ -1,269 +0,0 @@-module PrimTable(module PrimTable) where-import Control.Exception-import Data.Bits-import Data.Char-import Data.Maybe-import Data.Word-import System.IO-import System.IO.TimeMilli-import Unsafe.Coerce-import GHC.Exts(Any)-import Foreign.C.String-import Foreign.C.Types-import Foreign.Marshal.Alloc-import Foreign.Ptr---import System.Environment-import System.IO.Unsafe---import Debug.Trace--type AnyType = Any--_primitive :: String -> Any---primitive s | trace ("_primitive " ++ show s) False = undefined-_primitive "dynsym" = unsafeCoerce dynsym-_primitive s = fromMaybe (error $ "PrimTable._primitive: " ++ s) $ lookup s primOps--primOps :: [(String, Any)]-primOps =- [ comb "S" (\ f g x -> f x (g x))- , comb "K" const- , comb "I" id- , comb "B" (\ f g x -> f (g x))- , comb "C" (\ f g x -> f x g)- , comb "S'" (\ k f g x -> k (f x) (g x))- , comb "B'" (\ k f g x -> k f (g x))- , comb "C'" (\ k f g x -> k (f x) g)- , comb "A" (\ _x y -> y)- , comb "U" (\ x y -> y x)- , comb "Y" (\ f -> let r = f r in r)- , comb "Z" (\ f g _x -> f g)- , comb "J" (\ x _y z -> z x)- , comb "P" (\ x y f -> f x y)- , comb "R" (\ x y f -> y f x)- , comb "O" (\ x y _g f -> f x y)- , comb "K2" (\ x _y _z -> x)- , comb "K3" (\ x _y _z _w -> x)- , comb "K4" (\ x _y _z _w _v -> x)- , comb "C'B" (\ x y z w -> x z (y w))-- , arith "+" (+)- , arith "-" (-)- , arith "*" (*)- , arith "quot" quot- , arith "rem" rem- , arith "subtract" subtract- , arithu "neg" negate- , arithu "inv" complement- , arithw "uquot" quot- , arithw "urem" rem- , arithw "and" (.&.)- , arithw "or" (.|.)- , arithw "xor" xor- , arithwi "shl" shiftL- , arithwi "shr" shiftR- , arith "ashr" shiftR- , arithu "popcount" popCount- , arithu "clz" countLeadingZeros- , arithu "ctz" countTrailingZeros- , cmp "==" (==)- , cmp "/=" (/=)- , cmp "<" (<)- , cmp "<=" (<=)- , cmp ">" (>)- , cmp ">=" (>=)- , cmpw "u<" (<)- , cmpw "u<=" (<=)- , cmpw "u>" (>)- , cmpw "u>=" (>=)- , comb "icmp" (\ x y -> fromOrdering (compare (x::Int) y))-- , farith "f+" (+)- , farith "f-" (-)- , farith "f*" (*)- , farith "f/" (/)- , farithu "fneg" negate- , fcmp "f==" (==)- , fcmp "f/=" (/=)- , fcmp "f<" (<)- , fcmp "f<=" (<=)- , fcmp "f>" (>)- , fcmp "f>=" (>=)- , comb "itof" (fromIntegral :: Int -> Double)-- , comb "seq" seq- , comb "rnf" rnf- , comb "ord" ord- , comb "chr" chr-- , comb "IO.performIO" unsafePerformIO- , comb "IO.>>=" iobind- , comb "IO.>>" iothen- , comb "IO.return" ioret- , comb "IO.print" ioprint- , comb "IO.serialize" ioserialize- , comb "IO.deserialize" iodeserialize- , comb "newCAStringLen" (fmap fromPair . newCAStringLen . toString)- , comb "IO.getArgRef" iogetargref-- , comb0 "IO.stdin" stdin- , comb0 "IO.stdout" stdout- , comb0 "IO.stderr" stderr-- ]- where- comb0 n f = (n, unsafeCoerce f)- comb n f = (n, unsafeCoerce f)--- comb n f = (n, unsafeCoerce (\ x -> trace (seq x n) (f x)))- arith :: String -> (Int -> Int -> Int) -> (String, Any)- arith = comb- arithw :: String -> (Word -> Word -> Word) -> (String, Any)- arithw = comb- arithwi :: String -> (Word -> Int -> Word) -> (String, Any)- arithwi = comb- arithu :: String -> (Int -> Int) -> (String, Any)- arithu = comb- farith :: String -> (Double -> Double -> Double) -> (String, Any)- farith = comb- farithu :: String -> (Double -> Double) -> (String, Any)- farithu = comb- cmp :: String -> (Int -> Int -> Bool) -> (String, Any)- cmp n f = comb n (\ x y -> fromBool (f x y))- cmpw :: String -> (Word -> Word -> Bool) -> (String, Any)- cmpw n f = comb n (\ x y -> fromBool (f x y))- fcmp :: String -> (Double -> Double -> Bool) -> (String, Any)- fcmp n f = comb n (\ x y -> fromBool (f x y))-- iobind :: IO a -> (a -> IO b) -> IO b- iobind = (>>=)- iothen :: IO a -> IO b -> IO b- iothen = (>>)- ioret :: a -> IO a- ioret = return- -- Can't implement this- ioprint :: Handle -> a -> IO ()- ioprint h _ = hPutStrLn h "hugs does not support cprint"- ioserialize :: Handle -> a -> IO ()- ioserialize h _ = hPutStrLn h "hugs does not support serialize"- iodeserialize :: Handle -> IO a- iodeserialize _ = error "hugs does not support deserialize"--{-- iogetargs :: IO Any- iogetargs = do- args <- getArgs- return $ fromList $ map fromString args--}- iogetargref = error "hugs: no IO.getArgRef"-- -- Can't implement this- rnf :: a -> ()- rnf x = seq x ()--fromBool :: Bool -> Any-fromBool False = unsafeCoerce const-fromBool True = unsafeCoerce $ \ _x y -> y--fromOrdering :: Ordering -> (Any -> Any -> Any -> Any)-fromOrdering LT = \ x _y _z -> x-fromOrdering EQ = \ _x y _z -> y-fromOrdering GT = \ _x _y z -> z--fromPair :: (a, b) -> Any-fromPair (x, y) = unsafeCoerce $ \ pair -> pair x y--fromString :: String -> Any-fromString = fromList . map (unsafeCoerce . ord)--fromList :: [Any] -> Any-fromList [] = unsafeCoerce const-fromList (x:xs) = unsafeCoerce $ \ _nil cons -> cons (unsafeCoerce x) (fromList xs)--toList :: Any -> [Int]-toList a = unsafeCoerce a [] (\ i is -> i : toList is)--toString :: Any -> String-toString = map chr . toList--dynsym :: Any -> Any-dynsym acfun =- let s = toString acfun- in--- trace ("dynsym: " ++ show s) $- fromMaybe (error $ "hugs: unimplemented FFI: " ++ s) $ lookup s cops--popCount :: Int -> Int-popCount = undefined--countLeadingZeros :: Int -> Int-countLeadingZeros = undefined--countTrailingZeros :: Int -> Int-countTrailingZeros = undefined--cops :: [(String, Any)]-cops =- [ comb "getTimeMilli" getTimeMilli- , comb "fputc" fputc- , comb "fgetc" fgetc- , comb "fopen" fopen- , comb "fclose" fclose- , comb "putb" putb- , comb "add_FILE" add_FILE- , comb "add_utf8" add_utf8- , comb "free" free- , comb "exp" (fio exp)- , comb "log" (fio log)- , comb "sqrt" (fio sqrt)- , comb "sin" (fio sin)- , comb "cos" (fio cos)- , comb "tan" (fio tan)- , comb "asin" (fio asin)- , comb "acos" (fio acos)- , comb "atan" (fio atan)- , comb "sinh" (fio sinh)- , comb "cosh" (fio cosh)- , comb "tanh" (fio tanh)- , comb "asinh" (fio asinh)- , comb "acosh" (fio acosh)- , comb "atanh" (fio atanh)- , comb "atan2" (fio2 atan2)- ]- where- comb n f = (n, unsafeCoerce f)-- fio :: (Double -> Double) -> (Double -> IO Double)- fio f = return . f-- fio2 :: (Double -> Double -> Double) -> (Double -> Double -> IO Double)- fio2 f x y = return (f x y)-- add_FILE :: Handle -> IO Handle- add_FILE h = return h-- add_utf8 :: Handle -> IO Handle- add_utf8 h = do {-hSetEncoding h utf8;-} return h-- putb :: Int -> Handle -> IO ()- putb c h = hPutChar h (chr c)-- fputc :: Int -> Handle -> IO Int- fputc c h = hPutChar h (chr c) >> return 0-- fgetc :: Handle -> IO Int- fgetc h = handle (\ (_ :: Exception) -> return (-1)) (do c <- hGetChar h; return (ord c))-- fopen :: Ptr CChar -> Ptr CChar -> IO Handle- fopen name mode = do- sname <- peekCAString name- smode <- peekCAString mode- let hmode =- case smode of- "r" -> ReadMode- "w" -> WriteMode- "a" -> AppendMode- "w+" -> ReadWriteMode- _ -> error "fopen"- openFile sname hmode-- fclose :: Handle -> IO Int- fclose h = do hClose h; return 0
@@ -8,7 +8,10 @@ writeSerialized, writeSerializedCompressed, readSerialized,+ readSerializedBS,+ writeSerializedCompressedBS, ) where+import Data.ByteString(ByteString) --import System.IO {-@@ -28,6 +31,12 @@ readSerialized :: FilePath -> IO a readSerialized = errhugs++readSerializedBS :: forall a . ByteString -> IO a+readSerializedBS = errhugs++writeSerializedCompressedBS :: forall a . a -> IO ByteString+writeSerializedCompressedBS = errhugs errhugs :: a errhugs = error "System.IO.Serialize: serialization not available with hugs"
@@ -1,6 +1,7 @@ module System.IO.TimeMilli(getTimeMilli) where import Data.Time import Data.Time.Clock.POSIX+import Data.Word -getTimeMilli :: IO Int+getTimeMilli :: IO Word getTimeMilli = fmap (floor . (1000 *) . toRational . utcTimeToPOSIXSeconds) getCurrentTime
@@ -1,8 +1,8 @@-module System.IO.Transducers(addLZ77, addBase64) where+module System.IO.Transducers(addLZMA, addBase64) where import System.IO -addLZ77 :: Handle -> IO Handle-addLZ77 _ = error "hugs compiled, cannot compress"+addLZMA :: Handle -> IO Handle+addLZMA _ = error "hugs compiled, cannot compress" addBase64 :: Handle -> IO Handle
@@ -24,6 +24,7 @@ import Control.Monad.ST_Type import Control.Monad.ST.Unsafe import Data.Any+import Data.Array.Byte import Data.Bits import Data.Bool import Data.Bool_Type@@ -102,6 +103,9 @@ import Data.STRef.Lazy import Data.STRef.Strict import Data.String+import Data.String.Interpolate+import Data.String.Interpolate.Basic+import Data.String.Interpolate.ShowS import Data.Text import Data.Text.Encoding import Data.Text.IO@@ -150,6 +154,13 @@ import Mhs.MutArr import Mhs.MutUArr import Mhs.UArr+import Mhs.Print+import Mhs.Reflect+import Mhs.Extract+import Mhs.IntMap+import Mhs.Text.ParserComb+import Mhs.Text.PrettyPrint.HughesPJLite+import Mhs.Text.PrettyPrint.HughesPJLiteClass import Prelude import Primitives import System.Compress@@ -165,6 +176,7 @@ import System.IO.MD5 import System.IO.PrintOrRun import System.IO.Serialize+import System.IO.Serialize.TypeDescr import System.IO.StringHandle import System.IO.TimeMilli import System.Info
@@ -34,12 +34,14 @@ -- ArithException(..),+ SerializeException(..), SomeAsyncException(..), AsyncException(..), asyncExceptionToException, asyncExceptionFromException, -- BlockedIndefinitelyOnMVar(..), blockedIndefinitelyOnMVar, BlockedIndefinitelyOnSTM(..), blockedIndefinitelyOnSTM,+ NonTermination(..), nonTermination, -- ErrorCall(..), --@@ -55,7 +57,7 @@ -- This is the function called by the runtime. -- It compiles to--- (U (U (K2 A)))+-- ((C D_1) (U (K2 A))) displaySomeException :: SomeException -> String displaySomeException = displayException @@ -102,7 +104,7 @@ evaluate :: a -> IO a evaluate a = seq a (return ()) >> return a -try :: forall a e . Exception e => IO a -> IO (Either e a)+try :: forall e a . Exception e => IO a -> IO (Either e a) try ioa = catch (fmap Right ioa) (return . Left) tryJust :: Exception e => (e -> Maybe b) -> IO a -> IO (Either b a)@@ -144,6 +146,8 @@ deriving instance Ord AsyncException deriving instance Eq MaskingState deriving instance Show MaskingState+deriving instance Eq SerializeException+deriving instance Ord SerializeException blockedIndefinitelyOnMVar :: SomeException blockedIndefinitelyOnMVar = toException BlockedIndefinitelyOnMVar@@ -151,6 +155,9 @@ blockedIndefinitelyOnSTM :: SomeException -- for the RTS blockedIndefinitelyOnSTM = toException BlockedIndefinitelyOnSTM +nonTermination :: SomeException+nonTermination = toException NonTermination+ ------------------- -- Assertions are ignored.@@ -169,4 +176,3 @@ instance Show AssertionFailed where showsPrec _ (AssertionFailed err) = showString err-
@@ -10,11 +10,13 @@ patternMatchFail, noMethodError, recSelError, recConError, AsyncException(..), ArithException(..),+ SerializeException(..), SomeAsyncException(..), asyncExceptionToException, asyncExceptionFromException, BlockedIndefinitelyOnMVar(..), BlockedIndefinitelyOnSTM(..),+ NonTermination(..), ErrorCall(ErrorCallWithLocation, ErrorCall), uninterruptibleMask,@@ -74,6 +76,9 @@ else if primIntEQ n (5::Int) then SomeException BlockedIndefinitelyOnMVar else if primIntEQ n (6::Int) then SomeException BlockedIndefinitelyOnSTM else if primIntEQ n (7::Int) then SomeException Overflow+ else if primIntEQ n (8::Int) then SomeException Serialize+ else if primIntEQ n (9::Int) then SomeException Deserialize+ else if primIntEQ n (10::Int) then SomeException NonTermination else e -- Throw an exception when executed, not when evaluated@@ -183,6 +188,15 @@ ------------------- +data SerializeException+ = Serialize+ | Deserialize+ deriving ({-Eq, Ord,-} Show, Typeable) -- Eq, Ord in Exception module++instance Exception SerializeException++-------------------+ data AsyncException = StackOverflow | HeapOverflow@@ -303,6 +317,16 @@ instance Show BlockedIndefinitelyOnSTM where showsPrec _ BlockedIndefinitelyOnSTM = showString "thread blocked indefinitely in an STM transaction"++--------------------++-- The runtime raises it when evaluating a value needs the value itself.+data NonTermination = NonTermination++instance Exception NonTermination++instance Show NonTermination where+ showsPrec _ NonTermination = showString "<<loop>>" --------------------
@@ -8,17 +8,12 @@ RealWorld, stToIO, -- GHC compat ) where import qualified Prelude(); import MiniPrelude-import Primitives(primPerformIO)+import Primitives(primPerformIO, primLazyBindST, primStrictIO) import Control.Monad.Fix import Control.Monad.ST(RealWorld) import qualified Control.Monad.ST_Type as S import qualified Control.Monad.ST as S -primLazyBind :: IO a -> (a -> IO b) -> IO b-primLazyBind = _primitive "IO.lazyBind"-primStrictIO :: IO a -> IO a-primStrictIO = _primitive "IO.strict"- newtype ST s a = ST {unST :: S.ST s a} -- This gets a type error when defined in terms of S.runST@@ -44,7 +39,7 @@ (<*>) = ap -- defined in terms on >>=, so it becomes lazy instance Monad (ST s) where- ma >>= k = ST $ S.ST $ primLazyBind (S.unST (unST ma)) (S.unST . unST . k)+ ma >>= k = ST $ S.ST $ primLazyBindST (S.unST (unST ma)) (S.unST . unST . k) instance MonadFix (ST s) where mfix = fixST@@ -55,4 +50,3 @@ stToIO :: ST RealWorld a -> IO a stToIO = S.unST . lazyToStrictST-
@@ -10,17 +10,21 @@ MutableByteArray, sizeOfMutableByteArray,+ newMutableEmptyByteArray, newMutableByteArray, freezeMutableByteArray, unsafeFreezeMutableByteArray, readWord8, writeWord8, withMutableByteArrayPtr,+ appendByte,+ appendChar, ) where import Control.Monad.ST import Control.Monad.ST_Type import Data.ByteString as BS-import Data.ByteString.Internal(primBS2FPtr)+import Data.ByteString.Internal(primBS2FPtr, primBSNE, primBSwrite, primBSread,+ primBSfreeze, primBSappByte, primBSappChar, primBSnew) import Data.Word import Foreign.ForeignPtr(withForeignPtr) import Foreign.Ptr(Ptr, castPtr)@@ -53,8 +57,11 @@ newtype MutableByteArray s = M BS.ByteString +newMutableEmptyByteArray :: Int -> ST s (MutableByteArray s)+newMutableEmptyByteArray n = ST (M <$> primBSnew 0 n)+ newMutableByteArray :: Int -> ST s (MutableByteArray s)-newMutableByteArray n = return $! M (BS.replicate n 0)+newMutableByteArray n = ST (M <$> primBSnew n n) freezeMutableByteArray :: MutableByteArray s -> ST s ByteArray freezeMutableByteArray (M bs) = return $! A (BS.copy bs)@@ -63,16 +70,20 @@ writeWord8 (M bs) n b = ST (primBSwrite bs n b) readWord8 :: MutableByteArray s -> Int -> ST s Word8-readWord8 (M bs) i = return $! BS.index bs i+readWord8 (M bs) i = ST (primBSread bs i) sizeOfMutableByteArray :: MutableByteArray s -> ST s Int sizeOfMutableByteArray (M bs) = return $! BS.length bs -primBSwrite :: BS.ByteString -> Int -> Word8 -> IO ()-primBSwrite = _primitive "bswrite"- unsafeFreezeMutableByteArray :: MutableByteArray s -> ST s ByteArray-unsafeFreezeMutableByteArray (M bs) = return (A bs)+unsafeFreezeMutableByteArray (M bs) = ST (A <$> primBSfreeze bs) withMutableByteArrayPtr :: MutableByteArray s -> (Ptr Word8 -> IO a) -> IO a withMutableByteArrayPtr (M bs) act = withForeignPtr (primBS2FPtr bs) (act . castPtr)++appendByte :: MutableByteArray s -> Word8 -> ST s ()+appendByte (M bs) b = ST (primBSappByte bs b)++-- Append byte for the UTF8 encoding of the character.+appendChar :: MutableByteArray s -> Char -> ST s ()+appendChar (M bs) b = ST (primBSappChar bs b)
@@ -105,6 +105,17 @@ testBitDefault :: (Bits a, Num a) => a -> Int -> Bool testBitDefault x i = (x .&. bit i) /= 0 +-- The class defaults for rotate/rotateL/rotateR are circular, so instances must define rotate.+-- The mask clears sign bits from shiftR; it avoids Num since IntN arithmetic checks overflow.+rotateDefault :: FiniteBits a => a -> Int -> a+rotateDefault x i+ | r == 0 = x+ | otherwise = (x `unsafeShiftL` r) .|. ((x `unsafeShiftR` (w - r)) .&. mask)+ where+ w = finiteBitSize x+ r = i `mod` w+ mask = complement (complement zeroBits `unsafeShiftL` r)+ popCountDefault :: (Bits a, Num a) => a -> Int popCountDefault = go 0 where@@ -132,6 +143,7 @@ bitSizeMaybe _ = Just _wordSize bitSize _ = _wordSize bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primIntPopcount zeroBits = 0
@@ -161,7 +161,6 @@ import Control.Monad.Fail import Data.Bits.Base import Data.ByteString.Internal-import Data.Coerce import Data.Function (($!)) import Data.List.NonEmpty (NonEmpty, fromList) import Data.Monoid.Internal@@ -537,14 +536,15 @@ useAsCString :: ByteString -> (CString -> IO a) -> IO a useAsCString bs act =- allocaBytes (l + 1) $ \buf -> do- withForeignPtr (primBS2FPtr bs) $ \p -> copyBytes buf p l- pokeByteOff buf l (0 :: Word8)- act (castPtr buf)- where l = length bs+ withForeignPtr (primBS2FPtr bs) $ \ p -> do -- Raw pointer to the bytestring+ let l = length bs+ allocaBytes (l + 1) $ \ buf -> do -- Temporary buffer+ copyBytes buf p l -- Copy the bytestring,+ pokeByteOff buf l (0 :: Word8) -- and add a trailing 0.+ act (castPtr buf) useAsCStringLen :: ByteString -> (CStringLen -> IO a) -> IO a-useAsCStringLen bs act = useAsCString bs $ \cstr -> act (cstr, length bs)+useAsCStringLen bs act = useAsCString bs $ \ cstr -> act (cstr, length bs) packCString :: CString -> IO ByteString packCString = primPackCString@@ -565,8 +565,8 @@ -- We should write raw bytes hPut :: Handle -> ByteString -> IO () hPut h bs =- withHandleWr h $ \bfile ->- useAsCStringLen bs $ \(cstr, len) ->+ withHandleWr h $ \ bfile ->+ useAsCStringLen bs $ \ (cstr, len) -> void (c_writeb cstr len bfile) -- XXX: flush if not BlockBuffering @@ -581,9 +581,9 @@ hGet :: Handle -> Int -> IO ByteString hGet h i =- withHandleRd h $ \bfile -> do+ withHandleRd h $ \ bfile -> do fp <- mallocForeignPtrBytes i- bytesRead <- withForeignPtr fp $ \buf -> c_readb buf i bfile+ bytesRead <- withForeignPtr fp $ \ buf -> c_readb buf i bfile return $! primFPtr2BS fp bytesRead hGetNonBlocking :: Handle -> Int -> IO ByteString@@ -594,7 +594,7 @@ hGetContents :: Handle -> IO ByteString hGetContents h =- withHandleRd h $ \bfile -> do+ withHandleRd h $ \ bfile -> do let readChunks chunkSize chunks = do fp <- mallocForeignPtrBytes chunkSize@@ -635,5 +635,5 @@ readPrec = parens ( do L.String s <- lexP -- Looks for "foo"- return (pack (coerce s))+ return (fromString s) )
@@ -3,7 +3,7 @@ import qualified Prelude () import MiniPrelude -import Data.ByteString.Internal (StrictByteString)+import Data.ByteString.Internal (StrictByteString, packUTF8) import Data.ByteString.Lazy (LazyByteString, append, empty, fromStrict) newtype Builder = Builder (LazyByteString -> LazyByteString)@@ -30,4 +30,4 @@ lazyByteString bs = Builder (bs `append`) stringUtf8 :: String -> Builder-stringUtf8 = byteString . _primitive "toUTF8"+stringUtf8 = byteString . packUTF8
@@ -4,7 +4,6 @@ import Control.DeepSeq.Class import Control.Error import Data.Bool-import Data.Coerce import Data.Enum import Data.Eq import Data.Function@@ -40,8 +39,6 @@ primBSGE = _primitive "bs>=" primBScmp :: ByteString -> ByteString -> Ordering primBScmp = _primitive "bscmp"-primBSpack :: [Word8] -> ByteString-primBSpack = _primitive "bspack" primBSunpack :: ByteString -> [Word8] primBSunpack = _primitive "bsunpack" primBSlength :: ByteString -> Int@@ -61,6 +58,11 @@ primBS2FPtr :: ByteString -> ForeignPtr CChar primBS2FPtr = _primitive "bs2fp" +-- Are two bytestrings the identical object?+primBSsame :: ByteString -> ByteString -> Bool+primBSsame a b =+ primPtrToWord (primForeignPtrToPtr (primBS2FPtr a)) `primWordEQ` primPtrToWord (primForeignPtrToPtr (primBS2FPtr b))+ -- Warning: This function modifies the `ForeignPtr`, -- avoid using the `ForeignPtr` after calling `primFPtr2BS`. primFPtr2BS :: ForeignPtr CChar -> Int -> ByteString@@ -72,6 +74,97 @@ primBSgrabLen :: Ptr CChar -> Int -> IO ByteString primBSgrabLen = _primitive "bsgrablen" +-- Initial size and initial capacity, zero fill.+primBSnew :: Int -> Int -> IO ByteString+primBSnew = _primitive "bsnew"++primBSwrite :: ByteString -> Int -> Word8 -> IO ()+primBSwrite = _primitive "bswrite"++primBSread :: ByteString -> Int -> IO Word8+primBSread = _primitive "bsread"++primBSfreeze :: ByteString -> IO ByteString+primBSfreeze = _primitive "bsfreeze"++primBSappByte :: ByteString -> Word8 -> IO ()+primBSappByte = _primitive "bsappbyte"++primBSappChar :: ByteString -> Char -> IO ()+primBSappChar = _primitive "bsappchar"++primBSfromUTF8 :: ByteString -> String+primBSfromUTF8 = _primitive "fromUTF8"++primBSheadUTF8 :: ByteString -> Char+primBSheadUTF8 = _primitive "headUTF8"++primBStailUTF8 :: ByteString -> ByteString+primBStailUTF8 = _primitive "tailUTF8"++-- Helpers for Data.Text, on (modified) UTF-8 encoded ByteStrings.+-- Offsets are in bytes, counts are in characters.++-- | Number of characters.+primUTF8length :: ByteString -> Int+primUTF8length = _primitive "utf8length"++-- | Byte offset after the first n characters (clamped).+primUTF8offset :: ByteString -> Int -> Int+primUTF8offset = _primitive "utf8offset"++-- | Byte offset where the last n characters start (clamped).+primUTF8offsetEnd :: ByteString -> Int -> Int+primUTF8offsetEnd = _primitive "utf8offsetend"++-- | @primUTF8offsetFrom bs i n@: byte offset after the first n characters+-- from byte offset i (clamped).+primUTF8offsetFrom :: ByteString -> Int -> Int -> Int+primUTF8offsetFrom = _primitive "utf8offsetfrom"++-- | @primUTF8offsetEndBefore bs i n@: byte offset where the last n+-- characters before byte offset i start (clamped).+primUTF8offsetEndBefore :: ByteString -> Int -> Int -> Int+primUTF8offsetEndBefore = _primitive "utf8offsetendbefore"++-- | Decode the character starting at a byte offset.+-- The result is @ord c * 8 + bytes@.+primUTF8decode :: ByteString -> Int -> Int+primUTF8decode = _primitive "utf8decode"++-- | Decode the character ending at a byte offset.+-- The result is @ord c * 8 + bytes@.+primUTF8decodeEnd :: ByteString -> Int -> Int+primUTF8decodeEnd = _primitive "utf8decodeend"++-- | The characters in reverse order.+primUTF8reverse :: ByteString -> ByteString+primUTF8reverse = _primitive "utf8reverse"++-- | First offset at or after the given one that is not a space ('Data.Char.isSpace').+primUTF8skipSpace :: ByteString -> Int -> Int+primUTF8skipSpace = _primitive "utf8skipspace"++-- | First offset at or after the given one that is a space.+primUTF8skipNonSpace :: ByteString -> Int -> Int+primUTF8skipNonSpace = _primitive "utf8skipnonspace"++-- | Offset after the string without its trailing spaces.+primUTF8trimSpaceEnd :: ByteString -> Int+primUTF8trimSpaceEnd = _primitive "utf8trimspaceend"++-- | @primBSfind pat str i@: offset of the first @pat@ in @str@ at or after @i@, or -1.+primBSfind :: ByteString -> ByteString -> Int -> Int+primBSfind = _primitive "bsfind"++-- | Offset of the last @pat@ in @str@, or -1.+primBSrfind :: ByteString -> ByteString -> Int+primBSrfind = _primitive "bsrfind"++-- | ASCII lower case (0) or upper case (1).+primBSasciiCase :: ByteString -> Int -> ByteString+primBSasciiCase = _primitive "bsasciicase"+ ----------------------------------------- instance NFData ByteString@@ -91,7 +184,7 @@ showsPrec p bs = showsPrec p (toString bs) instance IsString ByteString where- fromString = coerce pack+ fromString = primUnsafeCoerce pack -- Char and Word8 have the same representation instance Semigroup ByteString where (<>) = append@@ -100,7 +193,7 @@ mempty = empty toString :: ByteString -> String-toString = coerce unpack+toString = primUnsafeCoerce unpack -- Char and Word8 have the same representation empty :: ByteString empty = pack []@@ -125,8 +218,23 @@ bsError s = error $ "Data.ByteString." ++ s pack :: [Word8] -> ByteString-pack = primBSpack+pack s = primPerformIO $ packIO s +packIO :: [Word8] -> IO ByteString+packIO s =+ let loop bs [] = primBSfreeze bs+ loop bs (c:cs) = primBSappByte bs c `primThen` loop bs cs+ in primBSnew 0 10 `primBind` \ bs -> loop bs s++packUTF8 :: [Char] -> ByteString+packUTF8 s = primPerformIO (packUTF8IO s)++packUTF8IO :: [Char] -> IO ByteString+packUTF8IO s =+ let loop bs [] = primBSfreeze bs+ loop bs (c:cs) = primBSappChar bs c `primThen` loop bs cs+ in primBSnew 0 10 `primBind` \ bs -> loop bs s+ unpack :: ByteString -> [Word8] unpack = primBSunpack @@ -153,3 +261,19 @@ toForeignPtr :: ByteString -> (ForeignPtr Word8, Int, Int) toForeignPtr bs = (primUnsafeCoerce (primBS2FPtr bs), 0, primBSlength bs)++-- | 1 if every byte is below 0x80, else 0.+primBSisAscii :: ByteString -> Int+primBSisAscii = _primitive "bsisascii"++-- | Concatenate with a single copy. The list and its elements must+-- already be evaluated; use 'concatBS'.+primBSconcatEvaluated :: [ByteString] -> ByteString+primBSconcatEvaluated = _primitive "bsconcat"++-- | Concatenate with a single copy.+concatBS :: [ByteString] -> ByteString+concatBS bss = forceAll bss `primSeq` primBSconcatEvaluated bss+ where+ forceAll [] = ()+ forceAll (b:bs) = b `primSeq` forceAll bs
@@ -193,7 +193,6 @@ -- copied from bytestring-0.12.2.0 instance Monoid ShortByteString where mempty = empty- mappend = (<>) mconcat = concat -- copied from bytestring-0.12.2.0
@@ -8,6 +8,7 @@ isMark, isSeparator, isPunctuation, isSymbol, toTitle, toUpper, toLower,+ _toTitles, _toUppers, _toLowers, _toFolds, ) where import qualified Prelude(); import MiniPrelude import Primitives(primOrd, primUnsafeCoerce)@@ -217,22 +218,421 @@ bytestringGCTable :: BS.ByteString bytestringGCTable = decompressRLE compressedGCTable --- These tables are generated by unicode/UniParse.hs--- This is for Unicode 17.0.0+-- These tables are generated by unicode/UniParse.hs and unicode/SpecialParse.hs+-- This is for Unicode 18.0.0 unicodeVersion :: Version-unicodeVersion = makeVersion [17,0,0]+unicodeVersion = makeVersion [18,0,0] compressedGCTable :: ByteString compressedGCTable =- "\159\25\22\130\17\19\130\17\13\14\17\18\17\12\17\17\137\8\17\17\130\18\17\17\153\0\13\17\14\20\11\20\153\1\13\18\14\18\160\25\22\17\131\19\21\17\20\21\4\15\18\26\21\20\21\18\10\10\20\1\17\17\20\10\4\16\130\10\17\150\0\18\134\0\151\1\18\135\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\0\1\0\1\0\130\1\0\0\1\0\1\0\0\1\130\0\1\1\131\0\1\0\0\1\130\0\130\1\0\0\1\0\0\1\0\1\0\1\0\0\1\0\1\1\0\1\0\0\1\130\0\1\0\1\0\0\1\1\4\0\130\1\131\4\0\2\1\0\2\1\0\2\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\2\1\0\1\130\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\134\1\0\0\1\0\0\1\1\0\1\131\0\1\0\1\0\1\0\1\0\196\1\4\4\153\1\145\3\131\20\139\3\141\20\132\3\134\20\3\20\3\144\20\239\5\0\1\0\1\3\20\0\1\29\29\3\130\1\17\0\131\29\20\20\0\17\130\0\29\0\29\0\0\1\144\0\29\136\0\162\1\0\1\1\130\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\132\1\0\1\18\0\1\0\0\1\1\178\0\175\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\21\132\5\7\7\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\29\165\0\29\29\3\133\17\168\1\17\12\29\29\21\21\19\29\172\5\12\5\17\5\5\17\5\5\17\5\135\29\154\4\131\29\131\4\17\17\138\29\133\26\130\18\17\17\19\17\17\21\21\138\5\17\26\130\17\159\4\3\137\4\148\5\137\8\131\17\4\4\5\226\4\17\4\134\5\26\21\133\5\3\3\5\5\21\131\5\4\4\137\8\130\4\21\21\4\141\17\29\26\4\5\157\4\154\5\29\29\216\4\138\5\4\141\29\137\8\160\4\136\5\3\3\21\130\17\3\29\29\5\19\19\149\4\131\5\3\136\5\3\130\5\3\132\5\29\29\142\17\29\152\4\130\5\29\29\17\29\138\4\132\29\151\4\20\134\4\26\26\132\29\136\5\168\4\3\151\5\26\159\5\6\181\4\5\6\5\4\130\6\135\5\131\6\5\6\6\4\134\5\137\4\5\5\17\17\137\8\17\3\142\4\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\130\29\131\4\29\29\5\4\130\6\131\5\29\29\6\6\29\29\6\6\5\4\135\29\6\131\29\4\4\29\130\4\5\5\29\29\137\8\4\4\19\19\133\10\21\19\4\17\5\29\29\5\5\6\29\133\4\131\29\4\4\29\29\149\4\29\134\4\29\4\4\29\4\4\29\4\4\29\29\5\29\130\6\5\5\131\29\5\5\29\29\130\5\130\29\5\134\29\131\4\29\4\134\29\137\8\5\5\130\4\5\17\137\29\5\5\6\29\136\4\29\130\4\29\149\4\29\134\4\29\4\4\29\132\4\29\29\5\4\130\6\132\5\29\5\5\6\29\6\6\5\29\29\4\142\29\4\4\5\5\29\29\137\8\17\19\134\29\4\133\5\29\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\4\29\132\4\29\29\5\4\6\5\6\131\5\29\29\6\6\29\29\6\6\5\134\29\5\5\6\131\29\4\4\29\130\4\5\5\29\29\137\8\21\4\133\10\137\29\5\4\29\133\4\130\29\130\4\29\131\4\130\29\4\4\29\4\29\4\4\130\29\4\4\130\29\130\4\130\29\139\4\131\29\6\6\5\6\6\130\29\130\6\29\130\6\5\29\29\4\133\29\6\141\29\137\8\130\10\133\21\19\21\132\29\5\130\6\5\135\4\29\130\4\29\150\4\29\143\4\29\29\5\4\130\5\131\6\29\130\5\29\131\5\134\29\5\5\29\130\4\29\4\4\29\29\4\4\5\5\29\29\137\8\134\29\17\134\10\21\4\5\6\6\17\135\4\29\130\4\29\150\4\29\137\4\29\132\4\29\29\5\4\6\5\132\6\29\5\6\6\29\6\6\5\5\134\29\6\6\132\29\130\4\29\4\4\5\5\29\29\137\8\29\4\4\6\139\29\5\5\6\6\136\4\29\130\4\29\168\4\5\5\4\130\6\131\5\29\130\6\29\130\6\5\4\21\131\29\130\4\6\134\10\130\4\5\5\29\29\137\8\136\10\21\133\4\29\5\6\6\29\145\4\130\29\151\4\29\136\4\29\4\29\29\134\4\130\29\5\131\29\130\6\130\5\29\5\29\135\6\133\29\137\8\29\29\6\6\17\139\29\175\4\5\4\4\134\5\131\29\19\133\4\3\135\5\17\137\8\17\17\164\29\4\4\29\4\29\132\4\29\151\4\29\4\29\137\4\5\4\4\136\5\4\29\29\132\4\29\3\29\134\5\29\137\8\29\29\131\4\159\29\4\130\21\142\17\21\17\130\21\5\5\133\21\137\8\137\10\21\5\21\5\21\5\13\14\13\14\6\6\135\4\29\163\4\131\29\141\5\6\132\5\17\5\5\132\4\138\5\29\163\5\29\135\21\5\133\21\29\21\21\132\17\131\21\17\17\164\29\170\4\6\6\131\5\6\133\5\6\5\5\6\6\5\5\4\137\8\133\17\133\4\6\6\5\5\131\4\130\5\4\130\6\4\4\134\6\130\4\131\5\140\4\5\6\6\5\5\133\6\5\4\6\137\8\130\6\5\21\21\165\0\29\0\132\29\0\29\29\170\1\17\3\130\1\130\200\4\29\131\4\29\29\134\4\29\4\29\131\4\29\29\168\4\29\131\4\29\29\160\4\29\131\4\29\29\134\4\29\4\29\131\4\29\29\142\4\29\184\4\29\131\4\29\29\194\4\29\29\130\5\136\17\147\10\130\29\143\4\137\21\133\29\213\0\29\29\133\1\29\29\12\132\235\4\21\17\144\4\22\153\4\13\14\130\29\202\4\130\17\130\9\135\4\134\29\145\4\130\5\6\136\29\146\4\5\5\6\17\17\136\29\145\4\5\5\139\29\140\4\29\130\4\29\5\5\139\29\179\4\5\5\6\134\5\135\6\5\6\6\138\5\130\17\3\130\17\19\4\5\29\29\137\8\133\29\137\10\133\29\133\17\12\131\17\130\5\26\5\137\8\133\29\162\4\3\180\4\134\29\132\4\5\5\161\4\5\4\132\29\197\4\137\29\158\4\29\130\5\131\6\5\5\130\6\131\29\6\6\5\133\6\130\5\131\29\21\130\29\17\17\137\8\157\4\29\29\132\4\138\29\171\4\131\29\153\4\133\29\137\8\10\130\29\161\21\150\4\5\5\6\6\5\29\29\17\17\180\4\6\5\6\134\5\29\5\6\5\6\6\135\5\133\6\137\5\29\29\5\137\8\133\29\137\8\133\29\134\17\3\133\17\29\29\141\5\7\158\5\29\29\139\5\147\29\131\5\6\174\4\5\6\132\5\6\5\132\6\5\6\6\135\4\29\17\17\137\8\134\17\137\21\136\5\136\21\130\17\5\5\6\157\4\6\131\5\6\6\5\5\6\130\5\4\4\137\8\171\4\5\6\5\5\130\6\5\6\130\5\6\6\135\29\131\17\163\4\135\6\135\5\6\6\5\5\130\29\132\17\137\8\130\29\130\4\137\8\157\4\133\3\17\17\136\1\0\1\132\29\170\0\29\29\130\0\135\17\135\29\130\5\17\140\5\6\134\5\131\4\5\133\4\5\4\4\6\5\5\4\132\29\171\1\190\3\140\1\3\161\1\164\3\191\5\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\136\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\136\1\135\0\133\1\29\29\133\0\29\29\135\1\135\0\135\1\135\0\133\1\29\29\133\0\29\29\135\1\29\0\29\0\29\0\29\0\135\1\135\0\141\1\29\29\135\1\135\2\135\1\135\2\135\1\135\2\132\1\29\1\1\131\0\2\20\1\130\20\130\1\29\1\1\131\0\2\130\20\131\1\29\29\1\1\131\0\29\130\20\135\1\132\0\130\20\29\29\130\1\29\1\1\131\0\2\20\20\29\138\22\132\26\133\12\17\17\15\16\13\15\15\16\13\15\135\17\23\24\132\26\22\136\17\15\16\131\17\11\11\130\17\18\13\14\138\17\18\17\11\137\17\22\132\26\29\137\26\10\3\29\29\133\10\130\18\13\14\3\137\10\130\18\13\14\29\140\3\130\29\161\19\141\29\140\5\131\7\5\130\7\139\5\142\29\21\21\0\131\21\0\21\21\1\130\0\1\1\130\0\1\21\0\21\21\18\132\0\133\21\0\21\0\21\0\21\131\0\21\1\131\0\1\131\4\1\21\21\1\1\0\0\132\18\0\131\1\21\18\21\21\1\21\143\10\162\9\0\1\131\9\10\21\21\131\29\132\18\132\21\18\18\131\21\18\21\21\18\21\21\18\134\21\18\158\21\18\18\21\21\18\21\18\158\21\130\139\18\135\21\13\14\13\14\147\21\18\18\134\21\13\14\208\21\18\157\21\152\18\167\21\133\18\199\21\149\29\138\21\148\29\187\10\205\21\149\10\129\182\21\18\136\21\18\181\21\135\18\238\21\18\129\247\21\13\14\13\14\13\14\13\14\13\14\13\14\13\14\157\10\171\21\132\18\13\14\158\18\13\14\13\14\13\14\13\14\13\14\143\18\129\255\21\129\130\18\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\190\18\13\14\13\14\159\18\13\14\130\129\18\175\21\148\18\21\21\133\18\166\21\29\29\129\137\21\175\0\175\1\0\1\130\0\1\1\0\1\0\1\0\1\131\0\1\0\1\1\0\133\1\3\3\130\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\133\21\0\1\0\1\130\5\0\1\132\29\131\17\10\17\17\165\1\29\1\132\29\1\29\29\183\4\134\29\3\17\141\29\5\150\4\136\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\159\5\17\17\15\16\15\16\130\17\15\16\17\15\16\136\17\12\17\17\12\17\15\16\17\17\15\16\13\14\13\14\13\14\13\14\132\17\3\137\17\12\12\131\17\12\17\13\140\17\21\21\130\17\13\14\13\14\13\14\13\14\12\161\29\153\21\29\216\21\139\29\129\213\21\153\29\143\21\22\130\17\21\3\4\9\13\14\13\14\13\14\13\14\13\14\21\21\13\14\13\14\13\14\13\14\12\13\14\14\21\136\9\131\5\6\6\12\132\3\21\21\130\9\3\4\17\21\21\29\213\4\29\29\5\5\20\20\3\3\4\12\217\4\17\130\3\4\132\29\170\4\29\221\4\29\21\21\131\10\137\21\159\4\165\21\136\29\21\143\4\158\21\29\137\10\157\21\135\10\21\142\10\159\21\137\10\166\21\142\10\130\191\21\4\179\189\29\4\191\21\4\129\163\253\29\149\4\3\136\246\4\130\29\182\21\136\29\167\4\133\3\17\17\130\139\4\3\130\17\143\4\137\8\4\4\147\29\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\4\5\130\7\17\137\5\17\3\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\3\3\5\5\197\4\137\9\5\5\133\17\135\29\150\20\136\3\20\20\0\1\0\1\0\1\0\1\0\1\0\1\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\3\135\1\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\3\20\20\0\1\0\1\4\0\1\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\132\0\1\132\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\131\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\147\29\131\3\0\1\4\3\3\1\134\4\5\130\4\5\131\4\5\150\4\6\6\5\5\6\131\21\5\130\29\133\10\21\21\19\21\133\29\179\4\131\17\135\29\6\6\177\4\143\6\5\5\135\29\17\17\137\8\133\29\145\5\133\4\130\17\4\17\4\4\5\137\8\155\4\135\5\17\17\150\4\138\5\6\6\138\29\17\156\4\130\29\130\5\6\174\4\5\6\6\131\5\6\6\5\5\130\6\140\17\29\3\137\8\131\29\17\17\132\4\5\3\136\4\137\8\132\4\29\168\4\133\5\6\6\5\5\6\6\5\5\136\29\130\4\5\135\4\5\6\29\29\137\8\29\29\131\17\143\4\3\133\4\130\21\4\6\5\6\177\4\5\4\130\5\4\4\5\5\132\4\5\5\4\5\4\151\29\4\4\3\17\17\138\4\6\5\5\6\6\17\17\4\3\3\6\5\137\29\133\4\29\29\133\4\29\29\133\4\136\29\134\4\29\134\4\29\170\1\20\131\3\136\1\3\20\20\131\29\207\1\162\4\6\6\5\6\6\5\6\6\17\6\5\29\29\137\8\133\29\4\215\161\29\4\139\29\150\4\131\29\176\4\131\29\27\134\253\29\27\27\253\29\27\27\135\253\29\27\28\177\253\29\28\130\237\4\29\29\233\4\165\29\134\1\139\29\132\1\132\29\4\5\137\4\18\140\4\29\132\4\29\4\29\4\4\29\4\4\29\235\4\144\20\143\21\130\234\4\14\13\143\21\191\4\21\21\181\4\135\21\159\29\139\4\19\130\21\143\5\134\17\13\14\17\133\29\143\5\17\12\12\11\11\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\17\17\13\14\131\17\130\11\130\17\29\131\17\12\13\14\13\14\13\14\130\17\18\12\130\18\29\17\19\17\17\131\29\132\4\29\129\134\4\29\29\26\29\130\17\19\130\17\13\14\17\18\17\12\17\17\137\8\17\17\130\18\17\17\153\0\13\17\14\20\11\20\153\1\13\18\14\18\13\14\17\13\14\17\17\137\4\3\172\4\3\3\158\4\130\29\133\4\29\29\133\4\29\29\133\4\29\29\130\4\130\29\19\19\18\20\21\19\19\29\21\131\18\21\21\137\29\130\26\21\21\29\29\139\4\29\153\4\29\146\4\29\4\4\29\142\4\29\29\141\4\161\29\250\4\132\29\130\17\131\29\172\10\130\29\136\21\180\9\131\10\144\21\10\10\130\21\29\140\21\130\29\21\174\29\172\21\5\129\129\29\156\4\130\29\176\4\142\29\5\154\10\131\29\159\4\131\10\136\29\147\4\9\135\4\9\132\29\165\4\132\5\132\29\157\4\29\17\163\4\131\29\135\4\17\132\9\169\29\167\0\167\1\205\4\29\29\137\8\133\29\163\0\131\29\163\1\131\29\167\4\135\29\179\4\138\29\17\138\0\29\142\0\29\134\0\29\0\0\29\138\1\29\142\1\29\134\1\29\1\1\130\29\179\4\139\29\130\182\4\136\29\149\4\137\29\135\4\151\29\133\3\29\169\3\29\136\3\196\29\133\4\29\29\4\29\171\4\29\4\4\130\29\4\29\29\150\4\29\17\135\10\150\4\21\21\134\10\158\4\135\29\136\10\175\29\146\4\29\4\4\132\29\132\10\149\4\133\10\130\29\17\153\4\132\29\17\153\4\165\29\183\4\131\29\10\10\4\4\143\10\29\29\173\10\4\130\5\29\5\5\132\29\131\5\131\4\29\130\4\29\156\4\29\29\130\5\131\29\5\136\10\134\29\136\17\134\29\156\4\10\10\17\156\4\130\10\159\29\135\4\21\155\4\5\5\131\29\132\10\134\17\136\29\181\4\130\29\134\17\149\4\29\29\135\10\146\4\132\29\135\10\145\4\134\29\131\17\139\29\134\10\207\29\200\4\182\29\178\0\140\29\178\1\134\29\133\10\163\4\131\5\135\29\137\8\133\29\137\8\131\4\3\4\149\0\130\29\132\5\12\3\149\1\135\29\18\18\129\207\29\158\10\29\169\4\29\5\5\12\29\29\4\4\143\29\130\4\3\4\4\135\29\17\135\21\160\29\133\5\156\4\137\10\4\135\29\149\4\138\5\131\10\132\17\149\29\145\4\131\5\131\17\165\29\148\4\134\10\147\29\150\4\136\29\6\5\6\180\4\142\5\134\17\131\29\147\10\137\8\5\4\4\5\5\4\136\29\130\5\6\172\4\130\6\131\5\6\6\5\5\17\17\26\131\17\5\137\29\26\29\29\152\4\134\29\137\8\133\29\130\5\163\4\132\5\6\135\5\29\137\8\131\17\4\6\6\4\135\29\162\4\5\17\17\4\136\29\5\5\6\175\4\130\6\136\5\6\6\131\4\131\17\131\5\17\6\5\137\8\4\17\4\130\17\29\147\10\138\29\145\4\29\152\4\130\6\130\5\6\6\5\6\5\5\133\17\5\4\4\5\189\29\134\4\29\4\29\131\4\29\142\4\29\137\4\17\133\29\174\4\5\130\6\135\5\132\29\137\8\133\29\5\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\4\29\132\4\29\5\5\4\6\6\5\131\6\29\29\6\6\29\29\130\6\29\29\4\133\29\6\132\29\132\4\6\6\29\29\134\5\130\29\132\5\138\29\137\4\29\4\29\29\4\29\165\4\29\4\130\6\133\5\29\6\29\29\6\29\131\6\29\6\6\5\6\5\4\5\4\17\17\29\17\17\135\29\5\5\156\29\180\4\130\6\135\5\6\6\130\5\6\5\131\4\132\17\137\8\17\17\29\17\5\130\4\157\29\175\4\130\6\133\5\6\5\131\6\5\5\6\5\5\4\4\17\4\135\29\137\8\129\165\29\174\4\130\6\131\5\29\29\131\6\5\5\6\5\5\150\17\131\4\5\5\161\29\175\4\130\6\135\5\6\6\5\6\5\5\130\17\4\138\29\137\8\133\29\140\17\146\29\170\4\5\6\5\6\6\133\5\6\5\4\17\133\29\137\8\133\29\147\8\155\29\154\4\29\29\5\6\5\6\6\131\5\6\132\5\131\29\137\8\10\10\130\17\21\134\4\129\184\29\171\4\130\6\136\5\6\5\5\17\227\29\159\0\159\1\137\8\136\10\139\29\135\4\29\29\4\29\29\135\4\29\4\4\29\151\4\133\6\29\6\6\29\29\5\5\6\5\4\6\4\6\5\130\17\136\29\137\8\197\29\135\4\29\29\166\4\130\6\131\5\29\29\5\5\131\6\5\4\17\4\6\154\29\4\137\5\167\4\133\5\6\4\131\5\135\17\5\135\29\4\133\5\6\6\130\5\173\4\140\5\6\5\5\130\17\4\132\17\140\29\200\4\134\29\137\17\213\29\5\6\130\5\6\5\6\215\29\160\4\17\141\29\137\8\133\29\136\4\29\164\4\6\134\5\29\133\5\6\5\4\132\17\137\29\137\8\146\10\130\29\17\17\157\4\29\29\149\5\29\6\134\5\6\5\5\6\5\5\200\29\134\4\29\4\4\29\165\4\133\5\130\29\5\29\5\5\29\134\5\4\5\135\29\137\8\133\29\133\4\29\4\4\29\159\4\132\6\29\5\5\29\6\6\5\6\5\4\134\29\137\8\133\29\168\4\3\4\4\131\29\137\8\129\245\29\146\4\5\5\6\6\17\17\134\29\5\5\4\6\140\4\29\161\4\6\6\132\5\130\29\6\6\5\6\5\140\17\137\8\5\212\29\4\142\29\148\10\135\21\131\19\144\21\140\29\17\135\153\4\229\29\238\9\29\132\17\138\29\129\195\4\148\203\29\224\4\17\17\140\29\136\175\4\143\26\5\133\4\142\5\137\29\159\154\4\132\29\132\198\4\181\184\29\157\4\139\5\130\6\130\5\137\8\141\197\29\132\184\4\134\29\158\4\29\137\8\131\29\17\17\206\4\29\137\8\133\29\157\4\29\29\132\5\17\137\29\175\4\134\5\132\17\131\21\131\3\17\21\137\29\137\8\29\134\10\29\148\4\132\29\146\4\131\175\29\130\3\167\4\3\3\130\17\137\8\129\197\29\159\0\159\1\150\10\131\17\132\29\152\0\29\29\152\1\171\29\202\4\131\29\5\4\182\6\134\29\131\5\140\3\191\29\3\3\17\3\5\138\29\6\6\3\3\130\9\136\29\4\175\253\29\137\214\4\168\29\4\4\156\29\4\224\29\242\4\195\252\29\131\3\29\134\3\29\3\3\29\130\162\4\142\29\4\156\29\130\4\29\29\4\141\29\131\4\135\29\131\139\4\146\131\29\234\4\132\29\140\4\130\29\136\4\134\29\137\4\29\29\21\5\5\17\131\26\158\219\29\129\239\21\137\8\130\21\130\29\131\179\21\133\29\150\21\142\29\143\21\18\142\29\173\5\29\29\150\5\136\29\243\21\187\29\129\245\21\137\29\166\21\29\29\187\21\6\6\130\5\130\21\133\6\135\26\135\5\21\21\134\5\157\21\131\5\188\21\148\29\193\21\130\5\21\249\29\147\10\139\29\147\10\139\29\214\21\136\29\152\10\129\134\29\153\0\153\1\153\0\134\1\29\145\1\153\0\153\1\0\29\0\0\29\29\0\29\29\0\0\29\29\131\0\29\135\0\131\1\29\1\29\134\1\29\138\1\153\0\153\1\0\0\29\131\0\29\29\135\0\29\134\0\29\153\1\0\0\29\131\0\29\132\0\29\0\130\29\134\0\29\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\155\1\29\29\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\0\1\29\29\177\8\131\255\21\182\5\131\21\177\5\135\21\5\141\21\5\21\21\132\17\142\29\132\5\29\142\5\136\207\29\137\1\4\147\1\133\29\133\1\129\212\29\134\5\29\144\5\29\29\134\5\29\5\5\29\132\5\132\29\189\3\160\29\5\239\29\172\4\130\29\134\5\134\3\29\29\137\8\131\29\4\21\130\191\29\157\4\5\144\29\171\4\131\5\137\8\132\29\19\131\207\29\154\4\3\131\5\137\8\129\213\29\157\4\5\5\4\137\8\131\29\17\129\191\29\158\4\29\130\4\5\4\4\5\134\4\5\5\132\4\5\135\29\4\3\129\223\29\134\4\29\131\4\29\4\4\29\142\4\29\129\196\4\29\29\136\10\134\5\168\29\161\0\161\1\134\5\3\131\29\137\8\131\29\17\17\134\144\29\186\10\21\130\10\19\131\10\203\29\172\10\21\142\10\129\193\29\131\4\29\154\4\29\4\4\29\4\29\29\4\29\137\4\29\131\4\29\4\29\4\133\29\4\131\29\4\29\4\29\4\29\130\4\29\4\4\29\4\29\29\4\29\4\29\4\29\4\29\4\29\4\4\29\4\29\29\131\4\29\134\4\29\131\4\29\131\4\29\4\29\137\4\29\144\4\132\29\130\4\29\132\4\29\144\4\179\29\18\18\130\141\29\171\21\131\29\227\21\139\29\142\21\29\29\142\21\29\142\21\29\164\21\137\29\140\10\129\160\21\183\29\156\21\140\29\171\21\131\29\136\21\134\29\21\21\141\29\133\21\129\153\29\129\250\21\132\20\133\216\21\130\29\144\21\130\29\140\21\130\29\129\217\21\133\29\139\21\131\29\21\142\29\139\21\131\29\183\21\135\29\137\21\133\29\167\21\135\29\157\21\29\29\139\21\131\29\21\21\141\29\136\18\166\29\130\215\21\135\29\141\21\29\29\140\21\130\29\138\21\130\29\184\21\29\21\131\29\143\21\29\29\139\21\131\29\137\21\134\29\129\146\21\29\219\21\137\8\21\136\132\29\4\130\205\221\29\4\159\29\4\160\189\29\4\4\129\219\29\4\29\29\4\173\139\29\4\29\29\4\186\174\29\4\142\29\4\132\235\29\4\147\161\29\132\157\4\139\225\29\4\166\200\29\4\132\29\4\160\221\29\4\4\161\199\29\4\171\151\134\29\26\157\29\223\26\255\29\129\239\5\131\252\143\29\28\131\255\251\29\28\29\29\28\131\255\251\29\28"+ ("\159\25\22\130\17\19\130\17\13\14\17\18\17\12\17\17\137\8\17\17\130\18\17\17\153\0\13\17\14\20\11\20\153\1\13\18\14\18\160\25\22\17\131\19\21\17\20\21\4\15\18\26\21\20\21\18\10\10\20\1\17\17\20\10\4\16\130\10\17\150\0\18\134\0\151\1\18\135\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\0\1\0\1\0\130\1\0\0\1\0\1\0\0\1\130\0\1\1\131\0\1\0\0\1\130\0\130\1\0\0\1\0\0\1\0\1\0\1\0\0\1\0\1\1\0\1\0\0\1\130\0\1\0\1\0\0\1\1\4\0\130\1\131\4\0\2\1\0\2\1\0\2\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\2\1\0\1\130\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\134\1\0\0\1\0\0\1\1\0\1\131\0\1\0\1\0\1\0\1\0\196\1\4\4\153\1\145\3\131\20\139\3\141\20\132\3\134\20\3\20\3\144\20\239\5\0\1\0\1\3\20\0\1\29\29\3\130\1\17\0\131\29\20\20\0\17\130\0\29\0\29\0\0\1\144\0\29\136\0\162\1\0\1\1\130\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\132\1\0\1\18\0\1\0\0\1\1\178\0\175\1\0\1\0\1\0\1\0\1\0\1"::ByteString) <>+ ("\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\21\132\5\7\7\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\29\165\0\29\3\3\133\17\168\1\17\12\3\3\21\21\19\29\172\5\12\5\17\5\5\17\5\5\17\130\5\133\29\154\4\131\29\131\4\17\17\138\29\133\26\130\18\17\17\19\17\17\21\21\138\5\17\26\130\17\159\4\3\137\4\148\5\137\8\131\17\4\4\5\226\4\17\4\134\5\26\21\133\5\3\3\5\5\21\131\5\4\4\137\8\130\4\21\21\4\141\17\29\26\4\5\157\4\154\5\29\29\216\4\138\5\4\141\29\137\8\160\4\136\5\3\3\21\130\17\3\29\29\5\19\19\149\4\131\5\3\136\5\3\130\5\3\132\5\29\29\142\17\29\152\4\130\5\29\29\17\29\138\4\132\29\151\4\20\134\4\26\26\132\29\136\5\168\4\3\151\5\26\159\5\6\181\4\5\6\5\4\130\6\135\5\131\6\5\6\6\4\134\5\137\4\5\5\17\17\137\8\17\3\142\4\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\130\29\131\4\29\29\5\4\130\6\131\5\29\29\6\6\29\29\6\6\5\4\135\29\6\131\29\4\4\29\130\4\5\5\29\29\137\8\4\4\19\19\133\10\21\19\4\17\5\29\29\5\5\6\29\133\4\131\29\4\4\29\29\149\4\29\134\4\29\4\4\29\4\4\29\4\4\29\29\5\29\130"::ByteString) <>+ ("\6\5\5\131\29\5\5\29\29\130\5\130\29\5\134\29\131\4\29\4\134\29\137\8\5\5\130\4\5\17\137\29\5\5\6\29\136\4\29\130\4\29\149\4\29\134\4\29\4\4\29\132\4\29\29\5\4\130\6\132\5\29\5\5\6\29\6\6\5\29\29\4\142\29\4\4\5\5\29\29\137\8\17\19\134\29\4\133\5\29\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\4\29\132\4\29\29\5\4\6\5\6\131\5\29\29\6\6\29\29\6\6\5\132\29\131\5\6\131\29\4\4\29\130\4\5\5\29\29\137\8\21\4\133\10\137\29\5\4\29\133\4\130\29\130\4\29\131\4\130\29\4\4\29\4\29\4\4\130\29\4\4\130\29\130\4\130\29\139\4\131\29\6\6\5\6\6\130\29\130\6\29\130\6\5\29\29\4\133\29\6\141\29\137\8\130\10\133\21\19\21\132\29\5\130\6\5\135\4\29\130\4\29\150\4\29\143\4\29\29\5\4\130\5\131\6\29\130\5\29\131\5\134\29\5\5\29\130\4\29\4\4\29\29\4\4\5\5\29\29\137\8\134\29\17\134\10\21\4\5\6\6\17\135\4\29\130\4\29\150\4\29\137\4\29\132\4\29\29\5\4\6\5\132\6\29\5\6\6\29\6\6\5\5\134\29\6\6\132\29\130\4\29\4\4\5\5\29\29\137\8\29\4\4\6\139\29\5\5\6\6\136\4\29\130\4\29\168\4\5\5\4\130\6\131\5\29\130\6\29\130\6\5\4\21\131\29\130\4\6\134\10\130\4\5\5\29\29\137\8\136\10\21\133\4\29\5\6\6\29\145\4\130\29\151\4\29\136\4\29\4\29\29\134\4\130\29\5\131\29\130\6\130\5\29\5\29\135\6\133\29\137\8\29\29\6\6\17\139\29\175\4\5\4\4\134\5\131\29\19\133\4\3\135\5\17\137\8\17\17\164\29\4\4\29\4\29\132\4\29\151\4\29\4\29\137\4\5\4\4\136\5\4\29\29\132\4\29\3\29\134\5\29\137\8\29\29\131\4\159\29\4\130\21\142\17\21\17\130\21\5\5\133\21\137\8\137\10\21\5\21\5\21\5"::ByteString) <>+ ("\13\14\13\14\6\6\135\4\29\163\4\131\29\141\5\6\132\5\17\5\5\132\4\138\5\29\163\5\29\135\21\5\133\21\29\21\21\132\17\131\21\17\17\164\29\170\4\6\6\131\5\6\133\5\6\5\5\6\6\5\5\4\137\8\133\17\133\4\6\6\5\5\131\4\130\5\4\130\6\4\4\134\6\130\4\131\5\140\4\5\6\6\5\5\133\6\5\4\6\137\8\130\6\5\21\21\165\0\29\0\132\29\0\29\29\170\1\17\3\130\1\130\200\4\29\131\4\29\29\134\4\29\4\29\131\4\29\29\168\4\29\131\4\29\29\160\4\29\131\4\29\29\134\4\29\4\29\131\4\29\29\142\4\29\184\4\29\131\4\29\29\194\4\29\29\130\5\136\17\147\10\130\29\143\4\137\21\133\29\213\0\29\29\133\1\29\29\12\132\235\4\21\17\144\4\22\153\4\13\14\130\29\202\4\130\17\130\9\135\4\134\29\145\4\130\5\6\136\29\146\4\5\5\6\17\17\136\29\145\4\5\5\139\29\140\4\29\130\4\29\5\5\139\29\179\4\5\5\6\134\5\135\6\5\6\6\138\5\130\17\3\130\17\19\4\5\29\29\137\8\133\29\137\10\133\29\133\17\12\131\17\130\5\26\5\137\8\133\29\162\4\3\180\4\134\29\132\4\5\5\161\4\5\4\132\29\197\4\137\29\158\4\29\130\5\131\6\5\5\130\6\131\29\6\6\5\133\6\130\5\131\29\21\130\29\17\17\137\8\157\4\29\29\132\4\138\29\171\4\131\29\153\4\133\29\137\8\10\130\29\161\21\150\4\5\5\6\6\5\29\29\17\17\180\4\6\5\6\134\5\29\5\6\5\6\6\135\5\133\6\137\5\29\29\5\137\8\133\29\137\8\133\29\134\17\3\133\17\29\29\141\5\7\177\5\142\29\131\5\6\174\4\5\6\132\5\6\5\132\6\5\6\6\135\4\29\17\17\137\8\134\17\137\21\136\5\136\21\130\17\5\5\6\157\4\6\131\5\6\6\5\5\6\130\5\4\4\137\8\171\4\5\6\5\5\130\6\5\6\130\5\6\6\135\29\131\17\163\4\135\6\135\5\6\6\5\5\130\29\132\17\137"::ByteString) <>+ ("\8\130\29\130\4\137\8\157\4\133\3\17\17\136\1\0\1\132\29\170\0\29\29\130\0\135\17\135\29\130\5\17\140\5\6\134\5\131\4\5\133\4\5\4\4\6\5\5\4\132\29\171\1\190\3\140\1\3\161\1\164\3\191\5\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\136\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\136\1\135\0\133\1\29\29\133\0\29\29\135\1\135\0\135\1\135\0\133\1\29\29\133\0\29\29\135\1\29\0\29\0\29\0\29\0\135\1\135\0\141\1\29\29\135\1\135\2\135\1\135\2\135\1\135\2\132\1\29\1\1\131\0\2\20\1\130\20\130\1\29\1\1\131\0\2\130\20\131\1\29\29\1\1\131\0\29\130\20\135\1\132\0\130\20\29\29\130\1\29\1\1\131\0\2\20\20\29\138\22\132\26\133\12\17\17\15\16\13\15\15\16\13\15\135\17\23\24\132\26\22\136\17\15\16\131\17\11\11\130\17\18\13\14\138\17\18\17\11\137\17\22\132\26\29\137\26\10\3\29\29\133\10\130\18\13\14\3\137\10\130\18\13\14\144\3\164\19\138\29\140\5\131\7\5\130\7\139\5\142\29\21\21\0\131\21\0\21"::ByteString) <>+ ("\21\1\130\0\1\1\130\0\1\21\0\21\21\18\132\0\133\21\0\21\0\21\0\21\131\0\21\1\131\0\1\131\4\1\21\21\1\1\0\0\132\18\0\131\1\21\18\21\21\1\21\143\10\162\9\0\1\131\9\10\21\21\131\29\132\18\132\21\18\18\131\21\18\21\21\18\21\21\18\134\21\18\158\21\18\18\21\21\18\21\18\158\21\130\139\18\135\21\13\14\13\14\147\21\18\18\134\21\13\14\208\21\18\157\21\152\18\167\21\133\18\199\21\149\29\138\21\148\29\187\10\205\21\149\10\129\182\21\18\136\21\18\181\21\135\18\238\21\18\129\247\21\13\14\13\14\13\14\13\14\13\14\13\14\13\14\157\10\171\21\132\18\13\14\158\18\13\14\13\14\13\14\13\14\13\14\143\18\129\255\21\129\130\18\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\190\18\13\14\13\14\159\18\13\14\130\129\18\175\21\148\18\21\21\133\18\166\21\29\29\129\137\21\175\0\175\1\0\1\130\0\1\1\0\1\0\1\0\1\131\0\1\0\1\1\0\133\1\3\3\130\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\1\133\21\0\1\0\1\130\5\0\1\132\29\131\17\10\17\17\165\1\29\1\132\29\1\29\29\183\4\134\29\3\17\141\29\5\150\4\136\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\134\4\29\159\5\17\17\15\16\15\16\130\17\15\16\17\15\16\136\17\12\17\17\12\17\15\16\17\17\15\16\13\14\13\14\13\14\13\14\132\17\3\137\17\12\12\131\17\12\17\13\140\17\21\21\130\17\13\14\13\14\13\14\13\14\12\29\29\17\17\13\14\155\29\153\21\29\216\21"::ByteString) <>+ ("\139\29\129\213\21\153\29\143\21\22\130\17\21\3\4\9\13\14\13\14\13\14\13\14\13\14\21\21\13\14\13\14\13\14\13\14\12\13\14\14\21\136\9\131\5\6\6\12\132\3\21\21\130\9\3\4\17\21\21\29\213\4\29\29\5\5\20\20\3\3\4\12\217\4\17\130\3\4\132\29\170\4\29\221\4\29\21\21\131\10\137\21\159\4\165\21\136\29\21\143\4\158\21\29\137\10\157\21\135\10\21\142\10\159\21\137\10\166\21\142\10\130\191\21\4\179\189\29\4\191\21\4\129\163\253\29\149\4\3\136\246\4\130\29\182\21\136\29\167\4\133\3\17\17\130\139\4\3\130\17\143\4\137\8\4\4\147\29\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\4\5\130\7\17\137\5\17\3\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\3\3\5\5\197\4\137\9\5\5\133\17\135\29\150\20\136\3\20\20\0\1\0\1\0\1\0\1\0\1\0\1\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\3\135\1\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\3\20\20\0\1\0\1\4\0\1\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\132\0\1\132\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\131\0\1\0\1\0\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\0\131\29\0\141\29\131\3\0\1\4\3\3\1\134\4\5\130\4\5\131\4\5\150\4\6\6\5\5\6\131\21\5\130\29\133\10\21\21\19\21\133\29\179\4\131\17\135\29\6\6\177\4\143\6\5\5\135\29\17\17\137\8\133\29\145\5\133\4\130"::ByteString) <>+ ("\17\4\17\4\4\5\137\8\155\4\135\5\17\17\150\4\138\5\6\6\138\29\17\156\4\130\29\130\5\6\174\4\5\6\6\131\5\6\6\5\5\130\6\140\17\29\3\137\8\131\29\17\17\132\4\5\3\136\4\137\8\132\4\29\168\4\133\5\6\6\5\5\6\6\5\5\136\29\130\4\5\135\4\5\6\29\29\137\8\29\29\131\17\143\4\3\133\4\130\21\4\6\5\6\177\4\5\4\130\5\4\4\5\5\132\4\5\5\4\5\4\151\29\4\4\3\17\17\138\4\6\5\5\6\6\17\17\4\3\3\6\5\137\29\133\4\29\29\133\4\29\29\133\4\136\29\134\4\29\134\4\29\170\1\20\131\3\136\1\3\20\20\0\0\29\29\207\1\162\4\6\6\5\6\6\5\6\6\17\6\5\29\29\137\8\133\29\4\215\161\29\4\139\29\150\4\131\29\176\4\131\29\27\134\253\29\27\27\253\29\27\27\135\253\29\27\28\177\253\29\28\130\237\4\29\29\233\4\165\29\134\1\139\29\132\1\132\29\4\5\137\4\18\140\4\29\132\4\29\4\29\4\4\29\4\4\29\235\4\144\20\143\21\130\234\4\14\13\143\21\191\4\21\21\181\4\135\21\159\29\139\4\19\130\21\143\5\134\17\13\14\17\133\29\143\5\17\12\12\11\11\13\14\13\14\13\14\13\14\13\14\13\14\13\14\13\14\17\17\13\14\131\17\130\11\130\17\29\131\17\12\13\14\13\14\13\14\130\17\18\12\130\18\29\17\19\17\17\131\29\132\4\29\129\134\4\29\29\26\29\130\17\19\130\17\13\14\17\18\17\12\17\17\137\8\17\17\130\18\17\17\153\0\13\17\14\20\11\20\153\1\13\18\14\18\13\14\17\13\14\17\17\137\4\3\172\4\3\3\158\4\130\29\133\4\29\29\133\4\29\29\133\4\29\29\130\4\130\29\19\19\18\20\21\19\19\29\21\131\18\21\21\137\29\130\26\21\21\29\29\139\4\29\153\4\29\146\4\29\4\4\29\142\4\29\29\141\4\161\29\250\4\132\29\130\17\131\29\172\10\130\29\136\21\180\9\131\10\144\21\10\10\130\21\29\140\21\130\29\21\174\29"::ByteString) <>+ ("\172\21\5\129\129\29\156\4\130\29\176\4\142\29\5\154\10\131\29\159\4\131\10\136\29\147\4\9\135\4\9\132\29\165\4\132\5\132\29\157\4\29\17\163\4\131\29\135\4\17\132\9\169\29\167\0\167\1\205\4\29\29\137\8\133\29\163\0\131\29\163\1\131\29\167\4\135\29\179\4\138\29\17\138\0\29\142\0\29\134\0\29\0\0\29\138\1\29\142\1\29\134\1\29\1\1\130\29\179\4\139\29\130\182\4\136\29\149\4\137\29\135\4\151\29\133\3\29\169\3\29\141\3\191\29\133\4\29\29\4\29\171\4\29\4\4\130\29\4\29\29\150\4\29\17\135\10\150\4\21\21\134\10\158\4\135\29\136\10\175\29\146\4\29\4\4\132\29\132\10\149\4\133\10\130\29\17\153\4\132\29\17\153\4\165\29\183\4\131\29\10\10\4\4\143\10\29\29\173\10\4\130\5\29\5\5\132\29\131\5\131\4\29\130\4\29\156\4\29\29\130\5\131\29\5\136\10\134\29\136\17\134\29\156\4\10\10\17\156\4\130\10\159\29\135\4\21\155\4\5\5\131\29\132\10\134\17\136\29\181\4\130\29\134\17\149\4\29\29\135\10\146\4\132\29\135\10\145\4\134\29\131\17\139\29\134\10\207\29\200\4\182\29\178\0\140\29\178\1\134\29\133\10\163\4\131\5\135\29\137\8\133\29\137\8\131\4\3\4\149\0\130\29\132\5\12\3\149\1\135\29\18\18\129\207\29\158\10\29\169\4\29\5\5\12\29\29\4\4\143\29\130\4\3\4\4\29\20\20\132\5\17\135\21\149\4\29\143\5\156\4\137\10\4\135\29\149\4\138\5\131\10\132\17\149\29\145\4\131\5\131\17\165\29\148\4\134\10\147\29\150\4\136\29\6\5\6\180\4\142\5\134\17\131\29\147\10\137\8\5\4\4\5\5\4\136\29\130\5\6\172\4\130\6\131\5\6\6\5\5\17\17\26\131\17\5\137\29\26\29\29\152\4\134\29\137\8\133\29\130\5\163\4\132\5\6\135\5\29\137\8\131\17\4\6\6\4\135\29\162\4\5\17\17\4\136\29\5\5\6\175\4\130\6\136\5\6\6\131\4\131\17"::ByteString) <>+ ("\131\5\17\6\5\137\8\4\17\4\130\17\29\147\10\138\29\145\4\29\152\4\130\6\130\5\6\6\5\6\5\5\133\17\5\4\4\5\189\29\134\4\29\4\29\131\4\29\142\4\29\137\4\17\133\29\174\4\5\130\6\135\5\132\29\137\8\133\29\5\5\6\6\29\135\4\29\29\4\4\29\29\149\4\29\134\4\29\4\4\29\132\4\29\5\5\4\6\6\5\131\6\29\29\6\6\29\29\130\6\29\29\4\133\29\6\132\29\132\4\6\6\29\29\134\5\130\29\132\5\138\29\137\4\29\4\29\29\4\29\165\4\29\4\130\6\133\5\29\6\29\29\6\29\131\6\29\6\6\5\6\5\4\5\4\17\17\29\17\17\135\29\5\5\156\29\180\4\130\6\135\5\6\6\130\5\6\5\131\4\132\17\137\8\17\17\29\17\5\130\4\157\29\175\4\130\6\133\5\6\5\131\6\5\5\6\5\5\4\4\17\4\135\29\137\8\129\165\29\174\4\130\6\131\5\29\29\131\6\5\5\6\5\5\150\17\131\4\5\5\161\29\175\4\130\6\135\5\6\6\5\6\5\5\130\17\4\138\29\137\8\133\29\140\17\146\29\170\4\5\6\5\6\6\133\5\6\5\4\17\133\29\137\8\133\29\147\8\155\29\154\4\29\29\5\6\5\6\6\131\5\6\132\5\131\29\137\8\10\10\130\17\21\134\4\129\184\29\171\4\130\6\136\5\6\5\5\17\227\29\159\0\159\1\137\8\136\10\139\29\135\4\29\29\4\29\29\135\4\29\4\4\29\151\4\133\6\29\6\6\29\29\5\5\6\5\4\6\4\6\5\130\17\136\29\137\8\197\29\135\4\29\29\166\4\130\6\131\5\29\29\5\5\131\6\5\4\17\4\6\154\29\4\137\5\167\4\133\5\6\4\131\5\135\17\5\135\29\4\133\5\6\6\130\5\173\4\140\5\6\5\5\130\17\4\132\17\140\29\200\4\134\29\137\17\4\212\29\5\6\130\5\6\5\6\215\29\160\4\17\141\29\137\8\133\29\136\4\29\164\4\6\134\5\29\133\5\6\5\4\132\17\137\29\137\8\146\10\130\29\17\17\157\4\29\29\149\5\29\6\134\5"::ByteString) <>+ ("\6\5\5\6\5\5\200\29\134\4\29\4\4\29\165\4\133\5\130\29\5\29\5\5\29\134\5\4\5\135\29\137\8\133\29\133\4\29\4\4\29\159\4\132\6\29\5\5\29\6\6\5\6\5\4\134\29\137\8\133\29\168\4\3\4\4\131\29\137\8\133\29\5\4\129\237\29\146\4\5\5\6\6\17\17\134\29\5\5\4\6\140\4\29\161\4\6\6\132\5\130\29\6\6\5\6\5\140\17\137\8\5\212\29\4\142\29\148\10\135\21\131\19\144\21\140\29\17\135\153\4\229\29\239\9\132\17\138\9\129\195\4\139\29\130\182\9\146\136\29\224\4\17\17\140\29\136\175\4\143\26\5\133\4\142\5\137\29\159\154\4\132\29\132\198\4\181\184\29\157\4\139\5\130\6\130\5\137\8\141\197\29\132\184\4\134\29\158\4\29\137\8\131\29\17\17\206\4\29\137\8\133\29\157\4\29\29\132\5\17\137\29\175\4\134\5\132\17\131\21\131\3\17\21\137\29\137\8\29\134\10\29\148\4\132\29\146\4\131\175\29\130\3\167\4\3\3\130\17\137\8\129\197\29\159\0\159\1\150\10\131\17\132\29\152\0\29\29\152\1\171\29\202\4\131\29\5\4\182\6\134\29\131\5\140\3\191\29\3\3\17\3\5\138\29\6\6\3\3\130\9\136\29\4\175\253\29\137\219\4\163\29\4\4\158\29\4\222\29\242\4\140\29\4\135\143\29\4\141\29\178\4\188\156\29\131\3\29\134\3\29\3\3\29\130\168\4\136\29\4\156\29\130\4\29\29\4\141\29\132\4\134\29\131\139\4\146\131\29\234\4\132\29\140\4\130\29\136\4\134\29\137\4\29\29\21\5\5\17\131\26\158\219\29\129\239\21\137\8\130\21\130\29\131\179\21\133\29\150\21\29\130\21\135\29\130\18\143\21\141\18\29\29\173\5\29\29\150\5\136\29\243\21\187\29\129\245\21\137\29\166\21\5\5\187\21\6\6\130\5\130\21\133\6\135\26\135\5\21\21\134\5\157\21\131\5\129\147\21\130\5\21\137\29\130\6\135\21\5\5\21\21\6\159\21\6\6\189\29\147\10\139\29\147\10\139\29\214\21\136\29\152"::ByteString) <>+ ("\10\129\134\29\153\0\153\1\153\0\134\1\29\145\1\153\0\153\1\0\29\0\0\29\29\0\29\29\0\0\29\29\131\0\29\135\0\131\1\29\1\29\134\1\29\138\1\153\0\153\1\0\0\29\131\0\29\29\135\0\29\134\0\29\153\1\0\0\29\131\0\29\132\0\29\0\130\29\134\0\29\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\153\1\153\0\156\1\29\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\152\0\18\152\1\18\133\1\0\1\29\29\177\8\131\255\21\182\5\131\21\177\5\135\21\5\141\21\5\21\21\132\17\142\29\132\5\29\142\5\207\29\156\18\135\226\29\137\1\4\180\1\0\134\1\0\1\0\1\1\0\130\1\0\149\1\0\1\0\1\0\1\0\130\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\4\4\141\29\134\1\181\29\178\3\134\5\29\144\5\29\29\134\5\29\5\5\29\132\5\132\29\189\3\160\29\5\239\29\172\4\130\29\134\5\134\3\29\29\137\8\131\29\4\21\130\191\29\157\4\5\144\29\171\4\131\5\137\8\132\29\19\131\207\29\154\4\3\131\5\137\8\129\213\29\157\4\5\5\4\137\8\131\29\17\129\191\29\158\4\29\130\4\5\4\4\5\134\4\5\5\132\4\5\135\29\4\3\129\223\29\134\4\29\131\4\29\4\4\29\142\4\29\129\196\4\29\29\136\10\134\5\168\29\161\0\161\1\134\5\3\131\29\137\8\131\29\17\17\134\144\29\186\10\21\130\10\19\131\10\203\29\172\10\21\142\10\129\193\29\131\4\29\154\4\29\4\4\29\4\29\29\4\29\137\4\29\131\4\29\4\29\4\133\29\4\131\29\4\29\4\29\4\29\130\4\29\4\4\29\4\29\29\4\29\4\29\4\29\4\29\4\29\4\4\29\4\29\29\131\4\29\134\4\29\131\4\29\131\4\29\4\29\137\4\29\144\4\132\29\130\4\29\132\4\29\144\4\179\29\18\18\130\141\29\171\21\131\29\227\21\139\29\142\21\29\29\142"::ByteString) <>+ ("\21\29\142\21\29\164\21\137\29\140\10\129\161\21\182\29\156\21\140\29\171\21\131\29\136\21\134\29\21\21\141\29\133\21\129\153\29\129\250\21\132\20\133\217\21\29\29\144\21\130\29\140\21\130\29\129\219\21\131\29\139\21\131\29\155\21\131\29\183\21\135\29\137\21\133\29\167\21\135\29\157\21\29\29\139\21\131\29\21\21\141\29\136\18\166\29\130\215\21\135\29\141\21\29\29\140\21\130\29\198\21\29\21\130\29\145\21\29\140\21\130\29\139\21\132\29\129\146\21\29\219\21\137\8\21\136\132\29\4\130\205\221\29\4\159\29\4\160\189\29\4\4\129\220\29\4\29\4\173\139\29\4\29\29\4\186\174\29\4\142\29\4\132\235\29\4\147\161\29\132\157\4\139\225\29\4\166\200\29\4\132\29\4\160\221\29\4\4\161\199\29\4\130\183\133\29\4\216\189\29\4\168\135\192\29\26\157\29\223\26\255\29\129\239\5\131\252\143\29\28\131\255\251\29\28\29\29\28\131\255\251\29\28"::ByteString) tcTable :: [(Int, Int, Int)] tcTable =- [(97,25,63),(84,0,1486),(43,22,63),(24,6,63),(7,0,242),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,463),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(1,0,599),(1,0,390),(3,0,1),(2,0,1),(3,0,1),(4,0,1),(6,0,1),(3,0,194),(4,0,1),(1,0,326),(1,0,85122),(3,0,260),(3,0,1),(2,0,1),(2,0,1),(3,0,1),(5,0,1),(3,0,1),(4,0,1),(2,0,1),(3,0,1),(4,0,1),(2,0,112),(5,0,2),(1,0,0),(1,0,1),(1,0,2),(1,0,0),(1,0,1),(1,0,2),(1,0,0),(1,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,157),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,2),(1,0,0),(1,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(3,1,21630),(3,0,1),(5,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,21566),(1,0,21560),(1,0,21564),(1,0,419),(1,0,411),(2,1,409),(3,0,403),(2,0,405),(1,0,84638),(4,0,409),(1,0,84630),(2,0,413),(1,0,84686),(1,0,84560),(1,0,84616),(2,0,417),(1,0,421),(1,0,84616),(1,0,21486),(1,0,84610),(3,0,421),(2,0,21498),(1,0,425),(3,0,427),(8,0,21454),(3,0,435),(2,0,84614),(1,0,435),(4,0,84564),(1,0,435),(1,0,137),(1,1,433),(2,0,141),(6,0,437),(11,0,84522),(1,0,84516),(167,0,168),(44,0,1),(2,0,1),(4,0,1),(4,2,260),(49,0,75),(1,2,73),(4,16,63),(17,0,61),(1,8,63),(9,0,127),(1,1,125),(3,0,123),(1,0,113),(4,0,93),(1,0,107),(1,0,15),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,171),(1,0,159),(1,0,14),(1,0,231),(2,0,191),(3,0,1),(3,0,1),(53,31,63),(32,15,159),(17,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(10,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,29),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(50,37,95),(2927,42,0),(45,2,0),(763,5,15),(2184,0,12507),(1,0,12505),(1,0,12487),(1,1,12483),(2,0,12485),(1,0,12471),(1,0,12361),(1,0,70532),(2,0,1),(239,0,70664),(4,0,7628),(17,0,70768),(115,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(6,0,117),(6,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,7,16),(16,5,16),(16,7,16),(16,7,16),(16,5,16),(17,0,16),(2,0,16),(2,0,16),(2,0,16),(9,7,16),(16,1,148),(2,3,172),(4,1,200),(2,1,256),(2,1,224),(2,1,252),(4,7,16),(16,7,16),(16,7,16),(16,1,16),(3,0,18),(11,0,14409),(5,0,18),(13,1,16),(16,1,16),(5,0,14),(14,0,18),(347,0,55),(34,15,31),(20,0,1),(844,25,51),(1888,47,95),(49,0,1),(4,0,21589),(1,0,21583),(2,0,1),(2,0,1),(2,0,1),(7,0,1),(3,0,1),(11,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(2,0,1),(5,0,1),(13,37,14527),(39,0,14527),(6,0,14527),(30996,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(20,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(136,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(11,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(5,0,1),(2,0,1),(1,0,96),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(12,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(27,0,1),(861,0,1855),(29,79,77727),(21457,25,63),(1255,39,79),(176,35,79),(191,10,77),(12,14,77),(16,6,77),(8,1,77),(1797,50,127),(176,21,63),(2896,31,63),(21920,31,63),(91,24,53),(31335,33,67)]+ [(97,25,63),(84,0,1486),(43,22,63),(24,6,63),(7,0,242),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,463),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(1,0,599),(1,0,390),(3,0,1),(2,0,1),(3,0,1),(4,0,1),(6,0,1),(3,0,194),(4,0,1),(1,0,326),(1,0,85122),(3,0,260),(3,0,1),(2,0,1),(2,0,1),(3,0,1),(5,0,1),(3,0,1),(4,0,1),(2,0,1),(3,0,1),(4,0,1),(2,0,112),(5,0,2),(1,0,0),(1,0,1),(1,0,2),(1,0,0),(1,0,1),(1,0,2),(1,0,0),(1,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,157),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,2),(1,0,0),(1,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(3,1,21630),(3,0,1),(5,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,21566),(1,0,21560),(1,0,21564),(1,0,419),(1,0,411),(2,1,409),(3,0,403),(2,0,405),(1,0,84638),(4,0,409),(1,0,84630),(2,0,413),(1,0,84686),(1,0,84560),(1,0,84616),(2,0,417),(1,0,421),(1,0,84616),(1,0,21486),(1,0,84610),(3,0,421),(2,0,21498),(1,0,425),(3,0,427),(2,0,84684),(5,0,84684),(1,0,21454),(3,0,435),(2,0,84614),(1,0,435),(4,0,84564),(1,0,435),(1,0,137),(1,1,433),(2,0,141),(6,0,437),(11,0,84522),(1,0,84516),(167,0,168),(44,0,1),(2,0,1),(4,0,1),(4,2,260),(49,0,75),(1,2,73),(4,16,63),(17,0,61),(1,8,63),(9,0,127),(1,1,125),(3,0,123),(1,0,113),(4,0,93),(1,0,107),(1,0,15),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,171),(1,0,159),(1,0,14),(1,0,231),(2,0,191),(3,0,1),(3,0,1),(53,31,63),(32,15,159),(17,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(10,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,29),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(50,37,95),(2927,42,0),(45,2,0),(763,5,15),(2184,0,12507),(1,0,12505),(1,0,12487),(1,1,12483),(2,0,12485),(1,0,12471),(1,0,12361),(1,0,70532),(2,0,1),(239,0,70664),(4,0,7628),(17,0,70768),(115,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(6,0,117),(6,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,7,16),(16,5,16),(16,7,16),(16,7,16),(16,5,16),(17,0,16),(2,0,16),(2,0,16),(2,0,16),(9,7,16),(16,1,148),(2,3,172),(4,1,200),(2,1,256),(2,1,224),(2,1,252),(4,7,16),(16,7,16),(16,7,16),(16,1,16),(3,0,18),(11,0,14409),(5,0,18),(13,1,16),(16,1,16),(5,0,14),(14,0,18),(347,0,55),(34,15,31),(20,0,1),(844,25,51),(1888,47,95),(49,0,1),(4,0,21589),(1,0,21583),(2,0,1),(2,0,1),(2,0,1),(7,0,1),(3,0,1),(11,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(2,0,1),(5,0,1),(13,37,14527),(39,0,14527),(6,0,14527),(30996,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(20,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(136,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(11,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(5,0,1),(2,0,1),(1,0,96),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(12,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(27,0,1),(853,1,66),(8,0,1855),(29,79,77727),(21457,25,63),(1255,39,79),(176,35,79),(191,10,77),(12,14,77),(16,6,77),(8,1,77),(1797,50,127),(176,21,63),(2896,31,63),(21920,31,63),(91,24,53),(28806,0,1),(8,0,1),(2,0,1),(3,0,1),(4,0,1),(23,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2467,33,67)] ucTable :: [(Int, Int, Int)] ucTable =- [(97,25,63),(84,0,1486),(43,22,63),(24,6,63),(7,0,242),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,463),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(1,0,599),(1,0,390),(3,0,1),(2,0,1),(3,0,1),(4,0,1),(6,0,1),(3,0,194),(4,0,1),(1,0,326),(1,0,85122),(3,0,260),(3,0,1),(2,0,1),(2,0,1),(3,0,1),(5,0,1),(3,0,1),(4,0,1),(2,0,1),(3,0,1),(4,0,1),(2,0,112),(6,0,1),(1,0,3),(2,0,1),(1,0,3),(2,0,1),(1,0,3),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,157),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(1,0,3),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(3,1,21630),(3,0,1),(5,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,21566),(1,0,21560),(1,0,21564),(1,0,419),(1,0,411),(2,1,409),(3,0,403),(2,0,405),(1,0,84638),(4,0,409),(1,0,84630),(2,0,413),(1,0,84686),(1,0,84560),(1,0,84616),(2,0,417),(1,0,421),(1,0,84616),(1,0,21486),(1,0,84610),(3,0,421),(2,0,21498),(1,0,425),(3,0,427),(8,0,21454),(3,0,435),(2,0,84614),(1,0,435),(4,0,84564),(1,0,435),(1,0,137),(1,1,433),(2,0,141),(6,0,437),(11,0,84522),(1,0,84516),(167,0,168),(44,0,1),(2,0,1),(4,0,1),(4,2,260),(49,0,75),(1,2,73),(4,16,63),(17,0,61),(1,8,63),(9,0,127),(1,1,125),(3,0,123),(1,0,113),(4,0,93),(1,0,107),(1,0,15),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,171),(1,0,159),(1,0,14),(1,0,231),(2,0,191),(3,0,1),(3,0,1),(53,31,63),(32,15,159),(17,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(10,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,29),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(50,37,95),(2927,42,6016),(45,2,6016),(763,5,15),(2184,0,12507),(1,0,12505),(1,0,12487),(1,1,12483),(2,0,12485),(1,0,12471),(1,0,12361),(1,0,70532),(2,0,1),(239,0,70664),(4,0,7628),(17,0,70768),(115,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(6,0,117),(6,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,7,16),(16,5,16),(16,7,16),(16,7,16),(16,5,16),(17,0,16),(2,0,16),(2,0,16),(2,0,16),(9,7,16),(16,1,148),(2,3,172),(4,1,200),(2,1,256),(2,1,224),(2,1,252),(4,7,16),(16,7,16),(16,7,16),(16,1,16),(3,0,18),(11,0,14409),(5,0,18),(13,1,16),(16,1,16),(5,0,14),(14,0,18),(347,0,55),(34,15,31),(20,0,1),(844,25,51),(1888,47,95),(49,0,1),(4,0,21589),(1,0,21583),(2,0,1),(2,0,1),(2,0,1),(7,0,1),(3,0,1),(11,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(2,0,1),(5,0,1),(13,37,14527),(39,0,14527),(6,0,14527),(30996,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(20,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(136,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(11,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(5,0,1),(2,0,1),(1,0,96),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(12,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(27,0,1),(861,0,1855),(29,79,77727),(21457,25,63),(1255,39,79),(176,35,79),(191,10,77),(12,14,77),(16,6,77),(8,1,77),(1797,50,127),(176,21,63),(2896,31,63),(21920,31,63),(91,24,53),(31335,33,67)]+ [(97,25,63),(84,0,1486),(43,22,63),(24,6,63),(7,0,242),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,463),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(1,0,599),(1,0,390),(3,0,1),(2,0,1),(3,0,1),(4,0,1),(6,0,1),(3,0,194),(4,0,1),(1,0,326),(1,0,85122),(3,0,260),(3,0,1),(2,0,1),(2,0,1),(3,0,1),(5,0,1),(3,0,1),(4,0,1),(2,0,1),(3,0,1),(4,0,1),(2,0,112),(6,0,1),(1,0,3),(2,0,1),(1,0,3),(2,0,1),(1,0,3),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,157),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(1,0,3),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(3,1,21630),(3,0,1),(5,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,21566),(1,0,21560),(1,0,21564),(1,0,419),(1,0,411),(2,1,409),(3,0,403),(2,0,405),(1,0,84638),(4,0,409),(1,0,84630),(2,0,413),(1,0,84686),(1,0,84560),(1,0,84616),(2,0,417),(1,0,421),(1,0,84616),(1,0,21486),(1,0,84610),(3,0,421),(2,0,21498),(1,0,425),(3,0,427),(2,0,84684),(5,0,84684),(1,0,21454),(3,0,435),(2,0,84614),(1,0,435),(4,0,84564),(1,0,435),(1,0,137),(1,1,433),(2,0,141),(6,0,437),(11,0,84522),(1,0,84516),(167,0,168),(44,0,1),(2,0,1),(4,0,1),(4,2,260),(49,0,75),(1,2,73),(4,16,63),(17,0,61),(1,8,63),(9,0,127),(1,1,125),(3,0,123),(1,0,113),(4,0,93),(1,0,107),(1,0,15),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,171),(1,0,159),(1,0,14),(1,0,231),(2,0,191),(3,0,1),(3,0,1),(53,31,63),(32,15,159),(17,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(10,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,0,29),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(50,37,95),(2927,42,6016),(45,2,6016),(763,5,15),(2184,0,12507),(1,0,12505),(1,0,12487),(1,1,12483),(2,0,12485),(1,0,12471),(1,0,12361),(1,0,70532),(2,0,1),(239,0,70664),(4,0,7628),(17,0,70768),(115,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(6,0,117),(6,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(1,7,16),(16,5,16),(16,7,16),(16,7,16),(16,5,16),(17,0,16),(2,0,16),(2,0,16),(2,0,16),(9,7,16),(16,1,148),(2,3,172),(4,1,200),(2,1,256),(2,1,224),(2,1,252),(4,7,16),(16,7,16),(16,7,16),(16,1,16),(3,0,18),(11,0,14409),(5,0,18),(13,1,16),(16,1,16),(5,0,14),(14,0,18),(347,0,55),(34,15,31),(20,0,1),(844,25,51),(1888,47,95),(49,0,1),(4,0,21589),(1,0,21583),(2,0,1),(2,0,1),(2,0,1),(7,0,1),(3,0,1),(11,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(9,0,1),(2,0,1),(5,0,1),(13,37,14527),(39,0,14527),(6,0,14527),(30996,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(20,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(136,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(11,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(5,0,1),(2,0,1),(1,0,96),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(12,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(5,0,1),(2,0,1),(3,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(27,0,1),(853,1,66),(8,0,1855),(29,79,77727),(21457,25,63),(1255,39,79),(176,35,79),(191,10,77),(12,14,77),(16,6,77),(8,1,77),(1797,50,127),(176,21,63),(2896,31,63),(21920,31,63),(91,24,53),(28806,0,1),(8,0,1),(2,0,1),(3,0,1),(4,0,1),(23,0,1),(2,0,1),(2,0,1),(2,0,1),(4,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2,0,1),(2467,33,67)] lcTable :: [(Int, Int, Int)] lcTable =- [(65,25,64),(127,22,64),(24,6,64),(40,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,397),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,241),(1,0,2),(2,0,2),(2,0,2),(4,0,420),(1,0,2),(2,0,2),(2,0,412),(1,0,2),(2,1,410),(2,0,2),(3,0,158),(1,0,404),(1,0,406),(1,0,2),(2,0,410),(1,0,414),(2,0,422),(1,0,418),(1,0,2),(4,0,422),(1,0,426),(2,0,428),(1,0,2),(2,0,2),(2,0,2),(2,0,436),(1,0,2),(2,0,436),(3,0,2),(2,0,436),(1,0,2),(2,1,434),(2,0,2),(2,0,2),(2,0,438),(1,0,2),(4,0,2),(8,0,4),(1,0,2),(2,0,4),(1,0,2),(2,0,4),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,4),(1,0,2),(2,0,2),(2,0,193),(1,0,111),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,259),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(8,0,21590),(1,0,2),(2,0,325),(1,0,21584),(3,0,2),(2,0,389),(1,0,138),(1,0,142),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(290,0,2),(2,0,2),(4,0,2),(9,0,232),(7,0,76),(2,2,74),(4,0,128),(2,1,126),(3,16,64),(18,8,64),(44,0,16),(9,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(6,0,119),(3,0,2),(2,0,13),(1,0,2),(3,2,259),(3,15,160),(16,31,64),(80,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,30),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,37,96),(2927,37,14528),(39,0,14528),(6,0,14528),(723,79,77728),(80,5,16),(2201,0,2),(7,42,6015),(45,2,6015),(323,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,0,15229),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,7,15),(16,5,15),(16,7,15),(16,7,15),(16,5,15),(17,0,15),(2,0,15),(2,0,15),(2,0,15),(9,7,15),(32,7,15),(16,7,15),(16,7,15),(16,1,15),(2,1,147),(2,0,17),(12,3,171),(4,0,17),(12,1,15),(2,1,199),(14,1,15),(2,1,223),(2,0,13),(12,1,255),(2,1,251),(2,0,17),(298,0,15033),(4,0,16765),(1,0,16523),(7,0,56),(46,15,32),(35,0,2),(819,25,52),(1866,47,96),(96,0,2),(2,0,21485),(1,0,7627),(1,0,21453),(3,0,2),(2,0,2),(2,0,2),(2,0,21559),(1,0,21497),(1,0,21565),(1,0,21563),(2,0,2),(3,0,2),(9,1,21629),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(9,0,2),(2,0,2),(5,0,2),(31054,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(20,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(136,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(4,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(11,0,2),(2,0,2),(2,0,70663),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(5,0,2),(2,0,84559),(3,0,2),(2,0,2),(4,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,84615),(1,0,84637),(1,0,84629),(1,0,84609),(1,0,84615),(2,0,84515),(1,0,84563),(1,0,84521),(1,0,1856),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,95),(1,0,84613),(1,0,70767),(1,0,2),(2,0,2),(2,0,84685),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,85121),(25,0,2),(22316,25,64),(1247,39,80),(176,35,80),(192,10,78),(12,14,78),(16,6,78),(8,1,78),(1772,50,128),(208,21,64),(2896,31,64),(21920,31,64),(96,24,54),(31328,33,68)]+ [(65,25,64),(127,22,64),(24,6,64),(40,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,397),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,241),(1,0,2),(2,0,2),(2,0,2),(4,0,420),(1,0,2),(2,0,2),(2,0,412),(1,0,2),(2,1,410),(2,0,2),(3,0,158),(1,0,404),(1,0,406),(1,0,2),(2,0,410),(1,0,414),(2,0,422),(1,0,418),(1,0,2),(4,0,422),(1,0,426),(2,0,428),(1,0,2),(2,0,2),(2,0,2),(2,0,436),(1,0,2),(2,0,436),(3,0,2),(2,0,436),(1,0,2),(2,1,434),(2,0,2),(2,0,2),(2,0,438),(1,0,2),(4,0,2),(8,0,4),(1,0,2),(2,0,4),(1,0,2),(2,0,4),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,4),(1,0,2),(2,0,2),(2,0,193),(1,0,111),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,259),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(8,0,21590),(1,0,2),(2,0,325),(1,0,21584),(3,0,2),(2,0,389),(1,0,138),(1,0,142),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(290,0,2),(2,0,2),(4,0,2),(9,0,232),(7,0,76),(2,2,74),(4,0,128),(2,1,126),(3,16,64),(18,8,64),(44,0,16),(9,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(6,0,119),(3,0,2),(2,0,13),(1,0,2),(3,2,259),(3,15,160),(16,31,64),(80,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,30),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(3,37,96),(2927,37,14528),(39,0,14528),(6,0,14528),(723,79,77728),(80,5,16),(2201,0,2),(7,42,6015),(45,2,6015),(323,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,0,15229),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(10,7,15),(16,5,15),(16,7,15),(16,7,15),(16,5,15),(17,0,15),(2,0,15),(2,0,15),(2,0,15),(9,7,15),(32,7,15),(16,7,15),(16,7,15),(16,1,15),(2,1,147),(2,0,17),(12,3,171),(4,0,17),(12,1,15),(2,1,199),(14,1,15),(2,1,223),(2,0,13),(12,1,255),(2,1,251),(2,0,17),(298,0,15033),(4,0,16765),(1,0,16523),(7,0,56),(46,15,32),(35,0,2),(819,25,52),(1866,47,96),(96,0,2),(2,0,21485),(1,0,7627),(1,0,21453),(3,0,2),(2,0,2),(2,0,2),(2,0,21559),(1,0,21497),(1,0,21565),(1,0,21563),(2,0,2),(3,0,2),(9,1,21629),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(9,0,2),(2,0,2),(5,0,2),(31054,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(20,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(136,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(4,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(11,0,2),(2,0,2),(2,0,70663),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(5,0,2),(2,0,84559),(3,0,2),(2,0,2),(4,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,84615),(1,0,84637),(1,0,84629),(1,0,84609),(1,0,84615),(2,0,84515),(1,0,84563),(1,0,84521),(1,0,1856),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,95),(1,0,84613),(1,0,70767),(1,0,2),(2,0,2),(2,0,84685),(1,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,85121),(1,0,84683),(5,0,84683),(19,0,2),(887,1,65),(21429,25,64),(1247,39,80),(176,35,80),(192,10,78),(12,14,78),(16,6,78),(8,1,78),(1772,50,128),(208,21,64),(2896,31,64),(21920,31,64),(96,24,54),(28832,0,2),(8,0,2),(2,0,2),(3,0,2),(4,0,2),(23,0,2),(2,0,2),(2,0,2),(2,0,2),(4,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2,0,2),(2434,33,68)]+++_toLowers :: Char -> [Char]+_toLowers c = case c of+ '\304' -> "i\775"+ _ -> [ toLower c]++_toTitles :: Char -> [Char]+_toTitles c = case c of+ '\8183' -> "\937\834\837"+ '\8135' -> "\919\834\837"+ '\8119' -> "\913\834\837"+ '\8180' -> "\911\837"+ '\8178' -> "\8186\837"+ '\8132' -> "\905\837"+ '\8130' -> "\8138\837"+ '\8116' -> "\902\837"+ '\8114' -> "\8122\837"+ '\8182' -> "\937\834"+ '\8167' -> "\933\776\834"+ '\8166' -> "\933\834"+ '\8164' -> "\929\787"+ '\8163' -> "\933\776\769"+ '\8162' -> "\933\776\768"+ '\8151' -> "\921\776\834"+ '\8150' -> "\921\834"+ '\8147' -> "\921\776\769"+ '\8146' -> "\921\776\768"+ '\8134' -> "\919\834"+ '\8118' -> "\913\834"+ '\8022' -> "\933\787\834"+ '\8020' -> "\933\787\769"+ '\8018' -> "\933\787\768"+ '\8016' -> "\933\787"+ '\7834' -> "A\702"+ '\7833' -> "Y\778"+ '\7832' -> "W\778"+ '\7831' -> "T\776"+ '\7830' -> "H\817"+ '\496' -> "J\780"+ '\944' -> "\933\776\769"+ '\912' -> "\921\776\769"+ '\329' -> "\700N"+ '\64279' -> "\1348\1389"+ '\64278' -> "\1358\1398"+ '\64277' -> "\1348\1387"+ '\64276' -> "\1348\1381"+ '\64275' -> "\1348\1398"+ '\1415' -> "\1333\1410"+ '\122773' -> "Ss"+ '\64262' -> "St"+ '\64261' -> "St"+ '\64260' -> "Ffl"+ '\64259' -> "Ffi"+ '\64258' -> "Fl"+ '\64257' -> "Fi"+ '\64256' -> "Ff"+ '\223' -> "Ss"+ _ -> [ toTitle c]++_toUppers :: Char -> [Char]+_toUppers c = case c of+ '\8183' -> "\937\834\921"+ '\8135' -> "\919\834\921"+ '\8119' -> "\913\834\921"+ '\8180' -> "\911\921"+ '\8178' -> "\8186\921"+ '\8132' -> "\905\921"+ '\8130' -> "\8138\921"+ '\8116' -> "\902\921"+ '\8114' -> "\8122\921"+ '\8188' -> "\937\921"+ '\8179' -> "\937\921"+ '\8140' -> "\919\921"+ '\8131' -> "\919\921"+ '\8124' -> "\913\921"+ '\8115' -> "\913\921"+ '\8111' -> "\8047\921"+ '\8110' -> "\8046\921"+ '\8109' -> "\8045\921"+ '\8108' -> "\8044\921"+ '\8107' -> "\8043\921"+ '\8106' -> "\8042\921"+ '\8105' -> "\8041\921"+ '\8104' -> "\8040\921"+ '\8103' -> "\8047\921"+ '\8102' -> "\8046\921"+ '\8101' -> "\8045\921"+ '\8100' -> "\8044\921"+ '\8099' -> "\8043\921"+ '\8098' -> "\8042\921"+ '\8097' -> "\8041\921"+ '\8096' -> "\8040\921"+ '\8095' -> "\7983\921"+ '\8094' -> "\7982\921"+ '\8093' -> "\7981\921"+ '\8092' -> "\7980\921"+ '\8091' -> "\7979\921"+ '\8090' -> "\7978\921"+ '\8089' -> "\7977\921"+ '\8088' -> "\7976\921"+ '\8087' -> "\7983\921"+ '\8086' -> "\7982\921"+ '\8085' -> "\7981\921"+ '\8084' -> "\7980\921"+ '\8083' -> "\7979\921"+ '\8082' -> "\7978\921"+ '\8081' -> "\7977\921"+ '\8080' -> "\7976\921"+ '\8079' -> "\7951\921"+ '\8078' -> "\7950\921"+ '\8077' -> "\7949\921"+ '\8076' -> "\7948\921"+ '\8075' -> "\7947\921"+ '\8074' -> "\7946\921"+ '\8073' -> "\7945\921"+ '\8072' -> "\7944\921"+ '\8071' -> "\7951\921"+ '\8070' -> "\7950\921"+ '\8069' -> "\7949\921"+ '\8068' -> "\7948\921"+ '\8067' -> "\7947\921"+ '\8066' -> "\7946\921"+ '\8065' -> "\7945\921"+ '\8064' -> "\7944\921"+ '\8182' -> "\937\834"+ '\8167' -> "\933\776\834"+ '\8166' -> "\933\834"+ '\8164' -> "\929\787"+ '\8163' -> "\933\776\769"+ '\8162' -> "\933\776\768"+ '\8151' -> "\921\776\834"+ '\8150' -> "\921\834"+ '\8147' -> "\921\776\769"+ '\8146' -> "\921\776\768"+ '\8134' -> "\919\834"+ '\8118' -> "\913\834"+ '\8022' -> "\933\787\834"+ '\8020' -> "\933\787\769"+ '\8018' -> "\933\787\768"+ '\8016' -> "\933\787"+ '\7834' -> "A\702"+ '\7833' -> "Y\778"+ '\7832' -> "W\778"+ '\7831' -> "T\776"+ '\7830' -> "H\817"+ '\496' -> "J\780"+ '\944' -> "\933\776\769"+ '\912' -> "\921\776\769"+ '\329' -> "\700N"+ '\64279' -> "\1348\1341"+ '\64278' -> "\1358\1350"+ '\64277' -> "\1348\1339"+ '\64276' -> "\1348\1333"+ '\64275' -> "\1348\1350"+ '\1415' -> "\1333\1362"+ '\122773' -> "SS"+ '\64262' -> "ST"+ '\64261' -> "ST"+ '\64260' -> "FFL"+ '\64259' -> "FFI"+ '\64258' -> "FL"+ '\64257' -> "FI"+ '\64256' -> "FF"+ '\223' -> "SS"+ _ -> [ toUpper c]++_toFolds :: Char -> [Char]+_toFolds c = case c of+ 'I' -> "\305"+ '\181' -> "\956"+ '\223' -> "ss"+ '\304' -> "i\775"+ '\329' -> "\700n"+ '\383' -> "s"+ '\496' -> "j\780"+ '\837' -> "\953"+ '\912' -> "\953\776\769"+ '\944' -> "\965\776\769"+ '\962' -> "\963"+ '\976' -> "\946"+ '\977' -> "\952"+ '\981' -> "\966"+ '\982' -> "\960"+ '\1008' -> "\954"+ '\1009' -> "\961"+ '\1013' -> "\949"+ '\1415' -> "\1381\1410"+ '\5112' -> "\5104"+ '\5113' -> "\5105"+ '\5114' -> "\5106"+ '\5115' -> "\5107"+ '\5116' -> "\5108"+ '\5117' -> "\5109"+ '\7296' -> "\1074"+ '\7297' -> "\1076"+ '\7298' -> "\1086"+ '\7299' -> "\1089"+ '\7300' -> "\1090"+ '\7301' -> "\1090"+ '\7302' -> "\1098"+ '\7303' -> "\1123"+ '\7304' -> "\42571"+ '\7830' -> "h\817"+ '\7831' -> "t\776"+ '\7832' -> "w\778"+ '\7833' -> "y\778"+ '\7834' -> "a\702"+ '\7835' -> "\7777"+ '\7838' -> "ss"+ '\8016' -> "\965\787"+ '\8018' -> "\965\787\768"+ '\8020' -> "\965\787\769"+ '\8022' -> "\965\787\834"+ '\8064' -> "\7936\953"+ '\8065' -> "\7937\953"+ '\8066' -> "\7938\953"+ '\8067' -> "\7939\953"+ '\8068' -> "\7940\953"+ '\8069' -> "\7941\953"+ '\8070' -> "\7942\953"+ '\8071' -> "\7943\953"+ '\8072' -> "\7936\953"+ '\8073' -> "\7937\953"+ '\8074' -> "\7938\953"+ '\8075' -> "\7939\953"+ '\8076' -> "\7940\953"+ '\8077' -> "\7941\953"+ '\8078' -> "\7942\953"+ '\8079' -> "\7943\953"+ '\8080' -> "\7968\953"+ '\8081' -> "\7969\953"+ '\8082' -> "\7970\953"+ '\8083' -> "\7971\953"+ '\8084' -> "\7972\953"+ '\8085' -> "\7973\953"+ '\8086' -> "\7974\953"+ '\8087' -> "\7975\953"+ '\8088' -> "\7968\953"+ '\8089' -> "\7969\953"+ '\8090' -> "\7970\953"+ '\8091' -> "\7971\953"+ '\8092' -> "\7972\953"+ '\8093' -> "\7973\953"+ '\8094' -> "\7974\953"+ '\8095' -> "\7975\953"+ '\8096' -> "\8032\953"+ '\8097' -> "\8033\953"+ '\8098' -> "\8034\953"+ '\8099' -> "\8035\953"+ '\8100' -> "\8036\953"+ '\8101' -> "\8037\953"+ '\8102' -> "\8038\953"+ '\8103' -> "\8039\953"+ '\8104' -> "\8032\953"+ '\8105' -> "\8033\953"+ '\8106' -> "\8034\953"+ '\8107' -> "\8035\953"+ '\8108' -> "\8036\953"+ '\8109' -> "\8037\953"+ '\8110' -> "\8038\953"+ '\8111' -> "\8039\953"+ '\8114' -> "\8048\953"+ '\8115' -> "\945\953"+ '\8116' -> "\940\953"+ '\8118' -> "\945\834"+ '\8119' -> "\945\834\953"+ '\8124' -> "\945\953"+ '\8126' -> "\953"+ '\8130' -> "\8052\953"+ '\8131' -> "\951\953"+ '\8132' -> "\942\953"+ '\8134' -> "\951\834"+ '\8135' -> "\951\834\953"+ '\8140' -> "\951\953"+ '\8146' -> "\953\776\768"+ '\8147' -> "\953\776\769"+ '\8147' -> "\912"+ '\8150' -> "\953\834"+ '\8151' -> "\953\776\834"+ '\8162' -> "\965\776\768"+ '\8163' -> "\965\776\769"+ '\8163' -> "\944"+ '\8164' -> "\961\787"+ '\8166' -> "\965\834"+ '\8167' -> "\965\776\834"+ '\8178' -> "\8060\953"+ '\8179' -> "\969\953"+ '\8180' -> "\974\953"+ '\8182' -> "\969\834"+ '\8183' -> "\969\834\953"+ '\8188' -> "\969\953"+ '\43888' -> "\5024"+ '\43889' -> "\5025"+ '\43890' -> "\5026"+ '\43891' -> "\5027"+ '\43892' -> "\5028"+ '\43893' -> "\5029"+ '\43894' -> "\5030"+ '\43895' -> "\5031"+ '\43896' -> "\5032"+ '\43897' -> "\5033"+ '\43898' -> "\5034"+ '\43899' -> "\5035"+ '\43900' -> "\5036"+ '\43901' -> "\5037"+ '\43902' -> "\5038"+ '\43903' -> "\5039"+ '\43904' -> "\5040"+ '\43905' -> "\5041"+ '\43906' -> "\5042"+ '\43907' -> "\5043"+ '\43908' -> "\5044"+ '\43909' -> "\5045"+ '\43910' -> "\5046"+ '\43911' -> "\5047"+ '\43912' -> "\5048"+ '\43913' -> "\5049"+ '\43914' -> "\5050"+ '\43915' -> "\5051"+ '\43916' -> "\5052"+ '\43917' -> "\5053"+ '\43918' -> "\5054"+ '\43919' -> "\5055"+ '\43920' -> "\5056"+ '\43921' -> "\5057"+ '\43922' -> "\5058"+ '\43923' -> "\5059"+ '\43924' -> "\5060"+ '\43925' -> "\5061"+ '\43926' -> "\5062"+ '\43927' -> "\5063"+ '\43928' -> "\5064"+ '\43929' -> "\5065"+ '\43930' -> "\5066"+ '\43931' -> "\5067"+ '\43932' -> "\5068"+ '\43933' -> "\5069"+ '\43934' -> "\5070"+ '\43935' -> "\5071"+ '\43936' -> "\5072"+ '\43937' -> "\5073"+ '\43938' -> "\5074"+ '\43939' -> "\5075"+ '\43940' -> "\5076"+ '\43941' -> "\5077"+ '\43942' -> "\5078"+ '\43943' -> "\5079"+ '\43944' -> "\5080"+ '\43945' -> "\5081"+ '\43946' -> "\5082"+ '\43947' -> "\5083"+ '\43948' -> "\5084"+ '\43949' -> "\5085"+ '\43950' -> "\5086"+ '\43951' -> "\5087"+ '\43952' -> "\5088"+ '\43953' -> "\5089"+ '\43954' -> "\5090"+ '\43955' -> "\5091"+ '\43956' -> "\5092"+ '\43957' -> "\5093"+ '\43958' -> "\5094"+ '\43959' -> "\5095"+ '\43960' -> "\5096"+ '\43961' -> "\5097"+ '\43962' -> "\5098"+ '\43963' -> "\5099"+ '\43964' -> "\5100"+ '\43965' -> "\5101"+ '\43966' -> "\5102"+ '\43967' -> "\5103"+ '\64256' -> "ff"+ '\64257' -> "fi"+ '\64258' -> "fl"+ '\64259' -> "ffi"+ '\64260' -> "ffl"+ '\64261' -> "st"+ '\64261' -> "\64262"+ '\64262' -> "st"+ '\64275' -> "\1396\1398"+ '\64276' -> "\1396\1381"+ '\64277' -> "\1396\1387"+ '\64278' -> "\1406\1398"+ '\64279' -> "\1396\1389"+ '\122773' -> "\223"+ _ -> [toLower c]
@@ -39,6 +39,7 @@ fromConstrM, ) where import Data.Data_Class+import Data.Coerce import Data.Functor.Const(Const(..)) import Data.Functor.Identity(Identity(..)) import Data.Int(Int8, Int16, Int32, Int64)@@ -50,6 +51,7 @@ import Data.Ratio((%)) import Data.Ratio_Type import Data.Tuple+import Data.Type.Coercion import Data.Typeable import Data.Type.Equality import Data.Version@@ -68,6 +70,7 @@ deriving instance Show ConstrRep deriving instance Eq Fixity deriving instance Show Fixity+deriving instance Eq DataType deriving instance Show DataType instance Eq Constr where@@ -551,6 +554,15 @@ -} ------------------------------------------------------------------------------ +-- | @since base-4.0.0.0+instance (Data a, Data b) => Data (a -> b) where+ toConstr _ = error "Data.Data.toConstr(a -> b)"+ gunfold _ _ = error "Data.Data.gunfold(a -> b)"+ dataTypeOf _ = mkNoRepType "Prelude.(->)"+ dataCast2 f = gcast2 f++------------------------------------------------------------------------------+ -- | @since base-4.8.0.0 instance Data a => Data (Ptr a) where toConstr _ = error "Data.Data.toConstr(Ptr)"@@ -595,10 +607,10 @@ deriving instance (Typeable i, Typeable j, Typeable a, Typeable b, (a :: i) ~~ (b :: j)) => Data (a :~~: b)+-} -- | @since base-4.7.0.0 deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b)--} -- | @since base-4.9.0.0 deriving instance Data a => Data (Identity a)@@ -634,10 +646,10 @@ deriving instance Data a => Data (Last a) -- | @since base-4.8.0.0---deriving instance (Data (f a), Data a, Typeable f) => Data (Alt f a)+-- BUG deriving instance (Data (f a), Data a, Typeable f) => Data (Alt f a) -- | @since base-4.12.0.0---deriving instance (Data (f a), Data a, Typeable f) => Data (Ap f a)+-- BUG deriving instance (Data (f a), Data a, Typeable f) => Data (Ap f a) {- ----------------------------------------------------------------------------
@@ -1,6 +1,6 @@ -- Copyright 2025 Lennart Augustsson -- See LICENSE file for full license.-module Data.Double(Double, doubleToInt) where+module Data.Double(Double, doubleToInt, castWord64ToDouble, castDoubleToWord64) where import qualified Prelude() -- do not import Prelude import Primitives import Control.Error@@ -58,10 +58,10 @@ in scaleFloat64 (ne - de) (fromInteger nm / fromInteger dm) -- XXX Very inefficient scaling--- If we get here the number has > 1023 bits, so shifting by 256 is fine.+-- If we get here the number has > 1023 bits, so shifting by 512 is fine. scaleToMax :: Integer -> Integer -> (Int, Integer) scaleToMax m = f 0- where f e x = if abs x < m then (e, x) else f (e+256) (x `shiftR` 256)+ where f e x = if abs x < m then (e, x) else f (e+512) (x `shiftR` 512) instance Eq Double where (==) = primDoubleEQ@@ -86,6 +86,8 @@ pred x = x - 1 toEnum n = fromIntegral n fromEnum = fromInteger . truncate+ -- NOTE: this intentionally differs from the Haskell Report.+ -- Use fractionalEnumFrom etc. to get the Report behavior. enumFrom = numericEnumFrom enumFromThen = numericEnumFromThen enumFromTo = numericEnumFromTo@@ -118,6 +120,7 @@ asin x = casin x acos x = cacos x atan x = catan x+ (**) x y = cpow x y foreign import ccall "log" clog :: Double -> Double foreign import ccall "exp" cexp :: Double -> Double@@ -130,6 +133,7 @@ foreign import ccall "atan" catan :: Double -> Double foreign import ccall "atan2" catan2 :: Double -> Double -> Double foreign import ccall "scalbn" cscalbn :: Double -> Int -> Double+foreign import ccall "pow" cpow :: Double -> Double -> Double -- Assumes 32/64 bit floats instance RealFloat Double where@@ -205,3 +209,9 @@ doubleToInt :: Double -> Int doubleToInt = primDoubleToInt++castWord64ToDouble :: Word64 -> Double+castWord64ToDouble = primWord64ToDoubleRaw++castDoubleToWord64 :: Double -> Word64+castDoubleToWord64 = primWord64FromDoubleRaw
@@ -53,3 +53,15 @@ where left a ~(l, r) = (a:l, r) right a ~(l, r) = (l, a:r)++fromLeft :: a -> Either a b -> a+fromLeft a = either id (const a)++fromRight :: b -> Either a b -> b+fromRight b = either (const b) id++lefts :: [Either a b] -> [a]+lefts es = [ a | Left a <- es ]++rights :: [Either a b] -> [b]+rights es = [ b | Right b <- es ]
@@ -6,6 +6,10 @@ numericEnumFromThen, numericEnumFromTo, numericEnumFromThenTo,+ fractionalEnumFrom,+ fractionalEnumFromThen,+ fractionalEnumFromTo,+ fractionalEnumFromThenTo, ) where import qualified Prelude() -- do not import Prelude import Primitives@@ -14,6 +18,7 @@ import Data.Char_Type import Data.Bounded import Data.Enum_Class+import Data.Fractional import Data.Function import Data.Functor import Data.Int.Int@@ -34,13 +39,13 @@ i_n2 = fromEnum n2 numericEnumFrom :: (Num a) => a -> [a]-numericEnumFrom n = n : numericEnumFrom (n + 1)+numericEnumFrom !n = n : numericEnumFrom (n + 1) numericEnumFromThen :: (Num a) => a -> a -> [a] numericEnumFromThen n m = from n where d = m - n- from i = i : from (i + d)+ from !i = i : from (i + d) numericEnumFromTo :: (Num a, Ord a) => a -> a -> [a] numericEnumFromTo l h = takeWhile (<= h) (numericEnumFrom l)@@ -51,6 +56,30 @@ takeWhile (<= h) (numericEnumFromThen l m) else takeWhile (>= h) (numericEnumFromThen l m)++-- Like GHC, compute n + k*step to avoid adding up rounding errors+fractionalEnumFrom :: (Fractional a) => a -> [a]+fractionalEnumFrom n = from 0+ where+ from !k = let x = n + k in x `seq` (x : from (k + 1))++fractionalEnumFromThen :: (Fractional a) => a -> a -> [a]+fractionalEnumFromThen n m = from 0+ where+ d = m - n+ from !k = let x = n + k * d in x `seq` (x : from (k + 1))++-- For Fractional types the Report says to go up to h + step/2+fractionalEnumFromTo :: (Fractional a, Ord a) => a -> a -> [a]+fractionalEnumFromTo l h = takeWhile (<= h + 1/2) (fractionalEnumFrom l)++fractionalEnumFromThenTo :: (Fractional a, Ord a) => a -> a -> a -> [a]+fractionalEnumFromThenTo l m h =+ if m >= l then+ takeWhile (<= h + d) (fractionalEnumFromThen l m)+ else+ takeWhile (>= h + d) (fractionalEnumFromThen l m)+ where d = (m - l) / 2 -- Likewise for Bool instance Enum Bool where
@@ -1,6 +1,6 @@ -- Copyright 2025 Lennart Augustsson -- See LICENSE file for full license.-module Data.Float(Float, floatToDouble, doubleToFloat) where+module Data.Float(Float, floatToDouble, doubleToFloat, castWord32ToFloat, castFloatToWord32) where import qualified Prelude() -- do not import Prelude import Primitives import Control.Error@@ -24,6 +24,7 @@ import Data.RealFrac import Data.Num import Data.Word.Word+import Data.Word.Word32 import {-# SOURCE #-} Numeric.FormatFloat(showFloat) import Numeric.Show(showSignedNeg) import Text.Show@@ -83,6 +84,8 @@ pred x = x - 1 toEnum n = fromIntegral n fromEnum = fromInteger . truncate+ -- NOTE: this intentionally differs from the Haskell Report.+ -- Use fractionalEnumFrom etc. to get the Report behavior. enumFrom = numericEnumFrom enumFromThen = numericEnumFromThen enumFromTo = numericEnumFromTo@@ -115,6 +118,7 @@ asin x = casin x acos x = cacos x atan x = catan x+ (**) x y = cpow x y foreign import ccall "logf" clog :: Float -> Float foreign import ccall "expf" cexp :: Float -> Float@@ -127,6 +131,7 @@ foreign import ccall "atanf" catan :: Float -> Float foreign import ccall "atan2f" catan2 :: Float -> Float -> Float foreign import ccall "scalbnf" cscalbn :: Float -> Int -> Float+foreign import ccall "powf" cpow :: Float -> Float -> Float -- Assumes 32/64 bit floats instance RealFloat Float where@@ -204,3 +209,9 @@ doubleToFloat :: Double -> Float doubleToFloat = primDoubleToFloat++castWord32ToFloat :: Word32 -> Float+castWord32ToFloat w = primWordToFloatRaw (primUnsafeCoerce w) -- Safety: Word32 is a newtype over Word++castFloatToWord32 :: Float -> Word32+castFloatToWord32 f = primUnsafeCoerce (primWordFromFloatRaw f) -- Safety: Word32 is a newtype over Word
@@ -45,7 +45,7 @@ import Primitives import Control.Applicative(Applicative(..), Alternative(..)) import Control.Error-import Control.Monad(Monad(..), MonadPlus(..))+import Control.Monad import Data.Bool import Data.Coerce import Data.Either@@ -59,6 +59,7 @@ import Data.Maybe import Data.Monoid import Data.Monoid.Internal hiding (Max(..), Min(..))+import qualified Data.Monoid.Internal as Monoid import Data.Num import Data.Ord import Data.Proxy@@ -223,6 +224,44 @@ product = getDual sum = getDual toList (Dual x) = [x]++-- | @since 4.8.0.0+instance Foldable Monoid.Min where+ foldMap = coerce++ elem = (. Monoid.getMin) . (==)+ foldl = coerce+ foldl' = coerce+ foldl1 _ = Monoid.getMin+ foldr f z (Monoid.Min x) = f x z+ foldr' = foldr+ foldr1 _ = Monoid.getMin+ length _ = 1+ maximum = Monoid.getMin+ minimum = Monoid.getMin+ null _ = False+ product = Monoid.getMin+ sum = Monoid.getMin+ toList (Monoid.Min x) = [x]++-- | @since 4.8.0.0+instance Foldable Monoid.Max where+ foldMap = coerce++ elem = (. Monoid.getMax) . (==)+ foldl = coerce+ foldl' = coerce+ foldl1 _ = Monoid.getMax+ foldr f z (Monoid.Max x) = f x z+ foldr' = foldr+ foldr1 _ = Monoid.getMax+ length _ = 1+ maximum = Monoid.getMax+ minimum = Monoid.getMax+ null _ = False+ product = Monoid.getMax+ sum = Monoid.getMax+ toList (Monoid.Max x) = [x] -- | @since 4.8.0.0 instance Foldable Sum where
@@ -33,9 +33,7 @@ import Data.Maybe import Data.Semigroup import Data.Tuple (Solo (..))-import Prelude- (Maybe (..), Monad (..), Ord, Ordering (..), id, seq, ($!), ($), (.),- (=<<), flip, const, error)+import Prelude hiding (foldr) import qualified Data.List.NonEmpty as NE
@@ -6,17 +6,39 @@ import Control.Applicative import Control.Monad import Data.Bool+import Data.Coerce+import Data.Enum import Data.Eq+import Data.Floating+import Data.Fractional import Data.Function import Data.Functor import Data.Functor.Const_Type+import Data.Integral import Data.Int.Int import Data.Monoid.Internal+import Data.Num+import Data.Real+import Data.RealFloat+import Data.RealFrac import Data.Ord import Text.Show -instance forall a . Functor (Const a) where- fmap _ (Const a) = Const a+deriving instance Functor (Const a)+deriving instance Show a => Show (Const a b)++deriving instance Enum a => Enum (Const a b)+deriving instance Eq a => Eq (Const a b)+deriving instance Floating a => Floating (Const a b)+deriving instance Fractional a => Fractional (Const a b)+deriving instance Integral a => Integral (Const a b)+deriving instance Num a => Num (Const a b)+deriving instance Ord a => Ord (Const a b)+deriving instance Real a => Real (Const a b)+deriving instance RealFloat a => RealFloat (Const a b)+deriving instance RealFrac a => RealFrac (Const a b)+deriving instance Semigroup a => Semigroup (Const a b)+deriving instance Monoid a => Monoid (Const a b) instance forall m . Monoid m => Applicative (Const m) where pure _ = Const mempty
@@ -3,16 +3,7 @@ module Data.Functor.Const_Type(Const(..)) where import qualified Prelude() -- do not import Prelude import Primitives-import Data.Bool-import Data.Coerce-import Data.Eq-import Data.Function-import Data.Functor-import Data.Int.Int-import Data.Ord import {-# SOURCE #-} Data.Typeable-import Text.Show type Const :: forall k . Type -> k -> Type newtype Const a b = Const { getConst :: a }- deriving (Eq, Ord, Show)
@@ -7,24 +7,36 @@ import Control.Monad import Data.Bool import Data.Coerce+import Data.Enum import Data.Eq+import Data.Floating+import Data.Fractional import Data.Function import Data.Functor+import Data.Integral import Data.Int.Int+import Data.Monoid.Internal+import Data.Num import Data.Ord+import Data.Real+import Data.RealFloat+import Data.RealFrac import Data.Records -- needed since we don't import Mhs.Builtin import {-# SOURCE #-} Data.Typeable import Text.Show newtype Identity a = Identity { runIdentity :: a }- deriving (Eq, Ord, Show)--instance Functor Identity where- fmap f (Identity a) = Identity (f a)+ deriving stock ({-Read,-} Show, Functor)+ deriving newtype (Enum, Eq, Floating, Fractional, Integral, Monoid,+ Num, Ord, Real, RealFloat, RealFrac, Semigroup) instance Applicative Identity where pure a = Identity a Identity f <*> Identity a = Identity (f a)++-- Read instance in Text.Read.Internal+-- Foldable instance in Data.Foldable+-- Traversable instance in Data.Traverse instance Monad Identity where Identity a >>= f = f a
@@ -14,6 +14,7 @@ import Primitives import Data.Eq import Data.Maybe_Type+import Data.Tuple(fst) import {-# SOURCE #-} Data.Typeable import System.Mem.Weak @@ -42,9 +43,10 @@ mkWeakIORef :: IORef a -> IO () -> IO (Weak (IORef a)) mkWeakIORef r fin = mkWeakPtr r (Just fin) --- XXX WRONG atomicModifyIORef :: forall a b . IORef a -> (a -> (a, b)) -> IO b-atomicModifyIORef r f = readIORef r `primBind` \ a -> let (a', b) = f a in writeIORef r a' `primThen` primReturn b+atomicModifyIORef r f =+ primAtomic (readIORef r `primBind` \ a ->+ let ab = f a in writeIORef r (fst ab) `primThen` primReturn ab) `primBind` \ (_, b) -> primReturn b atomicModifyIORef' :: forall a b . IORef a -> (a -> (a, b)) -> IO b atomicModifyIORef' r f = atomicModifyIORef r f' `primBind` \ b -> b `primSeq` primReturn b
@@ -28,11 +28,13 @@ EQ -> (0::Int) GT -> (1::Int) fromInteger = _integerToInt+ _fromInt i = i instance Integral Int where quot = primIntQuot rem = primIntRem toInteger = _intToInteger+ _fromIntegral = _fromInt instance Bounded Int where minBound = primWordToInt ((primWordInv (0::Word) `primWordQuot` (2::Word)) `primWordAdd` (1::Word))
@@ -60,11 +60,13 @@ abs x = x signum x = if x < 0 then -1 else if x > 0 then 1 else 0 fromInteger i = i16 (_integerToInt i)+ _fromInt = i16 instance Integral Int16 where quot = bin16 primIntQuot rem = bin16 primIntRem toInteger = _intToInteger . unI16+ _fromIntegral = _fromInt . unI16 instance Bounded Int16 where minBound = -maxBound - 1@@ -111,6 +113,7 @@ bitSizeMaybe _ = Just 16 bitSize _ = 16 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount (I16 x) = primWordPopcount (primIntToWord x `primWordAnd` (0xffff::Word)) zeroBits = 0
@@ -60,11 +60,13 @@ abs x = x signum x = if x < 0 then -1 else if x > 0 then 1 else 0 fromInteger i = i32 (_integerToInt i)+ _fromInt = i32 instance Integral Int32 where quot = bin32 primIntQuot rem = bin32 primIntRem toInteger = _intToInteger . unI32+ _fromIntegral = _fromInt . unI32 instance Bounded Int32 where minBound = -maxBound - 1@@ -111,6 +113,7 @@ bitSizeMaybe _ = Just 32 bitSize _ = 32 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount (I32 x) = primWordPopcount (primIntToWord x `primWordAnd` (0xffffffff::Word)) zeroBits = 0
@@ -93,6 +93,7 @@ bitSizeMaybe _ = Just 64 bitSize _ = 64 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primInt64Popcount zeroBits = 0
@@ -60,11 +60,13 @@ abs x = x signum x = if x < 0 then -1 else if x > 0 then 1 else 0 fromInteger i = i8 (_integerToInt i)+ _fromInt = i8 instance Integral Int8 where quot = bin8 primIntQuot rem = bin8 primIntRem toInteger = _intToInteger . unI8+ _fromIntegral = _fromInt . unI8 instance Bounded Int8 where minBound = -maxBound - 1@@ -111,6 +113,7 @@ bitSizeMaybe _ = Just 8 bitSize _ = 8 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount (I8 x) = primWordPopcount (primIntToWord x `primWordAnd` (0xff::Word)) zeroBits = 0
@@ -6,6 +6,8 @@ _intListToInteger, ) where import qualified Prelude() -- do not import Prelude+import Primitives(primSeq)+import Control.Exception.Internal(throw, ArithException(DivideByZero)) import Data.Bits.Base import Data.Bool import Data.Enum@@ -57,7 +59,8 @@ fromInteger x = x instance Integral Integer where- quotRem = quotRemI+ quotRem x y =+ if y == 0 then throw DivideByZero else quotRemI x y toInteger x = x instance Real Integer where@@ -117,6 +120,8 @@ _intListToInteger :: [Int] -> Integer _intListToInteger [] = _intToInteger 0-_intListToInteger ads@(x : ds) = if x == -1 then - f ds else f ads- where f = foldr (\ d a -> a * integerListBase + toInteger d) 0-+_intListToInteger ads@(x : ds) = if x == -1 then - f 0 (reverse ds) else f 0 (reverse ads)+ where f a [] = a+ f a (d:ys) =+ let a' = a * integerListBase + toInteger d+ in primSeq a' (f a' ys)
@@ -16,367 +16,156 @@ _integerToInt, _wordToInteger, ) where-import qualified Prelude() -- do not import Prelude+import qualified Prelude() import Primitives-import Control.Error-import Control.Exception.Internal-import Data.Bits.Base+import Control.Monad import Data.Bool-import Data.Enum import Data.Eq import Data.Function-import Data.Int.Int-import Data.Integral-import Data.List-import Data.Maybe_Type-import Data.Num import Data.Ord-import Data.Word+--import Foreign.Ptr(Ptr)+--import Foreign.ForeignPtr(withForeignPtr)+import System.IO.Internal+import System.IO.Unsafe import Data.Integer_Type -isZero :: Integer -> Bool-isZero (I _ ds) = null ds--instance Eq Sign where- (==) Plus Plus = True- (==) Minus Minus = True- (==) _ _ = False+-- We cannot import Foreign.ForeignPtr; it is circular.+withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b+withForeignPtr fp io =+ io (primForeignPtrToPtr fp) `primBind` \ b ->+ primSeq fp (primReturn b) --- Trim off 0s and make an Integer-sI :: Sign -> [Digit] -> Integer-sI s ds =- -- Remove trailing 0s- case dropWhileEnd (== (0 :: Word)) ds of- [] -> I Plus []- ds' -> I s ds'+----- -zeroD :: Digit-zeroD = 0+foreign import capi "mpz_add" mpz_add :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_sub" mpz_sub :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_mul" mpz_mul :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_neg" mpz_neg :: Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_abs" mpz_abs :: Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_tdiv_qr" mpz_tdiv_qr :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_cmp" mpz_cmp :: Ptr MPZ -> Ptr MPZ -> IO Int+foreign import capi "mpz_and" mpz_and :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_ior" mpz_ior :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_xor" mpz_xor :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()+foreign import capi "mpz_mul_2exp" mpz_mul_2exp :: Ptr MPZ -> Ptr MPZ -> Int -> IO ()+foreign import capi "mpz_fdiv_q_2exp" mpz_fdiv_q_2exp :: Ptr MPZ -> Ptr MPZ -> Int -> IO ()+foreign import capi "mpz_popcount" mpz_popcount :: Ptr MPZ -> IO Int+foreign import capi "mpz_tstbit" mpz_tstbit :: Ptr MPZ -> Int -> IO Int+foreign import capi "mpz_log2" mpz_log2 :: Ptr MPZ -> IO Int -addI :: Integer -> Integer -> Integer-addI (I Plus xs) (I Plus ys) = I Plus (add xs ys)-addI (I Plus xs) (I Minus ys) | LT <- cmpW xs ys = sI Minus (sub ys xs)- | True = sI Plus (sub xs ys)-addI (I Minus xs) (I Plus ys) | LT <- cmpW ys xs = sI Minus (sub xs ys)- | True = sI Plus (sub ys xs)-addI (I Minus xs) (I Minus ys) = I Minus (add xs ys)+binop :: (Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()) -> Integer -> Integer -> Integer+binop f (I x) (I y) = unsafePerformIO $ do+ z <- newMPZ+ withForeignPtr x $ \ px ->+ withForeignPtr y $ \ py ->+ withForeignPtr z $ \ pz ->+ f pz px py+ return (I z) -negateI :: Integer -> Integer-negateI i@(I _ []) = i-negateI (I Plus x) = I Minus x-negateI (I Minus x) = I Plus x+unop :: (Ptr MPZ -> Ptr MPZ -> IO ()) -> Integer -> Integer+unop f (I x) = unsafePerformIO $ do+ z <- newMPZ+ withForeignPtr x $ \ px ->+ withForeignPtr z $ \ pz ->+ f pz px+ return (I z) -absI :: Integer -> Integer-absI (I _ x) = I Plus x+addI :: Integer -> Integer -> Integer+addI = binop mpz_add subI :: Integer -> Integer -> Integer-subI x y = addI x (negateI y)--add :: [Digit] -> [Digit] -> [Digit]-add = add' zeroD--add' :: Digit -> [Digit] -> [Digit] -> [Digit]-add' ci (x : xs) (y : ys) = s : add' co xs ys where (co, s) = addD ci x y-add' ci (x : xs) [] = s : add' co xs [] where (co, s) = addD ci x zeroD-add' ci [] (y : ys) = s : add' co [] ys where (co, s) = addD ci zeroD y-add' ci [] [] = if ci == zeroD then [] else [ci]---- Add 3 digits with carry-addD :: Digit -> Digit -> Digit -> (Digit, Digit)-addD x y z = (quotMaxD s, remMaxD s) where s = x + y + z---- Invariant: xs >= ys, so result is always >= 0-sub :: [Digit] -> [Digit] -> [Digit]-sub xs ys = sub' zeroD xs ys--sub' :: Digit -> [Digit] -> [Digit] -> [Digit]-sub' bi (x : xs) (y : ys) = d : sub' bo xs ys where (bo, d) = subW bi x y-sub' bi (x : xs) [] = d : sub' bo xs [] where (bo, d) = subW bi x zeroD-sub' 0 [] [] = []-sub' _ [] _ = error "impossible: xs >= ys"---- Subtract with borrow-subW :: Digit -> Digit -> Digit -> (Digit, Digit)-subW b x y =- let d = maxD + x - y - b- in (1 - quotMaxD d, remMaxD d)--cmpW :: [Digit] -> [Digit] -> Ordering-cmpW (x : xs) (y : ys) =- case cmpW xs ys of- EQ -> compare x y- res -> res-cmpW (_ : _) [] = GT-cmpW [] (_ : _) = LT-cmpW [] [] = EQ+subI = binop mpz_sub mulI :: Integer -> Integer -> Integer-mulI (I _ []) _ = I Plus [] -- 0 * x = 0-mulI _ (I _ []) = I Plus [] -- x * 0 = 0-mulI (I sx [x]) (I sy ys) = I (mulSign sx sy) (mulD zeroD ys x)-mulI (I sx xs) (I sy [y]) = I (mulSign sx sy) (mulD zeroD xs y)-mulI (I sx xs) (I sy ys) = I (mulSign sx sy) (mulM xs ys)--mulSign :: Sign -> Sign -> Sign-mulSign s t = if s == t then Plus else Minus+mulI = binop mpz_mul --- Multiply with a single digit, and add carry.-mulD :: Digit -> [Digit] -> Digit -> [Digit]-mulD ci [] _ = if ci == 0 then [] else [ci]-mulD ci (x:xs) y = r : mulD q xs y- where- xy = x * y + ci- q = quotMaxD xy- r = remMaxD xy+negateI :: Integer -> Integer+negateI = unop mpz_neg -mulM :: [Digit] -> [Digit] -> [Digit]-mulM xs ys =- let rs = map (mulD zeroD xs) ys- ss = zipWith (++) (map (`replicate` (0 :: Word)) [0 :: Int ..]) rs- in foldl1 add ss+absI :: Integer -> Integer+absI = unop mpz_abs --- Signs:--- + + -> (+,+)--- + - -> (-,+)--- - + -> (-,-)--- - - -> (+,-) quotRemI :: Integer -> Integer -> (Integer, Integer)-quotRemI _ (I _ []) = throw DivideByZero -- n / 0-quotRemI (I _ []) _ = (I Plus [], I Plus []) -- 0 / n-quotRemI (I sx xs) (I sy ys) | Just (y, n) <- msd ys =- -- All but the MSD are 0. Scale numerator accordingly and divide.- -- Then add back (the ++) the remainder we scaled off.- let (rs, xs') = splitAt n xs -- xs' is the scaled number- in case quotRemD xs' y of- (q, r) -> qrRes sx sy (q, rs ++ r)-quotRemI (I sx xs) (I sy ys) = qrRes sx sy (quotRemB xs ys)--msd :: [Digit] -> Maybe (Digit, Int)-msd = go 0- where- go _ [] = Nothing- go n [d] = Just (d, n)- go n (d : ds) = if d == 0 then go (n + 1) ds else Nothing--qrRes :: Sign -> Sign -> ([Digit], [Digit]) -> (Integer, Integer)-qrRes sx sy (ds, rs) = (sI (mulSign sx sy) ds, sI sx rs)--quotI :: Integer -> Integer -> Integer-quotI x y =- case quotRemI x y of- (q, _) -> q---- Divide by a single digit.--- Does not return normalized numbers.-quotRemD :: [Digit] -> Digit -> ([Digit], [Digit])-quotRemD axs y = qr zeroD (reverse axs) []- where- qr ci [] res = (res, [ci])- qr ci (x:xs) res = qr r xs (q:res)- where- --cx = ci `unsafeShiftL` shiftD + x- cx = ci * maxD + x- q = quot cx y- r = rem cx y---- Simple iterative long division.-quotRemB :: [Digit] -> [Digit] -> ([Digit], [Digit])-quotRemB xs ys =- let n = I Plus xs- d = I Plus ys- a = I Plus $ replicate (length ys - (1 :: Int)) (0 :: Word) ++ [last ys] -- only MSD of ys- aq = quotI n a- ar = addI d oneI- loop q r =- if absI r `geI` d then- let r' = n `subI` (q `mulI` d)- qn = q `addI` (r' `quotI` a)- q' = (q `addI` qn) `quotI` twoI- in loop q' r'- else- q- q' = loop aq ar- r = n `subI` (q' `mulI` d)- in if r `ltI` zeroI then- (digits (q' `subI` oneI), digits (r `addI` d))- else- (digits q', digits r)+quotRemI (I x) (I y) = unsafePerformIO $ do+ q <- newMPZ+ r <- newMPZ+ withForeignPtr x $ \ px ->+ withForeignPtr y $ \ py ->+ withForeignPtr q $ \ pq ->+ withForeignPtr r $ \ pr ->+ mpz_tdiv_qr pq pr px py+ return (I q, I r) -digits :: Integer -> [Digit]-digits (I _ ds) = ds+-- XXX should do quot and rem too zeroI :: Integer-zeroI = I Plus []+zeroI = _intToInteger (0::Int) oneI :: Integer-oneI = I Plus [1]--twoI :: Integer-twoI = I Plus [2]--tenI :: Integer-tenI = I Plus [10]+oneI = _intToInteger (1::Int) negOneI :: Integer-negOneI = I Minus [1]+negOneI = _intToInteger (primIntNeg 1) ---------------+isZero :: Integer -> Bool+isZero = eqI zeroI +cmpop :: (Int -> a) -> Integer -> Integer -> a+cmpop f (I x) (I y) = unsafePerformIO $+ withForeignPtr x $ \ px ->+ withForeignPtr y $ \ py -> do+ s <- mpz_cmp px py+ return (f s)+ eqI :: Integer -> Integer -> Bool-eqI (I sx xs) (I sy ys) = sx == sy && xs == ys+eqI = cmpop ((0::Int) ==) neI :: Integer -> Integer -> Bool-neI x y = not (eqI x y)+neI = cmpop ((0::Int) /=) cmpI :: Integer -> Integer -> Ordering-cmpI (I Plus xs) (I Plus ys) = cmpW xs ys-cmpI (I Minus _) (I Plus _) = LT-cmpI (I Plus _) (I Minus _) = GT-cmpI (I Minus xs) (I Minus ys) = cmpW ys xs+cmpI = cmpop (\ i -> if i < (0::Int) then LT else if i > (0::Int) then GT else EQ) ltI :: Integer -> Integer -> Bool-ltI x y =- case cmpI x y of- LT -> True- _ -> False+ltI = cmpop (< (0::Int)) leI :: Integer -> Integer -> Bool-leI x y =- case cmpI x y of- GT -> False- _ -> True+leI = cmpop (<= (0::Int)) gtI :: Integer -> Integer -> Bool-gtI x y =- case cmpI x y of- GT -> True- _ -> False+gtI = cmpop (> (0::Int)) geI :: Integer -> Integer -> Bool-geI x y =- case cmpI x y of- LT -> False- _ -> True-----------------------------------+geI = cmpop (>= (0::Int)) andI :: Integer -> Integer -> Integer-andI (I Plus xs) (I Plus ys) = bI Plus (andDigits xs ys)-andI (I Plus xs) (I Minus ys) = bI Plus (andNotDigits (sub1 ys) xs)-andI (I Minus xs) (I Plus ys) = bI Plus (andNotDigits (sub1 xs) ys)-andI (I Minus xs) (I Minus ys) = bI Minus (orDigits (sub1 xs) (sub1 ys))+andI = binop mpz_and orI :: Integer -> Integer -> Integer-orI (I Plus xs) (I Plus ys) = bI Plus (orDigits xs ys)-orI (I Plus xs) (I Minus ys) = bI Minus (andNotDigits xs (sub1 ys))-orI (I Minus xs) (I Plus ys) = bI Minus (andNotDigits ys (sub1 xs))-orI (I Minus xs) (I Minus ys) = bI Minus (andDigits (sub1 xs) (sub1 ys))+orI = binop mpz_ior xorI :: Integer -> Integer -> Integer-xorI (I Plus xs) (I Plus ys) = bI Plus (xorDigits xs ys)-xorI (I Plus xs) (I Minus ys) = bI Minus (xorDigits xs (sub1 ys))-xorI (I Minus xs) (I Plus ys) = bI Minus (xorDigits (sub1 xs) ys)-xorI (I Minus xs) (I Minus ys) = bI Plus (xorDigits (sub1 xs) (sub1 ys))--bI :: Sign -> [Digit] -> Integer-bI Plus ds = sI Plus ds-bI Minus ds = sI Minus (add1 ds)--add1 :: [Digit] -> [Digit]-add1 ds = add ds [1]--sub1 :: [Digit] -> [Digit]-sub1 ds = sub ds [1]--andDigits :: [Digit] -> [Digit] -> [Digit]-andDigits (x : xs) (y : ys) = (x .&. y) : andDigits xs ys-andDigits _ _ = []--andNotDigits :: [Digit] -> [Digit] -> [Digit]-andNotDigits [] [] = []-andNotDigits [] ys = ys-andNotDigits xs [] = []-andNotDigits (x : xs) (y : ys) = (complement x .&. y) : andNotDigits xs ys--orDigits :: [Digit] -> [Digit] -> [Digit]-orDigits [] [] = []-orDigits [] ys = ys-orDigits xs [] = xs-orDigits (x : xs) (y : ys) = (x .|. y) : orDigits xs ys--xorDigits :: [Digit] -> [Digit] -> [Digit]-xorDigits [] [] = []-xorDigits [] ys = ys-xorDigits xs [] = xs-xorDigits (x : xs) (y : ys) = (x `xor` y) : xorDigits xs ys--shiftLD :: [Digit] -> Int -> [Digit]-shiftLD ds 0 = ds-shiftLD ds i = go 0 ds- where- go ci [] = if ci == 0 then [] else [ci]- go ci (d : ds) =- let- x = (d `unsafeShiftL` i) .|. ci- co = quotMaxD x- s = remMaxD x- in s : go co ds+xorI = binop mpz_xor -shiftRD :: [Digit] -> Int -> ([Digit], Bool)-shiftRD ds 0 = (ds, False)-shiftRD ds i =- let (rs, ds') = splitAt 1 (shiftLD ds (shiftD - i))- in (ds', any (/= 0) rs)+-- XXX add complement testBitI :: Integer -> Int -> Bool-testBitI (I Plus ds) i =- case ds !? q of- Just d -> testBit d r- Nothing -> False- where (q, r) = quotRem i shiftD-testBitI (I Minus ds) i =- -- not (testBitI (complement (I Minus ds)) i)- case ds !? q of- Just d ->- let d' = if all (== 0) (take q ds) then d - 1 else d- in not (testBit d' r)- Nothing -> True- where (q, r) = quotRem i shiftD+testBitI (I x) i = unsafePerformIO $+ withForeignPtr x $ \ px -> do+ r <- mpz_tstbit px i+ return (r == (1::Int)) shiftLI :: Integer -> Int -> Integer-shiftLI (I sign ds) i- | null ds = zeroI- | otherwise =- let (q, r) = quotRem i shiftD- in I sign (replicate q 0 ++ shiftLD ds r)+shiftLI x i = unop (\ pz px -> mpz_mul_2exp pz px i) x shiftRI :: Integer -> Int -> Integer-shiftRI (I sign ds) i- | null ds = zeroI- | otherwise =- let- (q, r) = quotRem i shiftD- (rs, ds') = splitAt q ds- (ds'', shiftedOut1s) = shiftRD ds' r- in case sign of- Minus | shiftedOut1s || any (/= 0) rs -> I sign (add1 ds'')- _ -> I sign ds''+shiftRI x i = unop (\ pz px -> mpz_fdiv_q_2exp pz px i) x popCountI :: Integer -> Int-popCountI (I sign ds) =- let count = sum (map popCount ds)- in case sign of- Plus -> count- Minus -> -count+popCountI (I x) = unsafePerformIO $ withForeignPtr x mpz_popcount log2I :: Integer -> Int-log2I (I _ ds) = case go 0 ds of- Nothing -> 0- Just (d, n) -> n * shiftD + _wordSize - 1 - primWordClz d- where- go _ [] = Nothing- go n [d] = Just (d, n)- go n (d : ds) = go (n + 1) ds+log2I (I x) = unsafePerformIO $ withForeignPtr x mpz_log2 --------------------------------- {-@@ -521,3 +310,4 @@ mapM_ qc [prop_div, prop_muldiv] -}+
@@ -1,132 +1,92 @@--- Copyright 2023 Lennart Augustsson--- See LICENSE file for full license.-module Data.Integer_Type(module Data.Integer_Type) where-import qualified Prelude() -- do not import Prelude+module Data.Integer_Type(+ Integer(..),+ MPZ, newMPZ,+ _intToInteger, _wordToInteger, _int64ToInteger, _word64ToInteger,+ _integerToInt, _integerToWord, _integerToInt64, _integerToWord64,+ _integerToFloat,+ _integerToDouble,+ ) where+import qualified Prelude() import Primitives-import {-# SOURCE #-} Control.Error-import Data.Bool_Type-import Data.List_Type------- The Integer is stored in sign-magnitude format with digits in base maxD (2^32)--- It has the following invariants:--- * each digit is >= 0 and < maxD--- * least significant digits first, most significant last--- * no trailing 0s in the digits--- * 0 is positive--data Integer = I Sign [Digit] deriving ()--data Sign = Plus | Minus deriving ()+import Control.Error+import Data.Function(($))+import {-# SOURCE #-} Data.Typeable+--import Foreign.ForeignPtr+--import Mhs.Builtin+--import System.IO.Unsafe -type Digit = Word+-- We cannot import Foreign.ForeignPtr; it is circular.+withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b+withForeignPtr fp io =+ io (primForeignPtrToPtr fp) `primBind` \ b ->+ primSeq fp (primReturn b) -maxD :: Digit-maxD = 1 `primWordShl` shiftD+----- -shiftD :: Int-shiftD = {-_wordSize-} 32 `primIntShr` 1 -- this is used so multiplication of two digits doesn't overflow a Word+data MPZ -quotMaxD :: Digit -> Digit-quotMaxD d = d `primWordShr` shiftD+newtype Integer = I (ForeignPtr MPZ) -remMaxD :: Digit -> Digit-remMaxD d = d `primWordAnd` (maxD `primWordSub` 1)+foreign import capi "new_mpz" new_mpz :: IO (Ptr MPZ) -- it really returns a ForeignPtr+foreign import capi "mpz_init_set_si" mpz_init_set_si :: Ptr MPZ -> Int -> IO ()+foreign import capi "mpz_init_set_ui" mpz_init_set_ui :: Ptr MPZ -> Word -> IO ()+foreign import capi "mpz_get_si" mpz_get_si :: Ptr MPZ -> IO Int+foreign import capi "mpz_get_f" mpz_get_f :: Ptr MPZ -> IO Float+foreign import capi "mpz_get_d" mpz_get_d :: Ptr MPZ -> IO Double --- Sadly, we also need a bunch of functions.+newMPZ :: IO (ForeignPtr MPZ)+newMPZ =+ new_mpz `primBind` \ x ->+ primReturn (primUnsafeCoerce x) _intToInteger :: Int -> Integer-_intToInteger i- | i `primIntEQ` 0 = I Plus []- | i `primIntGE` 0 = f Plus (primIntToWord i)- | True = f Minus (primWordNeg (primIntToWord i))- where- f sign i =- let- high = quotMaxD i- low = remMaxD i- in if high `primWordEQ` 0 then I sign [low] else I sign [low, high]--_integerToInt :: Integer -> Int-_integerToInt x = primWordToInt (_integerToWord x)+_intToInteger i = primPerformIO (+ newMPZ `primBind` \ x ->+ withForeignPtr x ( \ p -> mpz_init_set_si p i) `primThen`+ primReturn (I x)+ ) _wordToInteger :: Word -> Integer-_wordToInteger i- | i `primWordEQ` 0 = I Plus []- | high `primWordEQ` 0 = I Plus [low]- | True = I Plus [low, high]- where- high = quotMaxD i- low = remMaxD i+_wordToInteger i = primPerformIO (+ newMPZ `primBind` \ x ->+ withForeignPtr x ( \ p -> mpz_init_set_ui p i) `primThen`+ primReturn (I x)+ ) +_integerToInt :: Integer -> Int+_integerToInt (I x) = primPerformIO (withForeignPtr x mpz_get_si)+ _integerToWord :: Integer -> Word-_integerToWord (I sign ds) =- case sign of- Plus -> i- Minus -> 0 `primWordSub` i- where- xadd = primWordAdd- xmul x = primWordShl x shiftD- i =- case ds of- [] -> 0 :: Word- [d1] -> d1- -- XXX should really depend of the width of a digit- [d1, d2] -> xmul d2 `xadd` d1- [d1, d2, d3] -> xmul (xmul d3 `xadd` d2) `xadd` d1- d1:d2:d3:d4:_ -> xmul (xmul (xmul d4 `xadd` d3) `xadd` d2) `xadd` d1+_integerToWord i = primIntToWord (_integerToInt i) -_integerToWord64 :: Integer -> Word64-_integerToWord64 (I sign ds) =- case sign of- Plus -> i- Minus -> 0 `primWord64Sub` i- where- xadd = primWord64Add- xmul x = primWord64Shl x shiftD- conv [] = []- conv (x:xs) = primWordToWord64 x : conv xs- i =- case conv ds of- [] -> 0 :: Word64- [d1] -> d1- -- XXX should really depend of the width of a digit- [d1, d2] -> xmul d2 `xadd` d1- [d1, d2, d3] -> xmul (xmul d3 `xadd` d2) `xadd` d1- d1:d2:d3:d4:_ -> xmul (xmul (xmul d4 `xadd` d3) `xadd` d2) `xadd` d1+_integerToFloat :: Integer -> Float+_integerToFloat (I x) = primPerformIO (withForeignPtr x mpz_get_f) -_word64ToInteger :: Word64 -> Integer-_word64ToInteger w = I Plus (conv w)- where conv i | primWord64EQ i 0 = []- | True = primWord64ToWord (primWord64Rem i base) : conv (primWord64Quot i base)- base = primWordToWord64 maxD+_integerToDouble :: Integer -> Double+_integerToDouble (I x) = primPerformIO (withForeignPtr x mpz_get_d) +-------++foreign import capi "mpz_init_set_si64" mpz_init_set_si64 :: Ptr MPZ -> Int64 -> IO ()+foreign import capi "mpz_init_set_ui64" mpz_init_set_ui64 :: Ptr MPZ -> Word64 -> IO ()+foreign import capi "mpz_get_si64" mpz_get_si64 :: Ptr MPZ -> IO Int64+ _integerToInt64 :: Integer -> Int64-_integerToInt64 x = primWord64ToInt64 (_integerToWord64 x)+_integerToInt64 (I x) = primPerformIO (withForeignPtr x mpz_get_si64) -_int64ToInteger :: Int64 -> Integer-_int64ToInteger i- | i `primInt64EQ` 0 = I Plus []- | i `primInt64GE` 0 = _word64ToInteger (primInt64ToWord64 i)- | True = I Minus ds- where I _ ds = _word64ToInteger (primWord64Neg (primInt64ToWord64 i))+_integerToWord64 :: Integer -> Word64+_integerToWord64 i = primInt64ToWord64 (_integerToInt64 i) -_integerToFloat :: Integer -> Float-_integerToFloat (I sign ds) = sgn (loop ds)- where- loop [] = 0.0 :: Float- loop (d : ds) = primFloatFromInt (primWordToInt d) `primFloatAdd` (primFloatFromInt (primWordToInt maxD) `primFloatMul` loop ds)- sgn x =- case sign of- Plus -> x- Minus -> primFloatNeg x+_word64ToInteger :: Word64 -> Integer+_word64ToInteger i = primPerformIO (+ newMPZ `primBind` \ x ->+ withForeignPtr x ( \ p -> mpz_init_set_ui64 p i) `primThen`+ primReturn (I x)+ ) -_integerToDouble :: Integer -> Double-_integerToDouble (I sign ds) = sgn (loop ds)- where- loop [] = 0.0 :: Double- loop (d : ds) = primDoubleFromInt (primWordToInt d) `primDoubleAdd` (primDoubleFromInt (primWordToInt maxD) `primDoubleMul` loop ds)- sgn x =- case sign of- Plus -> x- Minus -> primDoubleNeg x+_int64ToInteger :: Int64 -> Integer+_int64ToInteger i = primPerformIO (+ newMPZ `primBind` \ x ->+ withForeignPtr x ( \ p -> mpz_init_set_si64 p i) `primThen`+ primReturn (I x)+ )
@@ -26,6 +26,9 @@ quotRem :: a -> a -> (a, a) divMod :: a -> a -> (a, a) toInteger :: a -> Integer+ -- Used by fromIntegral to avoid going through Integer.+ -- Must be the same as fromInteger . toInteger.+ _fromIntegral :: forall b . Num b => a -> b n `quot` d = q where (q,r) = quotRem n d n `rem` d = r where (q,r) = quotRem n d@@ -34,6 +37,7 @@ divMod n d = if signum r == negate (signum d) then (q - 1, r + d) else qr where qr@(q,r) = quotRem n d quotRem n d = (quot n d, rem n d)+ _fromIntegral x = fromInteger (toInteger x) gcd :: forall a . (Integral a) => a -> a -> a gcd x y = gcd' (abs x) (abs y)@@ -62,4 +66,4 @@ | otherwise = x * pow (x * x) (y `quot` 2) fromIntegral :: forall a b . (Integral a, Num b) => a -> b-fromIntegral x = fromInteger (toInteger x)+fromIntegral = _fromIntegral
@@ -411,6 +411,7 @@ intercalate :: forall a . [a] -> [[a]] -> [a] intercalate xs xss = concat (intersperse xs xss) +infix 4 `elem`, `notElem` elem :: forall a . (Eq a) => a -> [a] -> Bool elem a = any (a ==)
@@ -603,7 +603,6 @@ -- | The 'unzip' function is the inverse of the 'zip' function. unzip :: Functor f => f (a,b) -> (f a, f b) unzip xs = (fst <$> xs, snd <$> xs)-{-# WARNING in "x-data-list-nonempty-unzip" unzip "This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip" #-} -- | The 'nub' function removes duplicate elements from a list. In -- particular, it keeps only the first occurrence of each element.
@@ -44,7 +44,6 @@ _ <*> _ = Nothing instance Monad Maybe where- return = pure Nothing >>= _ = Nothing Just a >>= f = f a
@@ -23,12 +23,14 @@ class Semigroup a => Monoid a where mempty :: a- mappend :: a -> a -> a- mappend = (<>) mconcat :: [a] -> a mconcat [] = mempty mconcat (a:as) = a <> mconcat as + mappend :: -- Semigroup a =>+ a -> a -> a+ mappend = (<>)+ --------------------- instance Semigroup (Proxy s) where@@ -79,7 +81,7 @@ --------------------- newtype Max a = Max { getMax :: a }- deriving (Bounded, Eq, Ord, Show)+ deriving (Bounded, Eq, Ord, Show, Num) instance Ord a => Semigroup (Max a) where Max a <> Max b = Max (a `max` b)@@ -95,10 +97,12 @@ pure = Max (<*>) = coerce +-- Foldable and Traversable in their respective modules+ --------------------- newtype Min a = Min { getMin :: a }- deriving (Bounded, Eq, Ord, Show)+ deriving (Bounded, Eq, Ord, Show, Num) instance Ord a => Semigroup (Min a) where Min a <> Min b = Min (a `min` b)@@ -114,6 +118,8 @@ pure = Min (<*>) = coerce +-- Foldable and Traversable in their respective modules+ --------------------- newtype Sum a = Sum { getSum :: a }@@ -132,6 +138,8 @@ pure = Sum (<*>) = coerce +-- Foldable and Traversable in their respective modules+ --------------------- newtype Product a = Product { getProduct :: a }@@ -149,6 +157,8 @@ instance Applicative Product where pure = Product (<*>) = coerce++-- Foldable and Traversable in their respective modules ---------------------
@@ -17,8 +17,12 @@ abs :: a -> a signum :: a -> a fromInteger :: Integer -> a+ -- Used by fromIntegral to avoid going through Integer.+ -- Must be the same as fromInteger . _intToInteger.+ _fromInt :: Int -> a negate x = 0 - x x - y = x + negate y+ _fromInt i = fromInteger (_intToInteger i) subtract :: forall a . Num a => a -> a -> a subtract x y = y - x
@@ -50,28 +50,25 @@ newtype Down a = Down { getDown :: a -- ^ @since 4.14.0.0 }-{- deriving- ( Eq -- ^ @since 4.6.0.0- , Num -- ^ @since 4.11.0.0- , Semigroup -- ^ @since 4.11.0.0- , Monoid -- ^ @since 4.11.0.0- , Bits -- ^ @since 4.14.0.0- , FiniteBits -- ^ @since 4.14.0.0- , Floating -- ^ @since 4.14.0.0- , Fractional -- ^ @since 4.14.0.0- , Ix -- ^ @since 4.14.0.0- , Real -- ^ @since 4.14.0.0- , RealFrac -- ^ @since 4.14.0.0- , RealFloat -- ^ @since 4.14.0.0- , Storable -- ^ @since 4.14.0.0+{- In Data.Orphans+ ( Num+ , Semigroup+ , Monoid+ , Bits+ , FiniteBits+ , Floating+ , Fractional+ , Ix+ , Real+ , RealFrac+ , RealFloat+ , Storable+ , Read+ , Show+ , Functor ) -} -{- In Data.Orphans-instance (Read a) => Read (Down a)-instance (Show a) => Show (Down a)--}- instance Eq a => Eq (Down a) where Down x == Down y = x == y @@ -79,8 +76,8 @@ compare (Down x) (Down y) = y `compare` x instance Bounded a => Bounded (Down a) where- minBound = Down maxBound- maxBound = Down minBound+ minBound = Down maxBound+ maxBound = Down minBound instance Functor Down where- fmap f (Down a) = Down (f a)+ fmap f (Down a) = Down (f a)
@@ -0,0 +1,30 @@+module Data.Ord.Class(Ord(..)) where+import qualified Prelude() -- do not import Prelude+import Data.Bool_Type+import Data.Eq+import Data.Ordering_Type+import {-# SOURCE #-} Data.Typeable++infix 4 <,<=,>,>=++class Eq a => Ord a where+ compare :: a -> a -> Ordering+ (<) :: a -> a -> Bool+ (<=) :: a -> a -> Bool+ (>) :: a -> a -> Bool+ (>=) :: a -> a -> Bool+ max :: a -> a -> a+ min :: a -> a -> a++ compare x y = if x == y then EQ+ else if x <= y then LT+ else GT++ x <= y = case compare x y of { GT -> False; _ -> True }+ x >= y = y <= x+ x > y = if x <= y then False else True+ x < y = if y <= x then False else True++ min x y = if x <= y then x else y+ max x y = if x <= y then y else x+
@@ -2,12 +2,39 @@ -- due to import cycles. module Data.Orphans where import qualified Prelude(); import MiniPrelude+import Data.Bits+import Data.Eq+import Data.Floating+import Data.Fractional+import Data.Ix+import Data.Num+import Data.Monoid+import Data.Real+import Data.RealFloat+import Data.RealFrac+import Foreign.Storable+import Mhs.Builtin import Text.Read -instance (Read a) => Read (Down a) where- readsPrec d = readParen (d > 10) $ \ r ->- [(Down x,t) | ("Down",s) <- lex r, (x,t) <- readsPrec 11 s]+deriving instance (Num a) => Num (Down a)+deriving instance (Semigroup a) => Semigroup (Down a)+deriving instance (Monoid a) => Monoid (Down a)+deriving instance (Bits a) => Bits (Down a)+deriving instance (FiniteBits a) => FiniteBits (Down a)+deriving instance (Floating a) => Floating (Down a)+deriving instance (Fractional a) => Fractional (Down a)+deriving instance (Ix a) => Ix (Down a)+deriving instance (Read a) => Read (Down a)+deriving instance (Real a) => Real (Down a)+deriving instance (RealFrac a) => RealFrac (Down a)+deriving instance (RealFloat a) => RealFloat (Down a)+deriving instance (Show a) => Show (Down a)+deriving instance (Storable a) => Storable (Down a) -instance (Show a) => Show (Down a) where- showsPrec d (Down x) = showParen (d > 10) $- showString "Down " . showsPrec 11 x+instance Num (f a) => Num (Alt f a) where+ Alt x + Alt y = Alt (x + y)+ Alt x * Alt y = Alt (x * y)+ fromInteger = Alt . fromInteger+ abs (Alt x) = Alt (abs x)+ negate (Alt x) = Alt (negate x)+ signum (Alt x) = Alt (signum x)
@@ -49,6 +49,8 @@ pred x = x - 1 toEnum = fromIntegral fromEnum = fromInteger . truncate+ -- NOTE: this intentionally differs from the Haskell Report.+ -- Use fractionalEnumFrom etc. to get the Report behavior. enumFrom = numericEnumFrom enumFromThen = numericEnumFromThen enumFromTo = numericEnumFromTo
@@ -32,7 +32,7 @@ , Ord -- ^ @since 4.9.0.0 , Show -- ^ @since 4.9.0.0 , Read -- ^ @since 4.9.0.0--- , Data -- ^ @since 4.9.0.0+ , Data -- ^ @since 4.9.0.0 -- , Generic -- ^ @since 4.9.0.0 -- , Generic1 -- ^ @since 4.9.0.0 )@@ -87,7 +87,7 @@ , Ord -- ^ @since 4.9.0.0 , Show -- ^ @since 4.9.0.0 , Read -- ^ @since 4.9.0.0--- , Data -- ^ @since 4.9.0.0+ , Data -- ^ @since 4.9.0.0 -- , Generic -- ^ @since 4.9.0.0 -- , Generic1 -- ^ @since 4.9.0.0 )@@ -150,7 +150,7 @@ , Ord -- ^ @since 4.9.0.0 , Show -- ^ @since 4.9.0.0 , Read -- ^ @since 4.9.0.0--- , Data -- ^ @since 4.9.0.0+ , Data -- ^ @since 4.9.0.0 -- , Generic -- ^ @since 4.9.0.0 -- , Generic1 -- ^ @since 4.9.0.0 )
@@ -0,0 +1,148 @@+module Data.String.Interpolate(+ interpolateRaw,+ interpolateValue,+ interpolateAppend,+ interpolateEmpty,+ interpolateFinalize,+ StringBuilder,+ buildString,+ Interpolate(..),+ --+ Adjust(..),+ FloatFmt(..),+ ) where+import qualified Prelude()+import Data.Bool+import Data.Char+import Data.Coerce+import Data.Double+import Data.Eq+import Data.Float+import Data.Function+import Data.Int+import Data.Integer+import Data.List+import Data.Num+import Data.Maybe+import Data.Monoid+import Data.Monoid.Internal+import Data.Ord+import Data.RealFloat+import Data.String+import Data.Word+import {-# SOURCE #-} Data.Typeable+import Numeric.FormatFloat+import Text.Show++-----+-- Implementation of s"..."+--+-- Example:+-- s"foo ${f a b} bar ${g x} baz ${name}"+-- desugared+-- interpolateFinalize $+-- interpolateRaw "foo " `interpolateAppend`+-- interpolateValue (f a b)`interpolateAppend`+-- interpolateRaw " bar " `interpolateAppend`+-- interpolateValue (g x) `interpolateAppend`+-- interpolateRaw " baz " `interpolateAppend`+-- interpolateValue name `interpolateAppend`+-- interpolateEmpty+--++interpolateRaw :: String -> StringBuilder+interpolateRaw = fromString++interpolateValue :: Interpolate a => a -> StringBuilder+interpolateValue = interpolate++interpolateAppend :: StringBuilder -> StringBuilder -> StringBuilder+interpolateAppend = mappend++interpolateEmpty :: StringBuilder+interpolateEmpty = mempty++interpolateFinalize :: IsString a => StringBuilder -> a+interpolateFinalize = fromString . buildString++-----+-- StringBuilder++newtype StringBuilder = StringBuilder (Endo String)+ deriving newtype (Semigroup, Monoid)++instance IsString StringBuilder where+ fromString s = StringBuilder (Endo (s <>))++buildString :: StringBuilder -> String+buildString (StringBuilder (Endo f)) = f ""++-----+-- Interpolation of values++class Interpolate a where+ interpolate :: (IsString s, Monoid s) => a -> s++instance Interpolate String where+ interpolate = fromString+instance Interpolate Char where+ interpolate c = fromString [c]++instance Interpolate Integer where+ interpolate = fromString . show+instance Interpolate Int where+ interpolate = fromString . show+instance Interpolate Int8 where+ interpolate = fromString . show+instance Interpolate Int16 where+ interpolate = fromString . show+instance Interpolate Int32 where+ interpolate = fromString . show+instance Interpolate Int64 where+ interpolate = fromString . show++instance Interpolate Word where+ interpolate = fromString . show+instance Interpolate Word8 where+ interpolate = fromString . show+instance Interpolate Word16 where+ interpolate = fromString . show+instance Interpolate Word32 where+ interpolate = fromString . show+instance Interpolate Word64 where+ interpolate = fromString . show++instance Interpolate Float where+ interpolate = fromString . show+instance Interpolate Double where+ interpolate = fromString . show++instance Interpolate Bool where+ interpolate = fromString . show++----------------------------------+-- MicroHs externsions++measure :: Interpolate a => a -> Int+measure = length . buildString . interpolate++data Adjust a+ = LeftAdj Int a+ | RightAdj Int a+ | LeftAdjPad Char Int a+ | RightAdjPad Char Int a+ deriving (Eq, Show)++instance Interpolate a => Interpolate (Adjust a) where+ interpolate (LeftAdj n a) = interpolate (LeftAdjPad ' ' n a)+ interpolate (RightAdj n a) = interpolate (RightAdjPad ' ' n a)+ interpolate (LeftAdjPad c n a) = interpolate a <> fromString (replicate (n - measure a) c)+ interpolate (RightAdjPad c n a) = fromString (replicate (n - measure a) c) <> interpolate a++data FloatFmt a = EFloat Int a | FFloat Int a | GFloat Int a+ deriving (Eq, Show)++instance (RealFloat a) => Interpolate (FloatFmt a) where+ interpolate (EFloat n a) = fromString (showEFloat (Just n) a "")+ interpolate (FFloat n a) = fromString (showFFloat (Just n) a "")+ interpolate (GFloat n a) = fromString (showGFloat (Just n) a "")
@@ -0,0 +1,16 @@+module Data.String.Interpolate.Basic where++interpolateRaw :: IsString s => String -> s+interpolateRaw = fromString++interpolateValue :: s -> s+interpolateValue = id++interpolateAppend :: Monoid s => s -> s -> s+interpolateAppend = mappend++interpolateEmpty :: Monoid s => s+interpolateEmpty = mempty++interpolateFinalize :: s -> s+interpolateFinalize = id
@@ -0,0 +1,16 @@+module Data.String.Interpolate.ShowS where++interpolateRaw :: String -> ShowS+interpolateRaw = showString++interpolateValue :: Show a => a -> ShowS+interpolateValue = shows++interpolateAppend :: ShowS -> ShowS -> ShowS+interpolateAppend = (.)++interpolateEmpty :: ShowS+interpolateEmpty = id++interpolateFinalize :: ShowS -> ShowS+interpolateFinalize = id
@@ -1,7 +1,12 @@ module Data.Text( Text, StrictText,- pack, unpack,++ pattern Empty,+ pattern (:<),+ pattern (:>),+ pack,+ unpack, show, empty, singleton,@@ -19,7 +24,9 @@ words, unwords, toLower,+ toTitle, toUpper,+ toCaseFold, foldr, concat, lines,@@ -41,23 +48,94 @@ stripEnd, stripPrefix, stripSuffix,+ all,+ any,+ concatMap,+ foldl,+ foldl',+ filter,+ reverse,+ last,+ init,+ elem,+ zip,+ span,+ break,+ breakOn,+ takeWhileEnd,+ count,+ index,+ chunksOf,+ breakOnEnd,+ center,+ compareLength,+ dropEnd,+ find,+ findIndex,+ group,+ groupBy,+ inits,+ tails,+ intersperse,+ justifyLeft,+ justifyRight,+ mapAccumL,+ mapAccumR,+ maximum,+ minimum,+ partition,+ scanl,+ scanr,+ split,+ splitAt,+ takeEnd,+ transpose,+ unfoldr,+ unfoldrN,+ unsnoc,+ zipWith,+ foldl1,+ foldr1,+ scanl1,+ scanr1,+ copy, ) where-import qualified Prelude(); import MiniPrelude hiding(head, tail, null, length, words, unwords, map)+import qualified Prelude(); import MiniPrelude hiding(head, tail, null, length, words, unwords, map,+ concatMap, foldl, any, all, filter, reverse, last, init, elem, zip, span, break,+ maximum, minimum, scanl, scanr, splitAt, zipWith, foldl1, foldr1, scanl1, scanr1) import Control.DeepSeq.Class import qualified Data.Char as C+import qualified Data.Char.Unicode as U import qualified Data.List as L+import Data.List.NonEmpty_Type(NonEmpty(..)) import Data.String import qualified Data.ByteString.Internal as BS import Data.Text.Internal import Text.Read.Internal+import Primitives(primChr) type StrictText = Text +pattern Empty :: Text+pattern Empty <- (null -> True) where+ Empty = empty++infixr 5 :<+pattern (:<) :: Char -> Text -> Text+pattern x :< xs <- (uncons -> Just (x, xs)) where+ (:<) = cons++infixl 5 :>+pattern (:>) :: Text -> Char -> Text+pattern xs :> x <- (unsnoc -> Just (xs, x)) where+ (:>) = snoc+ instance Eq Text where (==) = cmp (==) (/=) = cmp (/=) instance Ord Text where+ compare (T x) (T y) = compare x y (<) = cmp (<) (<=) = cmp (<=) (>) = cmp (>)@@ -80,9 +158,14 @@ instance Semigroup Text where (<>) = append+ sconcat (t :| ts) = concat (t : ts)+ stimes n t+ | n <= 0 = error "stimes: positive multiplier expected"+ | otherwise = replicate (fromIntegral n) t instance Monoid Text where mempty = empty+ mconcat = concat instance NFData Text where rnf (T bs) = seq bs ()@@ -94,10 +177,10 @@ singleton c = pack [c] pack :: String -> Text-pack s = T (_primitive "toUTF8" s)+pack = T . BS.packUTF8 unpack :: Text -> String-unpack (T t) = _primitive "fromUTF8" t+unpack (T t) = BS.primBSfromUTF8 t append :: Text -> Text -> Text append (T x) (T y) = T (BS.append x y)@@ -106,12 +189,12 @@ null (T bs) = BS.null bs length :: Text -> Int-length = L.length . unpack+length (T b) = BS.primUTF8length b head :: Text -> Char head (T t) | BS.null t = error "Data.Text.head: empty"- | otherwise = _primitive "headUTF8" t+ | otherwise = BS.primBSheadUTF8 t cons :: Char -> Text -> Text cons c t = singleton c `append` t@@ -122,82 +205,113 @@ tail :: Text -> Text tail (T t) | BS.null t = error "Data.Text.tail: empty"- | otherwise = _primitive "tailUTF8" t+ | otherwise = T (BS.primBStailUTF8 t) uncons :: Text -> Maybe (Char, Text) uncons t | null t = Nothing | otherwise = Just (head t, tail t) replicate :: Int -> Text -> Text-replicate = stimes+replicate n t@(T b) | n <= 0 = empty+ | otherwise = T (BS.concatBS (L.replicate n b)) splitOn :: Text -> Text -> [Text]-splitOn s t = L.map pack $ splitOnList (unpack s) (unpack t)+splitOn p@(T pb) t@(T tb)+ | null p = error "splitOn: empty"+ | otherwise = go 0+ where+ n = bytes t+ go i = case BS.primBSfind pb tb i of+ j | j < 0 -> [slice i n t]+ | otherwise -> slice i j t : go (j + bytes p) dropWhileEnd :: (Char -> Bool) -> Text -> Text-dropWhileEnd p = pack . L.dropWhileEnd p . unpack--splitOnList :: Eq a => [a] -> [a] -> [[a]]-splitOnList [] = error "splitOn: empty"-splitOnList sep = loop []- where- loop r [] = [reverse r]- loop r s@(c:cs) | Just t <- L.stripPrefix sep s = reverse r : loop [] t- | otherwise = loop (c:r) cs+dropWhileEnd p t@(T b) = slice 0 (suffixStart p b) t words :: Text -> [Text]-words = L.map pack . L.words . unpack+words t@(T b) = go 0+ where+ n = bytes t+ go i = case BS.primUTF8skipSpace b i of+ s | s >= n -> []+ | otherwise -> case BS.primUTF8skipNonSpace b s of+ e -> slice s e t : go e unwords :: [Text] -> Text-unwords = pack . L.unwords . L.map unpack+unwords = intercalate (singleton ' ') toLower :: Text -> Text-toLower = pack . L.map C.toLower . unpack+toLower t@(T b)+ | isAsciiText t = T (BS.primBSasciiCase b 0)+ | otherwise = pack . L.concatMap U._toLowers . unpack $ t +toTitle :: Text -> Text+toTitle = pack . f . unpack+ where f [] = []+ f (c:cs) | U.isAlpha c = U._toTitles c ++ g cs+ | otherwise = c : f cs+ g [] = []+ g (c:cs) | U.isAlpha c = U._toLowers c ++ g cs+ | otherwise = c : f cs+ toUpper :: Text -> Text-toUpper = pack . L.map C.toUpper . unpack+toUpper t@(T b)+ | isAsciiText t = T (BS.primBSasciiCase b 1)+ | otherwise = pack . L.concatMap U._toUppers . unpack $ t +toCaseFold :: Text -> Text+toCaseFold t@(T b)+ | isAsciiText t = T (BS.primBSasciiCase b 0)+ | otherwise = pack . L.concatMap U._toFolds . unpack $ t+ foldr :: (Char -> a -> a) -> a -> Text -> a foldr f z = L.foldr f z . unpack concat :: [Text] -> Text-concat = L.foldr append empty+concat [] = empty+concat [t] = t+concat ts = T (BS.concatBS (L.map (\ (T b) -> b) ts)) unlines :: [Text] -> Text-unlines = L.foldr (\ l -> append (append l (pack "\n"))) empty+unlines ls = concat (L.concatMap (\ l -> [l, newline]) ls) lines :: Text -> [Text]-lines = L.map pack . L.lines . unpack+lines t@(T b) = go 0+ where+ n = bytes t+ go i | i >= n = []+ | otherwise = case BS.primBSfind newlineBS b i of+ j | j < 0 -> [slice i n t]+ | otherwise -> slice i j t : go (j + 1) take :: Int -> Text -> Text-take n = pack . L.take n . unpack+take n t@(T b) = slice 0 (BS.primUTF8offset b n) t drop :: Int -> Text -> Text-drop n = pack . L.drop n . unpack+drop n t@(T b) = slice (BS.primUTF8offset b n) (bytes t) t intercalate :: Text -> [Text] -> Text-intercalate _ [] = empty-intercalate _ [x] = x-intercalate s (x:xs) = x `append` s `append` intercalate s xs+intercalate s ts = concat (L.intersperse s ts) replace :: Text -> Text -> Text -> Text-replace s r = intercalate r . splitOn s+replace s r+ | null s = error "Data.Text.replace: empty input"+ | otherwise = intercalate r . splitOn s --- XXX Should make the BS version efficient and go via that isPrefixOf :: Text -> Text -> Bool-isPrefixOf p s = L.isPrefixOf (unpack p) (unpack s)+isPrefixOf p t = bytes p <= bytes t && slice 0 (bytes p) t == p isSuffixOf :: Text -> Text -> Bool-isSuffixOf p s = L.isSuffixOf (unpack p) (unpack s)+isSuffixOf p t = bytes p <= bytes t && slice (bytes t - bytes p) (bytes t) t == p isInfixOf :: Text -> Text -> Bool-isInfixOf p s = L.isInfixOf (unpack p) (unpack s)+isInfixOf (T p) (T t) = BS.primBSfind p t 0 >= 0 dropWhile :: (Char -> Bool) -> Text -> Text-dropWhile p = pack . L.dropWhile p . unpack+dropWhile p t@(T b) = slice (prefixEnd p b 0) (bytes t) t takeWhile :: (Char -> Bool) -> Text -> Text-takeWhile p = pack . L.takeWhile p . unpack+takeWhile p t@(T b) = slice 0 (prefixEnd p b 0) t map :: (Char -> Char) -> Text -> Text map f = pack . L.map f . unpack@@ -206,16 +320,349 @@ dropAround p = dropWhile p . dropWhileEnd p stripStart :: Text -> Text-stripStart = dropWhile C.isSpace+stripStart t@(T b) = slice (BS.primUTF8skipSpace b 0) (bytes t) t stripEnd :: Text -> Text-stripEnd = dropWhileEnd C.isSpace+stripEnd t@(T b) = slice 0 (BS.primUTF8trimSpaceEnd b) t strip :: Text -> Text-strip = dropAround C.isSpace+strip t@(T b) = slice (BS.primUTF8skipSpace b 0) (BS.primUTF8trimSpaceEnd b) t stripPrefix :: Text -> Text -> Maybe Text-stripPrefix p t = pack <$> L.stripPrefix (unpack p) (unpack t)+stripPrefix p t+ | p `isPrefixOf` t = Just (slice (bytes p) (bytes t) t)+ | otherwise = Nothing stripSuffix :: Text -> Text -> Maybe Text-stripSuffix p t = pack <$> L.stripSuffix (unpack p) (unpack t)+stripSuffix p t+ | p `isSuffixOf` t = Just (slice 0 (bytes t - bytes p) t)+ | otherwise = Nothing++all :: (Char -> Bool) -> Text -> Bool+all p (T b) = L.all (L.all p) (chunksFrom b)++any :: (Char -> Bool) -> Text -> Bool+any p (T b) = L.any (L.any p) (chunksFrom b)++concatMap :: (Char -> Text) -> Text -> Text+concatMap f t = concat [ f c | c <- unpack t ]++foldl :: (a -> Char -> a) -> a -> Text -> a+foldl f z = L.foldl f z . unpack++foldl' :: (a -> Char -> a) -> a -> Text -> a+foldl' f z = L.foldl' f z . unpack++filter :: (Char -> Bool) -> Text -> Text+filter p = pack . L.filter p . unpack++reverse :: Text -> Text+reverse (T b) = T (BS.primUTF8reverse b)++last :: Text -> Char+last t@(T b)+ | null t = error "Data.Text.last: empty"+ | otherwise = charOf (BS.primUTF8decodeEnd b (bytes t))++init :: Text -> Text+init t@(T b)+ | null t = error "Data.Text.init: empty"+ | otherwise = slice 0 (BS.primUTF8offsetEnd b 1) t++elem :: Char -> Text -> Bool+elem c t+ | c >= '\xD800' && c <= '\xDFFF' = False -- never in a Text ('pack' replaces them)+ | otherwise = singleton c `isInfixOf` t++zip :: Text -> Text -> [(Char, Char)]+zip a b = L.zip (unpack a) (unpack b)++span :: (Char -> Bool) -> Text -> (Text, Text)+span p t@(T b) = case prefixEnd p b 0 of i -> (slice 0 i t, slice i (bytes t) t)++break :: (Char -> Bool) -> Text -> (Text, Text)+break p = span (not . p)++-- | Split at the first occurrence of the pattern (which is part of the second component).+breakOn :: Text -> Text -> (Text, Text)+breakOn p'@(T p) t@(T b)+ | null p' = error "Data.Text.breakOn: empty input"+ | otherwise =+ case BS.primBSfind p b 0 of+ i | i < 0 -> (t, empty)+ | otherwise -> (slice 0 i t, slice i (bytes t) t)++takeWhileEnd :: (Char -> Bool) -> Text -> Text+takeWhileEnd p t@(T b) = slice (suffixStart p b) (bytes t) t++-- | Number of non-overlapping occurrences of the pattern.+count :: Text -> Text -> Int+count p@(T pb) (T b)+ | null p = error "Data.Text.count: empty pattern"+ | otherwise = go 0 0+ where+ go k i = case BS.primBSfind pb b i of+ j | j < 0 -> k+ | otherwise -> go (k + 1) (j + bytes p)++index :: Text -> Int -> Char+index t@(T b) i+ | i < 0 = error "Data.Text.index: negative index"+ | o >= bytes t = error "Data.Text.index: index too large"+ | otherwise = charOf (BS.primUTF8decode b o)+ where o = BS.primUTF8offset b i++chunksOf :: Int -> Text -> [Text]+chunksOf n t | n <= 0 || null t = []+ | otherwise = take n t : chunksOf n (drop n t)++breakOnEnd :: Text -> Text -> (Text, Text)+breakOnEnd p@(T pb) t@(T b)+ | null p = error "Data.Text.breakOnEnd: empty input"+ | otherwise =+ case BS.primBSrfind pb b of+ i | i < 0 -> (empty, t)+ | otherwise -> case i + bytes p of j -> (slice 0 j t, slice j (bytes t) t)++replicateChar :: Int -> Char -> Text+replicateChar n c = pack (L.replicate n c)++center :: Int -> Char -> Text -> Text+center k c t | len >= k = t+ | otherwise = replicateChar l c `append` t `append` replicateChar r c+ where len = length t+ d = k - len+ r = d `quot` 2+ l = d - r++justifyLeft :: Int -> Char -> Text -> Text+justifyLeft k c t | len >= k = t+ | otherwise = t `append` replicateChar (k - len) c+ where len = length t++justifyRight :: Int -> Char -> Text -> Text+justifyRight k c t | len >= k = t+ | otherwise = replicateChar (k - len) c `append` t+ where len = length t++compareLength :: Text -> Int -> Ordering+compareLength t@(T b) n+ | n < 0 = GT+ -- more than n characters: stop after the first n+ | BS.primUTF8offset b n < bytes t = GT+ | otherwise = compare (length t) n++dropEnd :: Int -> Text -> Text+dropEnd n t@(T b) = slice 0 (BS.primUTF8offsetEnd b n) t++takeEnd :: Int -> Text -> Text+takeEnd n t@(T b) = slice (BS.primUTF8offsetEnd b n) (bytes t) t++find :: (Char -> Bool) -> Text -> Maybe Char+find p (T b) = go (chunksFrom b)+ where+ go [] = Nothing+ go (c:cs) = case L.find p c of+ Nothing -> go cs+ r -> r++findIndex :: (Char -> Bool) -> Text -> Maybe Int+findIndex p (T b) = go 0 (chunkSizes `L.zip` chunksFrom b)+ where+ -- every chunk before the last one has exactly its size in characters+ go k [] = k `seq` Nothing+ go k ((m, c) : cs) = k `seq` case L.findIndex p c of+ Just j -> Just (k + j)+ Nothing -> go (k + m) cs++group :: Text -> [Text]+group = groupBy (==)++groupBy :: (Char -> Char -> Bool) -> Text -> [Text]+groupBy f = L.map pack . L.groupBy f . unpack++inits :: Text -> [Text]+inits t = L.map (\ i -> slice 0 i t) (boundaries t)++tails :: Text -> [Text]+tails t = L.map (\ i -> slice i (bytes t) t) (boundaries t)++intersperse :: Char -> Text -> Text+intersperse c = pack . L.intersperse c . unpack++mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)+mapAccumL f z t = case L.mapAccumL f z (unpack t) of (a, s) -> (a, pack s)++mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)+mapAccumR f z t = case L.mapAccumR f z (unpack t) of (a, s) -> (a, pack s)++maximum :: Text -> Char+maximum = L.maximum . unpack++minimum :: Text -> Char+minimum = L.minimum . unpack++partition :: (Char -> Bool) -> Text -> (Text, Text)+partition p t = case L.partition p (unpack t) of (a, b) -> (pack a, pack b)++scanl :: (Char -> Char -> Char) -> Char -> Text -> Text+scanl f z = pack . L.scanl f z . unpack++scanr :: (Char -> Char -> Char) -> Char -> Text -> Text+scanr f z = pack . L.scanr f z . unpack++-- | Split on characters satisfying the predicate.+split :: (Char -> Bool) -> Text -> [Text]+split p t = L.map pack (go (unpack t))+ where go s = case L.break p s of+ (a, []) -> [a]+ (a, _ : rest) -> a : go rest++splitAt :: Int -> Text -> (Text, Text)+splitAt n t@(T b) = case BS.primUTF8offset b n of i -> (slice 0 i t, slice i (bytes t) t)++transpose :: [Text] -> [Text]+transpose = L.map pack . L.transpose . L.map unpack++unfoldr :: (a -> Maybe (Char, a)) -> a -> Text+unfoldr f = pack . L.unfoldr f++unfoldrN :: Int -> (a -> Maybe (Char, a)) -> a -> Text+unfoldrN n f = pack . L.take n . L.unfoldr f++unsnoc :: Text -> Maybe (Text, Char)+unsnoc t | null t = Nothing+ | otherwise = Just (init t, last t)++zipWith :: (Char -> Char -> Char) -> Text -> Text -> Text+zipWith f a b = pack (L.zipWith f (unpack a) (unpack b))++foldl1 :: (Char -> Char -> Char) -> Text -> Char+foldl1 f = L.foldl1 f . unpack++foldr1 :: (Char -> Char -> Char) -> Text -> Char+foldr1 f = L.foldr1 f . unpack++scanl1 :: (Char -> Char -> Char) -> Text -> Text+scanl1 f = pack . L.scanl1 f . unpack++scanr1 :: (Char -> Char -> Char) -> Text -> Text+scanr1 f = pack . L.scanr1 f . unpack++-----------------------------------------------------------------------------+-- Byte-level helpers. A Text is a (modified) UTF-8 ByteString; the+-- primitives in Data.ByteString.Internal work on byte offsets, so most+-- functions slice the original bytes instead of going through a String.++bytes :: Text -> Int+bytes (T b) = BS.primBSlength b++-- | The bytes from offset @i@ up to (not including) offset @j@.+slice :: Int -> Int -> Text -> Text+slice i j t@(T b)+ | i <= 0 && j >= BS.primBSlength b = t+ | j <= i = empty+ | otherwise = T (BS.primBSsubstr b i (j - i))++-- | The character and byte count in a result of 'BS.primUTF8decode'.+charOf :: Int -> Char+charOf r = primChr (r `quot` 8)++widthOf :: Int -> Int+widthOf r = r `rem` 8++-- The predicate is Haskell, so these look at every character in turn.+-- Decoding one character per primitive call costs about three times as+-- much as walking a String that the runtime has unpacked, so the bytes+-- are unpacked in chunks: 16 characters first, doubling up to 'maxChunk',+-- which keeps an early exit cheap and a long walk linear. The last+-- 'smallRest' bytes are unpacked at once.++maxChunk :: Int+maxChunk = 4096++smallRest :: Int+smallRest = 256++-- | The next chunk of @b@ from byte offset @i@: at most @sz@ characters+-- (or all of a small rest).+chunkOf :: Int -> BS.ByteString -> Int -> BS.ByteString+chunkOf sz b i+ | n - i <= smallRest = if i == 0 then b else BS.primBSsubstr b i (n - i)+ | otherwise = BS.primBSsubstr b i (BS.primUTF8offsetFrom b i sz - i)+ where n = BS.primBSlength b++-- | Where the chunk of @b@ that ends at byte offset @i@ starts: at most+-- @sz@ characters (or all of a small front).+chunkStartBefore :: Int -> BS.ByteString -> Int -> Int+chunkStartBefore sz b i+ | i <= smallRest = 0+ | otherwise = BS.primUTF8offsetEndBefore b i sz++-- | Offset of the first character at or after @i@ that does not satisfy @p@.+prefixEnd :: (Char -> Bool) -> BS.ByteString -> Int -> Int+prefixEnd p b = go 16+ where+ n = BS.primBSlength b+ go sz i+ | i >= n = n+ | otherwise =+ case chunkOf sz b i of+ chunk -> case leading p (BS.primBSfromUTF8 chunk) of+ k | k < 0 -> go (min maxChunk (sz * 2)) (i + BS.primBSlength chunk)+ | otherwise -> i + BS.primUTF8offset chunk k++-- | Offset where the longest suffix whose characters satisfy @p@ starts.+suffixStart :: (Char -> Bool) -> BS.ByteString -> Int+suffixStart p b = go 16 (BS.primBSlength b)+ where+ go sz i+ | i <= 0 = 0+ | otherwise =+ case chunkStartBefore sz b i of+ s -> case (if s == 0 && i == BS.primBSlength b then b else BS.primBSsubstr b s (i - s)) of+ chunk -> case leading p (L.reverse (BS.primBSfromUTF8 chunk)) of+ k | k < 0 -> go (min maxChunk (sz * 2)) s+ | otherwise -> s + BS.primUTF8offsetEnd chunk k++-- | The number of leading characters that satisfy @p@, or -1 if all do.+leading :: (Char -> Bool) -> String -> Int+leading p = go 0+ where+ go k [] = k `seq` (-1)+ go k (c:cs) = k `seq` (if p c then go (k + 1) cs else k)++-- | The characters, unpacked lazily in chunks of 'chunkSizes' characters.+chunksFrom :: BS.ByteString -> [String]+chunksFrom b = go chunkSizes 0+ where+ n = BS.primBSlength b+ go (sz:szs) i+ | i >= n = []+ | otherwise = case chunkOf sz b i of+ chunk -> BS.primBSfromUTF8 chunk : go szs (i + BS.primBSlength chunk)+ go [] _ = []++chunkSizes :: [Int]+chunkSizes = L.takeWhile (< maxChunk) (L.iterate (* 2) 16) ++ L.repeat maxChunk++-- | The offset of every character, and the end.+boundaries :: Text -> [Int]+boundaries t@(T b) = go 0+ where+ n = bytes t+ go i | i >= n = [n]+ | otherwise = i : go (i + widthOf (BS.primUTF8decode b i))++isAsciiText :: Text -> Bool+isAsciiText (T b) = BS.primBSisAscii b /= 0++newline :: Text+newline = pack "\n"++newlineBS :: BS.ByteString+newlineBS = case newline of T b -> b++-- Force the text to be copied.+copy :: Text -> Text+copy (T t) = T (BS.concatBS [t])
@@ -20,8 +20,10 @@ import Data.Bits.Base import Data.ByteString (ByteString, isValidUtf8) import Data.ByteString qualified as BS+import qualified Data.ByteString.Internal as BSI import Data.Char-import Data.Text+import Data.Text (Text, pack, unpack)+import Data.Text.Internal import Data.Word.Word8 (intToWord8, word8ToInt) import Unsafe.Coerce (unsafeCoerce) @@ -32,16 +34,16 @@ decodeLatin1 = pack . unsafeCoerce BS.unpack -- Safety: Char and Word8 have the same representation & a Latin-1 byte is the correct Unicode code point decodeASCIIPrefix :: ByteString -> (Text, ByteString)-decodeASCIIPrefix bs = let (a, b) = BS.span (< 0x80) bs in (unsafeCoerce a, b) -- Safety: the ByteString is valid ASCII, which is also valid UTF-8 and Text uses UTF-8 encoding+decodeASCIIPrefix bs = let (a, b) = BS.span (< 0x80) bs in (fromUtf8Bytes a, b) -- Safety: the ByteString is valid ASCII, which is also valid UTF-8 and Text uses UTF-8 encoding decodeASCII :: ByteString -> Text decodeASCII bs- | isValidASCII bs = unsafeCoerce bs -- Safety: the ByteString is valid ASCII, which is also valid UTF-8 and Text uses UTF-8 encoding+ | isValidASCII bs = fromUtf8Bytes bs -- Safety: the ByteString is valid ASCII, which is also valid UTF-8 and Text uses UTF-8 encoding | otherwise = error "Data.Text.Encoding.decodeASCII: invalid" decodeUtf8 :: ByteString -> Text decodeUtf8 bs- | isValidUtf8 bs = unsafeCoerce bs -- Safety: the ByteString is valid UTF-8 and Text uses UTF-8 encoding+ | isValidUtf8 bs = fromUtf8Bytes bs -- Safety: the ByteString is valid UTF-8 and Text uses UTF-8 encoding | otherwise = error "Data.Text.Encoding.decodeUtf8: invalid" decodeUtf16LE :: ByteString -> Text@@ -89,7 +91,35 @@ decode _ = error "Data.Text.Encoding.decodeUtf32BE: impossible" -- length is not a multiple of 4 encodeUtf8 :: Text -> ByteString-encodeUtf8 = unsafeCoerce -- Safety: Text uses UTF-8 encoding+encodeUtf8 (T bs) = replaceBytes modifiedNul nulByte bs -- Safety: Text uses (modified) UTF-8 encoding++-- Text stores NUL as the two bytes C0 80 (modified UTF-8), as 'pack'+-- does; standard UTF-8 has the single byte 00. Keeping one form means+-- that the byte-level functions in Data.Text (search, equality) see the+-- same character the same way.+fromUtf8Bytes :: ByteString -> Text+fromUtf8Bytes bs = T (replaceBytes nulByte modifiedNul bs)++nulByte :: ByteString+nulByte = BS.pack [0]++modifiedNul :: ByteString+modifiedNul = BS.pack [0xC0, 0x80]++-- | Replace every occurrence of the first string.+replaceBytes :: ByteString -> ByteString -> ByteString -> ByteString+replaceBytes old new s =+ case BSI.primBSfind old s 0 of+ j | j < 0 -> s+ | otherwise -> BSI.concatBS (from 0 j)+ where+ n = BSI.primBSlength s+ m = BSI.primBSlength old+ -- the piece from i up to the match at j, then the rest+ from i j = BSI.primBSsubstr s i (j - i) : new : go (j + m)+ go i = case BSI.primBSfind old s i of+ j | j < 0 -> [BSI.primBSsubstr s i (n - i)]+ | otherwise -> from i j encodeUtf16LE :: Text -> ByteString encodeUtf16LE = BS.pack . concatMap f . unpack
@@ -21,36 +21,59 @@ import qualified Prelude as P import Control.Exception (evaluate) import qualified Data.ByteString as BS+import qualified Data.ByteString.Internal as BS import Data.Text.Internal+import Data.Text(pack, unpack) import Data.Text.Encoding-import System.IO.Base(Handle, IOMode(..), hClose, openBinaryFile, stdin, stdout, withBinaryFile)+--import System.IO.Base(Handle, IOMode(..), hClose, openBinaryFile, stdin, stdout, withBinaryFile)+import System.IO.Base(Handle, IOMode(..), hClose, openFile, stdin, stdout, withFile)+import qualified System.IO.Base as IO +--+-- This is a mess!+-- For fast file operations we want to do IO on the bytestrings directly.+-- But stdin/stdout/stderr and files open with openFile are in UTF-8 mode+-- and there is no way to turn that off.+-- For now, do it the slow way via String.+ readFile :: FilePath -> IO Text readFile f = do- h <- openBinaryFile f ReadMode+-- h <- openBinaryFile f ReadMode+ h <- openFile f ReadMode hGetContents h writeFile :: FilePath -> Text -> IO ()-writeFile f t = withBinaryFile f WriteMode $ \ h -> hPutStr h t+writeFile f t = -- withBinaryFile f WriteMode $ \ h -> hPutStr h t+ withFile f WriteMode $ \ h -> hPutStr h t appendFile :: FilePath -> Text -> IO ()-appendFile f t = withBinaryFile f AppendMode $ \ h -> hPutStr h t+appendFile f t = -- withBinaryFile f AppendMode $ \ h -> hPutStr h t+ withFile f AppendMode $ \ h -> hPutStr h t hGetContents :: Handle -> IO Text hGetContents h = do+{-+--hPutStr h (T bs) = BS.hPutStr h bs -- need handle to be in raw mode. It isn't. bs <- BS.hGetContents h evaluate (decodeUtf8 bs)+-}+ pack <$> IO.hGetContents h hGetChunk :: Handle -> IO Text hGetChunk = hGetContents -- XXX: read chunk from buffer hGetLine :: Handle -> IO Text hGetLine h = do+{-+--hPutStr h (T bs) = BS.hPutStr h bs -- need handle to be in raw mode. It isn't. bs <- BS.hGetLine h evaluate (decodeUtf8 bs)+-}+ pack <$> IO.hGetLine h hPutStr :: Handle -> Text -> IO ()-hPutStr h (T bs) = BS.hPutStr h bs+--hPutStr h (T bs) = BS.hPutStr h bs -- need handle to be in raw mode. It isn't.+hPutStr h t = IO.hPutStr h (unpack t) hPutStrLn :: Handle -> Text -> IO () hPutStrLn h t = hPutStr h t >> hPutStr h "\n"
@@ -1,82 +1,116 @@--- |--- Module : Data.Text.Lazy--- Copyright : (c) 2009, 2010, 2012 Bryan O'Sullivan------ License : BSD-style--- Maintainer : bos@serpentine.com--- Portability : GHC------ A time and space-efficient implementation of Unicode text using--- lists of packed arrays.------ /Note/: Read below the synopsis for important notes on the use of--- this module.------ The representation used by this module is suitable for high--- performance use and for streaming large quantities of data. It--- provides a means to manipulate a large body of text without--- requiring that the entire content be resident in memory.------ Some operations, such as 'concat', 'append', 'reverse' and 'cons',--- have better time complexity than their "Data.Text" equivalents, due--- to the underlying representation being a list of chunks. For other--- operations, lazy 'Text's are usually within a few percent of strict--- ones, but often with better heap usage if used in a streaming--- fashion. For data larger than available memory, or if you have--- tight memory constraints, this module will be the only option.------ This module is intended to be imported @qualified@, to avoid name--- clashes with "Prelude" functions. eg.------ > import qualified Data.Text.Lazy as L--module Data.Text.Lazy- (- -- * Types- Text- , LazyText-- -- * Creation and elimination- , pack- , unpack- , singleton- , empty- , fromChunks- , toChunks- , toStrict- , fromStrict- , foldrChunks- , foldlChunks-- -- * Pattern matching- , pattern Empty- , pattern (:<)- , pattern (:>)-- -- * Basic interface- , cons- , snoc- , append- , uncons- , unsnoc- , head- , last- , tail- , init- , null- , length- , compareLength+module Data.Text.Lazy(+ -- Special for Data.Text.Lazy+ Text, LazyText,+ fromChunks,+ toChunks,+ toStrict,+ fromStrict,+ foldrChunks,+ foldlChunks, - , replicate- , splitOn- , dropWhileEnd- , map- , concat- ) where+ -- Common with Data.Text+ pattern Empty,+ pattern (:<),+ pattern (:>),+ pack,+ unpack,+ show,+ empty,+ singleton,+ append,+ null,+ length,+ head,+ tail,+ cons,+ snoc,+ uncons,+ replicate,+ splitOn,+ words,+ unwords,+ toLower,+ toTitle,+ toUpper,+ toCaseFold,+ foldr,+ concat,+ lines,+ unlines,+ take,+ drop,+ takeWhile,+ dropWhile,+ dropWhileEnd,+ intercalate,+ isPrefixOf,+ isSuffixOf,+ isInfixOf,+ replace,+ map,+ dropAround,+ strip,+ stripStart,+ stripEnd,+ stripPrefix,+ stripSuffix,+ all,+ any,+ concatMap,+ foldl,+ foldl',+ filter,+ reverse,+ last,+ init,+ elem,+ zip,+ span,+ break,+ breakOn,+ takeWhileEnd,+ count,+ index,+ chunksOf,+ breakOnEnd,+ center,+ compareLength,+ dropEnd,+ find,+ findIndex,+ group,+ groupBy,+ inits,+ tails,+ intersperse,+ justifyLeft,+ justifyRight,+ mapAccumL,+ mapAccumR,+ maximum,+ minimum,+ partition,+ scanl,+ scanr,+ split,+ splitAt,+ takeEnd,+ transpose,+ unfoldr,+ unfoldrN,+ unsnoc,+ zipWith,+ foldl1,+ foldr1,+ scanl1,+ scanr1,+ ) where import qualified Prelude(); import MiniPrelude hiding(head) import Primitives import Control.DeepSeq.Class import Data.Bounded+import qualified Data.Char as C+import qualified Data.Char.Unicode as U import qualified Data.ByteString.Internal as BS import qualified Data.ByteString.Unsafe as BS import Data.Data@@ -87,7 +121,7 @@ import Data.Text.Internal import Text.Read.Internal -data Text = Empty | Chunk !T.Text Text+data Text = Empty | Chunk !T.Text Text -- invariant: T.Text is never empty type LazyText = Text @@ -153,7 +187,6 @@ instance Monoid Text where mempty = empty- mappend = (<>) mconcat = concat instance IsString Text where@@ -192,10 +225,13 @@ textDataType = mkDataType "Data.Text.Lazy.Text" [packConstr] pack :: String -> Text-pack s = let (c, s') = L.splitAt defaultChunkSize s in Chunk (T.pack c) (pack s')+pack "" = Empty+pack s =+ case L.splitAt defaultChunkSize s of+ (c, s') -> Chunk (T.pack c) (pack s') unpack :: Text -> String-unpack = foldrChunks (\t s -> T.unpack t ++ s) ""+unpack = foldrChunks (\ t s -> T.unpack t ++ s) "" singleton :: Char -> Text singleton c = Chunk (T.singleton c) Empty@@ -213,6 +249,9 @@ toChunks :: Text -> [T.Text] toChunks = foldrChunks (:) [] +onChunks :: (T.Text -> T.Text) -> Text -> Text+onChunks f = foldrChunks (Chunk . f) Empty+ toStrict :: Text -> T.Text toStrict t = T.concat (toChunks t) @@ -323,15 +362,15 @@ splitOnList [] = error "splitOn: empty" splitOnList sep = loop [] where- loop r [] = [reverse r]- loop r s@(c:cs) | Just t <- L.stripPrefix sep s = reverse r : loop [] t- | otherwise = loop (c:r) cs+ loop r [] = [L.reverse r]+ loop r s@(c:cs) | Just t <- L.stripPrefix sep s = L.reverse r : loop [] t+ | otherwise = loop (c:r) cs dropWhileEnd :: (Char -> Bool) -> Text -> Text dropWhileEnd p = pack . L.dropWhileEnd p . unpack map :: (Char -> Char) -> Text -> Text-map f = foldrChunks (Chunk . T.map f) Empty+map f = onChunks (T.map f) concat :: [Text] -> Text concat [] = Empty@@ -342,15 +381,7 @@ -- | Currently set to 16 KiB, less the memory management overhead. defaultChunkSize :: Int-defaultChunkSize = 16384 - chunkOverhead---- | Currently set to 128 bytes, less the memory management overhead.-smallChunkSize :: Int-smallChunkSize = 128 - chunkOverhead---- | The memory management overhead. Currently this is tuned for GHC only.-chunkOverhead :: Int-chunkOverhead = _wordSize `primIntShl` 1+defaultChunkSize = 16384 - 32 emptyError :: String -> a emptyError fun = error ("Data.Text.Lazy." ++ fun ++ ": empty input")@@ -360,3 +391,190 @@ int64ToInt :: Int64 -> Int int64ToInt = primInt64ToInt++-----+-- XXX This is pretty much exact copies of Data.Text.+-- That's crazy! Strict text should be implemented as a single big chunk+-- of lazy text.++take :: Int64 -> Text -> Text+take n = pack . L.take (int64ToInt n) . unpack++drop :: Int64 -> Text -> Text+drop n = pack . L.drop (int64ToInt n) . unpack++toLower :: Text -> Text+toLower = onChunks T.toLower++toTitle :: Text -> Text+toTitle = onChunks T.toTitle++toUpper :: Text -> Text+toUpper = onChunks T.toUpper++toCaseFold :: Text -> Text+toCaseFold = onChunks T.toCaseFold++intercalate :: Text -> [Text] -> Text+intercalate _ [] = empty+intercalate _ [x] = x+intercalate s (x:xs) = x `append` s `append` intercalate s xs++-- XXX Should make the BS version efficient and go via that+isPrefixOf :: Text -> Text -> Bool+isPrefixOf p s = L.isPrefixOf (unpack p) (unpack s)++isSuffixOf :: Text -> Text -> Bool+isSuffixOf p s = L.isSuffixOf (unpack p) (unpack s)++isInfixOf :: Text -> Text -> Bool+isInfixOf p s = L.isInfixOf (unpack p) (unpack s)++replace :: Text -> Text -> Text -> Text+replace s r = intercalate r . splitOn s++dropAround :: (Char -> Bool) -> Text -> Text+dropAround p = dropWhile p . dropWhileEnd p++dropWhile :: (Char -> Bool) -> Text -> Text+dropWhile p = pack . L.dropWhile p . unpack++takeWhile :: (Char -> Bool) -> Text -> Text+takeWhile p = pack . L.takeWhile p . unpack++stripStart :: Text -> Text+stripStart = dropWhile C.isSpace++stripEnd :: Text -> Text+stripEnd = dropWhileEnd C.isSpace++strip :: Text -> Text+strip = dropAround C.isSpace++stripPrefix :: Text -> Text -> Maybe Text+stripPrefix p t = pack <$> L.stripPrefix (unpack p) (unpack t)++stripSuffix :: Text -> Text -> Maybe Text+stripSuffix p t = pack <$> L.stripSuffix (unpack p) (unpack t)++foldl :: (a -> Char -> a) -> a -> Text -> a+foldl f z = L.foldl f z . unpack++foldl' :: (a -> Char -> a) -> a -> Text -> a+foldl' f z = L.foldl' f z . unpack++filter :: (Char -> Bool) -> Text -> Text+filter p = onChunks (T.filter p)++reverse :: Text -> Text+reverse = pack . L.reverse . unpack++breakOn :: Text -> Text -> (Text, Text)+breakOn p t = go [] (unpack t)+ where ps = unpack p+ go acc s@(c:cs) | ps `L.isPrefixOf` s = (pack (L.reverse acc), pack s)+ | otherwise = go (c:acc) cs+ go acc [] = (pack (L.reverse acc), empty)++takeWhileEnd :: (Char -> Bool) -> Text -> Text+takeWhileEnd p = pack . L.reverse . L.takeWhile p . L.reverse . unpack++count :: Text -> Text -> Int+count p t = L.length (splitOn p t) - 1++index :: Text -> Int64 -> Char+index t i = unpack t L.!! int64ToInt i++chunksOf :: Int64 -> Text -> [Text]+chunksOf n t | n <= 0 || null t = []+ | otherwise = take n t : chunksOf n (drop n t)++breakOnEnd :: Text -> Text -> (Text, Text)+breakOnEnd p t = case breakOn (reverse p) (reverse t) of (a, b) -> (reverse b, reverse a)++replicateChar :: Int64 -> Char -> Text+replicateChar n c = pack (L.replicate (int64ToInt n) c)++center :: Int64 -> Char -> Text -> Text+center k c t | len >= k = t+ | otherwise = replicateChar l c `append` t `append` replicateChar r c+ where len = length t+ d = k - len+ r = d `quot` 2+ l = d - r++justifyLeft :: Int64 -> Char -> Text -> Text+justifyLeft k c t | len >= k = t+ | otherwise = t `append` replicateChar (k - len) c+ where len = length t++justifyRight :: Int64 -> Char -> Text -> Text+justifyRight k c t | len >= k = t+ | otherwise = replicateChar (k - len) c `append` t+ where len = length t++dropEnd :: Int64 -> Text -> Text+dropEnd n = pack . L.reverse . L.drop (int64ToInt n) . L.reverse . unpack++takeEnd :: Int64 -> Text -> Text+takeEnd n = pack . L.reverse . L.take (int64ToInt n) . L.reverse . unpack++find :: (Char -> Bool) -> Text -> Maybe Char+find p = L.find p . unpack++findIndex :: (Char -> Bool) -> Text -> Maybe Int64+findIndex p = fmap intToInt64 . L.findIndex p . unpack++group :: Text -> [Text]+group = L.map pack . L.group . unpack++groupBy :: (Char -> Char -> Bool) -> Text -> [Text]+groupBy f = L.map pack . L.groupBy f . unpack++inits :: Text -> [Text]+inits = L.map pack . L.inits . unpack++tails :: Text -> [Text]+tails = L.map pack . L.tails . unpack++intersperse :: Char -> Text -> Text+intersperse c = pack . L.intersperse c . unpack++mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)+mapAccumL f z t = case L.mapAccumL f z (unpack t) of (a, s) -> (a, pack s)++mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)+mapAccumR f z t = case L.mapAccumR f z (unpack t) of (a, s) -> (a, pack s)++maximum :: Text -> Char+maximum = L.maximum . unpack++minimum :: Text -> Char+minimum = L.minimum . unpack++partition :: (Char -> Bool) -> Text -> (Text, Text)+partition p t = case L.partition p (unpack t) of (a, b) -> (pack a, pack b)++scanl :: (Char -> Char -> Char) -> Char -> Text -> Text+scanl f z = pack . L.scanl f z . unpack++scanr :: (Char -> Char -> Char) -> Char -> Text -> Text+scanr f z = pack . L.scanr f z . unpack++split :: (Char -> Bool) -> Text -> [Text]+split p t = L.map pack (go (unpack t))+ where go s = case L.break p s of+ (a, []) -> [a]+ (a, _ : rest) -> a : go rest++splitAt :: Int64 -> Text -> (Text, Text)+splitAt n t = case L.splitAt (int64ToInt n) (unpack t) of (a, b) -> (pack a, pack b)++transpose :: [Text] -> [Text]+transpose = L.map pack . L.transpose . L.map unpack++unfoldr :: (a -> Maybe (Char, a)) -> a -> Text+unfoldr f = pack . L.unfoldr f++unfoldrN :: Int64 -> (a -> Maybe (Char, a)) -> a -> Text+unfoldrN n f = pack . L.take (int64ToInt n) . L.unfoldr f
@@ -24,7 +24,7 @@ splitTyConApp, typeRepArgs, typeRepTyCon,- typeRepFimgerprint,+ typeRepFingerprint, -- TyCon, tyConPackage,@@ -86,8 +86,8 @@ showsTypeRep :: TypeRep -> ShowS showsTypeRep = shows -typeRepFimgerprint :: TypeRep -> MD5CheckSum-typeRepFimgerprint (TypeRep m _ _) = m+typeRepFingerprint :: TypeRep -> MD5CheckSum+typeRepFingerprint (TypeRep m _ _) = m typeRepTyCon :: TypeRep -> TyCon typeRepTyCon (TypeRep _ tc _) = tc
@@ -7,6 +7,8 @@ class Typeable a where typeRep :: forall proxy . proxy a -> TypeRep +instance (Typeable f, Typeable a) => Typeable (f a)+ data TypeRep _mkTyCon :: forall a . String -> String -> a -> TypeRep
@@ -4,6 +4,10 @@ data Void deriving (Eq, Ord, Read, Show) +instance Semigroup Void where+ a <> _ = a+ stimes _ a = a+ absurd :: forall a . Void -> a absurd v = seq v (error "absurd")
@@ -32,11 +32,15 @@ abs x = x signum x = if x == 0 then 0 else 1 fromInteger = _integerToWord+ _fromInt = primIntToWord instance Integral Word where quot = primWordQuot rem = primWordRem toInteger = _wordToInteger+ -- Only use _fromInt when the Word fits in an Int+ _fromIntegral w = if i `primIntGE` 0 then _fromInt i else fromInteger (_wordToInteger w)+ where i = primWordToInt w instance Bounded Word where minBound = 0::Word@@ -140,6 +144,7 @@ bitSizeMaybe _ = Just _wordSize bitSize _ = _wordSize bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primWordPopcount zeroBits = 0
@@ -51,11 +51,13 @@ abs x = x signum x = if x == 0 then 0 else 1 fromInteger i = w16 (_integerToWord i)+ _fromInt = w16 . primIntToWord instance Integral Word16 where quot = bin16 primWordQuot rem = bin16 primWordRem toInteger = _wordToInteger . unW16+ _fromIntegral = _fromInt . primWordToInt . unW16 instance Bounded Word16 where minBound = w16 0@@ -102,6 +104,7 @@ bitSizeMaybe _ = Just 16 bitSize _ = 16 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primWordPopcount . unW16 zeroBits = 0
@@ -51,11 +51,13 @@ abs x = x signum x = if x == 0 then 0 else 1 fromInteger i = w32 (_integerToWord i)+ _fromInt = w32 . primIntToWord instance Integral Word32 where quot = bin32 primWordQuot rem = bin32 primWordRem toInteger = _wordToInteger . unW32+ _fromIntegral = _fromIntegral . unW32 -- a Word32 might not fit in an Int instance Bounded Word32 where minBound = w32 0@@ -102,6 +104,7 @@ bitSizeMaybe _ = Just 32 bitSize _ = 32 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primWordPopcount . unW32 zeroBits = 0
@@ -90,6 +90,7 @@ bitSizeMaybe _ = Just 64 bitSize _ = 64 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primWord64Popcount zeroBits = 0
@@ -51,11 +51,13 @@ abs x = x signum x = if x == 0 then 0 else 1 fromInteger i = w8 (_integerToWord i)+ _fromInt = w8 . primIntToWord instance Integral Word8 where quot = bin8 primWordQuot rem = bin8 primWordRem toInteger = _wordToInteger . unW8+ _fromIntegral = _fromInt . primWordToInt . unW8 instance Bounded Word8 where minBound = w8 0@@ -102,6 +104,7 @@ bitSizeMaybe _ = Just 8 bitSize _ = 8 bit = bitDefault+ rotate = rotateDefault testBit = testBitDefault popCount = primWordPopcount . unW8 zeroBits = 0
@@ -13,3 +13,6 @@ traceM :: forall m . Monad m => String -> m () traceM s = trace s (return ())++traceShow :: forall a r. Show a => a -> r -> r+traceShow a = trace (show a)
@@ -0,0 +1,4 @@+module Debug.Trace where+import qualified Prelude()+import Primitives+trace :: [Char] -> a -> a
@@ -9,61 +9,115 @@ ) where import qualified Prelude() -- do not import Prelude import Primitives-import Data.ByteString.Internal+import Control.Monad+import Data.ByteString.Internal as BS import Data.Char_Type import Data.Coerce(coerce)+import Data.Function+import Data.Num+import Data.Word.Word8 import Foreign.C.Types(CChar)+import Foreign.Ptr(Ptr, castPtr)+--import Foreign.ForeignPtr(withForeignPtr) import Foreign.Marshal.Alloc+import Foreign.Marshal.Utils(copyBytes)+import Foreign.Storable type CString = Ptr CChar type CStringLen = (Ptr CChar, Int) -primNewCAStringLen :: [Char] -> IO (Ptr CChar, Int)-primNewCAStringLen = _primitive "newCAStringLen"+-- The coercion is OK, because we will only use the lower 8 bits+-- of each Char. That's what the A signifies.+-- String and [Word8] have the same representation.+stringToWord8s :: String -> [Word8]+stringToWord8s = primUnsafeCoerce+word8sToString :: [Word8] -> String+word8sToString = primUnsafeCoerce newCAString :: String -> IO CString-newCAString s = primNewCAStringLen s `primBind` \ (s, _) -> primReturn s+newCAString s = packIO (stringToWord8s s) >>= getCString newCAStringLen :: String -> IO CStringLen-newCAStringLen = primNewCAStringLen+newCAStringLen s = packIO (stringToWord8s s) >>= getCStringLen +getCStringLen :: ByteString -> IO (CString, Int)+getCStringLen bs = do+ p <- getCString bs+ let l = primBSlength bs+ l `seq` return (p, l) -- evaluate l so we don't hold on to the bs+ withCAString :: forall a . String -> (CString -> IO a) -> IO a-withCAString s io =- newCAString s `primBind` \ cs ->- io cs `primBind` \ a ->- free cs `primThen`- primReturn a+withCAString s io = do+ cs <- newCAString s+ a <- io cs+ free cs+ return a withCAStringLen :: forall a . String -> (CStringLen -> IO a) -> IO a-withCAStringLen s io =- newCAStringLen s `primBind` \ cs@(p, _) ->- io cs `primBind` \ a ->- free p `primThen`- primReturn a+withCAStringLen s io = do+ cs@(p, _) <- newCAStringLen s+ a <- io cs+ free p+ return a peekCAString :: CString -> IO String-peekCAString cstr = primPackCString cstr `primBind` \bs -> primReturn (primUnsafeCoerce unpack bs)+peekCAString cstr = do+ bs <- primPackCString cstr+ return (word8sToString (unpack bs)) peekCAStringLen :: CStringLen -> IO String-peekCAStringLen (cstr, len) = primPackCStringLen cstr len `primBind` \bs -> primReturn (primUnsafeCoerce unpack bs)+peekCAStringLen (cstr, len) = do+ bs <- primPackCStringLen cstr len+ return (word8sToString (unpack bs)) --------------------------------------------------------- XXX: No encoding! newCString :: String -> IO CString-newCString = newCAString+newCString s = packUTF8IO s >>= getCString newCStringLen :: String -> IO CStringLen-newCStringLen = newCAStringLen+newCStringLen s = packUTF8IO s >>= getCStringLen withCString :: forall a . String -> (CString -> IO a) -> IO a-withCString = withCAString+withCString s io = do+ cs <- newCString s+ a <- io cs+ free cs+ return a withCStringLen :: forall a . String -> (CStringLen -> IO a) -> IO a-withCStringLen = withCAStringLen+withCStringLen s io = do+ cs@(p, _) <- newCAStringLen s+ a <- io cs+ free p+ return a peekCString :: CString -> IO String-peekCString = peekCAString+peekCString cstr = do+ bs <- primPackCString cstr+ return (primBSfromUTF8 bs) peekCStringLen :: CStringLen -> IO String-peekCStringLen = peekCAStringLen+peekCStringLen (cstr, len) = do+ bs <- primPackCStringLen cstr len+ return (primBSfromUTF8 bs)+++------------------------------------------------------++-- Copy the data from a bytestring and add a 0 at the end.+getCString :: ByteString -> IO (Ptr CChar)+--getCString = _primitive "bsgetptr"+getCString bs = + withForeignPtr (primBS2FPtr bs) $ \ p -> do -- raw pointer to the bytestring+ let l = BS.length bs+ buf <- mallocBytes (l + 1)+ copyBytes buf p l -- copy the bytestring+ pokeByteOff buf l (0 :: Word8) -- and add a trailing 0+ return (castPtr buf)++-- Avoid circular dependency+withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b+withForeignPtr fp io =+ io (primForeignPtrToPtr fp) `primBind` \ b ->+ primSeq fp (primReturn b)
@@ -10,8 +10,15 @@ copyBytes, moveBytes, ) where--import qualified Prelude(); import MiniPrelude+import qualified Prelude()+import Primitives(IO)+import Control.Monad+import Data.Bool+import Data.Eq(Eq(..))+import Data.Function(($))+import Data.Int(Int)+import Data.Maybe+import Data.Num import Foreign.Marshal.Alloc import Foreign.C.Types import Foreign.Ptr
@@ -11,10 +11,10 @@ castFunPtrToPtr, castPtrToFunPtr, freeHaskellFunPtr,- IntPtr,+ IntPtr(..), ptrToIntPtr, intPtrToPtr,- WordPtr,+ WordPtr(..), ptrToWordPtr, wordPtrToPtr, ) where
@@ -82,9 +82,6 @@ mempty :: Generically a mempty = Generically (to (mempty :: Rep a ())) - mappend :: Generically a -> Generically a -> Generically a- mappend = (<>)- type Generically1 :: forall k. (k -> Type) -> (k -> Type) newtype Generically1 f a = Generically1 (f a)
@@ -26,6 +26,7 @@ module Data.Monoid.Internal, module Data.Proxy, module Data.String,+ module Data.String.Interpolate, module Text.ParserCombinators.ReadPrec, module Text.Read.Internal, module Text.Read.Lex,@@ -63,6 +64,7 @@ import Data.Proxy(Proxy(..)) import Data.Monoid.Internal(Semigroup(..)) import Data.String(IsString(..))+import Data.String.Interpolate(interpolateRaw, interpolateValue, interpolateAppend, interpolateEmpty, interpolateFinalize) import Data.Records(HasField(..), SetField(..), composeSet) import Data.Traversable(Traversable(..)) import {-# SOURCE #-} Data.Typeable(Typeable(..), _mkTyCon, gcast1, gcast2)
@@ -0,0 +1,594 @@+-- Copyright 2026 Lennart Augustsson+-- See LICENSE file for full license.+--+-- Reading the graph, and extracting the code of a function: the part of the+-- graph of its value that is code, i.e., the partial applications that make+-- up the function.+-- The graph is read directly: nodeAddr gives the NODEPTR of a value,+-- decodeNodePtr says what it is, and a cell is read with peek. See NODEPTR+-- and struct node in eval.c for the encoding, and rts_info for the tables+-- that describe it.+--+-- The graph is traversed depth first from the root, and the application+-- nodes that are code, i.e., partial applications, are copied.+-- The traversal stops at+-- - data: a value, or a constructor with its fields;+-- - a redex, i.e., an application with as many arguments as its head needs;+-- it can be shared, so the copy refers to it instead;+-- - a node that starts a cycle, other than the root. It is a function of+-- its own, which can be extracted by itself. That a node starts a cycle+-- is only known when the traversal comes back to it, so it is copied+-- first; when the traversal is done with it, its copy and everything+-- after it is dropped, and it becomes a reference;+-- - a node beyond the exploration limit: exploreFactor times the size limit+-- copies made, counting the ones that are dropped, so a graph with many+-- cycles cannot make it explore the same nodes over and over.+-- The table of the copies is also the table of visited nodes, so sharing is+-- kept. A cycle back to the root is a reference to the root's copy, entry 0.+--+-- Finding the cycles needs a depth first traversal, but cutting the copy at+-- the size limit in depth first order would spend it on whatever is first,+-- e.g., the rotations of a balance function, and cut the tests near the root.+-- So the traversal explores more, and then select keeps the copied nodes that+-- are nearest the root, breadth first, up to the size limit.+--+-- The graph must not change while it is read: nothing may evaluate the+-- redexes in it. The GC does not move nodes, but it removes indirections,+-- and then frees them. So indirections are skipped at once, and a field is+-- read from its node just before the node it points to is visited.+module Mhs.Extract(+ -- The graph+ nodeAddr, NodePtr(..), Comb(..), Cell(..), decodeNodePtr, encodeNodePtr,+ -- Extraction+ Extraction(..), EntryNo, Entry(..), Why(..), Opnd(..),+ defaultLimit, extract, extractionProg, extractionSummary,+ ) where+import Control.Monad+import Data.Bits+import Data.ByteString(packCStringLen)+import Data.Char(toLower)+import Data.Int(Int64)+import Data.Maybe(fromMaybe, isJust, isNothing)+import Data.Word(Word8, Word16)+import Foreign.C.String(CString, peekCString)+import Foreign.C.Types(CInt)+import Foreign.Ptr+import Foreign.Storable+import Mhs.IntMap(IntMap)+import qualified Mhs.IntMap as M+import Mhs.Reflect(Exp(..), Literal(..), Prog(..))+import System.IO.Unsafe(unsafePerformIO)++-----------------------------------------------------------------------------+-- The graph++-- | The NODEPTR of a value, without evaluating it, see decodeNodePtr.+nodeAddr :: a -> Int+nodeAddr = _primitive "nodeAddr"++primRtsInfo :: IO (Ptr ())+primRtsInfo = _primitive "IO.rtsinfo"++-- Keep a value alive until this runs.+keepAlive :: a -> IO ()+keepAlive a = nodeAddr a `seq` return ()++-- | What a NODEPTR is. Its two lowest bits tell.+data NodePtr+ = CellPtr (Ptr Cell) -- ...00: a pointer to a cell+ | Comb Comb -- ...10: a combinator, primitive, constructor, or case,+ -- which is encoded in the NODEPTR instead of a cell+ | ValueTag Int -- ...11: only in the function field of a cell, which+ -- then holds a value instead of an application;+ -- the tag says what the value is, e.g., D_INT+ deriving (Eq, Show)++-- | A combinator, primitive, constructor, or case. The constructors and+-- cases are families, e.g., C_k_n, so they are indexed.+data Comb+ = Prim Int -- a combinator or primitive, e.g., S or +: its tag+ | C Int Int -- C_k_n: constructor number k, with n fields+ | D Int -- D_a0_..._am: a dense case: its index in the table of case arities+ | E Int -- E_k0_a0_..._km_am: a sparse case: ditto+ deriving (Eq, Show)++-- | A heap cell, i.e., a node: an application, or a value. The values are+-- named after their tags, e.g., D_INT.+data Cell+ = AP NodePtr NodePtr -- the function and the argument+ | IND NodePtr -- an indirection+ | INT Int+ | INT64 Int64+ | DBL Double+ | FLT32 Float+ | PTR (Ptr ())+ | FUNPTR (FunPtr ())+ | FORPTR (Ptr ()) -- a ForeignPtr or a ByteString: a struct forptr+ | ARR (Ptr ()) -- an array: a struct ioarray+ | THID (Ptr ()) -- a thread: a struct mthread+ | MVAR (Ptr ()) -- a struct mvar+ | WEAK (Ptr ()) -- a struct weak_ptr+ | IO_CCALL Int -- an FFI function: its number, see FFI_IX+ | BADDYN CString -- an unknown FFI function: its name+ | TICK Int -- a tick: its number in the tick table+ | DATA Int Word -- any other value: its tag, and the payload+ deriving (Eq, Show)++-- | What a NODEPTR is.+decodeNodePtr :: Int -> NodePtr+decodeNodePtr w =+ case w .&. 3 of+ 0 -> CellPtr (nullPtr `plusPtr` w)+ 2 -> Comb (virt ((w `shiftR` 2) .&. 0x7ff) (w `shiftR` 13))+ 3 -> ValueTag (w `shiftR` 2)+ _ -> error ("Mhs.Extract.decodeNodePtr: not a NODEPTR: " ++ show w)+ where+ virt t x+ | t == vConstr info = C (x .&. 0x7ff) ((x `shiftR` 11) .&. 0xff)+ | t == vCaseD info = D (x .&. 0x7ffff)+ | t == vCaseS info = E (x .&. 0x7ffff)+ | otherwise = Prim t++-- | The NODEPTR of a NodePtr.+encodeNodePtr :: NodePtr -> Int+encodeNodePtr (CellPtr p) = p `minusPtr` nullPtr+encodeNodePtr (ValueTag t) = t `shiftL` 2 .|. 3+encodeNodePtr (Comb c) =+ case c of+ Prim t -> virt t 0+ C k n -> virt (vConstr info) (n `shiftL` 11 .|. k)+ D i -> virt (vCaseD info) i+ E i -> virt (vCaseS info) i+ where virt t x = (x `shiftL` 11 .|. t) `shiftL` 2 .|. 2++-- A cell is two NODEPTRs, the function and the argument, or a value tag and+-- the payload, which can be wider than a NODEPTR.+instance Storable Cell where+ sizeOf _ = nodeSize info+ alignment _ = wordBytes info+ peek p = do+ f <- field 0+ case f of+ ValueTag t -> value t+ _ -> AP f <$> field (payload info)+ where+ field o = decodeNodePtr <$> peekByteOff p o+ val :: forall a . Storable a => IO a+ val = peekByteOff p (payload info)+ value t+ | t == dInd info = IND <$> field (payload info)+ | t == dInt info = INT <$> val+ | t == dInt64 info = INT64 <$> val+ | t == dDbl info = DBL <$> val+ | t == dFlt32 info = FLT32 <$> val+ | t == dPtr info = PTR <$> val+ | t == dFunPtr info = FUNPTR <$> val+ | t == dForPtr info = FORPTR <$> val+ | t == dArr info = ARR <$> val+ | t == dThid info = THID <$> val+ | t == dMVar info = MVAR <$> val+ | t == dWeak info = WEAK <$> val+ | t == dCCall info = IO_CCALL <$> val+ | t == dBadDyn info = BADDYN <$> val+ | t == dTick info = TICK <$> val+ | otherwise = DATA t <$> val+ poke p c =+ case c of+ AP f a -> field 0 f >> field (payload info) a+ IND a -> tag dInd >> field (payload info) a+ INT x -> tag dInt >> val x+ INT64 x -> tag dInt64 >> val x+ DBL x -> tag dDbl >> val x+ FLT32 x -> tag dFlt32 >> val x+ PTR x -> tag dPtr >> val x+ FUNPTR x -> tag dFunPtr >> val x+ FORPTR x -> tag dForPtr >> val x+ ARR x -> tag dArr >> val x+ THID x -> tag dThid >> val x+ MVAR x -> tag dMVar >> val x+ WEAK x -> tag dWeak >> val x+ IO_CCALL x -> tag dCCall >> val x+ BADDYN x -> tag dBadDyn >> val x+ TICK x -> tag dTick >> val x+ DATA t x -> field 0 (ValueTag t) >> val x+ where+ field o n = pokeByteOff p o (encodeNodePtr n)+ tag d = field 0 (ValueTag (d info))+ val :: forall a . Storable a => a -> IO ()+ val = pokeByteOff p (payload info)++-----------------------------------------------------------------------------+-- The runtime's tables, see rts_info in eval.c.++data Info = Info+ { wordBytes, nodeSize, payload :: Int+ , tagNames, tagArities, caseArities, ffiTable, numFfi, xffiTable :: Ptr ()+ , dInd, dInt, dInt64, dDbl, dFlt32, dPtr, dFunPtr, dForPtr+ , dArr, dThid, dMVar, dWeak, dCCall, dBadDyn, dTick+ , vConstr, vCaseD, vCaseS+ , forPtrFinalizer, forPtrPayload, finalFpType, fpBstr :: Int+ }++rtsInfoVersion :: Int+rtsInfoVersion = 2++-- The unsafePerformIO is safe: rts_info is a static struct in the runtime,+-- which is filled in before any Haskell code runs, and then never changes.+-- So reading it has no side effects, and gives the same result whenever it+-- is done, and info can be an ordinary value.+-- What can change is not in info: a variable that can change, e.g.,+-- case_arities, which is reallocated when code is loaded, is given by its+-- address, and read through it each time it is used.+info :: Info+info = unsafePerformIO $ do+ p <- primRtsInfo+ let ws = sizeOf p+ ptr :: Int -> IO (Ptr ())+ ptr i = peekByteOff p (i * ws)+ int :: Int -> IO Int+ int i = (fromIntegral :: Word -> Int) <$> peekByteOff p (i * ws)+ v <- int 0+ when (v /= rtsInfoVersion) $+ error "Mhs.Extract: the runtime has another version of rts_info"+ [size, pl] <- mapM int [1, 2]+ [names, arities, cases, ffi, nffi, xffi] <- mapM ptr [4 .. 9]+ [ind, i, i64, dbl, flt, ptr', funptr, fp, arr, thid, mvar, weak, ccall, baddyn, tick,+ con, cased, cases',+ fin, fppayload, fptype, bstr] <- mapM int [10 .. 31]+ return Info+ { wordBytes = ws, nodeSize = size, payload = pl+ , tagNames = names, tagArities = arities, caseArities = cases+ , ffiTable = ffi, numFfi = nffi, xffiTable = xffi+ , dInd = ind, dInt = i, dInt64 = i64, dDbl = dbl, dFlt32 = flt, dPtr = ptr'+ , dFunPtr = funptr, dForPtr = fp, dArr = arr, dThid = thid, dMVar = mvar, dWeak = weak+ , dCCall = ccall, dBadDyn = baddyn, dTick = tick+ , vConstr = con, vCaseD = cased, vCaseS = cases'+ , forPtrFinalizer = fin, forPtrPayload = fppayload, finalFpType = fptype, fpBstr = bstr+ }++tagName :: Int -> IO String+tagName t = do+ s <- peekElemOff (castPtr (tagNames info)) t+ if s == nullPtr then return ('?' : show t) else peekCString s++tagArity :: Int -> IO Int+tagArity t = fromIntegral <$> (peekElemOff (castPtr (tagArities info)) t :: IO Word8)++-- The name and arity of FFI function i, see FFI_IX.+-- An entry of the table is three words: the name, the arity, and the function.+ffiEntry :: Int -> IO (String, Int)+ffiEntry i = do+ let ws = wordBytes info+ num <- fromIntegral <$> (peek (castPtr (numFfi info)) :: IO CInt)+ e <- if i < num then+ return (ffiTable info `plusPtr` (i * 3 * ws))+ else do+ x <- peek (castPtr (xffiTable info)) :: IO (Ptr ())+ return (x `plusPtr` ((i - num) * 3 * ws))+ name <- peek (castPtr e) >>= peekCString+ arity <- peekByteOff e ws :: IO CInt+ return (name, fromIntegral arity)++-- Entry ix of the table of case arities: the constructor numbers of the+-- arms (for a sparse case), and their arities.+-- An entry is three words: the number of arms, the arities, and the tags.+caseArity :: Int -> IO (Maybe [Int], [Int])+caseArity ix = do+ let ws = wordBytes info+ tbl <- peek (castPtr (caseArities info)) :: IO (Ptr ())+ let e = tbl `plusPtr` (ix * 3 * ws)+ m <- fromIntegral <$> (peek (castPtr e) :: IO Word16)+ ap <- peekByteOff e ws :: IO (Ptr Word8)+ tp <- peekByteOff e (2 * ws) :: IO (Ptr Word16)+ as <- mapM (fmap fromIntegral . peekElemOff ap) [0 .. m - 1]+ ts <- if tp == nullPtr then return Nothing+ else Just <$> mapM (fmap fromIntegral . peekElemOff tp) [0 .. m - 1]+ return (ts, as)++-- The number of arguments a combinator needs before it reduces,+-- or -1 if it never reduces (a constructor), see arity_virt.+combArity :: Comb -> IO Int+combArity c =+ case c of+ Prim t -> tagArity t+ C _ _ -> return (-1)+ D i -> (+ 1) . length . snd <$> caseArity i+ E i -> (+ 2) . length . snd <$> caseArity i++combExp :: Comb -> IO Exp+combExp c =+ case c of+ Prim t -> tagName t >>= prim+ C k n -> return (Con k n)+ D i -> do (_, as) <- caseArity i; prim ('D' : nums as)+ E i -> do (ts, as) <- caseArity i+ prim ('E' : nums (concat (zipWith (\ k a -> [k, a]) (fromMaybe [] ts) as)))+ where+ prim = return . Lit . LPrim+ nums = concatMap (\ i -> '_' : show i)++-- The value of a cell, if it is a literal.+valueExp :: Cell -> IO (Maybe Exp)+valueExp c =+ case c of+ INT x -> lit (LInt x)+ INT64 x -> lit (LInt64 x)+ DBL x -> lit (LDouble x)+ FLT32 x -> lit (LFloat x)+ FORPTR fp -> do+ fin <- peekByteOff fp (forPtrFinalizer info) :: IO (Ptr ())+ ty <- if fin == nullPtr then return (-1) else peekByteOff fin (finalFpType info) :: IO CInt+ if fromIntegral ty /= fpBstr info then+ return Nothing+ else do+ -- struct bytestring: the size, the capacity, and the bytes+ let pl = fp `plusPtr` forPtrPayload info+ size <- peekByteOff pl 0 :: IO Word+ arr <- peekByteOff pl (2 * wordBytes info) :: IO CString+ packCStringLen (arr, fromIntegral size) >>= lit . LBytes+ _ -> return Nothing+ where lit = return . Just . Lit++skipInd :: NodePtr -> IO NodePtr+skipInd n@(CellPtr p) = do+ c <- peek p+ case c of+ IND a -> skipInd a+ _ -> return n+skipInd n = return n++-- The function and the argument of an application.+apFields :: Ptr Cell -> IO (NodePtr, NodePtr)+apFields p = do+ c <- peek p+ case c of+ AP f a -> return (f, a)+ _ -> error "Mhs.Extract: not an application"++notANode :: NodePtr -> a+notANode n = error ("Mhs.Extract: not a node: " ++ show n)++-----------------------------------------------------------------------------+-- The result++-- | What an entry of the extraction is.+data Why+ = Copy -- a copied application, i.e., code+ -- Why the copy stopped at a node, and refers to it instead:+ | Whnf -- data: a value, or a constructor with its fields+ | Redex -- an application that would reduce+ | Cycle -- a node that starts a cycle+ | Depth -- the size limit, since the nodes furthest from the root are cut+ deriving (Eq, Show)++-- | The number of an entry of the extraction. Entry 0 is the root.+type EntryNo = Int++-- | An operand of a copied application: an entry, or a leaf, i.e., a+-- combinator, primitive, constructor, FFI function, ..., which never changes.+data Opnd = Index EntryNo | Leaf NodePtr Exp+ deriving (Show)++data Entry = Entry+ { entryNode :: Ptr Cell -- the node it is a copy of, or refers to+ , entryWhy :: Why+ , entryValue :: Maybe Exp -- Whnf: the value, if it is a literal+ , entryFun :: Opnd -- Copy: the function,+ , entryArg :: Opnd -- and the argument+ }+ deriving (Show)++-- | The extracted subgraph: the entries, by their EntryNo.+newtype Extraction = Extraction (IntMap Entry)++-- | The default size limit.+defaultLimit :: Int+defaultLimit = 500++-- How many times the size limit to explore.+exploreFactor :: Int+exploreFactor = 4++-----------------------------------------------------------------------------+-- Extraction++-- What an application is: code to copy, data, or a redex. The arguments+-- on the spine are counted, and compared with the arity of the head.+classify :: NodePtr -> IO Why+classify = go 0+ where+ go :: Int -> NodePtr -> IO Why+ go d (Comb c) = do+ a <- combArity c+ return $ if a < 0 then Whnf else spine d a+ go d (CellPtr p) = do+ c <- peek p+ case c of+ AP f _ -> go (d + 1) f+ IND a -> go d a+ IO_CCALL i -> spine d . snd <$> ffiEntry i+ TICK _ -> return (spine d 1)+ _ -> return (if d == 0 then Whnf else Redex) -- a value, or an error+ go _ n = notANode n+ spine d a = if d < a then Copy else Redex++-- An entry while the graph is traversed.+data W = W+ { wNode :: Ptr Cell+ , wWhy :: Why+ , wActive :: Bool -- being copied, i.e., on the traversal stack+ , wCycle :: Bool -- the traversal came back to it while it was active+ , wValue :: Maybe Exp+ , wFun :: Opnd+ , wArg :: Opnd+ }++-- The state of the traversal.+data S = S+ { sEntries :: IntMap W -- the entries, by EntryNo; the ones from sN on were dropped+ , sN :: Int -- the number of entries+ , sMade :: Int -- the number of copies made, also dropped ones+ , sNodes :: IntMap EntryNo -- the entry of a node, by nodeKey+ }++noOpnd :: Opnd+noOpnd = Index (-1)++-- The key of a node in sNodes. Nodes are at least 4 byte aligned, and the+-- key must not be negative.+nodeKey :: Ptr Cell -> Int+nodeKey p = fromIntegral ((fromIntegral (p `minusPtr` nullPtr) :: Word) `shiftR` 2)++setEntry :: EntryNo -> W -> S -> S+setEntry i w s = s{ sEntries = M.insert i w (sEntries s) }++newEntry :: W -> S -> (S, EntryNo)+newEntry w s =+ let i = sN s+ in (s{ sEntries = M.insert i w (sEntries s), sN = i + 1,+ sNodes = M.insert (nodeKey (wNode w)) i (sNodes s) }, i)++-- Find the entry of a node. The entries of dropped nodes are left behind,+-- so an entry only counts if it is still in use for the same node.+lookupNode :: Ptr Cell -> S -> Maybe EntryNo+lookupNode p s =+ case M.lookup (nodeKey p) (sNodes s) of+ Just i | i < sN s && wNode (sEntries s M.! i) == p -> Just i+ _ -> Nothing++-- Visit a node, and copy it if it is code.+visit :: Int -> S -> NodePtr -> IO (S, Opnd)+visit limit s n0 = do+ n <- skipInd n0+ let leaf e = (s, Leaf n e)+ case n of+ Comb c -> leaf <$> combExp c+ CellPtr p | Just i <- lookupNode p s -> do+ let w = sEntries s M.! i+ return (if wActive w && i /= 0 then setEntry i w{ wCycle = True } s else s, Index i)+ CellPtr p -> do+ c <- peek p+ case c of+ -- A function, which never changes.+ IO_CCALL i -> leaf . Lit . LFFI . fst <$> ffiEntry i+ TICK i -> return (leaf (Lit (LTick (show i))))+ _ -> do+ k0 <- case c of+ AP _ _ -> classify n+ BADDYN _ -> return Redex -- evaluating it is an error+ _ -> return Whnf+ let k = if k0 == Copy && sMade s >= exploreFactor * limit then Depth else k0+ v <- if k == Whnf then valueExp c else return Nothing+ let (s1, i) = newEntry (W p k (k == Copy) False v noOpnd noOpnd) s+ if k /= Copy then return (s1, Index i) else do+ -- Each field is read again, just before it is visited, see above.+ (s2, fo) <- apFields p >>= visit limit s1{ sMade = sMade s1 + 1 } . fst+ (s3, ao) <- apFields p >>= visit limit s2 . snd+ let w = sEntries s3 M.! i+ s4 | wCycle w = -- Drop the copy, and everything after it.+ (setEntry i (W p Cycle False False Nothing noOpnd noOpnd) s3){ sN = i + 1 }+ | otherwise = setEntry i w{ wActive = False, wFun = fo, wArg = ao } s3+ return (s4, Index i)+ _ -> notANode n++-- Keep the copied nodes that are nearest the root, breadth first, up to+-- the size limit. A copied node that is used by a kept one, but is not+-- kept itself, becomes a Depth reference, and what is only reachable+-- through it is dropped. The kept entries stay in the same order, so the+-- root stays entry 0.+select :: Int -> S -> Extraction+select limit s = Extraction (M.fromList (zip [0 ..] (map entry (M.keys used))))+ where+ es = sEntries s+ root = M.insert 0 () M.empty+ -- The entries used by the kept copies, and the kept copies.+ (used, kept) = bfs root root 1 [0] []+ -- The queue is the current list, and then the next one, which is reversed.+ bfs u kp _ [] [] = (u, kp)+ bfs u kp nk [] next = bfs u kp nk (reverse next) []+ bfs u kp nk (i : is) next =+ let w = es M.! i+ (u', kp', nk', next') = foldl step (u, kp, nk, next) [wFun w, wArg w]+ in bfs u' kp' nk' is next'+ step acc@(u, kp, nk, next) (Index j)+ | isJust (M.lookup j u) = acc+ | wWhy (es M.! j) == Copy && nk < limit = (M.insert j () u, M.insert j () kp, nk + 1, j : next)+ | otherwise = (M.insert j () u, kp, nk, next)+ step acc _ = acc+ newIndex = M.fromList (zip (M.keys used) [0 ..])+ re (Index j) = Index (newIndex M.! j)+ re l = l+ entry i =+ let w = es M.! i in+ case wWhy w of+ Copy | isJust (M.lookup i kept) -> Entry (wNode w) Copy Nothing (re (wFun w)) (re (wArg w))+ | otherwise -> Entry (wNode w) Depth Nothing noOpnd noOpnd+ why -> Entry (wNode w) why (wValue w) noOpnd noOpnd++-- | Extract the code of a function, i.e., a partial application, with at most+-- limit copied nodes. The value is evaluated first. Nothing if it is not+-- a partial application.+extract :: Int -> a -> IO (Maybe Extraction)+extract limit a = a `seq` do+ r <- skipInd (decodeNodePtr (nodeAddr a))+ code <- case r of+ CellPtr p -> do+ c <- peek p+ case c of+ AP _ _ -> (== Copy) <$> classify r+ _ -> return False+ _ -> return False+ res <- if not code then return Nothing else do+ (s, _) <- visit limit (S M.empty 0 0 M.empty) r+ return (Just (select limit s))+ keepAlive a+ return res++-----------------------------------------------------------------------------+-- Using the result++-- The number of uses of each entry by the copies.+uses :: Extraction -> EntryNo -> Int+uses (Extraction es) = \ i -> fromMaybe 0 (M.lookup i us)+ where us = foldr (\ j -> M.insertWith (+) j 1) M.empty+ [ j | (_, e) <- M.toList es, entryWhy e == Copy, Index j <- [entryFun e, entryArg e] ]++-- | The extracted code as combinator code, for Mhs.Reflect.decompile, and+-- the cells that its free variables refer to.+-- The root is self when the code refers to it. A copied node that is used+-- more than once is a definition, _i, where i is its entry. A reference+-- is a free variable, e.g., redex_i, except for a literal value.+-- The cells are only valid as long as the extracted value is alive, and+-- a redex changes when it is evaluated.+extractionProg :: Extraction -> (Prog, [(String, Ptr Cell)])+extractionProg x@(Extraction es) = (Prog defs body, refs)+ where+ us = uses x+ shared i = i /= 0 && entryWhy (es M.! i) == Copy && us i > 1+ name 0 = "self"+ name i = case entryWhy (es M.! i) of+ Copy -> '_' : show i+ why -> map toLower (show why) ++ "_" ++ show i+ opnd (Leaf _ e) = e+ opnd (Index i) | i == 0 || shared i = Var (name i)+ | otherwise = entryExp i+ entryExp i =+ let e = es M.! i in+ case entryWhy e of+ Copy -> App (opnd (entryFun e)) (opnd (entryArg e))+ _ -> fromMaybe (Var (name i)) (entryValue e)+ recursive = us 0 > 0+ defs = [ (name 0, entryExp 0) | recursive ] +++ [ (name i, entryExp i) | i <- M.keys es, shared i ]+ body = if recursive then Var (name 0) else entryExp 0+ refs = [ (name i, entryNode e) | (i, e) <- M.toList es,+ entryWhy e /= Copy, isNothing (entryValue e) ]++-- | The number of entries of each kind.+extractionSummary :: Extraction -> String+extractionSummary x@(Extraction es) =+ show (count Copy) ++ " nodes copied, " ++ show (uses x 0) +++ " references back to the root, references that stopped the copy: whnf " +++ show (count Whnf) ++ ", redex " ++ show (count Redex) ++ ", cycle " +++ show (count Cycle) ++ ", depth " ++ show (count Depth)+ where count w = length [ () | (_, e) <- M.toList es, entryWhy e == w ]
@@ -1,13 +1,16 @@ -- Temporary module module Mhs.MutArr(module Mhs.MutArr, MutIOArr) where import qualified Prelude(); import MiniPrelude -- do not import Prelude-import Primitives(Int, IO, IOArray, primArrAlloc, primArrSize, primArrRead, primArrWrite, primArrCopy, primArrTrunc)+import Primitives(Int, IO, IOArray, primArrAlloc, primArrSize, primArrRead, primArrWrite, primArrCopy, primArrTrunc, primArrEQ) import Control.Monad.ST_Type import Mhs.Builtin -- primitive IOArray type MutIOArr a = IOArray a +instance Eq (IOArray a) where+ (==) = primArrEQ+ newMutIOArr :: forall a . Int -> a -> IO (MutIOArr a) newMutIOArr = primArrAlloc @@ -29,6 +32,7 @@ ---------------- newtype MutSTArr s a = MutSTArr (MutIOArr a)+ deriving (Eq) newMutSTArr :: forall s a . Int -> a -> ST s (MutSTArr s a) newMutSTArr n a = ST $ MutSTArr <$> newMutIOArr n a
@@ -20,8 +20,10 @@ import Foreign.ForeignPtr import Foreign.Ptr import Foreign.Storable+import Mhs.Builtin newtype MutSTUArr s a = MutSTUArr (MutIOUArr a)+ deriving (Eq) newMutSTUArrB :: forall s a . (Storable a) => Word8 -> Int -> ST s (MutSTUArr s a) newMutSTUArrB b n = ST $ MutSTUArr <$> newMutIOUArrB b n@@ -36,6 +38,9 @@ unsafeWriteMutSTUArr (MutSTUArr bs) i a = ST $ unsafeWriteMutIOUArr bs i a newtype MutIOUArr a = MutIOUArr ByteString++instance Eq (MutIOUArr a) where+ MutIOUArr a == MutIOUArr b = primBSsame a b newMutIOUArrB :: forall a . (Storable a) => Word8 -> Int -> IO (MutIOUArr a) newMutIOUArrB b n = return (MutIOUArr (primBSreplicate (n * sizeOf (undefined :: a)) b))
@@ -0,0 +1,25 @@+module Mhs.Print(cprint, cuprint) where+import qualified Prelude() -- do not import Prelude+import Primitives+import Data.Function+import System.IO+import System.IO.Internal++primHPrint :: forall a . Ptr BFILE -> a -> IO ()+primHPrint = _primitive "IO.print"++-- NOTE: This is a dangerous function, it might crash and/or execute effects+cprint :: forall a . a -> IO ()+cprint a = withHandleWr stdout $ \ p ->+ let gc = primGC 1 in+ primRnfNoErr a `seq` -- this is where the danger lurks+ gc `primThen` -- Do GC reductions+ gc `primThen`+ gc `primThen`+ gc `primThen`+ gc `primThen`+ gc `primThen`+ primHPrint p a++cuprint :: forall a . a -> IO ()+cuprint a = withHandleWr stdout $ \ p -> primHPrint p a
@@ -1,101 +1,469 @@-module Mhs.Reflect where-import Data.Int-import Data.Word-import System.IO.Serialize-import System.IO.StringHandle--newtype Exp a = Exp UExp- deriving (Eq, Show)+-- Copyright 2026 Lennart Augustsson+-- See LICENSE file for full license.+--+-- Reflection: turn a value back into an expression.+-- The value is serialized to the combinator file format (see doc/COMB.md),+-- the combinator code is parsed, and then decompiled to lambda expressions+-- by reducing the combinators symbolically. Constructors (C_k_n) and the+-- case combinators (D_a0_..._a{m-1} and E_k1_n1_..._km_nm) become constructors+-- and case expressions. The number of fields of each arm comes from the+-- arities in the case combinator.+-- The definitions are named by their labels, or by their names when the+-- file has them (mhs -oFILE.combffi).+module Mhs.Reflect(+ Ident, Exp(..), Literal(..), Pat(..), Prog(..),+ reflect, reflectCombinators, hReflect,+ parseCombinators, decompile,+ ppProg, ppExp,+ ) where+import Control.Monad+import Data.ByteString.Char8(unpack, pack, ByteString, hGetContents)+import Data.Char(isAlphaNum, isDigit, isSpace, chr, ord)+import Data.Int(Int64)+import Data.List(isSuffixOf, stripPrefix)+import qualified Data.Text as T+import Data.Text.Encoding(decodeUtf8)+import Foreign.Ptr(Ptr)+import Mhs.Array(accumArray, (!))+import Mhs.Text.PrettyPrint.HughesPJLiteClass(Pretty(..), Doc, text, (<+>), sep, vcat, hsep, nest, hang,+ punctuate, maybeParens, render, appPrec)+import System.IO(Handle, hLookAhead, hGetChar)+import System.IO.Internal(BFILE, addTransducer)+import System.IO.Serialize(writeSerializedBS) -type Label = Int+type Ident = String -data UExp- = App UExp UExp+data Exp+ = Var Ident+ | Lam Ident Exp+ | App Exp Exp | Lit Literal- | Lbl Label UExp- | Ref Label- deriving (Eq, Show)+ | Con Int Int -- constructor number k with n fields, C_k_n+ | Case Exp [(Pat, Exp)] (Maybe Exp) -- scrutinee, arms, default+ | Let [(Ident, Exp)] Exp -- recursive bindings+ | Array [Exp]+ deriving (Show) +data Pat = PCon Int Int [Ident] -- C_k_n x1 ... xn+ deriving (Show)+ data Literal- = Prim String- | Int Int- | Int64 Int64- | Integer Integer- | Bytes [Word8]- | Float Float- | Double Double- deriving (Eq, Show)+ = LInt Int+ | LInt64 Int64+ | LDouble Double+ | LFloat Float+ | LInteger Integer+ | LBytes ByteString -- a ByteString+ | LString String -- a String, from fromUTF8 applied to a ByteString+ | LPrim String -- a combinator or a primitive+ | LFFI String -- a foreign import+ | LFunPtr String -- a C function pointer+ | LTick String -- a tick, for profiling+ deriving (Show) -reflect :: a -> IO (Exp a)-reflect a = Exp . parse . dropHeader <$> handleWriteToString (\ h -> hSerialize h a >> hFlush h)+-- Shared subexpressions are bound by a (recursive) let.+data Prog = Prog [(Ident, Exp)] Exp+ deriving (Show) --- The first two lines are version and number of definitions-dropHeader = dropWhile (/= '\n') . drop 1 . dropWhile (/= '\n')+-- | Turn a value into an expression.+reflect :: a -> IO Prog+reflect a = decompile <$> reflectCombinators a -str :: a -> IO String-str a = handleWriteToString (\ h -> hSerialize h a)+-- | Turn a value into its combinator code.+reflectCombinators :: a -> IO Prog+reflectCombinators a = parseCombinators . unpack <$> writeSerializedBS a -parse :: String -> UExp-parse = parseStk []+foreign import ccall "add_lzma_decompressor" c_add_lzma_decompressor :: Ptr BFILE -> IO (Ptr BFILE)++-- | Read a serialized value, e.g., a combinator file written by mhs or a+-- file written by writeSerialized, and turn it into an expression.+-- A .combffi file written by mhs has the names of the definitions,+-- and then they are used instead of the labels.+-- The file may be compressed (mhs -z, or writeSerializedCompressed).+-- Open the file with openBinaryFile, since it may contain bytes that+-- are not UTF-8. The handle is closed.+hReflect :: Handle -> IO Prog+hReflect h = do+ c <- hLookAhead h+ h' <- if c == 'z' || c == 'q' then do -- compressed?+ _ <- hGetChar h+ addTransducer c_add_lzma_decompressor h+ else+ return h+ decompile . parseCombinators . unpack <$> hGetContents h'++-----------------------------------------------------------------------------+-- Parsing the combinator file format++-- This must agree with the version in src/runtime/eval.c.+combVersion :: String+combVersion = "v9.3"++-- | Parse a serialized value, including the header, and the names+-- of the definitions, if present.+parseCombinators :: String -> Prog+parseCombinators s =+ case stripPrefix (combVersion ++ "\n") s of+ Just r | (n@(_:_), '\n':r') <- span isDigit r, all isDigit n ->+ case parseGraph r' of+ (Prog defs e, rest) -> renameLabels (parseNames rest) (Prog defs (dropAs e))+ _ -> error $ "Mhs.Reflect: unsupported combinator file format: " ++ show (takeWhile (/= '\n') s)++-- Parse the graph, and return what follows it.+parseGraph :: String -> (Prog, String)+parseGraph = p [] [] where- nonSP c = c /= ' ' && c /= '\n'- lit stk con cs =- case span nonSP cs of- (p, cs') -> parseStk (Lit (con p) : stk) cs'- parseStk stk [] = error "parse: EOF"- parseStk stk (c:cs) =- case c of- ' ' -> parseStk stk cs- '\n' -> parseStk stk cs- '@' -> case stk of- x:y:stk' -> parseStk (App y x : stk') cs- _ -> error "parse: App"- '}' -> case stk of- [x] -> x- _ -> error "parse: }"- '%' -> lit stk (Integer . read) cs- '&' | '&':cs' <- cs -> lit stk (Float . read) cs'- | otherwise -> lit stk (Double . read) cs- '#' | '#':cs' <- cs -> lit stk (Int64 . read) cs'- | otherwise -> lit stk (Int . read) cs- '[' -> undefined -- array- '_' ->- case span nonSP cs of- (l, cs') -> parseStk (Ref (read l) : stk) cs'- ':' ->- case span nonSP cs of- (l, cs') ->- case stk of- x : stk' -> parseStk (Lbl (read l) x : stk') cs'- _ -> error "parse: :"- '"' ->- case getString cs of- (s, cs') -> parseStk (Lit (Bytes s) : stk) cs'- '^' -> undefined -- FFI- ';' -> undefined -- C function pointer- _ -> lit stk Prim (c:cs)- - getString :: String -> ([Word8], String)- getString = get []- where- get :: [Word8] -> String -> ([Word8], String)- get _ [] = error "getString"- get bs ('"':cs) = (reverse bs, cs)- get bs ('\\':'?':cs) = get (0x7f : bs) cs- get bs ('\\':'_':cs) = get (0xff : bs) cs- get bs ('\\': c:cs) = get (byte c : bs) cs- get bs ('^':c:cs) = get (b : bs) cs- where b | d < 0x40 = d `rem` 0x20- | otherwise = (d `rem` 0x20) + 0x80- d = byte c- get bs ('|':c:cs) = get (byte c + 0x80 : bs) cs- get bs (c:cs) = get (byte c : bs) cs- byte :: Char -> Word8- byte = fromIntegral . fromEnum+ p :: [(Ident, Exp)] -> [Exp] -> String -> (Prog, String)+ p defs stk (' ':s) = p defs stk s+ p defs stk ('\n':s) = p defs stk s+ p defs (x:f:stk) ('@':s) = p defs (App f x : stk) s+ p defs [e] ('}':s) = (Prog (reverse defs) e, s)+ p defs stk ('#':'#':s) = lit (LInt64 . read) defs stk s+ p defs stk ('#':s) = lit (LInt . read) defs stk s+ p defs stk ('&':'&':s) = lit (LFloat . read) defs stk s+ p defs stk ('&':s) = lit (LDouble . read) defs stk s+ p defs stk ('%':s) =+ case span (/= '"') s of (i, _:r) -> p defs (Lit (LInteger (read i)) : stk) r+ _ -> perr s+ p defs stk ('"':s) =+ case getByteString s of (bs, r) -> p defs (Lit (LBytes bs) : stk) r+ p defs stk ('$':s) =+ case span isDigit s of+ (n@(_:_), ' ':r) | (bs, r') <- splitAt (read n) r -> p defs (Lit (LBytes (pack bs)) : stk) r'+ _ -> perr s+ p defs stk ('!':'"':s) =+ case getByteString s of (bs, r) -> p defs (Lit (LTick (unpack bs)) : stk) r+ p defs stk ('^':s) = lit LFFI defs stk s+ p defs stk (';':s) = lit LFunPtr defs stk s+ p defs stk ('_':s) =+ case tok s of (l, r) -> p defs (Var ('_':l) : stk) r+ p defs (e:stk) (':':s) =+ case tok s of (l, r) -> p ((i, e) : defs) (Var i : stk) r+ where i = '_':l+ p defs stk ('[':s) =+ case span isDigit s of+ (n@(_:_), ']':r) | k <- read n, length stk >= k ->+ p defs (Array (reverse (take k stk)) : drop k stk) r+ _ -> perr s+ p defs stk s@(_:_) = case tok s of (c, r) -> p defs (atom c : stk) r+ p _ _ s = perr s -main :: IO ()-main = do- let f x = x+1 :: Int- print (f 5)- x <- reflect (f)- print x+ lit :: (String -> Literal) -> [(Ident, Exp)] -> [Exp] -> String -> (Prog, String)+ lit con defs stk s =+ case tok s of (sn, r) -> p defs (Lit (con sn) : stk) r++ tok = break isSpace+ perr s = error $ "Mhs.Reflect: parse error at " ++ show (take 20 s)++-- In a file written by mhs the graph ends with A d1 (A d2 (... (A dn e))),+-- where the di are the definitions. Since A x y = y, that is just e.+dropAs :: Exp -> Exp+dropAs (App (App (Lit (LPrim "A")) _) e) = dropAs e+dropAs e = e++-- The names of the definitions, which mhs puts last in a .combffi file,+-- after the foreign imports:+-- #####Names+-- label name+-- ...+parseNames :: String -> [(Int, Ident)]+parseNames s =+ case dropWhile (/= "#####Names") (lines s) of+ _ : lns -> names lns+ [] -> []+ where+ names (ln : lns) | (l@(_:_), ' ':n@(_:_)) <- span isDigit ln = (read l, n) : names lns+ names _ = []++-- A label that has a name is renamed to it.+-- The label numbers of a serialized value depend on heap addresses, so they+-- differ between runs. Rename the other labels to _1, _2, ... in the order+-- they are defined, which only depends on the shape of the graph.+renameLabels :: [(Int, Ident)] -> Prog -> Prog+renameLabels names (Prog defs e) = Prog [ (ren i, sub d) | (i, d) <- defs ] (sub e)+ where+ nums = [ read l | ('_':l, _) <- defs ] :: [Int]+ top = maximum (0 : nums)+ tbl = accumArray (\ _ x -> x) 0 (0, top) (zip nums [1 :: Int ..])+ named = accumArray (\ _ x -> Just x) Nothing (0, top) [ ln | ln@(l, _) <- names, l <= top ]+ ren ('_':l) | Just n <- named ! k = n+ | otherwise = '_' : show (tbl ! k)+ where k = read l+ ren i = i+ sub (Var i) = Var (ren i)+ sub (App f a) = App (sub f) (sub a)+ sub (Array es) = Array (map sub es)+ sub x = x++-- Combinators, primitives, and the data type combinators.+atom :: String -> Exp+atom s =+ case s of+ 'C':'_':r | Just (k, n) <- twoNums r -> Con k n+ _ -> Lit (LPrim s)+ where+ twoNums r =+ case span isDigit r of+ (k@(_:_), '_':r') | (n@(_:_), "") <- span isDigit r' -> Just (read k, read n)+ _ -> Nothing++-- Get a quoted string, see doc/COMB.md for the escapes.+getByteString :: String -> (ByteString, String)+getByteString = get []+ where+ get r ('"':s) = (pack (reverse r), s)+ get r ('\\':'?':s) = get ('\x7f':r) s+ get r ('\\':'_':s) = get ('\xff':r) s+ get r ('\\':c:s) = get (c:r) s+ get r ('^' :c:s) | c < '\x40' = get (chr (ord c - 0x20) : r) s+ | otherwise = get (chr (ord c + 0x40) : r) s+ get r ('|' :c:s) = get (chr (ord c + 0x80) : r) s+ get r (c:s) = get (c : r) s+ get _ [] = error "Mhs.Reflect: unterminated string"++-----------------------------------------------------------------------------+-- Decompilation++-- A state monad for generating fresh variable names.+newtype F a = F (Int -> (a, Int))++instance Functor F where+ fmap f (F g) = F $ \ n -> case g n of (a, n') -> (f a, n')+instance Applicative F where+ pure a = F $ \ n -> (a, n)+ (<*>) = ap+instance Monad F where+ F g >>= k = F $ \ n -> case g n of (a, n') -> case k a of F h -> h n'++runF :: F a -> a+runF (F g) = fst (g 1)++fresh :: Int -> F [Ident]+fresh k = F $ \ n -> (map (\ i -> 'x' : show i) [n .. n + k - 1], n + k)++-- The combinators, with their arity and reduction rule.+combinator :: String -> Maybe (Int, [Exp] -> Exp)+combinator c =+ case c of+ "S" -> r 3 $ \ [x, y, z] -> x @@ z @@ (y @@ z)+ "K" -> r 2 $ \ [x, _] -> x+ "I" -> r 1 $ \ [x] -> x+ "B" -> r 3 $ \ [x, y, z] -> x @@ (y @@ z)+ "C" -> r 3 $ \ [x, y, z] -> x @@ z @@ y+ "S'" -> r 4 $ \ [x, y, z, w] -> x @@ (y @@ w) @@ (z @@ w)+ "B'" -> r 4 $ \ [x, y, z, w] -> x @@ y @@ (z @@ w)+ "C'" -> r 4 $ \ [x, y, z, w] -> x @@ (y @@ w) @@ z+ "C'B" -> r 4 $ \ [x, y, z, w] -> x @@ z @@ (y @@ w)+ "A" -> r 2 $ \ [_, y] -> y+ "U" -> r 2 $ \ [x, y] -> y @@ x+ "Z" -> r 3 $ \ [x, y, _] -> x @@ y+ "K2" -> r 3 $ \ [x, _, _] -> x+ "K3" -> r 4 $ \ [x, _, _, _] -> x+ "K4" -> r 5 $ \ [x, _, _, _, _] -> x+ "P" -> r 3 $ \ [x, y, z] -> z @@ x @@ y+ "R" -> r 3 $ \ [x, y, z] -> y @@ z @@ x+ "O" -> r 4 $ \ [x, y, _, w] -> w @@ x @@ y+ _ -> Nothing+ where r n f = Just (n, f)++infixl 9 @@+(@@) :: Exp -> Exp -> Exp+(@@) = App++apps :: Exp -> [Exp] -> Exp+apps = foldl App++spine :: Exp -> (Exp, [Exp])+spine = go []+ where go as (App f a) = go (a:as) f+ go as e = (e, as)++-- The case combinators: D_a0_..._a{m-1}, with the arities of the arms, and+-- E_k1_n1_..._km_nm, with the constructor numbers and arities of the arms.+data CaseComb = CaseD [Int] | CaseS [(Int, Int)]++caseComb :: String -> Maybe CaseComb+caseComb ('D':'_':r) | Just as <- nums r = Just (CaseD as)+caseComb ('E':'_':r) | Just kns <- nums r >>= pairs = Just (CaseS kns)+ where pairs (k : n : ns) = ((k, n) :) <$> pairs ns+ pairs [] = Just []+ pairs _ = Nothing+caseComb _ = Nothing++-- Numbers separated by _+nums :: String -> Maybe [Int]+nums r =+ case span isDigit r of+ (ds@(_:_), "") -> Just [read ds]+ (ds@(_:_), '_':r') -> (read ds :) <$> nums r'+ _ -> Nothing++-- The number of arguments of a case combinator, including the scrutinee.+caseArgs :: CaseComb -> Int+caseArgs (CaseD as) = length as + 1+caseArgs (CaseS kns) = length kns + 2++-- | Decompile combinator code to lambda expressions.+decompile :: Prog -> Prog+decompile (Prog defs e) = runF $ do+ defs' <- mapM (\ (i, d) -> (,) i <$> dec d) defs+ e' <- dec e+ return (Prog defs' e')++dec :: Exp -> F Exp+dec = go+ where+ go e =+ case spine e of+ (Lit (LPrim c), as)+ | Just (n, rule) <- combinator c ->+ if length as >= n then+ go (apps (rule (take n as)) (drop n as))+ else do+ -- Too few arguments, so eta expand.+ vs <- fresh (n - length as)+ b <- go (rule (as ++ map Var vs))+ return (foldr Lam b vs)+ (Lit (LPrim "Y"), f : as) -> do+ -- Y f = let r = f r in r+ v <- head <$> fresh 1+ b <- go (f @@ Var v)+ apps (Let [(v, b)] (Var v)) <$> mapM go as+ (Lit (LTick _), a : as) -> go (apps a as)+ (Lit (LPrim "fromUTF8"), Lit (LBytes bs) : as) ->+ apps (Lit (LString (T.unpack (decodeUtf8 bs)))) <$> mapM go as+ (Lit (LPrim c), as)+ | Just cc <- caseComb c -> do+ let n = caseArgs cc+ if length as < n then do+ -- The scrutinee (and maybe arms) are missing, so eta expand.+ vs <- fresh (n - length as)+ b <- go (apps e (map Var vs))+ return (foldr Lam b vs)+ else do+ let (cas, rest) = splitAt n as+ c' <- case cc of+ CaseD ars -> dense ars cas+ CaseS kns -> sparse kns cas+ apps c' <$> mapM go rest+ (f, as) -> apps f <$> mapM go as++ -- D_a0_..._a{m-1} f0 ... f{m-1} e+ dense ars cas = do+ let (arms, [scrut]) = splitAt (length cas - 1) cas+ arms' <- sequence (zipWith3 arm [0..] ars arms)+ s <- go scrut+ return (Case s arms' Nothing)++ -- E_k1_n1_..._km_nm d f1 ... fm e+ sparse kns (d : cas) = do+ let (arms, scrut) = splitAt (length kns) cas+ arms' <- zipWithM (uncurry arm) kns arms+ d' <- go d+ s <- go (head scrut)+ return (Case s arms' (Just d'))+ sparse _ [] = error "Mhs.Reflect: bad sparse case"++ -- An arm for constructor k with n fields.+ arm k n f = do+ vs <- fresh n+ b <- go (apps f (map Var vs))+ return (PCon k n vs, b)++-----------------------------------------------------------------------------+-- Printing, as Haskell code. What fits on a line is printed on one line,+-- e.g., case x of { C_0_0 -> 0; C_1_2 y z -> y }, and otherwise a case or+-- let has a line for each arm or definition, still with the braces and+-- semicolons, and an application a line for each argument.++instance Pretty Exp where+ pPrintPrec _ d = ppr (if d <= 0 then 0 else if d <= appPrec then 1 else 2)++instance Pretty Prog where+ pPrint = pprProg++-- | A program as Haskell code, a let with a definition per line if it has+-- definitions. There is no newline at the end.+ppProg :: Prog -> String+ppProg = render . pprProg++-- | An expression as Haskell code.+ppExp :: Exp -> String+ppExp = render . ppr 0++pprProg :: Prog -> Doc+pprProg (Prog [] b) = ppr 0 b+pprProg (Prog ies b) = vcat [text "let", nest 2 (vcat (map pprDef ies)), text "in " <+> ppr 0 b]++-- A definition. The variables of a lambda are on the line of the name.+pprDef :: (Ident, Exp) -> Doc+pprDef (i, e@(Lam _ _)) = hang (ppIdent i <+> text "=" <+> h) 2 b where (h, b) = pprLam e+pprDef (i, e) = hang (ppIdent i <+> text "=") 2 (ppr 0 e)++-- The variables of a lambda, and its body.+pprLam :: Exp -> (Doc, Doc)+pprLam e = (text ("\\" ++ unwords vs ++ " ->"), ppr 0 b)+ where (vs, b) = lams e++-- Precedence: 0 anywhere, 1 function in an application, 2 argument.+ppr :: Int -> Exp -> Doc+ppr _ (Var i) = ppIdent i+ppr p (Lit l) = pprLit p l+ppr _ (Con k n) = conName k n+ppr _ (Array es) = text "[|" <> sep (punctuate (text ",") (map (ppr 0) es)) <> text "|]"+ppr p e@(Lam _ _) = maybeParens (p > 0) (hang h 2 b) where (h, b) = pprLam e+ppr p e@(App _ _) = maybeParens (p > 1) (sep (ppr 1 f : map (nest 2 . ppr 2) as)) where (f, as) = spine e+ppr p (Case s arms md) = maybeParens (p > 0) $+ block (text "case" <+> ppr 0 s <+> text "of") (map pprArm arms ++ [ arm (text "_") d | Just d <- [md] ])+ where pprArm (PCon k n vs, b) = arm (hsep (conName k n : [ text (if v `occursIn` b then v else "_") | v <- vs ])) b+ arm l b = hang (l <+> text "->") 2 (ppr 0 b)+ppr p (Let bs b) = maybeParens (p > 0) $+ sep [block (text "let") (map pprDef bs), text "in" <+> ppr 0 b]++-- A block, h { d1; ...; dn }, on one line, or with a line for each di.+block :: Doc -> [Doc] -> Doc+block h ds = sep ([h <+> text "{"] ++ map (nest 2) (punctuate (text ";") ds) ++ [text "}"])++pprLit :: Int -> Literal -> Doc+pprLit p l =+ case l of+ LInt i -> num i+ LInt64 i -> num i+ LDouble d -> num d+ LFloat f -> num f+ LInteger i -> num i+ LBytes bs -> text ("B" ++ show (unpack bs))+ LString s -> text (show s)+ LPrim s -> maybeParens (isOper s) (text s)+ LFFI s -> text ("^" ++ s)+ LFunPtr s -> text (";" ++ s)+ LTick s -> text ("!" ++ show s)+ where num :: (Show a) => a -> Doc+ num x = let s = show x in maybeParens (p > 1 && take 1 s == "-") (text s)++conName :: Int -> Int -> Doc+conName k n = text ("C_" ++ show k ++ "_" ++ show n)++-- A variable, which can be the name of a definition, e.g., Data.List.+++ppIdent :: Ident -> Doc+ppIdent i = maybeParens (isOper i) (text i)++-- Operators, e.g., + and IO.>>=, are printed in parentheses.+-- A name that ends with a dot is the operator ., e.g., Data.Function..+isOper :: String -> Bool+isOper s = not (all (\ c -> isAlphaNum c || c == '_' || c == '\'' || c == '.') s) || "." `isSuffixOf` s++lams :: Exp -> ([Ident], Exp)+lams (Lam v e) = case lams e of (vs, b) -> (v:vs, b)+lams e = ([], e)++occursIn :: Ident -> Exp -> Bool+occursIn v = occ+ where+ occ (Var i) = i == v+ occ (Lam i e) = i /= v && occ e+ occ (App f a) = occ f || occ a+ occ (Case s arms md) = occ s || any (\ (PCon _ _ vs, b) -> v `notElem` vs && occ b) arms || maybe False occ md+ occ (Let bs b) = v `notElem` map fst bs && (any (occ . snd) bs || occ b)+ occ (Array es) = any occ es+ occ _ = False
@@ -0,0 +1,32 @@+module Mhs.Strict where+--import Control.Monad.State\+import MicroHs.State+import Mhs.Reflect++type FcnNo = Int+type Fcn = (FcnNo, [Code])++gen :: Exp -> (FcnNo, [Fcn])+gen e =+ case runState (do u <- addFcn e; genS; return u) (S 1 [] []) of+ (_, S _ fcns) -> (u, fcns)++data S = S { uniq :: Int, ifcns :: [Exp], ofcns :: [Fcn] }+ deriving (Show)+type G a = State S a++newUniq ::++genS :: G ()+genS = do+ gets ifcns >>=+ \case+ [] -> return ()+ (u, e) : es -> do+ modify $ \ s -> s{ifcns = es}+ cs <- genE e+ modify $ \ s -> s{ofcns = (u, cs) : ofcns s}+ genS++genE :: Exp -> G [Code]+genE e
@@ -53,8 +53,7 @@ import Data.Tuple import {-# SOURCE #-} Data.Typeable import System.IO.Base(IO, putChar, putStr, putStrLn, print, getLine, getContents, interact,- FilePath, readFile, writeFile, appendFile,- cprint, cuprint)+ FilePath, readFile, writeFile, appendFile) import Text.Show(Show(..), ShowS, shows, showChar, showString, showParen) import Text.Show import Primitives(_wordSize, _isWindows)
@@ -13,15 +13,27 @@ floatToDigits, ) where import qualified Prelude()-import MiniPrelude+import Control.Error+import Data.Bool import Data.Char+import Data.Eq import Data.Float import Data.Floating import Data.Fractional+import Data.Function+import Data.Int import Data.Integer+import Data.Integral+import Data.List+import Data.Maybe+import Data.Num+import Data.Ord import Data.RealFloat import Data.RealFrac+import Data.String+import {-# SOURCE #-} Data.Typeable import Numeric.Show+import Text.Show showFloat :: (RealFloat a) => a -> ShowS showFloat x = showString (formatRealFloat FFGeneric Nothing x)
@@ -48,6 +48,7 @@ instance Integral Natural where toInteger (N i) = i quotRem (N x) (N y) = (N q, N r) where (q, r) = quotRem x y+ divMod (N x) (N y) = (N q, N r) where (q, r) = quotRem x y -- same as quotRem for N instance Real Natural where toRational (N i) = toRational i
@@ -76,12 +76,14 @@ | otherwise = showUnsignedNeg (-n) r showUnsignedNeg :: (Integral a) => a -> ShowS-showUnsignedNeg n r =- let c = primChr (primOrd '0' - fromIntegral (rem n 10))- in if n > -10 then- c : r- else- showUnsignedNeg (quot n 10) (c : r)+showUnsignedNeg n rest =+ case quotRem n 10 of+ (q, r) ->+ let c = primChr (primOrd '0' - fromIntegral r)+ in if n > -10 then+ c : rest+ else+ showUnsignedNeg q (c : rest) showUnsignedInt :: (Integral a) => Int -> a -> ShowS showUnsignedInt _ = showInt
@@ -63,7 +63,8 @@ import Data.Functor(Functor(..), (<$>)) import Data.Int.Int(Int) import Data.Integer(Integer)-import Data.Integral(Integral(..), fromIntegral, gcd, lcm, even, odd, (^))+import Data.Integral(Integral(quot, rem, div, mod, quotRem, divMod, toInteger),+ fromIntegral, gcd, lcm, even, odd, (^)) import Data.List([](..), map, (++), filter, head, last, tail, init, null, length, (!!), reverse, foldl, foldl1, foldr, foldr1, and, or, any, all, sum, product, concat, concatMap, maximum, minimum,@@ -73,7 +74,7 @@ lines, words, unlines, unwords) import Data.Maybe(Maybe(..), maybe) import Data.Monoid.Internal(Monoid(..), Semigroup((<>)))-import Data.Num(Num(..), subtract)+import Data.Num(Num((+), (-), (*), negate, abs, signum, fromInteger), subtract) import Data.Ord(Ord(..), Ordering(..)) import Data.Ratio(Rational) import Data.Real(Real(..))@@ -84,8 +85,7 @@ import Data.Tuple(fst, snd, curry, uncurry) import Data.Word.Word(Word) import System.IO(IO, putChar, putStr, putStrLn, print, getChar, getLine, getContents, interact,- FilePath, readFile, writeFile, appendFile, readLn, readIO,- cprint, cuprint)+ FilePath, readFile, writeFile, appendFile, readLn, readIO) import System.IO.Error(IOError, ioError, userError) import Text.Read(ReadS, Read(..), read, reads, readParen, lex) import Text.Show(Show(..), ShowS, shows, showChar, showString, showParen)
@@ -268,11 +268,18 @@ primThen = _primitive "IO.>>" primReturn :: forall a . a -> IO a primReturn = _primitive "IO.return"-primGetArgRef :: IO (IOArray [[Char]])-primGetArgRef = _primitive "IO.getArgRef"+primLazyBind :: IO a -> (a -> IO b) -> IO b+primLazyBind = _primitive "IO.lazyBind"+primLazyBindST :: IO a -> (a -> IO b) -> IO b+primLazyBindST = _primitive "IO.lazyBindST"+primStrictIO :: IO a -> IO a+primStrictIO = _primitive "IO.strict" primPerformIO :: forall a . IO a -> a primPerformIO = _primitive "IO.performIO" +primGetArgRef :: IO (IOArray [[Char]])+primGetArgRef = _primitive "IO.getArgRef"+ primRnfErr :: forall a . a -> () primRnfErr = _primitive "rnf" (0::Int) @@ -359,6 +366,13 @@ primAddFinalizer :: FunPtr (Ptr a -> IO ()) -> ForeignPtr a -> IO () primAddFinalizer = _primitive "fpfin"++-- Run the IO action somewhat atomically.+-- This means that it is guaranteed an uninterrupted slice.+-- This is used for atomicModifyIORef which has a very bounded amount of work,+-- so a slice is good enough.+primAtomic :: IO a -> IO a+primAtomic = _primitive "IO.atomic" primForkIO :: IO () -> IO ThreadId primForkIO = _primitive "IO.fork"
@@ -27,7 +27,7 @@ -- , renamePath , copyFile -- , copyFileWithMetadata--- , getFileSize+ , getFileSize -- , canonicalizePath -- , makeAbsolute@@ -71,14 +71,17 @@ -- , isSymbolicLink ) where import qualified Prelude(); import MiniPrelude+import Data.Int.Int64 import Control.Exception(bracket) import Control.Monad(when) import Data.Bits+import Data.Integer import Foreign.C.Error import Foreign.C.String import Foreign.Marshal.Alloc import Foreign.Ptr import System.IO+import System.IO.Error(ioError) import System.Environment data DIR@@ -94,6 +97,7 @@ foreign import ccall "getcwd" c_getcwd :: CString -> Int -> IO CString foreign import ccall "get_permissions" c_getPermissions :: CString -> IO Int foreign import ccall "set_permissions" c_setPermissions :: CString -> Int -> IO Int+foreign import ccall "get_file_size" c_getFileSize :: CString -> IO Int64 -- XXX Use Foreign.C.Error@@ -160,17 +164,53 @@ createDirectory :: FilePath -> IO () createDirectory d = throwErrnoIfMinus1_ "createDirectory" $ withCAString d $ \ s -> c_mkdir s 0o775 -- rwxrwxr-x +-- As in GHC's directory package: an existing directory is not an error,+-- anything else that makes mkdir fail is. With parents, try the path+-- itself first and only create the parent when mkdir says it is missing,+-- so existing ancestors are never touched. (Unlike GHC, a dangling+-- symlink at the path is an error.) createDirectoryIfMissing :: Bool -> FilePath -> IO ()-createDirectoryIfMissing False d = do- _ <- withCAString d $ \ s -> c_mkdir s 0o775 -- rwxrwxr-x- return ()-createDirectoryIfMissing True d = do- let ds = scanl1 (\ x y -> x ++ "/" ++ y) . split [] $ d- split r [] = [r]- split r (c:cs) | isPathSeparator c = r : split [] cs- | otherwise = split (r ++ [c]) cs- mapM_ (createDirectoryIfMissing False) ds+createDirectoryIfMissing _ "" = return () -- as GHC does+createDirectoryIfMissing parents d = do+ res <- withCAString d $ \ s -> do+ r <- c_mkdir s 0o775 -- rwxrwxr-x+ if r == -1 then Just <$> getErrno else return Nothing+ case res of+ Nothing -> return ()+ Just errno -> do+ let parent = parentDirectory d+ if parents && errno == eNOENT && not (null parent) then do+ createDirectoryIfMissing True parent+ createDirectoryIfMissing False d+ else do+ -- Some systems report a permission error for an existing directory.+ -- Only EEXIST proves that the path exists, so only then may an+ -- unopenable path count as a directory.+ isDir <- if errno == eEXIST then isDirectory True d+ else if errno `elem` [eACCES, ePERM, eROFS] then isDirectory False d+ else return False+ unless isDir $+ ioError (errnoToIOError "createDirectoryIfMissing" errno Nothing (Just d)) +-- Is the path a directory? An unreadable directory (e.g., mode --x)+-- cannot be opened; with exists = True the path is known to exist, and+-- EACCES then means it is such a directory.+isDirectory :: Bool -> FilePath -> IO Bool+isDirectory exists fn = withCAString fn $ \ cfn -> do+ dp <- c_opendir cfn+ if dp == nullPtr then do+ errno <- getErrno+ return (exists && errno == eACCES)+ else do+ _ <- c_closedir dp+ return True++-- The path with its last component (and any trailing separators) removed.+-- "" when there is no parent left to create.+parentDirectory :: FilePath -> FilePath+parentDirectory =+ reverse . dropWhile isPathSeparator . dropWhile (not . isPathSeparator) . dropWhile isPathSeparator . reverse+ isPathSeparator :: Char -> Bool isPathSeparator c = c == '/' || _isWindows && c == '\\' @@ -247,3 +287,6 @@ copyPermissions :: FilePath -> FilePath -> IO () copyPermissions src dst = getPermissions src >>= setPermissions dst++getFileSize :: FilePath -> IO Integer+getFileSize fp = toInteger <$> withCAString fp (throwErrnoIfMinus1 "getFileSize" . c_getFileSize)
@@ -9,7 +9,7 @@ NewlineMode(..), TextEncoding,- mkTextEncoding, hSetEncoding,+ mkTextEncoding, hSetEncoding, hGetEncoding, latin1, utf8, utf8_bom, utf16, utf16le, utf16be, utf32, utf32le, utf32be, localeEncoding, char8, SeekMode(..), hIsOpen,@@ -71,6 +71,12 @@ instance MonadFix IO where mfix = fixIO +instance Semigroup a => Semigroup (IO a) where+ (<>) = liftA2 (<>)++instance Monoid a => Monoid (IO a) where+ mempty = pure mempty+ data Newline = LF | CRLF deriving (Eq, Ord, Show, Read) @@ -83,6 +89,9 @@ data TextEncoding = UTF8 +instance Show TextEncoding where+ show UTF8 = "UTF-8"+ mkTextEncoding :: String -> IO TextEncoding mkTextEncoding "UTF-8//ROUNDTRIP" = return UTF8 mkTextEncoding _ = error "unknown text encoding"@@ -91,6 +100,9 @@ hSetEncoding :: Handle -> TextEncoding -> IO () hSetEncoding _ _ = return () +hGetEncoding :: Handle -> IO (Maybe TextEncoding)+hGetEncoding _ = return (Just UTF8)+ latin1, utf8, utf8_bom, utf16, utf16le, utf16be, utf32, utf32le, utf32be, localeEncoding, char8 :: TextEncoding latin1 = UTF8 utf8 = UTF8@@ -110,10 +122,6 @@ deriving (Eq, Ord, Bounded, Enum, Read, Show) ----------- XXX This currently does nothing.-hIsTerminalDevice :: Handle -> IO Bool-hIsTerminalDevice _ = return True hIsOpen :: Handle -> IO Bool hIsOpen (Handle _ r _) = do
@@ -8,7 +8,8 @@ hLookAhead, putChar, getChar, hClose, hFlush,- openFile, openFileM, openBinaryFile,+ openFile, openFileM,+ openBinaryFile, openBinaryFileM, hPutStr, hPutStrLn, putStr, putStrLn, print,@@ -18,8 +19,6 @@ writeFile, readFile, appendFile, writeBinaryFile, readBinaryFile, - cprint, cuprint,- hPutBuf, hGetBuf, openTmpFile, openTempFile, openBinaryTempFile,@@ -31,6 +30,9 @@ hGetBuffering, IOException(..),++ hIsTerminalDevice,+ hFileSize, ) where import qualified Prelude() -- do not import Prelude import Primitives@@ -45,6 +47,9 @@ import Data.Function import Data.Functor import Data.Int.Int+import Data.Int.Int64+import Data.Integer_Type+import Data.Integral import Data.List import Data.Maybe import Data.Num@@ -61,9 +66,6 @@ import System.IO.Open import System.IO.Unsafe -primHPrint :: forall a . Ptr BFILE -> a -> IO ()-primHPrint = _primitive "IO.print"- -- BFILE stuff foreign import ccall "closeb" c_closeb :: Ptr BFILE -> IO () foreign import ccall "flushb" c_flushb :: Ptr BFILE -> IO ()@@ -72,6 +74,8 @@ foreign import ccall "putb" c_putb :: Int -> Ptr BFILE -> IO () foreign import ccall "writeb" c_writeb :: Ptr a -> Int -> Ptr BFILE -> IO Int foreign import ccall "readb" c_readb :: Ptr a -> Int -> Ptr BFILE -> IO Int+foreign import ccall "isattyb" c_isattyb :: Ptr BFILE -> IO Int+foreign import ccall "filesizeb" c_filesizeb :: Ptr BFILE -> IO Int64 ---------------------------------------------------------- @@ -134,21 +138,6 @@ getChar :: IO Char getChar = hGetChar stdin -cprint :: forall a . a -> IO ()-cprint a = withHandleWr stdout $ \ p ->- let gc = primGC 1 in- primRnfNoErr a `seq`- gc `primThen` -- Do GC reductions- gc `primThen`- gc `primThen`- gc `primThen`- gc `primThen`- gc `primThen`- primHPrint p a--cuprint :: forall a . a -> IO ()-cuprint a = withHandleWr stdout $ \ p -> primHPrint p a- print :: forall a . (Show a) => a -> IO () print a = putStrLn (show a) @@ -252,7 +241,7 @@ ioErrH h typ desc = ioError $ IOError (Just h) typ "" desc Nothing Nothing ioErr :: IOErrorType -> String -> String -> IO a-ioErr typ desc name = ioError $ IOError Nothing typ "" "" Nothing (Just $ name ++ ": " ++ desc)+ioErr typ loc name = ioError $ IOError Nothing typ loc "" Nothing (Just name) -------- @@ -326,3 +315,19 @@ hGetBuf :: Handle -> Ptr a -> Int -> IO Int hGetBuf h p n = withHandleRd h $ c_readb p n++hIsTerminalDevice :: Handle -> IO Bool+hIsTerminalDevice h = do+ i <- withHandleAny h c_isattyb+ if i < 0 then+ ioErrH h InvalidArgument "hIsTerminalDevice"+ else+ return (i /= 0)++hFileSize :: Handle -> IO Integer+hFileSize h = do+ i <- withHandleAny h c_filesizeb+ if i < 0 then+ ioErrH h InvalidArgument "hFileSize"+ else+ return (toInteger i)
@@ -121,13 +121,12 @@ instance Applicative IO where pure = primReturn+ (*>) = primThen (<*>) = ap instance Monad IO where (>>=) = primBind (>>) = primThen- return = primReturn instance MonadFail IO where fail = error-
@@ -1,48 +1,72 @@--- Copyright 2023 Lennart Augustsson+-- Copyright 2023-2026 Lennart Augustsson -- See LICENSE file for full license. module System.IO.MD5(MD5CheckSum, md5File, md5Handle, md5String, md5Combine) where import qualified Prelude(); import MiniPrelude import Primitives(primPerformIO) import Control.DeepSeq.Class+import Control.Monad.Fail+import qualified Data.ByteString as BS+import qualified Data.ByteString.Unsafe as BS+import Data.Char (digitToInt, isHexDigit) import Data.Coerce-import Data.Word(Word32)+import Data.Word(Word8) import Foreign.C.String import Foreign.Marshal.Alloc-import Foreign.Marshal.Array+import Foreign.Marshal.Array(withArrayLen)+import Foreign.Marshal.Utils(copyBytes) import Foreign.Ptr+import Foreign.Storable import System.IO import System.IO.Internal---- XXX change this to use hex bytestrings instead.+import qualified Text.ParserCombinators.ReadP as P+import Text.Read -foreign import ccall "md5BFILE" c_md5BFILE :: Ptr BFILE -> Ptr Word32 -> IO ()-foreign import ccall "md5String" c_md5String :: CString -> Ptr Word32 -> IO ()-foreign import ccall "md5Array" c_md5Array :: Ptr Word32 -> Ptr Word32 -> Int -> IO ()+foreign import ccall "md5BFILE" c_md5BFILE :: Ptr BFILE -> Ptr MD5CheckSum -> IO ()+foreign import ccall "md5String" c_md5String :: CString -> Ptr MD5CheckSum -> IO ()+foreign import ccall "md5Array" c_md5Array :: Ptr MD5CheckSum -> Ptr MD5CheckSum -> Int -> IO () -newtype MD5CheckSum = MD5 [Word32] -- 4*32 bits+newtype MD5CheckSum = MD5 BS.ByteString -- 16 bytes deriving (Eq, Ord) instance Show MD5CheckSum where- show (MD5 ws) = "MD5" ++ show ws+ showsPrec p (MD5 bs) = showParen (p > 10) $ showString "MD5 " . showString (concatMap hex (BS.unpack bs))+ where hex b = [intToDigit q, intToDigit r] where (q, r) = quotRem (fromIntegral b) 16 +instance Read MD5CheckSum where+ readPrec = parens $ prec 10 $ do+ Ident "MD5" <- lexP+ hexStr <- lift $ do+ P.skipSpaces+ P.munch1 isHexDigit+ case parseHex hexStr of+ Just bytes | length bytes == 16 -> return (MD5 (BS.pack bytes))+ _ -> pfail++parseHex :: String -> Maybe [Word8]+parseHex [] = Just []+parseHex (h1:h2:rest)+ | isHexDigit h1 && isHexDigit h2 =+ let b = fromIntegral (digitToInt h1 * 16 + digitToInt h2)+ in (b :) <$> parseHex rest+parseHex _ = Nothing+ instance NFData MD5CheckSum where- rnf (MD5 ws) = loop ws- where loop [] = ()- loop (a:as) = a `seq` loop as+ rnf (MD5 bs) = seq bs () +instance Storable MD5CheckSum where+ sizeOf _ = md5Len+ alignment _ = 1+ peek p = MD5 <$> BS.packCStringLen (castPtr p, md5Len)+ poke p (MD5 bs) = BS.unsafeUseAsCString bs $ \ cp -> copyBytes p (castPtr cp) md5Len+ md5Len :: Int md5Len = 16 -- The MD5 checksum is 16 bytes -md5WLen :: Int -- length in Word32-md5WLen = md5Len `quot` 4--chksum :: (Ptr Word32 -> IO ()) -> IO MD5CheckSum-chksum fn = do- buf <- mallocArray md5WLen- fn buf- wmd5 <- peekArray md5WLen buf- free buf- return (MD5 wmd5)+chksum :: (Ptr MD5CheckSum -> IO ()) -> IO MD5CheckSum+chksum fn =+ alloca $ \ buf -> do+ fn buf+ peek buf md5String :: String -> MD5CheckSum md5String s = primPerformIO $ withCAString s $ chksum . c_md5String@@ -64,5 +88,5 @@ md5Combine [] = error "md5Combine: empty" md5Combine [m] = m md5Combine ms = primPerformIO $- withArray [ w | MD5 ws <- ms, w <- ws ] $ \ a ->- chksum $ \ w -> c_md5Array a w (length ms * md5Len)+ withArrayLen ms $ \ l a ->+ chksum $ \ w -> c_md5Array a w (l * md5Len)
@@ -5,12 +5,15 @@ writeSerialized, writeSerializedCompressed, readSerialized, readSerializedH, readSerializedBS, writeSerializedCompressedBS, writeSerializedBS,+ hSerializeDescr, hDeserializeDescr, ) where import qualified Prelude(); import MiniPrelude import Primitives(Ptr) import Data.ByteString(ByteString)+import Data.Data(Data) import System.IO import System.IO.Internal+import System.IO.Serialize.TypeDescr import System.IO.StringHandle(withByteStringHandle, handleWriteToByteString) primHSerialize :: forall a . Ptr BFILE -> a -> IO ()@@ -75,3 +78,21 @@ handleWriteToByteString $ \ h -> do hSerialize h a hFlush h++descrVersion :: String+descrVersion = "TD1 "++hSerializeDescr :: forall a . Data a => Handle -> a -> IO ()+hSerializeDescr h a = do+ let d = descrVersion ++ show (getTypeDescrMD5 (undefined :: a))+ hPutStr h d+ hSerialize h a++hDeserializeDescr :: forall a . Data a => Handle -> IO (Maybe a)+hDeserializeDescr h = do+ let d = descrVersion ++ show (getTypeDescrMD5 (undefined :: a))+ d' <- replicateM (length d) (hGetChar h)+ if d == d' then+ Just <$> hDeserialize h+ else+ return Nothing
@@ -0,0 +1,97 @@+module System.IO.Serialize.TypeDescr(+ getTypeDescr, getTypeDescrMD5,+ TypeDescr(..), TypeEnv, TypeInfo(..)+ ) where+import qualified Prelude(); import MiniPrelude+import Data.Data+import Data.Data_Class+import Data.Function((&))+import Data.List+import Data.Ord+import Data.Typeable(typeRepFingerprint)+import System.IO.MD5+import Debug.Trace++newtype TypeInfo = TypeInfo [(ConstrRep, [TypeKey])]+ deriving (Show)++data TypeDescr = TypeDescr TypeKey TypeEnv+ deriving (Show)++type TypeKey = TypeRep+type TypeEnv = [(TypeKey, TypeInfo)] -- Sorted list of types already seen++-- | Get a descriptor of a type that fully describes the type.+getTypeDescr :: forall a . Data a => a -> TypeDescr+getTypeDescr _ = TypeDescr (typeKey a) (collectTypes a [])+ where a = undefined :: a++getTypeDescrMD5 :: forall a . Data a => a -> MD5CheckSum+getTypeDescrMD5 a =+ case getTypeDescr a of+ TypeDescr rkey renv -> md5Combine $ typeRepFingerprint rkey : concatMap md5ki renv+ where+ md5ki :: (TypeKey, TypeInfo) -> [MD5CheckSum]+ md5ki (key, TypeInfo info) = typeRepFingerprint key : concatMap md5i info+ md5i :: (ConstrRep, [TypeKey]) -> [MD5CheckSum]+ md5i (crep, keys) = md5String (show crep) : map typeRepFingerprint keys++typeKey :: Data a => a -> TypeKey+typeKey = typeOf++-- Recursively build the flat type environment using fully qualified keys+collectTypes :: forall a . Data a => a -> TypeEnv -> TypeEnv+collectTypes a env =+ let key = typeKey a+ in if any ((== key) . fst) env+ then env -- Already visited; breaks recursive loops+ else+ let dType = dataTypeOf a+ dRep = dataTypeRep dType++ (cDescrs, finalEnv) =+ case dRep of+ AlgRep constrs ->+ let env' = insertBy (comparing fst) (key, TypeInfo []) env -- create dummy entry+ in foldr (processConstr a) ([], env') constrs+ _ ->+ ([], collectFunTypes a env) -- Primitives have no constructors+ info = TypeInfo cDescrs+ in replaceKey key info finalEnv++processConstr :: forall a. Data a+ => a+ -> Constr+ -> ([(ConstrRep, [TypeKey])], TypeEnv)+ -> ([(ConstrRep, [TypeKey])], TypeEnv)+processConstr _ constr (acc, currentEnv) =+ let dummyVal :: a+ dummyVal = fromConstr constr++ (fTypes, nextEnv) = extractFields currentEnv dummyVal+ in ((conrep constr, fTypes) : acc, nextEnv)++extractFields :: Data a => TypeEnv -> a -> ([TypeKey], TypeEnv)+extractFields env val =+ let fKeys = gmapQ typeKey val+ updaters = gmapQ collectTypes val+ finalEnv = foldl' (&) env updaters+ in (fKeys, finalEnv)++-- A function type has no representation, but the types of its argument+-- and result are part of its description: a serialized function builds+-- and takes apart values of those types. dataCast2 gives access to+-- their Data instances.+newtype CollectFun a = CollectFun (a -> TypeEnv -> TypeEnv)++collectFunTypes :: forall a . Data a => a -> TypeEnv -> TypeEnv+collectFunTypes a env =+ case dataCast2 (CollectFun fun) of+ Just (CollectFun f) -> f a env+ Nothing -> env+ where+ fun :: forall d e . (Data d, Data e) => (d -> e) -> TypeEnv -> TypeEnv+ fun _ = collectTypes (undefined :: e) . collectTypes (undefined :: d)++replaceKey :: (Eq k) => k -> v -> [(k, v)] -> [(k, v)]+replaceKey k v = map (\(k', v') -> if k' == k then (k, v) else (k', v'))
@@ -24,7 +24,8 @@ act h with nullPtr $ \ bufp -> with 0 $ \ lenp -> do- c_get_mem bf bufp lenp -- get buffer and length+ -- get buffer and length; h must be alive here, its finalizer closes bf+ withHandleAny h $ \ bf' -> c_get_mem bf' bufp lenp buf <- peek bufp len <- peek lenp res <- peekCAStringLen (buf, len) -- encode as a string@@ -50,7 +51,8 @@ act h with nullPtr $ \ bufp -> with 0 $ \ lenp -> do- c_get_mem bf bufp lenp -- get buffer and length+ -- get buffer and length; h must be alive here, its finalizer closes bf+ withHandleAny h $ \ bf' -> c_get_mem bf' bufp lenp buf <- peek bufp len <- peek lenp res <- BS.primPackCStringLen buf len -- create the bytestring
@@ -1,7 +1,15 @@-module System.IO.TimeMilli(getTimeMilli) where+module System.IO.TimeMilli(getTimeMicro, getTimeMilli, getBootTimeMicro) where import qualified Prelude(); import MiniPrelude+import Data.Word(Word) -foreign import ccall "GETTIMEMILLI" c_getTimeMilli :: IO Int+foreign import ccall "GETTIMEMICRO" c_getTimeMicro :: IO Word+foreign import ccall "GETBOOTTIMEMICRO" c_getBootTimeMicro :: IO Word -getTimeMilli :: IO Int-getTimeMilli = c_getTimeMilli+getTimeMicro :: IO Word+getTimeMicro = c_getTimeMicro++getTimeMilli :: IO Word+getTimeMilli = do t <- c_getTimeMicro; return (t `quot` 1000)++getBootTimeMicro :: IO Word+getBootTimeMicro = c_getBootTimeMicro
@@ -9,4 +9,4 @@ unsafeDupablePerformIO = primPerformIO unsafeInterleaveIO :: IO a -> IO a-unsafeInterleaveIO ioa = primReturn (primPerformIO ioa)+unsafeInterleaveIO ioa = primLazyBind ioa primReturn
@@ -4,14 +4,38 @@ import System.Process import System.IO.Unsafe +-- The names of the operating system and the architecture are those that+-- GHC uses, except that Windows is "windows" unless the runtime was+-- compiled with MinGW. They also give the CPP symbols os_HOST_OS and+-- arch_HOST_ARCH. os :: String-os = if _isWindows then "windows" else uname "-s"+os = if _isWindows then (if isMinGW then "mingw32" else "windows") else+ case uname "-s" of+ "sunos" -> "solaris2"+ s -> s arch :: String-arch = if _isWindows then if _wordSize == 64 then "x86_64" else "x86" else+arch = if _isWindows then if _wordSize == 64 then "x86_64" else "i386" else+ narrow $ case uname "-m" of- "arm64" -> "aarch64" -- match ghc- s -> s+ "arm64" -> "aarch64"+ "amd64" -> "x86_64"+ "ppc64le" -> "powerpc64le"+ "ppc64" -> "powerpc64"+ "ppc" -> "powerpc"+ s | s `elem` ["i386", "i486", "i586", "i686", "x86"] -> "i386"+ | take 3 s == "arm" -> "arm"+ | otherwise -> s+ where+ -- uname gives the kernel's architecture, which can be 64 bit when+ -- the runtime is 32 bit, e.g., a 32 bit x86 program on x86_64.+ narrow a | _wordSize == 32 =+ case a of+ "x86_64" -> "i386"+ "aarch64" -> "arm"+ "powerpc64" -> "powerpc"+ _ -> a+ | otherwise = a compilerName :: String compilerName = "mhs"@@ -19,6 +43,10 @@ compilerVersion :: Version compilerVersion = fullCompilerVersion { versionBranch = take 2 (versionBranch fullCompilerVersion) } +foreign import ccall "ismingw" c_ismingw :: IO Int+isMinGW :: Bool+isMinGW = unsafePerformIO c_ismingw == 1+ -- Assume the system has an uname command. uname :: String -> String uname flag = unsafePerformIO $ do@@ -26,4 +54,4 @@ return $ map toLower $ filter (not . isSpace) res fullCompilerVersion :: Version-fullCompilerVersion = makeVersion [0,16,0,0]+fullCompilerVersion = makeVersion [0,17,4,0]
@@ -44,6 +44,9 @@ bracket_ (return ()) (removeFile fin >> removeFile fout) (do- callCommand $ unwords $ cmd : ("<" ++ fin) : (">" ++ fout) : args+ callCommand $ unwords $ cmd : ("<" ++ quote fin) : (">" ++ quote fout) : args res <- readFile fout seq (length res) $ return res)+ -- The temporary directory can contain spaces.+ -- Double quotes work for both sh and cmd.exe.+ where quote s = "\"" ++ s ++ "\""
@@ -614,9 +614,8 @@ ufmt0 { fmtAdjust = Nothing } _ -> ufmt0 alt _ 0 = Nothing- alt p _ = case fmtAlternate ufmt of- True -> Just p- False -> Nothing+ alt p _ | fmtAlternate ufmt = Just p+ | otherwise = Nothing upcase (s1, s2) = (s1, map toUpper s2) -- | Formatter for 'RealFloat' values.
@@ -56,6 +56,8 @@ import Data.Float import Data.Fractional import Data.Function+import Data.Functor.Const_Type+import Data.Functor.Identity import Data.Maybe import Data.Monoid import Data.Int@@ -857,3 +859,5 @@ deriving instance Read a => Read (First a) deriving instance Read a => Read (Last a) deriving instance Read (f a) => Read (Ap f a)+deriving instance Read a => Read (Identity a)+deriving instance Read a => Read (Const a b)
@@ -1,5 +1,5 @@ module Paths_base where import Data.Version-version :: Version; version = makeVersion [0,16,0,0]-getDataDir :: IO FilePath; getDataDir = return "/Users/augustss/.mcabal/mhs-0.16.0.0/packages/base-0.16.0.0/data"+version :: Version; version = makeVersion [0,17,4,0]+getDataDir :: IO FilePath; getDataDir = return "/Users/augustss/.mcabal/mhs-0.17.4.0/packages/base-0.17.4.0/data" getDataFileName :: FilePath -> IO FilePath; getDataFileName name = fmap (++ '/' : name) getDataDir
@@ -1,313 +0,0 @@--- This module implements the operation needed to support--- the Integer type.-module Data.Integer.Internal(- Integer,- zeroI, oneI, negOneI,- eqI, neI, cmpI, ltI, leI, gtI, geI,- addI, subI, mulI, quotRemI,- negateI, absI,- andI, orI, xorI,- shiftLI, shiftRI,- testBitI, popCountI,- log2I,- _intToInteger,- _integerToFloat,- _integerToDouble,- _integerToInt,- _wordToInteger,- ) where-import qualified Prelude()-import Primitives-import Control.Monad-import Data.Bool-import Data.Eq-import Data.Function-import Data.Ord---import Foreign.Ptr(Ptr)---import Foreign.ForeignPtr(withForeignPtr)-import System.IO.Internal-import System.IO.Unsafe-import Data.Integer_Type---- We cannot import Foreign.ForeignPtr; it is circular.-withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b-withForeignPtr fp io =- io (primForeignPtrToPtr fp) `primBind` \ b ->- primSeq fp (primReturn b)---------foreign import capi "mpz_add" mpz_add :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_sub" mpz_sub :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_mul" mpz_mul :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_neg" mpz_neg :: Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_abs" mpz_abs :: Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_tdiv_qr" mpz_tdiv_qr :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_cmp" mpz_cmp :: Ptr MPZ -> Ptr MPZ -> IO Int-foreign import capi "mpz_and" mpz_and :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_ior" mpz_ior :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_xor" mpz_xor :: Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()-foreign import capi "mpz_mul_2exp" mpz_mul_2exp :: Ptr MPZ -> Ptr MPZ -> Int -> IO ()-foreign import capi "mpz_fdiv_q_2exp" mpz_fdiv_q_2exp :: Ptr MPZ -> Ptr MPZ -> Int -> IO ()-foreign import capi "mpz_popcount" mpz_popcount :: Ptr MPZ -> IO Int-foreign import capi "mpz_tstbit" mpz_tstbit :: Ptr MPZ -> Int -> IO Int-foreign import capi "mpz_log2" mpz_log2 :: Ptr MPZ -> IO Int--binop :: (Ptr MPZ -> Ptr MPZ -> Ptr MPZ -> IO ()) -> Integer -> Integer -> Integer-binop f (I x) (I y) = unsafePerformIO $ do- z <- newMPZ- withForeignPtr x $ \ px ->- withForeignPtr y $ \ py ->- withForeignPtr z $ \ pz ->- f pz px py- return (I z)--unop :: (Ptr MPZ -> Ptr MPZ -> IO ()) -> Integer -> Integer-unop f (I x) = unsafePerformIO $ do- z <- newMPZ- withForeignPtr x $ \ px ->- withForeignPtr z $ \ pz ->- f pz px- return (I z)--addI :: Integer -> Integer -> Integer-addI = binop mpz_add--subI :: Integer -> Integer -> Integer-subI = binop mpz_sub--mulI :: Integer -> Integer -> Integer-mulI = binop mpz_mul--negateI :: Integer -> Integer-negateI = unop mpz_neg--absI :: Integer -> Integer-absI = unop mpz_abs--quotRemI :: Integer -> Integer -> (Integer, Integer)-quotRemI (I x) (I y) = unsafePerformIO $ do- q <- newMPZ- r <- newMPZ- withForeignPtr x $ \ px ->- withForeignPtr y $ \ py ->- withForeignPtr q $ \ pq ->- withForeignPtr r $ \ pr ->- mpz_tdiv_qr pq pr px py- return (I q, I r)---- XXX should do quot and rem too--zeroI :: Integer-zeroI = _intToInteger (0::Int)--oneI :: Integer-oneI = _intToInteger (1::Int)--negOneI :: Integer-negOneI = _intToInteger (primIntNeg 1)--isZero :: Integer -> Bool-isZero = eqI zeroI--cmpop :: (Int -> a) -> Integer -> Integer -> a-cmpop f (I x) (I y) = unsafePerformIO $- withForeignPtr x $ \ px ->- withForeignPtr y $ \ py -> do- s <- mpz_cmp px py- return (f s)--eqI :: Integer -> Integer -> Bool-eqI = cmpop ((0::Int) ==)--neI :: Integer -> Integer -> Bool-neI = cmpop ((0::Int) /=)--cmpI :: Integer -> Integer -> Ordering-cmpI = cmpop (\ i -> if i < (0::Int) then LT else if i > (0::Int) then GT else EQ)--ltI :: Integer -> Integer -> Bool-ltI = cmpop (< (0::Int))--leI :: Integer -> Integer -> Bool-leI = cmpop (<= (0::Int))--gtI :: Integer -> Integer -> Bool-gtI = cmpop (> (0::Int))--geI :: Integer -> Integer -> Bool-geI = cmpop (>= (0::Int))--andI :: Integer -> Integer -> Integer-andI = binop mpz_and--orI :: Integer -> Integer -> Integer-orI = binop mpz_ior--xorI :: Integer -> Integer -> Integer-xorI = binop mpz_xor---- XXX add complement--testBitI :: Integer -> Int -> Bool-testBitI (I x) i = unsafePerformIO $- withForeignPtr x $ \ px -> do- r <- mpz_tstbit px i- return (r == (1::Int))--shiftLI :: Integer -> Int -> Integer-shiftLI x i = unop (\ pz px -> mpz_mul_2exp pz px i) x--shiftRI :: Integer -> Int -> Integer-shiftRI x i = unop (\ pz px -> mpz_fdiv_q_2exp pz px i) x--popCountI :: Integer -> Int-popCountI (I x) = unsafePerformIO $ withForeignPtr x mpz_popcount--log2I :: Integer -> Int-log2I (I x) = unsafePerformIO $ withForeignPtr x mpz_log2------------------------------------{--pIntegerToInteger :: P.Integer -> Integer-pIntegerToInteger i | i >= 0 = I Plus (f i)- | otherwise = I Minus (f (negate i))- where- f 0 = []- f x = fromInteger (rem x (toInteger maxD)) : f (quot x (toInteger maxD))--integerToPInteger :: Integer -> P.Integer-integerToPInteger (I s xs) =- let r = foldr (\ d r -> r * toInteger maxD + toInteger d) 0 xs- in case s of- Plus -> r- Minus -> negate r--instance Num Integer where- (+) = addI- (-) = subI- (*) = mulI- abs x = if x < 0 then -x else x- signum x = if x > 0 then 1 else if x < 0 then -1 else 0- fromInteger = pIntegerToInteger--instance Enum Integer where- fromEnum = fromEnum . integerToPInteger- toEnum = _intToInteger--instance Real Integer where- toRational = toRational . toInteger--instance Integral Integer where- quotRem = quotRemI- toInteger = integerToPInteger----instance Show Integer where--- show = showInteger--instance Eq Integer where- (==) = eqI--instance Ord Integer where- x < y = x `ltI` y- x <= y = x == y || x `ltI` y- x > y = y `ltI` x- x >= y = x == y || y `ltI` x--instance Arbitrary Integer where- arbitrary = do- ndig <- frequency- [(5, pure 0)- ,(25, pure 1)- ,(20, pure 2)- ,(10, pure 3)- ,(10, pure 4)- ,(2, pure 5)- ,(2, pure 6)- ]- digits <- vectorOf ndig (chooseInt (0, maxD - 1))- sign <- elements [Plus, Minus]- pure $ if null digits then I Plus [] else I sign digits--{--newtype SmallInteger = SmallInteger Integer- deriving Show--instance Arbitrary SmallInteger where- arbitrary = do- ndig <- frequency- [(25, pure 1)- ,(20, pure 2)- ,(10, pure 3)- ,(10, pure 4)- ]- digit <- chooseInt (1, maxD - 1)- sign <- elements [Plus, Minus]- pure $ SmallInteger $ I sign (replicate (ndig - 1) 0 ++ [digit])--}-{--sanity :: HasCallStack => Integer -> Integer-sanity (I Minus []) = undefined-sanity (I _ ds) | length ds > 1 && last ds == 0 = undefined-sanity i = i--}--prop_roundtrip1 :: Integer -> Bool-prop_roundtrip1 i = fromInteger (toInteger i) == i--prop_negate :: Integer -> Bool-prop_negate i = toInteger (negate i) == negate (toInteger i)--prop_abs :: Integer -> Bool-prop_abs i = toInteger (abs i) == abs (toInteger i)--prop_add :: Integer -> Integer -> Bool-prop_add x y = toInteger (addI x y) == toInteger x + toInteger y--prop_sub :: Integer -> Integer -> Bool-prop_sub x y = toInteger (subI x y) == toInteger x - toInteger y--prop_mul :: Integer -> Integer -> Bool-prop_mul x y = toInteger (mulI x y) == toInteger x * toInteger y--prop_div :: Integer -> NonZero Integer -> Bool-prop_div x (NonZero y) =- to (quotRemI x y) == toInteger x `quotRem` toInteger y- where to (a, b) = (toInteger a, toInteger b)--prop_muldiv :: Integer -> NonZero Integer -> Bool-prop_muldiv x (NonZero y) =- let (q, r) = quotRemI x y- in q*y + r == x--prop_eq :: Integer -> Integer -> Bool-prop_eq x y = (eqI x y) == (toInteger x == toInteger y)--prop_ne :: Integer -> Integer -> Bool-prop_ne x y = (neI x y) == (toInteger x /= toInteger y)--prop_lt :: Integer -> Integer -> Bool-prop_lt x y = (ltI x y) == (toInteger x < toInteger y)--prop_gt :: Integer -> Integer -> Bool-prop_gt x y = (gtI x y) == (toInteger x > toInteger y)--prop_le :: Integer -> Integer -> Bool-prop_le x y = (leI x y) == (toInteger x <= toInteger y)--prop_ge :: Integer -> Integer -> Bool-prop_ge x y = (geI x y) == (toInteger x >= toInteger y)--prop_show :: Integer -> Bool-prop_show x = showInteger x == show (toInteger x)--checkAll :: IO ()-checkAll = do- let qc p = quickCheck (withMaxSuccess 100000 p)- mapM_ qc [prop_roundtrip1, prop_negate, prop_abs, prop_show]- mapM_ qc [prop_add, prop_sub, prop_mul,- prop_eq, prop_ne, prop_lt, prop_gt, prop_le, prop_ge]- mapM_ qc [prop_div, prop_muldiv]---}-
@@ -1,92 +0,0 @@-module Data.Integer_Type(- Integer(..),- MPZ, newMPZ,- _intToInteger, _wordToInteger, _int64ToInteger, _word64ToInteger,- _integerToInt, _integerToWord, _integerToInt64, _integerToWord64,- _integerToFloat,- _integerToDouble,- ) where-import qualified Prelude()-import Primitives-import Control.Error-import Data.Function(($))-import {-# SOURCE #-} Data.Typeable---import Foreign.ForeignPtr---import Mhs.Builtin---import System.IO.Unsafe---- We cannot import Foreign.ForeignPtr; it is circular.-withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b-withForeignPtr fp io =- io (primForeignPtrToPtr fp) `primBind` \ b ->- primSeq fp (primReturn b)---------data MPZ--newtype Integer = I (ForeignPtr MPZ)--foreign import capi "new_mpz" new_mpz :: IO (Ptr MPZ) -- it really returns a ForeignPtr-foreign import capi "mpz_init_set_si" mpz_init_set_si :: Ptr MPZ -> Int -> IO ()-foreign import capi "mpz_init_set_ui" mpz_init_set_ui :: Ptr MPZ -> Word -> IO ()-foreign import capi "mpz_get_si" mpz_get_si :: Ptr MPZ -> IO Int-foreign import capi "mpz_get_f" mpz_get_f :: Ptr MPZ -> IO Float-foreign import capi "mpz_get_d" mpz_get_d :: Ptr MPZ -> IO Double--newMPZ :: IO (ForeignPtr MPZ)-newMPZ =- new_mpz `primBind` \ x ->- primReturn (primUnsafeCoerce x)--_intToInteger :: Int -> Integer-_intToInteger i = primPerformIO (- newMPZ `primBind` \ x ->- withForeignPtr x ( \ p -> mpz_init_set_si p i) `primThen`- primReturn (I x)- )--_wordToInteger :: Word -> Integer-_wordToInteger i = primPerformIO (do- newMPZ `primBind` \ x ->- withForeignPtr x ( \ p -> mpz_init_set_ui p i) `primThen`- primReturn (I x)- )--_integerToInt :: Integer -> Int-_integerToInt (I x) = primPerformIO (withForeignPtr x mpz_get_si)--_integerToWord :: Integer -> Word-_integerToWord i = primIntToWord (_integerToInt i)--_integerToFloat :: Integer -> Float-_integerToFloat (I x) = primPerformIO (withForeignPtr x mpz_get_f)--_integerToDouble :: Integer -> Double-_integerToDouble (I x) = primPerformIO (withForeignPtr x mpz_get_d)-----------foreign import capi "mpz_init_set_si64" mpz_init_set_si64 :: Ptr MPZ -> Int64 -> IO ()-foreign import capi "mpz_init_set_ui64" mpz_init_set_ui64 :: Ptr MPZ -> Word64 -> IO ()-foreign import capi "mpz_get_si64" mpz_get_si64 :: Ptr MPZ -> IO Int64--_integerToInt64 :: Integer -> Int64-_integerToInt64 (I x) = primPerformIO (withForeignPtr x mpz_get_si64)--_integerToWord64 :: Integer -> Word64-_integerToWord64 i = primInt64ToWord64 (_integerToInt64 i)--_word64ToInteger :: Word64 -> Integer-_word64ToInteger i = primPerformIO (do- newMPZ `primBind` \ x ->- withForeignPtr x ( \ p -> mpz_init_set_ui64 p i) `primThen`- primReturn (I x)- )--_int64ToInteger :: Int64 -> Integer-_int64ToInteger i = primPerformIO (- newMPZ `primBind` \ x ->- withForeignPtr x ( \ p -> mpz_init_set_si64 p i) `primThen`- primReturn (I x)- )
@@ -0,0 +1,118 @@+-- Copyright 2023 Lennart Augustsson+-- See LICENSE file for full license.+module Mhs.IntMap(+ IntMap,+ empty, lookup, insert, fromList, toList, insertWith, (!), keys+ ) where+import qualified Prelude(); import MiniPrelude hiding(lookup)++data IntMap a+ = Empty+ | Leaf Int a+ | Node (IntMap a) (IntMap a) (IntMap a) (IntMap a)+ --Xderiving (Show)+instance Show a => Show (IntMap a) where+ showsPrec p m = showParen (p > 0) $ showsPrec 10 (toList m)++{-+-- This works for y>0+divModX :: Int -> Int -> (Int, Int)+divModX x y =+ let+ q = quot x y+ r = rem x y+ in+ if x >= 0 || r == 0 then+ (q, r)+ else+ (q - 1, r + y)+-}++div4 :: Int -> Int+div4 i = {-if i < 0 then error "div4" else-} i `quot` 4+mod4 :: Int -> Int+mod4 i = {-if i < 0 then error "mod4" else-} i `rem` 4++empty :: forall a . IntMap a+empty = Empty++lookup :: forall a . Int -> IntMap a -> Maybe a+lookup k am =+ case am of+ Empty -> Nothing+ Leaf i a -> if k == i then Just a else Nothing+ Node m0 m1 m2 m3 ->+ let+ d = div4 k+ m = mod4 k+ in if 0 == m then lookup d m0+ else if 1 == m then lookup d m1+ else if 2 == m then lookup d m2+ else lookup d m3++insert :: forall a . Int -> a -> IntMap a -> IntMap a+insert = insertWith const++fromList :: forall a . [(Int, a)] -> IntMap a+fromList = foldr (uncurry insert) empty++-- XXX There must be a better way+toList :: forall a . IntMap a -> [(Int, a)]+toList am =+ let+ f o (k, a) = (k*4 + o, a)+ in+ case am of+ Empty -> []+ Leaf l a -> [(l, a)]+ Node m0 m1 m2 m3 ->+ map (f 0) (toList m0) `merge`+ map (f 1) (toList m1) `merge`+ map (f 2) (toList m2) `merge`+ map (f 3) (toList m3)++merge :: forall a . [(Int, a)] -> [(Int, a)] -> [(Int, a)]+merge [] ys = ys+merge xs [] = xs+merge xxs@(xa@(x,_):xs) yys@(yb@(y,_):ys) = if x < y then xa : merge xs yys else yb : merge xxs ys++keys :: forall a . IntMap a -> [Int]+keys = map fst . toList++(!) :: forall a . IntMap a -> Int -> a+(!) m k =+ case lookup k m of+ Just i -> i+ Nothing -> error "Mhs.IntMap.!"++insertWith :: forall a . (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a+insertWith comb ak a =+ let+ ins k am =+ case am of+ Empty -> Leaf k a+ Leaf i b ->+ if k == i then+ Leaf k (comb a b)+ else+ ins k $ single i b+ Node m0 m1 m2 m3 ->+ let+ d = div4 k+ m = mod4 k+ in if 0 == m then Node (ins d m0) m1 m2 m3+ else if 1 == m then Node m0 (ins d m1) m2 m3+ else if 2 == m then Node m0 m1 (ins d m2) m3+ else Node m0 m1 m2 (ins d m3)+ in ins ak++single :: Int -> a -> IntMap a+single k a = --insert k a $ Node Empty Empty Empty Empty+ let+ m = mod4 k+ d = div4 k+ l = Leaf d a+ in if 0 == m then Node l Empty Empty Empty+ else if 1 == m then Node Empty l Empty Empty+ else if 2 == m then Node Empty Empty l Empty+ else Node Empty Empty Empty l
@@ -0,0 +1,189 @@+-- Copyright 2023 Lennart Augustsson+-- See LICENSE file for full license.+{-# OPTIONS_GHC -Wno-type-defaults -Wno-noncanonical-monad-instances #-}+{-# LANGUAGE FunctionalDependencies #-}+module Mhs.Text.ParserComb(+ Prsr, runPrsr,+ satisfy, satisfyM,+ many, optional, some,+ sepBy, sepBy1,+ sepEndBy, sepEndBy1,+ (<?>),+ (<<),+ --notFollowedBy,+ --lookAhead,+ nextToken,+ LastFail(..),+ TokenMachine(..),+ mapTokenState,+ ) where+import qualified Prelude(); import MiniPrelude hiding (fail)+import Control.Applicative+import Control.Monad.Fail as F+import Control.Monad++data LastFail t+ = LastFail Int [t] [String]+ deriving (Show)++maxInt :: Int+maxInt = 1000000000++noFail :: forall t . LastFail t+noFail = LastFail maxInt [] []++longest :: forall t . LastFail t -> LastFail t -> LastFail t+longest lf1@(LastFail l1 t1 x1) lf2@(LastFail l2 _ x2)+ | l1 < l2 = lf1+ | l2 < l1 = lf2+ | otherwise = LastFail l1 t1 (x1 ++ x2)++class TokenMachine tm t | tm -> t where+ tmNextToken :: tm -> (t, tm)+ tmRawTokens :: tm -> [t]++tmLeft :: forall tm t . TokenMachine tm t => tm -> Int+tmLeft = length . tmRawTokens++firstToken :: forall tm t . TokenMachine tm t => tm -> [t]+firstToken tm =+ case tmNextToken tm of+ (t, _) -> [t]++data Res tm t a = Success a tm (LastFail t) | Failure (LastFail t)+ --deriving (Show)++newtype Prsr tm t a = P (tm -> Res tm t a)+--instance Show (Prsr s t a) where show _ = "<<Prsr>>"++runP :: forall tm t a . Prsr tm t a -> (tm -> Res tm t a)+runP (P p) = p++mapTokenState :: forall tm t . (tm -> tm) -> Prsr tm t ()+mapTokenState f = P (\tm -> Success () (f tm) noFail)++instance Functor (Prsr tm t) where+ fmap f p = P $ \t ->+ case runP p t of+ Success a u lf -> Success (f a) u lf+ Failure lf -> Failure lf++instance Applicative (Prsr tm t) where+ pure a = P $ \t -> Success a t noFail+ f <*> a = P $ \t ->+ case runP f t of+ Failure lf -> Failure lf+ Success f' t' lff ->+ case runP a t' of+ Failure lfa -> Failure (longest lff lfa)+ Success a' t'' lfa -> Success (f' a') t'' (longest lff lfa)+-- Hugs does not have *> here+-- (*>) p k = p >>= \ _ -> k++(<<) :: Prsr tm t a -> Prsr tm t b -> Prsr tm t a+(<<) f a = P $ \t ->+ case runP f t of+ Failure lf -> Failure lf+ Success f' t' lff ->+ case runP a t' of+ Failure lfa -> Failure (longest lff lfa)+ Success _ t'' lfa -> Success f' t'' (longest lff lfa)++instance Monad (Prsr tm t) where+ (>>=) p k = P $ \t ->+ case runP p t of+ Success a u lfa ->+ case runP (k a) u of+ Success b v lfb -> Success b v (longest lfa lfb)+ Failure lfb -> Failure (longest lfa lfb)+ Failure lf -> Failure lf+ (>>) p k = p >>= const k+ return = pure++instance TokenMachine tm t => MonadFail (Prsr tm t) where+ fail m = P $ \ts -> Failure (LastFail (tmLeft ts) (firstToken ts) [m])++instance TokenMachine tm t => Alternative (Prsr tm t) where+ empty = F.fail "empty"++ (<|>) p q = P $ \ t ->+ case runP p t of+ Failure lfa ->+ case runP q t of+ Success b v lfb -> Success b v (longest lfa lfb)+ Failure lfb -> Failure (longest lfa lfb)+ r -> r++instance TokenMachine tm t => MonadPlus (Prsr tm t) where+ mzero = F.fail "mzero"+ mplus = (<|>)++satisfy :: forall tm t . TokenMachine tm t => String -> (t -> Bool) -> Prsr tm t t+satisfy msg f = P $ \ acs ->+ case tmNextToken acs of+ (c, cs) | f c -> Success c cs noFail+ _ -> Failure (LastFail (tmLeft acs) (firstToken acs) [msg])++satisfyM :: forall tm t a . TokenMachine tm t => String -> (t -> Maybe a) -> Prsr tm t a+satisfyM msg f = P $ \ acs ->+ case tmNextToken acs of+ (c, cs) | Just a <- f c -> Success a cs noFail+ _ -> Failure (LastFail (tmLeft acs) (firstToken acs) [msg])++infixl 9 <?>+(<?>) :: forall tm t a . Prsr tm t a -> String -> Prsr tm t a+(<?>) p e = P $ \ t ->+-- trace ("<?> " ++ show e) $+ case runP p t of+ Failure (LastFail l ts _) -> Failure (LastFail l ts [e])+ s -> s++{-+lookAhead :: forall tm t a . TokenMachine tm t => Prsr tm t a -> Prsr tm t ()+lookAhead p = P $ \ t ->+ case runP p t of+ Many [] (LastFail l ts xs) -> Many [] (LastFail l (take 1 ts) xs)+ _ -> Many [((), t)] noFail+-}++nextToken :: forall tm t . TokenMachine tm t => Prsr tm t t+nextToken = P $ \ cs ->+ case tmNextToken cs of+ (c, _) -> Success c cs noFail++{-+eof :: forall tm t . TokenMachine tm t => Prsr tm t ()+eof = P $ \ t@(cs, _) ->+ case tmNextToken cs of+ Nothing -> Many [((), t)] noFail+ Just _ -> Many [] (LastFail (tmLeft cs) (firstToken cs) ["eof"])+-}++{-+notFollowedBy :: forall t a . Prsr t a -> Prsr t ()+notFollowedBy p = P $ \ t@(ts,_) ->+ case runP p t of+ Many [] _ -> Many [((), t)] noFail+ _ -> Many [] (LastFail (length ts) (take 1 ts) ["!"])+-}++runPrsr :: forall tm t a . --X(Show a, Show s) =>+ Prsr tm t a -> tm -> Either (LastFail t) a+runPrsr (P p) f =+ case p f of+ Failure lf -> Left lf+ Success a _ _ -> Right a++-------------------------------++sepBy1 :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]+sepBy1 p sep = (:) <$> p <*> many (sep >> p)++sepBy :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]+sepBy p sep = sepBy1 p sep <|> pure []++sepEndBy :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]+sepEndBy p sep = sepEndBy1 p sep <|> pure []++sepEndBy1 :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]+sepEndBy1 p sep = (:) <$> p <*> ((sep >> sepEndBy p sep) <|> pure [])
@@ -0,0 +1,429 @@+-- Based on the pretty-printer outlined in the paper+-- 'The Design of a Pretty-printing Library' by+-- John Hughes in Advanced Functional Programming, 1995.+-- With inspiration and code from the from the Hackage package pretty.+module Mhs.Text.PrettyPrint.HughesPJLite(+ Doc,+ text, empty,+ (<+>), ($$), ($+$),+ hcat, hsep,+ vcat,+ sep, cat,+ fsep, fcat,+ nest, hang,+ punctuate,+ parens, brackets, braces,+ maybeParens,+ Style,+ render, renderStyle,+ ) where+import qualified Prelude(); import MiniPrelude++infixr 6 <+>+infixl 5 $$, $+$++data Doc+ = Empty -- ^ An empty span, see 'empty'.+ | NilAbove Doc -- ^ @text "" $$ x@.+ | TextBeside String Doc -- ^ @text s <> x@.+ | Nest Int Doc -- ^ @nest k x@.+ | Union Doc Doc -- ^ @ul `union` ur@.+ | NoDoc -- ^ The empty set of documents.+ | Beside Doc Bool Doc -- ^ True <=> space between.+ | Above Doc Bool Doc -- ^ True <=> never overlap.++type RDoc = Doc++text :: String -> Doc+text s = TextBeside s Empty++empty :: Doc+empty = Empty++reduceDoc :: Doc -> RDoc+reduceDoc (Beside p g q) = beside p g (reduceDoc q)+reduceDoc (Above p g q) = above p g (reduceDoc q)+reduceDoc p = p++hcat :: [Doc] -> Doc+hcat = snd . reduceHoriz . foldr (`Beside` False) empty++hsep :: [Doc] -> Doc+hsep = snd . reduceHoriz . foldr (`Beside` True) empty++vcat :: [Doc] -> Doc+vcat = snd . reduceVert . foldr (`Above` False) empty++nest :: Int -> Doc -> Doc+nest k p = mkNest k (reduceDoc p)++-- | @hang d1 n d2 = sep [d1, nest n d2]@+hang :: Doc -> Int -> Doc -> Doc+hang d1 n d2 = sep [d1, nest n d2]++punctuate :: Doc -> [Doc] -> [Doc]+punctuate _ [] = []+punctuate p (x:xs) = go x xs+ where go y [] = [y]+ go y (z:zs) = (y <> p) : go z zs++maybeParens :: Bool -> Doc -> Doc+maybeParens False = id+maybeParens True = parens++parens :: Doc -> Doc+parens p = text "(" <> p <> text ")"+braces :: Doc -> Doc+braces p = text "{" <> p <> text "}"+brackets :: Doc -> Doc+brackets p = text "[" <> p <> text "]"++-- mkNest checks for Nest's invariant that it doesn't have an Empty inside it+mkNest :: Int -> Doc -> Doc+mkNest k (Nest k1 p) = mkNest (k + k1) p+mkNest _ NoDoc = NoDoc+mkNest _ Empty = Empty+mkNest 0 p = p+mkNest k p = nest_ k p++-- mkUnion checks for an empty document+mkUnion :: Doc -> Doc -> Doc+mkUnion Empty _ = Empty+mkUnion p q = p `union_` q++data IsEmpty = IsEmpty | NotEmpty++reduceHoriz :: Doc -> (IsEmpty, Doc)+reduceHoriz (Beside p g q) = eliminateEmpty Beside (snd (reduceHoriz p)) g (reduceHoriz q)+reduceHoriz doc = (NotEmpty, doc)++reduceVert :: Doc -> (IsEmpty, Doc)+reduceVert (Above p g q) = eliminateEmpty Above (snd (reduceVert p)) g (reduceVert q)+reduceVert doc = (NotEmpty, doc)++eliminateEmpty ::+ (Doc -> Bool -> Doc -> Doc) ->+ Doc -> Bool -> (IsEmpty, Doc) -> (IsEmpty, Doc)+eliminateEmpty _ Empty _ q = q+eliminateEmpty cons p g q =+ (NotEmpty,+ case q of+ (NotEmpty, q') -> cons p g q'+ (IsEmpty, _) -> p+ )++nilAbove_ :: RDoc -> RDoc+nilAbove_ = NilAbove++-- | Arg of a TextBeside is always an RDoc.+textBeside_ :: String -> RDoc -> RDoc+textBeside_ = TextBeside++nest_ :: Int -> RDoc -> RDoc+nest_ = Nest++union_ :: RDoc -> RDoc -> RDoc+union_ = Union++($$) :: Doc -> Doc -> Doc+p $$ q = above_ p False q++-- | Above, with no overlapping.+-- '$+$' is associative, with identity 'empty'.+($+$) :: Doc -> Doc -> Doc+p $+$ q = above_ p True q++above_ :: Doc -> Bool -> Doc -> Doc+above_ p _ Empty = p+above_ Empty _ q = q+above_ p g q = Above p g q++above :: Doc -> Bool -> RDoc -> RDoc+above (Above p g1 q1) g2 q2 = above p g1 (above q1 g2 q2)+above p@Beside{} g q = aboveNest (reduceDoc p) g 0 (reduceDoc q)+above p g q = aboveNest p g 0 (reduceDoc q)++-- Specfication: aboveNest p g k q = p $g$ (nest k q)+aboveNest :: RDoc -> Bool -> Int -> RDoc -> RDoc+aboveNest _ _ k _ | k `seq` False = undefined+aboveNest NoDoc _ _ _ = NoDoc+aboveNest (p1 `Union` p2) g k q = aboveNest p1 g k q `union_`+ aboveNest p2 g k q++aboveNest Empty _ k q = mkNest k q+aboveNest (Nest k1 p) g k q = nest_ k1 (aboveNest p g (k - k1) q)+ -- p can't be Empty, so no need for mkNest++aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q)+aboveNest (TextBeside s p) g k q = TextBeside s rest+ where+ k1 = k - length s+ rest = case p of+ Empty -> nilAboveNest g k1 q+ _ -> aboveNest p g k1 q++aboveNest Above{} _ _ _ = error "aboveNest Above"+aboveNest Beside{} _ _ _ = error "aboveNest Beside"++-- Specification: text s <> nilaboveNest g k q+-- = text s <> (text "" $g$ nest k q)+nilAboveNest :: Bool -> Int -> RDoc -> RDoc+nilAboveNest _ k _ | k `seq` False = undefined+nilAboveNest _ _ Empty = Empty+ -- Here's why the "text s <>" is in the spec!+nilAboveNest g k (Nest k1 q) = nilAboveNest g (k + k1) q+nilAboveNest g k q | not g && k > 0 -- No newline if no overlap+ = textBeside_ (replicate k ' ') q+ | otherwise -- Put them really above+ = nilAbove_ (mkNest k q)++instance Semigroup Doc where+ p <> q = beside_ p False q++-- | Beside, separated by space, unless one of the arguments is 'empty'.+-- '<+>' is associative, with identity 'empty'.+(<+>) :: Doc -> Doc -> Doc+p <+> q = beside_ p True q++beside_ :: Doc -> Bool -> Doc -> Doc+beside_ p _ Empty = p+beside_ Empty _ q = q+beside_ p g q = Beside p g q++-- Specification: beside g p q = p <g> q+beside :: Doc -> Bool -> RDoc -> RDoc+beside NoDoc _ _ = NoDoc+beside (p1 `Union` p2) g q = beside p1 g q `union_` beside p2 g q+beside Empty _ q = q+beside (Nest k p) g q = nest_ k $! beside p g q+beside p@(Beside p1 g1 q1) g2 q2+ | g1 == g2 = beside p1 g1 $! beside q1 g2 q2+ | otherwise = beside (reduceDoc p) g2 q2+beside p@Above{} g q = let { d = reduceDoc p } in beside d g q+beside (NilAbove p) g q = nilAbove_ $! beside p g q+beside (TextBeside t p) g q = TextBeside t rest+ where+ rest = case p of+ Empty -> nilBeside g q+ _ -> beside p g q++-- Specification: text "" <> nilBeside g p+-- = text "" <g> p+nilBeside :: Bool -> RDoc -> RDoc+nilBeside _ Empty = Empty -- Hence the text "" in the spec+nilBeside g (Nest _ p) = nilBeside g p+nilBeside g p | g = textBeside_ " " p+ | otherwise = p++sep :: [Doc] -> Doc+sep = sepX True -- Separate with spaces++-- | Either 'hcat' or 'vcat'.+cat :: [Doc] -> Doc+cat = sepX False -- Don't++sepX :: Bool -> [Doc] -> Doc+sepX _ [] = empty+sepX x (p:ps) = sep1 x (reduceDoc p) 0 ps+++-- Specification: sep1 g k ys = sep (x : map (nest k) ys)+-- = oneLiner (x <g> nest k (hsep ys))+-- `union` x $$ nest k (vcat ys)+sep1 :: Bool -> RDoc -> Int -> [Doc] -> RDoc+sep1 _ _ k _ | k `seq` False = undefined+sep1 _ NoDoc _ _ = NoDoc+sep1 g (p `Union` q) k ys = sep1 g p k ys `union_`+ aboveNest q False k (reduceDoc (vcat ys))++sep1 g Empty k ys = mkNest k (sepX g ys)+sep1 g (Nest n p) k ys = nest_ n (sep1 g p (k - n) ys)++sep1 _ (NilAbove p) k ys = nilAbove_+ (aboveNest p False k (reduceDoc (vcat ys)))+sep1 g (TextBeside s p) k ys = textBeside_ s (sepNB g p (k - length s) ys)+sep1 _ Above{} _ _ = error "sep1 Above"+sep1 _ Beside{} _ _ = error "sep1 Beside"++sepNB :: Bool -> Doc -> Int -> [Doc] -> Doc+sepNB g (Nest _ p) k ys+ = sepNB g p k ys+sepNB g Empty k ys+ = oneLiner (nilBeside g (reduceDoc rest)) `mkUnion`+ nilAboveNest False k (reduceDoc (vcat ys))+ where+ rest | g = hsep ys+ | otherwise = hcat ys+sepNB g p k ys+ = sep1 g p k ys++oneLiner :: Doc -> Doc+oneLiner NoDoc = NoDoc+oneLiner Empty = Empty+oneLiner (NilAbove _) = NoDoc+oneLiner (TextBeside s p) = textBeside_ s (oneLiner p)+oneLiner (Nest k p) = nest_ k (oneLiner p)+oneLiner (p `Union` _) = oneLiner p+oneLiner Above{} = error "oneLiner Above"+oneLiner Beside{} = error "oneLiner Beside"++-- ---------------------------------------------------------------------------+-- Rendering++-- | A rendering style. Allows us to specify constraints to choose among the+-- many different rendering options.+data Style = Style Int Rat+lineLength :: Style -> Int+lineLength (Style l _) = l+ribbonsPerLine :: Style -> Rat+ribbonsPerLine (Style _ r) = r++type Rat = (Int, Int)++style :: Style+style = Style 100 (3, 2)++-- | Render the @Doc@ to a String using the default @Style@ (see 'style').+render :: Doc -> String+render = renderStyle style++-- | Render the @Doc@ to a String using the given @Style@.+renderStyle :: Style -> Doc -> String+renderStyle s = fullRender (lineLength s) (ribbonsPerLine s) ""++-- | The general rendering interface. Please refer to the @Style@ and @Mode@+-- types for a description of rendering mode, line length and ribbons.+fullRender :: Int -- ^ Line length.+ -> Rat -- ^ Ribbons per line.+ -> String -- ^ What to do at the end.+ -> Doc -- ^ The document.+ -> String -- ^ Result.+fullRender lineLen (num, den) rest doc+ = display lineLen ribbonLen rest doc'+ where+ doc' = best bestLineLen ribbonLen (reduceDoc doc)++ ribbonLen = (lineLen * den) `quot` num+ bestLineLen = lineLen++display :: Int -> Int -> String -> Doc -> String+display _page_width _ribbon_width end doc+ = let lay :: Int -> Doc -> String+ lay k (Nest k1 p) = lay (k + k1) p+ lay _ Empty = end+ lay k (NilAbove p) = "\n" ++ lay k p+ lay k (TextBeside s p) = lay1 k s p+ lay _ _ = error "display lay"++ lay1 k s p = let r = k + length s+ in replicate k ' ' ++ (s ++ lay2 r p)++ lay2 :: Int -> Doc -> String+ lay2 k (NilAbove p) = "\n" ++ lay k p+ lay2 k (TextBeside s p) = s ++ lay2 (k + length s) p+ lay2 k (Nest _ p) = lay2 k p+ lay2 _ Empty = end+ lay2 _ _ = error "display lay2"+ in lay 0 doc++best :: Int -- Line length.+ -> Int -- Ribbon length.+ -> RDoc+ -> RDoc -- No unions in here!.+best w0 r = get w0+ where+ get _ Empty = Empty+ get _ NoDoc = NoDoc+ get w (NilAbove p) = nilAbove_ (get w p)+ get w (TextBeside s p) = textBeside_ s (get1 w (length s) p)+ get w (Nest k p) = nest_ k (get (w - k) p)+ get w (p `Union` q) = nicest w r (get w p) (get w q)+ get _ _ = error "best get"++ get1 _ _ Empty = Empty+ get1 _ _ NoDoc = NoDoc+ get1 w sl (NilAbove p) = nilAbove_ (get (w - sl) p)+ get1 w sl (TextBeside s p) = textBeside_ s (get1 w (sl + length s) p)+ get1 w sl (Nest _ p) = get1 w sl p+ get1 w sl (p `Union` q) = nicest1 w r sl (get1 w sl p)+ (get1 w sl q)+ get1 _ _ _ = error "best get1"++nicest :: Int -> Int -> Doc -> Doc -> Doc+nicest w r = nicest1 w r 0++nicest1 :: Int -> Int -> Int -> Doc -> Doc -> Doc+nicest1 w r sl p q | fits (minWR - sl) p = p+ | otherwise = q+ where minWR = min w r++fits :: Int -- Space available+ -> Doc+ -> Bool -- True if *first line* of Doc fits in space available+fits n _ | n < 0 = False+fits _ NoDoc = False+fits _ Empty = True+fits _ (NilAbove _) = True+fits n (TextBeside s p) = fits (n - length s) p+fits _ _ = error "fits"++---------++fcat :: [Doc] -> Doc+fcat = fill False++fsep :: [Doc] -> Doc+fsep = fill True++-- Specification:+--+-- fill g docs = fillIndent 0 docs+--+-- fillIndent k [] = []+-- fillIndent k [p] = p+-- fillIndent k (p1:p2:ps) =+-- oneLiner p1 <g> fillIndent (k + length p1 + g ? 1 : 0)+-- (remove_nests (oneLiner p2) : ps)+-- `Union`+-- (p1 $*$ nest (-k) (fillIndent 0 ps))+--+-- $*$ is defined for layouts (not Docs) as+-- layout1 $*$ layout2 | hasMoreThanOneLine layout1 = layout1 $$ layout2+-- | otherwise = layout1 $+$ layout2++fill :: Bool -> [Doc] -> RDoc+fill _ [] = empty+fill g (p:ps) = fill1 g (reduceDoc p) 0 ps++fill1 :: Bool -> RDoc -> Int -> [Doc] -> Doc+fill1 _ _ k _ | k `seq` False = undefined+fill1 _ NoDoc _ _ = NoDoc+fill1 g (p `Union` q) k ys = fill1 g p k ys `union_`+ aboveNest q False k (fill g ys)+fill1 g Empty k ys = mkNest k (fill g ys)+fill1 g (Nest n p) k ys = nest_ n (fill1 g p (k - n) ys)+fill1 g (NilAbove p) k ys = nilAbove_ (aboveNest p False k (fill g ys))+fill1 g (TextBeside s p) k ys = textBeside_ s (fillNB g p k ys)+fill1 _ Above{} _ _ = error "fill1 Above"+fill1 _ Beside{} _ _ = error "fill1 Beside"++fillNB :: Bool -> Doc -> Int -> [Doc] -> Doc+fillNB _ _ k _ | k `seq` False = undefined+fillNB g (Nest _ p) k ys = fillNB g p k ys+ -- Never triggered, because of invariant (2)+fillNB _ Empty _ [] = Empty+fillNB g Empty k (Empty:ys) = fillNB g Empty k ys+fillNB g Empty k (y:ys) = fillNBE g k y ys+fillNB g p k ys = fill1 g p k ys+++fillNBE :: Bool -> Int -> Doc -> [Doc] -> Doc+fillNBE g k y ys+ = nilBeside g (fill1 g ((elideNest . oneLiner . reduceDoc) y) k' ys)+ -- XXX: TODO: PRETTY: Used to use True here (but GHC used False...)+ `mkUnion` nilAboveNest False k (fill g (y:ys))+ where k' = if g then k - 1 else k++elideNest :: Doc -> Doc+elideNest (Nest _ d) = d+elideNest d = d
@@ -0,0 +1,143 @@+{-# OPTIONS_GHC -Wno-unused-imports #-}+-----------------------------------------------------------------------------+-- |+-- Module : Text.PrettyPrint.HughesPJClass+-- Copyright : (c) Lennart Augustsson 2014+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : David Terei <code@davidterei.com>+-- Stability : stable+-- Portability : portable+--+-- Pretty printing class, simlar to 'Show' but nicer looking.+--+-- Note that the precedence level is a 'Rational' so there is an unlimited+-- number of levels. This module re-exports 'Text.PrettyPrint.HughesPJ'.+--+-----------------------------------------------------------------------------++module Mhs.Text.PrettyPrint.HughesPJLiteClass (+ -- * Pretty typeclass+ Pretty(..),++ PrettyLevel(..), prettyNormal,+ PrettyPrec,+ prettyShow,+ pPrint0,+ appPrec,++ -- re-export HughesPJ+ module Mhs.Text.PrettyPrint.HughesPJLite+ ) where+import qualified Prelude(); import MiniPrelude+-- Integer and Double are not in the MiniPrelude of lib. With GHC they are,+-- so this import is redundant there, see the OPTIONS_GHC pragma.+import Prelude(Integer, Double)++import Mhs.Text.PrettyPrint.HughesPJLite++-- | Level of detail in the pretty printed output. Level 0 is the least+-- detail.+newtype PrettyLevel = PrettyLevel Int+ deriving (Eq, Ord, Show)++type PrettyPrec = Int++-- | The "normal" (Level 0) of detail.+prettyNormal :: PrettyLevel+prettyNormal = PrettyLevel 0++-- | Pretty printing class. The precedence level is used in a similar way as in+-- the 'Show' class. Minimal complete definition is either 'pPrintPrec' or+-- 'pPrint'.+class Pretty a where+ pPrintPrec :: PrettyLevel -> PrettyPrec -> a -> Doc+ pPrintPrec _ _ = pPrint++ pPrint :: a -> Doc+ pPrint = pPrintPrec prettyNormal 0++ pPrintList :: PrettyLevel -> [a] -> Doc+ pPrintList l = brackets . sep . punctuate comma . map (pPrintPrec l 0)++-- | Pretty print a value with the 'prettyNormal' level.+prettyShow :: (Pretty a) => a -> String+prettyShow = render . pPrint++pPrint0 :: (Pretty a) => PrettyLevel -> a -> Doc+pPrint0 l = pPrintPrec l 0++appPrec :: PrettyPrec+appPrec = 10++comma :: Doc+comma = text ","++-- Various Pretty instances+instance Pretty Int where pPrint = text . show++instance Pretty Integer where pPrint = text . show++instance Pretty Double where pPrint = text . show++instance Pretty () where pPrint _ = text "()"++instance Pretty Bool where pPrint = text . show++instance Pretty Ordering where pPrint = text . show++instance Pretty Char where+ pPrint = text . show+ pPrintList _ = text . show++instance (Pretty a) => Pretty (Maybe a) where+ pPrintPrec _ _ Nothing = text "Nothing"+ pPrintPrec l p (Just x) =+ maybeParens (p > appPrec) $ text "Just" <+> pPrintPrec l (appPrec+1) x++instance (Pretty a, Pretty b) => Pretty (Either a b) where+ pPrintPrec l p (Left x) =+ maybeParens (p > appPrec) $ text "Left" <+> pPrintPrec l (appPrec+1) x+ pPrintPrec l p (Right x) =+ maybeParens (p > appPrec) $ text "Right" <+> pPrintPrec l (appPrec+1) x++instance (Pretty a) => Pretty [a] where+ pPrintPrec l _ = pPrintList l++instance (Pretty a, Pretty b) => Pretty (a, b) where+ pPrintPrec l _ (a, b) =+ parens $ fsep $ punctuate comma [pPrint0 l a, pPrint0 l b]++instance (Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) where+ pPrintPrec l _ (a, b, c) =+ parens $ fsep $ punctuate comma [pPrint0 l a, pPrint0 l b, pPrint0 l c]++instance (Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) where+ pPrintPrec l _ (a, b, c, d) =+ parens $ fsep $ punctuate comma+ [pPrint0 l a, pPrint0 l b, pPrint0 l c, pPrint0 l d]++instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) where+ pPrintPrec l _ (a, b, c, d, e) =+ parens $ fsep $ punctuate comma+ [pPrint0 l a, pPrint0 l b, pPrint0 l c, pPrint0 l d, pPrint0 l e]++instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) where+ pPrintPrec l _ (a, b, c, d, e, f) =+ parens $ fsep $ punctuate comma+ [pPrint0 l a, pPrint0 l b, pPrint0 l c,+ pPrint0 l d, pPrint0 l e, pPrint0 l f]++instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) =>+ Pretty (a, b, c, d, e, f, g) where+ pPrintPrec l _ (a, b, c, d, e, f, g) =+ parens $ fsep $ punctuate comma+ [pPrint0 l a, pPrint0 l b, pPrint0 l c,+ pPrint0 l d, pPrint0 l e, pPrint0 l f, pPrint0 l g]++instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) =>+ Pretty (a, b, c, d, e, f, g, h) where+ pPrintPrec l _ (a, b, c, d, e, f, g, h) =+ parens $ fsep $ punctuate comma+ [pPrint0 l a, pPrint0 l b, pPrint0 l c,+ pPrint0 l d, pPrint0 l e, pPrint0 l f, pPrint0 l g, pPrint0 l h]
@@ -0,0 +1,523 @@+-- This module implements the operation needed to support+-- the Integer type.+module Data.Integer.Internal(+ Integer,+ zeroI, oneI, negOneI,+ eqI, neI, cmpI, ltI, leI, gtI, geI,+ addI, subI, mulI, quotRemI,+ negateI, absI,+ andI, orI, xorI,+ shiftLI, shiftRI,+ testBitI, popCountI,+ log2I,+ _intToInteger,+ _integerToFloat,+ _integerToDouble,+ _integerToInt,+ _wordToInteger,+ ) where+import qualified Prelude() -- do not import Prelude+import Primitives+import Control.Error+import Control.Exception.Internal+import Data.Bits.Base+import Data.Bool+import Data.Enum+import Data.Eq+import Data.Function+import Data.Int.Int+import Data.Integral+import Data.List+import Data.Maybe_Type+import Data.Num+import Data.Ord+import Data.Word+import Data.Integer_Type++isZero :: Integer -> Bool+isZero (I _ ds) = null ds++instance Eq Sign where+ (==) Plus Plus = True+ (==) Minus Minus = True+ (==) _ _ = False++-- Trim off 0s and make an Integer+sI :: Sign -> [Digit] -> Integer+sI s ds =+ -- Remove trailing 0s+ case dropWhileEnd (== (0 :: Word)) ds of+ [] -> I Plus []+ ds' -> I s ds'++zeroD :: Digit+zeroD = 0++addI :: Integer -> Integer -> Integer+addI (I Plus xs) (I Plus ys) = I Plus (add xs ys)+addI (I Plus xs) (I Minus ys) | LT <- cmpW xs ys = sI Minus (sub ys xs)+ | True = sI Plus (sub xs ys)+addI (I Minus xs) (I Plus ys) | LT <- cmpW ys xs = sI Minus (sub xs ys)+ | True = sI Plus (sub ys xs)+addI (I Minus xs) (I Minus ys) = I Minus (add xs ys)++negateI :: Integer -> Integer+negateI i@(I _ []) = i+negateI (I Plus x) = I Minus x+negateI (I Minus x) = I Plus x++absI :: Integer -> Integer+absI (I _ x) = I Plus x++subI :: Integer -> Integer -> Integer+subI x y = addI x (negateI y)++add :: [Digit] -> [Digit] -> [Digit]+add = add' zeroD++add' :: Digit -> [Digit] -> [Digit] -> [Digit]+add' ci (x : xs) (y : ys) = s : add' co xs ys where (co, s) = addD ci x y+add' ci (x : xs) [] = s : add' co xs [] where (co, s) = addD ci x zeroD+add' ci [] (y : ys) = s : add' co [] ys where (co, s) = addD ci zeroD y+add' ci [] [] = if ci == zeroD then [] else [ci]++-- Add 3 digits with carry+addD :: Digit -> Digit -> Digit -> (Digit, Digit)+addD x y z = (quotMaxD s, remMaxD s) where s = x + y + z++-- Invariant: xs >= ys, so result is always >= 0+sub :: [Digit] -> [Digit] -> [Digit]+sub xs ys = sub' zeroD xs ys++sub' :: Digit -> [Digit] -> [Digit] -> [Digit]+sub' bi (x : xs) (y : ys) = d : sub' bo xs ys where (bo, d) = subW bi x y+sub' bi (x : xs) [] = d : sub' bo xs [] where (bo, d) = subW bi x zeroD+sub' 0 [] [] = []+sub' _ [] _ = error "impossible: xs >= ys"++-- Subtract with borrow+subW :: Digit -> Digit -> Digit -> (Digit, Digit)+subW b x y =+ let d = maxD + x - y - b+ in (1 - quotMaxD d, remMaxD d)++cmpW :: [Digit] -> [Digit] -> Ordering+cmpW (x : xs) (y : ys) =+ case cmpW xs ys of+ EQ -> compare x y+ res -> res+cmpW (_ : _) [] = GT+cmpW [] (_ : _) = LT+cmpW [] [] = EQ++mulI :: Integer -> Integer -> Integer+mulI (I _ []) _ = I Plus [] -- 0 * x = 0+mulI _ (I _ []) = I Plus [] -- x * 0 = 0+mulI (I sx [x]) (I sy ys) = I (mulSign sx sy) (mulD zeroD ys x)+mulI (I sx xs) (I sy [y]) = I (mulSign sx sy) (mulD zeroD xs y)+mulI (I sx xs) (I sy ys) = I (mulSign sx sy) (mulM xs ys)++mulSign :: Sign -> Sign -> Sign+mulSign s t = if s == t then Plus else Minus++-- Multiply with a single digit, and add carry.+mulD :: Digit -> [Digit] -> Digit -> [Digit]+mulD ci [] _ = if ci == 0 then [] else [ci]+mulD ci (x:xs) y = r : mulD q xs y+ where+ xy = x * y + ci+ q = quotMaxD xy+ r = remMaxD xy++mulM :: [Digit] -> [Digit] -> [Digit]+mulM xs ys =+ let rs = map (mulD zeroD xs) ys+ ss = zipWith (++) (map (`replicate` (0 :: Word)) [0 :: Int ..]) rs+ in foldl1 add ss++-- Signs:+-- + + -> (+,+)+-- + - -> (-,+)+-- - + -> (-,-)+-- - - -> (+,-)+quotRemI :: Integer -> Integer -> (Integer, Integer)+quotRemI _ (I _ []) = throw DivideByZero -- n / 0+quotRemI (I _ []) _ = (I Plus [], I Plus []) -- 0 / n+quotRemI (I sx xs) (I sy ys) | Just (y, n) <- msd ys =+ -- All but the MSD are 0. Scale numerator accordingly and divide.+ -- Then add back (the ++) the remainder we scaled off.+ let (rs, xs') = splitAt n xs -- xs' is the scaled number+ in case quotRemD xs' y of+ (q, r) -> qrRes sx sy (q, rs ++ r)+quotRemI (I sx xs) (I sy ys) = qrRes sx sy (quotRemB xs ys)++msd :: [Digit] -> Maybe (Digit, Int)+msd = go 0+ where+ go _ [] = Nothing+ go n [d] = Just (d, n)+ go n (d : ds) = if d == 0 then go (n + 1) ds else Nothing++qrRes :: Sign -> Sign -> ([Digit], [Digit]) -> (Integer, Integer)+qrRes sx sy (ds, rs) = (sI (mulSign sx sy) ds, sI sx rs)++quotI :: Integer -> Integer -> Integer+quotI x y =+ case quotRemI x y of+ (q, _) -> q++-- Divide by a single digit.+-- Does not return normalized numbers.+quotRemD :: [Digit] -> Digit -> ([Digit], [Digit])+quotRemD axs y = qr zeroD (reverse axs) []+ where+ qr ci [] res = (res, [ci])+ qr ci (x:xs) res = qr r xs (q:res)+ where+ --cx = ci `unsafeShiftL` shiftD + x+ cx = ci * maxD + x+ q = quot cx y+ r = rem cx y++-- Simple iterative long division.+quotRemB :: [Digit] -> [Digit] -> ([Digit], [Digit])+quotRemB xs ys =+ let n = I Plus xs+ d = I Plus ys+ a = I Plus $ replicate (length ys - (1 :: Int)) (0 :: Word) ++ [last ys] -- only MSD of ys+ aq = quotI n a+ ar = addI d oneI+ loop q r =+ if absI r `geI` d then+ let r' = n `subI` (q `mulI` d)+ qn = q `addI` (r' `quotI` a)+ q' = (q `addI` qn) `quotI` twoI+ in loop q' r'+ else+ q+ q' = loop aq ar+ r = n `subI` (q' `mulI` d)+ in if r `ltI` zeroI then+ (digits (q' `subI` oneI), digits (r `addI` d))+ else+ (digits q', digits r)++digits :: Integer -> [Digit]+digits (I _ ds) = ds++zeroI :: Integer+zeroI = I Plus []++oneI :: Integer+oneI = I Plus [1]++twoI :: Integer+twoI = I Plus [2]++tenI :: Integer+tenI = I Plus [10]++negOneI :: Integer+negOneI = I Minus [1]++--------------++eqI :: Integer -> Integer -> Bool+eqI (I sx xs) (I sy ys) = sx == sy && xs == ys++neI :: Integer -> Integer -> Bool+neI x y = not (eqI x y)++cmpI :: Integer -> Integer -> Ordering+cmpI (I Plus xs) (I Plus ys) = cmpW xs ys+cmpI (I Minus _) (I Plus _) = LT+cmpI (I Plus _) (I Minus _) = GT+cmpI (I Minus xs) (I Minus ys) = cmpW ys xs++ltI :: Integer -> Integer -> Bool+ltI x y =+ case cmpI x y of+ LT -> True+ _ -> False++leI :: Integer -> Integer -> Bool+leI x y =+ case cmpI x y of+ GT -> False+ _ -> True++gtI :: Integer -> Integer -> Bool+gtI x y =+ case cmpI x y of+ GT -> True+ _ -> False++geI :: Integer -> Integer -> Bool+geI x y =+ case cmpI x y of+ LT -> False+ _ -> True++---------------------------------++andI :: Integer -> Integer -> Integer+andI (I Plus xs) (I Plus ys) = bI Plus (andDigits xs ys)+andI (I Plus xs) (I Minus ys) = bI Plus (andNotDigits (sub1 ys) xs)+andI (I Minus xs) (I Plus ys) = bI Plus (andNotDigits (sub1 xs) ys)+andI (I Minus xs) (I Minus ys) = bI Minus (orDigits (sub1 xs) (sub1 ys))++orI :: Integer -> Integer -> Integer+orI (I Plus xs) (I Plus ys) = bI Plus (orDigits xs ys)+orI (I Plus xs) (I Minus ys) = bI Minus (andNotDigits xs (sub1 ys))+orI (I Minus xs) (I Plus ys) = bI Minus (andNotDigits ys (sub1 xs))+orI (I Minus xs) (I Minus ys) = bI Minus (andDigits (sub1 xs) (sub1 ys))++xorI :: Integer -> Integer -> Integer+xorI (I Plus xs) (I Plus ys) = bI Plus (xorDigits xs ys)+xorI (I Plus xs) (I Minus ys) = bI Minus (xorDigits xs (sub1 ys))+xorI (I Minus xs) (I Plus ys) = bI Minus (xorDigits (sub1 xs) ys)+xorI (I Minus xs) (I Minus ys) = bI Plus (xorDigits (sub1 xs) (sub1 ys))++bI :: Sign -> [Digit] -> Integer+bI Plus ds = sI Plus ds+bI Minus ds = sI Minus (add1 ds)++add1 :: [Digit] -> [Digit]+add1 ds = add ds [1]++sub1 :: [Digit] -> [Digit]+sub1 ds = sub ds [1]++andDigits :: [Digit] -> [Digit] -> [Digit]+andDigits (x : xs) (y : ys) = (x .&. y) : andDigits xs ys+andDigits _ _ = []++andNotDigits :: [Digit] -> [Digit] -> [Digit]+andNotDigits [] [] = []+andNotDigits [] ys = ys+andNotDigits xs [] = []+andNotDigits (x : xs) (y : ys) = (complement x .&. y) : andNotDigits xs ys++orDigits :: [Digit] -> [Digit] -> [Digit]+orDigits [] [] = []+orDigits [] ys = ys+orDigits xs [] = xs+orDigits (x : xs) (y : ys) = (x .|. y) : orDigits xs ys++xorDigits :: [Digit] -> [Digit] -> [Digit]+xorDigits [] [] = []+xorDigits [] ys = ys+xorDigits xs [] = xs+xorDigits (x : xs) (y : ys) = (x `xor` y) : xorDigits xs ys++shiftLD :: [Digit] -> Int -> [Digit]+shiftLD ds 0 = ds+shiftLD ds i = go 0 ds+ where+ go ci [] = if ci == 0 then [] else [ci]+ go ci (d : ds) =+ let+ x = (d `unsafeShiftL` i) .|. ci+ co = quotMaxD x+ s = remMaxD x+ in s : go co ds++shiftRD :: [Digit] -> Int -> ([Digit], Bool)+shiftRD ds 0 = (ds, False)+shiftRD ds i =+ let (rs, ds') = splitAt 1 (shiftLD ds (shiftD - i))+ in (ds', any (/= 0) rs)++testBitI :: Integer -> Int -> Bool+testBitI (I Plus ds) i =+ case ds !? q of+ Just d -> testBit d r+ Nothing -> False+ where (q, r) = quotRem i shiftD+testBitI (I Minus ds) i =+ -- not (testBitI (complement (I Minus ds)) i)+ case ds !? q of+ Just d ->+ let d' = if all (== 0) (take q ds) then d - 1 else d+ in not (testBit d' r)+ Nothing -> True+ where (q, r) = quotRem i shiftD++shiftLI :: Integer -> Int -> Integer+shiftLI (I sign ds) i+ | null ds = zeroI+ | otherwise =+ let (q, r) = quotRem i shiftD+ in I sign (replicate q 0 ++ shiftLD ds r)++shiftRI :: Integer -> Int -> Integer+shiftRI (I sign ds) i+ | null ds = zeroI+ | otherwise =+ let+ (q, r) = quotRem i shiftD+ (rs, ds') = splitAt q ds+ (ds'', shiftedOut1s) = shiftRD ds' r+ in case sign of+ Minus | shiftedOut1s || any (/= 0) rs -> I sign (add1 ds'')+ _ -> I sign ds''++popCountI :: Integer -> Int+popCountI (I sign ds) =+ let count = sum (map popCount ds)+ in case sign of+ Plus -> count+ Minus -> -count++log2I :: Integer -> Int+log2I (I _ ds) = case go 0 ds of+ Nothing -> 0+ Just (d, n) -> n * shiftD + _wordSize - 1 - primWordClz d+ where+ go _ [] = Nothing+ go n [d] = Just (d, n)+ go n (d : ds) = go (n + 1) ds++---------------------------------+{-+pIntegerToInteger :: P.Integer -> Integer+pIntegerToInteger i | i >= 0 = I Plus (f i)+ | otherwise = I Minus (f (negate i))+ where+ f 0 = []+ f x = fromInteger (rem x (toInteger maxD)) : f (quot x (toInteger maxD))++integerToPInteger :: Integer -> P.Integer+integerToPInteger (I s xs) =+ let r = foldr (\ d r -> r * toInteger maxD + toInteger d) 0 xs+ in case s of+ Plus -> r+ Minus -> negate r++instance Num Integer where+ (+) = addI+ (-) = subI+ (*) = mulI+ abs x = if x < 0 then -x else x+ signum x = if x > 0 then 1 else if x < 0 then -1 else 0+ fromInteger = pIntegerToInteger++instance Enum Integer where+ fromEnum = fromEnum . integerToPInteger+ toEnum = _intToInteger++instance Real Integer where+ toRational = toRational . toInteger++instance Integral Integer where+ quotRem = quotRemI+ toInteger = integerToPInteger++--instance Show Integer where+-- show = showInteger++instance Eq Integer where+ (==) = eqI++instance Ord Integer where+ x < y = x `ltI` y+ x <= y = x == y || x `ltI` y+ x > y = y `ltI` x+ x >= y = x == y || y `ltI` x++instance Arbitrary Integer where+ arbitrary = do+ ndig <- frequency+ [(5, pure 0)+ ,(25, pure 1)+ ,(20, pure 2)+ ,(10, pure 3)+ ,(10, pure 4)+ ,(2, pure 5)+ ,(2, pure 6)+ ]+ digits <- vectorOf ndig (chooseInt (0, maxD - 1))+ sign <- elements [Plus, Minus]+ pure $ if null digits then I Plus [] else I sign digits++{-+newtype SmallInteger = SmallInteger Integer+ deriving Show++instance Arbitrary SmallInteger where+ arbitrary = do+ ndig <- frequency+ [(25, pure 1)+ ,(20, pure 2)+ ,(10, pure 3)+ ,(10, pure 4)+ ]+ digit <- chooseInt (1, maxD - 1)+ sign <- elements [Plus, Minus]+ pure $ SmallInteger $ I sign (replicate (ndig - 1) 0 ++ [digit])+-}+{-+sanity :: HasCallStack => Integer -> Integer+sanity (I Minus []) = undefined+sanity (I _ ds) | length ds > 1 && last ds == 0 = undefined+sanity i = i+-}++prop_roundtrip1 :: Integer -> Bool+prop_roundtrip1 i = fromInteger (toInteger i) == i++prop_negate :: Integer -> Bool+prop_negate i = toInteger (negate i) == negate (toInteger i)++prop_abs :: Integer -> Bool+prop_abs i = toInteger (abs i) == abs (toInteger i)++prop_add :: Integer -> Integer -> Bool+prop_add x y = toInteger (addI x y) == toInteger x + toInteger y++prop_sub :: Integer -> Integer -> Bool+prop_sub x y = toInteger (subI x y) == toInteger x - toInteger y++prop_mul :: Integer -> Integer -> Bool+prop_mul x y = toInteger (mulI x y) == toInteger x * toInteger y++prop_div :: Integer -> NonZero Integer -> Bool+prop_div x (NonZero y) =+ to (quotRemI x y) == toInteger x `quotRem` toInteger y+ where to (a, b) = (toInteger a, toInteger b)++prop_muldiv :: Integer -> NonZero Integer -> Bool+prop_muldiv x (NonZero y) =+ let (q, r) = quotRemI x y+ in q*y + r == x++prop_eq :: Integer -> Integer -> Bool+prop_eq x y = (eqI x y) == (toInteger x == toInteger y)++prop_ne :: Integer -> Integer -> Bool+prop_ne x y = (neI x y) == (toInteger x /= toInteger y)++prop_lt :: Integer -> Integer -> Bool+prop_lt x y = (ltI x y) == (toInteger x < toInteger y)++prop_gt :: Integer -> Integer -> Bool+prop_gt x y = (gtI x y) == (toInteger x > toInteger y)++prop_le :: Integer -> Integer -> Bool+prop_le x y = (leI x y) == (toInteger x <= toInteger y)++prop_ge :: Integer -> Integer -> Bool+prop_ge x y = (geI x y) == (toInteger x >= toInteger y)++prop_show :: Integer -> Bool+prop_show x = showInteger x == show (toInteger x)++checkAll :: IO ()+checkAll = do+ let qc p = quickCheck (withMaxSuccess 100000 p)+ mapM_ qc [prop_roundtrip1, prop_negate, prop_abs, prop_show]+ mapM_ qc [prop_add, prop_sub, prop_mul,+ prop_eq, prop_ne, prop_lt, prop_gt, prop_le, prop_ge]+ mapM_ qc [prop_div, prop_muldiv]++-}
@@ -0,0 +1,132 @@+-- Copyright 2023 Lennart Augustsson+-- See LICENSE file for full license.+module Data.Integer_Type(module Data.Integer_Type) where+import qualified Prelude() -- do not import Prelude+import Primitives+import {-# SOURCE #-} Control.Error+import Data.Bool_Type+import Data.List_Type++--+-- The Integer is stored in sign-magnitude format with digits in base maxD (2^32)+-- It has the following invariants:+-- * each digit is >= 0 and < maxD+-- * least significant digits first, most significant last+-- * no trailing 0s in the digits+-- * 0 is positive++data Integer = I Sign [Digit] deriving ()++data Sign = Plus | Minus deriving ()++type Digit = Word++maxD :: Digit+maxD = 1 `primWordShl` shiftD++shiftD :: Int+shiftD = {-_wordSize-} 32 `primIntShr` 1 -- this is used so multiplication of two digits doesn't overflow a Word++quotMaxD :: Digit -> Digit+quotMaxD d = d `primWordShr` shiftD++remMaxD :: Digit -> Digit+remMaxD d = d `primWordAnd` (maxD `primWordSub` 1)++-- Sadly, we also need a bunch of functions.++_intToInteger :: Int -> Integer+_intToInteger i+ | i `primIntEQ` 0 = I Plus []+ | i `primIntGE` 0 = f Plus (primIntToWord i)+ | True = f Minus (primWordNeg (primIntToWord i))+ where+ f sign i =+ let+ high = quotMaxD i+ low = remMaxD i+ in if high `primWordEQ` 0 then I sign [low] else I sign [low, high]++_integerToInt :: Integer -> Int+_integerToInt x = primWordToInt (_integerToWord x)++_wordToInteger :: Word -> Integer+_wordToInteger i+ | i `primWordEQ` 0 = I Plus []+ | high `primWordEQ` 0 = I Plus [low]+ | True = I Plus [low, high]+ where+ high = quotMaxD i+ low = remMaxD i++_integerToWord :: Integer -> Word+_integerToWord (I sign ds) =+ case sign of+ Plus -> i+ Minus -> 0 `primWordSub` i+ where+ xadd = primWordAdd+ xmul x = primWordShl x shiftD+ i =+ case ds of+ [] -> 0 :: Word+ [d1] -> d1+ -- XXX should really depend of the width of a digit+ [d1, d2] -> xmul d2 `xadd` d1+ [d1, d2, d3] -> xmul (xmul d3 `xadd` d2) `xadd` d1+ d1:d2:d3:d4:_ -> xmul (xmul (xmul d4 `xadd` d3) `xadd` d2) `xadd` d1++_integerToWord64 :: Integer -> Word64+_integerToWord64 (I sign ds) =+ case sign of+ Plus -> i+ Minus -> 0 `primWord64Sub` i+ where+ xadd = primWord64Add+ xmul x = primWord64Shl x shiftD+ conv [] = []+ conv (x:xs) = primWordToWord64 x : conv xs+ i =+ case conv ds of+ [] -> 0 :: Word64+ [d1] -> d1+ -- XXX should really depend of the width of a digit+ [d1, d2] -> xmul d2 `xadd` d1+ [d1, d2, d3] -> xmul (xmul d3 `xadd` d2) `xadd` d1+ d1:d2:d3:d4:_ -> xmul (xmul (xmul d4 `xadd` d3) `xadd` d2) `xadd` d1++_word64ToInteger :: Word64 -> Integer+_word64ToInteger w = I Plus (conv w)+ where conv i | primWord64EQ i 0 = []+ | True = primWord64ToWord (primWord64Rem i base) : conv (primWord64Quot i base)+ base = primWordToWord64 maxD++_integerToInt64 :: Integer -> Int64+_integerToInt64 x = primWord64ToInt64 (_integerToWord64 x)++_int64ToInteger :: Int64 -> Integer+_int64ToInteger i+ | i `primInt64EQ` 0 = I Plus []+ | i `primInt64GE` 0 = _word64ToInteger (primInt64ToWord64 i)+ | True = I Minus ds+ where I _ ds = _word64ToInteger (primWord64Neg (primInt64ToWord64 i))++_integerToFloat :: Integer -> Float+_integerToFloat (I sign ds) = sgn (loop ds)+ where+ loop [] = 0.0 :: Float+ loop (d : ds) = primFloatFromInt (primWordToInt d) `primFloatAdd` (primFloatFromInt (primWordToInt maxD) `primFloatMul` loop ds)+ sgn x =+ case sign of+ Plus -> x+ Minus -> primFloatNeg x++_integerToDouble :: Integer -> Double+_integerToDouble (I sign ds) = sgn (loop ds)+ where+ loop [] = 0.0 :: Double+ loop (d : ds) = primDoubleFromInt (primWordToInt d) `primDoubleAdd` (primDoubleFromInt (primWordToInt maxD) `primDoubleMul` loop ds)+ sgn x =+ case sign of+ Plus -> x+ Minus -> primDoubleNeg x
@@ -12,6 +12,7 @@ -- cclibs flags to pass at the end of the compilation command, default "" -- conf the config directory to use, default "unix" -- cout flag to set the output file to cc, default "-o"+-- js flag to embed a JavaScript file, default "" (not possible) -- If no target is set, we use 'unix' on non-Windows and 'windows' on Windows. @@ -48,6 +49,7 @@ -- Generate JavaScript&Wasm [emscripten] cc = "emcc"+js = "--pre-js" ccflags = "-O3 -sEXPORTED_RUNTIME_METHODS=stringToNewUTF8 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sNODERAWFS -sSINGLE_FILE -DUSE_SYSTEM_RAW -sEXIT_RUNTIME -Wno-address-of-packed-member" cclibs = "-lm" conf = "unix"@@ -55,7 +57,7 @@ -- Generate JavaScript&Wasm, with xterm.js support [emscripten_web] cc = "emcc"-ccflags = "-O3 -sASYNCIFY -sEXPORTED_FUNCTIONS=['_main','_set_input_char'] -sEXPORTED_RUNTIME_METHODS=['FS','ccall'] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sSINGLE_FILE -DUSE_WEB_INPUT -Wno-address-of-packed-member"+ccflags = "-O3 -sASYNCIFY -sEXPORTED_FUNCTIONS=['_main','_set_input_char'] -sEXPORTED_RUNTIME_METHODS=['FS','ccall'] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -DUSE_WEB_INPUT -Wno-address-of-packed-member" cclibs = "-lm" conf = "unix" @@ -81,3 +83,64 @@ ccflags = "$MHSCCFLAGS" cclibs = "$MHSCCLIBS" conf = "$MHSCONF"++-- Library keys+-- name the name of the library+-- version the version of the library+-- modules the modules of the library, separated by spaces;+-- a module also stands for all the modules below it,+-- e.g., Data.Text includes Data.Text.IO+--+-- The libraries are the base package, and the libraries whose modules+-- are part of it. The installer writes a Cabal registration file for each,+-- so that tools like cabal know that these libraries are already installed.+-- The library named like the base package has no modules key; it gets the+-- modules of base that no other library has. The other libraries depend on it.+--+-- The version numbers are fake, they are from GHC. They are those of+-- builtinPackages in MicroCabal, except for hashable: Data.Hashable has+-- the API of the 1.4 series, and the packages that use it ask for that.++[library]+name = "base"+version = "4.19.1.0"++[library]+name = "bytestring"+version = "0.12.1.0"+modules = "Data.ByteString"++[library]+name = "deepseq"+version = "1.4.4.0"+modules = "Control.DeepSeq"++[library]+name = "directory"+version = "1.3.8.1"+modules = "System.Directory"++[library]+name = "hashable"+version = "1.4.7.0"+modules = "Data.Hashable"++[library]+name = "integer-logarithms"+version = "1.0.4"+modules = "Math.NumberTheory"++[library]+name = "process"+version = "1.6.18.0"+modules = "System.Process"++[library]+name = "stm"+version = "2.5.3.0"+modules = "Control.Concurrent.STM Control.Monad.STM"++[library]+name = "text"+version = "2.1.1"+modules = "Data.Text"
@@ -12,6 +12,7 @@ -- cclibs flags to pass at the end of the compilation command, default "" -- conf the config directory to use, default "unix" -- cout flag to set the output file to cc, default "-o"+-- js flag to embed a JavaScript file, default "" (not possible) -- If no target is set, we use 'unix' on non-Windows and 'windows' on Windows. @@ -48,6 +49,7 @@ -- Generate JavaScript&Wasm [emscripten] cc = "emcc"+js = "--pre-js" ccflags = "-O3 -sEXPORTED_RUNTIME_METHODS=stringToNewUTF8 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sNODERAWFS -sSINGLE_FILE -DUSE_SYSTEM_RAW -sEXIT_RUNTIME -Wno-address-of-packed-member" cclibs = "-lm" conf = "unix"@@ -55,7 +57,7 @@ -- Generate JavaScript&Wasm, with xterm.js support [emscripten_web] cc = "emcc"-ccflags = "-O3 -sASYNCIFY -sEXPORTED_FUNCTIONS=['_main','_set_input_char'] -sEXPORTED_RUNTIME_METHODS=['FS','ccall'] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -sSINGLE_FILE -DUSE_WEB_INPUT -Wno-address-of-packed-member"+ccflags = "-O3 -sASYNCIFY -sEXPORTED_FUNCTIONS=['_main','_set_input_char'] -sEXPORTED_RUNTIME_METHODS=['FS','ccall'] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH -sTOTAL_STACK=5MB -DUSE_WEB_INPUT -Wno-address-of-packed-member" cclibs = "-lm" conf = "unix" @@ -81,3 +83,64 @@ ccflags = "$MHSCCFLAGS" cclibs = "$MHSCCLIBS" conf = "$MHSCONF"++-- Library keys+-- name the name of the library+-- version the version of the library+-- modules the modules of the library, separated by spaces;+-- a module also stands for all the modules below it,+-- e.g., Data.Text includes Data.Text.IO+--+-- The libraries are the base package, and the libraries whose modules+-- are part of it. The installer writes a Cabal registration file for each,+-- so that tools like cabal know that these libraries are already installed.+-- The library named like the base package has no modules key; it gets the+-- modules of base that no other library has. The other libraries depend on it.+--+-- The version numbers are fake, they are from GHC. They are those of+-- builtinPackages in MicroCabal, except for hashable: Data.Hashable has+-- the API of the 1.4 series, and the packages that use it ask for that.++[library]+name = "base"+version = "4.19.1.0"++[library]+name = "bytestring"+version = "0.12.1.0"+modules = "Data.ByteString"++[library]+name = "deepseq"+version = "1.4.4.0"+modules = "Control.DeepSeq"++[library]+name = "directory"+version = "1.3.8.1"+modules = "System.Directory"++[library]+name = "hashable"+version = "1.4.7.0"+modules = "Data.Hashable"++[library]+name = "integer-logarithms"+version = "1.0.4"+modules = "Math.NumberTheory"++[library]+name = "process"+version = "1.6.18.0"+modules = "System.Process"++[library]+name = "stm"+version = "2.5.3.0"+modules = "Control.Concurrent.STM Control.Monad.STM"++[library]+name = "text"+version = "2.1.1"+modules = "Data.Text"
@@ -4,6 +4,7 @@ module Control.Error, module Control.Monad, module Control.Monad.Fail,+ module Control.Exception, module Data.Bool, module Data.Bounded, module Data.Char,@@ -31,23 +32,27 @@ module Data.String, module Data.Tuple, module Data.Typeable,+ module Data.Version, module System.IO.Base,+ module Text.Read, module Text.Show, first, second,- mhsError, _usingMhs, _wordSize, _isWindows, appendDot,- wantGMP,+ wantGMP, wantImath, compiledWithMhs, Int64,+ Word, HasCallStack,+ MhsError(..), SLoc(..), ) where import qualified Prelude() --import Primitives(primRnfNoErr, primRnfErr) import Control.Applicative(Applicative(..)) import Control.DeepSeq.Class import Control.Error(error, undefined, errorWithoutStackTrace)+import Control.Exception import Control.Monad(Monad(..), mapM, mapM_, sequence, sequence_, (=<<)) import Control.Monad.Fail(MonadFail(..)) import Data.Bool(Bool(..), (&&), (||), not, otherwise)@@ -83,16 +88,16 @@ import Data.Semigroup import Data.String(IsString(..), lines, unlines, words, unwords) import Data.Tuple(fst, snd, curry, uncurry)+import Data.Version+import Data.Word(Word) import System.IO.Base(IO, putChar, putStr, putStrLn, print, getLine, getContents, interact,- FilePath, readFile, writeFile, appendFile,- cprint, cuprint)+ FilePath, readFile, writeFile, appendFile)+import Text.Read(readMaybe) import Text.Show(Show(..), ShowS, shows, showChar, showString, showParen) import {-# SOURCE #-} Data.Typeable import Primitives(_wordSize, _isWindows) import Data.Text(Text)--mhsError :: String -> a-mhsError = errorWithoutStackTrace+import Control.Exception(Exception, throw) -- So we can detect mhs vs ghc _usingMhs :: Bool@@ -107,10 +112,14 @@ -- Exported by the runtime system to indicate if GMP is desired. foreign import capi "want_gmp" want_gmp :: Int+foreign import capi "want_imath" want_imath :: Int wantGMP :: Bool wantGMP = want_gmp /= 0 +wantImath :: Bool+wantImath = want_imath /= 0+ compiledWithMhs :: Bool compiledWithMhs = True @@ -125,3 +134,16 @@ class HasCallStack instance HasCallStack++---+-- This belongs in MicroHs.Error, but Hugs cannot derive Tyoeable+-- and GHC doesn't allow explicit Typeable instances.+data MhsError+ = MhsSyntaxError SLoc String String+ | MhsTypeError SLoc String String String -- header, expected, actual+ | MhsUndefError SLoc String String -- name space, ident+ | MhsAmbigError SLoc String String String -- name space, ident, alts+ | MhsOtherError SLoc String+ | MhsError String -- no location+data SLoc = SLoc FilePath Int Int+ deriving (Show, Eq)
@@ -1,4 +0,0 @@--- Copyright 2023 Lennart Augustsson--- See LICENSE file for full license.-module PrimTable() where-import qualified Prelude() -- do not import Prelude
@@ -11,6 +11,7 @@ import qualified Prelude(); import MiniPrelude import Control.Monad import Data.Char+import Data.List(isPrefixOf, tails) import System.IO foreign import ccall "GETRAW" c_getRaw :: IO Int@@ -69,6 +70,41 @@ toLines :: Hist -> [String] toLines (Hist before after _) = reverse before ++ after +-- Move one step back in the history, given the current line.+-- Returns the new history and the line to show.+histPrev :: String -> Hist -> Maybe (Hist, String)+histPrev _ (Hist [] _ _) = Nothing+histPrev cur (Hist (l:p) [] Nothing) = Just (Hist p [l] (Just cur), l)+histPrev _ (Hist (l:p) n orig) = Just (Hist p (l:n) orig, l)++-- Search backwards in the history, starting with the current line, for a line+-- that contains the pattern and is not equal to the line to skip.+-- Returns the new history, the found line, and the position of the match.+histSearch :: Maybe String -> String -> String -> Hist -> Maybe (Hist, String, Int)+histSearch skip pat line hist =+ case [ i | (i, t) <- zip [0..] (tails line), pat `isPrefixOf` t ] of+ is@(_:_) | Just line /= skip -> Just (hist, line, last is)+ _ -> histPrev line hist >>= \ (hist', line') -> histSearch skip pat line' hist'++back :: Int -> IO ()+back n = putStr (replicate n '\b')++bsSpBs :: Int -> String+bsSpBs n = concat $ replicate n "\b \b"++-- Decode a UTF-8 encoded character, given the first byte.+utf8 :: Int -> IO (Maybe Char)+utf8 i | i `quot` 32 == 6 = utf8' 1 (i `rem` 32)+ | i `quot` 16 == 14 = utf8' 2 (i `rem` 16)+ | i `quot` 8 == 30 = utf8' 3 (i `rem` 8)+ | otherwise = return Nothing+ where+ utf8' :: Int -> Int -> IO (Maybe Char)+ utf8' 0 c = return (Just (chr c))+ utf8' n c = do+ d <- getRaw+ utf8' (n - 1) (c * 64 + ord d `rem` 64)+ loop :: CompleteFn -> Hist -> String -> String -> IO ([String], Maybe String) loop comp hist before after = do hFlush stdout@@ -79,8 +115,6 @@ loop' comp hist before after cmd = do let cur = reverse before ++ after- back n = putStr (replicate n '\b')- bsSpBs n = concat $ replicate n "\b \b" ins c = do putChar c@@ -156,10 +190,9 @@ Hist p [l] (Just orig) -> setLine (Hist (l:p) [] Nothing) orig Hist p (c:l:n) orig -> setLine (Hist (c:p) (l:n) orig) l previous =- case hist of- Hist [] _ _ -> noop- Hist (l:p) [] Nothing -> setLine (Hist p [l] (Just cur)) l- Hist (l:p) n orig -> setLine (Hist p (l:n) orig) l+ case histPrev cur hist of+ Nothing -> noop+ Just (h, l) -> setLine h l setLine h s = do eraseLine putStr s@@ -190,14 +223,11 @@ back (n + length after) -- put cursor back tabLoop (ss ++ [s]) -- try next alternative - utf8 i | i `quot` 32 == 6 = utf8' 1 (i `rem` 32)- | i `quot` 16 == 14 = utf8' 2 (i `rem` 16)- | i `quot` 8 == 30 = utf8' 3 (i `rem` 8)- | otherwise = noop- utf8' 0 c = add (chr c)- utf8' n c = do- d <- getRaw- utf8' (n - 1 :: Int) (c * 64 + ord d `rem` 64)+ search = do+ eraseLine+ let s = Search "" False hist cur (length before)+ drawSearch s+ isearch comp (hist, before, after) [s] exec i = case i of@@ -219,6 +249,7 @@ '\^U' -> erase -- CTL-U, erase line '\^K' -> kill -- CTL-K, kill to eol '\t' -> complete -- TAB, complete word+ '\^R' -> search -- CTL-R, reverse incremental search '\ESC' -> do -- ESC b <- getRaw if b /= '[' then@@ -240,7 +271,73 @@ ('4','~') -> eol _ -> noop _ -> noop- _ | ord i >= 128 -> utf8 (ord i)+ _ | ord i >= 128 -> utf8 (ord i) >>= maybe noop add _ -> if i >= ' ' && i < '\DEL' then add i else noop exec cmd++-- The state of an incremental search:+-- the pattern, if the search failed, the history, the found line, and the position of the match.+data Search = Search String Bool Hist String Int++-- The text shown for a search, and the cursor position within it.+showSearch :: Search -> (String, Int)+showSearch (Search pat failed _ line pos) = (s, length s - length line + pos)+ where s = (if failed then "(failed " else "(") ++ "reverse-i-search)`" ++ pat ++ "': " ++ line++drawSearch :: Search -> IO ()+drawSearch s = do+ let (str, k) = showSearch s+ putStr str+ back (length str - k)++eraseSearch :: Search -> IO ()+eraseSearch s = do+ let (str, k) = showSearch s+ putStr (drop k str)+ putStr $ bsSpBs $ length str++-- Incremental reverse search in the history.+-- The second argument is the state before the search started, used if the search is aborted.+-- The third argument is a stack of search states, the head is the current one.+-- Backspace pops the stack, i.e., undoes the last step.+isearch :: CompleteFn -> (Hist, String, String) -> [Search] -> IO ([String], Maybe String)+isearch comp o@(ohist, obefore, oafter) ss@(s@(Search pat failed hist line pos) : ps) = do+ let+ noop = isearch comp o ss+ redraw s' ss' = do+ eraseSearch s+ drawSearch s'+ isearch comp o ss'+ push s' = redraw s' (s' : ss)+ found p (Just (h, l, i)) = Search p False h l i+ found p Nothing = Search p True hist line pos+ add c+ | failed = push (Search pat' True hist line pos)+ | otherwise = push (found pat' (histSearch Nothing pat' line hist))+ where pat' = pat ++ [c]+ again = push (found pat (histSearch (Just line) pat line hist))+ pop =+ case ps of+ [] -> noop+ s' : _ -> redraw s' ps+ abort = do+ eraseSearch s+ putStr (reverse obefore ++ oafter)+ back (length oafter)+ loop comp ohist obefore oafter+ accept c = do+ eraseSearch s+ putStr line+ back (length line - pos)+ loop' comp hist (reverse (take pos line)) (drop pos line) c+ hFlush stdout+ i <- getRaw+ case i of+ '\^R' -> again -- CTL-R, search for next match+ '\^G' -> abort -- CTL-G, abort search+ '\b' -> pop -- BS, undo last step+ '\DEL' -> pop -- DEL, undo last step+ _ | ord i >= 128 -> utf8 (ord i) >>= maybe noop add+ | i >= ' ' && i < '\DEL' -> add i+ | otherwise -> accept i -- other keys end the search and are then executed
@@ -5,7 +5,7 @@ import qualified Prelude(); import MHSPrelude import MicroHs.Ident import MicroHs.Exp-import MicroHs.Expr(Lit(..))+import MicroHs.Expr(Lit(..), PrimOp(..)) -- -- Used combinators@@ -40,61 +40,80 @@ App f a -> IsApp f a _ -> NotApp -isPrim :: String -> Exp -> Bool-isPrim s ae =- case ae of- Lit (LPrim ss) -> s == ss- _ -> False- isK :: Exp -> Bool-isK = isPrim "K"+isK ae =+ case ae of+ Lit (LPrim PK) -> True+ _ -> False isI :: Exp -> Bool-isI = isPrim "I"+isI ae =+ case ae of+ Lit (LPrim PI) -> True+ _ -> False isB :: Exp -> Bool-isB = isPrim "B"+isB ae =+ case ae of+ Lit (LPrim PB) -> True+ _ -> False isC :: Exp -> Bool-isC = isPrim "C"+isC ae =+ case ae of+ Lit (LPrim PC) -> True+ _ -> False isC' :: Exp -> Bool-isC' = isPrim "C'"+isC' ae =+ case ae of+ Lit (LPrim PC') -> True+ _ -> False isY :: Exp -> Bool-isY = isPrim "Y"+isY ae =+ case ae of+ Lit (LPrim PY) -> True+ _ -> False isP :: Exp -> Bool-isP = isPrim "P"+isP ae =+ case ae of+ Lit (LPrim PP) -> True+ _ -> False isZ :: Exp -> Bool-isZ = isPrim "Z"--{--isU :: Exp -> Bool-isU = isPrim "U"--}+isZ ae =+ case ae of+ Lit (LPrim PZ) -> True+ _ -> False isK2 :: Exp -> Bool-isK2 = isPrim "K2"+isK2 ae =+ case ae of+ Lit (LPrim PK2) -> True+ _ -> False isK3 :: Exp -> Bool-isK3 = isPrim "K3"+isK3 ae =+ case ae of+ Lit (LPrim PK3) -> True+ _ -> False cI :: Exp-cI = Lit (LPrim "I")+cI = Lit (LPrim PI) cK :: Exp-cK = Lit (LPrim "K")+cK = Lit (LPrim PK) cS :: Exp-cS = Lit (LPrim "S")+cS = Lit (LPrim PS) cP :: Exp-cP = Lit (LPrim "P")+cP = Lit (LPrim PP) cC :: Exp-cC = Lit (LPrim "C")+cC = Lit (LPrim PC) -------------------- @@ -219,7 +238,7 @@ NotApp -> r IsApp cb ck -> if isB cb && isK ck && isP a2 then- Lit (LPrim "O")+ Lit (LPrim PO) else r @@ -248,7 +267,7 @@ if isI a1 then a2 else- app2 (Lit (LPrim "B")) a1 a2+ app2 (Lit (LPrim PB)) a1 a2 {- aB (App CB CK) CP = CO -- Cons@@ -259,11 +278,27 @@ -} aS' :: Exp -> Exp -> Exp -> Exp-aS' e1 e2 e3 = app3 (Lit (LPrim "S'")) e1 e2 e3+aS' e1 e2 e3 = app3 (Lit (LPrim PS')) e1 e2 e3 aC' :: Exp -> Exp -> Exp -> Exp-aC' e1 e2 e3 = app3 (Lit (LPrim "C'")) e1 e2 e3+aC' e1 e2 e3 = app3 (Lit (LPrim PC')) e1 e2 e3 +-- Note: Z, B', and C'B lose some full laziness.+-- A shared partial application B K x y reduces in place to K (x y),+-- so all its uses share x y. But Z x y cannot reduce until it gets a+-- third argument, and then it builds x y afresh every time. The same goes+-- for B' (B B x y = B (x y)) and C'B (C' B x y z = B (x z) y).+-- It matters when the partial application is used many times and x y does+-- real work, see MicroHs.Ident.isIdent.+-- Dropping the rewrites is no fix: without all three a self-compile takes+-- 1.9% more instructions, because the extra sharing keeps 25% more cells+-- live (2026-11-19).+-- A better fix would be to float out the expressions that can do work,+-- e.g., saturated applications, before bracket abstraction, as a let just+-- outside the innermost lambda that binds one of their free variables.+-- The shared value is then an argument node, and these combinators only+-- rebuild cheap partial applications. For this to work, eLet in+-- MicroHs.Desugar must not substitute such a let back under the lambda. improveT :: Exp -> Exp improveT ae = case getApp ae of@@ -274,32 +309,27 @@ aa = improveT a in if isK ff && isI aa then- Lit (LPrim "A")+ Lit (LPrim PA) {- Using I x --> x does not improve things. else if isI ff then aa -} else if isB ff && isK aa then- Lit (LPrim "Z")+ Lit (LPrim PZ) else if isC ff && isI aa then- Lit (LPrim "U")+ Lit (LPrim PU) else if isB ff && isB aa then- Lit (LPrim "B'")+ Lit (LPrim PB') else if isC ff && isC aa then- Lit (LPrim "R")+ Lit (LPrim PR) else if isC' ff && isB aa then- Lit (LPrim "C'B")+ Lit (LPrim PC'B) else if isZ ff && isK aa then- Lit (LPrim "K2")-{---- Using J is a very minor improvement- else if False && isZ ff && isU aa then- Lit (LPrim "J")--}+ Lit (LPrim PK2) else if isZ ff && isK2 aa then- Lit (LPrim "K3")+ Lit (LPrim PK3) else if isZ ff && isK3 aa then- Lit (LPrim "K4")+ Lit (LPrim PK4) else let def =@@ -324,10 +354,12 @@ kApp :: Exp -> Exp -> Exp-kApp (Lit (LPrim "K")) (App (Lit (LPrim ('K':s))) x)- | s == "" = App (Lit (LPrim "K2")) x- | s == "2" = App (Lit (LPrim "K3")) x- | s == "3" = App (Lit (LPrim "K4")) x+kApp f@(Lit (LPrim PK)) a@(App (Lit (LPrim k)) x) =+ case k of+ PK -> App (Lit (LPrim PK2)) x+ PK2 -> App (Lit (LPrim PK3)) x+ PK3 -> App (Lit (LPrim PK4)) x+ _ -> App f a kApp f a = App f a {-@@ -391,24 +423,26 @@ reduce :: Exp -> Exp reduce e = red e [] where+ isPrim p (Lit (LPrim p')) = p == p'+ isPrim _ _ = False -- No duplication, nor cycles, so no S, S', Y red (App f a) as = red f (reduce a : as) red f (x:as) | isI f && xxx "I" = red x as- red f (x:y:as) | isPrim "A" f && xxx "A" = red y as- | isPrim "U" f && xxx "U" = red y (x : as)+ red f (x:y:as) | isPrim PA f && xxx "A" = red y as+ | isPrim PU f && xxx "U" = red y (x : as) | isK f && xxx "K" = red x as red f (x:y:z:as) | isB f && xxx "B" = red x (App y z : as) | isC f && xxx "C" = red x (z : y : as)- | isPrim "Z" f && xxx "Z" = red x (y : as)+ | isPrim PZ f && xxx "Z" = red x (y : as) | isP f && xxx "P" = red z (x : y : as)- | isPrim "R" f && xxx "R" = red y (z : x : as)- | isPrim "K2" f && xxx "K2" = red x as- red f (x:y:z:w:as) | isPrim "B'" f && xxx "B'" = red x (y : App z w : as)- | isPrim "C'" f && xxx "C'" = red x (App y w : z : as)- | isPrim "O" f && xxx "O" = red w (x : y : as)- | isPrim "K3" f && xxx "K3" = red x as- | isPrim "C'B" f && xxx "C'B" = red x (z : App y w : as)- red f (x:_:_:_:_:as) | isPrim "K4" f && xxx "K4" = red x as+ | isPrim PR f && xxx "R" = red y (z : x : as)+ | isPrim PK2 f && xxx "K2" = red x as+ red f (x:y:z:w:as) | isPrim PB' f && xxx "B'" = red x (y : App z w : as)+ | isPrim PC' f && xxx "C'" = red x (App y w : z : as)+ | isPrim PO f && xxx "O" = red w (x : y : as)+ | isPrim PK3 f && xxx "K3" = red x as+ | isPrim PC'B f && xxx "C'B" = red x (z : App y w : as)+ red f (x:_:_:_:_:as) | isPrim PK4 f && xxx "K4" = red x as red f as = foldl App f as
@@ -14,18 +14,15 @@ packageDir, packageSuffix, packageTxtSuffix, mhsVersion, getPaths,- openFilePath, loadPkg, addPreludeImport, loadEmbedded, ) where import qualified Prelude(); import MHSPrelude-import Control.Exception import qualified Data.ByteString as BS import Data.Char import Data.List import Data.Maybe-import Data.Version import System.Directory import System.Environment import System.FilePath@@ -33,12 +30,14 @@ import System.IO.MD5 import System.IO.Serialize import System.IO.TimeMilli+import System.Info(os, arch) import System.Process import MicroHs.Abstract import MicroHs.Builtin import MicroHs.CompileCache import MicroHs.Desugar import qualified MicroHs.Embed as Embed+import MicroHs.Error(mhsError, mhsErrorLoc) import MicroHs.Exp import MicroHs.Expr import MicroHs.Flags@@ -52,15 +51,12 @@ import MicroHs.TCMonad(TCState) import MicroHs.TypeCheck import MicroHs.Version-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import Mhs.Text.PrettyPrint.HughesPJLiteClass(prettyShow) mhsVersion :: String mhsVersion = showVersion version -mhsCacheName :: FilePath-mhsCacheName = ".mhscache"--type Time = Int+type Time = Word type CM a = StateIO Cache a @@ -89,21 +85,25 @@ getCached :: Flags -> IO Cache getCached flags | not (readCache flags) = return emptyCache getCached flags = do- mcash <- loadCached mhsCacheName+ mcash <- loadCached mhsVersion (cacheName flags) case mcash of- Nothing ->+ NoCacheFile -> return emptyCache- Just cash -> do+ OtherCompiler -> do+ when (verbosityGT flags 0) $+ putStrLn $ "Ignoring saved cache " ++ show (cacheName flags) ++ ", it was written by another compiler"+ return emptyCache+ LoadedCache cash -> do when (loading flags || verbosityGT flags 0) $- putStrLn $ "Loading saved cache " ++ show mhsCacheName+ putStrLn $ "Loading saved cache " ++ show (cacheName flags) validateCache flags cash maybeSaveCache :: Flags -> Cache -> IO () maybeSaveCache flags cash = when (writeCache flags) $ do when (verbosityGT flags 0) $- putStrLn $ "Saving cache " ++ show mhsCacheName- saveCache mhsCacheName cash+ putStrLn $ "Saving cache " ++ show (cacheName flags)+ saveCache mhsVersion (cacheName flags) cash -- Load the real modules for imported boot modules. -- Doing so can result in more boot imports, so we recurse.@@ -172,7 +172,6 @@ putStrLn "" dumpIf flags Dpreproc $ liftIO $ putStrLn $ "preprocessed:\n" ++ file- modify $ addWorking mn compileModule flags ImpNormal mn pathfn file Just tm -> do when (verbosityGT flags 1) $@@ -202,7 +201,6 @@ Just (pathfn, file) -> do dumpIf flags Dpreproc $ liftIO $ putStrLn $ "preprocessed:\n" ++ file- modify $ addBoot mn compileModule flags ImpBoot mn pathfn file compileModule :: Flags -> ImpType -> IdentModule -> FilePath -> String -> CM (TModule [LDef], Symbols, Time)@@ -214,11 +212,15 @@ when (verbosityGT flags 4) $ liftIO $ putStrLn $ "parsing: " ++ pathfn let pmdl@(EModule mnn _ _) = parseDie pTop pathfn file+ -- Remember the module under the name from the parsed file.+ modify $ case impt of+ ImpNormal -> addWorking mnn+ ImpBoot -> addBoot mnn t2 <- liftIO (seq pmdl getTimeMilli) dumpIf flags Dparse $ liftIO $ putStrLn $ "parsed:\n" ++ prettyShow pmdl when (isNothing (getFileName mn) && mn /= mnn) $- mhsError $ "module name does not agree with file name: " ++ showIdent mn ++ " " ++ showIdent mnn+ mhsErrorLoc (getSLoc mnn) $ "module name does not agree with file name: " ++ showIdent mn ++ " " ++ showIdent mnn ((dmdl, syms, imported, tTCDesug, tImp), _) <- compileModuleP flags impt (addPreludeImport pmdl) t4 <- liftIO getTimeMilli@@ -240,6 +242,11 @@ case impt of ImpNormal -> modify $ workToDone (cmdl, map snd imported, chksum) ImpBoot -> return ()+ -- It is possible to do a GC with reductions (System.Mem.performGCWithReduction)+ -- here, after the first module has been compiled. By then many CAFs and partial+ -- applications in the compiler have been evaluated, and the GC simplifies them.+ -- In a self-compile it saves about 0.5% of the instructions, which is too little+ -- to bother. return (cmdl, syms, tThis + tImp) compileModuleP :: Flags -> ImpType -> EModule -> CM ((TModule [LDef], Symbols, [(ImpType, IdentModule)], Time, Time), TCState)@@ -400,13 +407,14 @@ scanFor s (_:cs) = scanFor s cs scanFor' _ [] = False scanFor' s ('#':'-':'}':cs) = scanFor s cs- scanFor' s (' ':cs) | s `isPrefixOf` cs = True+ scanFor' s (c:cs) | (c == ' ' || c == ',') && s `isPrefixOf` cs = True scanFor' s (_:cs) = scanFor' s cs scanFor "cpp" . map toLower <$> readFile fn moduleToFile :: IdentModule -> FilePath moduleToFile mn = map (\ c -> if c == '.' then pathSeparator else c) (unIdent mn) +-- Find a source module in the source search path. findModulePath :: Flags -> String -> IdentModule -> IO (Maybe (FilePath, Handle)) findModulePath flags suf mn = do let@@ -414,15 +422,21 @@ openFilePath (srcPaths flags) fn openFilePath :: [FilePath] -> FilePath -> IO (Maybe (FilePath, Handle))-openFilePath adirs fileName =+openFilePath = openFilePath' openFileM++openBinaryFilePath :: [FilePath] -> FilePath -> IO (Maybe (FilePath, Handle))+openBinaryFilePath = openFilePath' openBinaryFileM++openFilePath' :: (FilePath -> IOMode -> IO (Maybe Handle)) -> [FilePath] -> FilePath -> IO (Maybe (FilePath, Handle))+openFilePath' openM adirs fileName = case adirs of [] -> return Nothing dir:dirs -> do let path = dir </> fileName- mh <- openFileM path ReadMode+ mh <- openM path ReadMode case mh of- Nothing -> openFilePath dirs fileName -- If opening failed, try the next directory+ Nothing -> openFilePath' openM dirs fileName -- If opening failed, try the next directory Just hdl -> return (Just (path, hdl)) runCPPString :: Flags -> FilePath -> String -> IO String@@ -431,8 +445,9 @@ hClose hi writeFile fni $ "#line 1 \"" ++ fn ++ "\"\n" ++ ifile (fno, ho) <- openTmpFile "mhsout.hs"+ hClose ho runCPP flags fni fno- ofile <- hGetContents ho+ ofile <- hGetContents =<< openFile fno ReadMode removeFile fni removeFile fno return ofile@@ -445,11 +460,12 @@ hClose hi writeFile fni ifile (fno, ho) <- openTmpFile "mhspreout.hs"- let cmd = unwords $ pgm : fn : fni : fno : args+ hClose ho+ let cmd = unwords $ map quote $ pgm : fn : fni : fno : args when (verbosityGT flags 1) $ putStrLn $ "Run preprocessor: " ++ show cmd callCommand cmd- ofile <- hGetContents ho+ ofile <- hGetContents =<< openFile fno ReadMode removeFile fni removeFile fno return ofile@@ -457,7 +473,14 @@ mhsDefines :: [String] mhsDefines = [ "-D__MHS__" -- We are MHS+ -- The same symbols as GHC, e.g., darwin_HOST_OS and aarch64_HOST_ARCH.+ -- The compiled program runs where the compiler does, so BUILD is HOST.+ , "-D" ++ sym os ++ "_HOST_OS"+ , "-D" ++ sym arch ++ "_HOST_ARCH"+ , "-D" ++ sym os ++ "_BUILD_OS"+ , "-D" ++ sym arch ++ "_BUILD_ARCH" ]+ where sym = map (\ c -> if isAlphaNum c then c else '_') runCPP :: Flags -> FilePath -> FilePath -> IO () runCPP flags infile outfile = do@@ -465,29 +488,33 @@ let datadir = mhsdir flags cpphs = fromMaybe "cpphs" mcpphs mhsIncludes = ["-I" ++ datadir </> "src/runtime"]- args = mhsDefines ++ mhsIncludes ++ map quote (cppArgs flags)- cmd = cpphs ++ " --strip " ++ unwords args ++ " " ++ infile ++ " -O" ++ outfile+ args = mhsDefines ++ cppArgs flags ++ mhsIncludes+ cmd = unwords $ map quote $ [cpphs, "--strip"] ++ args ++ [infile, "-O" ++ outfile] when (verbosityGT flags 1) $ putStrLn $ "Run cpphs: " ++ show cmd callCommand cmd +-- Quote one shell word, closing and reopening quotes around single quotes. quote :: String -> String-quote s = "'" ++ s ++ "'"+quote s = "'" ++ concatMap escape s ++ "'"+ where escape '\'' = "'\\''"+ escape c = [c] runHsc2hs :: Flags -> FilePath -> IO String runHsc2hs flags fni = do (fno, ho) <- openTmpFile "mhshsc2hs.hs"+ hClose ho mhsc2hs <- lookupEnv "MHSHSC2HS" let datadir = mhsdir flags hsc2hs = fromMaybe "hsc2hs" mhsc2hs mhsIncludes = ["-I" ++ datadir </> "src/runtime" ,"-I" ++ datadir </> "src/runtime/unix"]- args = mhsDefines ++ mhsIncludes ++ map quote (cppArgs flags)- cmd = unwords $ [hsc2hs, "-o", fno] ++ args ++ [fni]+ args = mhsDefines ++ mhsIncludes ++ cppArgs flags+ cmd = unwords $ map quote $ [hsc2hs, "-o", fno] ++ args ++ [fni] when (verbosityGT flags 1) $ putStrLn $ "Run hsc2hs: " ++ show cmd callCommand cmd- ofile <- hGetContents ho+ ofile <- hGetContents =<< openFile fno ReadMode removeFile fno return ofile @@ -503,7 +530,7 @@ findPkgModule flags mn = do t0 <- liftIO getTimeMilli let fn = moduleToFile mn <.> packageTxtSuffix- mres <- liftIO $ openFilePath (pkgPaths flags) fn+ mres <- liftIO $ openBinaryFilePath (pkgPaths flags) fn case mres of Just (pfn, hdl) -> do -- liftIO $ putStrLn $ "findPkgModule " ++ pfn@@ -558,9 +585,10 @@ mapM_ (loadDeps flags) deps' loadDependencies flags -- loadDeps can add new dependencies +-- Find a package in the package searcg path. loadDeps :: Flags -> (IdentPackage, Version) -> CM () loadDeps flags (pid, pver) = do- mres <- liftIO $ openFilePath (pkgPaths flags) (packageDir </> unIdent pid ++ "-" ++ showVersion pver <.> packageSuffix)+ mres <- liftIO $ openBinaryFilePath (pkgPaths flags) (packageDir </> unIdent pid ++ "-" ++ showVersion pver <.> packageSuffix) case mres of Nothing -> mhsError $ "Cannot find package " ++ showIdent pid Just (pfn, hdl) -> do@@ -574,7 +602,7 @@ un :: Int -> Bool -> [String] -> [String] un _ _ [] = [] un n _ (l:ls) | all isSpace l = un (n+1) True ls- un n _ ("\\begin{code}":ls) = "" : code (n+1) ls+ | Just r <- stripPrefix "\\begin{code}" l, all isSpace r = "" : code (n+1) ls un n spc (l@('#':_) : ls) = l : un (n+1) spc ls un n spc (('>':l):ls) | spc = (' ':l) : un (n+1) True ls | otherwise = err n "missing blank before >"@@ -585,17 +613,22 @@ code n (l : ls) = l : code (n+1) ls code n [] = err n "unlit: missing \\end{code}" err :: Int -> String -> a- err n s = error $ "unlit: " ++ fn ++ ":" ++ show n ++ ": " ++ s+ err n s = mhsErrorLoc (SLoc fn n 1) $ "unlit: " ++ s --------------- +-- The source directories of the library: lib, and lib/libmhs, with the+-- modules that the compiler uses too.+libDirs :: FilePath -> [FilePath]+libDirs lib = [lib, lib </> "libmhs"]+ getPaths :: IO (FilePath, [FilePath], Maybe FilePath) getPaths = do mdir <- lookupEnv "MHSDIR" let srcs = ["."] case mdir of -- If MHSDIR is set, use that and no package directories- Just dir -> return (dir, srcs ++ [dir </> "lib"], Nothing)+ Just dir -> return (dir, srcs ++ libDirs (dir </> "lib"), Nothing) Nothing -> do -- There are two scenarios: either we are running inplace or installed binDir <- takeDirectory <$> catch getExecutablePath (\ (_ :: SomeException) -> getProgName) -- ~/.mcabal/bin@@ -603,11 +636,10 @@ inplace <- doesFileExist (upDir </> "src/runtime/eval.c") if inplace then do let libDir = upDir </> "lib"- gmpDir | wantGMP = [libDir </> "gmp"]- | otherwise = []- return (upDir, srcs ++ gmpDir ++ [libDir], Nothing)+ nogmpDir | not (wantGMP || wantImath) = [libDir </> "no-gmp"]+ | otherwise = []+ return (upDir, srcs ++ nogmpDir ++ libDirs libDir, Nothing) else do- let vers = "mhs-" ++ mhsVersion- pkgDir = upDir </> vers -- ~/.mcabal/bin/../mhs-VERSION- mhsDir = pkgDir </> "packages" </> vers </> "data"+ let pkgDir = upDir </> "mhs-" ++ mhsVersion -- ~/.mcabal/bin/../mhs-VERSION+ mhsDir = pkgDir </> "packages" </> "MicroHs-" ++ mhsVersion </> "data" -- ~/.mcabal/bin/../mhs-VERSION/packages/MicroHs-VERSION/data return (mhsDir, srcs, Just pkgDir)
@@ -5,15 +5,17 @@ lookupCache, lookupCacheChksum, getImportDeps, addPackage, getCompMdls, getPathPkgs, getPkgs, getEmbedPkgs, getCacheTables, setCacheTables,- saveCache, loadCached,+ saveCache, loadCached, LoadedCache(..), ) where import qualified Prelude(); import MHSPrelude+import qualified Data.ByteString.Char8 as BS import MicroHs.Desugar(LDef)-import MicroHs.Expr(IdentModule)+import MicroHs.Error(mhsErrorLoc)+import MicroHs.Expr(IdentModule, getSLoc) import MicroHs.Ident(showIdent) import qualified MicroHs.IdentMap as M import MicroHs.Package-import MicroHs.TypeCheck(TModule, tModuleName, GlobTables, emptyGlobTables, mergeGlobTables)+import MicroHs.TypeCheck(TModule(..), GlobTables, emptyGlobTables, mergeGlobTables, deleteModuleGlobTables, isInstId) import System.IO import System.IO.Serialize import System.IO.MD5(MD5CheckSum)@@ -45,13 +47,14 @@ working :: [IdentModule], -- modules currently being processed (used to detected circular imports) boots :: [IdentModule], -- modules where only the boot version has been compiled cache :: M.Map CacheEntry, -- cached compiled modules+ others :: [TModule [LDef]], -- invisible package modules pkgs :: [(Maybe FilePath, Package)], -- loaded packages, no filename for embedded tables :: GlobTables -- glbals, e.g., instances } -- deriving (Show) instance NFData Cache where- rnf (Cache a b c d e) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d `seq` rnf e+ rnf (Cache a b c d e f) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d `seq` rnf e `seq` rnf f forceCache :: Cache -> Cache forceCache c = force c@@ -64,10 +67,17 @@ emptyCache :: Cache emptyCache =- Cache { working = [], boots = [], cache = M.empty, pkgs = [], tables = emptyGlobTables }+ Cache { working = [], boots = [], cache = M.empty, others = [], pkgs = [], tables = emptyGlobTables } +-- Remove a module from the cache, and what it added to the global tables,+-- so that, e.g., its instances are not used by the modules compiled after it. deleteFromCache :: IdentModule -> Cache -> Cache-deleteFromCache mn c = c{ cache = M.delete mn (cache c) }+deleteFromCache mn c =+ case M.lookup mn (cache c) of+ Nothing -> c+ Just e ->+ let insts = [ i | (i, _) <- tBindingsOf (tModuleOf e), isInstId i ]+ in c{ cache = M.delete mn (cache c), tables = deleteModuleGlobTables mn insts (tables c) } addBoot :: IdentModule -> Cache -> Cache addBoot mn c = c{ boots = mn : boots c }@@ -82,17 +92,20 @@ addWorking mn c = let ws = working c in if mn `elem` ws then- mhsError $ "recursive module: " ++ showIdent mn ++ ", import chain: " ++ unwords (map showIdent ws)+ mhsErrorLoc (getSLoc mn) $ "recursive module: " ++ showIdent mn ++ ", import chain: " ++ unwords (map showIdent ws) else c{ working = mn : ws } workToDone :: CModule -> Cache -> Cache-workToDone (t, i, k) c@(Cache{ working = mn:ws, boots = bs, cache = m }) =+workToDone (t, i, k) c@(Cache{ working = _mn:ws, boots = bs, cache = m }) = c{ working = ws, boots = filter (/= mn) bs, cache = M.insert mn (CompMdl t i k) m }+ -- The identifier in _mn is from the place of use (=import), but we want the cache+ -- to contain the identifier from the place of definition.+ where mn = tModuleName t workToDone _ _ = undefined cachedModules :: Cache -> [TModule [LDef]]-cachedModules = map tModuleOf . M.elems . cache+cachedModules c = others c ++ (map tModuleOf . M.elems . cache) c cachedModuleNames :: Cache -> [IdentModule] cachedModuleNames = M.keys . cache@@ -124,20 +137,47 @@ addPackage :: Maybe FilePath -> Package -> Cache -> Cache addPackage mf p c = c{ pkgs = (mf, p) : pkgs c,- cache = foldr ins (cache c) (pkgExported p ++ pkgOther p),+ cache = foldr ins (cache c) (pkgExported p),+ others = pkgOther p ++ others c, tables = mergeGlobTables (pkgTables p) (tables c) } where ins t = M.insert (tModuleName t) (PkgMdl t) -saveCache :: FilePath -> Cache -> IO ()-saveCache fn cash = writeSerializedCompressed fn (forceCache cash)+-- The cache file starts with a line that says which compiler wrote it,+-- followed by the serialized cache. Deserializing does no type checking,+-- so a cache written by another compiler, where the types can differ,+-- must not be read.+-- Change cacheFormat when the layout of the cache changes.+cacheFormat :: Int+cacheFormat = 1 -loadCached :: FilePath -> IO (Maybe Cache)-loadCached fn = do- mhin <- openFileM fn ReadMode+-- The first line of the cache file, for a compiler version.+cacheHeader :: String -> BS.ByteString+cacheHeader version = BS.pack $ "MicroHs cache, compiler " ++ version ++ ", format " ++ show cacheFormat ++ "\n"++saveCache :: String -> FilePath -> Cache -> IO ()+saveCache version fn cash = do+ bs <- writeSerializedCompressedBS (forceCache cash)+ h <- openBinaryFile fn WriteMode+ BS.hPut h (cacheHeader version)+ BS.hPut h bs+ hClose h++data LoadedCache+ = NoCacheFile -- there is no cache file+ | OtherCompiler -- the cache was written by another compiler+ | LoadedCache Cache++loadCached :: String -> FilePath -> IO LoadedCache+loadCached version fn = do+ mhin <- openBinaryFileM fn ReadMode case mhin of Nothing ->- return Nothing+ return NoCacheFile Just hin -> do- hClose hin- Just <$> readSerialized fn+ bs <- BS.hGetContents hin+ let hdr = cacheHeader version+ if hdr `BS.isPrefixOf` bs then+ LoadedCache <$> readSerializedBS (BS.drop (BS.length hdr) bs)+ else+ return OtherCompiler
@@ -5,7 +5,7 @@ ) where import qualified Prelude(); import MHSPrelude hiding(lex) import Data.List-import Text.ParserComb+import Mhs.Text.ParserComb import MicroHs.Ident import MicroHs.Lex
@@ -1,4 +1,4 @@-module MicroHs.Deriving(deriveStrat, expandField, mkGetName, etaReduce, mkTypeableInst) where+module MicroHs.Deriving(deriveStrat, expandField, mkGetName, getPrefix, etaReduce, mkTypeableInst) where import qualified Prelude(); import MHSPrelude import Control.Monad import Data.Char@@ -6,6 +6,7 @@ import Data.List import Data.Maybe(fromMaybe) import MicroHs.Builtin+import MicroHs.Error(mhsError) import MicroHs.Expr import MicroHs.Fixity(defaultFixity) import MicroHs.Ident@@ -36,7 +37,7 @@ DerStock -> deriveNoHdr mctx narg lhs cs cls DerNewtype | newt -> newtypeDer mctx narg lhs c acls =<< getVia narg lhs c DerAnyClass -> anyclassDer mctx narg lhs cls- DerVia via | newt -> newtypeDer mctx narg lhs c acls via+ DerVia via -> newtypeDer mctx narg lhs c acls via _ -> cannotDerive lhs cls where useNewt d = unIdent (getAppCon d) `notElem` ["Data.Data_Class.Data", "Data.Typeable.Typeable", "GHC.Generics.Generic", "GHC.Generics.Generic1",@@ -169,7 +170,10 @@ -- Given a (qualified) type name and a field name, -- return the name of the selector function. mkGetName :: Ident -> Ident -> Ident-mkGetName tycon fld = qualIdent (mkIdent "get$") $ qualIdent tycon fld+mkGetName tycon fld = qualIdent (mkIdent getPrefix) $ qualIdent tycon fld++getPrefix :: String+getPrefix = "get$" --------------------------------------------
@@ -25,7 +25,7 @@ import MicroHs.Names import MicroHs.State as S import MicroHs.TypeCheck-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import Mhs.Text.PrettyPrint.HughesPJLiteClass(prettyShow) type LDef = (Ident, Exp) @@ -45,9 +45,14 @@ map fst (either id (map snd) ets) -- strict flags in (qualIdent mn c, encConstr i n ss) in zipWith dsConstr [0::Int ..] cs- Newtype _ (Constr _ _ c _ _) _ -> [ (qualIdent mn c, Lit (LPrim "I")) ]+ Newtype _ (Constr _ _ c _ _) _ -> [ (qualIdent mn c, Lit (LPrim PI)) ] Fcn f eqns -> [(f, wrapTick (useTicks flags) f $ dsEqns (getSLoc f) eqns)]- ForImp cc ie i t -> [(i, ccall t $ Lit $ mkForImp mn ffiNo cc ie i t)]+ ForImp cc _ ie i at ->+ -- An explicit forall (as GHC allows) does not change the C type.+ let dropForalls (EForall _ _ ty) = dropForalls ty+ dropForalls ty = ty+ t = dropForalls at+ in [(i, ccall t $ Lit $ mkForImp mn ffiNo cc ie i t)] -- Foreign exports don't fit very well into the desugared syntax. -- We represent -- foreign export "foo" bar :: ty@@ -55,7 +60,7 @@ -- foo = FE bar' ty' -- where bar' is the desugared expression for bar, and ty' is the C type -- (currently just a newtype of an EType).- ForExp _ (Just s) e t -> [(mkIdentSLoc l s, mkForExp e' (CType t))]+ ForExp cc (Just s) e t -> [(mkIdentSLoc l s, mkForExp (cc == Cjavascript) e' (CType t))] where l = getSLoc e e' = dsExpr e Class ctx (c, _) _ bs ->@@ -80,7 +85,7 @@ -- pure function, need a performIO. -- ^f --> \ x1 ... xn -> performIO (^f x1 ... xn) let xs = map (\ i -> mkIdent $ '_' : show i) [1..length as]- perf = Lit $ LPrim "IO.performIO"+ perf = litPrim "IO.performIO" call = App perf $ apps f (map Var xs) in foldr Lam call xs @@ -123,7 +128,8 @@ let ps' = map dsPat ps in (ps', id, dsAlts alts) ex = dsCaseExp loc (vs ++ xs) (map Var xs) (map mkArm eqns)- in foldr Lam ex xs+ ex' = optCase ex+ in foldr Lam ex' xs _ -> eMatchErr loc dsAlts :: EAlts -> (Exp -> Exp)@@ -165,9 +171,11 @@ node ie@(i, e) = (ie, i, freeVars e) gr = map node $ checkDup ds asccs = stronglyConnComp gr+ dicts = [ i | b@(Fcn i _) <- ads, isDictBind b ] loop _ [] = ret- loop vs (AcyclicSCC (i, e) : sccs) =- letE i e $ loop vs sccs+ loop vs (AcyclicSCC (i, e) : sccs)+ | i `elem` dicts = substExp i e $ loop vs sccs+ | otherwise = letE i e $ loop vs sccs loop vs (CyclicSCC [(i, e)] : sccs) = case lazier (i, e) of (i', e')@@ -178,6 +186,31 @@ mutualRec v ies (loop vs sccs) in loop mvs asccs +-- Is this the binding of a dictionary that is built from other dictionaries,+-- by selecting a superclass or a constraint in a tuple of constraints, or by+-- applying an instance? E.g.,+-- dict$19 = (\ (_, $x) -> $x) adict$3+-- dict$23 = inst$Data.Eq.Eq@(Data.List_Type.[]@a) adict$4+-- The type checker binds a solved constraint where it is solved, often+-- inside a lambda. As a let there, a method selection on it, e.g.,+-- (+) dict$19, would be redone at every call of the lambda. So these+-- bindings are substituted, like variables: then (+) (sel adict$3) is free+-- in the lambda, and the translation to combinators shares it. A dictionary+-- that is used in several places is then built once for each.+-- XXX A better way would be let floating: move each dictionary binding out+-- to where the variables it uses are bound. That shares the dictionary+-- without building it once for every use.+isDictBind :: EBind -> Bool+isDictBind (Fcn i [Eqn [] (EAlts [([], ae)] [])]) = dictPrefixDollar `isPrefixOf` unIdent i && dict ae+ where dict (EVar _) = True+ dict (EApp f e) = dfun f && dict e+ dict _ = False+ dfun (EVar s) = "$super" `isInfixOf` unIdent s || "inst$" `isPrefixOf` unIdent s+ dfun (EApp f e) = dfun f && dict e+ dfun (ELam _ [Eqn [ETuple _] (EAlts [([], EVar _)] [])]) = True+ dfun _ = False+isDictBind _ = False+ letE :: Ident -> Exp -> Exp -> Exp letE i e b = eLet i e b -- do some minor optimizations --App (Lam i b) e@@ -185,7 +218,7 @@ -- Do a single recursive definition 'let i = e in b' -- by 'let i = Y (\i.e) in b' letRecE :: Ident -> Exp -> Exp -> Exp-letRecE i e b = letE i (App (Lit (LPrim "Y")) (Lam i e)) b+letRecE i e b = letE i (App (Lit (LPrim PY)) (Lam i e)) b -- Do mutual recursion by tupling up all the definitions. -- let f = ... g ...@@ -201,6 +234,9 @@ -- g = sel_1_2 v -- in body mutualRec :: Ident -> [LDef] -> Exp -> Exp+mutualRec _ ies _ | length ies > maxFields =+ errorMessage (getSLoc (fst (head ies))) $+ "too many mutually recursive local definitions, " ++ show (length ies) ++ ", the maximum is " ++ show maxFields mutualRec v ies body = let (is, es) = unzip ies n = length is@@ -380,7 +416,7 @@ in (ps', sub, \ d -> dsBinds (reverse rbs) $ foldr eSeq (rhs d) (reverse ris)) eSeq :: Exp -> Exp -> Exp-eSeq e1 e2 = App (App (Lit (LPrim "seq")) e1) e2+eSeq e1 e2 = App (App (litPrim "seq") e1) e2 -- XXX quadratic. but only used for short lists groupEq :: forall a . (a -> a -> Bool) -> [a] -> [[a]]@@ -510,7 +546,8 @@ case filter (== i) (freeVars b) of [] -> b -- no occurences, no need to bind -- The single use substitution is essential for performance.- [_] -> substExp i e b -- single occurrence, substitute XXX could be worse if under lambda+ [_] -> substExp i e b -- single occurrence, substitute XXX could be worse if under lambda,+ -- see the note on Z in MicroHs.Abstract _ -> App (Lam i b) e -- just use a beta redex -- Change from x to y inside e.@@ -576,7 +613,7 @@ minn a 0 = a minn a b = min a b minMatch :: [Ident] -> Exp -> Int- minMatch _ (Lam i _) | i `elem` as = 0 -- name capture, so ignore matches+ minMatch _ (Lam i _) | i == fcn || i `elem` as = 0 -- name capture, so ignore matches minMatch _ (Lam _ e) = minMatch [] e minMatch vs (App f (Var v)) = minMatch (v:vs) f minMatch _ (App f a) = minMatch [] f `minn` minMatch [] a@@ -590,7 +627,9 @@ app vs e = apps e (map Var vs) -- Replace n recursive args with call to vfcn' repl :: [Ident] -> Exp -> Exp- repl vs (Lam i e) = app vs $ Lam i $ repl [] e+ repl vs (Lam i e)+ | i == fcn || i `elem` drops = app vs $ Lam i e+ | otherwise = app vs $ Lam i $ repl [] e repl vs (App f (Var v)) = repl (v:vs) f repl vs (App f a) = app vs $ App (repl [] f) (repl [] a) repl [] (Var v) = Var v@@ -640,10 +679,55 @@ isValidC (c:cs) = isAlpha c && all (\ d -> isAlphaNum d || d == '_') cs isValidC _ = False impent = parseImpEnt loc cc ui $ fromMaybe "" ms- fno = show no+ -- The number is only unique within a module, so qualify it with the module name.+ -- It comes first, so the name cannot be a C identifier, which isValidC names are.+ fno = show no ++ "_" ++ map (\ c -> if isAlphaNum c then c else '_') (unIdent mn) cid = case impent of ImpStatic _ _ n -> if isValidC n then n else fno _ -> fno in LForImp mn impent cid cty++-- Pattern matching against a number of Int/Char constants, e.g.+-- case e of 1->2; 2->3; 3->4; _->5+-- make each match turn into view pattern ((1 ==) -> True) -> 2; ((2 ==) -> True) -> 3 etc.+-- This is quite slow when there are many case arms.+-- Recognize this case and turn it into a binary search instead.+-- Sadly, it only works for Char/Int/Word in this simple version.+optCase :: Exp -> Exp+optCase ae = opt [] ae+ where opt arms e | Just (eq, texp, fexp) <- getEncIf e+ , Just (var, lit) <- getEqExp eq = opt ((var, (lit, texp)) : arms) fexp+ opt arms@((var, _):_) dflt | length arms >= binLimit && all ((var ==) . fst) arms+ , let kes = sortBy (compare `on` fst) (map snd arms)+ , length kes == length (groupBy ((==) `on` fst) kes) -- no duplicated labels+ = tree var kes dflt+ opt _ _ = ae++ getEqExp (App (App (App (Var sel) (Var dict)) (Lit (LInt lit))) var@(Var _))+ | unIdent sel == "Data.Eq.=="+ && (unIdent dict == "inst$Data.Eq.Eq@Primitives.Char" ||+ unIdent dict == "inst$Data.Eq.Eq@Primitives.Int" ||+ unIdent dict == "inst$Data.Eq.Eq@Primitives.Word")+ = Just (var, lit)+ getEqExp _ = Nothing++ tree var kes dflt | l < binLimit = linear var kes dflt+ | otherwise =+ case splitAt (l `quot` 2) kes of+ (lo, hi@((k,_):_)) -> encIf (gtInt k var) (tree var lo dflt) (tree var hi dflt)+ _ -> undefined+ where l = length kes+ linear _ [] dflt = dflt+ linear var ((k, rhs):kes) dflt = encIf (eqInt k var) rhs (linear var kes dflt)++ eqInt :: Int -> Exp -> Exp+ eqInt i x = app2 (litPrim "==") (Lit (LInt i)) x+ gtInt :: Int -> Exp -> Exp+ gtInt i x = app2 (litPrim ">") (Lit (LInt i)) x++-- Switch to binary search with >= binLimit arms+-- Experimentally, this seems to be the sweet spot.+binLimit :: Int+binLimit = 7
@@ -7,220 +7,133 @@ encList, encTuple, encTupleSel,+ getEncIf,+ maxConstructors,+ maxFields, ) where import qualified Prelude(); import MHSPrelude-import Data.List+import Data.Ord(comparing)+import Data.List(sortBy)+import MicroHs.Error(mhsError) import MicroHs.Exp-import MicroHs.Expr(Con(..), Lit(..), impossible)+import MicroHs.Expr(Con(..), Lit(..), PrimOp(..), impossible) import MicroHs.Ident+--import Debug.Trace -- -- Encoding of constructors and case --+-- The scrutinee is the last argument, so that \x -> case x of ... eta reduces.+-- Dense: D_a0_..._a{m-1} f0 ... f{m-1} e (ak is the number of fields of constructor k)+-- Sparse: E_k1_n1_..._km_nm d f1 ... fm e (arm fi is for constructor ki with ni fields,+-- sorted by constructor number)+-- The runtime does not need the arities, but they make it possible to+-- turn the combinator code back into lambda expressions. The constructor+-- numbers of a sparse case are part of the combinator, so they cannot be+-- separated from it by bracket abstraction. -data SPat = SPat Con [Ident] -- simple pattern--- deriving(Show, Eq)+-- The runtime keeps a constructor number, and the number of arms of a case,+-- in 11 bits, and the number of fields in 8 bits (see src/runtime/eval.c).+-- The type checker checks data types against these limits; the checks+-- below catch anything else, e.g., very big tuples.+maxConstructors :: Int+maxConstructors = 2047 -encCase :: Exp -> [(SPat, Exp)] -> Exp -> Exp-encCase var pes dflt | n <= scottLimit = encCaseScott var pes dflt- | otherwise = encCaseNo var pes dflt- where n = numConstr pes+maxFields :: Int+maxFields = 255 -encConstr :: Int -> Int -> [Bool] -> Exp-encConstr i n ss | n <= scottLimit = encConstrScott i n ss- | otherwise = encConstrNo i n ss+checkCons :: Int -> a -> a+checkCons m a | m > maxConstructors = mhsError $ "too many constructors, " ++ show m ++ ", the maximum is " ++ show maxConstructors+ | otherwise = a -encIf :: Exp -> Exp -> Exp -> Exp-encIf = encIfScott+checkFields :: Int -> a -> a+checkFields n a | n > maxFields = mhsError $ "too many fields in a constructor or tuple, " ++ show n ++ ", the maximum is " ++ show maxFields+ | otherwise = a --- Lowest value that works is 3.--- The runtime system knows the encoding of some types:--- Bool, [], Ordering-scottLimit :: Int-scottLimit = 6--- Some timing for different limits--- 3 27.9s--- 5 26.5s--- 10 26.4s--- 20 27.3s--- 100 32.0s+data SPat = SPat Con [Ident] -- simple pattern+-- deriving(Show, Eq) --- Special tuple constructors T3,T4,...Tn-tupleLimit :: Int-tupleLimit = 16+-- The exact point where we switch from dense to sparse case isn't critical.+-- It's roughly the same around the current point.+encCase :: Exp -> [(SPat, Exp)] -> Exp -> Exp+encCase var pes@((SPat (ConData cs _ _) _, _) : _) dflt =+ let m = length cs -- number of constructors+ a = length pes -- number of present arms+ encCaseDense = apps (cCaseD (map snd cs)) (map arm cs ++ [var])+ where arm (c, k) =+ head $ [ lams xs e | (SPat (ConData _ i _) xs, e) <- pes, c == i ] +++ [ lams (replicate k dummyIdent) dflt ] --- Special tag constructors TAG0,TAG1,...Tn-tagLimit :: Int-tagLimit = 32+ in if m > 4 && 3*m > 4*a then -- more than 4 constructors and less than 75% (=3/4) filled+ encCaseSparse var pes dflt+ else+ encCaseDense+encCase _ _ _ = impossible --------------------------------------------+encCaseSparse :: Exp -> [(SPat, Exp)] -> Exp -> Exp+encCaseSparse var pes dflt =+ --trace ("sparse " ++ show (m, a)) encCaseDense+ let pes' = sortBy (comparing fst) [(conNo c, (xs, e)) | (SPat c xs, e) <- pes]+ in apps (cCaseS [ (k, length xs) | (k, (xs, _)) <- pes' ])+ (dflt : [ lams xs e | (_, (xs, e)) <- pes' ] ++ [var]) --- Scott encoding--- C_i e1 ... en--- encodes as, assuming k constructors--- \ x1 ... xn -> \ f1 ... fi ... fk -> fi x1 ... xn --- Encode a case expression:--- case var of p1->e1; p2->e2; ...; _->dflt-encCaseScott :: Exp -> [(SPat, Exp)] -> Exp -> Exp-encCaseScott var pes dflt =- --trace ("mkCase " ++ show pes) $- case pes of- (SPat (ConData cs _ _) _, _) : _ ->- let- arm (c, k) =- head $ [ lams xs e | (SPat (ConData _ i _) xs, e) <- pes, c == i ] ++- [ lams (replicate k dummyIdent) dflt ]- in apps var (map arm cs)- _ -> undefined---- Encode a constructor with strictness flags ss.--- The constructor arity is given by ss, and the constructor number is i out of n.--- It's always possible to just use the lambda expression, but we handle some--- cases specially to speed up combinator optimization.-encConstrScott :: Int -> Int -> [Bool] -> Exp-encConstrScott i n ss | or ss = encConstrScottStrict i n ss- | otherwise = encConstrScottLazy i n (length ss)--encConstrScottLazy :: Int -> Int -> Int -> Exp-encConstrScottLazy i n l =- case (i, n, l) of- (0, 1, 0) -> comb "I" -- single nullary- (0, 1, 1) -> comb "U" -- single unary- (0, 1, 2) -> comb "P" -- pair/...- (0, 1, _) | l <= tupleLimit -> comb ("T" ++ show l)-- (0, 2, 0) -> comb "K" -- []/False/Nothing/...- (0, 2, 1) -> comb "L" -- Left/...-- (1, 2, 0) -> comb "A" -- True/...- (1, 2, 1) -> comb "J" -- Just/...- (1, 2, 2) -> comb "O" -- (:)/...+-- constructor k out of m+encConstr :: Int -> Int -> [Bool] -> Exp+encConstr k _m ss | or ss = encConstrStrict k ss+ | otherwise = encConstrLazy k (length ss) - (0, 3, 0) -> comb "K2" -- LT/...- (1, 3, 0) -> comb "KK" -- EQ/...- (2, 3, 0) -> comb "KA" -- GT/...- _ -> encConstrScottLambda i n l- where comb = Lit . LPrim+-- constructor k out of m+encConstrStrict :: Int -> [Bool] -> Exp+encConstrStrict k ss =+ let n = length ss -- constructor arity+ xs = [mkIdent ("$x" ++ show j) | j <- [0 .. n-1] ]+ strict (False:ys) (_:is) e = strict ys is e+ strict (True :ys) (x:is) e = app2 (litPrim "seq") (Var x) (strict ys is e)+ strict _ _ e = e+ in lams xs $ strict ss xs $ apps (cCon k n) (map Var xs) -encConstrScottLambda :: Int -> Int -> Int -> Exp-encConstrScottLambda i n l =- let- f = mkIdent "$f"- fs = map (\ k -> if k == i then f else dummyIdent) [0::Int .. n-1]- xs = [mkIdent ("$x" ++ show j) | j <- [0 .. l-1] ]- in lams xs $ lams fs $ apps (Var f) (map Var xs)+-- Constructor k, with n arguments+encConstrLazy :: Int -> Int -> Exp+encConstrLazy k n = cCon k n -encConstrScottStrict :: Int -> Int -> [Bool] -> Exp-encConstrScottStrict i n ss =- let- f = mkIdent "$f"- fs = map (\ k -> if k == i then f else dummyIdent) [0::Int .. n-1]- xs = [mkIdent ("$x" ++ show j) | (j, _) <- zip [0::Int ..] ss]- strict (False:ys) (_:is) e = strict ys is e- strict (True:ys) (x:is) e = app2 (Lit (LPrim "seq")) (Var x) (strict ys is e)- strict _ _ e = e- in lams xs $ strict ss xs $ lams fs $ apps (Var f) (map Var xs)+-- Special case of encCase+encIf :: Exp -> Exp -> Exp -> Exp+encIf c t e = apps (cCaseD [0, 0]) [e, t, c] -encIfScott :: Exp -> Exp -> Exp -> Exp-encIfScott c t e = app2 c e t+-- Recognize an encoded if, see encIf.+getEncIf :: Exp -> Maybe (Exp, Exp, Exp)+getEncIf (App (App (App (Lit (LPrim (PCaseD [0, 0]))) e) t) c) = Just (c, t, e)+getEncIf _ = Nothing encList :: [Exp] -> Exp encList = foldr (app2 cCons) cNil -cCons :: Exp-cCons = encConstrScottLazy 1 2 2- cNil :: Exp-cNil = encConstrScottLazy 0 2 0---------------------------------------------+cNil = encConstrLazy 0 0 --- Explicit constructor number encoding--- C_i e1 e2 ... en--- encodes as--- (i, (e1, e2, ..., en))--- with the tuples being Scott encoded.+cCons :: Exp+cCons = encConstrLazy 1 2 --- Could be improved by a new node type holding--- both the constructor number and a pointer to the tuple.--- Also, could use a "jump table" case combinator instead--- of a decision tree.+encTuple :: [Exp] -> Exp+encTuple es = apps (encConstrLazy 0 (length es)) es -encConstrNo :: Int -> Int -> [Bool] -> Exp-encConstrNo i _n ss =- let- xs = [mkIdent ("$x" ++ show j) | (j, _) <- zip [0::Int ..] ss]- strict (False:ys) (_:is) e = strict ys is e- strict (True:ys) (x:is) e = app2 (Lit (LPrim "seq")) (Var x) (strict ys is e)- strict _ _ e = e- in lams xs $ strict ss xs $ encTag i $ encTuple (map Var xs)+encTupleSel :: Int -> Int -> Exp -> Exp+encTupleSel m n tup =+ let xs = [mkIdent ("x" ++ show i) | i <- [1 .. n] ]+ in apps (cCaseD [n]) [foldr Lam (Var (xs !! m)) xs, tup] -encTag :: Int -> Exp -> Exp-encTag i e | i <= tagLimit = App (Lit (LPrim ("TAG" ++ show i))) e- | otherwise = encTuple [Lit (LInt i), e]+-- A dense case, given the number of fields of each constructor.+cCaseD :: [Int] -> Exp+cCaseD as = checkCons (length as) $ foldr checkFields (Lit $ LPrim $ PCaseD as) as -encCaseNo :: Exp -> [(SPat, Exp)] -> Exp -> Exp-encCaseNo var pes dflt =- App var (Lam n $ Lam t $ caseTree (Var n) (Var t) 0 (numConstr pes) pes' dflt)- where n = mkIdent "$n"- t = mkIdent "$tt"- pes' = sortBy (\ (x, _, _) (y, _, _) -> compare x y)- [(conNo c, xs, e) | (SPat c xs, e) <- pes]+-- A sparse case, given the constructor number and number of fields of each arm.+cCaseS :: [(Int, Int)] -> Exp+cCaseS kns = checkCons (length kns) $ foldr (\ (k, n) -> checkCons (k + 1) . checkFields n) (Lit $ LPrim $ PCaseS kns) kns -caseTree :: Exp -> Exp -> Int -> Int -> [(Int, [Ident], Exp)] -> Exp -> Exp-caseTree n tup lo hi pes dflt =- case pes of- [] -> dflt- [(i, xs, e)] | hi - lo == 1 -> match tup xs e- | otherwise -> encIf (eqInt i n) (match tup xs e) dflt-{-- -- Strangely, this slows things down.- -- Why? A 3-way branch should be better than a 2-way.- [(i, xs, e), (_, xs', e')]- | hi - lo == 2 -> encIf (eqInt i n) (match tup xs e) (match tup xs' e')- _ ->- case splitAt (length pes `quot` 2) pes of- (pesl, (i, xs, e) : pesh) ->- encTri (cmpInt i n) (caseTree n tup (i+1) hi pesh dflt)- (match tup xs e)- (caseTree n tup lo i pesl dflt)- _ -> impossible--}- _ ->- case splitAt (length pes `quot` 2) pes of- (pesl, pesh@((i, _, _):_)) ->- encIf (gtInt i n) (caseTree n tup lo i pesl dflt) (caseTree n tup i hi pesh dflt)- _ -> impossible- where- eqInt :: Int -> Exp -> Exp- eqInt i x = app2 (Lit (LPrim "==")) (Lit (LInt i)) x- gtInt :: Int -> Exp -> Exp- gtInt i x = app2 (Lit (LPrim ">")) (Lit (LInt i)) x- match :: Exp -> [Ident] -> Exp -> Exp- match e is rhs = App e $ lams is rhs-{-- cmpInt :: Exp -> Int -> Exp- cmpInt i x = app2 (Lit (LPrim "icmp")) (Lit (LInt i)) x- encTri o l e h = app3 o l e h--}+cCon :: Int -> Int -> Exp+cCon k n = checkCons (k + 1) $ checkFields n $ Lit $ LPrim $ PCon k n conNo :: Con -> Int conNo (ConData cks i _) = length $ takeWhile ((/= i) . fst) cks conNo _ = undefined--numConstr :: [(SPat, Exp)] -> Int-numConstr ((SPat (ConData cs _ _) _, _):_) = length cs-numConstr _ = undefined---- Make a tuple-encTuple :: [Exp] -> Exp-encTuple es = apps (encConstrScottLazy 0 1 (length es)) es---- Select component m from an n-tuple-encTupleSel :: Int -> Int -> Exp -> Exp-encTupleSel m n tup =- let- xs = [mkIdent ("x" ++ show i) | i <- [1 .. n] ]- in App tup (foldr Lam (Var (xs !! m)) xs)-
@@ -0,0 +1,115 @@+{-# OPTIONS_GHC -Wno-orphans #-}+module MicroHs.Error(+ MhsError(..),+ mhsError,+ mhsErrorLoc,+ reportErrors,+ formatMhsError,+ errLoc,+ ) where+import qualified Prelude(); import MHSPrelude+import Data.Maybe+import MicroHs.Ident({-SLoc(..),-} showSLoc, isNoSLoc)+import System.Environment+import System.Exit+import System.IO++-- This belongs in MicroHs.Error, but Hugs cannot derive Tyoeable+-- and GHC doesn't allow explicit Typeable instances.+-- Instead it lives in {ghc,hugs,mhs}/MHSPrelude.hs+{-+data MhsError+ = MhsSyntaxError SLoc String String+ | MhsTypeError SLoc String String String -- header, expected, actual+ | MhsOtherError SLoc String+ | MhsError String -- no location+-}++instance Show MhsError where+ show = formatMhsError False++instance Exception MhsError++errLoc :: MhsError -> Maybe SLoc+errLoc (MhsSyntaxError l _ _) = Just l+errLoc (MhsTypeError l _ _ _) = Just l+errLoc (MhsUndefError l _ _) = Just l+errLoc (MhsAmbigError l _ _ _) = Just l+errLoc (MhsOtherError l _) = Just l+errLoc (MhsError _) = Nothing++mhsError :: String -> a+mhsError s = throw (MhsError s)++mhsErrorLoc :: SLoc -> String -> a+mhsErrorLoc loc s = throw (MhsOtherError loc s)++formatMhsError :: Bool -> MhsError -> String+formatMhsError col err =+ case err of+ MhsError msg -> "mhs: " ++ redError ++ msg+ MhsOtherError loc msg -> locErr loc ++ msg+ MhsTypeError loc mode a e ->+ locErr loc ++ mode ++ " mismatch" +++ "\n expected: " ++ green col e +++ "\n actual: " ++ red col a+ MhsSyntaxError loc a e ->+ locErr loc ++ "syntax" +++ "\n found: " ++ a +++ "\n expected: " ++ e+ MhsUndefError loc k i ->+ locErr loc ++ "undefined " ++ k ++ ": " ++ i+ MhsAmbigError loc k i alts ->+ locErr loc ++ "ambiguous " ++ k ++ ": " ++ i ++ " " ++ alts+ where+ locErr loc | isNoSLoc loc = redError+ | otherwise = bold col (showSLoc loc) ++ ": " ++ redError+ redError = red col "error: "++sgr :: String -> Bool -> String -> String+sgr code col str = if col then "\ESC[" ++ code ++ "m" ++ str ++ "\ESC[0m" else str++bold, red, green, blue :: Bool -> String -> String+bold = sgr "1"+red = sgr "1;31"+blue = sgr "34"+green = sgr "32"++fileSnippet :: Bool -> SLoc -> IO (Maybe String)+fileSnippet col (SLoc fn l c) = do+ mls <- catch (Just . lines <$> readFile fn) (\ (_ :: SomeException) -> return Nothing)+ case mls of+ Just ls | l >= 1 && l <= length ls -> do+ let src = ls !! (l - 1)+ num = show l+ pad = map (const ' ') num+ return $ Just $ unlines [ blue col (pad ++ " |")+ , blue col (num ++ " | ") ++ src+ , blue col (pad ++ " | ") ++ caretPad src c ++ red col "^"+ ]+ _ -> return Nothing++-- Catch errors in the program being compiled, print them nicely, and exit with failure.+reportErrors :: IO () -> IO ()+reportErrors io = catch io $ \ err -> do+ -- Colors when stderr is a terminal, unless NO_COLOR is set.+ tty <- hIsTerminalDevice stderr+ noColor <- lookupEnv "NO_COLOR"+ let color = tty && isNothing noColor+ errMsg = formatMhsError color err+ msnippet <- maybe (return Nothing) (fileSnippet color) (errLoc err)+ hPutStrLn stderr errMsg+ maybe (return ()) (hPutStrLn stderr) msnippet++ exitWith (ExitFailure 1)++-- Whitespace that puts the caret under column c of the source line.+-- Tabs are kept, so they expand the same way as in the line above;+-- the lexer counts a tab as advancing to the next multiple of 8.+caretPad :: String -> Int -> String+caretPad src c = go 1 src+ where+ go col _ | col >= c = ""+ go col ('\t' : r) = '\t' : go (((col + 7) `quot` 8) * 8 + 1) r+ go col (_ : r) = ' ' : go (col + 1) r+ go col [] = replicate (c - col) ' '
@@ -3,24 +3,22 @@ -- See LICENSE file for full license. module MicroHs.Exp( Exp(..),- PrimOp, substExp, app2, app3, allVarsExp, freeVars, lams, apps,- mkForExp, getForExp,+ mkForExp, getForExp, IsJavascript,+ litPrim, ) where import qualified Prelude(); import MHSPrelude import Data.Char import Data.List import MicroHs.Ident-import MicroHs.Expr(Lit(..), showLit, CType(..))+import MicroHs.Expr(Lit(..), PrimOp(..), showLit, CType(..), lPrim) import MicroHs.List-import Text.PrettyPrint.HughesPJLiteClass+import Mhs.Text.PrettyPrint.HughesPJLiteClass import Debug.Trace -type PrimOp = String- data Exp = Var Ident | App Exp Exp@@ -34,6 +32,10 @@ rnf (Lam a b) = rnf a `seq` rnf b rnf (Lit a) = rnf a +-- A primitive that has no constructor of its own.+litPrim :: String -> Exp+litPrim = Lit . lPrim+ app2 :: Exp -> Exp -> Exp -> Exp app2 f a1 a2 = App (App f a1) a2 @@ -47,6 +49,8 @@ pPrintPrec _ _ = ppExp ppExp :: Exp -> Doc+ppExp (App (Lam i b) e) =+ parens $ sep [text "let" <+> ppIdent i <+> text "=" <+> ppExp e, text "in" <+> ppExp b] ppExp ae = case ae of Var i -> ppIdent i@@ -99,11 +103,14 @@ apps f = foldl App f -- Encoding for 'foreign export' definitions.-mkForExp :: Exp -> CType -> Exp-mkForExp e t = app2 cfe e cty+type IsJavascript = Bool++mkForExp :: IsJavascript -> Exp -> CType -> Exp+mkForExp js e t = app2 cfe e cty where cty = Lit $ LCType t- cfe = Lit $ LPrim "FE"+ cfe = litPrim $ if js then "FEJS" else "FE" -getForExp :: Exp -> Maybe (Exp, CType)-getForExp (App (App (Lit (LPrim "FE")) e) (Lit (LCType t))) = Just (e, t)+getForExp :: Exp -> Maybe (IsJavascript, Exp, CType)+getForExp (App (App (Lit (LPrim (POther "FE"))) e) (Lit (LCType t))) = Just (False, e, t)+getForExp (App (App (Lit (LPrim (POther "FEJS"))) e) (Lit (LCType t))) = Just (True, e, t) getForExp _ = Nothing
@@ -1,12 +1,15 @@ {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}-module MicroHs.ExpPrint(toStringCMdl, toStringP, encodeString, combVersion, removeUnused, renumberCMdl) where+module MicroHs.ExpPrint(toStringCMdl, toStringP, encodeString, combVersion, removeUnused, renumberCMdl, renumberCMdlNames, renumberCMdlM) where import qualified Prelude(); import MHSPrelude import qualified Data.ByteString.Char8 as BS import Data.Char(ord, chr)+import Data.Function(on)+import Data.List(nubBy) import qualified MicroHs.IdentMap as M import Data.Maybe import MicroHs.Desugar(LDef) import MicroHs.EncodeData(encList)+import MicroHs.Error(mhsError) import MicroHs.Exp import MicroHs.Expr(Lit(..), showLit, errorMessage, HasLoc(..), CType) import MicroHs.Ident(Ident, showIdent, mkIdent, showSLoc)@@ -15,12 +18,12 @@ import MicroHs.TypeCheck(isInstId) type CMdl = ([LDef], Exp)-type ForExpTable = [(Ident, Ident, CType)]+type ForExpTable = [(Ident, Ident, CType, IsJavascript)] -- Version number of combinator file. -- Must match version in eval.c. combVersion :: String-combVersion = "v8.3\n"+combVersion = "v9.3\n" -- Remove unused definitions. Only used for dumping definitions. removeUnused :: CMdl -> [LDef]@@ -31,19 +34,35 @@ dMap = M.fromList ds dfs :: [Ident] -> M.Map Exp -> [LDef] dfs [] done = M.toList done- dfs (i:is) done | Just _ <- M.lookup i done = dfs is done+ dfs (i:is) done | isJust (M.lookup i done) = dfs is done | otherwise = dfs (freeVars e ++ is) (M.insert i e done) where e = fromMaybe (error $ "removeUnused: undef " ++ show i) $ M.lookup i dMap +renumberCMdl :: CMdl -> (ForExpTable, CMdl)+renumberCMdl cmdl =+ let (fexps, cmdl', _) = renumberCMdlNames cmdl+ in (fexps, cmdl')++-- As renumberCMdl, but also return the label (a number) of each definition,+-- together with its original name.+renumberCMdlNames :: CMdl -> (ForExpTable, CMdl, [(String, Ident)])+renumberCMdlNames (ds, emain) =+ let fexps = [ (i, t, js) | (i, e) <- ds, Just (js, _, t) <- [getForExp e] ]+ dMap = M.fromList $ checkDupInstances ds+ in renumberCMdlMNames fexps dMap emain+ -- Rename (to a numbers) top level definitions and remove unused ones. -- This is the "linking" of the program. -- Returns the renamed foreign exports and the "linked" CNdl-renumberCMdl :: CMdl -> (ForExpTable, CMdl)-renumberCMdl (ds, emain) =+renumberCMdlM :: [(Ident, CType, IsJavascript)] -> M.Map Exp -> Exp -> (ForExpTable, CMdl)+renumberCMdlM fexps dMap emain =+ let (fexps', cmdl, _) = renumberCMdlMNames fexps dMap emain+ in (fexps', cmdl)++renumberCMdlMNames :: [(Ident, CType, IsJavascript)] -> M.Map Exp -> Exp -> (ForExpTable, CMdl, [(String, Ident)])+renumberCMdlMNames fexps dMap emain = let- fexps = [ (i, t) | (i, e) <- ds, Just (_, t) <- [getForExp e] ]- roots = freeVars emain ++ map fst fexps- dMap = M.fromList ds+ roots = freeVars emain ++ [ i | (i, _, _) <- fexps ] -- Shake the tree bottom-up, renaming identifiers as we go along. -- This is much faster than (say) computing the sccs and walking that. dfs :: Ident -> State (Int, M.Map Exp, [LDef]) ()@@ -59,7 +78,7 @@ mapM_ dfs $ freeVars e -- Now that n's children are done, compute its actual entry. (i', seen', r') <- get- put (i'+1, M.insert n (ref i') seen', (mkIdent $ show i', substv e) : r')+ put (i'+1, M.insert n (ref i') seen', (mkIdent $ '_':show i', substv e) : r') (_, (_, defs, res)) = runState (mapM_ dfs roots) (0, M.empty, []) ref i = Var $ mkIdent $ "_" ++ show i findIdentIn n m = fromMaybe (errorMessage (getSLoc n) $ "No definition found for: " ++ showIdent n) $@@ -70,11 +89,13 @@ Var n -> findIdent n App f a -> App (substv f) (substv a) e -> e- fexps' = [ (unVar (findIdent i), i, t) | (i, t) <- fexps ]+ fexps' = [ (unVar (findIdent i), i, t, js) | (i, t, js) <- fexps ] where unVar (Var n) = n unVar _ = undefined+ -- The label of each definition (the number after the _), and its name.+ names = [ (drop 1 (showIdent l), n) | (n, Var l) <- M.toList defs ] in- (fexps', (checkDupInstances res, substv emain))+ (fexps', (res, substv emain), names) -- The argument is all definitions and the main expression. -- The result is the program as a string.@@ -82,9 +103,9 @@ toStringCMdl (ds, emain) = let def :: (Ident, Exp) -> (String -> String) -> (String -> String)- def (i, e) r | Just (e', _) <- getForExp e = def (i, e') r+ def (i, e) r | Just (_, e', _) <- getForExp e = def (i, e') r def (i, e) r =- ("A " ++) . toStringP e . ((":" ++ showIdent i ++ " @\n") ++) . r . ("@" ++)+ ("A " ++) . toStringP e . ((":" ++ tail (showIdent i) ++ " @\n") ++) . r . ("@" ++) res :: String -> String res = foldr def (toStringP emain) ds@@ -94,12 +115,12 @@ checkDupInstances :: [LDef] -> [LDef] checkDupInstances ds = case dupInstances ds of- (n1 : n2 : _) : _ ->+ (n2 : n1 : _) : _ -> errorMessage (getSLoc n1) $ "Duplicate instance " ++ unmangleInst (showIdent n1) ++ " at " ++ showSLoc (getSLoc n2) _ -> ds dupInstances :: [LDef] -> [[Ident]]-dupInstances = filter ((> 1) . length) . groupSort . filter isInstId . map fst+dupInstances = filter ((> 1) . length) . map (nubBy ((==) `on` getSLoc)) . groupSort . filter isInstId . map fst -- XXX not nice unmangleInst :: String -> String@@ -114,10 +135,11 @@ Lit (LStr s) -> -- Encode very short string directly as combinators. if length s > 1 then- toStringP (App (Lit (LPrim "fromUTF8")) (Lit (LBStr (BS.pack (utf8encode s)))))+ toStringP (App (litPrim "fromUTF8") (Lit (LBStr (BS.pack (utf8encode s))))) else toStringP (encodeString s)- Lit (LBStr s) -> (quoteString (BS.unpack s) ++) . (' ' :)+ Lit (LBStr s) | BS.length s > 100 -> byteString s -- arbitrary limit+ | otherwise -> (quoteString (BS.unpack s) ++) . (' ' :) Lit (LInteger _) -> undefined Lit (LRat _) -> undefined Lit (LTick s) -> ('!':) . (quoteString s ++) . (' ' :)@@ -154,6 +176,11 @@ | c < '\xff' = ['|', chr (ord c - 0x80)] | otherwise = "\\_" in '"' : concatMap (\c -> achar (chr (ord c `rem` 256))) s ++ ['"']++-- BaseStrings are encoded without quotations,+-- using a length and raw data instead.+byteString :: BS.ByteString -> String -> String+byteString bs s = "$" ++ show (BS.length bs) ++ " " ++ BS.unpack bs ++ s encodeString :: String -> Exp encodeString = encList . map (Lit . LInt . ord)
@@ -9,10 +9,11 @@ Deriving(..), DerStrategy(..), doNotDerive, Expr(..), eLam, eLamWithSLoc, eEqn, oneAlt, eEqns, showExpr, eqExpr, XTCState,- CallConv(..),+ CallConv(..), Safety(..), QForm(..), Listish(..), Lit(..), showLit,+ PrimOp(..), mkPrimOp, primOpName, lPrim, ImpEnt(..), ImpVal(..), CType(..), EBind, showEBind, showEBinds,@@ -59,11 +60,13 @@ ) where import qualified Prelude(); import MHSPrelude import Data.ByteString(ByteString)+import Data.Char(toLower) import Data.List import Data.Maybe import MicroHs.Builtin+import MicroHs.Error(mhsErrorLoc) import MicroHs.Ident-import Text.PrettyPrint.HughesPJLiteClass+import Mhs.Text.PrettyPrint.HughesPJLiteClass type IdentModule = Ident @@ -88,7 +91,7 @@ | Sign [Ident] EType | KindSign Ident EKind | Import ImportSpec- | ForImp CallConv (Maybe String) Ident EType+ | ForImp CallConv Safety (Maybe String) Ident EType | ForExp CallConv (Maybe String) Expr EType | Infix Fixity [Ident] | Class [EConstraint] LHS [FunDep] [EBind] -- XXX will probable need initial forall with FD@@ -113,7 +116,7 @@ rnf (Sign a b) = rnf a `seq` rnf b rnf (KindSign a b) = rnf a `seq` rnf b rnf (Import a) = rnf a- rnf (ForImp a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d+ rnf (ForImp a b c d e) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d `seq` rnf e rnf (ForExp a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d rnf (Infix a b) = rnf a `seq` rnf b rnf (Class a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d@@ -138,6 +141,11 @@ instance NFData CallConv where rnf x = x `seq` () +data Safety = Unsafe | Safe | Interruptible+ deriving (Eq, Show)++instance NFData Safety where rnf x = x `seq` ()+ data ImportSpec = ImportSpec ImpType Bool Ident (Maybe Ident) (Maybe (Bool, [ImportItem])) -- first Bool indicates 'qualified', second 'hiding' deriving (Show) @@ -185,6 +193,7 @@ | EOper Expr [(Ident, Expr)] | ELam SLoc [Eqn] | ELit SLoc Lit+ | EQLit SLoc Ident Lit | ECase Expr [ECaseArm] | ELet [EBind] Expr | ETuple [Expr]@@ -220,6 +229,7 @@ rnf (EOper a b) = rnf a `seq` rnf b rnf (ELam a b) = rnf a `seq` rnf b rnf (ELit a b) = rnf a `seq` rnf b+ rnf (EQLit a b c) = rnf a `seq` rnf b `seq` rnf c rnf (ECase a b) = rnf a `seq` rnf b rnf (ELet a b) = rnf a `seq` rnf b rnf (ETuple a) = rnf a@@ -344,13 +354,75 @@ | LChar Char | LStr String | LBStr ByteString -- bytestring- | LPrim String+ | LPrim PrimOp | LExn String -- exception to raise | LForImp IdentModule ImpEnt String CType | LCType CType -- used for foreign export | LTick String deriving (Eq, Show) +-- A combinator or a primitive.+-- The combinators that the compiler generates, or looks for, have their own+-- constructors. All other primitives use POther.+-- To keep this canonical, a name must never be put in POther if it+-- has a constructor; use mkPrimOp to convert a name.+data PrimOp+ = PS | PK | PI | PB | PC | PS' | PB' | PC' | PA | PU | PY | PZ | PP | PR | PO | PK2 | PK3 | PK4 | PC'B+ | PCon Int Int -- C_k_n, constructor k with n fields+ | PCaseD [Int] -- D_a0_..._a{m-1}, dense case, ak is the number of fields of constructor k+ | PCaseS [(Int, Int)] -- E_k1_n1_..._km_nm, sparse case, with arms for constructors ki with ni fields+ | POther String+ deriving (Eq, Show)++instance NFData PrimOp where+ rnf (PCon a b) = rnf a `seq` rnf b+ rnf (PCaseD a) = rnf a+ rnf (PCaseS a) = rnf a+ rnf (POther a) = rnf a+ rnf p = p `seq` ()++-- The named combinators.+namedPrimOps :: [(String, PrimOp)]+namedPrimOps =+ [ (primOpName p, p) | p <- [PS, PK, PI, PB, PC, PS', PB', PC', PA, PU, PY, PZ, PP, PR, PO, PK2, PK3, PK4, PC'B] ]++-- Convert a primitive name, e.g., from _primitive.+-- Only the named combinators are recognized, the others (C_k_n etc.)+-- are only generated by the compiler.+mkPrimOp :: String -> PrimOp+mkPrimOp s = fromMaybe (POther s) (lookup s namedPrimOps)++-- A literal for a primitive that has no constructor of its own.+lPrim :: String -> Lit+lPrim = LPrim . POther++primOpName :: PrimOp -> String+primOpName p =+ case p of+ PS -> "S"+ PK -> "K"+ PI -> "I"+ PB -> "B"+ PC -> "C"+ PS' -> "S'"+ PB' -> "B'"+ PC' -> "C'"+ PA -> "A"+ PU -> "U"+ PY -> "Y"+ PZ -> "Z"+ PP -> "P"+ PR -> "R"+ PO -> "O"+ PK2 -> "K2"+ PK3 -> "K3"+ PK4 -> "K4"+ PC'B -> "C'B"+ PCon k n -> "C_" ++ show k ++ "_" ++ show n+ PCaseD as -> 'D' : concatMap (('_' :) . show) as+ PCaseS kns -> 'E' : concat [ '_' : show k ++ '_' : show n | (k, n) <- kns ]+ POther s -> s+ instance NFData Lit where rnf (LInt a) = rnf a rnf (LInt64 a) = rnf a@@ -448,6 +520,7 @@ EApp p1 p2 -> patVars p1 ++ patVars p2 EOper p1 ips -> patVars p1 ++ concatMap (\ (i, p2) -> i `add` patVars p2) ips ELit _ _ -> []+ EQLit _ _ _ -> [] ETuple ps -> concatMap patVars ps EParen p -> patVars p EListish (LList ps) -> concatMap patVars ps@@ -588,6 +661,7 @@ getSLoc (EOper e _) = getSLoc e getSLoc (ELam l _) = l getSLoc (ELit l _) = l+ getSLoc (EQLit l _ _) = l getSLoc (ECase e _) = getSLoc e getSLoc (ELet bs _) = getSLoc bs getSLoc (ETuple es) = getSLoc es@@ -684,6 +758,7 @@ vs = freeTyVars (map snd s') -- these are free in s' ELit _ _ -> ae+ EQLit _ _ _ -> ae ETuple ts -> ETuple (map sub ts) EOper t1 its -> EOper (sub t1) (map (second sub) its) EListish (LList [t]) -> EListish (LList [sub t])@@ -762,6 +837,7 @@ EOper e1 ies -> allVarsExpr' e1 . composeMap (\ (i,e2) -> (i :) . allVarsExpr' e2) ies ELam _ qs -> composeMap allVarsEqn qs ELit _ _ -> id+ EQLit _ _ _ -> id ECase e as -> allVarsExpr' e . composeMap allVarsCaseArm as ELet bs e -> composeMap allVarsBind' bs . allVarsExpr' e ETuple es -> composeMap allVarsExpr' es@@ -818,6 +894,7 @@ setSLocExpr l (EVar i) = EVar (setSLocIdent l i) setSLocExpr l (ECon c) = ECon (setSLocCon l c) setSLocExpr l (ELit _ k) = ELit l k+setSLocExpr l (EQLit _ mq k) = EQLit l mq k setSLocExpr l (EApp f a) = EApp (setSLocExpr l f) a setSLocExpr l (EForall q vs e) = EForall q vs (setSLocExpr l e) setSLocExpr _ e@(EUVar _) = e@@ -831,7 +908,7 @@ errorMessage :: forall a . HasCallStack => SLoc -> String -> a-errorMessage loc msg = mhsError $ showSLoc loc ++ ": " ++ msg+errorMessage loc msg = mhsErrorLoc loc msg ---------------- @@ -896,7 +973,7 @@ case mis of Nothing -> empty Just (h, is) -> text (if h then " hiding" else "") <> parens (ppCommaSep (map (pPrint0 l) is))- ForImp cc ie i t -> text "foreign import" <+> text (drop 1 $ show cc) <+> maybe empty (text . show) ie <+> pPrint0 l i <+> text "::" <+> pPrint0 l t+ ForImp cc sf ie i t -> text "foreign import" <+> text (drop 1 $ show cc) <+> text (map toLower $ show sf) <+> maybe empty (text . show) ie <+> pPrint0 l i <+> text "::" <+> pPrint0 l t ForExp cc ie e t -> text "foreign export" <+> text (drop 1 $ show cc) <+> maybe empty (text . show) ie <+> pPrint0 l e <+> text "::" <+> pPrint0 l t Infix (a, p) is -> text ("infix" ++ f a) <+> text (show p) <+> ppCommaSep (map (pPrint0 l) is) where f AssocLeft = "l"; f AssocRight = "r"; f AssocNone = ""@@ -1001,6 +1078,7 @@ EOper e ies -> ppE prec (foldl (\ e1 (i, e2) -> EApp (EApp (EVar i) e1) e2) e ies) ELam _ qs -> parens $ text "\\" <> ppEqns l empty (text "->") qs ELit _ i -> text (showLit i)+ EQLit _ m i -> pPrint0 l m <> text "." <> text (showLit i) ECase e as -> maybeParens (prec > 0) $ text "case" <+> ppE 0 e <+> text "of" $$ nest 2 (vcat (map (ppCaseArm l) as)) ELet bs e -> maybeParens (prec > 0) $ text "let" $$ nest 2 (vcat (map ppEBind bs)) $$ text "in" <+> ppE 0 e ETuple es -> parens $ hsep $ punctuate (text ",") (map (ppE 0) es)@@ -1024,6 +1102,7 @@ EUVar i -> text ("_a" ++ show i) EQVar e t -> parens $ ppE 0 e <> text ":::" <> ppE 0 t ECon c -> {-text "***" <>-} ppCon l c+ EForall _ [] e | not raw -> ppE prec e EForall q iks e -> maybeParens (prec > 0) $ ppForall l q iks <+> ppE 0 e ppApp :: PrettyPrec -> [Expr] -> Expr -> Doc@@ -1101,7 +1180,7 @@ LChar c -> show c LStr s -> show s LBStr s -> show s- LPrim s -> s+ LPrim p -> primOpName p LExn s -> s LForImp _ ie s _-> '^' : if isPtr then '&':s else s where isPtr = case ie of ImpStatic _ IPtr _ -> True; _ -> False@@ -1228,6 +1307,7 @@ go _bound (EUVar _) acc = acc go _bound (ECon _) acc = acc go _bound (ELit _ _) acc = acc+ go _bound (EQLit _ _ _) acc = acc go bound (EOper e ies) acc = go bound e (goList bound (map snd ies) acc) go bound (ESign e _) acc = go bound e acc go bound (EListish (LList [e])) acc = go bound e acc
@@ -3,6 +3,7 @@ import Data.Char import Data.List import MicroHs.Desugar(LDef)+import MicroHs.Error(mhsError) import MicroHs.Exp import MicroHs.Expr import MicroHs.Flags@@ -11,20 +12,22 @@ --import Debug.Trace -- The export table has (internal-name, external-name, external-type)-makeFFI :: Flags -> [(Ident, Ident, CType)] -> [IdentModule ]-> [[LDef]] -> (String, String)+makeFFI :: Flags -> [(Ident, Ident, CType, IsJavascript)] -> [IdentModule ]-> [[LDef]] -> (String, String) makeFFI _ forExps exclude dss =- let ffiImports = nubBy eq [ (ie, n, t, mn) | ds <- dss, (_, d) <- ds, Lit (LForImp mn ie n (CType t)) <- [get d] ]+ let ffiImports = nubBy eq [ (ie, n, cRep ie t, mn) | ds <- dss, (_, d) <- ds, Lit (LForImp mn ie n (CType t)) <- [get d] ] where get (App _ a) = a -- if there is no IO type, we have (App primPerform (LForImp ...)) get a = a eq (_, n, _, _) (_, n', _, _) = n == n'+ -- Only a call through a pointer needs the C types.+ cRep ImpDynamic t = t+ cRep _ t = repType t wrappers = [ t | (ImpWrapper, _, t, _) <- ffiImports]- dynamics = [ t | (ImpDynamic, _, t, _) <- ffiImports] imps = filter ((`notElem` exclude) . impModule) $ filter ((`notElem` runtimeFFI) . impName) ffiImports includes = jsincs ++ nub [ inc | (ImpStatic iincs _ _, _, _, _) <- imps, inc <- iincs ] jsincs = if any isJS ffiImports then ["emscripten.h"] else [] where isJS (ImpJS _, _, _, _) = True isJS _ = False- mkSig (_, i, CType t) = let (as, ior) = getArrows t in mkExportSig i as ior ++ ";"+ mkSig (_, i, CType t, js) = let (as, ior) = getArrows t in mkExportSig js i as ior ++ ";" header = unlines ["#include <stdint.h>", "#if defined(__cplusplus)",@@ -37,9 +40,16 @@ "#endif" ] in- if not (null wrappers) || not (null dynamics) then mhsError "Unimplemented FFI feature" else+ if not (null wrappers) then mhsError "Unimplemented FFI feature: foreign import \"wrapper\"" else (unlines $ map (\ fn -> "#include \"" ++ fn ++ "\"") includes +++ (if any (\ (_, _, _, js) -> js) forExps then+ ["#if defined(__EMSCRIPTEN__)",+ "#include \"emscripten.h\"",+ "#else",+ "#define EMSCRIPTEN_KEEPALIVE",+ "#endif"]+ else []) ++ map mkHdr imps ++ ["static const struct ffi_entry imp_table[] = {"] ++ map mkEntry imps ++@@ -56,23 +66,23 @@ ] ++ zipWith mkExportWrapper [0..] forExps , header) -mkExportSig :: Ident -> [EType] -> EType -> String-mkExportSig n as ior =- let outT = cTypeName $ checkIO ior- ins = zipWith (\ i a -> cTypeName a ++ " _x" ++ show i) [1::Int ..] as+mkExportSig :: IsJavascript -> Ident -> [EType] -> EType -> String+mkExportSig js n as ior =+ let outT = expTypeName js $ checkIO ior+ ins = zipWith (\ i a -> expTypeName js a ++ " _x" ++ show i) [1::Int ..] as in outT ++ " " ++ unIdent n ++ "(" ++ intercalate ", " ins ++ ")" -mkExport :: (Ident, Ident, CType) -> String-mkExport (i, _, _) = " { \"" ++ unIdent i ++ "\", 0 },"+mkExport :: (Ident, Ident, CType, IsJavascript) -> String+mkExport (i, _, _, _) = " { \"" ++ unIdent i ++ "\", 0 }," -mkExportWrapper :: Int -> (Ident, Ident, CType) -> String-mkExportWrapper no (_, n, CType t) = unlines $+mkExportWrapper :: Int -> (Ident, Ident, CType, IsJavascript) -> String+mkExportWrapper no (_, n, CType t, js) = unlines $ let (as, ior) = getArrows t r = checkIO ior- outT = cTypeName r- arg k a = " mhs_from_" ++ cTypeHsName a ++ "(ffe_alloc(), 0, _x" ++ show k ++ "); ffe_apply();"+ outT = expTypeName js r+ arg k a = " mhs_from_" ++ expTypeHsName js a ++ "(ffe_alloc(), 0, _x" ++ show k ++ "); ffe_apply();" eval = if eqEType r ior then "ffe_eval()" else "ffe_exec()"- in [mkExportSig n as ior ++ " {",+ in [(if js then "EMSCRIPTEN_KEEPALIVE " else "") ++ mkExportSig js n as ior ++ " {", " gc_check(" ++ show (2 * length as + 4) ++ ");", " ffe_push(xffe_table[" ++ show no ++ "].ffe_value);" ] ++ zipWith arg [1::Int ..] as ++@@ -82,7 +92,7 @@ "}" ] else- [ " " ++ outT ++ " _res = mhs_to_" ++ cTypeHsName r ++ "(" ++ eval ++ ", -1);",+ [ " " ++ outT ++ " _res = mhs_to_" ++ expTypeHsName js r ++ "(" ++ eval ++ ", -1);", " ffe_pop();", " return _res;", "}"@@ -97,8 +107,9 @@ mkEntry :: (ImpEnt, String, EType, IdentModule) -> String mkEntry (ImpStatic _ IFunc _, f, t, _) = "{ \"" ++ f ++ "\", " ++ show (arity t) ++ ", mhs_" ++ f ++ "}," mkEntry (ImpStatic _ IPtr _, f, _, _) = "{ \"&" ++ f ++ "\", 0, mhs_addr_" ++ f ++ "},"-mkEntry (ImpStatic _ IValue _, f, _, _) = "{ \"" ++ f ++ "\", 0, mhs_" ++ f ++ "},"+mkEntry (ImpStatic _ IValue _, f, t, _) = "{ \"" ++ f ++ "\", " ++ show (arity t) ++ ", mhs_" ++ f ++ "}," mkEntry (ImpJS _, f, t, _) = "{ \"" ++ f ++ "\", " ++ show (arity t) ++ ", mhs_" ++ f ++ "},"+mkEntry (ImpDynamic, f, t, _) = "{ \"" ++ f ++ "\", " ++ show (arity t) ++ ", mhs_" ++ f ++ "}," mkEntry _ = undefined mkMhsFun :: String -> String -> String@@ -154,12 +165,7 @@ let (as, ior) = getArrows t r = checkIO ior len = length as- call = expand val- expand [] = []- expand ('$':c:cs) | isDigit c =- let n = digitToInt c - 1- in mkArg (as !! n) n ++ expand cs- expand (c:cs) = c : expand cs+ call = expandArgs t len (\ i -> mkArg (as !! i) i) val fcall = if isUnit r then call ++ "; return mhs_from_Unit(s, " ++ show len ++ ")"@@ -175,15 +181,68 @@ arg t i = ", " ++ mkJSArg t i call = "EM_ASM" ++ (if isUnit rt then "" else '_':jsr) ++- "({ " ++ s ++ " }" ++ args ++ ")"+ "({ " ++ expandArgs ty n (\ i -> '$' : show i) s ++ " }" ++ args ++ ")" -- EM_ASM counts from $0 fcall = if isUnit rt then call ++ "; return mhs_from_Unit(s, " ++ show n ++ ")" else "return " ++ mkRet rt n call in mkMhsFun f fcall+-- Call the function pointer in the first argument with the other arguments.+-- The pointer is cast to the exact C type of the function.+mkHdr (ImpDynamic, f, t, _) =+ let (ats, ior) = getArrows t+ (fpt, as) =+ case ats of+ fp : as' | Just ft <- dropApp identFunPtr fp+ , let (fas, fr) = getArrows ft+ , length fas == length as' && and (zipWith eqEType fas as') && eqEType fr ior+ -> (fp, as')+ _ -> errorMessage (getSLoc t) $ "foreign import dynamic must have type FunPtr ft -> ft: " ++ showEType t+ r = checkIO ior+ len = length ats+ cfun = cCallTypeName r ++ " (*)(" ++ (if null as then "void" else intercalate ", " (map cCallTypeName as)) ++ ")"+ call = "((" ++ cfun ++ ")" ++ mkArg fpt 0 ++ ")(" ++ intercalate ", " (zipWith mkArg (map repType as) [1..]) ++ ")"+ fcall =+ if isUnit r then+ call ++ "; return mhs_from_Unit(s, " ++ show len ++ ")"+ else+ "return " ++ mkRet (repType r) len call+ in mkMhsFun f fcall mkHdr _ = undefined +-- Replace $1, $2, ... (up to $9) in the code of a "value" or javascript import+-- by the arguments, numbered from 1 as in GHC. The function gets the argument+-- number counted from 0. Any other $k is an error.+expandArgs :: EType -> Int -> (Int -> String) -> String -> String+expandArgs t len arg = expand+ where+ expand [] = []+ expand ('$':c:cs) | isDigit c =+ let k = digitToInt c+ in if k < 1 || k > len then+ errorMessage (getSLoc t) $ "foreign import: $" ++ show k ++ " is not an argument: " ++ argsAre +++ (if k == 0 then " (they start at $1, not $0)" else "")+ else+ arg (k - 1) ++ expand cs+ expand (c:cs) = c : expand cs+ argsAre | len == 0 = "the import has no arguments"+ | len == 1 = "the argument is $1"+ | otherwise = "the arguments are $1 .. $" ++ show len++-- Replace the newtypes for C types by the types that represent them.+repType :: EType -> EType+repType (EApp f a) = EApp (repType f) (repType a)+repType t@(EVar i) | Just (_, r) <- lookup (unIdent i) cNewtypes = EVar (mkIdentSLoc (getSLoc i) r)+ | otherwise = t+repType t = t++-- The C type of an argument or the result of a call through a pointer.+cCallTypeName :: EType -> String+cCallTypeName (EApp (EVar ptr) _) | ptr == identFunPtr = "HsFunPtr"+cCallTypeName (EVar i) | Just (c, _) <- lookup (unIdent i) cNewtypes = c+cCallTypeName t = cTypeName t+ arity :: EType -> Int arity = length . fst . getArrows @@ -206,6 +265,15 @@ , ("System.IO.Handle", "Ptr") ] +-- Foreign export type names; a javascript export also allows Bool.+expTypeName :: IsJavascript -> EType -> String+expTypeName True (EVar i) | unIdent i == "Data.Bool_Type.Bool" = "int"+expTypeName _ t = cTypeName t++expTypeHsName :: IsJavascript -> EType -> String+expTypeHsName True (EVar i) | unIdent i == "Data.Bool_Type.Bool" = "Bool"+expTypeHsName _ t = cTypeHsName t+ -- Use to construct 'foreign export ccall' signature. cTypeName :: EType -> String cTypeName (EApp (EVar ptr) _t) | ptr == identPtr = "void*"@@ -253,17 +321,17 @@ -- These are already in the runtime runtimeFFI :: [String] runtimeFFI = [- "GETRAW", "GETTIMEMILLI", "acos", "add_FILE", "add_fd", "open", "add_utf8", "add_buf", "add_crlf",+ "GETRAW", "GETTIMEMICRO", "GETBOOTTIMEMICRO", "acos", "add_FILE", "add_fd", "open", "add_utf8", "add_buf", "add_crlf", "asin", "atan", "atan2", "calloc", "closeb",- "cos", "exp", "flushb", "fopen", "free", "getb", "getenv", "islinux", "ismacos", "iswindows", "log", "malloc",+ "cos", "exp", "flushb", "fopen", "free", "getb", "getenv", "isattyb", "filesizeb", "islinux", "ismacos", "ismingw", "iswindows", "log", "malloc", "md5Array", "md5BFILE", "md5String", "memcpy", "memmove", "realloc", "strlen", "strcpy",- "putb", "sin", "sqrt", "system", "tan", "tmpname", "ungetb", "remove",+ "putb", "putchar", "sin", "sqrt", "system", "tan", "tmpname", "ungetb", "remove", "acosf", "asinf", "atanf", "atan2f", "cosf", "expf", "logf", "sinf", "sqrtf", "tanf",- "scalbn", "scalbnf",+ "scalbn", "scalbnf", "pow", "powf", "js_debug", "js_eval_run", "js_eval_call", "js_set_haskellCallback", "readb", "writeb", "peekPtr", "pokePtr", "pokeWord", "peekWord",- "add_lz77_compressor", "add_lz77_decompressor",+ "add_lz77_compressor", "add_lz77_decompressor", "lz77c", "add_lzma_compressor", "add_lzma_decompressor", "add_rle_compressor", "add_rle_decompressor", "add_base64_encoder", "add_base64_decoder",@@ -290,8 +358,9 @@ "mpz_get_si64", "mpz_init_set_si64", "mpz_init_set_ui64", "mpz_log2", "want_gmp",+ "want_imath", "gettimeofday",- "EOK", "E2BIG", "EACCES", "EADDRINUSE", "EADDRNOTAVAIL", "EADV", "EAFNOSUPPORT", "EAGAIN",+ "E2BIG", "EACCES", "EADDRINUSE", "EADDRNOTAVAIL", "EADV", "EAFNOSUPPORT", "EAGAIN", "EALREADY", "EBADF", "EBADMSG", "EBADRPC", "EBUSY", "ECHILD", "ECOMM", "ECONNABORTED", "ECONNREFUSED", "ECONNRESET", "EDEADLK", "EDESTADDRREQ", "EDIRTY", "EDOM", "EDQUOT", "EEXIST", "EFAULT", "EFBIG", "EFTYPE", "EHOSTDOWN", "EHOSTUNREACH", "EIDRM", "EILSEQ",@@ -310,7 +379,7 @@ "environ", "get_executable_path", "setenv", "unsetenv",- "set_permissions", "get_permissions",+ "set_permissions", "get_permissions", "get_file_size", "F_SETFL", "O_NONBLOCK", "SOL_SOCKET", "SO_DEBUG", "SO_ERROR", "SO_REUSEADDR", "SO_TYPE", "accept", "bind", "close", "connect", "fcntl", "getsockopt", "listen", "recv", "send", "setsockopt", "socket" ]
@@ -2,7 +2,7 @@ import qualified Prelude(); import MHSPrelude import MicroHs.Builtin import MicroHs.Expr-import MicroHs.Ident+--import MicroHs.Ident -- Operators resolution -- Input: A sequence of binary infix operators, prefix operators, and operands@@ -62,7 +62,7 @@ resolveFixity :: Expr -> [((Expr, Fixity), Expr)] -> Either (SLoc, String) Expr resolveFixity ae oes = let inps = expr ae ++ concatMap opexpr oes- expr (ENegApp e) = Rator FixPre undefined negFixity : expr e -- there's only one prefix operator, so undefined is ok+ expr (ENegApp e) = Rator FixPre e negFixity : expr e -- there's only one prefix operator, so e is just for location expr e = [Rand e] opexpr ((f, fx), e) = Rator FixIn f fx : expr e
@@ -15,11 +15,14 @@ speed :: Bool, -- show lines/s readCache :: Bool, -- read and use cache writeCache :: Bool, -- generate cache+ cacheName :: FilePath, -- file name for compilation cache useTicks :: Bool, -- emit ticks doCPP :: Bool, -- run ccphs on input files+ noCode :: Bool, -- don't generate code cppArgs :: [String], -- flags for CPP cArgs :: [String], -- arguments for C compiler lArgs :: [String], -- arguments for C linker+ jsFiles :: [String], -- JavaScript files to embed in the output (targets with a js option) compress :: Bool, -- compress generated combinators base64 :: Bool, -- base64 encode generated combinators buildPkg :: Maybe FilePath, -- build a package@@ -58,11 +61,14 @@ speed = False, readCache = False, writeCache = False,+ cacheName = ".mhscache", useTicks = False, doCPP = False,+ noCode = False, cppArgs = [], cArgs = [], lArgs = [],+ jsFiles = [], compress = False, base64 = False, buildPkg = Nothing,
@@ -16,7 +16,7 @@ import Data.List import Data.Maybe import qualified MicroHs.IntSet as IS-import qualified MicroHs.IntMap as IM+import qualified Mhs.IntMap as IM import MicroHs.List data Tree a = Node a [Tree a]
@@ -1,5 +1,6 @@ -- Copyright 2023 Lennart Augustsson -- See LICENSE file for full license.+{-# OPTIONS_GHC -Wno-orphans #-} module MicroHs.Ident( Line, Col, Ident,@@ -24,7 +25,7 @@ ) where import qualified Prelude(); import MHSPrelude hiding(head) import Data.Char-import Text.PrettyPrint.HughesPJLiteClass+import Mhs.Text.PrettyPrint.HughesPJLiteClass import MicroHs.List(dropEnd) import Data.Text(Text, pack, unpack, append, head, cons)@@ -49,8 +50,10 @@ type Line = Int type Col = Int +{- Move to MHSPrelude data SLoc = SLoc FilePath Line Col- deriving (Show)+ deriving (Show, Eq)+-} -- instance Show SLoc where -- show (SLoc f l c) = show f ++ "," ++ show l ++ ":" ++ show c@@ -58,8 +61,10 @@ instance Pretty SLoc where pPrintPrec d _ (SLoc f l c) = pPrint0 d f <> text "," <> pPrint0 d l <> text ":" <> pPrint0 d c +-- The file name is shared by all the locations in a file, so it is not+-- traversed. mkIdentSLoc forces the location of an identifier. instance NFData SLoc where- rnf (SLoc a b c) = rnf a `seq` rnf b `seq` rnf c+ rnf (SLoc a b c) = a `seq` b `seq` c `seq` () data Ident = Ident SLoc Text -- deriving (Show)@@ -101,7 +106,7 @@ mkIdent = mkIdentSLoc noSLoc mkIdentSLoc :: SLoc -> String -> Ident-mkIdentSLoc l = Ident l . pack+mkIdentSLoc l s = rnf l `seq` Ident l (pack s) unIdent :: Ident -> String unIdent (Ident _ s) = unpack s@@ -115,8 +120,17 @@ ppIdent :: Ident -> Doc ppIdent (Ident _ i) = text $ unpack i +-- Test if an identifier has the given name.+-- The pack is outside the lambda, so that a partial application, like the+-- isIdent "->" in getArrow, does it once instead of on every call.+-- With isIdent s (Ident _ i) = pack s == i the code is+-- B D_2 (Z (B (==) pack)), and Z (Z x y z = x y) rebuilds the pack each+-- time the partial application gets an Ident. Binding the pack with a+-- let or where does not help, since eLet in the desugarer substitutes a+-- variable that is used once, even under a lambda.+-- See the note on Z, B', and C'B in MicroHs.Abstract. isIdent :: String -> Ident -> Bool-isIdent s (Ident _ i) = pack s == i+isIdent s = (\ t (Ident _ i) -> t == i) (pack s) qualIdent :: HasCallStack => Ident -> Ident -> Ident@@ -197,10 +211,10 @@ showSLoc :: SLoc -> String showSLoc (SLoc fn l c) = if null fn then "no location" else- show fn ++ ": " +++ fn ++ ":" ++ if l == 0 then "no location" else if l == -1 then "end-of-file" else- "line " ++ show l ++ ", col " ++ show c+ show l ++ ":" ++ show c slocFile :: SLoc -> FilePath slocFile (SLoc f _ _) = f
@@ -116,9 +116,9 @@ ins (One a v) = ins (Node Nil 1 a v Nil) ins (Node left _ key val right) = case k `compare` key of- LT -> balance (ins left) key val right+ LT -> balanceL (ins left) key val right EQ -> node left k (comb v val) right- GT -> balance left key val (ins right)+ GT -> balanceR left key val (ins right) delete :: forall a . Ident -> Map a -> Map a delete k = del@@ -128,9 +128,9 @@ | otherwise = t del (Node left _ key val right) = case k `compare` key of- LT -> balance (del left) key val right+ LT -> balanceR (del left) key val right EQ -> glue left right- GT -> balance left key val (del right)+ GT -> balanceL left key val (del right) where glue Nil right = right glue left Nil = left@@ -148,7 +148,7 @@ extractMin (Node Nil _ key val right) = (key, val, right) extractMin (Node left _ key val right) = case extractMin left of- (min, vmin, left') -> (min, vmin, balance left' key val right)+ (min, vmin, left') -> (min, vmin, balanceR left' key val right) extractMax :: forall a . Map a -> (Ident, a, Map a) extractMax Nil = undefined@@ -156,7 +156,7 @@ extractMax (Node left _ key val Nil) = (key, val, left) extractMax (Node left _ key val right) = case extractMax right of- (max, vmax, right') -> (max, vmax, balance left key val right')+ (max, vmax, right') -> (max, vmax, balanceL left key val right') -- omega=2 is not valid in the sense that balance can always be restored. -- But it gives the best performance on benchmarks, so we use it.@@ -167,34 +167,45 @@ --delta :: Int --delta = 0 -balance :: forall a . Map a -> Ident -> a -> Map a -> Map a-balance Nil key val Nil = One key val-balance Nil key val right@(One _ _) = Node Nil 2 key val right-balance Nil key val right@(Node rl _ _ _ rr)- | size rl < alpha*size rr = singleL Nil key val right- | otherwise = doubleL Nil key val right-balance left@(One _ _) key val Nil = Node left 2 key val Nil-balance left@(One _ _) key val right@(One _ _) = Node left 3 key val right-balance left@(One _ _) key val right@(Node rl sr _ _ rr)- | sr > omega {- *1+delta-}= if size rl < alpha*size rr then singleL left key val right- else doubleL left key val right- | otherwise = Node left (2 + sr) key val right-balance left@(Node ll _ _ _ lr) key val Nil- | size lr < alpha*size ll = singleR left key val Nil- | otherwise = doubleR left key val Nil-balance left@(Node ll sl _ _ lr) key val right@(One _ _)- | sl > omega {- *1+delta-}= if size lr < alpha*size ll then singleR left key val right- else doubleR left key val right- | otherwise = Node left (2 + sl) key val right-balance left@(Node ll sl _ _ lr) key val right@(Node rl sr _ _ rr)- | sr > omega * sl {- + delta -} =- if size rl < alpha*size rr then singleL left key val right- else doubleL left key val right- | sl > omega * sr {- + delta -} =- if size lr < alpha*size ll then singleR left key val right- else doubleR left key val right- | otherwise =- node left key val right+-- Make a tree from left, key, and right, restoring the balance if the left side+-- is too big, because it has grown or the right side has shrunk.+-- With size Nil = 0 and size (One _ _) = 1 all the cases follow the same rule:+-- rotate when one side is more than omega times the other.+-- Computing the sizes once, instead of matching on the constructors of both+-- sides, makes this much cheaper, and so does only checking the side that+-- can be too big.+balanceL :: forall a . Map a -> Ident -> a -> Map a -> Map a+balanceL left key val right =+ let sl = size left+ sr = size right+ in if sl + sr <= 1 then+ if sl + sr == 0 then One key val else Node left (sl + sr + 1) key val right+ else if sl > omega * sr then+ rotateR left key val right+ else+ Node left (sl + sr + 1) key val right++-- As balanceL, when the right side can be too big.+balanceR :: forall a . Map a -> Ident -> a -> Map a -> Map a+balanceR left key val right =+ let sl = size left+ sr = size right+ in if sl + sr <= 1 then+ if sl + sr == 0 then One key val else Node left (sl + sr + 1) key val right+ else if sr > omega * sl then+ rotateL left key val right+ else+ Node left (sl + sr + 1) key val right++rotateL :: forall a . Map a -> Ident -> a -> Map a -> Map a+rotateL left key val right@(Node rl _ _ _ rr) | size rl < alpha * size rr = singleL left key val right+ | otherwise = doubleL left key val right+rotateL _ _ _ _ = undefined++rotateR :: forall a . Map a -> Ident -> a -> Map a -> Map a+rotateR left@(Node ll _ _ _ lr) key val right | size lr < alpha * size ll = singleR left key val right+ | otherwise = doubleR left key val right+rotateR _ _ _ _ = undefined singleL :: forall a . Map a -> Ident -> a -> Map a -> Map a singleL l k v (Node rl _ rk rv rr) = node' (node l k v rl) rk rv rr
@@ -1,118 +0,0 @@--- Copyright 2023 Lennart Augustsson--- See LICENSE file for full license.-module MicroHs.IntMap(- IntMap,- empty, lookup, insert, fromList, toList, insertWith, (!), keys- ) where-import qualified Prelude(); import MHSPrelude hiding(lookup)--data IntMap a- = Empty- | Leaf Int a- | Node (IntMap a) (IntMap a) (IntMap a) (IntMap a)- --Xderiving (Show)-instance Show a => Show (IntMap a) where- showsPrec p m = showParen (p > 0) $ showsPrec 10 (toList m)--{---- This works for y>0-divModX :: Int -> Int -> (Int, Int)-divModX x y =- let- q = quot x y- r = rem x y- in- if x >= 0 || r == 0 then- (q, r)- else- (q - 1, r + y)--}--div4 :: Int -> Int-div4 i = {-if i < 0 then error "div4" else-} i `quot` 4-mod4 :: Int -> Int-mod4 i = {-if i < 0 then error "mod4" else-} i `rem` 4--empty :: forall a . IntMap a-empty = Empty--lookup :: forall a . Int -> IntMap a -> Maybe a-lookup k am =- case am of- Empty -> Nothing- Leaf i a -> if k == i then Just a else Nothing- Node m0 m1 m2 m3 ->- let- d = div4 k- m = mod4 k- in if 0 == m then lookup d m0- else if 1 == m then lookup d m1- else if 2 == m then lookup d m2- else lookup d m3--insert :: forall a . Int -> a -> IntMap a -> IntMap a-insert = insertWith const--fromList :: forall a . [(Int, a)] -> IntMap a-fromList = foldr (uncurry insert) empty---- XXX There must be a better way-toList :: forall a . IntMap a -> [(Int, a)]-toList am =- let- f o (k, a) = (k*4 + o, a)- in- case am of- Empty -> []- Leaf l a -> [(l, a)]- Node m0 m1 m2 m3 ->- map (f 0) (toList m0) `merge`- map (f 1) (toList m1) `merge`- map (f 2) (toList m2) `merge`- map (f 3) (toList m3)--merge :: forall a . [(Int, a)] -> [(Int, a)] -> [(Int, a)]-merge [] ys = ys-merge xs [] = xs-merge xxs@(xa@(x,_):xs) yys@(yb@(y,_):ys) = if x < y then xa : merge xs yys else yb : merge xxs ys--keys :: forall a . IntMap a -> [Int]-keys = map fst . toList--(!) :: forall a . IntMap a -> Int -> a-(!) m k =- case lookup k m of- Just i -> i- Nothing -> error "Data.IntMap.!"--insertWith :: forall a . (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a-insertWith comb ak a =- let- ins k am =- case am of- Empty -> Leaf k a- Leaf i b ->- if k == i then- Leaf k (comb a b)- else- ins k $ single i b- Node m0 m1 m2 m3 ->- let- d = div4 k- m = mod4 k- in if 0 == m then Node (ins d m0) m1 m2 m3- else if 1 == m then Node m0 (ins d m1) m2 m3- else if 2 == m then Node m0 m1 (ins d m2) m3- else Node m0 m1 m2 (ins d m3)- in ins ak--single :: Int -> a -> IntMap a-single k a = --insert k a $ Node Empty Empty Empty Empty- let- m = mod4 k- d = div4 k- l = Leaf d a- in if 0 == m then Node l Empty Empty Empty- else if 1 == m then Node Empty l Empty Empty- else if 2 == m then Node Empty Empty l Empty- else Node Empty Empty Empty l
@@ -5,7 +5,7 @@ empty, member, insert, fromList, toList ) where import qualified Prelude(); import MHSPrelude-import qualified MicroHs.IntMap as M+import qualified Mhs.IntMap as M newtype IntSet = I (M.IntMap ())
@@ -3,16 +3,14 @@ import Data.Char import Data.List import Data.Maybe-import Data.Version-import Control.Exception import MicroHs.Compile import MicroHs.CompileCache import MicroHs.Desugar(LDef)+import MicroHs.Error(mhsError, errLoc, formatMhsError) import MicroHs.Exp(Exp(Var)) import MicroHs.Expr(showEType, EModule(..), EDef(..), Expr(EVar)) import MicroHs.Flags-import MicroHs.Ident(mkIdent, Ident, unIdent, isIdentChar, SLoc(..), slocIdent, isNoSLoc)-import qualified MicroHs.IdentMap as M+import MicroHs.Ident(mkIdent, Ident, unIdent, isIdentChar, {-SLoc(..),-} slocIdent, isNoSLoc, unQualString) import MicroHs.List import MicroHs.Parse import MicroHs.StateIO@@ -27,8 +25,8 @@ import System.Environment import System.FilePath import System.IO+import System.IO.TimeMilli import Text.Printf-import Text.Read(readMaybe) --import System.IO.TimeMilli defaultEditor :: String@@ -40,6 +38,11 @@ isCache :: Cache, isSymbols :: Symbols, isStats :: Bool,+ isCompStats :: Bool,+ isType :: Bool,+ isColor :: Bool,+ isPrompt :: String,+ isPrompt2 :: String, isCComp :: (Int, TCState, TranslateMap), isHistory :: FilePath, isErrLine :: Int,@@ -55,10 +58,17 @@ mainInteractive :: Flags -> [String] -> IO () mainInteractive flags mdls = do- putStrLn $ "Welcome to interactive MicroHs, version " ++ showVersion version- when wantGMP $ putStrLn "Using GMP"+ when (verbosityGT flags (-1)) $ do+ putStrLn $ "Welcome to interactive MicroHs, version " ++ showVersion version+ putStrLn $ "Integer implemented with " +++ if wantGMP then "GMP" else if wantImath then "imath" else "Haskell"+{-+ bootTime <- getBootTimeMicro+ now <- getTimeMicro+ putStrLn $ "time=" ++ show (now - bootTime) ++ "us"+-} mhome <- lookupEnv "HOME"- let flags' = flags{ loading = True }+ let flags' = flags{ loading = verbosityGT flags (-1) } hist = maybe mhsi (</> mhsi) mhome mhsi = ".mhsi" _ <- runStateIO startInteractive =<< startIState flags' mdls hist@@ -80,7 +90,16 @@ ccash <- getCached flags cash <- loadEmbedded flags ccash let startMdl = preamble ++ unlines (map ("import " ++) mdls)- return $ IState startMdl flags cash noSymbols False (-1, error "tcstate", M.empty) hist 1 ""+{-+ bootTime <- getBootTimeMicro+ now <- getTimeMicro+ putStrLn $ "time=" ++ show (now - bootTime) ++ "us"+-}+ return $ IState { isLines = startMdl, isFlags = flags, isCache = cash+ , isSymbols = noSymbols, isStats = False, isCompStats = False+ , isType = False, isColor = False+ , isPrompt = "mhs> ", isPrompt2 = "mhs| ", isCComp = (-1, error "tcstate", translateMapEmpty)+ , isHistory = hist, isErrLine = 1, isErrFile = "" } noSymbols :: Symbols noSymbols = (stEmpty, stEmpty)@@ -101,30 +120,50 @@ is <- get liftIO $ maybeSaveCache (isFlags is) (isCache is) let line "" = return ()- line ('r':r) = do _ <- command r; return ()+ line (':':r) = do _ <- command r; return () line s = oneline s rc <- liftIO (catch (lines <$> readFile ".mhsi_rc") (\ (_ :: SomeException) -> return [])) mapM_ line rc- putStrLnI "Type ':quit' to quit, ':help' for help"+ when (verbosityGT (isFlags is) (-1)) $+ putStrLnI "Type ':quit' to quit, ':help' for help"+{-+ liftIO $ do bootTime <- getBootTimeMicro+ now <- getTimeMicro+ putStrLn $ "time=" ++ show (now - bootTime) ++ "us"+-} repl -repl :: I ()-repl = do+getLineI :: String -> I (Maybe String)+getLineI prompt = do mdls <- gets (cachedModuleNames . isCache) syms <- gets isSymbols stdinFlag <- gets (useStdin . isFlags) hist <- gets isHistory- ms <- liftIO $+ liftIO $ if stdinFlag then do- putStr "> "+ putStr prompt hFlush stdout es <- try getLine case es of Left (_::SomeException) -> return Nothing Right s -> return (Just s) else do- ms <- getInputLineHistComp (return . complete mdls syms) hist "> "+ ms <- getInputLineHistComp (return . complete mdls syms) hist prompt return (ms <|> Just "") -- ignore ^D++evalLine :: String -> I ()+evalLine s = do+ t1 <- liftIO getTimeMilli+ oneline s+ t2 <- liftIO getTimeMilli+ cstat <- gets isCompStats+ when cstat $+ putStrLnI $ "(" ++ show (t2 - t1) ++ "ms compile)"++repl :: I ()+repl = do+ prompt <- gets isPrompt+ ms <- getLineI prompt let bye = putStrLnI "Bye" case ms of Nothing -> bye@@ -135,30 +174,52 @@ c <- command r if c then repl else bye _ -> do- oneline s+ evalLine s repl +multiline :: I ()+multiline = loop []+ where+ loop acc = do+ prompt <- gets isPrompt2+ ms <- getLineI prompt+ case ms of+ Nothing -> return ()+ Just s+ | trim s == ":}" ->+ let blk = unlines (reverse acc)+ in unless (all isSpace blk) $ evalLine blk+ | otherwise -> loop (s : acc)+ trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace+ command :: String -> I Bool-command s =- let fw = (!!0) . words . fst in- case words s of- [] -> return True- c : ws ->- case filter (isPrefixOf c . fw) commands of- [] -> do- putStrLnI "Unrecognized command"- return True- [(_, cmd)] ->- cmd (unwords ws)- xs -> do- putStrLnI $ "Ambiguous command: " ++ unwords (map fw xs)- return True+command s = do+ let fw = (!!0) . words . fst+ -- split string into command and rest+ (c, rest) = break isSpace $ dropWhile isSpace s+ arg = dropWhile isSpace rest+ if null c then+ return True+ else+ case filter (isPrefixOf c . fw) commands of+ [] -> do+ putStrLnI "Unrecognized command"+ return True+ [(_, cmd)] -> do+ cmd arg+ xs -> do+ putStrLnI $ "Ambiguous command: " ++ unwords (map fw xs)+ return True commands :: [(String, String -> I Bool)] commands = [ ("quit quit MicroHs", const $ return False )+ , ("{ start multi-line input (end with :})", const $ do+ multiline+ return True+ ) , ("clear clear all definitions", const $ do updateLines (const preamble) modify $ \ is -> is{ isCache = emptyCache, isSymbols = noSymbols }@@ -222,18 +283,44 @@ setOptions :: String -> I () setOptions "" = do stats <- gets isStats+ compStats <- gets isCompStats+ prompt <- gets isPrompt+ prompt2 <- gets isPrompt2+ typ <- gets isType+ color <- gets isColor flags <- gets isFlags putStrLnI "Current flags: (use + to set and - to unset)"- putStrLnI $ " " ++ (if stats then "+" else "-") ++ "s"+ putStrLnI $ " " ++ (if stats then "+" else "-") ++ "s"+ putStrLnI $ " " ++ (if compStats then "+" else "-") ++ "c"+ putStrLnI $ " " ++ (if typ then "+" else "-") ++ "t"+ putStrLnI $ " " ++ (if color then "+" else "-") ++ "color" putStrLnI $ " path=" ++ intercalate ":" (srcPaths flags)+ putStrLnI $ " prompt=" ++ prompt+ putStrLnI $ " prompt-cont=" ++ prompt2 setOptions "+s" = do modify $ \ is -> is{ isStats = True } setOptions "-s" = do modify $ \ is -> is{ isStats = False }-setOptions s | Just p <- stripPrefix "path=" s =+setOptions "+c" = do+ modify $ \ is -> is{ isCompStats = True }+setOptions "-c" = do+ modify $ \ is -> is{ isCompStats = False }+setOptions "+t" = do+ modify $ \ is -> is{ isType = True }+setOptions "-t" = do+ modify $ \ is -> is{ isType = False }+setOptions "+color" = do+ modify $ \ is -> is{ isColor = True }+setOptions "-color" = do+ modify $ \ is -> is{ isColor = False }+setOptions ('p':'a':'t':'h':'=':p) = modify $ \ is -> is{ isFlags = (isFlags is){ srcPaths = splitColonPath p } }+setOptions ('p':'r':'o':'m':'p':'t':'=':p) =+ modify $ \ is -> is{ isPrompt = p }+setOptions ('p':'r':'o':'m':'p':'t':'-':'c':'o':'n':'t':'=':p) =+ modify $ \ is -> is{ isPrompt2 = p } setOptions _ =- putStrLnI "Unknown flag. Known flags: +s, -s"+ putStrLnI "Unknown flag. Known flags: +s, -s, +c, -c, +color, -color, path=PATH, prompt=STR, prompt2=STR" reload :: I () reload = do@@ -257,18 +344,9 @@ updateLines :: (String -> String) -> I () updateLines f = modify $ \ is -> is{ isLines = f (isLines is) } ---updateCache :: (Cache -> Cache) -> I ()---updateCache f = modify $ \ is -> is{ isCache = f (isCache is) }----setSyms :: Symbols -> I ()---setSyms syms = modify $ \ is -> is{ isSymbols = syms }- interactiveName :: String interactiveName = "Interactive" ---interactiveId :: Ident---interactiveId = mkIdent interactiveName- itName :: String itName = "_it" @@ -280,7 +358,7 @@ mkIt :: String -> String mkIt l =- itName ++ " = " ++ l ++ "\n"+ itName ++ " =\n" ++ unlines (map (" " ++) (lines l)) mkItIO :: Flags -> Bool -> String -> String mkItIO flgs stats l =@@ -295,69 +373,110 @@ "type " ++ itTypeName ++ " = " ++ l ++ "\n" err :: SomeException -> I ()-err e = do- let msg = displayException e- case parseError msg of- Just (f, l) -> modify $ \ is -> is{ isErrFile = f, isErrLine = l }- Nothing -> return ()- liftIO $ err' msg+err e =+ case fromException e of+ Just e' -> do+ case errLoc e' of+ Just loc@(SLoc f l _) | not (isNoSLoc loc) -> modify $ \ is -> is{ isErrFile = f, isErrLine = l }+ _ -> return ()+ color <- gets isColor+ err' $ formatMhsError color e'+ _ -> err' =<< wrapColor 91 ("*** Exception: " ++ displayException e) --- Try to find a file and line number--- XXX We should have a special exception instead of parsing the message string.-parseError :: String -> Maybe (FilePath, Int)-parseError s =- case words s of- "error:" : ('"' : sfile) : "line" : sline : _ |- Just file <- stripSuffix "\":" sfile,- Just line <- stripSuffix "," sline >>= readMaybe -> Just (file, line)- _ -> Nothing+err' :: String -> I ()+err' s = liftIO $ putStrLn s -err' :: String -> IO ()-err' s = putStrLn $ "*** Exception: " ++ s+wrapColor :: Int -> String -> I String+wrapColor c s = do+ color <- gets isColor+ return $ if color then "\ESC[" ++ show c ++ "m" ++ s ++ "\ESC[0m" else s +unindent :: String -> String+unindent s =+ let ls = lines s+ nonEmpty = filter (not . all isSpace) ls+ in case nonEmpty of+ [] -> ""+ _ ->+ let n = minimum (map (length . takeWhile (== ' ')) nonEmpty)+ in unlines (map (drop n) ls)++stripLet :: String -> Maybe String+stripLet ('l':'e':'t':r) | null r || isSpace (head r) = Just (unindent (" " ++ r))+stripLet _ = Nothing+ oneline :: String -> I () oneline aline = do- let line = dropWhile isSpace aline- ls <- gets isLines+ let line = unindent aline+ exprInput =+ case lines line of+ [l] -> l+ ls' -> "{\n" ++ unlines (map (" " ++) ls') ++ "}" stats <- gets isStats- let lls = ls ++ line ++ "\n"- def = do+ let def lls = do defTest <- tryCompile lls case defTest of Right _ -> do updateLines (const lls) Left e -> err e- expr = do+ expr ln = do -- t1 <- liftIO getTimeMilli flgs <- gets isFlags- exprTest <- tryCompile (ls ++ "\n" ++ mkItIO flgs stats line)+ ls <- gets isLines+ exprTest <- tryCompile (ls ++ "\n" ++ mkItIO flgs stats ln) case exprTest of Right (m, _) -> do- evalExpr m+ evalExpr ln m {- t2 <- liftIO getTimeMilli when (stats) $ liftIO $ putStrLn $ "total " ++ show (t2 - t1) ++ "ms" -}- Left e -> err e+ Left e -> do+ case fromException e of+ Just (MhsUndefError _ _ i) | let u = unQualString i, i /= u -> do+ -- We have an undefined qualified identifier.+ -- Add a qualified import for the module (if it doesn't exist),+ -- if that succeeds, rerun the expression.+ let mdl = fromJust $ stripSuffix ("." ++ u) i+ imp = "import qualified " ++ mdl+ if imp `elem` lines ls then+ -- Already imported+ err e+ else do+ let lls = ls ++ imp ++ "\n"+ defTest <- tryCompile lls+ case defTest of+ Right _ -> do+ -- Adding the import succeeded, so try again+ updateLines (const lls)+ expr ln+ Left _ -> err e+ _ -> err e -- A small hack, if we import something we have already imported -- in exactly the same way, we just reload instead. This is to avoid -- building up multiple imports.- if take 1 (words line) == ["import"] && line `elem` lines ls then+ ls <- gets isLines+ let trimmed = dropWhile isSpace aline+ if take 1 (words line) == ["import"] && trimmed `elem` lines ls then reload- else + else -- First try to parse as a definition,- tryParse pTopModule lls def $ \ _ ->+ tryParse pTopModule (ls ++ line) def $ \ _ -> -- if that fails, parse as an expression.- tryParse pExprTop line expr $- liftIO . err'+ tryParse pExprTop exprInput (const $ expr line) $ \ msg ->+ -- finally, try to strip an initial 'let' and parse as a definition+ let emsg = err' msg in+ case stripLet line of+ Just line' -> tryParse pTopModule (ls ++ line') def $ const emsg+ Nothing -> emsg tryParse :: forall a . -- Show a =>- P a -> String -> I () -> (String -> I ()) -> I ()+ P a -> String -> (String -> I ()) -> (String -> I ()) -> I () tryParse p s ok bad = case parse p "" s of- Right _ -> ok- Left e -> bad e+ Right _ -> ok s+ Left e -> bad (show e) tryCompile :: String -> I (Either SomeException ([LDef], TCState)) tryCompile file = trySIO $ compile file@@ -377,8 +496,8 @@ -- putStrLnI $ " tryCompile dmdl = " ++ (show $ tBindingsOf dmdl) return (tBindingsOf cmdl, tcstate') -evalExpr :: [LDef] -> I ()-evalExpr cmdl = do+evalExpr :: String -> [LDef] -> I ()+evalExpr ln cmdl = do -- putStrLnI $ "evalExpr: " ++ show cmdl (_, _, tmap) <- gets isCComp let ares = translateWithMap tmap (cmdl, Var $ mkIdent (interactiveName ++ "." ++ itIOName))@@ -390,7 +509,11 @@ mio <- liftIO $ try val case mio of Left e -> err e- Right _ -> return ()+ Right _ -> do+ typ <- gets isType+ when typ $ do+ liftIO $ putStr " :: "+ showType ln showType :: String -> I () showType line = do@@ -500,7 +623,9 @@ (ts, vs) <- gets isSymbols let i = mkIdent str case stLookup "type" i vs `alt` stLookup "value" i ts of- Left s -> putStrLnI s+ Left s -> do+ color <- gets isColor+ putStrLnI $ formatMhsError color s Right (Entry (EVar qi) _) | let loc@(SLoc f l _) = slocIdent qi, not (isNoSLoc loc) -> do ed <- getEditor _ <- liftIO $ system $ printf ed l f
@@ -4,18 +4,23 @@ LexState, lexTopLS, popLayout, lex, readInt,+ interpSkip, ) where import qualified Prelude(); import MHSPrelude hiding(lex)+import Data.ByteString.Char8(ByteString, pack) import Data.Char import Data.List-import Data.Maybe (fromJust)+import Data.Maybe (fromJust, fromMaybe)+import MicroHs.Error(mhsErrorLoc) import MicroHs.Ident-import Text.ParserComb(TokenMachine(..))-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import Mhs.Text.ParserComb(TokenMachine(..))+--import Debug.Trace data Token = TIdent SLoc [String] String -- identifier | TString SLoc String -- String literal+ | TBStr SLoc ByteString -- ByteString literal ("xxx"#)+ | TQual SLoc [String] -- qualified literal | TChar SLoc Char -- Char literal | TInt SLoc Integer -- Integer literal | TRat SLoc Rational -- Rational literal (i.e., decimal number)@@ -27,6 +32,10 @@ -- NOT YET @ for type app -- L for (# -- R for #)+ -- I interpolation start+ -- E interpolation end+ -- $ interpolation expr start+ -- % interpolation expr end | TError SLoc String -- lexical error | TBrace SLoc -- {n} in the Haskell report | TIndent SLoc -- <n> in the Haskell report@@ -34,10 +43,14 @@ | TEnd SLoc | TRaw [Token] -- deriving (Show)+instance Show Token where+ show = showToken showToken :: Token -> String showToken (TIdent _ ss s) = intercalate "." (ss ++ [s]) showToken (TString _ s) = show s+showToken (TBStr _ s) = show s+showToken (TQual _ ss) = concatMap (++ ".") ss showToken (TChar _ c) = show c showToken (TInt _ i) = show i showToken (TRat _ d) = show d@@ -45,6 +58,7 @@ | c == '>' = "} layout" | c == 'L' = "(#" | c == 'R' = "#)"+ | c == 'I' = "literal" | otherwise = [c] showToken (TError _ s) = s showToken (TBrace _) = "TBrace"@@ -53,6 +67,13 @@ showToken (TEnd _) = "EOF" showToken (TRaw _) = "TRaw" +-- Lex an operator (a sequence of operator characters)+lexOper :: SLoc -> String -> [Token]+lexOper loc (d:cs) =+ case span isOperChar cs of+ (ds, rs) -> TIdent loc [] (d:ds) : lex (addCol loc $ 1 + length ds) rs+lexOper loc [] = lex loc []+ incrLine :: SLoc -> SLoc incrLine (SLoc f l _) = let l' = l+1 in seq l' (SLoc f l' 1) @@ -83,32 +104,52 @@ (ds, rs) = span (== '-') cs isComm [] = True isComm (d:_) = not (isOperChar d)+lex loc ('s':'"':'"':'"':cs) = lexLitStr (lexInterpCont loc) loc (addCol loc 4) isTrip multiLine interpSkip cs+lex loc ('s':'"': cs) = lexLitStr (lexInterpCont loc) loc (addCol loc 2) isDQuote id interpSkip cs lex loc (d:cs) | isLower_ d = case spanIdent cs of (ds, rs) -> tIdent loc [] (d:ds) (lex (addCol loc $ 1 + length ds) rs) lex loc cs@(d:_) | isUpper d = upperIdent loc loc [] cs lex loc ('0':x:cs)- | toLower x == 'x' = lexNumBasePrefix x 16 isHexDigit loc cs- | toLower x == 'o' = lexNumBasePrefix x 8 isOctDigit loc cs- | toLower x == 'b' = lexNumBasePrefix x 2 isBinDigit loc cs+ | toLower x == 'x' = readNum isHexDigit 16 2 loc x cs+ | toLower x == 'o' = readNum isOctDigit 8 2 loc x cs+ | toLower x == 'b' = readNum isBinDigit 2 2 loc x cs where isBinDigit c = c == '0' || c == '1'-lex loc cs@(d:_) | isDigit d =- case readNumDec cs of- (Left n, len, rs) -> TInt loc n : lexSkipHash (addCol loc len) rs- (Right q, len, rs) -> TRat loc q : lexSkipHash (addCol loc len) rs+lex loc cs@(d:_) | isDigit d = readNum isDigit 10 0 loc '0' cs lex loc ('.':cs@(d:_)) | isLower_ d = TSpec loc '.' : lex (addCol loc 1) cs-lex loc ('(':dcs@(d:cs)) | d == '#' = TSpec loc 'L' : lex (addCol loc 2) cs- | otherwise = TSpec loc '(' : lex (addCol loc 1) dcs-lex loc ('#':')':cs) = TSpec loc 'R' : lex (addCol loc 2) cs+-- '(#' starts an unboxed tuple when its bracket is closed by '#)', as in+-- (# a, b #), (# #), (##) or (#-1, x #): the body is then lexed on its own,+-- so a '#)' met anywhere else is the operator '#' and ')', as in the section+-- (x #). Otherwise '(#' is '(' followed by an operator whose name begins+-- with '#': (#), (#>), or a section like (#> 1) or (# x).+lex loc ('(':dcs@(d:cs))+ | d == '#' =+ case hashClose (500::Int) (0::Int) $ lex (addCol loc 2) cs of+ Just ts -> TSpec loc 'L' : ts+ Nothing -> TSpec loc '(' : lexOper (addCol loc 1) dcs+ | otherwise = TSpec loc '(' : lex (addCol loc 1) dcs+ where -- Look for a closing #) within a small (n tokens) distance.+ -- The #) is recognized as two separate tokens and merged,+ -- otherwise #) could be accidentally recognized outside a (#.+ -- Nested (# #) are handled by the recursive call to lex above.+ -- Only recognize #) with matching parens, otherwise it cannot+ -- be the one we are looking for.+ -- The reason for a matching distance is to avoid eagerly lexing+ -- the entire file, instead of streaming as we want.+ hashClose 0 _ _ = Nothing -- Not found with 500 token+ hashClose _ _ [] = Nothing -- No more tokens+ hashClose _ p _ | p < 0 = Nothing -- Mismatched paren+ hashClose _ 0 (TIdent l1 [] "#" : TSpec l2 ')' : ts) | addCol l1 1 == l2 = -- Found adjacent # ) tokens+ Just $ TSpec l1 'R' : ts+ hashClose n p (t : ts) = (t:) <$> hashClose (n+1) (par t) ts+ where par (TSpec _ '(') = p+1+ par (TSpec _ ')') = p-1+ par _ = p -- Recognize #line 123 "file/name.hs" lex loc ('#':xcs) | (SLoc _ _ 1) <- loc, Just cs <- stripPrefix "line " xcs = case span (/= '\n') cs of- (line, rs) -> -- rs will contain the '\n', so subtract 1 below- let ws = words line- file = tail $ init $ ws!!1 -- strip the initial and final '"'- loc' = SLoc file (readInt (ws!!0) - 1) 1- in lex loc' rs+ (line, rs) -> lex (fromMaybe loc (lineDirective loc line)) rs | (SLoc _ 1 1) <- loc, take 1 xcs == "!" = -- It's a shebang (#!), ignore the rest of the line skipLine loc xcs@@ -118,37 +159,34 @@ TSpec loc c : let ts = lex (addCol loc 1) cs in if c == '\\' then tLam ts else ts-lex loc (d:cs) | isOperChar d =- case span isOperChar cs of- (ds, rs) -> TIdent loc [] (d:ds) : lex (addCol loc $ 1 + length ds) rs+lex loc dcs@(d:_) | isOperChar d = lexOper loc dcs lex loc (d:cs) | isSpec d = TSpec loc d : lex (addCol loc 1) cs-lex loc ('"':'"':'"':cs) = lexLitStr loc (addCol loc 3) (TString loc) isTrip multiLine cs- where isTrip ('"':'"':'"':_) = Just 3- isTrip _ = Nothing-lex loc ('"':cs) = lexLitStr loc (addCol loc 1) (TString loc) isDQuote id cs- where isDQuote ('"':_) = Just 1- isDQuote _ = Nothing-lex loc ('\'':cs) = lexLitStr loc (addCol loc 1) tchar isSQuote id cs+lex loc ('"':'"':'"':cs) = lexLitStr (lexStringCont loc) loc (addCol loc 3) isTrip multiLine (\ _ _ -> Nothing) cs+lex loc ('"':cs) = lexLitStr (lexStringCont loc) loc (addCol loc 1) isDQuote id (\ _ _ -> Nothing) cs+lex loc ('\'':cs) = lexLitStr lexCharCont loc (addCol loc 1) isSQuote id (\ _ _ -> Nothing) cs where isSQuote ('\'':_) = Just 1 isSQuote _ = Nothing- tchar [c] = TChar loc c- tchar _ = TError loc "Illegal Char literal"+ lexCharCont _ [c] loc' cs' = TChar loc c : lexSkipHash loc' cs'+ lexCharCont _ _ _ _ = [TError loc "Illegal Char literal"] lex loc (d:_) = [TError loc $ "Unrecognized input: " ++ show d] lex loc [] = [TEnd loc] +lexStringCont :: SLoc -> [[Token]] -> String -> SLoc -> String -> [Token]+lexStringCont loc _ s loc' ('#':cs) = TBStr loc (pack s) : lex (addCol loc' 1) cs+lexStringCont loc _ s loc' cs = TString loc s : lex loc' cs++isTrip, isDQuote :: String -> Maybe Int+isTrip ('"':'"':'"':_) = Just 3+isTrip _ = Nothing+isDQuote ('"':_) = Just 1+isDQuote _ = Nothing+ nested :: SLoc -> [Char] -> [Token] nested loc ('#':cs) = pragma loc cs nested loc cs = skipNest loc 1 cs --- lex a number of the form '0':x:cs-lexNumBasePrefix :: Char -> Integer -> (Char -> Bool) -> SLoc -> String -> [Token]-lexNumBasePrefix x base isDig loc cs =- case readIntBase base isDig cs of- Just (n, len, rs) -> TInt loc n : lexSkipHash (addCol loc $ len + 2) rs- Nothing -> TInt loc 0 : lexSkipHash (addCol loc 1) (x : cs)- -- Used to skip # after numbers lexSkipHash :: SLoc -> String -> [Token] lexSkipHash loc ('#':cs) = lexSkipHash (addCol loc 1) cs@@ -169,41 +207,54 @@ addDigit x d = x * base + toInteger (digitToInt d) -readNumDec :: String -> (Either Integer Rational, Int, String)-readNumDec cs =- case readIntDec cs of+readNum :: (Char -> Bool) -> Integer -> Int -> SLoc -> Char -> String -> [Token]+readNum isBaseDigit base prefixLen loc x cs =+ case readIntB cs of Just (n, nLen, rest) -> case rest of- '.' : rs@(d : _) | isDigit d ->- case readIntDec rs of+ '.' : rs@(d : _) | isBaseDigit d ->+ case readIntB rs of Just (m, mLen, rest') ->- let q = toRational n + toRational m * 10 ^^ negate (length $ filter isDigit $ take mLen rs)+ let q = toRational n + toRational m * fromInteger base ^^ negate (length $ filter isBaseDigit $ take mLen rs) in case expo rest' of- Just (e, eLen, rest'') -> (Right $ q * 10 ^^ e, nLen + 1 + mLen + eLen, rest'')- Nothing -> (Right q, nLen + 1 + mLen, rest')- Nothing -> (Left n, nLen, rest) -- this can't happen+ Just (ebase, e, eLen, rest'') -> TRat loc (q * fromInteger ebase ^^ e) : lexSkipHash (addCol loc (prefixLen + nLen + 1 + mLen + eLen)) rest''+ Nothing -> TRat loc q : lexSkipHash (addCol loc (prefixLen + nLen + 1 + mLen)) rest'+ Nothing -> TInt loc n : lexSkipHash (addCol loc (prefixLen + nLen)) rest -- this can't happen _ -> case expo rest of- Just (e, eLen, rest') -> (Right $ toRational n * 10 ^^ e, nLen + eLen, rest')- Nothing -> (Left n, nLen, rest)- Nothing -> error "impossible: first char is a digit"+ Just (ebase, e, eLen, rest') -> TRat loc (toRational n * fromInteger ebase ^^ e) : lexSkipHash (addCol loc (prefixLen + nLen + eLen)) rest'+ Nothing -> TInt loc n : lexSkipHash (addCol loc (prefixLen + nLen)) rest+ Nothing -> -- we have something like 0x with no digits. So this is not a number+ TInt loc 0 : lex (addCol loc 1) (x:cs) where readIntDec = readIntBase 10 isDigit+ readIntB = readIntBase base isBaseDigit -- try to read an exponent- expo :: String -> Maybe (Integer, Int, String)+ expo :: String -> Maybe (Integer, Integer, Int, String) expo = go 0 go len ('_' : xs) = go (len + 1) xs- go len (e:'-':xs@(d:_)) | toLower e == 'e' && isDigit d =+ -- e means exponent on base written in base+ go len (e:'-':xs@(d:_)) | toLower e == 'e' && not (isBaseDigit e) && isBaseDigit d =+ let (n, len', rest) = fromJust $ readIntB xs+ in Just (base, -n, len + 2 + len', rest)+ go len (e:'+':xs@(d:_)) | toLower e == 'e' && not (isBaseDigit e) && isBaseDigit d =+ let (n, len', rest) = fromJust $ readIntB xs+ in Just (base, n, len + 2 + len', rest)+ go len (e: xs@(d:_)) | toLower e == 'e' && not (isBaseDigit e) && isBaseDigit d =+ let (n, len', rest) = fromJust $ readIntB xs+ in Just (base, n, len + 1 + len', rest)+ -- p means exponent on base 2 written in base 10+ go len (e:'-':xs@(d:_)) | toLower e == 'p' && isDigit d = let (n, len', rest) = fromJust $ readIntDec xs- in Just (-n, len + 2 + len', rest)- go len (e:'+':xs@(d:_)) | toLower e == 'e' && isDigit d =+ in Just (2, -n, len + 2 + len', rest)+ go len (e:'+':xs@(d:_)) | toLower e == 'p' && isDigit d = let (n, len', rest) = fromJust $ readIntDec xs- in Just (n, len + 2 + len', rest)- go len (e: xs@(d:_)) | toLower e == 'e' && isDigit d =+ in Just (2, n, len + 2 + len', rest)+ go len (e: xs@(d:_)) | toLower e == 'p' && isDigit d = let (n, len', rest) = fromJust $ readIntDec xs- in Just (n, len + 1 + len', rest)+ in Just (2, n, len + 1 + len', rest) go _ _ = Nothing -- Skip a {- -} style comment@@ -230,52 +281,64 @@ tIndent ts@(TIndent _ : _) = ts tIndent ts = TIndent (tokensLoc ts) : ts -lexLitStr :: SLoc -> SLoc -> (String -> Token) -> (String -> Maybe Int) -> (String -> String) -> String -> [Token]-lexLitStr oloc loc mk end post acs = loop loc [] acs- where loop l rs cs | Just k <- end cs = mk (decodeEscs $ post $ reverse rs) : lex (addCol l k) (drop k cs)- loop l rs ('\\':c:cs) | isSpace c = remGap l rs cs- loop l rs ('\\':'^':'\\':cs) = loop (addCol l 3) ('\\':'^':'\\':rs) cs -- special hack for unescaped \- loop l rs ('\\':cs) = loop' (addCol l 1) ('\\':rs) cs- loop l rs cs = loop' l rs cs+lexLitStr :: ([[Token]] -> String -> SLoc -> String -> [Token]) ->+ SLoc -> SLoc -> (String -> Maybe Int) ->+ (String -> String) -> (SLoc -> String -> Maybe ([Token], String, SLoc)) -> String -> [Token]+lexLitStr cont oloc loc end post interp acs = loop loc [] [] acs+ where+ loop :: SLoc -> String -> [[Token]] -> String -> [Token]+ loop l rs tss cs | Just k <- end cs = cont (reverse tss) (decodeEscs l $ post $ reverse rs) (addCol l k) (drop k cs)+ | Just (ts, cs', l') <- interp l cs = loop l' (chMark : rs) (ts : tss) cs'+ loop l rs tss ('\\':c:cs) | isSpace c = remGap l rs tss cs+ loop l rs tss ('\\':'^':'\\':cs) = loop (addCol l 3) ('\\':'^':'\\':rs) tss cs -- special hack for unescaped \+ loop l rs tss ('\\':cs) = loop' (addCol l 1) ('\\':rs) tss cs+ loop l rs tss cs = loop' l rs tss cs - loop' l rs ('\n' :cs) = loop (incrLine l) ( '\n':rs) cs- loop' l rs ('\t' :cs) = loop (tabCol l) ( '\t':rs) cs- loop' l rs ('\r' :cs) = loop l rs cs- loop' l rs (c:cs) = loop (addCol l 1) ( c:rs) cs- loop' _ _ [] = [TError oloc "unterminated Char/String literal"]--- foo xs = trace (show ("foo", loc, take 20 acs, xs)) xs+ loop' :: SLoc -> String -> [[Token]] -> String -> [Token]+ loop' l rs tss ('\n' :cs) = loop (incrLine l) ( '\n':rs) tss cs+ loop' l rs tss ('\t' :cs) = loop (tabCol l) ( '\t':rs) tss cs+ loop' l rs tss ('\r' :cs) = loop l rs tss cs+ loop' l rs tss (c:cs) = loop (addCol l 1) ( c:rs) tss cs+ loop' _ _ _ [] = [TError oloc "unterminated Char/String literal"] - remGap l rs ('\\':cs) = loop (addCol l 1) rs cs- remGap l rs ('\n':cs) = remGap (incrLine l) ('\n':rs) cs- remGap l rs ('\t':cs) = remGap (tabCol l) ('\t':rs) cs- remGap l rs ('\r':cs) = remGap l rs cs- remGap l rs (' ' :cs) = remGap (addCol l 1) rs cs- remGap l _ _ = --errorMessage oloc "bad string gap"- mhsError (prettyShow l ++ ": bad string gap")+ remGap :: SLoc -> String -> [[Token]] -> String -> [Token]+ remGap l rs tss ('\\':cs) = loop (addCol l 1) rs tss cs+ remGap l rs tss ('\n':cs) = remGap (incrLine l) ('\n':rs) tss cs+ remGap l rs tss ('\t':cs) = remGap (tabCol l) ('\t':rs) tss cs+ remGap l rs tss ('\r':cs) = remGap l rs tss cs+ remGap l rs tss (' ' :cs) = remGap (addCol l 1) rs tss cs+ remGap l _ _ _ = --errorMessage oloc "bad string gap"+ mhsErrorLoc l ": bad string gap" -decodeEscs :: String -> String-decodeEscs [] = []-decodeEscs ('\\':cs) = decodeEsc cs-decodeEscs (c:cs) = c : decodeEscs cs+chMark :: Char+chMark = '\xffff' -- reserved, and will not occur in text -decodeEsc :: String -> String-decodeEsc ('n':cs) = '\n' : decodeEscs cs-decodeEsc ('a':cs) = '\a' : decodeEscs cs-decodeEsc ('b':cs) = '\b' : decodeEscs cs-decodeEsc ('f':cs) = '\f' : decodeEscs cs-decodeEsc ('r':cs) = '\r' : decodeEscs cs-decodeEsc ('t':cs) = '\t' : decodeEscs cs-decodeEsc ('v':cs) = '\v' : decodeEscs cs-decodeEsc ('&':cs) = decodeEscs cs-decodeEsc ('x':cs) = conv 16 0 cs-decodeEsc ('o':cs) = conv 8 0 cs-decodeEsc ('^':c:cs) | '@' <= c && c <= '_' = chr (ord c - ord '@') : decodeEscs cs-decodeEsc cs@(c:_) | isDigit c = conv 10 0 cs-decodeEsc (c1:c2:c3:cs) | Just c <- lookup [c1,c2,c3] ctlCodes = c : decodeEscs cs-decodeEsc (c1:c2:cs) | Just c <- lookup [c1,c2] ctlCodes = c : decodeEscs cs-decodeEsc (c :cs) = c : decodeEscs cs-decodeEsc [] = mhsError "Bad \\ escape"+decodeEscs :: SLoc -> String -> String+decodeEscs _ [] = []+decodeEscs loc ('\\':cs) = decodeEsc loc cs+decodeEscs loc (c:cs) = c : decodeEscs loc cs +decodeEsc :: SLoc -> String -> String+decodeEsc loc ('n':cs) = '\n' : decodeEscs loc cs+decodeEsc loc ('a':cs) = '\a' : decodeEscs loc cs+decodeEsc loc ('b':cs) = '\b' : decodeEscs loc cs+decodeEsc loc ('f':cs) = '\f' : decodeEscs loc cs+decodeEsc loc ('r':cs) = '\r' : decodeEscs loc cs+decodeEsc loc ('t':cs) = '\t' : decodeEscs loc cs+decodeEsc loc ('v':cs) = '\v' : decodeEscs loc cs+decodeEsc loc ('&':cs) = decodeEscs loc cs+decodeEsc loc ('x':cs) = conv loc 16 0 cs+decodeEsc loc ('o':cs) = conv loc 8 0 cs+decodeEsc loc ('^':c:cs) | '@' <= c && c <= '_' = chr (ord c - ord '@') : decodeEscs loc cs+decodeEsc loc cs@(c:_) | isDigit c = conv loc 10 0 cs+decodeEsc loc (c1:c2:c3:cs) | Just c <- lookup [c1,c2,c3] ctlCodes = c : decodeEscs loc cs+decodeEsc loc (c1:c2:cs) | Just c <- lookup [c1,c2] ctlCodes = c : decodeEscs loc cs+decodeEsc loc ('\\':cs) = '\\' : decodeEscs loc cs+decodeEsc loc ('\'':cs) = '\'' : decodeEscs loc cs+decodeEsc loc ('"':cs) = '"' : decodeEscs loc cs+decodeEsc loc (c:_) = mhsErrorLoc loc $ "Bad \\ escape: " ++ show c+decodeEsc _ _ = undefined+ -- Nobody uses these, but it's part of the Haskell Report so... ctlCodes :: [(String, Char)] ctlCodes =@@ -289,10 +352,14 @@ ("FS", '\FS'), ("GS", '\GS'), ("RS", '\RS'), ("US", '\US'), ("SP", '\SP'), ("DEL", '\DEL')] -conv :: Int -> Int -> String -> String-conv b r (c:ds) | isHexDigit c && n < b = conv b (r * b + n) ds+-- Stop as soon as the code point is too big, so that it cannot overflow.+conv :: SLoc -> Int -> Int -> String -> String+conv loc b r (c:ds) | isHexDigit c && n < b =+ let r' = r * b + n+ in if r' > 0x10ffff then mhsErrorLoc loc "Bad \\ escape: character code is too big"+ else conv loc b r' ds where n = digitToInt c-conv _ r ds = chr r : decodeEscs ds+conv loc _ r ds = chr r : decodeEscs loc ds -- Multiline string literals multiLine :: String -> String@@ -347,17 +414,28 @@ isSpecSing '~' = True isSpecSing _ = False +-- Called with current location, starting location, qualifiers so far (reverse),+-- and string to parse. upperIdent :: SLoc -> SLoc -> [String] -> String -> [Token] --upperIdent l c qs acs | trace (show (l, c, qs, acs)) False = undefined upperIdent loc sloc qs acs = case span isIdentChar acs of (ds, rs) -> case rs of- '.':cs@(d:_) | isUpper d -> upperIdent (addCol loc $ 1 + length ds) sloc (ds:qs) cs+ -- qualified string, maybe with interpolation+ '.':cs@(d1:d2:_) | d1 == '"' || d1 == 's' && d2 == '"' -- M."..." or M.s"..."+ -> TQual sloc (reverse (ds:qs)) : lex (addCol loc $ 1 + length ds) cs++ '.':cs@(d:_) -- either another module name or a qualified uppercase identifier+ | isUpper d -> upperIdent (addCol loc $ 1 + length ds) sloc (ds:qs) cs+ -- qualified lower case identifier | isLower_ d -> ident (spanIdent cs)+ -- qualified operator | isOperChar d -> ident (span isOperChar cs)+ -- could add qualified numbers here where ident (xs, ys) = tIdent sloc (reverse (ds:qs)) xs (lex (addCol loc $ 1 + length ds + length xs) ys)+ -- Identifier with trailing # '#':_ -> mk (ds ++ hs) rs' where (hs, rs') = span (== '#') rs _ -> mk ds rs where@@ -394,6 +472,8 @@ tokensLoc :: [Token] -> SLoc tokensLoc (TIdent loc _ _:_) = loc tokensLoc (TString loc _ :_) = loc+tokensLoc (TBStr loc _ :_) = loc+tokensLoc (TQual loc _ :_) = loc tokensLoc (TChar loc _ :_) = loc tokensLoc (TInt loc _ :_) = loc tokensLoc (TRat loc _ :_) = loc@@ -405,25 +485,42 @@ tokensLoc (TEnd loc :_) = loc tokensLoc _ = mkLocEOF -readBase :: Integer -> String -> Integer-readBase b = foldl (\ r c -> r * b + toInteger (digitToInt c)) 0- readInt :: String -> Int-readInt = fromInteger . readBase 10+readInt = foldl (\ r c -> r * 10 + digitToInt c) 0 -- XXX This is a pretty hacky recognition of pragmas. pragma :: SLoc -> [Char] -> [Token] pragma loc cs = let skip = skipNest loc 1 ('#':cs)- in case words cs of- p : _ | map toUpper p == "SOURCE" -> TPragma loc p : skip+ (p, rest) = break isSpace (dropWhile isSpace cs)+ in case map toUpper p of+ "SOURCE" -> TPragma loc p : skip -- hsc2hs generates LINE pragmas- p : ln@(_:_) : fn : _ | map toUpper p == "LINE", all isDigit ln ->- let f = tail (init fn)- l = readInt ln - 1- in seq l $ skipNest (SLoc f l 1) 1 ('#':cs)+ "LINE" | Just loc' <- lineDirective loc rest -> skipNest loc' 1 ('#':cs) _ -> skip +-- Parse the arguments of a '#line 123 "file/name.hs"' directive or a LINE pragma.+-- The directive describes the following line, and the '\n' that ends it+-- will increment the line number, so subtract 1 here.+-- The file name is everything between the first and the last '"', taken+-- verbatim: the tools that generate these directives (cpphs, hsc2hs, and+-- runCPPString) write the name without any escaping, so it may contain spaces.+-- Without a quoted file name the current file name is kept.+-- Only the directive's own line is examined.+lineDirective :: SLoc -> String -> Maybe SLoc+lineDirective (SLoc file _ _) cs =+ case span isDigit (dropWhile isSpace (takeWhile (/= '\n') cs)) of+ (ln@(_:_), rs) ->+ let l = readInt ln - 1+ f = fromMaybe file (quoted rs)+ in seq l $ Just (SLoc f l 1)+ _ -> Nothing+ where+ quoted rs =+ case break (== '"') rs of+ (_, '"':qs) | (_, '"':nm) <- break (== '"') (reverse qs) -> Just (reverse nm)+ _ -> Nothing+ -- | This is the magical layout resolver, straight from the Haskell report. -- https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3 -- The first argument to layoutLS is the input token stream.@@ -488,3 +585,89 @@ lexTopLS :: FilePath -> String -> LexState lexTopLS f s = LS $ layoutLS (lexStart $ lex (SLoc f 1 1) s) [] -- error $ show $ map showToken $ lex (SLoc f 1 1) s++-------++-- String interpolation proceeds in several steps.+-- * interpSkip is used to skip over ${expr} parts, and insert '\xffff' for each interpoland.+-- * do regular string processing of that string (gaps, escapes, multiline, etc)+-- * splice the interpolands back into the processed strings, breaking it at '\xffff'++-- Recognize ${ and find the corresponding }.+-- Return the (yokens for characters skipped, rest, new location)+-- Complicated because we want to keep all characters inside ${...},+-- but also correctly identifying the closing }, whilst tracking the location.+interpSkip :: SLoc -> String -> Maybe ([Token], String, SLoc)+interpSkip aloc ('$':'{':acs) =+-- trace ("interpSkip " ++ acs) $+ skip 0 "" aloc' acs+ where aloc' = addCol aloc 2+ skip :: Int -> String -> SLoc -> String -> Maybe ([Token], String, SLoc)+ skip 0 rs l ('}':cs) = Just (recLex aloc' (reverse rs), cs, addCol l 1)+ skip n rs l ('{':'-':cs) = skipn n ('-':'{':rs) l 1 cs+ skip n rs l ('-':'-':cs) = skipl n ('-':'-':rs) l cs+ skip n rs l ('{':cs) = skip (n+1) ('{':rs) (addCol l 1) cs+ skip n rs l ('}':cs) = skip (n-1) ('}':rs) (addCol l 1) cs+ skip n rs l ('"':'"':'"':cs) = skipss n ('"':'"':'"':rs) (addCol l 3) cs+ skip n rs l ('"':cs) = skips n ('"' :rs) (addCol l 1) cs+ skip n rs l ('\'':cs) = skipc n ('\'' :rs) (addCol l 1) cs+ skip n rs l ('\t':cs) = skip n ('\t' :rs) (tabCol l) cs+ skip n rs l ('\n':cs) = skip n ('\n' :rs) (incrLine l) cs+ skip n rs l ('\r':cs) = skip n rs l cs+ skip n rs l (c:cs) = skip n (c :rs) (addCol l 1) cs+ skip _ _ _ [] = Nothing++ -- Skip """...""" string. Keep all the characters, and keep track of position.+ skipss n rs l ('\\':c :cs) = skipss n (c:'\\' :rs) (addCol l 2) cs+ skipss n rs l ('"':'"':'"':cs) = skip n ('"':'"':'"':rs) (addCol l 3) cs+ skipss n rs l (c :cs) = skipss n (c :rs) (addCol l 1) cs+ skipss n rs l [] = skip n rs l []++ -- Skip "..." string. Keep all the characters, and keep track of position.+ skips n rs l ('"' :cs) = skip n ('"' :rs) (addCol l 1) cs+ skips n rs l ('\\':c:cs) = skips n (c:'\\':rs) (addCol l 2) cs+ skips n rs l ( c:cs) = skips n (c :rs) (addCol l 1) cs+ skips n rs l [] = skip n rs l []++ -- Skip '...' string. Keep all the characters, and keep track of position.+ skipc n rs l ('\'' :cs) = skip n ('\'' :rs) (addCol l 1) cs+ skipc n rs l ('\\':c:cs) = skipc n (c:'\\':rs) (addCol l 2) cs+ skipc n rs l ( c:cs) = skipc n (c :rs) (addCol l 1) cs+ skipc n rs l [] = skip n rs l []++ -- Skip -- comment. Keep all the characters, and keep track of position.+ skipl n rs l cs@('\n':_) = skip n rs l cs+ skipl n rs l (c:cs) = skipl n (c:rs) (addCol l 1) cs+ skipl n rs l [] = skip n rs l []++ -- Skip {- -} comment. Keep all the characters, and keep track of position.+ skipn :: Int -> String -> SLoc -> Int -> String -> Maybe ([Token], String, SLoc)+ skipn n rs l 0 cs = skip n rs l cs+ skipn n rs l d ('{':'-':cs) = skipn n ('-':'{':rs) (addCol l 2) (d + 1) cs+ skipn n rs l d ('-':'}':cs) = skipn n ('}':'-':rs) (addCol l 2) (d - 1) cs+ skipn n rs l d ('\n':cs) = skipn n ('\n' :rs) (incrLine l) d cs+ skipn n rs l d ('\t':cs) = skipn n ('\t' :rs) (tabCol l) d cs+ skipn n rs l d ('\r':cs) = skipn n rs l d cs+ skipn n rs l d (c:cs) = skipn n (c :rs) (addCol l 1) d cs+ skipn n rs l _ [] = skip n rs l []++ -- lex an expression to be interpolated. Add interpolation markers.+ recLex :: SLoc -> String -> [Token]+ recLex l s = [TSpec l '$'] ++ init ls ++ [TSpec ll '%']+ where ls = lex l s+ ll = tokensLoc [last ls]++interpSkip _ _ = Nothing++lexInterpCont :: SLoc -> [[Token]] -> String -> SLoc -> String -> [Token]+lexInterpCont loc atss s loc' cs = mkInterp loc atss s ++ lex loc' cs++-- Splice in the interpolated tokens into the string+mkInterp :: SLoc -> [[Token]] -> String -> [Token]+mkInterp l atss as = TSpec l 'I' : splice atss [] as+ where splice _ rs [] = mkS rs ++ [TSpec l 'E']+ splice (ts:tss) rs (c:cs) | c == chMark = mkS rs ++ ts ++ splice tss [] cs+ splice tss rs (c:cs) = splice tss (c:rs) cs++ mkS "" = []+ mkS rs = [TString l (reverse rs)]
@@ -70,6 +70,9 @@ deleteAllsBy :: forall a . (a -> a -> Bool) -> [a] -> [a] -> [a] deleteAllsBy eq = foldl (flip (deleteAllBy eq)) +deleteAlls :: forall a . Eq a => [a] -> [a] -> [a]+deleteAlls = deleteAllsBy (==)+ padLeft :: Int -> String -> String padLeft n s = replicate (n - length s) ' ' ++ s
@@ -8,7 +8,6 @@ import qualified Data.ByteString.Char8 as BS import Data.Char import Data.List-import Data.Version import Data.Maybe import System.Environment import MicroHs.Compile@@ -16,6 +15,7 @@ import MicroHs.Config import MicroHs.Desugar(LDef) import MicroHs.EncodeData(encList)+import MicroHs.Error import MicroHs.Exp(Exp(Var, Lit)) import MicroHs.Expr(Lit(LInt, LForImp, LBStr)) import MicroHs.ExpPrint@@ -37,8 +37,8 @@ import System.IO import System.IO.Serialize import System.IO.TimeMilli-import System.IO.Transducers(addLZ77, addBase64)-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import System.IO.Transducers(addLZMA, addBase64)+import Mhs.Text.PrettyPrint.HughesPJLiteClass(prettyShow) main :: IO () main = do@@ -54,11 +54,12 @@ -- Flag decoding happens twice, because we need to decode the flags to know -- how to read the config file, but we also need the config file for the -- default package search path.- let (cflags, _, _) = decodeArgs defaultFlags{ mhsdir = mhsDir } [] args -- decode flags so we can read the config file- conf <- readConfig cflags+ let (cflags, cmdls, _) = decodeArgs defaultFlags{ mhsdir = mhsDir } [] args -- decode flags so we can read the config file+ cflags' = if null cmdls && null (cArgs cflags) then cflags{interactive = True} else cflags+ conf <- readConfig cflags' let paths = splitColonPath $ fromMaybe ('$':mHSPKG) $ lookup "mhs" conf >>= lookup "packageDbPath" (eflags, mdls, rargs) = decodeArgs dflags [] args -- decode flags for real- where dflags = defaultFlags{ pkgPaths = paths, srcPaths = srcs, mhsdir = mhsDir }+ where dflags = defaultFlags{ pkgPaths = paths, srcPaths = srcs, mhsdir = mhsDir, interactive = interactive cflags' } paths' <- nub . filter (not . null) . splitColonPath <$> expandPath mpkg (intercalate ":" $ pkgPaths eflags) let flags = eflags{ config = conf, pkgPaths = paths' } @@ -66,15 +67,15 @@ putStrLn $ "flags = " ++ show flags preload' <- mapM (findAPackage flags) (preload flags) let flags' = flags { preload = preload' }- withArgs rargs $+ withArgs rargs $ reportErrors $ case () of- _ | Just p <- listPkg flags' -> mainListPkg flags p+ _ | Just p <- listPkg flags' -> mainListPkg flags' p _ | Just p <- buildPkg flags' -> mainBuildPkg flags' p mdls _ | Just s <- evalArg flags' -> mainEvalArg flags' s mdls+ _ | noCode flags' -> mainNoCode flags' mdls _ | installPkg flags' -> mainInstallPackage flags' mdls- _ | null mdls && null (cArgs flags')-> mainInteractive flags' []- _ | null mdls -> mainCompileC flags' [] "" _ | interactive flags' -> mainInteractive flags' mdls+ _ | null mdls -> mainCompileC flags' [] "" _ | [s] <- mdls -> mainCompile flags' (mkIdentSLoc (SLoc "command-line" 0 0) s) _ -> mhsError usage @@ -82,7 +83,7 @@ mHSPKG = "MHSPKG" usage :: String-usage = "Usage: mhs [-h|?] [--help] [--version] [--numeric-version] [-v] [-q] [-l] [-s] [-r] [-C[R|W]] [-XCPP] [-DDEF] [-IPATH] [-T] [-z] [-b64] [-iPATH] [-oFILE] [-a[PATH]] [-L[FILE|PKG]] [-PPKG] [-Q PKG [DIR]] [-pFILE] [-tTARGET] [-optc OPTION] [-optl OPTION] [--interactive] [-eEXPR] [-ECMD] [-ddump-PASS] [--embed-packages PKG:...] [--embed-ffis PKG:...] [MODULENAME...|FILE]"+usage = "Usage: mhs [-h|?] [--help] [--version] [--numeric-version] [-v] [-q] [-l] [-s] [-r] [-C[R|W][PATH]] [-XCPP] [-DDEF] [-IPATH] [-T] [-z] [-b64] [-iPATH] [-oFILE] [-a[PATH]] [-L[FILE|PKG]] [-PPKG] [-Q PKG [DIR]] [-pFILE] [-tTARGET] [-optc OPTION] [-optl OPTION] [--interactive] [-eEXPR] [-ECMD] [-ddump-PASS] [--embed-packages PKG:...] [--embed-ffis PKG:...] [MODULENAME...|FILE]" longUsage :: String longUsage = usage ++ "\nOptions:\n" ++ details@@ -92,9 +93,9 @@ \-a Clear package search path\n\ \-aPATH Add PATH to package search path\n\ \-b64 Base64 encode the combinator code\n\- \-C Read and write compilation cache\n\- \-CR Read compilation cache\n\- \-CW Write compilation cache\n\+ \-C[PATH] Read and write compilation cache, optionally at PATH (default .mhscache)\n\+ \-CR[PATH] Read compilation cache, optionally from PATH\n\+ \-CW[PATH] Write compilation cache, optionally to PATH\n\ \-c Do not generate executable\n\ \-Dxxx Pass -Dxxx to cpphs\n\ \-ddump-PASS Debug, print AST after PASS\n\@@ -103,6 +104,7 @@ \-eEXPR Evaluate EXPR\n\ \-embed-ffis PKG* Embed packages FFI stubs in mhs binary\n\ \-embed-packages PKG* Embed packages in mhs binary\n\+ \-fno-code Do not generate code\n\ \-F Run a preprocessor\n\ \-h Print usage\n\ \--help Print this message\n\@@ -151,6 +153,9 @@ "-CR" -> decodeArgs f{readCache = True} mdls args "-CW" -> decodeArgs f{writeCache = True} mdls args "-C" -> decodeArgs f{readCache = True, writeCache = True} mdls args+ '-':'C':'R':s@(_:_) -> decodeArgs f{readCache = True, cacheName = s} mdls args+ '-':'C':'W':s@(_:_) -> decodeArgs f{writeCache = True, cacheName = s} mdls args+ '-':'C':s@(_:_) -> decodeArgs f{readCache = True, writeCache = True, cacheName = s} mdls args "-T" -> decodeArgs f{useTicks = True} mdls args "-XCPP" -> decodeArgs f{doCPP = True} mdls args "-z" -> decodeArgs f{compress = True} mdls args@@ -175,7 +180,7 @@ -> decodeArgs f{embedFFIs = embedFFIs f ++ splitColonPath s} mdls args' "--embed-packages" | s : args' <- args, let ps = splitColonPath s -> decodeArgs f{embedPkgs = embedPkgs f ++ ps, embedFFIs = embedFFIs f ++ ps} mdls args'-+ "-fno-code" -> decodeArgs f{noCode = True} mdls args '-':'i':[] -> decodeArgs f{srcPaths = []} mdls args '-':'i':s -> decodeArgs f{srcPaths = srcPaths f ++ splitColonPath s} mdls args '-':'o':s -> decodeArgs f{output = s} mdls args@@ -195,6 +200,8 @@ '-':_ -> mhsError $ "Unknown flag: " ++ arg ++ "\n" ++ usage _ | arg `hasTheExtension` ".c" || arg `hasTheExtension` ".o" || arg `hasTheExtension` ".a" -> decodeArgs f{cArgs = cArgs f ++ [arg]} mdls args+ | arg `hasTheExtension` ".js"+ -> decodeArgs f{jsFiles = jsFiles f ++ [arg]} mdls args | otherwise -> decodeArgs f (mdls ++ [arg]) args where@@ -205,7 +212,8 @@ let cfFilePath = mhsdir flags </> "mhs.conf" exists <- doesFileExist cfFilePath if not exists then do- when (verbosityGT flags (-1)) $+ -- If interactive, we don't need the conf file+ when (verbosityGT flags (-1) && not (interactive flags)) $ putStrLn $ "Warning: cannot find config file: " ++ cfFilePath return [] else do@@ -218,14 +226,14 @@ return [] Right cfs -> do when (verbosityGT flags 1) $- putStrLn $ "Read targets file. Possible targets: " ++ show (map fst cfs)+ putStrLn $ "Read config file " ++ show cfFilePath ++ ". Possible targets: " ++ show (map fst cfs) return cfs findSection :: Flags -> IO [(Key, Value)] findSection flags = do case lookup (target flags) (config flags) of Nothing ->- error $ "Cannot find config section: " ++ target flags ++ ", available=" ++ unwords (map fst (config flags))+ mhsError $ "Cannot find config section: " ++ target flags ++ ", available=" ++ unwords (map fst (config flags)) Just cs -> do when (verbosityGT flags 0) $ putStrLn $ "Found target: " ++ show (target flags, cs)@@ -261,6 +269,19 @@ when (verbose flags > 0) $ putStrLn $ "Compression time " ++ show (t2 - t1) ++ " ms" +mainNoCode :: Flags -> [String] -> IO ()+mainNoCode flags amns = do+ when (verbose flags > 0) $+ putStrLn "Building"+ let mns = map mkIdent amns+ t1 <- getTimeMilli+ cash <- compileMany flags mns emptyCache+ let mdls = getCompMdls cash+ force mdls `seq` putStrLn "No code generated"+ t2 <- getTimeMilli+ when (verbose flags > 0) $+ putStrLn $ "Build time " ++ show (t2 - t1) ++ " ms"+ splitNameVer :: String -> (String, Version) splitNameVer s = case span (\ c -> isDigit c || c == '.') (reverse s) of@@ -339,7 +360,7 @@ let mainName = qualIdent rmn (mkIdent "main") cmdl = (allDefs, if noLink flags then Lit (LInt 0) else Var mainName)- (forExps, outCMdl@(outDefs, _)) = renumberCMdl cmdl+ (forExps, outCMdl@(outDefs, _xxx), labelNames) = renumberCMdlNames cmdl outData = toStringCMdl outCMdl numOutDefs = length outData numDefs = length allDefs@@ -350,16 +371,8 @@ putStrLn "linked:"; printLDefs (removeUnused cmdl) dumpIf flags Dtoplevel $ do putStrLn "toplevel:"; printLDefs allDefs- if runIt flags then do- if compiledWithMhs then do- let prg = translateAndRun cmdl- prg-{-- else if compiledWithGhc then- withMhsContext $ \ ctx -> do- run ctx outData--}- else mhsError "The -r flag currently only works with mhs and ghc"+ if runIt flags then+ translateAndRun outCMdl else do seq (length outData) (return ()) t2 <- getTimeMilli@@ -368,7 +381,7 @@ when (speed flags) $ do let fns = filter (isSuffixOf ".hs") $ map (slocFile . slocIdent) $ cachedNonPkgModuleNames cash- locs <- sum . map (length . lines) <$> mapM readFile fns+ locs <- fromIntegral . sum . map (length . lines) <$> mapM readFile fns putStrLn $ show (locs * 1000 `div` (t2 - t0)) ++ " lines/s" -- embedPkg are the packages we are embedding in the binary.@@ -393,14 +406,17 @@ if outFile `hasTheExtension` ".comb" || outFile `hasTheExtension` ".combffi" then do h <- openBinaryFile outFile WriteMode h' <- if base64 flags then do addBase64 h else return h- h'' <- if compress flags then do hPutChar h' 'z'; addLZ77 h' else return h'+ h'' <- if compress flags then do hPutChar h' 'z'; addLZMA h' else return h' hPutStr h'' outData when (outFile `hasTheExtension` ".combffi") $ do -- add FFI info- hPutStrLn h'' "\n#####"+ hPutStrLn h'' "\n#####FFI" let putFFI (_, Lit (LForImp _ i n t)) = hPutStrLn h'' $ n ++ " = " ++ show i ++ " :: " ++ prettyShow t putFFI _ = return () mapM_ putFFI outDefs+ -- add the names of the definitions, after their labels+ hPutStrLn h'' "#####Names"+ mapM_ (\ (l, i) -> hPutStrLn h'' $ l ++ " " ++ showIdent i) labelNames hClose h'' else if outFile `hasTheExtension` ".c" then writeFile outFile cCode@@ -422,15 +438,24 @@ let dir = mhsdir flags incDirs = map (convertToInclude "include") ppkgs cDirs = map (convertToInclude "cbits") ppkgs+ jsDirs = map (convertToInclude "jsbits") ppkgs outFile = output flags incDirs' <- filterM doesDirectoryExist incDirs cDirs' <- filterM doesDirectoryExist cDirs+ jsDirs' <- filterM doesDirectoryExist jsDirs+ -- JavaScript files from packages (jsbits directory) and the command line (FILE.js)+ pkgJs <- concat <$> mapM (\ d -> map (d </>) . filter (".js" `isSuffixOf`) . sort <$> listDirectory d) jsDirs' -- print (map fst $ getPathPkgs cash, (incDirs, incDirs'), (cDirs, cDirs')) let incs = unwords $ map ("-I" ++) incDirs' defs = "-D__MHS__" cpps = concatMap (\ a -> "'" ++ a ++ "' ") (cppArgs flags) -- Use all CPP args from the command line rtdir = dir ++ "/src/runtime" sect <- findSection flags+ let vjs = getSectionKey sect "js" ""+ jsFs = pkgJs ++ jsFiles flags+ jsOpts = if null vjs then [] else concatMap (\ f -> [vjs, f]) jsFs+ when (not (null jsFs) && null vjs && verbosityGT flags 0) $+ putStrLn $ "Warning: JavaScript files ignored, target " ++ target flags ++ " has no js option: " ++ unwords jsFs let optls = concatMap pkgOptl poptls -- optl from pkgs vcc = getSectionKey sect "cc" "cc" vccflags = getSectionKey sect "ccflags" ""@@ -447,6 +472,7 @@ cArgs flags ++ lArgs flags ++ optls +++ jsOpts ++ map (++ "/*.c") cDirs' ++ [ rtdir </> "main.c" | not (noLink flags) ] ++ [ rtdir </> "eval.c",@@ -535,31 +561,28 @@ let ps = encList $ map (Lit . LBStr) bss rep ie@(i, _) | i == mkIdent "MicroHs.Embed.packages" = (i, ps) | otherwise = ie- + when (verbosityGT flags 0) $ putStrLn $ "Embedded " ++ show (embedPkgs flags) return $ map rep ds expandPath :: Maybe FilePath -> FilePath -> IO FilePath-expandPath (Just s) f = do- m <- lookupEnv mHSPKG- when (isNothing m) $- setEnv mHSPKG s- setEnv "VERSION" mhsVersion- expandEnv f-expandPath Nothing f = do- setEnv "VERSION" mhsVersion- expandEnv f+expandPath = expandEnv . expandEnvLookup -expandEnv :: String -> IO String-expandEnv "" = return ""-expandEnv ('$':cs) = do+expandEnvLookup :: Maybe FilePath -> String -> IO String+expandEnvLookup (Just s) mpkg = fromMaybe s <$> lookupEnv mpkg+expandEnvLookup _ "VERSION" = return mhsVersion+expandEnvLookup _ name = fromMaybe "" <$> lookupEnv name++expandEnv :: (String -> IO String) -> String -> IO String+expandEnv _ "" = return ""+expandEnv f ('$':cs) = do let (name, rest) = span isMacroName cs isMacroName c = isAlphaNum c || c == '_'- repl <- fromMaybe "" <$> lookupEnv name- (repl ++) <$> expandEnv rest-expandEnv (c:cs) =- (c :) <$> expandEnv cs+ repl <- f name+ (repl ++) <$> expandEnv f rest+expandEnv f (c:cs) =+ (c :) <$> expandEnv f cs copyFileBS :: FilePath -> FilePath -> IO () copyFileBS src dst = BS.readFile src >>= BS.writeFile dst
@@ -137,6 +137,50 @@ identFunPtr :: Ident identFunPtr = mkIdentB "Primitives.FunPtr" +-- The newtypes for C types, each with its C type and the primitive type+-- that represents it (which must match the newtype's definition).+-- The type of a foreign import keeps these newtypes, while all others+-- are expanded, because a call through a function pointer needs the+-- exact C types.+cNewtypes :: [(String, (String, String))]+cNewtypes =+ [ (c "CBool", ("uint8_t", w))+ , (c "CChar", ("char", i))+ , (c "CSChar", ("signed char", i))+ , (c "CUChar", ("unsigned char", w))+ , (c "CWchar", ("wchar_t", i))+ , (c "CShort", ("short", i))+ , (c "CUShort", ("unsigned short", w))+ , (c "CInt", ("int", i))+ , (c "CUInt", ("unsigned int", w))+ , (c "CLong", ("long", i))+ , (c "CULong", ("unsigned long", w))+ , (c "CPtrdiff", ("ptrdiff_t", w))+ , (c "CSize", ("size_t", w))+ , (c "CSSize", ("intptr_t", i)) -- ssize_t is not standard C+ , (c "CLLong", ("long long", i64))+ , (c "CULLong", ("unsigned long long", w64))+ , (c "CIntPtr", ("intptr_t", i))+ , (c "CUIntPtr", ("uintptr_t", w))+ , (c "CIntMax", ("intmax_t", i64))+ , (c "CUIntMax", ("uintmax_t", w64))+ , (c "CClock", ("clock_t", i))+ , (c "CTime", ("time_t", i))+ , (c "CFloat", ("float", "Primitives.Float"))+ , (c "CDouble", ("double", "Primitives.Double"))+ , ("Data.Int.Int8.Int8", ("int8_t", i))+ , ("Data.Int.Int16.Int16", ("int16_t", i))+ , ("Data.Int.Int32.Int32", ("int32_t", i))+ , ("Data.Word.Word8.Word8", ("uint8_t", w))+ , ("Data.Word.Word16.Word16", ("uint16_t", w))+ , ("Data.Word.Word32.Word32", ("uint32_t", w))+ ]+ where c s = "Foreign.C.Types." ++ s+ i = "Primitives.Int"+ w = "Primitives.Word"+ i64 = "Primitives.Int64"+ w64 = "Primitives.Word64"+ identStablePtr :: Ident identStablePtr = mkIdentB "Foreign.StablePtr.StablePtr"
@@ -6,7 +6,6 @@ packageModules, ) where import qualified Prelude(); import MHSPrelude-import Data.Version import MicroHs.Desugar(LDef) import MicroHs.Expr(IdentModule) import MicroHs.Ident(Ident)
@@ -7,14 +7,18 @@ import Control.Monad import Control.Monad.Fail import Data.Char+import Data.Either import Data.List-import Text.ParserComb as P+import Data.Maybe+import Mhs.Text.ParserComb as P+import MicroHs.Builtin(builtinMdl, mkBuiltin)+--import MicroHs.Error(MhsError(MhsSyntaxError)) import MicroHs.Lex import MicroHs.List import MicroHs.Expr hiding (getSLoc) import qualified MicroHs.Expr as E import MicroHs.Ident-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import Mhs.Text.PrettyPrint.HughesPJLiteClass(prettyShow) --import Debug.Trace -- Hugs can't define the efficient *>@@ -32,11 +36,11 @@ P a -> FilePath -> String -> a parseDie p fn file = case parse p fn file of- Left msg -> mhsError msg+ Left err -> throw err Right a -> a parse :: forall a . -- (Show a) =>- P a -> FilePath -> String -> Either String a+ P a -> FilePath -> String -> Either MhsError a parse p fn file = let { ts = lexTopLS fn file } in case runPrsr p ts of@@ -81,12 +85,20 @@ pModule = do pKeyword "module" mn <- pUQIdentA- exps <- (lpar *> sepEndBy pExportItem comma <* rpar)+ exps <- (lpar *> sepSEBy pExportItem comma <* rpar) <|> pure [ExpModule mn] pKeyword "where" defs <- pBlock pDef pure $ EModule mn exps defs +-- Optional leading and trailing+sepSEBy :: P a -> P b -> P [a]+sepSEBy p sep = (sep *> sepEndBy1 p sep) <|> sepEndBy p sep++-- Optional leading and trailing, non-empty+sepSEBy1 :: P a -> P b -> P [a]+sepSEBy1 p sep = (sep *> sepEndBy1 p sep) <|> sepEndBy1 p sep+ pModuleEmpty :: P EModule pModuleEmpty = do defs <- pBlock pDef@@ -291,16 +303,45 @@ pParens :: forall a . P a -> P a pParens p = lpar *> p <* rpar +-- Parse a qualifier used for literals+pLitQual :: P Ident+pLitQual = do+ let+ is (TQual l ss) = Just $ mkIdentSLoc l (intercalate "." ss)+ is _ = Nothing+ satisfyM "QualString" is+ pLit :: P Expr pLit = do+ mqual <- optional pLitQual let- is (TString loc s) = Just (ELit loc (LStr s))- is (TChar loc a) = Just (ELit loc (LChar a))- is (TInt loc i) = Just (ELit loc (LInteger i))- is (TRat loc d) = Just (ELit loc (LRat d))+ elit = maybe ELit (flip EQLit) mqual+ is (TString loc s) = Just (elit loc (LStr s))+ is (TBStr loc s) = Just (elit loc (LBStr s))+ is (TChar loc a) = Just (elit loc (LChar a))+ is (TInt loc i) = Just (elit loc (LInteger i))+ is (TRat loc d) = Just (elit loc (LRat d)) is _ = Nothing- satisfyM "literal" is+ satisfyM "literal" is <|> pInterpolate mqual +pInterpolate :: Maybe Ident -> P Expr+pInterpolate mqual = do+ -- XXX locations+ let mdl = fromMaybe builtinMdl mqual+ fin = EVar $ qualIdent mdl $ mkIdent "interpolateFinalize"+ raw = EVar $ qualIdent mdl $ mkIdent "interpolateRaw"+ val = EVar $ qualIdent mdl $ mkIdent "interpolateValue"+ app = EVar $ qualIdent mdl $ mkIdent "interpolateAppend"+ emp = EVar $ qualIdent mdl $ mkIdent "interpolateEmpty"+ let pStr = satisfyM "string" is+ where is (TString loc s) = Just $ EApp raw $ ELit loc (LStr s)+ is _ = Nothing+ pExp = pSpec '$' *> (EApp val <$> pExpr) <* pSpec '%'+ pSpec 'I'+ frags <- many (pStr <|> pExp)+ pSpec 'E'+ pure $ EApp fin $ foldr (eApp2 app) emp frags+ pNumLit :: P Expr pNumLit = guardM pLit isNum where isNum (ELit _ (LInteger _)) = True@@ -361,7 +402,7 @@ pBlock :: forall a . P a -> P [a] pBlock p = pBraces body- where body = sepBy p (some semi) <* optional semi+ where body = optional semi *> sepBy p (some semi) <* optional semi pDef :: P EDef@@ -372,33 +413,31 @@ <|> Type <$> (pKeyword "type" *> pLHS) <*> (equal *> pType) <|> Import <$> (pKeyword "import" *> pImportSpec) <|> ForImp <$> (pKeyword "foreign" *> pKeyword "import" *> pCallConv)- <*> (optional pSafety *> optional pString) <*> pLIdent <*> (dcolon *> pType)+ <*> (pSafety <|> pure Safe) <*> optional pString <*> pLIdent <*> (dcolon *> pType) <|> ForExp <$> (pKeyword "foreign" *> pKeyword "export" *> pCallConv) <*> optional pString <*> pFExpr <*> (dcolon *> pType) <|> Class <$> (pKeyword "class" *> pContext) <*> pLHS <*> pFunDeps <*> pWhere pClsBind <|> Instance <$> (pKeyword "instance" *> pType) <*> pWhere pInstBind <*> (pWhere pInstBind <|> pure [])- <|> Default <$> (pKeyword "default" *> optional clsSym) <*> pParens (sepBy pType comma)+ <|> Default <$> (pKeyword "default" *> optional clsSym) <*> pParens (sepSEBy pType comma) <|> KindSign <$> (pKeyword "type" *> pTypeIdentSym) <*> (dcolon *> pKind) <|> mkPattern <$> (pKeyword "pattern" *> pPatSyn)- <|> Sign <$> (pKeyword "pattern" *> sepBy1 pUIdentSym comma <* dcolon) <*> pType+ <|> Sign <$> (pKeyword "pattern" *> sepEndBy1 pUIdentSym comma <* dcolon) <*> pType <|> StandDeriving<$> (pKeyword "deriving" *> pStrat) <*> pure 0 <*> (pKeyword "instance" *> pType)- <|> noop <$ (pKeyword "type" <* pKeyword "role" <* pTypeIdentSym <*- some (pKeyword "nominal" <|> pKeyword "phantom" <|> pKeyword "representational"))+ <|> roleInstance <$> (pKeyword "type" *> pKeyword "role" *> pTypeIdentSym) <*> some pRole where- pFunDeps = (bar *> sepBy1 pFunDep comma) <|> pure []+ pFunDeps = (bar *> sepSEBy1 pFunDep comma) <|> pure [] pFunDep = (,) <$> some pLIdent <*> (pSRArrow *> some pLIdent) pField = guardM pFields ((== 1) . either length length) clsSym = do s <- pUIdentSym <|> pLIdentSymbol; guard (unIdent s /= "()"); return s mkPattern (lhs, pat, meqn) = Pattern lhs pat meqn- noop = Infix (AssocLeft, 0) [] -- harmless definition pStrat = (DerVia <$> (pKeyword "via" *> pType)) <|> pSimpleStrat pFExpr = EVar <$> (pLQIdentSym <|> pUQIdentSym) - pSafety = pKeyword "unsafe" <|> pKeyword "safe" <|> pKeyword "interruptible"+ pSafety = (Unsafe <$ pKeyword "unsafe") <|> (Safe <$ pKeyword "safe") <|> (Interruptible <$ pKeyword "interruptible") pCallConv :: P CallConv pCallConv = (Cccall <$ pKeyword "ccall") <|> (Ccapi <$ pKeyword "capi") <|> (Cjavascript <$ pKeyword "javascript")@@ -486,7 +525,7 @@ pDeriving = pKeyword "deriving" *> ( (flip Deriving <$> pDer <*> pVia) <|> (Deriving <$> pSimpleStrat <*> pDer) ) where pDer = map ((,) 0) <$>- ( pParens (sepBy pType comma)+ ( pParens (sepSEBy pType comma) <|> ((:[]) <$> pAType) ) pVia = DerVia <$> (pKeyword "via" *> pType) @@ -495,6 +534,34 @@ <|> (DerAnyClass <$ pKeyword "anyclass") <|> pure DerNone -- List has 0 or 1 elements+data Role = RNominal | RRepresentational | RPhantom++pRole :: P Role+pRole = (RNominal <$ pKeyword "nominal") <|> (RRepresentational <$ pKeyword "representational") <|> (RPhantom <$ pKeyword "phantom")++-- A role annotation 'type role T r1 ... rn' is turned into an instance+-- instance (c1, ..., cn) => Coercible (T a1 ... an) (T b1 ... bn)+-- where ci is 'ai ~ bi' for nominal, 'Coercible ai bi' for representational,+-- and absent for phantom.+roleInstance :: Ident -> [Role] -> EDef+roleInstance t rs =+ let loc = E.getSLoc t+ vars c = [ EVar (mkIdentSLoc loc (c : show i)) | i <- [1 .. length rs] ]+ as = vars 'a'+ bs = vars 'b'+ coercible = eAppI2 (mkBuiltin loc "Coercible")+ ctx = [ c | (r, a, b) <- zip3 rs as bs, c <- role r a b ]+ role RNominal a b = [eAppI2 (mkIdentSLoc loc "~") a b]+ role RRepresentational a b = [coercible a b]+ role RPhantom _ _ = []+ hd = coercible (eApps (EVar t) as) (eApps (EVar t) bs)+ implies c = eAppI2 (mkIdentSLoc loc "=>") c hd+ inst = case ctx of+ [] -> hd+ [c] -> implies c+ _ -> implies (ETuple ctx)+ in Instance inst [] []+ pContext :: P [EConstraint] pContext = (pCtx <* pDRArrow) <|> pure [] where@@ -515,7 +582,7 @@ pFields :: P (Either [SType] [(Ident, SType)])-pFields = Right <$> (pSpec '{' *> (concatMap flat <$> sepBy ((,) <$> (sepBy1 pLIdentSym comma <* dcolon) <*> pSType) comma <* pSpec '}'))+pFields = Right <$> (pSpec '{' *> (concatMap flat <$> sepSEBy ((,) <$> (sepEndBy1 pLIdentSym comma <* dcolon) <*> pSType) comma <* pSpec '}')) <|> Left <$> many pSAType where flat (is, t) = [ (i, t) | i <- is ] @@ -544,13 +611,13 @@ pImportSpec = let pSource = (ImpBoot <$ pPragma "SOURCE") <|> pure ImpNormal- pQual = True <$ pKeyword "qualified"+ pQualified = True <$ pKeyword "qualified" -- the 'qualified' can occur before or after the module name- pQId = ((,) <$> pQual <*> pUQIdentA)- <|> ((\ a b -> (b,a)) <$> pUQIdentA <*> (pQual <|> pure False))+ pQId = ((,) <$> pQualified <*> pUQIdentA)+ <|> ((\ a b -> (b,a)) <$> pUQIdentA <*> (pQualified <|> pure False)) imp a (b, c) = ImportSpec a b c in imp <$> pSource <*> pQId <*> optional (pKeyword "as" *> pUQIdent) <*>- optional ((,) <$> ((True <$ pKeyword "hiding") <|> pure False) <*> pParens (sepEndBy pImportItem comma))+ optional ((,) <$> ((True <$ pKeyword "hiding") <|> pure False) <*> pParens (sepSEBy pImportItem comma)) pImportItem :: P ImportItem pImportItem =@@ -563,7 +630,7 @@ impType i is = ImpTypeSome i is pConList :: P [Ident]-pConList = sepBy (pDotDot <|> pQIdent <|> pUIdentSpecial <|> pParens pSymOper) comma+pConList = sepSEBy (pDotDot <|> pQIdent <|> pUIdentSpecial <|> pParens pSymOper) comma where pDotDot = dotDotIdent <$ pSymbol ".." dotDotIdent :: Ident@@ -702,7 +769,7 @@ pEqnsU :: Ident -> P (Ident, [Eqn]) pEqnsU i = pEqns' pUIdentSym pUOper (\ n _ -> i == n) --- pEqns' is used to parse oridinary function definitions as well+-- pEqns' is used to parse ordinary function definitions as well -- as the 'constructor' of pattern synonyms, which has an upper case identifier. pEqns' :: P Ident -> P Ident -> (Ident -> Int -> Bool) -> P (Ident, [Eqn]) pEqns' ident oper test = do@@ -724,13 +791,11 @@ pEqnLHS :: P Ident -> P Ident -> P (Ident, [EPat]) pEqnLHS ident oper =- pOpLHS+ ((\ p1 i p2 -> (i, [p1,p2])) <$> pPatApp <*> oper <*> pPatApp) <|> ((,) <$> ident <*> many pAPat) <|>- ((\ (i, ps1) ps2 -> (i, ps1 ++ ps2)) <$> pParens pOpLHS <*> many pAPat)- where- pOpLHS = (\ p1 i p2 -> (i, [p1,p2])) <$> pPatApp <*> oper <*> pPatApp+ ((\ (i, ps1) ps2 -> (i, ps1 ++ ps2)) <$> pParens (pEqnLHS ident oper) <*> many pAPat) pAlts :: P () -> P EAlts pAlts sep = do@@ -744,7 +809,7 @@ <|> ((\ e -> [([], e)]) <$> (sep *> pExpr)) pAlt :: P () -> P EAlt-pAlt sep = (,) <$> (bar *> sepBy1 pStmt comma) <*> (sep *> pExpr)+pAlt sep = (,) <$> (bar *> sepSEBy1 pStmt comma) <*> (sep *> pExpr) pWhere :: P EBind -> P [EBind] pWhere pb =@@ -836,18 +901,20 @@ pOperCommaNoMinus :: P Ident pOperCommaNoMinus = guardM pOperComma (/= mkIdent "-") --- XXX combine pUpdate and pSelects+-- Updates and selections can be mixed, as in GHC: e.a{x = 1}.b+-- A run of selections becomes one ESelect. pAExpr :: P Expr pAExpr = do ee <- pAExpr'- us <- many pUpdate- ss <- many pSelect- let sel e | null ss = e- | otherwise = EApp (ESelect ss) e- pure $ sel (foldl EUpdate ee us)+ ps <- many (Left <$> pUpdate <|> Right <$> pSelect)+ let post e [] = e+ post e (Left us : r) = post (EUpdate e us) r+ post e r = let (ss, r') = span isRight r+ in post (EApp (ESelect (rights ss)) e) r'+ pure $ post ee ps pUpdate :: P [EField]-pUpdate = pSpec '{' *> sepBy pEField comma <* pSpec '}'+pUpdate = pSpec '{' *> sepSEBy pEField comma <* pSpec '}' where pEField = do fs <- (:) . unQualIdent <$> pLQIdentSym <*> many pSelect@@ -868,7 +935,7 @@ <|> (lpar *> (ESectL <$> pExprOp) <*> (pOperComma <* rpar)) <|> (lpar *> (ESectR <$> pOperCommaNoMinus) <*> (pExprOp <* rpar)) <|> (lpar *> (ESelect <$> some pSelect <* rpar))- <|> (pKeyword "_primitive" *> (ELit noSLoc . LPrim <$> pString))+ <|> (pKeyword "_primitive" *> (ELit noSLoc . LPrim . mkPrimOp <$> pString)) <|> (pSpec '@' *> (ETypeArg <$> pAType)) <|> (pSpec 'L' *> (uTuple <$> sepBy pExpr comma <* pSpec 'R')) <|> pUSummand pExpr@@ -881,15 +948,17 @@ let pMore = do e2 <- pExpr- ((\ es -> LList (e1:e2:es)) <$> some (comma *> pExpr))+ ((\ es -> LList (e1:e2:es)) <$> (some (comma *> pExpr) <* optional comma) ) <|> (LFromThenTo e1 e2 <$> (pSymbol ".." *> pExpr)) <|> (LFromThen e1 e2 <$ pSymbol "..")- <|> pure (LList [e1,e2])- (comma *> pMore)- <|> (LCompr e1 <$> (bar *> sepBy1 pStmt comma))+ <|> (LList [e1,e2] <$ optional comma) -- [e1, e2,]+ (comma *> (pMore <|> pure (LList [e1]))) -- [e1,]+ <|> (LCompr e1 <$> (bar *> sepSEBy1 pStmt comma)) <|> (LFromTo e1 <$> (pSymbol ".." *> pExpr)) <|> (LFrom e1 <$ pSymbol "..") <|> pure (LList [e1])+ <|> -- List with initial comma+ (comma *> (LList <$> sepEndBy1 pExpr comma)) pExprOp :: P Expr pExprOp = pOperators pOper pExprArgNeg@@ -923,13 +992,19 @@ pBind' :: P EBind pBind' = uncurry Fcn <$> pEqns- <|> Sign <$> (sepBy1 pLIdentSym comma <* dcolon) <*> pType- <|> Infix <$> ((,) <$> pAssoc <*> pPrec) <*> sepBy1 pTypeOper comma+ <|> Sign <$> (sepEndBy1 pLIdentSym comma <* dcolon) <*> (pType <* notEqual)+ <|> Infix <$> ((,) <$> pAssoc <*> pPrec) <*> sepEndBy1 pTypeOper comma where pAssoc = (AssocLeft <$ pKeyword "infixl") <|> (AssocRight <$ pKeyword "infixr") <|> (AssocNone <$ pKeyword "infix") dig (TInt _ ii) | 0 <= i && i <= 9 = Just i where i = fromInteger ii dig _ = Nothing pPrec = satisfyM "digit" dig <|> pure 9+ notEqual :: P ()+ notEqual = do+ t <- nextToken+ case t of+ TSpec _ '=' -> Control.Monad.Fail.fail "notEqual"+ _ -> return () -- Bindings allowed in a class definition pClsBind :: P EBind@@ -941,7 +1016,7 @@ pInstBind :: P EBind pInstBind = uncurry Fcn <$> pEqns- <|> Sign <$> (sepBy1 pLIdentSym comma <* dcolon) <*> pType+ <|> Sign <$> (sepEndBy1 pLIdentSym comma <* dcolon) <*> pType ------------- @@ -983,11 +1058,6 @@ ------------- -formatFailed :: LastFail Token -> String+formatFailed :: LastFail Token -> MhsError formatFailed (LastFail _ ts msgs) =- let- sloc = tokensLoc ts- in- showSLoc sloc ++ ":\n"- ++ " found: " ++ head (map showToken ts ++ ["EOF"]) ++ "\n"- ++ " expected: " ++ unwords (nub msgs)+ MhsSyntaxError (tokensLoc ts) (head (map showToken ts ++ ["EOF"])) (unwords (nub msgs))
@@ -10,7 +10,6 @@ ) where import qualified Prelude(); import MHSPrelude import Control.Applicative-import Control.Exception import Control.Monad import Data.Functor hiding(unzip)
@@ -1,8 +1,10 @@ module MicroHs.SymTab( Entry(..), entryType, SymTab,+ STLookup(..), stEmpty, stLookup,+ stLookupST, stLookupGlbUnqMany, stFromList, stInsertGlbU,@@ -21,11 +23,11 @@ import Control.Applicative import Data.List import MicroHs.Builtin(builtinMdl)-import MicroHs.Expr(Expr(..), EType, conIdent)+import MicroHs.Expr(Expr(..), EType, conIdent, getSLoc) import MicroHs.Ident(Ident, showIdent, unIdent, mkIdentSLoc, slocIdent, isUpperX) import MicroHs.List import qualified MicroHs.IdentMap as M-import Text.PrettyPrint.HughesPJLiteClass+import Mhs.Text.PrettyPrint.HughesPJLiteClass -- Symbol table --@@ -101,17 +103,25 @@ stLookupGlbUnqMany :: Ident -> SymTab -> Maybe [Entry] stLookupGlbUnqMany i (SymTab _ ug _) = M.lookup i ug -stLookup :: String -> Ident -> SymTab -> Either String Entry-stLookup msg i (SymTab l ug qg) =+data STLookup = STNone | STOne Entry | STMany [Entry]++stLookupST :: Ident -> SymTab -> STLookup+stLookupST i (SymTab l ug qg) = case lookup i l of- Just e -> Right e+ Just e -> STOne e Nothing -> case M.lookup i ug <|> M.lookup i qg <|> M.lookup (hackBuiltin i) ug of- Just [e] -> Right e- Just es -> Left $ "ambiguous " ++ msg ++ ": " ++ showIdent i ++ " " ++- showListS showIdent [ getIdent e | Entry e _ <- es ]- Nothing -> Left $ "undefined " ++ msg ++ ": " ++ showIdent i+ Just [e] -> STOne e+ Just es -> STMany es+ Nothing -> STNone++stLookup :: String -> Ident -> SymTab -> Either MhsError Entry+stLookup msg i st =+ case stLookupST i st of+ STNone -> Left $ MhsUndefError (getSLoc i) msg (showIdent i) -- ++ "\n" ++ show lenv ++ "\n" ++ show genv+ STMany es -> Left $ MhsAmbigError (getSLoc i) msg (showIdent i) (showListS showIdent [ getIdent e | Entry e _ <- es ])+ STOne e -> Right e -- When a module uses 'import quakified Prelude()' the Mhs.Builtin (aka B@) will -- also not be imported. So as a last recourse, look for the identifier
@@ -12,11 +12,12 @@ import MicroHs.Expr import MicroHs.Ident import qualified MicroHs.IdentMap as M-import qualified MicroHs.IntMap as IM+import qualified Mhs.IntMap as IM import MicroHs.Names import MicroHs.State import MicroHs.SymTab import System.IO.Unsafe(unsafePerformIO)+import Mhs.Text.PrettyPrint.HughesPJLiteClass import Unsafe.Coerce import Debug.Trace @@ -77,6 +78,13 @@ instance NFData ValueExport where rnf (ValueExport a b) = rnf a `seq` rnf b +instance Pretty ValueExport where+ pPrintPrec l _ (ValueExport i (Entry e t)) = pPrintPrec l 0 i <+> text "=" <+> pPrintPrec l 0 e <+> text "::" <+> pPrintPrec l 0 t++instance Pretty TypeExport where+ pPrintPrec l _ (TypeExport i (Entry e t) vs) =+ pPrintPrec l 0 i <+> text "=" <+> pPrintPrec l 0 e <+> text "::" <+> pPrintPrec l 0 t <+> pPrintPrec l 0 vs+ ----------------------------------------------- -- Tables @@ -145,6 +153,12 @@ ----------------------------------------------- -- TCState+-- Where we are while type checking, for error messages.+data Ctx+ = CtxExpr Expr -- checking this literal+ | CtxBind Ident -- in the definition of this identifier+ deriving (Show)+ data TCState = TC { moduleName :: IdentModule, -- current module name unique :: Int, -- unique number@@ -163,7 +177,8 @@ ArgDicts -- dictionary arguments ), constraints :: Constraints, -- constraints that have to be solved- defaults :: Defaults -- current defaults+ defaults :: Defaults, -- current defaults+ importQuals :: [IdentModule] -- qualifiers of imported names, and the current module } deriving (Show)
@@ -2,341 +2,66 @@ -- See LICENSE file for full license. {-# OPTIONS_GHC -Wno-unused-imports #-} module MicroHs.Translate(+ TranslateMap, translateMapEmpty, translate,- TranslateMap, translateMap, translateWithMap, translateAndRun ) where import qualified Prelude(); import MHSPrelude-import Data.ByteString.Internal(ByteString)+import Control.Concurrent(yield)+import Data.ByteString(ByteString)+import Data.ByteString.Char8(pack) import Data.Maybe import Data.String import Unsafe.Coerce -import PrimTable import MicroHs.Desugar(LDef, encodeInteger)+import MicroHs.Error(mhsError) import MicroHs.Expr import MicroHs.Exp-import MicroHs.ExpPrint(encodeString)+import MicroHs.ExpPrint(toStringCMdl, renumberCMdlM) import MicroHs.Ident import qualified MicroHs.IdentMap as M-import Text.PrettyPrint.HughesPJLiteClass(prettyShow)+import System.IO.Serialize(readSerializedBS)+import System.IO.Unsafe(unsafePerformIO)+import Mhs.Text.PrettyPrint.HughesPJLiteClass(prettyShow)+--import Debug.Trace -translateAndRun :: ([LDef], Exp) -> IO ()-translateAndRun defs = do- let prog = unsafeCoerce (translate defs)- prog+newtype TranslateMap = TM (M.Map Exp) -type TranslateMap = M.Map AnyType+translateMapEmpty :: TranslateMap+translateMapEmpty = TM M.empty -trLookup :: TranslateMap -> Ident -> AnyType-trLookup mp n = fromMaybe (errorMessage (getSLoc n) $ "translate: not found " ++ showIdent n) $ M.lookup n mp+-- Convert the expression e in the environment ds into its value+translate :: ([LDef], Exp) -> AnyType+translate = translateWithMap translateMapEmpty +-- Convert a bunch of definitions to a TranslateMap translateMap :: [LDef] -> TranslateMap-translateMap ds =- let mp = M.fromList [(n, translateExp mp d) | (n, d) <- ds ]- in mp--translateExp :: TranslateMap -> Exp -> AnyType-translateExp mp e = trans (trLookup mp) e--translateWithMap :: TranslateMap -> ([LDef], Exp) -> AnyType-translateWithMap mp (ds, e) =- let mp' = foldr (\ (i, d) -> M.insert i (translateExp mp' d)) mp ds- in translateExp mp' e+translateMap = TM . M.fromList -translate :: ([LDef], Exp) -> AnyType-translate (ds, e) = translateExp (translateMap ds) e+-- Convert and assume the converted value is of type IO() and run it+translateAndRun :: ([LDef], Exp) -> IO ()+translateAndRun defs = do+ let prog = unsafeCoerce (translate defs) :: IO ()+ -- Translate the program, and then yield, so that the program starts+ -- with a new time slice, as it would when run on its own.+ -- Otherwise its thread switches depend on how much of the slice+ -- the compiler used, e.g., if the compilation cache was used.+ prog `seq` yield+ prog -trans :: (Ident -> AnyType) -> Exp -> AnyType-trans r ae =- case ae of- Var n -> r n- App f a -> unsafeCoerce (trans r f) (trans r a)- Lit (LInt i) -> unsafeCoerce i- Lit (LInt64 i) -> unsafeCoerce i- Lit (LDouble i) -> unsafeCoerce i- Lit (LFloat i) -> unsafeCoerce i- Lit (LStr s) -> trans r (encodeString s)- Lit (LBStr s) -> unsafeCoerce s- Lit (LPrim p) -> fromMaybe (error $ "trans: no primop " ++ show p) $ lookup p primTable- Lit (LInteger i) -> trans r (encodeInteger i)- Lit f@(LForImp _ _ _ _) -> trans r (App (Lit (LPrim "dynsym")) (Lit (LStr (drop 1 $ showLit f))))- _ -> error $ "trans: impossible: " ++ prettyShow ae+--------------------------------------------------------------------- --- Use linear search in this table.--- 99% of the hits are among the combinators.-primTable :: [(String, AnyType)]-primTable = [- ("B", _primitive "B"),- ("O", _primitive "O"),- ("K", _primitive "K"),- ("C'", _primitive "C'"),- ("C", _primitive "C"),- ("A", _primitive "A"),- ("S'", _primitive "S'"),- ("P", _primitive "P"),- ("I", _primitive "I"),- ("S", _primitive "S"),- ("U", _primitive "U"),- ("Y", _primitive "Y"),- ("B'", _primitive "B'"),- ("Z", _primitive "Z"),- ("J", _primitive "J"),- ("R", _primitive "R"),- ("K2", _primitive "K2"),- ("K3", _primitive "K3"),- ("K4", _primitive "K4"),- ("C'B", _primitive "C'B"),- ("L", _primitive "L"),- ("KK", _primitive "KK"),- ("KA", _primitive "KA"),- ("T3", _primitive "T3"),- ("T4", _primitive "T4"),- ("T5", _primitive "T5"),- ("T6", _primitive "T6"),- ("T7", _primitive "T7"),- ("T8", _primitive "T8"),- ("T9", _primitive "T9"),- ("T10", _primitive "T10"),- ("T11", _primitive "T11"),- ("T12", _primitive "T12"),- ("T13", _primitive "T13"),- ("T14", _primitive "T14"),- ("T15", _primitive "T15"),- ("T16", _primitive "T16"),- ("TAG0", _primitive "TAG0"),- ("TAG1", _primitive "TAG1"),- ("TAG2", _primitive "TAG2"),- ("TAG3", _primitive "TAG3"),- ("TAG4", _primitive "TAG4"),- ("TAG5", _primitive "TAG5"),- ("TAG6", _primitive "TAG6"),- ("TAG7", _primitive "TAG7"),- ("TAG8", _primitive "TAG8"),- ("TAG9", _primitive "TAG9"),- ("TAG10", _primitive "TAG10"),- ("TAG11", _primitive "TAG11"),- ("TAG12", _primitive "TAG12"),- ("TAG13", _primitive "TAG13"),- ("TAG14", _primitive "TAG14"),- ("TAG15", _primitive "TAG15"),- ("TAG16", _primitive "TAG16"),- ("TAG17", _primitive "TAG17"),- ("TAG18", _primitive "TAG18"),- ("TAG19", _primitive "TAG19"),- ("TAG20", _primitive "TAG20"),- ("TAG21", _primitive "TAG21"),- ("TAG22", _primitive "TAG22"),- ("TAG23", _primitive "TAG23"),- ("TAG24", _primitive "TAG24"),- ("TAG25", _primitive "TAG25"),- ("TAG26", _primitive "TAG26"),- ("TAG27", _primitive "TAG27"),- ("TAG28", _primitive "TAG28"),- ("TAG29", _primitive "TAG29"),- ("TAG30", _primitive "TAG30"),- ("TAG31", _primitive "TAG31"),- ("TAG32", _primitive "TAG32"),- ("+", _primitive "+"),- ("-", _primitive "-"),- ("*", _primitive "*"),- ("quot", _primitive "quot"),- ("rem", _primitive "rem"),- ("neg", _primitive "neg"),- ("u+", _primitive "u+"),- ("u-", _primitive "u-"),- ("u*", _primitive "u*"),- ("uquot", _primitive "uquot"),- ("urem", _primitive "urem"),- ("uneg", _primitive "uneg"),- ("and", _primitive "and"),- ("or", _primitive "or"),- ("xor", _primitive "xor"),- ("inv", _primitive "inv"),- ("shl", _primitive "shl"),- ("shr", _primitive "shr"),- ("ashr", _primitive "ashr"),- ("subtract", _primitive "subtract"),- ("usubtract", _primitive "usubtract"),- ("popcount", _primitive "popcount"),- ("clz", _primitive "clz"),- ("ctz", _primitive "ctz"),- ("==", _primitive "=="),- ("/=", _primitive "/="),- ("<", _primitive "<"),- ("<=", _primitive "<="),- (">", _primitive ">"),- (">=", _primitive ">="),- ("u<", _primitive "u<"),- ("u<=", _primitive "u<="),- ("u>", _primitive "u>"),- ("u>=", _primitive "u>="),- ("ord", _primitive "ord"),- ("chr", _primitive "chr"),- ("f+", _primitive "f+"),- ("f-", _primitive "f-"),- ("f*", _primitive "f*"),- ("f/", _primitive "f/"),- ("f==", _primitive "f=="),- ("f/=", _primitive "f/="),- ("f<", _primitive "f<"),- ("f<=", _primitive "f<="),- ("f>", _primitive "f>"),- ("f>=", _primitive "f>="),- ("fneg", _primitive "fneg"),- ("itof", _primitive "itof"),- ("utof", _primitive "utof"),- ("ftoi", _primitive "ftoi"),- ("Itof", _primitive "Itof"),- ("ftod", _primitive "ftod"),- ("dtof", _primitive "dtof"),- ("d+", _primitive "d+"),- ("d-", _primitive "d-"),- ("d*", _primitive "d*"),- ("d/", _primitive "d/"),- ("d==", _primitive "d=="),- ("d/=", _primitive "d/="),- ("d<", _primitive "d<"),- ("d<=", _primitive "d<="),- ("d>", _primitive "d>"),- ("d>=", _primitive "d>="),- ("dneg", _primitive "dneg"),- ("itod", _primitive "itod"),- ("utod", _primitive "utod"),- ("Itod", _primitive "Itod"),- ("dtoi", _primitive "dtoi"),- ("seq", _primitive "seq"),- ("icmp", _primitive "icmp"),- ("ucmp", _primitive "ucmp"),- ("rnf", _primitive "rnf"),- ("IO.>>=", _primitive "IO.>>="),- ("IO.>>", _primitive "IO.>>"),- ("IO.return", _primitive "IO.return"),- ("IO.print", _primitive "IO.print"),- ("IO.serialize", _primitive "IO.serialize"),- ("IO.deserialize", _primitive "IO.deserialize"),- ("IO.stdin", _primitive "IO.stdin"),- ("IO.stdout", _primitive "IO.stdout"),- ("IO.stderr", _primitive "IO.stderr"),- ("IO.getArgRef", _primitive "IO.getArgRef"),- ("IO.performIO", _primitive "IO.performIO"),- ("IO.gc", _primitive "IO.gc"),- ("IO.stats", _primitive "IO.stats"),- ("raise", _primitive "raise"),- ("catch", _primitive "catch"),- ("dynsym", _primitive "dynsym"),- ("newCAStringLen", _primitive "newCAStringLen"),- ("packCString", _primitive "packCString"),- ("packCStringLen", _primitive "packCStringLen"),- ("toInt", _primitive "toInt"),- ("toPtr", _primitive "toPtr"),- ("toDbl", _primitive "toDbl"),- ("toFlt", _primitive "toFlt"),- ("fromDbl", _primitive "fromDbl"),- ("fromFlt", _primitive "fromFlt"),- ("toFunPtr", _primitive "toFunPtr"),- ("A.alloc", _primitive "A.alloc"),- ("A.copy", _primitive "A.copy"),- ("A.size", _primitive "A.size"),- ("A.read", _primitive "A.read"),- ("A.write", _primitive "A.write"),- ("A.trunc", _primitive "A.trunc"),- ("A.==", _primitive "A.=="),- ("bs++", _primitive "bs++"),- ("bs++.", _primitive "bs++."),- ("bs==", _primitive "bs=="),- ("bs/=", _primitive "bs/="),- ("bs<", _primitive "bs<"),- ("bs<=", _primitive "bs<="),- ("bs>", _primitive "bs>"),- ("bs>=", _primitive "bs>="),- ("bscmp", _primitive "bscmp"),- ("bspack", _primitive "bspack"),- ("bsunpack", _primitive "bsunpack"),- ("bsreplicate", _primitive "bsreplicate"),- ("bslength", _primitive "bslength"),- ("bssubstr", _primitive "bssubstr"),- ("bsindex", _primitive "bsindex"),- ("bswrite", _primitive "bswrite"),- ("fromUTF8", _primitive "fromUTF8"),- ("toUTF8", _primitive "toUTF8"),- ("headUTF8", _primitive "headUTF8"),- ("tailUTF8", _primitive "tailUTF8"),- ("fp+", _primitive "fp+"),- ("fp2p", _primitive "fp2p"),- ("fpnew", _primitive "fpnew"),- ("fpfin", _primitive "fpfin"),- ("fp2bs", _primitive "fp2bs"),- ("bs2fp", _primitive "bs2fp"),- ("bsgrab", _primitive "bsgrab"),- ("bsgrablen", _primitive "bsgrablen"),- ("IO.fork", _primitive "IO.fork"),- ("IO.thid", _primitive "IO.thid"),- ("IO.waitrdfd", _primitive "IO.waitrdfd"),- ("IO.waitwrfd", _primitive "IO.waitwrfd"),- ("thnum", _primitive "thnum"),- ("IO.throwto", _primitive "IO.throwto"),- ("IO.yield", _primitive "IO.yield"),- ("IO.newmvar", _primitive "IO.newmvar"),- ("IO.takemvar", _primitive "IO.takemvar"),- ("IO.putmvar", _primitive "IO.putmvar"),- ("IO.readmvar", _primitive "IO.readmvar"),- ("IO.trytakemvar", _primitive "IO.trytakemvar"),- ("IO.tryputmvar", _primitive "IO.tryputmvar"),- ("IO.tryreadmvar", _primitive "IO.tryreadmvar"),- ("IO.threaddelay", _primitive "IO.threaddelay"),- ("IO.threadstatus", _primitive "IO.threadstatus"),- ("isint", _primitive "isint"),- ("SPnew", _primitive "SPnew"),- ("SPderef", _primitive "SPderef"),- ("SPfree", _primitive "SPfree"),- ("I+", _primitive "I+"),- ("I-", _primitive "I-"),- ("I*", _primitive "I*"),- ("Iquot", _primitive "Iquot"),- ("Irem", _primitive "Irem"),- ("Ineg", _primitive "Ineg"),- ("Iu+", _primitive "Iu+"),- ("Iu-", _primitive "Iu-"),- ("Iu*", _primitive "Iu*"),- ("Iuquot", _primitive "Iuquot"),- ("Iurem", _primitive "Iurem"),- ("Iuneg", _primitive "Iuneg"),- ("Iand", _primitive "Iand"),- ("Ior", _primitive "Ior"),- ("Ixor", _primitive "Ixor"),- ("Ishl", _primitive "Ishl"),- ("Ishr", _primitive "Ishr"),- ("Iashr", _primitive "Iashr"),- ("Iinv", _primitive "Iinv"),- ("Isubtract", _primitive "Isubtract"),- ("Iusubtract", _primitive "Iusubtract"),- ("Ipopcount", _primitive "Ipopcount"),- ("Iclz", _primitive "Iclz"),- ("Ictz", _primitive "Ictz"),- ("I==", _primitive "I=="),- ("I/=", _primitive "I/="),- ("I<", _primitive "I<"),- ("I<=", _primitive "I<="),- ("I>", _primitive "I>"),- ("I>=", _primitive "I>="),- ("Iicmp", _primitive "Iicmp"),- ("Iu<", _primitive "Iu<"),- ("Iu<=", _primitive "Iu<="),- ("Iu>", _primitive "Iu>"),- ("Iu>=", _primitive "Iu>="),- ("Iucmp", _primitive "Iucmp"),- ("itoI", _primitive "itoI"),- ("Itoi", _primitive "Itoi"),- ("utoU", _primitive "utoU"),- ("Utou", _primitive "Utou"),- ("Wknew", _primitive "Wknew"),- ("Wknewfin", _primitive "Wknewfin"),- ("Wkderef", _primitive "Wkderef"),- ("Wkfinal", _primitive "Wkfinal"),- ("IO.getmaskingstate", _primitive "IO.getmaskingstate"),- ("IO.setmaskingstate", _primitive "IO.setmaskingstate"),- ("IO.pp", _primitive "IO.pp")- ]+-- Translate the Exp to its value by printing it in serailized form+-- and then use the regular runtime deserialization.+translateWithMap :: TranslateMap -> ([LDef], Exp) -> AnyType+translateWithMap _ _ | not compiledWithMhs =+ mhsError "Not compiled with mhs, so cannot run code"+translateWithMap (TM mp) (ds, e) =+ let dm = foldr (uncurry M.insert) mp ds+ outCMdl = snd $ renumberCMdlM [] dm e+ str = toStringCMdl outCMdl -- serialized value+ val = unsafePerformIO (readSerializedBS (pack str))+ in val
@@ -4,7 +4,7 @@ module MicroHs.TypeCheck( typeCheck, TModule(..), showTModule,- GlobTables, emptyGlobTables, mergeGlobTables,+ GlobTables, emptyGlobTables, mergeGlobTables, deleteModuleGlobTables, impossible, impossibleShow, mkClassConstructor, mkSuperSel,@@ -26,19 +26,22 @@ import Data.Maybe import MicroHs.Builtin import MicroHs.Deriving+import MicroHs.EncodeData(maxConstructors, maxFields)+import MicroHs.Error(MhsError(MhsTypeError)) import MicroHs.Expr import MicroHs.Fixity import MicroHs.Flags import MicroHs.Graph import MicroHs.Ident import qualified MicroHs.IdentMap as M-import qualified MicroHs.IntMap as IM+import qualified Mhs.IntMap as IM import MicroHs.List import MicroHs.Names+import MicroHs.Lex(readInt) import MicroHs.Parse(dotDotIdent) import MicroHs.SymTab import MicroHs.TCMonad-import Text.PrettyPrint.HughesPJLiteClass+import Mhs.Text.PrettyPrint.HughesPJLiteClass import Debug.Trace --primitiveKinds :: [String]@@ -80,6 +83,28 @@ gClassTable = M.merge (gClassTable g1) (gClassTable g2), gInstInfo = M.mergeWith mergeInstInfo (gInstInfo g1) (gInstInfo g2) } +-- Remove what a module has added to the global tables, e.g., when it is+-- removed from the compilation cache. The type synonyms, data types, and+-- classes are the ones qualified by the module name. The instances are the+-- ones whose dictionaries are among the given instance identifiers, i.e.,+-- the instance bindings of the module.+deleteModuleGlobTables :: IdentModule -> [Ident] -> GlobTables -> GlobTables+deleteModuleGlobTables mn insts g =+ GlobTables { gSynTable = delOwn (gSynTable g),+ gDataTable = delOwn (gDataTable g),+ gClassTable = delOwn (gClassTable g),+ gInstInfo = M.fromList (mapMaybe delInsts (M.toList (gInstInfo g))) }+ where+ delOwn :: forall a . M.Map a -> M.Map a+ delOwn m = foldr M.delete m [ i | i <- M.keys m, qualOf i == mn ]+ instSet = M.fromList [ (i, ()) | i <- insts ]+ isOwn (EVar i) = isJust (M.lookup i instSet)+ isOwn _ = False+ delInsts (c, InstInfo m l fds) =+ let m' = M.fromList [ ie | ie@(_, e) <- M.toList m, not (isOwn e) ]+ l' = [ d | d@(InstDict e _) <- l, not (isOwn e) ]+ in if M.null m' && null l' then Nothing else Just (c, InstInfo m' l' fds)+ type Symbols = (SymTab, SymTab) data TModule a = TModule {@@ -119,7 +144,8 @@ impMdls = [(fromMaybe m mm, tm) | (ImportSpec _ _ m mm _, tm) <- imps] allMdls = thisMdl : impMdls (texps, vexps) =- unzip $ map (getTVExps impMap (typeTable tcs) (valueTable tcs) (assocTable tcs)) exps+ let tys = typeTable tcs; vals = valueTable tcs; ast = assocTable tcs in+ unzip $ map (getTVExps impMap tys vals ast) (gatherAssoc tys ast exps) where impMap = M.fromListWith (++) [(i, [m]) | (i, m) <- allMdls] fexps = map (tFixDefs . snd) allMdls sexps = synTable tcs@@ -180,8 +206,8 @@ (if hide then id -- don't complain about missing hidden identifiers; we use it for compatibility else- checkBad (ivs \\ allVs) .- checkBad (its \\ allTs))+ checkBad (ivs `deleteAlls` allVs) .+ checkBad (its `deleteAlls` allTs)) (imp, TModule mn fx ts' vs' ds a) checkBad :: forall a . [Ident] -> a -> a@@ -189,6 +215,23 @@ checkBad (i:_) _ = errorMessage (getSLoc i) $ "not exported: " ++ showIdent i +-- When eporting a data type the associated selectors can be exported+-- with the type or not. E.g.+-- module M(T, a) where data T = T { a :: Int }+-- behaves the same as+-- module M(T(a)) ...+-- So for each type export item we gather up the associated selectors and add them.+gatherAssoc :: TypeTable -> AssocTable -> [ExportItem] -> [ExportItem]+gatherAssoc tys ast exps =+ let vs = [ i | ExpValue i <- exps ]+ gather :: ExportItem -> ExportItem+ gather (ExpTypeSome ti is) | is /= [dotDotIdent] =+ let assc = [ i | ValueExport i _ <- getAssocs ast $ tyQIdent $ expLookup ti tys ]+ xs = (assc `intersect` vs) \\ is+ in ExpTypeSome ti (xs ++ is)+ gather e = e+ in map gather exps+ -- Type and value exports getTVExps :: forall a . M.Map [TModule a] -> TypeTable -> ValueTable -> AssocTable -> ExportItem -> ([TypeExport], [ValueExport])@@ -201,7 +244,7 @@ _ -> errorMessage (getSLoc m) $ "undefined module: " ++ showIdent m getTVExps _ tys vals ast (ExpTypeSome ti is) = let e = expLookup ti tys- assc = getAssocs vals ast $ tyQIdent e -- all associated values+ assc = getAssocs ast $ tyQIdent e -- all associated values ves = concatMap one is one i | i == dotDotIdent = assc -- '..' means all associated values | otherwise =@@ -217,7 +260,7 @@ getTVExps _ _ _ _ (ExpDefault _) = ([], []) expLookup :: Ident -> SymTab -> Entry-expLookup i m = either (errorMessage (getSLoc i)) id $ stLookup "export" i m+expLookup i m = either throw id $ stLookup "export" i m tyQIdent :: Entry -> Ident tyQIdent (Entry (EVar qi) _) = qi@@ -249,11 +292,11 @@ _ -> Entry (EVar qi) t -- XXX A hack for boot modules -- Find all value Entry for names associated with a type.- assoc i = getAssocs vt at (qualIdent mn i)+ assoc i = getAssocs at (qualIdent mn i) -- All top level values possible to export. ves = [ ValueExport i (ventry i t') | Sign is t <- tds, let t' = expandSyn' st t, i <- is ] ++- [ ValueExport i (ventry i t') | ForImp _ _ qi t <- tds, let t' = expandSyn' st t, let i = unQualIdent qi ]+ [ ValueExport i (ventry i t') | ForImp _ _ _ qi t <- tds, let t' = expandSyn' st t, let i = unQualIdent qi ] where st = synTable tcs -- All top level types possible to export.@@ -273,8 +316,8 @@ -- Find all value Entry for names associated with a type. -- XXX join stLookup code with tentry-getAssocs :: (HasCallStack) => ValueTable -> AssocTable -> Ident -> [ValueExport]-getAssocs _vt at ai = fromMaybe [] $ M.lookup ai at+getAssocs :: (HasCallStack) => AssocTable -> Ident -> [ValueExport]+getAssocs at ai = fromMaybe [] $ M.lookup ai at mkTCState :: IdentModule -> GlobTables -> [(ImportSpec, TModule a)] -> TCState mkTCState mdlName globs mdls =@@ -318,6 +361,9 @@ dflts = foldr (mergeDefaults . tDefaults . snd) M.empty mdls + -- Every import makes its names available qualified with one of these.+ quals = nub $ mdlName : [ fromMaybe mn mas | (ImportSpec _ _ _ mas _, TModule mn _ _ _ _ _) <- mdls ]+ in TC { moduleName = mdlName, unique = 1, fixTable = addPrimFixs allFixes,@@ -331,7 +377,8 @@ classTable = gClassTable globs, ctxTables = (gInstInfo globs, [], [], []), constraints = [],- defaults = dflts+ defaults = dflts,+ importQuals = quals } mergeDefaults :: Defaults -> Defaults -> Defaults@@ -351,7 +398,10 @@ | otherwise = errorMessage (getSLoc i1) $ "Multiple instances: " ++ showSLoc (getSLoc i2) mrg e1 _e2 = e1 -- XXX improve this l = unionBy eqInstDict l1 l2- in InstInfo m l fds+ -- Evaluate the spine of the list. Otherwise the unions of all the merges+ -- nest, each with a nubBy over the unevaluated list of the one before,+ -- and evaluating the list in the end needs a very deep stack.+ in length l `seq` InstInfo m l fds -- Approximate equality for dictionaries. -- The important thing is to avoid exact duplicates in the instance table.@@ -627,7 +677,7 @@ munify :: HasCallStack => SLoc -> Expected -> EType -> T () munify loc (Infer r) b = tSetRefType loc r b-munify loc (Check a) b = unify loc a b+munify loc (Check a) b = unify loc b a -- Expand type synonyms, but keep location info expandSynLoc :: EType -> T EType@@ -655,12 +705,6 @@ chk rt return rt -expandSynNoChk :: HasCallStack =>- EType -> T EType-expandSynNoChk t = do- syns <- gets synTable- return $ expandSyn' syns t- -- Expand with the given synonym table. expandSyn' :: HasCallStack => SynTable -> EType -> EType@@ -728,7 +772,7 @@ SLoc -> String -> T () tcErrorTK loc msg = do tcm <- gets tcMode- tcError loc $ msgTCMode' tcm ++ " error: " ++ msg+ tcError loc $ msgTCMode' tcm ++ ": " ++ msg -- For error messages msgTCMode :: TCMode -> String@@ -743,40 +787,60 @@ msgTCMode' TCKind = "sort" msgTCMode' TCSort = "realm" +-- The convention is unify loc actual expected.+-- The original pair is carried along so that a mismatch deep inside+-- a type is reported in terms of the whole types. unify :: HasCallStack => SLoc -> EType -> EType -> T ()-unify loc a b = unifyR loc a b+unify loc a b = unifyR loc (a, b) a b +type Orig = (EType, EType) -- (actual, expected) as given to unify+ unifyR :: HasCallStack =>- SLoc -> EType -> EType -> T ()-unifyR _ (EVar x1) (EVar x2) | x1 == x2 = return ()-unifyR loc (EApp f1 a1) (EApp f2 a2) = do { unifyR loc f1 f2; unifyR loc a1 a2 }-unifyR loc t1@(EUVar r1) t2@(EUVar r2) | r1 < r2 = unifyVar loc r2 t1 -- always make higher- | r1 > r2 = unifyVar loc r1 t2 -- TRefs point to lower- | otherwise = return ()-unifyR loc (EUVar r1) t2 = unifyVar loc r1 t2-unifyR loc t1 (EUVar r2) = unifyVar loc r2 t1-unifyR loc t1 t2 = do+ SLoc -> Orig -> EType -> EType -> T ()+unifyR _ _ (EVar x1) (EVar x2) | x1 == x2 = return ()+unifyR loc o (EApp f1 a1) (EApp f2 a2) = do { unifyR loc o f1 f2; unifyR loc o a1 a2 }+unifyR loc o t1@(EUVar r1) t2@(EUVar r2) | r1 < r2 = unifyVar loc o r2 t1 -- always make higher+ | r1 > r2 = unifyVar loc o r1 t2 -- TRefs point to lower+ | otherwise = return ()+unifyR loc o (EUVar r1) t2 = unifyVar loc o r1 t2+unifyR loc o t1 (EUVar r2) = unifyVar loc o r2 t1+unifyR loc o t1 t2 = do tcm <- gets tcMode+ eqs <- gets typeEqTable case tcm of- -- Defer to constraint solver.+ -- Defer to constraint solver, unless this is a definite mismatch+ -- that no given equality could resolve. -- XXX needs changing if we have kind equalities.- TCExpr -> addEqConstraint loc t1 t2- _ -> tcErrorTK loc $ "cannot unify " ++ showExpr t1 ++ " and " ++ showExpr t2+ TCExpr | not (null eqs) || not (rigidClash t1 t2) -> addEqConstraint loc t1 t2+ _ -> mismatchError loc o +-- Two types with different rigid heads (or arities) can never unify.+rigidClash :: EType -> EType -> Bool+rigidClash t1 t2 =+ case (getAppM t1, getAppM t2) of+ (Just (c1, as1), Just (c2, as2)) -> c1 /= c2 || length as1 /= length as2+ _ -> False++mismatchError :: HasCallStack => SLoc -> Orig -> T a+mismatchError loc (actual, expected) = do+ tcm <- gets tcMode+ (a, e) <- niceTypes2 actual expected+ throw $ MhsTypeError loc (msgTCMode' tcm) (showTypeUser a) (showTypeUser e)+ unifyVar :: HasCallStack =>- SLoc -> TRef -> EType -> T ()-unifyVar loc r t = do+ SLoc -> Orig -> TRef -> EType -> T ()+unifyVar loc o r t = do mt <- getUVar r -- tcTrace $ "unifyVar: " ++ show (r,t) case mt of- Nothing -> unifyUnboundVar loc r t- Just t' -> unify loc t' t+ Nothing -> unifyUnboundVar loc o r t+ Just t' -> unifyR loc o t' t -- Unify an unbount tyvar r1 with the type at2 unifyUnboundVar :: HasCallStack =>- SLoc -> TRef -> EType -> T ()-unifyUnboundVar loc r1 at2@(EUVar r2) = do+ SLoc -> Orig -> TRef -> EType -> T ()+unifyUnboundVar loc o r1 at2@(EUVar r2) = do -- We know r1 /= r2 mt2 <- getUVar r2 case mt2 of@@ -787,14 +851,55 @@ setUVar r1 at2 else setUVar r2 (EUVar r1)- Just t2 -> unify loc (EUVar r1) t2-unifyUnboundVar loc r1 t2 = do+ Just t2 -> unifyR loc o (EUVar r1) t2+unifyUnboundVar loc _ r1 t2 = do vs <- getMetaTyVars [t2]- if r1 `elem` vs then- tcErrorTK loc $ "cyclic " ++ showExpr (EUVar r1) ++ " = " ++ showExpr t2+ if r1 `elem` vs then do+ (a, b) <- niceTypes2 (EUVar r1) t2+ tcError loc $ "occurs check: cannot construct the infinite type: " ++ showTypeUser a ++ " ~ " ++ showTypeUser b else setUVar r1 t2 +-----------------------------------------+-- Error message support++-- Show a type for the user, with String instead of [Char].+showTypeUser :: EType -> String+showTypeUser = sub . showEType+ where+ sub ('#' : s) | (_:_, r) <- span isDigit s = sub r -- drop skolem uniques, a#12 shows as a+ sub (c : s) = c : sub s+ sub [] = []++-- Dereference and give unification variables readable names.+niceTypes :: [EType] -> T [EType]+niceTypes ts = do+ ts' <- mapM derefUVar ts+ let vs = nub (concatMap uvarsOf ts')+ used = concatMap allVarsExpr ts'+ names = [ n | n <- map (:[]) ['a'..'z'] ++ [ 't' : show k | k <- [1::Int ..] ], mkIdent n `notElem` used ]+ sub = zip vs names+ go (EUVar i) | Just n <- lookup i sub = EVar (mkIdent n)+ go (EApp f a) = EApp (go f) (go a)+ go (EForall b iks t) = EForall b iks (go t)+ go (ESign t k) = ESign (go t) k+ go t = t+ return (map go ts')++niceTypes2 :: EType -> EType -> T (EType, EType)+niceTypes2 a b = do+ ts <- niceTypes [a, b]+ case ts of+ [a', b'] -> return (a', b')+ _ -> impossible++uvarsOf :: EType -> [Int]+uvarsOf (EUVar i) = [i]+uvarsOf (EApp f a) = uvarsOf f ++ uvarsOf a+uvarsOf (EForall _ _ t) = uvarsOf t+uvarsOf (ESign t _) = uvarsOf t+uvarsOf _ = []+ -- Reset unification map tcReset :: T () tcReset = modify $ \ ts -> ts{ uvarSubst = IM.empty }@@ -813,21 +918,22 @@ env <- gets valueTable case stLookup msg i env of Right (Entry e s) -> return (setSLocExpr (getSLoc i) e, s)- Left e -> do-{-- tcm <- gets tcMode- tcTrace ("TCMode=" ++ show tcm)- tcTrace ("Value table:\n" ++ show env)- tenv <- gets typeTable- tcTrace ("Type table:\n" ++ show tenv)--}- tcError (getSLoc i) e+ Left e -> throw e tLookupV :: HasCallStack => Ident -> T (Expr, EType) tLookupV i = do tcm <- gets tcMode- tLookup (msgTCMode tcm) i+ env <- gets valueTable+ let sloc e = setSLocExpr (getSLoc i) e+ case stLookupST i env of+ STOne (Entry e s) -> return (sloc e, s)+ -- If the identifier is ambiguous we use a pretty gruesome hack:+ -- if there is only one hit that is not a record getter, we use that.+ -- This allows ordinary functions/methods to have the same name as a+ -- field, and they will be preferred.+ STMany es | [Entry e s] <- filter (\ (Entry e' _) -> not (isGetExpr e')) es -> return (sloc e, s)+ _ -> tLookup (msgTCMode tcm) i -- generate the error normally tInst :: HasCallStack => Expr -> EType -> T (Expr, EType) --tInst ae t | trace ("tInst: " ++ show (ae, t)) False = undefined@@ -1108,20 +1214,22 @@ let addAssoc ti is = do vt <- gets valueTable- let val i =- case stLookup "" i vt of+ let val (i, lookupName) =+ case stLookup "" lookupName vt of Right e -> [ValueExport i e] _ -> [] -- fields with existential type have no selector addAssocTable (qualIdent mn ti) (concatMap val is) - assocData (Constr _ _ c _ (Left _)) = [c]- assocData (Constr _ _ c _ (Right its)) = c : map fst its+ assocData _ (Constr _ _ c _ (Left _)) = [(c, c)]+ -- Keep the visible field name, but look up its owner-specific getter.+ assocData ti (Constr _ _ c _ (Right its)) =+ (c, c) : [ (f, mkGetName ti f) | (f, _) <- its ] case adef of Data (i, _) cs _ | not (isMatchDataTypeName i)- -> addAssoc i (nub $ concatMap assocData cs)- Newtype (i, _) c _ -> addAssoc i (assocData c)- Class _ (i, _) _ ms -> addAssoc i [ x | Sign ns _ <- ms, m <- ns, x <- [m, mkDefaultMethodId m] ]+ -> addAssoc i (nub $ concatMap (assocData i) cs)+ Newtype (i, _) c _ -> addAssoc i (assocData i c)+ Class _ (i, _) _ ms -> addAssoc i [ (x, x) | Sign ns _ <- ms, m <- ns, x <- [m, mkDefaultMethodId m] ] _ -> return () -- Add type synonyms to the synonym table, and data/newtype to the data table.@@ -1143,7 +1251,7 @@ Type lhs t -> withLHS lhs $ \ lhs' -> first (Type lhs') <$> tInferTypeT t Class ctx lhs fds ms -> withLHS lhs $ \ lhs' -> cm kConstraint <$> (Class <$> tcCtx ctx <*> return lhs' <*> mapM tcFD fds <*> mapM tcMethod ms) Sign is t -> Sign is <$> tCheckTypeTImpl QImpl kType t- ForImp cc ie i t -> ForImp cc ie i <$> tCheckTypeTImpl QImpl kType t+ ForImp cc sf ie i t -> ForImp cc sf ie i <$> tCheckTypeTImpl QImpl kType t Instance ct m e -> Instance <$> tCheckTypeTImpl QExpl kConstraint ct <*> return m <*> return e Default mc ts -> Default (Just c) <$> mapM (tcDefault c) ts where c = fromMaybe num mc@@ -1333,6 +1441,9 @@ vs = replicate n (EVar dummyIdent) in [Eqn vs $ simpleAlts e] dDflts = concatMap mkDflt meths+ case map fst mdflts \\ [ i | Sign is _ <- meths, i <- is ] of -- defaults without a signature+ i:_ -> tcError (getSLoc i) $ "missing method signature: " ++ showIdent i+ _ -> return () return $ dcls : dDflts expandClass d = return [d] @@ -1408,50 +1519,81 @@ (iks, ctxs, ct') -> (iks, ctx : ctxs, ct') _ -> ([], [], act) +-- Convert a Set of Classes to a list while expanding synonyms+expandTup :: EType -> T [EType]+expandTup t = do+ u <- expandSyn t+ case getExprTuple u of+ Just xs -> concat <$> mapM expandTup xs+ Nothing -> pure [u]+ -- expandInst runs when all kind checking has been done, but no value checking. -- So any generated type expressions must be kind correct and fully qualified, -- whereas value expressions do not. expandInst :: EDef -> T [EDef] expandInst dinst@(Instance act bs extra) = do- (vks, ctx, cc) <- splitContext <$> expandSyn act- let loc = getSLoc act- qiCls = getAppCon cc- iInst = mkInstId loc cc--- tcTrace ("expandInst " ++ show iInst)--- (e, _) <- tLookupV iCls- ct <- gets classTable--- let qiCls = getAppCon e- (ClassInfo _ supers _ mits fds) <-- case M.lookup qiCls ct of- Nothing -> tcError loc $ "not a class " ++ showIdent qiCls- Just x -> return x- let signs = [ (i, t) | Sign is t <- bs, i <- is ]- addSign i e = maybe e (ESign e) $ lookup i signs- clsMdl = qualOf qiCls -- get class's module name- ies = [(i, addSign i $ ELam loc qs) | Fcn i qs <- bs]- meth (i, t) = fromMaybe (mkDefault i t) $ lookup i ies- meths = map meth mits- sups = map (const (EVar $ mkIdentSLoc loc dictPrefixDollar)) supers- args = sups ++ meths- instBind (Fcn i _) = isJust $ lookup i mits- instBind (Sign is _) = all (\ i -> isJust $ lookup i mits) is- instBind _ = False- -- When the method type has nested quantifiers the type checker cannot handle- -- m = mDflt- -- so we eta expand the definition t- -- m $1 ... = mDflt $1 ...- mkDefault i t = ELam loc [Eqn vs $ simpleAlts $ eApps (EVar dfltId) vs]- where dfltId = setSLocIdent loc $ mkDefaultMethodId $ qualIdent clsMdl i- vs = [EVar $ mkIdentSLoc loc $ "$" ++ show k | k <- [0 .. countArrows t - 1] ]- case filter (not . instBind) bs of+ (vks, ctx, uccs) <- splitContext <$> expandSyn act+ ccs <- expandTup uccs+ (instBinds, defs) <- unzip <$> forM ccs (\ cc -> do+ let loc = getSLoc act+ qiCls = getAppCon cc+ iInst = mkInstId loc cc+-- tcTrace ("expandInst " ++ show iInst)+-- (e, _) <- tLookupV iCls+ ct <- gets classTable+-- let qiCls = getAppCon e++ -- Lookup known class: supers => _ | fds where mits+ (ClassInfo _ supers _ mits fds) <-+ case M.lookup qiCls ct of+ Nothing -> tcError loc $ "not a class " ++ showIdent qiCls+ Just x -> return x++ let lbs = filter ((0 /=) . instBind) bs+ signs = [ (i, t) | Sign is t <- lbs, i <- is ]+ addSign i e = maybe e (ESign e) $ lookup i signs+ clsMdl = qualOf qiCls -- get class's module name+ ies = [(i, addSign i $ ELam loc qs) | Fcn i qs <- lbs]+ meth (i, t) = fromMaybe (mkDefault i t) $ lookup i ies+ meths = map meth mits+ sups = map (const (EVar $ mkIdentSLoc loc dictPrefixDollar)) supers+ args = sups ++ meths+ lengthMaybe :: Maybe EType -> Int+ lengthMaybe Just{} = 1+ lengthMaybe Nothing = 0+ instBind (Fcn i _) = lengthMaybe $ lookup i mits+ instBind (Sign is _) = sum ((\ i -> lengthMaybe $ lookup i mits) <$> is)+ instBind _ = 0+ -- When the method type has nested quantifiers the type checker cannot handle+ -- m = mDflt+ -- so we eta expand the definition t+ -- m $1 ... = mDflt $1 ...+ mkDefault i t = ELam loc [Eqn vs $ simpleAlts $ eApps (EVar dfltId) vs]+ where dfltId = setSLocIdent loc $ mkDefaultMethodId $ qualIdent clsMdl i+ vs = [EVar $ mkIdentSLoc loc $ "$" ++ show k | k <- [0 .. countArrows t - 1] ]++ let body = eEqns [] $ eLetB extra $ eApps (EVar $ mkClassConstructor qiCls) args+ bind = Fcn iInst body+ sign = Sign [iInst] $ eForall vks $ addConstraints ctx cc+ addInstTable [(EVar iInst, vks, ctx, cc, fds)]+ return (instBind, [sign, bind])+ )++ let instBindSum = foldr (\ f b x -> f x + b x) (const 0) instBinds+ case filter ((1 /=) . instBindSum) bs of [] -> return ()- b:_ -> tcError (getSLoc b) "superflous instance binding"+ b:_ -> tcError (getSLoc b) (if instBindSum b < 1+ then "superflous instance binding"+ else "ambiguous instance binding"+ ) - let body = eEqns [] $ eLetB extra $ eApps (EVar $ mkClassConstructor qiCls) args- bind = Fcn iInst body- sign = Sign [iInst] $ eForall vks $ addConstraints ctx cc- addInstTable [(EVar iInst, vks, ctx, cc, fds)]- return [dinst, sign, bind]+{-+ if qiCls == identDataTypeableTypeable then+ trace ("instance Typeable ignored"+ return []+ else+-}+ return (dinst : concat defs) expandInst d = return [d] @@ -1576,6 +1718,12 @@ let cti = [ (qualIdent mn c, either length length ets + if null ctx then 0 else 1) | Constr _ ctx c _ ets <- cs ] tret = tApps (qualIdent mn tycon) (map tVarK vks)+ -- The runtime encoding of data limits these, see MicroHs.EncodeData.+ when (length cs > maxConstructors) $+ tcError (getSLoc tycon) $ "too many constructors, " ++ show (length cs) ++ ", the maximum is " ++ show maxConstructors+ sequence_ [ tcError (getSLoc c) $ "too many fields, " ++ show n ++ ", the maximum is " ++ show maxFields+ | (c, n) <- cti, n > maxFields ]+ let addCon (Constr evks ectx c _ ets) = do let ts = either id (map snd) ets cty = EForall QExpl vks $ EForall QExpl evks $ addConstraints ectx $ foldr (tArrow . snd) tret ts@@ -1590,7 +1738,7 @@ fs = either (const []) (map fst) ets extValETop c (EForall QExpl vks $ EForall QExpl [] $ tArrow t tret) (ECon $ ConNew (qualIdent mn c) fs) addConFields tycon con- ForImp _ _ i t -> extValQTop i t+ ForImp _ _ _ i t -> extValQTop i t Class ctx (i, vks) fds ms -> addValueClass ctx i vks fds ms _ -> return () @@ -1661,10 +1809,11 @@ mn <- gets moduleName -- tcTrace $ "tcDefValue: " ++ showIdent i ++ " done" return $ Fcn (qualIdent' mn i) teqns- ForImp cc ie i t -> do+ ForImp cc sf ie i t -> do mn <- gets moduleName- t' <- withNewtypeAsSyns (expandSynLoc t)- pure $ ForImp cc ie (qualIdent' mn i) t'+ -- Keep the newtypes for C types, see cNewtypes.+ t' <- withSomeNewtypesAsSyns ((`notElem` map fst cNewtypes) . unIdent) (expandSynLoc t)+ pure $ ForImp cc sf ie (qualIdent' mn i) t' -- Check that a foreign export match the declaration type. -- In most cases the types will be the same, but the declaration can be overloaded -- so we need to ensure that it is compatible with the export definition.@@ -1825,7 +1974,11 @@ tcExpr :: HasCallStack => Expected -> Expr -> T Expr-tcExpr mt ae = tcExprR mt ae {-do+tcExpr mt ae =+ case ae of+ -- Only literals are needed in the context, for "arising from the literal".+ ELit _ _ -> tcExprR mt ae+ _ -> tcExprR mt ae {-do tcTrace ("tcExpr enter: mt=" ++ show mt ++ " ae=" ++ showExpr ae) r <- tcExprR mt ae tcTrace ("tcExpr exit: " ++ showExpr r)@@ -1860,23 +2013,15 @@ EQVar e t -> -- already resolved, just instantiate instSigma loc e t mt - EApp f e ->- case f of- -- If we have parsed a e.lbl as a record select,- -- but it turns out that the lbl is not a label,- -- then we rejig the expression into function compositions,- -- i.e., e . lbl.- ESelect is@(lbl:_) -> do- b <- isLabel lbl- if b then- tcExprAp mt ae []- else- --trace ("convert to . " ++ show (f, e)) $- tcExpr mt (EOper e $ map (\ i -> (mkIdentSLoc (getSLoc i) ".", EVar i)) is)- _ -> tcExprAp mt ae []+ EApp _ _ -> tcExprAp mt ae [] EOper e ies -> tcOper e ies >>= tcExpr mt ELam _ qs -> tcExprLam mt loc qs+ EQLit lloc mq lit@(LStr _) ->+ -- Turn M."foo" into M.fromString ("foo" :: [Char])+ tcExpr mt $ EApp (EVar $ qualIdent mq $ mkIdentSLoc lloc "fromString") (ESign (ELit lloc lit) eStr)+ where eStr = EListish $ LList [EVar $ mkBuiltin loc "Char"]+ EQLit _ _ _ -> impossible ELit _ lit -> do tcm <- gets tcMode case tcm of@@ -1935,10 +2080,13 @@ _ -> impossible ECase a arms -> do -- XXX should look more like EIf- (ea, ta) <- tInferExpr a+ -- Solve the scrutinee's constraints before checking the arms.+ -- Solving can refine its type (e.g., HasField for r.f), and a+ -- GADT pattern needs the refined type for its given equalities.+ ((ea, ta), bs) <- solveLocalConstraints $ tInferExpr a tt <- tGetExpType mt earms <- mapM (tcArm tt ta) arms- return (ECase ea earms)+ return (ECase (eLetB (eBinds bs) ea) earms) ELet bs a -> tcBinds bs $ \ ebs -> do { ea <- tcExpr mt a; return (ELet ebs ea) } ETuple es -> case unTuple mt of@@ -2019,6 +2167,7 @@ es' <- mapM (tCheckExpr te) es return (EListish (LList es')) EListish (LCompr eret ass) -> do+ tr <- newUVar let doStmts :: [EStmt] -> [EStmt] -> T ([EStmt], Typed Expr) doStmts rss xs =@@ -2031,7 +2180,7 @@ SBind p a -> do v <- newUVar ea <- tCheckExprAndSolve (tApp (tList loc) v) a- tCheckPatC v p $ \ ep -> doStmts (SBind ep ea : rss) ss+ tCheckPatC tr v p $ \ ep -> doStmts (SBind ep ea : rss) ss SThen a -> do ea <- tCheckExprAndSolve (tBool (getSLoc a)) a doStmts (SThen ea : rss) ss@@ -2041,8 +2190,7 @@ SRec _ -> tcError (getSLoc as) "rec not allowed" (rss, (ea, ta)) <- doStmts [] ass- let- tr = tApp (tList loc) ta+ unify loc tr (tApp (tList loc) ta) munify loc mt tr return (EListish (LCompr ea rss)) EListish (LFrom e) -> tcExpr mt (enumCall loc "From" [e])@@ -2176,15 +2324,21 @@ isLabel i = do env <- gets valueTable case stLookup "" i env of- Left _ -> return True- Right (Entry (EVar g) t) ->- return $ isInfixOf "get$." (unIdent g) || countArrows t == 0- Right _ -> undefined -- return True+ Left _ -> return True --+ Right (Entry e t) ->+ return $ isGetExpr e || countArrows t == 0 +isGetExpr :: Expr -> Bool+isGetExpr (EVar g) = (getPrefix ++ ".") `isInfixOf` unIdent g+isGetExpr _ = False+ tcExprAp :: HasCallStack => Expected -> Expr -> [Expr] -> T Expr --tcExprAp _ ae args | trace ("tcExprAp: " ++ show (ae, args)) False = undefined tcExprAp mt ae args = do+ let rest = do+ (f, t) <- tInferExpr ae+ tcExprApFn mt f t args case ae of EApp f a -> tcExprAp mt f (a : args) EParen f -> tcExprAp mt f args@@ -2208,10 +2362,24 @@ _ -> tcExprApFn mt fn t' args EQVar f t -> -- already resolved tcExprApFn mt f t args- _ -> do- (f, t) <- tInferExpr ae- tcExprApFn mt f t args + ESelect is@(lbl:_) | (e:args') <- args -> do+ -- If we have parsed a e.lbl as a record select,+ -- but it turns out that the lbl is not a label,+ -- then we rejig the expression into function compositions,+ -- i.e., e . lbl.+ -- This is dodgy, since it will already have been parsed with+ -- the wrong fixity.+ b <- isLabel lbl+ if b then+ rest+ else+ let eoper = EOper e $ map (\ i -> (mkIdentSLoc (getSLoc i) ".", EVar i)) is+ in --trace ("convert " ++ show (EApp ae e) ++ " to " ++ show eoper) $+ tcExprAp mt eoper args'++ _ -> rest+ data AnArg = ArgExpr Expr EType | ArgCtx EConstraint -- deriving Show @@ -2301,6 +2469,13 @@ failureFree (ELazy False p) = failureFree p failureFree (EViewPat _ p) = failureFree p failureFree (EParen p) = failureFree p+failureFree (EUpdate c fs) = do -- record pattern, e.g. C { f = p, .. }+ b <- failureFreeAp [] c+ bs <- mapM fieldFree fs+ return (b && and bs)+ where fieldFree (EField _ p) = failureFree p+ fieldFree (EFieldPun _) = return True+ fieldFree EFieldWild = return True failureFree _ = return False failureFreeAp :: [Bool] -> EPat -> T Bool@@ -2500,10 +2675,19 @@ e' <- tcOper e (ies ++ [(op, x)]) case e' of EApp f x' | x' `eqExpr` x -> return f- _ -> tcError loc "Bad section fixity"-tcLSect e op =- return (EApp (EVar op) e)+ _ -> badSectionFixity loc+tcLSect e op | greedyExpr e = badSectionFixity (getSLoc op)+ | otherwise = return (EApp (EVar op) e) +-- These construct have a greedy parser and cannot be in a left section+greedyExpr :: Expr -> Bool+greedyExpr (ELam _ _) = True+greedyExpr (ECase _ _) = True+greedyExpr (ELet _ _) = True+greedyExpr (EIf _ _ _) = True+greedyExpr (EDo _ _) = True+greedyExpr _ = False+ tcRSect :: Ident -> Expr -> T Expr tcRSect op (EOper e ies) = do let x = eVarI loc "$x"@@ -2511,11 +2695,14 @@ e' <- tcOper x ((op, e):ies) case e' of EApp (EApp _ x') _ | x `eqExpr` x' -> return (eLam [x] e')- _ -> tcError loc "Bad section fixity"+ _ -> badSectionFixity loc tcRSect op e = do let x = eVarI (getSLoc op) "$x" return (eLam [x] (EApp (EApp (EVar op) x) e)) +badSectionFixity :: SLoc -> T a+badSectionFixity loc = tcError loc "Bad section fixity"+ unArrow :: HasCallStack => SLoc -> EType -> T (EType, EType) --unArrow _ t | trace ("unArrow: " ++ show t) False = undefined@@ -2633,12 +2820,12 @@ case ds of [] -> return eqn _ -> return $ addSolved ds eqn- ARet at' -> + ARet at' -> case pps of p:ps -> do (tp, tr) <- unArrow (getSLoc p) at' -- tCheckPatC dicts used in tcAlt solve- tCheckPatC tp p $ \ p' -> tcPats tr ps $ \ t' ps' -> ta t' (p' : ps')+ tCheckPatC tr tp p $ \ p' -> tcPats tr ps $ \ t' ps' -> ta t' (p' : ps') [] -> ta at' [] -- base case, no more arguments, explicit or implicit @@ -2652,34 +2839,35 @@ tcAlt :: HasCallStack => EType -> EAlt -> T EAlt --tcAlt t (_, rhs) | trace ("tcAlt: " ++ showExpr rhs ++ " :: " ++ showEType t) False = undefined-tcAlt t (ss, rhs) = tcGuards ss $ \ ss' -> do+tcAlt t (ss, rhs) = tcGuards t ss $ \ ss' -> do rhs' <- tCheckExprAndSolve t rhs return (ss', rhs') -tcGuards :: [EStmt] -> ([EStmt] -> T EAlt) -> T EAlt-tcGuards [] ta = ta []-tcGuards (s:ss) ta = tcGuard s $ \ rs -> tcGuards ss $ \ rss -> ta (rs:rss)+tcGuards :: EType -> [EStmt] -> ([EStmt] -> T EAlt) -> T EAlt+tcGuards _ [] ta = ta []+tcGuards t (s:ss) ta = tcGuard t s $ \ rs -> tcGuards t ss $ \ rss -> ta (rs:rss) -tcGuard :: EStmt -> (EStmt -> T EAlt) -> T EAlt-tcGuard (SBind p e) ta = do+-- The EType is the type of the alternative's right hand side.+tcGuard :: EType -> EStmt -> (EStmt -> T EAlt) -> T EAlt+tcGuard t (SBind p e) ta = do --traceM ("tcGuard: " ++ show p ++ " <- " ++ show e) ((e', tt), bs) <- solveLocalConstraints $ tInferExpr e let e'' = eLetB (eBinds bs) e' -- tCheckPatC dicts used in solving in tcAlt- tCheckPatC tt p $ \ p' -> ta (SBind p' e'')-tcGuard (SThen e) ta = do+ tCheckPatC t tt p $ \ p' -> ta (SBind p' e'')+tcGuard _ (SThen e) ta = do e' <- tCheckExprAndSolve (tBool (getSLoc e)) e ta (SThen e') -- XXX do we have solves-tcGuard (SLet bs) ta = tcBinds bs $ \ bs' -> ta (SLet bs')-tcGuard (SRec ss) _ = tcError (getSLoc ss) "rec not allowed"+tcGuard _ (SLet bs) ta = tcBinds bs $ \ bs' -> ta (SLet bs')+tcGuard _ (SRec ss) _ = tcError (getSLoc ss) "rec not allowed" tcArm :: EType -> EType -> ECaseArm -> T ECaseArm tcArm t tpat arm = case arm of -- The dicts introduced by tCheckPatC are -- used in the tCheckExprAndSolve in tcAlt.- (p, alts) -> tCheckPatC tpat p $ \ pp -> do+ (p, alts) -> tCheckPatC t tpat p $ \ pp -> do alts' <- tcAlts t alts return (pp, alts') @@ -2716,23 +2904,35 @@ tcErrorTK loc "Subsumption check failed" return exp1' -tCheckPatC :: forall a . EType -> EPat -> (EPat -> T a) -> T a-tCheckPatC t p@(EVar v) ta | not (isConIdent v) = do -- simple special case+-- The first EType is the type of the context of the pattern match, e.g., the result type of a case.+-- Existential type variables bound by the pattern must not escape into it,+-- nor into the pattern type, nor into the types of the variables in the environment.+tCheckPatC :: forall a . EType -> EType -> EPat -> (EPat -> T a) -> T a+tCheckPatC _ t p@(EVar v) ta | not (isConIdent v) = do -- simple special case withExtVals [(v, t)] $ ta p-tCheckPatC t app ta = do+tCheckPatC rt t app ta = do -- tcTrace $ "tCheckPatC: " ++ show app ++ " :: " ++ show t app' <- dsEFields app let vs = patVars app' multCheck vs env <- mapM (\ v -> (,) v <$> newUVar) vs- withExtVals env $ do- (_sks, ds, pp) <- tCheckPat t app'+ (sks, r) <- withExtVals env $ do+ (sks, ds, pp) <- tCheckPat t app' -- tcTrace ("tCheckPatC: " ++ show pp) -- xt <- derefUVar t -- tcTrace ("tCheckPatC ds=" ++ show ds ++ "t=" ++ show xt)- -- XXX must check for leaking skolems- withDicts ds $+ r <- withDicts ds $ ta pp+ return (sks, r)+ -- Check for escaping existentials (skolems).+ -- The pattern variables are no longer in the environment.+ unless (null sks) $ do+ env_tys <- getEnvTypes+ esc_tvs <- getFreeTyVars (rt : t : env_tys)+ let bad_tvs = filter (`elem` esc_tvs) sks+ unless (null bad_tvs) $+ tcError (getSLoc app) $ "existential type variable escapes its scope: " ++ unwords (map (showTypeUser . EVar) bad_tvs)+ return r type EPatRet = ([TyVar], [(Ident, EConstraint)], EPat) -- skolems, dictionaries, pattern @@ -2887,7 +3087,7 @@ (sks, spt) <- shallowSkolemise avs apt (df, pf, pt) <- case getImplies spt of- Nothing -> return ([], con, apt)+ Nothing -> return ([], con, spt) Just (ctx, pt') -> do di <- newADictIdent loc return ([(di, ctx)], EApp con (EVar di), pt')@@ -3206,11 +3406,24 @@ (exp1', rho1) <- tInst exp1 arho1 subsCheckRho loc exp1' rho1 rho2 subsCheckRho loc exp1 rho1 rho2 | Just (a2, r2) <- getArrow rho2 = do -- Rule FUN- (a1, r1) <- unArrow loc rho1- subsCheckFun loc exp1 a1 r1 a2 r2+ rho1' <- derefUVar rho1+ case rho1' of+ -- Not an arrow, unify the whole types so a mismatch reports both.+ EVar _ -> unify loc rho1' rho2 >> return exp1+ EApp _ _ | Nothing <- getArrow rho1' -> unify loc rho1' rho2 >> return exp1+ _ -> do+ (a1, r1) <- unArrow loc rho1'+ subsCheckFun loc exp1 a1 r1 a2 r2 subsCheckRho loc exp1 rho1 rho2 | Just (a1, r1) <- getArrow rho1 = do -- Rule FUN- (a2,r2) <- unArrow loc rho2- subsCheckFun loc exp1 a1 r1 a2 r2+ rho2' <- derefUVar rho2+ case rho2' of+ -- Not an arrow, unify the whole types so a mismatch reports both+ -- (and in the right order, unArrow would treat rho2 as the actual type).+ EVar _ -> unify loc rho1 rho2' >> return exp1+ EApp _ _ | Nothing <- getArrow rho2' -> unify loc rho1 rho2' >> return exp1+ _ -> do+ (a2,r2) <- unArrow loc rho2'+ subsCheckFun loc exp1 a1 r1 a2 r2 subsCheckRho loc exp1 tau1 tau2 = do -- Rule MONO -- tcTrace $ "subsCheckRho: MONO " ++ show (tau1, tau2) unify loc tau1 tau2 -- Revert to ordinary unification@@ -3692,13 +3905,16 @@ solveCoercible :: HasCallStack => SolveOne solveCoercible loc iCls [t1, t2] = do -- traceM $ "solveCoercible " ++ prettyShow [t1, t2]- -- pretend newtypes are type synonyms- (t1', t2') <- withNewtypeAsSyns $- (,) <$> expandSynNoChk t1 <*> expandSynNoChk t2+ hasRoles <- coercibleHeads iCls+ -- pretend newtypes are type synonyms, if their constructor is in scope+ ntSyn <- getNewtypeSyn+ syns <- gets synTable+ let t1' = expandSynCo hasRoles ntSyn syns t1+ t2' = expandSynCo hasRoles ntSyn syns t2 -- walk over the types in parallel, -- and generate new Coercible constraints when not equal. -- traceM $ "solveCoercible: " ++ showExprRaw t1' ++ " and " ++ showExprRaw t2'- case genCoerce t1' t2' of+ case genCoerce hasRoles t1' t2' of Nothing -> solveInstCoercible loc iCls t1 t2 -- look for a dict argument Just [(u1, u2)] | u1 `eqEType` t1 && u2 `eqEType` t2 -> solveInstCoercible loc iCls t1 t2 -- look for a dict argument Just tts -> do@@ -3709,15 +3925,92 @@ return $ Just (ETuple [], ncs, []) solveCoercible _ _ _ = impossible -genCoerce :: EType -> EType -> Maybe [(EType, EType)]-genCoerce t1 t2 | eqEType t1 t2 = Just []-genCoerce t1@(EUVar _) t2 = Just [(t1, t2)]-genCoerce t1@(EVar _) t2 = Just [(t1, t2)]-genCoerce t1 t2@(EUVar _) = Just [(t1, t2)]-genCoerce t1 t2@(EVar _) = Just [(t1, t2)]-genCoerce (EApp f1 a1) (EApp f2 a2) = (++) <$> genCoerce f1 f2 <*> genCoerce a1 a2-genCoerce _ _ = Nothing+-- Walk over the types in parallel and generate Coercible constraints where they differ.+-- An application of a type constructor that has a Coercible instance (i.e., a role+-- annotation) is not decomposed, instead it is left for the instance to solve.+genCoerce :: ((Ident, Int) -> Bool) -> EType -> EType -> Maybe [(EType, EType)]+genCoerce hasRoles = gen+ where+ gen t1 t2 | eqEType t1 t2 = Just []+ gen t1@(EUVar _) t2 = Just [(t1, t2)]+ gen t1@(EVar _) t2 = Just [(t1, t2)]+ gen t1 t2@(EUVar _) = Just [(t1, t2)]+ gen t1 t2@(EVar _) = Just [(t1, t2)]+ gen t1@(EApp f1 a1) t2@(EApp f2 a2)+ | Just h1 <- tyConApp t1, Just h2 <- tyConApp t2, h1 == h2, hasRoles h1 = Just [(t1, t2)]+ | otherwise = (++) <$> gen f1 f2 <*> gen a1 a2+ gen _ _ = Nothing +-- Expand synonyms, but not inside applications of type constructors that have roles,+-- since e.g. a nominal argument must not have its newtypes expanded.+-- Synonym arguments are substituted unexpanded, so that an application with roles+-- in the synonym body gets the original arguments.+expandSynCo :: ((Ident, Int) -> Bool) -> (Ident -> Maybe EType) -> SynTable -> EType -> EType+expandSynCo hasRoles ntSyn syns = esyn+ where+ esyn = syn []+ syn ts t =+ case t of+ EApp f a -> syn (a : ts) f+ EVar i+ | hasRoles (i, length ts) -> eApps t ts+ | Just (EForall _ vks tt) <- M.lookup i syns <|> ntSyn i, length vks <= length ts ->+ let (as, ts') = splitAt (length vks) ts+ in syn ts' (subst (zip (map idKindIdent vks) as) tt)+ | otherwise -> eApps t (map esyn ts)+ EUVar _ -> eApps t (map esyn ts)+ ESign a _ -> syn ts a+ EForall b iks tt | null ts -> EForall b iks (esyn tt)+ ELit _ _ -> t+ _ -> impossiblePP t++-- Get a function that gives the representation type of a newtype, as a type synonym.+-- It only does so if the newtype constructor is in scope, i.e.,+-- it is visible unqualified or qualified with one of the import qualifiers.+-- Directly recursive newtypes are not expanded.+getNewtypeSyn :: T (Ident -> Maybe EType)+getNewtypeSyn = do+ dt <- gets dataTable+ venv <- gets valueTable+ quals <- gets importQuals+ let ntSyn qi =+ case M.lookup qi dt of+ Just (Newtype (_, vs) (Constr _ _ c _ et) _) ->+ let t = either (snd . head) (snd . snd . head) et+ in if qi `notElem` allVarsExpr t && visible (qualIdent (qualOf qi) c) c then+ case etaReduce vs t of (vs', t') -> Just (EForall QExpl vs' t')+ else+ Nothing+ _ -> Nothing+ -- Check if the constructor qc is in scope, under the name c or q.c.+ visible qc c = any isCon (c : map (`qualIdent` c) quals)+ where isCon i =+ case stLookupST i venv of+ STOne e -> isQc e+ STMany es -> any isQc es+ STNone -> False+ isQc (Entry (ECon con) _) = conIdent con == qc+ isQc _ = False+ return ntSyn++-- Get the type constructor and number of arguments of a type application.+tyConApp :: EType -> Maybe (Ident, Int)+tyConApp = go 0+ where go n (EApp f _) = go (n + 1) f+ go n (EVar i) | isConIdent i = Just (i, n)+ go _ _ = Nothing++-- The type constructors (and their arity) that have Coercible instances.+-- These instances come from role annotations.+coercibleHeads :: Ident -> T ((Ident, Int) -> Bool)+coercibleHeads iCls = do+ it <- gets instTable+ case M.lookup iCls it of+ Nothing -> return (const False)+ Just (InstInfo _ insts _) -> do+ let hds = [ h | InstDict _ f <- insts, t : _ <- [snd (f 0)], Just h <- [tyConApp t] ]+ return (`elem` hds)+ solveInstCoercible :: SLoc -> Ident -> EType -> EType -> T (Maybe (Expr, [Goal], [Improve])) solveInstCoercible loc iCls t1 t2 = do {- XXX Should use the reflexive, symmetric, transitive closure for Coercible.@@ -3738,11 +4031,15 @@ -- XXX It's rather inefficient to do this over and over. -- XXX We give up on direct recursive newtypes. Should do it for mutual recursion too. withNewtypeAsSyns :: T a -> T a-withNewtypeAsSyns act = do+withNewtypeAsSyns = withSomeNewtypesAsSyns (const True)++-- Treat the newtypes whose names satisfy the predicate as synonyms.+withSomeNewtypesAsSyns :: (Ident -> Bool) -> T a -> T a+withSomeNewtypesAsSyns expand act = do st <- gets synTable -- get old syntable -- Copy newtypes to syn table dt <- gets dataTable- let ext (qi, Newtype (_, vs) (Constr _ _ _c _ et) _) = do+ let ext (qi, Newtype (_, vs) (Constr _ _ _c _ et) _) | expand qi = do -- XXX We should check that the constructor name (_c) is visible. -- But this is tricky since we don't know under what qualified name it -- it could be visible.@@ -3775,7 +4072,7 @@ mkConstDict :: SLoc -> Ident -> Expr -> T (Maybe (Expr, [Goal], [Improve])) mkConstDict loc iCls e = do let res = EApp (EVar $ mkClassConstructor iCls) fcn- fcn = EApp (ELit loc (LPrim "K")) e -- constant function+ fcn = EApp (ELit loc (LPrim PK)) e -- constant function return $ Just (res, [], []) type TySubst = [(TRef, EType)]@@ -3886,6 +4183,11 @@ [] -> return () (i, t) : _ -> do t' <- derefUVar t+ case t' of+ EApp (EApp (EVar eq) a) e | eq == identTypeEq -> mismatchError (getSLoc i) (a, e)+ _ -> do+ c <- head <$> niceTypes [t']+ tcError (getSLoc i) $ "no instance for (" ++ showTypeUser c ++ ")" {- is <- gets instTable traceM $ "Cannot satisfy constraint: " ++ unlines (map (\ (xi, ii) -> show xi ++ ":\n " ++ showInstInfo ii) (M.toList is))@@ -3896,8 +4198,6 @@ cs' <- gets constraints traceM (show (length cs, length cs')) -}- tcError (getSLoc i) $ "Cannot satisfy constraint: " ++ showExpr t'- ++ "\n fully qualified: " ++ showExprRaw t' -- Add a type equality constraint. addEqConstraint :: SLoc -> EType -> EType -> T ()
@@ -2,8 +2,7 @@ module MicroHs.Version( version, ) where-import qualified Prelude()-import Data.Version+import qualified Prelude(); import MHSPrelude version :: Version-version = makeVersion [0,16,0,0]+version = makeVersion [0,17,4,0]
@@ -1,189 +0,0 @@--- Copyright 2023 Lennart Augustsson--- See LICENSE file for full license.-{-# OPTIONS_GHC -Wno-type-defaults -Wno-noncanonical-monad-instances #-}-{-# LANGUAGE FunctionalDependencies #-}-module Text.ParserComb(- Prsr, runPrsr,- satisfy, satisfyM,- many, optional, some,- sepBy, sepBy1,- sepEndBy, sepEndBy1,- (<?>),- (<<),- --notFollowedBy,- --lookAhead,- nextToken,- LastFail(..),- TokenMachine(..),- mapTokenState,- ) where-import qualified Prelude(); import MHSPrelude hiding (fail)-import Control.Applicative-import Control.Monad.Fail as F-import Control.Monad--data LastFail t- = LastFail Int [t] [String]- deriving (Show)--maxInt :: Int-maxInt = 1000000000--noFail :: forall t . LastFail t-noFail = LastFail maxInt [] []--longest :: forall t . LastFail t -> LastFail t -> LastFail t-longest lf1@(LastFail l1 t1 x1) lf2@(LastFail l2 _ x2)- | l1 < l2 = lf1- | l2 < l1 = lf2- | otherwise = LastFail l1 t1 (x1 ++ x2)--class TokenMachine tm t | tm -> t where- tmNextToken :: tm -> (t, tm)- tmRawTokens :: tm -> [t]--tmLeft :: forall tm t . TokenMachine tm t => tm -> Int-tmLeft = length . tmRawTokens--firstToken :: forall tm t . TokenMachine tm t => tm -> [t]-firstToken tm =- case tmNextToken tm of- (t, _) -> [t]--data Res tm t a = Success a tm (LastFail t) | Failure (LastFail t)- --deriving (Show)--newtype Prsr tm t a = P (tm -> Res tm t a)---instance Show (Prsr s t a) where show _ = "<<Prsr>>"--runP :: forall tm t a . Prsr tm t a -> (tm -> Res tm t a)-runP (P p) = p--mapTokenState :: forall tm t . (tm -> tm) -> Prsr tm t ()-mapTokenState f = P (\tm -> Success () (f tm) noFail)--instance Functor (Prsr tm t) where- fmap f p = P $ \t ->- case runP p t of- Success a u lf -> Success (f a) u lf- Failure lf -> Failure lf--instance Applicative (Prsr tm t) where- pure a = P $ \t -> Success a t noFail- f <*> a = P $ \t ->- case runP f t of- Failure lf -> Failure lf- Success f' t' lff ->- case runP a t' of- Failure lfa -> Failure (longest lff lfa)- Success a' t'' lfa -> Success (f' a') t'' (longest lff lfa)--- Hugs does not have *> here--- (*>) p k = p >>= \ _ -> k--(<<) :: Prsr tm t a -> Prsr tm t b -> Prsr tm t a-(<<) f a = P $ \t ->- case runP f t of- Failure lf -> Failure lf- Success f' t' lff ->- case runP a t' of- Failure lfa -> Failure (longest lff lfa)- Success _ t'' lfa -> Success f' t'' (longest lff lfa)--instance Monad (Prsr tm t) where- (>>=) p k = P $ \t ->- case runP p t of- Success a u lfa ->- case runP (k a) u of- Success b v lfb -> Success b v (longest lfa lfb)- Failure lfb -> Failure (longest lfa lfb)- Failure lf -> Failure lf- (>>) p k = p >>= const k- return = pure--instance TokenMachine tm t => MonadFail (Prsr tm t) where- fail m = P $ \ts -> Failure (LastFail (tmLeft ts) (firstToken ts) [m])--instance TokenMachine tm t => Alternative (Prsr tm t) where- empty = F.fail "empty"-- (<|>) p q = P $ \ t ->- case runP p t of- Failure lfa ->- case runP q t of- Success b v lfb -> Success b v (longest lfa lfb)- Failure lfb -> Failure (longest lfa lfb)- r -> r--instance TokenMachine tm t => MonadPlus (Prsr tm t) where- mzero = F.fail "mzero"- mplus = (<|>)--satisfy :: forall tm t . TokenMachine tm t => String -> (t -> Bool) -> Prsr tm t t-satisfy msg f = P $ \ acs ->- case tmNextToken acs of- (c, cs) | f c -> Success c cs noFail- _ -> Failure (LastFail (tmLeft acs) (firstToken acs) [msg])--satisfyM :: forall tm t a . TokenMachine tm t => String -> (t -> Maybe a) -> Prsr tm t a-satisfyM msg f = P $ \ acs ->- case tmNextToken acs of- (c, cs) | Just a <- f c -> Success a cs noFail- _ -> Failure (LastFail (tmLeft acs) (firstToken acs) [msg])--infixl 9 <?>-(<?>) :: forall tm t a . Prsr tm t a -> String -> Prsr tm t a-(<?>) p e = P $ \ t ->--- trace ("<?> " ++ show e) $- case runP p t of- Failure (LastFail l ts _) -> Failure (LastFail l ts [e])- s -> s--{--lookAhead :: forall tm t a . TokenMachine tm t => Prsr tm t a -> Prsr tm t ()-lookAhead p = P $ \ t ->- case runP p t of- Many [] (LastFail l ts xs) -> Many [] (LastFail l (take 1 ts) xs)- _ -> Many [((), t)] noFail--}--nextToken :: forall tm t . TokenMachine tm t => Prsr tm t t-nextToken = P $ \ cs ->- case tmNextToken cs of- (c, _) -> Success c cs noFail--{--eof :: forall tm t . TokenMachine tm t => Prsr tm t ()-eof = P $ \ t@(cs, _) ->- case tmNextToken cs of- Nothing -> Many [((), t)] noFail- Just _ -> Many [] (LastFail (tmLeft cs) (firstToken cs) ["eof"])--}--{--notFollowedBy :: forall t a . Prsr t a -> Prsr t ()-notFollowedBy p = P $ \ t@(ts,_) ->- case runP p t of- Many [] _ -> Many [((), t)] noFail- _ -> Many [] (LastFail (length ts) (take 1 ts) ["!"])--}--runPrsr :: forall tm t a . --X(Show a, Show s) =>- Prsr tm t a -> tm -> Either (LastFail t) a-runPrsr (P p) f =- case p f of- Failure lf -> Left lf- Success a _ _ -> Right a-----------------------------------sepBy1 :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]-sepBy1 p sep = (:) <$> p <*> many (sep >> p)--sepBy :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]-sepBy p sep = sepBy1 p sep <|> pure []--sepEndBy :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]-sepEndBy p sep = sepEndBy1 p sep <|> pure []--sepEndBy1 :: TokenMachine tm t => Prsr tm t a -> Prsr tm t sep -> Prsr tm t [a]-sepEndBy1 p sep = (:) <$> p <*> ((sep >> sepEndBy p sep) <|> pure [])
@@ -1,429 +0,0 @@--- Based on the pretty-printer outlined in the paper--- 'The Design of a Pretty-printing Library' by--- John Hughes in Advanced Functional Programming, 1995.--- With inspiration and code from the from the Hackage package pretty.-module Text.PrettyPrint.HughesPJLite(- Doc,- text, empty,- (<+>), ($$), ($+$),- hcat, hsep,- vcat,- sep, cat,- fsep, fcat,- nest, hang,- punctuate,- parens, brackets, braces,- maybeParens,- Style,- render, renderStyle,- ) where-import qualified Prelude(); import MHSPrelude--infixr 6 <+>-infixl 5 $$, $+$--data Doc- = Empty -- ^ An empty span, see 'empty'.- | NilAbove Doc -- ^ @text "" $$ x@.- | TextBeside String Doc -- ^ @text s <> x@.- | Nest Int Doc -- ^ @nest k x@.- | Union Doc Doc -- ^ @ul `union` ur@.- | NoDoc -- ^ The empty set of documents.- | Beside Doc Bool Doc -- ^ True <=> space between.- | Above Doc Bool Doc -- ^ True <=> never overlap.--type RDoc = Doc--text :: String -> Doc-text s = TextBeside s Empty--empty :: Doc-empty = Empty--reduceDoc :: Doc -> RDoc-reduceDoc (Beside p g q) = beside p g (reduceDoc q)-reduceDoc (Above p g q) = above p g (reduceDoc q)-reduceDoc p = p--hcat :: [Doc] -> Doc-hcat = snd . reduceHoriz . foldr (`Beside` False) empty--hsep :: [Doc] -> Doc-hsep = snd . reduceHoriz . foldr (`Beside` True) empty--vcat :: [Doc] -> Doc-vcat = snd . reduceVert . foldr (`Above` False) empty--nest :: Int -> Doc -> Doc-nest k p = mkNest k (reduceDoc p)---- | @hang d1 n d2 = sep [d1, nest n d2]@-hang :: Doc -> Int -> Doc -> Doc-hang d1 n d2 = sep [d1, nest n d2]--punctuate :: Doc -> [Doc] -> [Doc]-punctuate _ [] = []-punctuate p (x:xs) = go x xs- where go y [] = [y]- go y (z:zs) = (y <> p) : go z zs--maybeParens :: Bool -> Doc -> Doc-maybeParens False = id-maybeParens True = parens--parens :: Doc -> Doc-parens p = text "(" <> p <> text ")"-braces :: Doc -> Doc-braces p = text "{" <> p <> text "}"-brackets :: Doc -> Doc-brackets p = text "[" <> p <> text "]"---- mkNest checks for Nest's invariant that it doesn't have an Empty inside it-mkNest :: Int -> Doc -> Doc-mkNest k (Nest k1 p) = mkNest (k + k1) p-mkNest _ NoDoc = NoDoc-mkNest _ Empty = Empty-mkNest 0 p = p-mkNest k p = nest_ k p---- mkUnion checks for an empty document-mkUnion :: Doc -> Doc -> Doc-mkUnion Empty _ = Empty-mkUnion p q = p `union_` q--data IsEmpty = IsEmpty | NotEmpty--reduceHoriz :: Doc -> (IsEmpty, Doc)-reduceHoriz (Beside p g q) = eliminateEmpty Beside (snd (reduceHoriz p)) g (reduceHoriz q)-reduceHoriz doc = (NotEmpty, doc)--reduceVert :: Doc -> (IsEmpty, Doc)-reduceVert (Above p g q) = eliminateEmpty Above (snd (reduceVert p)) g (reduceVert q)-reduceVert doc = (NotEmpty, doc)--eliminateEmpty ::- (Doc -> Bool -> Doc -> Doc) ->- Doc -> Bool -> (IsEmpty, Doc) -> (IsEmpty, Doc)-eliminateEmpty _ Empty _ q = q-eliminateEmpty cons p g q =- (NotEmpty,- case q of- (NotEmpty, q') -> cons p g q'- (IsEmpty, _) -> p- )--nilAbove_ :: RDoc -> RDoc-nilAbove_ = NilAbove---- | Arg of a TextBeside is always an RDoc.-textBeside_ :: String -> RDoc -> RDoc-textBeside_ = TextBeside--nest_ :: Int -> RDoc -> RDoc-nest_ = Nest--union_ :: RDoc -> RDoc -> RDoc-union_ = Union--($$) :: Doc -> Doc -> Doc-p $$ q = above_ p False q---- | Above, with no overlapping.--- '$+$' is associative, with identity 'empty'.-($+$) :: Doc -> Doc -> Doc-p $+$ q = above_ p True q--above_ :: Doc -> Bool -> Doc -> Doc-above_ p _ Empty = p-above_ Empty _ q = q-above_ p g q = Above p g q--above :: Doc -> Bool -> RDoc -> RDoc-above (Above p g1 q1) g2 q2 = above p g1 (above q1 g2 q2)-above p@Beside{} g q = aboveNest (reduceDoc p) g 0 (reduceDoc q)-above p g q = aboveNest p g 0 (reduceDoc q)---- Specfication: aboveNest p g k q = p $g$ (nest k q)-aboveNest :: RDoc -> Bool -> Int -> RDoc -> RDoc-aboveNest _ _ k _ | k `seq` False = undefined-aboveNest NoDoc _ _ _ = NoDoc-aboveNest (p1 `Union` p2) g k q = aboveNest p1 g k q `union_`- aboveNest p2 g k q--aboveNest Empty _ k q = mkNest k q-aboveNest (Nest k1 p) g k q = nest_ k1 (aboveNest p g (k - k1) q)- -- p can't be Empty, so no need for mkNest--aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q)-aboveNest (TextBeside s p) g k q = TextBeside s rest- where- k1 = k - length s- rest = case p of- Empty -> nilAboveNest g k1 q- _ -> aboveNest p g k1 q--aboveNest Above{} _ _ _ = error "aboveNest Above"-aboveNest Beside{} _ _ _ = error "aboveNest Beside"---- Specification: text s <> nilaboveNest g k q--- = text s <> (text "" $g$ nest k q)-nilAboveNest :: Bool -> Int -> RDoc -> RDoc-nilAboveNest _ k _ | k `seq` False = undefined-nilAboveNest _ _ Empty = Empty- -- Here's why the "text s <>" is in the spec!-nilAboveNest g k (Nest k1 q) = nilAboveNest g (k + k1) q-nilAboveNest g k q | not g && k > 0 -- No newline if no overlap- = textBeside_ (replicate k ' ') q- | otherwise -- Put them really above- = nilAbove_ (mkNest k q)--instance Semigroup Doc where- p <> q = beside_ p False q---- | Beside, separated by space, unless one of the arguments is 'empty'.--- '<+>' is associative, with identity 'empty'.-(<+>) :: Doc -> Doc -> Doc-p <+> q = beside_ p True q--beside_ :: Doc -> Bool -> Doc -> Doc-beside_ p _ Empty = p-beside_ Empty _ q = q-beside_ p g q = Beside p g q---- Specification: beside g p q = p <g> q-beside :: Doc -> Bool -> RDoc -> RDoc-beside NoDoc _ _ = NoDoc-beside (p1 `Union` p2) g q = beside p1 g q `union_` beside p2 g q-beside Empty _ q = q-beside (Nest k p) g q = nest_ k $! beside p g q-beside p@(Beside p1 g1 q1) g2 q2- | g1 == g2 = beside p1 g1 $! beside q1 g2 q2- | otherwise = beside (reduceDoc p) g2 q2-beside p@Above{} g q = let { d = reduceDoc p } in beside d g q-beside (NilAbove p) g q = nilAbove_ $! beside p g q-beside (TextBeside t p) g q = TextBeside t rest- where- rest = case p of- Empty -> nilBeside g q- _ -> beside p g q---- Specification: text "" <> nilBeside g p--- = text "" <g> p-nilBeside :: Bool -> RDoc -> RDoc-nilBeside _ Empty = Empty -- Hence the text "" in the spec-nilBeside g (Nest _ p) = nilBeside g p-nilBeside g p | g = textBeside_ " " p- | otherwise = p--sep :: [Doc] -> Doc-sep = sepX True -- Separate with spaces---- | Either 'hcat' or 'vcat'.-cat :: [Doc] -> Doc-cat = sepX False -- Don't--sepX :: Bool -> [Doc] -> Doc-sepX _ [] = empty-sepX x (p:ps) = sep1 x (reduceDoc p) 0 ps----- Specification: sep1 g k ys = sep (x : map (nest k) ys)--- = oneLiner (x <g> nest k (hsep ys))--- `union` x $$ nest k (vcat ys)-sep1 :: Bool -> RDoc -> Int -> [Doc] -> RDoc-sep1 _ _ k _ | k `seq` False = undefined-sep1 _ NoDoc _ _ = NoDoc-sep1 g (p `Union` q) k ys = sep1 g p k ys `union_`- aboveNest q False k (reduceDoc (vcat ys))--sep1 g Empty k ys = mkNest k (sepX g ys)-sep1 g (Nest n p) k ys = nest_ n (sep1 g p (k - n) ys)--sep1 _ (NilAbove p) k ys = nilAbove_- (aboveNest p False k (reduceDoc (vcat ys)))-sep1 g (TextBeside s p) k ys = textBeside_ s (sepNB g p (k - length s) ys)-sep1 _ Above{} _ _ = error "sep1 Above"-sep1 _ Beside{} _ _ = error "sep1 Beside"--sepNB :: Bool -> Doc -> Int -> [Doc] -> Doc-sepNB g (Nest _ p) k ys- = sepNB g p k ys-sepNB g Empty k ys- = oneLiner (nilBeside g (reduceDoc rest)) `mkUnion`- nilAboveNest False k (reduceDoc (vcat ys))- where- rest | g = hsep ys- | otherwise = hcat ys-sepNB g p k ys- = sep1 g p k ys--oneLiner :: Doc -> Doc-oneLiner NoDoc = NoDoc-oneLiner Empty = Empty-oneLiner (NilAbove _) = NoDoc-oneLiner (TextBeside s p) = textBeside_ s (oneLiner p)-oneLiner (Nest k p) = nest_ k (oneLiner p)-oneLiner (p `Union` _) = oneLiner p-oneLiner Above{} = error "oneLiner Above"-oneLiner Beside{} = error "oneLiner Beside"---- ------------------------------------------------------------------------------ Rendering---- | A rendering style. Allows us to specify constraints to choose among the--- many different rendering options.-data Style = Style Int Rat-lineLength :: Style -> Int-lineLength (Style l _) = l-ribbonsPerLine :: Style -> Rat-ribbonsPerLine (Style _ r) = r--type Rat = (Int, Int)--style :: Style-style = Style 100 (3, 2)---- | Render the @Doc@ to a String using the default @Style@ (see 'style').-render :: Doc -> String-render = renderStyle style---- | Render the @Doc@ to a String using the given @Style@.-renderStyle :: Style -> Doc -> String-renderStyle s = fullRender (lineLength s) (ribbonsPerLine s) ""---- | The general rendering interface. Please refer to the @Style@ and @Mode@--- types for a description of rendering mode, line length and ribbons.-fullRender :: Int -- ^ Line length.- -> Rat -- ^ Ribbons per line.- -> String -- ^ What to do at the end.- -> Doc -- ^ The document.- -> String -- ^ Result.-fullRender lineLen (num, den) rest doc- = display lineLen ribbonLen rest doc'- where- doc' = best bestLineLen ribbonLen (reduceDoc doc)-- ribbonLen = (lineLen * den) `quot` num- bestLineLen = lineLen--display :: Int -> Int -> String -> Doc -> String-display _page_width _ribbon_width end doc- = let lay :: Int -> Doc -> String- lay k (Nest k1 p) = lay (k + k1) p- lay _ Empty = end- lay k (NilAbove p) = "\n" ++ lay k p- lay k (TextBeside s p) = lay1 k s p- lay _ _ = error "display lay"-- lay1 k s p = let r = k + length s- in replicate k ' ' ++ (s ++ lay2 r p)-- lay2 :: Int -> Doc -> String- lay2 k (NilAbove p) = "\n" ++ lay k p- lay2 k (TextBeside s p) = s ++ lay2 (k + length s) p- lay2 k (Nest _ p) = lay2 k p- lay2 _ Empty = end- lay2 _ _ = error "display lay2"- in lay 0 doc--best :: Int -- Line length.- -> Int -- Ribbon length.- -> RDoc- -> RDoc -- No unions in here!.-best w0 r = get w0- where- get _ Empty = Empty- get _ NoDoc = NoDoc- get w (NilAbove p) = nilAbove_ (get w p)- get w (TextBeside s p) = textBeside_ s (get1 w (length s) p)- get w (Nest k p) = nest_ k (get (w - k) p)- get w (p `Union` q) = nicest w r (get w p) (get w q)- get _ _ = error "best get"-- get1 _ _ Empty = Empty- get1 _ _ NoDoc = NoDoc- get1 w sl (NilAbove p) = nilAbove_ (get (w - sl) p)- get1 w sl (TextBeside s p) = textBeside_ s (get1 w (sl + length s) p)- get1 w sl (Nest _ p) = get1 w sl p- get1 w sl (p `Union` q) = nicest1 w r sl (get1 w sl p)- (get1 w sl q)- get1 _ _ _ = error "best get1"--nicest :: Int -> Int -> Doc -> Doc -> Doc-nicest w r = nicest1 w r 0--nicest1 :: Int -> Int -> Int -> Doc -> Doc -> Doc-nicest1 w r sl p q | fits (minWR - sl) p = p- | otherwise = q- where minWR = min w r--fits :: Int -- Space available- -> Doc- -> Bool -- True if *first line* of Doc fits in space available-fits n _ | n < 0 = False-fits _ NoDoc = False-fits _ Empty = True-fits _ (NilAbove _) = True-fits n (TextBeside s p) = fits (n - length s) p-fits _ _ = error "fits"-------------fcat :: [Doc] -> Doc-fcat = fill False--fsep :: [Doc] -> Doc-fsep = fill True---- Specification:------ fill g docs = fillIndent 0 docs------ fillIndent k [] = []--- fillIndent k [p] = p--- fillIndent k (p1:p2:ps) =--- oneLiner p1 <g> fillIndent (k + length p1 + g ? 1 : 0)--- (remove_nests (oneLiner p2) : ps)--- `Union`--- (p1 $*$ nest (-k) (fillIndent 0 ps))------ $*$ is defined for layouts (not Docs) as--- layout1 $*$ layout2 | hasMoreThanOneLine layout1 = layout1 $$ layout2--- | otherwise = layout1 $+$ layout2--fill :: Bool -> [Doc] -> RDoc-fill _ [] = empty-fill g (p:ps) = fill1 g (reduceDoc p) 0 ps--fill1 :: Bool -> RDoc -> Int -> [Doc] -> Doc-fill1 _ _ k _ | k `seq` False = undefined-fill1 _ NoDoc _ _ = NoDoc-fill1 g (p `Union` q) k ys = fill1 g p k ys `union_`- aboveNest q False k (fill g ys)-fill1 g Empty k ys = mkNest k (fill g ys)-fill1 g (Nest n p) k ys = nest_ n (fill1 g p (k - n) ys)-fill1 g (NilAbove p) k ys = nilAbove_ (aboveNest p False k (fill g ys))-fill1 g (TextBeside s p) k ys = textBeside_ s (fillNB g p k ys)-fill1 _ Above{} _ _ = error "fill1 Above"-fill1 _ Beside{} _ _ = error "fill1 Beside"--fillNB :: Bool -> Doc -> Int -> [Doc] -> Doc-fillNB _ _ k _ | k `seq` False = undefined-fillNB g (Nest _ p) k ys = fillNB g p k ys- -- Never triggered, because of invariant (2)-fillNB _ Empty _ [] = Empty-fillNB g Empty k (Empty:ys) = fillNB g Empty k ys-fillNB g Empty k (y:ys) = fillNBE g k y ys-fillNB g p k ys = fill1 g p k ys---fillNBE :: Bool -> Int -> Doc -> [Doc] -> Doc-fillNBE g k y ys- = nilBeside g (fill1 g ((elideNest . oneLiner . reduceDoc) y) k' ys)- -- XXX: TODO: PRETTY: Used to use True here (but GHC used False...)- `mkUnion` nilAboveNest False k (fill g (y:ys))- where k' = if g then k - 1 else k--elideNest :: Doc -> Doc-elideNest (Nest _ d) = d-elideNest d = d
@@ -1,139 +0,0 @@--------------------------------------------------------------------------------- |--- Module : Text.PrettyPrint.HughesPJClass--- Copyright : (c) Lennart Augustsson 2014--- License : BSD-style (see the file LICENSE)------ Maintainer : David Terei <code@davidterei.com>--- Stability : stable--- Portability : portable------ Pretty printing class, simlar to 'Show' but nicer looking.------ Note that the precedence level is a 'Rational' so there is an unlimited--- number of levels. This module re-exports 'Text.PrettyPrint.HughesPJ'.-----------------------------------------------------------------------------------module Text.PrettyPrint.HughesPJLiteClass (- -- * Pretty typeclass- Pretty(..),-- PrettyLevel(..), prettyNormal,- PrettyPrec,- prettyShow,- pPrint0,- appPrec,-- -- re-export HughesPJ- module Text.PrettyPrint.HughesPJLite- ) where-import qualified Prelude(); import MHSPrelude--import Text.PrettyPrint.HughesPJLite---- | Level of detail in the pretty printed output. Level 0 is the least--- detail.-newtype PrettyLevel = PrettyLevel Int- deriving (Eq, Ord, Show)--type PrettyPrec = Int---- | The "normal" (Level 0) of detail.-prettyNormal :: PrettyLevel-prettyNormal = PrettyLevel 0---- | Pretty printing class. The precedence level is used in a similar way as in--- the 'Show' class. Minimal complete definition is either 'pPrintPrec' or--- 'pPrint'.-class Pretty a where- pPrintPrec :: PrettyLevel -> PrettyPrec -> a -> Doc- pPrintPrec _ _ = pPrint-- pPrint :: a -> Doc- pPrint = pPrintPrec prettyNormal 0-- pPrintList :: PrettyLevel -> [a] -> Doc- pPrintList l = brackets . fsep . punctuate comma . map (pPrintPrec l 0)---- | Pretty print a value with the 'prettyNormal' level.-prettyShow :: (Pretty a) => a -> String-prettyShow = render . pPrint--pPrint0 :: (Pretty a) => PrettyLevel -> a -> Doc-pPrint0 l = pPrintPrec l 0--appPrec :: PrettyPrec-appPrec = 10--comma :: Doc-comma = text ","---- Various Pretty instances-instance Pretty Int where pPrint = text . show--instance Pretty Integer where pPrint = text . show--instance Pretty Double where pPrint = text . show--instance Pretty () where pPrint _ = text "()"--instance Pretty Bool where pPrint = text . show--instance Pretty Ordering where pPrint = text . show--instance Pretty Char where- pPrint = text . show- pPrintList _ = text . show--instance (Pretty a) => Pretty (Maybe a) where- pPrintPrec _ _ Nothing = text "Nothing"- pPrintPrec l p (Just x) =- maybeParens (p > appPrec) $ text "Just" <+> pPrintPrec l (appPrec+1) x--instance (Pretty a, Pretty b) => Pretty (Either a b) where- pPrintPrec l p (Left x) =- maybeParens (p > appPrec) $ text "Left" <+> pPrintPrec l (appPrec+1) x- pPrintPrec l p (Right x) =- maybeParens (p > appPrec) $ text "Right" <+> pPrintPrec l (appPrec+1) x--instance (Pretty a) => Pretty [a] where- pPrintPrec l _ = pPrintList l--instance (Pretty a, Pretty b) => Pretty (a, b) where- pPrintPrec l _ (a, b) =- parens $ fsep $ punctuate comma [pPrint0 l a, pPrint0 l b]--instance (Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) where- pPrintPrec l _ (a, b, c) =- parens $ fsep $ punctuate comma [pPrint0 l a, pPrint0 l b, pPrint0 l c]--instance (Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) where- pPrintPrec l _ (a, b, c, d) =- parens $ fsep $ punctuate comma- [pPrint0 l a, pPrint0 l b, pPrint0 l c, pPrint0 l d]--instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) where- pPrintPrec l _ (a, b, c, d, e) =- parens $ fsep $ punctuate comma- [pPrint0 l a, pPrint0 l b, pPrint0 l c, pPrint0 l d, pPrint0 l e]--instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) where- pPrintPrec l _ (a, b, c, d, e, f) =- parens $ fsep $ punctuate comma- [pPrint0 l a, pPrint0 l b, pPrint0 l c,- pPrint0 l d, pPrint0 l e, pPrint0 l f]--instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) =>- Pretty (a, b, c, d, e, f, g) where- pPrintPrec l _ (a, b, c, d, e, f, g) =- parens $ fsep $ punctuate comma- [pPrint0 l a, pPrint0 l b, pPrint0 l c,- pPrint0 l d, pPrint0 l e, pPrint0 l f, pPrint0 l g]--instance (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) =>- Pretty (a, b, c, d, e, f, g, h) where- pPrintPrec l _ (a, b, c, d, e, f, g, h) =- parens $ fsep $ punctuate comma- [pPrint0 l a, pPrint0 l b, pPrint0 l c,- pPrint0 l d, pPrint0 l e, pPrint0 l f, pPrint0 l g, pPrint0 l h]
@@ -115,6 +115,8 @@ void (*closeb)(struct BFILE*); size_t (*readb)(uint8_t *, size_t, struct BFILE*); /* optional block read */ size_t (*writeb)(const uint8_t *, size_t, struct BFILE*); /* optional block write */+ int (*isattyb)(struct BFILE*); /* optional tty test */+ int64_t (*filesizeb)(struct BFILE*); /* optional file size */ } BFILE; static INLINE int@@ -147,6 +149,25 @@ p->flushb(p); } +/* Is the BFILE connected to a terminal? */+static INLINE int+isattyb(BFILE *p)+{+ if (p->isattyb)+ return p->isattyb(p);+ else+ return 0; /* no method, so not a terminal */+}++static INLINE int64_t+filesizeb(BFILE *p)+{+ if (p->filesizeb)+ return p->filesizeb(p);+ else+ return -1; /* no method, so size unknown */+}+ void putsb(const char *str, struct BFILE *p) {@@ -341,6 +362,7 @@ p->mets.closeb = closeb_rd_mem; p->mets.readb = readb_mem; p->mets.writeb = 0;+ p->mets.isattyb = 0; p->bf.size = len; p->bf.pos = 0; p->bf.buf = (uint8_t *)buf;@@ -360,6 +382,7 @@ p->mets.closeb = closeb_wr_mem; p->mets.readb = 0; p->mets.writeb = writeb_mem;+ p->mets.isattyb = 0; bfbuffer_init(&p->bf, 1000); return (struct BFILE*)p; }@@ -382,6 +405,10 @@ #if WANT_STDIO /***************** BFILE via FILE *******************/+#if defined(_WIN32)+#include <io.h> /* for _isatty() */+#endif+ struct BFILE_file { BFILE mets; FILE *file;@@ -428,6 +455,30 @@ FREE(p); } +int+isattyb_file(BFILE *bp)+{+ struct BFILE_file *p = (struct BFILE_file *)bp;+ CHECKBFILE(bp, getb_file);+#if defined(_WIN32)+ return _isatty(_fileno(p->file));+#else+ return isatty(fileno(p->file));+#endif+}++int64_t+filesizeb_file(BFILE *bp)+{+ struct BFILE_file *p = (struct BFILE_file *)bp;+ CHECKBFILE(bp, getb_file);+#if WANT_DIR+ return get_FILE_size(p->file);+#else+ return -1;+#endif+}+ void freeb_file(BFILE *bp) {@@ -465,6 +516,8 @@ p->mets.closeb = closeb_file; p->mets.readb = readb_file; p->mets.writeb = writeb_file;+ p->mets.isattyb = isattyb_file;+ p->mets.filesizeb = filesizeb_file; p->file = f; return (BFILE*)p; }@@ -528,6 +581,26 @@ FREE(p); } +int+isattyb_fd(BFILE *bp)+{+ struct BFILE_fd *p = (struct BFILE_fd *)bp;+ CHECKBFILE(bp, getb_fd);+ return isatty(p->fd);+}++int64_t+filesizeb_fd(BFILE *bp)+{+ struct BFILE_fd *p = (struct BFILE_fd *)bp;+ CHECKBFILE(bp, getb_fd);+#if WANT_DIR+ return get_fd_size(p->fd);+#else+ return -1;+#endif+}+ void freeb_fd(BFILE *bp) {@@ -565,6 +638,8 @@ p->mets.closeb = closeb_fd; p->mets.readb = readb_fd; p->mets.writeb = writeb_fd;+ p->mets.isattyb = isattyb_fd;+ p->mets.filesizeb = filesizeb_fd; p->fd = fd; p->unget = -1; return (BFILE*)p;@@ -646,6 +721,15 @@ FREE(p); } +int+isattyb_lz77(BFILE *bp)+{+ struct BFILE_lz77 *p = (struct BFILE_lz77*)bp;+ CHECKBFILE(bp, getb_lz77);++ return isattyb(p->bfile);+}+ size_t readb_lz77(uint8_t *buf, size_t size, BFILE *bp) {@@ -679,6 +763,8 @@ p->mets.closeb = closeb_lz77; p->mets.readb = readb_lz77; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_lz77;+ p->mets.filesizeb = 0; p->read = 1; p->bfile = file; p->numflush = 0;@@ -715,6 +801,8 @@ p->mets.closeb = closeb_lz77; p->mets.readb = 0; p->mets.writeb = writeb_lz77;+ p->mets.isattyb = isattyb_lz77;+ p->mets.filesizeb = 0; p->read = 0; p->bfile = file; p->numflush = 0;@@ -855,6 +943,15 @@ closeb(p->bfile); } +int+isattyb_rle(BFILE *bp)+{+ struct BFILE_rle *p = (struct BFILE_rle*)bp;+ CHECKBFILE(bp, getb_rle);++ return isattyb(p->bfile);+}+ void flushb_rle(BFILE *bp) {@@ -881,6 +978,7 @@ p->mets.closeb = closeb_rle; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_rle; p->count = 0; p->unget = -1; p->bfile = file;@@ -903,6 +1001,7 @@ p->mets.closeb = closeb_rle; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_rle; p->count = 0; p->byte = -1; p->bfile = file;@@ -965,6 +1064,15 @@ closeb(p->bfile); } +int+isattyb_bwt(BFILE *bp)+{+ struct BFILE_bwt *p = (struct BFILE_bwt*)bp;+ CHECKBFILE(bp, getb_bwt);++ return isattyb(p->bfile);+}+ size_t readb_bwt(uint8_t *buf, size_t size, BFILE *bp) {@@ -1121,6 +1229,8 @@ p->mets.closeb = closeb_bwt; p->mets.readb = readb_bwt; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_bwt;+ p->mets.filesizeb = 0; p->read = 1; p->bfile = file; p->numflush = 0;@@ -1159,6 +1269,8 @@ p->mets.closeb = closeb_bwt; p->mets.readb = 0; p->mets.writeb = writeb_bwt;+ p->mets.isattyb = isattyb_bwt;+ p->mets.filesizeb = 0; p->read = 0; p->bfile = file; p->numflush = 0;@@ -1171,20 +1283,43 @@ /***************** BFILE with UTF8 encode/decode *******************/ -#if WANT_UTF8+/*+ * This transducer is always compiled in: mk_std() and mkStringU() in eval.c+ * use it unconditionally for stdio and ByteString-to-String decoding, so it+ * must exist regardless of WANT_UTF8. The flag instead selects the decode+ * policy below: real UTF-8 when set, one Char per raw byte when not, so+ * every byte<->Char boundary in the runtime agrees on what "no UTF-8" means.+ */ struct BFILE_utf8 { BFILE mets; BFILE *bfile; int unget;+ uint8_t pend[3];+ int npend; }; +static int+next_raw_utf8(struct BFILE_utf8 *p)+{+ if (p->npend > 0)+ return p->pend[--p->npend];+ return getb(p->bfile);+}++static void+push_raw_utf8(struct BFILE_utf8 *p, int b)+{+ if (b >= 0)+ p->pend[p->npend++] = (uint8_t)b;+}+ /* XXX: This is not right with WORD_SIZE==16 */ int getb_utf8(BFILE *bp) { struct BFILE_utf8 *p = (struct BFILE_utf8*)bp; CHECKBFILE(bp, getb_utf8);- int c1, c2, c3, c4;+ int c1; /* Do we have an ungetb character? */ if (p->unget >= 0) {@@ -1192,38 +1327,60 @@ p->unget = -1; return c1; }- c1 = getb(p->bfile);+ c1 = next_raw_utf8(p);+#if !WANT_UTF8+ return c1; /* one Char per raw byte, no decoding */+#else+ int c2, c3, c4; if (c1 < 0) return -1; if ((c1 & 0x80) == 0) return c1;- c2 = getb(p->bfile);- if (c2 < 0)- return -1; if ((c1 & 0xe0) == 0xc0) {- int c = ((c1 & 0x1f) << 6) | (c2 & 0x3f);- /* accept overlong encoding of 0, modified UTF-8 uses that */- if (0 < c && c < 0x80) ERR("getb_utf8: overlong encoding");- return c;+ c2 = next_raw_utf8(p);+ if ((c2 & 0xc0) == 0x80) {+ int c = ((c1 & 0x1f) << 6) | (c2 & 0x3f);+ /* accept overlong encoding of 0, modified UTF-8 uses that */+ if (c == 0 || c >= 0x80)+ return c;+ }+ push_raw_utf8(p, c2);+ return 0xdc00 | c1; }- c3 = getb(p->bfile);- if (c3 < 0)- return -1; if ((c1 & 0xf0) == 0xe0) {- int c = ((c1 & 0x0f) << 12) | ((c2 & 0x3f) << 6) | (c3 & 0x3f);- if (c < 0x800) ERR("getb_utf8: overlong encoding");- return c;+ c2 = next_raw_utf8(p);+ if ((c2 & 0xc0) == 0x80) {+ c3 = next_raw_utf8(p);+ if ((c3 & 0xc0) == 0x80) {+ int c = ((c1 & 0x0f) << 12) | ((c2 & 0x3f) << 6) | (c3 & 0x3f);+ if (c >= 0x800 && (c < 0xd800 || c > 0xdfff))+ return c;+ }+ push_raw_utf8(p, c3);+ }+ push_raw_utf8(p, c2);+ return 0xdc00 | c1; }- c4 = getb(p->bfile);- if (c4 < 0)- return -1; if ((c1 & 0xf8) == 0xf0) {- int c = ((c1 & 0x07) << 18) | ((c2 & 0x3f) << 12) | ((c3 & 0x3f) << 6) | (c4 & 0x3f);- if (c < 0x10000) ERR("getb_utf8: overlong encoding");- return c;+ c2 = next_raw_utf8(p);+ if ((c2 & 0xc0) == 0x80) {+ c3 = next_raw_utf8(p);+ if ((c3 & 0xc0) == 0x80) {+ c4 = next_raw_utf8(p);+ if ((c4 & 0xc0) == 0x80) {+ int c = ((c1 & 0x07) << 18) | ((c2 & 0x3f) << 12) | ((c3 & 0x3f) << 6) | (c4 & 0x3f);+ if (c >= 0x10000 && c < 0x110000)+ return c;+ }+ push_raw_utf8(p, c4);+ }+ push_raw_utf8(p, c3);+ }+ push_raw_utf8(p, c2);+ return 0xdc00 | c1; }- ERR("getb_utf8");- NOTREACHED;+ return 0xdc00 | c1;+#endif /* WANT_UTF8 */ } void@@ -1243,6 +1400,16 @@ CHECKBFILE(bp, getb_utf8); if (c < 0) ERR("putb_utf8: < 0");+#if !WANT_UTF8+ putb(c, p->bfile); /* one raw byte per Char, no encoding */+ return;+#else+ if (0xdc80 <= c && c <= 0xdcff) {+ putb(c & 0xff, p->bfile);+ return;+ }+ if ((c & 0x1ff800) == 0xd800)+ c = 0xfffd; if (0 < c && c < 0x80) { /* modified UTF-8 avoids 0 */ putb(c, p->bfile); return;@@ -1266,6 +1433,7 @@ return; } ERR("putb_utf8");+#endif /* WANT_UTF8 */ } void@@ -1287,6 +1455,24 @@ FREE(p); } +int+isattyb_utf8(BFILE *bp)+{+ struct BFILE_utf8 *p = (struct BFILE_utf8*)bp;+ CHECKBFILE(bp, getb_utf8);++ return isattyb(p->bfile);+}++int64_t+filesizeb_utf8(BFILE *bp)+{+ struct BFILE_utf8 *p = (struct BFILE_utf8*)bp;+ CHECKBFILE(bp, getb_utf8);++ return filesizeb(p->bfile);+}+ BFILE * add_utf8(BFILE *file) {@@ -1301,12 +1487,14 @@ p->mets.closeb = closeb_utf8; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_utf8;+ p->mets.filesizeb = filesizeb_utf8; p->bfile = file; p->unget = -1;+ p->npend = 0; return (BFILE*)p; }-#endif /* WANT_UTF8 */ /***************** BFILE that just buffers *******************/ @@ -1405,6 +1593,24 @@ FREE(p); } +int+isattyb_buf(BFILE *bp)+{+ struct BFILE_buf *p = (struct BFILE_buf*)bp;+ CHECKBFILE(bp, getb_buf);++ return isattyb(p->bfile);+}++int64_t+filesizeb_buf(BFILE *bp)+{+ struct BFILE_buf *p = (struct BFILE_buf*)bp;+ CHECKBFILE(bp, getb_buf);++ return filesizeb(p->bfile);+}+ /* bufsize==0 no buffering, bufsize<0 linebuffered, bufsize>0 regular */ BFILE * add_buf(BFILE *file, int bufsize)@@ -1420,6 +1626,8 @@ p->mets.closeb = closeb_buf; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_buf;+ p->mets.filesizeb = filesizeb_buf; p->bfile = file; p->unget = -1; p->pos = 0;@@ -1505,6 +1713,24 @@ FREE(p); } +int+isattyb_crlf(BFILE *bp)+{+ struct BFILE_crlf *p = (struct BFILE_crlf*)bp;+ CHECKBFILE(bp, getb_crlf);++ return isattyb(p->bfile);+}++int64_t+filesizeb_crlf(BFILE *bp)+{+ struct BFILE_crlf *p = (struct BFILE_crlf*)bp;+ CHECKBFILE(bp, getb_crlf);++ return filesizeb(p->bfile);+}+ BFILE * add_crlf(BFILE *file) {@@ -1519,6 +1745,8 @@ p->mets.closeb = closeb_crlf; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_crlf;+ p->mets.filesizeb = filesizeb_crlf; p->bfile = file; return (BFILE*)p; }@@ -1715,6 +1943,22 @@ FREE(p); } +static int+isattyb_b64(BFILE *bp) {+ struct BFILE_b64 *p = (struct BFILE_b64*)bp;+ CHECKBFILE(bp, getb_b64);++ return isattyb(p->bfile);+}++static int64_t+filesizeb_b64(BFILE *bp) {+ struct BFILE_b64 *p = (struct BFILE_b64*)bp;+ CHECKBFILE(bp, getb_b64);++ return filesizeb(p->bfile);+}+ BFILE * add_base64_encoder(BFILE *file) { struct BFILE_b64 *p = MALLOC(sizeof(struct BFILE_b64));@@ -1728,6 +1972,8 @@ p->mets.closeb = closeb_b64; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_b64;+ p->mets.filesizeb = filesizeb_b64; p->bfile = file; p->read = 0;@@ -1755,6 +2001,8 @@ p->mets.closeb = closeb_b64; p->mets.readb = 0; p->mets.writeb = 0;+ p->mets.isattyb = isattyb_b64;+ p->mets.filesizeb = filesizeb_b64; p->bfile = file; p->read = 1; p->unget = -1;@@ -1784,182 +2032,298 @@ * To use, #define LZMA_IMPLEMENTATION before including lzma.h, * then compile with this file. *- * Wire format (same envelope style as the lz77 transducer):+ * Wire format: * "LZ2" -- 3-byte magic / version tag- * uint32 olen -- compressed length (little-endian, 4 bytes)- * <olen bytes> -- lzma_compress output (includes the 13-byte- * LZMA properties+size header)- *- * Both compressor and decompressor buffer the entire payload in- * memory, matching the existing lz77 design in bfile.c.+ * <5 bytes> -- LZMA properties header+ * <stream> -- LZMA compressed bitstream with end-of-stream marker */ -struct BFILE_lzma {+#define LZMA_IN_BUF_SIZE 4096++struct BFILE_lzma_dec { BFILE mets; BFILE *bfile; /* underlying BFILE */- struct bfbuffer bf;- int read; /* 1 = decompressor, 0 = compressor */- int numflush;+ CLzmaDec dec;+ SizeT read_pos; /* read cursor in dec.dic */+ SizeT in_pos; /* read cursor in in_buf */+ SizeT in_len; /* valid bytes in in_buf */+ int eof; /* end of LZMA stream reached */+ int unget; /* >= 0 if an ungot byte is pending */+ Byte in_buf[LZMA_IN_BUF_SIZE]; }; -/* ---- shared getb / ungetb / putb / readb / writeb ---- */+struct BFILE_lzma_enc {+ BFILE mets;+ BFILE *bfile; /* underlying BFILE */+ CLzmaEnc *enc;+ ISeqOutStream out_stream;+ int flushed;+}; -int-getb_lzma(BFILE *bp)+static size_t+lzma_seq_out_write(const ISeqOutStream *pp, const void *data, size_t size) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);- return bfbuffer_get(&p->bf);+ struct BFILE_lzma_enc *p = CONTAINER_FROM_VTBL(pp, struct BFILE_lzma_enc, out_stream);+ return writeb((const uint8_t *)data, size, p->bfile); } -void-ungetb_lzma(int c, BFILE *bp)+static SRes+lzma_seq_in_read(const ISeqInStream *pp, void *buf, size_t *size) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);- p->bf.pos--;+ (void)pp;+ (void)buf;+ *size = 0;+ return SZ_OK; } -void-putb_lzma(int b, BFILE *bp)+static const ISeqInStream lzma_dummy_in_stream = { lzma_seq_in_read };++/* Fill more decoded bytes into p->dec.dic */+static void+lzma_dec_fill(struct BFILE_lzma_dec *p) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);- bfbuffer_snoc(&p->bf, b);+ while (p->read_pos == p->dec.dicPos && !p->eof) {+ if (p->dec.dicPos == p->dec.dicBufSize) {+ p->dec.dicPos = 0;+ p->read_pos = 0;+ }+ if (p->in_pos == p->in_len) {+ p->in_pos = 0;+ p->in_len = readb(p->in_buf, LZMA_IN_BUF_SIZE, p->bfile);+ }+ SizeT in_rem = p->in_len - p->in_pos;+ ELzmaStatus status = LZMA_STATUS_NOT_SPECIFIED;+ SRes res = LzmaDec_DecodeToDic(&p->dec, p->dec.dicBufSize,+ p->in_buf + p->in_pos, &in_rem,+ LZMA_FINISH_ANY, &status);+ if (res != SZ_OK)+ ERR("LzmaDec_DecodeToDic");+ p->in_pos += in_rem;+ if (status == LZMA_STATUS_FINISHED_WITH_MARK) {+ p->eof = 1;+ } else if (status == LZMA_STATUS_NEEDS_MORE_INPUT &&+ in_rem == 0 && p->in_len == 0 &&+ p->read_pos == p->dec.dicPos) {+ ERR("LZMA unexpected EOF");+ }+ } } -size_t-readb_lzma(uint8_t *buf, size_t size, BFILE *bp)+static int+getb_lzma_dec(BFILE *bp) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);- return bfbuffer_read(&p->bf, buf, size);+ struct BFILE_lzma_dec *p = (struct BFILE_lzma_dec *)bp;+ CHECKBFILE(bp, getb_lzma_dec);+ if (p->unget >= 0) {+ int c = p->unget;+ p->unget = -1;+ return c;+ }+ if (p->read_pos == p->dec.dicPos) {+ lzma_dec_fill(p);+ if (p->read_pos == p->dec.dicPos)+ return -1;+ }+ return p->dec.dic[p->read_pos++]; } -size_t-writeb_lzma(const uint8_t *str, size_t size, BFILE *bp)+static void+ungetb_lzma_dec(int c, BFILE *bp) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);- return bfbuffer_write(&p->bf, str, size);+ struct BFILE_lzma_dec *p = (struct BFILE_lzma_dec *)bp;+ CHECKBFILE(bp, getb_lzma_dec);+ if (c < 0)+ return;+ if (p->unget >= 0)+ ERR("ungetb_lzma_dec: double unget");+ p->unget = c; } -/* ---- compressor flush / close ---- */+static size_t+readb_lzma_dec(uint8_t *buf, size_t size, BFILE *bp)+{+ struct BFILE_lzma_dec *p = (struct BFILE_lzma_dec *)bp;+ CHECKBFILE(bp, getb_lzma_dec);+ size_t total = 0; -void-flushb_lzma(BFILE *bp)+ if (size == 0)+ return 0;++ if (p->unget >= 0) {+ *buf++ = (uint8_t)p->unget;+ p->unget = -1;+ total++;+ size--;+ }++ while (size > 0) {+ if (p->read_pos == p->dec.dicPos) {+ lzma_dec_fill(p);+ if (p->read_pos == p->dec.dicPos)+ break;+ }+ size_t avail = p->dec.dicPos - p->read_pos;+ if (avail > size)+ avail = size;+ memcpy(buf, p->dec.dic + p->read_pos, avail);+ p->read_pos += avail;+ buf += avail;+ total += avail;+ size -= avail;+ }+ return total;+}++static void+closeb_lzma_dec(BFILE *bp) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);+ struct BFILE_lzma_dec *p = (struct BFILE_lzma_dec *)bp;+ CHECKBFILE(bp, getb_lzma_dec);+ LzmaDec_Free(&p->dec, &LZMA_ALLOC);+ closeb(p->bfile);+ FREE(p);+} - /* Nothing new since last flush — skip. */- if (p->numflush++ && !p->bf.pos)- return;+static int+isattyb_lzma_dec(BFILE *bp)+{+ struct BFILE_lzma_dec *p = (struct BFILE_lzma_dec *)bp;+ CHECKBFILE(bp, getb_lzma_dec);+ return isattyb(p->bfile);+} - /*- * Worst-case LZMA output is slightly larger than input.- * The lzma.h docs don't give an exact bound, but input_size + (input_size/3)- * + LZMA_HEADER_SIZE is a safe over-estimate used by many wrappers.- */- size_t ilen = p->bf.pos;- size_t olen = ilen + (ilen / 3) + LZMA_HEADER_SIZE + 128;- uint8_t *obuf = MALLOC(olen);- if (!obuf)- memerr();+/* ---- streaming compressor ---- */ - if (lzma_compress(obuf, &olen, p->bf.buf, ilen) != 0)- ERR("lzma_compress");- /* Put the size in place */- ilen = p->bf.pos;- for (int i = 0; i < 8; i++) {- obuf[LZMA_PROPS_SIZE + i] = ilen & 0xff;- ilen >>= 8;+static void+lzma_enc_feed(struct BFILE_lzma_enc *p, const uint8_t *str, size_t size)+{+ CLzmaEnc *enc = p->enc;+ CMatchFinder *mf = &enc->matchFinderBase;++ while (size > 0) {+ if (MatchFinder_NeedMove(mf))+ MatchFinder_MoveBlock(mf);+ Byte *dest = mf->buffer + GET_AVAIL_BYTES(mf);+ size_t space = (size_t)(mf->bufferBase + mf->blockSize - dest);+ size_t chunk = size < space ? size : space;+ memcpy(dest, str, chunk);+ mf->streamPos += (UInt32)chunk;+ str += chunk;+ size -= chunk;++ while (GET_AVAIL_BYTES(mf) + enc->additionalOffset > (1 << 17) + (1 << 12) + mf->keepSizeAfter) {+ mf->streamEndWasReached = 0;+ enc->needInit = 0;+ MatchFinder_SetLimits(mf);+ if (LzmaEnc_CodeOneBlock(enc, 0, 0) != SZ_OK)+ ERR("LzmaEnc_CodeOneBlock");+ if (enc->finished)+ break;+ } }+} - putsb("LZ2", p->bfile); /* magic / version */- putint32((value_t)olen, p->bfile); /* compressed length */- for (size_t i = 0; i < olen; i++)- putb(obuf[i], p->bfile);+static int+getb_lzma_enc(BFILE *bp)+{+ ERR("getb on lzma compressor");+ return -1;+} - FREE(obuf);- p->bf.pos = 0;- flushb(p->bfile);+static void+putb_lzma_enc(int b, BFILE *bp)+{+ struct BFILE_lzma_enc *p = (struct BFILE_lzma_enc *)bp;+ CHECKBFILE(bp, getb_lzma_enc);+ uint8_t ch = (uint8_t)b;+ lzma_enc_feed(p, &ch, 1); } -void-closeb_lzma(BFILE *bp)+static size_t+writeb_lzma_enc(const uint8_t *str, size_t size, BFILE *bp) {- struct BFILE_lzma *p = (struct BFILE_lzma *)bp;- CHECKBFILE(bp, getb_lzma);+ struct BFILE_lzma_enc *p = (struct BFILE_lzma_enc *)bp;+ CHECKBFILE(bp, getb_lzma_enc);+ lzma_enc_feed(p, str, size);+ return size;+} - if (!p->read) {- /* Write mode: compress whatever is buffered. */- flushb_lzma(bp);- bfbuffer_free(&p->bf);+static void+flushb_lzma_enc(BFILE *bp)+{+ struct BFILE_lzma_enc *p = (struct BFILE_lzma_enc *)bp;+ CHECKBFILE(bp, getb_lzma_enc);++ if (p->flushed)+ return;+ p->flushed = 1;++ CLzmaEnc *enc = p->enc;+ CMatchFinder *mf = &enc->matchFinderBase;+ mf->streamEndWasReached = 1;+ enc->needInit = 0;+ MatchFinder_SetLimits(mf);+ while (!enc->finished) {+ if (LzmaEnc_CodeOneBlock(enc, 0, 0) != SZ_OK)+ ERR("LzmaEnc_CodeOneBlock flush"); }+ LzmaEnc_Finish(enc);+ flushb(p->bfile);+}++static void+closeb_lzma_enc(BFILE *bp)+{+ struct BFILE_lzma_enc *p = (struct BFILE_lzma_enc *)bp;+ CHECKBFILE(bp, getb_lzma_enc);+ flushb_lzma_enc(bp);+ LzmaEnc_Destroy(p->enc, &LZMA_ALLOC, &LZMA_ALLOC); closeb(p->bfile); FREE(p); } +static int+isattyb_lzma_enc(BFILE *bp)+{+ struct BFILE_lzma_enc *p = (struct BFILE_lzma_enc *)bp;+ CHECKBFILE(bp, getb_lzma_enc);+ return isattyb(p->bfile);+}+ /* ---- public constructors ---- */ BFILE * add_lzma_decompressor(BFILE *file) {- struct BFILE_lzma *p = MALLOC(sizeof(struct BFILE_lzma));+ struct BFILE_lzma_dec *p = MALLOC(sizeof(struct BFILE_lzma_dec)); if (!p) memerr();- memset(p, 0, sizeof(struct BFILE_lzma));+ memset(p, 0, sizeof(struct BFILE_lzma_dec)); - p->mets.getb = getb_lzma;- p->mets.ungetb = ungetb_lzma;- p->mets.putb = 0;- p->mets.flushb = 0;- p->mets.closeb = closeb_lzma;- p->mets.readb = readb_lzma;- p->mets.writeb = 0;- p->read = 1;- p->bfile = file;- p->numflush = 0;+ p->mets.getb = getb_lzma_dec;+ p->mets.ungetb = ungetb_lzma_dec;+ p->mets.putb = 0;+ p->mets.flushb = 0;+ p->mets.closeb = closeb_lzma_dec;+ p->mets.readb = readb_lzma_dec;+ p->mets.writeb = 0;+ p->mets.isattyb = isattyb_lzma_dec;+ p->mets.filesizeb = 0;+ p->bfile = file;+ p->unget = -1; /* Check the 3-byte magic tag. */- if (getb(file) != 'L' || getb(file) != 'Z' || getb(file) != '2')+ if (getb(file) != 'L' || getb(file) != 'Z' || getb(file) != '3') ERR("Bad LZMA signature"); - /* Read the compressed payload length, then the payload itself. */- size_t clen = (size_t)getint32(file);- uint8_t *cbuf = MALLOC(clen);- if (!cbuf)- memerr();- for (size_t i = 0; i < clen; i++)- cbuf[i] = getb(file);-- /*- * The LZMA header (bytes 5–12 of cbuf) encodes the uncompressed size.- * Read it as a little-endian 64-bit value so we can pre-allocate the- * output buffer without guessing.- */- if (clen < LZMA_HEADER_SIZE)- ERR("LZMA payload too short");-- uint64_t ulen64 = 0;- for (int i = 0; i < 8; i++)- ulen64 |= (uint64_t)cbuf[LZMA_PROPS_SIZE + i] << (8 * i);-- size_t ulen = (size_t)ulen64;- uint8_t *ubuf = MALLOC(ulen);- if (!ubuf)- memerr();-- size_t src_len = clen;- if (lzma_uncompress(ubuf, &ulen, cbuf, &src_len) != 0)- ERR("lzma_uncompress");-- FREE(cbuf);+ Byte props[LZMA_PROPS_SIZE];+ if (readb(props, LZMA_PROPS_SIZE, file) != LZMA_PROPS_SIZE)+ ERR("LZMA header too short"); - p->bf.buf = ubuf;- p->bf.size = ulen;- p->bf.pos = 0;+ LzmaDec_Construct(&p->dec);+ if (LzmaDec_Allocate(&p->dec, props, LZMA_PROPS_SIZE, &LZMA_ALLOC) != SZ_OK)+ ERR("LzmaDec_Allocate");+ LzmaDec_Init(&p->dec); return (BFILE *)p; }@@ -1967,23 +2331,52 @@ BFILE * add_lzma_compressor(BFILE *file) {- struct BFILE_lzma *p = MALLOC(sizeof(struct BFILE_lzma));+ struct BFILE_lzma_enc *p = MALLOC(sizeof(struct BFILE_lzma_enc)); if (!p) memerr();- memset(p, 0, sizeof(struct BFILE_lzma));+ memset(p, 0, sizeof(struct BFILE_lzma_enc)); - p->mets.getb = getb_lzma;- p->mets.ungetb = 0;- p->mets.putb = putb_lzma;- p->mets.flushb = flushb_lzma;- p->mets.closeb = closeb_lzma;- p->mets.readb = 0;- p->mets.writeb = writeb_lzma;- p->read = 0;- p->bfile = file;- p->numflush = 0;+ p->mets.getb = getb_lzma_enc;+ p->mets.ungetb = 0;+ p->mets.putb = putb_lzma_enc;+ p->mets.flushb = flushb_lzma_enc;+ p->mets.closeb = closeb_lzma_enc;+ p->mets.readb = 0;+ p->mets.writeb = writeb_lzma_enc;+ p->mets.isattyb = isattyb_lzma_enc;+ p->mets.filesizeb = 0;+ p->bfile = file;+ p->flushed = 0; - bfbuffer_init(&p->bf, 25000); /* same initial size as lz77 */+ p->out_stream.Write = lzma_seq_out_write;++ CLzmaEnc *enc = (CLzmaEnc *)LzmaEnc_Create(&LZMA_ALLOC);+ if (!enc)+ memerr();+ p->enc = enc;++ CLzmaEncProps props;+ LzmaEncProps_Init(&props);+ props.writeEndMark = 1;+ if (LzmaEnc_SetProps(enc, &props) != SZ_OK)+ ERR("LzmaEnc_SetProps");++ Byte props_buf[LZMA_PROPS_SIZE];+ SizeT props_size = LZMA_PROPS_SIZE;+ if (LzmaEnc_WriteProperties(enc, props_buf, &props_size) != SZ_OK)+ ERR("LzmaEnc_WriteProperties");++ putsb("LZ3", file);+ writeb(props_buf, props_size, file);++ if (LzmaEnc_Prepare(enc, &p->out_stream, (ISeqInStream *)&lzma_dummy_in_stream, &LZMA_ALLOC, &LZMA_ALLOC) != SZ_OK)+ ERR("LzmaEnc_Prepare");++ CMatchFinder *mf = &enc->matchFinderBase;+ MatchFinder_Init_HighHash(mf);+ MatchFinder_Init_LowHash(mf);+ MatchFinder_Init_4(mf);+ mf->cyclicBufferPos = (mf->pos - CYC_TO_POS_OFFSET); return (BFILE *)p; }
@@ -72,7 +72,7 @@ /* * Get time since some epoch in milliseconds. */-/* #define GETTIMEMILLI */+/* #define GETTIMEMICRO */ /*@@ -85,6 +85,7 @@ #define GCRED 0 /* do some reductions during GC */ #define INTTABLE 0 /* use fixed table of small INT nodes */ #define SANITY 0 /* do some sanity checks */+#define MARK_PFQ 0 /* no GC prefetch ring: tiny heap, small C stack */ #define STACKOVL 1 /* check for stack overflow */ #define INLINE
@@ -72,7 +72,7 @@ /* * Get time since some epoch in milliseconds. */-/* #define GETTIMEMILLI */+/* #define GETTIMEMICRO */ /*@@ -85,6 +85,7 @@ #define GCRED 0 /* do some reductions during GC */ #define INTTABLE 1 /* use fixed table of small INT nodes */ #define SANITY 1 /* do some sanity checks */+#define MARK_PFQ 0 /* no GC prefetch ring: tiny heap, small C stack */ #define STACKOVL 1 /* check for stack overflow */ #define HEAP_CELLS 4000
@@ -4,8014 +4,10303 @@ #include "mhsffi.h" /* this includes config.h */ #include "extra.c" -#if !defined(WANT_GMP)-#define WANT_GMP 0-#endif /* defined(WANT_GMP) */--#if !defined(WANT_OVERFLOW)-#define WANT_OVERFLOW 0-#endif /* defined(WANT_OVERFLOW) */--#if !defined(WANT_IO_POLL)-#define WANT_IO_POLL 0-#endif /* defined(WANT_IO_POLL) */--#if !defined(WANT_SOCKET)-#define WANT_SOCKET 0-#endif /* defined(WANT_SOCKET) */--#if WANT_STDIO-#include <stdio.h>-#include <locale.h>-#endif-#include <stdlib.h>-#include <string.h>-#include <ctype.h>-#include <setjmp.h>-#if WANT_MATH-#include <math.h>-#endif /* WANT_MATH */-#if defined(__EMSCRIPTEN__)-#include "emscripten.h"-#ifndef EM_ASM_PTR-#define EM_ASM_PTR(...) (void*)(uintptr_t)EM_ASM_INT(__VA_ARGS__)-#endif-#endif /* __EMSCRIPTEN__ */-#if WANT_DIR-#include <sys/stat.h>-#include <sys/types.h>-#endif /* WANT_DIR */-#if WANT_TIME-#include <time.h>-#endif-#if WANT_GMP-#include <gmp.h>-#endif-#if WANT_SIGINT-#include <signal.h>-#endif-#if WANT_IO_POLL-#include <poll.h>-#endif--extern char **environ; /* should probably be behind some WANT_ */--#if WANT_MD5-#include "md5.h"-#endif--#if !defined(WANT_UTF8)-#define WANT_UTF8 1-#endif--#if !defined(WANT_BUF)-#define WANT_BUF 1-#endif--#if !defined(WANT_CRLF)-#define WANT_CRLF 1-#endif--#if !defined(WANT_BASE64)-#define WANT_BASE64 1-#endif--#if !defined(WANT_LZ77)-#define WANT_LZ77 1-#endif--#if !defined(WANT_LZMA)-#define WANT_LZMA 1-#endif--#if !defined(WANT_RLE)-#define WANT_RLE 1-#endif--#if !defined(WANT_BWT)-#define WANT_BWT 1-#endif--#if !defined(WANT_ENV)-#define WANT_ENV 1-#endif--#if !defined(WANT_ERRNO)-#define WANT_ERRNO 0-#else-#include "ffi_errno.c"-#endif--#if !defined(GET_EXECUTABLE_PATH)-char *get_executable_path(void) { return NULL; }-#endif--#if !defined(YIELD_EXTRA)-#define YIELD_EXTRA do {} while(0)-#endif--#if !defined(MKDIR)-#define MKDIR mkdir-#endif--#if WANT_LZ77-size_t lz77d(uint8_t *src, size_t srclen, uint8_t **bufp);-size_t lz77c(uint8_t *src, size_t srclen, uint8_t **bufp);-#endif--/* The register optimization is disabled for now since it breaks on some platforms. */-#if 0 && defined(__GNUC__) && __GNUC__ >= 14 && defined(__aarch64__)-#define REGISTER(dcl, reg) register dcl asm(#reg)-#else-#define REGISTER(dcl, reg) dcl-#endif--const struct ffi_entry ffi_table[];-int num_ffi;-#define FFI_IX(i) ((i) < num_ffi ? ffi_table[i] : xffi_table[i - num_ffi])--#if WANT_STDIO-#define THREAD_DEBUG 1-#else-#define THREAD_DEBUG 0-#endif---#define VERSION "v8.3\n"--#define PRIvalue PRIdPTR-#define PRIuvalue PRIuPTR-typedef uintptr_t heapoffs_t; /* Heap offsets */-#define PRIheap PRIuPTR-typedef uintptr_t tag_t; /* Room for tag, low order bit indicates AP/not-AP */--typedef uintptr_t counter_t; /* Statistics counter, can be smaller since overflow doesn't matter */-#define PRIcounter PRIuPTR-typedef uintptr_t bits_t; /* One word of bits */--#if !defined(WANT_ARGS)-#define WANT_ARGS 1-#endif--#if !defined(MALLOC)-#define MALLOC malloc-#endif--#if !defined(REALLOC)-#define REALLOC realloc-#endif--#if !defined(CALLOC)-#define CALLOC calloc-#endif--#if !defined(FREE)-#define FREE free-#endif--#if !defined(EXIT)-#define EXIT exit-#endif--#if !defined(PRINT)-#define PRINT printf-#endif--#if !defined(PCOMMA)-#define PCOMMA "'"-#endif /* !defined(PCOMMA) */--#if !defined(GETRAW)-int GETRAW(void) { return -1; }-#endif /* !defined(GETRAW) */--#if !defined(GETTIMEMILLI)-value_t GETTIMEMILLI(void) { return 0; }-#endif /* !define(GETTIMEMILLI) */--#if !defined(GETCPUTIME)-void GETCPUTIME(long *sec, long *nsec) { *sec = 0; *nsec = 0; }-#endif /* !define(GETCPUTIME) */--#if !defined(INLINE)-#define INLINE inline-#endif /* !define(INLINE) */--#if !defined(NORETURN)-/*#define NORETURN [[noreturn]]*/-#define NORETURN _Noreturn-#endif /* !defined(NORETURN) */--#if !defined(PACKED)-#if WORD_SIZE == 32-#define PACKED __attribute__((packed))-#else-#define PACKED-#endif /* WORD_SIZE == 32 */-#endif /* !defined(PACKED) */--#if !defined(SLICE)-#define SLICE 100000-#endif--NORETURN void memerr(void);--void *-mmalloc(size_t s)-{- void *p = MALLOC(s);- if (!p)- memerr();- return p;-}--void *-mrealloc(void *q, size_t s)-{- void *p = REALLOC(q, s);- if (!p)- memerr();- return p;-}--void *-mcalloc(size_t n, size_t s)-{- void *p = CALLOC(n, s);- if (!p)- memerr();- return p;-}--#if !defined(ERR)-#if WANT_STDIO-#define ERR(s) do { fprintf(stderr,"ERR: "s"\n"); EXIT(1); } while(0)-#define ERR1(s,a) do { fprintf(stderr,"ERR: "s"\n",a); EXIT(1); } while(0)-#else /* WANT_STDIO */-#define ERR(s) EXIT(1)-#define ERR1(s,a) EXIT(1)-#endif /* WANT_STDIO */-#endif /* !define(ERR) */--#if !defined(TMPNAME)-/* This is a really bad implementation, since it doesn't check for anything. */-char* TMPNAME(const char* pre, const char* suf) {- ERR("no TMPNAME");-}-#endif--#if !defined(FFS)-/* This is pretty bad, could use deBruijn multiplication instead. */-int-FFS(bits_t x)-{- int i;- if (!x)- return 0;- for(i = 1; !(x & 1); x >>= 1, i++)- ;- return i;-}-#endif /* !defined(FFS) */--/***** popcount *****/-#if defined(__has_builtin)--#if __has_builtin(__builtin_popcountl)-#define BUILTIN_POPCOUNT __builtin_popcountl-#endif--#if __has_builtin(__builtin_popcountll)-#define BUILTIN_POPCOUNT64 __builtin_popcountll-#endif--/* If there are compiler intrinsics to detect over flow, do so */-#if __has_builtin(__builtin_add_overflow) && WANT_OVERFLOW-#define ADD_OVERFLOW(T, r, a, b) do { T vr; if (__builtin_add_overflow((T)(a), (T)(b), &(vr))) raise_rts(exn_overflow); (r) = vr; } while(0)-#endif-#if __has_builtin(__builtin_sub_overflow) && WANT_OVERFLOW-#define SUB_OVERFLOW(T, r, a, b) do { T vr; if (__builtin_sub_overflow((T)(a), (T)(b), &(vr))) raise_rts(exn_overflow); (r) = vr; } while(0)-#endif-#if __has_builtin(__builtin_mul_overflow) && WANT_OVERFLOW-#define MUL_OVERFLOW(T, r, a, b) do { T vr; if (__builtin_mul_overflow((T)(a), (T)(b), &(vr))) raise_rts(exn_overflow); (r) = vr; } while(0)-#endif--#endif--/* If we can't detect overflow, just ignore it. */-#if !defined(ADD_OVERFLOW)-#define ADD_OVERFLOW(T, r, a, b) ((r) = (a) + (b))-#endif-#if !defined(SUB_OVERFLOW)-#define SUB_OVERFLOW(T, r, a, b) ((r) = (a) - (b))-#endif-#if !defined(MUL_OVERFLOW)-#define MUL_OVERFLOW(T, r, a, b) ((r) = (a) * (b))-#endif---#if !defined(POPCOUNT)-uvalue_t POPCOUNT(uvalue_t x) {-#if defined(BUILTIN_POPCOUNT)- return BUILTIN_POPCOUNT(x);-#else /* !defined(BUILTIN_POPCOUNT) */- uvalue_t count = 0;- while (x) {- x = x & (x - 1); // clear lowest 1 bit- count++;- }- return count;-#endif /* !defined(BUILTIN_POPCOUNT) */-}-#endif /* !defined(POPCOUNT) */--#if !defined(POPCOUNT64)-uvalue_t POPCOUNT64(uint64_t x) {-#if defined(BUILTIN_POPCOUNT64)- return BUILTIN_POPCOUNT64(x);-#else /* !defined(BUILTIN_POPCOUNT64) */- uvalue_t count = 0;- while (x) {- x = x & (x - 1); // clear lowest 1 bit- count++;- }- return count;-#endif /* !defined(BUILTIN_POPCOUNT64) */-}-#endif /* !defined(POPCOUNT64) */-/***** end popcount *****/--/***** clz *****/-#if defined(__has_builtin)--#if __has_builtin(__builtin_clzl)-#define BUILTIN_CLZ __builtin_clzl-#endif--#if __has_builtin(__builtin_clzll)-#define BUILTIN_CLZ64 __builtin_clzll-#endif--#endif---#if !defined(CLZ)-uvalue_t CLZ(uvalue_t x) {-#if defined(BUILTIN_CLZ)- if (x == 0) return WORD_SIZE;- return BUILTIN_CLZ(x);-#else /* defined(BUILTIN_CLZ) */- value_t count = WORD_SIZE;- while (x) {- x = x >> 1;- count--;- }- return count;-#endif /* defined(BUILTIN_CLZ) */-}-#endif /* !defined(CLZ) */--#if !defined(CLZ64)-uvalue_t CLZ64(uint64_t x) {-#if defined(BUILTIN_CLZ64)- if (x == 0) return 64;- return BUILTIN_CLZ64(x);-#else /* defined(BUILTIN_CLZ64) */- value_t count = 64;- while (x) {- x = x >> 1;- count--;- }- return count;-#endif /* defined(BUILTIN_CLZ64) */-}-#endif /* !defined(CLZ64) */-/***** end clz *****/--/***** ctz *****/-#if defined(__has_builtin)--#if __has_builtin(__builtin_ctzl)-#define BUILTIN_CTZ __builtin_ctzl-#endif--#if __has_builtin(__builtin_ctzll)-#define BUILTIN_CTZ64 __builtin_ctzll-#endif--#endif /* defined(__has_builtin) */---#if !defined(CTZ)-uvalue_t CTZ(uvalue_t x) {- if (x == 0) return WORD_SIZE;-#if defined(BUILTIN_CTZ)- return BUILTIN_CTZ(x);-#else /* defined(BUILTIN_CTZ) */- uvalue_t count = 0;- while ((x & 1) == 0) {- x = x >> 1;- count += 1;- }- return count;-#endif /* defined(BUILTIN_CTZ) */-}-#endif /* !defined(CTZ) */--#if !defined(CTZ64)-uvalue_t CTZ64(uint64_t x) {- if (x == 0) return 64;-#if defined(BUILTIN_CTZ64)- return BUILTIN_CTZ64(x);-#else /* defined(BUILTIN_CTZ64) */- uvalue_t count = 0;- while ((x & 1) == 0) {- x = x >> 1;- count++;- }- return count;-#endif /* defined(BUILTIN_CTZ64) */-}-#endif /* !defined(CTZ) */--/***** end ctz *****/--#if !defined(COUNT)-#define COUNT(n) ++(n)-#endif--value_t-iswindows(void)-{-#if defined(ISWINDOWS)- return 1;-#else- return 0;-#endif-}--value_t-ismacos(void)-{-#if defined(ISMACOS)- return 1;-#else- return 0;-#endif-}--value_t-islinux(void)-{-#if defined(ISLINUX)- return 1;-#else- return 0;-#endif-}--/***************************************/--/* Keep permanent nodes for LOW_INT <= i < HIGH_INT */-#define LOW_INT (-10)-#define HIGH_INT 256--#if !defined(HEAP_CELLS)-#define HEAP_CELLS 50000000-#endif--#if !defined(STACK_SIZE)-#define STACK_SIZE 250000-#endif--/* tcc doesn't understand noreturn attribute */-#if defined(__TCC__)-#define NOTREACHED return 0-#else-#define NOTREACHED-#endif--enum node_tag { T_FREE, T_IND, T_AP, T_INT, T_INT64, T_DBL, T_FLT32, T_PTR, T_FUNPTR, T_FORPTR, T_BADDYN, T_ARR, T_THID, T_MVAR, T_WEAK,- T_S, T_K, T_I, T_B, T_C,- T_A, T_Y, T_SS, T_BB, T_CC, T_P, T_R, T_O, T_U, T_Z, T_J,- T_K2, T_K3, T_K4, T_CCB,- T_L, T_KK, T_KA,- T_T3, T_T4, T_T5, T_T6, T_T7, T_T8, T_T9, T_T10, T_T11, T_T12, T_T13, T_T14, T_T15, T_T16,- T_TAG0, T_TAG1, T_TAG2, T_TAG3, T_TAG4, T_TAG5, T_TAG6, T_TAG7, T_TAG8, T_TAG9,- T_TAG10, T_TAG11, T_TAG12, T_TAG13, T_TAG14, T_TAG15, T_TAG16, T_TAG17, T_TAG18, T_TAG19,- T_TAG20, T_TAG21, T_TAG22, T_TAG23, T_TAG24, T_TAG25, T_TAG26, T_TAG27, T_TAG28, T_TAG29,- T_TAG30, T_TAG31, T_TAG32,- T_ADD, T_SUB, T_MUL, T_QUOT, T_REM, T_SUBR, T_NEG,- T_UADD, T_USUB, T_UMUL, T_UQUOT, T_UREM, T_USUBR, T_UNEG,- T_AND, T_OR, T_XOR, T_INV, T_SHL, T_SHR, T_ASHR,- T_POPCOUNT, T_CLZ, T_CTZ,- T_EQ, T_NE, T_LT, T_LE, T_GT, T_GE, T_ULT, T_ULE, T_UGT, T_UGE, T_ICMP, T_UCMP,- T_ADD64, T_SUB64, T_MUL64, T_QUOT64, T_REM64, T_SUBR64, T_NEG64,- T_UADD64, T_USUB64, T_UMUL64, T_UQUOT64, T_UREM64, T_USUBR64, T_UNEG64,- T_AND64, T_OR64, T_XOR64, T_INV64, T_SHL64, T_SHR64, T_ASHR64,- T_POPCOUNT64, T_CLZ64, T_CTZ64,- T_EQ64, T_NE64, T_LT64, T_LE64, T_GT64, T_GE64, T_ULT64, T_ULE64, T_UGT64, T_UGE64, T_ICMP64, T_UCMP64,- T_ITOI64, T_I64TOI, T_UTOU64, T_U64TOU,- T_FPADD, T_FP2P, T_FPNEW, T_FPFIN,- T_FP2BS, T_BS2FP,- T_TOPTR, T_TOINT, T_TODBL, T_TOFLT, T_TOFUNPTR,- T_FROMDBL, T_FROMFLT,- T_BININT2, T_BININT1, T_UNINT1,- T_BININT64_2, T_BININT64_1, T_UNINT64_1,- T_BINFLT2, T_BINFLT1, T_UNFLT1,- T_BINDBL2, T_BINDBL1, T_UNDBL1,- T_BINBS2, T_BINBS1,- T_ISINT,- T_FADD, T_FSUB, T_FMUL, T_FDIV, T_FNEG, T_ITOF, T_I64TOF, T_FTOI, T_UTOF,- T_FEQ, T_FNE, T_FLT, T_FLE, T_FGT, T_FGE,- T_DADD, T_DSUB, T_DMUL, T_DDIV, T_DNEG, T_ITOD, T_I64TOD, T_DTOI, T_UTOD,- T_DEQ, T_DNE, T_DLT, T_DLE, T_DGT, T_DGE,- T_FTOD, T_DTOF,- T_ARR_ALLOC, T_ARR_COPY, T_ARR_SIZE, T_ARR_READ, T_ARR_WRITE, T_ARR_TRUNC, T_ARR_EQ,- T_RAISE, T_SEQ, T_RNF,- T_TICK,- T_IO_BIND, T_IO_THEN, T_IO_RETURN,- T_IO_SERIALIZE, T_IO_DESERIALIZE,- T_IO_GETARGREF,- T_IO_PERFORMIO, T_IO_PRINT, T_CATCH, T_CATCHR,- T_IO_CCALL,- T_IO_GC, T_IO_STATS,- T_IO_LAZYBIND, T_IO_STRICT,- T_DYNSYM,- T_IO_FORK, T_IO_THID, T_THNUM, T_IO_THROWTO, T_IO_YIELD,- T_IO_NEWMVAR,- T_IO_TAKEMVAR, T_IO_PUTMVAR, T_IO_READMVAR,- T_IO_TRYTAKEMVAR, T_IO_TRYPUTMVAR, T_IO_TRYREADMVAR,- T_IO_THREADDELAY, T_IO_THREADSTATUS,- T_IO_GETMASKINGSTATE, T_IO_SETMASKINGSTATE,- T_NEWCASTRINGLEN, T_PACKCSTRING, T_PACKCSTRINGLEN,- T_BSAPPEND, T_BSEQ, T_BSNE, T_BSLT, T_BSLE, T_BSGT, T_BSGE, T_BSCMP,- T_BSPACK, T_BSUNPACK, T_BSREPLICATE, T_BSLENGTH, T_BSSUBSTR, T_BSINDEX, T_BSWRITE,- T_BSFROMUTF8, T_BSTOUTF8, T_BSHEADUTF8, T_BSTAILUTF8,- T_BSAPPENDDOT, T_BSGRAB, T_BSGRABLEN,- T_SPNEW, T_SPDEREF, T_SPFREE,- T_WKNEWFIN, T_WKNEW, T_WKDEREF, T_WKFINAL,- T_IO_PP, /* for debugging */- T_IO_STDIN, T_IO_STDOUT, T_IO_STDERR,- T_IO_WAITRDFD, T_IO_WAITWRFD,- T_LAST_TAG,-};--/* Most entries are initialized from the primops table. */-static const char* tag_names [T_LAST_TAG+1] =- { "FREE", "IND", "AP", "INT", "INT64", "DBL", "FLT32", "PTR",- "FUNPTR", "FORPTR", "BADDYN", "ARR", "THID", "MVAR", "WEAK" };-#define TAGNAME(t) tag_names[t]--struct ioarray;-struct bytestring;-struct forptr;-struct mthread;-struct mvar;-struct weak_ptr;--typedef struct PACKED node {- union {- struct node *uufun;- intptr_t uuifun;- tag_t uutag; /* LSB=1 indicates that this is a tag, LSB=0 that this is a T_AP node */- } ufun;- union {- struct node *uuarg;- value_t uuvalue;-#if WANT_FLOAT32- flt32_t uuflt32value;- uint32_t uuint32value;-#endif /* WANT_FLOAT32 */-#if WANT_FLOAT64- flt64_t uuflt64value;-#endif /* WANT_FLOAT32 */-#if WANT_INT64- int64_t uuint64value;-#endif /* WANT_INT64 */- const char *uucstring;- void *uuptr;- HsFunPtr uufunptr;- struct ioarray *uuarray;- struct forptr *uuforptr; /* foreign pointers and byte arrays */- struct mthread *uuthread;- struct mvar *uumvar;- struct weak_ptr *uuweak;- } uarg;-} node;-/*- * Low bits encode the node type- * 00 - T_AP application- * 01 - tag upper bits are T_XXX- * 10 - T_IND indirection- * 11 - unused- * Only the lower 2 bits are free on 32 bit platforms with 3 word nodes- * (i.e. with WANT_DOUBLE or WANT_INT64).- */-#define TAG_SHIFT 2-#define BIT_MASK ((1 << TAG_SHIFT) - 1)-#define BIT_AP 0-#define BIT_TG 1-#define BIT_IN 2--static INLINE tag_t GETTAG(NODEPTR p)-{- tag_t t = p->ufun.uutag;- switch(t & BIT_MASK) {- case BIT_AP: return T_AP;- case BIT_IN: return T_IND;- default: return t >> TAG_SHIFT;- }-}-static INLINE void SETTAG(NODEPTR p, tag_t t)-{- switch(t) {- case BIT_AP: break; /* do nothing, bits are already 0 */- case BIT_IN: p->ufun.uutag |= BIT_IN; break;- default: p->ufun.uutag = (t << TAG_SHIFT) | BIT_TG; break;- }-}--#define NIL 0-#define HEAPREF(i) &cells[(i)]-// #define GETTAG(p) ( ? ( (p)->ufun.uutag & BIT_IND ? T_IND : (int)((p)->ufun.uutag >> TAG_SHIFT) ) : T_AP)-// #define SETTAG(p,t) do { if (t != T_AP) { if (t == T_IND) { (p)->ufun.uutag = BIT_IND; } else { (p)->ufun.uutag = ((t) << TAG_SHIFT) | BIT_TAG; } } } while(0)-#define GETVALUE(p) (p)->uarg.uuvalue-#define GETINT64VALUE(p) (p)->uarg.uuint64value-#define GETINT32VALUE(p) (p)->uarg.uuint32value-#define GETFLTVALUE(p) (p)->uarg.uuflt32value-#define GETDBLVALUE(p) (p)->uarg.uuflt64value-#define SETVALUE(p,v) (p)->uarg.uuvalue = v-#define SETINT64VALUE(p,v) (p)->uarg.uuint64value = v-#define SETINT32VALUE(p,v) (p)->uarg.uuint32value = v-#define SETFLTVALUE(p,v) (p)->uarg.uuflt32value = v-#define SETDBLVALUE(p,v) (p)->uarg.uuflt64value = v-#define FUN(p) (p)->ufun.uufun-#define ARG(p) (p)->uarg.uuarg-#define CSTR(p) (p)->uarg.uucstring-#define PTR(p) (p)->uarg.uuptr-#define FUNPTR(p) (p)->uarg.uufunptr-#define FORPTR(p) (p)->uarg.uuforptr-#define BSTR(p) (p)->uarg.uuforptr->payload-#define ARR(p) (p)->uarg.uuarray-#define THR(p) (p)->uarg.uuthread-#define MVAR(p) (p)->uarg.uumvar-//#define ISINDIR(p) ((p)->ufun.uuifun & BIT_IND)-#define ISINDIR(p) (GETTAG((p)) == T_IND)-#define WEAK(p) (p)->uarg.uuweak-//#define GETINDIR(p) ((struct node*) ((p)->ufun.uuifun & ~BIT_IND))-#define GETINDIR(p) ((struct node*) ((p)->ufun.uuifun & ~BIT_MASK))-#define SETINDIR(p,q) do { (p)->ufun.uuifun = (intptr_t)(q) | BIT_IN; } while(0)-#define NODE_SIZE sizeof(node)-#define ALLOC_HEAP(n) do { cells = mmalloc(n * sizeof(node)); } while(0)-#define LABEL(n) ((heapoffs_t)((n) - cells))-node *cells; /* All cells */--/*- * byte arrays- */-struct bytestring {- size_t size;- void *string;-};--/*- * Arrays are allocated with malloc()/free().- * During GC they are marked, and all elements in the array are- * recursively marked.- * At the end of the the mark phase there is a scan of all- * arrays, and the unmarked ones are freed.- */-struct ioarray {- struct ioarray *next; /* all ioarrays are linked together */- bool permanent; /* this array should never be GC-ed */- size_t marked; /* marked during GC */- size_t size; /* number of elements in the array */- NODEPTR array[1]; /* actual size may be bigger */-};-struct ioarray *array_root = 0; /* root of all allocated arrays, linked by next */--enum fptype {- FP_FORPTR = 0, /* a regular foreign pointer to unknown memory */- FP_BSTR, /* a bytestring */- FP_MPZ, /* a GMP MPZ pointer */-};--/*- * A Haskell ForeignPtr has a normal pointer, and a finalizer- * function that is to be called when there are no more references- * to the ForeignPtr.- * A complication is that using plusForeignPtr creates a new- * ForeignPtr that must share the same finalizer.- * There is one struct forptr for each ForeignPtr. It has pointer- * to the actual data, and to a struct final which is shared between- * all ForeignPtrs that have been created with plusForeignPtr.- * During GC the used bit is set for any references to the forptr.- * The scan phase will traverse the struct final chain and run- * the finalizer, and free associated structs.- */-struct final {- struct final *next; /* the next finalizer */- HsFunPtr final; /* function to call to release resource */- void *arg; /* argument to final when called */- size_t size; /* size of memory, if known, otherwise NOSIZE */-#define NOSIZE ~0 /* used as the size in payload for actual foreign pointers */- struct forptr *back; /* back pointer to the first forptr */- short marked; /* mark bit for GC */- enum fptype fptype; /* what kind of foreign pointer */-};--/*- * Foreign pointers are also used to represent bytestrings.- * The difference between a foreign pointer and a bytestring- * is that we can serialize the latter.- * The size field is non-zero only for bytestrings.- */-struct forptr {- struct forptr *next; /* the next ForeignPtr that shares the same finalizer */- struct final *finalizer; /* the finalizer for this ForeignPtr */- struct bytestring payload; /* the actual pointer to allocated data, and maybe a size */- // char *desc;-};-struct final *final_root = 0; /* root of all allocated foreign pointers, linked by next */--//REGISTER(counter_t num_reductions,r19);-counter_t num_reductions = 0;-counter_t num_alloc = 0;-counter_t num_gc = 0;-counter_t num_yield = 0;-counter_t num_resched = 0;-counter_t num_thread_reap = 0;-counter_t num_mvar_alloc = 0;-counter_t num_mvar_free = 0;-counter_t num_stable_alloc = 0;-counter_t num_stable_free = 0;-counter_t num_new_weak = 0;-counter_t num_gc_weak = 0;-uintptr_t gc_mark_time = 0;-uintptr_t gc_scan_time = 0;-uintptr_t run_time = 0;--#define MAIN_THREAD 1-uvalue_t num_thread_create = MAIN_THREAD;--#define MAXSTACKDEPTH 0-#if MAXSTACKDEPTH-stackptr_t max_stack_depth = 0;-counter_t max_c_stack = 0;-counter_t cur_c_stack = 0;-#define MAXSTACK if (stack_ptr > max_stack_depth) max_stack_depth = stack_ptr-#else-#define MAXSTACK-#endif--NODEPTR atptr;--REGISTER(NODEPTR *stack,r20);-REGISTER(stackptr_t stack_ptr,r21);-#if STACKOVL-#define PUSH(x) do { if (stack_ptr >= stack_size-2) stackerr(); stack[++stack_ptr] = (x); MAXSTACK; } while(0)-#else /* STACKOVL */-#define PUSH(x) do { stack[++stack_ptr] = (x); MAXSTACK; } while(0)-#endif /* STACKOVL */-#define TOP(n) stack[stack_ptr - (n)]-#define POP(n) stack_ptr -= (n)-#define POPTOP() stack[stack_ptr--]-#define GCCHECK(n) gc_check((n))-#define CLEARSTK() do { stack_ptr = -1; } while(0)-#define GCCHECKSAVE(p, n) do { PUSH(p); GCCHECK(n); (p) = TOP(0); POP(1); } while(0)--heapoffs_t heap_size; /* number of heap cells */-heapoffs_t heap_start; /* first location in heap that needs GC */-REGISTER(stackptr_t stack_size,r22); /* number of stack slots */--counter_t num_marked;-counter_t max_num_marked = 0;-counter_t num_free;-counter_t num_arr_alloc;-counter_t num_arr_free;-counter_t num_fin_alloc;-counter_t num_fin_free;-counter_t num_bs_alloc;-counter_t num_bs_alloc_max;-counter_t num_bs_free;-counter_t num_bs_bytes;-counter_t num_bs_inuse;-counter_t num_bs_inuse_max;--#define BITS_PER_WORD (sizeof(bits_t) * 8)-bits_t *free_map; /* 1 bit per node, 0=free, 1=used */-heapoffs_t free_map_nwords;-heapoffs_t next_scan_index;--int want_gc_red = 0;--NORETURN void-memerr(void)-{- ERR("Out of memory");-}--NORETURN-void-stackerr(void)-{- ERR("stack overflow");-}--/***************************************/--#include "bfile.c"--/***************************************/--struct ioarray*-arr_alloc(size_t sz, NODEPTR e)-{- struct ioarray *arr = mmalloc(sizeof(struct ioarray) + (sz-1) * sizeof(NODEPTR));- size_t i;-- arr->next = array_root;- array_root = arr;- arr->marked = 0;- arr->permanent = false;- arr->size = sz;- for(i = 0; i < sz; i++)- arr->array[i] = e;- //PRINT("arr_alloc(%d, %p) = %p\n", (int)sz, e, arr);- num_arr_alloc++;- return arr;-}--struct ioarray*-arr_copy(struct ioarray *oarr)-{- size_t sz = oarr->size;- struct ioarray *arr = mmalloc(sizeof(struct ioarray) + (sz-1) * sizeof(NODEPTR));-- arr->next = array_root;- array_root = arr;- arr->marked = 0;- arr->permanent = false;- arr->size = sz;- memcpy(arr->array, oarr->array, sz * sizeof(NODEPTR));- num_arr_alloc++;- return arr;-}--/*****************************************************************************/--#if WANT_TICK-struct tick_entry {- struct bytestring tick_name;- counter_t tick_count;-} *tick_table = 0;-size_t tick_table_size;-size_t tick_index;--/* Allocate a new tick table entry and return the index. */-size_t-add_tick_table(struct bytestring name)-{- if (!tick_table) {- tick_table_size = 100;- tick_table = mmalloc(tick_table_size * sizeof(struct tick_entry));- tick_index = 0;- }- if (tick_index >= tick_table_size) {- tick_table_size *= 2;- tick_table = mrealloc(tick_table, tick_table_size * sizeof(struct tick_entry));- }- tick_table[tick_index].tick_name = name;- tick_table[tick_index].tick_count = 0;- return tick_index++;-}--/* Called with the tick index. */-static INLINE void-dotick(value_t i)-{- tick_table[i].tick_count++;-}--void-dump_tick_table(FILE *f)-{- if (!tick_table) {- fprintf(f, "Tick table empty\n");- return;- }- for (size_t i = 0; i < tick_index; i++) {- counter_t n = tick_table[i].tick_count;- if (n)- fprintf(f, "%-60s %10"PRIcounter"\n", (char *)tick_table[i].tick_name.string, n);- }-}-#endif--enum th_sched { mt_main, mt_resched, mt_raise };-/* The two enums below are known by the Haskell code. Do not change order */-enum th_state {- ts_runnable,- ts_wait_mvar,- ts_wait_time,- ts_finished,- ts_died,- ts_wait_io, /* not visible to Haskell; must stay after ts_died */-};-enum mask_state { mask_unmasked, mask_interruptible, mask_uninterruptible };--/***************** HANDLER *****************/--struct handler {- jmp_buf hdl_buf; /* env storage */- struct handler *hdl_old; /* old handler */- NODEPTR hdl_exn; /* used temporarily to pass the exception value */-} *cur_handler = 0;--/***************** THREAD ******************/--struct mthread {- enum th_state mt_state; /* thread state */- enum mask_state mt_mask; /* making state. */- struct mthread *mt_next; /* all threads linked together */- struct mthread *mt_queue; /* runq/waitq link */- counter_t mt_slice; /* reduction steps until yielding */- counter_t mt_num_slices; /* number of slices so far */- NODEPTR mt_root; /* root of the graph to reduce */- struct mvar *mt_exn; /* possible thrown exception */- NODEPTR mt_mval; /* filled after waiting for take/read */- bool mt_mark; /* marked as accessible */- uvalue_t mt_id; /* thread number, thread 1 is the main thread */-#if WANT_IO_POLL- int mt_fd; /* The file descriptor that we are waiting on,- * IO_POLL_WAITING_FOR_NONE, or IO_POLL_EVENT_HAS_HAPPENED */-#define IO_POLL_WAITING_FOR_NONE (-1)-#define IO_POLL_EVENT_HAS_HAPPENED (-2)- int mt_events; /* POLLIN or POLLOUT */-#endif /* WANT_IO_POLL */-#if defined(CLOCK_INIT)- CLOCK_T mt_at; /* time to wake up when in threadDelay */-#endif-};-struct mthread *all_threads = 0; /* all threads */--struct mqueue {- struct mthread *mq_head;- struct mthread *mq_tail;-};-struct mqueue runq = { 0, 0 }; /* runnable threads */-struct mqueue timeq = { 0, 0 }; /* waiting for a timer to expire, sorted in time order */-struct mqueue pollq = { 0, 0 }; /* waiting for I/O on a file descriptor */--struct mvar {- struct mvar *mv_next; /* all mvars linked together */- NODEPTR mv_data; /* contents of the mvar, or NIL when empty */- struct mqueue mv_takeput; /* queue of threads waiting for take or put, single wakeup */- struct mqueue mv_read; /* queue of threads waiting for read, multiple wakeup */- bool mv_mark; /* marked as accessible */-};-struct mvar *all_mvars = 0; /* all mvars */--jmp_buf sched; /* jump here to yield */-counter_t slice = SLICE; /* normal time slice;- * on an M4 Mac this is about 0.3ms */-//REGISTER(counter_t glob_slice,r23);-REGISTER(int glob_slice,r23);--NODEPTR the_exn; /* Used to propagate the exception for longjmp(sched, mt_raise) */--/****** StablePtr ******/--size_t sp_capacity = 4; /* initial size of stable pointer table */-NODEPTR *sp_table; /* stable pointer table */--static void-init_stableptr(void)-{- sp_table = mmalloc(sp_capacity * sizeof(NODEPTR)); /* stable pointer table, all free */- for (size_t i = 0; i < sp_capacity; i++)- sp_table[i] = NIL;-}--static uvalue_t-new_stableptr(NODEPTR n)-{- size_t i;-- COUNT(num_stable_alloc);- /* Linear search for an empty slot. */- /* Not ideal, but fine for a small number of StablePtr. */- for(i = 1; i < sp_capacity; i++) { /* index 0 reserved according to the spec */- if (sp_table[i] == NIL)- break;- }- if (i == sp_capacity) {- /* table is full, so double its size */- sp_capacity *= 2;- sp_table = mrealloc(sp_table, sp_capacity * sizeof(NODEPTR));- for(size_t j = i; j < sp_capacity; j++)- sp_table[j] = NIL;- }- sp_table[i] = n;- return (uvalue_t)i;-}--static NODEPTR-deref_stableptr(uvalue_t sp)-{- if (sp >= sp_capacity || sp_table[sp] == NIL)- ERR("deref_stableptr");- return sp_table[sp];-}--static void-free_stableptr(uvalue_t sp)-{- if (sp >= sp_capacity || sp_table[sp] == NIL)- ERR("free_stableptr");- COUNT(num_stable_free);- sp_table[sp] = NIL;-}--/* The order of these must be kept in sync with Control.Exception.Internal.rtsExn */-enum rts_exn { exn_stackoverflow, exn_heapoverflow, exn_threadkilled, exn_userinterrupt,- exn_dividebyzero, exn_blockedmvar, exn_blockedstm, exn_overflow };--NORETURN void raise_exn(NODEPTR exn);-struct mvar* new_mvar(void);-NODEPTR take_mvar(bool try, struct mvar *mv);-NORETURN void die_exn(NODEPTR exn);-void thread_intr(struct mthread *mt);-int put_mvar(bool try, struct mvar *mv, NODEPTR v);-NODEPTR mkInt(value_t i);-NODEPTR mkInt64(int64_t i);-NODEPTR mkFlt32(flt32_t d);-NODEPTR mkFlt64(flt64_t d);-NODEPTR mkPtr(void* p);-struct mthread* new_thread(NODEPTR root);-void gc(void);-void async_throwto(struct mthread*, NODEPTR);--#if WANT_STDIO-void pp(FILE*, NODEPTR);-#endif--/* Needed during reduction */-NODEPTR intTable[HIGH_INT - LOW_INT];-NODEPTR combK, combA, combI, combCons, combPair;-NODEPTR combCC, combZ, combIOBIND, combIORETURN, combIOTHEN, combB, combC, combBB;-NODEPTR combKK, combKA;-NODEPTR combSETMASKINGSTATE;-NODEPTR combPERFORMIO;-NODEPTR combShowExn, combU, combK2, combK3;-NODEPTR combBININT1, combBININT2, combUNINT1;-NODEPTR combBININT64_1, combBININT64_2, combUNINT64_1;-NODEPTR combBINFLT1, combBINFLT2, combUNFLT1;-NODEPTR combBINDBL1, combBINDBL2, combUNDBL1;-NODEPTR combBINBS1, combBINBS2;-NODEPTR comb_stdin, comb_stdout, comb_stderr;-NODEPTR combJust;-NODEPTR combTHROWTO;-NODEPTR combPairUnit;-NODEPTR combWorld;-NODEPTR combCATCHR;-NODEPTR combFst, combSnd;-NODEPTR combFP2P;-NODEPTR spare_node; /* an unused node in the heap, used in printrec */-#define combFalse combK-#define combTrue combA-#define combNothing combK-#define combUnit combI-#define combLT combK2-#define combEQ combKK-#define combGT combKA--/*******************************/--#if WANT_ARGS-/* This single element array hold a list of the program arguments. */-struct ioarray *argarray;-#endif /* WANT_ARGS */--int verbose = 0;-int gcbell = 0;---#if WANT_SIGINT-volatile bool has_sigint = false;-void-handle_sigint(int s)-{- has_sigint = true;-}-#endif--/* Check that there are k nodes available, if not then GC. */-INLINE void-gc_check(size_t k)-{- if (k < num_free)- return;-#if WANT_STDIO- if (verbose > 1)- PRINT("gc_check: %d\n", (int)k);-#endif- gc();-}--/* Add the thread to the tail of runq */-void-add_q_tail(struct mqueue *q, struct mthread *mt)-{- if (!q->mq_head) {- /* q is empty, so mt goes first */- q->mq_head = mt;- } else {- /* link mt to the end of the runq */- q->mq_tail->mt_queue = mt;- }- q->mq_tail = mt; /* mt is now last */- mt->mt_queue = 0; /* mt is last, so no next */-}--void-add_runq_tail(struct mthread *mt)-{- mt->mt_state = ts_runnable;- add_q_tail(&runq, mt);-}--struct mthread*-remove_q_head(struct mqueue *q)-{- struct mthread *mt = q->mq_head; /* front thread */- if (!mt)- return 0;- q->mq_head = mt->mt_queue; /* skip to next thread */- if (!q->mq_head)- q->mq_tail = 0; /* q is now empty */- return mt;-}--int-find_and_unlink(struct mqueue *mq, struct mthread *mt)-{- struct mthread **mtp;-- for(mtp = &mq->mq_head; *mtp && *mtp != mt; mtp = &(*mtp)->mt_queue)- ;- if (!*mtp)- return 0; /* not found */- *mtp = mt->mt_queue; /* unlink */- if (*mtp)- return 1; /* the unlinked thread was not the tail */- if (mq->mq_head) {- for (mt = mq->mq_head; mt->mt_queue; mt = mt->mt_queue)- ; /* find the last element */- mq->mq_tail = mt;- } else {- /* q is empty */- mq->mq_tail = 0;- }- return 1;-}--/* This is a yucky hack */-bool doing_rnf = false; /* REMOVE */-#if THREAD_DEBUG-const bool thread_trace = false;-#endif /* THREAD_DEBUG */--/* clean up temporary globals to prepare for rescheduling */-void-cleanup(struct mthread *mt, enum th_state ts)-{- /* We are going to reschedule, so clean up thread state:- * stack pointer- * error handlers- */-#if THREAD_DEBUG- if (thread_trace)- printf("cleanup: %d state=%d\n", (int)mt->mt_id, ts);-#endif /* THREAD_DEBUG */- mt->mt_slice = stack_ptr; /* we need stack_ptr reductions to just reach where we left off */- mt->mt_state = ts;- CLEARSTK(); /* reset stack */- doing_rnf = false;- /* free all error handlers */- for (struct handler *h = cur_handler; h; ) {- struct handler *n = h;- h = h->hdl_old;- free(n);- }- cur_handler = 0;-}--/* reschedule, does not return */-NORETURN void-resched(struct mthread *mt, enum th_state ts)-{- cleanup(mt, ts);- longjmp(sched, mt_resched);-}--#if THREAD_DEBUG-void-dump_q(const char *s, struct mqueue q)-{- printf(" %s=[", s);- for(struct mthread *mt = q.mq_head; mt; mt = mt->mt_queue) {- printf("%d ", (int)mt->mt_id);- }- printf("]\n");-}-#endif /* THREAD_DEBUG */--/* Check if its time to wake up some threads waiting for a time. */-void-check_timeq(void)-{-#if defined(CLOCK_INIT)- CLOCK_T now = CLOCK_GET();- while (timeq.mq_head && timeq.mq_head->mt_at <= now) {- struct mthread *mt = remove_q_head(&timeq);- add_runq_tail(mt);- mt->mt_at = -1; /* indicate that the delay has expired */-#if THREAD_DEBUG- if (thread_trace)- printf("check_timeq: %d done\n", (int)mt->mt_id);-#endif /* THREAD_DEBUG */- }-#if THREAD_DEBUG- if (thread_trace) {- printf("check_timeq: exit\n");- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */-#endif-}--void-check_pollq(int timeout)-{-#if WANT_IO_POLL-#define MAX_POLL_FDS 100- struct pollfd fds[MAX_POLL_FDS];- int nfds = 0;- for(struct mthread *mt = pollq.mq_head; mt; mt = mt->mt_queue) {- if (nfds >= MAX_POLL_FDS)- ERR("check_pollq: too many FDs");- fds[nfds].fd = mt->mt_fd;- fds[nfds].events = mt->mt_events;- nfds++;- }-#if THREAD_DEBUG- if (thread_trace)- printf("check_pollq: enter poll(_, %d, %d)\n", nfds, timeout);-#endif /* THREAD_DEBUG */- int r = poll(fds, nfds, timeout);- if (r < 0)- return; /* silently ignore errors */- nfds = 0;- struct mthread *next;- for(struct mthread *mt = pollq.mq_head; mt; mt = next) {- next = mt->mt_queue;- if (fds[nfds].revents & (mt->mt_events | POLLHUP)) {- /* Some event has happened, move the thread back to the runq. */- find_and_unlink(&pollq, mt); /* remove from I/O queue */- add_runq_tail(mt);-#if THREAD_DEBUG- if (thread_trace)- printf("check_pollq: FD=%d thread=%d done\n", mt->mt_fd, (int)mt->mt_id);-#endif /* THREAD_DEBUG */- mt->mt_fd = IO_POLL_EVENT_HAS_HAPPENED;- }- nfds++;- }-#if THREAD_DEBUG- if (thread_trace) {- printf("check_pollq: exit\n");- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */-#endif /* WANT_IO_POLL */-}--void-throwto(struct mthread *mt, NODEPTR exn)-{-#if THREAD_DEBUG- if (thread_trace) {- printf("throwto: id=%d\n", (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */- thread_intr(mt);- if (mt->mt_state != ts_died && mt->mt_state != ts_finished) {-#if THREAD_DEBUG- if (thread_trace) {- printf("throwto: id=%d put_mvar exn\n", (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */- (void)put_mvar(false, mt->mt_exn, exn); /* never returns if it blocks */- }-}--void-check_thrown(bool intr)-{- if (runq.mq_head->mt_exn->mv_data == NIL)- return; /* no thrown exception */- if (runq.mq_head->mt_mask == mask_uninterruptible ||- (!intr && runq.mq_head->mt_mask == mask_interruptible)) {- return; /* interrupts are masked, so don't throw */- }- /* the current thread has an async exception */-#if THREAD_DEBUG- if (thread_trace)- printf("check_thrown: exn for %d\n", (int)runq.mq_head->mt_id);-#endif /* THREAD_DEBUG */- NODEPTR exn = take_mvar(false, runq.mq_head->mt_exn); /* get the exception */- raise_exn(exn);-}--void-check_sigint(void)-{-#if WANT_SIGINT- if (has_sigint) {- /* We have a signal, so send an async exception to the main thread */- has_sigint = false;- for(struct mthread *mt = all_threads; mt; mt = mt->mt_next) {- if (mt->mt_id == MAIN_THREAD) {-#if THREAD_DEBUG- if (thread_trace)- printf("sending signal to main\n");-#endif /* THREAD_DEBUG */- async_throwto(mt, mkInt(exn_userinterrupt));- break;- }- }- }-#endif-}--/* Used to detect calls to error while we are already in a call to error. */-bool in_raise = false;--/* Inlining makes very little difference */-/*static INLINE*/ void-yield(void)-{- if (in_raise) /* don't context switch when we are dying */- return;- COUNT(num_yield);- runq.mq_head->mt_num_slices++;- // XXX should check mt_thrown here-- YIELD_EXTRA; /* platform specific extra stuff */-- if (timeq.mq_head)- check_timeq();- check_thrown(false);- check_sigint();-- if (pollq.mq_head) {- /* Check if any threads blocked on IO can be scheduled. Since we pass in a delay of 0, checking- * for the events will not block. */- check_pollq(0);- }--// printf("yield %p %d\n", runq, (int)stack_ptr);- /* if there is nothing after in the runq then there is no need to reschedule */- if (!runq.mq_head->mt_queue) {-#if THREAD_DEBUG- if (thread_trace) {- printf("yield: %d no other threads\n", (int)runq.mq_head->mt_id);- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- glob_slice = slice;- num_reductions += glob_slice-1;- return;- }-- /* Unlink from runq */- struct mthread *mt = remove_q_head(&runq);- /* link into back of runq */- add_runq_tail(mt);-#if THREAD_DEBUG- if (thread_trace) {- printf("yield: resched %d\n", (int)mt->mt_id);- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- resched(mt, ts_runnable);-}--struct mthread*-new_thread(NODEPTR root)-{- struct mthread *mt = mmalloc(sizeof(struct mthread));--#if THREAD_DEBUG- if (thread_trace) {- printf("new_thread: mt=%p root=%p\n", mt, root);- }-#endif /* THREAD_DEBUG */- mt->mt_mask = mask_unmasked;- mt->mt_root = root;- mt->mt_exn = new_mvar();- mt->mt_mval = NIL;- mt->mt_slice = 0;- mt->mt_mark = false;- mt->mt_num_slices = 0;- mt->mt_id = num_thread_create++;-#if WANT_IO_POLL- mt->mt_fd = IO_POLL_WAITING_FOR_NONE;- mt->mt_events = 0;-#endif-#if defined(CLOCK_INIT)- mt->mt_at = 0; /* delay has not expired */-#endif-- /* add to all_threads */- mt->mt_next = all_threads;- all_threads = mt;-- /* add to tail of runq */- add_runq_tail(mt); /* sets runnable */-#if THREAD_DEBUG- if (thread_trace) {- printf("new_thread: add %d to runq tail\n", (int)mt->mt_id);- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- return mt;-}--struct mvar*-new_mvar(void)-{- COUNT(num_mvar_alloc);- struct mvar *mv = mmalloc(sizeof(struct mvar));-- mv->mv_data = NIL;- mv->mv_takeput.mq_head = 0;- mv->mv_takeput.mq_tail = 0;- mv->mv_read.mq_head = 0;- mv->mv_read.mq_tail = 0;-- /* add to all_mvars */- mv->mv_next = all_mvars;- mv->mv_mark = false;- all_mvars = mv;--#if THREAD_DEBUG- if (thread_trace)- printf("new_mvar: mvar=%p\n", mv);-#endif /* THREAD_DEBUG */- return mv;-}--NODEPTR-take_mvar(bool try, struct mvar *mv)-{-#if THREAD_DEBUG- if (thread_trace) {- printf("take_mvar: start mvar=%p\n", mv);- dump_q("takeput", mv->mv_takeput);- }-#endif /* THREAD_DEBUG */- NODEPTR n;- if ((n = runq.mq_head->mt_mval) != NIL) {-#if THREAD_DEBUG- if (thread_trace)- printf("take_mvar: end mvar=%p got data %d\n", mv, (int)runq.mq_head->mt_id);-#endif /* THREAD_DEBUG */- /* We have no data after waking up */- runq.mq_head->mt_mval = NIL;- return n; /* returned the stashed data */- }- if ((n = mv->mv_data) != NIL) {-#if THREAD_DEBUG- if (thread_trace)- printf("take_mvar: mvar=%p full\n", mv);-#endif /* THREAD_DEBUG */- /* mvar is full */- mv->mv_data = NIL; /* now empty */-- /* move one thread waiting to put to the runq */- struct mthread *mt;- if((mt = remove_q_head(&mv->mv_takeput))) {-#if THREAD_DEBUG- if (thread_trace) {- printf("take_mvar: mvar=%p wake %d\n", mv, (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */- add_runq_tail(mt);-#if THREAD_DEBUG- if (thread_trace) {- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- }-#if THREAD_DEBUG- if (thread_trace) {- printf("take_mvar: end mvar=%p return %p\n", mv, n);- }-#endif /* THREAD_DEBUG */- return n; /* return the data */- } else {-#if THREAD_DEBUG- if (thread_trace)- printf("take_mvar: mvar=%p empty\n", mv);-#endif /* THREAD_DEBUG */- /* mvar is empty */- if (try)- return NIL;- struct mthread *mt = remove_q_head(&runq);- add_q_tail(&mv->mv_takeput, mt);-#if THREAD_DEBUG- if (thread_trace) {- printf("take_mvar: end mvar=%p suspend %d\n", mv, (int)mt->mt_id);- dump_q("runq", runq);- dump_q("takeput", mv->mv_takeput);- }-#endif /* THREAD_DEBUG */- /* Unlink from runq */- resched(mt, ts_wait_mvar); /* never returns */- NOTREACHED;- }-}--NODEPTR-read_mvar(bool try, struct mvar *mv)-{- NODEPTR n;- if ((n = runq.mq_head->mt_mval) != NIL) {- /* We have no data after waking up */- runq.mq_head->mt_mval = NIL;- return n; /* returned the stashed data */- }- if ((n = mv->mv_data) != NIL) {- /* mvar is full */- return n; /* return the data */- } else {- /* mvar is empty */- if (try)- return NIL;-#if THREAD_DEBUG- if (thread_trace) {- printf("read_mvar: suspend %d\n", (int)runq.mq_head->mt_id);- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- struct mthread *mt = remove_q_head(&runq);- add_q_tail(&mv->mv_read, mt);- resched(mt, ts_wait_mvar); /* never returns */- NOTREACHED;- }-}--int-put_mvar(bool try, struct mvar *mv, NODEPTR v)-{-#if THREAD_DEBUG- if (thread_trace) {- printf("put_mvar: mvar=%p\n", mv);- dump_q("takeput", mv->mv_takeput);- dump_q("read", mv->mv_read);- }-#endif /* THREAD_DEBUG */- if (mv->mv_data != NIL) {-#if THREAD_DEBUG- if (thread_trace)- printf("put_mvar: mvar=%p full\n", mv);-#endif /* THREAD_DEBUG */- /* mvar is full */- if (try)- return 0;- struct mthread *mt = remove_q_head(&runq);- add_q_tail(&mv->mv_takeput, mt); /* put on mvar queue */-#if THREAD_DEBUG- if (thread_trace) {- printf("put_mvar: suspend %d\n", (int)mt->mt_id);- dump_q("runq", runq);- dump_q("takeput", mv->mv_takeput);- }-#endif /* THREAD_DEBUG */- resched(mt, ts_wait_mvar); /* never returns */- } else {-#if THREAD_DEBUG- if (thread_trace)- printf("put_mvar: mvar=%p empty\n", mv);-#endif /* THREAD_DEBUG */- /* mvar is empty */- if (mv->mv_takeput.mq_head || mv->mv_read.mq_head) {- /* one or more threads are waiting */- struct mthread *mt;- if ((mt = remove_q_head(&mv->mv_takeput))) {- /* wake up one 'take' */-#if THREAD_DEBUG- if (thread_trace)- printf("put_mvar: wake-1 %d\n", (int)mt->mt_id);-#endif /* THREAD_DEBUG */- add_runq_tail(mt); /* and schedule for execution later */- mt->mt_mval = v;- }- for(;;) {- mt = remove_q_head(&mv->mv_read);- if (!mt)- break;-#if THREAD_DEBUG- if (thread_trace)- printf("put_mvar: wake-N %d\n", (int)mt->mt_id);-#endif /* THREAD_DEBUG */- mt->mt_mval = v; /* value for restarted read */- add_runq_tail(mt); /* and schedule for execution later */- }-#if THREAD_DEBUG- if (thread_trace) {- printf("put_mvar: end\n");- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- /* return to caller */- } else {-#if THREAD_DEBUG- if (thread_trace) {- printf("put_mvar: mvar=%p no waiters\n", mv);- }-#endif /* THREAD_DEBUG */- /* no threads waiting, so store the value */- mv->mv_data = v;- /* return to caller */- }- }- return 1;-}--NORETURN void-thread_delay(uvalue_t usecs)-{-#if !defined(CLOCK_INIT)- ERR("thread_delay: no clock");-#else- /* XXX should check if there is already a throw exn */- struct mthread *mt = remove_q_head(&runq);- mt->mt_at = CLOCK_GET() + usecs; /* wakeup time */-#if THREAD_DEBUG- if (thread_trace)- printf("thread_delay: id=%d usecs=%ld\n", (int)mt->mt_id, (long)usecs);-#endif /* THREAD_DEBUG */- /* insert in delayq which is kept sorted in time order */- struct mthread **tq;- for (tq = &timeq.mq_head; *tq; tq = &(*tq)->mt_queue) {- if (mt->mt_at <= (*tq)->mt_at)- break;- }- mt->mt_queue = *tq; /* forward link */- *tq = mt; /* and put mt in place */- if (!mt->mt_queue) /* no forward link */- timeq.mq_tail = mt;- resched(mt, ts_wait_time);-#endif-}--/* Pause execution if something might still happen */-void-pause_exec(void)-{-/*- * We end up here if the run queue is empty. If there is no thread waiting for- * a delay to expire, we will never resume operation and we are deadlocked. However, if- * we compile with WANT_IO_POLL there might be threads waiting for IO events, so in- * that case we check for them as well. If there is no thread waiting for a delay or an- * IO event, we are deadlocked.- */-#if WANT_IO_POLL- /* Check for deadlock situation */- if (!pollq.mq_head-#if defined(CLOCK_INIT)- && !timeq.mq_head-#endif- ) ERR("deadlock");-- /* Loop until at least one thread is runnable.*/- while (!runq.mq_head) {- int timeout_ms = -1; /* block indefinitely if only io_waiters */-#if defined(CLOCK_INIT)- /* If there are threads blocked on delays, compute the timeout_ms to account for that. */- if (timeq.mq_head) {- CLOCK_T dly = timeq.mq_head->mt_at - CLOCK_GET();- if (dly > 0) {- /* poll() can be unreliable, so sleep shorter than the delay */- dly /= 1100; /* 1.1=sleep shorter, 1000=convert us to ms */- timeout_ms = dly == 0 ? 1 : dly; /* sleep at least 1ms to avoid busy wait */- } else {- timeout_ms = 0; /* delay has already expired */- }- }- check_timeq();-#endif /* defined(CLOCK_INIT) */- check_pollq(timeout_ms);- check_sigint(); /* if there is a SIGINT, this will put a thread on the runq */- }--#else /* !WANT_IO_POLL */--#if defined(CLOCK_INIT)- if (timeq.mq_head) {- struct mthread *mt;- while (!runq.mq_head && (mt = timeq.mq_head)) {- /* We are waiting for a delay to expire, so sleep a while */- CLOCK_T dly = mt->mt_at - CLOCK_GET();- if (dly > 0) {- /* usleep() can be unreliable, so sleep shorter than the delay */- dly /= 4;- if (dly < 50) dly = 50;- CLOCK_SLEEP((useconds_t)dly);- }- check_timeq();- }- } else {-#if THREAD_DEBUG- if (0) {- dump_q("runq", runq);- dump_q("timeq", timeq);- if (0) {- for(struct mvar *mv = all_mvars; mv; mv = mv->mv_next) {- printf("mvar %p, data=%p\n", mv, mv->mv_data);- dump_q("takeput", mv->mv_takeput);- }- }- for(struct mthread *mt = all_threads; mt; mt = mt->mt_next) {- if (mt->mt_exn->mv_data != NIL) {- printf("### bad thread ThreadId#%d mask=%d state=%d\n", (int)mt->mt_id, mt->mt_mask, mt->mt_state);- }- }- }-#endif /* THREAD_DEBUG */- ERR("deadlock"); /* XXX throw async to main thread */- }-#else /* CLOCK_INIT */- ERR("no clock");-#endif /* CLOCK_INIT */-#endif /* !WANT_IO_POLL */-}--/* Interrupt a sleeping thread in a throwTo/threadDelay */-void-thread_intr(struct mthread *mt)-{-#if THREAD_DEBUG- if (thread_trace)- printf("thread_intr: id=%d state=%d\n", (int)mt->mt_id, mt->mt_state);-#endif /* THREAD_DEBUG */- switch(mt->mt_state) {- case ts_runnable:- break; /* already on runq */- case ts_wait_mvar:- if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */- break;- /* we don't know which mvar we are waiting on, so look at all of them */- /* XXX should add a pointer in mthread to the mvar */- for (struct mvar *mv = all_mvars; mv; mv = mv->mv_next) {- if (find_and_unlink(&mv->mv_takeput, mt))- goto found;- if (find_and_unlink(&mv->mv_read, mt))- goto found;- }- ERR("thread_intr: mvar");- found:-#if defined(CLOCK_INIT)- mt->mt_at = -1; /* don't wait again */-#endif- mt->mt_mval = NIL; /* no longer waiting on the mvar */- add_runq_tail(mt);- break;- case ts_wait_time:-#if THREAD_DEBUG- if (thread_trace) {- printf("thread_intr: ts_wait_time mask=%d\n", (int)mt->mt_mask);- }-#endif /* THREAD_DEBUG */- if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */- break;- /* find thread in timeq */- if (!find_and_unlink(&timeq, mt))- ERR("thread_intr: timeq");- /* XXX should adjust mq_tail */- add_runq_tail(mt);- break;- case ts_wait_io:-#if THREAD_DEBUG- if (thread_trace) {- printf("thread_intr: ts_wait_io mask=%d\n", (int)mt->mt_mask);- }-#endif /* THREAD_DEBUG */- if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */- break;- /* find thread in timeq */- if (!find_and_unlink(&pollq, mt))- ERR("thread_intr: pollq");- /* XXX should adjust mq_tail */- add_runq_tail(mt);- break;- case ts_finished:- case ts_died:-#if THREAD_DEBUG- if (thread_trace) {- printf("thread_intr: finished/died\n");- }-#endif /* THREAD_DEBUG */- break;- default:- ERR("thread_intr");- }-#if THREAD_DEBUG- if (thread_trace) {- printf("thread_intr: done\n");- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */-}--NORETURN void-raise_exn(NODEPTR exn)-{-#if THREAD_DEBUG- if (thread_trace) {- printf("raise_exn: %p\n", exn);- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */-- if (cur_handler) {- /* Pass the exception to the handler */- cur_handler->hdl_exn = exn;- longjmp(cur_handler->hdl_buf, 1);- } else {- /* No exception handler, jump to the scheduler */- the_exn = exn;- longjmp(sched, mt_raise);- }-}--/* Raise a RTS exception identified by a number rather than an exception value */-NORETURN void-raise_rts(enum rts_exn exn) {- raise_exn(mkInt(exn));-}--/***************** GC ******************/--/* Set FREE bit to 0 */-static INLINE void mark_used(NODEPTR n)-{- heapoffs_t i = LABEL(n);- if (i < heap_start)- return;-#if SANITY- if (i >= free_map_nwords * BITS_PER_WORD) ERR("mark_used");-#endif- free_map[i / BITS_PER_WORD] &= ~(1ULL << (i % BITS_PER_WORD));-}--/* Set FREE bit to 1, used to undo marking in GC */-static INLINE void mark_unused(NODEPTR n)-{- heapoffs_t i = LABEL(n);-#if SANITY- if (i < heap_start)- ERR("Unmarking invalid heap address.");- if (i >= free_map_nwords * BITS_PER_WORD) ERR("mark_used");-#endif- free_map[i / BITS_PER_WORD] |= 1ULL << (i % BITS_PER_WORD);-}--/* Test if FREE bit is 0 */-static INLINE int is_marked_used(NODEPTR n)-{- heapoffs_t i = LABEL(n);- if (i < heap_start)- return 1;-#if SANITY- if (i >= free_map_nwords * BITS_PER_WORD)- ERR("is_marked_used");-#endif- return (free_map[i / BITS_PER_WORD] & (1ULL << (i % BITS_PER_WORD))) == 0;-}--static INLINE void mark_all_free(void)-{- memset(free_map, ~0, free_map_nwords * sizeof(bits_t));- next_scan_index = heap_start;-}--static INLINE NODEPTR-alloc_node(enum node_tag t)-{- heapoffs_t i = next_scan_index / BITS_PER_WORD;- int k; /* will contain bit pos + 1 */- heapoffs_t pos;- NODEPTR n;- heapoffs_t word;-- /* This can happen if we run out of memory when parsing. */- if (num_free <= 0)- ERR("alloc_node");-- for(;;) {- word = free_map[i];- if (word)- break;- i++;-#if SANITY- if (i >= free_map_nwords) {-#if 0- fprintf(stderr, "wordsize=%u, num_free=%u next_scan_index=%u i=%u free_map_nwords=%u\n", (uint)BITS_PER_WORD,- (uint)num_free, (uint)next_scan_index, (uint)i, (uint)free_map_nwords);-#endif- ERR("alloc_node: free_map");- }-#endif- }- k = FFS(word);- pos = i * BITS_PER_WORD + k - 1; /* first free node */- n = HEAPREF(pos);- // mark_used(n); // equivalent to:- free_map[i] = word & (word-1);- next_scan_index = pos;-- SETTAG(n, t);- COUNT(num_alloc);- num_free--;- return n;-}--static INLINE NODEPTR-new_ap(NODEPTR f, NODEPTR a)-{- NODEPTR n = alloc_node(T_AP);- FUN(n) = f;- ARG(n) = a;- return n;-}--NODEPTR evali(NODEPTR n);--/* If this is non-0 it means that the threading system is active. */-struct mthread *main_thread = 0;--void-start_exec(NODEPTR root)-{- struct mthread *mt;-- mt = new_thread(new_ap(root, combWorld)); /* main thread */- mt->mt_id = MAIN_THREAD; /* make it the main thread in case this is foreign export calling */- main_thread = mt;-- switch(setjmp(sched)) {- case mt_main:- break;- case mt_resched:- COUNT(num_resched);- break;- case mt_raise:- /* We have an uncaught exception.- * If it's the main thread, this kills the program.- * Otherwise, it just kills the thread.- */- if (in_raise) {- ERR("FATAL: exception while trying to die");- EXIT(1);- }- mt = remove_q_head(&runq);- if (mt->mt_id == MAIN_THREAD) {- die_exn(the_exn);- } else {-#if THREAD_DEBUG- if (thread_trace) {- printf("start_exec: mt=%p id=%d died from exn\n", mt, (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */- mt->mt_state = ts_died;- mt->mt_root = NIL;- }- }-#if THREAD_DEBUG- if (thread_trace) {- printf("start_exec:\n");- dump_q("runq", runq);- }-#endif /* THREAD_DEBUG */- for(;;) {- if (!runq.mq_head)- pause_exec();- mt = runq.mq_head; /* front thread */- if (!mt) /* this should never happen */- ERR("no threads");-- glob_slice = mt->mt_slice + slice;-#if THREAD_DEBUG- if (thread_trace)- printf("start_exec: start %d, slice=%d\n", (int)mt->mt_id, (int)glob_slice);-#endif /* THREAD_DEBUG */- num_reductions += glob_slice-1;- (void)evali(mt->mt_root); /* run it */- num_reductions -= glob_slice;- /* when evali() returns the thread is done */- (void)remove_q_head(&runq); /* remove front thread */--#if THREAD_DEBUG- if (thread_trace) {- printf("start_exec: mt=%p id=%d finished\n", mt, (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */- mt->mt_state = ts_finished;- mt->mt_root = NIL;- /* XXX mt_mval, mt_thrown */-- if (mt->mt_id == MAIN_THREAD) {- main_thread = 0;-#if THREAD_DEBUG- if (thread_trace) {- printf("start_exec: main thread done\n");- }-#endif /* THREAD_DEBUG */- return; /* when the main thread dies it's all over */- }- }-}--/* One node of each kind for primitives, these are never GCd. */-/* We use linear search in this, because almost all lookups- * are among the combinators.- */-static const-struct {- const char *name;- const enum node_tag tag;- const enum node_tag flipped; /* What should (C op) reduce to? defaults to T_FREE */- // NODEPTR node;-} primops[] = {- /* combinators */- /* sorted by frequency in a typical program */- { "B", T_B },- { "O", T_O },- { "K", T_K, T_A },- { "C'", T_CC },- { "C", T_C },- { "A", T_A, T_K },- { "S'", T_SS },- { "P", T_P },- { "R", T_R },- { "I", T_I },- { "S", T_S },- { "U", T_U },- { "Y", T_Y },- { "B'", T_BB },- { "Z", T_Z },- { "J", T_J },- { "K2", T_K2 },- { "K3", T_K3 },- { "K4", T_K4 },- { "C'B", T_CCB },- { "L", T_L },- { "KK", T_KK },- { "KA", T_KA },- { "T3", T_T3 },- { "T4", T_T4 },- { "T5", T_T5 },- { "T6", T_T6 },- { "T7", T_T7 },- { "T8", T_T8 },- { "T9", T_T9 },- { "T10", T_T10 },- { "T11", T_T11 },- { "T12", T_T12 },- { "T13", T_T13 },- { "T14", T_T14 },- { "T15", T_T15 },- { "T16", T_T16 },- { "TAG0", T_TAG0 },- { "TAG1", T_TAG1 },- { "TAG2", T_TAG2 },- { "TAG3", T_TAG3 },- { "TAG4", T_TAG4 },- { "TAG5", T_TAG5 },- { "TAG6", T_TAG6 },- { "TAG7", T_TAG7 },- { "TAG8", T_TAG8 },- { "TAG9", T_TAG9 },- { "TAG10", T_TAG10 },- { "TAG11", T_TAG11 },- { "TAG12", T_TAG12 },- { "TAG13", T_TAG13 },- { "TAG14", T_TAG14 },- { "TAG15", T_TAG15 },- { "TAG16", T_TAG16 },- { "TAG17", T_TAG17 },- { "TAG18", T_TAG18 },- { "TAG19", T_TAG19 },- { "TAG20", T_TAG20 },- { "TAG21", T_TAG21 },- { "TAG22", T_TAG22 },- { "TAG23", T_TAG23 },- { "TAG24", T_TAG24 },- { "TAG25", T_TAG25 },- { "TAG26", T_TAG26 },- { "TAG27", T_TAG27 },- { "TAG28", T_TAG28 },- { "TAG29", T_TAG29 },- { "TAG30", T_TAG30 },- { "TAG31", T_TAG31 },- { "TAG32", T_TAG32 },-/* primops */- { "+", T_ADD, T_ADD },- { "-", T_SUB, T_SUBR },- { "*", T_MUL, T_MUL },- { "quot", T_QUOT },- { "rem", T_REM },- { "u+", T_UADD, T_UADD },- { "u-", T_USUB, T_USUBR },- { "u*", T_UMUL, T_UMUL },- { "uquot", T_UQUOT },- { "urem", T_UREM },- { "subtract", T_SUBR, T_SUB },- { "usubtract", T_USUBR, T_USUB },- { "neg", T_NEG },- { "uneg", T_UNEG },- { "and", T_AND, T_AND },- { "or", T_OR, T_OR },- { "xor", T_XOR, T_XOR },- { "inv", T_INV },- { "shl", T_SHL },- { "shr", T_SHR },- { "ashr", T_ASHR },- { "popcount", T_POPCOUNT },- { "clz", T_CLZ },- { "ctz", T_CTZ },-#if WANT_FLOAT64- { "d+" , T_DADD, T_DADD},- { "d-" , T_DSUB },- { "d*" , T_DMUL, T_DMUL},- { "d/", T_DDIV},- { "dneg", T_DNEG},- { "itod", T_ITOD},- { "Itod", T_I64TOD},- { "utod", T_UTOD},- { "dtoi", T_DTOI},- { "d==", T_DEQ, T_DEQ},- { "d/=", T_DNE, T_DNE},- { "d<", T_DLT, T_DGT},- { "d<=", T_DLE, T_DGE},- { "d>", T_DGT, T_DLT},- { "d>=", T_DGE, T_DLE},-#endif /* WANT_FLOAT64 */-#if WANT_FLOAT64 && WANT_FLOAT32- { "dtof", T_DTOF },- { "ftod", T_FTOD },-#endif /* WANT_FLOAT64 && WANT_FLOAT32 */-#if WANT_FLOAT32- { "f+" , T_FADD, T_FADD},- { "f-" , T_FSUB },- { "f*" , T_FMUL, T_FMUL},- { "f/", T_FDIV},- { "fneg", T_FNEG},- { "Itof", T_I64TOF},- { "itof", T_ITOF},- { "utof", T_UTOF},- { "ftoi", T_FTOI},- { "f==", T_FEQ, T_FEQ},- { "f/=", T_FNE, T_FNE},- { "f<", T_FLT, T_FGT},- { "f<=", T_FLE, T_FGE},- { "f>", T_FGT, T_FLT},- { "f>=", T_FGE, T_FLE},-#endif /* WANT_FLOAT32 */-- { "bs++", T_BSAPPEND },- { "bs++.", T_BSAPPENDDOT },- { "bs==", T_BSEQ, T_BSEQ },- { "bs/=", T_BSNE, T_BSNE },- { "bs<", T_BSLT, T_BSGT },- { "bs<=", T_BSLE, T_BSGE },- { "bs>", T_BSGT, T_BSLT },- { "bs>=", T_BSGE, T_BSLE },- { "bscmp", T_BSCMP },- { "bspack", T_BSPACK },- { "bsunpack", T_BSUNPACK },- { "bsreplicate", T_BSREPLICATE },- { "bslength", T_BSLENGTH },- { "bssubstr", T_BSSUBSTR },- { "bsindex", T_BSINDEX },- { "bswrite", T_BSWRITE },-- { "ord", T_I },- { "chr", T_I },- { "==", T_EQ, T_EQ },- { "/=", T_NE, T_NE },- { "<", T_LT, T_GT },- { "u<", T_ULT, T_UGT },- { "u<=", T_ULE, T_UGE },- { "u>", T_UGT, T_ULT },- { "u>=", T_UGE, T_ULE },- { "<=", T_LE, T_GE },- { ">", T_GT, T_LT },- { ">=", T_GE, T_LE },- { "fp+", T_FPADD },- { "fp2p", T_FP2P },- { "fpnew", T_FPNEW },- { "fpfin", T_FPFIN },- // { "fpstr", T_FPSTR },- { "fp2bs", T_FP2BS },- { "bs2fp", T_BS2FP },- { "seq", T_SEQ },- { "icmp", T_ICMP },- { "ucmp", T_UCMP },- { "rnf", T_RNF },- { "fromUTF8", T_BSFROMUTF8 },- { "toUTF8", T_BSTOUTF8 },- { "headUTF8", T_BSHEADUTF8 },- { "tailUTF8", T_BSTAILUTF8 },- /* IO primops */- { "IO.>>=", T_IO_BIND },- { "IO.>>", T_IO_THEN },- { "IO.return", T_IO_RETURN },- { "IO.serialize", T_IO_SERIALIZE },- { "IO.print", T_IO_PRINT },- { "IO.deserialize", T_IO_DESERIALIZE },- { "IO.stdin", T_IO_STDIN },- { "IO.stdout", T_IO_STDOUT },- { "IO.stderr", T_IO_STDERR },- { "IO.getArgRef", T_IO_GETARGREF },- { "IO.performIO", T_IO_PERFORMIO },- { "IO.gc", T_IO_GC },- { "IO.stats", T_IO_STATS },- { "IO.pp", T_IO_PP },- { "IO.lazyBind", T_IO_LAZYBIND },- { "IO.strict", T_IO_STRICT },- { "raise", T_RAISE },- { "catch", T_CATCH },- { "catchr", T_CATCHR },- { "A.alloc", T_ARR_ALLOC },- { "A.copy", T_ARR_COPY },- { "A.size", T_ARR_SIZE },- { "A.read", T_ARR_READ },- { "A.write", T_ARR_WRITE },- { "A.trunc", T_ARR_TRUNC },- { "A.==", T_ARR_EQ },- { "dynsym", T_DYNSYM },- { "IO.fork", T_IO_FORK },- { "IO.thid", T_IO_THID },- { "thnum", T_THNUM },- { "IO.throwto", T_IO_THROWTO },- { "IO.yield", T_IO_YIELD },- { "IO.newmvar", T_IO_NEWMVAR },- { "IO.takemvar", T_IO_TAKEMVAR },- { "IO.putmvar", T_IO_PUTMVAR },- { "IO.readmvar", T_IO_READMVAR },- { "IO.trytakemvar", T_IO_TRYTAKEMVAR },- { "IO.tryputmvar", T_IO_TRYPUTMVAR },- { "IO.tryreadmvar", T_IO_TRYREADMVAR },- { "IO.threaddelay", T_IO_THREADDELAY },- { "IO.threadstatus", T_IO_THREADSTATUS },- { "IO.getmaskingstate", T_IO_GETMASKINGSTATE },- { "IO.setmaskingstate", T_IO_SETMASKINGSTATE },- { "newCAStringLen", T_NEWCASTRINGLEN },- { "packCString", T_PACKCSTRING },- { "packCStringLen", T_PACKCSTRINGLEN },- { "bsgrab", T_BSGRAB },- { "bsgrablen", T_BSGRABLEN },- { "toPtr", T_TOPTR },- { "toInt", T_TOINT },- { "toDbl", T_TODBL },- { "toFlt", T_TOFLT },- { "fromDbl", T_FROMDBL },- { "fromFlt", T_FROMFLT },- { "toFunPtr", T_TOFUNPTR },- { "IO.ccall", T_IO_CCALL },- { "isint", T_ISINT },- { "SPnew", T_SPNEW },- { "SPderef", T_SPDEREF },- { "SPfree", T_SPFREE },- { "Wknew", T_WKNEW },- { "Wknewfin", T_WKNEWFIN },- { "Wkderef", T_WKDEREF },- { "Wkfinal", T_WKFINAL },- { "binint2", T_BININT2 },- { "binint1", T_BININT1 },- { "bindbl2", T_BINDBL2 },- { "bindbl1", T_BINDBL1 },- { "binbs2", T_BINBS2 },- { "binbs1", T_BINBS1 },- { "unint1", T_UNINT1 },- { "undbl1", T_UNDBL1 },- { "IO.waitrdfd", T_IO_WAITRDFD},- { "IO.waitwrfd", T_IO_WAITWRFD},-#if WANT_INT64- { "I+", T_ADD64, T_ADD64 },- { "I-", T_SUB64, T_SUBR64 },- { "I*", T_MUL64, T_MUL64 },- { "Iquot", T_QUOT64 },- { "Irem", T_REM64 },- { "Iu+", T_UADD64, T_UADD64 },- { "Iu-", T_USUB64, T_USUBR64 },- { "Iu*", T_UMUL64, T_UMUL64 },- { "Iuquot", T_UQUOT64 },- { "Iurem", T_UREM64 },- { "Isubtract", T_SUBR64, T_SUB64 },- { "Iusubtract", T_USUBR64, T_USUB64 },- { "Ineg", T_NEG64 },- { "Iuneg", T_UNEG64 },- { "Iand", T_AND64, T_AND64 },- { "Ior", T_OR64, T_OR64 },- { "Ixor", T_XOR64, T_XOR64 },- { "Iinv", T_INV64 },- { "Ishl", T_SHL64 },- { "Ishr", T_SHR64 },- { "Iashr", T_ASHR64 },- { "Ipopcount", T_POPCOUNT64 },- { "Iclz", T_CLZ64 },- { "Ictz", T_CTZ64 },- { "I==", T_EQ64, T_EQ64 },- { "I/=", T_NE64, T_NE64 },- { "I<", T_LT64, T_GT64 },- { "Iu<", T_ULT64, T_UGT64 },- { "Iu<=", T_ULE64, T_UGE64 },- { "Iu>", T_UGT64, T_ULT64 },- { "Iu>=", T_UGE64, T_ULE64 },- { "I<=", T_LE64, T_GE64 },- { "I>", T_GT64, T_LT64 },- { "I>=", T_GE64, T_LE64 },- { "Iicmp", T_ICMP64 },- { "Iucmp", T_UCMP64 },- { "itoI", T_ITOI64 },- { "Itoi", T_I64TOI },- { "utoU", T_UTOU64 },- { "Utou", T_U64TOU },-#endif /* WANT_INT64 */- { "tick", T_TICK }, /* fake op */-};--#if GCRED-enum node_tag flip_ops[T_LAST_TAG+1];-#endif--#if WANT_STDIO-/* Create a dummy foreign pointer for the standard stdio handles. */-/* These handles are never gc():d. */-void-mk_std(NODEPTR n, FILE *f)-{- struct final *fin = mcalloc(1, sizeof(struct final));- struct forptr *fp = mcalloc(1, sizeof(struct forptr));- BFILE *bf = add_utf8(add_FILE(f));- SETTAG(n, T_FORPTR);- FORPTR(n) = fp;- fin->arg = bf;- fin->back = fp;- fp->payload.string = bf;- fp->finalizer = fin;-}-#endif--void-init_nodes(void)-{- enum node_tag t;- size_t j;- NODEPTR n;-- ALLOC_HEAP(heap_size);- free_map_nwords = (heap_size + BITS_PER_WORD - 1) / BITS_PER_WORD; /* bytes needed for free map */- free_map = mmalloc(free_map_nwords * sizeof(bits_t));-- /* Set up permanent nodes */- heap_start = 0;- for(t = T_FREE; t <= T_LAST_TAG; t++) {- NODEPTR n = HEAPREF(heap_start++);- SETTAG(n, t);- switch (t) {- case T_K: combK = n; break;- case T_A: combTrue = n; break;- case T_I: combI = n; break;- case T_O: combCons = n; break;- case T_P: combPair = n; break;- case T_CC: combCC = n; break;- case T_BB: combBB = n; break;- case T_B: combB = n; break;- case T_C: combC = n; break;- case T_Z: combZ = n; break;- case T_U: combU = n; break;- case T_K2: combK2 = n; break;- case T_K3: combK3 = n; break;- case T_KK: combKK = n; break;- case T_KA: combKA = n; break;- case T_IO_BIND: combIOBIND = n; break;- case T_IO_THEN: combIOTHEN = n; break;- case T_IO_RETURN: combIORETURN = n; break;- case T_IO_SETMASKINGSTATE: combSETMASKINGSTATE = n; break;- case T_IO_PERFORMIO: combPERFORMIO = n; break;- case T_BININT1: combBININT1 = n; break;- case T_BININT2: combBININT2 = n; break;- case T_UNINT1: combUNINT1 = n; break;- case T_BININT64_1: combBININT64_1 = n; break;- case T_BININT64_2: combBININT64_2 = n; break;- case T_UNINT64_1: combUNINT64_1 = n; break;- case T_BINDBL1: combBINDBL1 = n; break;- case T_BINDBL2: combBINDBL2 = n; break;- case T_UNDBL1: combUNDBL1 = n; break;- case T_BINFLT1: combBINFLT1 = n; break;- case T_BINFLT2: combBINFLT2 = n; break;- case T_UNFLT1: combUNFLT1 = n; break;- case T_BINBS1: combBINBS1 = n; break;- case T_BINBS2: combBINBS2 = n; break;- case T_IO_THROWTO: combTHROWTO = n; break;- case T_CATCHR: combCATCHR = n; break;- case T_FP2P: combFP2P = n; break;-#if WANT_STDIO- case T_IO_STDIN: comb_stdin = n; mk_std(n, stdin); break;- case T_IO_STDOUT: comb_stdout = n; mk_std(n, stdout); break;- case T_IO_STDERR: comb_stderr = n; mk_std(n, stderr); break;-#endif- default:- break;- }- for (j = sizeof primops / sizeof primops[0]; j-- > 0; ) {- // if (primops[j].tag == t) {- // primops[j].node = n;- // }- tag_names[primops[j].tag] = primops[j].name;- }- }--#if GCRED- for (j = 0; j < sizeof primops / sizeof primops[0]; j++) {- flip_ops[primops[j].tag] = primops[j].flipped;- }-#endif-- /* The representation of the constructors of- * data Ordering = LT | EQ | GT- * do not have single constructors.- * But we can make compound one, since they are irreducible.- */-#define NEWAP(c, f, a) do { n = HEAPREF(heap_start++); SETTAG(n, T_AP); FUN(n) = (f); ARG(n) = (a); (c) = n;} while(0)-#define MKINT(c, i) do { n = HEAPREF(heap_start++); SETTAG(n, T_INT); SETVALUE(n, i); (c) = n; } while(0)- {- /* The displaySomeException compiles to (U (U (K2 A))) */- NODEPTR x;- NEWAP(x, combK2, combTrue); /* (K2 A) */- NEWAP(x, combU, x); /* (U (K2 A)) */- NEWAP(combShowExn, combU, x); /* (U (U (K2 A))) */- }- NEWAP(combJust, combZ, combU); /* (Z U) */- MKINT(combWorld, 99999);- NEWAP(combPairUnit, combPair, combUnit);- NEWAP(combFst, combU, combK);- NEWAP(combSnd, combU, combA);-#undef NEWAP--#if INTTABLE- /* Allocate permanent Int nodes */- for (int i = LOW_INT; i < HIGH_INT; i++) {- NODEPTR n = HEAPREF(heap_start++);- intTable[i - LOW_INT] = n;- SETTAG(n, T_INT);- SETVALUE(n, i);- }-#endif- spare_node = HEAPREF(heap_start++);-- /* Round up heap_start to the next bitword boundary to avoid the permanent nodes. */- heap_start = (heap_start + BITS_PER_WORD - 1) / BITS_PER_WORD * BITS_PER_WORD;-- mark_all_free();-- num_free = heap_size - heap_start;-}--#if GCRED-counter_t red_a, red_k, red_i, red_int, red_flip, red_bi, red_bxi, red_ccbi, red_cc, red_cci, red_ccbbcp;-#endif-counter_t red_bb, red_k4, red_k3, red_k2, red_ccb, red_z, red_r;--//counter_t mark_depth;-//counter_t max_mark_depth = 0;--void mark(NODEPTR *np);-void mark_mvar(struct mvar *mv);-void mark_thread(struct mthread *mt);--/* Follow indirections */-static INLINE NODEPTR-indir(NODEPTR *np)-{- NODEPTR n = *np;- while (GETTAG(n) == T_IND)- n = GETINDIR(n);- *np = n;- return n;-}--/***** weak pointers *****/--struct weak_ptr {- struct weak_ptr *next; /* list of all weak pointers. */- int marked; /* seen by GC */- NODEPTR key; /* key, this is the weak pointer */- NODEPTR value; /* associated value */- NODEPTR finalize; /* maybe finalizer */-};-struct weak_ptr *allweaks; /* head of all weak pointers */--/* After GC mark phase, deal with weak pointers */-void-sweep_weaks(void)-{- restart:- /* all weak pointer records are alive, marked or not */- for (struct weak_ptr *wp = allweaks; wp; wp = wp->next) {- if (!wp->value)- continue; /* the weak pointer is already dead */- (void)indir(&wp->key);- if (is_marked_used(wp->key)) {- /* The key is used, so mark the other parts */- if (!is_marked_used(wp->value) ||- (wp->finalize != 0 && !is_marked_used(wp->finalize))) {- /* Not already marked */- mark(&wp->value);- if (wp->finalize)- mark(&wp->finalize);- /* This marking might have marked other keys, so restart the scan */- goto restart;- }- } else {- /* The key is not marked, so the weak reference is dead */- wp->value = 0;- }- }-- /* Create finalizers for all weak pointers that just died */- for (struct weak_ptr *wp = allweaks; wp; wp = wp->next) {- if (!wp->value && wp->finalize) {- struct mthread *mt = new_thread(wp->finalize);- mark_thread(mt); /* mark it, since overall thread marking has already run */- wp->finalize = 0;- wp->key = 0; /* not needed, but for sanity */- /* Marking the finalizer does not resurrect keys */- }- }-- /* If a weak pointer object is unreferenced and it has been finalized,- * then it can be garbage collected. */- for (struct weak_ptr **wpp = &allweaks; *wpp; ) {- struct weak_ptr *wp = *wpp;- if (!wp->marked && !wp->value) {- /* not marked, so unlink and free */- *wpp = wp->next;- COUNT(num_gc_weak);- free(wp);- } else {- /* point to the next weak_ptr */- wpp = &wp->next;- }- }-}--NODEPTR-new_weak_ptr(NODEPTR key, NODEPTR value, NODEPTR finalize)-{- struct weak_ptr *wp = mmalloc(sizeof(struct weak_ptr));- wp->next = allweaks;- allweaks = wp;- wp->marked = 0;- wp->key = key;- wp->value = value;- if (finalize) {- wp->finalize = new_ap(finalize, combWorld);- } else {- wp->finalize = 0;- }-- COUNT(num_new_weak);- NODEPTR n = alloc_node(T_WEAK);- WEAK(n) = wp;- return n;-}--NODEPTR-deref_weak_ptr(struct weak_ptr *wp)-{- if (!wp->value)- return combNothing;- return new_ap(combJust, wp->value);-}--void-finalize_weak_ptr(struct weak_ptr *wp)-{- NODEPTR final = wp->finalize;- if (!final)- return;- wp->finalize = 0;- (void)evali(final);-}--/**********************************************************/--/* Throwing, e.g., a UserInterrupt exception, to the main thread- * can happen from any thread (the one that happens to poll).- * Throwing an exception can block, so we can't throw it from- * the current thread. Instead, we spawn a new thread, whose- * only job it is to throw the exception.- */-void-async_throwto(struct mthread *mt, NODEPTR exn)-{- GCCHECK(4);- NODEPTR thid = alloc_node(T_THID);- THR(thid) = mt; /* thread ID for mt */- NODEPTR root = new_ap(new_ap(new_ap(combTHROWTO, thid), exn), combWorld); /* root = throwTo thid exn */- (void)new_thread(root); /* spawn and put on runq, i.e., forkIO root */-}--void-mark_thread(struct mthread *mt)-{- if (mt->mt_mark)- return; /* already marked */- mt->mt_mark = true;- if (mt->mt_root != NIL)- mark(&mt->mt_root);- mark_mvar(mt->mt_exn);- if (mt->mt_mval != NIL)- mark(&mt->mt_mval);-}--void-mark_mvar(struct mvar *mv)-{- if (mv->mv_mark)- return;- mv->mv_mark = true;- if (mv->mv_data != NIL)- mark(&mv->mv_data);- for (struct mthread *mt = mv->mv_takeput.mq_head; mt; mt = mt->mt_queue)- mark_thread(mt);- for (struct mthread *mt = mv->mv_read.mq_head; mt; mt = mt->mt_queue)- mark_thread(mt);-}--/*- * Only allow GC reductions when the node is not near the top of the stack.- * The reason is that when GC is triggered we are just starting a reduction- * and the combinator at the left-bottom of the spine is being reduced.- * If a GC reduction removes this combinator, then bad things happen.- */-static int-gc_red_ok(NODEPTR n)-{- for (stackptr_t s = stack_ptr; s >= 0 && s >= stack_ptr - 5; s--)- if (n == stack[s])- return 0;- return 1;-}--/* Mark all used nodes reachable from *np, updating *np. */-void-mark(NODEPTR *np)-{- stackptr_t stk = stack_ptr;- NODEPTR n;- NODEPTR *to_push = 0; /* silence warning by initializing */-#if GCRED- value_t val;-#endif- enum node_tag tag;-- // mark_depth++;- // if (mark_depth % 10000 == 0)- // PRINT("mark depth %"PRIcounter"\n", mark_depth);- top:- n = *np;- tag = GETTAG(n);- if (tag == T_IND) {-#if SANITY- int loop = 0;- /* Skip indirections, and redirect start pointer */- while ((tag = GETTAG(n)) == T_IND) {- // PRINT("*"); fflush(stdout);- n = GETINDIR(n);- if (loop++ > 1000000000) {- //PRINT("%p %p %p\n", n, GETINDIR(n), GETINDIR(GETINDIR(n)));- ERR("IND loop");- }- }- // if (loop)- // PRINT("\n");-#else /* SANITY */- while ((tag = GETTAG(n)) == T_IND) {- n = GETINDIR(n);- }-#endif /* SANITY */- *np = n;- }- if (n < cells || n > cells + heap_size)- ERR("bad n");- if (is_marked_used(n)) {- goto fin;- }- num_marked++;- mark_used(n);- switch (tag) {-#if GCRED-#define GCREDIND(x) do { NODEPTR nn = (x); mark(&nn); SETINDIR(n, nn); goto fin; } while(0)- case T_INT:-#if INTTABLE- if (LOW_INT <= (val = GETVALUE(n)) && val < HIGH_INT) {- SETINDIR(n, intTable[val - LOW_INT]);- COUNT(red_int);- goto top;- }- goto fin;-#endif /* INTTABLE */- case T_AP:- if (want_gc_red) {- NODEPTR fun = indir(&FUN(n));- NODEPTR arg = indir(&ARG(n));- enum node_tag funt = GETTAG(fun);- enum node_tag argt = GETTAG(arg);- enum node_tag funfunt = funt == T_AP ? GETTAG(indir(&FUN(fun))) : T_FREE;- enum node_tag funargt = argt == T_AP ? GETTAG(indir(&FUN(arg))) : T_FREE;-- /* This is really only fruitful just after parsing. It can be removed. */- if (funfunt == T_A && gc_red_ok(n)) {- /* Do the A x y --> y reduction */- NODEPTR y = ARG(n);- COUNT(red_a);- GCREDIND(y);- }-- if (funfunt == T_K && gc_red_ok(n)) {- /* Do the K x y --> x reduction */- NODEPTR x = ARG(FUN(n));- COUNT(red_k);- GCREDIND(x);- }-- if (funt == T_I && gc_red_ok(n)) {- /* Do the I x --> x reduction */- NODEPTR x = ARG(n);- COUNT(red_i);- GCREDIND(x);- }-- if(funt == T_CC && argt == T_I && gc_red_ok(n)) {- /* C' I --> C */- SETTAG(n, T_C);- COUNT(red_cci);- goto top;- }-- if(funt == T_CCB && argt == T_AP) {- NODEPTR funarg = indir(&FUN(arg));- NODEPTR argarg = indir(&ARG(arg));- if (GETTAG(argarg) == T_P && GETTAG(funarg) == T_AP) {- if (GETTAG(indir(&FUN(funarg))) == T_B && GETTAG(indir(&ARG(funarg))) == T_C && gc_red_ok(n)) {- /* C'B ((B C) P) --> C */- SETTAG(n, T_C);- COUNT(red_ccbbcp);- goto top;- }- }- }-- if(funt == T_B && argt == T_I && gc_red_ok(n)) {- /* B I --> I */- SETTAG(n, T_I);- COUNT(red_bi);- goto top;- }-- if(funfunt == T_B && argt == T_I && gc_red_ok(n)) {- /* B x I --> x */- NODEPTR x = ARG(FUN(n));- COUNT(red_bxi);- GCREDIND(x);- }-- if(funfunt == T_CCB && argt == T_I && gc_red_ok(n)) {- /* C'B x I --> x */- NODEPTR x = ARG(FUN(n));- COUNT(red_ccbi);- GCREDIND(x);- }-- if(funt == T_C && funargt == T_C && gc_red_ok(n)) {- /* C (C x) --> x */- NODEPTR x = ARG(ARG(n));- COUNT(red_cc);- GCREDIND(x);- }--#if 0- /* Very rare */- if (funt == T_S && funargt == T_K && gc_red_ok(n)) {- /* S (K x) --> B x */- printf("SK"); fflush(stdout);- }-#endif--#if 0- /* Fairly frequent, but needs allocation */- if (funfunt == T_B && funargt == T_K) {- /* B x (K y) --> K x y */- printf("BxK\n");- }-#endif--#if 1- if (funt == T_C && gc_red_ok(n)) {- enum node_tag tf;- if ((tf = flip_ops[argt])) {- /* Do the C op --> flip_op reduction */- // PRINT("%s -> %s\n", tag_names[tt], tag_names[tf]);- COUNT(red_flip);- GCREDIND(HEAPREF(tf));- }- }-#endif- }-#else /* GCRED */- case T_AP:-#endif /* GCRED */- /* Avoid tail recursion */- np = &FUN(n);- to_push = &ARG(n);- break;- case T_ARR:- {- struct ioarray *arr = ARR(n);-- // arr->marked records marking progress through arr.- if (arr->marked >= arr->size) {- goto fin;- }- // We unmark the array as a whole and push it as long- // as there's more entries to scan.- mark_unused(n);- num_marked--;- to_push = np;- np = &arr->array[arr->marked++];- break;- }-- case T_FORPTR:- FORPTR(n)->finalizer->marked = 1;- goto fin;-- case T_THID:- mark_thread(THR(n));- goto fin;-- case T_MVAR:- mark_mvar(MVAR(n));- goto fin;-- case T_WEAK:- WEAK(n)->marked = 1;- goto fin;-- default:- goto fin;- }-- if (!is_marked_used(*to_push)) {- // mark_depth++;- PUSH((NODEPTR)to_push);- }- goto top;- fin:- // if (mark_depth > max_mark_depth) {- // max_mark_depth = mark_depth;- // }- // mark_depth--;- if (stack_ptr > stk) {- np = (NODEPTR *)POPTOP();- goto top;- }- return;-}--// stackptr_t gc_tot;--/* Perform a garbage collection:- - Mark nodes from the stack- - Mark permanent arrays- - Mark threads that have a root- - Scan and free arrays- - Scan and free foreign pointers and run finalizers- - Scan and free threads- - Scan and free mvars-*/-void-gc(void)-{- stackptr_t i;- //printf("****** GC ********\n");-- // gc_tot += stack_ptr+1;-- num_gc++;- num_marked = 0;-#if WANT_STDIO- if (verbose > 1)- PRINT("gc mark\n");-#endif- gc_mark_time -= GETTIMEMILLI();- mark_all_free();- /* Mark everything reachable from the stack */- for (i = 0; i <= stack_ptr; i++)- mark(&stack[i]);-- /* Mark everything reachable from permanent array nodes */- for (struct ioarray *arr = array_root; arr; arr = arr->next) {- if (arr->permanent) {- for (i = 0; i < arr->size; i++)- mark(&arr->array[i]);- }- }-- /* Mark all FFI exports */- if (xffe_table) {- for(struct ffe_entry *f = xffe_table; f->ffe_name; f++) {- mark((NODEPTR*)&f->ffe_value);- }- }-- /* Mark used stable pointers */- for (size_t i = 0; i < sp_capacity; i++) {- if (sp_table[i] != NIL)- mark(&sp_table[i]);- }-- /* Mark everything reachable from the threads.- * Note, zombie threads have no root so they are not marked.- */- for (struct mthread *mt = all_threads; mt; mt = mt->mt_next) {- if (mt->mt_root != NIL)- mark_thread(mt);- }-- /* check for unmarked weak pointers */- sweep_weaks();-- gc_mark_time += GETTIMEMILLI();-- if (num_marked > max_num_marked)- max_num_marked = num_marked;- num_free = heap_size - heap_start - num_marked;- if (num_free < heap_size / 50)- ERR("heap exhausted");-- gc_scan_time -= GETTIMEMILLI();- /* Free unused arrays */- for (struct ioarray **arrp = &array_root; *arrp; ) {- struct ioarray *arr = *arrp;- if (arr->marked || arr->permanent) {- arr->marked = 0;- arrp = &arr->next;- } else {- *arrp = arr->next; /* unlink */- num_arr_free++;- FREE(arr); /* and FREE */- }- }-- /* Run finalizers on unused foreign pointers. */- for (struct final **finp = &final_root; *finp; ) {- struct final *fin = *finp;- if (fin->marked) {- fin->marked = 0;- finp = &fin->next;- } else {- /* Unused, run finalizer and free all associated memory */- if (fin->size == NOSIZE) {- num_fin_free++;- } else {- num_bs_free++;- num_bs_inuse -= fin->size;- if (num_bs_alloc - num_bs_free > num_bs_alloc_max)- num_bs_alloc_max = num_bs_alloc - num_bs_free;- }- void (*f)(void *) = (void (*)(void *))fin->final;- //printf("forptr free fin=%p, f=%p", fin, f);- //fflush(stdout);- if (f) {- //printf("finalizer fin=%p final=%p\n", fin, f);- (*f)(fin->arg);- }- for (struct forptr *p = fin->back; p; ) {- struct forptr *q = p->next;- //printf("free fp=%p\n", p);- //printf(" p=%p desc=%s", p, p->desc ? p->desc : "NONE");- //fflush(stdout);- FREE(p);- //memset(p, 0x55, sizeof *p);- p = q;- }- //printf("\n");- *finp = fin->next;- //printf("free fin=%p\n", fin);- FREE(fin);- //memset(fin, 0x77, sizeof *fin);- }- }-- /* Remove unreferenced zombie threads */- for (struct mthread **mtp = &all_threads; *mtp; ) {- struct mthread *mt = *mtp;- if ((mt->mt_state == ts_died || mt->mt_state == ts_finished) && !mt->mt_mark) {- COUNT(num_thread_reap);- *mtp = mt->mt_next;- free(mt);- } else {- mt->mt_mark = false;- mtp = &mt->mt_next;- }- }-- /* Remove unreferences mvars */- for (struct mvar **mvp = &all_mvars; *mvp; ) {- struct mvar *mv = *mvp;- if (!mv->mv_mark) {- COUNT(num_mvar_free);- *mvp = mv->mv_next;- free(mv);- } else {- mv->mv_mark = false;- mvp = &mv->mv_next;- }- }-- gc_scan_time += GETTIMEMILLI();--#if WANT_STDIO- if (verbose > 1) {- PRINT("gc done, %"PRIcounter" free\n", num_free);- /*PRINT(" GC reductions A=%"PRIcounter", K=%"PRIcounter", I=%"PRIcounter", int=%"PRIcounter" flip=%"PRIcounter"\n",- red_a, red_k, red_i, red_int, red_flip);*/- }- if (gcbell) {- fputc('\007', stderr); /* ring the bell */- fflush(stderr);- }-#endif /* !WANT_STDIO */--#if 0- /* For debugging only: mark all free cells */- for(int n = 0; n < heap_size; n++) {- NODEPTR p = HEAPREF(n);- if (!is_marked_used(p)) {- SETTAG(p, T_FREE);- }- }-#endif-#if 0- {- BFILE *err = add_fd(2);- putsb("GC ", err); putdecb(num_free, err); putsb(" free\r\n", err);- closeb(err);- }-#endif-}--static INLINE-value_t-peekWord(value_t *p)-{- return *p;-}--static INLINE-void-pokeWord(value_t *p, value_t w)-{- *p = w;-}--static INLINE-void *-peekPtr(void **p)-{- return *p;-}--static INLINE-void-pokePtr(void **p, void *w)-{- *p = w;-}--static INLINE-uvalue_t-peek_uint8(uint8_t *p)-{- return *p;-}--static INLINE-void-poke_uint8(uint8_t *p, value_t w)-{- *p = (uint8_t)w;-}--static INLINE-uvalue_t-peek_uint16(uint16_t *p)-{- return *p;-}--static INLINE-void-poke_uint16(uint16_t *p, value_t w)-{- *p = (uint16_t)w;-}--static INLINE-uvalue_t-peek_uint32(uint32_t *p)-{- return *p;-}--static INLINE-void-poke_uint32(uint32_t *p, value_t w)-{- *p = (uint32_t)w;-}--#if WANT_INT64-static INLINE-uint64_t-peek_uint64(uint64_t *p)-{- return *p;-}--static INLINE-void-poke_uint64(uint64_t *p, uint64_t w)-{- *p = w;-}-#endif /* WANT_INT64 */--static INLINE-value_t-peek_int8(int8_t *p)-{- return *p;-}--static INLINE-void-poke_int8(int8_t *p, value_t w)-{- *p = (int8_t)w;-}--static INLINE-value_t-peek_int16(int16_t *p)-{- return *p;-}--static INLINE-void-poke_int16(int16_t *p, value_t w)-{- *p = (int16_t)w;-}--static INLINE-value_t-peek_int32(int32_t *p)-{- return *p;-}--static INLINE-void-poke_int32(int32_t *p, value_t w)-{- *p = (int32_t)w;-}--#if WANT_INT64-static INLINE-int64_t-peek_int64(int64_t *p)-{- return *p;-}--static INLINE-void-poke_int64(int64_t *p, int64_t w)-{- *p = w;-}-#endif /* WANT_INT64 */--static INLINE-value_t-peek_int(int *p)-{- return *p;-}--static INLINE-void-poke_int(int *p, value_t w)-{- *p = (int)w;-}--static INLINE-value_t-peek_uint(unsigned int *p)-{- return *p;-}--static INLINE-void-poke_uint(unsigned int *p, value_t w)-{- *p = (unsigned int)w;-}--static INLINE-value_t-peek_char(char *p)-{- return *p;-}--static INLINE-void-poke_char(char *p, value_t w)-{- *p = (char)w;-}--static INLINE-value_t-peek_schar(signed char *p)-{- return *p;-}--static INLINE-void-poke_schar(signed char *p, value_t w)-{- *p = (signed char)w;-}--static INLINE-value_t-peek_uchar(unsigned char *p)-{- return *p;-}--static INLINE-void-poke_uchar(unsigned char *p, value_t w)-{- *p = (unsigned char)w;-}--static INLINE-value_t-peek_short(short *p)-{- return *p;-}--static INLINE-void-poke_short(short *p, value_t w)-{- *p = (short)w;-}--static INLINE-value_t-peek_ushort(unsigned short *p)-{- return *p;-}--static INLINE-void-poke_ushort(unsigned short *p, value_t w)-{- *p = (unsigned short)w;-}--static INLINE-value_t-peek_long(long *p)-{- return *p;-}--static INLINE-void-poke_long(long *p, value_t w)-{- *p = (long)w;-}--static INLINE-value_t-peek_ulong(unsigned long *p)-{- return *p;-}--static INLINE-void-poke_ulong(unsigned long *p, value_t w)-{- *p = (unsigned long)w;-}--static INLINE-value_t-peek_llong(long long *p)-{- return *p;-}--static INLINE-void-poke_llong(long long *p, value_t w)-{- *p = (long long)w;-}--static INLINE-value_t-peek_ullong(unsigned long long *p)-{- return *p;-}--static INLINE-void-poke_ullong(unsigned long long *p, value_t w)-{- *p = (unsigned long long)w;-}--static INLINE-value_t-peek_size_t(size_t *p)-{- return *p;-}--static INLINE-void-poke_size_t(size_t *p, value_t w)-{- *p = (size_t)w;-}--#if WANT_FLOAT32-static INLINE-flt32_t-peek_flt32(flt32_t *p)-{- return *p;-}--static INLINE-void-poke_flt32(flt32_t *p, flt32_t w)-{- *p = w;-}-#endif /* WANT_FLOAT32 */--#if WANT_FLOAT64-static INLINE-flt64_t-peek_flt64(flt64_t *p)-{- return *p;-}--static INLINE-void-poke_flt64(flt64_t *p, flt64_t w)-{- *p = w;-}-#endif /* WANT_FLOAT64 */--/* Look up an FFI function by name */-value_t-lookupFFIname(const char *name)-{- size_t i;-- for(i = 0; ffi_table[i].ffi_name; i++)- if (strcmp(ffi_table[i].ffi_name, name) == 0)- return (value_t)i;- if (xffi_table) {- for(i = 0; xffi_table[i].ffi_name; i++)- if (strcmp(xffi_table[i].ffi_name, name) == 0)- return (value_t)(i + num_ffi);- }- return -1;-}--NODEPTR-ffiNode(const char *buf)-{- NODEPTR r;- value_t i = lookupFFIname(buf);- char *fun;-- if (i < 0) {- /* lookup failed, generate a node that will dynamically generate an error */- r = alloc_node(T_BADDYN);- fun = mmalloc(strlen(buf) + 1);- strcpy(fun, buf);- CSTR(r) = fun;- } else {- r = alloc_node(T_IO_CCALL);- SETVALUE(r, i);- }- return r;-}--/* If the next input character is c, then consume it, else leave it alone. */-int-gobble(BFILE *f, int c)-{- int d = getb(f);- if (c == d) {- return 1;- } else {- ungetb(d, f);- return 0;- }-}--/* Get a non-terminating character. ' ' and '\n' terminates a token. */-int-getNT(BFILE *f)-{- int c;-- c = getb(f);- if (c == ' ' || c == '\n') {- return 0;- } else {- return c;- }-}--value_t-parse_int(BFILE *f)-{- // Parse using uvalue_t, which wraps on overflow.- uvalue_t i = 0;- uvalue_t neg = 1;- int c = getb(f);- if (c == '-') {- neg = -1;- c = getb(f);- }- for(;;) {- i = i * 10 + (c - '0');- c = getb(f);- if (c < '0' || c > '9') {- ungetb(c, f);- break;- }- }- // Multiply by neg without triggering undefined behavior.- return (value_t)(neg * i);-}--#if WANT_INT64-int64_t-parse_int64(BFILE *f)-{- // Parse using uint64_t, which wraps on overflow.- uint64_t i = 0;- uint64_t neg = 1;- int c = getb(f);- if (c == '-') {- neg = -1;- c = getb(f);- }- for(;;) {- i = i * 10 + (c - '0');- c = getb(f);- if (c < '0' || c > '9') {- ungetb(c, f);- break;- }- }- // Multiply by neg without triggering undefined behavior.- return (int64_t)(neg * i);-}-#endif /* WANT_INT64 */--struct forptr *mkForPtr(struct bytestring bs);-NODEPTR mkFunPtr(HsFunPtr p);--/* Create a forptr that has a free() finalizer. */-struct forptr *-mkForPtrFree(struct bytestring str)-{- struct forptr *fp = mkForPtr(str); /* Create a foreign pointer */- fp->finalizer->final = (HsFunPtr)FREE; /* and set the finalizer to just free it */- return fp;-}--NODEPTR-mkStrNode(struct bytestring str)-{- NODEPTR n = alloc_node(T_FORPTR);- struct forptr *fp = mkForPtrFree(str);- FORPTR(n) = fp;- fp->finalizer->fptype = FP_BSTR;- //printf("mkForPtr n=%p fp=%p %d %s payload.string=%p\n", n, fp, (int)FORPTR(n)->payload.size, (char*)FORPTR(n)->payload.string, FORPTR(n)->payload.string);- return n;-}--/* Table of labelled nodes for sharing during parsing. */-struct shared_entry {- heapoffs_t label;- NODEPTR node; /* NIL indicates unused */-} *shared_table;-heapoffs_t shared_table_size;--/* Look for the label in the table.- * If it's found, return the node.- * If not found, return the first empty entry.-*/-NODEPTR *-find_label(heapoffs_t label)-{- int i;-- for(i = (int)label; ; i++) {- i %= shared_table_size;- if (shared_table[i].node == NIL) {- /* The slot is empty, so claim and return it */- shared_table[i].label = label;- return &shared_table[i].node;- } else if (shared_table[i].label == label) {- /* Found the label, so return it. */- return &shared_table[i].node;- }- /* Not empty and not found, try next. */- }-}--/* The memory allocated here is never freed.- * This could be fixed by using a forptr and a- * finalizer for read UTF-8 strings.- * Fix this if there is a lot of deserialization.- */-struct bytestring-parse_string(BFILE *f)-{- struct bytestring bs;- size_t sz = 20;- uint8_t *buffer = mmalloc(sz);- size_t i;- int c;-- for(i = 0;;) {- c = getb(f);- if (c < 0)- ERR("parse string EOF");- if (c == '"')- break;- if (i >= sz - 1) {- sz *= 2;- buffer = mrealloc(buffer, sz);- }-#if 0- if (c == '\\') {- buffer[i++] = (uint8_t)parse_int(f);- if (!gobble(f, '&'))- ERR("parse string");- } else {- buffer[i++] = c;- }-#else- /* See src/MicroHs/ExpPrint.hs for how strings are encoded. */- switch (c) {- case '\\':- c = getb(f);- if (c == '?')- c = 0x7f;- else if (c == '_')- c = 0xff;- break;- case '^':- c = getb(f);- if (c < 0x40)- c &= 0x1f;- else- c = (c & 0x1f) | 0x80;- break;- case '|':- c = getb(f);- c |= 0x80;- break;- default:- /* Unencoded */- ;- }- buffer[i++] = c;-#endif- }- buffer[i] = 0; /* add a trailing 0 in case we need a C string */- buffer = mrealloc(buffer, i + 1);-- bs.size = i;- bs.string = buffer;- //printf("parse_string %d %s\n", (int)bs.size, (char*)bs.string);- return bs;-}--struct forptr *new_mpz(void);--NODEPTR-parse(BFILE *f)-{- stackptr_t stk = stack_ptr;- NODEPTR r, x, y;- NODEPTR *nodep;- heapoffs_t l;- int c;- size_t j;- char buf[80]; /* store names of primitives. */-- for(;;) {- c = getb(f);- if (c < 0) ERR("parse EOF");- switch (c) {- case ' ':- case '\n':- continue;- }- if (num_free < 3)- ERR("out of heap reading code");- GCCHECK(1);- switch(c) {- case '@':- x = TOP(0);- y = TOP(1);- POP(2);- PUSH(new_ap(y, x));- break;- case '}':- x = TOP(0);- POP(1);- if (stack_ptr != stk)- ERR("parse: stack");- return x;-#if WANT_GMP- case '%':- {- struct bytestring bs = parse_string(f); /* get all the digits, terminated by " */- struct forptr *fp = new_mpz(); /* a new mpz */- mpz_ptr op = fp->payload.string; /* get actual pointer */- mpz_set_str(op, bs.string, 10); /* convert to an mpz */- free(bs.string);- r = alloc_node(T_FORPTR);- FORPTR(r) = fp;- PUSH(r);- break;- }-#endif- case '&':- {- int is32 = gobble(f, '&');- for (j = 0; (buf[j] = getNT(f)); j++)- ;- if (is32) {-#if WANT_FLOAT32- r = mkFlt32(strtof(buf, NULL));-#else- r = alloc_node(T_FLT32);- SETVALUE(r, 0);-#endif- } else {-#if WANT_FLOAT64- r = mkFlt64(strtod(buf, NULL));-#else- r = alloc_node(T_DBL);- SETVALUE(r, 0);-#endif- }- PUSH(r);- break;- }- case '#':- if (gobble(f, '#')) {-#if WANT_INT64- r = mkInt64(parse_int64(f));-#else- ERR("no Int64");-#endif /* WANT_INT64 */- } else {- r = mkInt(parse_int(f));- }- PUSH(r);- break;- case '[':- {- size_t sz;- struct ioarray *arr;- size_t i;- sz = (size_t)parse_int(f);- if (!gobble(f, ']')) ERR("parse arr 1");- arr = arr_alloc(sz, NIL);- for (i = 0; i < sz; i++) {- arr->array[i] = TOP(sz - i - 1);- }- r = alloc_node(T_ARR);- ARR(r) = arr;- POP(sz);- PUSH(r);- break;- }- case '_':- /* Reference to a shared value: _label */- l = parse_int(f); /* The label */- nodep = find_label(l);- if (*nodep == NIL) {- /* Not yet defined, so make it an indirection */- *nodep = alloc_node(T_FREE);- SETINDIR(*nodep, NIL);- }- PUSH(*nodep);- break;- case ':':- /* Define a shared expression: :label e */- l = parse_int(f); /* The label */- if (!gobble(f, ' ')) ERR("parse ' '");- nodep = find_label(l);- x = TOP(0);- if (*nodep == NIL) {- /* not referenced yet, so add a direct reference */- *nodep = x;- } else {- /* Sanity check */- if (GETTAG(*nodep) != T_IND || GETINDIR(*nodep) != NIL) ERR("shared != NIL");- SETINDIR(*nodep, x);- }- break;- case '"':- /* Everything up to the next " is a string.- * Special characters are encoded as \NNN&,- * where NNN is the decimal value of the character */- PUSH(mkStrNode(parse_string(f)));- break;-#if WANT_TICK- case '!':- if (!gobble(f, '"'))- ERR("parse !");- r = alloc_node(T_TICK);- SETVALUE(r, (value_t)add_tick_table(parse_string(f)));- PUSH(r);- break;-#endif- case '^':- /* An FFI name */- for (j = 0; (buf[j] = getNT(f)); j++)- ;- r = ffiNode(buf);- PUSH(r);- break;- case ';':- /* <name is a C function pointer to name */- for (j = 0; (buf[j] = getNT(f)); j++)- ;- if (strcmp(buf, "0") == 0) {- PUSH(mkFunPtr((HsFunPtr)0));- } else if (strcmp(buf, "closeb") == 0) {- PUSH(mkFunPtr((HsFunPtr)closeb));- } else {- ERR1("unknown funptr '%s'", buf);- }- break;- default:- buf[0] = c;- /* A primitive, keep getting char's until end */- for (j = 1; (buf[j] = getNT(f)); j++)- ;- /* Look up the primop and use the preallocated node. */- for (j = 0; j < sizeof primops / sizeof primops[0]; j++) {- if (strcmp(primops[j].name, buf) == 0) {-#if 0- r = primops[j].node;- if (r != HEAPREF(primops[j].tag))- printf("bad %s\n", buf);-#else- r = HEAPREF(primops[j].tag);-#endif- goto found;- }- }- ERR1("no primop %s", buf);- found:- PUSH(r);- break;- }- }-}--void-checkversion(BFILE *f)-{- char *p = VERSION;- int c;-- while ((c = *p++)) {- if (c != getb(f))- ERR("version mismatch");- }- (void)gobble(f, '\r'); /* allow extra CR */-}--/* Parse a file */-NODEPTR-parse_top(BFILE *f, struct ffe_entry *ffe)-{- heapoffs_t numLabels, i;- NODEPTR n;- checkversion(f);- numLabels = parse_int(f);- if (!gobble(f, '\n'))- ERR("size parse");- gobble(f, '\r'); /* allow extra CR */- shared_table_size = 3 * numLabels; /* sparsely populated hashtable */- shared_table = mmalloc(shared_table_size * sizeof(struct shared_entry));- for(i = 0; i < shared_table_size; i++)- shared_table[i].node = NIL;- n = parse(f);- if (ffe) {- for(struct ffe_entry *f = ffe; f->ffe_name; f++) {- heapoffs_t l = atoi(f->ffe_name+1); /* the name must be numerical */- f->ffe_value = *find_label(l);- }- }- FREE(shared_table);- return n;-}--counter_t num_shared;--/* Two bits per node: marked, shared- * 0, 0 -- not visited- * 1, 0 -- visited once- * 1, 1 -- visited more than once- * 0, 1 -- printed- */-struct print_bits {- bits_t *marked_bits;- bits_t *shared_bits;-};-static INLINE void set_bit(bits_t *bits, NODEPTR n)-{- heapoffs_t i = LABEL(n);- bits[i / BITS_PER_WORD] |= (1ULL << (i % BITS_PER_WORD));-}-#if WANT_STDIO-static INLINE void clear_bit(bits_t *bits, NODEPTR n)-{- heapoffs_t i = LABEL(n);- bits[i / BITS_PER_WORD] &= ~(1ULL << (i % BITS_PER_WORD));-}-#endif-static INLINE int test_bit(bits_t *bits, NODEPTR n)-{- heapoffs_t i = LABEL(n);- return (bits[i / BITS_PER_WORD] & (1ULL << (i % BITS_PER_WORD))) != 0;-}--size_t strNodes(size_t len);-NODEPTR mkStringC(char *str);--#if WANT_STDIO-void-convdbl(char *str, char *fmt, flt64_t x)-{- /* Using 16 decimals will lose some precision.- * 17 would keep the precision, but it frequently looks very ugly.- */- (void)snprintf(str, 25, fmt, x);- if (strcmp(str, "nan") != 0 && strcmp(str, "-nan") != 0 &&- strcmp(str, "inf") != 0 && strcmp(str, "-inf") != 0 &&- !strchr(str, '.') && !strchr(str, 'e') && !strchr(str, 'E')) {- /* There is no decimal point and no exponent, so add a decimal point */- strcat(str, ".0");- }-}--void-putdblb(flt64_t x, BFILE *p)-{- char str[30];- convdbl(str, "%.16g", x);- putsb(str, p);-}--void printrec(BFILE *f, struct print_bits *pb, NODEPTR n, bool prefix);--/* Mark all reachable nodes, when a marked node is reached, mark it as shared. */-void-find_sharing(struct print_bits *pb, NODEPTR n)-{- top:- while (GETTAG(n) == T_IND) {- n = GETINDIR(n);- }- if (n < cells || n >= cells + heap_size) abort();- //PRINT("find_sharing %p %llu ", n, LABEL(n));- tag_t tag = GETTAG(n);- if (tag == T_AP || tag == T_ARR || tag == T_FORPTR) {- if (test_bit(pb->shared_bits, n)) {- /* Alread marked as shared */- //PRINT("shared\n");- ;- } else if (test_bit(pb->marked_bits, n)) {- /* Already marked, so now mark as shared */- //PRINT("marked\n");- set_bit(pb->shared_bits, n);- num_shared++;- } else {- /* Mark as visited, and recurse */- //PRINT("unmarked\n");- set_bit(pb->marked_bits, n);- switch(tag) {- case T_AP:- find_sharing(pb, FUN(n));- n = ARG(n);- goto top;- case T_ARR:- for(size_t i = 0; i < ARR(n)->size; i++) {- find_sharing(pb, ARR(n)->array[i]);- }- break;- default:- break;- }- }- } else {- /* Not an sharable node, so do nothing */- //PRINT("not T_AP\n");- ;- }-}--void-print_string(BFILE *f, struct bytestring bs)-{- uint8_t *str = bs.string;- putb('"', f);- for (size_t i = 0; i < bs.size; i++) {- int c = str[i];-#if 0- if (c == '"' || c == '\\' || c < ' ' || c > '~') {- putb('\\', f);- putdecb(c, f);- putb('&', f);- } else {- putb(c, f);- }-#else- if (c < 0 || c > 0xff)- ERR("print_string");- if (c < 0x20) {- putb('^', f); putb(c + 0x20, f);- } else if (c == '"' || c == '^' || c == '|' || c == '\\') {- putb('\\', f); putb(c, f);- } else if (c < 0x7f) {- putb(c, f);- } else if (c == 0x7f) {- putb('\\', f); putb('?', f);- } else if (c < 0xa0) {- putb('^', f); putb(c - 0x80 + 0x40, f);- } else if (c < 0xff) {- putb('|', f); putb(c - 0x80, f);- } else { /* must be< c == 0xff */- putb('\\', f); putb('_', f);- }-#endif- }- putb('"', f);-}--/*- * Recursively print an expression.- * This assumes that the shared nodes has been marked as such.- * The prefix flag is used to get a readable dump.- */-void-printrec(BFILE *f, struct print_bits *pb, NODEPTR n, bool prefix)-{- int share = 0;- enum node_tag tag;- char prbuf[30];-- while (GETTAG(n) == T_IND) {- /*putb('*', f);*/- n = GETINDIR(n);- }-- if (test_bit(pb->shared_bits, n)) {- /* The node is shared */- if (test_bit(pb->marked_bits, n)) {- /* Not yet printed, so emit a label */- if (prefix) {- putb(':', f);- putdecb((value_t)LABEL(n), f);- putb(' ', f);- } else {- share = 1;- }- clear_bit(pb->marked_bits, n); /* mark as printed */- } else {- /* This node has already been printed, so just use a reference. */- putb('_', f);- putdecb((value_t)LABEL(n), f);- if (!prefix)- putb(' ', f);- return;- }- }-- //if (n == atptr) putb('@', f);- tag = GETTAG(n);- switch (tag) {- case T_AP:- if (prefix) {- putb('(', f);- printrec(f, pb, FUN(n), prefix);- putb(' ', f);- printrec(f, pb, ARG(n), prefix);- putb(')', f);- } else {- printrec(f, pb, FUN(n), prefix);- printrec(f, pb, ARG(n), prefix);- putb('@', f);- }- break;- case T_INT: putb('#', f); putdecb(GETVALUE(n), f); break;-#if WANT_INT64- case T_INT64: putb('#', f); putb('#', f); putdecb64(GETINT64VALUE(n), f); break;-#endif /* WANT_INT64 */-#if WANT_FLOAT64-case T_DBL: putb('&', f); putdblb(GETDBLVALUE(n), f); break;-#endif-#if WANT_FLOAT32- case T_FLT32: putb('&', f); putb('&', f); putdblb((double)GETFLTVALUE(n), f); break;-#endif- case T_WEAK: ERR("serialize WEAK unimplemented");- case T_ARR:- if (prefix) {- /* Arrays serialize as '[sz] e_1 ... e_sz' */- putb('[', f);- putdecb((value_t)ARR(n)->size, f);- putb(']', f);- for(size_t i = 0; i < ARR(n)->size; i++) {- putb(' ', f);- printrec(f, pb, ARR(n)->array[i], prefix);- }- } else {- /* Arrays serialize as 'e_1 ... e_sz [sz]' */- for(size_t i = 0; i < ARR(n)->size; i++) {- printrec(f, pb, ARR(n)->array[i], prefix);- }- putb('[', f);- putdecb((value_t)ARR(n)->size, f);- putb(']', f);- }- break;- case T_PTR:- if(PTR(n) == NULL) {- if (prefix) {- putsb("(toPtr #0)", f);- } else {- putsb("toPtr #0 @", f);- }- } else-#if WANT_STDIO- /* The pointer can be a forptr comb_std* that has been dereferenced */- if (PTR(n) == FORPTR(comb_stdin)->payload.string) {- SETTAG(spare_node, T_AP);- FUN(spare_node) = combFP2P;- ARG(spare_node) = comb_stdin;- printrec(f, pb, spare_node, prefix);- } else if (PTR(n) == FORPTR(comb_stdout)->payload.string) {- SETTAG(spare_node, T_AP);- FUN(spare_node) = combFP2P;- ARG(spare_node) = comb_stdout;- printrec(f, pb, spare_node, prefix);- } else if (PTR(n) == FORPTR(comb_stderr)->payload.string) {- SETTAG(spare_node, T_AP);- FUN(spare_node) = combFP2P;- ARG(spare_node) = comb_stderr;- printrec(f, pb, spare_node, prefix);- } else-#endif /* WANT_STDIO */- if (prefix) {- snprintf(prbuf, sizeof prbuf, "PTR<%p>",PTR(n));- putsb(prbuf, f);- } else {- ERR("Cannot serialize pointers");- }- break;- case T_FUNPTR:- /* There are a few function pointers that happen without user FFI.- * We need to be able to serialize these.- * XXX Make a table if we need more.- */- if (FUNPTR(n) == 0) {- putsb(";0 ", f);- } else if (FUNPTR(n) == (HsFunPtr)closeb) {- putsb(";closeb ", f);- } else if (prefix) {- snprintf(prbuf, sizeof prbuf, "FUNPTR<%p>", FUNPTR(n));- putsb(prbuf, f);- } else {- ERR("Cannot serialize function pointers");- }- break;- case T_THID:- if (prefix) {- snprintf(prbuf, sizeof prbuf, "FUNPTR<%d>",(int)THR(n)->mt_id);- } else {- ERR("cannot serialize ThreadId yet");- }- break;- case T_FORPTR:-#if WANT_STDIO- if (n == comb_stdin)- putsb("IO.stdin", f);- else if (n == comb_stdout)- putsb("IO.stdout", f);- else if (n == comb_stderr)- putsb("IO.stderr", f);- else-#endif /* WANT_STDIO */-#if WANT_GMP- if (FORPTR(n)->finalizer->fptype == FP_MPZ) {- /* Serialize as %99999" */- mpz_ptr op = FORPTR(n)->payload.string; /* get the mpz */- int sz = mpz_sizeinbase(op, 10); /* maximum length */- char *s = mmalloc(sz + 2);- (void)mpz_get_str(s, 10, op); /* convert to a string */- putsb("%", f);- putsb(s, f);- putsb("\"", f); /* so we can use parse_string */- free(s);- } else-#endif /* WANT_GMP */- if (FORPTR(n)->finalizer->fptype == FP_BSTR) {- print_string(f, FORPTR(n)->payload);- } else if (prefix) {- snprintf(prbuf, sizeof prbuf, "FORPTR<%p>",FORPTR(n));- putsb(prbuf, f);- } else {- ERR("Cannot serialize foreign pointers");- }- break;- case T_IO_CCALL: putb('^', f); putsb(FFI_IX(GETVALUE(n)).ffi_name, f); break;- case T_BADDYN: putb('^', f); putsb(CSTR(n), f); break;-#if WANT_TICK- case T_TICK:- putb('!', f);- print_string(f, tick_table[GETVALUE(n)].tick_name);- break;-#endif- default:- if (0 <= tag && tag <= T_LAST_TAG) {- if (tag_names[tag]) {- putsb(tag_names[tag], f);- } else {- ERR1("TAG %d", tag);- }- } else {- ERR1("TAG %d", tag);- }- break;- }- if (!prefix) {- if (GETTAG(n) != T_AP)- putb(' ', f);- if (share) {- putb(':', f);- putdecb((value_t)LABEL(n), f);- putb(' ', f);- }- }-}--/* Serialize a graph to file. */-void-printb(BFILE *f, NODEPTR n, bool header)-{- struct print_bits pb;- num_shared = 0;- pb.marked_bits = mcalloc(free_map_nwords, sizeof(bits_t));- pb.shared_bits = mcalloc(free_map_nwords, sizeof(bits_t));- find_sharing(&pb, n);- if (header) {- putsb(VERSION, f);- putdecb(num_shared, f);- putb('\n', f);- }- printrec(f, &pb, n, !header);- if (header) {- putb('}', f);- }- FREE(pb.marked_bits);- FREE(pb.shared_bits);-}--/* Show a graph. */-void-pps(NODEPTR n)-{- pp(stdout, n);-}--void-pp(FILE *f, NODEPTR n)-{- BFILE *bf = add_FILE(f);- printb(bf, n, false);- putb('\n', bf);- freeb_file(bf);-}--#if 0-NODEPTR *topnode;--void-ppmsg(const char *msg, NODEPTR n)-{- printf("%s", msg);- pp(stdout, n);- printf("\n");-}--void-dump(const char *msg, NODEPTR at)-{- atptr = at;- printf("dump: %s\n", msg);- pp(stdout, *topnode);-}-#endif--#endif /* WANT_STDIO */--NODEPTR-mkInt(value_t i)-{-#if INTTABLE- if (LOW_INT <= i && i < HIGH_INT) {- return intTable[i - LOW_INT];- }-#endif-- NODEPTR n;- n = alloc_node(T_INT);- SETVALUE(n, i);- return n;-}--#if WANT_INT64-NODEPTR-mkInt64(int64_t i)-{- NODEPTR n;- n = alloc_node(T_INT64);- SETINT64VALUE(n, i);- return n;-}-#endif /* WANT_INT64 */--#if WANT_FLOAT32-NODEPTR-mkFlt32(flt32_t d)-{- NODEPTR n;- n = alloc_node(T_FLT32);- SETFLTVALUE(n, d);- return n;-}-#endif /* WANT_FLOAT32 */--#if WANT_FLOAT64-NODEPTR-mkFlt64(flt64_t d)-{- NODEPTR n;- n = alloc_node(T_DBL);- SETDBLVALUE(n, d);- return n;-}-#endif /* WANT_FLOAT64 */--NODEPTR-mkPtr(void* p)-{- NODEPTR n;- n = alloc_node(T_PTR);- PTR(n) = p;- return n;-}--NODEPTR-mkFunPtr(void (*p)(void))-{- NODEPTR n;- n = alloc_node(T_FUNPTR);- FUNPTR(n) = p;- return n;-}--struct forptr*-mkForPtr(struct bytestring bs)-{- struct final *fin = mcalloc(1, sizeof(struct final));- struct forptr *fp = mcalloc(1, sizeof(struct forptr));- if (bs.size == NOSIZE) {- num_fin_alloc++;- } else {- num_bs_alloc++;- num_bs_inuse += bs.size;- num_bs_bytes += bs.size;- if (num_bs_inuse > num_bs_inuse_max)- num_bs_inuse_max = num_bs_inuse;- }- //printf("mkForPtr p=%p fin=%p fp=%p\n", p, fin, fp);- fin->next = final_root;- final_root = fin;- fin->final = 0;- fin->arg = bs.string;- fin->size = bs.size; /* The size is not really needed */- fin->back = fp;- fin->marked = 0;- fp->next = 0;- fp->payload = bs;- fp->finalizer = fin;- // fp->desc = 0;- return fp;-}--struct forptr*-mkForPtrP(void *p)-{- struct bytestring bs;- bs.size = NOSIZE;- bs.string = p;- return mkForPtr(bs);-}--struct forptr*-addForPtr(struct forptr *ofp, int s)-{- struct forptr *fp = mmalloc(sizeof(struct forptr));- struct final *fin = ofp->finalizer;-- fp->next = ofp;- fin->back = fp;- if (ofp->payload.size != NOSIZE)- fp->payload.size = ofp->payload.size - s;- fp->payload.string = (uint8_t*)ofp->payload.string + s;- fp->finalizer = fin;- return fp;-}--struct forptr*-bssubstr(struct forptr *fp, value_t offs, value_t len)-{- struct forptr *res = addForPtr(fp, offs);- res->payload.size = len;- return res;-}--static INLINE NODEPTR-mkNil(void)-{- return combFalse;-}--static INLINE NODEPTR-mkCons(NODEPTR x, NODEPTR xs)-{- return new_ap(new_ap(combCons, x), xs);-}--size_t-strNodes(size_t len)-{- /* Each character will need a CHAR node and a CONS node, a CONS uses 2 T_AP nodes */- len *= (1 + 2);- /* And each string will need a NIL */- len += 1;- return len;-}--/* Turn a C string into a combinator string.- * Does NOT do UTF decoding.- */-NODEPTR-mkString(struct bytestring bs)-{- NODEPTR n, nc;- size_t i;- const unsigned char *str = bs.string; /* no sign bits, please */-- n = mkNil();- for(i = bs.size; i > 0; i--) {- nc = mkInt(str[i-1]);- n = mkCons(nc, n);- }- return n;-}--NODEPTR-mkStringC(char *str)-{- struct bytestring bs;- bs.size = strlen(str);- bs.string = str;- return mkString(bs);-}--NODEPTR-mkStringU(struct bytestring bs)-{- BFILE *ubuf = add_utf8(openb_rd_mem(bs.string, bs.size));- NODEPTR n, *np, nc;-- //printf("mkStringU %d %s\n", (int)bs.size, (char*)bs.string);-- n = mkNil();- np = &n;- for(;;) {- int c = getb(ubuf);- if (c < 0)- break;- nc = mkInt(c);- *np = mkCons(nc, *np);- np = &ARG(*np);- }- closeb(ubuf);- return n;-}--NODEPTR-bsunpack(struct bytestring bs)-{- NODEPTR n, *np, nc;- size_t i;-- n = mkNil();- np = &n;- for(i = 0; i < bs.size; i++) {- nc = mkInt(((uint8_t *)bs.string)[i]);- *np = mkCons(nc, *np);- np = &ARG(*np);- }- return n;-}--/* XXX This should somehow be merged with other utf8 decoders */-/* Decode first character of a string and optionally return the rest of the string. */-/* Handles regular and modified UTF-8. */-value_t-headutf8(struct bytestring bs, void **ret)-{- uint8_t *p = bs.string;- if (bs.size == 0)- ERR("headUTF8 0");- int c1 = *p++;- if ((c1 & 0x80) == 0) {- if (ret)- *ret = p;- return c1;- }- if (bs.size == 1)- ERR("headUTF8 1");- int c2 = *p++;- if ((c1 & 0xe0) == 0xc0) {- if (ret)- *ret = p;- return ((c1 & 0x1f) << 6) | (c2 & 0x3f);- }- if (bs.size == 2)- ERR("headUTF8 2");- int c3 = *p++;- if ((c1 & 0xf0) == 0xe0) {- if (ret)- *ret = p;- return ((c1 & 0x0f) << 12) | ((c2 & 0x3f) << 6) | (c3 & 0x3f);- }- if (bs.size == 3)- ERR("headUTF8 3");- int c4 = *p++;- if ((c1 & 0xf8) == 0xf0) {- if (ret)- *ret = p;- return ((c1 & 0x07) << 18) | ((c2 & 0x3f) << 12) | ((c3 & 0x3f) << 6) | (c4 & 0x3f);- }- ERR("headUTF8 4");- NOTREACHED;-}--/* Evaluate to an INT */-static INLINE value_t-evalint(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_INT) {- ERR1("evalint, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return GETVALUE(n);-}--#if WANT_INT64-/* Evaluate to an INT */-static INLINE uint64_t-evalint64(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_INT64) {- ERR1("evalint64, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return GETINT64VALUE(n);-}-#endif /* WANT_INT64 */--#if WANT_FLOAT64-/* Evaluate to a flt64_t */-static INLINE flt64_t-evaldbl(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_DBL) {- ERR1("evaldbl, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return GETDBLVALUE(n);-}-#endif /* WANT_FLOAT64 */--#if WANT_FLOAT32-/* Evaluate to a flt32_t */-static INLINE flt32_t-evalflt(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_FLT32) {- ERR1("evaldbl, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return GETFLTVALUE(n);-}-#endif /* WANT_FLOAT32 */--/* Evaluate to a T_PTR */-void *-evalptr(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_PTR) {- ERR1("evalptr, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return PTR(n);-}--/* Evaluate to a T_FUNPTR */-HsFunPtr-evalfunptr(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_FUNPTR) {- ERR1("evalfunptr, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return FUNPTR(n);-}--/* Evaluate to a T_FORPTR */-struct forptr *-evalforptr(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_FORPTR) {- ERR1("evalforptr, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return FORPTR(n);-}--/* Evaluate to a bytestring */-struct forptr *-evalbstr(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_FORPTR || FORPTR(n)->finalizer->fptype != FP_BSTR) {- ERR1("evalbstr, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return FORPTR(n);-}--/* Evaluate to a T_THID */-struct mthread *-evalthid(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_THID) {- ERR1("evalthid, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return THR(n);-}--/* Evaluate to a T_MVAR */-struct mvar *-evalmvar(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_MVAR) {- ERR1("evalmvar, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return MVAR(n);-}--/* Evaluate to a T_WEAK */-void *-evalweak(NODEPTR n)-{- n = evali(n);-#if SANITY- if (GETTAG(n) != T_WEAK) {- ERR1("evalweak, bad tag %s", TAGNAME(GETTAG(n)));- }-#endif- return WEAK(n);-}--/* Evaluate a string, returns a newly allocated buffer.- * XXX this is cheating, should use continuations.- * XXX the malloc()ed string is leaked if we yield in here.- * Caller is responsible to free().- * Does modified UTF-8 encoding.- */-struct bytestring-evalstring(NODEPTR n)-{- size_t sz = 100;- char *buf = mmalloc(sz);- size_t offs;- uvalue_t c;- NODEPTR x;- struct bytestring bs;-- for (offs = 0;;) {- if (offs >= sz - 4) {- sz *= 2;- buf = mrealloc(buf, sz);- }- PUSH(n); /* protect the list from GC */- n = evali(n);- POP(1);- if (GETTAG(n) == T_K) /* Nil */- break;- else if (GETTAG(n) == T_AP && GETTAG(x = indir(&FUN(n))) == T_AP && GETTAG(indir(&FUN(x))) == T_O) { /* Cons */- PUSH(n); /* protect from GC */- c = evalint(ARG(x));- n = POPTOP();- if ((c & 0x1ff800) == 0xd800) {- // c is a surrogate- c = 0xfffd; // replacement character- }- if (0 < c && c < 0x80) { /* exclude 0, since this is modified UTF-8 */- buf[offs++] = (char)c;- } else if (c < 0x800) {- /* 0 encodes here, with an over-long representation */- buf[offs++] = ((c >> 6 ) ) | 0xc0;- buf[offs++] = ((c ) & 0x3f) | 0x80;- } else if (c < 0x10000) {- buf[offs++] = ((c >> 12) ) | 0xe0;- buf[offs++] = ((c >> 6 ) & 0x3f) | 0x80;- buf[offs++] = ((c ) & 0x3f) | 0x80;- } else if (c < 0x110000) {- buf[offs++] = ((c >> 18) ) | 0xf0;- buf[offs++] = ((c >> 12) & 0x3f) | 0x80;- buf[offs++] = ((c >> 6 ) & 0x3f) | 0x80;- buf[offs++] = ((c ) & 0x3f) | 0x80;- } else {- ERR("invalid char");- }- n = ARG(n);- } else {- ERR("evalstring not Nil/Cons");- }- }- buf[offs] = 0; /* in case we use it as a C string */- bs.size = offs;- bs.string = buf;- return bs;-}--/* Does not do UTF-8 encoding */-struct bytestring-evalbytestring(NODEPTR n)-{- size_t sz = 100;- uint8_t *buf = mmalloc(sz);- size_t offs;- uvalue_t c;- NODEPTR x;- struct bytestring bs;-- for (offs = 0;;) {- if (offs >= sz - 1) {- sz *= 2;- buf = mrealloc(buf, sz);- }- PUSH(n); /* protect list from GC */- n = evali(n);- POP(1);- if (GETTAG(n) == T_K) /* Nil */- break;- else if (GETTAG(n) == T_AP && GETTAG(x = indir(&FUN(n))) == T_AP && GETTAG(indir(&FUN(x))) == T_O) { /* Cons */- PUSH(n); /* protect from GC */- c = evalint(ARG(x));- n = POPTOP();- buf[offs++] = c;- n = ARG(n);- } else {- //pp(stdout, n);- ERR("evalbytestring not Nil/Cons");- }- }- buf[offs] = 0; /* in case we use it as a C string */- bs.size = offs;- bs.string = buf;- return bs;-}--struct bytestring-bsreplicate(size_t size, uint8_t value)-{- struct bytestring bs;- bs.size = size;- bs.string = mmalloc(size);- memset(bs.string, value, size);- return bs;-}--struct bytestring-bsappend(struct bytestring p, struct bytestring q)-{- struct bytestring r;- r.size = p.size + q.size;- r.string = mmalloc(r.size);- memcpy(r.string, p.string, p.size);- memcpy((uint8_t *)r.string + p.size, q.string, q.size);- return r;-}--struct bytestring-bsappenddot(struct bytestring p, struct bytestring q)-{- struct bytestring r;- r.size = p.size + q.size + 1;- r.string = mmalloc(r.size);- memcpy(r.string, p.string, p.size);- memcpy((uint8_t *)r.string + p.size, ".", 1);- memcpy((uint8_t *)r.string + p.size + 1, q.string, q.size);- return r;-}--/*- * Compare bytestrings.- */-int-bscompare(struct bytestring bsp, struct bytestring bsq)-{- size_t len = bsp.size < bsq.size ? bsp.size : bsq.size;- if (len) {- int r = memcmp(bsp.string, bsq.string, len);- if (r < 0)- return -1;- if (r > 0)- return 1;- }- /* Got to the end of the shorter string. */- /* The shorter string is considered smaller. */- if (bsp.size < bsq.size)- return -1;- if (bsp.size > bsq.size)- return 1;- return 0;-}--void-rnf_rec(bits_t *done, NODEPTR n)-{- top:- if (test_bit(done, n))- return;- set_bit(done, n);- n = evali(n);- if (GETTAG(n) == T_AP) {- PUSH(ARG(n)); /* protect from GC */- rnf_rec(done, FUN(n));- n = POPTOP();- goto top;- }-}--void-rnf(value_t noerr, NODEPTR n)-{- /* Mark visited nodes to avoid getting stuck in loops. */- bits_t *done = mcalloc(free_map_nwords, sizeof(bits_t));- if (doing_rnf)- ERR("recursive rnf()");- doing_rnf = (bool)noerr;- rnf_rec(done, n);- doing_rnf = false;- FREE(done);-}--/* Evaluate a node, returns when the node is in WHNF. */-NODEPTR-evali(NODEPTR an)-{- NODEPTR n = an;- stackptr_t stk = stack_ptr;- NODEPTR x, y, z, w;- value_t xi, yi, r;- struct forptr *xfp;- char *msg;-#if 0- heapoffs_t l;-#endif- enum node_tag tag;- struct ioarray *arr;- struct bytestring xbs, ybs, rbs;-#if WANT_STDIO- void *bfile;- int hdr;-#endif /* WANT_STDIO */--#if MAXSTACKDEPTH- counter_t old_cur_c_stack = cur_c_stack;- if (++cur_c_stack > max_c_stack)- max_c_stack = cur_c_stack;-#endif--/* Reset stack pointer and return. */-#define RET do { goto ret; } while(0)-#define HASNARGS(n) (stack_ptr - stk >= (n))-/* Check that there are at least n arguments, return if not. */-#define CHECK(n) do { if (!HASNARGS(n)) RET; } while(0)--#define SETIND(n, x) SETINDIR(n, x)-#define GOIND(x) do { NODEPTR _x = (x); SETIND(n, _x); n = _x; goto top; } while(0)-#define GOAP(f,a) do { FUN(n) = (f); ARG(n) = (a); goto ap; } while(0)-#define GOAP2(f,a,b) do { FUN(n) = new_ap((f), (a)); ARG(n) = (b); goto ap2; } while(0)-#define GOPAIR(a) do { FUN(n) = new_ap(combPair, (a)); goto ap; } while(0)-#define GOPAIRUNIT do { FUN(n) = combPairUnit; goto ap; } while(0)-#define GOBOOL(b) do { if (b) goto lbltrue; else goto lblfalse; } while(0)-/* CHKARGN checks that there are at least N arguments.- * It also- * - sets n to the "top" node- * - set x, y, ... to the arguments- * - pops N stack elements- * NOTE: No GC is allowed after these, since the stack has been popped.- */-#define CHKARG0 do { } while(0)-#define CHKARG1 do { CHECK(1); POP(1); n = TOP(-1); x = ARG(n); } while(0)-#define CHKARG2 do { CHECK(2); POP(2); n = TOP(-1); y = ARG(n); x = ARG(TOP(-2)); } while(0)-#define CHKARG3 do { CHECK(3); POP(3); n = TOP(-1); z = ARG(n); y = ARG(TOP(-2)); x = ARG(TOP(-3)); } while(0)-#define CHKARG4 do { CHECK(4); POP(4); n = TOP(-1); w = ARG(n); z = ARG(TOP(-2)); y = ARG(TOP(-3)); x = ARG(TOP(-4)); } while(0)-#define CHKARG5 do { CHECK(5); POP(5); n = TOP(-1); /*v = ARG(n);*/ w = ARG(TOP(-2)); z = ARG(TOP(-3)); y = ARG(TOP(-4)); x = ARG(TOP(-5)); } while(0)-/* Non-popping versions */-#define CHKARG1NP do { CHECK(1); n = TOP(0); x = ARG(n); } while(0)-#define CHKARG2NP do { CHECK(2); n = TOP(1); y = ARG(n); x = ARG(TOP(0)); } while(0)-#define CHKARG3NP do { CHECK(3); n = TOP(2); z = ARG(n); y = ARG(TOP(1)); x = ARG(TOP(0)); } while(0)-#define CHKARG4NP do { CHECK(4); n = TOP(3); w = ARG(n); z = ARG(TOP(2)); y = ARG(TOP(1)); x = ARG(TOP(0)); } while(0)--/* Alloc a possible GC action, e, between setting x and popping */-#define CHKARGEV1(e) do { CHECK(1); x = ARG(TOP(0)); e; POP(1); n = TOP(-1); } while(0)--#define SETINT(n,r) do { SETTAG((n), T_INT); SETVALUE((n), (r)); } while(0)-#define SETINT64(n,r) do { SETTAG((n), T_INT64); SETINT64VALUE((n), (r)); } while(0)-#define SETDBL(n,d) do { SETTAG((n), T_DBL); SETDBLVALUE((n), (d)); } while(0)-#define SETFLT(n,d) do { SETTAG((n), T_FLT32); SETFLTVALUE((n), (d)); } while(0)-#define SETPTR(n,r) do { SETTAG((n), T_PTR); PTR(n) = (r); } while(0)-#define SETFUNPTR(n,r) do { SETTAG((n), T_FUNPTR); FUNPTR(n) = (r); } while(0)-#define SETFORPTR(n,r) do { SETTAG((n), T_FORPTR); FORPTR(n) = (r); } while(0)-#define SETBSTR(n,r) do { SETTAG((n), T_FORPTR); FORPTR(n) = (r); FORPTR(n)->finalizer->fptype = FP_BSTR; } while(0)-#define OPINT1(e) do { CHECK(1); xi = evalint(ARG(TOP(0))); e; POP(1); n = TOP(-1); } while(0);-#define OPPTR2(e) do { CHECK(2); xp = evalptr(ARG(TOP(0))); yp = evalptr(ARG(TOP(1))); e; POP(2); n = TOP(-1); } while(0);-#define CMPP(op) do { OPPTR2(r = xp op yp); GOIND(r ? combTrue : combFalse); } while(0)-- top:- /*pp(stdout, an);*/- if (--glob_slice <= 0)- yield();-#if 0- /* This increases the cycle count */- l = LABEL(n);- if (l < T_IO_STDIN) {- /* The node is one of the permanent nodes; the address offset is the tag */- tag = l;- } else-#endif- {- tag_t ut;- /* first follow AP nodes down the spine */- for(;;) {- ut = n->ufun.uutag;- if ((ut & BIT_MASK) != BIT_AP)- break;- PUSH(n);- n = (NODEPTR)ut;- }- /* Skip idirections */- if ((ut & BIT_MASK) == BIT_IN) {- /* Follow and short-circuit the chain. */- NODEPTR on = n;- do {- n = GETINDIR(n);- } while(ISINDIR(n));- SETINDIR(on, n); /* and short-circuit them */- tag = GETTAG(n);- } else {- /* The tag is the rest of the bits we fetched */- tag = ut >> TAG_SHIFT;- }- }- /* Invariant: at this point n=current node, tag=GETTAG(n) */-- // printf("%s %d\n", tag_names[tag], (int)stack_ptr);- //if (stack_ptr < -1)- // ERR("stack_ptr");- switch (tag) {- ap2: PUSH(n); n = FUN(n);- ap:- case T_AP: PUSH(n);- n = FUN(n); goto top;-- case T_INT: RET;- case T_DBL: RET;- case T_INT64: RET;- case T_FLT32: RET;- case T_PTR: RET;- case T_FUNPTR: RET;- case T_FORPTR: RET;- case T_ARR: RET;- case T_THID: RET;- case T_MVAR: RET;- case T_WEAK: RET;- case T_BADDYN: ERR1("FFI unknown %s", CSTR(n));-- /*- * Some of these reductions, (e.g., Z x y = K (x y)) are there to avoid- * that increase in arity that some "optimizations" in Abstract.hs- * stop reductions from happening. This can be important for "full laziness".- * In practice, these reductions almost never happen, but there they are anyway. :)- */- case T_S: GCCHECK(2); CHKARG3; GOAP2(x, z, new_ap(y, z)); /* S x y z = x z (y z) */- case T_SS: GCCHECK(3); CHKARG4; GOAP2(x, new_ap(y, w), new_ap(z, w)); /* S' x y z w = x (y w) (z w) */- lblfalse:- n = combFalse;- case T_K: CHKARG2; GOIND(x); /* K x y = *x */- lbltrue:- n = combTrue;- case T_A: CHKARG2; GOIND(y); /* A x y = *y */- case T_U: CHKARG2; GOAP(y, x); /* U x y = y x */- case T_I: CHKARG1; GOIND(x); /* I x = *x */- case T_Y: CHKARG1; GOAP(x, n); /* n@(Y x) = x n */- case T_B: GCCHECK(1); CHKARG3; GOAP(x, new_ap(y, z)); /* B x y z = x (y z) */- case T_BB: if (!HASNARGS(4)) {- GCCHECK(1); CHKARG2; COUNT(red_bb); GOAP(combB, new_ap(x, y)); } else { /* B' x y = B (x y) */- GCCHECK(2); CHKARG4; GOAP2(x, y, new_ap(z, w)); } /* B' x y z w = x y (z w) */- case T_Z: if (!HASNARGS(3)) {- GCCHECK(1); CHKARG2; COUNT(red_z); GOAP(combK, new_ap(x, y)); } else { /* Z x y = K (x y) */- CHKARG3; GOAP(x, y); } /* Z x y z = x y */- case T_J: CHKARG3; GOAP(z, x); /* J x y z = z x */- case T_L: CHKARG3; GOAP(y, x); /* L x y z = y x */- case T_KK: CHKARG3; GOIND(y); /* KK x y z = y */- case T_KA: CHKARG3; GOIND(z); /* KA x y z = z */- t_c:- case T_C: GCCHECK(1); CHKARG3; GOAP2(x, z, y); /* C x y z = x z y */- case T_CC: GCCHECK(2); CHKARG4; GOAP2(x, new_ap(y, w), z); /* C' x y z w = x (y w) z */- t_p:- case T_P: GCCHECK(1); CHKARG3; GOAP2(z, x, y); /* P x y z = z x y */- case T_R: if(!HASNARGS(3)) {- GCCHECK(1); CHKARG2; COUNT(red_r); GOAP2(combC, y, x); } else { /* R x y = C y x */- GCCHECK(1); CHKARG3; GOAP2(y, z, x); } /* R x y z = y z x */- case T_O: GCCHECK(1); CHKARG4; GOAP2(w, x, y); /* O x y z w = w x y */- case T_K2: if (!HASNARGS(3)) {- CHKARG2; COUNT(red_k2); GOAP(combK, x); } else { /* K2 x y = K x */- CHKARG3; GOIND(x); } /* K2 x y z = *x */- case T_K3: if (!HASNARGS(4)) {- CHKARG2; COUNT(red_k3); GOAP(combK2, x); } else { /* K3 x y = K2 x */- CHKARG4; GOIND(x); } /* K3 x y z w = *x */- case T_K4: if (!HASNARGS(5)) {- CHKARG2; COUNT(red_k4); GOAP(combK3, x); } else { /* K4 x y = K3 x */- CHKARG5; GOIND(x); } /* K4 x y z w v = *x */- case T_CCB: if (!HASNARGS(4)) {- GCCHECK(2); CHKARG3; COUNT(red_ccb); GOAP2(combB, new_ap(x, z), y);} else{ /* C'B x y z = B (x z) y */- GCCHECK(2); CHKARG4; GOAP2(x, z, new_ap(y, w)); } /* C'B x y z w = x z (y w) */-- case T_TAG0:- case T_TAG1:- case T_TAG2:- case T_TAG3:- case T_TAG4:- case T_TAG5:- case T_TAG6:- case T_TAG7:- case T_TAG8:- case T_TAG9:- case T_TAG10:- case T_TAG11:- case T_TAG12:- case T_TAG13:- case T_TAG14:- case T_TAG15:- case T_TAG16:- case T_TAG17:- case T_TAG18:- case T_TAG19:- case T_TAG20:- case T_TAG21:- case T_TAG22:- case T_TAG23:- case T_TAG24:- case T_TAG25:- case T_TAG26:- case T_TAG27:- case T_TAG28:- case T_TAG29:- case T_TAG30:- case T_TAG31:- case T_TAG32:- GCCHECK(2); CHKARG2; GOAP2(y, mkInt(tag - T_TAG0), x); /* TAGN x y = y (INT N) x */-- case T_T3: GCCHECK(2); CHECK(4); POP(4); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(x, ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2))); /* T3 x1 x2 x3 f = x x1 x2 x3 */- case T_T4: GCCHECK(3); CHECK(5); POP(5); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(x, ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2))); /* T4 x1 x2 x3 x4 f = x x1 x2 x3 x4 */- case T_T5: GCCHECK(4); CHECK(6); POP(6); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(x, ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T6: GCCHECK(5); CHECK(7); POP(7); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T7: GCCHECK(6); CHECK(8); POP(8); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T8: GCCHECK(7); CHECK(9); POP(9); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T9: GCCHECK(8); CHECK(10); POP(10); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T10: GCCHECK(9); CHECK(11); POP(11); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T11: GCCHECK(10); CHECK(12); POP(12); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T12: GCCHECK(11); CHECK(13); POP(13); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-13))), ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T13: GCCHECK(12); CHECK(14); POP(14); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-14))), ARG(TOP(-13))), ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T14: GCCHECK(13); CHECK(15); POP(15); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-15))), ARG(TOP(-14))), ARG(TOP(-13))), ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T15: GCCHECK(14); CHECK(16); POP(16); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-16))), ARG(TOP(-15))), ARG(TOP(-14))), ARG(TOP(-13))), ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));- case T_T16: GCCHECK(15); CHECK(17); POP(17); n = TOP(-1); x = ARG(n);- GOAP2(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(new_ap(x, ARG(TOP(-17))), ARG(TOP(-16))), ARG(TOP(-15))), ARG(TOP(-14))), ARG(TOP(-13))), ARG(TOP(-12))), ARG(TOP(-11))), ARG(TOP(-10))), ARG(TOP(-9))), ARG(TOP(-8))), ARG(TOP(-7))), ARG(TOP(-6))), ARG(TOP(-5))), ARG(TOP(-4))), ARG(TOP(-3)), ARG(TOP(-2)));-- /*- * Strict primitives require evaluating the arguments before we can proceed.- * The easiest way to do this is to just recursively call evali() for each argument.- * The drawback of this is that it uses a lot of C stack. (E.g., recompiling MicroHs- * uses a stack depth of 1800).- * Instead we use the following scheme:- * When we find a strict binary (int) primitive we push T_BININT2,- * set n=second argument.- * Continue evaluation of n.- * When n is finally evaluated and we are about to return we check if the stack top is T_BININT2.- * If so, change the stack top to T_BININT1,- * set n=first argument.- * Continue evaluation of n.- * When n is finally evaluated and we are about to return we check if the stack top is T_BININT1.- * If so, we know that both arguments are now evaluated, and we perform the strict operation.- *- * On my desktop machine this is about 3% slower, on my laptop (Apple M1) it is about 3% faster.- *- * Pictorially for BININT- * Before the code below:- * ----- * | --------> @- * ---- / \- * | ------> @ y- * ---- / \- * n ----> ADD x- *- * After- * ----- * | --------> @- * ---- / \- * | ------> @ y- * ---- / \- * | ->BI2 ADD x- * ---- ^- * n ----------|- *- * x becomes an INT, stack is not empty, BININT2 found on top- * ----- * | --------> @- * ---- / \- * | ------> @ y- * ---- / \- * | ->BI2 ADD INT- * ---- ^- * n ----------|- *- * After- * ----- * | --------> @- * ---- / \- * | ------> @ y- * ---- / \ \- * | ->BI1 ADD INT |- * ---- |- * n ---------------|- *- * y becomes an INT, stack is not empty, BININT1 found on top- * do arithmetic- * ----- * | --------> @- * ---- / \- * | ------> @ INT- * ---- / \ \- * | ->BI1 ADD INT |- * ---- |- * n ---------------|- *- * ----- * n -------> INT(x+y)- */- case T_ADD:- case T_SUB:- case T_MUL:- case T_QUOT:- case T_REM:- case T_SUBR:- case T_UADD:- case T_USUB:- case T_UMUL:- case T_UQUOT:- case T_UREM:- case T_USUBR:- case T_AND:- case T_OR:- case T_XOR:- case T_SHL:- case T_SHR:- case T_ASHR:- case T_EQ:- case T_NE:- case T_LT:- case T_LE:- case T_GT:- case T_GE:- case T_ICMP:- case T_ULT:- case T_ULE:- case T_UGT:- case T_UGE:- case T_UCMP:- CHECK(2);- n = ARG(TOP(1));- if (GETTAG(n) == T_INT) {- n = ARG(TOP(0));- PUSH(combBININT1);- if (GETTAG(n) == T_INT)- goto binint1;- } else {- PUSH(combBININT2);- }- goto top;-- case T_NEG:- case T_UNEG:- case T_INV:- case T_POPCOUNT:- case T_CLZ:- case T_CTZ:- CHECK(1);- n = ARG(TOP(0));- PUSH(combUNINT1);- goto top;--#if WANT_FLOAT32- case T_FADD:- case T_FSUB:- case T_FMUL:- case T_FDIV:- case T_FEQ:- case T_FNE:- case T_FLT:- case T_FLE:- case T_FGT:- case T_FGE:- CHECK(2);- n = ARG(TOP(1));- PUSH(combBINFLT2);- goto top;- case T_FNEG:- CHECK(1);- n = ARG(TOP(0));- PUSH(combUNFLT1);- goto top;-- case T_I64TOF:- {-#if WANT_INT64- CHECK(1);- flt32_t rf = (flt32_t)evalint64(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETFLT(n, rf);- RET;-#else- ERR("No Int64");-#endif- }-- case T_ITOF:- {- CHECK(1);- flt32_t rf = (flt32_t)evalint(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETFLT(n, rf);- RET;- }-- case T_UTOF:- {- CHECK(1);- flt32_t rf = (flt32_t)(uvalue_t)evalint(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETFLT(n, rf);- RET;- }-- case T_FTOI:- {- CHECK(1);- value_t i = (value_t)evalflt(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, i);- RET;- }--#endif /* WANT_FLOAT32 */--#if WANT_FLOAT64 && WANT_FLOAT32- case T_DTOF:- {- float xf = (float)evaldbl(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETFLT(n, xf);- RET;- }- case T_FTOD:- {- double xd = (double)evalflt(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETDBL(n, xd);- RET;- }-#endif /* WANT_FLOAT64 && WANT_FLOAT32 */--#if WANT_FLOAT64- case T_DADD:- case T_DSUB:- case T_DMUL:- case T_DDIV:- case T_DEQ:- case T_DNE:- case T_DLT:- case T_DLE:- case T_DGT:- case T_DGE:- CHECK(2);- n = ARG(TOP(1));- PUSH(combBINDBL2);- goto top;- case T_DNEG:- CHECK(1);- n = ARG(TOP(0));- PUSH(combUNDBL1);- goto top;--#if WANT_INT64- case T_I64TOD:- {- CHECK(1);- flt64_t rd = (flt64_t)evalint64(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETDBL(n, rd);- RET;- }-#endif-- case T_ITOD:- {- CHECK(1);- flt64_t rd = (flt64_t)evalint(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETDBL(n, rd);- RET;- }-- case T_UTOD:- {- CHECK(1);- flt64_t rd = (flt64_t)(uvalue_t)evalint(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETDBL(n, rd);- RET;- }-- case T_DTOI:- {- CHECK(1);- value_t i = (value_t)evaldbl(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, i);- RET;- }--#endif /* WANT_FLOAT64 */-- case T_ISINT:- CHECK(1);- x = evali(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, GETTAG(x) == T_INT ? GETVALUE(x) : -1);- RET;-- case T_BSAPPEND:- case T_BSAPPENDDOT:- case T_BSEQ:- case T_BSNE:- case T_BSLT:- case T_BSLE:- case T_BSGT:- case T_BSGE:- case T_BSCMP:- CHECK(2);- n = ARG(TOP(1));- PUSH(combBINBS2);- goto top;--#if WANT_INT64- case T_ADD64:- case T_SUB64:- case T_MUL64:- case T_QUOT64:- case T_REM64:- case T_SUBR64:- case T_UADD64:- case T_USUB64:- case T_UMUL64:- case T_UQUOT64:- case T_UREM64:- case T_USUBR64:- case T_AND64:- case T_OR64:- case T_XOR64:- case T_SHL64:- case T_SHR64:- case T_ASHR64:- case T_EQ64:- case T_NE64:- case T_LT64:- case T_LE64:- case T_GT64:- case T_GE64:- case T_ICMP64:- case T_ULT64:- case T_ULE64:- case T_UGT64:- case T_UGE64:- case T_UCMP64:- CHECK(2);- /*- fprintf(stderr, "bin64 op=%s\n", TAGNAME(tag)); fflush(stderr);- { NODEPTR x = evali(ARG(TOP(1)));- fprintf(stderr, "x.tag=%s x.val=%lld\n", TAGNAME(GETTAG(x)), GETINT64VALUE(x)); fflush(stderr);- NODEPTR y = evali(ARG(TOP(0)));- fprintf(stderr, "y.tag=%s y.val=%ld\n", TAGNAME(GETTAG(y)), GETVALUE(y)); fflush(stderr);- }- */- n = ARG(TOP(1));- if (GETTAG(n) == T_INT64) {- //fprintf(stderr, "push combBININT64_1\n"); fflush(stderr);- n = ARG(TOP(0));- PUSH(combBININT64_1);- if (GETTAG(n) == T_INT64) {- //fprintf(stderr, "goto binint64_1\n"); fflush(stderr);- goto binint64_1;- }- } else {- //fprintf(stderr, "push combBININT64_2\n"); fflush(stderr);- PUSH(combBININT64_2);- }- goto top;- case T_NEG64:- case T_UNEG64:- case T_INV64:- case T_POPCOUNT64:- case T_CLZ64:- case T_CTZ64:- CHECK(1);- n = ARG(TOP(0));- PUSH(combUNINT64_1);- goto top;-#endif /* WANT_INT64 */--- /* Convert between different types. */-#define CONV(t, set, get) do { CHECK(1); x = evali(ARG(TOP(0))); n = POPTOP(); SETTAG(n, t); set(n, get(x)); RET; } while(0)-#if WANT_INT64- case T_TODBL: CONV(T_DBL, SETINT64VALUE, GETINT64VALUE); /* raw int64_t -> double */- case T_FROMDBL: CONV(T_INT64, SETINT64VALUE, GETINT64VALUE); /* raw double -> int64_t */- case T_ITOI64: CONV(T_INT64, SETINT64VALUE, GETVALUE);- case T_UTOU64: CONV(T_INT64, SETINT64VALUE, (uint64_t)GETVALUE);- case T_I64TOI: CONV(T_INT, SETVALUE, GETINT64VALUE);- case T_U64TOU: CONV(T_INT, SETVALUE, GETINT64VALUE);-#endif /* WANT_INT64 */-#if WANT_FLOAT32- case T_TOFLT: CONV(T_FLT32, SETINT32VALUE, GETINT32VALUE);- case T_FROMFLT: CONV(T_INT, SETVALUE, GETINT32VALUE);-#endif /* WANT_FLOAT32 */- case T_TOINT: CONV(T_INT, SETVALUE, GETVALUE);- case T_TOPTR: CONV(T_PTR, SETVALUE, GETVALUE);- case T_TOFUNPTR: CONV(T_FUNPTR, SETVALUE, GETVALUE);-#undef CONV-- case T_FPADD: CHECK(2); xfp = evalforptr(ARG(TOP(0))); yi = evalint(ARG(TOP(1))); POP(2); n = TOP(-1); SETFORPTR(n, addForPtr(xfp, yi)); RET;- case T_FP2P:- CHECK(1);- xfp = evalforptr(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETPTR(n, xfp->payload.string);- RET;-- case T_FP2BS:- CHECK(2);- xfp = evalforptr(ARG(TOP(0)));- xi = evalint(ARG(TOP(1)));- POP(2);- n = TOP(-1);- xfp->payload.size = xi;- SETBSTR(n, xfp);- RET;-- case T_BS2FP:- CHECK(1);- xfp = evalbstr(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETFORPTR(n, xfp);- RET;-- case T_ARR_EQ:- {- CHECK(2);- x = evali(ARG(TOP(0)));- arr = ARR(x);- y = evali(ARG(TOP(1)));- POP(2);- n = TOP(-1);- GOBOOL(arr == ARR(y));- }-- case T_BSTOUTF8:- {- CHECK(1);- n = ARG(TOP(0));- /* Zap the pointer to the list so it can be GC:ed.- * The actual list is protected from GC by evalbytestring().- */- // ARG(TOP(0)) = combK;- struct bytestring bs = evalstring(n);- POP(1);- n = TOP(-1);- SETBSTR(n, mkForPtrFree(bs));- RET;- }-- case T_BSHEADUTF8:- CHECK(1);- xfp = evalbstr(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, headutf8(xfp->payload, (void**)0));- RET;-- case T_BSTAILUTF8:- CHECK(1);- xfp = evalbstr(ARG(TOP(0)));- POP(1);- n = TOP(-1);- { void *out;- (void)headutf8(xfp->payload, &out); /* skip one UTF8 character */- xi = (char*)out - (char*)xfp->payload.string; /* offset */- yi = xfp->payload.size - xi; /* remaining length */- SETBSTR(n, bssubstr(xfp, xi, yi)); /* make a substring */- }- RET;-- case T_BSFROMUTF8:- if (doing_rnf) RET;- CHECK(1);-- xfp = evalbstr(ARG(TOP(0)));- GCCHECK(strNodes(xfp->payload.size));- POP(1);- n = TOP(-1);- //printf("T_FROMUTF8 x = %p fp=%p payload.string=%p\n", x, x->uarg.uuforptr, x->uarg.uuforptr->payload.string);- GOIND(mkStringU(xfp->payload));-- case T_BSUNPACK:- if (doing_rnf) RET;- CHECK(1);- struct forptr *xfp = evalbstr(ARG(TOP(0)));- GCCHECK(strNodes(xfp->payload.size));- POP(1);- n = TOP(-1);- GOIND(bsunpack(xfp->payload));-- case T_BSPACK:- CHECK(1);- n = ARG(TOP(0));- /* Zap the pointer to the list so it can be GC:ed.- * The actual list is protected from GC by evalbytestring().- */- ARG(TOP(0)) = combK;- struct bytestring rbs = evalbytestring(n);- POP(1);- n = TOP(-1);- SETBSTR(n, mkForPtrFree(rbs));- RET;-- case T_BSREPLICATE:- CHECK(2);- xi = evalint(ARG(TOP(0)));- yi = evalint(ARG(TOP(1)));- POP(2);- n = TOP(-1);- SETBSTR(n, mkForPtrFree(bsreplicate(xi, yi)));- RET;-- case T_BSLENGTH:- CHECK(1);- xfp = evalbstr(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, xfp->payload.size);- RET;-- case T_BSSUBSTR:- CHECK(3);- xfp = evalbstr(ARG(TOP(0)));- xi = evalint(ARG(TOP(1)));- yi = evalint(ARG(TOP(2)));- POP(3);- n = TOP(-1);- SETBSTR(n, bssubstr(xfp, xi, yi));- RET;-- case T_BSINDEX:- CHECK(2);- xfp = evalbstr(ARG(TOP(0)));- xi = evalint(ARG(TOP(1)));- POP(2);- n = TOP(-1);- SETINT(n, ((uint8_t *)xfp->payload.string)[xi]);- RET;-- case T_BSWRITE:- CHKARG4NP;- xfp = evalbstr(x);- xi = evalint(y);- yi = evalint(z);- POP(4);- ((uint8_t *)xfp->payload.string)[xi] = (uint8_t)yi;- GOPAIRUNIT;-- case T_RAISE:- if (doing_rnf) RET;- CHKARG1;- raise_exn(x); /* never returns */-- case T_SPNEW:- GCCHECK(1);- CHKARG2;- xi = new_stableptr(x);- GOPAIR(mkInt(xi));- case T_SPDEREF:- CHKARG2NP;- xi = evalint(x);- POP(2);- GOPAIR(deref_stableptr(xi));- case T_SPFREE:- CHKARG2NP;- xi = evalint(x);- free_stableptr(xi);- POP(2);- GOPAIRUNIT;-- case T_WKNEW:- GCCHECK(2);- CHKARG3;- GOPAIR(new_weak_ptr(x, y, 0));- case T_WKNEWFIN:- GCCHECK(3);- CHKARG4;- GOPAIR(new_weak_ptr(x, y, z));- case T_WKDEREF:- CHKARG2NP;- x = deref_weak_ptr(evalweak(x));- POP(2);- GOPAIR(x);- case T_WKFINAL:- CHKARG2NP;- finalize_weak_ptr(evalweak(x));- POP(2);- GOPAIRUNIT;-- case T_SEQ: CHECK(2); evali(ARG(TOP(0))); POP(2); n = TOP(-1); y = ARG(n); GOIND(y); /* seq x y = eval(x); y */-- case T_RNF:- if (doing_rnf) RET;- CHECK(2);- xi = evalint(ARG(TOP(0)));- rnf(xi, ARG(TOP(1))); POP(2); n = TOP(-1); GOIND(combUnit);-- case T_IO_PERFORMIO:- GCCHECK(2);- if (doing_rnf) RET;- CHKARG1;- /* Conjure up a new world and evaluate the io with that world, finally selecting the result */- /* PERFORMIO io --> io World K */-#if 1- GOAP2(x, combWorld, combK);-#else- {- /* Don't count performio reductions. */- /* Useful when Debug.Trace.trace should have zero cost */- NODEPTR p1 = new_ap(x, combWorld);- NODEPTR p2 = new_ap(p1, combK);- counter_t s = glob_slice;- glob_slice = 1000000000;- NODEPTR p3 = evali(p2);- glob_slice = s;- GOIND(p3);- }-#endif-- case T_IO_BIND:- goto t_c;- case T_IO_RETURN:- goto t_p;- case T_IO_THEN:- GCCHECK(2);- CHKARG2;- GOAP2(combIOBIND, x, new_ap(combK, y));- case T_IO_LAZYBIND:- /* Lazy bind, used for the lazy ST monad.- * DO NOT USE FOR IO, because effects are not guaranteed to happen.- * (x `lazyBind` y) z = let w = x z in y (fst w) (snd w)- */- GCCHECK(4);- CHKARG3;- w = new_ap(x, z);- GOAP2(y, new_ap(combFst, w), new_ap(combSnd, w));- case T_IO_STRICT:- CHKARG2;- /* Force the world argument before executing the IO.- * IO.strict io World = seq World (io World)- */- (void)evali(y); /* evaluate the world */- GOAP(x, y); /* and run IO computation */-#if WANT_STDIO- case T_IO_PP:- CHKARG2;- pp(stderr, x);- GOPAIRUNIT;- case T_IO_PRINT:- hdr = false;- goto ser;- case T_IO_SERIALIZE:- hdr = true;- ser:-#if 0- gc(); /* DUBIOUS: do a GC to get possible GC reductions */-#endif- CHKARG3NP;- bfile = (struct BFILE*)evalptr(x);- printb(bfile, evali(y), hdr);- putb('\n', bfile);- POP(3);- GOPAIRUNIT;- case T_IO_DESERIALIZE:- CHKARG2NP;- bfile = (struct BFILE*)evalptr(x);- gc(); /* make sure we have room. GC during parse is dodgy. */- x = parse_top(bfile, 0);- POP(2);- GOPAIR(x); /* allocates a cell, but we did a GC above */-#endif-#if WANT_ARGS- case T_IO_GETARGREF:- GCCHECK(2);- CHKARG1;- x = alloc_node(T_ARR);- ARR(x) = argarray;- GOPAIR(x);-#endif- case T_IO_CCALL:- {- GCCHECK(1); /* room for placeholder */- int a = (int)GETVALUE(n); /* function number */- //printf(" %s\n", FFI_IX(a).ffi_name);- int arity = FFI_IX(a).ffi_arity;- CHECK(arity);- funptr_t f = FFI_IX(a).ffi_fun;- PUSH(mkPtr(0)); /* placeholder for result, protected from GC */- int k = f(stk); /* call FFI function, return number of arguments */- if (k != arity) {-#if WANT_STDIO- fprintf(stderr, "ccall arity %s %d!=%d\n", FFI_IX(a).ffi_name, arity, k);-#endif- ERR("ccall arity"); /* temporary sanity check */- }- GCCHECK(1); /* room for pair */- x = POPTOP(); /* pop actual result */- POP(arity); /* pop the pushed arguments */- if (stack_ptr < 0)- ERR("CCALL POP");- n = POPTOP(); /* node to update */- GOPAIR(x); /* and this is the result */- }-- case T_NEWCASTRINGLEN:- {- CHKARG2NP; /* set x,y,n */- struct bytestring bs = evalbytestring(x);- GCCHECK(5);- NODEPTR cs = alloc_node(T_PTR);- PTR(cs) = bs.string;- NODEPTR res = new_ap(new_ap(combPair, cs), mkInt(bs.size));- POP(2);- GOPAIR(res);- }- case T_PACKCSTRING:- {- CHKARG2NP; /* sets x, y, n */- {- char *cstr = evalptr(x);- struct bytestring bs;- bs.size = strlen(cstr);- bs.string = mmalloc(bs.size);;- memcpy(bs.string, cstr, bs.size);- NODEPTR res = mkStrNode(bs);- GCCHECKSAVE(res, 1);- POP(2);- GOPAIR(res);- }- }- case T_PACKCSTRINGLEN:- {- CHKARG3NP; /* sets x,y,z,n */- {- char *cstr = evalptr(x);- struct bytestring bs;- bs.size = evalint(y);- bs.string = mmalloc(bs.size);- memcpy(bs.string, cstr, bs.size);- NODEPTR res = mkStrNode(bs);- POP(3);- GCCHECKSAVE(res, 1);- GOPAIR(res);- }- }- case T_BSGRAB:- {- CHKARG2NP; /* sets x, y, n */- {- struct bytestring bs;- bs.string = evalptr(x);- bs.size = strlen(bs.string);- NODEPTR res = mkStrNode(bs);- GCCHECKSAVE(res, 1);- POP(2);- GOPAIR(res);- }- }- case T_BSGRABLEN:- {- CHKARG3NP; /* sets x, y, z, n */- {- struct bytestring bs;- bs.string = evalptr(x);- bs.size = evalint(y);- NODEPTR res = mkStrNode(bs);- GCCHECKSAVE(res, 1);- POP(3);- GOPAIR(res);- }- }-- case T_ARR_ALLOC:- {- CHKARG3NP; /* sets x,y,z,n */- {- size_t size = evalint(x);- struct ioarray *arr = arr_alloc(size, y);- GCCHECK(2);- NODEPTR res = alloc_node(T_ARR);- ARR(res) = arr;- POP(3);- GOPAIR(res);- }- }- case T_ARR_COPY:- {- CHKARG2NP;- {- NODEPTR a = evali(x);- if (GETTAG(a) != T_ARR)- ERR("T_ARR_COPY tag");- struct ioarray *arr = arr_copy(ARR(a));- GCCHECK(2);- NODEPTR res = alloc_node(T_ARR);- ARR(res) = arr;- POP(2);- GOPAIR(res);- }- }- case T_ARR_SIZE:- {- CHKARG2NP;- NODEPTR a = evali(x);- if (GETTAG(a) != T_ARR)- ERR("bad ARR tag");- GCCHECK(2);- NODEPTR res = mkInt(ARR(a)->size);- POP(2);- GOPAIR(res);- }- case T_ARR_READ:- {- CHKARG3NP; /* sets x,y,n */- size_t i = evalint(y);- NODEPTR a = evali(x);- if (GETTAG(a) != T_ARR)- ERR("bad ARR tag");- if (i >= ARR(a)->size)- ERR("ARR_READ");- GCCHECK(1);- NODEPTR res = ARR(a)->array[i];- POP(3);- GOPAIR(res);- }- case T_ARR_WRITE:- {- CHKARG4NP; /* sets x,y,z,n */- size_t i = evalint(y);- NODEPTR a = evali(x);- if (GETTAG(a) != T_ARR)- ERR("bad ARR tag");- if (i >= ARR(a)->size) {- ERR("ARR_WRITE");- }- ARR(a)->array[i] = z;- POP(4);- GOPAIRUNIT;- }-- case T_ARR_TRUNC:- {- CHKARG3NP; /* sets x,y,n */- size_t i = evalint(y);- NODEPTR a = evali(x);- if (GETTAG(a) != T_ARR)- ERR("bad ARR tag");- if (i >= ARR(a)->size) {- ERR("ARR_TRUNC");- }- ARR(a)->size = i;- POP(3);- GOPAIRUNIT;- }-- case T_FPNEW:- {- CHKARG2NP;- //printf("T_FPNEW\n");- void *xp = evalptr(x);- //printf("T_FPNEW xp=%p\n", xp);- GCCHECK(2);- NODEPTR res = alloc_node(T_FORPTR);- SETFORPTR(res, mkForPtrP(xp));- POP(2);- GOPAIR(res);- }- case T_FPFIN:- {- CHKARG3NP;- //printf("T_FPFIN\n");- struct forptr *xfp = evalforptr(y);- //printf("T_FPFIN xfp=%p\n", xfp);- HsFunPtr xp = evalfunptr(x);- //printf("T_FPFIN yp=%p\n", yp);- xfp->finalizer->final = xp;- POP(3);- GOPAIRUNIT;- }- case T_IO_GC:- //printf("gc()\n");- CHKARG2NP;- {- int red = evalint(x);- int oldred = want_gc_red;- want_gc_red = red;- gc();- want_gc_red = oldred;- }- POP(2);- GOPAIRUNIT;-- case T_IO_STATS:- {- GCCHECK(4);- CHKARG1;- NODEPTR res = new_ap(new_ap(combPair, mkInt((uvalue_t)num_alloc)), mkInt((uvalue_t)(num_reductions - glob_slice)));- GOPAIR(res);- }-- case T_IO_FORK:- {- GCCHECK(3);- CHKARG2; /* set x=io, y=ST, n */- struct mthread *mt = new_thread(new_ap(x, y)); /* copy the world */- mt->mt_mask = runq.mq_head->mt_mask; /* inherit masking state */- NODEPTR res = alloc_node(T_THID);- THR(res) = mt;- GOPAIR(res);- }-- case T_IO_THID:- {- GCCHECK(2);- CHKARG1;- NODEPTR res = alloc_node(T_THID);- THR(res) = runq.mq_head; /* head of the run queue is the current thread */- GOPAIR(res);- }- case T_IO_THROWTO:- {- CHKARG3NP; /* x=this, y=exn, z=ST */- check_thrown(true); /* check if we have a thrown exception */- struct mthread *mt = evalthid(x);- throwto(mt, y);- POP(3);- GOPAIRUNIT;- }- case T_IO_YIELD:- CHKARG1;- yield();- GOPAIRUNIT;-- case T_IO_NEWMVAR:- {- GCCHECK(2);- CHKARG1;- struct mvar *mv = new_mvar();- NODEPTR res = alloc_node(T_MVAR);- MVAR(res) = mv;- GOPAIR(res);- }- case T_IO_TAKEMVAR:- {- CHKARG2NP; /* set x=mvar, y=ST */- check_thrown(true); /* check if we have a thrown exception */- NODEPTR res = take_mvar(false, evalmvar(x)); /* never returns if it blocks */- GCCHECKSAVE(res, 1);- POP(2);- GOPAIR(res);- }- case T_IO_READMVAR:- {- CHKARG2NP;- check_thrown(true); /* check if we have a thrown exception */- NODEPTR res = read_mvar(false, evalmvar(x)); /* never returns if it blocks */- GCCHECKSAVE(res, 1);- POP(2);- GOPAIR(res);- }- case T_IO_PUTMVAR:- {- CHKARG3NP; /* set x=mvar, y=value, z=ST */- check_thrown(true); /* check if we have a thrown exception */- (void)put_mvar(false, evalmvar(x), y); /* never returns if it blocks */- POP(3);- GOPAIRUNIT;- }- case T_IO_TRYTAKEMVAR:- {- CHKARG2NP;- NODEPTR res = take_mvar(true, evalmvar(x));- GCCHECKSAVE(res, 2);- if (res != NIL)- res = new_ap(combJust, res);- else- res = combNothing;- POP(2);- GOPAIR(res);- }- case T_IO_TRYREADMVAR:- {- CHKARG2NP;- NODEPTR res = read_mvar(true, evalmvar(x));- if (res != NIL) {- GCCHECKSAVE(res, 2);- res = new_ap(combJust, res);- } else {- res = combNothing;- }- POP(2);- GOPAIR(res);- }- case T_IO_TRYPUTMVAR:- {- CHKARG3NP;- NODEPTR res = put_mvar(true, evalmvar(x), y) ? combTrue : combFalse;- GCCHECKSAVE(res, 1);- POP(3);- GOPAIR(res);- }- case T_IO_THREADDELAY:- {- CHKARG2NP;-#if defined(CLOCK_INIT)- check_thrown(true); /* check if we have a thrown exception */- if (runq.mq_head->mt_at == -1) {- /* delay has already expired, so just return */- runq.mq_head->mt_at = 0;- POP(2);- GOPAIRUNIT;- } else {- thread_delay(evalint(x)); /* never returns */- }-#else- ERR("threadDelay: no clock");-#endif- }- case T_IO_THREADSTATUS:- {- CHKARG2NP;- struct mthread *mt = evalthid(x);- GCCHECK(2);- POP(2);- GOPAIR(mkInt(mt->mt_state));- }- case T_IO_WAITRDFD:- case T_IO_WAITWRFD: {-#if WANT_IO_POLL- CHKARG2NP; /* x = filedescriptor, y = RealWorld; no pop yet */-- /*- * When the thread wakes up again it will re-execute that last op.- * check_pollq() sets mt_fd=IO_POLL_EVENT_HAS_HAPPENED when waking the thread.- * If we did not do this check we would just sleep again.- */- if (runq.mq_head->mt_fd == IO_POLL_EVENT_HAS_HAPPENED) {- runq.mq_head->mt_fd = IO_POLL_WAITING_FOR_NONE;- POP(2);- GOPAIR(mkInt(0));- }-- check_thrown(true); /* check if we have a thrown exception */-- int fd = evalint(x);- int events = tag == T_IO_WAITRDFD ? POLLIN : POLLOUT;-- /* Set up the waiting thread's state, preparing it to leave the run queue- * until an event is ready for it.- */- struct mthread *mt = remove_q_head(&runq);- mt->mt_fd = fd;- mt->mt_events = events;- add_q_tail(&pollq, mt); /* put it on the q of I/O waiters */-#if THREAD_DEBUG- if (thread_trace) {- printf("T_IO_WAITxxFD: wait for FD=%d, events=%x, thread=%d\n", fd, events, (int)mt->mt_id);- }-#endif /* THREAD_DEBUG */-- POP(2);- resched(mt, ts_wait_io); /* set the thread state and reschedule */-#else /* WANT_IO_POLL */- CHKARG2;-#if WANT_ERRNO- errno = EINVAL;-#endif- GOPAIR(mkInt(-1)); /* cannot poll */-#endif /* WANT_IO_POLL */- }- case T_IO_GETMASKINGSTATE:- CHKARG1; /* x = ST */- GOPAIR(mkInt(runq.mq_head->mt_mask));-- case T_IO_SETMASKINGSTATE:- CHKARG2; /* x = level, y = ST */- runq.mq_head->mt_mask = evalint(x);- GOPAIRUNIT;-- case T_CATCH:- /* CATCH x y z --> CATCHR (x z) y z */- GCCHECK(3);- CHKARG3; /* x=io, y=hdl, z=ST */- GOAP(new_ap(new_ap(combCATCHR, new_ap(x, z)), y), z);- case T_CATCHR:- {- CHKARG3NP; /* x = (io st), y = hdl, z = st, n = (CATCHR (io st)) h */- struct handler *h = mmalloc(sizeof *h);- h->hdl_old = cur_handler;- cur_handler = h;- stackptr_t ostack = stack_ptr;; /* old stack pointer */- enum mask_state omask = runq.mq_head->mt_mask; /* old mask */- if (setjmp(h->hdl_buf)) {- /* An exception occurred: */- stack_ptr = ostack;- runq.mq_head->mt_mask = mask_interruptible; /* evaluate with mask */- NODEPTR exn = h->hdl_exn; /* exception value */- cur_handler = h->hdl_old; /* reset handler */- FREE(h);- GCCHECK(8);- POP(3);- /*- * Run:- * hdl exn `primBind` \ r ->- * primSetMaskingState omask `primThen`- * primReturn r- * i.e.,- * primBind (hdl exn) (B' primThen (primSetMaskingState omask) primReturn)- */- NODEPTR p = new_ap(combIOBIND, new_ap(y, exn));- NODEPTR q = new_ap(new_ap(new_ap(combBB, combIOTHEN), new_ap(combSETMASKINGSTATE, mkInt(omask))), combIORETURN);- GOAP2(p, q, z);- } else {- /* Normal execution: */- x = evali(x); /* execute first argument */- /* No exception occurred */- cur_handler = h->hdl_old; /* restore old handler */- FREE(h);- POP(3);- GOIND(x);- }- }-- case T_THNUM:- {- CHECK(1);- struct mthread *mt = evalthid(ARG(TOP(0)));- POP(1);- n = TOP(-1);- SETINT(n, (uvalue_t)mt->mt_id);- RET;- }-- case T_DYNSYM:- /* A dynamic FFI lookup */- CHECK(1);- msg = evalstring(ARG(TOP(0))).string;- GCCHECK(1);- x = ffiNode(msg);- FREE(msg);- POP(1);- n = TOP(-1);- GOIND(x);--#if WANT_TICK- case T_TICK:- xi = GETVALUE(n);- CHKARG1;- // fprintf(stderr, "tick=%s\n", (char*)tick_table[xi].tick_name.string); fflush(stderr);- dotick(xi);- GOIND(x);-#endif-- default:- ERR1("eval tag %s", TAGNAME(GETTAG(n)));- }--- ret:- if (stack_ptr != stk) {- // In this case, n was an AP that got pushed and potentially- // updated.- uvalue_t xu, yu, ru;-#if WANT_INT64- uint64_t x64u, y64u, r64u;-#endif /* WANT_INT64 */-#if WANT_FLOAT32- flt32_t xf, yf, rf;-#endif /* WANT_FLOAT32 */-#if WANT_FLOAT64- flt64_t xd, yd, rd;-#endif /* WANT_FLOAT64 */- NODEPTR p;-- tag = GETTAG(TOP(0));- switch (tag) {- case T_BININT2:- n = ARG(TOP(1));- TOP(0) = combBININT1;- goto top;-- case T_BININT1:- /* First argument */-#if SANITY- if (GETTAG(n) != T_INT)- ERR("BININT 0");-#endif /* SANITY */- binint1:- xu = (uvalue_t)GETVALUE(n);- /* Second argument */- y = ARG(TOP(2));- while (GETTAG(y) == T_IND)- y = GETINDIR(y);-#if SANITY- if (GETTAG(y) != T_INT)- ERR("BININT 1");-#endif /* SANITY */- yu = (uvalue_t)GETVALUE(y);- p = FUN(TOP(1));- POP(3);- n = TOP(-1);- binint:-/* if we don't need Int64 implementation, just make Int and Int64 the same */- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto binint;- case T_ADD: ADD_OVERFLOW(value_t, ru, xu, yu); break;- case T_SUB: SUB_OVERFLOW(value_t, ru, xu, yu); break;- case T_MUL: MUL_OVERFLOW(value_t, ru, xu, yu); break;- case T_SUBR: SUB_OVERFLOW(value_t, ru, yu, xu); break;- case T_QUOT: if (yu == 0)- raise_rts(exn_dividebyzero);- else if ((value_t)xu == VALUE_MIN && (value_t)yu == -1)- raise_rts(exn_overflow);- else- ru = (uvalue_t)((value_t)xu / (value_t)yu);- break;- case T_REM: if (yu == 0)- raise_rts(exn_dividebyzero);- else /* this should not overflow under any circumstances */- ru = (uvalue_t)((value_t)xu % (value_t)yu);- break;- case T_UADD: ru = xu + yu; break;- case T_USUB: ru = xu - yu; break;- case T_UMUL: ru = xu * yu; break;- case T_USUBR: ru = yu - xu; break;- case T_UQUOT: if (yu == 0)- raise_rts(exn_dividebyzero);- else- ru = xu / yu;- break;- case T_UREM: if (yu == 0)- raise_rts(exn_dividebyzero);- else- ru = xu % yu;- break;- case T_AND: ru = xu & yu; break;- case T_OR: ru = xu | yu; break;- case T_XOR: ru = xu ^ yu; break;- case T_SHL: ru = xu << yu; break;- case T_SHR: ru = xu >> yu; break;- case T_ASHR: ru = (uvalue_t)((value_t)xu >> yu); break;-- case T_EQ: GOBOOL(xu == yu);- case T_NE: GOBOOL(xu != yu);- case T_ULT: GOBOOL(xu < yu);- case T_ULE: GOBOOL(xu <= yu);- case T_UGT: GOBOOL(xu > yu);- case T_UGE: GOBOOL(xu >= yu);- case T_UCMP: GOIND(xu < yu ? combLT : xu > yu ? combGT : combEQ);- case T_LT: GOBOOL((value_t)xu < (value_t)yu);- case T_LE: GOBOOL((value_t)xu <= (value_t)yu);- case T_GT: GOBOOL((value_t)xu > (value_t)yu);- case T_GE: GOBOOL((value_t)xu >= (value_t)yu);- case T_ICMP: GOIND((value_t)xu < (value_t)yu ? combLT : (value_t)xu > (value_t)yu ? combGT : combEQ);-- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("BININT");- }- SETINT(n, (value_t)ru);- goto ret;-- case T_UNINT1:- /* The argument */-#if SANITY- if (GETTAG(n) != T_INT)- ERR("UNINT 0");-#endif- xu = (uvalue_t)GETVALUE(n);- p = FUN(TOP(1));- POP(2);- n = TOP(-1);- unint:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto unint;- case T_NEG: if ((value_t)xu == VALUE_MIN) raise_rts(exn_overflow); ru = -xu; break;- case T_UNEG: ru = -xu; break;- case T_INV: ru = ~xu; break;- case T_POPCOUNT: ru = POPCOUNT(xu); break;- case T_CLZ: ru = CLZ(xu); break;- case T_CTZ: ru = CTZ(xu); break;- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("UNINT");- }- SETINT(n, (value_t)ru);- goto ret;--#if WANT_INT64- case T_BININT64_2:- n = ARG(TOP(1));- TOP(0) = combBININT64_1;- goto top;-- case T_BININT64_1:- /* First argument */-#if SANITY- if (GETTAG(n) != T_INT64) {- //fprintf(stderr, "tag=%s\n", TAGNAME(GETTAG(n))); fflush(stderr);- ERR("BININT64 0");- }-#endif /* SANITY */- binint64_1:- x64u = (uint64_t)GETINT64VALUE(n);- /* Second argument */- y = ARG(TOP(2));- while (GETTAG(y) == T_IND)- y = GETINDIR(y);- /* The second argument to the shift ops is an int, so use a hack for that */- if (GETTAG(y) == T_INT64)- y64u = (uint64_t)GETINT64VALUE(y);- else if (GETTAG(y) == T_INT)- yu = (uvalue_t)GETVALUE(y);- else- ERR("BININT64 1");- p = FUN(TOP(1));- POP(3);- n = TOP(-1);- binint64:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto binint64;- case T_ADD64: ADD_OVERFLOW(int64_t, r64u, x64u, y64u); break;- case T_SUB64: SUB_OVERFLOW(int64_t, r64u, x64u, y64u); break;- case T_MUL64: MUL_OVERFLOW(int64_t, r64u, x64u, y64u); break;- case T_SUBR64:SUB_OVERFLOW(int64_t, r64u, y64u, x64u); break;- case T_QUOT64:if (y64u == 0)- raise_rts(exn_dividebyzero);- else if ((int64_t)x64u == INT64_MIN && (int64_t)y64u == -1)- raise_rts(exn_overflow);- else- r64u = (uint64_t)((int64_t)x64u / (int64_t)y64u);- break;- case T_REM64: if (y64u == 0)- raise_rts(exn_dividebyzero);- else- r64u = (uint64_t)((int64_t)x64u % (int64_t)y64u);- break;- case T_UADD64:r64u = x64u + y64u; break;- case T_USUB64:r64u = x64u - y64u; break;- case T_UMUL64:r64u = x64u * y64u; break;- case T_USUBR64:r64u = y64u - x64u; break;- case T_UQUOT64:if (y64u == 0)- raise_rts(exn_dividebyzero);- else- r64u = x64u / y64u;- break;- case T_UREM64:if (y64u == 0)- raise_rts(exn_dividebyzero);- else- r64u = x64u % y64u;- break;- case T_AND64: r64u = x64u & y64u; break;- case T_OR64: r64u = x64u | y64u; break;- case T_XOR64: r64u = x64u ^ y64u; break;- case T_SHL64: r64u = x64u << yu; break;- case T_SHR64: r64u = x64u >> yu; break;- case T_ASHR64:r64u = (uint64_t)((int64_t)x64u >> yu); break;-- case T_EQ64: GOBOOL(x64u == y64u);- case T_NE64: GOBOOL(x64u != y64u);- case T_ULT64: GOBOOL(x64u < y64u);- case T_ULE64: GOBOOL(x64u <= y64u);- case T_UGT64: GOBOOL(x64u > y64u);- case T_UGE64: GOBOOL(x64u >= y64u);- case T_UCMP64:GOIND(x64u < y64u ? combLT : x64u > y64u ? combGT : combEQ);- case T_LT64: GOBOOL((int64_t)x64u < (int64_t)y64u);- case T_LE64: GOBOOL((int64_t)x64u <= (int64_t)y64u);- case T_GT64: GOBOOL((int64_t)x64u > (int64_t)y64u);- case T_GE64: GOBOOL((int64_t)x64u >= (int64_t)y64u);- case T_ICMP64:GOIND((int64_t)x64u < (int64_t)y64u ? combLT : (int64_t)x64u > (int64_t)y64u ? combGT : combEQ);-- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("BININT64");- }- SETINT64(n, (int64_t)r64u);- goto ret;-- case T_UNINT64_1:- /* The argument */-#if SANITY- if (GETTAG(n) != T_INT64)- ERR("UNINT64 0");-#endif- x64u = (uint64_t)GETINT64VALUE(n);- p = FUN(TOP(1));- POP(2);- n = TOP(-1);- unint64:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto unint64;- case T_NEG64: if ((int64_t)x64u == INT64_MIN) raise_rts(exn_overflow); r64u = -x64u; break;- case T_UNEG64: r64u = -x64u; break;- case T_INV64: r64u = ~x64u; break;- case T_POPCOUNT64: ru = POPCOUNT64(x64u); SETINT(n, (value_t)ru); goto ret;- case T_CLZ64: ru = CLZ64(x64u); SETINT(n, (value_t)ru); goto ret;- case T_CTZ64: ru = CTZ64(x64u); SETINT(n, (value_t)ru); goto ret;- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("UNINT64");- }- SETINT64(n, (int64_t)r64u);- goto ret;-#endif /* WANT_INT64 */--#if WANT_FLOAT32- case T_BINFLT2:- n = ARG(TOP(1));- TOP(0) = combBINFLT1;- goto top;-- case T_BINFLT1:- /* First argument */-#if SANITY- if (GETTAG(n) != T_FLT32)- ERR("BINDBL 0");-#endif /* SANITY */- xf = GETFLTVALUE(n);- /* Second argument */- y = ARG(TOP(2));- while (GETTAG(y) == T_IND)- y = GETINDIR(y);-#if SANITY- if (GETTAG(y) != T_FLT32)- ERR("BINDBL 1");-#endif /* SANITY */- yf = GETFLTVALUE(y);- p = FUN(TOP(1));- POP(3);- n = TOP(-1);- binflt:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto binflt;- case T_FADD: rf = xf + yf; break;- case T_FSUB: rf = xf - yf; break;- case T_FMUL: rf = xf * yf; break;- case T_FDIV: rf = xf / yf; break;-- case T_FEQ: GOBOOL(xf == yf);- case T_FNE: GOBOOL(xf != yf);- case T_FLT: GOBOOL(xf < yf);- case T_FLE: GOBOOL(xf <= yf);- case T_FGT: GOBOOL(xf > yf);- case T_FGE: GOBOOL(xf >= yf);-- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("BINFLT");- }- SETFLT(n, rf);- goto ret;-- case T_UNFLT1:- /* The argument */-#if SANITY- if (GETTAG(n) != T_FLT32)- ERR("UNFLT 0");-#endif- xf = GETFLTVALUE(n);- p = FUN(TOP(1));- POP(2);- n = TOP(-1);- unflt:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto unflt;- case T_FNEG: rf = -xf; break;- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("UNFLT");- }- SETFLT(n, rf);- goto ret;-#endif /* WANT_FLOAT32 */--#if WANT_FLOAT64- case T_BINDBL2:- n = ARG(TOP(1));- TOP(0) = combBINDBL1;- goto top;-- case T_BINDBL1:- /* First argument */-#if SANITY- if (GETTAG(n) != T_DBL)- ERR("BINDBL 0");-#endif /* SANITY */- xd = GETDBLVALUE(n);- /* Second argument */- y = ARG(TOP(2));- while (GETTAG(y) == T_IND)- y = GETINDIR(y);-#if SANITY- if (GETTAG(y) != T_DBL)- ERR("BINDBL 1");-#endif /* SANITY */- yd = GETDBLVALUE(y);- p = FUN(TOP(1));- POP(3);- n = TOP(-1);- bindbl:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto bindbl;- case T_DADD: rd = xd + yd; break;- case T_DSUB: rd = xd - yd; break;- case T_DMUL: rd = xd * yd; break;- case T_DDIV: rd = xd / yd; break;-- case T_DEQ: GOBOOL(xd == yd);- case T_DNE: GOBOOL(xd != yd);- case T_DLT: GOBOOL(xd < yd);- case T_DLE: GOBOOL(xd <= yd);- case T_DGT: GOBOOL(xd > yd);- case T_DGE: GOBOOL(xd >= yd);-- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("BINDBL");- }- SETDBL(n, rd);- goto ret;-- case T_UNDBL1:- /* The argument */-#if SANITY- if (GETTAG(n) != T_DBL)- ERR("UNDBL 0");-#endif- xd = GETDBLVALUE(n);- p = FUN(TOP(1));- POP(2);- n = TOP(-1);- undbl:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto undbl;- case T_DNEG: rd = -xd; break;- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("UNDBL");- }- SETDBL(n, rd);- goto ret;-#endif /* WANT_FLOAT64 */-- case T_BINBS2:- n = ARG(TOP(1));- TOP(0) = combBINBS1;- goto top;-- case T_BINBS1:- /* First argument */-#if SANITY- if (GETTAG(n) != T_FORPTR || FORPTR(n)->finalizer->fptype != FP_BSTR)- ERR("BINBS 0");-#endif /* SANITY */- xbs = BSTR(n);- /* Second argument */- y = ARG(TOP(2));- while (GETTAG(y) == T_IND)- y = GETINDIR(y);-#if SANITY- if (GETTAG(y) != T_FORPTR || FORPTR(y)->finalizer->fptype != FP_BSTR)- ERR("BINBS 1");-#endif /* SANITY */- ybs = BSTR(y);- p = FUN(TOP(1));- POP(3);- n = TOP(-1);- binbs:- switch (GETTAG(p)) {- case T_IND: p = GETINDIR(p); goto binbs;-- case T_BSAPPEND: rbs = bsappend(xbs, ybs); break;- case T_BSAPPENDDOT: rbs = bsappenddot(xbs, ybs); break;- case T_BSEQ: GOBOOL(bscompare(xbs, ybs) == 0);- case T_BSNE: GOBOOL(bscompare(xbs, ybs) != 0);- case T_BSLT: GOBOOL(bscompare(xbs, ybs) < 0);- case T_BSLE: GOBOOL(bscompare(xbs, ybs) <= 0);- case T_BSGT: GOBOOL(bscompare(xbs, ybs) > 0);- case T_BSGE: GOBOOL(bscompare(xbs, ybs) >= 0);- case T_BSCMP: r = bscompare(xbs, ybs); GOIND(r < 0 ? combLT : r > 0 ? combGT : combEQ);-- default:- //fprintf(stderr, "tag=%d\n", GETTAG(FUN(TOP(0))));- ERR("BINBS");- }- SETBSTR(n, mkForPtrFree(rbs));- goto ret;-- default:- stack_ptr = stk;- n = TOP(-1);- }- }-#if MAXSTACKDEPTH- cur_c_stack = old_cur_c_stack; /* reset rather than counting down, in case of longjump */-#endif- return n;-}--static char *progname = "?";--NORETURN void-die_exn(NODEPTR exn)-{- /* No handler:- * First convert the exception to a string by calling displaySomeException.- * The display function compiles to combShowExn, so we need to build- * (combShowExn exn) and evaluate it.- */- NODEPTR x;- char *msg;-- in_raise = true;-- if (GETTAG(exn) == T_INT) {- /* This is the special hack for RTS generated exception, represented by a T_INT */- switch(GETVALUE(exn)) {- case 0: msg = "stack overflow"; break;- case 1: msg = "heap overflow"; break;- case 2: msg = "thread killed"; break;- case 3: msg = "user interrupt"; break;- case 4: msg = "DivideByZero"; break;- case 5: msg = "blocked MVar"; break;- case 6: msg = "blocked STM"; break;- case 7: msg = "arithmetic overflow"; break;- default: msg = "unknown"; break;- }- } else {- /* just overwrite the top stack element, we don't need it */- CLEARSTK();- GCCHECK(1);- PUSH(new_ap(combShowExn, exn));/* TOP(0) = (combShowExn exn) */- x = evali(TOP(0)); /* evaluate it */- msg = evalstring(x).string; /* and convert to a C string */- POP(1);- }-#if WANT_STDIO- /* A horrible hack until we get proper exceptions */- if (strcmp(msg, "ExitSuccess") == 0) {- EXIT(0);- } else {- fprintf(stderr, "\n%s: uncaught exception: %s\n", progname, msg);- EXIT(1);- }-#else /* WANT_STDIO */- ERR1("mhs error: %s", msg);-#endif /* WANT_STDIO */-}--#if WANT_ARGS-heapoffs_t-memsize(const char *p)-{- heapoffs_t n = atoi(p);- while (isdigit(*p))- p++;- switch (*p) {- case 'k': case 'K': n *= 1000; break;- case 'm': case 'M': n *= 1000000; break;- case 'g': case 'G': n *= 1000000000; break;- default: break;- }- return n;-}-#endif--extern const uint8_t *combexpr;-extern const int combexprlen;--#if WANT_TICK-int dump_ticks = 0;-#endif--#if WANT_ARGS- #if WANT_STDIO- #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(a,b,c,d)- #else- #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(a,b)- #endif-#else /* WANT_ARGS */- #if WANT_STDIO- #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(c,d)- #else- #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args()- #endif-#endif /* WANT_ARGS */--NODEPTR-MHS_INIT_ARGS(- int argc, char **argv,- char **outnamep,- size_t *file_sizep-)-{- NODEPTR prog;-#if WANT_ARGS- char *inname = 0;- char **av;- char **gargv;- int gargc;- int inrts;-#endif--#if 0- /* MINGW doesn't do buffering right */- setvbuf(stdout, NULL, _IOLBF, BUFSIZ);- setvbuf(stderr, NULL, _IONBF, BUFSIZ);-#endif--#ifdef INITIALIZATION- main_setup(); /* Do platform specific start-up. */-#endif--#ifdef CLOCK_INIT- CLOCK_INIT();-#endif--#if WANT_SIGINT- {- (void)signal(SIGINT, handle_sigint);- sigset_t set;- sigemptyset(&set);- sigaddset(&set, SIGINT);- sigprocmask(SIG_UNBLOCK, &set, NULL);- }-#endif-- heap_size = HEAP_CELLS; /* number of heap cells */- stack_size = STACK_SIZE; /* number of stack slots */--#if WANT_ARGS- progname = argv[0];- argc--, argv++;- gargv = argv;- for (av = argv, inrts = 0; argc--; argv++) {- char *p = *argv;- if (inrts) {- if (strcmp(p, "-RTS") == 0) {- inrts = 0;- } else {- if (strcmp(p, "-v") == 0)- verbose++;-#if WANT_TICK- else if (strcmp(p, "-T") == 0)- dump_ticks = 1;-#endif- else if (strncmp(p, "-H", 2) == 0)- heap_size = memsize(&p[2]);- else if (strncmp(p, "-K", 2) == 0)- stack_size = memsize(&p[2]);- else if (strncmp(p, "-r", 2) == 0)- inname = &p[2];-#if WANT_STDIO- else if (strncmp(p, "-o", 2) == 0)- *outnamep = &p[2];- else if (strcmp(p, "-B") == 0)- gcbell++;-#endif /* WANT_STDIO */- else- ERR("Usage: eval [+RTS [-v] [-B] [-T] [-Hheap-size] [-Kstack-size] [-rFILE] [-oFILE] -RTS] arg ...");- }- } else {- if (strcmp(p, "+RTS") == 0) {- inrts = 1;- } else {- *av++ = p;- }- }- }- gargc = av - gargv;-- if (inname == 0)- inname = "out.comb";-#endif-- init_nodes();- stack = mmalloc(sizeof(NODEPTR) * stack_size);- CLEARSTK();- init_stableptr();-- num_reductions = 0;--#if WANT_ARGS- /* Initialize an IORef (i.e., single element IOArray- * to contain the list of program arguments.- * The 0th element is the program name, and the rest- * are the non RTS arguments.- */- {- NODEPTR n;- /* No GC checks, the heap is empty. */- n = mkNil();- for(int i = gargc-1; i >= 0; i--) {- n = mkCons(mkStringC(gargv[i]), n);- }- n = mkCons(mkStringC(progname), n);- argarray = arr_alloc(1, n); /* An IORef contains a single element array */- argarray->permanent = true; /* never GC the arguments, because a T_IO_GETARGREF can reach argarray */- }-#endif /* WANT_ARGS */-- {- /* Read the combinator code. */- BFILE *bf;- if (combexpr) {- /* The code is in memory, create a memore buffer BFILE */- bf = openb_rd_mem(combexpr, combexprlen);-#if WANT_STDIO- *file_sizep = combexprlen;-#endif- } else {-#if WANT_STDIO & WANT_ARGS- /* Open a regular file */- FILE *f = fopen(inname, "r");- if (!f)- ERR1("file not found %s", inname);- fseek(f, 0, SEEK_END);- *file_sizep = ftell(f); /* find its size */- rewind(f);-- bf = add_FILE(f);-#else- ERR("no stdio");-#endif- }- int c = getb(bf);-#if WANT_BASE64- /* Compressed combinators start with a 'z', otherwise 'v' (for version) */- if (c != 'z' && c != 'v') {- /* Neither z nor v, assume base64 encoded */- ungetb(c, bf);- bf = add_base64_decoder(bf);- c = getb(bf);- }-#endif- if (c == 'z') {- /* add LZ77 decompressor transducer */- bf = add_lzma_decompressor(bf);- } else {- /* put it back, we need it */- ungetb(c, bf);- }- prog = parse_top(bf, xffe_table);- closeb(bf);- }-- /* GC unused stuff, nice for -o */- PUSH(prog);- want_gc_red = 1;- gc();- gc(); /* this finds some more GC reductions */- want_gc_red = 0; /* can be enabled, but it is rarely a win */- prog = POPTOP();- return prog;-}--void-mhs_init(void)-{- char *args[2] = { "<mhs_init>", 0 };- char *outname;- size_t file_size;- (void)MHS_INIT_ARGS(1, args, &outname, &file_size);-}--int-mhs_main(int argc, char **argv)-{- NODEPTR prog;- char *outname = 0;- size_t file_size = 0;-#if WANT_KPERF- counter_t instrs;-#endif /* WANT_KPERF */-- prog = MHS_INIT_ARGS(argc, argv, &outname, &file_size);--#if WANT_STDIO- heapoffs_t start_size = num_marked;- if (outname) {- /* Save GCed file (smaller), and exit. */- FILE *out = fopen(outname, "w");- if (!out)- ERR1("cannot open output file %s", outname);- struct BFILE *bf = add_FILE(out);- printb(bf, prog, true);- closeb(bf);- EXIT(0);- }- if (verbose > 2) {- pp(stdout, prog);- }-#endif- run_time -= GETTIMEMILLI();--#if 0- topnode = &prog;-#endif-#if WANT_KPERF- if (!start_kperf()) {- // ERR("kperf init failed");-#if WANT_STDIO- fprintf(stderr, "start_kperf() failed, ignored\n");-#endif- }-#endif /* WANT_KPERF */- start_exec(prog);- /* Flush standard handles in case there is some BFILE buffering */- flushb((BFILE*)FORPTR(comb_stdout)->payload.string);- flushb((BFILE*)FORPTR(comb_stderr)->payload.string);- gc(); /* Run finalizers */-#if WANT_KPERF- instrs = end_kperf();-#endif /* WANT_KPERF */- run_time += GETTIMEMILLI();--#if WANT_STDIO- if (verbose) {- if (verbose > 1) {- PRINT("node size=%"PRIheap", heap size bytes=%"PRIheap"\n", (heapoffs_t)NODE_SIZE, heap_size * NODE_SIZE);- }- setlocale(LC_NUMERIC, "en_US"); /* Make %' work on platforms that support it */- PRINT("%"PCOMMA"15"PRIheap" combinator file size\n", (heapoffs_t)file_size);- PRINT("%"PCOMMA"15"PRIheap" cells at start\n", start_size);- PRINT("%"PCOMMA"15"PRIheap" cells heap size (%"PCOMMA""PRIheap" bytes)\n", heap_size, heap_size * NODE_SIZE);- PRINT("%"PCOMMA"15"PRIcounter" cells allocated (%"PCOMMA".1f Mbyte/s)\n", num_alloc, num_alloc * NODE_SIZE / ((double)run_time / 1000) / 1000000);- PRINT("%"PCOMMA"15"PRIcounter" GCs\n", num_gc);- PRINT("%"PCOMMA"15"PRIcounter" max cells used\n", max_num_marked);- PRINT("%"PCOMMA"15"PRIcounter" reductions (%"PCOMMA".1f Mred/s)\n", num_reductions, num_reductions / ((double)run_time / 1000) / 1000000);- PRINT("%"PCOMMA"15"PRIcounter" yields (%"PCOMMA""PRIcounter" resched)\n", num_yield, num_resched);- PRINT("%"PCOMMA"15"PRIcounter" array alloc\n", num_arr_alloc);- PRINT("%"PCOMMA"15"PRIcounter" array free\n", num_arr_free);- PRINT("%"PCOMMA"15"PRIcounter" foreign alloc\n", num_fin_alloc);- PRINT("%"PCOMMA"15"PRIcounter" foreign free\n", num_fin_free);- PRINT("%"PCOMMA"15"PRIcounter" bytestring alloc (max %"PCOMMA""PRIcounter")\n", num_bs_alloc, num_bs_alloc_max);- PRINT("%"PCOMMA"15"PRIcounter" bytestring alloc bytes (max %"PCOMMA""PRIcounter")\n", num_bs_bytes, num_bs_inuse_max);- PRINT("%"PCOMMA"15"PRIcounter" bytestring free\n", num_bs_free);- PRINT("%"PCOMMA"15"PRIcounter" thread create\n", num_thread_create-1);- PRINT("%"PCOMMA"15"PRIcounter" thread reap\n", num_thread_reap);- PRINT("%"PCOMMA"15"PRIcounter" stableptr alloc\n", num_stable_alloc);- PRINT("%"PCOMMA"15"PRIcounter" stableptr free\n", num_stable_free);- PRINT("%"PCOMMA"15"PRIcounter" weakptr alloc\n", num_new_weak);- PRINT("%"PCOMMA"15"PRIcounter" weakptr free\n", num_gc_weak);-#if MAXSTACKDEPTH- PRINT("%"PCOMMA"15d max stack depth\n", (int)max_stack_depth);- PRINT("%"PCOMMA"15d max C stack depth\n", (int)max_c_stack);-#endif- // PRINT("%"PCOMMA"15d avg gc stack depth\n", (int)(gc_tot / num_gc));- // PRINT("%"PCOMMA"15"PRIcounter" max mark depth\n", max_mark_depth);- PRINT("%15.2fs total expired time\n", (double)run_time / 1000);- PRINT("%15.2fs gc expired time = %3.1f%% (%.2fs mark + %.2fs scan)\n",- (double)(gc_mark_time + gc_scan_time) / 1000,- (double)(gc_mark_time + gc_scan_time) / (double)run_time * 100,- (double)gc_mark_time / 1000,- (double)gc_scan_time / 1000);-#if WANT_KPERF- if (instrs > 0) {- PRINT("%"PCOMMA"15"PRIcounter" instructions (%.1f instr/red)\n", instrs, (double)instrs / (double)num_reductions);- }-#endif /* WANT_KPERF */-#if GCRED- PRINT(" GC reductions A=%"PRIcounter", K=%"PRIcounter", I=%"PRIcounter", int=%"PRIcounter", flip=%"PRIcounter","- " BI=%"PRIcounter", BxI=%"PRIcounter", C'BxI=%"PRIcounter", CC=%"PRIcounter", C'I=%"PRIcounter", C'BBCP=%"PRIcounter"\n",- red_a, red_k, red_i, red_int, red_flip, red_bi, red_bxi, red_ccbi, red_cc, red_cci, red_ccbbcp);- PRINT(" special reductions B'=%"PRIcounter" K4=%"PRIcounter" K3=%"PRIcounter" K2=%"PRIcounter" C'B=%"PRIcounter", Z=%"PRIcounter", R=%"PRIcounter"\n",- red_bb, red_k4, red_k3, red_k2, red_ccb, red_z, red_r);-#endif- }-#endif /* WANT_STDIO */--#if WANT_TICK- if (dump_ticks) {- dump_tick_table(stdout);- }-#endif--#ifdef TEARDOWN- main_teardown(); /* do some platform specific teardown */-#endif- EXIT(0);-}--#if WANT_MD5-#include "md5.c"-#endif /* WANT_MD5 */--#if WANT_LZ77-#include "lz77.c"-#endif--/***************************/-/* Foreign export helpers */--void-ffe_push(NODEPTR n)-{- PUSH(n);-}--void-ffe_pop(void)-{- POP(1);-}--/* Allocate a new node (will be overwritten) */-stackptr_t-ffe_alloc(void)-{- PUSH(alloc_node(T_DBL));- return stack_ptr;-}--void-ffe_apply(void)-{- NODEPTR arg = POPTOP();- NODEPTR fun = POPTOP();- PUSH(new_ap(fun, arg));-}--/* For stand-alone exported functions this is called with the threading inactive.- * On the other hand, if a 'foreign import' calls back to a 'foreign export' the- * threading is alread running.- */-/* XXX This is not quite right. The surrounding mhs_to_xxx should be in the thread. */-stackptr_t-ffe_eval(void)-{- if (main_thread) {- /* threading active, run on current stack */- (void)evali(TOP(0));- } else {- /* start up the threading to evaluate the node */- start_exec(TOP(0));- }- /* The mhs_to_xxx functions bizarrely return the ARG(TOP(n+1)) value.- * The wrapper will call with n=-1, so we need to put the result at ARG(TOP(0))- */- TOP(0) = new_ap(combI, TOP(0));- return stack_ptr;-}--stackptr_t-ffe_exec(void)-{- NODEPTR n = POPTOP();- PUSH(new_ap(combPERFORMIO, n));- return ffe_eval();-}--/* apply_sp :: StablePtr (Ptr a -> IO (Ptr b)) -> Ptr a -> IO (Ptr b) */-void *-apply_sp(uvalue_t sp, void *arg)-{- GCCHECK(3);- NODEPTR f = deref_stableptr(sp);- NODEPTR a = alloc_node(T_PTR);- PTR(a) = arg;- PUSH(new_ap(combPERFORMIO, new_ap(f, a)));- void *r = evalptr(TOP(0));- POP(1);- return r;-}--/*********************/-/* FFI adapters */--#define MHS_FROM(name, set, type) \-from_t \-name(stackptr_t stk, int n, type x) \-{ \- NODEPTR r = TOP(0); /* The pre-allocated cell for the result, */ \- set(r, x); /* Put result in pre-allocated cell. */ \- return n; /* return arity */ \-}-#if WANT_FLOAT64-MHS_FROM(mhs_from_Double, SETDBL, flt64_t);-#endif-#if WANT_FLOAT32-MHS_FROM(mhs_from_Float, SETFLT, flt32_t);-#endif-MHS_FROM(mhs_from_Int, SETINT, value_t);-#if WANT_INT64-MHS_FROM(mhs_from_Int64, SETINT64, int64_t);-#endif-MHS_FROM(mhs_from_Word, SETINT, uvalue_t);-MHS_FROM(mhs_from_Word8, SETINT, uvalue_t);-#if WANT_INT64-MHS_FROM(mhs_from_Word64, SETINT64, uint64_t);-#endif-MHS_FROM(mhs_from_Ptr, SETPTR, void*);-MHS_FROM(mhs_from_ForPtr, SETFORPTR, struct forptr *);-MHS_FROM(mhs_from_FunPtr, SETFUNPTR, HsFunPtr);-MHS_FROM(mhs_from_CChar, SETINT, char);-MHS_FROM(mhs_from_CSChar, SETINT, signed char);-MHS_FROM(mhs_from_CUChar, SETINT, unsigned char);-MHS_FROM(mhs_from_CShort, SETINT, short);-MHS_FROM(mhs_from_CUShort, SETINT, unsigned short);-MHS_FROM(mhs_from_CInt, SETINT, int);-MHS_FROM(mhs_from_CUInt, SETINT, unsigned int);-MHS_FROM(mhs_from_CLong, SETINT, long);-MHS_FROM(mhs_from_CULong, SETINT, unsigned long);-MHS_FROM(mhs_from_CLLong, SETINT, long long);-MHS_FROM(mhs_from_CULLong, SETINT, unsigned long long);-MHS_FROM(mhs_from_CSize, SETINT, size_t);-#if WANT_TIME-MHS_FROM(mhs_from_CTime, SETINT, time_t);-#endif-// MHS_FROM(mhs_from_CSSize, SETINT, ssize_t);-MHS_FROM(mhs_from_CIntPtr, SETINT, intptr_t);-MHS_FROM(mhs_from_CUIntPtr, SETINT, uintptr_t);-from_t-mhs_from_Unit(stackptr_t stk, int n)-{- POP(1); /* return value cell */- PUSH(combUnit); /* push unit instead */- return n;-}--#define MHS_TO(name, eval, type) \-type name(stackptr_t stk, int n) \-{ \- return eval(ARG(TOP(n+1))); /* The stack has a reserved cell on top of the arguments */ \-}-#if WANT_FLOAT32-MHS_TO(mhs_to_Float, evalflt, flt32_t);-#endif-#if WANT_FLOAT64-MHS_TO(mhs_to_Double, evaldbl, flt64_t);-#endif-MHS_TO(mhs_to_Int, evalint, value_t);-#if WANT_INT64-MHS_TO(mhs_to_Int64, evalint64, int64_t);-#endif-MHS_TO(mhs_to_Word, evalint, uvalue_t);-MHS_TO(mhs_to_Word8, evalint, uint8_t);-#if WANT_INT64-MHS_TO(mhs_to_Word64, evalint64, uint64_t);-#endif-MHS_TO(mhs_to_Ptr, evalptr, void*);-MHS_TO(mhs_to_FunPtr, evalfunptr, HsFunPtr);-MHS_TO(mhs_to_CChar, evalint, char);-MHS_TO(mhs_to_CSChar, evalint, signed char);-MHS_TO(mhs_to_CUChar, evalint, unsigned char);-MHS_TO(mhs_to_CShort, evalint, short);-MHS_TO(mhs_to_CUShort, evalint, unsigned short);-MHS_TO(mhs_to_CInt, evalint, int);-MHS_TO(mhs_to_CUInt, evalint, unsigned int);-MHS_TO(mhs_to_CLong, evalint, long);-MHS_TO(mhs_to_CULong, evalint, unsigned long);-MHS_TO(mhs_to_CLLong, evalint, long long);-MHS_TO(mhs_to_CULLong, evalint, unsigned long long);-MHS_TO(mhs_to_CSize, evalint, size_t);-#if WANT_TIME-MHS_TO(mhs_to_CTime, evalint, time_t);-#endif-// MHS_TO(mhs_to_CSSize, evalint, ssize_t);-MHS_TO(mhs_to_CIntPtr, evalint, intptr_t);-MHS_TO(mhs_to_CUIntPtr, evalint, uintptr_t);--/* The rest of this file was generated by the compiler, with some minor edits with #if. */-from_t mhs_GETRAW(int s) { return mhs_from_Int(s, 0, GETRAW()); }-from_t mhs_GETTIMEMILLI(int s) { return mhs_from_Int(s, 0, GETTIMEMILLI()); }-#if WANT_MATH-#if WANT_FLOAT64-from_t mhs_acos(int s) { return mhs_from_Double(s, 1, acos(mhs_to_Double(s, 0))); }-from_t mhs_asin(int s) { return mhs_from_Double(s, 1, asin(mhs_to_Double(s, 0))); }-from_t mhs_atan(int s) { return mhs_from_Double(s, 1, atan(mhs_to_Double(s, 0))); }-from_t mhs_atan2(int s) { return mhs_from_Double(s, 2, atan2(mhs_to_Double(s, 0), mhs_to_Double(s, 1))); }-from_t mhs_cos(int s) { return mhs_from_Double(s, 1, cos(mhs_to_Double(s, 0))); }-from_t mhs_exp(int s) { return mhs_from_Double(s, 1, exp(mhs_to_Double(s, 0))); }-from_t mhs_log(int s) { return mhs_from_Double(s, 1, log(mhs_to_Double(s, 0))); }-from_t mhs_sin(int s) { return mhs_from_Double(s, 1, sin(mhs_to_Double(s, 0))); }-from_t mhs_sqrt(int s) { return mhs_from_Double(s, 1, sqrt(mhs_to_Double(s, 0))); }-from_t mhs_tan(int s) { return mhs_from_Double(s, 1, tan(mhs_to_Double(s, 0))); }-from_t mhs_scalbn(int s) { return mhs_from_Double(s, 2, scalbn(mhs_to_Double(s, 0), mhs_to_Int(s, 1))); }-#endif /* WANT_FLOAT64 */-#if WANT_FLOAT32-from_t mhs_acosf(int s) { return mhs_from_Float(s, 1, acosf(mhs_to_Float(s, 0))); }-from_t mhs_asinf(int s) { return mhs_from_Float(s, 1, asinf(mhs_to_Float(s, 0))); }-from_t mhs_atanf(int s) { return mhs_from_Float(s, 1, atanf(mhs_to_Float(s, 0))); }-from_t mhs_atan2f(int s) { return mhs_from_Float(s, 2, atan2f(mhs_to_Float(s, 0), mhs_to_Float(s, 1))); }-from_t mhs_cosf(int s) { return mhs_from_Float(s, 1, cosf(mhs_to_Float(s, 0))); }-from_t mhs_expf(int s) { return mhs_from_Float(s, 1, expf(mhs_to_Float(s, 0))); }-from_t mhs_logf(int s) { return mhs_from_Float(s, 1, logf(mhs_to_Float(s, 0))); }-from_t mhs_sinf(int s) { return mhs_from_Float(s, 1, sinf(mhs_to_Float(s, 0))); }-from_t mhs_sqrtf(int s) { return mhs_from_Float(s, 1, sqrtf(mhs_to_Float(s, 0))); }-from_t mhs_tanf(int s) { return mhs_from_Float(s, 1, tanf(mhs_to_Float(s, 0))); }-from_t mhs_scalbnf(int s) { return mhs_from_Float(s, 2, scalbnf(mhs_to_Float(s, 0), mhs_to_Int(s, 1))); }-#endif /* WANT_FLOAT32 */-#endif /* WANT_MATH */--#if defined(__EMSCRIPTEN__)-from_t mhs_js_debug(int s) { EM_ASM({ console.log(UTF8ToString($0)) }, mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }-from_t mhs_js_eval_run(int s) { EM_ASM({ eval(UTF8ToString($0)) }, mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }-from_t mhs_js_eval_call(int s) { return mhs_from_Ptr(s, 1, EM_ASM_PTR({ return stringToNewUTF8(JSON.stringify(eval(UTF8ToString($0)))) }, mhs_to_Ptr(s, 0))); }-from_t mhs_js_set_haskellCallback(int s) { EM_ASM({ _haskellCallback = $0 }, mhs_to_Int(s, 0)); return mhs_from_Unit(s, 1); }-#endif--#if WANT_STDIO-from_t mhs_add_FILE(int s) { return mhs_from_Ptr(s, 1, add_FILE(mhs_to_Ptr(s, 0))); }-from_t mhs_putchar(int s) { putchar(mhs_to_Int(s, 0)); return mhs_from_Unit(s, 1); } /* for debugging */-from_t mhs_fopen(int s) { return mhs_from_Ptr(s, 2, fopen(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }-from_t mhs_system(int s) { return mhs_from_Int(s, 1, system(mhs_to_Ptr(s, 0))); }-from_t mhs_tmpname(int s) { return mhs_from_Ptr(s, 2, TMPNAME(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }-from_t mhs_remove(int s) { return mhs_from_Int(s, 1, remove(mhs_to_Ptr(s, 0))); }-#endif /* WANT_STDIO */-#if WANT_FD-from_t mhs_add_fd(int s) { return mhs_from_Ptr(s, 1, add_fd(mhs_to_Int(s, 0))); }-from_t mhs_open(int s) { return mhs_from_Int(s, 3, open(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }-#endif /* WANT_FD */-#if WANT_BUF-from_t mhs_add_buf(int s) { return mhs_from_Ptr(s, 2, add_buf(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-#endif /* WANT_BUF */-#if WANT_CRLF-from_t mhs_add_crlf(int s) { return mhs_from_Ptr(s, 1, add_crlf(mhs_to_Ptr(s, 0))); }-#endif /* WANT_CRLF */-#if WANT_UTF8-from_t mhs_add_utf8(int s) { return mhs_from_Ptr(s, 1, add_utf8(mhs_to_Ptr(s, 0))); }-#endif /* WANT_UTF8 */-#if WANT_BASE64-from_t mhs_add_base64_encoder(int s) { return mhs_from_Ptr(s, 1, add_base64_encoder(mhs_to_Ptr(s, 0))); }-from_t mhs_add_base64_decoder(int s) { return mhs_from_Ptr(s, 1, add_base64_decoder(mhs_to_Ptr(s, 0))); }-#endif /* WANT_BASE64 */-from_t mhs_closeb(int s) { closeb(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }-from_t mhs_addr_closeb(int s) { return mhs_from_FunPtr(s, 0, (HsFunPtr)&closeb); }-from_t mhs_flushb(int s) { flushb(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }-from_t mhs_getb(int s) { return mhs_from_Int(s, 1, getb(mhs_to_Ptr(s, 0))); }-from_t mhs_putb(int s) { putb(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_ungetb(int s) { ungetb(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_openwrmem(int s) { return mhs_from_Ptr(s, 0, openb_wr_mem()); }-from_t mhs_openrdmem(int s) { return mhs_from_Ptr(s, 2, openb_rd_mem(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-from_t mhs_getmem(int s) { get_mem(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_readb(int s) { return mhs_from_Int(s, 3, readb(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Ptr(s, 2))); }-from_t mhs_writeb(int s) { return mhs_from_Int(s, 3, writeb(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Ptr(s, 2))); }--#if WANT_MD5-from_t mhs_md5Array(int s) { md5Array(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_md5BFILE(int s) { md5BFILE(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_md5String(int s) { md5String(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-#endif /* WANT_MD5 */--#if WANT_LZ77-from_t mhs_add_lz77_compressor(int s) { return mhs_from_Ptr(s, 1, add_lz77_compressor(mhs_to_Ptr(s, 0))); }-from_t mhs_add_lz77_decompressor(int s) { return mhs_from_Ptr(s, 1, add_lz77_decompressor(mhs_to_Ptr(s, 0))); }-from_t mhs_lz77c(int s) { return mhs_from_CSize(s, 3, lz77c(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1), mhs_to_Ptr(s, 2))); }-#endif /* WANT_LZ77 */--#if WANT_LZMA-from_t mhs_add_lzma_compressor(int s) { return mhs_from_Ptr(s, 1, add_lzma_compressor(mhs_to_Ptr(s, 0))); }-from_t mhs_add_lzma_decompressor(int s) { return mhs_from_Ptr(s, 1, add_lzma_decompressor(mhs_to_Ptr(s, 0))); }-#endif /* WANT_LZ77 */--#if WANT_RLE-from_t mhs_add_rle_compressor(int s) { return mhs_from_Ptr(s, 1, add_rle_compressor(mhs_to_Ptr(s, 0))); }-from_t mhs_add_rle_decompressor(int s) { return mhs_from_Ptr(s, 1, add_rle_decompressor(mhs_to_Ptr(s, 0))); }-#endif /* WANT_RLE */--#if WANT_BWT-from_t mhs_add_bwt_compressor(int s) { return mhs_from_Ptr(s, 1, add_bwt_compressor(mhs_to_Ptr(s, 0))); }-from_t mhs_add_bwt_decompressor(int s) { return mhs_from_Ptr(s, 1, add_bwt_decompressor(mhs_to_Ptr(s, 0))); }-#endif /* WANT_BWT */--from_t mhs_calloc(int s) { return mhs_from_Ptr(s, 2, calloc(mhs_to_CSize(s, 0), mhs_to_CSize(s, 1))); }-from_t mhs_realloc(int s) { return mhs_from_Ptr(s, 2, realloc(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1))); }-from_t mhs_free(int s) { free(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }-from_t mhs_addr_free(int s) { return mhs_from_FunPtr(s, 0, (HsFunPtr)&FREE); }-from_t mhs_iswindows(int s) { return mhs_from_Int(s, 0, iswindows()); }-from_t mhs_ismacos(int s) { return mhs_from_Int(s, 0, ismacos()); }-from_t mhs_islinux(int s) { return mhs_from_Int(s, 0, islinux()); }-from_t mhs_malloc(int s) { return mhs_from_Ptr(s, 1, MALLOC(mhs_to_CSize(s, 0))); }-from_t mhs_memcpy(int s) { memcpy(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_CSize(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_strlen(int s) { return mhs_from_CSize(s, 1, strlen(mhs_to_Ptr(s, 0))); }-from_t mhs_strcpy(int s) { strcpy(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_memmove(int s) { memmove(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_CSize(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_peekPtr(int s) { return mhs_from_Ptr(s, 1, peekPtr(mhs_to_Ptr(s, 0))); }-from_t mhs_peekWord(int s) { return mhs_from_Word(s, 1, peekWord(mhs_to_Ptr(s, 0))); }-from_t mhs_pokePtr(int s) { pokePtr(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_pokeWord(int s) { pokeWord(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }--from_t mhs_peek_uint8(int s) { return mhs_from_Word(s, 1, peek_uint8(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uint8(int s) { poke_uint8(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_uint16(int s) { return mhs_from_Word(s, 1, peek_uint16(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uint16(int s) { poke_uint16(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_uint32(int s) { return mhs_from_Word(s, 1, peek_uint32(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uint32(int s) { poke_uint32(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }-#if WANT_INT64-from_t mhs_peek_uint64(int s) { return mhs_from_Word64(s, 1, peek_uint64(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uint64(int s) { poke_uint64(mhs_to_Ptr(s, 0), mhs_to_Word64(s, 1)); return mhs_from_Unit(s, 2); }-#endif /* WANT_INT64 */--from_t mhs_peek_int8(int s) { return mhs_from_Int(s, 1, peek_int8(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_int8(int s) { poke_int8(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_int16(int s) { return mhs_from_Int(s, 1, peek_int16(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_int16(int s) { poke_int16(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_int32(int s) { return mhs_from_Int(s, 1, peek_int32(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_int32(int s) { poke_int32(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }-#if WANT_INT64-from_t mhs_peek_int64(int s) { return mhs_from_Int64(s, 1, peek_int64(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_int64(int s) { poke_int64(mhs_to_Ptr(s, 0), mhs_to_Int64(s, 1)); return mhs_from_Unit(s, 2); }-#endif /* WANT_INT64 */-from_t mhs_peek_char(int s) { return mhs_from_CChar(s, 1, peek_char(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_char(int s) { poke_char(mhs_to_Ptr(s, 0), mhs_to_CChar(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_schar(int s) { return mhs_from_CSChar(s, 1, peek_schar(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_schar(int s) { poke_schar(mhs_to_Ptr(s, 0), mhs_to_CSChar(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_uchar(int s) { return mhs_from_CUChar(s, 1, peek_uchar(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uchar(int s) { poke_uchar(mhs_to_Ptr(s, 0), mhs_to_CUChar(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_short(int s) { return mhs_from_CShort(s, 1, peek_short(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_short(int s) { poke_short(mhs_to_Ptr(s, 0), mhs_to_CShort(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_ushort(int s) { return mhs_from_CUShort(s, 1, peek_ushort(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_ushort(int s) { poke_ushort(mhs_to_Ptr(s, 0), mhs_to_CUShort(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_int(int s) { return mhs_from_CInt(s, 1, peek_int(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_int(int s) { poke_int(mhs_to_Ptr(s, 0), mhs_to_CInt(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_uint(int s) { return mhs_from_CUInt(s, 1, peek_uint(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_uint(int s) { poke_uint(mhs_to_Ptr(s, 0), mhs_to_CUInt(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_long(int s) { return mhs_from_CLong(s, 1, peek_long(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_long(int s) { poke_long(mhs_to_Ptr(s, 0), mhs_to_CLong(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_ulong(int s) { return mhs_from_CULong(s, 1, peek_ulong(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_ulong(int s) { poke_ulong(mhs_to_Ptr(s, 0), mhs_to_CULong(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_llong(int s) { return mhs_from_CLLong(s, 1, peek_llong(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_llong(int s) { poke_llong(mhs_to_Ptr(s, 0), mhs_to_CLLong(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_ullong(int s) { return mhs_from_CULLong(s, 1, peek_ullong(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_ullong(int s) { poke_ullong(mhs_to_Ptr(s, 0), mhs_to_CULLong(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_peek_size_t(int s) { return mhs_from_CSize(s, 1, peek_size_t(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_size_t(int s) { poke_size_t(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1)); return mhs_from_Unit(s, 2); }-#if WANT_FLOAT32-from_t mhs_peek_flt32(int s) { return mhs_from_Float(s, 1, peek_flt32(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_flt32(int s) { poke_flt32(mhs_to_Ptr(s, 0), mhs_to_Float(s, 1)); return mhs_from_Unit(s, 2); }-#endif /* WANT_FLOAT32 */-#if WANT_FLOAT64-from_t mhs_peek_flt64(int s) { return mhs_from_Double(s, 1, peek_flt64(mhs_to_Ptr(s, 0))); }-from_t mhs_poke_flt64(int s) { poke_flt64(mhs_to_Ptr(s, 0), mhs_to_Double(s, 1)); return mhs_from_Unit(s, 2); }-#endif /* WANT_FLOAT64 */-from_t mhs_sizeof_char(int s) { return mhs_from_Int(s, 0, sizeof(char)); }-from_t mhs_sizeof_short(int s) { return mhs_from_Int(s, 0, sizeof(short)); }-from_t mhs_sizeof_int(int s) { return mhs_from_Int(s, 0, sizeof(int)); }-from_t mhs_sizeof_llong(int s) { return mhs_from_Int(s, 0, sizeof(long long)); }-from_t mhs_sizeof_long(int s) { return mhs_from_Int(s, 0, sizeof(long)); }-from_t mhs_sizeof_size_t(int s) { return mhs_from_Int(s, 0, sizeof(size_t)); }-#if WANT_DIR-from_t mhs_closedir(int s) { return mhs_from_Int(s, 1, closedir(mhs_to_Ptr(s, 0))); }-from_t mhs_opendir(int s) { return mhs_from_Ptr(s, 1, opendir(mhs_to_Ptr(s, 0))); }-from_t mhs_readdir(int s) { return mhs_from_Ptr(s, 1, readdir(mhs_to_Ptr(s, 0))); }-from_t mhs_c_d_name(int s) { return mhs_from_Ptr(s, 1, ((struct dirent *)(mhs_to_Ptr(s, 0)))->d_name); }-from_t mhs_chdir(int s) { return mhs_from_Int(s, 1, chdir(mhs_to_Ptr(s, 0))); }-from_t mhs_mkdir(int s) { return mhs_from_Int(s, 2, MKDIR(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-from_t mhs_getcwd(int s) { return mhs_from_Ptr(s, 2, getcwd(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-from_t mhs_get_permissions(int s) { return mhs_from_Int(s, 1, get_permissions(mhs_to_Ptr(s, 0))); }-from_t mhs_set_permissions(int s) { return mhs_from_Int(s, 2, set_permissions(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-#endif /* WANT_DIR */-from_t mhs_getcpu(int s) { GETCPUTIME(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-#if WANT_ENV-from_t mhs_getenv(int s) { return mhs_from_Ptr(s, 1, getenv(mhs_to_Ptr(s, 0))); }-from_t mhs_environ(int s) { return mhs_from_Ptr(s, 0, environ); }-from_t mhs_unsetenv(int s) { return mhs_from_Int(s, 1, unsetenv(mhs_to_Ptr(s, 0))); }-from_t mhs_setenv(int s) { return mhs_from_Int(s, 3, setenv(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }-#endif /* WANT_ENV */--/* Use this to detect if we have (and want) GMP or not. */-from_t mhs_want_gmp(int s) { return mhs_from_Int(s, 0, WANT_GMP); }--#if WANT_GMP-void-free_mpz(void *p)-{- /* printf("free_mpz %p\n", p);*/- mpz_clear(p); /* free any extra storage */- FREE(p); /* and free the mpz itself */-}--/* Allocate an initialize a GMP integer */-struct forptr *-new_mpz(void)-{-#if 0- {- static int done = 0;- if (!done) {- printf("GMP\n");- done = 1;- }- }-#endif- mpz_ptr p = mmalloc(sizeof(*p));- mpz_init(p);- struct forptr *fp = mkForPtrP(p);- fp->finalizer->final = (HsFunPtr)free_mpz;- fp->finalizer->fptype = FP_MPZ;- /* printf("new_mpz %p %p\n", p, fp); */- return fp;-}--intptr_t-mpz_get_si_(mpz_t op)-{- intptr_t r = mpz_get_ui(op);- if (mpz_sgn(op) < 0) {- r = -r;- }- return r;-}--#if 0-void-print_mpz(mpz_ptr p)-{- mpz_out_str(stdout, 10, p);-}-#endif--#if WANT_INT64 && WORD_SIZE < 64-/* GMP lacks 64 bit support on 32 bit platforms */-void-mpz_init_set_ui64(mpz_t rop, uint64_t op)-{- mpz_init_set_ui(rop, op >> 32);- mpz_mul_2exp(rop, rop, 32);- mpz_add_ui(rop, rop, op & 0xffffffff);-}-void-mpz_init_set_si64(mpz_t rop, int64_t op)-{- if (op >= 0) {- mpz_init_set_ui64(rop, op);- } else {- mpz_init_set_ui64(rop, -op);- mpz_neg(rop, rop);- }-}-int64_t-mpz_get_si64(mpz_t op)-{- mpz_t t;- mpz_init_set(t, op);- mpz_tdiv_q_2exp(t, t, 32);- uint64_t hi = mpz_get_ui(t);- uint64_t lo = mpz_get_ui(op);- mpz_clear(t);- uint64_t r = (hi << 32) | lo;- if (mpz_sgn(op) < 0) {- r = -r;- }- return r;-}-#endif /* WANT_INT64 */-#if WORD_SIZE == 64-#define mpz_init_set_ui64 mpz_init_set_ui-#define mpz_init_set_si64 mpz_init_set_si-#define mpz_get_si64 mpz_get_si_-#endif--from_t mhs_new_mpz(int s) { return mhs_from_ForPtr(s, 0, new_mpz()); }--/* Stubs for GMP functions */-from_t mhs_mpz_abs(int s) { mpz_abs(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_add(int s) { mpz_add(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_and(int s) { mpz_and(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_cmp(int s) { return mhs_from_Int(s, 2, mpz_cmp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }-from_t mhs_mpz_get_d(int s) { return mhs_from_Double(s, 1, mpz_get_d(mhs_to_Ptr(s, 0))); }-from_t mhs_mpz_get_f(int s) { return mhs_from_Float(s, 1, (float)mpz_get_d(mhs_to_Ptr(s, 0))); }-from_t mhs_mpz_get_si(int s) { return mhs_from_Int(s, 1, mpz_get_si_(mhs_to_Ptr(s, 0))); }-from_t mhs_mpz_init_set_si(int s) { mpz_init_set_si(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_init_set_ui(int s) { mpz_init_set_ui(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_ior(int s) { mpz_ior(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_mul(int s) { mpz_mul(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_mul_2exp(int s) { mpz_mul_2exp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_neg(int s) { mpz_neg(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_popcount(int s) {- mpz_ptr a = mhs_to_Ptr(s, 0);- from_t r;- if (mpz_sgn(a) < 0) {- mpz_t neg_a;- mpz_init(neg_a);- mpz_neg(neg_a, a);- r = mhs_from_Int(s, 1, -mpz_popcount(neg_a));- mpz_clear(neg_a);- } else {- r = mhs_from_Int(s, 1, mpz_popcount(a));- }- return r;-}-from_t mhs_mpz_sub(int s) { mpz_sub(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_fdiv_q_2exp(int s) { mpz_fdiv_q_2exp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_tdiv_qr(int s) { mpz_tdiv_qr(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2), mhs_to_Ptr(s, 3)); return mhs_from_Unit(s, 4); }-from_t mhs_mpz_tstbit(int s) { return mhs_from_Int(s, 2, mpz_tstbit(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }-from_t mhs_mpz_xor(int s) { mpz_xor(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }-from_t mhs_mpz_init_set_si64(int s) { mpz_init_set_si64(mhs_to_Ptr(s, 0), mhs_to_Int64(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_init_set_ui64(int s) { mpz_init_set_ui64(mhs_to_Ptr(s, 0), mhs_to_Word64(s, 1)); return mhs_from_Unit(s, 2); }-from_t mhs_mpz_get_si64(int s) { return mhs_from_Int64(s, 1, mpz_get_si64(mhs_to_Ptr(s, 0))); }-from_t mhs_mpz_log2(int s) {- mpz_ptr a = mhs_to_Ptr(s, 0);- return mhs_from_Int(s, 1, mpz_sizeinbase(a, 2) - 1);-}-#endif /* WANT_GMP */-#if WANT_TIME-from_t mhs_gettimeofday(int s) { return mhs_from_Int(s, 2, gettimeofday(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }-#endif-from_t mhs_get_executable_path(int s) { return mhs_from_Ptr(s, 0, get_executable_path()); }--#if WANT_SOCKET-#include <sys/socket.h>-from_t mhs_F_SETFL(int s) { return mhs_from_Int(s, 0, F_SETFL); }-from_t mhs_O_NONBLOCK(int s) { return mhs_from_Int(s, 0, O_NONBLOCK); }-from_t mhs_SOL_SOCKET(int s) { return mhs_from_Int(s, 0, SOL_SOCKET); }-from_t mhs_SO_DEBUG(int s) { return mhs_from_Int(s, 0, SO_DEBUG); }-from_t mhs_SO_ERROR(int s) { return mhs_from_Int(s, 0, SO_ERROR); }-from_t mhs_SO_REUSEADDR(int s) { return mhs_from_Int(s, 0, SO_REUSEADDR); }-from_t mhs_SO_TYPE(int s) { return mhs_from_Int(s, 0, SO_TYPE); }-from_t mhs_accept(int s) { return mhs_from_Int(s, 3, accept(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2))); }-from_t mhs_bind(int s) { return mhs_from_Int(s, 3, bind(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }-from_t mhs_close(int s) { return mhs_from_Int(s, 1, close(mhs_to_Int(s, 0))); }-from_t mhs_connect(int s) { return mhs_from_Int(s, 3, connect(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }-from_t mhs_fcntl(int s) { return mhs_from_Int(s, 3, fcntl(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }-from_t mhs_getsockopt(int s) { return mhs_from_Int(s, 5, getsockopt(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2), mhs_to_Ptr(s, 3), mhs_to_Ptr(s, 4))); }-from_t mhs_listen(int s) { return mhs_from_Int(s, 2, listen(mhs_to_Int(s, 0), mhs_to_Int(s, 1))); }-from_t mhs_recv(int s) { return mhs_from_Int(s, 4, recv(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Word(s, 2), mhs_to_Int(s, 3))); }-from_t mhs_send(int s) { return mhs_from_Int(s, 4, send(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Word(s, 2), mhs_to_Int(s, 3))); }-from_t mhs_setsockopt(int s) { return mhs_from_Int(s, 5, setsockopt(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2), mhs_to_Ptr(s, 3), mhs_to_Int(s, 4))); }-from_t mhs_socket(int s) { return mhs_from_Int(s, 3, socket(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }-#endif /* WANT_SOCKET */--const struct ffi_entry ffi_table[] = {- { "GETRAW", 0, mhs_GETRAW},- { "GETTIMEMILLI", 0, mhs_GETTIMEMILLI},-#if WANT_MATH-#if WANT_FLOAT64- { "acos", 1, mhs_acos},- { "asin", 1, mhs_asin},- { "atan", 1, mhs_atan},- { "atan2", 2, mhs_atan2},- { "cos", 1, mhs_cos},- { "exp", 1, mhs_exp},- { "log", 1, mhs_log},- { "sin", 1, mhs_sin},- { "sqrt", 1, mhs_sqrt},- { "tan", 1, mhs_tan},- { "scalbn", 2, mhs_scalbn},- { "poke_flt64", 2, mhs_poke_flt64 },- { "peek_flt64", 1, mhs_peek_flt64 },-#endif /* WANT_FLOAT64 */-#if WANT_FLOAT32- { "acosf", 1, mhs_acosf},- { "asinf", 1, mhs_asinf},- { "atanf", 1, mhs_atanf},- { "atan2f", 2, mhs_atan2f},- { "cosf", 1, mhs_cosf},- { "expf", 1, mhs_expf},- { "logf", 1, mhs_logf},- { "sinf", 1, mhs_sinf},- { "sqrtf", 1, mhs_sqrtf},- { "tanf", 1, mhs_tanf},- { "scalbnf", 2, mhs_scalbnf},- { "poke_flt32", 2, mhs_poke_flt32 },- { "peek_flt32", 1, mhs_peek_flt32 },-#endif /* WANT_FLOAT32 */-#endif /* WANT_MATH */--#if defined(__EMSCRIPTEN__)- { "js_debug", 1, mhs_js_debug},- { "js_eval_run", 1, mhs_js_eval_run},- { "js_eval_call", 1, mhs_js_eval_call},- { "js_set_haskellCallback", 1, mhs_js_set_haskellCallback},-#endif--#if WANT_STDIO- { "add_FILE", 1, mhs_add_FILE},- { "putchar", 1, mhs_putchar},- { "fopen", 2, mhs_fopen},- { "tmpname", 2, mhs_tmpname},- { "remove", 1, mhs_remove},- { "system", 1, mhs_system},-#endif /* WANT_STDIO */-#if WANT_FD- { "add_fd", 1, mhs_add_fd},- { "open", 3, mhs_open},-#endif /* WANT_FD */-#if WANT_BUF- { "add_buf", 2, mhs_add_buf},-#endif /* WANT_BUF */-#if WANT_CRLF- { "add_crlf", 1, mhs_add_crlf},-#endif /* WANT_CRLF */-#if WANT_UTF8- { "add_utf8", 1, mhs_add_utf8},-#endif /* WANT_UTF8 */-#if WANT_BASE64- { "add_base64_encoder", 1, mhs_add_base64_encoder},- { "add_base64_decoder", 1, mhs_add_base64_decoder},-#endif /* WANT_BASE64 */- { "closeb", 1, mhs_closeb},- { "&closeb", 0, mhs_addr_closeb},- { "flushb", 1, mhs_flushb},- { "getb", 1, mhs_getb},- { "putb", 2, mhs_putb},- { "ungetb", 2, mhs_ungetb},- { "openb_wr_mem", 0, mhs_openwrmem},- { "openb_rd_mem", 2, mhs_openrdmem},- { "get_mem", 3, mhs_getmem},- { "readb", 3, mhs_readb},- { "writeb", 3, mhs_writeb},--#if WANT_MD5- { "md5Array", 3, mhs_md5Array},- { "md5BFILE", 2, mhs_md5BFILE},- { "md5String", 2, mhs_md5String},-#endif /* WANT_MD5 */--#if WANT_LZ77- { "add_lz77_compressor", 1, mhs_add_lz77_compressor},- { "add_lz77_decompressor", 1, mhs_add_lz77_decompressor},- { "lz77c", 3, mhs_lz77c},-#endif /* WANT_LZ77 */--#if WANT_LZMA- { "add_lzma_compressor", 1, mhs_add_lzma_compressor},- { "add_lzma_decompressor", 1, mhs_add_lzma_decompressor},-#endif /* WANT_LZ77 */--#if WANT_RLE- { "add_rle_compressor", 1, mhs_add_rle_compressor},- { "add_rle_decompressor", 1, mhs_add_rle_decompressor},-#endif /* WANT_RLE */--#if WANT_BWT- { "add_bwt_compressor", 1, mhs_add_bwt_compressor},- { "add_bwt_decompressor", 1, mhs_add_bwt_decompressor},-#endif /* WANT_RLE */-- { "calloc", 2, mhs_calloc},- { "realloc", 2, mhs_realloc},- { "free", 1, mhs_free},- { "&free", 0, mhs_addr_free},- { "iswindows", 0, mhs_iswindows},- { "ismacos", 0, mhs_ismacos},- { "islinux", 0, mhs_islinux},- { "malloc", 1, mhs_malloc},- { "memcpy", 3, mhs_memcpy},- { "memmove", 3, mhs_memmove},- { "strlen", 1, mhs_strlen},- { "strcpy", 2, mhs_strcpy},- { "peekPtr", 1, mhs_peekPtr},- { "peekWord", 1, mhs_peekWord},- { "pokePtr", 2, mhs_pokePtr},- { "pokeWord", 2, mhs_pokeWord},-- { "peek_uint8", 1, mhs_peek_uint8},- { "poke_uint8", 2, mhs_poke_uint8},- { "peek_uint16", 1, mhs_peek_uint16},- { "poke_uint16", 2, mhs_poke_uint16},- { "peek_uint32", 1, mhs_peek_uint32},- { "poke_uint32", 2, mhs_poke_uint32},-#if WANT_INT64- { "peek_uint64", 1, mhs_peek_uint64},- { "poke_uint64", 2, mhs_poke_uint64},-#endif /* WANT_INT64 */- { "peek_uint", 1, mhs_peek_uint},- { "poke_uint", 2, mhs_poke_uint},-- { "peek_int8", 1, mhs_peek_int8},- { "poke_int8", 2, mhs_poke_int8},- { "peek_int16", 1, mhs_peek_int16},- { "poke_int16", 2, mhs_poke_int16},- { "peek_int32", 1, mhs_peek_int32},- { "poke_int32", 2, mhs_poke_int32},-#if WANT_INT64- { "peek_int64", 1, mhs_peek_int64},- { "poke_int64", 2, mhs_poke_int64},-#endif /* WANT_INT64 */- { "peek_int", 1, mhs_peek_int},- { "poke_int", 2, mhs_poke_int},- { "peek_llong", 1, mhs_peek_llong},- { "peek_long", 1, mhs_peek_long},- { "peek_ullong", 1, mhs_peek_ullong},- { "peek_ulong", 1, mhs_peek_ulong},- { "peek_size_t", 1, mhs_peek_size_t},- { "poke_llong", 2, mhs_poke_llong},- { "poke_long", 2, mhs_poke_long},- { "poke_ullong", 2, mhs_poke_ullong},- { "poke_ulong", 2, mhs_poke_ulong},- { "poke_size_t", 2, mhs_poke_size_t},- { "sizeof_char", 0, mhs_sizeof_char},- { "sizeof_short", 0, mhs_sizeof_short},- { "sizeof_int", 0, mhs_sizeof_int},- { "sizeof_llong", 0, mhs_sizeof_llong},- { "sizeof_long", 0, mhs_sizeof_long},- { "sizeof_size_t", 0, mhs_sizeof_size_t},-#if WANT_DIR- { "c_d_name", 1, mhs_c_d_name},- { "closedir", 1, mhs_closedir},- { "opendir", 1, mhs_opendir},- { "readdir", 1, mhs_readdir},- { "chdir", 1, mhs_chdir},- { "mkdir", 2, mhs_mkdir},- { "getcwd", 2, mhs_getcwd},- { "set_permissions", 2, mhs_set_permissions},- { "get_permissions", 1, mhs_get_permissions},-#endif /* WANT_DIR */- { "getcpu", 2, mhs_getcpu},- { "want_gmp", 0, mhs_want_gmp},-#if WANT_GMP- { "new_mpz", 0, mhs_new_mpz},- { "mpz_abs", 2, mhs_mpz_abs},- { "mpz_add", 3, mhs_mpz_add},- { "mpz_and", 3, mhs_mpz_and},- { "mpz_cmp", 2, mhs_mpz_cmp},- { "mpz_get_d", 1, mhs_mpz_get_d},- { "mpz_get_si", 1, mhs_mpz_get_si},- { "mpz_init_set_si", 2, mhs_mpz_init_set_si},- { "mpz_init_set_ui", 2, mhs_mpz_init_set_ui},- { "mpz_ior", 3, mhs_mpz_ior},- { "mpz_mul", 3, mhs_mpz_mul},- { "mpz_mul_2exp", 3, mhs_mpz_mul_2exp},- { "mpz_neg", 2, mhs_mpz_neg},- { "mpz_popcount", 1, mhs_mpz_popcount},- { "mpz_sub", 3, mhs_mpz_sub},- { "mpz_fdiv_q_2exp", 3, mhs_mpz_fdiv_q_2exp},- { "mpz_tdiv_qr", 4, mhs_mpz_tdiv_qr},- { "mpz_tstbit", 2, mhs_mpz_tstbit},- { "mpz_xor", 3, mhs_mpz_xor},- { "mpz_get_f", 1, mhs_mpz_get_f},- { "mpz_init_set_si64", 2, mhs_mpz_init_set_si64},- { "mpz_init_set_ui64", 2, mhs_mpz_init_set_ui64},- { "mpz_get_si64", 1, mhs_mpz_get_si64},- { "mpz_log2", 1, mhs_mpz_log2},-#endif /* WANT_GMP */-#if WANT_TIME- { "gettimeofday", 2, mhs_gettimeofday},-#endif-#if WANT_ERRNO- { "E2BIG", 0, mhs_E2BIG},- { "EACCES", 0, mhs_EACCES},- { "EADDRINUSE", 0, mhs_EADDRINUSE},- { "EADDRNOTAVAIL", 0, mhs_EADDRNOTAVAIL},- { "EADV", 0, mhs_EADV},- { "EAFNOSUPPORT", 0, mhs_EAFNOSUPPORT},- { "EAGAIN", 0, mhs_EAGAIN},- { "EALREADY", 0, mhs_EALREADY},- { "EBADF", 0, mhs_EBADF},- { "EBADMSG", 0, mhs_EBADMSG},- { "EBADRPC", 0, mhs_EBADRPC},- { "EBUSY", 0, mhs_EBUSY},- { "ECHILD", 0, mhs_ECHILD},- { "ECOMM", 0, mhs_ECOMM},- { "ECONNABORTED", 0, mhs_ECONNABORTED},- { "ECONNREFUSED", 0, mhs_ECONNREFUSED},- { "ECONNRESET", 0, mhs_ECONNRESET},- { "EDEADLK", 0, mhs_EDEADLK},- { "EDESTADDRREQ", 0, mhs_EDESTADDRREQ},- { "EDIRTY", 0, mhs_EDIRTY},- { "EDOM", 0, mhs_EDOM},- { "EDQUOT", 0, mhs_EDQUOT},- { "EEXIST", 0, mhs_EEXIST},- { "EFAULT", 0, mhs_EFAULT},- { "EFBIG", 0, mhs_EFBIG},- { "EFTYPE", 0, mhs_EFTYPE},- { "EHOSTDOWN", 0, mhs_EHOSTDOWN},- { "EHOSTUNREACH", 0, mhs_EHOSTUNREACH},- { "EIDRM", 0, mhs_EIDRM},- { "EILSEQ", 0, mhs_EILSEQ},- { "EINPROGRESS", 0, mhs_EINPROGRESS},- { "EINTR", 0, mhs_EINTR},- { "EINVAL", 0, mhs_EINVAL},- { "EIO", 0, mhs_EIO},- { "EISCONN", 0, mhs_EISCONN},- { "EISDIR", 0, mhs_EISDIR},- { "ELOOP", 0, mhs_ELOOP},- { "EMFILE", 0, mhs_EMFILE},- { "EMLINK", 0, mhs_EMLINK},- { "EMSGSIZE", 0, mhs_EMSGSIZE},- { "EMULTIHOP", 0, mhs_EMULTIHOP},- { "ENAMETOOLONG", 0, mhs_ENAMETOOLONG},- { "ENETDOWN", 0, mhs_ENETDOWN},- { "ENETRESET", 0, mhs_ENETRESET},- { "ENETUNREACH", 0, mhs_ENETUNREACH},- { "ENFILE", 0, mhs_ENFILE},- { "ENOBUFS", 0, mhs_ENOBUFS},- { "ENODATA", 0, mhs_ENODATA},- { "ENODEV", 0, mhs_ENODEV},- { "ENOENT", 0, mhs_ENOENT},- { "ENOEXEC", 0, mhs_ENOEXEC},- { "ENOLCK", 0, mhs_ENOLCK},- { "ENOLINK", 0, mhs_ENOLINK},- { "ENOMEM", 0, mhs_ENOMEM},- { "ENOMSG", 0, mhs_ENOMSG},- { "ENONET", 0, mhs_ENONET},- { "ENOPROTOOPT", 0, mhs_ENOPROTOOPT},- { "ENOSPC", 0, mhs_ENOSPC},- { "ENOSR", 0, mhs_ENOSR},- { "ENOSTR", 0, mhs_ENOSTR},- { "ENOSYS", 0, mhs_ENOSYS},- { "ENOTBLK", 0, mhs_ENOTBLK},- { "ENOTCONN", 0, mhs_ENOTCONN},- { "ENOTDIR", 0, mhs_ENOTDIR},- { "ENOTEMPTY", 0, mhs_ENOTEMPTY},- { "ENOTSOCK", 0, mhs_ENOTSOCK},- { "ENOTSUP", 0, mhs_ENOTSUP},- { "ENOTTY", 0, mhs_ENOTTY},- { "ENXIO", 0, mhs_ENXIO},- { "EOPNOTSUPP", 0, mhs_EOPNOTSUPP},- { "EPERM", 0, mhs_EPERM},- { "EPFNOSUPPORT", 0, mhs_EPFNOSUPPORT},- { "EPIPE", 0, mhs_EPIPE},- { "EPROCLIM", 0, mhs_EPROCLIM},- { "EPROCUNAVAIL", 0, mhs_EPROCUNAVAIL},- { "EPROGMISMATCH", 0, mhs_EPROGMISMATCH},- { "EPROGUNAVAIL", 0, mhs_EPROGUNAVAIL},- { "EPROTO", 0, mhs_EPROTO},- { "EPROTONOSUPPORT", 0, mhs_EPROTONOSUPPORT},- { "EPROTOTYPE", 0, mhs_EPROTOTYPE},- { "ERANGE", 0, mhs_ERANGE},- { "EREMCHG", 0, mhs_EREMCHG},- { "EREMOTE", 0, mhs_EREMOTE},- { "EROFS", 0, mhs_EROFS},- { "ERPCMISMATCH", 0, mhs_ERPCMISMATCH},- { "ERREMOTE", 0, mhs_ERREMOTE},- { "ESHUTDOWN", 0, mhs_ESHUTDOWN},- { "ESOCKTNOSUPPORT", 0, mhs_ESOCKTNOSUPPORT},- { "ESPIPE", 0, mhs_ESPIPE},- { "ESRCH", 0, mhs_ESRCH},- { "ESRMNT", 0, mhs_ESRMNT},- { "ESTALE", 0, mhs_ESTALE},- { "ETIME", 0, mhs_ETIME},- { "ETIMEDOUT", 0, mhs_ETIMEDOUT},- { "ETOOMANYREFS", 0, mhs_ETOOMANYREFS},- { "ETXTBSY", 0, mhs_ETXTBSY},- { "EUSERS", 0, mhs_EUSERS},- { "EWOULDBLOCK", 0, mhs_EWOULDBLOCK},- { "EXDEV", 0, mhs_EXDEV},- { "&errno", 0, mhs_addr_errno},- { "strerror_r", 3, mhs_strerror_r},-#endif- { "get_executable_path", 0, mhs_get_executable_path},-#if WANT_ENV- { "getenv", 1, mhs_getenv},- { "environ", 0, mhs_environ},- { "unsetenv", 1, mhs_unsetenv},- { "setenv", 3, mhs_setenv},-#endif /* WANT_ENV */-#if WANT_SOCKET- { "F_SETFL", 0, mhs_F_SETFL},- { "O_NONBLOCK", 0, mhs_O_NONBLOCK},- { "SOL_SOCKET", 0, mhs_SOL_SOCKET},- { "SO_DEBUG", 0, mhs_SO_DEBUG},- { "SO_ERROR", 0, mhs_SO_ERROR},- { "SO_REUSEADDR", 0, mhs_SO_REUSEADDR},- { "SO_TYPE", 0, mhs_SO_TYPE},- { "accept", 3, mhs_accept},- { "bind", 3, mhs_bind},- { "close", 1, mhs_close},- { "connect", 3, mhs_connect},- { "fcntl", 3, mhs_fcntl},- { "getsockopt", 5, mhs_getsockopt},- { "listen", 2, mhs_listen},- { "recv", 4, mhs_recv},- { "send", 4, mhs_send},- { "setsockopt", 5, mhs_setsockopt},- { "socket", 3, mhs_socket},-#endif /* WANT_SOCKET */- { 0,0 }-};--int num_ffi = sizeof(ffi_table) / sizeof(ffi_table[0]);----/*******************************/-/* HsFFI.h API */--void-hs_init(int *argc, char **argv[])-{- (void)mhs_main(*argc, *argv);-}--void-hs_exit(void)-{+#if !defined(EXTRASANITY)+#define EXTRASANITY 0 /* sanity checks that cost time, unlike SANITY */+#endif++/* Extra asserts for debugging */+#if EXTRASANITY+#if WANT_STDIO+#define XASSERT(p) do { if (!(p)) { fprintf(stderr, "XASSERT line %d: %s\n", __LINE__, #p); exit(1); } } while(0)+#else+#define XASSERT(p) do { if (!(p)) { ERR("XASSERT"); } } while(0)+#endif+#else+#define XASSERT(p) ((void)0)+#endif++//#define ROUND_UP(x, d) ((((x) + (d) - 1) / (d)) * (d))++#if !defined(WANT_GMP)+#define WANT_GMP 0+#endif /* defined(WANT_GMP) */++#if !defined(WANT_IMATH) && !WANT_GMP+#define WANT_IMATH 1+#endif /* defined(WANT_MATH) */++#if WANT_GMP && WANT_IMATH+#error "Cannot have both WANT_GMP and WANT_IMATH"+#endif++#if !defined(WANT_OVERFLOW)+#define WANT_OVERFLOW 0+#endif /* defined(WANT_OVERFLOW) */++#if !defined(WANT_IO_POLL)+#define WANT_IO_POLL 0+#endif /* defined(WANT_IO_POLL) */++#if !defined(WANT_SOCKET)+#define WANT_SOCKET 0+#endif /* defined(WANT_SOCKET) */++#if WANT_STDIO+#include <stdio.h>+#include <stdarg.h>+#include <locale.h>+#endif+#include <stdlib.h>+#include <limits.h>+#include <string.h>+#include <ctype.h>+#include <setjmp.h>+#if WANT_MATH+#include <math.h>+#endif /* WANT_MATH */+#if defined(__EMSCRIPTEN__)+#include "emscripten.h"+#ifndef EM_ASM_PTR+#define EM_ASM_PTR(...) (void*)(uintptr_t)EM_ASM_INT(__VA_ARGS__)+#endif+#endif /* __EMSCRIPTEN__ */+#if WANT_DIR+#include <sys/stat.h>+#include <sys/types.h>+#endif /* WANT_DIR */+#if WANT_TIME+#include <time.h>+#endif+#if WANT_GMP+#include <gmp.h>+#endif /* WANT_GMP */+#if WANT_IMATH+#include "imgmp.h"+#endif /* WANT_IMATH */+#if WANT_SIGINT+#include <signal.h>+#endif+#if WANT_IO_POLL+#include <poll.h>+#endif++extern char **environ; /* should probably be behind some WANT_ */++#if WANT_MD5+#include "md5.h"+#endif++#if !defined(WANT_UTF8)+#define WANT_UTF8 1+#endif++#if !defined(WANT_BUF)+#define WANT_BUF 1+#endif++#if !defined(WANT_CRLF)+#define WANT_CRLF 1+#endif++#if !defined(WANT_BASE64)+#define WANT_BASE64 1+#endif++#if !defined(WANT_LZ77)+#define WANT_LZ77 1+#endif++#if !defined(WANT_LZMA)+#define WANT_LZMA 1+#endif++#if !defined(WANT_RLE)+#define WANT_RLE 1+#endif++#if !defined(WANT_BWT)+#define WANT_BWT 1+#endif++#if !defined(WANT_ENV)+#define WANT_ENV 1+#endif++#if !defined(WANT_ERRNO)+#define WANT_ERRNO 0+#else+#include "ffi_errno.c"+#endif++#if !defined(GET_EXECUTABLE_PATH)+char *get_executable_path(void) { return NULL; }+#endif++#if !defined(YIELD_EXTRA)+#define YIELD_EXTRA do {} while(0)+#endif++#if !defined(MKDIR)+#define MKDIR mkdir+#endif++#if WANT_LZ77+size_t lz77d(uint8_t *src, size_t srclen, uint8_t **bufp);+size_t lz77c(uint8_t *src, size_t srclen, uint8_t **bufp);+#endif++const struct ffi_entry ffi_table[];+int num_ffi;+#define FFI_IX(i) ((i) < num_ffi ? ffi_table[i] : xffi_table[i - num_ffi])++#if WANT_STDIO+#define THREAD_DEBUG 1+#else+#define THREAD_DEBUG 0+#endif+++#define VERSION "v9.3\n"++#define PRIvalue PRIdPTR+#define PRIuvalue PRIuPTR+typedef uintptr_t heapoffs_t; /* Heap offsets */+#define PRIheap PRIuPTR++typedef uintptr_t counter_t; /* Statistics counter, can be smaller since overflow doesn't matter */+#define PRIcounter PRIuPTR+typedef uintptr_t bits_t; /* One word of bits */++#if !defined(WANT_ARGS)+#define WANT_ARGS 1+#endif++#if !defined(MALLOC)+#define MALLOC malloc+#endif++#if !defined(REALLOC)+#define REALLOC realloc+#endif++#if !defined(CALLOC)+#define CALLOC calloc+#endif++#if !defined(FREE)+#define FREE free+#endif++#if !defined(EXIT)+#define EXIT exit+#endif++#if !defined(PRINT)+#define PRINT printf+#endif++#if !defined(PCOMMA)+#define PCOMMA "'"+#endif /* !defined(PCOMMA) */++#if !defined(GETRAW)+int GETRAW(void) { return -1; }+#endif /* !defined(GETRAW) */++#if !defined(GETTIMEMICRO)+value_t GETTIMEMICRO(void) { return 0; }+#endif /* !define(GETTIMEMICRO) */+#define GETTIMEMILLI() (GETTIMEMICRO() / 1000)++#if !defined(GETCPUTIME)+void GETCPUTIME(long *sec, long *nsec) { *sec = 0; *nsec = 0; }+#endif /* !define(GETCPUTIME) */++#if !defined(INLINE)+#define INLINE inline+#endif /* !define(INLINE) */++#if !defined(NOINLINE)+#if defined(__GNUC__) || defined(__clang__)+#define NOINLINE __attribute__((noinline))+#else+#define NOINLINE+#endif+#endif /* !defined(NOINLINE) */++#if !defined(ALWAYS_INLINE)+#if defined(__GNUC__) || defined(__clang__)+#define ALWAYS_INLINE inline __attribute__((always_inline))+#else+#define ALWAYS_INLINE inline+#endif+#endif /* !defined(ALWAYS_INLINE) */++#if !defined(UNLIKELY)+#if defined(__GNUC__) || defined(__clang__)+#define UNLIKELY(x) __builtin_expect(!!(x), 0)+#else+#define UNLIKELY(x) (x)+#endif+#endif /* !defined(UNLIKELY) */++#if !defined(NORETURN)+/*#define NORETURN [[noreturn]]*/+#define NORETURN _Noreturn+#endif /* !defined(NORETURN) */++#if !defined(PACKED)+#if WORD_SIZE == 32+/* Avoid 64 bit alignment to keep nodes to 12 bytes */+#define PACKED __attribute__((packed, aligned(4)))+#else+#define PACKED+#endif /* WORD_SIZE == 32 */+#endif /* !defined(PACKED) */++/* tcc doesn't understand noreturn attribute */+#if defined(__TCC__)+#define NOTREACHED return 0+#else+#define NOTREACHED+#endif++#if !defined(SLICE)+#define SLICE 100000+#endif++NORETURN void memerr(void);++void *+mmalloc(size_t s)+{+ if (s == 0) s = 1; /* avoid malloc() returning NULL */+ void *p = MALLOC(s);+ if (!p)+ memerr();+ return p;+}++void *+mrealloc(void *q, size_t s)+{+ if (s == 0) s = 1; /* avoid realloc() returning NULL */+ void *p = REALLOC(q, s);+ if (!p)+ memerr();+ return p;+}++void *+mcalloc(size_t n, size_t s)+{+ if (n * s == 0) n = s = 1; /* avoid calloc() returning NULL */+ void *p = CALLOC(n, s);+ if (!p)+ memerr();+ return p;+}++#if !defined(ERR)+#if WANT_STDIO+static NORETURN NOINLINE void+mhs_err(const char *s)+{+ fprintf(stderr, "ERR: %s\n", s);+ EXIT(1);+}+#if defined(__GNUC__) || defined(__clang__)+__attribute__((format(printf, 1, 2)))+#endif+static NORETURN NOINLINE void+mhs_err1(const char *fmt, ...)+{+ va_list ap;+ va_start(ap, fmt);+ vfprintf(stderr, fmt, ap);+ va_end(ap);+ EXIT(1);+}+#define ERR(s) mhs_err(s)+#define ERR1(s,a) mhs_err1("ERR: " s "\n", (a))+#else /* WANT_STDIO */+#define ERR(s) EXIT(1)+#define ERR1(s,a) EXIT(1)+#endif /* WANT_STDIO */+#endif /* !define(ERR) */++#if !defined(TMPNAME)+/* This is a really bad implementation, since it doesn't check for anything. */+char* TMPNAME(const char* pre, const char* suf) {+ ERR("no TMPNAME");+}+#endif++#if !defined(FFS)+/* This is pretty bad, could use deBruijn multiplication instead. */+int+FFS(bits_t x)+{+ int i;+ if (!x)+ return 0;+ for(i = 1; !(x & 1); x >>= 1, i++)+ ;+ return i;+}+#endif /* !defined(FFS) */++/***** popcount *****/+#if defined(__has_builtin)++#if UINTPTR_MAX == ULONG_MAX && __has_builtin(__builtin_popcountl)+#define BUILTIN_POPCOUNT __builtin_popcountl+#elif UINTPTR_MAX == ULLONG_MAX && __has_builtin(__builtin_popcountll)+#define BUILTIN_POPCOUNT __builtin_popcountll+#elif UINTPTR_MAX == UINT_MAX && __has_builtin(__builtin_popcount)+#define BUILTIN_POPCOUNT __builtin_popcount+#endif++#if ULLONG_MAX == UINT64_MAX && __has_builtin(__builtin_popcountll)+#define BUILTIN_POPCOUNT64 __builtin_popcountll+#elif ULONG_MAX == UINT64_MAX && __has_builtin(__builtin_popcountl)+#define BUILTIN_POPCOUNT64 __builtin_popcountl+#endif++/* If there are compiler intrinsics to detect overflow, do so */+#if __has_builtin(__builtin_add_overflow) && WANT_OVERFLOW+#define ADD_OVERFLOW(T, r, a, b, ovf) do { T vr; if (__builtin_add_overflow((T)(a), (T)(b), &(vr))) ovf(exn_overflow); (r) = vr; } while(0)+#endif+#if __has_builtin(__builtin_sub_overflow) && WANT_OVERFLOW+#define SUB_OVERFLOW(T, r, a, b, ovf) do { T vr; if (__builtin_sub_overflow((T)(a), (T)(b), &(vr))) ovf(exn_overflow); (r) = vr; } while(0)+#endif+#if __has_builtin(__builtin_mul_overflow) && WANT_OVERFLOW+#define MUL_OVERFLOW(T, r, a, b, ovf) do { T vr; if (__builtin_mul_overflow((T)(a), (T)(b), &(vr))) ovf(exn_overflow); (r) = vr; } while(0)+#endif++#endif++/* If we can't detect overflow, just ignore it. */+#if !defined(ADD_OVERFLOW)+#define ADD_OVERFLOW(T, r, a, b, ovf) ((r) = (a) + (b))+#endif+#if !defined(SUB_OVERFLOW)+#define SUB_OVERFLOW(T, r, a, b, ovf) ((r) = (a) - (b))+#endif+#if !defined(MUL_OVERFLOW)+#define MUL_OVERFLOW(T, r, a, b, ovf) ((r) = (a) * (b))+#endif+++#if !defined(POPCOUNT)+uvalue_t POPCOUNT(uvalue_t x) {+#if defined(BUILTIN_POPCOUNT)+ return BUILTIN_POPCOUNT(x);+#else /* !defined(BUILTIN_POPCOUNT) */+ uvalue_t count = 0;+ while (x) {+ x = x & (x - 1); // clear lowest 1 bit+ count++;+ }+ return count;+#endif /* !defined(BUILTIN_POPCOUNT) */+}+#endif /* !defined(POPCOUNT) */++#if !defined(POPCOUNT64)+uvalue_t POPCOUNT64(uint64_t x) {+#if defined(BUILTIN_POPCOUNT64)+ return BUILTIN_POPCOUNT64(x);+#else /* !defined(BUILTIN_POPCOUNT64) */+ uvalue_t count = 0;+ while (x) {+ x = x & (x - 1); // clear lowest 1 bit+ count++;+ }+ return count;+#endif /* !defined(BUILTIN_POPCOUNT64) */+}+#endif /* !defined(POPCOUNT64) */+/***** end popcount *****/++/***** clz *****/+#if defined(__has_builtin)++#if UINTPTR_MAX == ULONG_MAX && __has_builtin(__builtin_clzl)+#define BUILTIN_CLZ __builtin_clzl+#elif UINTPTR_MAX == ULLONG_MAX && __has_builtin(__builtin_clzll)+#define BUILTIN_CLZ __builtin_clzll+#elif UINTPTR_MAX == UINT_MAX && __has_builtin(__builtin_clz)+#define BUILTIN_CLZ __builtin_clz+#endif++#if ULLONG_MAX == UINT64_MAX && __has_builtin(__builtin_clzll)+#define BUILTIN_CLZ64 __builtin_clzll+#elif ULONG_MAX == UINT64_MAX && __has_builtin(__builtin_clzl)+#define BUILTIN_CLZ64 __builtin_clzl+#endif++#endif+++#if !defined(CLZ)+uvalue_t CLZ(uvalue_t x) {+#if defined(BUILTIN_CLZ)+ if (x == 0) return WORD_SIZE;+ return BUILTIN_CLZ(x);+#else /* defined(BUILTIN_CLZ) */+ value_t count = WORD_SIZE;+ while (x) {+ x = x >> 1;+ count--;+ }+ return count;+#endif /* defined(BUILTIN_CLZ) */+}+#endif /* !defined(CLZ) */++#if !defined(CLZ64)+uvalue_t CLZ64(uint64_t x) {+#if defined(BUILTIN_CLZ64)+ if (x == 0) return 64;+ return BUILTIN_CLZ64(x);+#else /* defined(BUILTIN_CLZ64) */+ value_t count = 64;+ while (x) {+ x = x >> 1;+ count--;+ }+ return count;+#endif /* defined(BUILTIN_CLZ64) */+}+#endif /* !defined(CLZ64) */+/***** end clz *****/++/***** ctz *****/+#if defined(__has_builtin)++#if UINTPTR_MAX == ULONG_MAX && __has_builtin(__builtin_ctzl)+#define BUILTIN_CTZ __builtin_ctzl+#elif UINTPTR_MAX == ULLONG_MAX && __has_builtin(__builtin_ctzll)+#define BUILTIN_CTZ __builtin_ctzll+#elif UINTPTR_MAX == UINT_MAX && __has_builtin(__builtin_ctz)+#define BUILTIN_CTZ __builtin_ctz+#endif++#if ULLONG_MAX == UINT64_MAX && __has_builtin(__builtin_ctzll)+#define BUILTIN_CTZ64 __builtin_ctzll+#elif ULONG_MAX == UINT64_MAX && __has_builtin(__builtin_ctzl)+#define BUILTIN_CTZ64 __builtin_ctzl+#endif++#endif /* defined(__has_builtin) */+++#if !defined(CTZ)+uvalue_t CTZ(uvalue_t x) {+ if (x == 0) return WORD_SIZE;+#if defined(BUILTIN_CTZ)+ return BUILTIN_CTZ(x);+#else /* defined(BUILTIN_CTZ) */+ uvalue_t count = 0;+ while ((x & 1) == 0) {+ x = x >> 1;+ count += 1;+ }+ return count;+#endif /* defined(BUILTIN_CTZ) */+}+#endif /* !defined(CTZ) */++#if !defined(CTZ64)+uvalue_t CTZ64(uint64_t x) {+ if (x == 0) return 64;+#if defined(BUILTIN_CTZ64)+ return BUILTIN_CTZ64(x);+#else /* defined(BUILTIN_CTZ64) */+ uvalue_t count = 0;+ while ((x & 1) == 0) {+ x = x >> 1;+ count++;+ }+ return count;+#endif /* defined(BUILTIN_CTZ64) */+}+#endif /* !defined(CTZ) */++/***** end ctz *****/++#if !defined(COUNT)+#define COUNT(n) ++(n)+#endif++value_t+iswindows(void)+{+#if defined(ISWINDOWS)+ return 1;+#else+ return 0;+#endif+}++/* Was the runtime compiled with MinGW (rather than, e.g., cl)? */+value_t+ismingw(void)+{+#if defined(__MINGW32__)+ return 1;+#else+ return 0;+#endif+}++value_t+ismacos(void)+{+#if defined(ISMACOS)+ return 1;+#else+ return 0;+#endif+}++value_t+islinux(void)+{+#if defined(ISLINUX)+ return 1;+#else+ return 0;+#endif+}++/***************************************/++/* Keep permanent nodes for LOW_INT <= i < HIGH_INT */+#define LOW_INT (-10)+#define HIGH_INT 256++#if !defined(HEAP_CELLS)+#define HEAP_CELLS 50000000+#endif++#if !defined(STACK_SIZE)+#define STACK_SIZE 300000+#endif++/***************************************/++/* All node tags for nodes with a payload */++enum node_tag { D_NONE,+ X_AP, /* if we need to indicate an AP node */++ /* NODEPTR with a "virtual" pointer, and special tags */+ D_IND, /* indirection, pointer payload */+ /* Tags with a payload */+ D_INT, D_INT64, D_DBL, D_FLT32, D_PTR, D_FUNPTR, D_FORPTR,+ D_ARR, D_THID, D_MVAR, D_WEAK,+ D_IO_CCALL,+ D_BADDYN, D_TICK,++ /* Tags with extra info */+ V_CONSTR, V_TAG, V_CASED, V_LOOKD, V_CASES, V_LOOKS,++ T_FIRST_REAL_TAG,+ /* NODEPTR with a "virtual" pointer, and regular tags */+ /* Regular tags */+ T_S, T_K, T_I, T_B, T_C,+ T_A, T_Y, T_SS, T_BB, T_CC, T_P, T_R, T_O, T_U, T_Z,+ T_K2, T_K3, T_K4, T_CCB,+ T_ADD, T_SUB, T_MUL, T_QUOT, T_REM, T_SUBR,+ T_UADD, T_USUB, T_UMUL, T_UQUOT, T_UREM, T_USUBR,+ T_AND, T_OR, T_XOR, T_SHL, T_SHR, T_ASHR,+ T_EQ, T_NE, T_LT, T_LE, T_GT, T_GE, T_ULT, T_ULE, T_UGT, T_UGE, T_ICMP, T_UCMP,+ T_NEG, T_UNEG, T_INV, T_POPCOUNT, T_CLZ, T_CTZ,+ T_SEQ, T_IO_BIND, T_IO_THEN, T_IO_RETURN,+ T_ADD64, T_SUB64, T_MUL64, T_QUOT64, T_REM64, T_SUBR64, T_NEG64,+ T_UADD64, T_USUB64, T_UMUL64, T_UQUOT64, T_UREM64, T_USUBR64, T_UNEG64,+ T_AND64, T_OR64, T_XOR64, T_INV64, T_SHL64, T_SHR64, T_ASHR64,+ T_POPCOUNT64, T_CLZ64, T_CTZ64,+ T_EQ64, T_NE64, T_LT64, T_LE64, T_GT64, T_GE64, T_ULT64, T_ULE64, T_UGT64, T_UGE64, T_ICMP64, T_UCMP64,+ T_ITOI64, T_I64TOI, T_UTOU64, T_U64TOU,+ T_FPADD, T_FP2P, T_FPNEW, T_FPFIN,+ T_FP2BS, T_BS2FP,+ T_TOPTR, T_TOINT, T_TODBL, T_TOFLT, T_TOFUNPTR,+ T_FROMDBL, T_FROMFLT,+ T_BININT2, T_BININT1, T_UNINT1,+ T_BININT64_2, T_BININT64_1, T_UNINT64_1,+ T_BINFLT2, T_BINFLT1, T_UNFLT1,+ T_BINDBL2, T_BINDBL1, T_UNDBL1,+ T_BINBS2, T_BINBS1,+ T_ISINT,+ T_FADD, T_FSUB, T_FMUL, T_FDIV, T_FNEG, T_ITOF, T_I64TOF, T_FTOI, T_UTOF,+ T_FEQ, T_FNE, T_FLT, T_FLE, T_FGT, T_FGE,+ T_DADD, T_DSUB, T_DMUL, T_DDIV, T_DNEG, T_ITOD, T_I64TOD, T_DTOI, T_UTOD,+ T_DEQ, T_DNE, T_DLT, T_DLE, T_DGT, T_DGE,+ T_FTOD, T_DTOF,+ T_ARR_ALLOC, T_ARR_COPY, T_ARR_SIZE, T_ARR_READ, T_ARR_WRITE, T_ARR_TRUNC, T_ARR_EQ,+ T_RAISE, T_RNF,+ T_IO_SERIALIZE, T_IO_DESERIALIZE,+ T_IO_GETARGREF,+ T_IO_PERFORMIO, T_IO_ATOMIC, T_IO_PRINT, T_CATCH, T_CATCHR,+ T_IO_GC, T_IO_STATS,+ T_IO_LAZYBIND, T_IO_STRICT, T_IO_LAZYBINDST,+ T_IO_FORK, T_IO_THID, T_THNUM, T_IO_THROWTO, T_IO_YIELD,+ T_IO_NEWMVAR,+ T_IO_TAKEMVAR, T_IO_PUTMVAR, T_IO_READMVAR,+ T_IO_TRYTAKEMVAR, T_IO_TRYPUTMVAR, T_IO_TRYREADMVAR,+ T_IO_THREADDELAY, T_IO_THREADSTATUS,+ T_IO_GETMASKINGSTATE, T_IO_SETMASKINGSTATE,+ T_PACKCSTRING, T_PACKCSTRINGLEN,+ T_BSAPPEND, T_BSEQ, T_BSNE, T_BSLT, T_BSLE, T_BSGT, T_BSGE, T_BSCMP,+ T_BSUNPACK, T_BSREPLICATE, T_BSLENGTH, T_BSSUBSTR, T_BSINDEX,+ T_BSNEW, T_BSREAD, T_BSWRITE, T_BSFREEZE, T_BSAPPBYTE, T_BSAPPCHAR, + T_BSFROMUTF8, T_BSHEADUTF8, T_BSTAILUTF8,+ T_UTF8LENGTH, T_UTF8OFFSET, T_UTF8OFFSETEND, T_UTF8OFFSETFROM, T_UTF8OFFSETENDBEFORE,+ T_UTF8DECODE, T_UTF8DECODEEND,+ T_UTF8REVERSE, T_UTF8SKIPSPACE, T_UTF8SKIPNONSPACE, T_UTF8TRIMSPACEEND,+ T_BSFIND, T_BSRFIND, T_BSASCIICASE, T_BSISASCII, T_BSCONCAT,+ T_BSAPPENDDOT, T_BSGRAB, T_BSGRABLEN,+ T_SPNEW, T_SPDEREF, T_SPFREE,+ T_WKNEWFIN, T_WKNEW, T_WKDEREF, T_WKFINAL,+ T_IO_PP, /* for debugging */+ T_NODEADDR, T_IO_RTSINFO, /* for reading the graph, see rts_info */+ T_IO_STDIN, T_IO_STDOUT, T_IO_STDERR,+ T_IO_WAITRDFD, T_IO_WAITWRFD,+ T_LAST_TAG,+ T_XXX = 0x7fffffff+};++/* Most entries are initialized from the primops table. */+static const char* tag_names [T_LAST_TAG+1] =+ { [D_NONE] = "NONE", [X_AP] = "AP", [D_IND] = "IND",+ [D_INT] = "INT", [D_INT64] = "INT64", [D_DBL] = "DBL", [D_FLT32] = "FLT32", [D_PTR] = "PTR",+ [D_FUNPTR] = "FUNPTR", [D_FORPTR] = "FORPTR", [D_ARR] = "ARR", [D_THID] = "THID", [D_MVAR] = "MVAR", [D_WEAK] = "WEAK",+ [D_IO_CCALL] = "IO.ccall", [D_BADDYN] = "BADDYN", [D_TICK] = "TICK",+ [V_CONSTR] = "C_", [V_TAG] = "TAG", [V_CASED] = "D_", [V_LOOKD] = "L_", [V_CASES] = "E_", [V_LOOKS] = "M_",+ };+#define TAGNAME(t) tag_names[t]+/* The arity of each tag, from primops[], see arity_virt. */+static uint8_t tag_arity[T_LAST_TAG+1];++/***************************************/++/*+ * A NODEPTR is a basically a pointer to a struct node.+ * But to save memory references, we never point to a constant+ * node that is just a tag, instead we encode the tag straight in+ * the NODEPTR.+ * A struct node is always at least 4 byte aligned, so the two lower+ * bits of a real pointer are always 0.+ * A NODEPTR always has an LSB=0.+ * ...pppp00 real pointer = ...pppp00+ * ...tttt10 tag = ...tttt, basically a node_tag+ */++/* + * For a node (i.e., two NODEPTR) the two lower bits of the FUN part+ * decides what kind of node it is.+ * xxx0 yyyy AP node, xxx0 and yyyy are NODEPTRs+ * xx01 yyyy unused+ * xx11 yyyy node with payload (IND, INT, DBL, etc), xx=D_INT,D_DBL,..., yyyy is the payload+ */++/*+ * For a NODEPTR we have+ * ppppppppp00 ppppppppp00 is a real pointer+ * nnnkkkttt10 ttt 11 bits is a node_tag, kkk 11 bits, nnn 8 bits+ * when ttt=+ * V_CONSTR kkk = constructor number, nnn = number of constructor arguments+ * V_CASED nnnkkk = index in the table of case arities, see below+ * V_CASES as above+ * V_LOOKD kkk = number of arms, nnn unused+ * V_LOOKS as V_CASES+ * otherwise kkk, nnn unused+ * + */+typedef uintptr_t tag_t;+typedef union NodePtr {+ tag_t node_bits;+ struct node *node_ptr;+ union NodePtr *node_pptr; /* only used during GC for values on the stack */+} NODEPTR;++const NODEPTR NIL_NODEPTR = { 0 };++/* To fit in a word we should have+ * PTR_TAG_BITS + PTR_TAG_TAG_BITS + PTR_TAG_NCON_BITS + PTR_TAG_NARG_BITS <= size_in_bits(tag_t)+ * We make them add to 32+ */+#define PTR_TAG_BITS 2 /* number of reserved tag bits in every pointer */+#define PTR_TAG_MASK ((1 << PTR_TAG_BITS) - 1) /* 0x3 */+#define PTR_TAG_PTR 0+#define PTR_TAG_TAG 2+#define PTR_TAG_DATA 3+#define PTR_AP_MASK 1+#define PTR_AP_AP 0+#define PTR_TAG_TAG_BITS 11 /* max number of bits in a enum node_tag */+#define PTR_TAG_TAG_MASK ((1 << PTR_TAG_TAG_BITS) - 1) /* 0x7ff */+#define PTR_TAG_NCON_BITS 11 /* max number of constructors/case-arms */+#define PTR_TAG_NCON_MASK ((1 << PTR_TAG_NCON_BITS) - 1) /* 0x7ff */+#define PTR_TAG_NARG_BITS 8 /* max number of constructor arguments */+#define PTR_TAG_NARG_MASK ((1 << PTR_TAG_NARG_BITS) - 1) /* 0xff */++#define MK_TAG(t) (((tag_t)(t) << PTR_TAG_BITS) | PTR_TAG_TAG)+#define MK_DATA_TAG(t) (((tag_t)(t) << PTR_TAG_BITS) | PTR_TAG_DATA)+/* Encode the CASEx/LOOKx/CON/ARM as above */+#define MK_CASE(t, m) MK_TAG(((tag_t)(m) << PTR_TAG_TAG_BITS) | (t))+#define MK_CON(t, k, n) MK_CASE(t, ((tag_t)(n) << PTR_TAG_NCON_BITS) | (k))++/* is it NIL_NODEPTR? */+static INLINE bool+is_NIL(NODEPTR n)+{+ return n.node_bits == 0;+}++/* Is the NODEPTR a virtual pointer, i.e., an encoded tag?+ * Every NODEPTR has LSB=0 (...00 real pointer, ...10 virtual), so+ * testing PTR_TAG_TAG alone is sufficient.+ */+static ALWAYS_INLINE bool+is_VIRT(NODEPTR n)+{+ XASSERT((n.node_bits & PTR_AP_MASK) == 0);+ return (n.node_bits & PTR_TAG_TAG) != 0;+}++/* If the NODEPTR is a real pointer, return it. */+static INLINE struct node*+get_node_ptr(NODEPTR n)+{+ if (!is_VIRT(n))+ return n.node_ptr;+ else+ return NULL;+}++/* For a FUN part of a struct node */+static INLINE bool+is_AP(NODEPTR n)+{+ return (n.node_bits & PTR_AP_MASK) == PTR_AP_AP;+}++#if EXTRASANITY+/* For a FUN part of a struct node */+static INLINE bool+is_DATA(NODEPTR n)+{+ return (n.node_bits & PTR_TAG_MASK) == PTR_TAG_DATA;+}+#endif++/* For a non-AP FUN part of a struct node (i.e., is_DATA(n) is true) */+static ALWAYS_INLINE enum node_tag+get_DATA_TAG(NODEPTR n)+{+ XASSERT(is_DATA(n));+ return (enum node_tag)(n.node_bits >> PTR_TAG_BITS);+}++static INLINE NODEPTR+mk_TAG(enum node_tag t)+{+ NODEPTR n;+ n.node_bits = MK_TAG(t);+ return n;+}++static INLINE NODEPTR+mk_DATA_TAG(enum node_tag t)+{+ NODEPTR n;+ n.node_bits = MK_DATA_TAG(t);+ return n;+}++static INLINE NODEPTR+mk_CASE(enum node_tag t, int num_constr)+{+ NODEPTR n;+ n.node_bits = MK_CASE(t, num_constr);+ return n;+}++/* t is V_CONSTR, k is the constructor number, n the number of arguments */+static INLINE NODEPTR+mk_CON(enum node_tag t, int constr_no, int num_arg)+{+ NODEPTR n;+ n.node_bits = MK_CON(t, constr_no, num_arg);+ return n;+}++/* The tag of a virtual NODEPTR (without the extra info) */+static INLINE enum node_tag+get_VIRT_TAG(NODEPTR n)+{+ return (enum node_tag)((n.node_bits >> PTR_TAG_BITS) & PTR_TAG_TAG_MASK);+}++static INLINE bool+eq_NODEPTR(NODEPTR p, NODEPTR q)+{+ return p.node_ptr == q.node_ptr;+}++/***************************************/+++struct ioarray;+struct bytestring;+struct forptr;+struct mthread;+struct mvar;+struct weak_ptr;++typedef struct PACKED node {+ NODEPTR ufun;+ union {+ NODEPTR uuarg;+ NODEPTR uuind;+ value_t uuvalue;+#if WANT_FLOAT32+ flt32_t uuflt32value;+ uint32_t uuint32value;+#endif /* WANT_FLOAT32 */+#if WANT_FLOAT64+ flt64_t uuflt64value;+#endif /* WANT_FLOAT32 */+#if WANT_INT64+ int64_t uuint64value;+#endif /* WANT_INT64 */+ const char *uucstring;+ void *uuptr;+ HsFunPtr uufunptr;+ struct ioarray *uuarray;+ struct forptr *uuforptr; /* foreign pointers and byte arrays */+ struct mthread *uuthread;+ struct mvar *uumvar;+ struct weak_ptr *uuweak;+ } uarg;+} node;++#if 0+/* If the NODEPTR points to an application, return the FUN */+static INLINE NODEPTR+get_FUN(NODEPTR n)+{+ struct node *p = get_node_ptr(n);+ if (p) {+ NODEPTR q = p->ufun;+ if ((q.node_bits & PTR_AP_MASK) == PTR_AP_AP)+ return q;+ }+ return NIL_NODEPTR;+}+#endif++/* Is the non-NIL NODEPTR a data node with tag t? */+static ALWAYS_INLINE bool+is_DATA_NODE(NODEPTR n, enum node_tag t)+{+ XASSERT(!is_NIL(n));+ return !is_VIRT(n) && n.node_ptr->ufun.node_bits == MK_DATA_TAG(t);+}++/* If the NODEPTR points to an indirection, return it */+static INLINE NODEPTR+get_IND(NODEPTR n)+{+ struct node *p = get_node_ptr(n);+ if (p && p->ufun.node_bits == MK_DATA_TAG(D_IND))+ return p->uarg.uuind;+ return NIL_NODEPTR;+}++static ALWAYS_INLINE void+set_IND(NODEPTR n, NODEPTR t)+{+#if EXTRASANITY+ struct node *p = get_node_ptr(n);+ if (!p)+ ERR("set_IND");+#else+ struct node *p = n.node_ptr;+#endif+ p->ufun = mk_DATA_TAG(D_IND);+ p->uarg.uuind = t;+}++/* Set the tag of a data node, n is a real pointer */+static ALWAYS_INLINE void+set_DATA_TAG(NODEPTR n, enum node_tag t)+{+ XASSERT(get_node_ptr(n) != NULL);+ n.node_ptr->ufun = mk_DATA_TAG(t);+}++/*+ * The tag of any NODEPTR (this is what GETTAG used to be):+ * - virtual pointer: the encoded tag (T_xxx or V_xxx)+ * - real pointer to an application: X_AP+ * - real pointer to a data node: the D_xxx tag (including D_IND)+ */+static INLINE enum node_tag+get_XTAG(NODEPTR n)+{+ if (is_VIRT(n))+ return get_VIRT_TAG(n);+ NODEPTR f = n.node_ptr->ufun;+ if (is_AP(f))+ return X_AP;+ return get_DATA_TAG(f);+}++/* Number of arms of a virtual V_LOOKD */+static ALWAYS_INLINE int+get_CASE_size(NODEPTR n)+{+ XASSERT(is_VIRT(n));+ tag_t t = n.node_bits >> PTR_TAG_BITS;+ return (t >> PTR_TAG_TAG_BITS) & PTR_TAG_NCON_MASK;+}++/*+ * Case arities.+ * A dense case, D_a0_..._a{m-1}, has m arms, and the arm for constructor k+ * takes ak arguments, the fields of the constructor. A sparse case,+ * E_k1_n1_..._km_nm, has m arms, and arm j is for constructor kj, which has+ * nj fields; the kj are increasing. The interpreter uses m, and the+ * constructor numbers of a sparse case, but the arities are only needed to+ * turn the graph back into code, since they cannot be read back from the arms.+ * They are kept in a table, and a V_CASED or V_CASES holds an index into it.+ * Equal entries are shared, and the entries are never freed.+ */+struct case_arity {+ uint16_t m; /* number of arms */+ uint8_t *arities; /* arities[j] is the number of fields of the constructor of arm j */+ uint16_t *tags; /* sparse: tags[j] is the constructor number of arm j; dense: NULL */+};+static struct case_arity *case_arities; /* the table */+static uint32_t num_case_arities; /* number of entries in use */+static uint32_t max_case_arities; /* number of entries allocated */++#define PTR_TAG_CASED_BITS (PTR_TAG_NCON_BITS + PTR_TAG_NARG_BITS) /* bits for the table index */+#define MAX_CASE_ARITIES ((uint32_t)1 << PTR_TAG_CASED_BITS)++/* The index in the table of a virtual V_CASED, V_CASES, or V_LOOKS */+static ALWAYS_INLINE uint32_t+get_case_index(NODEPTR n)+{+ XASSERT(is_VIRT(n));+ tag_t t = n.node_bits >> PTR_TAG_BITS;+ return (t >> PTR_TAG_TAG_BITS) & (MAX_CASE_ARITIES - 1);+}++/* The case arities of a virtual V_CASED, V_CASES, or V_LOOKS */+static ALWAYS_INLINE struct case_arity *+get_case_arity(NODEPTR n)+{+ return &case_arities[get_case_index(n)];+}++/* Find the entry in the table, or add it, and return the index.+ * tags is NULL for a dense case.+ * Combinator code is rarely loaded, and the table is small,+ * so a linear search will do. */+static uint32_t+find_case_arity(uint32_t m, const uint16_t *tags, const uint8_t *arities)+{+ for (uint32_t i = 0; i < num_case_arities; i++) {+ struct case_arity *c = &case_arities[i];+ if (c->m == m && memcmp(c->arities, arities, m) == 0 &&+ (tags ? c->tags && memcmp(c->tags, tags, m * sizeof(uint16_t)) == 0 : !c->tags))+ return i;+ }+ if (num_case_arities >= max_case_arities) {+ if (num_case_arities >= MAX_CASE_ARITIES)+ ERR("too many case arities");+ max_case_arities = max_case_arities ? 2 * max_case_arities : 64;+ case_arities = mrealloc(case_arities, max_case_arities * sizeof(struct case_arity));+ }+ struct case_arity *c = &case_arities[num_case_arities];+ c->m = m;+ c->arities = mmalloc(m);+ memcpy(c->arities, arities, m);+ c->tags = 0;+ if (tags) {+ c->tags = mmalloc(m * sizeof(uint16_t));+ memcpy(c->tags, tags, m * sizeof(uint16_t));+ }+ return num_case_arities++;+}++/* Constructor number and number of arguments of a virtual V_CONSTR */+static ALWAYS_INLINE void+get_CON_info(NODEPTR n, int *kp, int *np)+{+ XASSERT(is_VIRT(n));+ tag_t t = n.node_bits >> PTR_TAG_BITS;+ *kp = (t >> PTR_TAG_TAG_BITS) & PTR_TAG_NCON_MASK;+ *np = (t >> (PTR_TAG_TAG_BITS + PTR_TAG_NCON_BITS)) & PTR_TAG_NARG_MASK;+}++static INLINE void+mk_AP(NODEPTR n, NODEPTR fun, NODEPTR arg)+{+ n.node_ptr->ufun = fun;+ n.node_ptr->uarg.uuarg = arg;+}++#define HEAPREF(i) &cells[(i)]+#define NPTR(n) ((n).node_ptr)+#define GETVALUE(p) NPTR(p)->uarg.uuvalue+#define GETINT64VALUE(p) NPTR(p)->uarg.uuint64value+#define GETINT32VALUE(p) NPTR(p)->uarg.uuint32value+#define GETFLTVALUE(p) NPTR(p)->uarg.uuflt32value+#define GETDBLVALUE(p) NPTR(p)->uarg.uuflt64value+#define SETVALUE(p,v) NPTR(p)->uarg.uuvalue = v+#define SETINT64VALUE(p,v) NPTR(p)->uarg.uuint64value = v+#define SETINT32VALUE(p,v) NPTR(p)->uarg.uuint32value = v+#define SETFLTVALUE(p,v) NPTR(p)->uarg.uuflt32value = v+#define SETDBLVALUE(p,v) NPTR(p)->uarg.uuflt64value = v+#define FUN(p) NPTR(p)->ufun+#define ARG(p) NPTR(p)->uarg.uuarg+#define CSTR(p) NPTR(p)->uarg.uucstring+#define PTR(p) NPTR(p)->uarg.uuptr+#define FUNPTR(p) NPTR(p)->uarg.uufunptr+#define FORPTR(p) NPTR(p)->uarg.uuforptr+#define BSTR(p) NPTR(p)->uarg.uuforptr->payload+#define ARR(p) NPTR(p)->uarg.uuarray+#define THR(p) NPTR(p)->uarg.uuthread+#define MVAR(p) NPTR(p)->uarg.uumvar+#define WEAK(p) NPTR(p)->uarg.uuweak++#define NODE_SIZE sizeof(node)+#define LABEL(n) ((heapoffs_t)((n).node_ptr - cells))+node *cells; /* All cells */++/* Prefetch a node we know we'll need soon but haven't dereferenced yet. */+#if defined(__GNUC__) || defined(__clang__)+#define PREFETCH_READ(addr) __builtin_prefetch((addr), 0, 2)+#else+#define PREFETCH_READ(addr) do { } while(0)+#endif++/*+ * Byte arrays.+ * This is used for both immutable and mutable arrays.+ * This struct is often passed by value.+ */+struct bytestring {+ size_t bs_size; /* current size of string */+ size_t bs_capacity; /* size allocated for string, 0 if immutable */+ void *bs_array; /* bytes */+};++/* Create a new immutable bytestring, if buf is NULL also allocates the array */+struct bytestring+mk_ro_bytestring(size_t size, void *buf)+{+ struct bytestring bs;+ bs.bs_capacity = 0;+ bs.bs_size = size;+ bs.bs_array = buf ? buf : mmalloc(size);+ return bs;+}++/*+ * Arrays are allocated with malloc()/free().+ * During GC they are marked, and all elements in the array are+ * recursively marked.+ * At the end of the the mark phase there is a scan of all+ * arrays, and the unmarked ones are freed.+ */+struct ioarray {+ struct ioarray *next; /* all ioarrays are linked together */+ bool permanent; /* this array should never be GC-ed */+ size_t marked; /* marked during GC */+ size_t size; /* number of elements in the array */+ NODEPTR array[]; /* actual size may be bigger */+};+struct ioarray *array_root = 0; /* root of all allocated arrays, linked by next */++enum fptype {+ FP_FORPTR = 0, /* a regular foreign pointer to unknown memory */+ FP_BSTR, /* a bytestring */+ FP_MPZ, /* a GMP MPZ pointer */+};++/*+ * A Haskell ForeignPtr has a normal pointer, and a finalizer+ * function that is to be called when there are no more references+ * to the ForeignPtr.+ * A complication is that using plusForeignPtr creates a new+ * ForeignPtr that must share the same finalizer.+ * There is one struct forptr for each ForeignPtr. It has pointer+ * to the actual data, and to a struct final which is shared between+ * all ForeignPtrs that have been created with plusForeignPtr.+ * During GC the used bit is set for any references to the forptr.+ * The scan phase will traverse the struct final chain and run+ * the finalizer, and free associated structs.+ */+struct final {+ struct final *next; /* the next finalizer */+ HsFunPtr final; /* function to call to release resource */+ void *arg; /* argument to final when called */+ size_t size; /* size of memory, if known, otherwise NOSIZE */+#define NOSIZE (~(size_t)0) /* used as the size in payload for actual foreign pointers */+ struct forptr *back; /* back pointer to the first forptr */+ short marked; /* mark bit for GC */+ enum fptype fptype; /* what kind of foreign pointer */+};++/*+ * Foreign pointers are also used to represent bytestrings.+ * The difference between a foreign pointer and a bytestring+ * is that we can serialize the latter.+ * The size field is non-zero only for bytestrings.+ */+struct forptr {+ struct forptr *next; /* the next ForeignPtr that shares the same finalizer */+ struct final *finalizer; /* the finalizer for this ForeignPtr */+ struct bytestring payload; /* the actual pointer to allocated data, and maybe a size */+ // char *desc;+};+struct final *final_root = 0; /* root of all allocated foreign pointers, linked by next */++/*+ * For Haskell code that reads the graph, see lib/Mhs/Extract.hs.+ * The primitive nodeAddr gives the NODEPTR of a value, without evaluating it,+ * and IO.rtsinfo a pointer to this: the layout of the nodes, and the tables+ * and tags needed to make sense of them. Every field is a word, so field i+ * is at offset i * sizeof(void*), and the Haskell code knows them by their+ * positions; change the version when they change. It also relies on the+ * layout of struct case_arity and struct ffi_entry: three words each, with+ * the fields in order.+ */+static struct {+ uintptr_t version;+ /* The nodes */+ uintptr_t node_size; /* sizeof(struct node) */+ uintptr_t node_payload; /* offsetof(struct node, uarg) */+ /* The tables */+ uintptr_t last_tag; /* T_LAST_TAG */+ const char **tag_names; /* the name of each tag, or NULL */+ const uint8_t *tag_arity; /* the arity of each tag, see arity_virt */+ struct case_arity **case_arities; /* the table, which moves when it grows */+ const struct ffi_entry *ffi_table; /* the FFI functions of the runtime, */+ int *num_ffi; /* and how many there are, */+ const struct ffi_entry **xffi_table; /* then those of the program, see FFI_IX */+ /* Tags */+ uintptr_t d_ind, d_int, d_int64, d_dbl, d_flt32, d_ptr, d_funptr, d_forptr,+ d_arr, d_thid, d_mvar, d_weak, d_io_ccall, d_baddyn, d_tick;+ uintptr_t v_constr, v_cased, v_cases;+ /* Bytestrings */+ uintptr_t forptr_finalizer; /* offsetof(struct forptr, finalizer) */+ uintptr_t forptr_payload; /* offsetof(struct forptr, payload) */+ uintptr_t final_fptype; /* offsetof(struct final, fptype) */+ uintptr_t fp_bstr; /* FP_BSTR */+} rts_info = {+ 2,+ sizeof(struct node), offsetof(struct node, uarg),+ T_LAST_TAG, tag_names, tag_arity, &case_arities, ffi_table, &num_ffi, &xffi_table,+ D_IND, D_INT, D_INT64, D_DBL, D_FLT32, D_PTR, D_FUNPTR, D_FORPTR,+ D_ARR, D_THID, D_MVAR, D_WEAK, D_IO_CCALL, D_BADDYN, D_TICK,+ V_CONSTR, V_CASED, V_CASES,+ offsetof(struct forptr, finalizer), offsetof(struct forptr, payload),+ offsetof(struct final, fptype), FP_BSTR,+};++counter_t num_reductions = 0;+counter_t num_alloc = 0;+counter_t num_gc = 0;+counter_t num_yield = 0;+counter_t num_resched = 0;+counter_t num_thread_reap = 0;+counter_t num_mvar_alloc = 0;+counter_t num_mvar_free = 0;+counter_t num_stable_alloc = 0;+counter_t num_stable_free = 0;+counter_t num_new_weak = 0;+counter_t num_gc_weak = 0;+uintptr_t gc_mark_time = 0;+uintptr_t gc_scan_time = 0;+uintptr_t run_time = 0;+uintptr_t boot_time = 0;++#define MAIN_THREAD 1+uvalue_t num_thread_create = MAIN_THREAD;++#define MAXSTACKDEPTH 0+#if MAXSTACKDEPTH+stackptr_t max_stack_depth = 0;+counter_t max_c_stack = 0;+counter_t cur_c_stack = 0;+#define MAXSTACK if (STACK_INDEX(stack_ptr) > max_stack_depth) max_stack_depth = STACK_INDEX(stack_ptr)+#else+#define MAXSTACK+#endif++NODEPTR atptr;++/* The stack grows downwards, stack_ptr points to the top element.+ * The empty stack has stack_ptr == stack_bot, just past the end of the stack area. */+NODEPTR *stack_bot; /* the empty stack_ptr; the first element is stack_bot[-1] */+NODEPTR *stack_ptr; /* the top element */+NODEPTR *stack_limit; /* PUSH fails when stack_ptr reaches this */+#if STACKOVL+#define PUSH(x) do { if (stack_ptr <= stack_limit) stackerr(); *--stack_ptr = (x); MAXSTACK; } while(0)+#else /* STACKOVL */+#define PUSH(x) do { *--stack_ptr = (x); MAXSTACK; } while(0)+#endif /* STACKOVL */+#define TOP(n) stack_ptr[(n)]+#define POP(n) stack_ptr += (n)+#define POPTOP() (*stack_ptr++)+/* The number of entries pushed after stack_ptr was p */+#define STACK_ABOVE(p) ((p) - stack_ptr)+/* The index of the stack slot p, counting from the bottom, i.e., stack_bot[-1] has index 0 */+#define STACK_INDEX(p) (stack_bot - 1 - (p))+#define GCCHECK(n) gc_check((n))+#define CLEARSTK() do { stack_ptr = stack_bot; } while(0)+#define GCCHECKSAVE(p, n) do { PUSH(p); GCCHECK(n); (p) = TOP(0); POP(1); } while(0)++heapoffs_t heap_size; /* number of heap cells */+heapoffs_t heap_start; /* first location in heap that needs GC */+stackptr_t stack_size; /* number of stack slots */++counter_t num_marked;+counter_t max_num_marked = 0;+counter_t num_free;+counter_t num_arr_alloc;+counter_t num_arr_free;+counter_t num_fin_alloc;+counter_t num_fin_free;+counter_t num_bs_alloc;+counter_t num_bs_alloc_max;+counter_t num_bs_free;+counter_t num_bs_bytes;+counter_t num_bs_inuse;+counter_t num_bs_inuse_max;++#define BITS_PER_WORD (sizeof(bits_t) * 8)+bits_t *free_map; /* 1 bit per node, 0=free, 1=used */+heapoffs_t free_map_nwords;+heapoffs_t next_scan_index;++int want_gc_red = 0;++NORETURN void+memerr(void)+{+ ERR("Out of memory");+}++NORETURN+void+stackerr(void)+{+ ERR("stack overflow");+}++/***************************************/++#include "bfile.c"++/***************************************/++struct ioarray*+arr_alloc(size_t sz, NODEPTR e)+{+ if (sz > (SIZE_MAX - offsetof(struct ioarray, array)) / sizeof(NODEPTR))+ ERR("ARR_ALLOC");+ struct ioarray *arr = mmalloc(offsetof(struct ioarray, array) + sz * sizeof(NODEPTR));+ size_t i;++ arr->next = array_root;+ array_root = arr;+ arr->marked = 0;+ arr->permanent = false;+ arr->size = sz;+ for(i = 0; i < sz; i++)+ arr->array[i] = e;+ //PRINT("arr_alloc(%d, %p) = %p\n", (int)sz, e, arr);+ num_arr_alloc++;+ return arr;+}++struct ioarray*+arr_copy(struct ioarray *oarr)+{+ size_t sz = oarr->size;+ struct ioarray *arr = mmalloc(offsetof(struct ioarray, array) + sz * sizeof(NODEPTR));++ arr->next = array_root;+ array_root = arr;+ arr->marked = 0;+ arr->permanent = false;+ arr->size = sz;+ memcpy(arr->array, oarr->array, sz * sizeof(NODEPTR));+ num_arr_alloc++;+ return arr;+}++/*****************************************************************************/++#if WANT_TICK+struct tick_entry {+ struct bytestring tick_name;+ counter_t tick_count;+} *tick_table = 0;+size_t tick_table_size;+size_t tick_index;++/* Allocate a new tick table entry and return the index. */+size_t+add_tick_table(struct bytestring name)+{+ if (!tick_table) {+ tick_table_size = 100;+ tick_table = mmalloc(tick_table_size * sizeof(struct tick_entry));+ tick_index = 0;+ }+ if (tick_index >= tick_table_size) {+ tick_table_size *= 2;+ tick_table = mrealloc(tick_table, tick_table_size * sizeof(struct tick_entry));+ }+ tick_table[tick_index].tick_name = name;+ tick_table[tick_index].tick_count = 0;+ return tick_index++;+}++/* Called with the tick index. */+static INLINE void+dotick(value_t i)+{+ tick_table[i].tick_count++;+}++void+dump_tick_table(FILE *f)+{+ if (!tick_table) {+ fprintf(f, "Tick table empty\n");+ return;+ }+ for (size_t i = 0; i < tick_index; i++) {+ counter_t n = tick_table[i].tick_count;+ if (n)+ fprintf(f, "%-60s %10"PRIcounter"\n", (char *)tick_table[i].tick_name.bs_array, n);+ }+}+#endif++enum th_sched { mt_main, mt_resched, mt_raise };+/* The two enums below are known by the Haskell code. Do not change order */+enum th_state {+ ts_runnable,+ ts_wait_mvar,+ ts_wait_time,+ ts_finished,+ ts_died,+ ts_wait_io, /* not visible to Haskell; must stay after ts_died */+};+enum mask_state { mask_unmasked, mask_interruptible, mask_uninterruptible };++/***************** HANDLER *****************/++struct handler {+ jmp_buf hdl_buf; /* env storage */+ struct handler *hdl_old; /* old handler */+ NODEPTR hdl_exn; /* used temporarily to pass the exception value */+} *cur_handler = 0;++/***************** THREAD ******************/++struct mthread {+ enum th_state mt_state; /* thread state */+ enum mask_state mt_mask; /* making state. */+ struct mthread *mt_next; /* all threads linked together */+ struct mthread *mt_queue; /* runq/waitq link */+ counter_t mt_slice; /* reduction steps until yielding */+ counter_t mt_num_slices; /* number of slices so far */+ NODEPTR mt_root; /* root of the graph to reduce */+ struct mvar *mt_exn; /* possible thrown exception */+ struct mthread *mt_throwto; /* When set, we are in throwTo to this thread and have+ * already handed over the exception; we are waiting for+ * the target to take it. See throwto(). */+ bool mt_throwdone; /* The target has taken the exception (or is gone). */+ NODEPTR mt_mval; /* Filled when put_mvar wakes a thread waiting in read_mvar.+ * The value cannot be taken from the mvar by the read, because+ * we need to guarantee that all reads get the same value. */+ bool mt_mark; /* marked as accessible */+ uvalue_t mt_id; /* thread number, thread 1 is the main thread */+#if WANT_IO_POLL+ int mt_fd; /* The file descriptor that we are waiting on,+ * IO_POLL_WAITING_FOR_NONE, or IO_POLL_EVENT_HAS_HAPPENED */+#define IO_POLL_WAITING_FOR_NONE (-1)+#define IO_POLL_EVENT_HAS_HAPPENED (-2)+ int mt_events; /* POLLIN or POLLOUT */+#endif /* WANT_IO_POLL */+#if defined(CLOCK_INIT)+ CLOCK_T mt_at; /* time to wake up when in threadDelay */+#endif+};+struct mthread *all_threads = 0; /* all threads */++struct mqueue {+ struct mthread *mq_head;+ struct mthread *mq_tail;+};+struct mqueue runq = { 0, 0 }; /* runnable threads */+struct mqueue timeq = { 0, 0 }; /* waiting for a timer to expire, sorted in time order */+struct mqueue pollq = { 0, 0 }; /* waiting for I/O on a file descriptor */++struct mvar {+ struct mvar *mv_next; /* all mvars linked together */+ NODEPTR mv_data; /* contents of the mvar, or NIL when empty */+ struct mqueue mv_takeput; /* queue of threads waiting for take or put, single wakeup */+ struct mqueue mv_read; /* queue of threads waiting for read, multiple wakeup */+ bool mv_mark; /* marked as accessible */+};+struct mvar *all_mvars = 0; /* all mvars */++jmp_buf sched; /* jump here to yield */+counter_t slice = SLICE; /* normal time slice;+ * on an M4 Mac this is about 0.3ms */+int glob_slice;++NODEPTR the_exn; /* Used to propagate the exception for longjmp(sched, mt_raise) */++/****** StablePtr ******/++size_t sp_capacity = 4; /* initial size of stable pointer table */+NODEPTR *sp_table; /* stable pointer table */++static void+init_stableptr(void)+{+ sp_table = mmalloc(sp_capacity * sizeof(NODEPTR)); /* stable pointer table, all free */+ for (size_t i = 0; i < sp_capacity; i++)+ sp_table[i] = NIL_NODEPTR;+}++static uvalue_t+new_stableptr(NODEPTR n)+{+ size_t i;++ COUNT(num_stable_alloc);+ /* Linear search for an empty slot. */+ /* Not ideal, but fine for a small number of StablePtr. */+ for(i = 1; i < sp_capacity; i++) { /* index 0 reserved according to the spec */+ if (is_NIL(sp_table[i]))+ break;+ }+ if (i == sp_capacity) {+ /* table is full, so double its size */+ sp_capacity *= 2;+ sp_table = mrealloc(sp_table, sp_capacity * sizeof(NODEPTR));+ for(size_t j = i; j < sp_capacity; j++)+ sp_table[j] = NIL_NODEPTR;+ }+ sp_table[i] = n;+ return (uvalue_t)i;+}++static NODEPTR+deref_stableptr(uvalue_t sp)+{+ if (sp >= sp_capacity || is_NIL(sp_table[sp]))+ ERR("deref_stableptr");+ return sp_table[sp];+}++static void+free_stableptr(uvalue_t sp)+{+ if (sp >= sp_capacity || is_NIL(sp_table[sp]))+ ERR("free_stableptr");+ COUNT(num_stable_free);+ sp_table[sp] = NIL_NODEPTR;+}++/* The order of these must be kept in sync with Control.Exception.Internal.rtsExn */+enum rts_exn { exn_stackoverflow, exn_heapoverflow, exn_threadkilled, exn_userinterrupt,+ exn_dividebyzero, exn_blockedmvar, exn_blockedstm, exn_overflow,+ exn_serialize, exn_deserialize, exn_nontermination, exn_last };++NORETURN void raise_exn(NODEPTR exn);+struct mvar* new_mvar(void);+NODEPTR take_mvar(bool try, struct mvar *mv);+NORETURN void die_exn(NODEPTR exn);+void thread_intr(struct mthread *mt);+int put_mvar(bool try, struct mvar *mv, NODEPTR v);+NODEPTR mkInt(value_t i);+NODEPTR mkInt64(int64_t i);+NODEPTR mkFlt32(flt32_t d);+NODEPTR mkFlt64(flt64_t d);+NODEPTR mkPtr(void* p);+struct mthread* new_thread(NODEPTR root);+void gc(void);+void async_throwto(struct mthread*, NODEPTR);++#if WANT_STDIO+void pp(FILE*, NODEPTR);+#endif++/* Needed during reduction */+NODEPTR intTable[HIGH_INT - LOW_INT];++#define combK mk_TAG(T_K)+#define combA mk_TAG(T_A)+#define combI mk_TAG(T_I)+#define combB mk_TAG(T_B)+#define combC mk_TAG(T_C)+#define combZ mk_TAG(T_Z)+#define combU mk_TAG(T_U)+#define combK2 mk_TAG(T_K2)+#define combK3 mk_TAG(T_K3)+#define combBB mk_TAG(T_BB)+#define combCC mk_TAG(T_CC)+#define combP mk_TAG(T_P)+#define combIOBIND mk_TAG(T_IO_BIND)+#define combIORETURN mk_TAG(T_IO_RETURN)+#define combIOTHEN mk_TAG(T_IO_THEN)+#define combSETMASKINGSTATE mk_TAG(T_IO_SETMASKINGSTATE)+#define combPERFORMIO mk_TAG(T_IO_PERFORMIO)+#define combBININT1 mk_TAG(T_BININT1)+#define combBININT2 mk_TAG(T_BININT2)+#define combUNINT1 mk_TAG(T_UNINT1)+#define combBININT64_1 mk_TAG(T_BININT64_1)+#define combBININT64_2 mk_TAG(T_BININT64_2)+#define combUNINT64_1 mk_TAG(T_UNINT64_1)+#define combBINFLT1 mk_TAG(T_BINFLT1)+#define combBINFLT2 mk_TAG(T_BINFLT2)+#define combUNFLT1 mk_TAG(T_UNFLT1)+#define combBINDBL1 mk_TAG(T_BINDBL1)+#define combBINDBL2 mk_TAG(T_BINDBL2)+#define combUNDBL1 mk_TAG(T_UNDBL1)+#define combBINBS1 mk_TAG(T_BINBS1)+#define combBINBS2 mk_TAG(T_BINBS2)+#define combTHROWTO mk_TAG(T_IO_THROWTO)+#define combCATCHR mk_TAG(T_CATCHR)+#define combFP2P mk_TAG(T_FP2P)++#define combFalse mk_CON(V_CONSTR, 0, 0)+#define combTrue mk_CON(V_CONSTR, 1, 0)+#define combNothing mk_CON(V_CONSTR, 0, 0)+#define combJust mk_CON(V_CONSTR, 1, 1)+#define combUnit mk_CON(V_CONSTR, 0, 0)+#define combNil mk_CON(V_CONSTR, 0, 0)+#define combCons mk_CON(V_CONSTR, 1, 2)+#define combPair mk_CON(V_CONSTR, 0, 2)+#define combLT mk_CON(V_CONSTR, 0, 0)+#define combEQ mk_CON(V_CONSTR, 1, 0)+#define combGT mk_CON(V_CONSTR, 2, 0)++NODEPTR spare_node; /* an unused node in the heap, used in printrec */+NODEPTR combShowExn;+NODEPTR comb_stdin, comb_stdout, comb_stderr;++NODEPTR combPFst, combPSnd;+NODEPTR combPUnit;+NODEPTR combWorld;++/*******************************/++#if WANT_ARGS+/* This single element array hold a list of the program arguments. */+struct ioarray *argarray;+#endif /* WANT_ARGS */++int verbose = 0;+int gcbell = 0;+++#if WANT_SIGINT+volatile bool has_sigint = false;+void+handle_sigint(int s)+{+ has_sigint = true;+}+#endif++/* Run GC and verify at least k nodes are free afterward. */+static NOINLINE void+gc_for(size_t k)+{+ gc();+ if (k >= num_free)+ ERR("heap exhausted");+}++/* Check that there are k nodes available, if not then GC. */+INLINE void+gc_check(size_t k)+{+ if (k < num_free)+ return;+ gc_for(k);+}++/* Add the thread to the tail of runq */+void+add_q_tail(struct mqueue *q, struct mthread *mt)+{+ if (!q->mq_head) {+ /* q is empty, so mt goes first */+ q->mq_head = mt;+ } else {+ /* link mt to the end of the runq */+ q->mq_tail->mt_queue = mt;+ }+ q->mq_tail = mt; /* mt is now last */+ mt->mt_queue = 0; /* mt is last, so no next */+}++void+add_runq_tail(struct mthread *mt)+{+ mt->mt_state = ts_runnable;+ add_q_tail(&runq, mt);+}++/* Add the thread to the head of runq */+void+add_runq_head(struct mthread *mt)+{+ mt->mt_state = ts_runnable;+ mt->mt_queue = runq.mq_head;+ runq.mq_head = mt;+ if (!runq.mq_tail)+ runq.mq_tail = mt; /* runq was empty */+}++/* Add the thread k to runq right after mt, which is in runq */+void+add_runq_after(struct mthread *mt, struct mthread *k)+{+ k->mt_state = ts_runnable;+ k->mt_queue = mt->mt_queue;+ mt->mt_queue = k;+ if (runq.mq_tail == mt)+ runq.mq_tail = k; /* mt was last */+}++struct mthread*+remove_q_head(struct mqueue *q)+{+ struct mthread *mt = q->mq_head; /* front thread */+ if (!mt)+ return 0;+ q->mq_head = mt->mt_queue; /* skip to next thread */+ if (!q->mq_head)+ q->mq_tail = 0; /* q is now empty */+ return mt;+}++int+find_and_unlink(struct mqueue *mq, struct mthread *mt)+{+ struct mthread **mtp;++ for(mtp = &mq->mq_head; *mtp && *mtp != mt; mtp = &(*mtp)->mt_queue)+ ;+ if (!*mtp)+ return 0; /* not found */+ *mtp = mt->mt_queue; /* unlink */+ if (*mtp)+ return 1; /* the unlinked thread was not the tail */+ if (mq->mq_head) {+ for (mt = mq->mq_head; mt->mt_queue; mt = mt->mt_queue)+ ; /* find the last element */+ mq->mq_tail = mt;+ } else {+ /* q is empty */+ mq->mq_tail = 0;+ }+ return 1;+}++/* This is a yucky hack */+bool doing_rnf = false; /* REMOVE */+jmp_buf rnf_skip; /* rnf() without errors: give up evaluating a node */+struct rnf_state {+ bits_t *rs_done; /* visited-node bitmap to free on unwind */+ struct handler *rs_hdl; /* cur_handler active when rnf() started */+ struct rnf_state *rs_old;+} *cur_rnf = 0;+#if THREAD_DEBUG+const bool thread_trace = false;+#endif /* THREAD_DEBUG */++/* clean up temporary globals to prepare for rescheduling */+void+cleanup(struct mthread *mt, enum th_state ts)+{+ /* We are going to reschedule, so clean up thread state:+ * stack pointer+ * error handlers+ */+#if THREAD_DEBUG+ if (thread_trace)+ printf("cleanup: %d state=%d\n", (int)mt->mt_id, ts);+#endif /* THREAD_DEBUG */+ mt->mt_slice = STACK_INDEX(stack_ptr); /* we need this many reductions to just reach where we left off */+ mt->mt_state = ts;+ CLEARSTK(); /* reset stack */+ doing_rnf = false;+ for (struct rnf_state *rs = cur_rnf; rs; rs = rs->rs_old)+ FREE(rs->rs_done);+ cur_rnf = 0;+ /* free all error handlers */+ for (struct handler *h = cur_handler; h; ) {+ struct handler *n = h;+ h = h->hdl_old;+ FREE(n);+ }+ cur_handler = 0;+}++/* reschedule, does not return */+NORETURN void+resched(struct mthread *mt, enum th_state ts)+{+ cleanup(mt, ts);+ longjmp(sched, mt_resched);+}++#if THREAD_DEBUG+void+dump_q(const char *s, struct mqueue q)+{+ printf(" %s=[", s);+ for(struct mthread *mt = q.mq_head; mt; mt = mt->mt_queue) {+ printf("%d ", (int)mt->mt_id);+ }+ printf("]\n");+}+#endif /* THREAD_DEBUG */++/* Check if its time to wake up some threads waiting for a time. */+void+check_timeq(void)+{+#if defined(CLOCK_INIT)+ CLOCK_T now = CLOCK_GET();+ while (timeq.mq_head && timeq.mq_head->mt_at <= now) {+ struct mthread *mt = remove_q_head(&timeq);+ add_runq_tail(mt);+ mt->mt_at = -1; /* indicate that the delay has expired */+#if THREAD_DEBUG+ if (thread_trace)+ printf("check_timeq: %d done\n", (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("check_timeq: exit\n");+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+#endif+}++void+check_pollq(int timeout)+{+#if WANT_IO_POLL+#define MAX_POLL_FDS 100+ struct pollfd fds[MAX_POLL_FDS];+ int nfds = 0;+ for(struct mthread *mt = pollq.mq_head; mt; mt = mt->mt_queue) {+ if (nfds >= MAX_POLL_FDS)+ ERR("check_pollq: too many FDs");+ fds[nfds].fd = mt->mt_fd;+ fds[nfds].events = mt->mt_events;+ nfds++;+ }+#if THREAD_DEBUG+ if (thread_trace)+ printf("check_pollq: enter poll(_, %d, %d)\n", nfds, timeout);+#endif /* THREAD_DEBUG */+ int r = poll(fds, nfds, timeout);+ if (r < 0)+ return; /* silently ignore errors */+ nfds = 0;+ struct mthread *next;+ for(struct mthread *mt = pollq.mq_head; mt; mt = next) {+ next = mt->mt_queue;+ if (fds[nfds].revents & (mt->mt_events | POLLHUP | POLLERR | POLLNVAL)) {+ /* Some event has happened, move the thread back to the runq. */+ find_and_unlink(&pollq, mt); /* remove from I/O queue */+ add_runq_tail(mt);+#if THREAD_DEBUG+ if (thread_trace)+ printf("check_pollq: FD=%d thread=%d done\n", mt->mt_fd, (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ mt->mt_fd = IO_POLL_EVENT_HAS_HAPPENED;+ }+ nfds++;+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("check_pollq: exit\n");+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+#endif /* WANT_IO_POLL */+}++/* Wake every thread that is blocked in throwTo waiting for mt to take its+ * exception. Called when mt takes one, and when mt finishes or dies. */+void+wake_throwto(struct mthread *mt)+{+ for (struct mthread *k; (k = remove_q_head(&mt->mt_exn->mv_read)); ) {+#if THREAD_DEBUG+ if (thread_trace)+ printf("wake_throwto: wake %d, which threw to %d\n", (int)k->mt_id, (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ /* The exception has been delivered, so the thrower continues next: at+ * the tail of the run queue it would first wait for a slice of every+ * other runnable thread, which made a loop of killThread quadratic. */+ k->mt_throwdone = true;+ if (runq.mq_head == mt)+ add_runq_after(mt, k); /* mt is the running thread (check_thrown): k goes right after it */+ else+ add_runq_head(k);+ }+}++/* mt has finished or died, so it takes no more exceptions. Release everyone+ * blocked in throwTo to it: the thrower whose exception is in mt's exception+ * MVar waits on its read queue, and further throwers wait in its put queue+ * because the MVar is full. Each of them runs throwTo again, finds mt gone,+ * and returns. */+void+release_throwto(struct mthread *mt)+{+ wake_throwto(mt);+ mt->mt_exn->mv_data = NIL_NODEPTR; /* an exception that was never taken */+ for (struct mthread *k; (k = remove_q_head(&mt->mt_exn->mv_takeput)); ) {+#if THREAD_DEBUG+ if (thread_trace)+ printf("release_throwto: wake %d, which threw to %d\n", (int)k->mt_id, (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ add_runq_tail(k);+ }+}++void+throwto(struct mthread *mt, NODEPTR exn)+{+#if THREAD_DEBUG+ if (thread_trace) {+ printf("throwto: id=%d\n", (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */+ struct mthread *me = runq.mq_head;++ if (mt == me) {+ /* Throwing to ourselves: just hand the exception over. It is raised at the+ * next interruption point, so there is nothing to wait for. */+ (void)put_mvar(false, mt->mt_exn, exn); /* never returns if it blocks */+ return;+ }+ if (me->mt_throwto == mt) {+ /* We handed the exception over in an earlier execution of this throwTo and+ * blocked; being back here means the target has taken it, or has died. */+#if THREAD_DEBUG+ if (thread_trace)+ printf("throwto: id=%d delivered\n", (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ me->mt_throwto = 0;+ return;+ }+ thread_intr(mt);+ if (mt->mt_state == ts_died || mt->mt_state == ts_finished)+ return; /* there is nothing left to interrupt */+#if THREAD_DEBUG+ if (thread_trace) {+ printf("throwto: id=%d put_mvar exn\n", (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */+ (void)put_mvar(false, mt->mt_exn, exn); /* never returns if it blocks */+ /* GHC's throwTo does not return until the exception has been raised in the+ * target thread, so wait for the target to take it. Without this the target+ * stays runnable with an exception pending, and can still run a stretch of+ * code -- and consume shared state -- before it is interrupted.+ * We wait on the read queue of the target's exception MVar: check_thrown and+ * a finishing thread wake it, and thread_intr searches it, so the wait is+ * itself interruptible. */+ me = remove_q_head(&runq);+ me->mt_throwto = mt;+ me->mt_throwdone = false;+ add_q_tail(&mt->mt_exn->mv_read, me);+ /* Let the target run next. If it is somewhere down the run queue (it was+ * runnable, or thread_intr has just put it at the tail) it would otherwise+ * take the exception only after every thread ahead of it has had a slice,+ * so killing n runnable threads cost n passes over the run queue. */+ if (mt->mt_state == ts_runnable && find_and_unlink(&runq, mt))+ add_runq_head(mt);+ resched(me, ts_wait_mvar); /* never returns */+}++/* mt is interrupted while it waits in throwTo. As in GHC, an interrupted throwTo+ * has no effect: if the target has not taken mt's exception yet, take it back.+ * (It is the one in the target's exception MVar, since mt waits on its read queue+ * until the target takes it.) The next thrower waiting to put one may then go on. */+void+revoke_throwto(struct mthread *mt)+{+ struct mthread *target = mt->mt_throwto;+ if (target && !mt->mt_throwdone) {+#if THREAD_DEBUG+ if (thread_trace)+ printf("revoke_throwto: %d revokes its exception to %d\n", (int)mt->mt_id, (int)target->mt_id);+#endif /* THREAD_DEBUG */+ /* Take our exception back; a thread waiting to throw to target may then put its own.+ * The MVar holds our exception, so this does not block. */+ (void)take_mvar(true, target->mt_exn);+ }+ mt->mt_throwto = 0;+ mt->mt_throwdone = false;+}++void+check_thrown(bool intr)+{+ struct mthread *me = runq.mq_head;+ if (me->mt_mask == mask_uninterruptible ||+ (!intr && me->mt_mask == mask_interruptible)) {+ /* interrupts are masked, so don't throw */+ return;+ }+ NODEPTR exn = take_mvar(true, me->mt_exn); /* get the exception */+ if (is_NIL(exn))+ return; /* no thrown exception */+ /* the current thread has an async exception */+ wake_throwto(me); /* the throwTo that sent it may now return */+ revoke_throwto(me); /* we are unwinding; drop any throwTo of our own */+ /* Clear any pending resume state so a caught exception cannot leak it. */+ me->mt_mval = NIL_NODEPTR;+#if defined(CLOCK_INIT)+ me->mt_at = 0;+#endif+#if WANT_IO_POLL+ me->mt_fd = IO_POLL_WAITING_FOR_NONE;+#endif+#if THREAD_DEBUG+ if (thread_trace)+ printf("check_thrown: exn for %d\n", (int)me->mt_id);+#endif /* THREAD_DEBUG */++ raise_exn(exn);+}++void+check_sigint(void)+{+#if WANT_SIGINT+ if (has_sigint) {+ /* We have a signal, so send an async exception to the main thread */+ has_sigint = false;+ for(struct mthread *mt = all_threads; mt; mt = mt->mt_next) {+ if (mt->mt_id == MAIN_THREAD) {+#if THREAD_DEBUG+ if (thread_trace)+ printf("sending signal to main\n");+#endif /* THREAD_DEBUG */+ async_throwto(mt, mkInt(exn_userinterrupt));+ break;+ }+ }+ }+#endif+}++/* Used to detect calls to error while we are already in a call to error. */+bool in_raise = false;++/* Inlining makes very little difference */+/*static INLINE*/ void+yield(void)+{+ if (in_raise) /* don't context switch when we are dying */+ return;+ COUNT(num_yield);+ runq.mq_head->mt_num_slices++;+ // XXX should check mt_thrown here++ YIELD_EXTRA; /* platform specific extra stuff */++ if (timeq.mq_head)+ check_timeq();+ check_thrown(false);+ check_sigint();++ if (pollq.mq_head) {+ /* Check if any threads blocked on IO can be scheduled. Since we pass in a delay of 0, checking+ * for the events will not block. */+ check_pollq(0);+ }++// printf("yield %p %d\n", runq, (int)stack_ptr);+ /* if there is nothing after in the runq then there is no need to reschedule */+ if (!runq.mq_head->mt_queue) {+#if THREAD_DEBUG+ if (thread_trace) {+ printf("yield: %d no other threads\n", (int)runq.mq_head->mt_id);+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ glob_slice = slice;+ num_reductions += glob_slice-1;+ return;+ }++ /* Unlink from runq */+ struct mthread *mt = remove_q_head(&runq);+ /* link into back of runq */+ add_runq_tail(mt);+#if THREAD_DEBUG+ if (thread_trace) {+ printf("yield: resched %d\n", (int)mt->mt_id);+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ resched(mt, ts_runnable);+}++struct mthread*+new_thread(NODEPTR root)+{+ struct mthread *mt = mmalloc(sizeof(struct mthread));++#if THREAD_DEBUG+ if (thread_trace) {+ printf("new_thread: mt=%p root=%p\n", mt, root.node_ptr);+ }+#endif /* THREAD_DEBUG */+ mt->mt_mask = mask_unmasked;+ mt->mt_root = root;+ mt->mt_exn = new_mvar();+ mt->mt_throwto = 0;+ mt->mt_throwdone = false;+ mt->mt_mval = NIL_NODEPTR;+ mt->mt_slice = 0;+ mt->mt_mark = false;+ mt->mt_num_slices = 0;+ mt->mt_id = num_thread_create++;+#if WANT_IO_POLL+ mt->mt_fd = IO_POLL_WAITING_FOR_NONE;+ mt->mt_events = 0;+#endif+#if defined(CLOCK_INIT)+ mt->mt_at = 0; /* delay has not expired */+#endif++ /* add to all_threads */+ mt->mt_next = all_threads;+ all_threads = mt;++ /* add to tail of runq */+ add_runq_tail(mt); /* sets runnable */+#if THREAD_DEBUG+ if (thread_trace) {+ printf("new_thread: add %d to runq tail\n", (int)mt->mt_id);+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ return mt;+}++struct mvar*+new_mvar(void)+{+ COUNT(num_mvar_alloc);+ struct mvar *mv = mmalloc(sizeof(struct mvar));++ mv->mv_data = NIL_NODEPTR;+ mv->mv_takeput.mq_head = 0;+ mv->mv_takeput.mq_tail = 0;+ mv->mv_read.mq_head = 0;+ mv->mv_read.mq_tail = 0;++ /* add to all_mvars */+ mv->mv_next = all_mvars;+ mv->mv_mark = false;+ all_mvars = mv;++#if THREAD_DEBUG+ if (thread_trace)+ printf("new_mvar: mvar=%p\n", mv);+#endif /* THREAD_DEBUG */+ return mv;+}++NODEPTR+take_mvar(bool try, struct mvar *mv)+{+#if THREAD_DEBUG+ if (thread_trace) {+ printf("take_mvar: start mvar=%p\n", mv);+ dump_q("takeput", mv->mv_takeput);+ }+#endif /* THREAD_DEBUG */+ NODEPTR n;+ if (!is_NIL(n = mv->mv_data)) {+ /* The mvar is full. */+#if THREAD_DEBUG+ if (thread_trace)+ printf("take_mvar: mvar=%p full\n", mv);+#endif /* THREAD_DEBUG */+ mv->mv_data = NIL_NODEPTR; /* now empty */++ /* move one thread waiting to put to the runq */+ struct mthread *mt;+ if((mt = remove_q_head(&mv->mv_takeput))) {+#if THREAD_DEBUG+ if (thread_trace) {+ printf("take_mvar: mvar=%p wake %d\n", mv, (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */+ add_runq_tail(mt);+#if THREAD_DEBUG+ if (thread_trace) {+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("take_mvar: end mvar=%p return %p\n", mv, n.node_ptr);+ }+#endif /* THREAD_DEBUG */+ return n; /* return the data */+ } else {+ /* The mvar is empty. */+#if THREAD_DEBUG+ if (thread_trace)+ printf("take_mvar: mvar=%p empty\n", mv);+#endif /* THREAD_DEBUG */+ /* mvar is empty */+ if (try)+ return NIL_NODEPTR;+ struct mthread *mt = remove_q_head(&runq);+ add_q_tail(&mv->mv_takeput, mt);+#if THREAD_DEBUG+ if (thread_trace) {+ printf("take_mvar: end mvar=%p suspend %d\n", mv, (int)mt->mt_id);+ dump_q("runq", runq);+ dump_q("takeput", mv->mv_takeput);+ }+#endif /* THREAD_DEBUG */+ /* Unlink from runq */+ resched(mt, ts_wait_mvar); /* never returns */+ NOTREACHED;+ }+}++NODEPTR+read_mvar(bool try, struct mvar *mv)+{+ NODEPTR n;+ if (!is_NIL(n = runq.mq_head->mt_mval)) {+ /* The putMVar delivers the data in mt_mval and wakes the thread.+ * So first first check if we already have data in mt_mval. */+ runq.mq_head->mt_mval = NIL_NODEPTR; /* empty again */+ return n; /* returned the stashed data */+ }+ if (!is_NIL(n = mv->mv_data)) {+ /* mvar is full */+ return n; /* return the data */+ } else {+ /* mvar is empty */+ if (try)+ return NIL_NODEPTR;+#if THREAD_DEBUG+ if (thread_trace) {+ printf("read_mvar: suspend %d\n", (int)runq.mq_head->mt_id);+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ struct mthread *mt = remove_q_head(&runq);+ add_q_tail(&mv->mv_read, mt);+ resched(mt, ts_wait_mvar); /* never returns */+ NOTREACHED;+ }+}++int+put_mvar(bool try, struct mvar *mv, NODEPTR v)+{+#if THREAD_DEBUG+ if (thread_trace) {+ printf("put_mvar: mvar=%p\n", mv);+ dump_q("takeput", mv->mv_takeput);+ dump_q("read", mv->mv_read);+ }+#endif /* THREAD_DEBUG */+ if (!is_NIL(mv->mv_data)) {+ /* The mvar is full. */+#if THREAD_DEBUG+ if (thread_trace)+ printf("put_mvar: mvar=%p full\n", mv);+#endif /* THREAD_DEBUG */+ if (try)+ return 0;+ struct mthread *mt = remove_q_head(&runq);+ add_q_tail(&mv->mv_takeput, mt); /* put on mvar queue */+#if THREAD_DEBUG+ if (thread_trace) {+ printf("put_mvar: suspend %d\n", (int)mt->mt_id);+ dump_q("runq", runq);+ dump_q("takeput", mv->mv_takeput);+ }+#endif /* THREAD_DEBUG */+ resched(mt, ts_wait_mvar); /* never returns */+ } else {+ /* The mvar is empty. */+#if THREAD_DEBUG+ if (thread_trace)+ printf("put_mvar: mvar=%p empty\n", mv);+#endif /* THREAD_DEBUG */+ /* mvar is empty */+ mv->mv_data = v; /* put the data in the mvar */+ if (mv->mv_takeput.mq_head || mv->mv_read.mq_head) {+ /* one or more threads are waiting */+ struct mthread *mt;+ if ((mt = remove_q_head(&mv->mv_takeput))) {+ /* wake up one 'take' */+#if THREAD_DEBUG+ if (thread_trace)+ printf("put_mvar: wake-1 %d\n", (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ add_runq_tail(mt); /* and schedule for execution later */+ }+ for(;;) {+ /* wake up all 'read' */+ mt = remove_q_head(&mv->mv_read);+ if (!mt)+ break;+#if THREAD_DEBUG+ if (thread_trace)+ printf("put_mvar: wake-N %d\n", (int)mt->mt_id);+#endif /* THREAD_DEBUG */+ if (!is_NIL(mt->mt_mval))+ ERR("put_mvar: mt_mval != NIL");+ mt->mt_mval = v; /* value for restarted read */+ add_runq_tail(mt); /* and schedule for execution later */+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("put_mvar: end\n");+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ /* return to caller */+ } else {+#if THREAD_DEBUG+ if (thread_trace) {+ printf("put_mvar: mvar=%p no waiters\n", mv);+ }+#endif /* THREAD_DEBUG */+ /* no threads waiting, so store the value */+ mv->mv_data = v;+ /* return to caller */+ }+ }+ return 1;+}++NORETURN void+thread_delay(uvalue_t usecs)+{+#if !defined(CLOCK_INIT)+ ERR("thread_delay: no clock");+#else+ /* XXX should check if there is already a throw exn */+ struct mthread *mt = remove_q_head(&runq);+ mt->mt_at = CLOCK_GET() + usecs; /* wakeup time */+#if THREAD_DEBUG+ if (thread_trace)+ printf("thread_delay: id=%d usecs=%ld\n", (int)mt->mt_id, (long)usecs);+#endif /* THREAD_DEBUG */+ /* insert in delayq which is kept sorted in time order */+ struct mthread **tq;+ for (tq = &timeq.mq_head; *tq; tq = &(*tq)->mt_queue) {+ if (mt->mt_at <= (*tq)->mt_at)+ break;+ }+ mt->mt_queue = *tq; /* forward link */+ *tq = mt; /* and put mt in place */+ if (!mt->mt_queue) /* no forward link */+ timeq.mq_tail = mt;+ resched(mt, ts_wait_time);+#endif+}++/* Pause execution if something might still happen */+void+pause_exec(void)+{+/*+ * We end up here if the run queue is empty. If there is no thread waiting for+ * a delay to expire, we will never resume operation and we are deadlocked. However, if+ * we compile with WANT_IO_POLL there might be threads waiting for IO events, so in+ * that case we check for them as well. If there is no thread waiting for a delay or an+ * IO event, we are deadlocked.+ */+#if WANT_IO_POLL+ /* Check for deadlock situation */+ if (!pollq.mq_head+#if defined(CLOCK_INIT)+ && !timeq.mq_head+#endif+ ) ERR("deadlock");++ /* Loop until at least one thread is runnable.*/+ while (!runq.mq_head) {+ int timeout_ms = -1; /* block indefinitely if only io_waiters */+#if defined(CLOCK_INIT)+ /* If there are threads blocked on delays, compute the timeout_ms to account for that. */+ if (timeq.mq_head) {+ CLOCK_T dly = timeq.mq_head->mt_at - CLOCK_GET();+ if (dly > 0) {+ /* poll() can be unreliable, so sleep shorter than the delay */+ dly /= 1100; /* 1.1=sleep shorter, 1000=convert us to ms */+ timeout_ms = dly == 0 ? 1 : dly; /* sleep at least 1ms to avoid busy wait */+ } else {+ timeout_ms = 0; /* delay has already expired */+ }+ }+ check_timeq();+ if (runq.mq_head)+ break;+#endif /* defined(CLOCK_INIT) */+ check_pollq(timeout_ms);+ check_sigint(); /* if there is a SIGINT, this will put a thread on the runq */+ }++#else /* !WANT_IO_POLL */++#if defined(CLOCK_INIT)+ if (timeq.mq_head) {+ struct mthread *mt;+ while (!runq.mq_head && (mt = timeq.mq_head)) {+ /* We are waiting for a delay to expire, so sleep a while */+ CLOCK_T dly = mt->mt_at - CLOCK_GET();+ if (dly > 0) {+ /* usleep() can be unreliable, so sleep shorter than the delay */+ dly /= 4;+ if (dly < 50) dly = 50;+ CLOCK_SLEEP((useconds_t)dly);+ }+ check_timeq();+ check_sigint();+ }+ } else {+#if THREAD_DEBUG+ if (0) {+ dump_q("runq", runq);+ dump_q("timeq", timeq);+ if (0) {+ for(struct mvar *mv = all_mvars; mv; mv = mv->mv_next) {+ printf("mvar %p, data=%p\n", mv, mv->mv_data.node_ptr);+ dump_q("takeput", mv->mv_takeput);+ }+ }+ for(struct mthread *mt = all_threads; mt; mt = mt->mt_next) {+ if (!is_NIL(mt->mt_exn->mv_data)) {+ printf("### bad thread ThreadId#%d mask=%d state=%d\n", (int)mt->mt_id, mt->mt_mask, mt->mt_state);+ }+ }+ }+#endif /* THREAD_DEBUG */+ ERR("deadlock"); /* XXX throw async to main thread */+ }+#else /* CLOCK_INIT */+ ERR("no clock");+#endif /* CLOCK_INIT */+#endif /* !WANT_IO_POLL */+}++/* Interrupt a sleeping thread in a throwTo/threadDelay */+void+thread_intr(struct mthread *mt)+{+#if THREAD_DEBUG+ if (thread_trace)+ printf("thread_intr: id=%d state=%d\n", (int)mt->mt_id, mt->mt_state);+#endif /* THREAD_DEBUG */+ switch(mt->mt_state) {+ case ts_runnable:+ break; /* already on runq */+ case ts_wait_mvar:+ if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */+ break;+ /* we don't know which mvar we are waiting on, so look at all of them */+ /* XXX should add a pointer in mthread to the mvar */+ for (struct mvar *mv = all_mvars; mv; mv = mv->mv_next) {+ if (find_and_unlink(&mv->mv_takeput, mt))+ goto found;+ if (find_and_unlink(&mv->mv_read, mt))+ goto found;+ }+ ERR("thread_intr: mvar");+ found:+ mt->mt_mval = NIL_NODEPTR; /* no longer waiting on the mvar */+ add_runq_tail(mt);+ break;+ case ts_wait_time:+#if THREAD_DEBUG+ if (thread_trace) {+ printf("thread_intr: ts_wait_time mask=%d\n", (int)mt->mt_mask);+ }+#endif /* THREAD_DEBUG */+ if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */+ break;+ /* find thread in timeq */+ if (!find_and_unlink(&timeq, mt))+ ERR("thread_intr: timeq");+ /* XXX should adjust mq_tail */+ add_runq_tail(mt);+ break;+ case ts_wait_io:+#if THREAD_DEBUG+ if (thread_trace) {+ printf("thread_intr: ts_wait_io mask=%d\n", (int)mt->mt_mask);+ }+#endif /* THREAD_DEBUG */+ if (mt->mt_mask == mask_uninterruptible) /* uninterruptible */+ break;+ /* find thread in pollq */+ if (!find_and_unlink(&pollq, mt))+ ERR("thread_intr: pollq");+#if WANT_IO_POLL+ mt->mt_fd = IO_POLL_WAITING_FOR_NONE;+#endif+ add_runq_tail(mt);+ break;+ case ts_finished:+ case ts_died:+#if THREAD_DEBUG+ if (thread_trace) {+ printf("thread_intr: finished/died\n");+ }+#endif /* THREAD_DEBUG */+ break;+ default:+ ERR("thread_intr");+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("thread_intr: done\n");+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+}++NORETURN void+raise_exn(NODEPTR exn)+{+ if (doing_rnf)+ longjmp(rnf_skip, 1);+ /* Free bitmaps of any rnf() calls we are unwinding past. */+ while (cur_rnf && cur_rnf->rs_hdl == cur_handler) {+ FREE(cur_rnf->rs_done);+ cur_rnf = cur_rnf->rs_old;+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("raise_exn: %p\n", exn.node_ptr);+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */++ if (cur_handler) {+ /* Pass the exception to the handler */+ cur_handler->hdl_exn = exn;+ longjmp(cur_handler->hdl_buf, 1);+ } else {+ /* No exception handler, jump to the scheduler */+ the_exn = exn;+ longjmp(sched, mt_raise);+ }+}++/* Raise a RTS exception identified by a number rather than an exception value */+NORETURN void+raise_rts(enum rts_exn exn) {+ raise_exn(mkInt(exn));+}++/***************** GC ******************/++/* Test if FREE bit is 0 */+static INLINE int is_marked_used(NODEPTR n)+{+ struct node *p = get_node_ptr(n);+ if (!p)+ return 1;+ heapoffs_t i = p - cells;+ if (i < heap_start)+ return 1;+#if SANITY+ if (i >= free_map_nwords * BITS_PER_WORD)+ ERR("is_marked_used");+#endif+ return (free_map[i / BITS_PER_WORD] & (1ULL << (i % BITS_PER_WORD))) == 0;+}++/*+ * Bump allocation inside a run of free cells (BUMP_ALLOC, default on).+ *+ * The free map is scanned first-fit in address order, so consecutive+ * allocations almost always come from consecutive cells anyway. Finding the+ * cell one at a time costs a word load, FFS, a bit clear and a store to+ * next_scan_index per allocation, and the store-forwarding chain through+ * free_map[i] and next_scan_index serialises back-to-back allocations.+ * Instead bump_refill() claims a whole run of free cells at once (clearing+ * their map bits eagerly) and alloc_node just bumps a pointer through it.+ * Runs average a few dozen cells on the self-compile, so the refill is cold.+ *+ * Invariants: num_free counts the cells not yet claimed, and num_alloc the+ * cells claimed, so neither changes per allocation. The claimed-but-unused+ * tail of the run (at most a map word) is counted as allocated: gc_check may+ * collect that much early, and NUM_ALLOC subtracts the tail, which a GC+ * abandons (mark_all_free). The map overstates "used" by that tail, which is+ * harmless because the map is only read by the GC, and gc() rebuilds it from+ * scratch.+ * bump_ptr/bump_end are globals, never cached in evali locals: longjmp+ * (T_CATCHR, resched) and nested GCs would otherwise see stale values.+ */+#if !defined(BUMP_ALLOC)+#define BUMP_ALLOC 1+#endif++#if BUMP_ALLOC+static struct node *bump_ptr, *bump_end; /* current run: [bump_ptr, bump_end) */+#define NUM_ALLOC (num_alloc - (counter_t)(bump_end - bump_ptr)) /* cells allocated */+#else+#define NUM_ALLOC num_alloc+#endif++static INLINE void mark_all_free(void)+{+ memset(free_map, ~0, free_map_nwords * sizeof(bits_t));+ next_scan_index = heap_start;+#if BUMP_ALLOC+ /* The map is about to be rebuilt by the marker (or is fresh at init), so a+ * run claimed from the old map is stale: its cells may now be live.+ * The unused tail of the run was never allocated. */+ num_alloc -= (counter_t)(bump_end - bump_ptr);+ bump_ptr = bump_end = 0;+#endif+}++#if BUMP_ALLOC+#if !defined(BUMP_MAX_WORDS)+#define BUMP_MAX_WORDS 16 /* max extra bitmap words claimed per refill */+#endif+/* Claim the next run of free cells into bump_ptr..bump_end. */+static ALWAYS_INLINE void+bump_refill_body(void)+{+ counter_t nf = num_free;+ heapoffs_t i = next_scan_index / BITS_PER_WORD;+ heapoffs_t nwords = free_map_nwords;+ heapoffs_t h_size = heap_size;+ bits_t *fmap = free_map;+ heapoffs_t pos;+ bits_t word, inv, mask;+ int k, run;++ /* This can happen if we run out of memory when parsing.+ * It also guarantees that the map has a free cell. */+ if (UNLIKELY(nf == 0))+ ERR("alloc_node");+ for(;;) {+ /* Not just under SANITY: an inconsistent num_free must not turn into a+ * read past the map. */+ if (UNLIKELY(i >= nwords))+ ERR("bump_refill: free_map");+ word = fmap[i];+ if (word)+ break;+ i++;+ }+ k = FFS(word) - 1; /* bit index of the first free cell */+ /* Run length = number of consecutive 1 bits starting at k. Bit 0 of+ * word >> k is set, so inv is 0 only for k == 0 with every bit set; that+ * case is handled explicitly because CTZ(0) is not portable. */+ inv = ~(word >> k);+ run = inv ? (int)CTZ(inv) : (int)(BITS_PER_WORD - k);+ pos = i * BITS_PER_WORD + k;+ /* The last map word has bits past heap_size when heap_size is not a+ * multiple of the word size; those bits are set but the cells do not exist. */+ if (pos + run > h_size)+ run = (int)(h_size - pos);+ mask = (run == (int)BITS_PER_WORD ? ~(bits_t)0 : (((bits_t)1 << run) - 1)) << k;+ fmap[i] = word & ~mask; /* claim the whole run now */+ /* If the run reached the end of this bitmap word and there is plenty of+ * headroom before GC, extend across consecutive free bits in following words. */+ if (k + run == (int)BITS_PER_WORD && nf >= 2 * (BUMP_MAX_WORDS + 1) * BITS_PER_WORD) {+ heapoffs_t j = i + 1;+ heapoffs_t full_words = h_size / BITS_PER_WORD;+ heapoffs_t j_end = j + BUMP_MAX_WORDS;+ if (j_end > full_words)+ j_end = full_words;+ while (j < j_end && fmap[j] == ~(bits_t)0) {+ fmap[j++] = 0;+ run += (int)BITS_PER_WORD;+ }+ if (j < j_end) {+ bits_t w2 = fmap[j];+ if (w2 & 1) {+ int r2 = (int)CTZ(~w2);+ fmap[j] = w2 & ~(((bits_t)1 << r2) - 1);+ run += r2;+ }+ }+ }+ num_free = nf - run;+ num_alloc += run;+ next_scan_index = pos + run;+ bump_ptr = HEAPREF(pos);+ bump_end = bump_ptr + run;+}++static NOINLINE void+bump_refill(void)+{+ bump_refill_body();+}+#endif /* BUMP_ALLOC */++/* Allocate a new node */+static INLINE struct node*+alloc_node_ptr(void)+{+ struct node *n;++#if BUMP_ALLOC+ if (bump_ptr == bump_end)+ bump_refill();+ n = bump_ptr++;+#else /* BUMP_ALLOC */+ /* This can happen if we run out of memory when parsing. */+ if (num_free <= 0)+ ERR("alloc_node");++ heapoffs_t i = next_scan_index / BITS_PER_WORD;+ int k; /* will contain bit pos + 1 */+ heapoffs_t pos;+ heapoffs_t word;++ for(;;) {+ word = free_map[i];+ if (word)+ break;+ i++;+#if SANITY+ if (i >= free_map_nwords) {+#if 0+ fprintf(stderr, "wordsize=%u, num_free=%u next_scan_index=%u i=%u free_map_nwords=%u\n", (uint)BITS_PER_WORD,+ (uint)num_free, (uint)next_scan_index, (uint)i, (uint)free_map_nwords);+#endif+ ERR("alloc_node: free_map");+ }+#endif+ }+ k = FFS(word);+ pos = i * BITS_PER_WORD + k - 1; /* first free node */+ n = HEAPREF(pos);+ // mark_used(n); // equivalent to:+ free_map[i] = word & (word-1);+ next_scan_index = pos;+ COUNT(num_alloc);+ num_free--;+#endif /* BUMP_ALLOC */++ return n;+}++/* Create a NODEPTR from a tag. Either a real node or an inline tag */+static INLINE NODEPTR+alloc_node(enum node_tag t)+{+ XASSERT(t < V_CONSTR || t > T_FIRST_REAL_TAG); /* V_ tags need extra info, use mk_CON/mk_CASE */+ if (t > T_FIRST_REAL_TAG)+ return mk_TAG(t);+ else {+ struct node *p = alloc_node_ptr();+ NODEPTR n;+ n.node_ptr = p;+ FUN(n) = mk_DATA_TAG(t);+ /* ARG slot uninitialized */+ return n;+ }+}++/* Create a new application node */+static INLINE NODEPTR+new_ap(NODEPTR f, NODEPTR a)+{+ struct node *p = alloc_node_ptr();+ NODEPTR n;+ n.node_ptr = p;+ FUN(n) = f;+ ARG(n) = a;+ return n;+}++NODEPTR evali(NODEPTR n);++/* If this is non-0 it means that the threading system is active. */+struct mthread *main_thread = 0;++void+start_exec(NODEPTR root)+{+ struct mthread *mt;++ mt = new_thread(new_ap(root, combWorld)); /* main thread */+ mt->mt_id = MAIN_THREAD; /* make it the main thread in case this is foreign export calling */+ main_thread = mt;++ switch(setjmp(sched)) {+ case mt_main:+ break;+ case mt_resched:+ COUNT(num_resched);+ break;+ case mt_raise:+ /* We have an uncaught exception.+ * If it's the main thread, this kills the program.+ * Otherwise, it just kills the thread.+ */+ if (in_raise) {+ ERR("FATAL: exception while trying to die");+ EXIT(1);+ }+ mt = remove_q_head(&runq);+ if (mt->mt_id == MAIN_THREAD) {+ die_exn(the_exn);+ } else {+#if THREAD_DEBUG+ if (thread_trace) {+ printf("start_exec: mt=%p id=%d died from exn\n", mt, (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */+ mt->mt_state = ts_died;+ mt->mt_root = NIL_NODEPTR;+ release_throwto(mt); /* release anyone blocked in throwTo to it */+ }+ }+#if THREAD_DEBUG+ if (thread_trace) {+ printf("start_exec:\n");+ dump_q("runq", runq);+ }+#endif /* THREAD_DEBUG */+ for(;;) {+ if (!runq.mq_head)+ pause_exec();+ mt = runq.mq_head; /* front thread */+ if (!mt) /* this should never happen */+ ERR("no threads");++ glob_slice = mt->mt_slice + slice;+#if THREAD_DEBUG+ if (thread_trace)+ printf("start_exec: start %d, slice=%d\n", (int)mt->mt_id, (int)glob_slice);+#endif /* THREAD_DEBUG */+ num_reductions += glob_slice-1;+ (void)evali(mt->mt_root); /* run it */+ num_reductions -= glob_slice;+ /* when evali() returns the thread is done */+ (void)remove_q_head(&runq); /* remove front thread */++#if THREAD_DEBUG+ if (thread_trace) {+ printf("start_exec: mt=%p id=%d finished\n", mt, (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */+ mt->mt_state = ts_finished;+ mt->mt_root = NIL_NODEPTR;+ release_throwto(mt); /* release anyone blocked in throwTo to it */+ /* XXX mt_mval, mt_thrown */++ if (mt->mt_id == MAIN_THREAD) {+ main_thread = 0;+#if THREAD_DEBUG+ if (thread_trace) {+ printf("start_exec: main thread done\n");+ }+#endif /* THREAD_DEBUG */+ return; /* when the main thread dies it's all over */+ }+ }+}++/* One node of each kind for primitives, these are never GCd. */+/* We use linear search in this, because almost all lookups+ * are among the combinators.+ */+static const+struct {+ const char *name;+ const enum node_tag tag;+ const uint8_t arity; /* the number of arguments it needs to reduce, see arity_virt */+ const enum node_tag flipped; /* What should (C op) reduce to? defaults to T_FREE */+ // NODEPTR node;+} primops[] = {+ /* combinators */+ { "B", T_B, 3 },+ { "O", T_O, 4 },+ { "K", T_K, 2, T_A },+ { "C'", T_CC, 4 },+ { "C", T_C, 3 },+ { "A", T_A, 2, T_K },+ { "S'", T_SS, 4 },+ { "P", T_P, 3 },+ { "R", T_R, 2 },+ { "I", T_I, 1 },+ { "S", T_S, 3 },+ { "U", T_U, 2 },+ { "Y", T_Y, 1 },+ { "B'", T_BB, 2 },+ { "Z", T_Z, 2 },+ { "K2", T_K2, 2 },+ { "K3", T_K3, 2 },+ { "K4", T_K4, 2 },+ { "C'B", T_CCB, 3 },+/* primops */+ { "+", T_ADD, 2, T_ADD },+ { "-", T_SUB, 2, T_SUBR },+ { "*", T_MUL, 2, T_MUL },+ { "quot", T_QUOT, 2 },+ { "rem", T_REM, 2 },+ { "u+", T_UADD, 2, T_UADD },+ { "u-", T_USUB, 2, T_USUBR },+ { "u*", T_UMUL, 2, T_UMUL },+ { "uquot", T_UQUOT, 2 },+ { "urem", T_UREM, 2 },+ { "subtract", T_SUBR, 2, T_SUB },+ { "usubtract", T_USUBR, 2, T_USUB },+ { "neg", T_NEG, 1 },+ { "uneg", T_UNEG, 1 },+ { "and", T_AND, 2, T_AND },+ { "or", T_OR, 2, T_OR },+ { "xor", T_XOR, 2, T_XOR },+ { "inv", T_INV, 1 },+ { "shl", T_SHL, 2 },+ { "shr", T_SHR, 2 },+ { "ashr", T_ASHR, 2 },+ { "popcount", T_POPCOUNT, 1 },+ { "clz", T_CLZ, 1 },+ { "ctz", T_CTZ, 1 },+#if WANT_FLOAT64+ { "d+", T_DADD, 2, T_DADD },+ { "d-", T_DSUB, 2 },+ { "d*", T_DMUL, 2, T_DMUL },+ { "d/", T_DDIV, 2 },+ { "dneg", T_DNEG, 1 },+ { "itod", T_ITOD, 1 },+ { "Itod", T_I64TOD, 1 },+ { "utod", T_UTOD, 1 },+ { "dtoi", T_DTOI, 1 },+ { "d==", T_DEQ, 2, T_DEQ },+ { "d/=", T_DNE, 2, T_DNE },+ { "d<", T_DLT, 2, T_DGT },+ { "d<=", T_DLE, 2, T_DGE },+ { "d>", T_DGT, 2, T_DLT },+ { "d>=", T_DGE, 2, T_DLE },+#endif /* WANT_FLOAT64 */+#if WANT_FLOAT64 && WANT_FLOAT32+ { "dtof", T_DTOF, 1 },+ { "ftod", T_FTOD, 1 },+#endif /* WANT_FLOAT64 && WANT_FLOAT32 */+#if WANT_FLOAT32+ { "f+", T_FADD, 2, T_FADD },+ { "f-", T_FSUB, 2 },+ { "f*", T_FMUL, 2, T_FMUL },+ { "f/", T_FDIV, 2 },+ { "fneg", T_FNEG, 1 },+ { "Itof", T_I64TOF, 1 },+ { "itof", T_ITOF, 1 },+ { "utof", T_UTOF, 1 },+ { "ftoi", T_FTOI, 1 },+ { "f==", T_FEQ, 2, T_FEQ },+ { "f/=", T_FNE, 2, T_FNE },+ { "f<", T_FLT, 2, T_FGT },+ { "f<=", T_FLE, 2, T_FGE },+ { "f>", T_FGT, 2, T_FLT },+ { "f>=", T_FGE, 2, T_FLE },+#endif /* WANT_FLOAT32 */++ { "bs++", T_BSAPPEND, 2 },+ { "bs++.", T_BSAPPENDDOT, 2 },+ { "bs==", T_BSEQ, 2, T_BSEQ },+ { "bs/=", T_BSNE, 2, T_BSNE },+ { "bs<", T_BSLT, 2, T_BSGT },+ { "bs<=", T_BSLE, 2, T_BSGE },+ { "bs>", T_BSGT, 2, T_BSLT },+ { "bs>=", T_BSGE, 2, T_BSLE },+ { "bscmp", T_BSCMP, 2 },+ { "bsunpack", T_BSUNPACK, 1 },+ { "bsreplicate", T_BSREPLICATE, 2 },+ { "bslength", T_BSLENGTH, 1 },+ { "bssubstr", T_BSSUBSTR, 3 },+ { "bsindex", T_BSINDEX, 2 },+ { "bsnew", T_BSNEW, 3 },+ { "bsread", T_BSREAD, 3 },+ { "bswrite", T_BSWRITE, 4 },+ { "bsfreeze", T_BSFREEZE, 2 },+ { "bsappbyte", T_BSAPPBYTE, 3 },+ { "bsappchar", T_BSAPPCHAR, 3 },++ { "ord", T_I, 1 },+ { "chr", T_I, 1 },+ { "==", T_EQ, 2, T_EQ },+ { "/=", T_NE, 2, T_NE },+ { "<", T_LT, 2, T_GT },+ { "u<", T_ULT, 2, T_UGT },+ { "u<=", T_ULE, 2, T_UGE },+ { "u>", T_UGT, 2, T_ULT },+ { "u>=", T_UGE, 2, T_ULE },+ { "<=", T_LE, 2, T_GE },+ { ">", T_GT, 2, T_LT },+ { ">=", T_GE, 2, T_LE },+ { "fp+", T_FPADD, 2 },+ { "fp2p", T_FP2P, 1 },+ { "fpnew", T_FPNEW, 2 },+ { "fpfin", T_FPFIN, 3 },+ // { "fpstr", T_FPSTR },+ { "fp2bs", T_FP2BS, 2 },+ { "bs2fp", T_BS2FP, 1 },+ { "seq", T_SEQ, 2 },+ { "icmp", T_ICMP, 2 },+ { "ucmp", T_UCMP, 2 },+ { "rnf", T_RNF, 2 },+ { "fromUTF8", T_BSFROMUTF8, 1 },+ { "headUTF8", T_BSHEADUTF8, 1 },+ { "tailUTF8", T_BSTAILUTF8, 1 },+ /* Data.Text helpers: lengths and offsets are in code points and bytes */+ { "utf8length", T_UTF8LENGTH, 1 },+ { "utf8offset", T_UTF8OFFSET, 2 },+ { "utf8offsetend", T_UTF8OFFSETEND, 2 },+ { "utf8offsetfrom", T_UTF8OFFSETFROM, 3 },+ { "utf8offsetendbefore", T_UTF8OFFSETENDBEFORE, 3 },+ { "utf8decode", T_UTF8DECODE, 2 },+ { "utf8decodeend", T_UTF8DECODEEND, 2 },+ { "utf8reverse", T_UTF8REVERSE, 1 },+ { "utf8skipspace", T_UTF8SKIPSPACE, 2 },+ { "utf8skipnonspace", T_UTF8SKIPNONSPACE, 2 },+ { "utf8trimspaceend", T_UTF8TRIMSPACEEND, 1 },+ { "bsfind", T_BSFIND, 3 },+ { "bsrfind", T_BSRFIND, 2 },+ { "bsasciicase", T_BSASCIICASE, 2 },+ { "bsisascii", T_BSISASCII, 1 },+ { "bsconcat", T_BSCONCAT, 1 },+ /* IO primops */+ { "IO.>>=", T_IO_BIND, 3 },+ { "IO.>>", T_IO_THEN, 2 },+ { "IO.return", T_IO_RETURN, 3 },+ { "IO.serialize", T_IO_SERIALIZE, 3 },+ { "IO.print", T_IO_PRINT, 3 },+ { "IO.deserialize", T_IO_DESERIALIZE, 2 },+ { "IO.stdin", T_IO_STDIN, 0 },+ { "IO.stdout", T_IO_STDOUT, 0 },+ { "IO.stderr", T_IO_STDERR, 0 },+ { "IO.getArgRef", T_IO_GETARGREF, 1 },+ { "IO.performIO", T_IO_PERFORMIO, 1 },+ { "IO.atomic", T_IO_ATOMIC, 2 },+ { "IO.gc", T_IO_GC, 2 },+ { "IO.stats", T_IO_STATS, 1 },+ { "IO.pp", T_IO_PP, 2 },+ { "nodeAddr", T_NODEADDR, 1 },+ { "IO.rtsinfo", T_IO_RTSINFO, 1 },+ { "IO.lazyBind", T_IO_LAZYBIND, 3 },+ { "IO.lazyBindST", T_IO_LAZYBINDST, 3 },+ { "IO.strict", T_IO_STRICT, 2 },+ { "raise", T_RAISE, 1 },+ { "catch", T_CATCH, 3 },+ { "catchr", T_CATCHR, 4 },+ { "A.alloc", T_ARR_ALLOC, 3 },+ { "A.copy", T_ARR_COPY, 2 },+ { "A.size", T_ARR_SIZE, 2 },+ { "A.read", T_ARR_READ, 3 },+ { "A.write", T_ARR_WRITE, 4 },+ { "A.trunc", T_ARR_TRUNC, 3 },+ { "A.==", T_ARR_EQ, 2 },+ { "IO.fork", T_IO_FORK, 2 },+ { "IO.thid", T_IO_THID, 1 },+ { "thnum", T_THNUM, 1 },+ { "IO.throwto", T_IO_THROWTO, 3 },+ { "IO.yield", T_IO_YIELD, 1 },+ { "IO.newmvar", T_IO_NEWMVAR, 1 },+ { "IO.takemvar", T_IO_TAKEMVAR, 2 },+ { "IO.putmvar", T_IO_PUTMVAR, 3 },+ { "IO.readmvar", T_IO_READMVAR, 2 },+ { "IO.trytakemvar", T_IO_TRYTAKEMVAR, 2 },+ { "IO.tryputmvar", T_IO_TRYPUTMVAR, 3 },+ { "IO.tryreadmvar", T_IO_TRYREADMVAR, 2 },+ { "IO.threaddelay", T_IO_THREADDELAY, 2 },+ { "IO.threadstatus", T_IO_THREADSTATUS, 2 },+ { "IO.getmaskingstate", T_IO_GETMASKINGSTATE, 1 },+ { "IO.setmaskingstate", T_IO_SETMASKINGSTATE, 2 },+ { "packCString", T_PACKCSTRING, 2 },+ { "packCStringLen", T_PACKCSTRINGLEN, 3 },+ { "bsgrab", T_BSGRAB, 2 },+ { "bsgrablen", T_BSGRABLEN, 3 },+ { "toPtr", T_TOPTR, 1 },+ { "toInt", T_TOINT, 1 },+ { "toDbl", T_TODBL, 1 },+ { "toFlt", T_TOFLT, 1 },+ { "fromDbl", T_FROMDBL, 1 },+ { "fromFlt", T_FROMFLT, 1 },+ { "toFunPtr", T_TOFUNPTR, 1 },+ { "IO.ccall", D_IO_CCALL, 0 },+ { "isint", T_ISINT, 1 },+ { "SPnew", T_SPNEW, 2 },+ { "SPderef", T_SPDEREF, 2 },+ { "SPfree", T_SPFREE, 2 },+ { "Wknew", T_WKNEW, 3 },+ { "Wknewfin", T_WKNEWFIN, 4 },+ { "Wkderef", T_WKDEREF, 2 },+ { "Wkfinal", T_WKFINAL, 2 },+ { "binint2", T_BININT2, 0 },+ { "binint1", T_BININT1, 0 },+ { "bindbl2", T_BINDBL2, 0 },+ { "bindbl1", T_BINDBL1, 0 },+ { "binbs2", T_BINBS2, 0 },+ { "binbs1", T_BINBS1, 0 },+ { "unint1", T_UNINT1, 0 },+ { "undbl1", T_UNDBL1, 0 },+ { "IO.waitrdfd", T_IO_WAITRDFD, 2 },+ { "IO.waitwrfd", T_IO_WAITWRFD, 2 },+#if WANT_INT64+ { "I+", T_ADD64, 2, T_ADD64 },+ { "I-", T_SUB64, 2, T_SUBR64 },+ { "I*", T_MUL64, 2, T_MUL64 },+ { "Iquot", T_QUOT64, 2 },+ { "Irem", T_REM64, 2 },+ { "Iu+", T_UADD64, 2, T_UADD64 },+ { "Iu-", T_USUB64, 2, T_USUBR64 },+ { "Iu*", T_UMUL64, 2, T_UMUL64 },+ { "Iuquot", T_UQUOT64, 2 },+ { "Iurem", T_UREM64, 2 },+ { "Isubtract", T_SUBR64, 2, T_SUB64 },+ { "Iusubtract", T_USUBR64, 2, T_USUB64 },+ { "Ineg", T_NEG64, 1 },+ { "Iuneg", T_UNEG64, 1 },+ { "Iand", T_AND64, 2, T_AND64 },+ { "Ior", T_OR64, 2, T_OR64 },+ { "Ixor", T_XOR64, 2, T_XOR64 },+ { "Iinv", T_INV64, 1 },+ { "Ishl", T_SHL64, 2 },+ { "Ishr", T_SHR64, 2 },+ { "Iashr", T_ASHR64, 2 },+ { "Ipopcount", T_POPCOUNT64, 1 },+ { "Iclz", T_CLZ64, 1 },+ { "Ictz", T_CTZ64, 1 },+ { "I==", T_EQ64, 2, T_EQ64 },+ { "I/=", T_NE64, 2, T_NE64 },+ { "I<", T_LT64, 2, T_GT64 },+ { "Iu<", T_ULT64, 2, T_UGT64 },+ { "Iu<=", T_ULE64, 2, T_UGE64 },+ { "Iu>", T_UGT64, 2, T_ULT64 },+ { "Iu>=", T_UGE64, 2, T_ULE64 },+ { "I<=", T_LE64, 2, T_GE64 },+ { "I>", T_GT64, 2, T_LT64 },+ { "I>=", T_GE64, 2, T_LE64 },+ { "Iicmp", T_ICMP64, 2 },+ { "Iucmp", T_UCMP64, 2 },+ { "itoI", T_ITOI64, 1 },+ { "Itoi", T_I64TOI, 1 },+ { "utoU", T_UTOU64, 1 },+ { "Utou", T_U64TOU, 1 },+#endif /* WANT_INT64 */+ { "tick", D_TICK, 1 }, /* fake op */+ { "D_", V_CASED, 0 },+ { "L_", V_LOOKD, 0 },+ { "E_", V_CASES, 0 },+ { "M_", V_LOOKS, 0 },+ { "C_", V_CONSTR, 0 },+};++#if GCRED+enum node_tag flip_ops[T_LAST_TAG+1];+#endif++/*+ * Use a hash table with open linear probing for the lookup of primpo names.+ * Make the hash table twice the size of the number of primops so we get a load factor of 0.5.+ */+#define PRIMOP_HASH_SIZE (2 * sizeof primops / sizeof primops[0] + 5)+/*+ * Without the + 5 above the time on my MacBook more that doubles!+ * It's a mystery why.+ */+static struct {+ const char *name; /* NULL marks an empty slot */+ enum node_tag tag;+} primop_hash[PRIMOP_HASH_SIZE];++/* FNV-1a hashing. It's simple and fast. */+static uint32_t+primop_hash_str(const char *s)+{+ uint32_t h = 2166136261;+ while (*s) {+ h ^= (uint8_t)*s++;+ h *= 16777619;+ }+ return h % PRIMOP_HASH_SIZE;+}++/* Build the initial table that maps a hash to a pair of a name and tag */+static void+init_primop_hash(void)+{+ size_t i;++ for (i = 0; i < sizeof primops / sizeof primops[0]; i++) {+ uint32_t k = primop_hash_str(primops[i].name);++ /* This slot is already occupied, so we progress to the next slot. */+ /* This must terminate, size the hash table is twice the size of the primops. */+ while (primop_hash[k].name) {+ k = (k + 1) % PRIMOP_HASH_SIZE;+ }+ primop_hash[k].name = primops[i].name;+ primop_hash[k].tag = primops[i].tag;+ }+}++/* Return the tag for a primop name, or -1 if there is no such primop. */+static int+lookup_primop(const char *name)+{+ uint32_t k = primop_hash_str(name);++ while (primop_hash[k].name) {+ if (strcmp(primop_hash[k].name, name) == 0)+ return (int)primop_hash[k].tag;+ k = (k + 1) % PRIMOP_HASH_SIZE;+ }+ return -1;+}++#if WANT_STDIO+/* Create a dummy foreign pointer for the standard stdio handles. */+/* These handles are never gc():d. */+void+mk_std(NODEPTR n, FILE *f)+{+ struct final *fin = mcalloc(1, sizeof(struct final));+ struct forptr *fp = mcalloc(1, sizeof(struct forptr));+ BFILE *bf = add_utf8(add_FILE(f));+ FORPTR(n) = fp;+ fin->arg = bf;+ fin->back = fp;+ fp->payload.bs_array = bf;+ fp->finalizer = fin;+}+#endif++void+init_nodes(void)+{+ size_t j;+ NODEPTR x;++ cells = mmalloc(heap_size * sizeof(node));+ free_map_nwords = (heap_size + BITS_PER_WORD - 1) / BITS_PER_WORD; /* bytes needed for free map */+ free_map = mmalloc(free_map_nwords * sizeof(bits_t));++ /* The permanent nodes are allocated from the start of the heap.+ * Afterwards heap_start is moved past them, so they are never GCed. */+ heap_start = 0;+ mark_all_free();+ num_free = heap_size;++ /* Initialize node name array.+ * Go backwards, so that the first name of a tag wins, e.g., I and not its aliases ord and chr. */+ for (j = sizeof primops / sizeof primops[0]; j-- > 0; ) {+ tag_names[primops[j].tag] = primops[j].name;+ tag_arity[primops[j].tag] = primops[j].arity;+#if GCRED+ flip_ops[primops[j].tag] = primops[j].flipped;+#endif+ }+ init_primop_hash();++ /* Set up permanent nodes */+#if INTTABLE+ /* Allocate permanent Int nodes */+ for (int i = LOW_INT; i < HIGH_INT; i++) {+ NODEPTR n = alloc_node(D_INT);+ intTable[i - LOW_INT] = n;+ SETVALUE(n, i);+ }+#endif++#if WANT_STDIO+ comb_stdin = alloc_node(D_FORPTR); mk_std(comb_stdin, stdin);+ comb_stdout = alloc_node(D_FORPTR); mk_std(comb_stdout, stdout);+ comb_stderr = alloc_node(D_FORPTR); mk_std(comb_stderr, stderr);+#endif++ /* The displaySomeException compiles to (D_2 (U (K2 A))) */+ x = new_ap(combK2, combA); /* (K2 A) */+ x = new_ap(combU, x); /* (U (K2 A)) */+ {+ uint8_t arities[1] = { 2 }; /* SomeException has a dictionary and a value */+ combShowExn = new_ap(mk_CASE(V_CASED, find_case_arity(1, 0, arities)), x); /* (D_2 (U (K2 A))) */+ }++ /* The IO monad uses pairs implemented with Scott encoding, i.e., with P */+ combPUnit = new_ap(combP, combUnit);+ combPFst = new_ap(combU, combK); /* fst for pairs constructed with P */+ combPSnd = new_ap(combU, combA); /* snd for pairs constructed with P */+ combWorld = mkInt(99999);++ spare_node = alloc_node(D_INT);++ /* The permanent nodes occupy [0 .. next_scan_index].+ * Round up heap_start to the next bitword boundary to avoid the permanent nodes. */+ heap_start = (next_scan_index + 1 + BITS_PER_WORD - 1) / BITS_PER_WORD * BITS_PER_WORD;+ if (heap_start >= heap_size)+ ERR("heap too small");+ mark_all_free(); /* also sets next_scan_index = heap_start */++ num_free = heap_size - heap_start;+}++#if GCRED+counter_t red_a, red_k, red_i, red_int, red_flip, red_bi, red_bxi, red_ccbi, red_cc, red_cci, red_ccbbcp;+#endif+counter_t red_bb, red_k4, red_k3, red_k2, red_ccb, red_z, red_r;++//counter_t mark_depth;+//counter_t max_mark_depth = 0;++void mark(NODEPTR *np);+void mark_mvar(struct mvar *mv);+void mark_thread(struct mthread *mt);+void mark_parse(void);++/* Follow indirections */+static INLINE NODEPTR+indir(NODEPTR *np)+{+ NODEPTR n = *np;+ NODEPTR p = get_IND(n);+ if (is_NIL(p))+ return n;+ do {+ n = p;+ p = get_IND(n);+ } while (!is_NIL(p));+ *np = n;+ return n;+}++/***** weak pointers *****/++struct weak_ptr {+ struct weak_ptr *next; /* list of all weak pointers. */+ int marked; /* seen by GC */+ NODEPTR key; /* key, this is the weak pointer */+ NODEPTR value; /* associated value */+ NODEPTR finalize; /* maybe finalizer */+};+struct weak_ptr *allweaks; /* head of all weak pointers */++/* After GC mark phase, deal with weak pointers */+void+sweep_weaks(void)+{+ /* Fixed-point mark: while any live weak pointer has a marked key,+ * mark its value and finalizer, which may in turn mark other keys. */+ bool changed;+ do {+ changed = false;+ for (struct weak_ptr *wp = allweaks; wp; wp = wp->next) {+ if (is_NIL(wp->value))+ continue; /* the weak pointer is already dead */+ (void)indir(&wp->key);+ if (is_marked_used(wp->key)) {+ /* The key is used, so mark the other parts */+ if (!is_marked_used(wp->value) ||+ (!is_NIL(wp->finalize) && !is_marked_used(wp->finalize))) {+ /* Not already marked */+ mark(&wp->value);+ if (!is_NIL(wp->finalize))+ mark(&wp->finalize);+ /* This marking might have marked other keys, so scan again */+ changed = true;+ }+ }+ }+ } while (changed);++ /* Kill all weak pointers whose keys remained unmarked.+ * Done before marking finalizers so finalizers cannot resurrect keys. */+ for (struct weak_ptr *wp = allweaks; wp; wp = wp->next) {+ if (!is_NIL(wp->value) && !is_marked_used(wp->key)) {+ wp->value = NIL_NODEPTR;+ wp->key = NIL_NODEPTR; /* not needed, but for sanity */+ }+ }++ /* Create finalizers for all weak pointers that just died */+ for (struct weak_ptr *wp = allweaks; wp; wp = wp->next) {+ if (is_NIL(wp->value) && !is_NIL(wp->finalize)) {+ struct mthread *mt = new_thread(wp->finalize);+ mark_thread(mt); /* mark it, since overall thread marking has already run */+ wp->finalize = NIL_NODEPTR;+ /* Marking the finalizer does not resurrect keys */+ }+ }++ /* If a weak pointer object is unreferenced and it has been finalized,+ * then it can be garbage collected. */+ for (struct weak_ptr **wpp = &allweaks; *wpp; ) {+ struct weak_ptr *wp = *wpp;+ if (!wp->marked && is_NIL(wp->value)) {+ /* not marked, so unlink and free */+ *wpp = wp->next;+ COUNT(num_gc_weak);+ FREE(wp);+ } else {+ wp->marked = 0; /* reset for next GC */+ /* point to the next weak_ptr */+ wpp = &wp->next;+ }+ }+}++NODEPTR+new_weak_ptr(NODEPTR key, NODEPTR value, NODEPTR finalize)+{+ struct weak_ptr *wp = mmalloc(sizeof(struct weak_ptr));+ wp->next = allweaks;+ allweaks = wp;+ wp->marked = 0;+ wp->key = key;+ wp->value = value;+ if (!is_NIL(finalize)) {+ wp->finalize = new_ap(finalize, combWorld);+ } else {+ wp->finalize = NIL_NODEPTR;+ }++ COUNT(num_new_weak);+ NODEPTR n = alloc_node(D_WEAK);+ WEAK(n) = wp;+ return n;+}++NODEPTR+deref_weak_ptr(struct weak_ptr *wp)+{+ if (is_NIL(wp->value))+ return combNothing;+ return new_ap(combJust, wp->value);+}++void+finalize_weak_ptr(struct weak_ptr *wp)+{+ NODEPTR final = wp->finalize;+ wp->value = NIL_NODEPTR;+ wp->key = NIL_NODEPTR;+ if (is_NIL(final))+ return;+ wp->finalize = NIL_NODEPTR;+ PUSH(final);+ (void)evali(TOP(0));+ POP(1);+}++/**********************************************************/++/* Throwing, e.g., a UserInterrupt exception, to the main thread+ * can happen from any thread (the one that happens to poll).+ * Throwing an exception can block, so we can't throw it from+ * the current thread. Instead, we spawn a new thread, whose+ * only job it is to throw the exception.+ */+void+async_throwto(struct mthread *mt, NODEPTR exn)+{+ GCCHECKSAVE(exn, 4);+ NODEPTR thid = alloc_node(D_THID);+ THR(thid) = mt; /* thread ID for mt */+ NODEPTR root = new_ap(new_ap(new_ap(combTHROWTO, thid), exn), combWorld); /* root = throwTo thid exn */+ (void)new_thread(root); /* spawn and put on runq, i.e., forkIO root */+}++void+mark_thread(struct mthread *mt)+{+ if (mt->mt_mark)+ return; /* already marked */+ mt->mt_mark = true;+ if (!is_NIL(mt->mt_root))+ mark(&mt->mt_root);+ mark_mvar(mt->mt_exn);+ if (mt->mt_throwto)+ mark_thread(mt->mt_throwto);+ if (!is_NIL(mt->mt_mval))+ mark(&mt->mt_mval);+}++void+mark_mvar(struct mvar *mv)+{+ if (mv->mv_mark)+ return;+ mv->mv_mark = true;+ if (!is_NIL(mv->mv_data))+ mark(&mv->mv_data);+ for (struct mthread *mt = mv->mv_takeput.mq_head; mt; mt = mt->mt_queue)+ mark_thread(mt);+ for (struct mthread *mt = mv->mv_read.mq_head; mt; mt = mt->mt_queue)+ mark_thread(mt);+}++#if GCRED+/* The evaluation stack pointer when the GC started.+ * The mark phase pushes on the same stack, so stack_ptr cannot be used by gc_red_ok(). */+NODEPTR *gc_eval_stack_ptr;++/*+ * Only allow GC reductions when the node is not near the top of the stack.+ * The reason is that when GC is triggered we are just starting a reduction+ * and the combinator at the left-bottom of the spine is being reduced.+ * If a GC reduction removes this combinator, then bad things happen.+ */+static int+gc_red_ok(NODEPTR n)+{+ for (NODEPTR *s = gc_eval_stack_ptr; s < stack_bot && s - gc_eval_stack_ptr <= 5; s++)+ if (n.node_ptr == s->node_ptr)+ return 0;+ return 1;+}++/*+ * Try to do a reduction of the application node n during GC.+ * If one applies, n is turned into an indirection to the result, and the result is returned.+ * Otherwise NIL is returned.+ * All reductions just select an existing node or a combinator, so nothing is allocated.+ */+static NOINLINE NODEPTR+gc_reduce(NODEPTR n)+{+ NODEPTR fun = indir(&FUN(n));+ NODEPTR arg = indir(&ARG(n));+ enum node_tag funt = get_XTAG(fun);+ enum node_tag argt = get_XTAG(arg);+ enum node_tag funfunt = funt == X_AP ? get_XTAG(indir(&FUN(fun))) : D_NONE;+ enum node_tag funargt = argt == X_AP ? get_XTAG(indir(&FUN(arg))) : D_NONE;+ NODEPTR r;++ switch (funfunt) {+ case T_A:+ /* A x y --> y. This is really only fruitful just after parsing. */+ r = arg;+ COUNT(red_a);+ goto red;+ case T_K:+ /* K x y --> x */+ r = indir(&ARG(fun));+ COUNT(red_k);+ goto red;+ case T_B:+ if (argt == T_I) {+ /* B x I --> x */+ r = indir(&ARG(fun));+ COUNT(red_bxi);+ goto red;+ }+ break;+ case T_CCB:+ if (argt == T_I) {+ /* C'B x I --> x */+ r = indir(&ARG(fun));+ COUNT(red_ccbi);+ goto red;+ }+ break;+ default:+ break;+ }++ switch (funt) {+ case T_I:+ /* I x --> x */+ r = arg;+ COUNT(red_i);+ goto red;+ case T_CC:+ if (argt == T_I) {+ /* C' I --> C */+ r = combC;+ COUNT(red_cci);+ goto red;+ }+ break;+ case T_CCB:+ if (argt == X_AP && get_XTAG(indir(&ARG(arg))) == T_P) {+ NODEPTR funarg = indir(&FUN(arg));+ if (get_XTAG(funarg) == X_AP &&+ get_XTAG(indir(&FUN(funarg))) == T_B &&+ get_XTAG(indir(&ARG(funarg))) == T_C) {+ /* C'B ((B C) P) --> C */+ r = combC;+ COUNT(red_ccbbcp);+ goto red;+ }+ }+ break;+ case T_B:+ if (argt == T_I) {+ /* B I --> I */+ r = combI;+ COUNT(red_bi);+ goto red;+ }+ break;+ case T_C:+ if (funargt == T_C) {+ /* C (C x) --> x */+ r = indir(&ARG(arg));+ COUNT(red_cc);+ goto red;+ }+ if (flip_ops[argt] != D_NONE) {+ /* C op --> flipped op */+ r = mk_TAG(flip_ops[argt]);+ COUNT(red_flip);+ goto red;+ }+ break;+ default:+ break;+ }+ return NIL_NODEPTR;++ red:+ /* Don't create an indirection loop, e.g., for x = I x */+ if (r.node_bits == n.node_bits || !gc_red_ok(n))+ return NIL_NODEPTR;+ set_IND(n, r);+ return r;+}+#endif /* GCRED */++/*+ * Marking is a DRAM-latency bound pointer chase: a cell is visited once per+ * GC and almost never in cache, so each visit costs a full miss.+ * The work stack lets us know the next MARK_PFQ cells in advance, so we+ * prefetch them and keep that many misses in flight (a FIFO prefetch queue+ * as in Cher et al., "Software prefetching for mark-sweep GC").+ * On an Apple M1 this cut mark time by about 3x; 16 entries was the knee.+ * Set -DMARK_PFQ=0 to get the plain stack-driven loop (e.g. embedded targets).+ */+#if !defined(MARK_PFQ)+#define MARK_PFQ 16+#endif+#if defined(__has_builtin)+#if __has_builtin(__builtin_prefetch)+#define MARK_PREFETCH(p) __builtin_prefetch(p)+#endif+#elif defined(__GNUC__)+#define MARK_PREFETCH(p) __builtin_prefetch(p)+#endif+#if !defined(MARK_PREFETCH)+/* No prefetch available, so the ring would be pure overhead. */+#undef MARK_PFQ+#define MARK_PFQ 0+#endif+#if MARK_PFQ > 0 && !defined(MARK_PFQ_MAXDEPTH)+/*+ * The ring reorders the depth-first walk: it always refills from the newest+ * work-stack entries and consumes one entry per visit, so on a long spine+ * whose visits push more entries than they consume (a list of records,+ * a string read from a handle, ...) the older entries are stranded on the+ * stack and it grows linearly with the length of the list instead of staying+ * at the depth of the structure. Above this much growth within one mark()+ * call the plain depth-first step is used until the stack has drained again,+ * which bounds the extra stack to this limit plus the structure's depth.+ * The self-compile peaks around 20K slots, well below the default.+ */+#define MARK_PFQ_MAXDEPTH ((stackptr_t)(stack_size / 8))+#endif++static INLINE int+is_marked_used_fast(NODEPTR n, struct node *h_cells, struct node *h_end, heapoffs_t h_start, bits_t *h_fmap)+{+ struct node *p = get_node_ptr(n);+ if (!p)+ return 1;+#if SANITY+ if (p < h_cells || p >= h_end)+ ERR("is_marked_used");+#else+ (void)h_end;+#endif+ heapoffs_t i = (heapoffs_t)(p - h_cells);+ if (i < h_start)+ return 1;+ return (h_fmap[i / BITS_PER_WORD] & ((bits_t)1 << (i % BITS_PER_WORD))) == 0;+}++/* Push a pointer to a NODEPTR slot on the stack, for the mark phase. */+#if MAXSTACKDEPTH+#define MARK_MAXSTACK if (STACK_INDEX(sp) > max_stack_depth) max_stack_depth = STACK_INDEX(sp)+#else+#define MARK_MAXSTACK+#endif+#if STACKOVL+#define MARK_PUSH_SLOT(s) do { if (sp <= sp_limit) stackerr(); (*--sp).node_pptr = (s); MARK_MAXSTACK; } while(0)+#else+#define MARK_PUSH_SLOT(s) do { (*--sp).node_pptr = (s); MARK_MAXSTACK; } while(0)+#endif++/* Mark all used nodes reachable from *np, updating *np. */+void+mark(NODEPTR *np)+{+ NODEPTR * const stk = stack_ptr;+ NODEPTR *sp = stk;+#if STACKOVL+ NODEPTR * const sp_limit = stack_limit;+#endif+ struct node * const h_cells = cells;+ struct node * const h_end = h_cells + heap_size;+ const heapoffs_t h_start = heap_start;+ bits_t * const h_fmap = free_map;+#if GCRED+ const int h_gc_red = want_gc_red;+#endif+ counter_t marked = 0;+ NODEPTR n;+ struct node *p;+#if MARK_PFQ > 0+ /* Ring of pending slots whose cells have been prefetched.+ * Every (possibly nested) mark() call owns its own ring and drains it+ * before returning, so recursion for integer leaves and the+ * thread/mvar side structures is unaffected. */+ NODEPTR *pfq[MARK_PFQ];+ unsigned pfq_head = 0, pfq_tail = 0, pfq_n = 0;+ NODEPTR * const pfq_floor = stk - stack_limit > MARK_PFQ_MAXDEPTH ? stk - MARK_PFQ_MAXDEPTH : stack_limit;+#endif++ // mark_depth++;+ // if (mark_depth % 10000 == 0)+ // PRINT("mark depth %"PRIcounter"\n", mark_depth);+ top:+ n = indir(np);+ p = get_node_ptr(n);+ if (!p)+ goto fin; /* not a real pointer, but there may be more pending work */++ /* n/p points to a real node */+ if (p < h_cells || p >= h_end)+ ERR("bad n");+ heapoffs_t idx = (heapoffs_t)(p - h_cells);+ if (idx < h_start)+ goto fin;+ bits_t *fp = &h_fmap[idx / BITS_PER_WORD];+ bits_t mask = (bits_t)1 << (idx % BITS_PER_WORD);+ bits_t word = *fp;+ if ((word & mask) == 0)+ goto fin;+ *fp = word & ~mask;+ marked++;++ NODEPTR f = FUN(n);+ if (is_AP(f)) {+#if GCRED+ if (h_gc_red) {+ NODEPTR r = gc_reduce(n);+ if (!is_NIL(r)) {+ /* n is now an indirection to r. Redirect this reference and mark r;+ * other references to n will be redirected when they are marked. */+ *np = r;+ goto top;+ }+ f = FUN(n); /* gc_reduce may have redirected FUN(n) */+ }+#endif /* GCRED */+#if MARK_PFQ > 0+ if (sp >= pfq_floor) {+ /* The probe keeps already-marked (shared) nodes, and virtual pointers,+ * off the work stack; it only touches the bitmap, not the cell.+ * The cell itself is not read until the ring has prefetched it, which is+ * why the mark-integer-leaves shortcut of the plain step below (it needs+ * the cell's tag) is not used. */+ NODEPTR a = ARG(n);+ if (!is_marked_used_fast(a, h_cells, h_end, h_start, h_fmap))+ MARK_PUSH_SLOT(&ARG(n));+ /* FUN becomes a work item too, so the ring can prefetch it.+ * It is pushed last so that the spine is still walked first. */+ if (!is_marked_used_fast(f, h_cells, h_end, h_start, h_fmap))+ MARK_PUSH_SLOT(&FUN(n));+ goto fin;+ }+ /* Stack has grown too much (see MARK_PFQ_MAXDEPTH): plain step. */+#endif /* MARK_PFQ */+ /* Mark integer leaves immediately instead of deferring them while walking+ * the other branch. In particular, a string can contain a distinct integer+ * node (behind an indirection) for every character read from a handle.+ */+ if (get_XTAG(indir(&ARG(n))) == D_INT) {+ stack_ptr = sp;+ mark(&ARG(n));+ sp = stack_ptr;+ } else if (!is_marked_used_fast(ARG(n), h_cells, h_end, h_start, h_fmap)) {+ /* The probe keeps already-marked (shared) nodes off the work stack. */+ PREFETCH_READ(ARG(n).node_ptr); /* won't be popped and dereferenced until later */+ MARK_PUSH_SLOT(&ARG(n));+ }+ /* Iterate straight down the spine; keeps the work stack shallow. */+ np = &FUN(n);+ goto top;+ }++ switch (get_DATA_TAG(f)) {+#if GCRED && INTTABLE+ case D_INT:+ {+ /* Replace a small INT by the shared permanent node */+ value_t val = GETVALUE(n);+ if (LOW_INT <= val && val < HIGH_INT) {+ NODEPTR i = intTable[val - LOW_INT];+ set_IND(n, i); /* other references will be redirected later */+ *np = i; /* redirect this reference */+ COUNT(red_int);+ }+ goto fin;+ }+#endif /* GCRED && INTTABLE */+ case D_ARR:+ {+ struct ioarray *arr = ARR(n);++ // arr->marked records marking progress through arr.+ if (arr->marked >= arr->size) {+ // An empty array has nothing to scan, but the sweep must keep it.+ if (arr->size == 0)+ arr->marked = 1;+ goto fin;+ }+ // We unmark the array as a whole and push it as long+ // as there's more entries to scan.+ *fp |= mask;+ marked--;+ MARK_PUSH_SLOT(np);+ if (!is_marked_used_fast(arr->array[arr->marked], h_cells, h_end, h_start, h_fmap))+ MARK_PUSH_SLOT(&arr->array[arr->marked]);+ arr->marked++;+ goto fin;+ }++ case D_FORPTR:+ FORPTR(n)->finalizer->marked = 1;+ goto fin;++ case D_THID:+ stack_ptr = sp;+ mark_thread(THR(n));+ sp = stack_ptr;+ goto fin;++ case D_MVAR:+ stack_ptr = sp;+ mark_mvar(MVAR(n));+ sp = stack_ptr;+ goto fin;++ case D_WEAK:+ WEAK(n)->marked = 1;+ goto fin;++ default:+ goto fin;+ }++ fin:+#if MARK_PFQ > 0+ if (sp >= pfq_floor) {+ /* Top up the ring from the work stack, issuing a prefetch for each+ * pending cell, then process the oldest entry: by now its cell has had+ * MARK_PFQ-1 other visits worth of time to arrive in cache. */+ while (pfq_n < MARK_PFQ && sp < stk) {+ NODEPTR *slot = (*sp++).node_pptr;+ MARK_PREFETCH(slot->node_ptr);+ pfq[pfq_tail] = slot;+ pfq_tail = (pfq_tail + 1) % MARK_PFQ;+ pfq_n++;+ }+ if (pfq_n > 0) {+ np = pfq[pfq_head];+ pfq_head = (pfq_head + 1) % MARK_PFQ;+ pfq_n--;+ goto top;+ }+ /* Ring empty here means the loop above found the stack empty. */+ stack_ptr = sp;+ num_marked += marked;+ return;+ }+ /* Too deep (see MARK_PFQ_MAXDEPTH): plain depth-first pops until the+ * stack has drained; the ring's pending entries wait, they are picked up+ * again when the ring is resumed. */+#endif /* MARK_PFQ */+ if (sp < stk) {+ np = (*sp++).node_pptr;+ goto top;+ }+ stack_ptr = sp;+ num_marked += marked;+}++/* Perform a garbage collection:+ - Mark nodes from the stack+ - Mark permanent arrays+ - Mark threads that have a root+ - Scan and free arrays+ - Scan and free foreign pointers and run finalizers+ - Scan and free threads+ - Scan and free mvars+*/+void+gc(void)+{+ stackptr_t i;+ NODEPTR *sp;+ //printf("****** GC ********\n");++ // gc_tot += stack_ptr+1;++ num_gc++;+ num_marked = 0;+#if WANT_STDIO+ if (verbose > 1)+ PRINT("gc mark\n");+#endif+ gc_mark_time -= GETTIMEMILLI();+ mark_all_free();+#if GCRED+ gc_eval_stack_ptr = stack_ptr;+#endif+ /* Mark everything reachable from the stack */+ for (sp = stack_bot; sp > stack_ptr; )+ mark(--sp);++ /* Mark the labelled nodes of a parse in progress */+ mark_parse();++ /* Mark everything reachable from permanent array nodes */+ for (struct ioarray *arr = array_root; arr; arr = arr->next) {+ if (arr->permanent) {+ for (i = 0; i < arr->size; i++)+ mark(&arr->array[i]);+ }+ }++ /* Mark all FFI exports */+ if (xffe_table) {+ for(struct ffe_entry *f = xffe_table; f->ffe_name; f++) {+ mark((NODEPTR*)&f->ffe_value);+ }+ }++ /* Mark used stable pointers */+ for (size_t i = 0; i < sp_capacity; i++) {+ if (!is_NIL(sp_table[i]))+ mark(&sp_table[i]);+ }++ /* Mark everything reachable from the threads.+ * Note, zombie threads have no root so they are not marked.+ */+ for (struct mthread *mt = all_threads; mt; mt = mt->mt_next) {+ if (!is_NIL(mt->mt_root))+ mark_thread(mt);+ }++ /* check for unmarked weak pointers */+ sweep_weaks();++ gc_mark_time += GETTIMEMILLI();++ if (num_marked > max_num_marked)+ max_num_marked = num_marked;+ num_free = heap_size - heap_start - num_marked;+ if (num_free < heap_size / 50)+ ERR("heap exhausted");++ gc_scan_time -= GETTIMEMILLI();+ /* Free unused arrays */+ for (struct ioarray **arrp = &array_root; *arrp; ) {+ struct ioarray *arr = *arrp;+ if (arr->marked || arr->permanent) {+ arr->marked = 0;+ arrp = &arr->next;+ } else {+ *arrp = arr->next; /* unlink */+ num_arr_free++;+ FREE(arr); /* and FREE */+ }+ }++ /* Run finalizers on unused foreign pointers. */+ for (struct final **finp = &final_root; *finp; ) {+ struct final *fin = *finp;+ if (fin->marked) {+ fin->marked = 0;+ finp = &fin->next;+ } else {+ /* Unused, run finalizer and free all associated memory */+ if (fin->size == NOSIZE) {+ num_fin_free++;+ } else {+ num_bs_free++;+ num_bs_inuse -= fin->size;+ if (num_bs_alloc - num_bs_free > num_bs_alloc_max)+ num_bs_alloc_max = num_bs_alloc - num_bs_free;+ }+ void (*f)(void *) = (void (*)(void *))fin->final;+ //printf("forptr free fin=%p, f=%p", fin, f);+ //fflush(stdout);+ if (f) {+ //printf("finalizer fin=%p final=%p\n", fin, f);+ (*f)(fin->arg);+ }+ for (struct forptr *p = fin->back; p; ) {+ struct forptr *q = p->next;+ //printf("free fp=%p\n", p);+ //printf(" p=%p desc=%s", p, p->desc ? p->desc : "NONE");+ //fflush(stdout);+ FREE(p);+ //memset(p, 0x55, sizeof *p);+ p = q;+ }+ //printf("\n");+ *finp = fin->next;+ //printf("free fin=%p\n", fin);+ FREE(fin);+ //memset(fin, 0x77, sizeof *fin);+ }+ }++ /* Remove unreferenced zombie threads */+ for (struct mthread **mtp = &all_threads; *mtp; ) {+ struct mthread *mt = *mtp;+ if ((mt->mt_state == ts_died || mt->mt_state == ts_finished) && !mt->mt_mark) {+ COUNT(num_thread_reap);+ *mtp = mt->mt_next;+ FREE(mt);+ } else {+ mt->mt_mark = false;+ mtp = &mt->mt_next;+ }+ }++ /* Remove unreferences mvars */+ for (struct mvar **mvp = &all_mvars; *mvp; ) {+ struct mvar *mv = *mvp;+ if (!mv->mv_mark) {+ COUNT(num_mvar_free);+ *mvp = mv->mv_next;+ FREE(mv);+ } else {+ mv->mv_mark = false;+ mvp = &mv->mv_next;+ }+ }++ gc_scan_time += GETTIMEMILLI();++#if WANT_STDIO+ if (verbose > 1) {+ PRINT("gc done, %"PRIcounter" free\n", num_free);+ /*PRINT(" GC reductions A=%"PRIcounter", K=%"PRIcounter", I=%"PRIcounter", int=%"PRIcounter" flip=%"PRIcounter"\n",+ red_a, red_k, red_i, red_int, red_flip);*/+ }+ if (gcbell) {+ fputc('\007', stderr); /* ring the bell */+ fflush(stderr);+ }+#endif /* !WANT_STDIO */++#if 0+ /* For debugging only: mark all free cells */+ for(int n = 0; n < heap_size; n++) {+ NODEPTR p;+ p.node_ptr = HEAPREF(n);+ if (!is_marked_used(p)) {+ set_DATA_TAG(p, D_NONE);+ }+ }+#endif+#if 0+ {+ BFILE *err = add_fd(2);+ putsb("GC ", err); putdecb(num_free, err); putsb(" free\r\n", err);+ closeb(err);+ }+#endif+}++static INLINE+value_t+peekWord(value_t *p)+{+ return *p;+}++static INLINE+void+pokeWord(value_t *p, value_t w)+{+ *p = w;+}++static INLINE+void *+peekPtr(void **p)+{+ return *p;+}++static INLINE+void+pokePtr(void **p, void *w)+{+ *p = w;+}++static INLINE+uvalue_t+peek_uint8(uint8_t *p)+{+ return *p;+}++static INLINE+void+poke_uint8(uint8_t *p, value_t w)+{+ *p = (uint8_t)w;+}++static INLINE+uvalue_t+peek_uint16(uint16_t *p)+{+ return *p;+}++static INLINE+void+poke_uint16(uint16_t *p, value_t w)+{+ *p = (uint16_t)w;+}++static INLINE+uvalue_t+peek_uint32(uint32_t *p)+{+ return *p;+}++static INLINE+void+poke_uint32(uint32_t *p, value_t w)+{+ *p = (uint32_t)w;+}++#if WANT_INT64+static INLINE+uint64_t+peek_uint64(uint64_t *p)+{+ return *p;+}++static INLINE+void+poke_uint64(uint64_t *p, uint64_t w)+{+ *p = w;+}+#endif /* WANT_INT64 */++static INLINE+value_t+peek_int8(int8_t *p)+{+ return *p;+}++static INLINE+void+poke_int8(int8_t *p, value_t w)+{+ *p = (int8_t)w;+}++static INLINE+value_t+peek_int16(int16_t *p)+{+ return *p;+}++static INLINE+void+poke_int16(int16_t *p, value_t w)+{+ *p = (int16_t)w;+}++static INLINE+value_t+peek_int32(int32_t *p)+{+ return *p;+}++static INLINE+void+poke_int32(int32_t *p, value_t w)+{+ *p = (int32_t)w;+}++#if WANT_INT64+static INLINE+int64_t+peek_int64(int64_t *p)+{+ return *p;+}++static INLINE+void+poke_int64(int64_t *p, int64_t w)+{+ *p = w;+}+#endif /* WANT_INT64 */++static INLINE+value_t+peek_int(int *p)+{+ return *p;+}++static INLINE+void+poke_int(int *p, value_t w)+{+ *p = (int)w;+}++static INLINE+value_t+peek_uint(unsigned int *p)+{+ return *p;+}++static INLINE+void+poke_uint(unsigned int *p, value_t w)+{+ *p = (unsigned int)w;+}++static INLINE+value_t+peek_char(char *p)+{+ return *p;+}++static INLINE+void+poke_char(char *p, value_t w)+{+ *p = (char)w;+}++static INLINE+value_t+peek_schar(signed char *p)+{+ return *p;+}++static INLINE+void+poke_schar(signed char *p, value_t w)+{+ *p = (signed char)w;+}++static INLINE+value_t+peek_uchar(unsigned char *p)+{+ return *p;+}++static INLINE+void+poke_uchar(unsigned char *p, value_t w)+{+ *p = (unsigned char)w;+}++static INLINE+value_t+peek_short(short *p)+{+ return *p;+}++static INLINE+void+poke_short(short *p, value_t w)+{+ *p = (short)w;+}++static INLINE+value_t+peek_ushort(unsigned short *p)+{+ return *p;+}++static INLINE+void+poke_ushort(unsigned short *p, value_t w)+{+ *p = (unsigned short)w;+}++static INLINE+value_t+peek_long(long *p)+{+ return *p;+}++static INLINE+void+poke_long(long *p, value_t w)+{+ *p = (long)w;+}++static INLINE+value_t+peek_ulong(unsigned long *p)+{+ return *p;+}++static INLINE+void+poke_ulong(unsigned long *p, value_t w)+{+ *p = (unsigned long)w;+}++/* A long long can be bigger than a value_t, so it is passed as itself. */+static INLINE+long long+peek_llong(long long *p)+{+ return *p;+}++static INLINE+void+poke_llong(long long *p, long long w)+{+ *p = w;+}++static INLINE+unsigned long long+peek_ullong(unsigned long long *p)+{+ return *p;+}++static INLINE+void+poke_ullong(unsigned long long *p, unsigned long long w)+{+ *p = w;+}++static INLINE+value_t+peek_size_t(size_t *p)+{+ return *p;+}++static INLINE+void+poke_size_t(size_t *p, value_t w)+{+ *p = (size_t)w;+}++#if WANT_FLOAT32+static INLINE+flt32_t+peek_flt32(flt32_t *p)+{+ return *p;+}++static INLINE+void+poke_flt32(flt32_t *p, flt32_t w)+{+ *p = w;+}+#endif /* WANT_FLOAT32 */++#if WANT_FLOAT64+static INLINE+flt64_t+peek_flt64(flt64_t *p)+{+ return *p;+}++static INLINE+void+poke_flt64(flt64_t *p, flt64_t w)+{+ *p = w;+}+#endif /* WANT_FLOAT64 */++/* Look up an FFI function by name */+value_t+lookupFFIname(const char *name)+{+ size_t i;++ for(i = 0; ffi_table[i].ffi_name; i++)+ if (strcmp(ffi_table[i].ffi_name, name) == 0)+ return (value_t)i;+ if (xffi_table) {+ for(i = 0; xffi_table[i].ffi_name; i++)+ if (strcmp(xffi_table[i].ffi_name, name) == 0)+ return (value_t)(i + num_ffi);+ }+ return -1;+}++NODEPTR+ffiNode(const char *buf)+{+ NODEPTR r;+ value_t i = lookupFFIname(buf);+ char *fun;++ if (i < 0) {+ /* lookup failed, generate a node that will dynamically generate an error */+ r = alloc_node(D_BADDYN);+ fun = mmalloc(strlen(buf) + 1);+ strcpy(fun, buf);+ CSTR(r) = fun;+ } else {+ r = alloc_node(D_IO_CCALL);+ SETVALUE(r, i);+ }+ return r;+}++/* If the next input character is c, then consume it, else leave it alone. */+int+gobble(BFILE *f, int c)+{+ int d = getb(f);+ if (c == d) {+ return 1;+ } else {+ if (d >= 0)+ ungetb(d, f);+ return 0;+ }+}++value_t+parse_int(BFILE *f)+{+ // Parse using uvalue_t, which wraps on overflow.+ uvalue_t i = 0;+ uvalue_t neg = 1;+ int c = getb(f);+ if (c == '-') {+ neg = -1;+ c = getb(f);+ }+ for(;;) {+ i = i * 10 + (c - '0');+ c = getb(f);+ if (c < '0' || c > '9') {+ if (c >= 0)+ ungetb(c, f);+ break;+ }+ }+ // Multiply by neg without triggering undefined behavior.+ return (value_t)(neg * i);+}++#if WANT_INT64+int64_t+parse_int64(BFILE *f)+{+ // Parse using uint64_t, which wraps on overflow.+ uint64_t i = 0;+ uint64_t neg = 1;+ int c = getb(f);+ if (c == '-') {+ neg = -1;+ c = getb(f);+ }+ for(;;) {+ i = i * 10 + (c - '0');+ c = getb(f);+ if (c < '0' || c > '9') {+ if (c >= 0)+ ungetb(c, f);+ break;+ }+ }+ // Multiply by neg without triggering undefined behavior.+ return (int64_t)(neg * i);+}+#endif /* WANT_INT64 */++struct forptr *mkForPtr(struct bytestring bs);+NODEPTR mkFunPtr(HsFunPtr p);++/* Create a forptr that has a free() finalizer. */+struct forptr *+mkForPtrFree(struct bytestring str)+{+ struct forptr *fp = mkForPtr(str); /* Create a foreign pointer */+ fp->finalizer->final = (HsFunPtr)FREE; /* and set the finalizer to just free it */+ return fp;+}++/* Create a ByteString node. It's a foreign pointer tagged with FP_BSTR. */+NODEPTR+mkStrNode(struct bytestring str)+{+ NODEPTR n = alloc_node(D_FORPTR);+ struct forptr *fp = mkForPtrFree(str);+ FORPTR(n) = fp;+ fp->finalizer->fptype = FP_BSTR;+ //printf("mkForPtr n=%p fp=%p %d %s payload.string=%p\n", n, fp, (int)FORPTR(n)->payload.size, (char*)FORPTR(n)->payload.string, FORPTR(n)->payload.string);+ return n;+}++/* Table of labelled nodes for sharing during parsing. */+struct shared_entry {+ heapoffs_t label;+ NODEPTR node; /* NIL indicates unused */+};++/* The memory allocated here is never freed.+ * This could be fixed by using a forptr and a+ * finalizer for read UTF-8 strings.+ * Fix this if there is a lot of deserialization.+ */+struct bytestring+parse_string(BFILE *f)+{+ size_t sz = 20;+ uint8_t *buffer = mmalloc(sz);+ size_t i;+ int c;++ for(i = 0;;) {+ c = getb(f);+ if (c < 0)+ ERR("parse string EOF");+ if (c == '"')+ break;+ if (i >= sz - 1) {+ sz *= 2;+ buffer = mrealloc(buffer, sz);+ }+#if 0+ if (c == '\\') {+ buffer[i++] = (uint8_t)parse_int(f);+ if (!gobble(f, '&'))+ ERR("parse string");+ } else {+ buffer[i++] = c;+ }+#else+ /* See src/MicroHs/ExpPrint.hs for how strings are encoded. */+ switch (c) {+ case '\\':+ c = getb(f);+ if (c == '?')+ c = 0x7f;+ else if (c == '_')+ c = 0xff;+ break;+ case '^':+ c = getb(f);+ if (c < 0x40)+ c &= 0x1f;+ else+ c = (c & 0x1f) | 0x80;+ break;+ case '|':+ c = getb(f);+ c |= 0x80;+ break;+ default:+ /* Unencoded */+ ;+ }+ buffer[i++] = c;+#endif+ }+ buffer[i] = 0; /* add a trailing 0 in case we need a C string, not counted in size */+ buffer = mrealloc(buffer, i + 1);+ //printf("parse_string %d %s\n", (int)bs.size, (char*)bs.string);+ return mk_ro_bytestring(i, buffer);+}++struct forptr *new_mpz(void);++struct parse_ctx {+ struct shared_entry *shared_table;+ heapoffs_t shared_table_size;+ jmp_buf deser_err;+ const char *message;+};++/* The parse in progress, if any. */+struct parse_ctx *cur_parse_ctx = 0;++/* The labelled nodes are GC roots while parsing.+ * They are usually reachable from the stack as well, but the GC can+ * redirect all those references, e.g., past an indirection made for a+ * forward reference, or to a permanent Int node. The table would then+ * refer to a freed node. Marking the table redirects its entries too.+ * An undefined forward reference is an indirection to NIL; the marking+ * stops there, so the entry stays and can be filled in later.+ */+void+mark_parse(void)+{+ struct parse_ctx *pc = cur_parse_ctx;+ if (!pc)+ return;+ for (heapoffs_t i = 0; i < pc->shared_table_size; i++) {+ if (!is_NIL(pc->shared_table[i].node))+ mark(&pc->shared_table[i].node);+ }+}++/* Look for the label in the table.+ * If it's found, return the node.+ * If not found, return the first empty entry.+*/+NODEPTR *+find_label(struct parse_ctx *pc, heapoffs_t label)+{+ heapoffs_t i;++ for(i = label; ; i++) {+ i %= pc->shared_table_size;+ if (is_NIL(pc->shared_table[i].node)) {+ /* The slot is empty, so claim and return it */+ pc->shared_table[i].label = label;+ return &pc->shared_table[i].node;+ } else if (pc->shared_table[i].label == label) {+ /* Found the label, so return it. */+ return &pc->shared_table[i].node;+ }+ /* Not empty and not found, try next. */+ }+}++#define DESER_ERR(s) do { pc->message = (s); longjmp(pc->deser_err, 1); } while(0)++/* Read a token terminated by ' ' or '\n' into buf[j..size-1], NUL-terminated. */+static void+parse_token(struct parse_ctx *pc, BFILE *f, char *buf, size_t j, size_t size)+{+ for (;;) {+ int c = getb(f);+ if (c < 0)+ DESER_ERR("parse EOF");+ if (c == ' ' || c == '\n') {+ buf[j] = 0;+ return;+ }+ if (c == 0 || j >= size - 1)+ DESER_ERR("bad input");+ buf[j++] = (char)c;+ }+}++NODEPTR+parse(struct parse_ctx *pc, BFILE *f)+{+ NODEPTR *stk = stack_ptr;+ NODEPTR r, x, y;+ NODEPTR *nodep;+ heapoffs_t l;+ int c;+ char buf[80]; /* store names of primitives. */++ for(;;) {+ c = getb(f);+ if (c < 0) DESER_ERR("parse EOF");+ switch (c) {+ case ' ':+ case '\n':+ continue;+ }+ GCCHECK(1); /* each step allocates at most one node */+ if (num_free <= 1)+ DESER_ERR("out of heap reading code");+ switch(c) {+ case '@':+ if (STACK_ABOVE(stk) < 2)+ DESER_ERR("parse: stack");+ x = TOP(0);+ y = TOP(1);+ POP(2);+ PUSH(new_ap(y, x));+ break;+ case '}':+ if (STACK_ABOVE(stk) != 1)+ DESER_ERR("parse: stack");+ x = TOP(0);+ POP(1);+ return x;+#if WANT_GMP || WANT_IMATH+ case '%':+ {+ struct bytestring bs = parse_string(f); /* get all the digits, terminated by " */+ struct forptr *fp = new_mpz(); /* a new mpz */+ mpz_ptr op = fp->payload.bs_array; /* get actual pointer */+ mpz_set_str(op, bs.bs_array, 10); /* convert to an mpz */+ FREE(bs.bs_array);+ r = alloc_node(D_FORPTR);+ FORPTR(r) = fp;+ PUSH(r);+ break;+ }+#endif+ case '&':+ {+ int is32 = gobble(f, '&');+ parse_token(pc, f, buf, 0, sizeof buf);+ if (is32) {+#if WANT_FLOAT32+ r = mkFlt32(strtof(buf, NULL));+#else+ r = alloc_node(D_FLT32);+ SETVALUE(r, 0);+#endif+ } else {+#if WANT_FLOAT64+ r = mkFlt64(strtod(buf, NULL));+#else+ r = alloc_node(D_DBL);+ SETVALUE(r, 0);+#endif+ }+ PUSH(r);+ break;+ }+ case '#':+ if (gobble(f, '#')) {+#if WANT_INT64+ r = mkInt64(parse_int64(f));+#else+ DESER_ERR("no Int64");+#endif /* WANT_INT64 */+ } else {+ r = mkInt(parse_int(f));+ }+ PUSH(r);+ break;+ case '[':+ {+ value_t vsz;+ size_t sz;+ struct ioarray *arr;+ size_t i;+ vsz = parse_int(f);+ if (!gobble(f, ']'))+ DESER_ERR("parse arr 1");+ if (vsz < 0 || vsz > STACK_ABOVE(stk))+ DESER_ERR("parse: stack");+ sz = (size_t)vsz;+ arr = arr_alloc(sz, NIL_NODEPTR);+ for (i = 0; i < sz; i++) {+ arr->array[i] = TOP(sz - i - 1);+ }+ r = alloc_node(D_ARR);+ ARR(r) = arr;+ POP(sz);+ PUSH(r);+ break;+ }+ case '_':+ /* Reference to a shared value: _label */+ l = parse_int(f); /* The label */+ nodep = find_label(pc, l);+ if (is_NIL(*nodep)) {+ /* Not yet defined, so make it an indirection */+ *nodep = alloc_node(D_NONE);+ set_IND(*nodep, NIL_NODEPTR);+ }+ PUSH(*nodep);+ break;+ case ':':+ /* Define a shared expression: :label e */+ l = parse_int(f); /* The label */+ if (!gobble(f, ' '))+ DESER_ERR("parse ' '");+ if (STACK_ABOVE(stk) < 1)+ DESER_ERR("parse: stack");+ nodep = find_label(pc, l);+ x = TOP(0);+ if (is_NIL(*nodep)) {+ /* not referenced yet, so add a direct reference */+ *nodep = x;+ } else {+#if 0+ /* Sanity check */+ NODEPTR q = get_IND(*nodep);+ if (!q || is_NIL(q))+ ERR("shared != NIL");+#endif+ set_IND(*nodep, x);+ }+ break;+ case '"':+ /* Everything up to the next " is a string.+ * Special characters are encoded as \NNN&,+ * where NNN is the decimal value of the character */+ PUSH(mkStrNode(parse_string(f)));+ break;+ case '$':+ {+ struct bytestring bs = mk_ro_bytestring(parse_int(f), NULL);+ if (!gobble(f, ' '))+ DESER_ERR("bytestring parse error");+ for(size_t i = 0; i < bs.bs_size; i++) {+ ((uint8_t*)bs.bs_array)[i] = getb(f);+ }+ PUSH(mkStrNode(bs));+ break;+ }++#if WANT_TICK+ case '!':+ if (!gobble(f, '"'))+ DESER_ERR("parse !");+ r = alloc_node(D_TICK);+ SETVALUE(r, (value_t)add_tick_table(parse_string(f)));+ PUSH(r);+ break;+#endif+ case '^':+ /* An FFI name */+ parse_token(pc, f, buf, 0, sizeof buf);+ r = ffiNode(buf);+ PUSH(r);+ break;+ case ';':+ /* <name is a C function pointer to name */+ parse_token(pc, f, buf, 0, sizeof buf);+ if (strcmp(buf, "0") == 0) {+ PUSH(mkFunPtr((HsFunPtr)0));+ } else if (strcmp(buf, "closeb") == 0) {+ PUSH(mkFunPtr((HsFunPtr)closeb));+ } else {+ DESER_ERR("unknown funptr");+ }+ break;+ case 'C':+ if (gobble(f, '_')) {+ value_t k = parse_int(f);+ if (!gobble(f, '_'))+ DESER_ERR("parse C");+ value_t n = parse_int(f);+ if (k < 0 || k > PTR_TAG_NCON_MASK || n < 0 || n > PTR_TAG_NARG_MASK)+ DESER_ERR("parse C");+ r = mk_CON(V_CONSTR, (int)k, (int)n);+ PUSH(r);+ break;+ } else {+ goto def;+ }+ case 'D':+ if (gobble(f, '_')) {+ /* D_a0_..._a{m-1}, m is at most 2047 since the LOOKD marker holds m in 11 bits */+ uint8_t arities[PTR_TAG_NCON_MASK];+ uint32_t m = 0;+ do {+ value_t a = parse_int(f);+ if (m >= PTR_TAG_NCON_MASK || a < 0 || a > PTR_TAG_NARG_MASK)+ DESER_ERR("parse D");+ arities[m++] = (uint8_t)a;+ } while (gobble(f, '_'));+ r = mk_CASE(V_CASED, find_case_arity(m, 0, arities));+ PUSH(r);+ break;+ } else {+ goto def;+ } + case 'L':+ if (gobble(f, '_')) {+ int m = parse_int(f);+ r = mk_CASE(V_LOOKD, m);+ PUSH(r);+ break;+ } else {+ goto def;+ } + case 'E':+ case 'M':+ if (gobble(f, '_')) {+ /* E_k1_n1_..._km_nm, the constructor numbers increasing (M_ is the same, for the marker) */+ uint16_t tags[PTR_TAG_NCON_MASK];+ uint8_t arities[PTR_TAG_NCON_MASK];+ uint32_t m = 0;+ do {+ value_t k = parse_int(f);+ if (!gobble(f, '_'))+ DESER_ERR("parse E");+ value_t a = parse_int(f);+ if (m >= PTR_TAG_NCON_MASK || k < 0 || k > PTR_TAG_NCON_MASK || (m > 0 && k <= tags[m-1]) ||+ a < 0 || a > PTR_TAG_NARG_MASK)+ DESER_ERR("parse E");+ tags[m] = (uint16_t)k;+ arities[m++] = (uint8_t)a;+ } while (gobble(f, '_'));+ r = mk_CASE(c == 'E' ? V_CASES : V_LOOKS, find_case_arity(m, tags, arities));+ PUSH(r);+ break;+ } else {+ goto def;+ }+ def:+ default:+ if (c == 0)+ DESER_ERR("bad input");+ buf[0] = (char)c;+ /* A primitive, keep getting char's until end */+ parse_token(pc, f, buf, 1, sizeof buf);++ /* Look up the primop (O(1) hash lookup) and make a virtual pointer for it. */+ {+ int t = lookup_primop(buf);+ if (t < 0)+ DESER_ERR("unknown primop");+ switch (t) {+#if WANT_STDIO+ /* The standard handles are real (permanent) FORPTR nodes */+ case T_IO_STDIN: r = comb_stdin; break;+ case T_IO_STDOUT: r = comb_stdout; break;+ case T_IO_STDERR: r = comb_stderr; break;+#endif /* WANT_STDIO */+ default: r = alloc_node(t); break;+ }+ }+ PUSH(r);+ break;+ }+ }+}++void+checkversion(struct parse_ctx *pc, BFILE *f)+{+ char *p = VERSION;+ int c;++ while ((c = *p++)) {+ if (c != getb(f))+ DESER_ERR("version mismatch");+ }+ (void)gobble(f, '\r'); /* allow extra CR */+}++/* Parse a file */+/* XXX We should not be using the ordinary stack here. */+NODEPTR+parse_top(BFILE *f, struct ffe_entry *ffe)+{+ heapoffs_t numLabels, i;+ NODEPTR n;+ NODEPTR *ostack = stack_ptr;+ struct parse_ctx spc, *pc = &spc;++ pc->shared_table = 0;+ if (setjmp(pc->deser_err)) {+ /* exception */+ stack_ptr = ostack;+ cur_parse_ctx = 0;+ if (pc->shared_table)+ FREE(pc->shared_table);+ return NIL_NODEPTR;+ } else {+ checkversion(pc, f);+ numLabels = parse_int(f);+ if (!gobble(f, '\n'))+ DESER_ERR("size parse");+ gobble(f, '\r'); /* allow extra CR */+ pc->shared_table_size = 3 * numLabels; /* sparsely populated hashtable */+ pc->shared_table = mmalloc(pc->shared_table_size * sizeof(struct shared_entry));+ for(i = 0; i < pc->shared_table_size; i++)+ pc->shared_table[i].node = NIL_NODEPTR;+ cur_parse_ctx = pc; /* the labels are GC roots */+ n = parse(pc, f);+ if (ffe) {+ for(struct ffe_entry *f = ffe; f->ffe_name; f++) {+ heapoffs_t l = atoi(f->ffe_name+1); /* the name must be numerical */+ f->ffe_value = find_label(pc, l)->node_ptr;+ }+ }+ cur_parse_ctx = 0;+ FREE(pc->shared_table);+ return n;+ }+}++/* Two bits per node: marked, shared+ * 0, 0 -- not visited+ * 1, 0 -- visited once+ * 1, 1 -- visited more than once+ * 0, 1 -- printed+ */+struct print_bits {+ bits_t *marked_bits;+ bits_t *shared_bits;+ jmp_buf ser_err;+ const char *message;+};+/* Virtual NODEPTRs are never shared, so they have no bits. */+static INLINE void set_bit(bits_t *bits, NODEPTR n)+{+ if (is_VIRT(n))+ return;+ heapoffs_t i = LABEL(n);+ bits[i / BITS_PER_WORD] |= (1ULL << (i % BITS_PER_WORD));+}+#if WANT_STDIO+static INLINE void clear_bit(bits_t *bits, NODEPTR n)+{+ if (is_VIRT(n))+ return;+ heapoffs_t i = LABEL(n);+ bits[i / BITS_PER_WORD] &= ~(1ULL << (i % BITS_PER_WORD));+}+#endif+static INLINE int test_bit(bits_t *bits, NODEPTR n)+{+ if (is_VIRT(n))+ return 0;+ heapoffs_t i = LABEL(n);+ return (bits[i / BITS_PER_WORD] & (1ULL << (i % BITS_PER_WORD))) != 0;+}++size_t strNodes(size_t len);+NODEPTR mkStringC(char *str);++#if WANT_STDIO+void+convdbl(char *str, char *fmt, flt64_t x)+{+ /* Using 16 decimals will lose some precision.+ * 17 would keep the precision, but it frequently looks very ugly.+ */+ (void)snprintf(str, 25, fmt, x);+ if (strcmp(str, "nan") != 0 && strcmp(str, "-nan") != 0 &&+ strcmp(str, "inf") != 0 && strcmp(str, "-inf") != 0 &&+ !strchr(str, '.') && !strchr(str, 'e') && !strchr(str, 'E')) {+ /* There is no decimal point and no exponent, so add a decimal point */+ strcat(str, ".0");+ }+}++void+putdblb(flt64_t x, BFILE *p)+{+ char str[30];+ convdbl(str, "%.16g", x);+ putsb(str, p);+}++void printrec(BFILE *f, struct print_bits *pb, NODEPTR n, bool prefix);++/* Mark all reachable nodes, when a marked node is reached, mark it as shared. */+void+find_sharing(counter_t *num_sharedp, struct print_bits *pb, NODEPTR n)+{+ top:+ { NODEPTR np = n;+ n = indir(&np);+ }+ struct node *p = get_node_ptr(n);+ if (!p)+ return;+ if (p < cells || p >= cells + heap_size) abort();++ //PRINT("find_sharing %p %llu ", n, LABEL(n));+ tag_t tag = get_XTAG(n);+ if (tag == X_AP || tag == D_ARR || tag == D_FORPTR) {+ if (test_bit(pb->shared_bits, n)) {+ /* Alread marked as shared */+ //PRINT("shared\n");+ ;+ } else if (test_bit(pb->marked_bits, n)) {+ /* Already marked, so now mark as shared */+ //PRINT("marked\n");+ set_bit(pb->shared_bits, n);+ (*num_sharedp)++;+ } else {+ /* Mark as visited, and recurse */+ //PRINT("unmarked\n");+ set_bit(pb->marked_bits, n);+ switch(tag) {+ case X_AP:+ find_sharing(num_sharedp, pb, FUN(n));+ n = ARG(n);+ goto top;+ case D_ARR:+ for(size_t i = 0; i < ARR(n)->size; i++) {+ find_sharing(num_sharedp, pb, ARR(n)->array[i]);+ }+ break;+ default:+ break;+ }+ }+ } else {+ /* Not an sharable node, so do nothing */+ //PRINT("not T_AP\n");+ ;+ }+}++void+print_string(BFILE *f, struct bytestring bs)+{+ uint8_t *str = bs.bs_array;+ putb('"', f);+ for (size_t i = 0; i < bs.bs_size; i++) {+ int c = str[i];+#if 0+ if (c == '"' || c == '\\' || c < ' ' || c > '~') {+ putb('\\', f);+ putdecb(c, f);+ putb('&', f);+ } else {+ putb(c, f);+ }+#else+ if (c < 0 || c > 0xff)+ ERR("print_string");+ if (c < 0x20) {+ putb('^', f); putb(c + 0x20, f);+ } else if (c == '"' || c == '^' || c == '|' || c == '\\') {+ putb('\\', f); putb(c, f);+ } else if (c < 0x7f) {+ putb(c, f);+ } else if (c == 0x7f) {+ putb('\\', f); putb('?', f);+ } else if (c < 0xa0) {+ putb('^', f); putb(c - 0x80 + 0x40, f);+ } else if (c < 0xff) {+ putb('|', f); putb(c - 0x80, f);+ } else { /* must be< c == 0xff */+ putb('\\', f); putb('_', f);+ }+#endif+ }+ putb('"', f);+}++#define SER_ERR(s) do { pb->message = (s); longjmp(pb->ser_err, 1); } while(0)+/*+ * Recursively print an expression.+ * This assumes that the shared nodes has been marked as such.+ * The prefix flag is used to get a readable dump.+ */+void+printrec(BFILE *f, struct print_bits *pb, NODEPTR n, bool prefix)+{+ NODEPTR n1;+ int share = 0;+ enum node_tag tag;+ char prbuf[30];++ for (;;) {+ n1 = get_IND(n);+ if (is_NIL(n1))+ break;+ /*putb('*', f);*/+ n = n1;+ }++ if (test_bit(pb->shared_bits, n)) {+ /* The node is shared */+ if (test_bit(pb->marked_bits, n)) {+ /* Not yet printed, so emit a label */+ if (prefix) {+ putb(':', f);+ putdecb((value_t)LABEL(n), f);+ putb(' ', f);+ } else {+ share = 1;+ }+ clear_bit(pb->marked_bits, n); /* mark as printed */+ } else {+ /* This node has already been printed, so just use a reference. */+ putb('_', f);+ putdecb((value_t)LABEL(n), f);+ if (!prefix)+ putb(' ', f);+ return;+ }+ }++ //if (n == atptr) putb('@', f);+ tag = get_XTAG(n);+ switch (tag) {+ case X_AP:+ if (prefix) {+ putb('(', f);+ printrec(f, pb, FUN(n), prefix);+ putb(' ', f);+ printrec(f, pb, ARG(n), prefix);+ putb(')', f);+ } else {+ printrec(f, pb, FUN(n), prefix);+ printrec(f, pb, ARG(n), prefix);+ putb('@', f);+ }+ break;+ case D_INT: putb('#', f); putdecb(GETVALUE(n), f); break;+#if WANT_INT64+ case D_INT64: putb('#', f); putb('#', f); putdecb64(GETINT64VALUE(n), f); break;+#endif /* WANT_INT64 */+#if WANT_FLOAT64+ case D_DBL: putb('&', f); putdblb(GETDBLVALUE(n), f); break;+#endif+#if WANT_FLOAT32+ case D_FLT32: putb('&', f); putb('&', f); putdblb((double)GETFLTVALUE(n), f); break;+#endif+ case D_WEAK: SER_ERR("serialize WEAK unimplemented");+ case D_ARR:+ if (prefix) {+ /* Arrays serialize as '[sz] e_1 ... e_sz' */+ putb('[', f);+ putdecb((value_t)ARR(n)->size, f);+ putb(']', f);+ for(size_t i = 0; i < ARR(n)->size; i++) {+ putb(' ', f);+ printrec(f, pb, ARR(n)->array[i], prefix);+ }+ } else {+ /* Arrays serialize as 'e_1 ... e_sz [sz]' */+ for(size_t i = 0; i < ARR(n)->size; i++) {+ printrec(f, pb, ARR(n)->array[i], prefix);+ }+ putb('[', f);+ putdecb((value_t)ARR(n)->size, f);+ putb(']', f);+ }+ break;+ case D_MVAR:+ SER_ERR("cannot serialize MVAR");+ break;+ case D_PTR:+ if(PTR(n) == NULL) {+ if (prefix) {+ putsb("(toPtr #0)", f);+ } else {+ putsb("toPtr #0 @", f);+ }+ } else+#if WANT_STDIO+ /* The pointer can be a forptr comb_std* that has been dereferenced */+ if (PTR(n) == FORPTR(comb_stdin)->payload.bs_array) {+ mk_AP(spare_node, combFP2P, comb_stdin);+ printrec(f, pb, spare_node, prefix);+ } else if (PTR(n) == FORPTR(comb_stdout)->payload.bs_array) {+ mk_AP(spare_node, combFP2P, comb_stdout);+ printrec(f, pb, spare_node, prefix);+ } else if (PTR(n) == FORPTR(comb_stderr)->payload.bs_array) {+ mk_AP(spare_node, combFP2P, comb_stderr);+ printrec(f, pb, spare_node, prefix);+ } else+#endif /* WANT_STDIO */+ if (prefix) {+ snprintf(prbuf, sizeof prbuf, "PTR<%p>",PTR(n));+ putsb(prbuf, f);+ } else {+ SER_ERR("Cannot serialize pointers");+ }+ break;+ case D_FUNPTR:+ /* There are a few function pointers that happen without user FFI.+ * We need to be able to serialize these.+ * XXX Make a table if we need more.+ */+ if (FUNPTR(n) == 0) {+ putsb(";0 ", f);+ } else if (FUNPTR(n) == (HsFunPtr)closeb) {+ putsb(";closeb ", f);+ } else if (prefix) {+ snprintf(prbuf, sizeof prbuf, "FUNPTR<%p>", FUNPTR(n));+ putsb(prbuf, f);+ } else {+ SER_ERR("Cannot serialize function pointers");+ }+ break;+ case D_THID:+ if (prefix) {+ snprintf(prbuf, sizeof prbuf, "THID<%d>", (int)THR(n)->mt_id);+ putsb(prbuf, f);+ } else {+ SER_ERR("cannot serialize ThreadId yet");+ }+ break;+ case D_FORPTR:+#if WANT_STDIO+ if (eq_NODEPTR(n, comb_stdin))+ putsb("IO.stdin", f);+ else if (eq_NODEPTR(n, comb_stdout))+ putsb("IO.stdout", f);+ else if (eq_NODEPTR(n, comb_stderr))+ putsb("IO.stderr", f);+ else+#endif /* WANT_STDIO */+#if WANT_GMP || WANT_IMATH+ if (FORPTR(n)->finalizer->fptype == FP_MPZ) {+ /* Serialize as %99999" */+ mpz_ptr op = FORPTR(n)->payload.bs_array; /* get the mpz */+ int sz = mpz_sizeinbase(op, 10); /* maximum length */+ char *s = mmalloc(sz + 2);+ (void)mpz_get_str(s, 10, op); /* convert to a string */+ putsb("%", f);+ putsb(s, f);+ putsb("\"", f); /* so we can use parse_string */+ FREE(s);+ } else+#endif /* WANT_GMP || WANT_IMATH */+ if (FORPTR(n)->finalizer->fptype == FP_BSTR) {+ struct bytestring bs = FORPTR(n)->payload;+ if (bs.bs_size > 100) {+ /* Encode large bytestrings with $len data */+ putb('$', f);+ putdecb(bs.bs_size, f);+ putb(' ', f);+ writeb(bs.bs_array, bs.bs_size, f);+ } else {+ print_string(f, bs);+ }+ } else if (prefix) {+ snprintf(prbuf, sizeof prbuf, "FORPTR<%p>",FORPTR(n));+ putsb(prbuf, f);+ } else {+ SER_ERR("Cannot serialize foreign pointers");+ }+ break;+ case D_IO_CCALL: putb('^', f); putsb(FFI_IX(GETVALUE(n)).ffi_name, f); break;+ case D_BADDYN: putb('^', f); putsb(CSTR(n), f); break;+#if WANT_TICK+ case D_TICK:+ putb('!', f);+ print_string(f, tick_table[GETVALUE(n)].tick_name);+ break;+#endif+ case V_CASED:+ {+ struct case_arity *c = get_case_arity(n);+ putb('D', f);+ for (uint32_t k = 0; k < c->m; k++) {+ putb('_', f);+ putdecb((value_t)c->arities[k], f);+ }+ break;+ }+ case V_CASES:+ case V_LOOKS:+ {+ struct case_arity *c = get_case_arity(n);+ putb(tag == V_CASES ? 'E' : 'M', f);+ for (uint32_t j = 0; j < c->m; j++) {+ putb('_', f);+ putdecb((value_t)c->tags[j], f);+ putb('_', f);+ putdecb((value_t)c->arities[j], f);+ }+ break;+ }+ case V_LOOKD:+ putb('L', f);+ putb('_', f);+ putdecb((value_t)get_CASE_size(n), f);+ break;+ case V_CONSTR:+ {+ putb('C', f);+ putb('_', f);+ int k, nn;+ get_CON_info(n, &k, &nn);+ putdecb((value_t)k, f);+ putb('_', f);+ putdecb((value_t)nn, f);+ break;+ }+ default:+ if (0 <= tag && tag <= T_LAST_TAG) {+ if (tag_names[tag]) {+ putsb(tag_names[tag], f);+ } else {+ SER_ERR("TAG1");+ }+ } else {+ SER_ERR("TAG2");+ }+ break;+ }+ if (!prefix) {+ if (tag != X_AP)+ putb(' ', f);+ if (share) {+ putb(':', f);+ putdecb((value_t)LABEL(n), f);+ putb(' ', f);+ }+ }+}++/* Serialize a graph to file. */+void+printb(BFILE *f, NODEPTR n, bool header)+{+ struct print_bits pb;+ counter_t num_shared = 0;++ pb.marked_bits = mcalloc(free_map_nwords, sizeof(bits_t));+ pb.shared_bits = mcalloc(free_map_nwords, sizeof(bits_t));+ find_sharing(&num_shared, &pb, n);+ if (header) {+ putsb(VERSION, f);+ putdecb(num_shared, f);+ putb('\n', f);+ }+ if (setjmp(pb.ser_err)) {+ /* exception */+ FREE(pb.marked_bits);+ FREE(pb.shared_bits);+ raise_rts(exn_serialize);+ } else {+ printrec(f, &pb, n, !header);+ if (header) {+ putb('}', f);+ }+ FREE(pb.marked_bits);+ FREE(pb.shared_bits);+ }+}++/* Show a graph. */+void+pps(NODEPTR n)+{+ pp(stdout, n);+}++void+pp(FILE *f, NODEPTR n)+{+ BFILE *bf = add_FILE(f);+ printb(bf, n, false);+ putb('\n', bf);+ freeb_file(bf);+}++#if 0+NODEPTR *topnode;++void+ppmsg(const char *msg, NODEPTR n)+{+ printf("%s", msg);+ pp(stdout, n);+ printf("\n");+}++void+dump(const char *msg, NODEPTR at)+{+ atptr = at;+ printf("dump: %s\n", msg);+ pp(stdout, *topnode);+}+#endif++#endif /* WANT_STDIO */++NODEPTR+mkInt(value_t i)+{+#if INTTABLE+ if (LOW_INT <= i && i < HIGH_INT) {+ return intTable[i - LOW_INT];+ }+#endif++ NODEPTR n;+ n = alloc_node(D_INT);+ SETVALUE(n, i);+ return n;+}++#if WANT_INT64+NODEPTR+mkInt64(int64_t i)+{+ NODEPTR n;+ n = alloc_node(D_INT64);+ SETINT64VALUE(n, i);+ return n;+}+#endif /* WANT_INT64 */++#if WANT_FLOAT32+NODEPTR+mkFlt32(flt32_t d)+{+ NODEPTR n;+ n = alloc_node(D_FLT32);+ SETFLTVALUE(n, d);+ return n;+}+#endif /* WANT_FLOAT32 */++#if WANT_FLOAT64+NODEPTR+mkFlt64(flt64_t d)+{+ NODEPTR n;+ n = alloc_node(D_DBL);+ SETDBLVALUE(n, d);+ return n;+}+#endif /* WANT_FLOAT64 */++NODEPTR+mkPtr(void* p)+{+ NODEPTR n;+ n = alloc_node(D_PTR);+ PTR(n) = p;+ return n;+}++NODEPTR+mkFunPtr(void (*p)(void))+{+ NODEPTR n;+ n = alloc_node(D_FUNPTR);+ FUNPTR(n) = p;+ return n;+}++struct forptr*+mkForPtr(struct bytestring bs)+{+ struct final *fin = mcalloc(1, sizeof(struct final));+ struct forptr *fp = mcalloc(1, sizeof(struct forptr));+ if (bs.bs_size == NOSIZE) {+ num_fin_alloc++;+ } else {+ num_bs_alloc++;+ num_bs_inuse += bs.bs_size;+ num_bs_bytes += bs.bs_size;+ if (num_bs_inuse > num_bs_inuse_max)+ num_bs_inuse_max = num_bs_inuse;+ }+ //printf("mkForPtr p=%p fin=%p fp=%p\n", p, fin, fp);+ fin->next = final_root;+ final_root = fin;+ fin->final = 0;+ fin->arg = bs.bs_array;+ fin->size = bs.bs_size; /* The size is not really needed */+ fin->back = fp;+ fin->marked = 0;+ fp->next = 0;+ fp->payload = bs;+ fp->finalizer = fin;+ // fp->desc = 0;+ return fp;+}++struct forptr*+mkForPtrP(void *p)+{+ struct bytestring bs;+ bs.bs_size = NOSIZE;+ bs.bs_capacity = 0;+ bs.bs_array = p;+ return mkForPtr(bs);+}++struct forptr*+addForPtr(struct forptr *ofp, value_t s)+{+ struct forptr *fp = mcalloc(1, sizeof(struct forptr));+ struct final *fin = ofp->finalizer;++ /* Only allowed for immutable bytestrings */+ if (ofp->payload.bs_capacity != 0) {+ ERR("addForPtr");+ }++ fp->next = fin->back;+ fin->back = fp;+ if (ofp->payload.bs_size != NOSIZE)+ fp->payload.bs_size = ofp->payload.bs_size - s;+ else+ fp->payload.bs_size = NOSIZE;+ fp->payload.bs_array = (uint8_t*)ofp->payload.bs_array + s;+ fp->finalizer = fin;+ return fp;+}++struct forptr*+bssubstr(struct forptr *fp, value_t offs, value_t len)+{+ struct forptr *res = addForPtr(fp, offs);+ res->payload.bs_size = len;+ return res;+}++/* The array might have moved, so update base pointer in the finalizer. */+void+adjforptr(struct forptr *fp)+{+ struct final *fin = fp->finalizer;+ if (fp->next || fin->back != fp) {+ /* We can only do this if fp is the only pointer to the allocated array.+ Sharing can only happen by adding to a forptr, and we don't do that+ to mutable BSTR pointers. */+ ERR("adjforptr");+ }+ fin->arg = fp->payload.bs_array;+}+ +void+bsappbyte(struct forptr *fp, uint8_t b)+{+ struct bytestring *bsp = &fp->payload;+ if (bsp->bs_size >= bsp->bs_capacity) {+ bsp->bs_capacity += bsp->bs_capacity / 2 + 2;+ bsp->bs_array = mrealloc(bsp->bs_array, bsp->bs_capacity);+ adjforptr(fp);+ }+ ((uint8_t*)bsp->bs_array)[bsp->bs_size++] = b;+}++static INLINE NODEPTR+mkNil(void)+{+ return combFalse;+}++static INLINE NODEPTR+mkCons(NODEPTR x, NODEPTR xs)+{+ return new_ap(new_ap(combCons, x), xs);+}++size_t+strNodes(size_t len)+{+ /* Each character will need a CHAR node and a CONS node, a CONS uses 2 T_AP nodes */+ len *= (1 + 2);+ /* And each string will need a NIL */+ len += 1;+ return len;+}++/* Turn a C string into a combinator string.+ * Does NOT do UTF decoding.+ */+NODEPTR+mkString(struct bytestring bs)+{+ NODEPTR n, nc;+ size_t i;+ const unsigned char *str = bs.bs_array; /* no sign bits, please */++ n = mkNil();+ for(i = bs.bs_size; i > 0; i--) {+ nc = mkInt(str[i-1]);+ n = mkCons(nc, n);+ }+ return n;+}++NODEPTR+mkStringC(char *str)+{+ return mkString(mk_ro_bytestring(strlen(str), str));+}++NODEPTR+mkStringU(struct bytestring bs)+{+ BFILE *ubuf = add_utf8(openb_rd_mem(bs.bs_array, bs.bs_size));+ NODEPTR n, *np, nc;++ //printf("mkStringU %d %s\n", (int)bs.size, (char*)bs.string);++ n = mkNil();+ np = &n;+ for(;;) {+ int c = getb(ubuf);+ if (c < 0)+ break;+ nc = mkInt(c);+ *np = mkCons(nc, *np);+ np = &ARG(*np);+ }+ closeb(ubuf);+ return n;+}++NODEPTR+bsunpack(struct bytestring bs)+{+ NODEPTR n, *np, nc;+ size_t i;++ n = mkNil();+ np = &n;+ for(i = 0; i < bs.bs_size; i++) {+ nc = mkInt(((uint8_t *)bs.bs_array)[i]);+ *np = mkCons(nc, *np);+ np = &ARG(*np);+ }+ return n;+}++/* XXX This should somehow be merged with other utf8 decoders */+/* Decode first character of a string and optionally return the rest of the string. */+/* Handles regular and modified UTF-8. */+value_t+headutf8(struct bytestring bs, void **ret)+{+ uint8_t *p = bs.bs_array;+ if (bs.bs_size == 0)+ ERR("headUTF8 0");+#if !WANT_UTF8+ if (ret)+ *ret = p + 1;+ return *p;+#else+ int c1 = *p++;+ if ((c1 & 0x80) == 0) {+ if (ret)+ *ret = p;+ return c1;+ }+ if ((c1 & 0xe0) == 0xc0 && bs.bs_size >= 2) {+ int c2 = p[0];+ if ((c2 & 0xc0) == 0x80) {+ int c = ((c1 & 0x1f) << 6) | (c2 & 0x3f);+ if (c == 0 || c >= 0x80) {+ if (ret)+ *ret = p + 1;+ return c;+ }+ }+ } else if ((c1 & 0xf0) == 0xe0 && bs.bs_size >= 3) {+ int c2 = p[0], c3 = p[1];+ if ((c2 & 0xc0) == 0x80 && (c3 & 0xc0) == 0x80) {+ int c = ((c1 & 0x0f) << 12) | ((c2 & 0x3f) << 6) | (c3 & 0x3f);+ if (c >= 0x800 && (c < 0xd800 || c > 0xdfff)) {+ if (ret)+ *ret = p + 2;+ return c;+ }+ }+ } else if ((c1 & 0xf8) == 0xf0 && bs.bs_size >= 4) {+ int c2 = p[0], c3 = p[1], c4 = p[2];+ if ((c2 & 0xc0) == 0x80 && (c3 & 0xc0) == 0x80 && (c4 & 0xc0) == 0x80) {+ int c = ((c1 & 0x07) << 18) | ((c2 & 0x3f) << 12) | ((c3 & 0x3f) << 6) | (c4 & 0x3f);+ if (c >= 0x10000 && c < 0x110000) {+ if (ret)+ *ret = p + 3;+ return c;+ }+ }+ }+ if (ret)+ *ret = p;+ return 0xdc00 | c1;+#endif /* WANT_UTF8 */+}++/*+ * Helpers for Data.Text, whose Text is a (modified) UTF-8 ByteString.+ * Positions are byte offsets; counts are in characters. A character+ * starts at every byte that is not a continuation byte (10xxxxxx).+ * Without WANT_UTF8 every byte is a character.+ */+#if WANT_UTF8+#define UTF8CONT(b) (((b) & 0xc0) == 0x80)+#else+#define UTF8CONT(b) ((void)(b), 0)+#endif++/* Number of characters. */+static value_t+utf8length(struct bytestring bs)+{+ const uint8_t *p = bs.bs_array;+ value_t n = 0;+ for (size_t i = 0; i < bs.bs_size; i++)+ n += !UTF8CONT(p[i]);+ return n;+}++/* Byte offset after the first k characters from byte offset i (clamped+ * to the string). */+static value_t+utf8offsetfrom(struct bytestring bs, value_t i0, value_t k)+{+ const uint8_t *p = bs.bs_array;+ size_t n = bs.bs_size;+ size_t i = i0 < 0 ? 0 : (size_t)i0 > n ? n : (size_t)i0;+ for (; k > 0 && i < n; k--) {+ i++;+ while (i < n && UTF8CONT(p[i]))+ i++;+ }+ return i;+}++/* Byte offset where the last k characters before byte offset i start+ * (clamped to the string). */+static value_t+utf8offsetendbefore(struct bytestring bs, value_t i0, value_t k)+{+ const uint8_t *p = bs.bs_array;+ size_t n = bs.bs_size;+ size_t i = i0 < 0 ? 0 : (size_t)i0 > n ? n : (size_t)i0;+ for (; k > 0 && i > 0; k--) {+ i--;+ while (i > 0 && UTF8CONT(p[i]))+ i--;+ }+ return i;+}++/* Byte offset after the first k characters (clamped to the string). */+static value_t+utf8offset(struct bytestring bs, value_t k)+{+ return utf8offsetfrom(bs, 0, k);+}++/* Byte offset where the last k characters start (clamped to the string). */+static value_t+utf8offsetend(struct bytestring bs, value_t k)+{+ return utf8offsetendbefore(bs, bs.bs_size, k);+}++/* Decode the character starting at byte offset i (which must be < size).+ * Returns (code point << 3) | (bytes used). */+static value_t+utf8decode(struct bytestring bs, value_t i)+{+ struct bytestring rest;+ void *out;+ value_t c;+ if (i < 0 || (size_t)i >= bs.bs_size)+ ERR("utf8decode");+ rest.bs_array = (uint8_t *)bs.bs_array + i;+ rest.bs_size = bs.bs_size - i;+ rest.bs_capacity = 0;+ c = headutf8(rest, &out);+ return (c << 3) | ((uint8_t *)out - (uint8_t *)rest.bs_array);+}++/* Decode the character that ends at byte offset e (which must be > 0).+ * Returns (code point << 3) | (bytes used). */+static value_t+utf8decodeend(struct bytestring bs, value_t e)+{+ const uint8_t *p = bs.bs_array;+ value_t lo, s;+ if (e <= 0 || (size_t)e > bs.bs_size)+ ERR("utf8decodeend");+ lo = e > 4 ? e - 4 : 0;+ for (s = e - 1; s > lo && UTF8CONT(p[s]); s--)+ ;+ return (utf8decode(bs, s) & ~(value_t)7) | (e - s);+}++/* Data.Char.isSpace: the ASCII spaces and the Unicode Space_Separator (Zs)+ * characters. */+static int+utf8isspace(value_t c)+{+ return c == ' ' || (c >= '\t' && c <= '\r') ||+ c == 0xa0 || c == 0x1680 || (c >= 0x2000 && c <= 0x200a) ||+ c == 0x202f || c == 0x205f || c == 0x3000;+}++/* First byte offset >= i whose character is (if want is 0: is not) a space. */+static value_t+utf8skip(struct bytestring bs, value_t i, int want)+{+ const uint8_t *p = bs.bs_array;+ value_t n = bs.bs_size;+ if (i < 0)+ i = 0;+ while (i < n) {+ if (p[i] < 0x80) { /* ASCII fast path */+ if (utf8isspace(p[i]) == want)+ return i;+ i++;+ } else {+ value_t r = utf8decode(bs, i);+ if (utf8isspace(r >> 3) == want)+ return i;+ i += r & 7;+ }+ }+ return n;+}++/* Byte offset after the string with trailing spaces removed. */+static value_t+utf8trimspaceend(struct bytestring bs)+{+ const uint8_t *p = bs.bs_array;+ value_t e = bs.bs_size;+ while (e > 0) {+ if (p[e-1] < 0x80) {+ if (!utf8isspace(p[e-1]))+ break;+ e--;+ } else {+ value_t r = utf8decodeend(bs, e);+ if (!utf8isspace(r >> 3))+ break;+ e -= r & 7;+ }+ }+ return e;+}++/* The characters in reverse order. */+static struct bytestring+utf8reverse(struct bytestring bs)+{+ struct bytestring r = mk_ro_bytestring(bs.bs_size, NULL);+ const uint8_t *p = bs.bs_array;+ uint8_t *q = (uint8_t *)r.bs_array + bs.bs_size;+ size_t i = 0, n = bs.bs_size;+ while (i < n) {+ size_t s = i++;+ while (i < n && UTF8CONT(p[i]))+ i++;+ q -= i - s;+ memcpy(q, p + s, i - s);+ }+ return r;+}++/* Byte offset of the first occurrence of pat in str at or after i, or -1.+ * Since UTF-8 is self-synchronizing, a match of a valid encoding always+ * starts at a character boundary. */+static value_t+bsfind(struct bytestring pat, struct bytestring str, value_t i)+{+ const uint8_t *p = pat.bs_array, *s = str.bs_array;+ size_t m = pat.bs_size, n = str.bs_size;+ if (i < 0)+ i = 0;+ if ((size_t)i > n || m > n - i)+ return -1;+ if (m == 0)+ return i;+ for (const uint8_t *q = s + i, *end = s + (n - m); q <= end; q++) {+ q = memchr(q, p[0], end - q + 1);+ if (!q)+ return -1;+ if (memcmp(q + 1, p + 1, m - 1) == 0)+ return q - s;+ }+ return -1;+}++/* Byte offset of the last occurrence of pat in str, or -1.+ * An empty pattern occurs at the end. */+static value_t+bsrfind(struct bytestring pat, struct bytestring str)+{+ const uint8_t *p = pat.bs_array, *s = str.bs_array;+ size_t m = pat.bs_size, n = str.bs_size;+ if (m > n)+ return -1;+ if (m == 0)+ return n;+ for (size_t i = n - m + 1; i-- > 0; )+ if (s[i] == p[0] && memcmp(s + i + 1, p + 1, m - 1) == 0)+ return i;+ return -1;+}++/* 1 if every byte is ASCII, else 0. */+static value_t+bsisascii(struct bytestring bs)+{+ const uint8_t *p = bs.bs_array;+ for (size_t i = 0; i < bs.bs_size; i++)+ if (p[i] >= 0x80)+ return 0;+ return 1;+}++/* ASCII lower case (upper == 0) or upper case (upper != 0). */+static struct bytestring+bsasciicase(struct bytestring bs, value_t upper)+{+ struct bytestring r = mk_ro_bytestring(bs.bs_size, NULL);+ const uint8_t *p = bs.bs_array;+ uint8_t *q = r.bs_array;+ for (size_t i = 0; i < bs.bs_size; i++) {+ uint8_t c = p[i];+ if (upper ? (c >= 'a' && c <= 'z') : (c >= 'A' && c <= 'Z'))+ c ^= 0x20;+ q[i] = c;+ }+ return r;+}++/* Evaluate to a Bool */+static INLINE value_t+evalbool(NODEPTR n)+{+ return eq_NODEPTR(evali(n), combTrue);+}++/* Evaluate to an INT */+static INLINE value_t+evalint(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_INT) {+ ERR1("evalint, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return GETVALUE(n);+}++#if WANT_INT64+/* Evaluate to an INT64 */+static INLINE int64_t+evalint64(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_INT64) {+ ERR1("evalint64, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return GETINT64VALUE(n);+}+#endif /* WANT_INT64 */++#if WANT_FLOAT64+/* Evaluate to a flt64_t */+static INLINE flt64_t+evaldbl(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_DBL) {+ ERR1("evaldbl, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return GETDBLVALUE(n);+}+#endif /* WANT_FLOAT64 */++#if WANT_FLOAT32+/* Evaluate to a flt32_t */+static INLINE flt32_t+evalflt(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_FLT32) {+ ERR1("evalflt, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return GETFLTVALUE(n);+}+#endif /* WANT_FLOAT32 */++/* Evaluate to a T_PTR */+void *+evalptr(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_PTR) {+ ERR1("evalptr, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return PTR(n);+}++/* Evaluate to a T_FUNPTR */+HsFunPtr+evalfunptr(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_FUNPTR) {+ ERR1("evalfunptr, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return FUNPTR(n);+}++/* Evaluate to a T_FORPTR */+struct forptr *+evalforptr(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_FORPTR) {+ ERR1("evalforptr, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return FORPTR(n);+}++/* Evaluate to a bytestring */+struct forptr *+evalbstr(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_FORPTR || FORPTR(n)->finalizer->fptype != FP_BSTR) {+ ERR1("evalbstr, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return FORPTR(n);+}++/* Evaluate to a T_THID */+struct mthread *+evalthid(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_THID) {+ ERR1("evalthid, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return THR(n);+}++/* Evaluate to a T_MVAR */+struct mvar *+evalmvar(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_MVAR) {+ ERR1("evalmvar, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return MVAR(n);+}++/* Evaluate to a T_WEAK */+void *+evalweak(NODEPTR n)+{+ n = evali(n);+#if SANITY+ if (get_XTAG(n) != D_WEAK) {+ ERR1("evalweak, bad tag %s", TAGNAME(get_XTAG(n)));+ }+#endif+ return WEAK(n);+}++/* Evaluate a string, returns a newly allocated buffer.+ * XXX this is cheating, should use continuations.+ * XXX the malloc()ed string is leaked if we yield in here.+ * Caller is responsible to free().+ * Does modified UTF-8 encoding.+ * Only used to display an uncaught exception.+ * XXX Should remove from DYNSYM+ */+struct bytestring+evalstring(NODEPTR n)+{+ size_t sz = 100;+ char *buf = mmalloc(sz);+ size_t offs;+ uvalue_t c;+ NODEPTR x;++ for (offs = 0;;) {+ if (offs >= sz - 4) {+ sz *= 2;+ buf = mrealloc(buf, sz);+ }+ PUSH(n); /* protect the list from GC */+ n = evali(n);+ POP(1);+ if (eq_NODEPTR(n, combNil))+ break;+ else if (get_XTAG(n) == X_AP && get_XTAG(x = indir(&FUN(n))) == X_AP && eq_NODEPTR(indir(&FUN(x)), combCons)) { /* Cons */+ PUSH(n); /* protect from GC */+ c = evalint(ARG(x));+ n = POPTOP();+ if ((c & 0x1ff800) == 0xd800) {+ // c is a surrogate+ c = 0xfffd; // replacement character+ }+ if (0 < c && c < 0x80) { /* exclude 0, since this is modified UTF-8 */+ buf[offs++] = (char)c;+ } else if (c < 0x800) {+ /* 0 encodes here, with an over-long representation */+ buf[offs++] = ((c >> 6 ) ) | 0xc0;+ buf[offs++] = ((c ) & 0x3f) | 0x80;+ } else if (c < 0x10000) {+ buf[offs++] = ((c >> 12) ) | 0xe0;+ buf[offs++] = ((c >> 6 ) & 0x3f) | 0x80;+ buf[offs++] = ((c ) & 0x3f) | 0x80;+ } else if (c < 0x110000) {+ buf[offs++] = ((c >> 18) ) | 0xf0;+ buf[offs++] = ((c >> 12) & 0x3f) | 0x80;+ buf[offs++] = ((c >> 6 ) & 0x3f) | 0x80;+ buf[offs++] = ((c ) & 0x3f) | 0x80;+ } else {+ ERR("invalid char");+ }+ n = ARG(n);+ } else {+ ERR("evalstring not Nil/Cons");+ }+ }+ buf[offs] = 0; /* in case we use it as a C string */+ return mk_ro_bytestring(offs, buf);+}++/*+ * Concatenate a list of ByteStrings with a single copy.+ * The spine and the elements must already be evaluated (concatBS in+ * Data.ByteString.Internal does that): evaluating here could yield to+ * another thread, which restarts the primitive from the beginning.+ * Without evaluation there is no allocation of nodes, so no GC either.+ */+static NODEPTR+bsconcat_follow(NODEPTR n)+{+ return indir(&n);+}++struct bytestring+bsconcat(NODEPTR list)+{+ struct bytestring r;+ size_t size = 0;+ uint8_t *q = 0;+ int pass;++ for (pass = 0; pass < 2; pass++) {+ NODEPTR n = list, x, e;+ if (pass == 1) {+ r = mk_ro_bytestring(size, NULL);+ q = r.bs_array;+ }+ for (;;) {+ n = bsconcat_follow(n);+ if (eq_NODEPTR(n, combNil))+ break;+ if (!(get_XTAG(n) == X_AP && get_XTAG(x = indir(&FUN(n))) == X_AP && eq_NODEPTR(indir(&FUN(x)), combCons)))+ ERR("bsconcat: list not evaluated");+ e = bsconcat_follow(ARG(x));+ if (get_XTAG(e) != D_FORPTR)+ ERR("bsconcat: element not evaluated");+ struct bytestring bs = FORPTR(e)->payload;+ if (pass == 0) {+ size += bs.bs_size;+ } else {+ memcpy(q, bs.bs_array, bs.bs_size);+ q += bs.bs_size;+ }+ n = ARG(n);+ }+ }+ return r;+}++struct bytestring+bsreplicate(size_t size, uint8_t value)+{+ struct bytestring bs = mk_ro_bytestring(size, NULL);+ memset(bs.bs_array, value, size);+ return bs;+}++struct bytestring+bsappend(struct bytestring p, struct bytestring q)+{+ struct bytestring r = mk_ro_bytestring(p.bs_size + q.bs_size, NULL);+ memcpy(r.bs_array, p.bs_array, p.bs_size);+ memcpy((uint8_t *)r.bs_array + p.bs_size, q.bs_array, q.bs_size);+ return r;+}++struct bytestring+bsappenddot(struct bytestring p, struct bytestring q)+{+ struct bytestring r = mk_ro_bytestring(p.bs_size + q.bs_size + 1, NULL);+ memcpy(r.bs_array, p.bs_array, p.bs_size);+ memcpy((uint8_t *)r.bs_array + p.bs_size, ".", 1);+ memcpy((uint8_t *)r.bs_array + p.bs_size + 1, q.bs_array, q.bs_size);+ return r;+}++/*+ * Compare bytestrings.+ */+int+bscompare(struct bytestring bsp, struct bytestring bsq)+{+ if (bsp.bs_array == bsq.bs_array && bsp.bs_size == bsq.bs_size)+ return 0;+ size_t len = bsp.bs_size < bsq.bs_size ? bsp.bs_size : bsq.bs_size;+ if (len) {+ int r = memcmp(bsp.bs_array, bsq.bs_array, len);+ if (r < 0)+ return -1;+ if (r > 0)+ return 1;+ }+ /* Got to the end of the shorter string. */+ /* The shorter string is considered smaller. */+ if (bsp.bs_size < bsq.bs_size)+ return -1;+ if (bsp.bs_size > bsq.bs_size)+ return 1;+ return 0;+}++static INLINE bool+bsequal(struct bytestring bsp, struct bytestring bsq)+{+ return bsp.bs_size == bsq.bs_size &&+ (bsp.bs_array == bsq.bs_array || bsp.bs_size == 0 ||+ memcmp(bsp.bs_array, bsq.bs_array, bsp.bs_size) == 0);+}++void+rnf_rec(bits_t *done, NODEPTR n)+{+ top:+ if (test_bit(done, n))+ return;+ set_bit(done, n);+ if (doing_rnf) {+ /* If evaluating n raises an exception or does IO, leave n unevaluated.+ * Returning a partly evaluated node instead (as before) would pass+ * a value of the wrong type to a primitive. */+ NODEPTR *stk = stack_ptr;+ struct handler *ohdl = cur_handler;+ if (setjmp(rnf_skip)) {+ stack_ptr = stk;+ while (cur_handler != ohdl) {+ struct handler *h = cur_handler;+ cur_handler = h->hdl_old;+ FREE(h);+ }+ return;+ }+ }+ n = evali(n);+ if (get_XTAG(n) == X_AP) {+ PUSH(ARG(n)); /* protect from GC */+ rnf_rec(done, FUN(n));+ n = POPTOP();+ goto top;+ }+}++void+rnf(value_t noerr, NODEPTR n)+{+ if (doing_rnf)+ ERR("recursive rnf()");+ /* Mark visited nodes to avoid getting stuck in loops. */+ struct rnf_state rs;+ rs.rs_done = mcalloc(free_map_nwords, sizeof(bits_t));+ rs.rs_hdl = cur_handler;+ rs.rs_old = cur_rnf;+ cur_rnf = &rs;+ doing_rnf = (bool)noerr;+ rnf_rec(rs.rs_done, n);+ doing_rnf = false;+ cur_rnf = rs.rs_old;+ FREE(rs.rs_done);+}++#if EXTRASANITY /* the only user so far; extracting code for a JIT will need them too */+/* The number of arguments the virtual node h (the head of a spine: a+ * combinator, primitive, case, or constructor) needs before it reduces, or -1+ * if it never reduces (a constructor). For the combinators that also reduce+ * with fewer arguments (e.g., B' x y = B (x y)) it is the smaller number. */+static INLINE int+arity_virt(NODEPTR h)+{+ enum node_tag t = get_VIRT_TAG(h);+ switch (t) {+ case V_CONSTR:+ case V_LOOKD:+ case V_LOOKS:+ return -1;+ case V_CASED:+ return get_case_arity(h)->m + 1;+ case V_CASES:+ return get_case_arity(h)->m + 2;+ default:+ return tag_arity[t];+ }+}++/* Is n in weak head normal form, i.e., would evaluating it do no reduction?+ * It is if it is a value (an Int, a ByteString, ...), a constructor applied to+ * at most its fields, or a partial application. So count the arguments down+ * the spine, and compare with the arity of the head. */+static INLINE bool+is_whnf(NODEPTR n)+{+ int d = 0; /* arguments so far */+ for (;;) {+ if (is_VIRT(n)) {+ int a = arity_virt(n);+ return a < 0 || d < a;+ }+ NODEPTR f = FUN(n);+ if (is_AP(f)) { /* an application */+ d++;+ n = f;+ continue;+ }+ switch (get_DATA_TAG(f)) {+ case D_IND: n = ARG(n); continue;+ case D_IO_CCALL: return d < FFI_IX(GETVALUE(n)).ffi_arity + 1;+ case D_TICK: return d < 1;+ case D_BADDYN: return false; /* evaluating it is an error */+ default: return true; /* a value */+ }+ }+}++/* A case checks for as many arguments as the arity in primops[]; the+ * combinators that also reduce with fewer arguments check for more in their+ * other branch. The arity of the other tags is in the node, see arity_virt. */+static void+check_arity(enum node_tag tag, int k)+{+ if (tag <= T_FIRST_REAL_TAG || tag >= T_LAST_TAG || k == tag_arity[tag])+ return;+ switch (tag) {+ case T_BB: case T_Z: case T_R: case T_K2: case T_K3: case T_K4: case T_CCB:+ if (k > tag_arity[tag])+ return;+ break;+ default:+ break;+ }+#if WANT_STDIO+ fprintf(stderr, "arity of %s: CHECK(%d), but primops[] says %d\n", TAGNAME(tag), k, (int)tag_arity[tag]);+#endif+ ERR("check_arity");+}+#endif /* EXTRASANITY */++/*+ * The interpreter is split in three functions:+ * evali the core: unwinding, combinators, case and constructors, the IO+ * monad combinators, seq, and Int arithmetic. It handles most+ * reductions.+ * evalprimop every other primitive; evali calls it for a tag it does not handle.+ * evalprimret the continuations of the strict primitives that are not on Int,+ * i.e., what to do when an argument has been evaluated and there is+ * a BININT64_1 (etc) marker on the stack.+ * evalprimop and evalprimret return the node to continue with, and whether+ * evali should evaluate it (PRIM_TOP, i.e., goto top) or return it as a value+ * (PRIM_RET, i.e., goto ret).+ */+enum prim_next { PRIM_TOP, PRIM_RET };+struct prim_res { NODEPTR n; enum prim_next next; };++/* Macros shared by evali, evalprimop, and evalprimret. RET, GOTOP, CHECK,+ * and the GOxxx macros are defined separately for evali and for the other two. */+#define HASNARGS(k) (STACK_ABOVE(stk) >= (k))+/* Check that there are at least k arguments, return if not. */+#if EXTRASANITY+#define CHECK(k) do { check_arity(tag, (k)); if (!HASNARGS(k)) RET; } while(0)+#else+#define CHECK(k) do { if (!HASNARGS(k)) RET; } while(0)+#endif+#define SETIND(n, x) set_IND(n, x)+#define GOBOOL(b) do { GOIND(b ? combTrue : combFalse); } while(0)+/* CHKARGN checks that there are at least N arguments.+ * It also+ * - sets n to the "top" node+ * - set x, y, ... to the arguments+ * - pops N stack elements+ * NOTE: No GC is allowed after these, since the stack has been popped.+ */+#define POPARG2 do { POP(2); n = TOP(-1); y = ARG(n); x = ARG(TOP(-2)); } while(0)+#define POPARG3 do { POP(3); n = TOP(-1); z = ARG(n); y = ARG(TOP(-2)); x = ARG(TOP(-3)); } while(0)+#define POPARG4 do { POP(4); n = TOP(-1); w = ARG(n); z = ARG(TOP(-2)); y = ARG(TOP(-3)); x = ARG(TOP(-4)); } while(0)+#define CHKARG0 do { } while(0)+#define CHKARG1 do { CHECK(1); POP(1); n = TOP(-1); x = ARG(n); } while(0)+#define CHKARG2 do { CHECK(2); POPARG2; } while(0)+#define CHKARG3 do { CHECK(3); POPARG3; } while(0)+#define CHKARG4 do { CHECK(4); POPARG4; } while(0)+#define CHKARG5 do { CHECK(5); POP(5); n = TOP(-1); /*v = ARG(n);*/ w = ARG(TOP(-2)); z = ARG(TOP(-3)); y = ARG(TOP(-4)); x = ARG(TOP(-5)); } while(0)+/* Read argument i (0-based) from the unpopped stack, and pop k entries setting n.+ * Use these instead of pre-loading arguments into locals across eval*() or GCCHECK(),+ * because GC may bypass and free a D_IND cell referenced by a stale local NODEPTR. */+#define STKARG(i) ARG(TOP(i))+#define POPN(k) do { POP(k); n = TOP(-1); } while(0)++/* Alloc a possible GC action, e, between setting x and popping */+#define CHKARGEV1(e) do { CHECK(1); x = ARG(TOP(0)); e; POP(1); n = TOP(-1); } while(0)++/* Overwrite the (real) node n with a data node */+#define SETINT(n,r) do { set_DATA_TAG((n), D_INT); SETVALUE((n), (r)); } while(0)+#define SETINT64(n,r) do { set_DATA_TAG((n), D_INT64); SETINT64VALUE((n), (r)); } while(0)+#define SETDBL(n,d) do { set_DATA_TAG((n), D_DBL); SETDBLVALUE((n), (d)); } while(0)+#define SETFLT(n,d) do { set_DATA_TAG((n), D_FLT32); SETFLTVALUE((n), (d)); } while(0)+#define SETPTR(n,r) do { set_DATA_TAG((n), D_PTR); PTR(n) = (r); } while(0)+#define SETFUNPTR(n,r) do { set_DATA_TAG((n), D_FUNPTR); FUNPTR(n) = (r); } while(0)+#define SETFORPTR(n,r) do { set_DATA_TAG((n), D_FORPTR); FORPTR(n) = (r); } while(0)+#define SETBSTR(n,r) do { set_DATA_TAG((n), D_FORPTR); FORPTR(n) = (r); FORPTR(n)->finalizer->fptype = FP_BSTR; } while(0)+#define OPINT1(e) do { CHECK(1); xi = evalint(ARG(TOP(0))); e; POP(1); n = TOP(-1); } while(0);+#define OPPTR2(e) do { CHECK(2); xp = evalptr(ARG(TOP(0))); yp = evalptr(ARG(TOP(1))); e; POP(2); n = TOP(-1); } while(0);+#define CMPP(op) do { OPPTR2(r = xp op yp); GOIND(r ? combTrue : combFalse); } while(0)+++/* Control macros for evalprimop and evalprimret */+#define RET do { return (struct prim_res){ n, PRIM_RET }; } while(0)+#define GOTOP(x) do { return (struct prim_res){ (x), PRIM_TOP }; } while(0)+#define GOIND(x) do { NODEPTR _x = (x); SETIND(n, _x); GOTOP(_x); } while(0)+#define GOAP(f,a) do { FUN(n) = (f); ARG(n) = (a); GOTOP(n); } while(0)+#define GOAP2(f,a,b) do { FUN(n) = new_ap((f), (a)); ARG(n) = (b); GOTOP(n); } while(0)+#define GOPAIR(a) do { FUN(n) = new_ap(combP, (a)); GOTOP(n); } while(0)+#define GOPAIRUNIT do { FUN(n) = combPUnit; GOTOP(n); } while(0)++/* Reduce the primitive tag, which is at the head of the spine (n).+ * stk is the stack base of the calling evali. */+static NOINLINE struct prim_res+evalprimop(NODEPTR n, enum node_tag tag, NODEPTR *stk)+{+ NODEPTR x, y, z, w;+ value_t xi, yi;+ struct forptr *xfp;+ struct ioarray *arr;+#if WANT_STDIO+ void *bfile;+ int hdr;+#endif /* WANT_STDIO */++ switch (tag) {++#if WANT_FLOAT32+ case T_FADD:+ case T_FSUB:+ case T_FMUL:+ case T_FDIV:+ case T_FEQ:+ case T_FNE:+ case T_FLT:+ case T_FLE:+ case T_FGT:+ case T_FGE:+ CHECK(2);+ n = ARG(TOP(1));+ PUSH(combBINFLT2);+ GOTOP(n);+ case T_FNEG:+ CHECK(1);+ n = ARG(TOP(0));+ PUSH(combUNFLT1);+ GOTOP(n);++ case T_I64TOF:+ {+#if WANT_INT64+ CHECK(1);+ flt32_t rf = (flt32_t)evalint64(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETFLT(n, rf);+ RET;+#else+ ERR("No Int64");+#endif+ }++ case T_ITOF:+ {+ CHECK(1);+ flt32_t rf = (flt32_t)evalint(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETFLT(n, rf);+ RET;+ }++ case T_UTOF:+ {+ CHECK(1);+ flt32_t rf = (flt32_t)(uvalue_t)evalint(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETFLT(n, rf);+ RET;+ }++ case T_FTOI:+ {+ CHECK(1);+ value_t i = (value_t)evalflt(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, i);+ RET;+ }++#endif /* WANT_FLOAT32 */++#if WANT_FLOAT64 && WANT_FLOAT32+ case T_DTOF:+ {+ CHECK(1);+ float xf = (float)evaldbl(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETFLT(n, xf);+ RET;+ }+ case T_FTOD:+ {+ CHECK(1);+ double xd = (double)evalflt(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETDBL(n, xd);+ RET;+ }+#endif /* WANT_FLOAT64 && WANT_FLOAT32 */++#if WANT_FLOAT64+ case T_DADD:+ case T_DSUB:+ case T_DMUL:+ case T_DDIV:+ case T_DEQ:+ case T_DNE:+ case T_DLT:+ case T_DLE:+ case T_DGT:+ case T_DGE:+ CHECK(2);+ n = ARG(TOP(1));+ PUSH(combBINDBL2);+ GOTOP(n);+ case T_DNEG:+ CHECK(1);+ n = ARG(TOP(0));+ PUSH(combUNDBL1);+ GOTOP(n);++#if WANT_INT64+ case T_I64TOD:+ {+ CHECK(1);+ flt64_t rd = (flt64_t)evalint64(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETDBL(n, rd);+ RET;+ }+#endif++ case T_ITOD:+ {+ CHECK(1);+ flt64_t rd = (flt64_t)evalint(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETDBL(n, rd);+ RET;+ }++ case T_UTOD:+ {+ CHECK(1);+ flt64_t rd = (flt64_t)(uvalue_t)evalint(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETDBL(n, rd);+ RET;+ }++ case T_DTOI:+ {+ CHECK(1);+ value_t i = (value_t)evaldbl(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, i);+ RET;+ }++#endif /* WANT_FLOAT64 */++ case T_ISINT:+ CHECK(1);+ x = evali(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, get_XTAG(x) == D_INT ? GETVALUE(x) : -1);+ RET;++ case T_BSAPPEND:+ case T_BSAPPENDDOT:+ case T_BSEQ:+ case T_BSNE:+ case T_BSLT:+ case T_BSLE:+ case T_BSGT:+ case T_BSGE:+ case T_BSCMP:+ CHECK(2);+ n = ARG(TOP(1));+ PUSH(combBINBS2);+ GOTOP(n);++#if WANT_INT64+ case T_ADD64:+ case T_SUB64:+ case T_MUL64:+ case T_QUOT64:+ case T_REM64:+ case T_SUBR64:+ case T_UADD64:+ case T_USUB64:+ case T_UMUL64:+ case T_UQUOT64:+ case T_UREM64:+ case T_USUBR64:+ case T_AND64:+ case T_OR64:+ case T_XOR64:+ case T_SHL64:+ case T_SHR64:+ case T_ASHR64:+ case T_EQ64:+ case T_NE64:+ case T_LT64:+ case T_LE64:+ case T_GT64:+ case T_GE64:+ case T_ICMP64:+ case T_ULT64:+ case T_ULE64:+ case T_UGT64:+ case T_UGE64:+ case T_UCMP64:+ CHECK(2);+ /*+ fprintf(stderr, "bin64 op=%s\n", TAGNAME(tag)); fflush(stderr);+ { NODEPTR x = evali(ARG(TOP(1)));+ fprintf(stderr, "x.tag=%s x.val=%lld\n", TAGNAME(get_XTAG(x)), GETINT64VALUE(x)); fflush(stderr);+ NODEPTR y = evali(ARG(TOP(0)));+ fprintf(stderr, "y.tag=%s y.val=%ld\n", TAGNAME(get_XTAG(y)), GETVALUE(y)); fflush(stderr);+ }+ */+ n = ARG(TOP(1));+ if (get_XTAG(n) == D_INT64) {+ //fprintf(stderr, "push combBININT64_1\n"); fflush(stderr);+ n = ARG(TOP(0));+ PUSH(combBININT64_1);+ if (get_XTAG(n) == D_INT64) {+ /* Both arguments are evaluated: the BININT64_1 continuation in+ * evalprimret does the operation. */+ RET;+ }+ } else {+ //fprintf(stderr, "push combBININT64_2\n"); fflush(stderr);+ PUSH(combBININT64_2);+ }+ GOTOP(n);+ case T_NEG64:+ case T_UNEG64:+ case T_INV64:+ case T_POPCOUNT64:+ case T_CLZ64:+ case T_CTZ64:+ CHECK(1);+ n = ARG(TOP(0));+ PUSH(combUNINT64_1);+ GOTOP(n);+#endif /* WANT_INT64 */+++ /* Convert between different types. */+#define CONV(t, set, get) do { CHECK(1); x = evali(ARG(TOP(0))); n = POPTOP(); set_DATA_TAG(n, t); set(n, get(x)); RET; } while(0)+#if WANT_INT64+ case T_TODBL: CONV(D_DBL, SETINT64VALUE, GETINT64VALUE); /* raw int64_t -> double */+ case T_FROMDBL: CONV(D_INT64, SETINT64VALUE, GETINT64VALUE); /* raw double -> int64_t */+ case T_ITOI64: CONV(D_INT64, SETINT64VALUE, GETVALUE);+ case T_UTOU64: CONV(D_INT64, SETINT64VALUE, (uint64_t)(uvalue_t)GETVALUE);+ case T_I64TOI: CONV(D_INT, SETVALUE, GETINT64VALUE);+ case T_U64TOU: CONV(D_INT, SETVALUE, GETINT64VALUE);+#endif /* WANT_INT64 */+#if WANT_FLOAT32+ case T_TOFLT: CONV(D_FLT32, SETINT32VALUE, (uint32_t)GETVALUE);+ case T_FROMFLT: CONV(D_INT, SETVALUE, GETINT32VALUE);+#endif /* WANT_FLOAT32 */+ case T_TOINT: CONV(D_INT, SETVALUE, GETVALUE);+ case T_TOPTR: CONV(D_PTR, SETVALUE, GETVALUE);+ case T_TOFUNPTR: CONV(D_FUNPTR, SETVALUE, GETVALUE);+#undef CONV++ case T_FPADD: CHECK(2); xfp = evalforptr(ARG(TOP(0))); yi = evalint(ARG(TOP(1))); POP(2); n = TOP(-1); SETFORPTR(n, addForPtr(xfp, yi)); RET;+ case T_FP2P:+ CHECK(1);+ xfp = evalforptr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETPTR(n, xfp->payload.bs_array);+ RET;++ case T_FP2BS:+ CHECK(2);+ xfp = evalforptr(ARG(TOP(0)));+ xi = evalint(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ xfp->payload.bs_size = xi;+ SETBSTR(n, xfp);+ RET;++ case T_BS2FP:+ CHECK(1);+ xfp = evalbstr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETFORPTR(n, xfp);+ RET;++ case T_ARR_EQ:+ {+ CHECK(2);+ x = evali(ARG(TOP(0)));+ arr = ARR(x);+ y = evali(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ GOBOOL(arr == ARR(y));+ }++ case T_BSHEADUTF8:+ CHECK(1);+ xfp = evalbstr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, headutf8(xfp->payload, (void**)0));+ RET;++ case T_BSTAILUTF8:+ CHECK(1);+ xfp = evalbstr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ { void *out;+ (void)headutf8(xfp->payload, &out); /* skip one UTF8 character */+ xi = (char*)out - (char*)xfp->payload.bs_array; /* offset */+ yi = xfp->payload.bs_size - xi; /* remaining length */+ SETBSTR(n, bssubstr(xfp, xi, yi)); /* make a substring */+ }+ RET;++ /* Data.Text helpers on one ByteString */+ case T_UTF8LENGTH:+ case T_UTF8TRIMSPACEEND:+ case T_UTF8REVERSE:+ case T_BSISASCII:+ CHECK(1);+ xfp = evalbstr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ switch (tag) {+ case T_UTF8LENGTH: SETINT(n, utf8length(xfp->payload)); break;+ case T_UTF8TRIMSPACEEND: SETINT(n, utf8trimspaceend(xfp->payload)); break;+ case T_BSISASCII: SETINT(n, bsisascii(xfp->payload)); break;+ default: SETBSTR(n, mkForPtrFree(utf8reverse(xfp->payload))); break;+ }+ RET;++ /* Data.Text helpers on a ByteString and an Int */+ case T_UTF8OFFSET:+ case T_UTF8OFFSETEND:+ case T_UTF8DECODE:+ case T_UTF8DECODEEND:+ case T_UTF8SKIPSPACE:+ case T_UTF8SKIPNONSPACE:+ case T_BSASCIICASE:+ CHECK(2);+ xfp = evalbstr(ARG(TOP(0)));+ xi = evalint(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ switch (tag) {+ case T_UTF8OFFSET: SETINT(n, utf8offset(xfp->payload, xi)); break;+ case T_UTF8OFFSETEND: SETINT(n, utf8offsetend(xfp->payload, xi)); break;+ case T_UTF8DECODE: SETINT(n, utf8decode(xfp->payload, xi)); break;+ case T_UTF8DECODEEND: SETINT(n, utf8decodeend(xfp->payload, xi)); break;+ case T_UTF8SKIPSPACE: SETINT(n, utf8skip(xfp->payload, xi, 0)); break;+ case T_UTF8SKIPNONSPACE: SETINT(n, utf8skip(xfp->payload, xi, 1)); break;+ default: SETBSTR(n, mkForPtrFree(bsasciicase(xfp->payload, xi))); break;+ }+ RET;++ case T_UTF8OFFSETFROM:+ case T_UTF8OFFSETENDBEFORE:+ CHECK(3);+ {+ value_t xk;+ xfp = evalbstr(ARG(TOP(0)));+ xi = evalint(ARG(TOP(1)));+ xk = evalint(ARG(TOP(2)));+ POP(3);+ n = TOP(-1);+ if (tag == T_UTF8OFFSETFROM)+ SETINT(n, utf8offsetfrom(xfp->payload, xi, xk));+ else+ SETINT(n, utf8offsetendbefore(xfp->payload, xi, xk));+ }+ RET;++ case T_BSFIND:+ CHECK(3);+ {+ struct forptr *pfp = evalbstr(ARG(TOP(0)));+ struct forptr *sfp = evalbstr(ARG(TOP(1)));+ xi = evalint(ARG(TOP(2)));+ POP(3);+ n = TOP(-1);+ SETINT(n, bsfind(pfp->payload, sfp->payload, xi));+ }+ RET;++ case T_BSCONCAT:+ CHECK(1);+ {+ struct bytestring rb = bsconcat(ARG(TOP(0))); /* evaluates nothing */+ POP(1);+ n = TOP(-1);+ SETBSTR(n, mkForPtrFree(rb));+ }+ RET;++ case T_BSRFIND:+ CHECK(2);+ {+ struct forptr *pfp = evalbstr(ARG(TOP(0)));+ struct forptr *sfp = evalbstr(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ SETINT(n, bsrfind(pfp->payload, sfp->payload));+ }+ RET;++ case T_BSFROMUTF8:+ if (doing_rnf) longjmp(rnf_skip, 1);+ CHECK(1);++ xfp = evalbstr(ARG(TOP(0)));+ GCCHECK(strNodes(xfp->payload.bs_size));+ POP(1);+ n = TOP(-1);+ //printf("T_FROMUTF8 x = %p fp=%p payload.string=%p\n", x, x->uarg.uuforptr, x->uarg.uuforptr->payload.string);+ GOIND(mkStringU(xfp->payload));++ case T_BSUNPACK:+ if (doing_rnf) longjmp(rnf_skip, 1);+ CHECK(1);+ struct forptr *xfp = evalbstr(ARG(TOP(0)));+ GCCHECK(strNodes(xfp->payload.bs_size));+ POP(1);+ n = TOP(-1);+ GOIND(bsunpack(xfp->payload));++ case T_BSREPLICATE:+ CHECK(2);+ xi = evalint(ARG(TOP(0)));+ yi = evalint(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ SETBSTR(n, mkForPtrFree(bsreplicate(xi, yi)));+ RET;++ case T_BSLENGTH:+ CHECK(1);+ xfp = evalbstr(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, xfp->payload.bs_size);+ RET;++ case T_BSSUBSTR:+ CHECK(3);+ xfp = evalbstr(ARG(TOP(0)));+ xi = evalint(ARG(TOP(1)));+ yi = evalint(ARG(TOP(2)));+ POP(3);+ n = TOP(-1);+ SETBSTR(n, bssubstr(xfp, xi, yi));+ RET;++ case T_BSINDEX:+ CHECK(2);+ xfp = evalbstr(ARG(TOP(0)));+ xi = evalint(ARG(TOP(1)));+ POP(2);+ n = TOP(-1);+ SETINT(n, ((uint8_t *)xfp->payload.bs_array)[xi]);+ RET;++ case T_BSNEW:+ {+ CHECK(3);+ struct bytestring bs;+ value_t sz = evalint(STKARG(0));+ value_t cap = evalint(STKARG(1));+ if (sz < 0 || cap < sz)+ ERR("BSNEW");+ bs.bs_size = (size_t)sz;+ bs.bs_capacity = (size_t)cap;+ GCCHECK(2); /* PAIR + StrNode */+ bs.bs_array = mmalloc(bs.bs_capacity);+ memset(bs.bs_array, 0, bs.bs_size);+ POPN(3);+ GOPAIR(mkStrNode(bs));+ }++ case T_BSFREEZE:+ {+ CHECK(2);+ xfp = evalbstr(STKARG(0));+ GCCHECK(1); /* PAIR */+ struct bytestring *bsp = &xfp->payload;+ if (bsp->bs_size != bsp->bs_capacity) {+ bsp->bs_array = mrealloc(bsp->bs_array, bsp->bs_size);+ adjforptr(xfp); /* in case bs_array moved */+ }+ bsp->bs_capacity = 0; /* mark as immutable */+ x = STKARG(0);+ POPN(2);+ GOPAIR(x);+ }++ case T_BSAPPBYTE:+ CHECK(3);+ xfp = evalbstr(STKARG(0));+ xi = evalint(STKARG(1));+ bsappbyte(xfp, xi);+ POPN(3);+ GOPAIRUNIT;+ + case T_BSAPPCHAR:+ {+ CHECK(3);+ xfp = evalbstr(STKARG(0));+ uvalue_t c = (uvalue_t)evalint(STKARG(1));+ if (0xdc80 <= c && c <= 0xdcff) {+ /* Using dc80-dcff to roundtrip bad bytes */+ bsappbyte(xfp, c & 0xff);+ } else {+ if (0xd800 <= c && c <= 0xdfff) {+ /* c is a surrogate */+ c = 0xfffd; /* replacement character */+ }+ if (0 < c && c < 0x80) { /* exclude 0, since this is modified UTF-8 */+ bsappbyte(xfp, c);+ } else if (c < 0x800) {+ /* 0 encodes here, with an over-long representation */+ bsappbyte(xfp, ((c >> 6 ) ) | 0xc0);+ bsappbyte(xfp, ((c ) & 0x3f) | 0x80);+ } else if (c < 0x10000) {+ bsappbyte(xfp, ((c >> 12) ) | 0xe0);+ bsappbyte(xfp, ((c >> 6 ) & 0x3f) | 0x80);+ bsappbyte(xfp, ((c ) & 0x3f) | 0x80);+ } else if (c < 0x110000) {+ bsappbyte(xfp, ((c >> 18) ) | 0xf0);+ bsappbyte(xfp, ((c >> 12) & 0x3f) | 0x80);+ bsappbyte(xfp, ((c >> 6 ) & 0x3f) | 0x80);+ bsappbyte(xfp, ((c ) & 0x3f) | 0x80);+ } else {+ ERR("invalid char");+ }+ }+ POPN(3);+ GOPAIRUNIT;+ }++ case T_BSREAD:+ CHECK(3);+ xfp = evalbstr(STKARG(0));+ xi = evalint(STKARG(1));+ GCCHECK(2); /* PAIR + Int */+ POPN(3);+ yi = ((uint8_t *)xfp->payload.bs_array)[xi];+ GOPAIR(mkInt(yi));++ case T_BSWRITE:+ CHECK(4);+ xfp = evalbstr(STKARG(0));+ xi = evalint(STKARG(1));+ yi = evalint(STKARG(2));+ POPN(4);+ ((uint8_t *)xfp->payload.bs_array)[xi] = (uint8_t)yi;+ GOPAIRUNIT;++ case T_RAISE:+ CHKARG1;+ raise_exn(x); /* never returns */++ case T_SPNEW:+ GCCHECK(2); /* PAIR + Int */+ CHKARG2;+ xi = new_stableptr(x);+ GOPAIR(mkInt(xi));+ case T_SPDEREF:+ CHECK(2);+ xi = evalint(STKARG(0));+ GCCHECK(1); /* PAIR */+ POPN(2);+ GOPAIR(deref_stableptr(xi));+ case T_SPFREE:+ CHECK(2);+ xi = evalint(STKARG(0));+ free_stableptr(xi);+ POPN(2);+ GOPAIRUNIT;++ case T_WKNEW:+ GCCHECK(2); /* PAIR + weak */+ CHKARG3;+ GOPAIR(new_weak_ptr(x, y, NIL_NODEPTR));+ case T_WKNEWFIN:+ GCCHECK(3); /* PAIR + weak + finalizer */+ CHKARG4;+ GOPAIR(new_weak_ptr(x, y, z));+ case T_WKDEREF:+ CHECK(2);+ {+ struct weak_ptr *wp = evalweak(STKARG(0));+ GCCHECK(2); /* Just + PAIR */+ x = deref_weak_ptr(wp);+ POPN(2);+ GOPAIR(x);+ }+ case T_WKFINAL:+ CHECK(2);+ finalize_weak_ptr(evalweak(STKARG(0)));+ POPN(2);+ GOPAIRUNIT;+++ case T_RNF:+ if (doing_rnf) longjmp(rnf_skip, 1);+ CHECK(2);+ xi = evalint(STKARG(0));+ rnf(xi, STKARG(1)); POPN(2); GOIND(combUnit);++ case T_IO_PERFORMIO:+ GCCHECK(2);+ if (doing_rnf) longjmp(rnf_skip, 1);+ CHKARG1;+ /* Conjure up a new world and evaluate the io with that world, finally selecting the result */+ /* PERFORMIO io --> io World K */+#if 1+ GOAP2(x, combWorld, combK);+#else+ {+ /* Don't count performio reductions. */+ /* Useful when Debug.Trace.trace should have zero cost */+ NODEPTR p1 = new_ap(x, combWorld);+ NODEPTR p2 = new_ap(p1, combK);+ counter_t s = glob_slice;+ glob_slice = 1000000000;+ NODEPTR p3 = evali(p2);+ glob_slice = s;+ GOIND(p3);+ }+#endif++ case T_IO_ATOMIC:+ /* Perform an IO action "atomically".+ * It's not really atomic, but 10 uninterrupted slices.+ * This is good enough for atomicModifyIORef. */+ {+ CHECK(2); /* arg0=action, arg1=world */+ GCCHECK(2);+ NODEPTR p1 = new_ap(STKARG(0), STKARG(1));+ NODEPTR p2 = new_ap(p1, combK);+ glob_slice += slice * 10; /* give the current thread 10 extra slices+ * (Note: not undone if evali raises a caught exception) */+ NODEPTR p3 = evali(p2); /* this evaluation is guaranteed at least 10 uninterrupted slices */+ glob_slice -= slice * 10; /* and take them away again */+ GCCHECKSAVE(p3, 2);+ POPN(2);+ GOPAIR(p3);+ }+ break;+ case T_IO_LAZYBINDST:+ /* Lazy bind, used for the lazy ST monad.+ * DO NOT USE FOR IO, because effects are not guaranteed to happen.+ * (x `lazyBind` y) z = let w = x z in y (fst w) (snd w)+ */+ GCCHECK(4);+ CHKARG3;+ w = new_ap(x, z);+ GOAP2(y, new_ap(combPFst, w), new_ap(combPSnd, w));+ case T_IO_LAZYBIND:+ /* Lazy bind, used for unsafeInterleaveIO.+ * (x `lazyBind` y) z = let w = x z in y (fst w) (snd w)+ * since the actual state token doesn't matter we use the more efficient+ * (x `lazyBind` y) z = let w = x z in y (fst w) z+ */+ GCCHECK(4);+ CHKARG3;+ w = new_ap(x, z);+ GOAP2(y, new_ap(combPFst, w), z);+ case T_IO_STRICT:+ /* Force the world argument before executing the IO.+ * IO.strict io World = seq World (io World)+ */+ CHECK(2);+ (void)evali(STKARG(1)); /* evaluate the world */+ x = STKARG(0);+ y = STKARG(1);+ POPN(2);+ GOAP(x, y); /* and run IO computation */+#if WANT_STDIO+ case T_IO_PP:+ CHKARG2;+ pp(stderr, x);+ GOPAIRUNIT;++ case T_NODEADDR:+ /* The NODEPTR of the argument, which is not evaluated, as an Int. */+ CHECK(1);+ x = ARG(TOP(0));+ n = POPTOP();+ SETINT(n, (value_t)x.node_bits);+ RET;++ case T_IO_RTSINFO:+ GCCHECK(2);+ CHKARG1; /* x = ST */+ GOPAIR(mkPtr(&rts_info));+ case T_IO_PRINT:+ hdr = false;+ goto ser;+ case T_IO_SERIALIZE:+ hdr = true;+ ser:+#if 0+ gc(); /* DUBIOUS: do a GC to get possible GC reductions */+#endif+ CHECK(3);+ bfile = (struct BFILE*)evalptr(STKARG(0));+ printb(bfile, evali(STKARG(1)), hdr);+ putb('\n', bfile);+ POPN(3);+ GOPAIRUNIT;+ case T_IO_DESERIALIZE:+ CHECK(2);+ bfile = (struct BFILE*)evalptr(STKARG(0));+ x = parse_top(bfile, 0);+ if (is_NIL(x))+ raise_rts(exn_deserialize);+ GCCHECKSAVE(x, 1); /* PAIR */+ POPN(2);+ GOPAIR(x);+#endif+#if WANT_ARGS+ case T_IO_GETARGREF:+ GCCHECK(2);+ CHKARG1;+ x = alloc_node(D_ARR);+ ARR(x) = argarray;+ GOPAIR(x);+#endif+ case D_IO_CCALL:+ {+ int a = (int)GETVALUE(n); /* function number */+ //printf(" %s\n", FFI_IX(a).ffi_name);+ int arity = FFI_IX(a).ffi_arity;+ CHECK(arity + 1); /* arity C arguments plus the World token */+ if (doing_rnf) longjmp(rnf_skip, 1); /* do not call C from rnf() without errors */+ GCCHECK(1); /* room for placeholder */+ funptr_t f = FFI_IX(a).ffi_fun;+ PUSH(mkPtr(0)); /* placeholder for result, protected from GC */+ int k = f((int)STACK_INDEX(stk)); /* call FFI function, return number of arguments */+ if (k != arity) {+#if WANT_STDIO+ fprintf(stderr, "ccall arity %s %d!=%d\n", FFI_IX(a).ffi_name, arity, k);+#endif+ ERR("ccall arity"); /* temporary sanity check */+ }+ GCCHECK(1); /* room for pair */+ x = POPTOP(); /* pop actual result */+ POP(arity); /* pop the pushed arguments */+ if (stack_ptr >= stack_bot)+ ERR("CCALL POP");+ n = POPTOP(); /* node to update */+ GOPAIR(x); /* and this is the result */+ }++ case T_PACKCSTRING:+ {+ CHECK(2);+ char *cstr = evalptr(STKARG(0));+ GCCHECK(2); /* StrNode + PAIR */+ struct bytestring bs = mk_ro_bytestring(strlen(cstr), NULL);+ memcpy(bs.bs_array, cstr, bs.bs_size);+ NODEPTR res = mkStrNode(bs);+ POPN(2);+ GOPAIR(res);+ }+ case T_PACKCSTRINGLEN:+ {+ CHECK(3);+ char *cstr = evalptr(STKARG(0));+ size_t len = evalint(STKARG(1));+ GCCHECK(2); /* StrNode + PAIR */+ struct bytestring bs = mk_ro_bytestring(len, NULL);+ memcpy(bs.bs_array, cstr, bs.bs_size);+ NODEPTR res = mkStrNode(bs);+ POPN(3);+ GOPAIR(res);+ }+ case T_BSGRAB:+ {+ CHECK(2);+ char *p = evalptr(STKARG(0));+ GCCHECK(2); /* StrNode + PAIR */+ struct bytestring bs = mk_ro_bytestring(strlen(p), p);+ NODEPTR res = mkStrNode(bs);+ POPN(2);+ GOPAIR(res);+ }+ case T_BSGRABLEN:+ {+ CHECK(3);+ char *p = evalptr(STKARG(0));+ size_t len = evalint(STKARG(1));+ GCCHECK(2); /* StrNode + PAIR */+ struct bytestring bs = mk_ro_bytestring(len, p);+ NODEPTR res = mkStrNode(bs);+ POPN(3);+ GOPAIR(res);+ }++ case T_ARR_ALLOC:+ {+ CHECK(3);+ value_t sz = evalint(STKARG(0));+ if (sz < 0)+ ERR("ARR_ALLOC");+ GCCHECK(2); /* before arr_alloc, a GC would free the unreferenced array */+ struct ioarray *arr = arr_alloc((size_t)sz, STKARG(1));+ NODEPTR res = alloc_node(D_ARR);+ ARR(res) = arr;+ POPN(3);+ GOPAIR(res);+ }+ case T_ARR_COPY:+ {+ CHECK(2);+ NODEPTR a = evali(STKARG(0));+ if (get_XTAG(a) != D_ARR)+ ERR("T_ARR_COPY tag");+ GCCHECK(2); /* before arr_copy, a GC would free the unreferenced array */+ struct ioarray *arr = arr_copy(ARR(a));+ NODEPTR res = alloc_node(D_ARR);+ ARR(res) = arr;+ POPN(2);+ GOPAIR(res);+ }+ case T_ARR_SIZE:+ {+ CHECK(2);+ NODEPTR a = evali(STKARG(0));+ if (get_XTAG(a) != D_ARR)+ ERR("bad ARR tag");+ size_t sz = ARR(a)->size;+ GCCHECK(2);+ NODEPTR res = mkInt(sz);+ POPN(2);+ GOPAIR(res);+ }+ case T_ARR_READ:+ {+ CHECK(3);+ size_t i = evalint(STKARG(1));+ NODEPTR a = evali(STKARG(0));+ if (get_XTAG(a) != D_ARR)+ ERR("bad ARR tag");+ if (i >= ARR(a)->size)+ ERR("ARR_READ");+ GCCHECK(1);+ NODEPTR res = ARR(a)->array[i];+ POPN(3);+ GOPAIR(res);+ }+ case T_ARR_WRITE:+ {+ CHECK(4);+ size_t i = evalint(STKARG(1));+ NODEPTR a = evali(STKARG(0));+ if (get_XTAG(a) != D_ARR)+ ERR("bad ARR tag");+ if (i >= ARR(a)->size) {+ ERR("ARR_WRITE");+ }+ ARR(a)->array[i] = STKARG(2);+ POPN(4);+ GOPAIRUNIT;+ }++ case T_ARR_TRUNC:+ {+ CHECK(3);+ size_t i = evalint(STKARG(1));+ NODEPTR a = evali(STKARG(0));+ if (get_XTAG(a) != D_ARR)+ ERR("bad ARR tag");+ if (i > ARR(a)->size) {+ ERR("ARR_TRUNC");+ }+ ARR(a)->size = i;+ POPN(3);+ GOPAIRUNIT;+ }++ case T_FPNEW:+ {+ CHECK(2);+ //printf("T_FPNEW\n");+ void *xp = evalptr(STKARG(0));+ //printf("T_FPNEW xp=%p\n", xp);+ GCCHECK(2);+ NODEPTR res = alloc_node(D_FORPTR);+ SETFORPTR(res, mkForPtrP(xp));+ POPN(2);+ GOPAIR(res);+ }+ case T_FPFIN:+ {+ CHECK(3);+ //printf("T_FPFIN\n");+ struct forptr *xfp = evalforptr(STKARG(1));+ //printf("T_FPFIN xfp=%p\n", xfp);+ HsFunPtr xp = evalfunptr(STKARG(0));+ //printf("T_FPFIN yp=%p\n", yp);+ xfp->finalizer->final = xp;+ POPN(3);+ GOPAIRUNIT;+ }+ case T_IO_GC:+ //printf("gc()\n");+ CHECK(2);+ {+ int red = evalint(STKARG(0));+ int oldred = want_gc_red;+ want_gc_red = red;+ gc();+ want_gc_red = oldred;+ }+ POPN(2);+ GOPAIRUNIT;++ case T_IO_STATS:+ {+ GCCHECK(5);+ CHKARG1;+ NODEPTR res = new_ap(new_ap(combPair, mkInt((uvalue_t)NUM_ALLOC)), mkInt((uvalue_t)(num_reductions - glob_slice)));+ GOPAIR(res);+ }++ case T_IO_FORK:+ {+ GCCHECK(3);+ CHKARG2; /* set x=io, y=ST, n */+ struct mthread *mt = new_thread(new_ap(x, y)); /* copy the world */+ mt->mt_mask = runq.mq_head->mt_mask; /* inherit masking state */+ NODEPTR res = alloc_node(D_THID);+ THR(res) = mt;+ GOPAIR(res);+ }++ case T_IO_THID:+ {+ GCCHECK(2);+ CHKARG1;+ NODEPTR res = alloc_node(D_THID);+ THR(res) = runq.mq_head; /* head of the run queue is the current thread */+ GOPAIR(res);+ }+ case T_IO_THROWTO:+ {+ CHECK(3); /* arg0=thid, arg1=exn, arg2=ST */+ check_thrown(true); /* check if we have a thrown exception */+ struct mthread *mt = evalthid(STKARG(0));+ throwto(mt, STKARG(1));+ POPN(3);+ GOPAIRUNIT;+ }+ case T_IO_YIELD:+ CHECK(1);+ FUN(TOP(0)) = combPUnit; /* update before yield() in case it reschedules */+ yield();+ POPN(1);+ GOTOP(n);++ case T_IO_NEWMVAR:+ {+ GCCHECK(2);+ CHKARG1;+ struct mvar *mv = new_mvar();+ NODEPTR res = alloc_node(D_MVAR);+ MVAR(res) = mv;+ GOPAIR(res);+ }+ case T_IO_TAKEMVAR:+ {+ CHECK(2); /* arg0=mvar, arg1=ST */+ check_thrown(true); /* check if we have a thrown exception */+ NODEPTR res = take_mvar(false, evalmvar(STKARG(0))); /* never returns if it blocks */+ GCCHECKSAVE(res, 1);+ POPN(2);+ GOPAIR(res);+ }+ case T_IO_READMVAR:+ {+ CHECK(2);+ check_thrown(true); /* check if we have a thrown exception */+ NODEPTR res = read_mvar(false, evalmvar(STKARG(0))); /* never returns if it blocks */+ GCCHECKSAVE(res, 1);+ POPN(2);+ GOPAIR(res);+ }+ case T_IO_PUTMVAR:+ {+ CHECK(3); /* arg0=mvar, arg1=value, arg2=ST */+ check_thrown(true); /* check if we have a thrown exception */+ struct mvar *mv = evalmvar(STKARG(0));+ (void)put_mvar(false, mv, STKARG(1)); /* never returns if it blocks */+ POPN(3);+ GOPAIRUNIT;+ }+ case T_IO_TRYTAKEMVAR:+ {+ CHECK(2);+ NODEPTR res = take_mvar(true, evalmvar(STKARG(0)));+ GCCHECKSAVE(res, 2);+ if (!is_NIL(res))+ res = new_ap(combJust, res);+ else+ res = combNothing;+ POPN(2);+ GOPAIR(res);+ }+ case T_IO_TRYREADMVAR:+ {+ CHECK(2);+ NODEPTR res = read_mvar(true, evalmvar(STKARG(0)));+ GCCHECKSAVE(res, 2);+ if (!is_NIL(res))+ res = new_ap(combJust, res);+ else+ res = combNothing;+ POPN(2);+ GOPAIR(res);+ }+ case T_IO_TRYPUTMVAR:+ {+ CHECK(3);+ struct mvar *mv = evalmvar(STKARG(0));+ NODEPTR res = put_mvar(true, mv, STKARG(1)) ? combTrue : combFalse;+ GCCHECK(1);+ POPN(3);+ GOPAIR(res);+ }+ case T_IO_THREADDELAY:+ {+ CHECK(2);+#if defined(CLOCK_INIT)+ check_thrown(true); /* check if we have a thrown exception */+ if (runq.mq_head->mt_at == -1) {+ /* delay has already expired, so just return */+ runq.mq_head->mt_at = 0;+ POPN(2);+ GOPAIRUNIT;+ } else {+ value_t dly = evalint(STKARG(0));+ if (dly <= 0) {+ POPN(2);+ GOPAIRUNIT;+ }+ thread_delay((uvalue_t)dly); /* never returns */+ }+#else+ ERR("threadDelay: no clock");+#endif+ }+ case T_IO_THREADSTATUS:+ {+ CHECK(2);+ struct mthread *mt = evalthid(STKARG(0));+ GCCHECK(2);+ POPN(2);+ GOPAIR(mkInt(mt->mt_state));+ }+ case T_IO_WAITRDFD:+ case T_IO_WAITWRFD: {+#if WANT_IO_POLL+ CHECK(2); /* arg0 = filedescriptor, arg1 = RealWorld; no pop yet */+ GCCHECK(2);++ /*+ * When the thread wakes up again it will re-execute that last op.+ * check_pollq() sets mt_fd=IO_POLL_EVENT_HAS_HAPPENED when waking the thread.+ * If we did not do this check we would just sleep again.+ */+ if (runq.mq_head->mt_fd == IO_POLL_EVENT_HAS_HAPPENED) {+ runq.mq_head->mt_fd = IO_POLL_WAITING_FOR_NONE;+ POPN(2);+ GOPAIR(mkInt(0));+ }++ check_thrown(true); /* check if we have a thrown exception */++ int fd = evalint(STKARG(0));+ int events = tag == T_IO_WAITRDFD ? POLLIN : POLLOUT;++ /* Set up the waiting thread's state, preparing it to leave the run queue+ * until an event is ready for it.+ */+ struct mthread *mt = remove_q_head(&runq);+ mt->mt_fd = fd;+ mt->mt_events = events;+ add_q_tail(&pollq, mt); /* put it on the q of I/O waiters */+#if THREAD_DEBUG+ if (thread_trace) {+ printf("T_IO_WAITxxFD: wait for FD=%d, events=%x, thread=%d\n", fd, events, (int)mt->mt_id);+ }+#endif /* THREAD_DEBUG */++ POP(2);+ resched(mt, ts_wait_io); /* set the thread state and reschedule */+#else /* WANT_IO_POLL */+ CHECK(2);+#if WANT_ERRNO+ errno = EINVAL;+#endif+ GCCHECK(2);+ POPN(2);+ GOPAIR(mkInt(-1)); /* cannot poll */+#endif /* WANT_IO_POLL */+ }+ case T_IO_GETMASKINGSTATE:+ GCCHECK(2);+ CHKARG1; /* x = ST */+ GOPAIR(mkInt(runq.mq_head->mt_mask));++ case T_IO_SETMASKINGSTATE:+ CHECK(2); /* arg0 = level, arg1 = ST */+ runq.mq_head->mt_mask = evalint(STKARG(0));+ POPN(2);+ GOPAIRUNIT;++ case T_CATCH:+ /* CATCH x y z --> CATCHR m (x z) y z+ * where m is the current masking state, which the handler restores.+ * It is kept in the graph rather than taken when CATCHR runs, because+ * a rescheduled thread starts over from its root and runs CATCHR again,+ * maybe with another masking state, e.g., inside a mask in the io. */+ GCCHECK(5);+ CHKARG3; /* x=io, y=hdl, z=ST */+ GOAP(new_ap(new_ap(new_ap(combCATCHR, mkInt(runq.mq_head->mt_mask)), new_ap(x, z)), y), z);+ case T_CATCHR:+ {+ CHECK(4); /* arg0 = mask, arg1 = (io st), arg2 = hdl, arg3 = st */+ struct handler *h = mmalloc(sizeof *h);+ h->hdl_old = cur_handler;+ cur_handler = h;+ NODEPTR *ostack = stack_ptr; /* old stack pointer */+ if (setjmp(h->hdl_buf)) {+ /* An exception occurred: */+ stack_ptr = ostack;+ runq.mq_head->mt_mask = mask_interruptible; /* evaluate with mask */+ NODEPTR exn = h->hdl_exn; /* exception value */+ cur_handler = h->hdl_old; /* reset handler */+ FREE(h);+ GCCHECKSAVE(exn, 7);+ x = STKARG(0);+ z = STKARG(2);+ w = STKARG(3);+ POPN(4);+ /*+ * Run:+ * hdl exn `primBind` \ r ->+ * primSetMaskingState m `primThen`+ * primReturn r+ * i.e.,+ * primBind (hdl exn) (B' primThen (primSetMaskingState m) primReturn)+ */+ NODEPTR p = new_ap(combIOBIND, new_ap(z, exn));+ NODEPTR q = new_ap(new_ap(new_ap(combBB, combIOTHEN), new_ap(combSETMASKINGSTATE, x)), combIORETURN);+ GOAP2(p, q, w);+ } else {+ /* Normal execution: */+ y = evali(STKARG(1)); /* execute the io */+ /* No exception occurred */+ cur_handler = h->hdl_old; /* restore old handler */+ FREE(h);+ POPN(4);+ GOIND(y);+ }+ }++ case T_THNUM:+ {+ CHECK(1);+ struct mthread *mt = evalthid(ARG(TOP(0)));+ POP(1);+ n = TOP(-1);+ SETINT(n, (uvalue_t)mt->mt_id);+ RET;+ }++#if WANT_TICK+ case D_TICK:+ xi = GETVALUE(n);+ CHKARG1;+ // fprintf(stderr, "tick=%s\n", (char*)tick_table[xi].tick_name.string); fflush(stderr);+ dotick(xi);+ GOIND(x);+#endif++ default:+ ERR1("eval tag %s", TAGNAME(get_XTAG(n)));+ }+ RET;+}++/* n has been evaluated, and the marker tag is on top of the stack. */+static NOINLINE struct prim_res+evalprimret(NODEPTR n, enum node_tag tag)+{+ uvalue_t yu, ru;+#if WANT_INT64+ uint64_t x64u, y64u, r64u;+#endif /* WANT_INT64 */+#if WANT_FLOAT32+ flt32_t xf, yf, rf;+#endif /* WANT_FLOAT32 */+#if WANT_FLOAT64+ flt64_t xd, yd, rd;+#endif /* WANT_FLOAT64 */+ struct bytestring xbs, ybs, rbs;+ value_t r;+ NODEPTR p, y;++ switch (tag) {++#if WANT_INT64+ case T_BININT64_2:+ n = ARG(TOP(1));+ TOP(0) = combBININT64_1;+ GOTOP(n);++ case T_BININT64_1:+ /* First argument */+#if SANITY+ if (get_XTAG(n) != D_INT64) {+ //fprintf(stderr, "tag=%s\n", TAGNAME(get_XTAG(n))); fflush(stderr);+ ERR("BININT64 0");+ }+#endif /* SANITY */+ x64u = (uint64_t)GETINT64VALUE(n);+ /* Second argument */+ y = ARG(TOP(2));+ while (get_XTAG(y) == D_IND)+ y = get_IND(y);+ /* The second argument to the shift ops is an int, so use a hack for that */+ if (get_XTAG(y) == D_INT64)+ y64u = (uint64_t)GETINT64VALUE(y);+ else if (get_XTAG(y) == D_INT)+ yu = (uvalue_t)GETVALUE(y);+ else+ ERR("BININT64 1");+ p = FUN(TOP(1));+ POP(3);+ n = TOP(-1);+ binint64:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto binint64;+ case T_ADD64: ADD_OVERFLOW(int64_t, r64u, x64u, y64u, raise_rts); break;+ case T_SUB64: SUB_OVERFLOW(int64_t, r64u, x64u, y64u, raise_rts); break;+ case T_MUL64: MUL_OVERFLOW(int64_t, r64u, x64u, y64u, raise_rts); break;+ case T_SUBR64:SUB_OVERFLOW(int64_t, r64u, y64u, x64u, raise_rts); break;+ case T_QUOT64:if (y64u == 0)+ raise_rts(exn_dividebyzero);+ else if ((int64_t)x64u == INT64_MIN && (int64_t)y64u == -1)+ raise_rts(exn_overflow);+ else+ r64u = (uint64_t)((int64_t)x64u / (int64_t)y64u);+ break;+ case T_REM64: if (y64u == 0)+ raise_rts(exn_dividebyzero);+ else if ((int64_t)y64u == -1) /* MIN % -1 traps on x86 */+ r64u = 0;+ else+ r64u = (uint64_t)((int64_t)x64u % (int64_t)y64u);+ break;+ case T_UADD64:r64u = x64u + y64u; break;+ case T_USUB64:r64u = x64u - y64u; break;+ case T_UMUL64:r64u = x64u * y64u; break;+ case T_USUBR64:r64u = y64u - x64u; break;+ case T_UQUOT64:if (y64u == 0)+ raise_rts(exn_dividebyzero);+ else+ r64u = x64u / y64u;+ break;+ case T_UREM64:if (y64u == 0)+ raise_rts(exn_dividebyzero);+ else+ r64u = x64u % y64u;+ break;+ case T_AND64: r64u = x64u & y64u; break;+ case T_OR64: r64u = x64u | y64u; break;+ case T_XOR64: r64u = x64u ^ y64u; break;+ case T_SHL64: r64u = x64u << yu; break;+ case T_SHR64: r64u = x64u >> yu; break;+ case T_ASHR64:r64u = (uint64_t)((int64_t)x64u >> yu); break;++ case T_EQ64: GOBOOL(x64u == y64u);+ case T_NE64: GOBOOL(x64u != y64u);+ case T_ULT64: GOBOOL(x64u < y64u);+ case T_ULE64: GOBOOL(x64u <= y64u);+ case T_UGT64: GOBOOL(x64u > y64u);+ case T_UGE64: GOBOOL(x64u >= y64u);+ case T_UCMP64:GOIND(x64u < y64u ? combLT : x64u > y64u ? combGT : combEQ);+ case T_LT64: GOBOOL((int64_t)x64u < (int64_t)y64u);+ case T_LE64: GOBOOL((int64_t)x64u <= (int64_t)y64u);+ case T_GT64: GOBOOL((int64_t)x64u > (int64_t)y64u);+ case T_GE64: GOBOOL((int64_t)x64u >= (int64_t)y64u);+ case T_ICMP64:GOIND((int64_t)x64u < (int64_t)y64u ? combLT : (int64_t)x64u > (int64_t)y64u ? combGT : combEQ);++ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("BININT64");+ }+ SETINT64(n, (int64_t)r64u);+ RET;++ case T_UNINT64_1:+ /* The argument */+#if SANITY+ if (get_XTAG(n) != D_INT64)+ ERR("UNINT64 0");+#endif+ x64u = (uint64_t)GETINT64VALUE(n);+ p = FUN(TOP(1));+ POP(2);+ n = TOP(-1);+ unint64:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto unint64;+ case T_NEG64:+#if WANT_OVERFLOW+ if ((int64_t)x64u == INT64_MIN) raise_rts(exn_overflow);+#endif+ r64u = -x64u; break;+ case T_UNEG64: r64u = -x64u; break;+ case T_INV64: r64u = ~x64u; break;+ case T_POPCOUNT64: ru = POPCOUNT64(x64u); SETINT(n, (value_t)ru); RET;+ case T_CLZ64: ru = CLZ64(x64u); SETINT(n, (value_t)ru); RET;+ case T_CTZ64: ru = CTZ64(x64u); SETINT(n, (value_t)ru); RET;+ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("UNINT64");+ }+ SETINT64(n, (int64_t)r64u);+ RET;+#endif /* WANT_INT64 */++#if WANT_FLOAT32+ case T_BINFLT2:+ n = ARG(TOP(1));+ TOP(0) = combBINFLT1;+ GOTOP(n);++ case T_BINFLT1:+ /* First argument */+#if SANITY+ if (get_XTAG(n) != D_FLT32)+ ERR("BINFLT 0");+#endif /* SANITY */+ xf = GETFLTVALUE(n);+ /* Second argument */+ y = ARG(TOP(2));+ while (get_XTAG(y) == D_IND)+ y = get_IND(y);+#if SANITY+ if (get_XTAG(y) != D_FLT32)+ ERR("BINFLT 1");+#endif /* SANITY */+ yf = GETFLTVALUE(y);+ p = FUN(TOP(1));+ POP(3);+ n = TOP(-1);+ binflt:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto binflt;+ case T_FADD: rf = xf + yf; break;+ case T_FSUB: rf = xf - yf; break;+ case T_FMUL: rf = xf * yf; break;+ case T_FDIV: rf = xf / yf; break;++ case T_FEQ: GOBOOL(xf == yf);+ case T_FNE: GOBOOL(xf != yf);+ case T_FLT: GOBOOL(xf < yf);+ case T_FLE: GOBOOL(xf <= yf);+ case T_FGT: GOBOOL(xf > yf);+ case T_FGE: GOBOOL(xf >= yf);++ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("BINFLT");+ }+ SETFLT(n, rf);+ RET;++ case T_UNFLT1:+ /* The argument */+#if SANITY+ if (get_XTAG(n) != D_FLT32)+ ERR("UNFLT 0");+#endif+ xf = GETFLTVALUE(n);+ p = FUN(TOP(1));+ POP(2);+ n = TOP(-1);+ unflt:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto unflt;+ case T_FNEG: rf = -xf; break;+ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("UNFLT");+ }+ SETFLT(n, rf);+ RET;+#endif /* WANT_FLOAT32 */++#if WANT_FLOAT64+ case T_BINDBL2:+ n = ARG(TOP(1));+ TOP(0) = combBINDBL1;+ GOTOP(n);++ case T_BINDBL1:+ /* First argument */+#if SANITY+ if (get_XTAG(n) != D_DBL)+ ERR("BINDBL 0");+#endif /* SANITY */+ xd = GETDBLVALUE(n);+ /* Second argument */+ y = ARG(TOP(2));+ while (get_XTAG(y) == D_IND)+ y = get_IND(y);+#if SANITY+ if (get_XTAG(y) != D_DBL)+ ERR("BINDBL 1");+#endif /* SANITY */+ yd = GETDBLVALUE(y);+ p = FUN(TOP(1));+ POP(3);+ n = TOP(-1);+ bindbl:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto bindbl;+ case T_DADD: rd = xd + yd; break;+ case T_DSUB: rd = xd - yd; break;+ case T_DMUL: rd = xd * yd; break;+ case T_DDIV: rd = xd / yd; break;++ case T_DEQ: GOBOOL(xd == yd);+ case T_DNE: GOBOOL(xd != yd);+ case T_DLT: GOBOOL(xd < yd);+ case T_DLE: GOBOOL(xd <= yd);+ case T_DGT: GOBOOL(xd > yd);+ case T_DGE: GOBOOL(xd >= yd);++ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("BINDBL");+ }+ SETDBL(n, rd);+ RET;++ case T_UNDBL1:+ /* The argument */+#if SANITY+ if (get_XTAG(n) != D_DBL)+ ERR("UNDBL 0");+#endif+ xd = GETDBLVALUE(n);+ p = FUN(TOP(1));+ POP(2);+ n = TOP(-1);+ undbl:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto undbl;+ case T_DNEG: rd = -xd; break;+ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("UNDBL");+ }+ SETDBL(n, rd);+ RET;+#endif /* WANT_FLOAT64 */++ case T_BINBS2:+ n = ARG(TOP(1));+ TOP(0) = combBINBS1;+ GOTOP(n);++ case T_BINBS1:+ /* First argument */+#if SANITY+ if (get_XTAG(n) != D_FORPTR || FORPTR(n)->finalizer->fptype != FP_BSTR)+ ERR("BINBS 0");+#endif /* SANITY */+ xbs = BSTR(n);+ /* Second argument */+ y = ARG(TOP(2));+ while (get_XTAG(y) == D_IND)+ y = get_IND(y);+#if SANITY+ if (get_XTAG(y) != D_FORPTR || FORPTR(y)->finalizer->fptype != FP_BSTR)+ ERR("BINBS 1");+#endif /* SANITY */+ ybs = BSTR(y);+ p = FUN(TOP(1));+ POP(3);+ n = TOP(-1);+ binbs:+ switch (get_XTAG(p)) {+ case D_IND: p = get_IND(p); goto binbs;++ case T_BSAPPEND: rbs = bsappend(xbs, ybs); break;+ case T_BSAPPENDDOT: rbs = bsappenddot(xbs, ybs); break;+ case T_BSEQ: GOBOOL(bsequal(xbs, ybs));+ case T_BSNE: GOBOOL(!bsequal(xbs, ybs));+ case T_BSLT: GOBOOL(bscompare(xbs, ybs) < 0);+ case T_BSLE: GOBOOL(bscompare(xbs, ybs) <= 0);+ case T_BSGT: GOBOOL(bscompare(xbs, ybs) > 0);+ case T_BSGE: GOBOOL(bscompare(xbs, ybs) >= 0);+ case T_BSCMP: r = bscompare(xbs, ybs); GOIND(r < 0 ? combLT : r > 0 ? combGT : combEQ);++ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("BINBS");+ }+ SETBSTR(n, mkForPtrFree(rbs));+ RET;++ default:+ ERR1("evalprimret %s", TAGNAME(tag));+ }+}++#undef RET+#undef GOTOP+#undef GOIND+#undef GOAP+#undef GOAP2+#undef GOPAIR+#undef GOPAIRUNIT++/*+ * evali keeps the hot globals in locals of the same name, so the C compiler+ * can keep them in registers: stack_ptr, glob_slice, bump_ptr, and bump_end,+ * and stack_limit (read-only). Inside evali the names refer to the locals,+ * so PUSH, TOP, CHKARGn, etc. use them; the functions below reach the globals.+ * EV_SAVE writes the locals back, and EV_LOAD reads them again.+ * The globals must be current whenever other code runs, so evali does EV_SAVE+ * before every call that can look at them, allocate, GC, or longjmp (an+ * exception or a thread switch), and EV_LOAD after the calls that return.+ * With BUMP_ALLOC, a single check on (bump_end - bump_ptr) guards both GC and+ * bump refill: whenever k cells remain in the current run they are already+ * claimed and free, so num_free is not needed in evali at all.+ */+static INLINE NODEPTR *ev_get_stack_ptr(void) { return stack_ptr; }+static INLINE void ev_set_stack_ptr(NODEPTR *s) { stack_ptr = s; }+#if STACKOVL+static INLINE NODEPTR *ev_get_stack_limit(void) { return stack_limit; }+#endif /* STACKOVL */+static INLINE int ev_get_glob_slice(void) { return glob_slice; }+static INLINE void ev_set_glob_slice(int s) { glob_slice = s; }++static ALWAYS_INLINE NODEPTR+mk_ap_node(struct node *p, NODEPTR f, NODEPTR a)+{+ NODEPTR n;+ n.node_ptr = p;+ FUN(n) = f;+ ARG(n) = a;+ return n;+}++#if BUMP_ALLOC+static INLINE struct node *ev_get_bump_ptr(void) { return bump_ptr; }+static INLINE struct node *ev_get_bump_end(void) { return bump_end; }+static INLINE void ev_set_bump(struct node *p, struct node *e) { bump_ptr = p; bump_end = e; }+#define EV_SAVE_BUMP() ev_set_bump(bump_ptr, bump_end)+#define EV_LOAD_BUMP() do { bump_ptr = ev_get_bump_ptr(); bump_end = ev_get_bump_end(); } while(0)++struct node2 { struct node *p0, *p1; };+struct node3 { struct node *p0, *p1, *p2; };++/* Cold slow-path allocators for evali: called only when bump_end - bump_ptr < k.+ * They save stack_ptr and bump state, GC if needed, and allocate k cells+ * (handling fragmented runs cleanly without wasting the tail of the current run).+ * Neither modifies stack_ptr or glob_slice on return, so evali only reloads bump_ptr/bump_end. */+static NOINLINE struct node *+ev_alloc1(NODEPTR *sp)+{+ if (UNLIKELY(num_free <= 1)) {+ stack_ptr = sp;+ bump_ptr = bump_end = 0;+ gc_for(1);+ }+ bump_refill_body();+ return bump_ptr++;+}++static NOINLINE struct node2+ev_alloc2(NODEPTR *sp, struct node *bp, struct node *be)+{+ struct node2 r;+ if (UNLIKELY(2 >= num_free + (counter_t)(be - bp))) {+ stack_ptr = sp;+ bump_ptr = bp;+ bump_end = be;+ gc_for(2);+ bp = be = 0;+ }+ if (bp < be) {+ r.p0 = bp++;+ } else {+ bump_refill_body();+ bp = bump_ptr;+ be = bump_end;+ r.p0 = bp++;+ }+ if (bp < be) {+ r.p1 = bp++;+ } else {+ bump_refill_body();+ bp = bump_ptr;+ be = bump_end;+ r.p1 = bp++;+ }+ bump_ptr = bp;+ bump_end = be;+ return r;+}++static NOINLINE struct node3+ev_alloc3(NODEPTR *sp, struct node *bp, struct node *be)+{+ struct node3 r;+ if (UNLIKELY(3 >= num_free + (counter_t)(be - bp))) {+ stack_ptr = sp;+ bump_ptr = bp;+ bump_end = be;+ gc_for(3);+ bp = be = 0;+ }+ bump_ptr = bp;+ bump_end = be;+ r.p0 = alloc_node_ptr();+ r.p1 = alloc_node_ptr();+ r.p2 = alloc_node_ptr();+ return r;+}++static NOINLINE NODEPTR+ev_constr_alloc(NODEPTR *sp, struct node *bp, struct node *be, int fidx, int nn)+{+ if (UNLIKELY((size_t)(nn - 1) >= num_free + (counter_t)(be - bp))) {+ stack_ptr = sp;+ bump_ptr = bp;+ bump_end = be;+ gc_for(nn - 1);+ bp = be = 0;+ }+ bump_ptr = bp;+ bump_end = be;+ NODEPTR fk = ARG(sp[fidx]);+ for (int i = 0; i < nn - 1; i++)+ fk = mk_ap_node(alloc_node_ptr(), fk, ARG(sp[i]));+ return fk;+}+#else /* BUMP_ALLOC */+#define EV_SAVE_BUMP() do { } while(0)+#define EV_LOAD_BUMP() do { } while(0)+#endif /* BUMP_ALLOC */+#define EV_SAVE() do { ev_set_stack_ptr(stack_ptr); ev_set_glob_slice(glob_slice); EV_SAVE_BUMP(); } while(0)+#define EV_LOAD() do { stack_ptr = ev_get_stack_ptr(); glob_slice = ev_get_glob_slice(); EV_LOAD_BUMP(); } while(0)++#undef GCCHECK+#define GCCHECK(k) do { if (!((k) < num_free)) { EV_SAVE(); gc_for((k)); EV_LOAD(); } } while(0)+#define EV_RAISE(e) do { EV_SAVE(); raise_rts(e); } while(0)++#if defined(__EMSCRIPTEN__)+/* With -sWASM=0 (JavaScript only) binaryen inlines evalprimop and evalprimret,+ * which have a single caller each, into evali in spite of NOINLINE. V8 does not+ * optimize the result ("Function is too big to be optimized"), so all of evali+ * runs slowly. A call through a volatile pointer cannot be inlined. */+static struct prim_res (* volatile evalprimop_p)(NODEPTR, enum node_tag, NODEPTR *) = evalprimop;+static struct prim_res (* volatile evalprimret_p)(NODEPTR, enum node_tag) = evalprimret;+#define EVALPRIMOP evalprimop_p+#define EVALPRIMRET evalprimret_p+#else+#define EVALPRIMOP evalprimop+#define EVALPRIMRET evalprimret+#endif++/* Evaluate a node, returns when the node is in WHNF. */+NODEPTR+evali(NODEPTR an)+{+ /* The cached globals, see above. */+ NODEPTR *stack_ptr = ev_get_stack_ptr();+ int glob_slice = ev_get_glob_slice();+#if STACKOVL+ NODEPTR * const stack_limit = ev_get_stack_limit();+#endif /* STACKOVL */+#if BUMP_ALLOC+ struct node *bump_ptr = ev_get_bump_ptr();+ struct node *bump_end = ev_get_bump_end();+#endif /* BUMP_ALLOC */+ NODEPTR n = an;+ NODEPTR *stk = stack_ptr;+ NODEPTR x, y, z, w;+ enum node_tag tag;++ //fprintf(stderr, "evali enter stk=%d\n", (int)stk);++#if MAXSTACKDEPTH+ counter_t old_cur_c_stack = cur_c_stack;+ if (++cur_c_stack > max_c_stack)+ max_c_stack = cur_c_stack;+#endif++/* Control macros for evali.+ * GOAP and GOAP2_P run right after popping k >= 1 (or k >= 2) spine entries+ * with n = TOP(-1), so n is already in place on the stack and net stack growth+ * is <= 0 (no STACKOVL check, no rewriting n, no reloading FUN(n)/FUN(m)).+ */+#define RET do { goto ret; } while(0)+#define GOIND(x) do { NODEPTR _x = (x); SETIND(n, _x); n = _x; goto top; } while(0)+#define GOAP(f,a) do { \+ NODEPTR _f = (f), _a = (a); \+ FUN(n) = _f; ARG(n) = _a; \+ --stack_ptr; \+ XASSERT(STACK_ABOVE(stk) >= 1 && eq_NODEPTR(TOP(0), n)); \+ n = _f; \+ goto top; \+ } while(0)+#define GOAP2_P(p,f,a,b) do { \+ NODEPTR _f = (f), _a = (a), _b = (b); \+ NODEPTR _m = mk_ap_node((p), _f, _a); \+ FUN(n) = _m; ARG(n) = _b; \+ stack_ptr -= 2; \+ XASSERT(STACK_ABOVE(stk) >= 2 && eq_NODEPTR(TOP(1), n)); \+ TOP(0) = _m; \+ n = _f; \+ goto top; \+ } while(0)+#if BUMP_ALLOC+#define ALLOC1(p0) do { \+ if (UNLIKELY(bump_ptr == bump_end)) { (p0) = ev_alloc1(stack_ptr); EV_LOAD_BUMP(); } \+ else { (p0) = bump_ptr++; } \+ } while(0)+#define ALLOC2(p0, p1) do { \+ if (UNLIKELY(bump_end - bump_ptr < 2)) { struct node2 _r = ev_alloc2(stack_ptr, bump_ptr, bump_end); EV_LOAD_BUMP(); (p0) = _r.p0; (p1) = _r.p1; } \+ else { (p0) = bump_ptr; (p1) = bump_ptr + 1; bump_ptr += 2; } \+ } while(0)+#define ALLOC3(p0, p1, p2) do { \+ if (UNLIKELY(bump_end - bump_ptr < 3)) { struct node3 _r = ev_alloc3(stack_ptr, bump_ptr, bump_end); EV_LOAD_BUMP(); (p0) = _r.p0; (p1) = _r.p1; (p2) = _r.p2; } \+ else { (p0) = bump_ptr; (p1) = bump_ptr + 1; (p2) = bump_ptr + 2; bump_ptr += 3; } \+ } while(0)+#else+#define ALLOC1(p0) do { GCCHECK(1); (p0) = alloc_node_ptr(); } while(0)+#define ALLOC2(p0, p1) do { GCCHECK(2); (p0) = alloc_node_ptr(); (p1) = alloc_node_ptr(); } while(0)+#define ALLOC3(p0, p1, p2) do { GCCHECK(3); (p0) = alloc_node_ptr(); (p1) = alloc_node_ptr(); (p2) = alloc_node_ptr(); } while(0)+#endif++ top:+ /*pp(stdout, an);*/+ if (--glob_slice <= 0) {+ EV_SAVE();+ yield();+ EV_LOAD();+ }+ for(;;) {+ if (is_VIRT(n)) {+ /* A virtual pointer, i.e., a combinator, primop, constructor, etc. */+ tag = get_VIRT_TAG(n);+ break;+ }+ NODEPTR f = FUN(n);+ if (is_AP(f)) {+ /* follow AP nodes down the spine */+ PUSH(n);+ n = f;+ continue;+ }+ tag = get_DATA_TAG(f);+ if (tag == D_IND) {+ /* Follow and short-circuit the chain of indirections. */+ NODEPTR on = n;+ do {+ n = ARG(n);+ } while (is_DATA_NODE(n, D_IND));+ ARG(on) = n; /* short-circuit; on is still an IND */+ continue; /* n can be an AP node */+ }+ break;+ }+ /* Invariant: at this point n=current node, tag=get_XTAG(n), and tag is not X_AP or D_IND */++ //printf("%s %d\n", tag_names[tag], (int)stack_ptr);+ //if (stack_ptr < -1)+ // ERR("stack_ptr");+ switch (tag) {+ case X_AP: PUSH(n);+ n = FUN(n); goto top;++ case D_INT: RET;+ case D_DBL: RET;+ case D_INT64: RET;+ case D_FLT32: RET;+ case D_PTR: RET;+ case D_FUNPTR: RET;+ case D_FORPTR: RET;+ case D_ARR: RET;+ case D_THID: RET;+ case D_MVAR: RET;+ case D_WEAK: RET;+ case D_BADDYN: ERR1("FFI unknown %s", CSTR(n));++ /*+ * Some of these reductions, (e.g., Z x y = K (x y)) are there to avoid+ * that increase in arity that some "optimizations" in Abstract.hs+ * stop reductions from happening. This can be important for "full laziness".+ * In practice, these reductions almost never happen, but there they are anyway. :)+ */+ case T_S: { struct node *p0, *p1; CHECK(3); ALLOC2(p0, p1); POPARG3; GOAP2_P(p0, x, z, mk_ap_node(p1, y, z)); } /* S x y z = x z (y z) */+ case T_SS: { struct node *p0, *p1, *p2; CHECK(4); ALLOC3(p0, p1, p2); POPARG4; GOAP2_P(p0, x, mk_ap_node(p1, y, w), mk_ap_node(p2, z, w)); } /* S' x y z w = x (y w) (z w) */+ case T_K: CHKARG2; GOIND(x); /* K x y = *x */+ case T_A: CHKARG2; GOIND(y); /* A x y = *y */+ case T_U: CHKARG2; GOAP(y, x); /* U x y = y x */+ case T_I: CHKARG1; GOIND(x); /* I x = *x */+ case T_Y: CHKARG1; GOAP(x, n); /* n@(Y x) = x n */+ case T_B: { struct node *p0; CHECK(3); ALLOC1(p0); POPARG3; GOAP(x, mk_ap_node(p0, y, z)); } /* B x y z = x (y z) */+ case T_BB: if (!HASNARGS(4)) {+ struct node *p0; CHECK(2); ALLOC1(p0); POPARG2; COUNT(red_bb); GOAP(combB, mk_ap_node(p0, x, y)); /* B' x y = B (x y) */+ } else {+ struct node *p0, *p1; ALLOC2(p0, p1); POPARG4; GOAP2_P(p0, x, y, mk_ap_node(p1, z, w)); /* B' x y z w = x y (z w) */+ }+ case T_Z: if (!HASNARGS(3)) {+ struct node *p0; CHECK(2); ALLOC1(p0); POPARG2; COUNT(red_z); GOAP(combK, mk_ap_node(p0, x, y)); /* Z x y = K (x y) */+ } else {+ CHKARG3; GOAP(x, y); /* Z x y z = x y */+ }+ t_c:+ case T_C: { struct node *p0; CHECK(3); ALLOC1(p0); POPARG3; GOAP2_P(p0, x, z, y); } /* C x y z = x z y */+ case T_CC: { struct node *p0, *p1; CHECK(4); ALLOC2(p0, p1); POPARG4; GOAP2_P(p0, x, mk_ap_node(p1, y, w), z); } /* C' x y z w = x (y w) z */+ t_p:+ case T_P: { struct node *p0; CHECK(3); ALLOC1(p0); POPARG3; GOAP2_P(p0, z, x, y); } /* P x y z = z x y */+ case T_R: if(!HASNARGS(3)) {+ struct node *p0; CHECK(2); ALLOC1(p0); POPARG2; COUNT(red_r); GOAP2_P(p0, combC, y, x); /* R x y = C y x */+ } else {+ struct node *p0; ALLOC1(p0); POPARG3; GOAP2_P(p0, y, z, x); /* R x y z = y z x */+ }+ case T_O: { struct node *p0; CHECK(4); ALLOC1(p0); POPARG4; GOAP2_P(p0, w, x, y); } /* O x y z w = w x y */+ case T_K2: if (!HASNARGS(3)) {+ CHKARG2; COUNT(red_k2); GOAP(combK, x); } else { /* K2 x y = K x */+ CHKARG3; GOIND(x); } /* K2 x y z = *x */+ case T_K3: if (!HASNARGS(4)) {+ CHKARG2; COUNT(red_k3); GOAP(combK2, x); } else { /* K3 x y = K2 x */+ CHKARG4; GOIND(x); } /* K3 x y z w = *x */+ case T_K4: if (!HASNARGS(5)) {+ CHKARG2; COUNT(red_k4); GOAP(combK3, x); } else { /* K4 x y = K3 x */+ CHKARG5; GOIND(x); } /* K4 x y z w v = *x */+ case T_CCB: if (!HASNARGS(4)) {+ struct node *p0, *p1; CHECK(3); ALLOC2(p0, p1); POPARG3; COUNT(red_ccb); GOAP2_P(p0, combB, mk_ap_node(p1, x, z), y); /* C'B x y z = B (x z) y */+ } else {+ struct node *p0, *p1; ALLOC2(p0, p1); POPARG4; GOAP2_P(p0, x, z, mk_ap_node(p1, y, w)); /* C'B x y z w = x z (y w) */+ }++ /*+ * Strict primitives require evaluating the arguments before we can proceed.+ * The easiest way to do this is to just recursively call evali() for each argument.+ * The drawback of this is that it uses a lot of C stack. (E.g., recompiling MicroHs+ * uses a stack depth of 1800).+ * Instead we use the following scheme:+ * When we find a strict binary (int) primitive we push T_BININT2,+ * set n=second argument.+ * Continue evaluation of n.+ * When n is finally evaluated and we are about to return we check if the stack top is T_BININT2.+ * If so, change the stack top to T_BININT1,+ * set n=first argument.+ * Continue evaluation of n.+ * When n is finally evaluated and we are about to return we check if the stack top is T_BININT1.+ * If so, we know that both arguments are now evaluated, and we perform the strict operation.+ * If we switch threads at any time during this the BININT1/2 on top of the stack will be lost,+ * but this doesn't matter; the operation is there and we will find it and redo BININT2 again.+ *+ * On my desktop machine this is about 3% slower, on my laptop (Apple M1) it is about 3% faster.+ *+ * Pictorially for BININT+ * Before the code below:+ * ----+ * | --------> @+ * ---- / \+ * | ------> @ y+ * ---- / \+ * n ----> ADD x+ *+ * After+ * ----+ * | --------> @+ * ---- / \+ * | ------> @ y+ * ---- / \+ * | ->BI2 ADD x+ * ---- ^+ * n ----------|+ *+ * x becomes an INT, stack is not empty, BININT2 found on top+ * ----+ * | --------> @+ * ---- / \+ * | ------> @ y+ * ---- / \+ * | ->BI2 ADD INT+ * ---- ^+ * n ----------|+ *+ * After+ * ----+ * | --------> @+ * ---- / \+ * | ------> @ y+ * ---- / \ \+ * | ->BI1 ADD INT |+ * ---- |+ * n ---------------|+ *+ * y becomes an INT, stack is not empty, BININT1 found on top+ * do arithmetic+ * ----+ * | --------> @+ * ---- / \+ * | ------> @ INT+ * ---- / \ \+ * | ->BI1 ADD INT |+ * ---- |+ * n ---------------|+ *+ * ----+ * n -------> INT(x+y)+ */+ case T_ADD:+ case T_SUB:+ case T_MUL:+ case T_QUOT:+ case T_REM:+ case T_SUBR:+ case T_UADD:+ case T_USUB:+ case T_UMUL:+ case T_UQUOT:+ case T_UREM:+ case T_USUBR:+ case T_AND:+ case T_OR:+ case T_XOR:+ case T_SHL:+ case T_SHR:+ case T_ASHR:+ case T_EQ:+ case T_NE:+ case T_LT:+ case T_LE:+ case T_GT:+ case T_GE:+ case T_ICMP:+ case T_ULT:+ case T_ULE:+ case T_UGT:+ case T_UGE:+ case T_UCMP:+ CHECK(2);+ n = ARG(TOP(1));+ if (is_DATA_NODE(n, D_INT)) {+ n = ARG(TOP(0));+ PUSH(combBININT1);+ if (is_DATA_NODE(n, D_INT))+ goto binint1;+ } else {+ PUSH(combBININT2);+ }+ goto top;++ case T_NEG:+ case T_UNEG:+ case T_INV:+ case T_POPCOUNT:+ case T_CLZ:+ case T_CTZ:+ CHECK(1);+ n = ARG(TOP(0));+ PUSH(combUNINT1);+ goto top;++ case T_SEQ: CHECK(2); EV_SAVE(); evali(ARG(TOP(0))); EV_LOAD(); POP(2); n = TOP(-1); y = ARG(n); GOIND(y); /* seq x y = eval(x); y */++ case T_IO_BIND:+ goto t_c;+ case T_IO_RETURN:+ goto t_p;+ case T_IO_THEN:+ {+ struct node *p0, *p1;+ CHECK(2);+ ALLOC2(p0, p1);+ POPARG2;+ GOAP2_P(p0, combIOBIND, x, mk_ap_node(p1, combK, y));+ }++ /* The scrutinee is the last argument:+ * CASED_a0_..._a{m-1} f0 ... f{m-1} e+ * CASES_k1_n1_..._km_nm d f1 ... fm e+ * Push a virtual LOOKx as a continuation marker and evaluate e:+ * LOOKD_m, or LOOKS with the same table entry as the CASES.+ * The arms stay where they are on the stack.+ * Nothing is allocated, and no heap node is written.+ */+ case V_CASED:+ {+ int m = get_case_arity(n)->m;+ CHECK(m + 1);+ n = ARG(TOP(m));+ PUSH(mk_CASE(V_LOOKD, m));+ goto top;+ }+ case V_CASES:+ {+ uint32_t i = get_case_index(n);+ int m = case_arities[i].m;+ CHECK(m + 2);+ n = ARG(TOP(m + 1));+ PUSH(mk_CASE(V_LOOKS, i));+ goto top;+ }+ case V_LOOKD:+ case V_LOOKS:+ RET;+ case V_CONSTR:+ {+ int k, nn;+ get_CON_info(n, &k, &nn);+ /* Stack layout when there is a case waiting:+ * TOP(0) .. TOP(nn-1) constructor spine, ARG(TOP(i)) is field i+ * TOP(nn) LOOKx_m marker+ * TOP(nn+1) ... the case spine, the last one is the case redex+ */+ CHECK(nn+1);+ NODEPTR p = TOP(nn);+ if (!is_VIRT(p))+ ERR("CONSTR: no LOOK");+ enum node_tag ltag = get_VIRT_TAG(p);+ NODEPTR fk;+ int fidx; /* stack index of the selected arm */+ int npop; /* number of stack entries to pop, the last one is the case redex */+ if (ltag == V_LOOKD) {+ /* CONSTR_k_n e1 ... en LOOKD_m (CASED_a0_..._a{m-1} f0 ... f{m-1} _) --> fk e1 ... en */+ fidx = nn + 1 + k;+ npop = nn + 2 + get_CASE_size(p);+ } else if (ltag == V_LOOKS) {+ /* CONSTR_k_n e1 ... en LOOKS (CASES_k1_n1_..._km_nm d f1 ... fm _) --> fj e1 ... en, when kj is k+ * --> d, when no kj is k+ * The constructor numbers are increasing, so use binary search.+ */+ struct case_arity *c = get_case_arity(p);+ int lo = 0, hi = c->m; /* search arms [lo, hi) */+ npop = nn + 3 + c->m;+ for (;;) {+ if (lo >= hi) {+ /* Not found, use the default, which takes no arguments. */+ fk = ARG(TOP(nn + 1));+ POP(npop);+ n = TOP(-1);+ GOIND(fk);+ }+ int mid = (lo + hi) / 2;+ int ki = c->tags[mid];+ if (ki == k) {+ fidx = nn + 2 + mid;+ break;+ } else if (ki < k) {+ lo = mid + 1;+ } else {+ hi = mid;+ }+ }+ } else {+ ERR1("CONSTR: no LOOK, found %s", TAGNAME(ltag));+ }+ if (nn == 0) {+ fk = ARG(TOP(fidx));+ POP(npop);+ n = TOP(-1);+ GOIND(fk);+ }+ /* Specialize the common 1- and 2-field constructors (e.g., Just, (:), (,)):+ * nn == 1 avoids the allocation check and loop, and nn == 2 uses GOAP2_P to+ * push the constructed AP node directly onto the stack instead of writing it+ * out and immediately unwinding it back from memory. */+ if (nn == 1) {+ fk = ARG(TOP(fidx));+ x = ARG(TOP(0));+ POP(npop);+ n = TOP(-1);+ GOAP(fk, x);+ }+ if (nn == 2) {+ struct node *p0;+ ALLOC1(p0);+ fk = ARG(TOP(fidx));+ x = ARG(TOP(0));+ y = ARG(TOP(1));+ POP(npop);+ n = TOP(-1);+ GOAP2_P(p0, fk, x, y);+ }+ /* Build fk e1 ... e{n-1}, and overwrite the case redex with (fk e1 ... e{n-1}) en.+ * This allocates n-1 nodes, and needs no indirection. */+#if BUMP_ALLOC+ if (UNLIKELY(bump_end - bump_ptr < nn - 1)) {+ fk = ev_constr_alloc(stack_ptr, bump_ptr, bump_end, fidx, nn);+ EV_LOAD_BUMP();+ } else {+ fk = ARG(TOP(fidx));+ for (int i = 0; i < nn - 1; i++)+ fk = mk_ap_node(bump_ptr++, fk, ARG(TOP(i)));+ }+#else+ GCCHECK(nn - 1);+ fk = ARG(TOP(fidx));+ for (int i = 0; i < nn - 1; i++)+ fk = new_ap(fk, ARG(TOP(i)));+#endif+ NODEPTR en = ARG(TOP(nn - 1));+ POP(npop);+ n = TOP(-1);+ GOAP(fk, en);+ }++ default:+ {+ /* Every other primitive */+ EV_SAVE();+ struct prim_res pr = EVALPRIMOP(n, tag, stk);+ EV_LOAD();+ n = pr.n;+ if (pr.next == PRIM_TOP)+ goto top;+ goto ret;+ }+ }+++ ret:+ if (stack_ptr != stk) {+ // In this case, n was an AP that got pushed and potentially+ // updated.+ uvalue_t xu, yu, ru;+ NODEPTR p;+ NODEPTR top0 = TOP(0);++ if (!is_VIRT(top0))+ goto ret_done;+ tag = get_VIRT_TAG(top0);+ switch (tag) {+ case T_BININT2:+ n = ARG(TOP(1));+ TOP(0) = combBININT1;+ goto top;++ case T_BININT1:+ /* First argument */+#if SANITY+ if (!is_DATA_NODE(n, D_INT))+ ERR("BININT 0");+#endif /* SANITY */+ binint1:+ xu = (uvalue_t)GETVALUE(n);+ /* Second argument */+ y = ARG(TOP(2));+ while (is_DATA_NODE(y, D_IND))+ y = ARG(y);+#if SANITY+ if (!is_DATA_NODE(y, D_INT))+ ERR("BININT 1");+#endif /* SANITY */+ yu = (uvalue_t)GETVALUE(y);+ p = FUN(TOP(1));+ POP(3);+ n = TOP(-1);+ while (is_DATA_NODE(p, D_IND))+ p = ARG(p);+ if (!is_VIRT(p))+ ERR("BININT");+ switch (get_VIRT_TAG(p)) {+ case T_ADD: ADD_OVERFLOW(value_t, ru, xu, yu, EV_RAISE); break;+ case T_SUB: SUB_OVERFLOW(value_t, ru, xu, yu, EV_RAISE); break;+ case T_MUL: MUL_OVERFLOW(value_t, ru, xu, yu, EV_RAISE); break;+ case T_SUBR: SUB_OVERFLOW(value_t, ru, yu, xu, EV_RAISE); break;+ case T_QUOT: if (yu == 0)+ EV_RAISE(exn_dividebyzero);+ else if ((value_t)xu == VALUE_MIN && (value_t)yu == -1)+ EV_RAISE(exn_overflow);+ else+ ru = (uvalue_t)((value_t)xu / (value_t)yu);+ break;+ case T_REM: if (yu == 0)+ EV_RAISE(exn_dividebyzero);+ else if ((value_t)yu == -1) /* MIN % -1 traps on x86 */+ ru = 0;+ else+ ru = (uvalue_t)((value_t)xu % (value_t)yu);+ break;+ case T_UADD: ru = xu + yu; break;+ case T_USUB: ru = xu - yu; break;+ case T_UMUL: ru = xu * yu; break;+ case T_USUBR: ru = yu - xu; break;+ case T_UQUOT: if (yu == 0)+ EV_RAISE(exn_dividebyzero);+ else+ ru = xu / yu;+ break;+ case T_UREM: if (yu == 0)+ EV_RAISE(exn_dividebyzero);+ else+ ru = xu % yu;+ break;+ case T_AND: ru = xu & yu; break;+ case T_OR: ru = xu | yu; break;+ case T_XOR: ru = xu ^ yu; break;+ case T_SHL: ru = xu << yu; break;+ case T_SHR: ru = xu >> yu; break;+ case T_ASHR: ru = (uvalue_t)((value_t)xu >> yu); break;++ case T_EQ: GOBOOL(xu == yu);+ case T_NE: GOBOOL(xu != yu);+ case T_ULT: GOBOOL(xu < yu);+ case T_ULE: GOBOOL(xu <= yu);+ case T_UGT: GOBOOL(xu > yu);+ case T_UGE: GOBOOL(xu >= yu);+ case T_UCMP: GOIND(xu < yu ? combLT : xu > yu ? combGT : combEQ);+ case T_LT: GOBOOL((value_t)xu < (value_t)yu);+ case T_LE: GOBOOL((value_t)xu <= (value_t)yu);+ case T_GT: GOBOOL((value_t)xu > (value_t)yu);+ case T_GE: GOBOOL((value_t)xu >= (value_t)yu);+ case T_ICMP: GOIND((value_t)xu < (value_t)yu ? combLT : (value_t)xu > (value_t)yu ? combGT : combEQ);++ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("BININT");+ }+ SETINT(n, (value_t)ru);+ goto ret;++ case T_UNINT1:+ /* The argument */+#if SANITY+ if (!is_DATA_NODE(n, D_INT))+ ERR("UNINT 0");+#endif+ xu = (uvalue_t)GETVALUE(n);+ p = FUN(TOP(1));+ POP(2);+ n = TOP(-1);+ while (is_DATA_NODE(p, D_IND))+ p = ARG(p);+ if (!is_VIRT(p))+ ERR("UNINT");+ switch (get_VIRT_TAG(p)) {+ case T_NEG:+#if WANT_OVERFLOW+ if ((value_t)xu == VALUE_MIN) EV_RAISE(exn_overflow);+#endif+ ru = -xu; break;+ case T_UNEG: ru = -xu; break;+ case T_INV: ru = ~xu; break;+ case T_POPCOUNT: ru = POPCOUNT(xu); break;+ case T_CLZ: ru = CLZ(xu); break;+ case T_CTZ: ru = CTZ(xu); break;+ default:+ //fprintf(stderr, "tag=%d\n", get_XTAG(FUN(TOP(0))));+ ERR("UNINT");+ }+ SETINT(n, (value_t)ru);+ goto ret;++#if WANT_INT64+ case T_BININT64_2:+ case T_BININT64_1:+ case T_UNINT64_1:+#endif /* WANT_INT64 */+#if WANT_FLOAT32+ case T_BINFLT2:+ case T_BINFLT1:+ case T_UNFLT1:+#endif /* WANT_FLOAT32 */+#if WANT_FLOAT64+ case T_BINDBL2:+ case T_BINDBL1:+ case T_UNDBL1:+#endif /* WANT_FLOAT64 */+ case T_BINBS2:+ case T_BINBS1:+ {+ EV_SAVE();+ struct prim_res pr = EVALPRIMRET(n, tag);+ EV_LOAD();+ n = pr.n;+ if (pr.next == PRIM_TOP)+ goto top;+ goto ret;+ }++ default:+ ret_done:+ stack_ptr = stk;+ n = TOP(-1);+ }+ }+#if MAXSTACKDEPTH+ cur_c_stack = old_cur_c_stack; /* reset rather than counting down, in case of longjump */+#endif+ //fprintf(stderr, "evali exit stack_ptr=%d\n", (int)stack_ptr);+#if EXTRASANITY+ if (!is_whnf(n))+ ERR("evali: the result is not in WHNF");+#endif+ EV_SAVE();+ return n;+}++/* Back to the global version */+#undef GCCHECK+#define GCCHECK(n) gc_check((n))++static char *progname = "?";++NORETURN void+die_exn(NODEPTR exn)+{+ /* No handler:+ * First convert the exception to a string by calling displaySomeException.+ * The display function compiles to combShowExn, so we need to build+ * (combShowExn exn) and evaluate it.+ */+ NODEPTR x;+ const char *msg;++ in_raise = true;++ if (get_XTAG(exn) == D_INT) {+ /* This is the special hack for RTS generated exception, represented by a D_INT */+ enum rts_exn eexn = GETVALUE(exn);+ static const char *msgs[] =+ { "stack overflow",+ "heap overflow",+ "thread killed",+ "user interrupt",+ "DivideByZero",+ "blocked MVar",+ "blocked STM",+ "arithmetic overflow",+ "Serialize",+ "Deserialize",+ "<<loop>>",+ };+ if (eexn < 0 || eexn >= exn_last) {+ msg = "unknown";+ } else {+ msg = msgs[eexn];+ }+ } else {+ /* just overwrite the top stack element, we don't need it */+ CLEARSTK();+ GCCHECKSAVE(exn, 1);+ PUSH(new_ap(combShowExn, exn)); /* TOP(0) = (combShowExn exn) */+ x = evali(TOP(0)); /* evaluate it */+ msg = evalstring(x).bs_array; /* and convert to a C string */+ POP(1);+ }+#if WANT_STDIO+ /* A horrible hack until we get proper exceptions */+ if (strcmp(msg, "ExitSuccess") == 0) {+ EXIT(0);+ } else if (strncmp(msg, "ExitFailure ", 12) == 0) {+ EXIT(atoi(msg + 12));+ } else {+ fprintf(stderr, "\n%s: uncaught exception: %s\n", progname, msg);+ EXIT(1);+ }+#else /* WANT_STDIO */+ ERR1("mhs error: %s", msg);+#endif /* WANT_STDIO */+}++#if WANT_ARGS+heapoffs_t+memsize(const char *p)+{+ heapoffs_t n = 0;+ while (isdigit((unsigned char)*p)) {+ n = n * 10 + (heapoffs_t)(*p - '0');+ p++;+ }+ switch (*p) {+ case 'k': case 'K': n *= 1000; break;+ case 'm': case 'M': n *= 1000000; break;+ case 'g': case 'G': n *= 1000000000; break;+ default: break;+ }+ return n;+}+#endif++extern const uint8_t *combexpr;+extern const int combexprlen;++#if WANT_TICK+int dump_ticks = 0;+#endif++#if WANT_ARGS+ #if WANT_STDIO+ #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(a,b,c,d)+ #else+ #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(a,b)+ #endif+#else /* WANT_ARGS */+ #if WANT_STDIO+ #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args(c,d)+ #else+ #define MHS_INIT_ARGS(a,b,c,d) mhs_init_args()+ #endif+#endif /* WANT_ARGS */++NODEPTR+MHS_INIT_ARGS(+ int argc, char **argv,+ char **outnamep,+ size_t *file_sizep+)+{+ NODEPTR prog;+#if WANT_ARGS+ char *inname = 0;+ char **av;+ char **gargv;+ int gargc;+ int inrts;+#endif++#if 0+ /* MINGW doesn't do buffering right */+ setvbuf(stdout, NULL, _IOLBF, BUFSIZ);+ setvbuf(stderr, NULL, _IONBF, BUFSIZ);+#endif++#ifdef INITIALIZATION+ main_setup(); /* Do platform specific start-up. */+#endif++#ifdef CLOCK_INIT+ CLOCK_INIT();+#endif++#if WANT_SIGINT+ {+ (void)signal(SIGINT, handle_sigint);+ sigset_t set;+ sigemptyset(&set);+ sigaddset(&set, SIGINT);+ sigprocmask(SIG_UNBLOCK, &set, NULL);+ }+#endif++ heap_size = HEAP_CELLS; /* number of heap cells */+ stack_size = STACK_SIZE; /* number of stack slots */++#if WANT_ARGS+ progname = argv[0];+ argc--, argv++;+ gargv = argv;+ for (av = argv, inrts = 0; argc--; argv++) {+ char *p = *argv;+ if (inrts) {+ if (strcmp(p, "-RTS") == 0) {+ inrts = 0;+ } else {+ if (strcmp(p, "-v") == 0)+ verbose++;+#if WANT_TICK+ else if (strcmp(p, "-T") == 0)+ dump_ticks = 1;+#endif+ else if (strncmp(p, "-H", 2) == 0)+ heap_size = memsize(&p[2]);+ else if (strncmp(p, "-K", 2) == 0)+ stack_size = memsize(&p[2]);+ else if (strncmp(p, "-r", 2) == 0)+ inname = &p[2];+#if WANT_STDIO+ else if (strncmp(p, "-o", 2) == 0)+ *outnamep = &p[2];+ else if (strcmp(p, "-B") == 0)+ gcbell++;+#endif /* WANT_STDIO */+ else+ ERR("Usage: eval [+RTS [-v] [-B] [-T] [-Hheap-size] [-Kstack-size] [-rFILE] [-oFILE] -RTS] arg ...");+ }+ } else {+ if (strcmp(p, "+RTS") == 0) {+ inrts = 1;+ } else {+ *av++ = p;+ }+ }+ }+ gargc = av - gargv;++ if (inname == 0)+ inname = "out.comb";+#endif++ init_nodes();+ NODEPTR *stack_area = mmalloc(sizeof(NODEPTR) * stack_size);+ stack_bot = stack_area + stack_size; /* the stack grows down from here */+ stack_limit = stack_area + 1;+ CLEARSTK();+ init_stableptr();++ num_reductions = 0;++#if WANT_ARGS+ /* Initialize an IORef (i.e., single element IOArray+ * to contain the list of program arguments.+ * The 0th element is the program name, and the rest+ * are the non RTS arguments.+ */+ {+ NODEPTR n;+ /* No GC checks, the heap is empty. */+ n = mkNil();+ for(int i = gargc-1; i >= 0; i--) {+ n = mkCons(mkStringC(gargv[i]), n);+ }+ n = mkCons(mkStringC(progname), n);+ argarray = arr_alloc(1, n); /* An IORef contains a single element array */+ argarray->permanent = true; /* never GC the arguments, because a T_IO_GETARGREF can reach argarray */+ }+#endif /* WANT_ARGS */++ {+ /* Read the combinator code. */+ BFILE *bf;+ if (combexpr) {+ /* The code is in memory, create a memore buffer BFILE */+ bf = openb_rd_mem(combexpr, combexprlen);+#if WANT_STDIO+ *file_sizep = combexprlen;+#endif+ } else {+#if WANT_STDIO & WANT_ARGS+ /* Open a regular file */+ FILE *f = fopen(inname, "rb");+ if (!f)+ ERR1("file not found %s", inname);+ fseek(f, 0, SEEK_END);+ *file_sizep = ftell(f); /* find its size */+ rewind(f);++ bf = add_FILE(f);+#else+ ERR("no stdio");+#endif+ }+ int c = getb(bf);+#if WANT_BASE64+ /* Compressed combinators start with a 'z', otherwise 'v' (for version) */+ if (c != 'z' && c != 'v') {+ /* Neither z nor v, assume base64 encoded */+ ungetb(c, bf);+ bf = add_base64_decoder(bf);+ c = getb(bf);+ }+#endif+ if (c == 'z') {+#if WANT_LZMA+ /* add LZMA decompressor transducer */+ bf = add_lzma_decompressor(bf);+#else+ ERR("LZMA compression not supported");+#endif+ } else {+ /* put it back, we need it */+ ungetb(c, bf);+ }+ prog = parse_top(bf, xffe_table);+ if (is_NIL(prog))+ ERR("deser failed");+ closeb(bf);+ }++ /* GC unused stuff, nice for -o */+ PUSH(prog);+ want_gc_red = 1;+ gc();+ gc(); /* this finds some more GC reductions */+ want_gc_red = 0; /* can be enabled, but it is rarely a win */+ prog = POPTOP();+ return prog;+}++void+mhs_init(void)+{+ char *args[2] = { "<mhs_init>", 0 };+ char *outname;+ size_t file_size;+ (void)MHS_INIT_ARGS(1, args, &outname, &file_size);+}++int+mhs_main(int argc, char **argv)+{+ NODEPTR prog;+ char *outname = 0;+ size_t file_size = 0;+#if WANT_KPERF+ counter_t instrs;+#endif /* WANT_KPERF */+ boot_time = GETTIMEMICRO();++ prog = MHS_INIT_ARGS(argc, argv, &outname, &file_size);++#if WANT_STDIO+ heapoffs_t start_size = num_marked;+ if (outname) {+ /* Save GCed file (smaller), and exit. */+ FILE *out = fopen(outname, "wb");+ if (!out)+ ERR1("cannot open output file %s", outname);+ struct BFILE *bf = add_FILE(out);+ printb(bf, prog, true);+ closeb(bf);+ EXIT(0);+ }+ if (verbose > 2) {+ pp(stdout, prog);+ }+#endif+ run_time -= GETTIMEMILLI();++#if 0+ topnode = &prog;+#endif+#if WANT_KPERF+ if (!start_kperf()) {+ // ERR("kperf init failed");+#if WANT_STDIO+ fprintf(stderr, "start_kperf() failed, ignored\n");+#endif+ }+#endif /* WANT_KPERF */+ start_exec(prog);+#if WANT_STDIO+ /* Flush standard handles in case there is some BFILE buffering */+ flushb((BFILE*)FORPTR(comb_stdout)->payload.bs_array);+ flushb((BFILE*)FORPTR(comb_stderr)->payload.bs_array);+#endif /* WANT_STDIO */+ gc(); /* Run finalizers */+#if WANT_KPERF+ instrs = end_kperf();+#endif /* WANT_KPERF */+ run_time += GETTIMEMILLI();++#if WANT_STDIO+ if (verbose) {+ if (verbose > 1) {+ PRINT("node size=%"PRIheap", heap size bytes=%"PRIheap"\n", (heapoffs_t)NODE_SIZE, heap_size * NODE_SIZE);+ }+ setlocale(LC_NUMERIC, "en_US"); /* Make %' work on platforms that support it */+ PRINT("%"PCOMMA"15"PRIheap" combinator file size\n", (heapoffs_t)file_size);+ PRINT("%"PCOMMA"15"PRIheap" cells at start\n", start_size);+ PRINT("%"PCOMMA"15"PRIheap" cells heap size (%"PCOMMA""PRIheap" bytes)\n", heap_size, heap_size * NODE_SIZE);+ PRINT("%"PCOMMA"15"PRIcounter" cells allocated (%"PCOMMA".1f Mbyte/s)\n", NUM_ALLOC, NUM_ALLOC * NODE_SIZE / ((double)run_time / 1000) / 1000000);+ PRINT("%"PCOMMA"15"PRIcounter" GCs\n", num_gc);+ PRINT("%"PCOMMA"15"PRIcounter" max cells used\n", max_num_marked);+ PRINT("%"PCOMMA"15"PRIcounter" reductions (%"PCOMMA".1f Mred/s)\n", num_reductions, num_reductions / ((double)run_time / 1000) / 1000000);+ PRINT("%"PCOMMA"15"PRIcounter" yields (%"PCOMMA""PRIcounter" resched)\n", num_yield, num_resched);+ PRINT("%"PCOMMA"15"PRIcounter" array alloc\n", num_arr_alloc);+ PRINT("%"PCOMMA"15"PRIcounter" array free\n", num_arr_free);+ PRINT("%"PCOMMA"15"PRIcounter" foreign alloc\n", num_fin_alloc);+ PRINT("%"PCOMMA"15"PRIcounter" foreign free\n", num_fin_free);+ PRINT("%"PCOMMA"15"PRIcounter" bytestring alloc (max %"PCOMMA""PRIcounter")\n", num_bs_alloc, num_bs_alloc_max);+ PRINT("%"PCOMMA"15"PRIcounter" bytestring alloc bytes (max %"PCOMMA""PRIcounter")\n", num_bs_bytes, num_bs_inuse_max);+ PRINT("%"PCOMMA"15"PRIcounter" bytestring free\n", num_bs_free);+ PRINT("%"PCOMMA"15"PRIcounter" thread create\n", num_thread_create-1);+ PRINT("%"PCOMMA"15"PRIcounter" thread reap\n", num_thread_reap);+ PRINT("%"PCOMMA"15"PRIcounter" stableptr alloc\n", num_stable_alloc);+ PRINT("%"PCOMMA"15"PRIcounter" stableptr free\n", num_stable_free);+ PRINT("%"PCOMMA"15"PRIcounter" weakptr alloc\n", num_new_weak);+ PRINT("%"PCOMMA"15"PRIcounter" weakptr free\n", num_gc_weak);+ {+ /* XXX temporary */+ size_t bytes = max_case_arities * sizeof(struct case_arity);+ for (uint32_t i = 0; i < num_case_arities; i++)+ bytes += case_arities[i].m * (case_arities[i].tags ? 1 + sizeof(uint16_t) : 1);+ PRINT("%"PCOMMA"15d case arity entries (%"PCOMMA"d bytes)\n", (int)num_case_arities, (int)bytes);+ }+#if MAXSTACKDEPTH+ PRINT("%"PCOMMA"15d max stack depth\n", (int)max_stack_depth);+ PRINT("%"PCOMMA"15d max C stack depth\n", (int)max_c_stack);+#endif+ // PRINT("%"PCOMMA"15d avg gc stack depth\n", (int)(gc_tot / num_gc));+ // PRINT("%"PCOMMA"15"PRIcounter" max mark depth\n", max_mark_depth);+ PRINT("%15.2fs total expired time\n", (double)run_time / 1000);+ PRINT("%15.2fs gc expired time = %3.1f%% (%.2fs mark + %.2fs scan)\n",+ (double)(gc_mark_time + gc_scan_time) / 1000,+ (double)(gc_mark_time + gc_scan_time) / (double)run_time * 100,+ (double)gc_mark_time / 1000,+ (double)gc_scan_time / 1000);+#if WANT_KPERF+ if (instrs > 0) {+ PRINT("%"PCOMMA"15"PRIcounter" instructions (%.1f instr/red)\n", instrs, (double)instrs / (double)num_reductions);+ }+#endif /* WANT_KPERF */+#if GCRED+ PRINT(" GC reductions A=%"PRIcounter", K=%"PRIcounter", I=%"PRIcounter", int=%"PRIcounter", flip=%"PRIcounter","+ " BI=%"PRIcounter", BxI=%"PRIcounter", C'BxI=%"PRIcounter", CC=%"PRIcounter", C'I=%"PRIcounter", C'BBCP=%"PRIcounter"\n",+ red_a, red_k, red_i, red_int, red_flip, red_bi, red_bxi, red_ccbi, red_cc, red_cci, red_ccbbcp);+ PRINT(" special reductions B'=%"PRIcounter" K4=%"PRIcounter" K3=%"PRIcounter" K2=%"PRIcounter" C'B=%"PRIcounter", Z=%"PRIcounter", R=%"PRIcounter"\n",+ red_bb, red_k4, red_k3, red_k2, red_ccb, red_z, red_r);+#endif+ }+#endif /* WANT_STDIO */++#if WANT_TICK+ if (dump_ticks) {+ dump_tick_table(stdout);+ }+#endif++#ifdef TEARDOWN+ main_teardown(); /* do some platform specific teardown */+#endif+ EXIT(0);+}++#if WANT_MD5+#include "md5.c"+#endif /* WANT_MD5 */++#if WANT_LZ77+#include "lz77.c"+#endif++/***************************/+/* Foreign export helpers */++/* The ffe_value in the C code is a struct node*, but it is really a NODEPTR,+ * so it can be a virtual pointer. */+void+ffe_push(struct node *p)+{+ NODEPTR n;+ n.node_ptr = p;+ PUSH(n);+}++void+ffe_pop(void)+{+ POP(1);+}++/* Allocate a new node (will be overwritten) */+stackptr_t+ffe_alloc(void)+{+ PUSH(alloc_node(D_DBL));+ return STACK_INDEX(stack_ptr);+}++void+ffe_apply(void)+{+ NODEPTR arg = POPTOP();+ NODEPTR fun = POPTOP();+ PUSH(new_ap(fun, arg));+}++/* For stand-alone exported functions this is called with the threading inactive.+ * On the other hand, if a 'foreign import' calls back to a 'foreign export' the+ * threading is alread running.+ */+/* XXX This is not quite right. The surrounding mhs_to_xxx should be in the thread. */+stackptr_t+ffe_eval(void)+{+ if (main_thread) {+ /* threading active, run on current stack */+ (void)evali(TOP(0));+ } else {+ /* Start up the threading to evaluate the node.+ * start_exec() runs an IO action, i.e., it applies its argument to World.+ * The node is a value, not an IO action, so pass (K node), which+ * ignores World. Applying the node itself to World would give it an+ * extra argument, which a constructor cannot take.+ */+ GCCHECK(2); /* K node, and the World application in start_exec */+ start_exec(new_ap(combK, TOP(0)));+ }+ /* The mhs_to_xxx functions bizarrely return the ARG(TOP(n+1)) value.+ * The wrapper will call with n=-1, so we need to put the result at ARG(TOP(0))+ */+ GCCHECK(1);+ TOP(0) = new_ap(combI, TOP(0));+ return STACK_INDEX(stack_ptr);+}++stackptr_t+ffe_exec(void)+{+ NODEPTR n = POPTOP();+ PUSH(new_ap(combPERFORMIO, n));+ return ffe_eval();+}++/* apply_sp :: StablePtr (Ptr a -> IO (Ptr b)) -> Ptr a -> IO (Ptr b) */+void *+apply_sp(uvalue_t sp, void *arg)+{+ GCCHECK(3);+ NODEPTR f = deref_stableptr(sp);+ NODEPTR a = alloc_node(D_PTR);+ PTR(a) = arg;+ PUSH(new_ap(combPERFORMIO, new_ap(f, a)));+ void *r = evalptr(TOP(0));+ POP(1);+ return r;+}++/*********************/+/* FFI adapters */++#define MHS_FROM(name, set, type) \+from_t \+name(stackptr_t stk, int n, type x) \+{ \+ NODEPTR r = TOP(0); /* The pre-allocated cell for the result, */ \+ set(r, x); /* Put result in pre-allocated cell. */ \+ return n; /* return arity */ \+}+#if WANT_FLOAT64+MHS_FROM(mhs_from_Double, SETDBL, flt64_t);+#endif+#if WANT_FLOAT32+MHS_FROM(mhs_from_Float, SETFLT, flt32_t);+#endif+MHS_FROM(mhs_from_Int, SETINT, value_t);+/* A Bool is the C_0_0 (False) or C_1_0 (True) constructor, not an int node. */+#define SETBOOL(n, x) SETIND((n), (x) ? combTrue : combFalse)+MHS_FROM(mhs_from_Bool, SETBOOL, value_t);+#if WANT_INT64+MHS_FROM(mhs_from_Int64, SETINT64, int64_t);+#endif+MHS_FROM(mhs_from_Word, SETINT, uvalue_t);+MHS_FROM(mhs_from_Word8, SETINT, uvalue_t);+#if WANT_INT64+MHS_FROM(mhs_from_Word64, SETINT64, uint64_t);+#endif+MHS_FROM(mhs_from_Ptr, SETPTR, void*);+MHS_FROM(mhs_from_ForPtr, SETFORPTR, struct forptr *);+MHS_FROM(mhs_from_FunPtr, SETFUNPTR, HsFunPtr);+MHS_FROM(mhs_from_CChar, SETINT, char);+MHS_FROM(mhs_from_CSChar, SETINT, signed char);+MHS_FROM(mhs_from_CUChar, SETINT, unsigned char);+MHS_FROM(mhs_from_CShort, SETINT, short);+MHS_FROM(mhs_from_CUShort, SETINT, unsigned short);+MHS_FROM(mhs_from_CInt, SETINT, int);+MHS_FROM(mhs_from_CUInt, SETINT, unsigned int);+MHS_FROM(mhs_from_CLong, SETINT, long);+MHS_FROM(mhs_from_CULong, SETINT, unsigned long);+#if WANT_INT64+/* CLLong and CULLong are newtypes of Int64 and Word64 */+MHS_FROM(mhs_from_CLLong, SETINT64, long long);+MHS_FROM(mhs_from_CULLong, SETINT64, unsigned long long);+#else+MHS_FROM(mhs_from_CLLong, SETINT, long long);+MHS_FROM(mhs_from_CULLong, SETINT, unsigned long long);+#endif+MHS_FROM(mhs_from_CSize, SETINT, size_t);+#if WANT_TIME+MHS_FROM(mhs_from_CTime, SETINT, time_t);+#endif+// MHS_FROM(mhs_from_CSSize, SETINT, ssize_t);+MHS_FROM(mhs_from_CIntPtr, SETINT, intptr_t);+MHS_FROM(mhs_from_CUIntPtr, SETINT, uintptr_t);+from_t+mhs_from_Unit(stackptr_t stk, int n)+{+ POP(1); /* return value cell */+ PUSH(combUnit); /* push unit instead */+ return n;+}++#define MHS_TO(name, eval, type) \+type name(stackptr_t stk, int n) \+{ \+ return eval(ARG(TOP(n+1))); /* The stack has a reserved cell on top of the arguments */ \+}+#if WANT_FLOAT32+MHS_TO(mhs_to_Float, evalflt, flt32_t);+#endif+#if WANT_FLOAT64+MHS_TO(mhs_to_Double, evaldbl, flt64_t);+#endif+MHS_TO(mhs_to_Int, evalint, value_t);+MHS_TO(mhs_to_Bool, evalbool, value_t);+#if WANT_INT64+MHS_TO(mhs_to_Int64, evalint64, int64_t);+#endif+MHS_TO(mhs_to_Word, evalint, uvalue_t);+MHS_TO(mhs_to_Word8, evalint, uint8_t);+#if WANT_INT64+MHS_TO(mhs_to_Word64, evalint64, uint64_t);+#endif+MHS_TO(mhs_to_Ptr, evalptr, void*);+MHS_TO(mhs_to_FunPtr, evalfunptr, HsFunPtr);+MHS_TO(mhs_to_CChar, evalint, char);+MHS_TO(mhs_to_CSChar, evalint, signed char);+MHS_TO(mhs_to_CUChar, evalint, unsigned char);+MHS_TO(mhs_to_CShort, evalint, short);+MHS_TO(mhs_to_CUShort, evalint, unsigned short);+MHS_TO(mhs_to_CInt, evalint, int);+MHS_TO(mhs_to_CUInt, evalint, unsigned int);+MHS_TO(mhs_to_CLong, evalint, long);+MHS_TO(mhs_to_CULong, evalint, unsigned long);+#if WANT_INT64+/* CLLong and CULLong are newtypes of Int64 and Word64 */+MHS_TO(mhs_to_CLLong, evalint64, long long);+MHS_TO(mhs_to_CULLong, evalint64, unsigned long long);+#else+MHS_TO(mhs_to_CLLong, evalint, long long);+MHS_TO(mhs_to_CULLong, evalint, unsigned long long);+#endif+MHS_TO(mhs_to_CSize, evalint, size_t);+#if WANT_TIME+MHS_TO(mhs_to_CTime, evalint, time_t);+#endif+// MHS_TO(mhs_to_CSSize, evalint, ssize_t);+MHS_TO(mhs_to_CIntPtr, evalint, intptr_t);+MHS_TO(mhs_to_CUIntPtr, evalint, uintptr_t);++/* The rest of this file was generated by the compiler, with some minor edits with #if. */+from_t mhs_GETRAW(int s) { return mhs_from_Int(s, 0, GETRAW()); }+from_t mhs_GETTIMEMICRO(int s) { return mhs_from_Int(s, 0, GETTIMEMICRO()); }+from_t mhs_GETBOOTTIMEMICRO(int s) { return mhs_from_Int(s, 0, boot_time); }+#if WANT_MATH+#if WANT_FLOAT64+from_t mhs_acos(int s) { return mhs_from_Double(s, 1, acos(mhs_to_Double(s, 0))); }+from_t mhs_asin(int s) { return mhs_from_Double(s, 1, asin(mhs_to_Double(s, 0))); }+from_t mhs_atan(int s) { return mhs_from_Double(s, 1, atan(mhs_to_Double(s, 0))); }+from_t mhs_atan2(int s) { return mhs_from_Double(s, 2, atan2(mhs_to_Double(s, 0), mhs_to_Double(s, 1))); }+from_t mhs_cos(int s) { return mhs_from_Double(s, 1, cos(mhs_to_Double(s, 0))); }+from_t mhs_exp(int s) { return mhs_from_Double(s, 1, exp(mhs_to_Double(s, 0))); }+from_t mhs_log(int s) { return mhs_from_Double(s, 1, log(mhs_to_Double(s, 0))); }+from_t mhs_sin(int s) { return mhs_from_Double(s, 1, sin(mhs_to_Double(s, 0))); }+from_t mhs_sqrt(int s) { return mhs_from_Double(s, 1, sqrt(mhs_to_Double(s, 0))); }+from_t mhs_tan(int s) { return mhs_from_Double(s, 1, tan(mhs_to_Double(s, 0))); }+from_t mhs_scalbn(int s) { return mhs_from_Double(s, 2, scalbn(mhs_to_Double(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_pow(int s) { return mhs_from_Double(s, 2, pow(mhs_to_Double(s, 0), mhs_to_Double(s, 1))); }+#endif /* WANT_FLOAT64 */+#if WANT_FLOAT32+from_t mhs_acosf(int s) { return mhs_from_Float(s, 1, acosf(mhs_to_Float(s, 0))); }+from_t mhs_asinf(int s) { return mhs_from_Float(s, 1, asinf(mhs_to_Float(s, 0))); }+from_t mhs_atanf(int s) { return mhs_from_Float(s, 1, atanf(mhs_to_Float(s, 0))); }+from_t mhs_atan2f(int s) { return mhs_from_Float(s, 2, atan2f(mhs_to_Float(s, 0), mhs_to_Float(s, 1))); }+from_t mhs_cosf(int s) { return mhs_from_Float(s, 1, cosf(mhs_to_Float(s, 0))); }+from_t mhs_expf(int s) { return mhs_from_Float(s, 1, expf(mhs_to_Float(s, 0))); }+from_t mhs_logf(int s) { return mhs_from_Float(s, 1, logf(mhs_to_Float(s, 0))); }+from_t mhs_sinf(int s) { return mhs_from_Float(s, 1, sinf(mhs_to_Float(s, 0))); }+from_t mhs_sqrtf(int s) { return mhs_from_Float(s, 1, sqrtf(mhs_to_Float(s, 0))); }+from_t mhs_tanf(int s) { return mhs_from_Float(s, 1, tanf(mhs_to_Float(s, 0))); }+from_t mhs_scalbnf(int s) { return mhs_from_Float(s, 2, scalbnf(mhs_to_Float(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_powf(int s) { return mhs_from_Float(s, 2, powf(mhs_to_Float(s, 0), mhs_to_Float(s, 1))); }+#endif /* WANT_FLOAT32 */+#endif /* WANT_MATH */++#if defined(__EMSCRIPTEN__)+from_t mhs_js_debug(int s) { EM_ASM({ console.log(UTF8ToString($0)) }, mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }+from_t mhs_js_eval_run(int s) { EM_ASM({ eval(UTF8ToString($0)) }, mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }+from_t mhs_js_eval_call(int s) { return mhs_from_Ptr(s, 1, EM_ASM_PTR({ return stringToNewUTF8(JSON.stringify(eval(UTF8ToString($0)))) }, mhs_to_Ptr(s, 0))); }+from_t mhs_js_set_haskellCallback(int s) { EM_ASM({ _haskellCallback = $0 }, mhs_to_Int(s, 0)); return mhs_from_Unit(s, 1); }+#endif++#if WANT_STDIO+from_t mhs_add_FILE(int s) { return mhs_from_Ptr(s, 1, add_FILE(mhs_to_Ptr(s, 0))); }+from_t mhs_putchar(int s) { putchar(mhs_to_Int(s, 0)); return mhs_from_Unit(s, 1); } /* for debugging */+from_t mhs_fopen(int s) { return mhs_from_Ptr(s, 2, fopen(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }+from_t mhs_system(int s) { return mhs_from_Int(s, 1, system(mhs_to_Ptr(s, 0))); }+from_t mhs_tmpname(int s) { return mhs_from_Ptr(s, 2, TMPNAME(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }+from_t mhs_remove(int s) { return mhs_from_Int(s, 1, remove(mhs_to_Ptr(s, 0))); }+#endif /* WANT_STDIO */+#if WANT_FD+from_t mhs_add_fd(int s) { return mhs_from_Ptr(s, 1, add_fd(mhs_to_Int(s, 0))); }+from_t mhs_open(int s) { return mhs_from_Int(s, 3, open(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }+#endif /* WANT_FD */+#if WANT_BUF+from_t mhs_add_buf(int s) { return mhs_from_Ptr(s, 2, add_buf(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+#endif /* WANT_BUF */+#if WANT_CRLF+from_t mhs_add_crlf(int s) { return mhs_from_Ptr(s, 1, add_crlf(mhs_to_Ptr(s, 0))); }+#endif /* WANT_CRLF */+#if WANT_UTF8+from_t mhs_add_utf8(int s) { return mhs_from_Ptr(s, 1, add_utf8(mhs_to_Ptr(s, 0))); }+#endif /* WANT_UTF8 */+#if WANT_BASE64+from_t mhs_add_base64_encoder(int s) { return mhs_from_Ptr(s, 1, add_base64_encoder(mhs_to_Ptr(s, 0))); }+from_t mhs_add_base64_decoder(int s) { return mhs_from_Ptr(s, 1, add_base64_decoder(mhs_to_Ptr(s, 0))); }+#endif /* WANT_BASE64 */+from_t mhs_closeb(int s) { closeb(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }+from_t mhs_addr_closeb(int s) { return mhs_from_FunPtr(s, 0, (HsFunPtr)&closeb); }+from_t mhs_flushb(int s) { flushb(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }+from_t mhs_getb(int s) { return mhs_from_Int(s, 1, getb(mhs_to_Ptr(s, 0))); }+from_t mhs_putb(int s) { putb(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_ungetb(int s) { ungetb(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_openwrmem(int s) { return mhs_from_Ptr(s, 0, openb_wr_mem()); }+from_t mhs_openrdmem(int s) { return mhs_from_Ptr(s, 2, openb_rd_mem(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_getmem(int s) { get_mem(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_readb(int s) { return mhs_from_Int(s, 3, readb(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Ptr(s, 2))); }+from_t mhs_writeb(int s) { return mhs_from_Int(s, 3, writeb(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1), mhs_to_Ptr(s, 2))); }+from_t mhs_isattyb(int s) { return mhs_from_Int(s, 1, isattyb(mhs_to_Ptr(s, 0))); }+#if WANT_INT64+from_t mhs_filesizeb(int s) { return mhs_from_Int64(s, 1, filesizeb(mhs_to_Ptr(s, 0))); }+#endif /* WANT_INT64 */++#if WANT_MD5+from_t mhs_md5Array(int s) { md5Array(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_md5BFILE(int s) { md5BFILE(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_md5String(int s) { md5String(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+#endif /* WANT_MD5 */++#if WANT_LZ77+from_t mhs_add_lz77_compressor(int s) { return mhs_from_Ptr(s, 1, add_lz77_compressor(mhs_to_Ptr(s, 0))); }+from_t mhs_add_lz77_decompressor(int s) { return mhs_from_Ptr(s, 1, add_lz77_decompressor(mhs_to_Ptr(s, 0))); }+from_t mhs_lz77c(int s) { return mhs_from_CSize(s, 3, lz77c(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1), mhs_to_Ptr(s, 2))); }+#endif /* WANT_LZ77 */++#if WANT_LZMA+from_t mhs_add_lzma_compressor(int s) { return mhs_from_Ptr(s, 1, add_lzma_compressor(mhs_to_Ptr(s, 0))); }+from_t mhs_add_lzma_decompressor(int s) { return mhs_from_Ptr(s, 1, add_lzma_decompressor(mhs_to_Ptr(s, 0))); }+#endif /* WANT_LZ77 */++#if WANT_RLE+from_t mhs_add_rle_compressor(int s) { return mhs_from_Ptr(s, 1, add_rle_compressor(mhs_to_Ptr(s, 0))); }+from_t mhs_add_rle_decompressor(int s) { return mhs_from_Ptr(s, 1, add_rle_decompressor(mhs_to_Ptr(s, 0))); }+#endif /* WANT_RLE */++#if WANT_BWT+from_t mhs_add_bwt_compressor(int s) { return mhs_from_Ptr(s, 1, add_bwt_compressor(mhs_to_Ptr(s, 0))); }+from_t mhs_add_bwt_decompressor(int s) { return mhs_from_Ptr(s, 1, add_bwt_decompressor(mhs_to_Ptr(s, 0))); }+#endif /* WANT_BWT */++from_t mhs_calloc(int s) { return mhs_from_Ptr(s, 2, CALLOC(mhs_to_CSize(s, 0), mhs_to_CSize(s, 1))); }+from_t mhs_realloc(int s) { return mhs_from_Ptr(s, 2, REALLOC(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1))); }+from_t mhs_free(int s) { FREE(mhs_to_Ptr(s, 0)); return mhs_from_Unit(s, 1); }+from_t mhs_addr_free(int s) { return mhs_from_FunPtr(s, 0, (HsFunPtr)&FREE); }+from_t mhs_iswindows(int s) { return mhs_from_Int(s, 0, iswindows()); }+from_t mhs_ismacos(int s) { return mhs_from_Int(s, 0, ismacos()); }+from_t mhs_islinux(int s) { return mhs_from_Int(s, 0, islinux()); }+from_t mhs_ismingw(int s) { return mhs_from_Int(s, 0, ismingw()); }+from_t mhs_malloc(int s) { return mhs_from_Ptr(s, 1, MALLOC(mhs_to_CSize(s, 0))); }+from_t mhs_memcpy(int s) { memcpy(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_CSize(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_strlen(int s) { return mhs_from_CSize(s, 1, strlen(mhs_to_Ptr(s, 0))); }+from_t mhs_strcpy(int s) { strcpy(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_memmove(int s) { memmove(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_CSize(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_peekPtr(int s) { return mhs_from_Ptr(s, 1, peekPtr(mhs_to_Ptr(s, 0))); }+from_t mhs_peekWord(int s) { return mhs_from_Word(s, 1, peekWord(mhs_to_Ptr(s, 0))); }+from_t mhs_pokePtr(int s) { pokePtr(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_pokeWord(int s) { pokeWord(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }++from_t mhs_peek_uint8(int s) { return mhs_from_Word(s, 1, peek_uint8(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uint8(int s) { poke_uint8(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_uint16(int s) { return mhs_from_Word(s, 1, peek_uint16(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uint16(int s) { poke_uint16(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_uint32(int s) { return mhs_from_Word(s, 1, peek_uint32(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uint32(int s) { poke_uint32(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }+#if WANT_INT64+from_t mhs_peek_uint64(int s) { return mhs_from_Word64(s, 1, peek_uint64(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uint64(int s) { poke_uint64(mhs_to_Ptr(s, 0), mhs_to_Word64(s, 1)); return mhs_from_Unit(s, 2); }+#endif /* WANT_INT64 */++from_t mhs_peek_int8(int s) { return mhs_from_Int(s, 1, peek_int8(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_int8(int s) { poke_int8(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_int16(int s) { return mhs_from_Int(s, 1, peek_int16(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_int16(int s) { poke_int16(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_int32(int s) { return mhs_from_Int(s, 1, peek_int32(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_int32(int s) { poke_int32(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }+#if WANT_INT64+from_t mhs_peek_int64(int s) { return mhs_from_Int64(s, 1, peek_int64(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_int64(int s) { poke_int64(mhs_to_Ptr(s, 0), mhs_to_Int64(s, 1)); return mhs_from_Unit(s, 2); }+#endif /* WANT_INT64 */+from_t mhs_peek_char(int s) { return mhs_from_CChar(s, 1, peek_char(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_char(int s) { poke_char(mhs_to_Ptr(s, 0), mhs_to_CChar(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_schar(int s) { return mhs_from_CSChar(s, 1, peek_schar(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_schar(int s) { poke_schar(mhs_to_Ptr(s, 0), mhs_to_CSChar(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_uchar(int s) { return mhs_from_CUChar(s, 1, peek_uchar(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uchar(int s) { poke_uchar(mhs_to_Ptr(s, 0), mhs_to_CUChar(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_short(int s) { return mhs_from_CShort(s, 1, peek_short(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_short(int s) { poke_short(mhs_to_Ptr(s, 0), mhs_to_CShort(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_ushort(int s) { return mhs_from_CUShort(s, 1, peek_ushort(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_ushort(int s) { poke_ushort(mhs_to_Ptr(s, 0), mhs_to_CUShort(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_int(int s) { return mhs_from_CInt(s, 1, peek_int(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_int(int s) { poke_int(mhs_to_Ptr(s, 0), mhs_to_CInt(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_uint(int s) { return mhs_from_CUInt(s, 1, peek_uint(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_uint(int s) { poke_uint(mhs_to_Ptr(s, 0), mhs_to_CUInt(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_long(int s) { return mhs_from_CLong(s, 1, peek_long(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_long(int s) { poke_long(mhs_to_Ptr(s, 0), mhs_to_CLong(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_ulong(int s) { return mhs_from_CULong(s, 1, peek_ulong(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_ulong(int s) { poke_ulong(mhs_to_Ptr(s, 0), mhs_to_CULong(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_llong(int s) { return mhs_from_CLLong(s, 1, peek_llong(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_llong(int s) { poke_llong(mhs_to_Ptr(s, 0), mhs_to_CLLong(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_ullong(int s) { return mhs_from_CULLong(s, 1, peek_ullong(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_ullong(int s) { poke_ullong(mhs_to_Ptr(s, 0), mhs_to_CULLong(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_peek_size_t(int s) { return mhs_from_CSize(s, 1, peek_size_t(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_size_t(int s) { poke_size_t(mhs_to_Ptr(s, 0), mhs_to_CSize(s, 1)); return mhs_from_Unit(s, 2); }+#if WANT_FLOAT32+from_t mhs_peek_flt32(int s) { return mhs_from_Float(s, 1, peek_flt32(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_flt32(int s) { poke_flt32(mhs_to_Ptr(s, 0), mhs_to_Float(s, 1)); return mhs_from_Unit(s, 2); }+#endif /* WANT_FLOAT32 */+#if WANT_FLOAT64+from_t mhs_peek_flt64(int s) { return mhs_from_Double(s, 1, peek_flt64(mhs_to_Ptr(s, 0))); }+from_t mhs_poke_flt64(int s) { poke_flt64(mhs_to_Ptr(s, 0), mhs_to_Double(s, 1)); return mhs_from_Unit(s, 2); }+#endif /* WANT_FLOAT64 */+from_t mhs_sizeof_char(int s) { return mhs_from_Int(s, 0, sizeof(char)); }+from_t mhs_sizeof_short(int s) { return mhs_from_Int(s, 0, sizeof(short)); }+from_t mhs_sizeof_int(int s) { return mhs_from_Int(s, 0, sizeof(int)); }+from_t mhs_sizeof_llong(int s) { return mhs_from_Int(s, 0, sizeof(long long)); }+from_t mhs_sizeof_long(int s) { return mhs_from_Int(s, 0, sizeof(long)); }+from_t mhs_sizeof_size_t(int s) { return mhs_from_Int(s, 0, sizeof(size_t)); }+#if WANT_DIR+from_t mhs_closedir(int s) { return mhs_from_Int(s, 1, closedir(mhs_to_Ptr(s, 0))); }+from_t mhs_opendir(int s) { return mhs_from_Ptr(s, 1, opendir(mhs_to_Ptr(s, 0))); }+from_t mhs_readdir(int s) { return mhs_from_Ptr(s, 1, readdir(mhs_to_Ptr(s, 0))); }+from_t mhs_c_d_name(int s) { return mhs_from_Ptr(s, 1, ((struct dirent *)(mhs_to_Ptr(s, 0)))->d_name); }+from_t mhs_chdir(int s) { return mhs_from_Int(s, 1, chdir(mhs_to_Ptr(s, 0))); }+from_t mhs_mkdir(int s) { return mhs_from_Int(s, 2, MKDIR(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_getcwd(int s) { return mhs_from_Ptr(s, 2, getcwd(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_get_permissions(int s) { return mhs_from_Int(s, 1, get_permissions(mhs_to_Ptr(s, 0))); }+from_t mhs_set_permissions(int s) { return mhs_from_Int(s, 2, set_permissions(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_get_file_size(int s) { return mhs_from_Int64(s, 1, get_file_size(mhs_to_Ptr(s, 0))); }+#endif /* WANT_DIR */+from_t mhs_getcpu(int s) { GETCPUTIME(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+#if WANT_ENV+from_t mhs_getenv(int s) { return mhs_from_Ptr(s, 1, getenv(mhs_to_Ptr(s, 0))); }+from_t mhs_environ(int s) { return mhs_from_Ptr(s, 0, environ); }+from_t mhs_unsetenv(int s) { return mhs_from_Int(s, 1, unsetenv(mhs_to_Ptr(s, 0))); }+from_t mhs_setenv(int s) { return mhs_from_Int(s, 3, setenv(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }+#endif /* WANT_ENV */++/* Use this to detect if we have (and want) GMP/imath or not. */+from_t mhs_want_gmp(int s) { return mhs_from_Int(s, 0, WANT_GMP); }+from_t mhs_want_imath(int s) { return mhs_from_Int(s, 0, WANT_IMATH); }++#if WANT_GMP || WANT_IMATH+void+free_mpz(void *p)+{+ /* printf("free_mpz %p\n", p);*/+ mpz_clear(p); /* free any extra storage */+ FREE(p); /* and free the mpz itself */+}++/* Allocate an initialize a GMP integer */+struct forptr *+new_mpz(void)+{+#if 0+ {+ static int done = 0;+ if (!done) {+ printf("GMP\n");+ done = 1;+ }+ }+#endif+ mpz_ptr p = mmalloc(sizeof(*p));+ mpz_init(p);+ struct forptr *fp = mkForPtrP(p);+ fp->finalizer->final = (HsFunPtr)free_mpz;+ fp->finalizer->fptype = FP_MPZ;+ /* printf("new_mpz %p %p\n", p, fp); */+ return fp;+}++intptr_t+mpz_get_si_(mpz_t op)+{+ uintptr_t r = mpz_get_ui(op);+ if (mpz_sgn(op) < 0) {+ r = -r;+ }+ return (intptr_t)r;+}++#if 0+void+print_mpz(mpz_ptr p)+{+ mpz_out_str(stdout, 10, p);+}+#endif++#if WANT_INT64 && (WORD_SIZE < 64 || LONG_MAX < INT64_MAX)+/* GMP lacks 64 bit support on 32 bit platforms, and where long is 32 bits (LLP64) */+void+mpz_init_set_ui64(mpz_t rop, uint64_t op)+{+ mpz_init_set_ui(rop, op >> 32);+ mpz_mul_2exp(rop, rop, 32);+ mpz_add_ui(rop, rop, op & 0xffffffff);+}+void+mpz_init_set_si64(mpz_t rop, int64_t op)+{+ if (op >= 0) {+ mpz_init_set_ui64(rop, (uint64_t)op);+ } else {+ mpz_init_set_ui64(rop, -(uint64_t)op);+ mpz_neg(rop, rop);+ }+}+int64_t+mpz_get_si64(mpz_t op)+{+ mpz_t t;+ mpz_init_set(t, op);+ mpz_tdiv_q_2exp(t, t, 32);+ uint64_t hi = mpz_get_ui(t);+ uint64_t lo = mpz_get_ui(op);+ mpz_clear(t);+ uint64_t r = (hi << 32) | lo;+ if (mpz_sgn(op) < 0) {+ r = -r;+ }+ return r;+}+#endif /* WANT_INT64 */+#if WORD_SIZE == 64 && LONG_MAX >= INT64_MAX+#define mpz_init_set_ui64 mpz_init_set_ui+#define mpz_init_set_si64 mpz_init_set_si+#define mpz_get_si64 mpz_get_si_+#endif++from_t mhs_new_mpz(int s) { return mhs_from_ForPtr(s, 0, new_mpz()); }++/* Stubs for GMP functions */+from_t mhs_mpz_abs(int s) { mpz_abs(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_add(int s) { mpz_add(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_and(int s) { mpz_and(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_cmp(int s) { return mhs_from_Int(s, 2, mpz_cmp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }+#if WANT_FLOAT64+from_t mhs_mpz_get_d(int s) { return mhs_from_Double(s, 1, mpz_get_d(mhs_to_Ptr(s, 0))); }+#endif /* WANT_FLOAT64 */+#if WANT_FLOAT32+from_t mhs_mpz_get_f(int s) { return mhs_from_Float(s, 1, (float)mpz_get_d(mhs_to_Ptr(s, 0))); }+#endif /* WANT_FLOAT32 */+#if WANT_INT64 && WORD_SIZE == 64 && LONG_MAX < INT64_MAX+/* LLP64: Int and Word are wider than the long the GMP interface takes. */+from_t mhs_mpz_get_si(int s) { return mhs_from_Int(s, 1, mpz_get_si64(mhs_to_Ptr(s, 0))); }+from_t mhs_mpz_init_set_si(int s) { mpz_init_set_si64(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_init_set_ui(int s) { mpz_init_set_ui64(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }+#else+from_t mhs_mpz_get_si(int s) { return mhs_from_Int(s, 1, mpz_get_si_(mhs_to_Ptr(s, 0))); }+from_t mhs_mpz_init_set_si(int s) { mpz_init_set_si(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_init_set_ui(int s) { mpz_init_set_ui(mhs_to_Ptr(s, 0), mhs_to_Word(s, 1)); return mhs_from_Unit(s, 2); }+#endif+from_t mhs_mpz_ior(int s) { mpz_ior(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_mul(int s) { mpz_mul(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_mul_2exp(int s) { mpz_mul_2exp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_neg(int s) { mpz_neg(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_popcount(int s) {+ mpz_ptr a = mhs_to_Ptr(s, 0);+ from_t r;+ if (mpz_sgn(a) < 0) {+ mpz_t neg_a;+ mpz_init(neg_a);+ mpz_neg(neg_a, a);+ r = mhs_from_Int(s, 1, -mpz_popcount(neg_a));+ mpz_clear(neg_a);+ } else {+ r = mhs_from_Int(s, 1, mpz_popcount(a));+ }+ return r;+}+from_t mhs_mpz_sub(int s) { mpz_sub(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_fdiv_q_2exp(int s) { mpz_fdiv_q_2exp(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2)); return mhs_from_Unit(s, 3); }+from_t mhs_mpz_tdiv_qr(int s) { mpz_tdiv_qr(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2), mhs_to_Ptr(s, 3)); return mhs_from_Unit(s, 4); }+from_t mhs_mpz_tstbit(int s) { return mhs_from_Int(s, 2, mpz_tstbit(mhs_to_Ptr(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_mpz_xor(int s) { mpz_xor(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2)); return mhs_from_Unit(s, 3); }+#if WANT_INT64+from_t mhs_mpz_init_set_si64(int s) { mpz_init_set_si64(mhs_to_Ptr(s, 0), mhs_to_Int64(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_init_set_ui64(int s) { mpz_init_set_ui64(mhs_to_Ptr(s, 0), mhs_to_Word64(s, 1)); return mhs_from_Unit(s, 2); }+from_t mhs_mpz_get_si64(int s) { return mhs_from_Int64(s, 1, mpz_get_si64(mhs_to_Ptr(s, 0))); }+#endif /* WANT_INT64 */+from_t mhs_mpz_log2(int s) {+ mpz_ptr a = mhs_to_Ptr(s, 0);+ return mhs_from_Int(s, 1, mpz_sizeinbase(a, 2) - 1);+}+#endif /* WANT_GMP || WANT_IMATH */+#if WANT_TIME+from_t mhs_gettimeofday(int s) { return mhs_from_Int(s, 2, gettimeofday(mhs_to_Ptr(s, 0), mhs_to_Ptr(s, 1))); }+#endif+from_t mhs_get_executable_path(int s) { return mhs_from_Ptr(s, 0, get_executable_path()); }++#if WANT_SOCKET+#include <sys/socket.h>+from_t mhs_F_SETFL(int s) { return mhs_from_Int(s, 0, F_SETFL); }+from_t mhs_O_NONBLOCK(int s) { return mhs_from_Int(s, 0, O_NONBLOCK); }+from_t mhs_SOL_SOCKET(int s) { return mhs_from_Int(s, 0, SOL_SOCKET); }+from_t mhs_SO_DEBUG(int s) { return mhs_from_Int(s, 0, SO_DEBUG); }+from_t mhs_SO_ERROR(int s) { return mhs_from_Int(s, 0, SO_ERROR); }+from_t mhs_SO_REUSEADDR(int s) { return mhs_from_Int(s, 0, SO_REUSEADDR); }+from_t mhs_SO_TYPE(int s) { return mhs_from_Int(s, 0, SO_TYPE); }+from_t mhs_accept(int s) { return mhs_from_Int(s, 3, accept(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Ptr(s, 2))); }+from_t mhs_bind(int s) { return mhs_from_Int(s, 3, bind(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }+from_t mhs_close(int s) { return mhs_from_Int(s, 1, close(mhs_to_Int(s, 0))); }+from_t mhs_connect(int s) { return mhs_from_Int(s, 3, connect(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Int(s, 2))); }+from_t mhs_fcntl(int s) { return mhs_from_Int(s, 3, fcntl(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }+from_t mhs_getsockopt(int s) { return mhs_from_Int(s, 5, getsockopt(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2), mhs_to_Ptr(s, 3), mhs_to_Ptr(s, 4))); }+from_t mhs_listen(int s) { return mhs_from_Int(s, 2, listen(mhs_to_Int(s, 0), mhs_to_Int(s, 1))); }+from_t mhs_recv(int s) { return mhs_from_Int(s, 4, recv(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Word(s, 2), mhs_to_Int(s, 3))); }+from_t mhs_send(int s) { return mhs_from_Int(s, 4, send(mhs_to_Int(s, 0), mhs_to_Ptr(s, 1), mhs_to_Word(s, 2), mhs_to_Int(s, 3))); }+from_t mhs_setsockopt(int s) { return mhs_from_Int(s, 5, setsockopt(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2), mhs_to_Ptr(s, 3), mhs_to_Int(s, 4))); }+from_t mhs_socket(int s) { return mhs_from_Int(s, 3, socket(mhs_to_Int(s, 0), mhs_to_Int(s, 1), mhs_to_Int(s, 2))); }+#endif /* WANT_SOCKET */++const struct ffi_entry ffi_table[] = {+ { "GETRAW", 0, mhs_GETRAW},+ { "GETTIMEMICRO", 0, mhs_GETTIMEMICRO},+ { "GETBOOTTIMEMICRO", 0, mhs_GETBOOTTIMEMICRO},+#if WANT_MATH+#if WANT_FLOAT64+ { "acos", 1, mhs_acos},+ { "asin", 1, mhs_asin},+ { "atan", 1, mhs_atan},+ { "atan2", 2, mhs_atan2},+ { "cos", 1, mhs_cos},+ { "exp", 1, mhs_exp},+ { "log", 1, mhs_log},+ { "sin", 1, mhs_sin},+ { "sqrt", 1, mhs_sqrt},+ { "tan", 1, mhs_tan},+ { "scalbn", 2, mhs_scalbn},+ { "pow", 2, mhs_pow},+#endif /* WANT_FLOAT64 */+#if WANT_FLOAT32+ { "acosf", 1, mhs_acosf},+ { "asinf", 1, mhs_asinf},+ { "atanf", 1, mhs_atanf},+ { "atan2f", 2, mhs_atan2f},+ { "cosf", 1, mhs_cosf},+ { "expf", 1, mhs_expf},+ { "logf", 1, mhs_logf},+ { "sinf", 1, mhs_sinf},+ { "sqrtf", 1, mhs_sqrtf},+ { "tanf", 1, mhs_tanf},+ { "scalbnf", 2, mhs_scalbnf},+ { "powf", 2, mhs_powf},+#endif /* WANT_FLOAT32 */+#endif /* WANT_MATH */+#if WANT_FLOAT64+ { "poke_flt64", 2, mhs_poke_flt64 },+ { "peek_flt64", 1, mhs_peek_flt64 },+#endif /* WANT_FLOAT64 */+#if WANT_FLOAT32+ { "poke_flt32", 2, mhs_poke_flt32 },+ { "peek_flt32", 1, mhs_peek_flt32 },+#endif /* WANT_FLOAT32 */++#if defined(__EMSCRIPTEN__)+ { "js_debug", 1, mhs_js_debug},+ { "js_eval_run", 1, mhs_js_eval_run},+ { "js_eval_call", 1, mhs_js_eval_call},+ { "js_set_haskellCallback", 1, mhs_js_set_haskellCallback},+#endif++#if WANT_STDIO+ { "add_FILE", 1, mhs_add_FILE},+ { "putchar", 1, mhs_putchar},+ { "fopen", 2, mhs_fopen},+ { "tmpname", 2, mhs_tmpname},+ { "remove", 1, mhs_remove},+ { "system", 1, mhs_system},+#endif /* WANT_STDIO */+#if WANT_FD+ { "add_fd", 1, mhs_add_fd},+ { "open", 3, mhs_open},+#endif /* WANT_FD */+#if WANT_BUF+ { "add_buf", 2, mhs_add_buf},+#endif /* WANT_BUF */+#if WANT_CRLF+ { "add_crlf", 1, mhs_add_crlf},+#endif /* WANT_CRLF */+#if WANT_UTF8+ { "add_utf8", 1, mhs_add_utf8},+#endif /* WANT_UTF8 */+#if WANT_BASE64+ { "add_base64_encoder", 1, mhs_add_base64_encoder},+ { "add_base64_decoder", 1, mhs_add_base64_decoder},+#endif /* WANT_BASE64 */+ { "closeb", 1, mhs_closeb},+ { "&closeb", 0, mhs_addr_closeb},+ { "flushb", 1, mhs_flushb},+ { "getb", 1, mhs_getb},+ { "putb", 2, mhs_putb},+ { "ungetb", 2, mhs_ungetb},+ { "openb_wr_mem", 0, mhs_openwrmem},+ { "openb_rd_mem", 2, mhs_openrdmem},+ { "get_mem", 3, mhs_getmem},+ { "readb", 3, mhs_readb},+ { "writeb", 3, mhs_writeb},+ { "isattyb", 1, mhs_isattyb},+#if WANT_INT64+ { "filesizeb", 1, mhs_filesizeb},+#endif /* WANT_INT64 */++#if WANT_MD5+ { "md5Array", 3, mhs_md5Array},+ { "md5BFILE", 2, mhs_md5BFILE},+ { "md5String", 2, mhs_md5String},+#endif /* WANT_MD5 */++#if WANT_LZ77+ { "add_lz77_compressor", 1, mhs_add_lz77_compressor},+ { "add_lz77_decompressor", 1, mhs_add_lz77_decompressor},+ { "lz77c", 3, mhs_lz77c},+#endif /* WANT_LZ77 */++#if WANT_LZMA+ { "add_lzma_compressor", 1, mhs_add_lzma_compressor},+ { "add_lzma_decompressor", 1, mhs_add_lzma_decompressor},+#endif /* WANT_LZ77 */++#if WANT_RLE+ { "add_rle_compressor", 1, mhs_add_rle_compressor},+ { "add_rle_decompressor", 1, mhs_add_rle_decompressor},+#endif /* WANT_RLE */++#if WANT_BWT+ { "add_bwt_compressor", 1, mhs_add_bwt_compressor},+ { "add_bwt_decompressor", 1, mhs_add_bwt_decompressor},+#endif /* WANT_RLE */++ { "calloc", 2, mhs_calloc},+ { "realloc", 2, mhs_realloc},+ { "free", 1, mhs_free},+ { "&free", 0, mhs_addr_free},+ { "iswindows", 0, mhs_iswindows},+ { "ismacos", 0, mhs_ismacos},+ { "islinux", 0, mhs_islinux},+ { "ismingw", 0, mhs_ismingw},+ { "malloc", 1, mhs_malloc},+ { "memcpy", 3, mhs_memcpy},+ { "memmove", 3, mhs_memmove},+ { "strlen", 1, mhs_strlen},+ { "strcpy", 2, mhs_strcpy},+ { "peekPtr", 1, mhs_peekPtr},+ { "peekWord", 1, mhs_peekWord},+ { "pokePtr", 2, mhs_pokePtr},+ { "pokeWord", 2, mhs_pokeWord},++ { "peek_uint8", 1, mhs_peek_uint8},+ { "poke_uint8", 2, mhs_poke_uint8},+ { "peek_uint16", 1, mhs_peek_uint16},+ { "poke_uint16", 2, mhs_poke_uint16},+ { "peek_uint32", 1, mhs_peek_uint32},+ { "poke_uint32", 2, mhs_poke_uint32},+#if WANT_INT64+ { "peek_uint64", 1, mhs_peek_uint64},+ { "poke_uint64", 2, mhs_poke_uint64},+#endif /* WANT_INT64 */+ { "peek_uint", 1, mhs_peek_uint},+ { "poke_uint", 2, mhs_poke_uint},++ { "peek_int8", 1, mhs_peek_int8},+ { "poke_int8", 2, mhs_poke_int8},+ { "peek_int16", 1, mhs_peek_int16},+ { "poke_int16", 2, mhs_poke_int16},+ { "peek_int32", 1, mhs_peek_int32},+ { "poke_int32", 2, mhs_poke_int32},+#if WANT_INT64+ { "peek_int64", 1, mhs_peek_int64},+ { "poke_int64", 2, mhs_poke_int64},+#endif /* WANT_INT64 */+ { "peek_int", 1, mhs_peek_int},+ { "poke_int", 2, mhs_poke_int},+ { "peek_char", 1, mhs_peek_char},+ { "poke_char", 2, mhs_poke_char},+ { "peek_schar", 1, mhs_peek_schar},+ { "poke_schar", 2, mhs_poke_schar},+ { "peek_uchar", 1, mhs_peek_uchar},+ { "poke_uchar", 2, mhs_poke_uchar},+ { "peek_short", 1, mhs_peek_short},+ { "poke_short", 2, mhs_poke_short},+ { "peek_ushort", 1, mhs_peek_ushort},+ { "poke_ushort", 2, mhs_poke_ushort},+ { "peek_llong", 1, mhs_peek_llong},+ { "peek_long", 1, mhs_peek_long},+ { "peek_ullong", 1, mhs_peek_ullong},+ { "peek_ulong", 1, mhs_peek_ulong},+ { "peek_size_t", 1, mhs_peek_size_t},+ { "poke_llong", 2, mhs_poke_llong},+ { "poke_long", 2, mhs_poke_long},+ { "poke_ullong", 2, mhs_poke_ullong},+ { "poke_ulong", 2, mhs_poke_ulong},+ { "poke_size_t", 2, mhs_poke_size_t},+ { "sizeof_char", 0, mhs_sizeof_char},+ { "sizeof_short", 0, mhs_sizeof_short},+ { "sizeof_int", 0, mhs_sizeof_int},+ { "sizeof_llong", 0, mhs_sizeof_llong},+ { "sizeof_long", 0, mhs_sizeof_long},+ { "sizeof_size_t", 0, mhs_sizeof_size_t},+#if WANT_DIR+ { "c_d_name", 1, mhs_c_d_name},+ { "closedir", 1, mhs_closedir},+ { "opendir", 1, mhs_opendir},+ { "readdir", 1, mhs_readdir},+ { "chdir", 1, mhs_chdir},+ { "mkdir", 2, mhs_mkdir},+ { "getcwd", 2, mhs_getcwd},+ { "set_permissions", 2, mhs_set_permissions},+ { "get_permissions", 1, mhs_get_permissions},+ { "get_file_size", 1, mhs_get_file_size},+#endif /* WANT_DIR */+ { "getcpu", 2, mhs_getcpu},+ { "want_gmp", 0, mhs_want_gmp},+ { "want_imath", 0, mhs_want_imath},+#if WANT_GMP || WANT_IMATH+ { "new_mpz", 0, mhs_new_mpz},+ { "mpz_abs", 2, mhs_mpz_abs},+ { "mpz_add", 3, mhs_mpz_add},+ { "mpz_and", 3, mhs_mpz_and},+ { "mpz_cmp", 2, mhs_mpz_cmp},+#if WANT_FLOAT64+ { "mpz_get_d", 1, mhs_mpz_get_d},+#endif /* WANT_FLOAT64 */+ { "mpz_get_si", 1, mhs_mpz_get_si},+ { "mpz_init_set_si", 2, mhs_mpz_init_set_si},+ { "mpz_init_set_ui", 2, mhs_mpz_init_set_ui},+ { "mpz_ior", 3, mhs_mpz_ior},+ { "mpz_mul", 3, mhs_mpz_mul},+ { "mpz_mul_2exp", 3, mhs_mpz_mul_2exp},+ { "mpz_neg", 2, mhs_mpz_neg},+ { "mpz_popcount", 1, mhs_mpz_popcount},+ { "mpz_sub", 3, mhs_mpz_sub},+ { "mpz_fdiv_q_2exp", 3, mhs_mpz_fdiv_q_2exp},+ { "mpz_tdiv_qr", 4, mhs_mpz_tdiv_qr},+ { "mpz_tstbit", 2, mhs_mpz_tstbit},+ { "mpz_xor", 3, mhs_mpz_xor},+#if WANT_FLOAT32+ { "mpz_get_f", 1, mhs_mpz_get_f},+#endif /* WANT_FLOAT32 */+#if WANT_INT64+ { "mpz_init_set_si64", 2, mhs_mpz_init_set_si64},+ { "mpz_init_set_ui64", 2, mhs_mpz_init_set_ui64},+ { "mpz_get_si64", 1, mhs_mpz_get_si64},+#endif /* WANT_INT64 */+ { "mpz_log2", 1, mhs_mpz_log2},+#endif /* WANT_GMP || WANT_IMATH */+#if WANT_TIME+ { "gettimeofday", 2, mhs_gettimeofday},+#endif+#if WANT_ERRNO+ { "E2BIG", 0, mhs_E2BIG},+ { "EACCES", 0, mhs_EACCES},+ { "EADDRINUSE", 0, mhs_EADDRINUSE},+ { "EADDRNOTAVAIL", 0, mhs_EADDRNOTAVAIL},+ { "EADV", 0, mhs_EADV},+ { "EAFNOSUPPORT", 0, mhs_EAFNOSUPPORT},+ { "EAGAIN", 0, mhs_EAGAIN},+ { "EALREADY", 0, mhs_EALREADY},+ { "EBADF", 0, mhs_EBADF},+ { "EBADMSG", 0, mhs_EBADMSG},+ { "EBADRPC", 0, mhs_EBADRPC},+ { "EBUSY", 0, mhs_EBUSY},+ { "ECHILD", 0, mhs_ECHILD},+ { "ECOMM", 0, mhs_ECOMM},+ { "ECONNABORTED", 0, mhs_ECONNABORTED},+ { "ECONNREFUSED", 0, mhs_ECONNREFUSED},+ { "ECONNRESET", 0, mhs_ECONNRESET},+ { "EDEADLK", 0, mhs_EDEADLK},+ { "EDESTADDRREQ", 0, mhs_EDESTADDRREQ},+ { "EDIRTY", 0, mhs_EDIRTY},+ { "EDOM", 0, mhs_EDOM},+ { "EDQUOT", 0, mhs_EDQUOT},+ { "EEXIST", 0, mhs_EEXIST},+ { "EFAULT", 0, mhs_EFAULT},+ { "EFBIG", 0, mhs_EFBIG},+ { "EFTYPE", 0, mhs_EFTYPE},+ { "EHOSTDOWN", 0, mhs_EHOSTDOWN},+ { "EHOSTUNREACH", 0, mhs_EHOSTUNREACH},+ { "EIDRM", 0, mhs_EIDRM},+ { "EILSEQ", 0, mhs_EILSEQ},+ { "EINPROGRESS", 0, mhs_EINPROGRESS},+ { "EINTR", 0, mhs_EINTR},+ { "EINVAL", 0, mhs_EINVAL},+ { "EIO", 0, mhs_EIO},+ { "EISCONN", 0, mhs_EISCONN},+ { "EISDIR", 0, mhs_EISDIR},+ { "ELOOP", 0, mhs_ELOOP},+ { "EMFILE", 0, mhs_EMFILE},+ { "EMLINK", 0, mhs_EMLINK},+ { "EMSGSIZE", 0, mhs_EMSGSIZE},+ { "EMULTIHOP", 0, mhs_EMULTIHOP},+ { "ENAMETOOLONG", 0, mhs_ENAMETOOLONG},+ { "ENETDOWN", 0, mhs_ENETDOWN},+ { "ENETRESET", 0, mhs_ENETRESET},+ { "ENETUNREACH", 0, mhs_ENETUNREACH},+ { "ENFILE", 0, mhs_ENFILE},+ { "ENOBUFS", 0, mhs_ENOBUFS},+ { "ENODATA", 0, mhs_ENODATA},+ { "ENODEV", 0, mhs_ENODEV},+ { "ENOENT", 0, mhs_ENOENT},+ { "ENOEXEC", 0, mhs_ENOEXEC},+ { "ENOLCK", 0, mhs_ENOLCK},+ { "ENOLINK", 0, mhs_ENOLINK},+ { "ENOMEM", 0, mhs_ENOMEM},+ { "ENOMSG", 0, mhs_ENOMSG},+ { "ENONET", 0, mhs_ENONET},+ { "ENOPROTOOPT", 0, mhs_ENOPROTOOPT},+ { "ENOSPC", 0, mhs_ENOSPC},+ { "ENOSR", 0, mhs_ENOSR},+ { "ENOSTR", 0, mhs_ENOSTR},+ { "ENOSYS", 0, mhs_ENOSYS},+ { "ENOTBLK", 0, mhs_ENOTBLK},+ { "ENOTCONN", 0, mhs_ENOTCONN},+ { "ENOTDIR", 0, mhs_ENOTDIR},+ { "ENOTEMPTY", 0, mhs_ENOTEMPTY},+ { "ENOTSOCK", 0, mhs_ENOTSOCK},+ { "ENOTSUP", 0, mhs_ENOTSUP},+ { "ENOTTY", 0, mhs_ENOTTY},+ { "ENXIO", 0, mhs_ENXIO},+ { "EOPNOTSUPP", 0, mhs_EOPNOTSUPP},+ { "EPERM", 0, mhs_EPERM},+ { "EPFNOSUPPORT", 0, mhs_EPFNOSUPPORT},+ { "EPIPE", 0, mhs_EPIPE},+ { "EPROCLIM", 0, mhs_EPROCLIM},+ { "EPROCUNAVAIL", 0, mhs_EPROCUNAVAIL},+ { "EPROGMISMATCH", 0, mhs_EPROGMISMATCH},+ { "EPROGUNAVAIL", 0, mhs_EPROGUNAVAIL},+ { "EPROTO", 0, mhs_EPROTO},+ { "EPROTONOSUPPORT", 0, mhs_EPROTONOSUPPORT},+ { "EPROTOTYPE", 0, mhs_EPROTOTYPE},+ { "ERANGE", 0, mhs_ERANGE},+ { "EREMCHG", 0, mhs_EREMCHG},+ { "EREMOTE", 0, mhs_EREMOTE},+ { "EROFS", 0, mhs_EROFS},+ { "ERPCMISMATCH", 0, mhs_ERPCMISMATCH},+ { "ERREMOTE", 0, mhs_ERREMOTE},+ { "ESHUTDOWN", 0, mhs_ESHUTDOWN},+ { "ESOCKTNOSUPPORT", 0, mhs_ESOCKTNOSUPPORT},+ { "ESPIPE", 0, mhs_ESPIPE},+ { "ESRCH", 0, mhs_ESRCH},+ { "ESRMNT", 0, mhs_ESRMNT},+ { "ESTALE", 0, mhs_ESTALE},+ { "ETIME", 0, mhs_ETIME},+ { "ETIMEDOUT", 0, mhs_ETIMEDOUT},+ { "ETOOMANYREFS", 0, mhs_ETOOMANYREFS},+ { "ETXTBSY", 0, mhs_ETXTBSY},+ { "EUSERS", 0, mhs_EUSERS},+ { "EWOULDBLOCK", 0, mhs_EWOULDBLOCK},+ { "EXDEV", 0, mhs_EXDEV},+ { "&errno", 0, mhs_addr_errno},+ { "strerror_r", 3, mhs_strerror_r},+#endif+ { "get_executable_path", 0, mhs_get_executable_path},+#if WANT_ENV+ { "getenv", 1, mhs_getenv},+ { "environ", 0, mhs_environ},+ { "unsetenv", 1, mhs_unsetenv},+ { "setenv", 3, mhs_setenv},+#endif /* WANT_ENV */+#if WANT_SOCKET+ { "F_SETFL", 0, mhs_F_SETFL},+ { "O_NONBLOCK", 0, mhs_O_NONBLOCK},+ { "SOL_SOCKET", 0, mhs_SOL_SOCKET},+ { "SO_DEBUG", 0, mhs_SO_DEBUG},+ { "SO_ERROR", 0, mhs_SO_ERROR},+ { "SO_REUSEADDR", 0, mhs_SO_REUSEADDR},+ { "SO_TYPE", 0, mhs_SO_TYPE},+ { "accept", 3, mhs_accept},+ { "bind", 3, mhs_bind},+ { "close", 1, mhs_close},+ { "connect", 3, mhs_connect},+ { "fcntl", 3, mhs_fcntl},+ { "getsockopt", 5, mhs_getsockopt},+ { "listen", 2, mhs_listen},+ { "recv", 4, mhs_recv},+ { "send", 4, mhs_send},+ { "setsockopt", 5, mhs_setsockopt},+ { "socket", 3, mhs_socket},+#endif /* WANT_SOCKET */+ { 0,0 }+};++int num_ffi = sizeof(ffi_table) / sizeof(ffi_table[0]);++++/*******************************/+/* HsFFI.h API */++void+hs_init(int *argc, char **argv[])+{+ (void)mhs_main(*argc, *argv);+}++void+hs_exit(void)+{+ extern void _exit(int); /* XXX why do we need this */ _exit(0); }
@@ -0,0 +1,2740 @@+/*+ Name: imath.c+ Purpose: Arbitrary precision integer arithmetic routines.+ Author: M. J. Fromberger++ Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.+ */++#include "imath.h"++#include <assert.h>+#include <ctype.h>+#include <stdlib.h>+#include <string.h>++#define USE_IMATH_INTERNAL_TEMP_MACROS+#include "macros.c" // for temp value handling++const mp_result MP_OK = 0; /* no error, all is well */+const mp_result MP_FALSE = 0; /* boolean false */+const mp_result MP_TRUE = -1; /* boolean true */+const mp_result MP_MEMORY = -2; /* out of memory */+const mp_result MP_RANGE = -3; /* argument out of range */+const mp_result MP_UNDEF = -4; /* result undefined */+const mp_result MP_TRUNC = -5; /* output truncated */+const mp_result MP_BADARG = -6; /* invalid null argument */+const mp_result MP_MINERR = -6;++const mp_sign MP_NEG = 1; /* value is strictly negative */+const mp_sign MP_ZPOS = 0; /* value is non-negative */++static const char* const s_unknown_err = "unknown result code";+static const char* const s_error_msg[] = {+ "error code 0", "boolean true",+ "out of memory", "argument out of range",+ "result undefined", "output truncated",+ "invalid argument", NULL,+};++/* The ith entry of this table gives the value of log_i(2).++ An integer value n requires ceil(log_i(n)) digits to be represented+ in base i. Since it is easy to compute lg(n), by counting bits, we+ can compute log_i(n) = lg(n) * log_i(2).++ The use of this table eliminates a dependency upon linkage against+ the standard math libraries.++ If MP_MAX_RADIX is increased, this table should be expanded too.+ */+static const double s_log2[] = {+ 0.000000000, 0.000000000, 1.000000000, 0.630929754, /* (D)(D) 2 3 */+ 0.500000000, 0.430676558, 0.386852807, 0.356207187, /* 4 5 6 7 */+ 0.333333333, 0.315464877, 0.301029996, 0.289064826, /* 8 9 10 11 */+ 0.278942946, 0.270238154, 0.262649535, 0.255958025, /* 12 13 14 15 */+ 0.250000000, 0.244650542, 0.239812467, 0.235408913, /* 16 17 18 19 */+ 0.231378213, 0.227670249, 0.224243824, 0.221064729, /* 20 21 22 23 */+ 0.218104292, 0.215338279, 0.212746054, 0.210309918, /* 24 25 26 27 */+ 0.208014598, 0.205846832, 0.203795047, 0.201849087, /* 28 29 30 31 */+ 0.200000000, 0.198239863, 0.196561632, 0.194959022, /* 32 33 34 35 */+ 0.193426404, /* 36 */+};++/* Return the number of digits needed to represent a static value */+#define MP_VALUE_DIGITS(V) \+ ((sizeof(V) + (sizeof(mp_digit) - 1)) / sizeof(mp_digit))++/* Round precision P to nearest word boundary */+static inline mp_size s_round_prec(mp_size P) { return 2 * ((P + 1) / 2); }++/* Set array P of S digits to zero */+static inline void ZERO(mp_digit* P, mp_size S) {+ mp_size i__ = S * sizeof(mp_digit);+ mp_digit* p__ = P;+ memset(p__, 0, i__);+}++/* Copy S digits from array P to array Q */+static inline void COPY(mp_digit* P, mp_digit* Q, mp_size S) {+ mp_size i__ = S * sizeof(mp_digit);+ mp_digit* p__ = P;+ mp_digit* q__ = Q;+ memcpy(q__, p__, i__);+}++/* Reverse N elements of unsigned char in A. */+static inline void REV(unsigned char* A, int N) {+ unsigned char* u_ = A;+ unsigned char* v_ = u_ + N - 1;+ while (u_ < v_) {+ unsigned char xch = *u_;+ *u_++ = *v_;+ *v_-- = xch;+ }+}++/* Strip leading zeroes from z_ in-place. */+static inline void CLAMP(mp_int z_) {+ mp_size uz_ = MP_USED(z_);+ mp_digit* dz_ = MP_DIGITS(z_) + uz_ - 1;+ while (uz_ > 1 && (*dz_-- == 0)) --uz_;+ z_->used = uz_;+}++/* Select min/max. */+static inline int MIN(int A, int B) { return (B < A ? B : A); }+static inline mp_size MAX(mp_size A, mp_size B) { return (B > A ? B : A); }++/* Exchange lvalues A and B of type T, e.g.+ SWAP(int, x, y) where x and y are variables of type int. */+#define SWAP(T, A, B) \+ do { \+ T t_ = (A); \+ A = (B); \+ B = t_; \+ } while (0)++/* Compare value to zero. */+static inline int CMPZ(mp_int Z) {+ if (Z->used == 1 && Z->digits[0] == 0) return 0;+ return (Z->sign == MP_NEG) ? -1 : 1;+}++static inline mp_word UPPER_HALF(mp_word W) { return (W >> MP_DIGIT_BIT); }+static inline mp_digit LOWER_HALF(mp_word W) { return (mp_digit)(W); }++/* Report whether the highest-order bit of W is 1. */+static inline bool HIGH_BIT_SET(mp_word W) {+ return (W >> (MP_WORD_BIT - 1)) != 0;+}++/* Report whether adding W + V will carry out. */+static inline bool ADD_WILL_OVERFLOW(mp_word W, mp_word V) {+ return ((MP_WORD_MAX - V) < W);+}++/* Default number of digits allocated to a new mp_int */+static mp_size default_precision = 8;++void mp_int_default_precision(mp_size size) {+ assert(size > 0);+ default_precision = size;+}++/* Minimum number of digits to invoke recursive multiply */+static mp_size multiply_threshold = 32;++void mp_int_multiply_threshold(mp_size thresh) {+ assert(thresh >= sizeof(mp_word));+ multiply_threshold = thresh;+}++/* Allocate a buffer of (at least) num digits, or return+ NULL if that couldn't be done. */+static mp_digit* s_alloc(mp_size num);++/* Release a buffer of digits allocated by s_alloc(). */+static void s_free(void* ptr);++/* Insure that z has at least min digits allocated, resizing if+ necessary. Returns true if successful, false if out of memory. */+static bool s_pad(mp_int z, mp_size min);++/* Ensure Z has at least N digits allocated. */+static inline mp_result GROW(mp_int Z, mp_size N) {+ return s_pad(Z, N) ? MP_OK : MP_MEMORY;+}++/* Fill in a "fake" mp_int on the stack with a given value */+static void s_fake(mp_int z, mp_small value, mp_digit vbuf[]);+static void s_ufake(mp_int z, mp_usmall value, mp_digit vbuf[]);++/* Compare two runs of digits of given length, returns <0, 0, >0 */+static int s_cdig(mp_digit* da, mp_digit* db, mp_size len);++/* Pack the unsigned digits of v into array t */+static int s_uvpack(mp_usmall v, mp_digit t[]);++/* Compare magnitudes of a and b, returns <0, 0, >0 */+static int s_ucmp(mp_int a, mp_int b);++/* Compare magnitudes of a and v, returns <0, 0, >0 */+static int s_vcmp(mp_int a, mp_small v);+static int s_uvcmp(mp_int a, mp_usmall uv);++/* Unsigned magnitude addition; assumes dc is big enough.+ Carry out is returned (no memory allocated). */+static mp_digit s_uadd(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b);++/* Unsigned magnitude subtraction. Assumes dc is big enough. */+static void s_usub(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b);++/* Unsigned recursive multiplication. Assumes dc is big enough. */+static int s_kmul(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b);++/* Unsigned magnitude multiplication. Assumes dc is big enough. */+static void s_umul(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b);++/* Unsigned recursive squaring. Assumes dc is big enough. */+static int s_ksqr(mp_digit* da, mp_digit* dc, mp_size size_a);++/* Unsigned magnitude squaring. Assumes dc is big enough. */+static void s_usqr(mp_digit* da, mp_digit* dc, mp_size size_a);++/* Single digit addition. Assumes a is big enough. */+static void s_dadd(mp_int a, mp_digit b);++/* Single digit multiplication. Assumes a is big enough. */+static void s_dmul(mp_int a, mp_digit b);++/* Single digit multiplication on buffers; assumes dc is big enough. */+static void s_dbmul(mp_digit* da, mp_digit b, mp_digit* dc, mp_size size_a);++/* Single digit division. Replaces a with the quotient,+ returns the remainder. */+static mp_digit s_ddiv(mp_int a, mp_digit b);++/* Quick division by a power of 2, replaces z (no allocation) */+static void s_qdiv(mp_int z, mp_size p2);++/* Quick remainder by a power of 2, replaces z (no allocation) */+static void s_qmod(mp_int z, mp_size p2);++/* Quick multiplication by a power of 2, replaces z.+ Allocates if necessary; returns false in case this fails. */+static int s_qmul(mp_int z, mp_size p2);++/* Quick subtraction from a power of 2, replaces z.+ Allocates if necessary; returns false in case this fails. */+static int s_qsub(mp_int z, mp_size p2);++/* Return maximum k such that 2^k divides z. */+static int s_dp2k(mp_int z);++/* Return k >= 0 such that z = 2^k, or -1 if there is no such k. */+static int s_isp2(mp_int z);++/* Set z to 2^k. May allocate; returns false in case this fails. */+static int s_2expt(mp_int z, mp_small k);++/* Normalize a and b for division, returns normalization constant */+static int s_norm(mp_int a, mp_int b);++/* Compute constant mu for Barrett reduction, given modulus m, result+ replaces z, m is untouched. */+static mp_result s_brmu(mp_int z, mp_int m);++/* Reduce a modulo m, using Barrett's algorithm. */+static int s_reduce(mp_int x, mp_int m, mp_int mu, mp_int q1, mp_int q2);++/* Modular exponentiation, using Barrett reduction */+static mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c);++/* Unsigned magnitude division. Assumes |a| > |b|. Allocates temporaries;+ overwrites a with quotient, b with remainder. */+static mp_result s_udiv_knuth(mp_int a, mp_int b);++/* Compute the number of digits in radix r required to represent the given+ value. Does not account for sign flags, terminators, etc. */+static int s_outlen(mp_int z, mp_size r);++/* Guess how many digits of precision will be needed to represent a radix r+ value of the specified number of digits. Returns a value guaranteed to be+ no smaller than the actual number required. */+static mp_size s_inlen(int len, mp_size r);++/* Convert a character to a digit value in radix r, or+ -1 if out of range */+static int s_ch2val(char c, int r);++/* Convert a digit value to a character */+static char s_val2ch(int v, int caps);++/* Take 2's complement of a buffer in place */+static void s_2comp(unsigned char* buf, int len);++/* Convert a value to binary, ignoring sign. On input, *limpos is the bound on+ how many bytes should be written to buf; on output, *limpos is set to the+ number of bytes actually written. */+static mp_result s_tobin(mp_int z, unsigned char* buf, int* limpos, int pad);++/* Multiply X by Y into Z, ignoring signs. Requires that Z have enough storage+ preallocated to hold the result. */+static inline void UMUL(mp_int X, mp_int Y, mp_int Z) {+ mp_size ua_ = MP_USED(X);+ mp_size ub_ = MP_USED(Y);+ mp_size o_ = ua_ + ub_;+ ZERO(MP_DIGITS(Z), o_);+ (void)s_kmul(MP_DIGITS(X), MP_DIGITS(Y), MP_DIGITS(Z), ua_, ub_);+ Z->used = o_;+ CLAMP(Z);+}++/* Square X into Z. Requires that Z have enough storage to hold the result. */+static inline void USQR(mp_int X, mp_int Z) {+ mp_size ua_ = MP_USED(X);+ mp_size o_ = ua_ + ua_;+ ZERO(MP_DIGITS(Z), o_);+ (void)s_ksqr(MP_DIGITS(X), MP_DIGITS(Z), ua_);+ Z->used = o_;+ CLAMP(Z);+}++mp_result mp_int_init(mp_int z) {+ if (z == NULL) return MP_BADARG;++ z->single = 0;+ z->digits = &(z->single);+ z->alloc = 1;+ z->used = 1;+ z->sign = MP_ZPOS;++ return MP_OK;+}++mp_int mp_int_alloc(void) {+ mp_int out = malloc(sizeof(mpz_t));++ if (out != NULL) mp_int_init(out);++ return out;+}++mp_result mp_int_init_size(mp_int z, mp_size prec) {+ assert(z != NULL);++ if (prec == 0) {+ prec = default_precision;+ } else if (prec == 1) {+ return mp_int_init(z);+ } else {+ prec = s_round_prec(prec);+ }++ z->digits = s_alloc(prec);+ if (MP_DIGITS(z) == NULL) return MP_MEMORY;++ z->digits[0] = 0;+ z->used = 1;+ z->alloc = prec;+ z->sign = MP_ZPOS;++ return MP_OK;+}++mp_result mp_int_init_copy(mp_int z, mp_int old) {+ assert(z != NULL && old != NULL);++ mp_size uold = MP_USED(old);+ if (uold == 1) {+ mp_int_init(z);+ } else {+ mp_size target = MAX(uold, default_precision);+ mp_result res = mp_int_init_size(z, target);+ if (res != MP_OK) return res;+ }++ z->used = uold;+ z->sign = old->sign;+ COPY(MP_DIGITS(old), MP_DIGITS(z), uold);++ return MP_OK;+}++mp_result mp_int_init_value(mp_int z, mp_small value) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);+ return mp_int_init_copy(z, &vtmp);+}++mp_result mp_int_init_uvalue(mp_int z, mp_usmall uvalue) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(uvalue)];++ s_ufake(&vtmp, uvalue, vbuf);+ return mp_int_init_copy(z, &vtmp);+}++mp_result mp_int_set_value(mp_int z, mp_small value) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);+ return mp_int_copy(&vtmp, z);+}++mp_result mp_int_set_uvalue(mp_int z, mp_usmall uvalue) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(uvalue)];++ s_ufake(&vtmp, uvalue, vbuf);+ return mp_int_copy(&vtmp, z);+}++void mp_int_clear(mp_int z) {+ if (z == NULL) return;++ if (MP_DIGITS(z) != NULL) {+ if (MP_DIGITS(z) != &(z->single)) s_free(MP_DIGITS(z));++ z->digits = NULL;+ }+}++void mp_int_free(mp_int z) {+ assert(z != NULL);++ mp_int_clear(z);+ free(z); /* note: NOT s_free() */+}++mp_result mp_int_copy(mp_int a, mp_int c) {+ assert(a != NULL && c != NULL);++ if (a != c) {+ mp_size ua = MP_USED(a);+ mp_digit *da, *dc;++ if (!s_pad(c, ua)) return MP_MEMORY;++ da = MP_DIGITS(a);+ dc = MP_DIGITS(c);+ COPY(da, dc, ua);++ c->used = ua;+ c->sign = a->sign;+ }++ return MP_OK;+}++void mp_int_swap(mp_int a, mp_int c) {+ if (a != c) {+ mpz_t tmp = *a;++ *a = *c;+ *c = tmp;++ if (MP_DIGITS(a) == &(c->single)) a->digits = &(a->single);+ if (MP_DIGITS(c) == &(a->single)) c->digits = &(c->single);+ }+}++void mp_int_zero(mp_int z) {+ assert(z != NULL);++ z->digits[0] = 0;+ z->used = 1;+ z->sign = MP_ZPOS;+}++mp_result mp_int_abs(mp_int a, mp_int c) {+ assert(a != NULL && c != NULL);++ mp_result res;+ if ((res = mp_int_copy(a, c)) != MP_OK) return res;++ c->sign = MP_ZPOS;+ return MP_OK;+}++mp_result mp_int_neg(mp_int a, mp_int c) {+ assert(a != NULL && c != NULL);++ mp_result res;+ if ((res = mp_int_copy(a, c)) != MP_OK) return res;++ if (CMPZ(c) != 0) c->sign = 1 - MP_SIGN(a);++ return MP_OK;+}++mp_result mp_int_add(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);++ mp_size ua = MP_USED(a);+ mp_size ub = MP_USED(b);+ mp_size max = MAX(ua, ub);++ if (MP_SIGN(a) == MP_SIGN(b)) {+ /* Same sign -- add magnitudes, preserve sign of addends */+ if (!s_pad(c, max)) return MP_MEMORY;++ mp_digit carry = s_uadd(MP_DIGITS(a), MP_DIGITS(b), MP_DIGITS(c), ua, ub);+ mp_size uc = max;++ if (carry) {+ if (!s_pad(c, max + 1)) return MP_MEMORY;++ c->digits[max] = carry;+ ++uc;+ }++ c->used = uc;+ c->sign = a->sign;++ } else {+ /* Different signs -- subtract magnitudes, preserve sign of greater */+ int cmp = s_ucmp(a, b); /* magnitude comparison, sign ignored */++ /* Set x to max(a, b), y to min(a, b) to simplify later code.+ A special case yields zero for equal magnitudes.+ */+ mp_int x, y;+ if (cmp == 0) {+ mp_int_zero(c);+ return MP_OK;+ } else if (cmp < 0) {+ x = b;+ y = a;+ } else {+ x = a;+ y = b;+ }++ if (!s_pad(c, MP_USED(x))) return MP_MEMORY;++ /* Subtract smaller from larger */+ s_usub(MP_DIGITS(x), MP_DIGITS(y), MP_DIGITS(c), MP_USED(x), MP_USED(y));+ c->used = x->used;+ CLAMP(c);++ /* Give result the sign of the larger */+ c->sign = x->sign;+ }++ return MP_OK;+}++mp_result mp_int_add_value(mp_int a, mp_small value, mp_int c) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);++ return mp_int_add(a, &vtmp, c);+}++mp_result mp_int_sub(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);++ mp_size ua = MP_USED(a);+ mp_size ub = MP_USED(b);+ mp_size max = MAX(ua, ub);++ if (MP_SIGN(a) != MP_SIGN(b)) {+ /* Different signs -- add magnitudes and keep sign of a */+ if (!s_pad(c, max)) return MP_MEMORY;++ mp_digit carry = s_uadd(MP_DIGITS(a), MP_DIGITS(b), MP_DIGITS(c), ua, ub);+ mp_size uc = max;++ if (carry) {+ if (!s_pad(c, max + 1)) return MP_MEMORY;++ c->digits[max] = carry;+ ++uc;+ }++ c->used = uc;+ c->sign = a->sign;++ } else {+ /* Same signs -- subtract magnitudes */+ if (!s_pad(c, max)) return MP_MEMORY;+ mp_int x, y;+ mp_sign osign;++ int cmp = s_ucmp(a, b);+ if (cmp >= 0) {+ x = a;+ y = b;+ osign = MP_ZPOS;+ } else {+ x = b;+ y = a;+ osign = MP_NEG;+ }++ if (MP_SIGN(a) == MP_NEG && cmp != 0) osign = 1 - osign;++ s_usub(MP_DIGITS(x), MP_DIGITS(y), MP_DIGITS(c), MP_USED(x), MP_USED(y));+ c->used = x->used;+ CLAMP(c);++ c->sign = osign;+ }++ return MP_OK;+}++mp_result mp_int_sub_value(mp_int a, mp_small value, mp_int c) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);++ return mp_int_sub(a, &vtmp, c);+}++mp_result mp_int_mul(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);++ /* If either input is zero, we can shortcut multiplication */+ if (mp_int_compare_zero(a) == 0 || mp_int_compare_zero(b) == 0) {+ mp_int_zero(c);+ return MP_OK;+ }++ /* Output is positive if inputs have same sign, otherwise negative */+ mp_sign osign = (MP_SIGN(a) == MP_SIGN(b)) ? MP_ZPOS : MP_NEG;++ /* If the output is not identical to any of the inputs, we'll write the+ results directly; otherwise, allocate a temporary space. */+ mp_size ua = MP_USED(a);+ mp_size ub = MP_USED(b);+ mp_size osize = MAX(ua, ub);+ osize = 4 * ((osize + 1) / 2);++ mp_digit* out;+ mp_size p = 0;+ if (c == a || c == b) {+ p = MAX(s_round_prec(osize), default_precision);++ if ((out = s_alloc(p)) == NULL) return MP_MEMORY;+ } else {+ if (!s_pad(c, osize)) return MP_MEMORY;++ out = MP_DIGITS(c);+ }+ ZERO(out, osize);++ if (!s_kmul(MP_DIGITS(a), MP_DIGITS(b), out, ua, ub)) return MP_MEMORY;++ /* If we allocated a new buffer, get rid of whatever memory c was already+ using, and fix up its fields to reflect that.+ */+ if (out != MP_DIGITS(c)) {+ if ((void*)MP_DIGITS(c) != (void*)c) s_free(MP_DIGITS(c));+ c->digits = out;+ c->alloc = p;+ }++ c->used = osize; /* might not be true, but we'll fix it ... */+ CLAMP(c); /* ... right here */+ c->sign = osign;++ return MP_OK;+}++mp_result mp_int_mul_value(mp_int a, mp_small value, mp_int c) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);++ return mp_int_mul(a, &vtmp, c);+}++mp_result mp_int_mul_pow2(mp_int a, mp_small p2, mp_int c) {+ assert(a != NULL && c != NULL && p2 >= 0);++ mp_result res = mp_int_copy(a, c);+ if (res != MP_OK) return res;++ if (s_qmul(c, (mp_size)p2)) {+ return MP_OK;+ } else {+ return MP_MEMORY;+ }+}++mp_result mp_int_sqr(mp_int a, mp_int c) {+ assert(a != NULL && c != NULL);++ /* Get a temporary buffer big enough to hold the result */+ mp_size osize = (mp_size)4 * ((MP_USED(a) + 1) / 2);+ mp_size p = 0;+ mp_digit* out;+ if (a == c) {+ p = s_round_prec(osize);+ p = MAX(p, default_precision);++ if ((out = s_alloc(p)) == NULL) return MP_MEMORY;+ } else {+ if (!s_pad(c, osize)) return MP_MEMORY;++ out = MP_DIGITS(c);+ }+ ZERO(out, osize);++ s_ksqr(MP_DIGITS(a), out, MP_USED(a));++ /* Get rid of whatever memory c was already using, and fix up its fields to+ reflect the new digit array it's using+ */+ if (out != MP_DIGITS(c)) {+ if ((void*)MP_DIGITS(c) != (void*)c) s_free(MP_DIGITS(c));+ c->digits = out;+ c->alloc = p;+ }++ c->used = osize; /* might not be true, but we'll fix it ... */+ CLAMP(c); /* ... right here */+ c->sign = MP_ZPOS;++ return MP_OK;+}++mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r) {+ assert(a != NULL && b != NULL && q != r);++ int cmp;+ mp_result res = MP_OK;+ mp_int qout, rout;+ mp_sign sa = MP_SIGN(a);+ mp_sign sb = MP_SIGN(b);+ if (CMPZ(b) == 0) {+ return MP_UNDEF;+ } else if ((cmp = s_ucmp(a, b)) < 0) {+ /* If |a| < |b|, no division is required:+ q = 0, r = a+ */+ if (r && (res = mp_int_copy(a, r)) != MP_OK) return res;++ if (q) mp_int_zero(q);++ return MP_OK;+ } else if (cmp == 0) {+ /* If |a| = |b|, no division is required:+ q = 1 or -1, r = 0+ */+ if (r) mp_int_zero(r);++ if (q) {+ mp_int_zero(q);+ q->digits[0] = 1;++ if (sa != sb) q->sign = MP_NEG;+ }++ return MP_OK;+ }++ /* When |a| > |b|, real division is required. We need someplace to store+ quotient and remainder, but q and r are allowed to be NULL or to overlap+ with the inputs.+ */+ DECLARE_TEMP(2);+ int lg;+ if ((lg = s_isp2(b)) < 0) {+ if (q && b != q) {+ REQUIRE(mp_int_copy(a, q));+ qout = q;+ } else {+ REQUIRE(mp_int_copy(a, TEMP(0)));+ qout = TEMP(0);+ }++ if (r && a != r) {+ REQUIRE(mp_int_copy(b, r));+ rout = r;+ } else {+ REQUIRE(mp_int_copy(b, TEMP(1)));+ rout = TEMP(1);+ }++ REQUIRE(s_udiv_knuth(qout, rout));+ } else {+ if (q) REQUIRE(mp_int_copy(a, q));+ if (r) REQUIRE(mp_int_copy(a, r));++ if (q) s_qdiv(q, (mp_size)lg);+ qout = q;+ if (r) s_qmod(r, (mp_size)lg);+ rout = r;+ }++ /* Recompute signs for output */+ if (rout) {+ rout->sign = sa;+ if (CMPZ(rout) == 0) rout->sign = MP_ZPOS;+ }+ if (qout) {+ qout->sign = (sa == sb) ? MP_ZPOS : MP_NEG;+ if (CMPZ(qout) == 0) qout->sign = MP_ZPOS;+ }++ if (q) REQUIRE(mp_int_copy(qout, q));+ if (r) REQUIRE(mp_int_copy(rout, r));+ CLEANUP_TEMP();+ return res;+}++mp_result mp_int_mod(mp_int a, mp_int m, mp_int c) {+ DECLARE_TEMP(1);+ if (CMPZ(m) < 0) {+ return MP_RANGE;+ }++ mp_int out = (m == c) ? TEMP(0) : c;+ REQUIRE(mp_int_div(a, m, NULL, out));+ if (CMPZ(out) < 0) {+ REQUIRE(mp_int_add(out, m, c));+ } else {+ REQUIRE(mp_int_copy(out, c));+ }+ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small* r) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];+ s_fake(&vtmp, value, vbuf);++ DECLARE_TEMP(1);+ REQUIRE(mp_int_div(a, &vtmp, q, TEMP(0)));++ if (r) (void)mp_int_to_int(TEMP(0), r); /* can't fail */++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_div_pow2(mp_int a, mp_small p2, mp_int q, mp_int r) {+ assert(a != NULL && p2 >= 0 && q != r);++ mp_result res = MP_OK;+ if (q != NULL && (res = mp_int_copy(a, q)) == MP_OK) {+ s_qdiv(q, (mp_size)p2);+ }++ if (res == MP_OK && r != NULL && (res = mp_int_copy(a, r)) == MP_OK) {+ s_qmod(r, (mp_size)p2);+ }++ return res;+}++mp_result mp_int_expt(mp_int a, mp_small b, mp_int c) {+ assert(c != NULL);+ if (b < 0) return MP_RANGE;++ DECLARE_TEMP(1);+ REQUIRE(mp_int_copy(a, TEMP(0)));++ (void)mp_int_set_value(c, 1);+ unsigned int v = labs(b);+ while (v != 0) {+ if (v & 1) {+ REQUIRE(mp_int_mul(c, TEMP(0), c));+ }++ v >>= 1;+ if (v == 0) break;++ REQUIRE(mp_int_sqr(TEMP(0), TEMP(0)));+ }++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c) {+ assert(c != NULL);+ if (b < 0) return MP_RANGE;++ DECLARE_TEMP(1);+ REQUIRE(mp_int_set_value(TEMP(0), a));++ (void)mp_int_set_value(c, 1);+ unsigned int v = labs(b);+ while (v != 0) {+ if (v & 1) {+ REQUIRE(mp_int_mul(c, TEMP(0), c));+ }++ v >>= 1;+ if (v == 0) break;++ REQUIRE(mp_int_sqr(TEMP(0), TEMP(0)));+ }++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_expt_full(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);+ if (MP_SIGN(b) == MP_NEG) return MP_RANGE;++ DECLARE_TEMP(1);+ REQUIRE(mp_int_copy(a, TEMP(0)));++ (void)mp_int_set_value(c, 1);+ for (unsigned ix = 0; ix < MP_USED(b); ++ix) {+ mp_digit d = b->digits[ix];++ for (unsigned jx = 0; jx < MP_DIGIT_BIT; ++jx) {+ if (d & 1) {+ REQUIRE(mp_int_mul(c, TEMP(0), c));+ }++ d >>= 1;+ if (d == 0 && ix + 1 == MP_USED(b)) break;+ REQUIRE(mp_int_sqr(TEMP(0), TEMP(0)));+ }+ }++ CLEANUP_TEMP();+ return MP_OK;+}++int mp_int_compare(mp_int a, mp_int b) {+ assert(a != NULL && b != NULL);++ mp_sign sa = MP_SIGN(a);+ if (sa == MP_SIGN(b)) {+ int cmp = s_ucmp(a, b);++ /* If they're both zero or positive, the normal comparison applies; if both+ negative, the sense is reversed. */+ if (sa == MP_ZPOS) {+ return cmp;+ } else {+ return -cmp;+ }+ } else if (sa == MP_ZPOS) {+ return 1;+ } else {+ return -1;+ }+}++int mp_int_compare_unsigned(mp_int a, mp_int b) {+ assert(a != NULL && b != NULL);++ return s_ucmp(a, b);+}++int mp_int_compare_zero(mp_int z) {+ assert(z != NULL);++ if (MP_USED(z) == 1 && z->digits[0] == 0) {+ return 0;+ } else if (MP_SIGN(z) == MP_ZPOS) {+ return 1;+ } else {+ return -1;+ }+}++int mp_int_compare_value(mp_int z, mp_small value) {+ assert(z != NULL);++ mp_sign vsign = (value < 0) ? MP_NEG : MP_ZPOS;+ if (vsign == MP_SIGN(z)) {+ int cmp = s_vcmp(z, value);++ return (vsign == MP_ZPOS) ? cmp : -cmp;+ } else {+ return (value < 0) ? 1 : -1;+ }+}++int mp_int_compare_uvalue(mp_int z, mp_usmall uv) {+ assert(z != NULL);++ if (MP_SIGN(z) == MP_NEG) {+ return -1;+ } else {+ return s_uvcmp(z, uv);+ }+}++mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL && m != NULL);++ /* Zero moduli and negative exponents are not considered. */+ if (CMPZ(m) == 0) return MP_UNDEF;+ if (CMPZ(b) < 0) return MP_RANGE;++ mp_size um = MP_USED(m);+ DECLARE_TEMP(3);+ REQUIRE(GROW(TEMP(0), 2 * um));+ REQUIRE(GROW(TEMP(1), 2 * um));++ mp_int s;+ if (c == b || c == m) {+ REQUIRE(GROW(TEMP(2), 2 * um));+ s = TEMP(2);+ } else {+ s = c;+ }++ REQUIRE(mp_int_mod(a, m, TEMP(0)));+ REQUIRE(s_brmu(TEMP(1), m));+ REQUIRE(s_embar(TEMP(0), b, m, TEMP(1), s));+ REQUIRE(mp_int_copy(s, c));++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_exptmod_evalue(mp_int a, mp_small value, mp_int m, mp_int c) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);++ return mp_int_exptmod(a, &vtmp, m, c);+}++mp_result mp_int_exptmod_bvalue(mp_small value, mp_int b, mp_int m, mp_int c) {+ mpz_t vtmp;+ mp_digit vbuf[MP_VALUE_DIGITS(value)];++ s_fake(&vtmp, value, vbuf);++ return mp_int_exptmod(&vtmp, b, m, c);+}++mp_result mp_int_exptmod_known(mp_int a, mp_int b, mp_int m, mp_int mu,+ mp_int c) {+ assert(a && b && m && c);++ /* Zero moduli and negative exponents are not considered. */+ if (CMPZ(m) == 0) return MP_UNDEF;+ if (CMPZ(b) < 0) return MP_RANGE;++ DECLARE_TEMP(2);+ mp_size um = MP_USED(m);+ REQUIRE(GROW(TEMP(0), 2 * um));++ mp_int s;+ if (c == b || c == m) {+ REQUIRE(GROW(TEMP(1), 2 * um));+ s = TEMP(1);+ } else {+ s = c;+ }++ REQUIRE(mp_int_mod(a, m, TEMP(0)));+ REQUIRE(s_embar(TEMP(0), b, m, mu, s));+ REQUIRE(mp_int_copy(s, c));++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_redux_const(mp_int m, mp_int c) {+ assert(m != NULL && c != NULL && m != c);++ return s_brmu(c, m);+}++mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c) {+ assert(a != NULL && m != NULL && c != NULL);++ if (CMPZ(a) == 0 || CMPZ(m) <= 0) return MP_RANGE;++ DECLARE_TEMP(2);++ REQUIRE(mp_int_egcd(a, m, TEMP(0), TEMP(1), NULL));++ if (mp_int_compare_value(TEMP(0), 1) != 0) {+ REQUIRE(MP_UNDEF);+ }++ /* It is first necessary to constrain the value to the proper range */+ REQUIRE(mp_int_mod(TEMP(1), m, TEMP(1)));++ /* Now, if 'a' was originally negative, the value we have is actually the+ magnitude of the negative representative; to get the positive value we+ have to subtract from the modulus. Otherwise, the value is okay as it+ stands.+ */+ if (MP_SIGN(a) == MP_NEG) {+ REQUIRE(mp_int_sub(m, TEMP(1), c));+ } else {+ REQUIRE(mp_int_copy(TEMP(1), c));+ }++ CLEANUP_TEMP();+ return MP_OK;+}++/* Binary GCD algorithm due to Josef Stein, 1961 */+mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);++ int ca = CMPZ(a);+ int cb = CMPZ(b);+ if (ca == 0 && cb == 0) {+ return MP_UNDEF;+ } else if (ca == 0) {+ return mp_int_abs(b, c);+ } else if (cb == 0) {+ return mp_int_abs(a, c);+ }++ DECLARE_TEMP(3);+ REQUIRE(mp_int_copy(a, TEMP(0)));+ REQUIRE(mp_int_copy(b, TEMP(1)));++ TEMP(0)->sign = MP_ZPOS;+ TEMP(1)->sign = MP_ZPOS;++ int k = 0;+ { /* Divide out common factors of 2 from u and v */+ int div2_u = s_dp2k(TEMP(0));+ int div2_v = s_dp2k(TEMP(1));++ k = MIN(div2_u, div2_v);+ s_qdiv(TEMP(0), (mp_size)k);+ s_qdiv(TEMP(1), (mp_size)k);+ }++ if (mp_int_is_odd(TEMP(0))) {+ REQUIRE(mp_int_neg(TEMP(1), TEMP(2)));+ } else {+ REQUIRE(mp_int_copy(TEMP(0), TEMP(2)));+ }++ for (;;) {+ s_qdiv(TEMP(2), s_dp2k(TEMP(2)));++ if (CMPZ(TEMP(2)) > 0) {+ REQUIRE(mp_int_copy(TEMP(2), TEMP(0)));+ } else {+ REQUIRE(mp_int_neg(TEMP(2), TEMP(1)));+ }++ REQUIRE(mp_int_sub(TEMP(0), TEMP(1), TEMP(2)));++ if (CMPZ(TEMP(2)) == 0) break;+ }++ REQUIRE(mp_int_abs(TEMP(0), c));+ if (!s_qmul(c, (mp_size)k)) REQUIRE(MP_MEMORY);++ CLEANUP_TEMP();+ return MP_OK;+}++/* This is the binary GCD algorithm again, but this time we keep track of the+ elementary matrix operations as we go, so we can get values x and y+ satisfying c = ax + by.+ */+mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c, mp_int x, mp_int y) {+ assert(a != NULL && b != NULL && c != NULL && (x != NULL || y != NULL));++ mp_result res = MP_OK;+ int ca = CMPZ(a);+ int cb = CMPZ(b);+ if (ca == 0 && cb == 0) {+ return MP_UNDEF;+ } else if (ca == 0) {+ if ((res = mp_int_abs(b, c)) != MP_OK) return res;+ mp_int_zero(x);+ (void)mp_int_set_value(y, 1);+ return MP_OK;+ } else if (cb == 0) {+ if ((res = mp_int_abs(a, c)) != MP_OK) return res;+ (void)mp_int_set_value(x, 1);+ mp_int_zero(y);+ return MP_OK;+ }++ /* Initialize temporaries:+ A:0, B:1, C:2, D:3, u:4, v:5, ou:6, ov:7 */+ DECLARE_TEMP(8);+ REQUIRE(mp_int_set_value(TEMP(0), 1));+ REQUIRE(mp_int_set_value(TEMP(3), 1));+ REQUIRE(mp_int_copy(a, TEMP(4)));+ REQUIRE(mp_int_copy(b, TEMP(5)));++ /* We will work with absolute values here */+ TEMP(4)->sign = MP_ZPOS;+ TEMP(5)->sign = MP_ZPOS;++ int k = 0;+ { /* Divide out common factors of 2 from u and v */+ int div2_u = s_dp2k(TEMP(4)), div2_v = s_dp2k(TEMP(5));++ k = MIN(div2_u, div2_v);+ s_qdiv(TEMP(4), k);+ s_qdiv(TEMP(5), k);+ }++ REQUIRE(mp_int_copy(TEMP(4), TEMP(6)));+ REQUIRE(mp_int_copy(TEMP(5), TEMP(7)));++ for (;;) {+ while (mp_int_is_even(TEMP(4))) {+ s_qdiv(TEMP(4), 1);++ if (mp_int_is_odd(TEMP(0)) || mp_int_is_odd(TEMP(1))) {+ REQUIRE(mp_int_add(TEMP(0), TEMP(7), TEMP(0)));+ REQUIRE(mp_int_sub(TEMP(1), TEMP(6), TEMP(1)));+ }++ s_qdiv(TEMP(0), 1);+ s_qdiv(TEMP(1), 1);+ }++ while (mp_int_is_even(TEMP(5))) {+ s_qdiv(TEMP(5), 1);++ if (mp_int_is_odd(TEMP(2)) || mp_int_is_odd(TEMP(3))) {+ REQUIRE(mp_int_add(TEMP(2), TEMP(7), TEMP(2)));+ REQUIRE(mp_int_sub(TEMP(3), TEMP(6), TEMP(3)));+ }++ s_qdiv(TEMP(2), 1);+ s_qdiv(TEMP(3), 1);+ }++ if (mp_int_compare(TEMP(4), TEMP(5)) >= 0) {+ REQUIRE(mp_int_sub(TEMP(4), TEMP(5), TEMP(4)));+ REQUIRE(mp_int_sub(TEMP(0), TEMP(2), TEMP(0)));+ REQUIRE(mp_int_sub(TEMP(1), TEMP(3), TEMP(1)));+ } else {+ REQUIRE(mp_int_sub(TEMP(5), TEMP(4), TEMP(5)));+ REQUIRE(mp_int_sub(TEMP(2), TEMP(0), TEMP(2)));+ REQUIRE(mp_int_sub(TEMP(3), TEMP(1), TEMP(3)));+ }++ if (CMPZ(TEMP(4)) == 0) {+ if (x) REQUIRE(mp_int_copy(TEMP(2), x));+ if (y) REQUIRE(mp_int_copy(TEMP(3), y));+ if (c) {+ if (!s_qmul(TEMP(5), k)) {+ REQUIRE(MP_MEMORY);+ }+ REQUIRE(mp_int_copy(TEMP(5), c));+ }++ break;+ }+ }++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_lcm(mp_int a, mp_int b, mp_int c) {+ assert(a != NULL && b != NULL && c != NULL);++ /* Since a * b = gcd(a, b) * lcm(a, b), we can compute+ lcm(a, b) = (a / gcd(a, b)) * b.++ This formulation insures everything works even if the input+ variables share space.+ */+ DECLARE_TEMP(1);+ REQUIRE(mp_int_gcd(a, b, TEMP(0)));+ REQUIRE(mp_int_div(a, TEMP(0), TEMP(0), NULL));+ REQUIRE(mp_int_mul(TEMP(0), b, TEMP(0)));+ REQUIRE(mp_int_copy(TEMP(0), c));++ CLEANUP_TEMP();+ return MP_OK;+}++bool mp_int_divisible_value(mp_int a, mp_small v) {+ mp_small rem = 0;++ if (mp_int_div_value(a, v, NULL, &rem) != MP_OK) {+ return false;+ }+ return rem == 0;+}++int mp_int_is_pow2(mp_int z) {+ assert(z != NULL);++ return s_isp2(z);+}++/* Implementation of Newton's root finding method, based loosely on a patch+ contributed by Hal Finkel <half@halssoftware.com>+ modified by M. J. Fromberger.+ */+mp_result mp_int_root(mp_int a, mp_small b, mp_int c) {+ assert(a != NULL && c != NULL && b > 0);++ if (b == 1) {+ return mp_int_copy(a, c);+ }+ bool flips = false;+ if (MP_SIGN(a) == MP_NEG) {+ if (b % 2 == 0) {+ return MP_UNDEF; /* root does not exist for negative a with even b */+ } else {+ flips = true;+ }+ }++ DECLARE_TEMP(5);+ REQUIRE(mp_int_copy(a, TEMP(0)));+ REQUIRE(mp_int_copy(a, TEMP(1)));+ TEMP(0)->sign = MP_ZPOS;+ TEMP(1)->sign = MP_ZPOS;++ for (;;) {+ REQUIRE(mp_int_expt(TEMP(1), b, TEMP(2)));++ if (mp_int_compare_unsigned(TEMP(2), TEMP(0)) <= 0) break;++ REQUIRE(mp_int_sub(TEMP(2), TEMP(0), TEMP(2)));+ REQUIRE(mp_int_expt(TEMP(1), b - 1, TEMP(3)));+ REQUIRE(mp_int_mul_value(TEMP(3), b, TEMP(3)));+ REQUIRE(mp_int_div(TEMP(2), TEMP(3), TEMP(4), NULL));+ REQUIRE(mp_int_sub(TEMP(1), TEMP(4), TEMP(4)));++ if (mp_int_compare_unsigned(TEMP(1), TEMP(4)) == 0) {+ REQUIRE(mp_int_sub_value(TEMP(4), 1, TEMP(4)));+ }+ REQUIRE(mp_int_copy(TEMP(4), TEMP(1)));+ }++ REQUIRE(mp_int_copy(TEMP(1), c));++ /* If the original value of a was negative, flip the output sign. */+ if (flips) (void)mp_int_neg(c, c); /* cannot fail */++ CLEANUP_TEMP();+ return MP_OK;+}++mp_result mp_int_to_int(mp_int z, mp_small* out) {+ assert(z != NULL);++ /* Make sure the value is representable as a small integer */+ mp_sign sz = MP_SIGN(z);+ if ((sz == MP_ZPOS && mp_int_compare_value(z, MP_SMALL_MAX) > 0) ||+ mp_int_compare_value(z, MP_SMALL_MIN) < 0) {+ return MP_RANGE;+ }++ mp_usmall uz = MP_USED(z);+ mp_digit* dz = MP_DIGITS(z) + uz - 1;+ mp_small uv = 0;+ while (uz > 0) {+ uv <<= MP_DIGIT_BIT / 2;+ uv = (uv << (MP_DIGIT_BIT / 2)) | *dz--;+ --uz;+ }++ if (out) *out = (mp_small)((sz == MP_NEG) ? -uv : uv);++ return MP_OK;+}++mp_result mp_int_to_uint(mp_int z, mp_usmall* out) {+ assert(z != NULL);++ /* Make sure the value is representable as an unsigned small integer */+ mp_size sz = MP_SIGN(z);+ if (sz == MP_NEG || mp_int_compare_uvalue(z, MP_USMALL_MAX) > 0) {+ return MP_RANGE;+ }++ mp_size uz = MP_USED(z);+ mp_digit* dz = MP_DIGITS(z) + uz - 1;+ mp_usmall uv = 0;++ while (uz > 0) {+ uv <<= MP_DIGIT_BIT / 2;+ uv = (uv << (MP_DIGIT_BIT / 2)) | *dz--;+ --uz;+ }++ if (out) *out = uv;++ return MP_OK;+}++mp_result mp_int_to_string(mp_int z, mp_size radix, char* str, int limit) {+ assert(z != NULL && str != NULL && limit >= 2);+ assert(radix >= MP_MIN_RADIX && radix <= MP_MAX_RADIX);++ int cmp = 0;+ if (CMPZ(z) == 0) {+ *str++ = s_val2ch(0, 1);+ } else {+ mp_result res;+ mpz_t tmp;+ char *h, *t;++ if ((res = mp_int_init_copy(&tmp, z)) != MP_OK) return res;++ if (MP_SIGN(z) == MP_NEG) {+ *str++ = '-';+ --limit;+ }+ h = str;++ /* Generate digits in reverse order until finished or limit reached */+ for (/* */; limit > 0; --limit) {+ mp_digit d;++ if ((cmp = CMPZ(&tmp)) == 0) break;++ d = s_ddiv(&tmp, (mp_digit)radix);+ *str++ = s_val2ch(d, 1);+ }+ t = str - 1;++ /* Put digits back in correct output order */+ while (h < t) {+ char tc = *h;+ *h++ = *t;+ *t-- = tc;+ }++ mp_int_clear(&tmp);+ }++ *str = '\0';+ if (cmp == 0) {+ return MP_OK;+ } else {+ return MP_TRUNC;+ }+}++mp_size mp_int_string_len(mp_int z, mp_size radix) {+ assert(z != NULL);+ assert(radix >= MP_MIN_RADIX && radix <= MP_MAX_RADIX);++ int len = s_outlen(z, radix) + 1; /* for terminator */++ /* Allow for sign marker on negatives */+ if (MP_SIGN(z) == MP_NEG) len += 1;++ return len;+}++/* Read zero-terminated string into z */+mp_result mp_int_read_string(mp_int z, mp_size radix, const char* str) {+ return mp_int_read_cstring(z, radix, str, NULL);+}++mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char* str,+ char** end) {+ assert(z != NULL && str != NULL);+ assert(radix >= MP_MIN_RADIX && radix <= MP_MAX_RADIX);++ /* Skip leading whitespace */+ while (isspace((unsigned char)*str)) ++str;++ /* Handle leading sign tag (+/-, positive default) */+ switch (*str) {+ case '-':+ z->sign = MP_NEG;+ ++str;+ break;+ case '+':+ ++str; /* fallthrough */+ default:+ z->sign = MP_ZPOS;+ break;+ }++ /* Skip leading zeroes */+ int ch;+ while ((ch = s_ch2val(*str, radix)) == 0) ++str;++ /* Make sure there is enough space for the value */+ if (!s_pad(z, s_inlen(strlen(str), radix))) return MP_MEMORY;++ z->used = 1;+ z->digits[0] = 0;++ while (*str != '\0' && ((ch = s_ch2val(*str, radix)) >= 0)) {+ s_dmul(z, (mp_digit)radix);+ s_dadd(z, (mp_digit)ch);+ ++str;+ }++ CLAMP(z);++ /* Override sign for zero, even if negative specified. */+ if (CMPZ(z) == 0) z->sign = MP_ZPOS;++ if (end != NULL) *end = (char*)str;++ /* Return a truncation error if the string has unprocessed characters+ remaining, so the caller can tell if the whole string was done */+ if (*str != '\0') {+ return MP_TRUNC;+ } else {+ return MP_OK;+ }+}++mp_size mp_int_count_bits(mp_int z) {+ assert(z != NULL);++ mp_size uz = MP_USED(z);+ if (uz == 1 && z->digits[0] == 0) return 1;++ --uz;+ mp_size nbits = uz * MP_DIGIT_BIT;+ mp_digit d = z->digits[uz];++ while (d != 0) {+ d >>= 1;+ ++nbits;+ }++ return nbits;+}++mp_result mp_int_to_binary(mp_int z, unsigned char* buf, int limit) {+ static const int PAD_FOR_2C = 1;++ assert(z != NULL && buf != NULL);++ int limpos = limit;+ mp_result res = s_tobin(z, buf, &limpos, PAD_FOR_2C);++ if (MP_SIGN(z) == MP_NEG) s_2comp(buf, limpos);++ return res;+}++mp_result mp_int_read_binary(mp_int z, unsigned char* buf, int len) {+ assert(z != NULL && buf != NULL && len > 0);++ /* Figure out how many digits are needed to represent this value */+ mp_size need = ((len * CHAR_BIT) + (MP_DIGIT_BIT - 1)) / MP_DIGIT_BIT;+ if (!s_pad(z, need)) return MP_MEMORY;++ mp_int_zero(z);++ /* If the high-order bit is set, take the 2's complement before reading the+ value (it will be restored afterward) */+ if (buf[0] >> (CHAR_BIT - 1)) {+ z->sign = MP_NEG;+ s_2comp(buf, len);+ }++ mp_digit* dz = MP_DIGITS(z);+ unsigned char* tmp = buf;+ for (int i = len; i > 0; --i, ++tmp) {+ s_qmul(z, (mp_size)CHAR_BIT);+ *dz |= *tmp;+ }++ /* Restore 2's complement if we took it before */+ if (MP_SIGN(z) == MP_NEG) s_2comp(buf, len);++ return MP_OK;+}++mp_size mp_int_binary_len(mp_int z) {+ mp_size res = mp_int_count_bits(z);+ if (res == 0) return res;++ mp_size bytes = mp_int_unsigned_len(z);++ /* If the highest-order bit falls exactly on a byte boundary, we need to pad+ with an extra byte so that the sign will be read correctly when reading it+ back in. */+ if (bytes * CHAR_BIT == res) ++bytes;++ return bytes;+}++mp_result mp_int_to_unsigned(mp_int z, unsigned char* buf, int limit) {+ static const int NO_PADDING = 0;++ assert(z != NULL && buf != NULL);++ return s_tobin(z, buf, &limit, NO_PADDING);+}++mp_result mp_int_read_unsigned(mp_int z, unsigned char* buf, int len) {+ assert(z != NULL && buf != NULL && len > 0);++ /* Figure out how many digits are needed to represent this value */+ mp_size need = ((len * CHAR_BIT) + (MP_DIGIT_BIT - 1)) / MP_DIGIT_BIT;+ if (!s_pad(z, need)) return MP_MEMORY;++ mp_int_zero(z);++ unsigned char* tmp = buf;+ for (int i = len; i > 0; --i, ++tmp) {+ (void)s_qmul(z, CHAR_BIT);+ *MP_DIGITS(z) |= *tmp;+ }++ return MP_OK;+}++mp_size mp_int_unsigned_len(mp_int z) {+ mp_size res = mp_int_count_bits(z);+ mp_size bytes = (res + (CHAR_BIT - 1)) / CHAR_BIT;+ return bytes;+}++const char* mp_error_string(mp_result res) {+ if (res > 0) return s_unknown_err;++ res = -res;+ int ix;+ for (ix = 0; ix < res && s_error_msg[ix] != NULL; ++ix);++ if (s_error_msg[ix] != NULL) {+ return s_error_msg[ix];+ } else {+ return s_unknown_err;+ }+}++/*------------------------------------------------------------------------*/+/* Private functions for internal use. These make assumptions. */++#if DEBUG+static const mp_digit fill = (mp_digit)0xdeadbeefabad1dea;+#endif++static mp_digit* s_alloc(mp_size num) {+ mp_digit* out = malloc(num * sizeof(mp_digit));+ assert(out != NULL);++#if DEBUG+ for (mp_size ix = 0; ix < num; ++ix) out[ix] = fill;+#endif+ return out;+}++static mp_digit* s_realloc(mp_digit* old, mp_size osize, mp_size nsize) {+#if DEBUG+ mp_digit* new = s_alloc(nsize);+ assert(new != NULL);++ for (mp_size ix = 0; ix < nsize; ++ix) new[ix] = fill;+ memcpy(new, old, osize * sizeof(mp_digit));+#else+ mp_digit* new = realloc(old, nsize * sizeof(mp_digit));+ assert(new != NULL);+#endif++ return new;+}++static void s_free(void* ptr) { free(ptr); }++static bool s_pad(mp_int z, mp_size min) {+ if (MP_ALLOC(z) < min) {+ mp_size nsize = s_round_prec(min);+ mp_digit* tmp;++ if (z->digits == &(z->single)) {+ if ((tmp = s_alloc(nsize)) == NULL) return false;+ tmp[0] = z->single;+ } else if ((tmp = s_realloc(MP_DIGITS(z), MP_ALLOC(z), nsize)) == NULL) {+ return false;+ }++ z->digits = tmp;+ z->alloc = nsize;+ }++ return true;+}++static void s_fake(mp_int z, mp_small value, mp_digit vbuf[]) {+ mp_usmall uv = (value < 0) ? -(mp_usmall)value : (mp_usmall)value;+ s_ufake(z, uv, vbuf);+ if (value < 0) z->sign = MP_NEG;+}++static void s_ufake(mp_int z, mp_usmall value, mp_digit vbuf[]) {+ mp_size ndig = (mp_size)s_uvpack(value, vbuf);++ z->used = ndig;+ z->alloc = MP_VALUE_DIGITS(value);+ z->sign = MP_ZPOS;+ z->digits = vbuf;+}++static int s_cdig(mp_digit* da, mp_digit* db, mp_size len) {+ mp_digit *dat = da + len - 1, *dbt = db + len - 1;++ for (/* */; len != 0; --len, --dat, --dbt) {+ if (*dat > *dbt) {+ return 1;+ } else if (*dat < *dbt) {+ return -1;+ }+ }++ return 0;+}++static int s_uvpack(mp_usmall uv, mp_digit t[]) {+ int ndig = 0;++ if (uv == 0)+ t[ndig++] = 0;+ else {+ while (uv != 0) {+ t[ndig++] = (mp_digit)uv;+ uv >>= MP_DIGIT_BIT / 2;+ uv >>= MP_DIGIT_BIT / 2;+ }+ }++ return ndig;+}++static int s_ucmp(mp_int a, mp_int b) {+ mp_size ua = MP_USED(a), ub = MP_USED(b);++ if (ua > ub) {+ return 1;+ } else if (ub > ua) {+ return -1;+ } else {+ return s_cdig(MP_DIGITS(a), MP_DIGITS(b), ua);+ }+}++static int s_vcmp(mp_int a, mp_small v) {+ mp_usmall uv = (v < 0) ? -(mp_usmall)v : (mp_usmall)v;+ return s_uvcmp(a, uv);+}++static int s_uvcmp(mp_int a, mp_usmall uv) {+ mpz_t vtmp;+ mp_digit vdig[MP_VALUE_DIGITS(uv)];++ s_ufake(&vtmp, uv, vdig);+ return s_ucmp(a, &vtmp);+}++static mp_digit s_uadd(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b) {+ mp_size pos;+ mp_word w = 0;++ /* Insure that da is the longer of the two to simplify later code */+ if (size_b > size_a) {+ SWAP(mp_digit*, da, db);+ SWAP(mp_size, size_a, size_b);+ }++ /* Add corresponding digits until the shorter number runs out */+ for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) {+ w = w + (mp_word)*da + (mp_word)*db;+ *dc = LOWER_HALF(w);+ w = UPPER_HALF(w);+ }++ /* Propagate carries as far as necessary */+ for (/* */; pos < size_a; ++pos, ++da, ++dc) {+ w = w + *da;++ *dc = LOWER_HALF(w);+ w = UPPER_HALF(w);+ }++ /* Return carry out */+ return (mp_digit)w;+}++static void s_usub(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b) {+ mp_size pos;+ mp_word w = 0;++ /* We assume that |a| >= |b| so this should definitely hold */+ assert(size_a >= size_b);++ /* Subtract corresponding digits and propagate borrow */+ for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) {+ w = ((mp_word)MP_DIGIT_MAX + 1 + /* MP_RADIX */+ (mp_word)*da) -+ w - (mp_word)*db;++ *dc = LOWER_HALF(w);+ w = (UPPER_HALF(w) == 0);+ }++ /* Finish the subtraction for remaining upper digits of da */+ for (/* */; pos < size_a; ++pos, ++da, ++dc) {+ w = ((mp_word)MP_DIGIT_MAX + 1 + /* MP_RADIX */+ (mp_word)*da) -+ w;++ *dc = LOWER_HALF(w);+ w = (UPPER_HALF(w) == 0);+ }++ /* If there is a borrow out at the end, it violates the precondition */+ assert(w == 0);+}++static int s_kmul(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b) {+ mp_size bot_size;++ /* Make sure b is the smaller of the two input values */+ if (size_b > size_a) {+ SWAP(mp_digit*, da, db);+ SWAP(mp_size, size_a, size_b);+ }++ /* Insure that the bottom is the larger half in an odd-length split; the code+ below relies on this being true.+ */+ bot_size = (size_a + 1) / 2;++ /* If the values are big enough to bother with recursion, use the Karatsuba+ algorithm to compute the product; otherwise use the normal multiplication+ algorithm+ */+ if (multiply_threshold && size_a >= multiply_threshold && size_b > bot_size) {+ mp_digit *t1, *t2, *t3, carry;++ mp_digit* a_top = da + bot_size;+ mp_digit* b_top = db + bot_size;++ mp_size at_size = size_a - bot_size;+ mp_size bt_size = size_b - bot_size;+ mp_size buf_size = 2 * bot_size;++ /* Do a single allocation for all three temporary buffers needed; each+ buffer must be big enough to hold the product of two bottom halves, and+ one buffer needs space for the completed product; twice the space is+ plenty.+ */+ if ((t1 = s_alloc(4 * buf_size)) == NULL) return 0;+ t2 = t1 + buf_size;+ t3 = t2 + buf_size;+ ZERO(t1, 4 * buf_size);++ /* t1 and t2 are initially used as temporaries to compute the inner product+ (a1 + a0)(b1 + b0) = a1b1 + a1b0 + a0b1 + a0b0+ */+ carry = s_uadd(da, a_top, t1, bot_size, at_size); /* t1 = a1 + a0 */+ t1[bot_size] = carry;++ carry = s_uadd(db, b_top, t2, bot_size, bt_size); /* t2 = b1 + b0 */+ t2[bot_size] = carry;++ (void)s_kmul(t1, t2, t3, bot_size + 1, bot_size + 1); /* t3 = t1 * t2 */++ /* Now we'll get t1 = a0b0 and t2 = a1b1, and subtract them out so that+ we're left with only the pieces we want: t3 = a1b0 + a0b1+ */+ ZERO(t1, buf_size);+ ZERO(t2, buf_size);+ (void)s_kmul(da, db, t1, bot_size, bot_size); /* t1 = a0 * b0 */+ (void)s_kmul(a_top, b_top, t2, at_size, bt_size); /* t2 = a1 * b1 */++ /* Subtract out t1 and t2 to get the inner product */+ s_usub(t3, t1, t3, buf_size + 2, buf_size);+ s_usub(t3, t2, t3, buf_size + 2, buf_size);++ /* Assemble the output value */+ COPY(t1, dc, buf_size);+ carry = s_uadd(t3, dc + bot_size, dc + bot_size, buf_size + 1, buf_size);+ assert(carry == 0);++ carry =+ s_uadd(t2, dc + 2 * bot_size, dc + 2 * bot_size, buf_size, buf_size);+ assert(carry == 0);++ s_free(t1); /* note t2 and t3 are just internal pointers to t1 */+ } else {+ s_umul(da, db, dc, size_a, size_b);+ }++ return 1;+}++static void s_umul(mp_digit* da, mp_digit* db, mp_digit* dc, mp_size size_a,+ mp_size size_b) {+ mp_size a, b;+ mp_word w;++ for (a = 0; a < size_a; ++a, ++dc, ++da) {+ mp_digit* dct = dc;+ mp_digit* dbt = db;++ if (*da == 0) continue;++ w = 0;+ for (b = 0; b < size_b; ++b, ++dbt, ++dct) {+ w = (mp_word)*da * (mp_word)*dbt + w + (mp_word)*dct;++ *dct = LOWER_HALF(w);+ w = UPPER_HALF(w);+ }++ *dct = (mp_digit)w;+ }+}++static int s_ksqr(mp_digit* da, mp_digit* dc, mp_size size_a) {+ if (multiply_threshold && size_a > multiply_threshold) {+ mp_size bot_size = (size_a + 1) / 2;+ mp_digit* a_top = da + bot_size;+ mp_digit *t1, *t2, *t3, carry;+ mp_size at_size = size_a - bot_size;+ mp_size buf_size = 2 * bot_size;++ if ((t1 = s_alloc(4 * buf_size)) == NULL) return 0;+ t2 = t1 + buf_size;+ t3 = t2 + buf_size;+ ZERO(t1, 4 * buf_size);++ (void)s_ksqr(da, t1, bot_size); /* t1 = a0 ^ 2 */+ (void)s_ksqr(a_top, t2, at_size); /* t2 = a1 ^ 2 */++ (void)s_kmul(da, a_top, t3, bot_size, at_size); /* t3 = a0 * a1 */++ /* Quick multiply t3 by 2, shifting left (can't overflow) */+ {+ int i, top = bot_size + at_size;+ mp_word w, save = 0;++ for (i = 0; i < top; ++i) {+ w = t3[i];+ w = (w << 1) | save;+ t3[i] = LOWER_HALF(w);+ save = UPPER_HALF(w);+ }+ t3[i] = LOWER_HALF(save);+ }++ /* Assemble the output value */+ COPY(t1, dc, 2 * bot_size);+ carry = s_uadd(t3, dc + bot_size, dc + bot_size, buf_size + 1, buf_size);+ assert(carry == 0);++ carry =+ s_uadd(t2, dc + 2 * bot_size, dc + 2 * bot_size, buf_size, buf_size);+ assert(carry == 0);++ s_free(t1); /* note that t2 and t2 are internal pointers only */++ } else {+ s_usqr(da, dc, size_a);+ }++ return 1;+}++static void s_usqr(mp_digit* da, mp_digit* dc, mp_size size_a) {+ mp_size i, j;+ mp_word w;++ for (i = 0; i < size_a; ++i, dc += 2, ++da) {+ mp_digit *dct = dc, *dat = da;++ if (*da == 0) continue;++ /* Take care of the first digit, no rollover */+ w = (mp_word)*dat * (mp_word)*dat + (mp_word)*dct;+ *dct = LOWER_HALF(w);+ w = UPPER_HALF(w);+ ++dat;+ ++dct;++ for (j = i + 1; j < size_a; ++j, ++dat, ++dct) {+ mp_word t = (mp_word)*da * (mp_word)*dat;+ mp_word u = w + (mp_word)*dct, ov = 0;++ /* Check if doubling t will overflow a word */+ if (HIGH_BIT_SET(t)) ov = 1;++ w = t + t;++ /* Check if adding u to w will overflow a word */+ if (ADD_WILL_OVERFLOW(w, u)) ov = 1;++ w += u;++ *dct = LOWER_HALF(w);+ w = UPPER_HALF(w);+ if (ov) {+ w += MP_DIGIT_MAX; /* MP_RADIX */+ ++w;+ }+ }++ w = w + *dct;+ *dct = (mp_digit)w;+ while ((w = UPPER_HALF(w)) != 0) {+ ++dct;+ w = w + *dct;+ *dct = LOWER_HALF(w);+ }++ assert(w == 0);+ }+}++static void s_dadd(mp_int a, mp_digit b) {+ mp_word w = 0;+ mp_digit* da = MP_DIGITS(a);+ mp_size ua = MP_USED(a);++ w = (mp_word)*da + b;+ *da++ = LOWER_HALF(w);+ w = UPPER_HALF(w);++ for (ua -= 1; ua > 0; --ua, ++da) {+ w = (mp_word)*da + w;++ *da = LOWER_HALF(w);+ w = UPPER_HALF(w);+ }++ if (w) {+ *da = (mp_digit)w;+ a->used += 1;+ }+}++static void s_dmul(mp_int a, mp_digit b) {+ mp_word w = 0;+ mp_digit* da = MP_DIGITS(a);+ mp_size ua = MP_USED(a);++ while (ua > 0) {+ w = (mp_word)*da * b + w;+ *da++ = LOWER_HALF(w);+ w = UPPER_HALF(w);+ --ua;+ }++ if (w) {+ *da = (mp_digit)w;+ a->used += 1;+ }+}++static void s_dbmul(mp_digit* da, mp_digit b, mp_digit* dc, mp_size size_a) {+ mp_word w = 0;++ while (size_a > 0) {+ w = (mp_word)*da++ * (mp_word)b + w;++ *dc++ = LOWER_HALF(w);+ w = UPPER_HALF(w);+ --size_a;+ }++ if (w) *dc = LOWER_HALF(w);+}++static mp_digit s_ddiv(mp_int a, mp_digit b) {+ mp_word w = 0, qdigit;+ mp_size ua = MP_USED(a);+ mp_digit* da = MP_DIGITS(a) + ua - 1;++ for (/* */; ua > 0; --ua, --da) {+ w = (w << MP_DIGIT_BIT) | *da;++ if (w >= b) {+ qdigit = w / b;+ w = w % b;+ } else {+ qdigit = 0;+ }++ *da = (mp_digit)qdigit;+ }++ CLAMP(a);+ return (mp_digit)w;+}++static void s_qdiv(mp_int z, mp_size p2) {+ mp_size ndig = p2 / MP_DIGIT_BIT, nbits = p2 % MP_DIGIT_BIT;+ mp_size uz = MP_USED(z);++ if (ndig) {+ mp_size mark;+ mp_digit *to, *from;++ if (ndig >= uz) {+ mp_int_zero(z);+ return;+ }++ to = MP_DIGITS(z);+ from = to + ndig;++ for (mark = ndig; mark < uz; ++mark) {+ *to++ = *from++;+ }++ z->used = uz - ndig;+ }++ if (nbits) {+ mp_digit d = 0, *dz, save;+ mp_size up = MP_DIGIT_BIT - nbits;++ uz = MP_USED(z);+ dz = MP_DIGITS(z) + uz - 1;++ for (/* */; uz > 0; --uz, --dz) {+ save = *dz;++ *dz = (*dz >> nbits) | (d << up);+ d = save;+ }++ CLAMP(z);+ }++ if (MP_USED(z) == 1 && z->digits[0] == 0) z->sign = MP_ZPOS;+}++static void s_qmod(mp_int z, mp_size p2) {+ mp_size start = p2 / MP_DIGIT_BIT + 1, rest = p2 % MP_DIGIT_BIT;+ mp_size uz = MP_USED(z);+ mp_digit mask = (1u << rest) - 1;++ if (start <= uz) {+ z->used = start;+ z->digits[start - 1] &= mask;+ CLAMP(z);+ }+}++static int s_qmul(mp_int z, mp_size p2) {+ mp_size uz, need, rest, extra, i;+ mp_digit *from, *to, d;++ if (p2 == 0) return 1;++ uz = MP_USED(z);+ need = p2 / MP_DIGIT_BIT;+ rest = p2 % MP_DIGIT_BIT;++ /* Figure out if we need an extra digit at the top end; this occurs if the+ topmost `rest' bits of the high-order digit of z are not zero, meaning+ they will be shifted off the end if not preserved */+ extra = 0;+ if (rest != 0) {+ mp_digit* dz = MP_DIGITS(z) + uz - 1;++ if ((*dz >> (MP_DIGIT_BIT - rest)) != 0) extra = 1;+ }++ if (!s_pad(z, uz + need + extra)) return 0;++ /* If we need to shift by whole digits, do that in one pass, then+ to back and shift by partial digits.+ */+ if (need > 0) {+ from = MP_DIGITS(z) + uz - 1;+ to = from + need;++ for (i = 0; i < uz; ++i) *to-- = *from--;++ ZERO(MP_DIGITS(z), need);+ uz += need;+ }++ if (rest) {+ d = 0;+ for (i = need, from = MP_DIGITS(z) + need; i < uz; ++i, ++from) {+ mp_digit save = *from;++ *from = (*from << rest) | (d >> (MP_DIGIT_BIT - rest));+ d = save;+ }++ d >>= (MP_DIGIT_BIT - rest);+ if (d != 0) {+ *from = d;+ uz += extra;+ }+ }++ z->used = uz;+ CLAMP(z);++ return 1;+}++/* Compute z = 2^p2 - |z|; requires that 2^p2 >= |z|+ The sign of the result is always zero/positive.+ */+static int s_qsub(mp_int z, mp_size p2) {+ mp_digit hi = (1u << (p2 % MP_DIGIT_BIT)), *zp;+ mp_size tdig = (p2 / MP_DIGIT_BIT), pos;+ mp_word w = 0;++ if (!s_pad(z, tdig + 1)) return 0;++ for (pos = 0, zp = MP_DIGITS(z); pos < tdig; ++pos, ++zp) {+ w = ((mp_word)MP_DIGIT_MAX + 1) - w - (mp_word)*zp;++ *zp = LOWER_HALF(w);+ w = UPPER_HALF(w) ? 0 : 1;+ }++ w = ((mp_word)MP_DIGIT_MAX + 1 + hi) - w - (mp_word)*zp;+ *zp = LOWER_HALF(w);++ assert(UPPER_HALF(w) != 0); /* no borrow out should be possible */++ z->sign = MP_ZPOS;+ CLAMP(z);++ return 1;+}++static int s_dp2k(mp_int z) {+ int k = 0;+ mp_digit *dp = MP_DIGITS(z), d;++ if (MP_USED(z) == 1 && *dp == 0) return 1;++ while (*dp == 0) {+ k += MP_DIGIT_BIT;+ ++dp;+ }++ d = *dp;+ while ((d & 1) == 0) {+ d >>= 1;+ ++k;+ }++ return k;+}++static int s_isp2(mp_int z) {+ mp_size uz = MP_USED(z), k = 0;+ mp_digit *dz = MP_DIGITS(z), d;++ while (uz > 1) {+ if (*dz++ != 0) return -1;+ k += MP_DIGIT_BIT;+ --uz;+ }++ d = *dz;+ while (d > 1) {+ if (d & 1) return -1;+ ++k;+ d >>= 1;+ }++ return (int)k;+}++static int s_2expt(mp_int z, mp_small k) {+ mp_size ndig, rest;+ mp_digit* dz;++ ndig = (k + MP_DIGIT_BIT) / MP_DIGIT_BIT;+ rest = k % MP_DIGIT_BIT;++ if (!s_pad(z, ndig)) return 0;++ dz = MP_DIGITS(z);+ ZERO(dz, ndig);+ *(dz + ndig - 1) = (1u << rest);+ z->used = ndig;++ return 1;+}++static int s_norm(mp_int a, mp_int b) {+ mp_digit d = b->digits[MP_USED(b) - 1];+ int k = 0;++ while (d < (1u << (mp_digit)(MP_DIGIT_BIT - 1))) { /* d < (MP_RADIX / 2) */+ d <<= 1;+ ++k;+ }++ /* These multiplications can't fail */+ if (k != 0) {+ (void)s_qmul(a, (mp_size)k);+ (void)s_qmul(b, (mp_size)k);+ }++ return k;+}++static mp_result s_brmu(mp_int z, mp_int m) {+ mp_size um = MP_USED(m) * 2;++ if (!s_pad(z, um)) return MP_MEMORY;++ s_2expt(z, MP_DIGIT_BIT * um);+ return mp_int_div(z, m, z, NULL);+}++static int s_reduce(mp_int x, mp_int m, mp_int mu, mp_int q1, mp_int q2) {+ mp_size um = MP_USED(m), umb_p1, umb_m1;++ umb_p1 = (um + 1) * MP_DIGIT_BIT;+ umb_m1 = (um - 1) * MP_DIGIT_BIT;++ if (mp_int_copy(x, q1) != MP_OK) return 0;++ /* Compute q2 = floor((floor(x / b^(k-1)) * mu) / b^(k+1)) */+ s_qdiv(q1, umb_m1);+ UMUL(q1, mu, q2);+ s_qdiv(q2, umb_p1);++ /* Set x = x mod b^(k+1) */+ s_qmod(x, umb_p1);++ /* Now, q is a guess for the quotient a / m.+ Compute x - q * m mod b^(k+1), replacing x. This may be off+ by a factor of 2m, but no more than that.+ */+ UMUL(q2, m, q1);+ s_qmod(q1, umb_p1);+ (void)mp_int_sub(x, q1, x); /* can't fail */++ /* The result may be < 0; if it is, add b^(k+1) to pin it in the proper+ range. */+ if ((CMPZ(x) < 0) && !s_qsub(x, umb_p1)) return 0;++ /* If x > m, we need to back it off until it is in range. This will be+ required at most twice. */+ if (mp_int_compare(x, m) >= 0) {+ (void)mp_int_sub(x, m, x);+ if (mp_int_compare(x, m) >= 0) {+ (void)mp_int_sub(x, m, x);+ }+ }++ /* At this point, x has been properly reduced. */+ return 1;+}++/* Perform modular exponentiation using Barrett's method, where mu is the+ reduction constant for m. Assumes a < m, b > 0. */+static mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c) {+ mp_digit umu = MP_USED(mu);+ mp_digit* db = MP_DIGITS(b);+ mp_digit* dbt = db + MP_USED(b) - 1;++ DECLARE_TEMP(3);+ REQUIRE(GROW(TEMP(0), 4 * umu));+ REQUIRE(GROW(TEMP(1), 4 * umu));+ REQUIRE(GROW(TEMP(2), 4 * umu));+ ZERO(TEMP(0)->digits, TEMP(0)->alloc);+ ZERO(TEMP(1)->digits, TEMP(1)->alloc);+ ZERO(TEMP(2)->digits, TEMP(2)->alloc);++ (void)mp_int_set_value(c, 1);++ /* Take care of low-order digits */+ while (db < dbt) {+ mp_digit d = *db;++ for (int i = MP_DIGIT_BIT; i > 0; --i, d >>= 1) {+ if (d & 1) {+ /* The use of a second temporary avoids allocation */+ UMUL(c, a, TEMP(0));+ if (!s_reduce(TEMP(0), m, mu, TEMP(1), TEMP(2))) {+ REQUIRE(MP_MEMORY);+ }+ mp_int_copy(TEMP(0), c);+ }++ USQR(a, TEMP(0));+ assert(MP_SIGN(TEMP(0)) == MP_ZPOS);+ if (!s_reduce(TEMP(0), m, mu, TEMP(1), TEMP(2))) {+ REQUIRE(MP_MEMORY);+ }+ assert(MP_SIGN(TEMP(0)) == MP_ZPOS);+ mp_int_copy(TEMP(0), a);+ }++ ++db;+ }++ /* Take care of highest-order digit */+ mp_digit d = *dbt;+ for (;;) {+ if (d & 1) {+ UMUL(c, a, TEMP(0));+ if (!s_reduce(TEMP(0), m, mu, TEMP(1), TEMP(2))) {+ REQUIRE(MP_MEMORY);+ }+ mp_int_copy(TEMP(0), c);+ }++ d >>= 1;+ if (!d) break;++ USQR(a, TEMP(0));+ if (!s_reduce(TEMP(0), m, mu, TEMP(1), TEMP(2))) {+ REQUIRE(MP_MEMORY);+ }+ (void)mp_int_copy(TEMP(0), a);+ }++ CLEANUP_TEMP();+ return MP_OK;+}++/* Division of nonnegative integers++ This function implements division algorithm for unsigned multi-precision+ integers. The algorithm is based on Algorithm D from Knuth's "The Art of+ Computer Programming", 3rd ed. 1998, pg 272-273.++ We diverge from Knuth's algorithm in that we do not perform the subtraction+ from the remainder until we have determined that we have the correct+ quotient digit. This makes our algorithm less efficient than Knuth because+ we might have to perform multiple multiplication and comparison steps before+ the subtraction. The advantage is that it is easy to implement and ensure+ correctness without worrying about underflow from the subtraction.++ inputs: u a n+m digit integer in base b (b is 2^MP_DIGIT_BIT)+ v a n digit integer in base b (b is 2^MP_DIGIT_BIT)+ n >= 1+ m >= 0+ outputs: u / v stored in u+ u % v stored in v+ */+static mp_result s_udiv_knuth(mp_int u, mp_int v) {+ /* Force signs to positive */+ u->sign = MP_ZPOS;+ v->sign = MP_ZPOS;++ /* Use simple division algorithm when v is only one digit long */+ if (MP_USED(v) == 1) {+ mp_digit d, rem;+ d = v->digits[0];+ rem = s_ddiv(u, d);+ mp_int_set_value(v, rem);+ return MP_OK;+ }++ /* Algorithm D++ The n and m variables are defined as used by Knuth.+ u is an n digit number with digits u_{n-1}..u_0.+ v is an n+m digit number with digits from v_{m+n-1}..v_0.+ We require that n > 1 and m >= 0+ */+ mp_size n = MP_USED(v);+ mp_size m = MP_USED(u) - n;+ assert(n > 1);+ /* assert(m >= 0) follows because m is unsigned. */++ /* D1: Normalize.+ The normalization step provides the necessary condition for Theorem B,+ which states that the quotient estimate for q_j, call it qhat++ qhat = u_{j+n}u_{j+n-1} / v_{n-1}++ is bounded by++ qhat - 2 <= q_j <= qhat.++ That is, qhat is always greater than the actual quotient digit q,+ and it is never more than two larger than the actual quotient digit.+ */+ int k = s_norm(u, v);++ /* Extend size of u by one if needed.++ The algorithm begins with a value of u that has one more digit of input.+ The normalization step sets u_{m+n}..u_0 = 2^k * u_{m+n-1}..u_0. If the+ multiplication did not increase the number of digits of u, we need to add+ a leading zero here.+ */+ if (k == 0 || MP_USED(u) != m + n + 1) {+ if (!s_pad(u, m + n + 1)) return MP_MEMORY;+ u->digits[m + n] = 0;+ u->used = m + n + 1;+ }++ /* Add a leading 0 to v.++ The multiplication in step D4 multiplies qhat * 0v_{n-1}..v_0. We need to+ add the leading zero to v here to ensure that the multiplication will+ produce the full n+1 digit result.+ */+ if (!s_pad(v, n + 1)) return MP_MEMORY;+ v->digits[n] = 0;++ /* Initialize temporary variables q and t.+ q allocates space for m+1 digits to store the quotient digits+ t allocates space for n+1 digits to hold the result of q_j*v+ */+ DECLARE_TEMP(2);+ REQUIRE(GROW(TEMP(0), m + 1));+ REQUIRE(GROW(TEMP(1), n + 1));++ /* D2: Initialize j */+ int j = m;+ mpz_t r;+ r.digits = MP_DIGITS(u) + j; /* The contents of r are shared with u */+ r.used = n + 1;+ r.sign = MP_ZPOS;+ r.alloc = MP_ALLOC(u);+ ZERO(TEMP(1)->digits, TEMP(1)->alloc);++ /* Calculate the m+1 digits of the quotient result */+ for (; j >= 0; j--) {+ /* D3: Calculate q' */+ /* r->digits is aligned to position j of the number u */+ mp_word pfx, qhat;+ pfx = r.digits[n];+ pfx <<= MP_DIGIT_BIT / 2;+ pfx <<= MP_DIGIT_BIT / 2;+ pfx |= r.digits[n - 1]; /* pfx = u_{j+n}{j+n-1} */++ qhat = pfx / v->digits[n - 1];+ /* Check to see if qhat > b, and decrease qhat if so.+ Theorem B guarantees that qhat is at most 2 larger than the+ actual value, so it is possible that qhat is greater than+ the maximum value that will fit in a digit */+ if (qhat > MP_DIGIT_MAX) qhat = MP_DIGIT_MAX;++ /* D4,D5,D6: Multiply qhat * v and test for a correct value of q++ We proceed a bit different than the way described by Knuth. This way is+ simpler but less efficient. Instead of doing the multiply and subtract+ then checking for underflow, we first do the multiply of qhat * v and+ see if it is larger than the current remainder r. If it is larger, we+ decrease qhat by one and try again. We may need to decrease qhat one+ more time before we get a value that is smaller than r.++ This way is less efficient than Knuth because we do more multiplies, but+ we do not need to worry about underflow this way.+ */+ /* t = qhat * v */+ s_dbmul(MP_DIGITS(v), (mp_digit)qhat, TEMP(1)->digits, n + 1);+ TEMP(1)->used = n + 1;+ CLAMP(TEMP(1));++ /* Clamp r for the comparison. Comparisons do not like leading zeros. */+ CLAMP(&r);+ if (s_ucmp(TEMP(1), &r) > 0) { /* would the remainder be negative? */+ qhat -= 1; /* try a smaller q */+ s_dbmul(MP_DIGITS(v), (mp_digit)qhat, TEMP(1)->digits, n + 1);+ TEMP(1)->used = n + 1;+ CLAMP(TEMP(1));+ if (s_ucmp(TEMP(1), &r) > 0) { /* would the remainder be negative? */+ assert(qhat > 0);+ qhat -= 1; /* try a smaller q */+ s_dbmul(MP_DIGITS(v), (mp_digit)qhat, TEMP(1)->digits, n + 1);+ TEMP(1)->used = n + 1;+ CLAMP(TEMP(1));+ }+ assert(s_ucmp(TEMP(1), &r) <= 0 && "The mathematics failed us.");+ }+ /* Unclamp r. The D algorithm expects r = u_{j+n}..u_j to always be n+1+ digits long. */+ r.used = n + 1;++ /* D4: Multiply and subtract++ Note: The multiply was completed above so we only need to subtract here.+ */+ s_usub(r.digits, TEMP(1)->digits, r.digits, r.used, TEMP(1)->used);++ /* D5: Test remainder++ Note: Not needed because we always check that qhat is the correct value+ before performing the subtract. Value cast to mp_digit to prevent+ warning, qhat has been clamped to MP_DIGIT_MAX+ */+ TEMP(0)->digits[j] = (mp_digit)qhat;++ /* D6: Add back+ Note: Not needed because we always check that qhat is the correct value+ before performing the subtract.+ */++ /* D7: Loop on j */+ r.digits--;+ ZERO(TEMP(1)->digits, TEMP(1)->alloc);+ }++ /* Get rid of leading zeros in q */+ TEMP(0)->used = m + 1;+ CLAMP(TEMP(0));++ /* Denormalize the remainder */+ CLAMP(u); /* use u here because the r.digits pointer is off-by-one */+ if (k != 0) s_qdiv(u, k);++ mp_int_copy(u, v); /* ok: 0 <= r < v */+ mp_int_copy(TEMP(0), u); /* ok: q <= u */++ CLEANUP_TEMP();+ return MP_OK;+}++static int s_outlen(mp_int z, mp_size r) {+ assert(r >= MP_MIN_RADIX && r <= MP_MAX_RADIX);++ mp_result bits = mp_int_count_bits(z);+ double raw = (double)bits * s_log2[r];++ return (int)(raw + 0.999999);+}++static mp_size s_inlen(int len, mp_size r) {+ double raw = (double)len / s_log2[r];+ mp_size bits = (mp_size)(raw + 0.5);++ return (mp_size)((bits + (MP_DIGIT_BIT - 1)) / MP_DIGIT_BIT) + 1;+}++static int s_ch2val(char c, int r) {+ int out;++ /*+ * In some locales, isalpha() accepts characters outside the range A-Z,+ * producing out<0 or out>=36. The "out >= r" check will always catch+ * out>=36. Though nothing explicitly catches out<0, our caller reacts the+ * same way to every negative return value.+ */+ if (isdigit((unsigned char)c))+ out = c - '0';+ else if (r > 10 && isalpha((unsigned char)c))+ out = toupper((unsigned char)c) - 'A' + 10;+ else+ return -1;++ return (out >= r) ? -1 : out;+}++static char s_val2ch(int v, int caps) {+ assert(v >= 0);++ if (v < 10) {+ return v + '0';+ } else {+ char out = (v - 10) + 'a';++ if (caps) {+ return toupper((unsigned char)out);+ } else {+ return out;+ }+ }+}++static void s_2comp(unsigned char* buf, int len) {+ unsigned short s = 1;++ for (int i = len - 1; i >= 0; --i) {+ unsigned char c = ~buf[i];++ s = c + s;+ c = s & UCHAR_MAX;+ s >>= CHAR_BIT;++ buf[i] = c;+ }++ /* last carry out is ignored */+}++static mp_result s_tobin(mp_int z, unsigned char* buf, int* limpos, int pad) {+ int pos = 0, limit = *limpos;+ mp_size uz = MP_USED(z);+ mp_digit* dz = MP_DIGITS(z);++ while (uz > 0 && pos < limit) {+ mp_digit d = *dz++;+ int i;++ for (i = sizeof(mp_digit); i > 0 && pos < limit; --i) {+ buf[pos++] = (unsigned char)d;+ d >>= CHAR_BIT;++ /* Don't write leading zeroes */+ if (d == 0 && uz == 1) i = 0; /* exit loop without signaling truncation */+ }++ /* Detect truncation (loop exited with pos >= limit) */+ if (i > 0) break;++ --uz;+ }++ if (pad != 0 && (buf[pos - 1] >> (CHAR_BIT - 1))) {+ if (pos < limit) {+ buf[pos++] = 0;+ } else {+ uz = 1;+ }+ }++ /* Digits are in reverse order, fix that */+ REV(buf, pos);++ /* Return the number of bytes actually written */+ *limpos = pos;++ return (uz == 0) ? MP_OK : MP_TRUNC;+}++/* Here there be dragons */
@@ -0,0 +1,422 @@+/*+ Name: imath.h+ Purpose: Arbitrary precision integer arithmetic routines.+ Author: M. J. Fromberger++ Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.+ */++#ifndef IMATH_H_+#define IMATH_H_++#include <limits.h>+#include <stdbool.h>+#include <stdint.h>++#ifdef __cplusplus+extern "C" {+#endif++typedef unsigned char mp_sign;+typedef unsigned int mp_size;+typedef int mp_result;+typedef long mp_small; /* must be a signed type */+typedef unsigned long mp_usmall; /* must be an unsigned type */+++/* Build with words as uint64_t by default. */+#ifdef USE_32BIT_WORDS+typedef uint16_t mp_digit;+typedef uint32_t mp_word;+# define MP_DIGIT_MAX (UINT16_MAX * 1UL)+# define MP_WORD_MAX (UINT32_MAX * 1UL)+#else+typedef uint32_t mp_digit;+typedef uint64_t mp_word;+# define MP_DIGIT_MAX (UINT32_MAX * UINT64_C(1))+# define MP_WORD_MAX (UINT64_MAX)+#endif++typedef struct {+ mp_digit single;+ mp_digit* digits;+ mp_size alloc;+ mp_size used;+ mp_sign sign;+} mpz_t, *mp_int;++static inline mp_digit* MP_DIGITS(mp_int Z) { return Z->digits; }+static inline mp_size MP_ALLOC(mp_int Z) { return Z->alloc; }+static inline mp_size MP_USED(mp_int Z) { return Z->used; }+static inline mp_sign MP_SIGN(mp_int Z) { return Z->sign; }++extern const mp_result MP_OK;+extern const mp_result MP_FALSE;+extern const mp_result MP_TRUE;+extern const mp_result MP_MEMORY;+extern const mp_result MP_RANGE;+extern const mp_result MP_UNDEF;+extern const mp_result MP_TRUNC;+extern const mp_result MP_BADARG;+extern const mp_result MP_MINERR;++#define MP_DIGIT_BIT (sizeof(mp_digit) * CHAR_BIT)+#define MP_WORD_BIT (sizeof(mp_word) * CHAR_BIT)+#define MP_SMALL_MIN LONG_MIN+#define MP_SMALL_MAX LONG_MAX+#define MP_USMALL_MAX ULONG_MAX++#define MP_MIN_RADIX 2+#define MP_MAX_RADIX 36++/** Sets the default number of digits allocated to an `mp_int` constructed by+ `mp_int_init_size()` with `prec == 0`. Allocations are rounded up to+ multiples of this value. `MP_DEFAULT_PREC` is the default value. Requires+ `ndigits > 0`. */+void mp_int_default_precision(mp_size ndigits);++/** Sets the number of digits below which multiplication will use the standard+ quadratic "schoolbook" multiplication algorithm rather than Karatsuba-Ofman.+ Requires `ndigits >= sizeof(mp_word)`. */+void mp_int_multiply_threshold(mp_size ndigits);++/** A sign indicating a (strictly) negative value. */+extern const mp_sign MP_NEG;++/** A sign indicating a zero or positive value. */+extern const mp_sign MP_ZPOS;++/** Reports whether `z` is odd, having remainder 1 when divided by 2. */+static inline bool mp_int_is_odd(mp_int z) { return (z->digits[0] & 1) != 0; }++/** Reports whether `z` is even, having remainder 0 when divided by 2. */+static inline bool mp_int_is_even(mp_int z) { return (z->digits[0] & 1) == 0; }++/** Initializes `z` with 1-digit precision and sets it to zero. This function+ cannot fail unless `z == NULL`. */+mp_result mp_int_init(mp_int z);++/** Allocates a fresh zero-valued `mpz_t` on the heap, returning NULL in case+ of error. The only possible error is out-of-memory. */+mp_int mp_int_alloc(void);++/** Initializes `z` with at least `prec` digits of storage, and sets it to+ zero. If `prec` is zero, the default precision is used. In either case the+ size is rounded up to the nearest multiple of the word size. */+mp_result mp_int_init_size(mp_int z, mp_size prec);++/** Initializes `z` to be a copy of an already-initialized value in `old`. The+ new copy does not share storage with the original. */+mp_result mp_int_init_copy(mp_int z, mp_int old);++/** Initializes `z` to the specified signed `value` at default precision. */+mp_result mp_int_init_value(mp_int z, mp_small value);++/** Initializes `z` to the specified unsigned `value` at default precision. */+mp_result mp_int_init_uvalue(mp_int z, mp_usmall uvalue);++/** Sets `z` to the value of the specified signed `value`. */+mp_result mp_int_set_value(mp_int z, mp_small value);++/** Sets `z` to the value of the specified unsigned `value`. */+mp_result mp_int_set_uvalue(mp_int z, mp_usmall uvalue);++/** Releases the storage used by `z`. */+void mp_int_clear(mp_int z);++/** Releases the storage used by `z` and also `z` itself.+ This should only be used for `z` allocated by `mp_int_alloc()`. */+void mp_int_free(mp_int z);++/** Replaces the value of `c` with a copy of the value of `a`. No new memory is+ allocated unless `a` has more significant digits than `c` has allocated. */+mp_result mp_int_copy(mp_int a, mp_int c);++/** Swaps the values and storage between `a` and `c`. */+void mp_int_swap(mp_int a, mp_int c);++/** Sets `z` to zero. The allocated storage of `z` is not changed. */+void mp_int_zero(mp_int z);++/** Sets `c` to the absolute value of `a`. */+mp_result mp_int_abs(mp_int a, mp_int c);++/** Sets `c` to the additive inverse (negation) of `a`. */+mp_result mp_int_neg(mp_int a, mp_int c);++/** Sets `c` to the sum of `a` and `b`. */+mp_result mp_int_add(mp_int a, mp_int b, mp_int c);++/** Sets `c` to the sum of `a` and `value`. */+mp_result mp_int_add_value(mp_int a, mp_small value, mp_int c);++/** Sets `c` to the difference of `a` less `b`. */+mp_result mp_int_sub(mp_int a, mp_int b, mp_int c);++/** Sets `c` to the difference of `a` less `value`. */+mp_result mp_int_sub_value(mp_int a, mp_small value, mp_int c);++/** Sets `c` to the product of `a` and `b`. */+mp_result mp_int_mul(mp_int a, mp_int b, mp_int c);++/** Sets `c` to the product of `a` and `value`. */+mp_result mp_int_mul_value(mp_int a, mp_small value, mp_int c);++/** Sets `c` to the product of `a` and `2^p2`. Requires `p2 >= 0`. */+mp_result mp_int_mul_pow2(mp_int a, mp_small p2, mp_int c);++/** Sets `c` to the square of `a`. */+mp_result mp_int_sqr(mp_int a, mp_int c);++/** Sets `q` and `r` to the quotient and remainder of `a / b`, so that the+ equation `a == b*q + r` is satisfied and `0 <= |r| < |b|`.+ Division by powers of 2 is detected and handled efficiently.++ Either of `q` or `r` may be NULL, but not both, and `q` and `r` may not+ point to the same value. */+mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r);++/** Sets `q` and `*r` to the quotient and remainder of `a / value`. Division by+ powers of 2 is detected and handled efficiently. The remainder is pinned to+ `0 <= *r < b`. Either of `q` or `r` may be NULL. */+mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small *r);++/** Sets `q` and `r` to the quotient and remainder of `a / 2^p2`. This is a+ special case for division by powers of two that is more efficient than+ using ordinary division. Note that `mp_int_div()` will automatically handle+ this case, this function is for cases where you have only the exponent. */+mp_result mp_int_div_pow2(mp_int a, mp_small p2, mp_int q, mp_int r);++/** Sets `c` to the remainder of `a / m`.+ It returns `MP_UNDEF` if `m == 0`, or `MP_RANGE` if `m < 0` .+ Otherwise the remainder is pinned to `0 <= c < m`. */+mp_result mp_int_mod(mp_int a, mp_int m, mp_int c);++/** Sets `c` to the value of `a` raised to the `b` power.+ It returns `MP_RANGE` if `b < 0`. */+mp_result mp_int_expt(mp_int a, mp_small b, mp_int c);++/** Sets `c` to the value of `a` raised to the `b` power.+ It returns `MP_RANGE` if `b < 0`. */+mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c);++/** Sets `c` to the value of `a` raised to the `b` power.+ It returns `MP_RANGE`) if `b < 0`. */+mp_result mp_int_expt_full(mp_int a, mp_int b, mp_int c);++/** Sets `*r` to the remainder of `a / value`.+ The remainder is pinned to `0 <= r < value`. */+static inline+mp_result mp_int_mod_value(mp_int a, mp_small value, mp_small* r) {+ return mp_int_div_value(a, value, 0, r);+}++/** Returns the comparator of `a` and `b`. */+int mp_int_compare(mp_int a, mp_int b);++/** Returns the comparator of the magnitudes of `a` and `b`, disregarding their+ signs. Neither `a` nor `b` is modified by the comparison. */+int mp_int_compare_unsigned(mp_int a, mp_int b);++/** Returns the comparator of `z` and zero. */+int mp_int_compare_zero(mp_int z);++/** Returns the comparator of `z` and the signed value `v`. */+int mp_int_compare_value(mp_int z, mp_small v);++/** Returns the comparator of `z` and the unsigned value `uv`. */+int mp_int_compare_uvalue(mp_int z, mp_usmall uv);++/** Reports whether `a` is divisible by `v`. */+bool mp_int_divisible_value(mp_int a, mp_small v);++/** Returns `k >= 0` such that `z` is `2^k`, if such a `k` exists. If no such+ `k` exists, the function returns -1. */+int mp_int_is_pow2(mp_int z);++/** Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`.+ It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */+mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c);++/** Sets `c` to the value of `a` raised to the `value` power, modulo `m`.+ It returns `MP_RANGE` if `value < 0` or `MP_UNDEF` if `m == 0`. */+mp_result mp_int_exptmod_evalue(mp_int a, mp_small value, mp_int m, mp_int c);++/** Sets `c` to the value of `value` raised to the `b` power, modulo `m`.+ It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */+mp_result mp_int_exptmod_bvalue(mp_small value, mp_int b, mp_int m, mp_int c);++/** Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`,+ given a precomputed reduction constant `mu` defined for Barrett's modular+ reduction algorithm.++ It returns `MP_RANGE` if `b < 0` or `MP_UNDEF` if `m == 0`. */+mp_result mp_int_exptmod_known(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c);++/** Sets `c` to the reduction constant for Barrett reduction by modulus `m`.+ Requires that `c` and `m` point to distinct locations. */+mp_result mp_int_redux_const(mp_int m, mp_int c);++/** Sets `c` to the multiplicative inverse of `a` modulo `m`, if it exists.+ The least non-negative representative of the congruence class is computed.++ It returns `MP_UNDEF` if the inverse does not exist, or `MP_RANGE` if `a ==+ 0` or `m <= 0`. */+mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c);++/** Sets `c` to the greatest common divisor of `a` and `b`.++ It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`+ and `b` are both zero. */+mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c);++/** Sets `c` to the greatest common divisor of `a` and `b`, and sets `x` and+ `y` to values satisfying Bezout's identity `gcd(a, b) = ax + by`.++ It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`+ and `b` are both zero. */+mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c, mp_int x, mp_int y);++/** Sets `c` to the least common multiple of `a` and `b`.++ It returns `MP_UNDEF` if the LCM is undefined, such as for example if `a`+ and `b` are both zero. */+mp_result mp_int_lcm(mp_int a, mp_int b, mp_int c);++/** Sets `c` to the greatest integer not less than the `b`th root of `a`,+ using Newton's root-finding algorithm.+ It returns `MP_UNDEF` if `a < 0` and `b` is even. */+mp_result mp_int_root(mp_int a, mp_small b, mp_int c);++/** Sets `c` to the greatest integer not less than the square root of `a`.+ This is a special case of `mp_int_root()`. */+static inline+mp_result mp_int_sqrt(mp_int a, mp_int c) { return mp_int_root(a, 2, c); }++/** Returns `MP_OK` if `z` is representable as `mp_small`, else `MP_RANGE`.+ If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */+mp_result mp_int_to_int(mp_int z, mp_small *out);++/** Returns `MP_OK` if `z` is representable as `mp_usmall`, or `MP_RANGE`.+ If `out` is not NULL, `*out` is set to the value of `z` when `MP_OK`. */+mp_result mp_int_to_uint(mp_int z, mp_usmall *out);++/** Converts `z` to a zero-terminated string of characters in the specified+ `radix`, writing at most `limit` characters to `str` including the+ terminating NUL value. A leading `-` is used to indicate a negative value.++ Returns `MP_TRUNC` if `limit` was to small to write all of `z`.+ Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */+mp_result mp_int_to_string(mp_int z, mp_size radix, char *str, int limit);++/** Reports the minimum number of characters required to represent `z` as a+ zero-terminated string in the given `radix`.+ Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */+mp_size mp_int_string_len(mp_int z, mp_size radix);++/** Reads a string of ASCII digits in the specified `radix` from the zero+ terminated `str` provided into `z`. For values of `radix > 10`, the letters+ `A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect+ to case.++ Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a+ sign flag. Processing stops when a NUL or any other character out of range+ for a digit in the given radix is encountered.++ If the whole string was consumed, `MP_OK` is returned; otherwise+ `MP_TRUNC`. is returned.++ Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */+mp_result mp_int_read_string(mp_int z, mp_size radix, const char *str);++/** Reads a string of ASCII digits in the specified `radix` from the zero+ terminated `str` provided into `z`. For values of `radix > 10`, the letters+ `A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect+ to case.++ Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a+ sign flag. Processing stops when a NUL or any other character out of range+ for a digit in the given radix is encountered.++ If the whole string was consumed, `MP_OK` is returned; otherwise+ `MP_TRUNC`. is returned. If `end` is not NULL, `*end` is set to point to+ the first unconsumed byte of the input string (the NUL byte if the whole+ string was consumed). This emulates the behavior of the standard C+ `strtol()` function.++ Requires `MP_MIN_RADIX <= radix <= MP_MAX_RADIX`. */+mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **end);++/** Returns the number of significant bits in `z`. */+mp_size mp_int_count_bits(mp_int z);++/** Converts `z` to 2's complement binary, writing at most `limit` bytes into+ the given `buf`. Returns `MP_TRUNC` if the buffer limit was too small to+ contain the whole value. If this occurs, the contents of buf will be+ effectively garbage, as the function uses the buffer as scratch space.++ The binary representation of `z` is in base-256 with digits ordered from+ most significant to least significant (network byte ordering). The+ high-order bit of the first byte is set for negative values, clear for+ non-negative values.++ As a result, non-negative values will be padded with a leading zero byte if+ the high-order byte of the base-256 magnitude is set. This extra byte is+ accounted for by the `mp_int_binary_len()` function. */+mp_result mp_int_to_binary(mp_int z, unsigned char *buf, int limit);++/** Reads a 2's complement binary value from `buf` into `z`, where `len` is the+ length of the buffer. The contents of `buf` may be overwritten during+ processing, although they will be restored when the function returns. */+mp_result mp_int_read_binary(mp_int z, unsigned char *buf, int len);++/** Returns the number of bytes to represent `z` in 2's complement binary. */+mp_size mp_int_binary_len(mp_int z);++/** Converts the magnitude of `z` to unsigned binary, writing at most `limit`+ bytes into the given `buf`. The sign of `z` is ignored, but `z` is not+ modified. Returns `MP_TRUNC` if the buffer limit was too small to contain+ the whole value. If this occurs, the contents of `buf` will be effectively+ garbage, as the function uses the buffer as scratch space during+ conversion.++ The binary representation of `z` is in base-256 with digits ordered from+ most significant to least significant (network byte ordering). */+mp_result mp_int_to_unsigned(mp_int z, unsigned char *buf, int limit);++/** Reads an unsigned binary value from `buf` into `z`, where `len` is the+ length of the buffer. The contents of `buf` are not modified during+ processing. */+mp_result mp_int_read_unsigned(mp_int z, unsigned char *buf, int len);++/** Returns the number of bytes required to represent `z` as an unsigned binary+ value in base 256. */+mp_size mp_int_unsigned_len(mp_int z);++/** Returns a pointer to a brief, human-readable, zero-terminated string+ describing `res`. The returned string is statically allocated and must not+ be freed by the caller. */+const char *mp_error_string(mp_result res);++#ifdef __cplusplus+}+#endif+#endif /* end IMATH_H_ */
@@ -0,0 +1,351 @@+#ifndef IMGMP_H+#define IMGMP_H++#include <stddef.h>+#include <stdlib.h>+#include <limits.h>++#define mpz_t __imath_mpz_t+#include "imath.c"+#undef mpz_t++typedef __imath_mpz_t mpz_t[1];+typedef __imath_mpz_t* mpz_ptr;+typedef const __imath_mpz_t* mpz_srcptr;+typedef unsigned long int mp_bitcnt_t;++static inline void mpz_init(mpz_ptr x) {+ mp_int_init(x);+}++static inline void mpz_clear(mpz_ptr x) {+ mp_int_clear(x);+}++static inline int mpz_set_str(mpz_ptr rop, const char *str, int base) {+ while (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r') {+ str++;+ }+ int is_neg = 0;+ if (*str == '-') {+ is_neg = 1;+ str++;+ } else if (*str == '+') {+ str++;+ }+ + // GMP base 0 automatic prefix detection detection+ if (base == 0) {+ if (*str == '0') {+ if (str[1] == 'x' || str[1] == 'X') { base = 16; str += 2; }+ else if (str[1] == 'b' || str[1] == 'B') { base = 2; str += 2; }+ else { base = 8; }+ } else {+ base = 10;+ }+ } else if (base == 16) {+ if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) str += 2;+ } else if (base == 2) {+ if (str[0] == '0' && (str[1] == 'b' || str[1] == 'B')) str += 2;+ }+ + if (mp_int_read_string(rop, base, str) == 0) {+ if (is_neg) mp_int_neg(rop, rop);+ return 0;+ }+ return -1;+}++static inline char *mpz_get_str(char *str, int base, mpz_srcptr op) {+ int actual_base = (base < 0) ? -base : (base == 0 ? 10 : base);+ int len = mp_int_string_len((mpz_ptr)op, actual_base);+ + if (str == NULL) {+ str = (char *)malloc(len);+ }+ + mp_int_to_string((mpz_ptr)op, actual_base, str, len);+ + if (base >= 0) {+ for (int i = 0; str[i]; i++) {+ if (str[i] >= 'A' && str[i] <= 'Z') str[i] += 32;+ }+ }+ return str;+}++static inline unsigned long int mpz_get_ui(mpz_srcptr x) {+ mp_usmall val = 0;+ __imath_mpz_t local = *x; + local.sign = MP_ZPOS; + + int max_digits = sizeof(unsigned long) / sizeof(mp_digit);+ if (local.used > max_digits) {+ local.used = max_digits; + }+ (void)mp_int_to_uint(&local, &val);+ return val;+}++static inline int mpz_sgn(mpz_srcptr x) {+ return mp_int_compare_zero((mpz_ptr)x);+}++static inline void mpz_init_set(mpz_ptr rop, mpz_srcptr op) {+ mp_int_init_copy(rop, (mpz_ptr)op);+}++static inline void mpz_init_set_si(mpz_ptr rop, signed long int op) {+ mp_int_init_value(rop, op);+}++static inline void mpz_init_set_ui(mpz_ptr rop, unsigned long int op) {+ mp_int_init_uvalue(rop, op);+}++static inline void mpz_add_ui(mpz_ptr rop, mpz_srcptr op1, unsigned long int op2) {+ // Intercept values exceeding signed boundaries to prevent negative interpretation bugs+ if (op2 <= (unsigned long)LONG_MAX) {+ mp_int_add_value((mpz_ptr)op1, (mp_small)op2, rop);+ } else {+ __imath_mpz_t tmp;+ mp_int_init_uvalue(&tmp, op2);+ mp_int_add((mpz_ptr)op1, &tmp, rop);+ mp_int_clear(&tmp);+ }+}++static inline void mpz_neg(mpz_ptr rop, mpz_srcptr op) {+ mp_int_neg((mpz_ptr)op, rop);+}++static inline void mpz_abs(mpz_ptr rop, mpz_srcptr op) {+ mp_int_abs((mpz_ptr)op, rop);+}++static inline void mpz_add(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ mp_int_add((mpz_ptr)op1, (mpz_ptr)op2, rop);+}++static inline void mpz_sub(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ mp_int_sub((mpz_ptr)op1, (mpz_ptr)op2, rop);+}++static inline void mpz_mul(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ mp_int_mul((mpz_ptr)op1, (mpz_ptr)op2, rop);+}++static inline void mpz_mul_2exp(mpz_ptr rop, mpz_srcptr op, mp_bitcnt_t bitcnt) {+ mp_int_mul_pow2((mpz_ptr)op, bitcnt, rop);+}++static inline void mpz_tdiv_q_2exp(mpz_ptr q, mpz_srcptr n, mp_bitcnt_t bitcnt) {+ mp_int_div_pow2((mpz_ptr)n, bitcnt, q, NULL);+}++static inline void mpz_fdiv_q_2exp(mpz_ptr q, mpz_srcptr n, mp_bitcnt_t bitcnt) {+ __imath_mpz_t rem;+ mp_int_init(&rem);+ mp_int_div_pow2((mpz_ptr)n, bitcnt, q, &rem);+ if (mp_int_compare_zero((mpz_ptr)n) < 0 && mp_int_compare_zero(&rem) != 0) {+ mp_int_sub_value(q, 1, q);+ }+ mp_int_clear(&rem);+}++static inline void mpz_tdiv_qr(mpz_ptr q, mpz_ptr r, mpz_srcptr n, mpz_srcptr d) {+ mp_int_div((mpz_ptr)n, (mpz_ptr)d, q, r);+}++static inline int mpz_cmp(mpz_srcptr op1, mpz_srcptr op2) {+ return mp_int_compare((mpz_ptr)op1, (mpz_ptr)op2);+}++static inline double mpz_get_d(mpz_srcptr x) {+ int len = mp_int_string_len((mpz_ptr)x, 10);+ char *buf = (char *)malloc(len);+ mp_int_to_string((mpz_ptr)x, 10, buf, len);+ double d = strtod(buf, NULL);+ free(buf);+ return d;+}++static inline size_t mpz_sizeinbase(mpz_srcptr x, int base) {+ if (mp_int_compare_zero((mpz_ptr)x) == 0) return 1;+ int len = mp_int_string_len((mpz_ptr)x, base) - 1;+ if (mp_int_compare_zero((mpz_ptr)x) < 0) len--;+ return len;+}++static inline int mpz_tstbit(mpz_srcptr x, mp_bitcnt_t bitindex) {+ if (mp_int_compare_zero((mpz_ptr)x) >= 0) {+ __imath_mpz_t tmp;+ mp_int_init(&tmp);+ mp_int_div_pow2((mpz_ptr)x, bitindex, &tmp, NULL);+ int bit = mp_int_is_odd(&tmp);+ mp_int_clear(&tmp);+ return bit;+ } else {+ // Two's complement bit transformation rule for negative inputs+ __imath_mpz_t abs_m1;+ mp_int_init(&abs_m1);+ mp_int_abs((mpz_ptr)x, &abs_m1);+ mp_int_sub_value(&abs_m1, 1, &abs_m1);+ mp_int_div_pow2(&abs_m1, bitindex, &abs_m1, NULL);+ int bit = mp_int_is_odd(&abs_m1);+ mp_int_clear(&abs_m1);+ return !bit;+ }+}++static inline void mpz_and(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ int s1 = mp_int_compare_zero((mpz_ptr)op1);+ int s2 = mp_int_compare_zero((mpz_ptr)op2);+ + if (s1 >= 0 && s2 >= 0) {+ __imath_mpz_t t1, t2, res, bit_val;+ mp_int_init_copy(&t1, (mpz_ptr)op1); mp_int_init_copy(&t2, (mpz_ptr)op2);+ mp_int_init(&res); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(&t1) != 0 && mp_int_compare_zero(&t2) != 0) {+ if (mp_int_is_odd(&t1) && mp_int_is_odd(&t2)) mp_int_add(&res, &bit_val, &res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(&t1, 1, &t1, NULL); mp_int_div_pow2(&t2, 1, &t2, NULL);+ }+ mp_int_copy(&res, rop);+ mp_int_clear(&t1); mp_int_clear(&t2); mp_int_clear(&res); mp_int_clear(&bit_val);+ } else if (s1 < 0 && s2 < 0) {+ // A & B = ~(~A | ~B)+ __imath_mpz_t not1, not2, or_res, bit_val;+ mp_int_init(¬1); mp_int_init(¬2); mp_int_init(&or_res); mp_int_init(&bit_val);+ mp_int_neg((mpz_ptr)op1, ¬1); mp_int_sub_value(¬1, 1, ¬1);+ mp_int_neg((mpz_ptr)op2, ¬2); mp_int_sub_value(¬2, 1, ¬2);+ mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(¬1) != 0 || mp_int_compare_zero(¬2) != 0) {+ if (mp_int_is_odd(¬1) || mp_int_is_odd(¬2)) mp_int_add(&or_res, &bit_val, &or_res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(¬1, 1, ¬1, NULL); mp_int_div_pow2(¬2, 1, ¬2, NULL);+ }+ mp_int_neg(&or_res, rop); mp_int_sub_value(rop, 1, rop);+ mp_int_clear(¬1); mp_int_clear(¬2); mp_int_clear(&or_res); mp_int_clear(&bit_val);+ } else {+ // Mixed: pos_op & ~not_neg+ __imath_mpz_t pos_op, not_neg, res, bit_val;+ mp_int_init_copy(&pos_op, (mpz_ptr)(s1 >= 0 ? op1 : op2));+ mp_int_init(¬_neg); mp_int_neg((mpz_ptr)(s1 < 0 ? op1 : op2), ¬_neg); mp_int_sub_value(¬_neg, 1, ¬_neg);+ mp_int_init(&res); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(&pos_op) != 0) {+ if (mp_int_is_odd(&pos_op) && !mp_int_is_odd(¬_neg)) mp_int_add(&res, &bit_val, &res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(&pos_op, 1, &pos_op, NULL); mp_int_div_pow2(¬_neg, 1, ¬_neg, NULL);+ }+ mp_int_copy(&res, rop);+ mp_int_clear(&pos_op); mp_int_clear(¬_neg); mp_int_clear(&res); mp_int_clear(&bit_val);+ }+}++static inline void mpz_ior(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ int s1 = mp_int_compare_zero((mpz_ptr)op1);+ int s2 = mp_int_compare_zero((mpz_ptr)op2);+ + if (s1 >= 0 && s2 >= 0) {+ __imath_mpz_t t1, t2, res, bit_val;+ mp_int_init_copy(&t1, (mpz_ptr)op1); mp_int_init_copy(&t2, (mpz_ptr)op2);+ mp_int_init(&res); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(&t1) != 0 || mp_int_compare_zero(&t2) != 0) {+ if (mp_int_is_odd(&t1) || mp_int_is_odd(&t2)) mp_int_add(&res, &bit_val, &res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(&t1, 1, &t1, NULL); mp_int_div_pow2(&t2, 1, &t2, NULL);+ }+ mp_int_copy(&res, rop);+ mp_int_clear(&t1); mp_int_clear(&t2); mp_int_clear(&res); mp_int_clear(&bit_val);+ } else if (s1 < 0 && s2 < 0) {+ // A | B = ~(~A & ~B)+ __imath_mpz_t not1, not2, and_res, bit_val;+ mp_int_init(¬1); mp_int_init(¬2); mp_int_init(&and_res); mp_int_init(&bit_val);+ mp_int_neg((mpz_ptr)op1, ¬1); mp_int_sub_value(¬1, 1, ¬1);+ mp_int_neg((mpz_ptr)op2, ¬2); mp_int_sub_value(¬2, 1, ¬2);+ mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(¬1) != 0 && mp_int_compare_zero(¬2) != 0) {+ if (mp_int_is_odd(¬1) && mp_int_is_odd(¬2)) mp_int_add(&and_res, &bit_val, &and_res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(¬1, 1, ¬1, NULL); mp_int_div_pow2(¬2, 1, ¬2, NULL);+ }+ mp_int_neg(&and_res, rop); mp_int_sub_value(rop, 1, rop);+ mp_int_clear(¬1); mp_int_clear(¬2); mp_int_clear(&and_res); mp_int_clear(&bit_val);+ } else {+ // Mixed: - ( (~B) & ~A ) - 1+ __imath_mpz_t pos_op, not_neg, and_not, bit_val;+ mp_int_init_copy(&pos_op, (mpz_ptr)(s1 >= 0 ? op1 : op2));+ mp_int_init(¬_neg); mp_int_neg((mpz_ptr)(s1 < 0 ? op1 : op2), ¬_neg); mp_int_sub_value(¬_neg, 1, ¬_neg);+ mp_int_init(&and_not); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(¬_neg) != 0) {+ if (mp_int_is_odd(¬_neg) && !mp_int_is_odd(&pos_op)) mp_int_add(&and_not, &bit_val, &and_not);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(¬_neg, 1, ¬_neg, NULL); mp_int_div_pow2(&pos_op, 1, &pos_op, NULL);+ }+ mp_int_neg(&and_not, rop); mp_int_sub_value(rop, 1, rop);+ mp_int_clear(&pos_op); mp_int_clear(¬_neg); mp_int_clear(&and_not); mp_int_clear(&bit_val);+ }+}++static inline void mpz_xor(mpz_ptr rop, mpz_srcptr op1, mpz_srcptr op2) {+ int s1 = mp_int_compare_zero((mpz_ptr)op1);+ int s2 = mp_int_compare_zero((mpz_ptr)op2);+ + if ((s1 >= 0 && s2 >= 0) || (s1 < 0 && s2 < 0)) {+ __imath_mpz_t t1, t2, res, bit_val;+ mp_int_init(&res); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ if (s1 >= 0) {+ mp_int_init_copy(&t1, (mpz_ptr)op1); mp_int_init_copy(&t2, (mpz_ptr)op2);+ } else {+ mp_int_init(&t1); mp_int_neg((mpz_ptr)op1, &t1); mp_int_sub_value(&t1, 1, &t1);+ mp_int_init(&t2); mp_int_neg((mpz_ptr)op2, &t2); mp_int_sub_value(&t2, 1, &t2);+ }+ while (mp_int_compare_zero(&t1) != 0 || mp_int_compare_zero(&t2) != 0) {+ if (mp_int_is_odd(&t1) ^ mp_int_is_odd(&t2)) mp_int_add(&res, &bit_val, &res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(&t1, 1, &t1, NULL); mp_int_div_pow2(&t2, 1, &t2, NULL);+ }+ mp_int_copy(&res, rop);+ mp_int_clear(&t1); mp_int_clear(&t2); mp_int_clear(&res); mp_int_clear(&bit_val);+ } else {+ // Mixed: - (pos_op ^ (~neg_op)) - 1+ __imath_mpz_t pos_op, not_neg, xor_res, bit_val;+ mp_int_init_copy(&pos_op, (mpz_ptr)(s1 >= 0 ? op1 : op2));+ mp_int_init(¬_neg); mp_int_neg((mpz_ptr)(s1 < 0 ? op1 : op2), ¬_neg); mp_int_sub_value(¬_neg, 1, ¬_neg);+ mp_int_init(&xor_res); mp_int_init(&bit_val); mp_int_set_value(&bit_val, 1);+ while (mp_int_compare_zero(&pos_op) != 0 || mp_int_compare_zero(¬_neg) != 0) {+ if (mp_int_is_odd(&pos_op) ^ mp_int_is_odd(¬_neg)) mp_int_add(&xor_res, &bit_val, &xor_res);+ mp_int_mul_pow2(&bit_val, 1, &bit_val);+ mp_int_div_pow2(&pos_op, 1, &pos_op, NULL); mp_int_div_pow2(¬_neg, 1, ¬_neg, NULL);+ }+ mp_int_neg(&xor_res, rop); mp_int_sub_value(rop, 1, rop);+ mp_int_clear(&pos_op); mp_int_clear(¬_neg); mp_int_clear(&xor_res); mp_int_clear(&bit_val);+ }+}++static inline mp_bitcnt_t mpz_popcount(mpz_srcptr x) {+ if (mp_int_compare_zero((mpz_ptr)x) < 0) {+ return ~(mp_bitcnt_t)0;+ }++ __imath_mpz_t t;+ mp_int_init_copy(&t, (mpz_ptr)x);+ mp_bitcnt_t count = 0;+ while (mp_int_compare_zero(&t) != 0) {+ if (mp_int_is_odd(&t)) count++;+ mp_int_div_pow2(&t, 1, &t, NULL);+ }+ mp_int_clear(&t);+ return count;+}++static inline int mpz_init_set_str(mpz_ptr rop, const char *str, int base) {+ mp_int_init(rop);+ if (mpz_set_str(rop, str, base) == 0) {+ return 0;+ }+ return -1;+}++#endif /* IMGMP_H */
@@ -1728,13 +1728,11 @@ #else // __APPLE__ -#include <sys/auxv.h>- // Don't use asm/hwcap.h, it does not seem to exist on all platforms. // #define USE_HWCAP #ifdef USE_HWCAP-+#include <sys/auxv.h> #include <asm/hwcap.h> #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
@@ -0,0 +1,75 @@+/*+ Name: macros.c+ Purpose: Support macros for temporary variable handling.+ Author: M. J. Fromberger++ Copyright (C) 2002 Michael J. Fromberger, All Rights Reserved.++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.+ */++// Discourage direct inclusion from the .h files.+#if !defined(USE_IMATH_INTERNAL_TEMP_MACROS)+#error This file should not be included from library headers.+#endif++/* Declare a block of N temporary mpz_t values.+ These values are initialized to zero.+ You must add CLEANUP_TEMP() at the end of the function.+ Use TEMP(i) to access a pointer to the ith value.+ */+#define DECLARE_TEMP(N) \+ struct { \+ mpz_t value[(N)]; \+ int len; \+ mp_result err; \+ } temp_ = { \+ .len = (N), \+ .err = MP_OK, \+ }; \+ do { \+ for (int i = 0; i < temp_.len; i++) { \+ mp_int_init(TEMP(i)); \+ } \+ } while (0)++/* Clear all allocated temp values. */+#define CLEANUP_TEMP() \+ CLEANUP: \+ do { \+ for (int i = 0; i < temp_.len; i++) { \+ mp_int_clear(TEMP(i)); \+ } \+ if (temp_.err != MP_OK) { \+ return temp_.err; \+ } \+ } while (0)++/* A pointer to the kth temp value. */+#define TEMP(K) (temp_.value + (K))++/* Evaluate E, an expression of type mp_result expected to return MP_OK. If+ the value is not MP_OK, the error is cached and control resumes at the+ cleanup handler, which returns it.+*/+#define REQUIRE(E) \+ do { \+ temp_.err = (E); \+ if (temp_.err != MP_OK) goto CLEANUP; \+ } while (0)
@@ -3,6 +3,7 @@ #include "config.h" #include <inttypes.h>+#include <stddef.h> #include <stdlib.h> #include <time.h> #if WANT_MATH@@ -26,7 +27,6 @@ typedef intptr_t value_t; /* Make value the same size as pointers, since they are in a union */ typedef uintptr_t uvalue_t; /* Make unsigned value the same size as pointers, since they are in a union */ typedef intptr_t stackptr_t; /* Index into stack */-typedef struct node* NODEPTR; typedef void (*HsFunPtr)(void); #define VALUE_MIN INTPTR_MIN@@ -42,13 +42,14 @@ struct ffe_entry { const char *ffe_name;- NODEPTR ffe_value;+ struct node *ffe_value; }; extern struct ffe_entry *xffe_table; from_t mhs_from_Double(intptr_t, int, flt64_t); from_t mhs_from_Float(intptr_t, int, flt32_t); from_t mhs_from_Int(intptr_t, int, intptr_t);+from_t mhs_from_Bool(intptr_t, int, intptr_t); from_t mhs_from_Int64(intptr_t, int, int64_t); from_t mhs_from_Word(intptr_t, int, uintptr_t); from_t mhs_from_Word8(intptr_t, int, uintptr_t);@@ -76,6 +77,7 @@ flt64_t mhs_to_Double(intptr_t, int); flt32_t mhs_to_Float(intptr_t, int); intptr_t mhs_to_Int(intptr_t, int);+intptr_t mhs_to_Bool(intptr_t, int); int64_t mhs_to_Int64(intptr_t, int); uintptr_t mhs_to_Word(intptr_t, int); uint8_t mhs_to_Word8(intptr_t, int);@@ -99,7 +101,7 @@ intptr_t mhs_to_CIntPtr(intptr_t, int); uintptr_t mhs_to_CUIntPtr(intptr_t, int); -void ffe_push(NODEPTR);+void ffe_push(struct node *); void ffe_pop(void); stackptr_t ffe_alloc(void); void ffe_apply(void);
@@ -80,6 +80,16 @@ #define WANT_ENV 0 /*+ * Use GMP for bignums+ */+#define WANT_GMP 0++/*+ * Use imath for bignums+ */+#define WANT_IMATH 0++/* * Number of bits in a word. Only 32 and 64 are supported. */ //#define WORD_SIZE 64@@ -109,7 +119,7 @@ /* * Get time since some epoch in milliseconds. */-/* #define GETTIMEMILLI */+/* #define GETTIMEMICRO */ /*@@ -122,6 +132,7 @@ #define GCRED 0 /* do some reductions during GC */ #define INTTABLE 0 /* use fixed table of small INT nodes */ #define SANITY 0 /* do some sanity checks */+#define MARK_PFQ 0 /* no GC prefetch ring: tiny heap, small C stack */ #define STACKOVL 0 /* check for stack overflow */ #include <stdbool.h>
@@ -72,7 +72,7 @@ /* * Get time since some epoch in milliseconds. */-/* #define GETTIMEMILLI */+/* #define GETTIMEMICRO */ /*@@ -85,6 +85,7 @@ #define GCRED 0 /* do some reductions during GC */ #define INTTABLE 1 /* use fixed table of small INT nodes */ #define SANITY 1 /* do some sanity checks */+#define MARK_PFQ 0 /* no GC prefetch ring: tiny heap, small C stack */ #define STACKOVL 1 /* check for stack overflow */ #define HEAP_CELLS 4000
@@ -80,9 +80,12 @@ #define WANT_ERRNO 1 /*- * overflow detection in arithmetic+ * Overflow detection in Int and Int64 arithmetic.+ * It is off, so they wrap around, as in GHC. Data.Hashable relies on that. */-#define WANT_OVERFLOW 1+#if !defined(WANT_OVERFLOW)+#define WANT_OVERFLOW 0+#endif /* * Enable non-blocking IO polling.@@ -93,6 +96,25 @@ * Include socket() & co */ #define WANT_SOCKET 1++/*+ * Use GMP for bignums+ */+#if !defined(WANT_GMP)+#define WANT_GMP 0+#endif++/*+ * Use imath for bignums, unless GMP is used.+ * With -DWANT_IMATH=0 (and no GMP) Integer is implemented in Haskell.+ */+#if !defined(WANT_IMATH)+#if WANT_GMP+#define WANT_IMATH 0+#else+#define WANT_IMATH 1+#endif+#endif /* * Use CPU counters.
@@ -2,6 +2,8 @@ * See LICENSE file for full license. */ +#include <limits.h> /* ULONG_MAX, ULLONG_MAX for the FFS selection */+ /* * Find First Set * This macro should be defined.@@ -21,8 +23,10 @@ #define FFS ffsl #elif defined(__has_builtin)-#if __has_builtin(__builtin__ffsl)+#if UINTPTR_MAX == ULONG_MAX && __has_builtin(__builtin_ffsl) #define FFS __builtin_ffsl+#elif UINTPTR_MAX == ULLONG_MAX && __has_builtin(__builtin_ffsll)+#define FFS __builtin_ffsll #endif /* __has_builtin(__builtin_ffsl) */ #endif /* if defined(...) */ #endif /* INTPTR_MAX == 0x7fffffff */@@ -87,8 +91,20 @@ } /* Allow a thread switch in yield() */-#define YIELD_EXTRA do { if (!is_drawing) emscripten_sleep(0); } while(0)+static inline void+yield_extra(void)+{+ static double last;+ double now = emscripten_get_now();+ if (!is_drawing && (now - last) > 32) {+ /* Only do this a few time a second. If done too often JS will enforce a minimum 4ms delay. */+ last = now;+ emscripten_sleep(0);+ }+} +#define YIELD_EXTRA yield_extra()+ // Create a C function called c_waitForFrame // that executes the JavaScript inside the block. EM_ASYNC_JS(void, c_waitForFrame, (), {@@ -171,13 +187,13 @@ * Get time since some epoch in milliseconds. */ uintptr_t-gettimemilli(void)+gettimemicro(void) { struct timeval tv; (void)gettimeofday(&tv, NULL);- return (uintptr_t)(tv.tv_sec * 1000 + tv.tv_usec / 1000);+ return (uintptr_t)(tv.tv_sec * 1000000 + tv.tv_usec); }-#define GETTIMEMILLI gettimemilli+#define GETTIMEMICRO gettimemicro /* * Create a unique file name.@@ -372,4 +388,39 @@ close(fd); return result; }++int64_t+get_file_size(const char *path)+{+ struct stat st;++ if (stat(path, &st) < 0) {+ return -1;+ }+ return st.st_size;+}++int64_t+get_fd_size(int fd)+{+ struct stat st;++ if (fstat(fd, &st) < 0) {+ return -1;+ }+ return st.st_size;+}++#if WANT_STDIO+int64_t+get_FILE_size(FILE *f)+{+ int fd = fileno(f);+ if (fd < 0) {+ return -1;+ }+ return get_fd_size(fd);+}+#endif /* WANT_STDIO */+ #endif /* WANT_DIR */
@@ -98,25 +98,18 @@ * Get time since some epoch in milliseconds. * If undefined, return 0. */-#define GETTIMEMILLI gettimemilli+#define GETTIMEMICRO gettimemicro uint64_t-gettimemilli(void)+gettimemicro(void) {- static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);-- SYSTEMTIME system_time;- FILETIME file_time;- uint64_t time, msec;-- GetSystemTime( &system_time );- SystemTimeToFileTime( &system_time, &file_time );- time = ((uint64_t)file_time.dwLowDateTime ) ;- time += ((uint64_t)file_time.dwHighDateTime) << 32;-- msec = (time - EPOCH) / 10000L;- //msec = time + system_time.wMilliseconds;- return msec;+ FILETIME ft;+ // 100-nanosecond intervals since January 1, 1601 (UTC)+ GetSystemTimePreciseAsFileTime(&ft);+ uint64_t intervals = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime;+ const uint64_t UNIX_EPOCH_OFFSET = 11644473600ULL * 10000000ULL;+ intervals -= UNIX_EPOCH_OFFSET;+ return intervals / 10; } /*@@ -343,4 +336,39 @@ return _chmod(path, wperms); }++int64_t+get_file_size(const char *path)+{+ struct _stat64 st;++ if (_stat64(path, &st) < 0) {+ return -1;+ }+ return st.st_size;+}++int64_t+get_fd_size(int fd)+{+ struct _stat64 st;++ if (_fstat64(fd, &st) < 0) {+ return -1;+ }+ return st.st_size;+}++#if WANT_STDIO+int64_t+get_FILE_size(FILE *f)+{+ int fd = _fileno(f);+ if (fd < 0) {+ return -1;+ }+ return get_fd_size(fd);+}+#endif /* WANT_STDIO */+ #endif /* defined(WANT_DIR) */
@@ -9,3 +9,4 @@ print [ op x y | x <- vals, y <- vals, y /= 0, op <- [quot, rem] ] print [ op x y | x <- vals, y <- vals, op <- [(==),(/=),(<),(<=),(>),(>=)] ] print [ op x y | x <- vals, y <- vals, let op = compare ]+ print [ op minBound (-1 :: Int) | op <- [rem, mod] ]
@@ -2,3 +2,4 @@ [1,0,2,-1,5,0,-5,0,-2,-1,-1,0,0,-2,1,0,2,0,-2,0,-1,0,0,-2,0,-1,0,-1,1,0,-1,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,-1,0,1,0,0,1,0,1,0,2,-1,0,-2,0,2,0,1,0,0,2,-1,0,-2,1,-5,0,5,0,2,1,1,0] [True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True] [EQ,LT,LT,LT,LT,LT,LT,GT,EQ,LT,LT,LT,LT,LT,GT,GT,EQ,LT,LT,LT,LT,GT,GT,GT,EQ,LT,LT,LT,GT,GT,GT,GT,EQ,LT,LT,GT,GT,GT,GT,GT,EQ,LT,GT,GT,GT,GT,GT,GT,EQ]+[0,0]
@@ -14,6 +14,7 @@ print [ op x y | x <- vals, y <- vals, y /= 0, op <- [quot, rem] ] print [ op x y | x <- vals, y <- vals, op <- [(==),(/=),(<),(<=),(>),(>=)] ] print [ op x y | x <- vals, y <- vals, let op = compare ]+ print [ op minBound (-1 :: Int64) | op <- [rem, mod] ] print [ minBound, maxBound :: Int64] print [ op x y | x <- uvals, y <- uvals, op <- [(+),( - ),(*)] ]
@@ -2,6 +2,7 @@ [1,0,2,-1,5,0,-5,0,-2,-1,-1,0,0,-2,1,0,2,0,-2,0,-1,0,0,-2,0,-1,0,-1,1,0,-1,0,0,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,-1,0,1,0,0,1,0,1,0,2,-1,0,-2,0,2,0,1,0,0,2,-1,0,-2,1,-5,0,5,0,2,1,1,0] [True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True,False,True,True,True,False,False,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,False,True,False,False,True,True,True,False,False,True,False,True] [EQ,LT,LT,LT,LT,LT,LT,GT,EQ,LT,LT,LT,LT,LT,GT,GT,EQ,LT,LT,LT,LT,GT,GT,GT,EQ,LT,LT,LT,GT,GT,GT,GT,EQ,LT,LT,GT,GT,GT,GT,GT,EQ,LT,GT,GT,GT,GT,GT,GT,EQ]+[0,0] [-9223372036854775808,9223372036854775807] [18446744073709551606,0,25,18446744073709551609,18446744073709551613,10,18446744073709551610,18446744073709551612,5,18446744073709551611,18446744073709551611,0,18446744073709551612,18446744073709551610,18446744073709551611,18446744073709551613,18446744073709551609,18446744073709551606,0,18446744073709551606,18446744073709551591,18446744073709551609,3,10,18446744073709551612,0,4,18446744073709551613,18446744073709551615,2,18446744073709551614,18446744073709551614,0,18446744073709551615,18446744073709551613,18446744073709551614,0,18446744073709551612,18446744073709551612,3,18446744073709551609,18446744073709551606,18446744073709551610,4,5,18446744073709551613,1,2,18446744073709551614,0,1,18446744073709551615,18446744073709551615,0,0,18446744073709551614,18446744073709551615,1,18446744073709551613,18446744073709551614,4,18446744073709551610,18446744073709551611,18446744073709551611,5,0,18446744073709551614,2,0,18446744073709551615,1,0,0,0,0,1,18446744073709551615,0,2,18446744073709551614,0,5,18446744073709551611,0,18446744073709551612,6,18446744073709551611,18446744073709551615,3,18446744073709551614,0,2,18446744073709551615,1,1,0,2,0,1,3,18446744073709551615,2,6,18446744073709551612,5,18446744073709551613,7,18446744073709551606,0,4,18446744073709551612,1,3,18446744073709551614,2,2,0,3,1,2,4,0,4,7,18446744073709551613,10,0,10,18446744073709551591,3,7,18446744073709551606,4,6,18446744073709551611,5,5,0,6,4,5,7,3,10,10,0,25] [1,0,0,18446744073709551611,0,18446744073709551611,18446744073709551611,0,9223372036854775805,1,3689348814741910322,1,1,3,1,0,0,18446744073709551614,18446744073709551614,0,9223372036854775807,0,3689348814741910322,4,1,4,1,1,1,0,18446744073709551615,0,9223372036854775807,1,3689348814741910323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,0,1,0,2,0,2,0,2,2,0,1,0,0,2,0,5,0,5,0,5,5,0,2,1,1,0]
@@ -4,9 +4,23 @@ main :: IO () main = do- let b = runST $ do+ let b1 = runST $ do a <- newMutableByteArray 5 writeWord8 a 1 65 writeWord8 a 3 66+ c <- readWord8 a 1+ writeWord8 a 4 c freezeMutableByteArray a- print b+ print b1++ let b2 = runST $ do+ a <- newMutableEmptyByteArray 2+ appendByte a 110+ appendByte a 111+ appendByte a 112+ appendByte a 113+ appendByte a 114+ appendChar a 'A'+ appendChar a 'å'+ freezeMutableByteArray a+ print b2
@@ -1,1 +1,2 @@-"\NULA\NULB\NUL"+"\NULA\NULBA"+"nopqrA\195\165"
@@ -50,6 +50,50 @@ -- Multiple solutions d = a +class E a where+ e :: a -> a++instance A Int Int where+ a x = x++-- Class synonym instances+type F a = E a+instance F Int where+ e x = x++-- Multiple instances at once+instance (B Int Int, C Int Int, D Int Int)++-- Multiple instances with methods+instance (A Char Char, E Char) where+ a x = x+ e x = x++-- tuple synonym+type ABCD a b = (A a b, B a b, C a b, D a b)+instance ABCD Bool Bool++-- constraints+type OrddT x y = (E x, Ordd (x,y))+instance forall a b . (Eqq a, Eqq b, Ord a, Ord b) => OrddT a b where+ (<==) = (<=)+ e x = x++-- cascading tuples+instance ((B Char Int, B Int Char), B Char Char, (A Int Char, A Char Int))++-- unrelated instances+class G a where+ g' :: a -> a+instance G Int where+ g' x = x+instance G Bool where+ g' = not+class G a => H a where+ h' :: a -> a+ h' = g'+instance (H Int, H Bool)+ main :: IO () main = do print $ f (5::Int)@@ -57,3 +101,7 @@ print $ h (5::Int) 'a' print $ f [88::Int] print $ f (1::Int, 'a')+ print (a ('a'::Char)::Char)+ print (e ('b'::Char)::Char)+ print $ h' True+ print $ h' (1::Int)
@@ -3,3 +3,7 @@ True True True+'a'+'b'+False+1
@@ -1,6 +1,5 @@ module Coerce where import Data.Coerce-import Data.Word newtype NT = NT Int deriving (Show)@@ -37,7 +36,6 @@ print (coerce (List [3::Int, 4]) :: [Int]) print (coerce (List [NT 5, NT 6]) :: [NT]) print (coerce (List [NT 7, NT 8]) :: [Int])- print (coerce "hello" :: [Word8]) print (f (NT 12) :: Int) print (g (NT 42)) print (h (NT 24) :: Int)
@@ -4,7 +4,6 @@ [3,4] [NT 5,NT 6] [7,8]-[104,101,108,108,111] 12 42 24
@@ -0,0 +1,48 @@+{-# LANGUAGE CPP #-}+-- As in GHC, the preprocessor defines os_HOST_OS and arch_HOST_ARCH (and+-- the _BUILD_ versions), with the names from System.Info.+module CppHost(main) where+import System.Info (arch, os)++cppOS :: String+#if defined(darwin_HOST_OS) && defined(darwin_BUILD_OS)+cppOS = "darwin"+#elif defined(linux_HOST_OS) && defined(linux_BUILD_OS)+cppOS = "linux"+#elif defined(mingw32_HOST_OS) && defined(mingw32_BUILD_OS)+cppOS = "mingw32"+#elif defined(windows_HOST_OS) && defined(windows_BUILD_OS)+cppOS = "windows"+#elif defined(freebsd_HOST_OS) && defined(freebsd_BUILD_OS)+cppOS = "freebsd"+#else+cppOS = "unknown"+#endif++cppArch :: String+#if defined(aarch64_HOST_ARCH) && defined(aarch64_BUILD_ARCH)+cppArch = "aarch64"+#elif defined(x86_64_HOST_ARCH) && defined(x86_64_BUILD_ARCH)+cppArch = "x86_64"+#elif defined(i386_HOST_ARCH) && defined(i386_BUILD_ARCH)+cppArch = "i386"+#elif defined(arm_HOST_ARCH) && defined(arm_BUILD_ARCH)+cppArch = "arm"+#elif defined(powerpc64le_HOST_ARCH) && defined(powerpc64le_BUILD_ARCH)+cppArch = "powerpc64le"+#elif defined(powerpc64_HOST_ARCH) && defined(powerpc64_BUILD_ARCH)+cppArch = "powerpc64"+#elif defined(powerpc_HOST_ARCH) && defined(powerpc_BUILD_ARCH)+cppArch = "powerpc"+#elif defined(riscv64_HOST_ARCH) && defined(riscv64_BUILD_ARCH)+cppArch = "riscv64"+#elif defined(s390x_HOST_ARCH) && defined(s390x_BUILD_ARCH)+cppArch = "s390x"+#else+cppArch = "unknown"+#endif++main :: IO ()+main = do+ print (cppOS == os)+ print (cppArch == arch)
@@ -0,0 +1,2 @@+True+True
@@ -0,0 +1,27 @@+module CreateDir(main) where+import Control.Exception+import System.Directory++-- Print whether the action raised an IOException.+check :: String -> IO () -> IO ()+check msg act = do+ r <- try act+ putStrLn $ msg ++ ": " ++ either (\ (e :: IOException) -> "error") (const "ok") r++-- Everything goes under cdtest.tmp (ignored by git), which is left+-- behind like the other .tmp files; a rerun finds it already there.+main :: IO ()+main = do+ check "nested" $ createDirectoryIfMissing True "cdtest.tmp/a/b"+ doesDirectoryExist "cdtest.tmp/a/b" >>= print+ check "nested again" $ createDirectoryIfMissing True "cdtest.tmp/a/b"+ check "trailing slash" $ createDirectoryIfMissing True "cdtest.tmp/a/c/"+ check "existing" $ createDirectoryIfMissing False "cdtest.tmp/a"+ check "missing parent" $ createDirectoryIfMissing False "cdtest.tmp/x/y"+ writeFile "cdtest.tmp/f" ""+ check "file in the way" $ createDirectoryIfMissing True "cdtest.tmp/f/sub"+ check "file at target" $ createDirectoryIfMissing False "cdtest.tmp/f"+ cwd <- getCurrentDirectory+ check "empty" $ createDirectoryIfMissing True ""+ check "absolute" $ createDirectoryIfMissing True (cwd ++ "/cdtest.tmp/d/e")+ doesDirectoryExist "cdtest.tmp/d/e" >>= print
@@ -0,0 +1,11 @@+nested: ok+True+nested again: ok+trailing slash: ok+existing: ok+missing parent: error+file in the way: error+file at target: error+empty: ok+absolute: ok+True
@@ -0,0 +1,40 @@+module Dynamic(main) where+import Data.Int+import Data.Word+import Foreign.C.Types+import Foreign.Marshal.Alloc+import Foreign.Ptr+import Foreign.Storable++foreign import ccall "dynamic.h &sub3" p_sub3 :: FunPtr (CInt -> CInt -> CInt -> IO CInt)+foreign import ccall "dynamic.h &neg8" p_neg8 :: FunPtr (Int8 -> Int8)+foreign import ccall "dynamic.h &inc16" p_inc16 :: FunPtr (Word16 -> IO Word16)+foreign import ccall "dynamic.h &halve" p_halve :: FunPtr (CFloat -> CFloat)+foreign import ccall "dynamic.h &scale" p_scale :: FunPtr (CDouble -> CLong -> IO CDouble)+foreign import ccall "dynamic.h &big" p_big :: FunPtr (IO CLLong)+foreign import ccall "dynamic.h &store" p_store :: FunPtr (Ptr CInt -> CInt -> IO ())+foreign import ccall "dynamic.h &pick" p_pick :: FunPtr (CInt -> IO (FunPtr (CInt -> CInt -> CInt -> IO CInt)))++foreign import ccall "dynamic" sub3 :: FunPtr (CInt -> CInt -> CInt -> IO CInt) -> CInt -> CInt -> CInt -> IO CInt+foreign import ccall "dynamic" neg8 :: FunPtr (Int8 -> Int8) -> Int8 -> Int8+foreign import ccall "dynamic" inc16 :: FunPtr (Word16 -> IO Word16) -> Word16 -> IO Word16+foreign import ccall "dynamic" halve :: FunPtr (CFloat -> CFloat) -> CFloat -> CFloat+foreign import ccall "dynamic" scale :: FunPtr (CDouble -> CLong -> IO CDouble) -> CDouble -> CLong -> IO CDouble+foreign import ccall "dynamic" big :: FunPtr (IO CLLong) -> IO CLLong+foreign import ccall "dynamic" store :: FunPtr (Ptr CInt -> CInt -> IO ()) -> Ptr CInt -> CInt -> IO ()+foreign import ccall "dynamic" pick :: FunPtr (CInt -> IO (FunPtr (CInt -> CInt -> CInt -> IO CInt))) -> CInt -> IO (FunPtr (CInt -> CInt -> CInt -> IO CInt))++main :: IO ()+main = do+ print =<< sub3 p_sub3 2 5 10+ print (neg8 p_neg8 5, neg8 p_neg8 (-128))+ print =<< inc16 p_inc16 65535+ print (halve p_halve 3)+ print =<< scale p_scale 1.5 (-4)+ print =<< big p_big+ alloca $ \ p -> do+ store p_store p (-42)+ print =<< peek p+ f <- pick p_pick 1+ print (f == castFunPtr p_sub3)+ print =<< sub3 f 100 (sum [1..10]) 1
@@ -0,0 +1,9 @@+-13+(-5,-128)+0+1.5+-6.0+-1234567890123+-42+True+44
@@ -3,6 +3,8 @@ import Data.Int import Data.Word import Numeric.Natural+import Data.Ratio+import Data.Enum data T = A | B | C deriving (Bounded, Enum, Show)@@ -58,3 +60,12 @@ print [bigInt-2, bigInt..bigInt+2] print $ take 3 [bigInt-2, bigInt..] print [10 :: Natural, 5..]++ -- Double, Float, Rational+ print (fractionalEnumFromTo 1.0 3.5 :: [Double])+ print (fractionalEnumFromThenTo 1 3 6 :: [Float])+ print (fractionalEnumFromThenTo 5 3 0 :: [Double])+ print (fractionalEnumFromTo 1 2.5 :: [Rational])+ print (fractionalEnumFromThenTo 0 0.1 1 :: [Double])+ print $ take 11 (fractionalEnumFromThen 0 0.1 :: [Double])+ print $ take 3 (fractionalEnumFrom 0.1 :: [Double])
@@ -45,3 +45,10 @@ [18446744073709551614,18446744073709551616,18446744073709551618] [18446744073709551614,18446744073709551616,18446744073709551618] [10,5,0]+[1.0,2.0,3.0,4.0]+[1.0,3.0,5.0,7.0]+[5.0,3.0,1.0,-1.0]+[1 % 1,2 % 1,3 % 1]+[0.0,0.1,0.2,0.30000000000000004,0.4,0.5,0.6000000000000001,0.7000000000000001,0.8,0.9,1.0]+[0.0,0.1,0.2,0.30000000000000004,0.4,0.5,0.6000000000000001,0.7000000000000001,0.8,0.9,1.0]+[0.1,1.1,2.1]
@@ -0,0 +1,1 @@+module Error1() awhere
@@ -0,0 +1,7 @@+./Error1.hs:1:17: error: syntax+ found: awhere+ expected: where+ |+1 | module Error1() awhere+ | ^+
@@ -0,0 +1,1 @@+module Error10(T(..)) where
@@ -0,0 +1,5 @@+./Error10.hs:1:16: error: undefined export: T+ |+1 | module Error10(T(..)) where+ | ^+
@@ -0,0 +1,2 @@+module Error100() where+import NoSuchModule
@@ -0,0 +1,7 @@+./Error100.hs:2:8: error: Module not found: NoSuchModule+search path=[".","../lib"]+package path=[]+ |+2 | import NoSuchModule+ | ^+
@@ -0,0 +1,2 @@+module Error101() where+import {-# SOURCE #-} NoSuchBootModule
@@ -0,0 +1,1 @@+mhs: error: boot module not found: NoSuchBootModule
@@ -0,0 +1,2 @@+module Error102(f) where+f ((1) x) = x
@@ -0,0 +1,5 @@+./Error102.hs:2:5: error: Bad pattern %1+ |+2 | f ((1) x) = x+ | ^+
@@ -0,0 +1,2 @@+module Error103(f) where+f (x :: forall a . a -> a) = x
@@ -0,0 +1,5 @@+./Error103.hs:2:4: error: type: Subsumption check failed+ |+2 | f (x :: forall a . a -> a) = x+ | ^+
@@ -0,0 +1,3 @@+module Error104() where+class C+deriving instance C
@@ -0,0 +1,5 @@+./Error104.hs:3:19: error: not a class Error104.C+ |+3 | deriving instance C+ | ^+
@@ -0,0 +1,2 @@+module Error105(x) where+x = 1 * - 2
@@ -0,0 +1,5 @@+./Error105.hs:2:11: error: bad prefix expression+ |+2 | x = 1 * - 2+ | ^+
@@ -0,0 +1,2 @@+module Error106() where+x = '\z'
@@ -0,0 +1,5 @@+./Error106.hs:2:8: error: Bad \ escape: 'z'+ |+2 | x = '\z'+ | ^+
@@ -0,0 +1,7 @@+module Error107(main) where+import Error107A++instance Show T where show _ = "xxx"++main :: IO ()+main = print T
@@ -0,0 +1,5 @@+./Error107A.hs:5:10: error: Duplicate instance Text.Show.Show Error107A.T at ./Error107.hs:4:10+ |+5 | instance Show T where show _ = "T"+ | ^+
@@ -0,0 +1,5 @@+module Error107A(T(..)) where++data T = T++instance Show T where show _ = "T"
@@ -0,0 +1,1 @@+module Error11(x) where
@@ -0,0 +1,5 @@+./Error11.hs:1:16: error: undefined export: x+ |+1 | module Error11(x) where+ | ^+
@@ -0,0 +1,8 @@+module Error110() where+import qualified Prelude()++data E = forall a . E () a+ deriving()++f :: E -> a+f (E i a) = a
@@ -0,0 +1,4 @@+module Error111(main) where++main :: IO ()+main = putStrLn "abc\x110000"
@@ -0,0 +1,5 @@+./Error111.hs:4:29: error: Bad \ escape: character code is too big+ |+4 | main = putStrLn "abc\x110000"+ | ^+
@@ -0,0 +1,11 @@+{-# LANGUAGE RoleAnnotations #-}+module Error112() where+import Data.Coerce++type role N nominal+data N a = N a+newtype Age = Age Int++-- A nominal argument cannot be coerced+n :: N Age -> N Int+n = coerce
@@ -0,0 +1,7 @@+./Error112.hs:11:5: error: type mismatch+ expected: Int+ actual: Age+ |+11 | n = coerce+ | ^+
@@ -0,0 +1,10 @@+{-# LANGUAGE RoleAnnotations #-}+module Error113() where+import Data.Coerce++type role P phantom representational+data P a b = P b++-- A representational argument must be coercible+p :: P Bool Bool -> P Char Int+p = coerce
@@ -0,0 +1,5 @@+./Error113.hs:10:5: error: no instance for (Coercible Bool Int)+ |+10 | p = coerce+ | ^+
@@ -0,0 +1,12 @@+{-# LANGUAGE RoleAnnotations #-}+module Error114() where+import Data.Coerce++type role N nominal+data N a = N a+newtype Age = Age Int+type S x = N x++-- A nominal argument cannot be coerced, even through a type synonym+s :: S Age -> S Int+s = coerce
@@ -0,0 +1,7 @@+./Error114.hs:12:5: error: type mismatch+ expected: Int+ actual: Age+ |+12 | s = coerce+ | ^+
@@ -0,0 +1,12 @@+{-# LANGUAGE RoleAnnotations #-}+module Error115() where+import Data.Coerce++type role N nominal+data N a = N a+newtype Age = Age Int+newtype W = W (N Age)++-- A nominal argument cannot be coerced, even inside a newtype+w :: W -> N Int+w = coerce
@@ -0,0 +1,7 @@+./Error115.hs:12:5: error: type mismatch+ expected: Int+ actual: Age+ |+12 | w = coerce+ | ^+
@@ -0,0 +1,7 @@+module Error116() where+import Data.Coerce+import Data.Word++-- The constructors of Char and Word8 are not in scope+x :: Word8+x = coerce 'a'
@@ -0,0 +1,5 @@+./Error116.hs:7:5: error: no instance for (Coercible Char Word8)+ |+7 | x = coerce 'a'+ | ^+
@@ -0,0 +1,2 @@+module Error12(lookup) where+import TestMap
@@ -0,0 +1,5 @@+./Error12.hs:1:16: error: ambiguous export: lookup [Data.List.lookup,TestMap.lookup]+ |+1 | module Error12(lookup) where+ | ^+
@@ -0,0 +1,6 @@+module Error120 where++data T = forall a . C Int a++foo :: T -> a+foo (C _ a) = a
@@ -0,0 +1,7 @@+./Error120.hs:6:15: error: type mismatch+ expected: a+ actual: a+ |+6 | foo (C _ a) = a+ | ^+
@@ -0,0 +1,4 @@+module Error13() where+import TestMap+a :: ()+a = lookup
@@ -0,0 +1,5 @@+./Error13.hs:4:5: error: ambiguous value: lookup [Data.List.lookup,TestMap.lookup]+ |+4 | a = lookup+ | ^+
@@ -0,0 +1,9 @@+module Error14() where+infixl 5 ++++infixr 5 ***+(+++) :: Int -> Int -> Int+(+++) = (+)+(***) :: Int -> Int -> Int+(***) = (*)+x :: Int+x = 1 +++ 2 *** 3
@@ -0,0 +1,5 @@+./Error14.hs:9:13: error: ambiguous operator expression+ |+9 | x = 1 +++ 2 *** 3+ | ^+
@@ -0,0 +1,3 @@+module Error15() where+a :: Int+a = 'a'
@@ -0,0 +1,7 @@+./Error15.hs:3:5: error: type mismatch+ expected: Int+ actual: Char+ |+3 | a = 'a'+ | ^+
@@ -0,0 +1,2 @@+module Error16() where+data T = C Maybe
@@ -0,0 +1,7 @@+./Error16.hs:2:12: error: kind mismatch+ expected: Type+ actual: Type -> Type+ |+2 | data T = C Maybe+ | ^+
@@ -0,0 +1,2 @@+module Error17() where+data T (a :: X) = T
@@ -0,0 +1,5 @@+./Error17.hs:2:14: error: undefined kind: X+ |+2 | data T (a :: X) = T+ | ^+
@@ -0,0 +1,4 @@+module Error18() where+data T = forall a . C a+x :: Int+x = let { C a = C (1::Int) } in a
@@ -0,0 +1,5 @@+./Error18.hs:4:11: error: existential type variable escapes its scope: a+ |+4 | x = let { C a = C (1::Int) } in a+ | ^+
@@ -0,0 +1,3 @@+module Error19() where+class C a where { m :: a }+instance C Int where { x = 1 }
@@ -0,0 +1,5 @@+./Error19.hs:3:24: error: superflous instance binding+ |+3 | instance C Int where { x = 1 }+ | ^+
@@ -0,0 +1,4 @@+module Error2() where+x :: Int+x = 1 ++y = 0
@@ -0,0 +1,7 @@+./Error2.hs:4:1: error: syntax+ found: ;+ expected: - LQIdent ( UQIdent [ QualString literal _primitive @ (# \ case let if QualDo do mdo+ |+4 | y = 0+ | ^+
@@ -0,0 +1,4 @@+module Error20() where+data T = C Int+x = case undefined of+ C -> True
@@ -0,0 +1,5 @@+./Error20.hs:4:7: error: too few arguments+ |+4 | C -> True+ | ^+
@@ -0,0 +1,4 @@+module Error21() where+data T = C Int+x = case undefined of+ C _ _ -> True
@@ -0,0 +1,5 @@+./Error21.hs:4:7: error: too many arguments+ |+4 | C _ _ -> True+ | ^+
@@ -0,0 +1,2 @@+module Error22() where+x = 1000000_
@@ -0,0 +1,5 @@+./Error22.hs:2:12: error: _ cannot be used as a variable+ |+2 | x = 1000000_+ | ^+
@@ -0,0 +1,2 @@+module Error23() where+x = _1000000
@@ -0,0 +1,5 @@+./Error23.hs:2:5: error: undefined value: _1000000+ |+2 | x = _1000000+ | ^+
@@ -0,0 +1,2 @@+module Error24() where+x = _0.0001
@@ -0,0 +1,5 @@+./Error24.hs:2:5: error: undefined value: _0+ |+2 | x = _0.0001+ | ^+
@@ -0,0 +1,2 @@+module Error25() where+x = 0_.0001
@@ -0,0 +1,5 @@+./Error25.hs:2:6: error: _ cannot be used as a variable+ |+2 | x = 0_.0001+ | ^+
@@ -0,0 +1,2 @@+module Error26() where+x = 0._0001
@@ -0,0 +1,5 @@+./Error26.hs:2:7: error: no instance for (HasField "_0001" Integer b)+ |+2 | x = 0._0001+ | ^+
@@ -0,0 +1,2 @@+module Error27() where+x = 0.0001_
@@ -0,0 +1,5 @@+./Error27.hs:2:11: error: _ cannot be used as a variable+ |+2 | x = 0.0001_+ | ^+
@@ -0,0 +1,2 @@+module Error28() where+x = 1e_+23
@@ -0,0 +1,5 @@+./Error28.hs:2:6: error: undefined value: e_+ |+2 | x = 1e_+23+ | ^+
@@ -0,0 +1,2 @@+module Error29() where+x = 1e+_23
@@ -0,0 +1,5 @@+./Error29.hs:2:6: error: undefined value: e+ |+2 | x = 1e+_23+ | ^+
@@ -0,0 +1,3 @@+module Error3() where+x :: Int+x = y
@@ -0,0 +1,5 @@+./Error3.hs:3:5: error: undefined value: y+ |+3 | x = y+ | ^+
@@ -0,0 +1,2 @@+module Error30() where+x = 1e_23
@@ -0,0 +1,5 @@+./Error30.hs:2:6: error: undefined value: e_23+ |+2 | x = 1e_23+ | ^+
@@ -0,0 +1,2 @@+module Error31() where+x = 1e23_
@@ -0,0 +1,5 @@+./Error31.hs:2:9: error: _ cannot be used as a variable+ |+2 | x = 1e23_+ | ^+
@@ -0,0 +1,2 @@+module Error32() where+x = _0xffff
@@ -0,0 +1,5 @@+./Error32.hs:2:5: error: undefined value: _0xffff+ |+2 | x = _0xffff+ | ^+
@@ -0,0 +1,2 @@+module Error33() where+x = 0xffff_
@@ -0,0 +1,5 @@+./Error33.hs:2:11: error: _ cannot be used as a variable+ |+2 | x = 0xffff_+ | ^+
@@ -0,0 +1,3 @@+module Error34() where+f :: Int -> String+f x = x + 1
@@ -0,0 +1,7 @@+./Error34.hs:3:7: error: type mismatch+ expected: [Char]+ actual: Int+ |+3 | f x = x + 1+ | ^+
@@ -0,0 +1,3 @@+module Error35() where+g :: [Int] -> Int+g xs = length xs ++ "a"
@@ -0,0 +1,7 @@+./Error35.hs:3:18: error: type mismatch+ expected: Int+ actual: [a]+ |+3 | g xs = length xs ++ "a"+ | ^+
@@ -0,0 +1,3 @@+module Error36() where+h :: Int -> Int+h x = if x then 1 else 2
@@ -0,0 +1,7 @@+./Error36.hs:3:10: error: type mismatch+ expected: Bool+ actual: Int+ |+3 | h x = if x then 1 else 2+ | ^+
@@ -0,0 +1,3 @@+module Error37() where+k :: Int -> Bool+k x = x == "foo"
@@ -0,0 +1,5 @@+./Error37.hs:3:12: error: no instance for (IsString Int)+ |+3 | k x = x == "foo"+ | ^+
@@ -0,0 +1,3 @@+module Error38() where+p :: Maybe Int -> Int+p (Just x) = x + y
@@ -0,0 +1,5 @@+./Error38.hs:3:18: error: undefined value: y+ |+3 | p (Just x) = x + y+ | ^+
@@ -0,0 +1,3 @@+module Error39() where+q :: Int -> Int+q x = show x
@@ -0,0 +1,7 @@+./Error39.hs:3:7: error: type mismatch+ expected: Int+ actual: [Char]+ |+3 | q x = show x+ | ^+
@@ -0,0 +1,3 @@+module Error4() where+x :: Int+x = A
@@ -0,0 +1,5 @@+./Error4.hs:3:5: error: undefined value: A+ |+3 | x = A+ | ^+
@@ -0,0 +1,3 @@+module Error40() where+r :: (Int, Bool) -> Int+r (a, b, c) = a
@@ -0,0 +1,7 @@+./Error40.hs:3:4: error: type mismatch+ expected: (Int, Bool)+ actual: (a, b, c)+ |+3 | r (a, b, c) = a+ | ^+
@@ -0,0 +1,3 @@+module Error41() where+s :: Int -> Int+s x = foldr (\a b -> a + b) 0 x
@@ -0,0 +1,7 @@+./Error41.hs:3:31: error: type mismatch+ expected: [Int]+ actual: Int+ |+3 | s x = foldr (\a b -> a + b) 0 x+ | ^+
@@ -0,0 +1,3 @@+module Error42() where+u :: a -> [a]+u x = x : x
@@ -0,0 +1,7 @@+./Error42.hs:3:11: error: type mismatch+ expected: [a]+ actual: a+ |+3 | u x = x : x+ | ^+
@@ -0,0 +1,2 @@+module Error43() where+data T = T deriving Functor
@@ -0,0 +1,5 @@+./Error43.hs:2:21: error: Bad deriving+ |+2 | data T = T deriving Functor+ | ^+
@@ -0,0 +1,2 @@+module Error44() where+class C a where { m = 1 }
@@ -0,0 +1,5 @@+./Error44.hs:2:19: error: missing method signature: m+ |+2 | class C a where { m = 1 }+ | ^+
@@ -0,0 +1,2 @@+module Error45() where+instance Int Bool
@@ -0,0 +1,7 @@+./Error45.hs:2:10: error: kind mismatch+ expected: a -> b+ actual: Type+ |+2 | instance Int Bool+ | ^+
@@ -0,0 +1,3 @@+module Error46() where+class C a where { m :: a }+instance C Int where { n = 2 }
@@ -0,0 +1,5 @@+./Error46.hs:3:24: error: superflous instance binding+ |+3 | instance C Int where { n = 2 }+ | ^+
@@ -0,0 +1,3 @@+module Error47() where+pattern P x = Q x+pattern Q x = P x
@@ -0,0 +1,5 @@+./Error47.hs:2:9: error: Cannot infer recursive pattern synonym types+ |+2 | pattern P x = Q x+ | ^+
@@ -0,0 +1,2 @@+module Error48() where+x = _
@@ -0,0 +1,5 @@+./Error48.hs:2:5: error: _ cannot be used as a variable+ |+2 | x = _+ | ^+
@@ -0,0 +1,2 @@+module Error49() where+x = do { y <- return 1 }
@@ -0,0 +1,5 @@+./Error49.hs:2:10: error: bad final do statement+ |+2 | x = do { y <- return 1 }+ | ^+
@@ -0,0 +1,3 @@+module Error5() where+x :: T+x = 1
@@ -0,0 +1,5 @@+./Error5.hs:2:6: error: undefined type: T+ |+2 | x :: T+ | ^+
@@ -0,0 +1,2 @@+module Error50() where+x = 1 @Int
@@ -0,0 +1,5 @@+./Error50.hs:2:8: error: Bad type application+ |+2 | x = 1 @Int+ | ^+
@@ -0,0 +1,3 @@+module Error51() where+data R = R { a :: Int }+x = id {..}
@@ -0,0 +1,5 @@+./Error51.hs:3:5: error: record wildcard not allowed+ |+3 | x = id {..}+ | ^+
@@ -0,0 +1,3 @@+module Error52() where+data R = R { a :: Int }+x = R { a.b = 1 }
@@ -0,0 +1,5 @@+./Error52.hs:3:9: error: Nested fields not allowed+ |+3 | x = R { a.b = 1 }+ | ^+
@@ -0,0 +1,3 @@+module Error53() where+data R = R { a :: Int }+x = R { b = 1 }
@@ -0,0 +1,5 @@+./Error53.hs:3:9: error: extra field(s) b+ |+3 | x = R { b = 1 }+ | ^+
@@ -0,0 +1,2 @@+module Error54() where+x = (1 + 2 *)
@@ -0,0 +1,5 @@+./Error54.hs:2:12: error: Bad section fixity+ |+2 | x = (1 + 2 *)+ | ^+
@@ -0,0 +1,3 @@+module Error55() where+f :: forall a -> Int -> Int+f (Just a) x = x
@@ -0,0 +1,5 @@+./Error55.hs:3:4: error: Bad required type argument+ |+3 | f (Just a) x = x+ | ^+
@@ -0,0 +1,5 @@+module Error56() where+f :: (forall a . a -> a) -> Int+f g = g 1+x :: (Int -> Int) -> Int+x = f
@@ -0,0 +1,7 @@+./Error56.hs:5:5: error: type mismatch+ expected: Int+ actual: a+ |+5 | x = f+ | ^+
@@ -0,0 +1,2 @@+module Error57() where+f (Just) = 1
@@ -0,0 +1,5 @@+./Error57.hs:2:4: error: too few arguments+ |+2 | f (Just) = 1+ | ^+
@@ -0,0 +1,2 @@+module Error58() where+f (Just 1 2) = 1
@@ -0,0 +1,5 @@+./Error58.hs:2:4: error: too many arguments+ |+2 | f (Just 1 2) = 1+ | ^+
@@ -0,0 +1,3 @@+module Error59() where+f :: forall a . a -> a+f = (id :: Int -> Int)
@@ -0,0 +1,7 @@+./Error59.hs:3:6: error: type mismatch+ expected: Int+ actual: a+ |+3 | f = (id :: Int -> Int)+ | ^+
@@ -0,0 +1,7 @@+module Error6() where+x :: Int+x = 1+y :: Int+y = 2+x :: Int+x = 3
@@ -0,0 +1,5 @@+./Error6.hs:3:1: error: duplicate definition Error6.x+ |+3 | x = 1+ | ^+
@@ -0,0 +1,4 @@+module Error60() where+g :: (forall a . a -> a) -> Int+g h = h 1+x = g (\y -> y + 1)
@@ -0,0 +1,5 @@+./Error60.hs:4:18: error: no instance for (Num a)+ |+4 | x = g (\y -> y + 1)+ | ^+
@@ -0,0 +1,6 @@+module Error61() where+class C a where { m :: a -> Int }+instance C a => C (a, Int) where { m _ = 1 }+instance C (Int, b) where { m _ = 2 }+instance C Int where { m _ = 3 }+x = m (1::Int, 2::Int)
@@ -0,0 +1,5 @@+./Error61.hs:6:5: error: Multiple constraint solutions for: C (Int, Int)+ |+6 | x = m (1::Int, 2::Int)+ | ^+
@@ -0,0 +1,2 @@+module Error62() where+deriving instance Show
@@ -0,0 +1,7 @@+./Error62.hs:2:19: error: kind mismatch+ expected: Constraint+ actual: Type -> Constraint+ |+2 | deriving instance Show+ | ^+
@@ -0,0 +1,3 @@+module Error63() where+type T = Int+deriving instance Show T
@@ -0,0 +1,5 @@+./Error63.hs:3:19: error: not data/newtype Error63.T+ |+3 | deriving instance Show T+ | ^+
@@ -0,0 +1,2 @@+module Error64() where+f x = x x
@@ -0,0 +1,5 @@+./Error64.hs:2:9: error: occurs check: cannot construct the infinite type: a ~ a -> b+ |+2 | f x = x x+ | ^+
@@ -0,0 +1,2 @@+module Error65() where+x = show id
@@ -0,0 +1,5 @@+./Error65.hs:2:5: error: no instance for (Show (a -> a))+ |+2 | x = show id+ | ^+
@@ -0,0 +1,3 @@+module Error66() where+x :: Int+x = let y = 1 in y y
@@ -0,0 +1,5 @@+./Error66.hs:3:20: error: occurs check: cannot construct the infinite type: a ~ a -> b+ |+3 | x = let y = 1 in y y+ | ^+
@@ -0,0 +1,3 @@+module Error67() where+f :: Int -> Int+f x = case x of { True -> 1; _ -> 2 }
@@ -0,0 +1,7 @@+./Error67.hs:3:19: error: type mismatch+ expected: Bool+ actual: Int+ |+3 | f x = case x of { True -> 1; _ -> 2 }+ | ^+
@@ -0,0 +1,3 @@+module Error68() where+f :: Int -> Bool+f x = x > 1 && x
@@ -0,0 +1,7 @@+./Error68.hs:3:16: error: type mismatch+ expected: Bool+ actual: Int+ |+3 | f x = x > 1 && x+ | ^+
@@ -0,0 +1,3 @@+module Error69() where+f :: Maybe (Int, [Bool]) -> Int+f m = fst m
@@ -0,0 +1,7 @@+./Error69.hs:3:11: error: type mismatch+ expected: (Int, a)+ actual: Maybe (Int, [Bool])+ |+3 | f m = fst m+ | ^+
@@ -0,0 +1,5 @@+module Error7() where+type T a = (a, a)+data D (f :: Type -> Type) = D (f Int)+x :: D T+x = (0, 0)
@@ -0,0 +1,5 @@+./Error7.hs:4:8: error: bad synonym use: Error7.T in D T+ |+4 | x :: D T+ | ^+
@@ -0,0 +1,3 @@+module Error70() where+f :: [Int] -> Int+f xs = [ x | x <- xs ]
@@ -0,0 +1,7 @@+./Error70.hs:3:10: error: type mismatch+ expected: Int+ actual: [Int]+ |+3 | f xs = [ x | x <- xs ]+ | ^+
@@ -0,0 +1,3 @@+module Error71() where+f :: Int -> Int+f x = do { y <- Just x; return y }
@@ -0,0 +1,7 @@+./Error71.hs:3:12: error: type mismatch+ expected: Int+ actual: Maybe Int+ |+3 | f x = do { y <- Just x; return y }+ | ^+
@@ -0,0 +1,2 @@+module Error72() where+f x = x + "a" + 'b'
@@ -0,0 +1,5 @@+./Error72.hs:2:11: error: no instance for (IsString Char)+ |+2 | f x = x + "a" + 'b'+ | ^+
@@ -0,0 +1,3 @@+module Error73() where+f :: Int -> Int+f x = g x where g y = y ++ y
@@ -0,0 +1,7 @@+./Error73.hs:3:7: error: type mismatch+ expected: Int+ actual: [a]+ |+3 | f x = g x where g y = y ++ y+ | ^+
@@ -0,0 +1,3 @@+module Error74() where+f :: Int -> Int+f x | x = 1
@@ -0,0 +1,7 @@+./Error74.hs:3:7: error: type mismatch+ expected: Bool+ actual: Int+ |+3 | f x | x = 1+ | ^+
@@ -0,0 +1,3 @@+module Error75() where+x :: Int+x = (\ y -> y) True
@@ -0,0 +1,7 @@+./Error75.hs:3:16: error: type mismatch+ expected: Int+ actual: Bool+ |+3 | x = (\ y -> y) True+ | ^+
@@ -0,0 +1,4 @@+module Error76() where+data T = C Int+f :: T -> Int+f (C x y) = x
@@ -0,0 +1,5 @@+./Error76.hs:4:4: error: too many arguments+ |+4 | f (C x y) = x+ | ^+
@@ -0,0 +1,3 @@+module Error77() where+x :: Int+x = 'c'
@@ -0,0 +1,7 @@+./Error77.hs:3:5: error: type mismatch+ expected: Int+ actual: Char+ |+3 | x = 'c'+ | ^+
@@ -0,0 +1,4 @@+module Error78() where+data T = T+instance Show T where+ show _ = 1
@@ -0,0 +1,5 @@+./Error78.hs:4:12: error: no instance for (Num [Char])+ |+4 | show _ = 1+ | ^+
@@ -0,0 +1,2 @@+module Error79() where+x = ''
@@ -0,0 +1,7 @@+./Error79.hs:2:5: error: syntax+ found: Illegal Char literal+ expected: - LQIdent ( UQIdent [ QualString literal _primitive @ (# \ case let if QualDo do mdo+ |+2 | x = ''+ | ^+
@@ -0,0 +1,1 @@+module Error8(module M) where
@@ -0,0 +1,5 @@+./Error8.hs:1:22: error: undefined module: M+ |+1 | module Error8(module M) where+ | ^+
@@ -0,0 +1,2 @@+module Error80() where+x =
@@ -0,0 +1,7 @@+./Error80.hs:2:5: error: syntax+ found: Unrecognized input: '\SOH'+ expected: - LQIdent ( UQIdent [ QualString literal _primitive @ (# \ case let if QualDo do mdo+ |+2 | x = + | ^+
@@ -0,0 +1,2 @@+module Error81() where+{- unclosed
@@ -0,0 +1,3 @@+./Error81.hs:3:1: error: syntax+ found: Unclosed {- comment+ expected: ; LIdent ( UQIdent [ QualString literal ~ ! (# infixl infixr infix - data newtype type import foreign class instance default pattern deriving eof
@@ -0,0 +1,2 @@+module Error82() where+x = "unterminated
@@ -0,0 +1,7 @@+./Error82.hs:2:5: error: syntax+ found: unterminated Char/String literal+ expected: - LQIdent ( UQIdent [ QualString literal _primitive @ (# \ case let if QualDo do mdo+ |+2 | x = "unterminated+ | ^+
@@ -0,0 +1,2 @@+module Error83() where+x = "abc\ x\def"
@@ -0,0 +1,5 @@+./Error83.hs:2:9: error: : bad string gap+ |+2 | x = "abc\ x\def"+ | ^+
@@ -0,0 +1,2 @@+module Error84() where+x = let a = 1 } in a
@@ -0,0 +1,7 @@+./Error84.hs:2:15: error: syntax+ found: layout error }+ expected: { . LQIdent ( UQIdent [ QualString literal _primitive @ (# \ case let if QualDo do mdo QSymOper ` :: ∷ where ; in+ |+2 | x = let a = 1 } in a+ | ^+
@@ -0,0 +1,3 @@+module Error85() where+data T a where+ C :: Int -> Maybe a
@@ -0,0 +1,5 @@+./Error85.hs:3:15: error: Bad GADT result type (Maybe a, T, [a$ :: _])+ |+3 | C :: Int -> Maybe a+ | ^+
@@ -0,0 +1,4 @@+module Error86(X) where+import Data.Monoid+import Data.Semigroup+type X = First Int
@@ -0,0 +1,5 @@+./Error86.hs:4:10: error: ambiguous type: First [Data.Monoid.First,Data.Semigroup.First]+ |+4 | type X = First Int+ | ^+
@@ -0,0 +1,2 @@+module Error87() where+import TestMap(noSuchSymbol)
@@ -0,0 +1,5 @@+./Error87.hs:2:16: error: not exported: noSuchSymbol+ |+2 | import TestMap(noSuchSymbol)+ | ^+
@@ -0,0 +1,4 @@+module Error88() where+import Data.Kind(Constraint)+type Id (c :: Constraint) = c+instance Id c
@@ -0,0 +1,5 @@+./Error88.hs:4:13: error: not a class c+ |+4 | instance Id c+ | ^+
@@ -0,0 +1,5 @@+module Error89() where+class C1 a where { m :: a }+class C2 a where { m :: a }+type C12 a = (C1 a, C2 a)+instance C12 Int where { m = 1 }
@@ -0,0 +1,5 @@+./Error89.hs:5:26: error: ambiguous instance binding+ |+5 | instance C12 Int where { m = 1 }+ | ^+
@@ -0,0 +1,1 @@+module Error9(T) where
@@ -0,0 +1,5 @@+./Error9.hs:1:15: error: undefined export: T+ |+1 | module Error9(T) where+ | ^+
@@ -0,0 +1,3 @@+module Error90(f) where+f :: Int -> Int+f x | rec { y <- Just x } = x
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff