Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str)
Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str)
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str)
Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch
Identified constant variable (byte*) HEAP_TOP
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) memset::@7
Culled Empty Block (label) memset::@6
Culled Empty Block (label) memset::@8
Culled Empty Block (label) memset::@9
Culled Empty Block (label) memset::@3
Culled Empty Block (label) @3
Culled Empty Block (label) @4
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @13
Culled Empty Block (label) @14
Culled Empty Block (label) print_str::@4
Culled Empty Block (label) print_str::@3
Culled Empty Block (label) print_str::@5
Culled Empty Block (label) print_str::@6
Culled Empty Block (label) @15
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
Culled Empty Block (label) @21
Culled Empty Block (label) @22
Culled Empty Block (label) @23
Culled Empty Block (label) @24
Culled Empty Block (label) @25
Culled Empty Block (label) @26
Culled Empty Block (label) @27
Culled Empty Block (label) @28
Culled Empty Block (label) @29
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) @32
Culled Empty Block (label) @33
Culled Empty Block (label) @34
Culled Empty Block (label) @35
Culled Empty Block (label) main::@2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@12
memset: scope:[memset]  from print_cls
  (byte) memset::c#4 ← phi( print_cls/(byte) memset::c#0 )
  (void*) memset::str#3 ← phi( print_cls/(void*) memset::str#0 )
  (word) memset::num#1 ← phi( print_cls/(word) memset::num#0 )
  (bool~) memset::$0 ← (word) memset::num#1 > (number) 0
  (bool~) memset::$1 ← ! (bool~) memset::$0
  if((bool~) memset::$1) goto memset::@1
  to:memset::@2
memset::@1: scope:[memset]  from memset memset::@4
  (void*) memset::str#1 ← phi( memset/(void*) memset::str#3 memset::@4/(void*) memset::str#4 )
  (void*) memset::return#0 ← (void*) memset::str#1
  to:memset::@return
memset::@2: scope:[memset]  from memset
  (byte) memset::c#3 ← phi( memset/(byte) memset::c#4 )
  (word) memset::num#2 ← phi( memset/(word) memset::num#1 )
  (void*) memset::str#2 ← phi( memset/(void*) memset::str#3 )
  (byte*~) memset::$2 ← ((byte*)) (void*) memset::str#2
  (byte*~) memset::$3 ← (byte*~) memset::$2 + (word) memset::num#2
  (byte*) memset::end#0 ← (byte*~) memset::$3
  (byte*) memset::dst#0 ← ((byte*)) (void*) memset::str#2
  to:memset::@4
memset::@4: scope:[memset]  from memset::@2 memset::@5
  (byte) memset::c#2 ← phi( memset::@2/(byte) memset::c#3 memset::@5/(byte) memset::c#1 )
  (void*) memset::str#4 ← phi( memset::@2/(void*) memset::str#2 memset::@5/(void*) memset::str#5 )
  (byte*) memset::end#1 ← phi( memset::@2/(byte*) memset::end#0 memset::@5/(byte*) memset::end#2 )
  (byte*) memset::dst#2 ← phi( memset::@2/(byte*) memset::dst#0 memset::@5/(byte*) memset::dst#1 )
  (bool~) memset::$4 ← (byte*) memset::dst#2 != (byte*) memset::end#1
  if((bool~) memset::$4) goto memset::@5
  to:memset::@1
memset::@5: scope:[memset]  from memset::@4
  (void*) memset::str#5 ← phi( memset::@4/(void*) memset::str#4 )
  (byte*) memset::end#2 ← phi( memset::@4/(byte*) memset::end#1 )
  (byte*) memset::dst#3 ← phi( memset::@4/(byte*) memset::dst#2 )
  (byte) memset::c#1 ← phi( memset::@4/(byte) memset::c#2 )
  *((byte*) memset::dst#3) ← (byte) memset::c#1
  (byte*) memset::dst#1 ← ++ (byte*) memset::dst#3
  to:memset::@4
memset::@return: scope:[memset]  from memset::@1
  (void*) memset::return#3 ← phi( memset::@1/(void*) memset::return#0 )
  (void*) memset::return#1 ← (void*) memset::return#3
  return 
  to:@return
@12: scope:[]  from @begin
  (byte*) print_screen#0 ← ((byte*)) (number) $400
  (byte*) print_line_cursor#0 ← (byte*) print_screen#0
  (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0
  to:@36
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 ← (number) 0 != *((byte*) print_str::str#2)
  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 + (number) $28
  (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
print_cls: scope:[print_cls]  from main
  (byte*) print_screen#1 ← phi( main/(byte*) print_screen#3 )
  (void*) memset::str#0 ← (void*)(byte*) print_screen#1
  (byte) memset::c#0 ← (byte) ' '
  (word) memset::num#0 ← (number) $3e8
  call memset 
  (void*) memset::return#2 ← (void*) memset::return#1
  to:print_cls::@1
print_cls::@1: scope:[print_cls]  from print_cls
  (byte*) print_screen#2 ← phi( print_cls/(byte*) print_screen#1 )
  (byte*) print_line_cursor#3 ← (byte*) print_screen#2
  (byte*) print_char_cursor#5 ← (byte*) print_line_cursor#3
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls::@1
  (byte*) print_char_cursor#16 ← phi( print_cls::@1/(byte*) print_char_cursor#5 )
  (byte*) print_line_cursor#12 ← phi( print_cls::@1/(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
@36: scope:[]  from @12
  (byte*) print_screen#5 ← phi( @12/(byte*) print_screen#0 )
  (byte*) print_char_cursor#28 ← phi( @12/(byte*) print_char_cursor#0 )
  (byte*) print_line_cursor#22 ← phi( @12/(byte*) print_line_cursor#0 )
  (byte[]) txt#0 ← (const string) $0
  to:@37
main: scope:[main]  from @37
  (byte*) print_char_cursor#24 ← phi( @37/(byte*) print_char_cursor#26 )
  (byte*) print_line_cursor#18 ← phi( @37/(byte*) print_line_cursor#20 )
  (byte*) print_screen#3 ← phi( @37/(byte*) print_screen#4 )
  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) 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 + (number) 1) ← ++ *((byte[]) txt#0 + (number) 1)
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,$a)
  (bool~) main::$3 ← (byte) main::i#1 != rangelast(0,$a)
  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
@37: scope:[]  from @36
  (byte*) print_screen#4 ← phi( @36/(byte*) print_screen#5 )
  (byte*) print_char_cursor#26 ← phi( @36/(byte*) print_char_cursor#28 )
  (byte*) print_line_cursor#20 ← phi( @36/(byte*) print_line_cursor#22 )
  call main 
  to:@38
@38: scope:[]  from @37
  (byte*) print_char_cursor#21 ← phi( @37/(byte*) print_char_cursor#10 )
  (byte*) print_line_cursor#16 ← phi( @37/(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 @38

SYMBOL TABLE SSA
(const string) $0 = (string) "camelot"
(label) @12
(label) @36
(label) @37
(label) @38
(label) @begin
(label) @end
(const byte) RADIX::BINARY = (number) 2
(const byte) RADIX::DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8
(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
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(bool~) memset::$0
(bool~) memset::$1
(byte*~) memset::$2
(byte*~) memset::$3
(bool~) memset::$4
(label) memset::@1
(label) memset::@2
(label) memset::@4
(label) memset::@5
(label) memset::@return
(byte) memset::c
(byte) memset::c#0
(byte) memset::c#1
(byte) memset::c#2
(byte) memset::c#3
(byte) memset::c#4
(byte*) memset::dst
(byte*) memset::dst#0
(byte*) memset::dst#1
(byte*) memset::dst#2
(byte*) memset::dst#3
(byte*) memset::end
(byte*) memset::end#0
(byte*) memset::end#1
(byte*) memset::end#2
(word) memset::num
(word) memset::num#0
(word) memset::num#1
(word) memset::num#2
(void*) memset::return
(void*) memset::return#0
(void*) memset::return#1
(void*) memset::return#2
(void*) memset::return#3
(void*) memset::str
(void*) memset::str#0
(void*) memset::str#1
(void*) memset::str#2
(void*) memset::str#3
(void*) memset::str#4
(void*) memset::str#5
(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#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()
(label) print_cls::@1
(label) print_cls::@return
(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#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
(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

Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#1 > (number) 0
Adding number conversion cast (unumber) 0 in (bool~) print_str::$0 ← (number) 0 != *((byte*) print_str::str#2)
Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#9 + (number) $28
Adding number conversion cast (unumber) $3e8 in (word) memset::num#0 ← (number) $3e8
Adding number conversion cast (unumber) 1 in *((byte[]) txt#0 + (number) 1) ← ++ *((byte[]) txt#0 + (number) 1)
Adding number conversion cast (unumber) 1 in *((byte[]) txt#0 + (number) 1) ← ++ *((byte[]) txt#0 + (unumber)(number) 1)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*~) memset::$2 ← (byte*)(void*) memset::str#2
Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#2
Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400
Inlining cast (word) memset::num#0 ← (unumber)(number) $3e8
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 0
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast $28
Simplifying constant integer cast $3e8
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Finalized unsigned number type (word) $3e8
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [2] (bool~) memset::$1 ← (word) memset::num#1 <= (byte) 0 from [1] (bool~) memset::$0 ← (word) memset::num#1 > (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (void*) memset::return#0 = (void*) memset::str#1 (void*) memset::return#3 (void*) memset::return#1 
Alias (void*) memset::str#2 = (void*) memset::str#3 
Alias (word) memset::num#1 = (word) memset::num#2 
Alias (byte) memset::c#3 = (byte) memset::c#4 
Alias (byte*) memset::end#0 = (byte*~) memset::$3 
Alias (byte) memset::c#1 = (byte) memset::c#2 
Alias (byte*) memset::dst#2 = (byte*) memset::dst#3 
Alias (byte*) memset::end#1 = (byte*) memset::end#2 
Alias (void*) memset::str#4 = (void*) memset::str#5 
Alias (byte*) print_line_cursor#0 = (byte*) print_screen#0 (byte*) print_char_cursor#0 (byte*) print_line_cursor#22 (byte*) print_char_cursor#28 (byte*) print_screen#5 (byte*) print_line_cursor#20 (byte*) print_char_cursor#26 (byte*) print_screen#4 
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#2 (byte*) print_screen#1 (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
Identical Phi Values (word) memset::num#1 (word) memset::num#0
Identical Phi Values (void*) memset::str#2 (void*) memset::str#0
Identical Phi Values (byte) memset::c#3 (byte) memset::c#0
Identical Phi Values (byte*) memset::end#1 (byte*) memset::end#0
Identical Phi Values (void*) memset::str#4 (void*) memset::str#2
Identical Phi Values (byte) memset::c#1 (byte) memset::c#3
Identical Phi Values (byte*) print_str::str#4 (byte*) print_str::str#1
Identical Phi Values (byte*) print_char_cursor#27 (byte*) print_char_cursor#25
Identical Phi Values (byte*) print_line_cursor#17 (byte*) print_line_cursor#19
Identical Phi Values (byte*) print_char_cursor#23 (byte*) print_char_cursor#18
Identical Phi Values (byte*) print_char_cursor#14 (byte*) print_char_cursor#23
Identical Phi Values (byte*) print_line_cursor#12 (byte*) print_screen#3
Identical Phi Values (byte*) print_screen#3 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_line_cursor#18 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_char_cursor#24 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_line_cursor#13 (byte*) print_line_cursor#12
Identical Phi Values (byte*) print_char_cursor#17 (byte*) print_line_cursor#12
Identical Phi Values (byte*) print_char_cursor#18 (byte*) print_char_cursor#12
Identical Phi Values (byte*) print_line_cursor#14 (byte*) print_line_cursor#1
Identical Phi Values (byte*) print_char_cursor#10 (byte*) print_line_cursor#1
Identical Phi Values (byte*) print_line_cursor#16 (byte*) print_line_cursor#14
Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#10
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (void*) memset::return#0 (void*) memset::str#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) memset::$1 [3] if((word) memset::num#0<=(byte) 0) goto memset::@1
Simple Condition (bool~) memset::$4 [13] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@5
Simple Condition (bool~) print_str::$0 [26] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2
Simple Condition (bool~) print_ln::$1 [39] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1
Simple Condition (bool~) main::$3 [79] if((byte) main::i#1!=rangelast(0,$a)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) print_line_cursor#0 = (byte*) 1024
Constant (const byte) memset::c#0 = ' '
Constant (const word) memset::num#0 = $3e8
Constant (const byte[]) txt#0 = $0
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) print_str::str#1 = txt#0
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (void*)print_line_cursor#0 in [47] (void*) memset::str#0 ← (void*)(const byte*) print_line_cursor#0
Successful SSA optimization Pass2ConstantValues
if() condition always false - eliminating [3] if((const word) memset::num#0<=(byte) 0) goto memset::@1
Successful SSA optimization Pass2ConstantIfs
Resolved ranged next value [77] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [79] if(main::i#1!=rangelast(0,$a)) goto main::@1 to (number) $b
Eliminating unused variable (void*) memset::return#2 and assignment [20] (void*) memset::return#2 ← (void*) memset::str#0
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) $b in if((byte) main::i#1!=(number) $b) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant (const void*) memset::str#0 = (void*)print_line_cursor#0
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (byte*)memset::str#0 in [0] (byte*~) memset::$2 ← (byte*)(const void*) memset::str#0
Constant value identified (byte*)memset::str#0 in [2] (byte*) memset::dst#0 ← (byte*)(const void*) memset::str#0
Successful SSA optimization Pass2ConstantValues
Constant (const byte*) memset::$2 = (byte*)memset::str#0
Constant (const byte*) memset::dst#0 = (byte*)memset::str#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [0] (byte*) memset::end#0 ← (const byte*) memset::$2 + (const word) memset::num#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) memset::end#0 = memset::$2+memset::num#0
Successful SSA optimization Pass2ConstantIdentification
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte*) memset::dst#1 = (byte*) memset::dst#2 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) memset::dst#5 (const byte*) memset::dst#0
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always true - replacing block destination [29] if((const byte*) memset::dst#0!=(const byte*) memset::end#0) goto memset::@5
Successful SSA optimization Pass2ConstantIfs
Inlining constant with var siblings (const byte*) memset::dst#0
Inlining constant with var siblings (const byte*) print_str::str#1
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) 0
Constant inlined memset::$2 = (byte*)(const void*) memset::str#0
Constant inlined memset::dst#0 = (byte*)(const void*) memset::str#0
Constant inlined print_str::str#1 = (const byte[]) txt#0
Constant inlined $0 = (const byte[]) txt#0
Constant inlined print_line_cursor#0 = (byte*) 1024
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(txt#0+1)
Consolidated array index constant in *(txt#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Added new block during phi lifting memset::@10(between memset::@4 and memset::@5)
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
Added new block during phi lifting main::@6(between main::@5 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @12
Adding NOP phi() at start of @36
Adding NOP phi() at start of @37
Adding NOP phi() at start of @38
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of print_ln::@2
Adding NOP phi() at start of print_cls
Adding NOP phi() at start of print_cls::@1
Adding NOP phi() at start of memset
Adding NOP phi() at start of memset::@2
Adding NOP phi() at start of memset::@4_1
Adding NOP phi() at start of memset::@1
CALL GRAPH
Calls in [] to main:4 
Calls in [main] to print_cls:8 print_str:11 print_ln:13 
Calls in [print_cls] to memset:38 

Created 7 initial phi equivalence classes
Not coalescing [18] print_char_cursor#31 ← print_line_cursor#1
Coalesced [19] print_line_cursor#25 ← print_line_cursor#1
Coalesced [20] main::i#5 ← main::i#1
Coalesced [21] print_line_cursor#23 ← print_line_cursor#19
Coalesced (already) [27] print_line_cursor#24 ← print_line_cursor#1
Coalesced [28] print_char_cursor#29 ← print_char_cursor#25
Coalesced [35] print_str::str#5 ← print_str::str#0
Coalesced [36] print_char_cursor#30 ← print_char_cursor#1
Coalesced [50] memset::dst#6 ← memset::dst#1
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) @12
Culled Empty Block (label) @36
Culled Empty Block (label) @38
Culled Empty Block (label) main::@3
Culled Empty Block (label) print_ln::@2
Culled Empty Block (label) print_ln::@3
Culled Empty Block (label) print_cls::@1
Culled Empty Block (label) memset::@2
Culled Empty Block (label) memset::@4_1
Culled Empty Block (label) memset::@1
Culled Empty Block (label) memset::@10
Renumbering block @37 to @1
Renumbering block memset::@4 to memset::@1
Renumbering block memset::@5 to memset::@2
Renumbering block main::@4 to main::@2
Renumbering block main::@5 to main::@3
Renumbering block main::@6 to main::@4
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of print_ln
Adding NOP phi() at start of print_str
Adding NOP phi() at start of print_cls
Adding NOP phi() at start of memset

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()
main: scope:[main]  from @1
  [4] phi()
  [5] call print_cls 
  to:main::@1
main::@1: scope:[main]  from main main::@4
  [6] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 )
  [6] (byte*) print_line_cursor#19 ← phi( main/(byte*) 1024 main::@4/(byte*) print_line_cursor#1 )
  [6] (byte*) print_char_cursor#25 ← phi( main/(byte*) 1024 main::@4/(byte*~) print_char_cursor#31 )
  [7] call print_str 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [8] phi()
  [9] call print_ln 
  to:main::@3
main::@3: scope:[main]  from main::@2
  [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 1)
  [11] (byte) main::i#1 ← ++ (byte) main::i#2
  [12] if((byte) main::i#1!=(byte) $b) goto main::@4
  to:main::@return
main::@return: scope:[main]  from main::@3
  [13] return 
  to:@return
main::@4: scope:[main]  from main::@3
  [14] (byte*~) print_char_cursor#31 ← (byte*) print_line_cursor#1
  to:main::@1
print_ln: scope:[print_ln]  from main::@2
  [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) $28
  [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) 0!=*((byte*) print_str::str#2)) 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()
  [28] call memset 
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls
  [29] return 
  to:@return
memset: scope:[memset]  from print_cls
  [30] phi()
  to:memset::@2
memset::@2: scope:[memset]  from memset memset::@1
  [31] (byte*) memset::dst#4 ← phi( memset::@1/(byte*) memset::dst#1 memset/(byte*)(const void*) memset::str#0 )
  [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0
  [33] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4
  to:memset::@1
memset::@1: scope:[memset]  from memset::@2
  [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2
  to:memset::@return
memset::@return: scope:[memset]  from memset::@1
  [35] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 11.0
(byte) main::i#2 4.4
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(byte) memset::c
(byte*) memset::dst
(byte*) memset::dst#1 16.5
(byte*) memset::dst#4 16.5
(byte*) memset::end
(word) memset::num
(void*) memset::return
(void*) memset::str
(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#31 22.0
(void()) print_cls()
(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#31 print_char_cursor#1 ]
[ memset::dst#4 memset::dst#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#31 print_char_cursor#1 ]
[ memset::dst#4 memset::dst#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#31 print_char_cursor#1 ]
Allocated zp ZP_WORD:9 [ memset::dst#4 memset::dst#1 ]

INITIAL ASM
Target platform is c64basic
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 7
  .label print_line_cursor = 3
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label i = 2
    // [5] call print_cls 
    // [27] phi from main to print_cls [phi:main->print_cls]
  print_cls_from_main:
    jsr print_cls
    // [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    // [6] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [6] phi (byte*) print_char_cursor#25 = (byte*) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    jmp b1
    // main::@1
  b1:
    // [7] call print_str 
    // [20] phi from main::@1 to print_str [phi:main::@1->print_str]
  print_str_from_b1:
    jsr print_str
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
    // main::@2
  b2:
    // [9] call print_ln 
    // [15] phi from main::@2 to print_ln [phi:main::@2->print_ln]
  print_ln_from_b2:
    jsr print_ln
    jmp b3
    // main::@3
  b3:
    // [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [12] if((byte) main::i#1!=(byte) $b) goto main::@4 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z i
    bne b4
    jmp breturn
    // main::@return
  breturn:
    // [13] return 
    rts
    // main::@4
  b4:
    // [14] (byte*~) print_char_cursor#31 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda.z print_line_cursor
    sta.z print_char_cursor
    lda.z print_line_cursor+1
    sta.z print_char_cursor+1
    // [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  b1_from_b4:
    // [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@4->main::@1#1] -- register_copy 
    // [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#31 [phi:main::@4->main::@1#2] -- register_copy 
    jmp b1
}
  // print_ln
// Print a newline
print_ln: {
    // [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:
    // [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
    // print_ln::@1
  b1:
    // [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z print_line_cursor
    sta.z print_line_cursor
    bcc !+
    inc.z print_line_cursor+1
  !:
    // [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda.z print_line_cursor+1
    cmp.z print_char_cursor+1
    bcc b1_from_b1
    bne !+
    lda.z print_line_cursor
    cmp.z print_char_cursor
    bcc b1_from_b1
  !:
    jmp breturn
    // print_ln::@return
  breturn:
    // [19] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(5) str)
print_str: {
    .label str = 5
    // [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta.z str
    lda #>txt
    sta.z str+1
    jmp b1
    // print_str::@1
  b1:
    // [22] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    jmp breturn
    // print_str::@return
  breturn:
    // [23] return 
    rts
    // print_str::@2
  b2:
    // [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
    // [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // [28] call memset 
    // [30] phi from print_cls to memset [phi:print_cls->memset]
  memset_from_print_cls:
    jsr memset
    jmp breturn
    // print_cls::@return
  breturn:
    // [29] return 
    rts
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
memset: {
    .const c = ' '
    .const num = $3e8
    .label str = $400
    .label end = str+num
    .label dst = 9
    // [31] phi from memset to memset::@2 [phi:memset->memset::@2]
  b2_from_memset:
    // [31] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    jmp b2
    // [31] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
  b2_from_b1:
    // [31] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy 
    jmp b2
    // memset::@2
  b2:
    // [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // [33] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp b1
    // memset::@1
  b1:
    // [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1 
    lda.z dst+1
    cmp #>end
    bne b2_from_b1
    lda.z dst
    cmp #<end
    bne b2_from_b1
    jmp breturn
    // memset::@return
  breturn:
    // [35] return 
    rts
}
  // File Data
  txt: .text "camelot"
  .byte 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 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#31 ← (byte*) print_line_cursor#1 [ print_char_cursor#31 print_line_cursor#1 main::i#1 ] ( main:2 [ print_char_cursor#31 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) $28 [ 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) 0!=*((byte*) print_str::str#2)) 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 [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0 [ memset::dst#4 ] ( main:2::print_cls:5::memset:28 [ memset::dst#4 ] ) always clobbers reg byte a reg byte y 
Statement [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#1 ] ( main:2::print_cls:5::memset:28 [ memset::dst#1 ] ) always clobbers reg byte a 
Statement [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 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#31 ← (byte*) print_line_cursor#1 [ print_char_cursor#31 print_line_cursor#1 main::i#1 ] ( main:2 [ print_char_cursor#31 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) $28 [ 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) 0!=*((byte*) print_str::str#2)) 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 [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0 [ memset::dst#4 ] ( main:2::print_cls:5::memset:28 [ memset::dst#4 ] ) always clobbers reg byte a reg byte y 
Statement [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#1 ] ( main:2::print_cls:5::memset:28 [ memset::dst#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#31 print_char_cursor#1 ] : zp ZP_WORD:7 , 
Potential registers zp ZP_WORD:9 [ memset::dst#4 memset::dst#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#31 print_char_cursor#1 ] 
Uplift Scope [print_str] 303: zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ] 
Uplift Scope [memset] 33: zp ZP_WORD:9 [ memset::dst#4 memset::dst#1 ] 
Uplift Scope [main] 15.4: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 
Uplift Scope [RADIX] 
Uplift Scope [print_ln] 
Uplift Scope [print_cls] 

Uplifting [] best 12852 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#31 print_char_cursor#1 ] 
Uplifting [print_str] best 12852 combination zp ZP_WORD:5 [ print_str::str#2 print_str::str#0 ] 
Uplifting [memset] best 12852 combination zp ZP_WORD:9 [ memset::dst#4 memset::dst#1 ] 
Uplifting [main] best 12762 combination reg byte x [ main::i#2 main::i#1 ] 
Uplifting [RADIX] best 12762 combination 
Uplifting [print_ln] best 12762 combination 
Uplifting [print_cls] best 12762 combination 
Coalescing zero page register [ zp ZP_WORD:9 [ memset::dst#4 memset::dst#1 ] ] with [ zp ZP_WORD:3 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] ]
Allocated (was zp ZP_WORD:5) zp ZP_WORD:2 [ print_str::str#2 print_str::str#0 ]
Allocated (was zp ZP_WORD:7) zp ZP_WORD:4 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#31 print_char_cursor#1 ]
Allocated (was zp ZP_WORD:9) zp ZP_WORD:6 [ memset::dst#4 memset::dst#1 print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 4
  .label print_line_cursor = 6
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    // [5] call print_cls 
    // [27] phi from main to print_cls [phi:main->print_cls]
  print_cls_from_main:
    jsr print_cls
    // [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [6] phi (byte*) print_char_cursor#25 = (byte*) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    jmp b1
    // main::@1
  b1:
    // [7] call print_str 
    // [20] phi from main::@1 to print_str [phi:main::@1->print_str]
  print_str_from_b1:
    jsr print_str
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
    // main::@2
  b2:
    // [9] call print_ln 
    // [15] phi from main::@2 to print_ln [phi:main::@2->print_ln]
  print_ln_from_b2:
    jsr print_ln
    jmp b3
    // main::@3
  b3:
    // [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] if((byte) main::i#1!=(byte) $b) goto main::@4 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b4
    jmp breturn
    // main::@return
  breturn:
    // [13] return 
    rts
    // main::@4
  b4:
    // [14] (byte*~) print_char_cursor#31 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda.z print_line_cursor
    sta.z print_char_cursor
    lda.z print_line_cursor+1
    sta.z print_char_cursor+1
    // [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  b1_from_b4:
    // [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@4->main::@1#1] -- register_copy 
    // [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#31 [phi:main::@4->main::@1#2] -- register_copy 
    jmp b1
}
  // print_ln
// Print a newline
print_ln: {
    // [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:
    // [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
    // print_ln::@1
  b1:
    // [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z print_line_cursor
    sta.z print_line_cursor
    bcc !+
    inc.z print_line_cursor+1
  !:
    // [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda.z print_line_cursor+1
    cmp.z print_char_cursor+1
    bcc b1_from_b1
    bne !+
    lda.z print_line_cursor
    cmp.z print_char_cursor
    bcc b1_from_b1
  !:
    jmp breturn
    // print_ln::@return
  breturn:
    // [19] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(2) str)
print_str: {
    .label str = 2
    // [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta.z str
    lda #>txt
    sta.z str+1
    jmp b1
    // print_str::@1
  b1:
    // [22] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    jmp breturn
    // print_str::@return
  breturn:
    // [23] return 
    rts
    // print_str::@2
  b2:
    // [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
    // [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // [28] call memset 
    // [30] phi from print_cls to memset [phi:print_cls->memset]
  memset_from_print_cls:
    jsr memset
    jmp breturn
    // print_cls::@return
  breturn:
    // [29] return 
    rts
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
memset: {
    .const c = ' '
    .const num = $3e8
    .label str = $400
    .label end = str+num
    .label dst = 6
    // [31] phi from memset to memset::@2 [phi:memset->memset::@2]
  b2_from_memset:
    // [31] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    jmp b2
    // [31] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
  b2_from_b1:
    // [31] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy 
    jmp b2
    // memset::@2
  b2:
    // [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // [33] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp b1
    // memset::@1
  b1:
    // [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1 
    lda.z dst+1
    cmp #>end
    bne b2_from_b1
    lda.z dst
    cmp #<end
    bne b2_from_b1
    jmp breturn
    // memset::@return
  breturn:
    // [35] return 
    rts
}
  // File Data
  txt: .text "camelot"
  .byte 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Removing instruction jmp b2
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 b2_from_b1 with b2
Replacing label b2_from_b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction print_str_from_b1:
Removing instruction b2_from_b1:
Removing instruction print_ln_from_b2:
Removing instruction b1_from_print_ln:
Removing instruction b1_from_b1:
Removing instruction b2_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction print_cls_from_main:
Removing instruction b1_from_main:
Removing instruction b2:
Removing instruction b3:
Removing instruction breturn:
Removing instruction b1_from_b4:
Removing instruction breturn:
Removing instruction b1_from_print_str:
Removing instruction breturn:
Removing instruction b1_from_b2:
Removing instruction memset_from_print_cls:
Removing instruction breturn:
Removing instruction b2_from_memset:
Removing instruction b1:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) RADIX::BINARY BINARY = (number) 2
(const byte) RADIX::DECIMAL DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL OCTAL = (number) 8
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 11.0
(byte) main::i#2 reg byte x 4.4
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@2
(label) memset::@return
(byte) memset::c
(const byte) memset::c#0 c = (byte) ' '
(byte*) memset::dst
(byte*) memset::dst#1 dst zp ZP_WORD:6 16.5
(byte*) memset::dst#4 dst zp ZP_WORD:6 16.5
(byte*) memset::end
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) memset::num#0
(word) memset::num
(const word) memset::num#0 num = (word) $3e8
(void*) memset::return
(void*) memset::str
(const void*) memset::str#0 str = (void*)(byte*) 1024
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:4 101.0
(byte*) print_char_cursor#12 print_char_cursor zp ZP_WORD:4 40.6
(byte*) print_char_cursor#25 print_char_cursor zp ZP_WORD:4 6.5
(byte*~) print_char_cursor#31 print_char_cursor zp ZP_WORD:4 22.0
(void()) print_cls()
(label) print_cls::@return
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp ZP_WORD:6 40.625
(byte*) print_line_cursor#19 print_line_cursor zp ZP_WORD:6 3.25
(byte*) print_line_cursor#9 print_line_cursor zp ZP_WORD:6 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:2 202.0
(byte*) print_str::str#2 str zp ZP_WORD:2 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_str::str#2 print_str::str#0 ]
zp ZP_WORD:4 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#31 print_char_cursor#1 ]
zp ZP_WORD:6 [ memset::dst#4 memset::dst#1 print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]


FINAL ASSEMBLER
Score: 11134

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 4
  .label print_line_cursor = 6
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    // print_cls()
    // [5] call print_cls 
    // [27] phi from main to print_cls [phi:main->print_cls]
    jsr print_cls
    // [6] phi from main to main::@1 [phi:main->main::@1]
    // [6] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [6] phi (byte*) print_char_cursor#25 = (byte*) 1024 [phi:main->main::@1#2] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // main::@1
  b1:
    // print_str(txt)
    // [7] call print_str 
    // [20] phi from main::@1 to print_str [phi:main::@1->print_str]
    jsr print_str
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // main::@2
    // print_ln()
    // [9] call print_ln 
    // [15] phi from main::@2 to print_ln [phi:main::@2->print_ln]
    jsr print_ln
    // main::@3
    // txt[1]++;
    // [10] *((const byte[]) txt#0+(byte) 1) ← ++ *((const byte[]) txt#0+(byte) 1) -- _deref_pbuc1=_inc__deref_pbuc2 
    lda txt+1
    clc
    adc #1
    sta txt+1
    // for ( byte i: 0..10)
    // [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] if((byte) main::i#1!=(byte) $b) goto main::@4 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$b
    bne b4
    // main::@return
    // }
    // [13] return 
    rts
    // main::@4
  b4:
    // [14] (byte*~) print_char_cursor#31 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 
    lda.z print_line_cursor
    sta.z print_char_cursor
    lda.z print_line_cursor+1
    sta.z print_char_cursor+1
    // [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@4->main::@1#1] -- register_copy 
    // [6] phi (byte*) print_char_cursor#25 = (byte*~) print_char_cursor#31 [phi:main::@4->main::@1#2] -- register_copy 
    jmp b1
}
  // print_ln
// Print a newline
print_ln: {
    // [16] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
    // [16] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#19 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy 
    // print_ln::@1
  b1:
    // print_line_cursor + $28
    // [17] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z print_line_cursor
    sta.z print_line_cursor
    bcc !+
    inc.z print_line_cursor+1
  !:
    // while (print_line_cursor<print_char_cursor)
    // [18] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#12) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 
    lda.z print_line_cursor+1
    cmp.z print_char_cursor+1
    bcc b1
    bne !+
    lda.z print_line_cursor
    cmp.z print_char_cursor
    bcc b1
  !:
    // print_ln::@return
    // }
    // [19] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(2) str)
print_str: {
    .label str = 2
    // [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#25 [phi:print_str->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (const byte[]) txt#0 [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<txt
    sta.z str
    lda #>txt
    sta.z str+1
    // print_str::@1
  b1:
    // while(*str)
    // [22] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    // print_str::@return
    // }
    // [23] return 
    rts
    // print_str::@2
  b2:
    // *(print_char_cursor++) = *(str++)
    // [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
    // *(print_char_cursor++) = *(str++);
    // [25] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#12 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [26] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [21] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
    // [21] phi (byte*) print_char_cursor#12 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [21] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // memset(print_screen, ' ', 1000)
    // [28] call memset 
    // [30] phi from print_cls to memset [phi:print_cls->memset]
    jsr memset
    // print_cls::@return
    // }
    // [29] return 
    rts
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
memset: {
    .const c = ' '
    .const num = $3e8
    .label str = $400
    .label end = str+num
    .label dst = 6
    // [31] phi from memset to memset::@2 [phi:memset->memset::@2]
    // [31] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    // [31] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
    // [31] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy 
    // memset::@2
  b2:
    // *dst = c
    // [32] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [33] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // memset::@1
    // [34] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1 
    lda.z dst+1
    cmp #>end
    bne b2
    lda.z dst
    cmp #<end
    bne b2
    // memset::@return
    // }
    // [35] return 
    rts
}
  // File Data
  txt: .text "camelot"
  .byte 0

