include "MMH_megs.mpl"
include "MMH_portalSpawner.mpl"
include "MMH_lightBridgeSpawner.mpl"
include "MMH_laserSpawner.mpl"
include "MMH_weightedStorageCubeSpawner.mpl"
include "MMH_discouragementRedirectionCubeSpawner.mpl"
include "MMH_repulsionGelSpawner.mpl"
include "MMH_propulsionGelSpawner.mpl"
include "MMH_cleansingGelSpawner.mpl"

project MMH {
  orientation "zy-x"
}

///setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"Adrodoc55\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"Adrodoc55's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" YouTube-Channel by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"https://www.youtube.com/user/Adrodoc55\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"because I wanted",Text4:"to thank myself"}
///setblock ~ ~ ~ standing_sign 0 replace {Text1:"{\"text\":\"Special Thanks\",\"bold\":\"true\"}",Text2:"{\"text\":\"click on the \",\"extra\":[{\"text\":\"red\",\"color\":\"red\"}]}",Text3:"names for more",Text4:"information"}
///setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"SQRTdude\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"SQRTdude's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" Video by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"http://youtu.be/g7xfCBRjGRQ\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"for the",Text4:"Copy Helper"}

install {
  /scoreboard objectives add MMH_Rotation dummy
  start @e[tag=MMH]
  /tellraw @a [{"text":"Welcome to","color":"dark_green"},{"text":" Mapmaker Helper\n","color":"green"},{"text":"   Version: ","color":"aqua"},{"text":"2.1.0\n","color":"dark_aqua","italic":"true"},{"text":"   made by ","color":"aqua","italic":"true"},{"text":"Adrodoc55\n","color":"dark_aqua","hoverEvent":{"action":"show_text","value":{"text":"Click to open YouTube Channel","color":"red"}},"clickEvent":{"action":"open_url","value":"https://www.youtube.com/user/Adrodoc55"}}]
}

uninstall {
  /scoreboard objectives remove MMH_Rotation
  stop @e[tag=MMH]
}

#MMH
repeat process MMH_rotation {
  /scoreboard players set @a[rym=45,ry=135] MMH_Rotation 0
  /scoreboard players set @a[rym=135,ry=-135] MMH_Rotation 1
  /scoreboard players set @a[rym=-135,ry=-45] MMH_Rotation 2
  /scoreboard players set @a[rym=-45,ry=45] MMH_Rotation 3
}


flavor 1
srclang 3
id 65535
numfuncs 2
import "huaweitest.mplt"
import "/home/bravewtz/Desktop/openarkcompiler/libjava-core/libjava-core.mplt"
entryfunc &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V
fileinfo {
  @INFO_filename "huaweitest.jar"}
srcfileinfo {
  1 "huaweitest.java"}
type $__class_meta__ <struct {
  @shadow <* void> final,
  @monitor i32 final,
  @classloader u16 final,
  @objsize u16 final,
  @itab <* void> final,
  @vtab <* void> final,
  @gctib <* void> final,
  @classinforo <* void> final,
  @clinitbridge <* void> final}>
type $__class_meta_ro__ <struct {
  @classname <* void> final,
  @ifields <* void> final,
  @methods <* void> final,
  @superclass_or_componentclass <* void> final,
  @numoffields u16 final,
  @numofmethods u16 final,
  @flag u16 final,
  @numofsuperclasses u16 final,
  @padding u32 final,
  @mod i32 final,
  @annotation i32 final,
  @clinitAddr i32 final}>
type $__method_info__ <struct {
  @method_in_vtab_index i64 final,
  @declaringclass i64 final,
  @addr i64 final,
  @mod i32 final,
  @methodname i32 final,
  @signaturename i32 final,
  @annotationvalue i32 final,
  @flag u16 final,
  @argsize u16 final,
  @padding u32 final}>
type $__method_info_compact__ <struct {
  @method_in_vtab_index i32 final,
  @addr i32 final,
  @lebPadding0 u8 final}>
type $__field_info__ <struct {
  @offset u64 final,
  @mod u32 final,
  @flag u16 final,
  @index u16 final,
  @typeName i64 final,
  @fieldname u32 final,
  @annotation u32 final,
  @declaringclass <* void> final}>
type $__field_info_compact__ <struct {
  @offset u32 final,
  @lebPadding0 u8 final}>
type $__superclass_meta__ <struct {
  @superclassinfo <* void> final}>
type $MUIDFuncDefTabEntry <struct {
  @funcUnifiedAddr u64}>
type $MUIDFuncInfTabEntry <struct {
  @funcSize u32,
  @funcName u32}>
type $MUIDFuncDefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDDataDefTabEntry <struct {
  @dataUnifiedAddr u64}>
type $MUIDDataDefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDUnifiedUndefTabEntry <struct {
  @globalAddress u64}>
type $MUIDUnifiedUndefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDRangeTabEntry <struct {
  @tabBegin <* void>,
  @tabEnd <* void>}>
javaclass $Lhuaweitest_3B <$Lhuaweitest_3B> public
var $_C_STR_907ba9a10d33c74f1c37be3b41544334 fstatic <[10] u64> readonly = [0, 0x6b00000000, 0x20490949984357f2, 0x4909490909490920, 0x909494949494949, 0x2020202020202049, 0x2020200909492020, 0x4949494920204920, 0x4949202049494949, 73]
var $_C_STR_194a027f7d649763903a7dcda50cf5a0 fstatic <[9] u64> readonly = [0, 0x5b00000000, 0x94909491faf02dc, 0x2009490949090949, 0x2020492009094920, 0x4920492020202020, 0x4920202020202020, 0x2020090949202020, 73]
var $_C_STR_901191d3899ab5fc7be3d97fe762f978 fstatic <[9] u64> readonly = [0, 0x5f00000000, 0x49494949fbe6d2fb, 0x4909490909490949, 0x2020090949202009, 0x2049202020202049, 0x2020202020492020, 0x909492020200949, 0x492020]
var $_C_STR_4a20a28a5a71422be90661b1072ca29e fstatic <[9] u64> readonly = [0, 0x6500000000, 0x94909494f3904e4, 0x2009490949090949, 0x4920202009094920, 0x2020202049202020, 0x2009492020204920, 0x4949494949492020, 0x492020204949]
var $_C_STR_e4c52869a15445bee0db530b07e9b98a fstatic <[8] u64> readonly = [0, 0x5100000000, 0x949094949ddeb72, 0x2009490949090949, 0x4920490909094920, 0x4920202020202020, 0x949202020094920, 0x49202009]
var $_C_STR_58a8c3b0d70b92b64324906ef9c02c90 fstatic <[10] u64> readonly = [0, 0x6d00000000, 0x94909497041ce40, 0x4949494949494949, 0x4949494949490949, 0x2049200909494949, 0x2020202020202020, 0x4949492020200949, 0x4920094949494949, 0x4949]
var $Ljava_2Flang_2FSystem_3B_7Cout extern <* <$Ljava_2Fio_2FPrintStream_3B>> final public static
var $__cinf_Ljava_2Flang_2FString_3B <$__class_meta__>
func &MCC_GetOrInsertLiteral () <* <$Ljava_2Flang_2FString_3B>>
var $__vtb_Lhuaweitest_3B fstatic <[11] <* void>> = [16, 24, 32, 36, 8, 4, 48, 12, 20, 44, 28]
var $__cinf_Lhuaweitest_3B <$__class_meta__> public
var $__methods_info__Lhuaweitest_3B fstatic <[2] <$__method_info__>> public = [[1= 0xfff6, 2= addrof ptr $__cinf_Lhuaweitest_3B, 3= addroffunc ptr &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V, 4= 9, 5= 56, 6= 76, 7= 168, 8= 0xa201, 9= 1, 10= 0], [1= 0xfff6, 2= addrof ptr $__cinf_Lhuaweitest_3B, 3= addroffunc ptr &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V, 4= 0x10001, 5= 184, 6= 212, 7= 168, 8= 0xad81, 9= 1, 10= 0]]
var $__cinf_Ljava_2Flang_2FObject_3B extern <$__class_meta__> public
var $__superclasses__Lhuaweitest_3B fstatic <[1] <$__superclass_meta__>> public = [[1= 0x4000000000000000]]
var $__classinforo__Lhuaweitest_3B fstatic <$__class_meta_ro__> public = [1= 4, 2= 0, 3= addrof ptr $__methods_info__Lhuaweitest_3B, 4= addrof ptr $__superclasses__Lhuaweitest_3B, 5= 0, 6= 2, 7= 0, 8= 1, 9= 0, 10= 33, 11= 168, 12= 0]
var $MCC_GCTIB__Lhuaweitest_3B fstatic <* void> public
var $classStateInitialized u64
var $__cinf_Lhuaweitest_3B <$__class_meta__> public = [1= 0x1bf435e944cf11ae, 2= 0, 3= 0xffff, 4= 0, 5= 0, 6= addrof ptr $__vtb_Lhuaweitest_3B, 7= addrof ptr $MCC_GCTIB__Lhuaweitest_3B, 8= addrof ptr $__classinforo__Lhuaweitest_3B, 9= addrof ptr $classStateInitialized]
var $__muid_classmetadata_bucket$$huaweitest_jar <[1] <* void>> public = [addrof ptr $__cinf_Lhuaweitest_3B]
func &MCC_Reflect_ThrowCastException nosideeffect () void
func &MCC_Reflect_Check_Casting_NoArray nosideeffect () void
func &MCC_Reflect_Check_Casting_Array nosideeffect () void
func &MCC_CheckThrowPendingException nosideeffect () void
func &MCC_PreNativeCall (var %caller ref) <* void>
func &MCC_PostNativeCall (var %env <* void>) void
func &MCC_DecodeReference nosideeffect (var %obj ref) ref
func &MCC_CallFastNative (var %func <* void>) <* void>
func &MCC_CallSlowNative0 (var %func <* void>) <* void>
func &MCC_CallSlowNative1 (var %func <* void>) <* void>
func &MCC_CallSlowNative2 (var %func <* void>) <* void>
func &MCC_CallSlowNative3 (var %func <* void>) <* void>
func &MCC_CallSlowNative4 (var %func <* void>) <* void>
func &MCC_CallSlowNative5 (var %func <* void>) <* void>
func &MCC_CallSlowNative6 (var %func <* void>) <* void>
func &MCC_CallSlowNative7 (var %func <* void>) <* void>
func &MCC_CallSlowNative8 (var %func <* void>) <* void>
func &MCC_CallFastNativeExt (var %func <* void>) <* void>
func &MCC_CallSlowNativeExt (var %func <* void>) <* void>
func &MCC_SetReliableUnwindContext nosideeffect () void
var $__reg_jni_func_tab$$huaweitest_jar <[0] <* void>>
var $__cinf_Ljava_2Flang_2FSystem_3B extern <$__class_meta__>
func &MCC_getFuncPtrFromItabSecondHash64 nosideeffect () ptr
var $__muid_func_def_tab$$huaweitest_jar fstatic <[2] <$MUIDFuncDefTabEntry>> = [[1= addroffunc ptr &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V]]
var $__muid_func_inf_tab$$huaweitest_jar fstatic <[2] <$MUIDFuncInfTabEntry>> = [[1= addroffunc ptr &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V, 2= addroffunc ptr &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V, 2= addroffunc ptr &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V]]
var $__muid_func_def_muid_tab$$huaweitest_jar fstatic <[2] <$MUIDFuncDefMuidTabEntry>> = [[1= -1722806870279642204, 2= -946015414860200947], [1= -1343471055290971758, 2= -2119983759179258436]]
var $__muid_func_muid_idx_tab$$huaweitest_jar fstatic <[2] u32> = [1, 0]
var $__muid_data_def_tab$$huaweitest_jar fstatic <[1] <$MUIDDataDefTabEntry>> = [[1= addrof ptr $__cinf_Lhuaweitest_3B]]
var $__muid_data_def_muid_tab$$huaweitest_jar fstatic <[1] <$MUIDDataDefMuidTabEntry>> = [[1= -6287124398786487729, 2= -1011506809175871035]]
var $__muid_func_undef_tab$$huaweitest_jar fstatic <[12] <$MUIDUnifiedUndefTabEntry>> = [[1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0]]
var $__muid_func_undef_muid_tab$$huaweitest_jar fstatic <[12] <$MUIDUnifiedUndefMuidTabEntry>> = [[1= 0x3e32352aee789835, 2= -3887705395317205813], [1= -4187412136968710015, 2= -3800091941095621250], [1= 0x6742c234127e0a27, 2= -3762262047879347071], [1= 0x7230554331c55d92, 2= -3676689525926909155], [1= -715372855679083712, 2= -2647497990906227723], [1= -7464356948810446352, 2= -2259485500590180091], [1= 0x783627f2afd1cbde, 2= -2046851302095768916], [1= -2701934576591406938, 2= -1693831364093527548], [1= 0x126777a7fe39e1fb, 2= -1314856249532362766], [1= 0xbf40578f3343f7a, 2= -1198421541845410999], [1= 0x7ca2bdf69a6c7c94, 2= -801329978528900548], [1= 0x477aafa4d7dd102b, 2= -442561182569419835]]
var $__muid_data_undef_tab$$huaweitest_jar fstatic <[3] <$MUIDUnifiedUndefTabEntry>> = [[1= addrof ptr $__cinf_Ljava_2Flang_2FObject_3B], [1= addrof ptr $Ljava_2Flang_2FSystem_3B_7Cout], [1= addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B]]
var $__muid_data_undef_muid_tab$$huaweitest_jar fstatic <[3] <$MUIDUnifiedUndefMuidTabEntry>> = [[1= -567417612161374449, 2= -3298852447504547670], [1= 0x191283ac418c4bb9, 2= -1676204161023949463], [1= -5921653145571052587, 2= -171150348656858163]]
var $__muid_range_tab$$huaweitest_jar fstatic <[29] <$MUIDRangeTabEntry>> = [[1= 0x5b15548b999b8d93, 2= -222031886891092138], [1= -5449160688458699489, 2= -3307888487811147755], [1= 2, 2= 2], [1= 3, 2= 3], [1= 4, 2= 4], [1= 5, 2= 5], [1= 6, 2= 6], [1= 7, 2= 7], [1= 8, 2= 8], [1= 9, 2= 9], [1= 0, 2= 0], [1= 11, 2= 11], [1= 12, 2= 12], [1= 13, 2= 13], [1= 14, 2= 14], [1= 15, 2= 15], [1= addrof ptr $__muid_func_def_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_def_tab$$huaweitest_jar], [1= 0, 2= 0], [1= addrof ptr $__muid_func_inf_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_inf_tab$$huaweitest_jar], [1= addrof ptr $__muid_func_undef_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_undef_tab$$huaweitest_jar], [1= addrof ptr $__muid_data_def_tab$$huaweitest_jar, 2= addrof ptr $__muid_data_def_tab$$huaweitest_jar], [1= 0, 2= 0], [1= addrof ptr $__muid_data_undef_tab$$huaweitest_jar, 2= addrof ptr $__muid_data_undef_tab$$huaweitest_jar], [1= addrof ptr $__muid_func_def_muid_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_def_muid_tab$$huaweitest_jar], [1= addrof ptr $__muid_func_undef_muid_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_undef_muid_tab$$huaweitest_jar], [1= addrof ptr $__muid_data_def_muid_tab$$huaweitest_jar, 2= addrof ptr $__muid_data_def_muid_tab$$huaweitest_jar], [1= addrof ptr $__muid_data_undef_muid_tab$$huaweitest_jar, 2= addrof ptr $__muid_data_undef_muid_tab$$huaweitest_jar], [1= addrof ptr $__muid_func_muid_idx_tab$$huaweitest_jar, 2= addrof ptr $__muid_func_muid_idx_tab$$huaweitest_jar], [1= 0, 2= 0]]
var $__reflection_strtab$$huaweitest_jar fstatic <[57] u8> = [0, 76, 104, 117, 97, 119, 101, 105, 116, 101, 115, 116, 59, 0, 109, 97, 105, 110, 0, 40, 91, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59, 41, 86, 0, 48, 33, 48, 0, 60, 105, 110, 105, 116, 62, 0, 40, 41, 86, 0]
var $__compilerVersionNum$$huaweitest_jar <[0] <* void>> = [1, 0]
func &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V public constructor (var %_this <* <$Lhuaweitest_3B>>) void {
  funcid 48153
  var %Reg1_R43694 <* <$Lhuaweitest_3B>> localrefvar
  var %Reg1_R57 <* <$Ljava_2Flang_2FObject_3B>> localrefvar
  var %__muid_symptr <* void>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43694)
  dassign %Reg1_R43694 0 (dread ref %_this)
  #INSTIDX : 0||0000:  aload_0
  #INSTIDX : 1||0001:  invokespecial
  regassign ptr %1 (dread ref %Reg1_R57)
  dassign %Reg1_R57 0 (retype ref <* <$Ljava_2Flang_2FObject_3B>> (dread ref %Reg1_R43694))
  intrinsiccall MCCIncRef (dread ref %Reg1_R57)
  intrinsiccall MCCDecRef (regread ptr %1)
  #Call function:Ljava_2Flang_2FObject_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[12] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_func_undef_tab$$huaweitest_jar, constval i64 9)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg1_R57) {}
  #INSTIDX : 4||0004:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg1_R43694, dread ref %Reg1_R57)
  return ()
}
func &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V public static (var %Reg2_R743 <* <[] <* <$Ljava_2Flang_2FString_3B>>>>) void {
  funcid 48154
  var %Reg0_R562 <* <$Ljava_2Fio_2FPrintStream_3B>> localrefvar
  var %Reg1_R43 <* <$Ljava_2Flang_2FString_3B>> localrefvar
  var %L_STR_161334 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161335 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161336 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161337 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161338 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161339 <* <$Ljava_2Flang_2FString_3B>>

  #INSTIDX : 0||0000:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %1 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %1)
  #INSTIDX : 3||0003:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_907ba9a10d33c74f1c37be3b41544334) { dassign %L_STR_161334 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161334)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161334)
  #INSTIDX : 5||0005:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 8||0008:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %2 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %2)
  #INSTIDX : 11||000b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_194a027f7d649763903a7dcda50cf5a0) { dassign %L_STR_161335 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161335)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161335)
  #INSTIDX : 13||000d:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 16||0010:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %3 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %3)
  #INSTIDX : 19||0013:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_901191d3899ab5fc7be3d97fe762f978) { dassign %L_STR_161336 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161336)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161336)
  #INSTIDX : 21||0015:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 24||0018:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %4 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %4)
  #INSTIDX : 27||001b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_4a20a28a5a71422be90661b1072ca29e) { dassign %L_STR_161337 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161337)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161337)
  #INSTIDX : 29||001d:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 32||0020:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %5 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %5)
  #INSTIDX : 35||0023:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_e4c52869a15445bee0db530b07e9b98a) { dassign %L_STR_161338 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161338)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161338)
  #INSTIDX : 37||0025:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 40||0028:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %6 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$huaweitest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %6)
  #INSTIDX : 43||002b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_58a8c3b0d70b92b64324906ef9c02c90) { dassign %L_STR_161339 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161339)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161339)
  #INSTIDX : 45||002d:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 48||0030:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg0_R562, dread ref %Reg1_R43)
  return ()
}


print "Hello MiniPL\n";
assert(false);


# Class: ComputationRegister
#
# Description:
#  This class implements a register of the computations (see
#  RigidMotionsParameterSpaceDecompostion) which is based on SQLite.
#  Thanks to the register the computations can be restored after a crash.
#
# Author:
#  Kacper Pluta - kacper.pluta@esiee.fr
#  Laboratoire d'Informatique Gaspard-Monge - LIGM, A3SI, France
#
# Date:
#  11/12/2016
#
# License:
#  Simplified BSD License
#
# Copyright (c) 2016, Kacper Pluta
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#   * Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#   * Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Kacper Pluta BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
module ComputationRegister()
  option object;

  (* Connection object returned by Database[SQLite]:-Open *)
  local connection;
  local version;

# Comments:
#  We should use Database[SQLite]:-Bind() with care. Values passed should be given as local or
#  global but never as values returned from other procedures.

# Method: ModuleCopy
#   Standard constructor / copy constructor
#
# Parameters:
#   self::ComputationRegister      - a new object to be constructed
#   proto::ComputationRegister     - a prototype object from which self is derived
#   dbPath::string                 - a path to a database
#
# Comment:
#   The database is open in such a way that journal_mode is set to WAL and
#   synchronous to NORMAL. These option should not be changed!
#   See SQLite documentation for more information. Note that second database
#   is created in memory to speed up inserts. In particular, small chunks of
#   data are first inserted into the memory database and then moved in one
#   transaction into the main database.
#
# Output:
#   An object of type ComputationRegister.
#
# Exceptions:
#  "There is no database" occurs when a given file (dbPath) does not exists.
#
  export ModuleCopy::static := proc( self::ComputationRegister,
                                     proto::ComputationRegister,
                                     dbPath::string, $ )
  local fileStatus := false, version, stmt, openStatus := true;
    if _passed = 2 then
      self:-connection := proto:-connection;
      self:-version := proto:-version;
    else
      fileStatus:=FileTools:-Exists(dbPath);
      # wait until DB is not busy
      while openStatus do
        try
          openStatus := false;
          self:-connection := Database[SQLite]:-Open(dbPath);
        catch "database is locked":
          openStatus := true;
        end try;
      od;
      Database[SQLite]:-Attach(self:-connection, ":memory:", "cacheDB");
      Database[SQLite]:-Execute(self:-connection, "PRAGMA synchronous = NORMAL;");
      Database[SQLite]:-Execute(self:-connection, "PRAGMA journal_mode = WAL;");
      Database[SQLite]:-Execute(self:-connection, "PRAGMA cacheDB.auto_vacuum = FULL;");

      #Create tables
      if not fileStatus then
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE Quadric (ID PRIMARY KEY NOT " ||
        "NULL UNIQUE, polynom TEXT NOT NULL UNIQUE check(length(polynom) > 0));");
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE RealAlgebraicNumber (ID " ||
        "INTEGER PRIMARY KEY UNIQUE, polynom TEXT NOT NULL check(length(polynom) > 0), " ||
        "IntervalL TEXT NOT NULL check(length(IntervalL) > 0), IntervalR " ||
        "TEXT NOT NULL check(length(IntervalR) > 0));");
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE Events (RANumID INTEGER " ||
        "REFERENCES RealAlgebraicNumber (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, " ||
        "QuadID INTEGER REFERENCES Quadric (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL);");
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE SamplePoint (A TEXT NOT NULL " ||
        "check(length(A) > 0), B TEXT NOT NULL check(length(B) > 0), C TEXT NOT NULL " ||
        "check(length(C) > 0));");
        Database[SQLite]:-Execute(self:-connection, "CREATE TABLE ComputedNumbers (RANumID " ||
        "INTEGER REFERENCES RealAlgebraicNumber (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT " ||
        "NULL);");
      fi;

      stmt := Database[SQLite]:-Prepare(self:-connection, "PRAGMA user_version;");
      while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
      self:-version := Database[SQLite]:-Fetch(stmt, 0);
      Database[SQLite]:-Finalize(stmt);

      if self:-version = 0 then
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE cacheDB.RealAlgebraicNumber (ID " ||
        "INTEGER PRIMARY KEY UNIQUE, polynom TEXT NOT NULL check(length(polynom) > 0), " ||
        "IntervalL TEXT NOT NULL check(length(IntervalL) > 0), IntervalR TEXT NOT NULL " ||
        "check(length(IntervalR) > 0));");
        Database[SQLite]:-Execute(self:-connection, "CREATE TABLE cacheDB.Quadric (ID PRIMARY KEY " ||
        "NOT NULL UNIQUE, polynom TEXT NOT NULL UNIQUE check(length(polynom) > 0));");
        Database[SQLite]:-Execute(self:-connection, "CREATE TABLE cacheDB.Events (RANumID INTEGER " ||
        "REFERENCES RealAlgebraicNumber (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, " ||
        "QuadID INTEGER REFERENCES Quadric (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL);");
        Database[SQLite]:-Execute(self:-connection, "CREATE TABLE cacheDB.SamplePoint (" ||
        "A TEXT NOT NULL check(length(A) > 0), B TEXT NOT NULL check(length(B) > 0), C TEXT " ||
        "NOT NULL check(length(C) > 0));");
      elif self:-version = 1 then
        Database[SQLite]:-Execute(self:-connection,"CREATE TABLE cacheDB.SamplePointSignature " ||
        "(SP_ID NOT NULL, Signature TEXT NOT NULL UNIQUE check(length(Signature) > 0));");
      elif self:-version >= 2 then
        Database[SQLite]:-Execute(self:-connection, "CREATE TABLE cacheDB.NMM (NMM TEXT NOT NULL " ||
        "UNIQUE check(length(NMM) > 0), SP_ID NOT NULL, T1 TEXT NOT NULL " ||
        "check(length(T1) > 0), T2 TEXT NOT NULL check(length(T2) > 0), T3 TEXT NOT NULL " ||
        "check(length(T3) > 0));");
      fi;
    fi;
    return self;
  end proc;

  export Close::static := proc( self::ComputationRegister )
    Database[SQLite]:-Close(self:-connection);
  end proc;

  export DatabaseVersion::static := proc( self::ComputationRegister )
    return self:-version;
  end proc;

# Method: ModulePrint
#   Standard printout of an object of type ComputationRegister.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
  export ModulePrint::static := proc( self::ComputationRegister )
    print(self:-connection);
  end proc;

# Method: InsertQuadric
#   Used to insert quadrics into a database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   id::integer                    - an identifier of a given quadric
#   quadric::polynom               - a second degree polynomial
#
# Comments:
#   Each quadric is inserted into a cache, memory stored, database.
#   SynchronizeQuadrics has to be called to move inserted polynomials
#   into the register.
#
  export InsertQuadric::static := proc(self::ComputationRegister, id::integer, quadric::polynom)
    local stmt, poly := sprintf("%a", quadric);
    if self:-version > 0 then
      error "Adding new quadrics is blocked! Re-run computations with a new database.";
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
                                 "cacheDB.Quadric(ID, polynom) VALUES (?, ?);");
    Database[SQLite]:-Bind(stmt, 1, id);
    Database[SQLite]:-Bind(stmt, 2, poly);
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: InsertEvent
#   Used to insert quadrics into a database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   idNum::integer                 - an identifier of a given event
#   event::EventType               - a given event
# Comments:
#   Each event is inserted into a cache, memory stored, database.
#   SynchronizeEvents has to be called to move inserted events
#   into the register.
#
  export InsertEvent::static := proc(self::ComputationRegister, idNum::integer,
                                     event::EventType)
    local x::integer, num, quadrics, stmt, poly, interA, interB;
    if self:-version > 0 then
      error "Adding new events is blocked! Re-run computations with a new database.";
    fi;
    num := GetRealAlgebraicNumber(event); quadrics := GetQuadrics(event);
    poly := sprintf("%a", GetPolynomial(num));
    interA := sprintf("%a", GetInterval(num)[1]);
    interB := sprintf("%a", GetInterval(num)[2]);
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
            "cacheDB.RealAlgebraicNumber(ID, polynom, IntervalL, IntervalR) " ||
                                             "VALUES (?, ?, ?, ?);");
    Database[SQLite]:-Bind(stmt, 1, idNum);
    Database[SQLite]:-Bind(stmt, 2, poly);
    Database[SQLite]:-Bind(stmt, 3, interA);
    Database[SQLite]:-Bind(stmt, 4, interB);

    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    for x in quadrics do
      stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
                             "cacheDB.Events(RANumID, QuadID) VALUES(?, ?);");
      Database[SQLite]:-Bind(stmt, 1, idNum);
      Database[SQLite]:-Bind(stmt, 2, x);
     while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
     Database[SQLite]:-Finalize(stmt);
    od;
  end proc;

# Method: InsertSignature
#   Used to insert unique signatures of rotational sample points into a database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   id::integer                    - an identifier of a given rotational sample point
#   sig::string                    - a given signature -- ordered indices of the critical planes
#
  export InsertSignature::static := proc(self::ComputationRegister, id::integer, sig::string)
    local stmt;
    if self:-version <> 1 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
            "cacheDB.SamplePointSignature(SP_ID, Signature) VALUES (?, ?);");
    Database[SQLite]:-Bind(stmt, 1, id);
    Database[SQLite]:-Bind(stmt, 2, sig);

    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: SynchronizeSamplePointsSignatures
#   Used to synchronize a cache database with the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
  export SynchronizeSamplePointsSignatures::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version <> 1 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO SamplePointSignature " ||
            "(SP_ID, Signature) SELECT * FROM cacheDB.SamplePointSignature AS SC WHERE NOT " ||
            "EXISTS(SELECT 1 FROM SamplePointSignature AS S WHERE SC.Signature = S.Signature);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    #clean up cacheDB
    stmt := Database[SQLite]:-Execute(self:-connection,"DELETE FROM cacheDB.SamplePointSignature;");
end proc;

# Method: CloseSignaturesAddition
#   Used to mark that signatures were computed.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
  export CloseSignaturesAddition::static := proc(self::ComputationRegister)
    if self:-version <> 1 then
      return NULL;
    fi;

    Database[SQLite]:-Execute(self:-connection, "PRAGMA user_version = 2;");
    self:-version := 2;
end proc;

# Method: InsertNMM
#   Used to insert a nieghborhood motion map into the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   ID::integer                    - an id of the rotational sample point
#   NMM::list                      - a list of lists which represent a neighborhood motion map
#   T::list                        - a list or rationals which represent a translational sample
#                                    point
#
  export InsertNMM::static := proc(self::ComputationRegister, ID::integer, NMM::list, T::list)
    local stmt, NMMString, transX, transY, transZ;
    if self:-version < 2 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
                                             "cacheDB.NMM(SP_ID, NMM, T1, T2, T3) VALUES (?, ?, " ||
                                             "?, ?, ?);");
    NMMString := sprintf("%a", NMM); transX := sprintf("%a", T[1]); transY := sprintf("%a", T[2]);
    transZ := sprintf("%a", T[3]);
    Database[SQLite]:-Bind(stmt, 1, ID);
    Database[SQLite]:-Bind(stmt, 2, NMMString);
    Database[SQLite]:-Bind(stmt, 3, transX);
    Database[SQLite]:-Bind(stmt, 4, transY);
    Database[SQLite]:-Bind(stmt, 5, transZ);

    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: SynchronizeNMM
#   Used to synchronize a cache database with the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
  export SynchronizeNMM::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version < 2 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO NMM (NMM, SP_ID, T1, T2, " ||
            "T3) SELECT * FROM cacheDB.NMM AS CNM WHERE NOT EXISTS(SELECT 1 FROM NMM AS NM " ||
                                                                     "WHERE NM.NMM = CNM.NMM);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    #clean up cacheDB
    stmt := Database[SQLite]:-Execute(self:-connection,"DELETE FROM cacheDB.NMM;");
  end proc;

# Method: SynchronizeQuadrics
#   Synchronize quadrics between memory, cache, database and a given database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
#
  export SynchronizeQuadrics::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version > 0 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO Quadric SELECT * FROM " ||
            "cacheDB.Quadric as qc WHERE NOT EXISTS(SELECT 1 FROM Quadric AS Q WHERE " ||
                                                           "q.POLYNOM = qc.POLYNOM);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: SynchronizeEvents
#   Synchronize events between memory, cache, database and a given database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
# Comments:
#   Cache database is cleared. Therefore, the method should be called only when all events were
#   inserted.
  export SynchronizeEvents::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version > 0 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO RealAlgebraicNumber " ||
                                "SELECT * FROM cacheDB.RealAlgebraicNumber AS rc WHERE NOT " ||
                                "EXISTS(SELECT 1 FROM RealAlgebraicNumber AS R WHERE " ||
                                "r.ID = rc.ID AND r.POLYNOM = rc.POLYNOM AND " ||
                                "r.INTERVALL = rc.INTERVALL AND " ||
                                "r.INTERVALR = rc.INTERVALR);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO Events SELECT * FROM " ||
                           "cacheDB.Events AS ev WHERE NOT EXISTS( SELECT 1 FROM Events AS E " ||
                           "WHERE e.RANUMID = ev.RANUMID AND e.QUADID = ev.QUADID);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    #clean up cacheDB
    stmt := Database[SQLite]:-Execute(self:-connection,"DELETE FROM cacheDB.RealAlgebraicNumber;");
  end proc;

# Method: InsertComputedNumber
#    Inserts ids' of computed events into a given database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   id::integer                    - an integer which stands for the identifier of a cluster
#
#
  export InsertComputedNumber::static := proc(self::ComputationRegister, id::integer)
    local stmt;
    if self:-version > 0 then
      error "Adding new computed events is blocked! Re-run computations with a new database.";
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT OR IGNORE INTO " ||
                                 "ComputedNumbers (RANumID) VALUES (?);");
    Database[SQLite]:-Bind(stmt, 1, id);
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: InsertSamplePoint
#    Inserts a sample point into a given database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   samp::list                     - a list of three rational numbers which represent a sample point
#
#
  export InsertSamplePoint::static := proc(self::ComputationRegister, samp::list)
    local stmt, a, b, c;
    if self:-version > 0 then
      error "Adding new computed sample points is blocked! Re-run computations with a new database.";
    fi;
    a := sprintf("%a", samp[1]); b := sprintf("%a", samp[2]); c := sprintf("%a", samp[3]);
    stmt := Database[SQLite]:-Prepare(self:-connection,"INSERT INTO cacheDB.SamplePoint " ||
                                                       "(A, B, C) VALUES (?, ?, ?);");
    Database[SQLite]:-Bind(stmt, 1, a);
    Database[SQLite]:-Bind(stmt, 2, b);
    Database[SQLite]:-Bind(stmt, 3, c);

    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);
  end proc;

# Method: SynchronizeSamplePoints
#    Synchronize sample points between cache, memory, database and a given database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
# Comments:
#   Cache database is cleared.
  export SynchronizeSamplePoints::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version > 0 then
      return NULL;
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection, "INSERT INTO SamplePoint SELECT * " ||
                                                                 "FROM cacheDB.SamplePoint;");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    Database[SQLite]:-Finalize(stmt);

    #clean up cacheDB
    stmt := Database[SQLite]:-Execute(self:-connection,"DELETE FROM cacheDB.SamplePoint;");
  end proc;

# Method: FetchComputedNumbers
#    Fetch ids' of events which were processed already from the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
#
# Output:
#   A list of integers.
#
  export FetchComputedNumbers::static := proc(self::ComputationRegister)
    local stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT * FROM ComputedNumbers;");
    local result := convert(Database[SQLite]:-FetchAll(stmt), list);
    Database[SQLite]:-Finalize(stmt);
    return result;
  end proc;

# Method: FetchQuadrics
#    Fetch quadrics from the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
#
# Output:
#   A list of second degree polynomials.
#
  export FetchQuadrics::static := proc(self::ComputationRegister)
    local stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT polynom FROM Quadric " ||
                                            "ORDER BY ID;");
    local result := map(parse, convert(Database[SQLite]:-FetchAll(stmt), list));
    Database[SQLite]:-Finalize(stmt);
    return result;
  end proc;

export FetchLowerEventID := proc(self::ComputationRegister)
    local lowerID;
    local stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT MIN(ID) FROM RealAlgebraicNumber;");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    lowerID := Database[SQLite]:-Fetch(stmt, 0);
    Database[SQLite]:-Finalize(stmt);
    return lowerID;
end proc;

# Method: FetchEvents
#    Fetch events from the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   first::integer                 - an id of the first event from a given range
#   last::integer                  - an id of the last event from a given range
#
#
# Output:
#   An Array of EventType.
#
  export FetchEvents::static := proc(self::ComputationRegister, first::integer, last::integer)
    local row, events:=Array([]);
    local stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT ID, polynom, IntervalL, " ||
    "IntervalR, group_concat(QuadID) FROM RealAlgebraicNumber JOIN EVENTS " ||
    "ON ID = RANUMID WHERE ID BETWEEN ? AND ? GROUP BY ID ORDER BY ID;");
    Database[SQLite]:-Bind(stmt, 1, first);
    Database[SQLite]:-Bind(stmt, 2, last);

    #Slow but Fetching all can kill with memory consumption
    while Database[SQLite]:-Step(stmt) <> Database[SQLite]:-RESULT_DONE do
      row := Database[SQLite]:-FetchRow(stmt);
      events(row[1]) := EventType(RealAlgebraicNumber(parse(row[2]), parse(row[3]),
                    parse(row[4])), [parse(row[5])]);
    od;
    Database[SQLite]:-Finalize(stmt);
    return events;
  end proc;

# Method: FetchSamplePointsWithoutSignature
#   Used to fetch a given number of sample points from the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   first::integer                 - an id of a sample point which represent the beginning of the
#                                    range of ids to be fetched
#   last::integer                  - an id of a sample point which represent the end of the range of
#                                    ids to be fetched
# Comment:
#   Only sample points without signatures are fetch.
#
  export FetchSamplePointsWithoutSignature::static := proc(self::ComputationRegister,
                                                       first::integer, last::integer)
    local row, buffer:=Array([]), stmt;
     if self:-version < 1 then
      error "This version of FetchSamplePoints requires a database in version 1.";
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT ID, A, B, C FROM SamplePoint AS S " ||
            "WHERE S.ID BETWEEN ? AND ? AND NOT EXISTS( SELECT 1 FROM SamplePointSignature AS SS " ||
                                                                         "WHERE S.ID = SS.SP_ID);");
    Database[SQLite]:-Bind(stmt, 1, first);
    Database[SQLite]:-Bind(stmt, 2, last);

    #Slow but Fetching all can kill with memory consumption
    while Database[SQLite]:-Step(stmt) <> Database[SQLite]:-RESULT_DONE do
      row := Database[SQLite]:-FetchRow(stmt);
      ArrayTools:-Append(buffer, [row[1], op(map(parse, row[2..()]))], inplace=true);
    od;
    Database[SQLite]:-Finalize(stmt);
    return buffer;
  end proc;

# Method: FetchTopologicallyDistinctSamplePoints
#   Used to fetch a given number of topologically different sample points from the database. These
#   are the sample points which induce different order of the critical planes in the remainder range
#   -- they have different signatures.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#   first::integer                 - an id of a sample point which represent the beginning of the
#                                    range of ids to be fetched
#   last::integer                  - an id of a sample point which represent the end of the range of
#                                    ids to be fetched
#
  export FetchTopologicallyDistinctSamplePoints::static := proc(self::ComputationRegister,
                                                            first::integer, last::integer)
    local row, buffer:=Array([]), stmt;
     if self:-version < 1 then
      error "This version of FetchTopologicallyDistinctSamplePoints requires a database " ||
            "in version 1.";
    fi;
    stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT S.ID, A, B, C FROM " ||
    "SamplePoint AS S, SamplePointSignature AS SSP WHERE S.ID = SSP.SP_ID AND SSP.ID " ||
    "BETWEEN ? AND ?;");
    Database[SQLite]:-Bind(stmt, 1, first);
    Database[SQLite]:-Bind(stmt, 2, last);

    #Slow but Fetching all can kill with memory consumption
    while Database[SQLite]:-Step(stmt) <> Database[SQLite]:-RESULT_DONE do
      row := Database[SQLite]:-FetchRow(stmt);
      ArrayTools:-Append(buffer, [row[1], op(map(parse, row[2..()]))], inplace=true);
    od;
    Database[SQLite]:-Finalize(stmt);
    return buffer;
  end proc;

# Method: NumberOfEvents
#   Returns number of events in the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
# Output:
#   Number of events in the database.
#
  export NumberOfEvents::static := proc(self::ComputationRegister)
    local stmt, num;
    stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT COUNT(ID) " ||
                                            "FROM RealAlgebraicNumber;");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    num := Database[SQLite]:-Fetch(stmt, 0);
    Database[SQLite]:-Finalize(stmt);
    return num;
  end proc;

# Method: NumberOfEvents
#   Updates the database from version 0 into 1 by adding tables which stores neighborhood motion
#   maps, translational sample points and signatures of rotational sample points. After the updated
#   it is not possible to add new events or rotational sample points into the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
  export PrepareSamplePoints::static := proc(self::ComputationRegister)
    local stmt, toCompute;
    stmt := Database[SQLite]:-Prepare(self:-connection,"SELECT COUNT(ID) FROM RealAlgebraicNumber "
    || "WHERE ID NOT IN (SELECT RANUMID FROM ComputedNumbers) AND ID NOT IN (SELECT MAX(ID) " ||
    "FROM RealAlgebraicNumber);");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    toCompute := Database[SQLite]:-Fetch(stmt, 0);
    Database[SQLite]:-Finalize(stmt);

    if self:-version = 0 and toCompute = 0 then
      Database[SQLite]:-Execute(self:-connection, "ALTER TABLE SamplePoint RENAME TO " ||
      "sqlitestudio_temp_table; CREATE TABLE SamplePoint (A TEXT NOT NULL check(length(A) > 0), " ||
      "B TEXT NOT NULL check(length(B) > 0), C TEXT NOT NULL check(length(C) > 0), " ||
      "ID INTEGER PRIMARY KEY AUTOINCREMENT); INSERT INTO SamplePoint (A, B, C) SELECT A, B, C " ||
      "FROM sqlitestudio_temp_table; DROP TABLE sqlitestudio_temp_table;");
      Database[SQLite]:-Execute(self:-connection, "PRAGMA user_version = 1;");
      self:-version := 1;
      Database[SQLite]:-Execute(self:-connection, "CREATE TABLE SamplePointSignature (ID INTEGER " ||
      "PRIMARY KEY AUTOINCREMENT, SP_ID REFERENCES SamplePoint (ID) ON DELETE CASCADE ON UPDATE " ||
      "CASCADE NOT NULL, Signature TEXT NOT NULL UNIQUE check(length(Signature) > 0));");
      Database[SQLite]:-Execute(self:-connection, "CREATE TABLE cacheDB.SamplePointSignature " ||
      "(SP_ID NOT NULL, Signature TEXT NOT NULL UNIQUE check(length(Signature) > 0));");
      Database[SQLite]:-Execute(self:-connection,"CREATE TABLE NMM (ID INTEGER PRIMARY KEY " ||
      "AUTOINCREMENT, NMM TEXT NOT NULL UNIQUE check(length(NMM) > 0), SP_ID INTEGER " ||
      "REFERENCES SamplePoint (ID) ON DELETE CASCADE ON UPDATE CASCADE, T1 TEXT NOT NULL " ||
      "check(length(T1) > 0), T2 TEXT NOT NULL check(length(T2) > 0), T3 TEXT NOT NULL " ||
      "check(length(T3) > 0));");
      Database[SQLite]:-Execute(self:-connection,"CREATE TABLE cacheDB.NMM (NMM TEXT NOT NULL " ||
      "UNIQUE check(length(NMM) > 0), SP_ID NOT NULL, T1 TEXT NOT NULL check(length(T1) > 0), " ||
      "T2 TEXT NOT NULL check(length(T2) > 0), T3 TEXT NOT NULL check(length(T3) > 0));");
    elif toCompute <> 0 then
      Close(self);
      error "Before running computation of NMM it is necessary to compute all sample points! " ||
      "Please, run first RigidMotionsParameterSpaceDecompostion:-LaunchResumeComputations().";
    fi;
  end proc;

# Method: NumberOfSamplePoints
#   Returns number of the rotational sample points in the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
# Output:
#   Number of the rotational sample points in the database.
#
  export NumberOfSamplePoints::static := proc(self::ComputationRegister)
    local stmt, num::integer;
    stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT COUNT(*) FROM SamplePoint;");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    num::integer := Database[SQLite]:-Fetch(stmt, 0);
    Database[SQLite]:-Finalize(stmt);
    return num;
  end proc;

# Method: NumberOfTopologicallyDistinctSamplePoints
#   Returns number of the topologically distinct rotational sample points in the database.
#
# Parameters:
#   self::ComputationRegister      - an instance of ComputationRegister
#
# Output:
#   Number of the topologically distinct sample points in the database.
#
  export NumberOfTopologicallyDistinctSamplePoints::static := proc(self::ComputationRegister)
    local stmt, num::integer;
    stmt := Database[SQLite]:-Prepare(self:-connection, "SELECT COUNT(*) FROM SamplePoint AS S, " ||
               "SamplePointSignature AS SSP WHERE S.ID = SSP.SP_ID;");
    while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
    num::integer := Database[SQLite]:-Fetch(stmt, 0);
    Database[SQLite]:-Finalize(stmt);
    return num;
  end proc;

  export DropRedundantSamplePoints::static := proc(self::ComputationRegister)
    local stmt;
    if self:-version = 2 then
      Database[SQLite]:-Execute(self:-connection, "CREATE TABLE SamplePoints (A TEXT NOT NULL " ||
      "CHECK (length(A) > 0), B TEXT NOT NULL CHECK (length(B) > 0), C TEXT NOT NULL CHECK " ||
      "(length(C) > 0), ID INTEGER PRIMARY KEY);");

      # Copy only topologically unique sample points
      stmt := Database[SQLite]:-Prepare(self:-connection, "INSERT INTO SamplePoints SELECT A, B," ||
      "C, S.ID FROM SamplePoint AS S, SamplePointSignature AS SSP WHERE S.ID = SSP.SP_ID;");
      while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
      Database[SQLite]:-Finalize(stmt);

      Database[SQLite]:-Execute(self:-connection, "CREATE TABLE SamplePointSignatures (ID INTEGER "
      || "PRIMARY KEY AUTOINCREMENT, SP_ID REFERENCES SamplePoints (ID) ON DELETE CASCADE ON " ||
      "UPDATE CASCADE NOT NULL, Signature TEXT NOT NULL UNIQUE CHECK (length(Signature) > 0));");

      # Copy data
      stmt := Database[SQLite]:-Prepare(self:-connection, "INSERT INTO SamplePointSignatures "||
      "SELECT * FROM SamplePointSignature;");
      while Database[SQLite]:-Step(stmt) = Database[SQLite]:-RESULT_BUSY do; od;
      Database[SQLite]:-Finalize(stmt);

      Database[SQLite]:-Execute(self:-connection, "DROP TABLE SamplePointSignature; " ||
      "DROP TABLE SamplePoint; VACUUM;");

     # Recover old names
     Database[SQLite]:-Execute(self:-connection, "ALTER TABLE SamplePoints RENAME TO " ||
     "SamplePoint;");

     Database[SQLite]:-Execute(self:-connection, "ALTER TABLE SamplePointSignatures RENAME TO " ||
     "SamplePointSignature;");

      Database[SQLite]:-Execute(self:-connection, "PRAGMA user_version = 3;");
      self:-version := 3;
    fi;
  end proc;
end module;


program parseoutputformat;
begin
    writeln(char('M') : 10)
end.


$ifndef _REP_REFINE_
$define _REP_REFINE_

$endif


program ifst;
	{sample25}
var
 ch
 :
 char;
begin                                                      readln(ch);
if ch = 'a' then writeln('It is ''a'' ')else writeln('It is not ''a'' ')
                                                                        end.


repeat process ACV_lightBridges {
// Remove unsupported bridges
/kill @e[type=area_effect_cloud,name=ACV_LightBridge,rxm=-90,rx=-1]
/kill @e[type=area_effect_cloud,name=ACV_LightBridge,rxm=1,rx=90]

/scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,tag=ACV_InAir] remove ACV_InAir
/execute @e[type=area_effect_cloud,name=ACV_LightBridge] ~ ~ ~ detect ~ ~ ~ air * scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,r=0,c=1] add ACV_InAir
/execute @e[type=area_effect_cloud,name=ACV_LightBridge] ~ ~ ~ detect ~ ~ ~ carpet 3 scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,r=0,c=1] add ACV_InAir
/execute @e[type=area_effect_cloud,name=ACV_LightBridge] ~ ~ ~ detect ~ ~ ~ piston_extension * execute @e[type=area_effect_cloud,name=ACV_LightBridge,r=0,c=1] ~ ~ ~ detect ~ ~1 ~ carpet 3 scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,r=0,c=1] add ACV_InAir

/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_InAir] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_PortalIn,dy=0] add ACV_createLightBridges_PARAM
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_InAir] add ACV_TpProof
/entitydata @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_InAir] {CustomName:"ACV_LightBridgeEnd"}
conditional: start ACV_createLightBridges

// To avoid race conditions, if there are multiple lightbridges in the same block one needs to be processed (setblock) before the others, so that the others summon all markers correctly
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge] add ACV_Multiple
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=ACV_Multiple] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge,dy=0,c=-1] remove ACV_Multiple

/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_Multiple] ~ ~ ~ detect ~ ~-1 ~ carpet 3 summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_BridgeBelow",Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_Multiple] ~ ~ ~ detect ~ ~ ~ carpet 3 summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_BridgeCross",Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_Multiple] ~ ~ ~ detect ~ ~1 ~ carpet 3 summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_BridgeBelow",Duration:2147483647}

/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_Multiple] ~ ~ ~ setblock ~ ~-1 ~ piston_extension 0 keep
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=!ACV_Multiple] ~ ~ ~ setblock ~ ~ ~ carpet 3

/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=ACV_Multiple] ~ ~ ~ detect ~ ~-1 ~ carpet 3 summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_BridgeBelow",Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=ACV_Multiple] ~ ~ ~ detect ~ ~ ~ carpet 3 summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_BridgeCross",Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_LightBridge,tag=ACV_Multiple] ~ ~ ~ detect ~ ~1 ~ carpet 3 summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_BridgeBelow",Duration:2147483647}

/tp @e[type=area_effect_cloud,name=ACV_LightBridge,rym=45,ry=135] ~-1 ~ ~
/tp @e[type=area_effect_cloud,name=ACV_LightBridge,rym=135,ry=-135] ~ ~ ~-1
/tp @e[type=area_effect_cloud,name=ACV_LightBridge,rym=-135,ry=-45] ~1 ~ ~
/tp @e[type=area_effect_cloud,name=ACV_LightBridge,rym=-45,ry=45] ~ ~ ~1

// Wake up all idle light bridges
/entitydata @e[type=area_effect_cloud,name=ACV_LightBridge_Idle] {CustomName:"ACV_LightBridge"}
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge] add ACV_TpProof

/testfor @e[type=area_effect_cloud,name=ACV_LightBridge]
invert: stop
}


flavor 1
srclang 3
id 65535
numfuncs 2
import "huaweitest.mplt"
import "/home/bravewtz/Desktop/openarkcompiler/libjava-core/libjava-core.mplt"
entryfunc &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V
fileinfo {
  @INFO_filename "huaweitest.jar"}
srcfileinfo {
  1 "huaweitest.java"}
javaclass $Lhuaweitest_3B <$Lhuaweitest_3B> public
func &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V public constructor (var %_this <* <$Lhuaweitest_3B>>) void
func &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V public static (var %Reg2_R743 <* <[] <* <$Ljava_2Flang_2FString_3B>>>>) void
var $_C_STR_907ba9a10d33c74f1c37be3b41544334 fstatic <[10] u64> readonly = [0, 0x6b00000000, 0x20490949984357f2, 0x4909490909490920, 0x909494949494949, 0x2020202020202049, 0x2020200909492020, 0x4949494920204920, 0x4949202049494949, 73]
var $_C_STR_194a027f7d649763903a7dcda50cf5a0 fstatic <[9] u64> readonly = [0, 0x5b00000000, 0x94909491faf02dc, 0x2009490949090949, 0x2020492009094920, 0x4920492020202020, 0x4920202020202020, 0x2020090949202020, 73]
var $_C_STR_901191d3899ab5fc7be3d97fe762f978 fstatic <[9] u64> readonly = [0, 0x5f00000000, 0x49494949fbe6d2fb, 0x4909490909490949, 0x2020090949202009, 0x2049202020202049, 0x2020202020492020, 0x909492020200949, 0x492020]
var $_C_STR_4a20a28a5a71422be90661b1072ca29e fstatic <[9] u64> readonly = [0, 0x6500000000, 0x94909494f3904e4, 0x2009490949090949, 0x4920202009094920, 0x2020202049202020, 0x2009492020204920, 0x4949494949492020, 0x492020204949]
var $_C_STR_e4c52869a15445bee0db530b07e9b98a fstatic <[8] u64> readonly = [0, 0x5100000000, 0x949094949ddeb72, 0x2009490949090949, 0x4920490909094920, 0x4920202020202020, 0x949202020094920, 0x49202009]
var $_C_STR_58a8c3b0d70b92b64324906ef9c02c90 fstatic <[10] u64> readonly = [0, 0x6d00000000, 0x94909497041ce40, 0x4949494949494949, 0x4949494949490949, 0x2049200909494949, 0x2020202020202020, 0x4949492020200949, 0x4920094949494949, 0x4949]
var $Ljava_2Flang_2FSystem_3B_7Cout extern <* <$Ljava_2Fio_2FPrintStream_3B>> final public static
var $__cinf_Ljava_2Flang_2FString_3B <$__class_meta__>
func &MCC_GetOrInsertLiteral () <* <$Ljava_2Flang_2FString_3B>>
func &Lhuaweitest_3B_7C_3Cinit_3E_7C_28_29V public constructor (var %_this <* <$Lhuaweitest_3B>>) void {
  funcid 48153
  var %Reg1_R43694 <* <$Lhuaweitest_3B>>
  var %Reg1_R57 <* <$Ljava_2Flang_2FObject_3B>>

  dassign %Reg1_R43694 0 (dread ref %_this)
  #INSTIDX : 0||0000:  aload_0
  #INSTIDX : 1||0001:  invokespecial
  dassign %Reg1_R57 0 (retype ref <* <$Ljava_2Flang_2FObject_3B>> (dread ref %Reg1_R43694))
  callassigned &Ljava_2Flang_2FObject_3B_7C_3Cinit_3E_7C_28_29V (dread ref %Reg1_R57) {}
  #INSTIDX : 4||0004:  return
  return ()
}
func &Lhuaweitest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V public static (var %Reg2_R743 <* <[] <* <$Ljava_2Flang_2FString_3B>>>>) void {
  funcid 48154
  var %Reg0_R562 <* <$Ljava_2Fio_2FPrintStream_3B>>
  var %Reg1_R43 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161334 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161335 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161336 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161337 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161338 <* <$Ljava_2Flang_2FString_3B>>
  var %L_STR_161339 <* <$Ljava_2Flang_2FString_3B>>

  intrinsiccallwithtype <$Lhuaweitest_3B> JAVA_CLINIT_CHECK ()
  #INSTIDX : 0||0000:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 3||0003:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_907ba9a10d33c74f1c37be3b41544334) { dassign %L_STR_161334 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161334)
  #INSTIDX : 5||0005:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 8||0008:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 11||000b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_194a027f7d649763903a7dcda50cf5a0) { dassign %L_STR_161335 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161335)
  #INSTIDX : 13||000d:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 16||0010:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 19||0013:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_901191d3899ab5fc7be3d97fe762f978) { dassign %L_STR_161336 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161336)
  #INSTIDX : 21||0015:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 24||0018:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 27||001b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_4a20a28a5a71422be90661b1072ca29e) { dassign %L_STR_161337 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161337)
  #INSTIDX : 29||001d:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 32||0020:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 35||0023:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_e4c52869a15445bee0db530b07e9b98a) { dassign %L_STR_161338 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161338)
  #INSTIDX : 37||0025:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 40||0028:  getstatic
  intrinsiccallwithtype <$Ljava_2Flang_2FSystem_3B> JAVA_CLINIT_CHECK ()
  dassign %Reg0_R562 0 (dread ref $Ljava_2Flang_2FSystem_3B_7Cout)
  #INSTIDX : 43||002b:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_58a8c3b0d70b92b64324906ef9c02c90) { dassign %L_STR_161339 0 }
  dassign %Reg1_R43 0 (dread ptr %L_STR_161339)
  #INSTIDX : 45||002d:  invokevirtual
  virtualcallassigned &Ljava_2Fio_2FPrintStream_3B_7Cprintln_7C_28Ljava_2Flang_2FString_3B_29V (dread ref %Reg0_R562, dread ref %Reg1_R43) {}
  #INSTIDX : 48||0030:  return
  return ()
}


//impulse: /give @p spawn_egg 1 0 {display:{Name:"Cleansing Gel Spawner"},EntityTag:{id:"minecraft:chicken",CustomName:"MMH_CleansingGelSpawner",Silent:1,NoGravity:1}}
//MMH_loadChunks()
///clone ~1 ~1 ~1 ~3 ~5 ~3 24 1 24

#MMH
repeat process MMH_cleansingGelSpawner {
if: /testfor @e[type=Chicken,name=MMH_CleansingGelSpawner]
then {
  MMH_loadChunks()
  /execute @e[type=Chicken,name=MMH_CleansingGelSpawner] ~ ~ ~ clone 24 1 24 26 5 26 ~-1 ~ ~-1 masked
  /execute @e[type=Chicken,name=MMH_CleansingGelSpawner] ~ ~ ~ fill ~ ~ ~ ~ ~ ~ air 0 replace pumpkin
  /tp @e[type=Chicken,name=MMH_CleansingGelSpawner] ~ -100 ~
}
}

///summon item ~-1 ~-1 ~-1 {CustomName:"ACV_CleansingGel",PickupDelay:32767,Item:{Count:1,Damage:1,id:"minecraft:wool"}}


program rcall;
procedure f; begin call f end;
begin call f end.


/* The shortest Min-Passy Program : sample12 */
program S;begin end.


repeat process ACV_antiBridges {
// Wake up one idle anti bridge after beeing teleported
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge_Stopping] ~ ~ ~ entitydata @e[type=area_effect_cloud,name=ACV_AntiBridge_Idle,dy=0,c=1] {CustomName:"ACV_AntiBridge"}
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge] add ACV_TpProof

/testfor @e[type=area_effect_cloud,name=ACV_AntiBridge]
invert: stop

/kill @e[type=area_effect_cloud,name=ACV_AntiBridge_Stopping]

/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_InCarpet] remove ACV_InCarpet
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge] ~ ~ ~ detect ~ ~ ~ carpet 3 scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,r=0,c=1] add ACV_InCarpet

/entitydata @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_InCarpet] {CustomName:"ACV_AntiBridge_Stopping"}
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge_Stopping] remove ACV_TpProof

// To avoid race conditions, if there are multiple antibridges in the same block one needs to be processed (setblock) after the others, so that it removes the bridge correctly
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge] add ACV_Multiple
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_Multiple] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,dy=0,c=-1] remove ACV_Multiple

/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_Multiple] ~ ~ ~ kill @e[type=area_effect_cloud,name=ACV_BridgeCross,dy=0,c=1]

/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_KeepCarpet] remove ACV_KeepCarpet
/scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_KeepPistonExtension] remove ACV_KeepPistonExtension
/execute @e[type=area_effect_cloud,name=ACV_BridgeCross] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,dy=0] add ACV_KeepCarpet
/execute @e[type=area_effect_cloud,name=ACV_BridgeBelow] ~ ~-1 ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_AntiBridge,dy=0] add ACV_KeepPistonExtension

/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_Multiple] ~ ~ ~ kill @e[type=area_effect_cloud,name=ACV_BridgeCross,dy=0,c=1]

/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_KeepCarpet] ~ ~ ~ kill @e[type=area_effect_cloud,name=ACV_BridgeBelow,dy=0]
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_KeepCarpet] ~ ~1 ~ kill @e[type=area_effect_cloud,name=ACV_BridgeBelow,dy=0]

///setblock ~ ~ ~ piston_extension Not: /fill ~ ~ ~ ~ ~ ~ piston_extension 0 replace carpet 3 due to https://bugs.mojang.com/browse/MC-61864
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_KeepCarpet] ~ ~ ~ execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=ACV_KeepPistonExtension,r=0,c=1] ~ ~ ~ setblock ~ ~ ~ piston_extension
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_KeepCarpet] ~ ~ ~ fill ~ ~ ~ ~ ~ ~ air 0 replace carpet 3
/execute @e[type=area_effect_cloud,name=ACV_AntiBridge,tag=!ACV_KeepCarpet] ~ ~ ~ fill ~ ~-1 ~ ~ ~-1 ~ air 0 replace piston_extension

/tp @e[type=area_effect_cloud,name=ACV_AntiBridge,rym=45,ry=135] ~-1 ~ ~
/tp @e[type=area_effect_cloud,name=ACV_AntiBridge,rym=135,ry=-135] ~ ~ ~-1
/tp @e[type=area_effect_cloud,name=ACV_AntiBridge,rym=-135,ry=-45] ~1 ~ ~
/tp @e[type=area_effect_cloud,name=ACV_AntiBridge,rym=-45,ry=45] ~ ~ ~1

/execute @e[type=area_effect_cloud,name=ACV_AntiBridge] ~ ~ ~ kill @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,dy=0]
}


with(DocumentTools):
SetProperty("LogAreaSIAN", value, ""):
SetProperty("LogAreaSE", value, ""):
SetProperty("LogAreaME", value, ""):

SetProperty("GlobalParams1", expression, NULL):
SetProperty("LocalParams1", expression, NULL):
SetProperty("NoIDParams1", expression, NULL):

SetProperty("being_refined", caption, ""):

SetProperty("Bound", expression, NULL):
SetProperty("MultiFunctions", expression, NULL):
SetProperty("SingleFunctions", expression, NULL):

SetProperty("RunningTimeSIAN", value, ""):
SetProperty("RunningTimeMulti", value, ""):
SetProperty("RunningTimeSingle", value, ""):

SetProperty("Parameters", value, ""):


//impulse: /give @p spawn_egg 1 0 {EntityTag:{id:"minecraft:squid"},display:{Name:"spawnMeg",Lore:["Use this to spawn","a Material Emancipation Grid"]}}
//impulse: /give @p spawn_egg 1 0 {EntityTag:{id:"minecraft:squid"},display:{Name:"deleteMeg",Lore:["Use this to delete","a Material Emancipation Grid"]}}

#MMH
repeat process MMH_megs {
  /execute @e[type=squid,name=spawnMeg] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {CustomName:ACV_MEG,Duration:2147483647,Passengers:[{id:creeper,CustomName:ACV_MEG,powered:1,ActiveEffects:[{Amplifier:1,Duration:1000000,Id:14,ShowParticles:0b}],PersistenceRequired:1,Invulnerable:1,NoAI:1}]}
  /tp @e[type=squid,name=spawnMeg] ~ -100 ~
  /execute @e[type=squid,name=deleteMeg] ~ ~ ~ tp @e[name=ACV_MEG,dy=-1] ~ -100 ~
  /tp @e[type=squid,name=deleteMeg] ~ -100 ~
}


impulse process ACV_confirmBlockOption {
  ACV_loadChunks()
  /clone ${origin + (1 1 -6)} ${origin + (7 2 -6)} 0 1 1
  /fill 0 1 2 6 2 2 air
  /tellraw @a [{"text":"[","color":"gold"},{"text":"Info","color":"gold","italic":"true"},{"text":"] ","color":"gold"},{"text":"Block-Option confirmed","color":"yellow"}]
}


program sample28p;
procedure p;begin writeln('Hello!') end;
procedure q;begin writeln('Everyone!') end;
begin call p; call q end.


// Param & Return Types:
// AS = armor_stand
// SCV = Scoreboard Value
// SC = Scoreboard
// ASwS = armor_stands with Score
// ASwT = armor_stands with Tag
// IF = ItemFrame

// ACV_DIRECTION:
// 5 = Floor Portal
// 4 = Ceiling Portal
// 3 = East Portal
// 2 = North Portal
// 1 = West Portal
// 0 = South Portal

// ACV_Color:
// 0 = Blue
// 1 = Orange
// 2 = Purple
// 3 = Red

Summon blue Portal:
/summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_remote_createPortals_PARAM",Tags:["ACV_Blue"],Duration:2147483647}
/execute @e[name=ACV_remote_createPortals] ~ ~ ~ setblock ~ ~ ~ redstone_block

Summon orange Portal:
/summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_remote_createPortals_PARAM",Tags:["ACV_Orange"],Duration:2147483647}
/execute @e[name=ACV_remote_createPortals] ~ ~ ~ setblock ~ ~ ~ redstone_block

Summon purple Portal:
/summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_remote_createPortals_PARAM",Tags:["ACV_Purple"],Duration:2147483647}
/execute @e[name=ACV_remote_createPortals] ~ ~ ~ setblock ~ ~ ~ redstone_block

Summon red Portal:
/summon area_effect_cloud ~ ~1 ~ {CustomName:"ACV_remote_createPortals_PARAM",Tags:["ACV_Red"],Duration:2147483647}
/execute @e[name=ACV_remote_createPortals] ~ ~ ~ setblock ~ ~ ~ redstone_block

Summon Repulsion Gel:
/summon item ~ ~ ~ {CustomName:"ACV_RepulsionGel",PickupDelay:32767,Item:{Count:1,Damage:11,id:"minecraft:wool"}}

Summon Propulsion Gel:
/summon item ~ ~ ~ {CustomName:"ACV_PropulsionGel",PickupDelay:32767,Item:{Count:1,Damage:1,id:"minecraft:wool"}}

Summon Cleansing Gel
/summon item ~ ~ ~ {CustomName:"ACV_CleansingGel",PickupDelay:32767,Item:{Count:1,id:"minecraft:glass"}}

Summon Material Emancipation Grill:
/summon area_effect_cloud ~ ~ ~ {CustomName:ACV_MEG,Duration:2147483647,Passengers:[{id:creeper,CustomName:ACV_MEG,powered:1,ActiveEffects:[{Amplifier:1,Duration:1000000,Id:14,ShowParticles:0b}],PersistenceRequired:1,Invulnerable:1,NoAI:1}]}

Kill Material Emancipation Grill:
/tp @e[name=ACV_MEG,dy=1] ~ -100 ~

Control_Panel {

Special_Thanks {
/setblock ~ ~ ~ standing_sign 0 replace {Text1:"{\"text\":\"Special Thanks\",\"bold\":\"true\"}",Text2:"[{\"text\":\"click on the \"},{\"text\":\"red\",\"color\":\"red\"}]",Text3:"{\"text\":\"names for more\"}",Text4:"{\"text\":\"information\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"Adrodoc55\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"Adrodoc55's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" YouTube-Channel by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"https://www.youtube.com/user/Adrodoc55\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"because I wanted\"}",Text4:"{\"text\":\"to thank myself\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"The Farlanders\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"The Farlander's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" Video by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"http://youtu.be/jSiP51XKK1Q\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"for the whole\"}",Text4:"{\"text\":\"Idea\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"Dragnoz\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"Dragnoz's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" Video by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"http://youtu.be/J0ulXBtxQvo\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"for floor and\"}",Text4:"{\"text\":\"ceiling Portals\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"SimplySarc\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"SimplySarc's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" Video by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"http://youtu.be/O8dv9P49cKk\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"for the\"}",Text4:"{\"text\":\"Chunk-Loader\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"NanoRex\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"NanoRex's\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" Video by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"http://youtu.be/lyROYbzLCZ0\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"for the Material\"}",Text4:"{\"text\":\"Emancipation Grid\"}"}
/setblock ~ ~ ~ wall_sign 3 replace {Text1:"{\"text\":\"Ersatz_\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"\\\",\\\"extra\\\":[{\\\"text\\\":\\\"Check out \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"Ersatz_'s\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\" YouTube-Channel by clicking \\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"here\\\",\\\"color\\\":\\\"aqua\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"open_url\\\",\\\"value\\\":\\\"https://www.youtube.com/channel/UClfq20CeYnZ2_Rm72VgUPXg\\\"}}]}\"}}",Text2:"{\"text\":\"\"}",Text3:"{\"text\":\"for his\"}",Text4:"{\"text\":\"Contribution\"}"}
Special_Thanks }

Equipment {
/setblock ~ ~ ~ standing_sign 0 replace {Text1:"{\"text\":\"\"}",Text2:"{\"text\":\"Equipment\",\"color\":\"dark_purple\",\"bold\":\"true\"}",Text3:"{\"text\":\"\"}",Text4:"{\"text\":\"\"}"}

/give @p minecraft:bow 1 0 {Unbreakable:1,ench:[{id:48,lvl:6},{id:51,lvl:1}],HideFlags:5,display:{Name:"Blue Portalgun",Lore:["Makes blue Portals!"]}}
/give @p minecraft:bow 1 0 {Unbreakable:1,ench:[{id:48,lvl:7},{id:51,lvl:1}],HideFlags:5,display:{Name:"Orange Portalgun",Lore:["Doesn't make blue Portals!"]}}
/give @p minecraft:bow 1 0 {Unbreakable:1,ench:[{id:48,lvl:8},{id:51,lvl:1}],HideFlags:5,display:{Name:"Purple Portalgun",Lore:["Makes purple Portals!"]}}
/give @p minecraft:bow 1 0 {Unbreakable:1,ench:[{id:48,lvl:9},{id:51,lvl:1}],HideFlags:5,display:{Name:"Red Portalgun",Lore:["Makes red Portals!"]}}
/give @p minecraft:arrow 1 0 {display:{Name:"Picking up Cubes",Lore:["Hold this to pick up the closest Cube"]}}
/replaceitem entity @p slot.armor.feet minecraft:chainmail_boots 1 0 {Unbreakable:1,ench:[{id:2,lvl:1}],HideFlags:5,display:{Name:"Long Fall Boots",Lore:["No more Falldamage!"]}}
Equipment }

Kill all Cubes {
/kill @e[name=ACV_Cube]
Kill all Cubes }

Kill closest Cubes {
/kill @e[name=ACV_Cube,c=1]
Kill closest Cubes }

Summon a Weighted Storage Cube {
/summon armor_stand ~ ~-0.8 ~2 {CustomName:"ACV_Cube",DisabledSlots:2035728,ArmorItems:[{},{},{},{Damage:6,id:"stone",Count:1}],NoGravity:1b,Invisible:1b,Invulnerable:1b}
Summon a Weighted Storage Cube }

Summon a Discourgement Redirection Cube {
/summon armor_stand ~ ~-0.8 ~2 {CustomName:"ACV_Cube",DisabledSlots:2035728,ArmorItems:[{},{},{},{id:"dispenser",Count:1}],Tags:["ACV_Redirecting"],NoGravity:1b,Invisible:1b,Invulnerable:1b}
Summon a Discourgement Redirection Cube }

Delete all Portals {
/execute @e[name=ACV_remote_deleteAllPortals] ~ ~ ~ setblock ~ ~ ~ redstone_block
Delete all Portals }

Delete blue Portal {
/summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_remote_deletePortals_PARAM",Tags:["ACV_Blue"],Duration:2147483647}
/execute @e[name=ACV_remote_deletePortals] ~ ~ ~ setblock ~ ~ ~ redstone_block
Delete blue Portal }

Delete orange Portal {
/summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_remote_deletePortals_PARAM",Tags:["ACV_Orange"],Duration:2147483647}
/execute @e[name=ACV_remote_deletePortals] ~ ~ ~ setblock ~ ~ ~ redstone_block
Delete orange Portal }

Delete purple Portal {
/summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_remote_deletePortals_PARAM",Tags:["ACV_Purple"],Duration:2147483647}
/execute @e[name=ACV_remote_deletePortals] ~ ~ ~ setblock ~ ~ ~ redstone_block
Delete purple Portal }

Delete red Portal {
/summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_remote_deletePortals_PARAM",Tags:["ACV_Red"],Duration:2147483647}
/execute @e[name=ACV_remote_deletePortals] ~ ~ ~ setblock ~ ~ ~ redstone_block
Delete red Portal }

Block_Option {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"\"}",Text2:"{\"text\":\"Block-Option\",\"color\":\"black\",\"bold\":\"true\"}",Text3:"{\"text\":\"\"}",Text4:"{\"text\":\"\"}"}

/execute @e[name=ACV_confirmBlockOption] ~ ~ ~ setblock ~ ~ ~ redstone_block
Block_Option }

Mapmaker_Helper {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"When building\"}",Text2:"{\"text\":\"a map please\"}",Text3:"{\"text\":\"consider the \"}",Text4:"{\"text\":\"Mapmaker Helper\",\"color\":\"dark_red\"}"}

/tellraw @a [{"text":"Download the ","color":"yellow"},{"text":"Mapmaker Helper","color":"gold"},{"text":" by clicking ","color":"yellow"},{"text":"here","color":"aqua","hoverEvent":{"action":"show_text","value":{"text":"Click to open the Download Page","color":"red"}},"clickEvent":{"action":"open_url","value":"https://github.com/Adrodoc55/MapMakerHelper/releases"}}]
Mapmaker_Helper }

Portalsystem {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"[{\"text\":\"Portal\",\"color\":\"dark_blue\",\"bold\":true},{\"text\":\"system\",\"color\":\"gold\",\"bold\":true}]",Text2:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text3:"{\"text\":\"|\",\"color\":\"black\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_portals] ~ ~ ~ setblock ~ ~ ~ redstone_block
/execute @e[name=ACV_teleportation] ~ ~ ~ setblock ~ ~ ~ redstone_block
/tellraw @a [{"text":"Welcome to","color":"gold"},{"text":" ApertureCraft Vanilla\n","color":"dark_aqua"},{"text":"   Version: ","color":"gold"},{"text":"9.0.1\n","color":"dark_aqua","italic":"true"},{"text":"   made by ","color":"yellow","italic":"true"},{"text":"Adrodoc55\n","color":"aqua","hoverEvent":{"action":"show_text","value":{"text":"Click to open YouTube Channel","color":"red"}},"clickEvent":{"action":"open_url","value":"https://www.youtube.com/user/Adrodoc55"}},{"text":"\nVisit me on ","color":"yellow"},{"text":"[Github]","color":"aqua","hoverEvent":{"action":"show_text","value":{"text":"Click to open Github","color":"red"}},"clickEvent":{"action":"open_url","value":"https://github.com/Adrodoc55/ApertureCraftVanilla"}},{"text":" to report Bugs and check for Updates","color":"yellow"}]

/execute @e[name=ACV_portals] ~ ~ ~ setblock ~ ~ ~ stone
/execute @e[name=ACV_teleportation] ~ ~ ~ setblock ~ ~ ~ stone
Portalsystem }

Smooth_Teleport {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"Smooth Teleport\"}",Text2:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text3:"{\"text\":\"|\",\"color\":\"black\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_teleportation] ~ ~ ~ setblock ~ ~ ~ stone
/entitydata @e[name=ACV_teleportation] {CustomName:"ACV_simpleTeleportation"}
/entitydata @e[name=ACV_smoothTeleportation] {CustomName:"ACV_teleportation"}

/execute @e[name=ACV_teleportation] ~ ~ ~ setblock ~ ~ ~ stone
/entitydata @e[name=ACV_teleportation] {CustomName:"ACV_smoothTeleportation"}
/entitydata @e[name=ACV_simpleTeleportation] {CustomName:"ACV_teleportation"}

/execute @e[name=ACV_portals] ~ ~ ~ detect ~ ~ ~ redstone_block * execute @e[name=ACV_teleportation] ~ ~ ~ setblock ~ ~ ~ redstone_block
Smooth_Teleport }

Cubes {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"Cubes\",\"color\":\"dark_gray\",\"bold\":true}",Text2:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text3:"{\"text\":\"|\",\"color\":\"black\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_cubes] ~ ~ ~ setblock ~ ~ ~ redstone_block

/execute @e[name=ACV_cubes] ~ ~ ~ setblock ~ ~ ~ stone
Cubes }

Lasers {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"Lasers\",\"color\":\"dark_red\",\"bold\":true}",Text2:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text3:"{\"text\":\"|\",\"color\":\"black\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_lasers] ~ ~ ~ setblock ~ ~ ~ redstone_block

/execute @e[name=ACV_lasers] ~ ~ ~ setblock ~ ~ ~ stone
Lasers }

Material Emancipation Grill {
/setblock ~ ~ ~ minecraft:standing_sign 8 replace {Text1:"{\"text\":\"Material\"}",Text2:"{\"text\":\"Emancipation Grill\"}",Text3:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_megs] ~ ~ ~ setblock ~ ~ ~ redstone_block

/execute @e[name=ACV_megs] ~ ~ ~ setblock ~ ~ ~ stone
Material Emancipation Grill }

Gels {
/setblock ~ ~ ~ standing_sign 8 replace {Text1:"{\"text\":\"Gels\",\"color\":\"blue\",\"bold\":true}",Text2:"{\"text\":\"off\",\"color\":\"dark_red\"}",Text3:"{\"text\":\"|\",\"color\":\"black\"}",Text4:"{\"text\":\"on\",\"color\":\"dark_green\"}"}

/execute @e[name=ACV_gels] ~ ~ ~ /setblock ~ ~ ~ redstone_block

/execute @e[name=ACV_gels] ~ ~ ~ /setblock ~ ~ ~ stone
Gels }

Control_Panel }