
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) print_screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) print_line_cursor#0 ← (byte*) print_screen#0
  (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0
  to:@12
print_str: scope:[print_str]  from main::@1
  (byte*) print_char_cursor#27 ← phi( main::@1/(byte*) print_char_cursor#25 )
  (byte*) print_str::str#4 ← phi( main::@1/(byte*) print_str::str#1 )
  to:print_str::@1
print_str::@1: scope:[print_str]  from print_str print_str::@2
  (byte*) print_char_cursor#22 ← phi( print_str/(byte*) print_char_cursor#27 print_str::@2/(byte*) print_char_cursor#1 )
  (byte*) print_str::str#2 ← phi( print_str/(byte*) print_str::str#4 print_str::@2/(byte*) print_str::str#0 )
  (bool~) print_str::$0 ← *((byte*) print_str::str#2) != (byte) '@'
  if((bool~) print_str::$0) goto print_str::@2
  to:print_str::@return
print_str::@2: scope:[print_str]  from print_str::@1
  (byte*) print_char_cursor#12 ← phi( print_str::@1/(byte*) print_char_cursor#22 )
  (byte*) print_str::str#3 ← phi( print_str::@1/(byte*) print_str::str#2 )
  *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#3)
  (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12
  (byte*) print_str::str#0 ← ++ (byte*) print_str::str#3
  to:print_str::@1
print_str::@return: scope:[print_str]  from print_str::@1
  (byte*) print_char_cursor#13 ← phi( print_str::@1/(byte*) print_char_cursor#22 )
  (byte*) print_char_cursor#2 ← (byte*) print_char_cursor#13
  return 
  to:@return
print_ln: scope:[print_ln]  from main::@4
  (byte*) print_char_cursor#23 ← phi( main::@4/(byte*) print_char_cursor#8 )
  (byte*) print_line_cursor#17 ← phi( main::@4/(byte*) print_line_cursor#19 )
  to:print_ln::@1
print_ln::@1: scope:[print_ln]  from print_ln print_ln::@1
  (byte*) print_char_cursor#14 ← phi( print_ln/(byte*) print_char_cursor#23 print_ln::@1/(byte*) print_char_cursor#14 )
  (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#17 print_ln::@1/(byte*) print_line_cursor#1 )
  (byte*~) print_ln::$0 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40
  (byte*) print_line_cursor#1 ← (byte*~) print_ln::$0
  (bool~) print_ln::$1 ← (byte*) print_line_cursor#1 < (byte*) print_char_cursor#14
  if((bool~) print_ln::$1) goto print_ln::@1
  to:print_ln::@2
print_ln::@2: scope:[print_ln]  from print_ln::@1
  (byte*) print_line_cursor#10 ← phi( print_ln::@1/(byte*) print_line_cursor#1 )
  (byte*) print_char_cursor#3 ← (byte*) print_line_cursor#10
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@2
  (byte*) print_char_cursor#15 ← phi( print_ln::@2/(byte*) print_char_cursor#3 )
  (byte*) print_line_cursor#11 ← phi( print_ln::@2/(byte*) print_line_cursor#10 )
  (byte*) print_line_cursor#2 ← (byte*) print_line_cursor#11
  (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#15
  return 
  to:@return
@12: scope:[]  from @begin
  (byte*) print_screen#7 ← phi( @begin/(byte*) print_screen#0 )
  (byte*) print_char_cursor#29 ← phi( @begin/(byte*) print_char_cursor#0 )
  (byte*) print_line_cursor#23 ← phi( @begin/(byte*) print_line_cursor#0 )
  (byte[]) print_hextab#0 ← (const string) $0
  to:@19
print_cls: scope:[print_cls]  from main
  (byte*) print_screen#1 ← phi( main/(byte*) print_screen#4 )
  (byte*) print_cls::sc#0 ← (byte*) print_screen#1
  to:print_cls::@1
print_cls::@1: scope:[print_cls]  from print_cls print_cls::@1
  (byte*) print_screen#2 ← phi( print_cls/(byte*) print_screen#1 print_cls::@1/(byte*) print_screen#2 )
  (byte*) print_cls::sc#2 ← phi( print_cls/(byte*) print_cls::sc#0 print_cls::@1/(byte*) print_cls::sc#1 )
  *((byte*) print_cls::sc#2) ← (byte) ' '
  (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
  (byte*~) print_cls::$0 ← (byte*) print_screen#2 + (word/signed word/dword/signed dword) 1000
  (bool~) print_cls::$1 ← (byte*) print_cls::sc#1 != (byte*~) print_cls::$0
  if((bool~) print_cls::$1) goto print_cls::@1
  to:print_cls::@2
print_cls::@2: scope:[print_cls]  from print_cls::@1
  (byte*) print_screen#3 ← phi( print_cls::@1/(byte*) print_screen#2 )
  (byte*) print_line_cursor#3 ← (byte*) print_screen#3
  (byte*) print_char_cursor#5 ← (byte*) print_line_cursor#3
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls::@2
  (byte*) print_char_cursor#16 ← phi( print_cls::@2/(byte*) print_char_cursor#5 )
  (byte*) print_line_cursor#12 ← phi( print_cls::@2/(byte*) print_line_cursor#3 )
  (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#12
  (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#16
  return 
  to:@return
@19: scope:[]  from @12
  (byte*) print_screen#6 ← phi( @12/(byte*) print_screen#7 )
  (byte*) print_char_cursor#28 ← phi( @12/(byte*) print_char_cursor#29 )
  (byte*) print_line_cursor#22 ← phi( @12/(byte*) print_line_cursor#23 )
  (byte[]) txt#0 ← (const string) $1
  to:@20
main: scope:[main]  from @20
  (byte*) print_char_cursor#24 ← phi( @20/(byte*) print_char_cursor#26 )
  (byte*) print_line_cursor#18 ← phi( @20/(byte*) print_line_cursor#20 )
  (byte*) print_screen#4 ← phi( @20/(byte*) print_screen#5 )
  call print_cls 
  to:main::@3
main::@3: scope:[main]  from main
  (byte*) print_char_cursor#17 ← phi( main/(byte*) print_char_cursor#6 )
  (byte*) print_line_cursor#13 ← phi( main/(byte*) print_line_cursor#4 )
  (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#13
  (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#17
  (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main::@3 main::@5
  (byte) main::i#4 ← phi( main::@3/(byte) main::i#0 main::@5/(byte) main::i#1 )
  (byte*) print_line_cursor#21 ← phi( main::@3/(byte*) print_line_cursor#5 main::@5/(byte*) print_line_cursor#6 )
  (byte*) print_char_cursor#25 ← phi( main::@3/(byte*) print_char_cursor#7 main::@5/(byte*) print_char_cursor#9 )
  (byte*) print_str::str#1 ← (byte[]) txt#0
  call print_str 
  to:main::@4
main::@4: scope:[main]  from main::@1
  (byte) main::i#3 ← phi( main::@1/(byte) main::i#4 )
  (byte*) print_line_cursor#19 ← phi( main::@1/(byte*) print_line_cursor#21 )
  (byte*) print_char_cursor#18 ← phi( main::@1/(byte*) print_char_cursor#2 )
  (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#18
  call print_ln 
  to:main::@5
main::@5: scope:[main]  from main::@4
  (byte) main::i#2 ← phi( main::@4/(byte) main::i#3 )
  (byte*) print_char_cursor#19 ← phi( main::@4/(byte*) print_char_cursor#4 )
  (byte*) print_line_cursor#14 ← phi( main::@4/(byte*) print_line_cursor#2 )
  (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#14
  (byte*) print_char_cursor#9 ← (byte*) print_char_cursor#19
  *((byte[]) txt#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((byte[]) txt#0 + (byte/signed byte/word/signed word/dword/signed dword) 1)
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,10)
  (bool~) main::$3 ← (byte) main::i#1 != rangelast(0,10)
  if((bool~) main::$3) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@5
  (byte*) print_char_cursor#20 ← phi( main::@5/(byte*) print_char_cursor#9 )
  (byte*) print_line_cursor#15 ← phi( main::@5/(byte*) print_line_cursor#6 )
  (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#15
  (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#20
  return 
  to:@return
@20: scope:[]  from @19
  (byte*) print_screen#5 ← phi( @19/(byte*) print_screen#6 )
  (byte*) print_char_cursor#26 ← phi( @19/(byte*) print_char_cursor#28 )
  (byte*) print_line_cursor#20 ← phi( @19/(byte*) print_line_cursor#22 )
  call main 
  to:@21
@21: scope:[]  from @20
  (byte*) print_char_cursor#21 ← phi( @20/(byte*) print_char_cursor#10 )
  (byte*) print_line_cursor#16 ← phi( @20/(byte*) print_line_cursor#7 )
  (byte*) print_line_cursor#8 ← (byte*) print_line_cursor#16
  (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#21
  to:@end
@end: scope:[]  from @21

SYMBOL TABLE SSA
(const string) $0 = (string) "0123456789abcdef"
(const string) $1 = (string) "camelot@"
(label) @12
(label) @19
(label) @20
(label) @21
(label) @begin
(label) @end
(void()) main()
(bool~) main::$3
(label) main::@1
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i#4
(byte*) print_char_cursor
(byte*) print_char_cursor#0
(byte*) print_char_cursor#1
(byte*) print_char_cursor#10
(byte*) print_char_cursor#11
(byte*) print_char_cursor#12
(byte*) print_char_cursor#13
(byte*) print_char_cursor#14
(byte*) print_char_cursor#15
(byte*) print_char_cursor#16
(byte*) print_char_cursor#17
(byte*) print_char_cursor#18
(byte*) print_char_cursor#19
(byte*) print_char_cursor#2
(byte*) print_char_cursor#20
(byte*) print_char_cursor#21
(byte*) print_char_cursor#22
(byte*) print_char_cursor#23
(byte*) print_char_cursor#24
(byte*) print_char_cursor#25
(byte*) print_char_cursor#26
(byte*) print_char_cursor#27
(byte*) print_char_cursor#28
(byte*) print_char_cursor#29
(byte*) print_char_cursor#3
(byte*) print_char_cursor#4
(byte*) print_char_cursor#5
(byte*) print_char_cursor#6
(byte*) print_char_cursor#7
(byte*) print_char_cursor#8
(byte*) print_char_cursor#9
(void()) print_cls()
(byte*~) print_cls::$0
(bool~) print_cls::$1
(label) print_cls::@1
(label) print_cls::@2
(label) print_cls::@return
(byte*) print_cls::sc
(byte*) print_cls::sc#0
(byte*) print_cls::sc#1
(byte*) print_cls::sc#2
(byte[]) print_hextab
(byte[]) print_hextab#0
(byte*) print_line_cursor
(byte*) print_line_cursor#0
(byte*) print_line_cursor#1
(byte*) print_line_cursor#10
(byte*) print_line_cursor#11
(byte*) print_line_cursor#12
(byte*) print_line_cursor#13
(byte*) print_line_cursor#14
(byte*) print_line_cursor#15
(byte*) print_line_cursor#16
(byte*) print_line_cursor#17
(byte*) print_line_cursor#18
(byte*) print_line_cursor#19
(byte*) print_line_cursor#2
(byte*) print_line_cursor#20
(byte*) print_line_cursor#21
(byte*) print_line_cursor#22
(byte*) print_line_cursor#23
(byte*) print_line_cursor#3
(byte*) print_line_cursor#4
(byte*) print_line_cursor#5
(byte*) print_line_cursor#6
(byte*) print_line_cursor#7
(byte*) print_line_cursor#8
(byte*) print_line_cursor#9
(void()) print_ln()
(byte*~) print_ln::$0
(bool~) print_ln::$1
(label) print_ln::@1
(label) print_ln::@2
(label) print_ln::@return
(byte*) print_screen
(byte*) print_screen#0
(byte*) print_screen#1
(byte*) print_screen#2
(byte*) print_screen#3
(byte*) print_screen#4
(byte*) print_screen#5
(byte*) print_screen#6
(byte*) print_screen#7
(void()) print_str((byte*) print_str::str)
(bool~) print_str::$0
(label) print_str::@1
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0
(byte*) print_str::str#1
(byte*) print_str::str#2
(byte*) print_str::str#3
(byte*) print_str::str#4
(byte[]) txt
(byte[]) txt#0

Alias (byte*) print_line_cursor#0 = (byte*) print_screen#0 (byte*) print_char_cursor#0 (byte*) print_line_cursor#23 (byte*) print_char_cursor#29 (byte*) print_screen#7 (byte*) print_line_cursor#22 (byte*) print_char_cursor#28 (byte*) print_screen#6 (byte*) print_line_cursor#20 (byte*) print_char_cursor#26 (byte*) print_screen#5 
Alias (byte*) print_str::str#2 = (byte*) print_str::str#3 
Alias (byte*) print_char_cursor#12 = (byte*) print_char_cursor#22 (byte*) print_char_cursor#13 (byte*) print_char_cursor#2 
Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#10 (byte*) print_char_cursor#3 (byte*) print_line_cursor#11 (byte*) print_char_cursor#15 (byte*) print_line_cursor#2 (byte*) print_char_cursor#4 
Alias (byte*) print_line_cursor#12 = (byte*) print_screen#3 (byte*) print_screen#2 (byte*) print_line_cursor#3 (byte*) print_char_cursor#5 (byte*) print_char_cursor#16 (byte*) print_line_cursor#4 (byte*) print_char_cursor#6 
Alias (byte*) print_line_cursor#13 = (byte*) print_line_cursor#5 
Alias (byte*) print_char_cursor#17 = (byte*) print_char_cursor#7 
Alias (byte*) print_line_cursor#19 = (byte*) print_line_cursor#21 
Alias (byte) main::i#2 = (byte) main::i#3 (byte) main::i#4 
Alias (byte*) print_char_cursor#18 = (byte*) print_char_cursor#8 
Alias (byte*) print_line_cursor#14 = (byte*) print_line_cursor#6 (byte*) print_line_cursor#15 (byte*) print_line_cursor#7 
Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#9 (byte*) print_char_cursor#19 (byte*) print_char_cursor#20 
Alias (byte*) print_line_cursor#16 = (byte*) print_line_cursor#8 
Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#21 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) print_char_cursor#14
Self Phi Eliminated (byte*) print_line_cursor#12
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) print_str::str#4 (byte*) print_str::str#1
Redundant Phi (byte*) print_char_cursor#27 (byte*) print_char_cursor#25
Redundant Phi (byte*) print_line_cursor#17 (byte*) print_line_cursor#19
Redundant Phi (byte*) print_char_cursor#23 (byte*) print_char_cursor#18
Redundant Phi (byte*) print_char_cursor#14 (byte*) print_char_cursor#23
Redundant Phi (byte*) print_screen#1 (byte*) print_screen#4
Redundant Phi (byte*) print_line_cursor#12 (byte*) print_screen#1
Redundant Phi (byte*) print_screen#4 (byte*) print_line_cursor#0
Redundant Phi (byte*) print_line_cursor#18 (byte*) print_line_cursor#0
Redundant Phi (byte*) print_char_cursor#24 (byte*) print_line_cursor#0
Redundant Phi (byte*) print_line_cursor#13 (byte*) print_line_cursor#12
Redundant Phi (byte*) print_char_cursor#17 (byte*) print_line_cursor#12
Redundant Phi (byte*) print_char_cursor#18 (byte*) print_char_cursor#12
Redundant Phi (byte*) print_line_cursor#14 (byte*) print_line_cursor#1
Redundant Phi (byte*) print_char_cursor#10 (byte*) print_line_cursor#1
Redundant Phi (byte*) print_line_cursor#16 (byte*) print_line_cursor#14
Redundant Phi (byte*) print_char_cursor#11 (byte*) print_char_cursor#10
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) print_str::$0 [6] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2
Simple Condition (bool~) print_ln::$1 [19] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1
Simple Condition (bool~) print_cls::$1 [35] if((byte*) print_cls::sc#1!=(byte*~) print_cls::$0) goto print_cls::@1
Simple Condition (bool~) main::$3 [63] if((byte) main::i#1!=rangelast(0,10)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) print_line_cursor#0 = ((byte*))1024
Constant (const byte[]) print_hextab#0 = $0
Constant (const byte[]) txt#0 = $1
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) print_cls::sc#0 = print_line_cursor#0
Constant (const byte*) print_cls::$0 = print_line_cursor#0+1000
Constant (const byte*) print_str::str#1 = txt#0
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(txt#0+1)
Consolidated array index constant in *(txt#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization PassNEliminateUnusedVars
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,10)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 11
Culled Empty Block (label) print_ln::@2
Culled Empty Block (label) @12
Culled Empty Block (label) print_cls::@2
Culled Empty Block (label) @19
Culled Empty Block (label) main::@3
Culled Empty Block (label) @21
Successful SSA optimization Pass2CullEmptyBlocks
Inlining constant with var siblings (const byte*) print_str::str#1
Inlining constant with var siblings (const byte*) print_cls::sc#0
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte*) print_line_cursor#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined print_str::str#1 = (const byte[]) txt#0
Constant inlined print_cls::$0 = ((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000
Constant inlined print_cls::sc#0 = ((byte*))(word/signed word/dword/signed dword) 1024
Constant inlined $1 = (const byte[]) txt#0
Constant inlined print_line_cursor#0 = ((byte*))(word/signed word/dword/signed dword) 1024
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@6(between main::@5 and main::@1)
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @20
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of print_cls
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to print_cls:5 print_str:7 print_ln:9 

Created 7 initial phi equivalence classes
Not coalescing [14] print_char_cursor#30 ← print_line_cursor#1
Coalesced [15] print_line_cursor#24 ← print_line_cursor#1
Coalesced [16] main::i#5 ← main::i#1
Coalesced [17] print_line_cursor#25 ← print_line_cursor#19
Coalesced (already) [22] print_line_cursor#26 ← print_line_cursor#1
Coalesced [23] print_char_cursor#31 ← print_char_cursor#25
Coalesced [30] print_str::str#5 ← print_str::str#0
Coalesced [31] print_char_cursor#32 ← print_char_cursor#1
Coalesced [38] print_cls::sc#3 ← print_cls::sc#1
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) print_ln::@3
Culled Empty Block (label) print_cls::@3
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @20
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of print_ln
Adding NOP phi() at start of print_str
Adding NOP phi() at start of print_cls

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@20
@20: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @20
  [3] phi()
main: scope:[main]  from @20
  [4] phi()
  [5] call print_cls 
  to:main::@1
main::@1: scope:[main]  from main main::@6
  [6] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(byte) main::i#1 )
  [6] (byte*) print_line_cursor#19 ← phi( main/((byte*))(word/signed word/dword/signed dword) 1024 main::@6/(byte*) print_line_cursor#1 )
  [6] (byte*) print_char_cursor#25 ← phi( main/((byte*))(word/signed word/dword/signed dword) 1024 main::@6/(byte*~) print_char_cursor#30 )
  [7] call print_str 
  to:main::@4
main::@4: scope:[main]  from main::@1
  [8] phi()
  [9] call print_ln 
  to:main::@5
main::@5: scope:[main]  from main::@4
  [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1)
  [11] (byte) main::i#1 ← ++ (byte) main::i#2
  [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@6
  to:main::@return
main::@return: scope:[main]  from main::@5
  [13] return 
  to:@return
main::@6: scope:[main]  from main::@5
  [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1
  to:main::@1
print_ln: scope:[print_ln]  from main::@4
  [15] phi()
  to:print_ln::@1
print_ln::@1: scope:[print_ln]  from print_ln print_ln::@1
  [16] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#19 print_ln::@1/(byte*) print_line_cursor#1 )
  [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40
  [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@1
  [19] return 
  to:@return
print_str: scope:[print_str]  from main::@1
  [20] phi()
  to:print_str::@1
print_str::@1: scope:[print_str]  from print_str print_str::@2
  [21] (byte*) print_char_cursor#12 ← phi( print_str/(byte*) print_char_cursor#25 print_str::@2/(byte*) print_char_cursor#1 )
  [21] (byte*) print_str::str#2 ← phi( print_str/(const byte[]) txt#0 print_str::@2/(byte*) print_str::str#0 )
  [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2
  to:print_str::@return
print_str::@return: scope:[print_str]  from print_str::@1
  [23] return 
  to:@return
print_str::@2: scope:[print_str]  from print_str::@1
  [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2)
  [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12
  [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2
  to:print_str::@1
print_cls: scope:[print_cls]  from main
  [27] phi()
  to:print_cls::@1
print_cls::@1: scope:[print_cls]  from print_cls print_cls::@1
  [28] (byte*) print_cls::sc#2 ← phi( print_cls/((byte*))(word/signed word/dword/signed dword) 1024 print_cls::@1/(byte*) print_cls::sc#1 )
  [29] *((byte*) print_cls::sc#2) ← (byte) ' '
  [30] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
  [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls::@1
  [32] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 11.0
(byte) main::i#2 4.4
(byte*) print_char_cursor
(byte*) print_char_cursor#1 101.0
(byte*) print_char_cursor#12 40.6
(byte*) print_char_cursor#25 6.5
(byte*~) print_char_cursor#30 22.0
(void()) print_cls()
(byte*) print_cls::sc
(byte*) print_cls::sc#1 16.5
(byte*) print_cls::sc#2 16.5
(byte[]) print_hextab
(byte*) print_line_cursor
(byte*) print_line_cursor#1 40.625
(byte*) print_line_cursor#19 3.25
(byte*) print_line_cursor#9 204.0
(void()) print_ln()
(byte*) print_screen
(void()) print_str((byte*) print_str::str)
(byte*) print_str::str
(byte*) print_str::str#0 202.0
(byte*) print_str::str#2 101.0
(byte[]) txt

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
[ print_str::str#2 print_str::str#0 ]
[ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ]
[ print_cls::sc#2 print_cls::sc#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
[ print_str::str#2 print_str::str#0 ]
[ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ]
[ print_cls::sc#2 print_cls::sc#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
Allocated zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ]
Allocated zp ZP_WORD:7 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ]
Allocated zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ]

INITIAL ASM
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label print_char_cursor = 7
  .label print_line_cursor = 3
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
b20_from_bbegin:
  jmp b20
//SEG5 @20
b20:
//SEG6 [2] call main 
//SEG7 [4] phi from @20 to main [phi:@20->main]
main_from_b20:
  jsr main
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
bend_from_b20:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label i = 2
  //SEG11 [5] call print_cls 
  //SEG12 [27] phi from main to print_cls [phi:main->print_cls]
  print_cls_from_main:
    jsr print_cls
  //SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG14 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
  //SEG15 [6] phi (byte*) print_line_cursor#19 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta print_line_cursor
    lda #>$400
    sta print_line_cursor+1
  //SEG16 [6] phi (byte*) print_char_cursor#25 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta print_char_cursor
    lda #>$400
    sta print_char_cursor+1
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [7] call print_str 
  //SEG19 [20] phi from main::@1 to print_str [phi:main::@1->print_str]
  print_str_from_b1:
    jsr print_str
  //SEG20 [8] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
  b4_from_b1:
    jmp b4
  //SEG21 main::@4
  b4:
  //SEG22 [9] call print_ln 
  //SEG23 [15] phi from main::@4 to print_ln [phi:main::@4->print_ln]
  print_ln_from_b4:
    jsr print_ln
    jmp b5
  //SEG24 main::@5
  b5:
  //SEG25 [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
  //SEG26 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG27 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@6 -- vbuz1_neq_vbuc1_then_la1 
    lda i
    cmp #$b
    bne b6
    jmp breturn
  //SEG28 main::@return
  breturn:
  //SEG29 [13] return 
    rts
  //SEG30 main::@6
  b6:
  //SEG31 [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda print_line_cursor
    sta print_char_cursor
    lda print_line_cursor+1
    sta print_char_cursor+1
  //SEG32 [6] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  b1_from_b6:
  //SEG33 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
  //SEG34 [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#1] -- register_copy 
  //SEG35 [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#30 [phi:main::@6->main::@1#2] -- register_copy 
    jmp b1
}
//SEG36 print_ln
// Print a newline
print_ln: {
  //SEG37 [16] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
  b1_from_print_ln:
  b1_from_b1:
  //SEG38 [16] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#19 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy 
    jmp b1
  //SEG39 print_ln::@1
  b1:
  //SEG40 [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1 
    lda print_line_cursor
    clc
    adc #$28
    sta print_line_cursor
    bcc !+
    inc print_line_cursor+1
  !:
  //SEG41 [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda print_line_cursor+1
    cmp print_char_cursor+1
    bcc b1_from_b1
    bne !+
    lda print_line_cursor
    cmp print_char_cursor
    bcc b1_from_b1
  !:
    jmp breturn
  //SEG42 print_ln::@return
  breturn:
  //SEG43 [19] return 
    rts
}
//SEG44 print_str
// Print a zero-terminated string
// print_str(byte* zeropage(5) str)
print_str: {
    .label str = 5
  //SEG45 [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
  //SEG46 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
  //SEG47 [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta str
    lda #>txt
    sta str+1
    jmp b1
  //SEG48 print_str::@1
  b1:
  //SEG49 [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1 
    ldy #0
    lda (str),y
    cmp #'@'
    bne b2
    jmp breturn
  //SEG50 print_str::@return
  breturn:
  //SEG51 [23] return 
    rts
  //SEG52 print_str::@2
  b2:
  //SEG53 [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy #0
    sta (print_char_cursor),y
  //SEG54 [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc print_char_cursor
    bne !+
    inc print_char_cursor+1
  !:
  //SEG55 [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc str
    bne !+
    inc str+1
  !:
  //SEG56 [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
  //SEG57 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
  //SEG58 [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
//SEG59 print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    .label sc = 9
  //SEG60 [28] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
  b1_from_print_cls:
  //SEG61 [28] phi (byte*) print_cls::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta sc
    lda #>$400
    sta sc+1
    jmp b1
  //SEG62 [28] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1]
  b1_from_b1:
  //SEG63 [28] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy 
    jmp b1
  //SEG64 print_cls::@1
  b1:
  //SEG65 [29] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (sc),y
  //SEG66 [30] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 
    inc sc
    bne !+
    inc sc+1
  !:
  //SEG67 [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 
    lda sc+1
    cmp #>$400+$3e8
    bne b1_from_b1
    lda sc
    cmp #<$400+$3e8
    bne b1_from_b1
    jmp breturn
  //SEG68 print_cls::@return
  breturn:
  //SEG69 [32] return 
    rts
}
  txt: .text "camelot@"

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) [ main::i#2 print_line_cursor#1 ] ( main:2 [ main::i#2 print_line_cursor#1 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1 [ print_char_cursor#30 print_line_cursor#1 main::i#1 ] ( main:2 [ print_char_cursor#30 print_line_cursor#1 main::i#1 ] ) always clobbers reg byte a 
Statement [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ print_line_cursor#1 print_char_cursor#12 ] ( main:2::print_ln:9 [ main::i#2 print_line_cursor#1 print_char_cursor#12 ] ) always clobbers reg byte a 
Statement [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#12 ] ( main:2::print_ln:9 [ main::i#2 print_line_cursor#1 print_char_cursor#12 ] ) always clobbers reg byte a 
Statement [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 [ print_char_cursor#12 print_str::str#2 ] ( main:2::print_str:7 [ print_line_cursor#19 main::i#2 print_char_cursor#12 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2) [ print_char_cursor#12 print_str::str#2 ] ( main:2::print_str:7 [ print_line_cursor#19 main::i#2 print_char_cursor#12 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Statement [29] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:2::print_cls:5 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:2::print_cls:5 [ print_cls::sc#1 ] ) always clobbers reg byte a 
Statement [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) [ main::i#2 print_line_cursor#1 ] ( main:2 [ main::i#2 print_line_cursor#1 ] ) always clobbers reg byte a 
Statement [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1 [ print_char_cursor#30 print_line_cursor#1 main::i#1 ] ( main:2 [ print_char_cursor#30 print_line_cursor#1 main::i#1 ] ) always clobbers reg byte a 
Statement [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ print_line_cursor#1 print_char_cursor#12 ] ( main:2::print_ln:9 [ main::i#2 print_line_cursor#1 print_char_cursor#12 ] ) always clobbers reg byte a 
Statement [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#12 ] ( main:2::print_ln:9 [ main::i#2 print_line_cursor#1 print_char_cursor#12 ] ) always clobbers reg byte a 
Statement [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 [ print_char_cursor#12 print_str::str#2 ] ( main:2::print_str:7 [ print_line_cursor#19 main::i#2 print_char_cursor#12 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Statement [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2) [ print_char_cursor#12 print_str::str#2 ] ( main:2::print_str:7 [ print_line_cursor#19 main::i#2 print_char_cursor#12 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Statement [29] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:2::print_cls:5 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y 
Statement [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 [ print_cls::sc#1 ] ( main:2::print_cls:5 [ print_cls::sc#1 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , 
Potential registers zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] : zp ZP_WORD:3 , 
Potential registers zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ] : zp ZP_WORD:5 , 
Potential registers zp ZP_WORD:7 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ] : zp ZP_WORD:7 , 
Potential registers zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] : zp ZP_WORD:9 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 247.88: zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] 170.1: zp ZP_WORD:7 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ] 
Uplift Scope [print_str] 303: zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ] 
Uplift Scope [print_cls] 33: zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] 
Uplift Scope [main] 15.4: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 
Uplift Scope [print_ln] 

Uplifting [] best 12807 combination zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] zp ZP_WORD:7 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ] 
Uplifting [print_str] best 12807 combination zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ] 
Uplifting [print_cls] best 12807 combination zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] 
Uplifting [main] best 12717 combination reg byte x [ main::i#2 main::i#1 ] 
Uplifting [print_ln] best 12717 combination 
Coalescing zero page register [ zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] ] with [ zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] ]
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 print_cls::sc#2 print_cls::sc#1 ]
Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ]
Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label print_char_cursor = 6
  .label print_line_cursor = 2
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
b20_from_bbegin:
  jmp b20
//SEG5 @20
b20:
//SEG6 [2] call main 
//SEG7 [4] phi from @20 to main [phi:@20->main]
main_from_b20:
  jsr main
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
bend_from_b20:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
  //SEG11 [5] call print_cls 
  //SEG12 [27] phi from main to print_cls [phi:main->print_cls]
  print_cls_from_main:
    jsr print_cls
  //SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG14 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG15 [6] phi (byte*) print_line_cursor#19 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta print_line_cursor
    lda #>$400
    sta print_line_cursor+1
  //SEG16 [6] phi (byte*) print_char_cursor#25 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta print_char_cursor
    lda #>$400
    sta print_char_cursor+1
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [7] call print_str 
  //SEG19 [20] phi from main::@1 to print_str [phi:main::@1->print_str]
  print_str_from_b1:
    jsr print_str
  //SEG20 [8] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
  b4_from_b1:
    jmp b4
  //SEG21 main::@4
  b4:
  //SEG22 [9] call print_ln 
  //SEG23 [15] phi from main::@4 to print_ln [phi:main::@4->print_ln]
  print_ln_from_b4:
    jsr print_ln
    jmp b5
  //SEG24 main::@5
  b5:
  //SEG25 [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
  //SEG26 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG27 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@6 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b6
    jmp breturn
  //SEG28 main::@return
  breturn:
  //SEG29 [13] return 
    rts
  //SEG30 main::@6
  b6:
  //SEG31 [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda print_line_cursor
    sta print_char_cursor
    lda print_line_cursor+1
    sta print_char_cursor+1
  //SEG32 [6] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  b1_from_b6:
  //SEG33 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
  //SEG34 [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#1] -- register_copy 
  //SEG35 [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#30 [phi:main::@6->main::@1#2] -- register_copy 
    jmp b1
}
//SEG36 print_ln
// Print a newline
print_ln: {
  //SEG37 [16] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
  b1_from_print_ln:
  b1_from_b1:
  //SEG38 [16] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#19 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy 
    jmp b1
  //SEG39 print_ln::@1
  b1:
  //SEG40 [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1 
    lda print_line_cursor
    clc
    adc #$28
    sta print_line_cursor
    bcc !+
    inc print_line_cursor+1
  !:
  //SEG41 [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda print_line_cursor+1
    cmp print_char_cursor+1
    bcc b1_from_b1
    bne !+
    lda print_line_cursor
    cmp print_char_cursor
    bcc b1_from_b1
  !:
    jmp breturn
  //SEG42 print_ln::@return
  breturn:
  //SEG43 [19] return 
    rts
}
//SEG44 print_str
// Print a zero-terminated string
// print_str(byte* zeropage(4) str)
print_str: {
    .label str = 4
  //SEG45 [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
  //SEG46 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
  //SEG47 [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta str
    lda #>txt
    sta str+1
    jmp b1
  //SEG48 print_str::@1
  b1:
  //SEG49 [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1 
    ldy #0
    lda (str),y
    cmp #'@'
    bne b2
    jmp breturn
  //SEG50 print_str::@return
  breturn:
  //SEG51 [23] return 
    rts
  //SEG52 print_str::@2
  b2:
  //SEG53 [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy #0
    sta (print_char_cursor),y
  //SEG54 [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc print_char_cursor
    bne !+
    inc print_char_cursor+1
  !:
  //SEG55 [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc str
    bne !+
    inc str+1
  !:
  //SEG56 [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
  //SEG57 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
  //SEG58 [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
//SEG59 print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    .label sc = 2
  //SEG60 [28] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
  b1_from_print_cls:
  //SEG61 [28] phi (byte*) print_cls::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta sc
    lda #>$400
    sta sc+1
    jmp b1
  //SEG62 [28] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1]
  b1_from_b1:
  //SEG63 [28] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy 
    jmp b1
  //SEG64 print_cls::@1
  b1:
  //SEG65 [29] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (sc),y
  //SEG66 [30] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 
    inc sc
    bne !+
    inc sc+1
  !:
  //SEG67 [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 
    lda sc+1
    cmp #>$400+$3e8
    bne b1_from_b1
    lda sc
    cmp #<$400+$3e8
    bne b1_from_b1
    jmp breturn
  //SEG68 print_cls::@return
  breturn:
  //SEG69 [32] return 
    rts
}
  txt: .text "camelot@"

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b20
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b4
Removing instruction jmp b5
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction b20_from_bbegin:
Removing instruction b20:
Removing instruction main_from_b20:
Removing instruction bend_from_b20:
Removing instruction print_str_from_b1:
Removing instruction b4_from_b1:
Removing instruction print_ln_from_b4:
Removing instruction b1_from_print_ln:
Removing instruction b1_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction print_cls_from_main:
Removing instruction b1_from_main:
Removing instruction b4:
Removing instruction b5:
Removing instruction breturn:
Removing instruction b1_from_b6:
Removing instruction breturn:
Removing instruction b1_from_print_str:
Removing instruction breturn:
Removing instruction b1_from_b2:
Removing instruction b1_from_print_cls:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @20
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 11.0
(byte) main::i#2 reg byte x 4.4
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:6 101.0
(byte*) print_char_cursor#12 print_char_cursor zp ZP_WORD:6 40.6
(byte*) print_char_cursor#25 print_char_cursor zp ZP_WORD:6 6.5
(byte*~) print_char_cursor#30 print_char_cursor zp ZP_WORD:6 22.0
(void()) print_cls()
(label) print_cls::@1
(label) print_cls::@return
(byte*) print_cls::sc
(byte*) print_cls::sc#1 sc zp ZP_WORD:2 16.5
(byte*) print_cls::sc#2 sc zp ZP_WORD:2 16.5
(byte[]) print_hextab
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp ZP_WORD:2 40.625
(byte*) print_line_cursor#19 print_line_cursor zp ZP_WORD:2 3.25
(byte*) print_line_cursor#9 print_line_cursor zp ZP_WORD:2 204.0
(void()) print_ln()
(label) print_ln::@1
(label) print_ln::@return
(byte*) print_screen
(void()) print_str((byte*) print_str::str)
(label) print_str::@1
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0 str zp ZP_WORD:4 202.0
(byte*) print_str::str#2 str zp ZP_WORD:4 101.0
(byte[]) txt
(const byte[]) txt#0 txt = (string) "camelot@"

reg byte x [ main::i#2 main::i#1 ]
zp ZP_WORD:2 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 print_cls::sc#2 print_cls::sc#1 ]
zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ]
zp ZP_WORD:6 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 print_char_cursor#1 ]


FINAL ASSEMBLER
Score: 11122

//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label print_char_cursor = 6
  .label print_line_cursor = 2
//SEG3 @begin
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
//SEG5 @20
//SEG6 [2] call main 
//SEG7 [4] phi from @20 to main [phi:@20->main]
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
//SEG9 @end
//SEG10 main
main: {
  //SEG11 [5] call print_cls 
  //SEG12 [27] phi from main to print_cls [phi:main->print_cls]
    jsr print_cls
  //SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
  //SEG14 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG15 [6] phi (byte*) print_line_cursor#19 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta print_line_cursor
    lda #>$400
    sta print_line_cursor+1
  //SEG16 [6] phi (byte*) print_char_cursor#25 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta print_char_cursor
    lda #>$400
    sta print_char_cursor+1
  //SEG17 main::@1
  b1:
  //SEG18 [7] call print_str 
  //SEG19 [20] phi from main::@1 to print_str [phi:main::@1->print_str]
    jsr print_str
  //SEG20 [8] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
  //SEG21 main::@4
  //SEG22 [9] call print_ln 
  //SEG23 [15] phi from main::@4 to print_ln [phi:main::@4->print_ln]
    jsr print_ln
  //SEG24 main::@5
  //SEG25 [10] *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← ++ *((const byte[]) txt#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
  //SEG26 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG27 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@6 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b6
  //SEG28 main::@return
  //SEG29 [13] return 
    rts
  //SEG30 main::@6
  b6:
  //SEG31 [14] (byte*~) print_char_cursor#30 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda print_line_cursor
    sta print_char_cursor
    lda print_line_cursor+1
    sta print_char_cursor+1
  //SEG32 [6] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  //SEG33 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
  //SEG34 [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#1] -- register_copy 
  //SEG35 [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#30 [phi:main::@6->main::@1#2] -- register_copy 
    jmp b1
}
//SEG36 print_ln
// Print a newline
print_ln: {
  //SEG37 [16] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
  //SEG38 [16] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#19 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy 
  //SEG39 print_ln::@1
  b1:
  //SEG40 [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1 
    lda print_line_cursor
    clc
    adc #$28
    sta print_line_cursor
    bcc !+
    inc print_line_cursor+1
  !:
  //SEG41 [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda print_line_cursor+1
    cmp print_char_cursor+1
    bcc b1
    bne !+
    lda print_line_cursor
    cmp print_char_cursor
    bcc b1
  !:
  //SEG42 print_ln::@return
  //SEG43 [19] return 
    rts
}
//SEG44 print_str
// Print a zero-terminated string
// print_str(byte* zeropage(4) str)
print_str: {
    .label str = 4
  //SEG45 [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  //SEG46 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
  //SEG47 [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta str
    lda #>txt
    sta str+1
  //SEG48 print_str::@1
  b1:
  //SEG49 [22] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1 
    ldy #0
    lda (str),y
    cmp #'@'
    bne b2
  //SEG50 print_str::@return
  //SEG51 [23] return 
    rts
  //SEG52 print_str::@2
  b2:
  //SEG53 [24] *((byte*) print_char_cursor#12) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    sta (print_char_cursor),y
  //SEG54 [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc print_char_cursor
    bne !+
    inc print_char_cursor+1
  !:
  //SEG55 [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc str
    bne !+
    inc str+1
  !:
  //SEG56 [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  //SEG57 [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
  //SEG58 [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
//SEG59 print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    .label sc = 2
  //SEG60 [28] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
  //SEG61 [28] phi (byte*) print_cls::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta sc
    lda #>$400
    sta sc+1
  //SEG62 [28] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1]
  //SEG63 [28] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy 
  //SEG64 print_cls::@1
  b1:
  //SEG65 [29] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (sc),y
  //SEG66 [30] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 
    inc sc
    bne !+
    inc sc+1
  !:
  //SEG67 [31] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) 1024+(word/signed word/dword/signed dword) 1000) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 
    lda sc+1
    cmp #>$400+$3e8
    bne b1
    lda sc
    cmp #<$400+$3e8
    bne b1
  //SEG68 print_cls::@return
  //SEG69 [32] return 
    rts
}
  txt: .text "camelot@"

