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)
Fixing pointer array-indexing *((const signed word*) words + (byte) main::j)
Fixing pointer array-indexing *((const signed word*) words + (byte) sub::idx)
Fixing pointer array-indexing *((const signed word*) words + (byte) sub::idx)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Warning! Adding boolean cast to non-boolean condition *((byte*) strlen::str)
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) @12
Culled Empty Block (label) @14
Culled Empty Block (label) @15
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) @18
Culled Empty Block (label) print_sword::@4
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) @36
Culled Empty Block (label) @37
Culled Empty Block (label) main::@4
Culled Empty Block (label) @38

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@13

(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
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
@13: 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:@39

(void()) print_ln()
print_ln: scope:[print_ln]  from main::@9
  (byte*) print_char_cursor#42 ← phi( main::@9/(byte*) print_char_cursor#18 )
  (byte*) print_line_cursor#17 ← phi( main::@9/(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#22 ← phi( print_ln/(byte*) print_char_cursor#42 print_ln::@1/(byte*) print_char_cursor#22 )
  (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#22
  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#1 ← (byte*) print_line_cursor#10
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@2
  (byte*) print_char_cursor#23 ← phi( print_ln::@2/(byte*) print_char_cursor#1 )
  (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#2 ← (byte*) print_char_cursor#23
  return 
  to:@return

(void()) print_sword((signed word) print_sword::w)
print_sword: scope:[print_sword]  from main::@3
  (byte*) print_char_cursor#51 ← phi( main::@3/(byte*) print_char_cursor#49 )
  (signed word) print_sword::w#2 ← phi( main::@3/(signed word) print_sword::w#1 )
  (bool~) print_sword::$0 ← (signed word) print_sword::w#2 < (number) 0
  if((bool~) print_sword::$0) goto print_sword::@1
  to:print_sword::@3
print_sword::@1: scope:[print_sword]  from print_sword
  (signed word) print_sword::w#5 ← phi( print_sword/(signed word) print_sword::w#2 )
  (byte*) print_char_cursor#43 ← phi( print_sword/(byte*) print_char_cursor#51 )
  (byte) print_char::ch#0 ← (byte) '-'
  call print_char 
  to:print_sword::@5
print_sword::@5: scope:[print_sword]  from print_sword::@1
  (signed word) print_sword::w#3 ← phi( print_sword::@1/(signed word) print_sword::w#5 )
  (byte*) print_char_cursor#24 ← phi( print_sword::@1/(byte*) print_char_cursor#14 )
  (byte*) print_char_cursor#3 ← (byte*) print_char_cursor#24
  (signed word~) print_sword::$5 ← - (signed word) print_sword::w#3
  (signed word) print_sword::w#0 ← (signed word~) print_sword::$5
  to:print_sword::@2
print_sword::@3: scope:[print_sword]  from print_sword
  (signed word) print_sword::w#7 ← phi( print_sword/(signed word) print_sword::w#2 )
  (byte*) print_char_cursor#44 ← phi( print_sword/(byte*) print_char_cursor#51 )
  (byte) print_char::ch#1 ← (byte) ' '
  call print_char 
  to:print_sword::@6
print_sword::@6: scope:[print_sword]  from print_sword::@3
  (signed word) print_sword::w#6 ← phi( print_sword::@3/(signed word) print_sword::w#7 )
  (byte*) print_char_cursor#25 ← phi( print_sword::@3/(byte*) print_char_cursor#14 )
  (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#25
  to:print_sword::@2
print_sword::@2: scope:[print_sword]  from print_sword::@5 print_sword::@6
  (byte*) print_char_cursor#45 ← phi( print_sword::@5/(byte*) print_char_cursor#3 print_sword::@6/(byte*) print_char_cursor#4 )
  (signed word) print_sword::w#4 ← phi( print_sword::@5/(signed word) print_sword::w#0 print_sword::@6/(signed word) print_sword::w#6 )
  (word~) print_sword::$1 ← ((word)) (signed word) print_sword::w#4
  (word) print_word::w#0 ← (word~) print_sword::$1
  call print_word 
  to:print_sword::@7
print_sword::@7: scope:[print_sword]  from print_sword::@2
  (byte*) print_char_cursor#26 ← phi( print_sword::@2/(byte*) print_char_cursor#9 )
  (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#26
  to:print_sword::@return
print_sword::@return: scope:[print_sword]  from print_sword::@7
  (byte*) print_char_cursor#27 ← phi( print_sword::@7/(byte*) print_char_cursor#5 )
  (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#27
  return 
  to:@return

(void()) print_word((word) print_word::w)
print_word: scope:[print_word]  from print_sword::@2
  (byte*) print_char_cursor#46 ← phi( print_sword::@2/(byte*) print_char_cursor#45 )
  (word) print_word::w#1 ← phi( print_sword::@2/(word) print_word::w#0 )
  (byte~) print_word::$0 ← > (word) print_word::w#1
  (byte) print_byte::b#0 ← (byte~) print_word::$0
  call print_byte 
  to:print_word::@1
print_word::@1: scope:[print_word]  from print_word
  (word) print_word::w#2 ← phi( print_word/(word) print_word::w#1 )
  (byte*) print_char_cursor#28 ← phi( print_word/(byte*) print_char_cursor#12 )
  (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#28
  (byte~) print_word::$2 ← < (word) print_word::w#2
  (byte) print_byte::b#1 ← (byte~) print_word::$2
  call print_byte 
  to:print_word::@2
print_word::@2: scope:[print_word]  from print_word::@1
  (byte*) print_char_cursor#29 ← phi( print_word::@1/(byte*) print_char_cursor#12 )
  (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#29
  to:print_word::@return
print_word::@return: scope:[print_word]  from print_word::@2
  (byte*) print_char_cursor#30 ← phi( print_word::@2/(byte*) print_char_cursor#8 )
  (byte*) print_char_cursor#9 ← (byte*) print_char_cursor#30
  return 
  to:@return

(void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte]  from print_word print_word::@1
  (byte*) print_char_cursor#47 ← phi( print_word/(byte*) print_char_cursor#46 print_word::@1/(byte*) print_char_cursor#7 )
  (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
  (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4
  (byte) print_char::ch#2 ← *((const byte*) print_hextab + (byte~) print_byte::$0)
  call print_char 
  to:print_byte::@1
print_byte::@1: scope:[print_byte]  from print_byte
  (byte) print_byte::b#3 ← phi( print_byte/(byte) print_byte::b#2 )
  (byte*) print_char_cursor#31 ← phi( print_byte/(byte*) print_char_cursor#14 )
  (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#31
  (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f
  (byte) print_char::ch#3 ← *((const byte*) print_hextab + (number~) print_byte::$2)
  call print_char 
  to:print_byte::@2
print_byte::@2: scope:[print_byte]  from print_byte::@1
  (byte*) print_char_cursor#32 ← phi( print_byte::@1/(byte*) print_char_cursor#14 )
  (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#32
  to:print_byte::@return
print_byte::@return: scope:[print_byte]  from print_byte::@2
  (byte*) print_char_cursor#33 ← phi( print_byte::@2/(byte*) print_char_cursor#11 )
  (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#33
  return 
  to:@return

(void()) print_char((byte) print_char::ch)
print_char: scope:[print_char]  from print_byte print_byte::@1 print_sword::@1 print_sword::@3
  (byte*) print_char_cursor#34 ← phi( print_byte/(byte*) print_char_cursor#47 print_byte::@1/(byte*) print_char_cursor#10 print_sword::@1/(byte*) print_char_cursor#43 print_sword::@3/(byte*) print_char_cursor#44 )
  (byte) print_char::ch#4 ← phi( print_byte/(byte) print_char::ch#2 print_byte::@1/(byte) print_char::ch#3 print_sword::@1/(byte) print_char::ch#0 print_sword::@3/(byte) print_char::ch#1 )
  *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4
  (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#34
  to:print_char::@return
print_char::@return: scope:[print_char]  from print_char
  (byte*) print_char_cursor#35 ← phi( print_char/(byte*) print_char_cursor#13 )
  (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#35
  return 
  to:@return

(void()) print_cls()
print_cls: scope:[print_cls]  from main::@2
  (byte*) print_screen#1 ← phi( main::@2/(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#15 ← (byte*) print_line_cursor#3
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls::@1
  (byte*) print_char_cursor#36 ← phi( print_cls::@1/(byte*) print_char_cursor#15 )
  (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#16 ← (byte*) print_char_cursor#36
  return 
  to:@return

(void()) main()
main: scope:[main]  from @39
  (byte*) print_char_cursor#56 ← phi( @39/(byte*) print_char_cursor#50 )
  (byte*) print_line_cursor#26 ← phi( @39/(byte*) print_line_cursor#20 )
  (byte*) print_screen#8 ← phi( @39/(byte*) print_screen#9 )
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@7
  (byte*) print_char_cursor#55 ← phi( main/(byte*) print_char_cursor#56 main::@7/(byte*) print_char_cursor#52 )
  (byte*) print_line_cursor#25 ← phi( main/(byte*) print_line_cursor#26 main::@7/(byte*) print_line_cursor#21 )
  (byte*) print_screen#7 ← phi( main/(byte*) print_screen#8 main::@7/(byte*) print_screen#4 )
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@7/(byte) main::i#1 )
  (byte) sub::idx#0 ← (byte) main::i#2
  (byte) sub::s#0 ← (number) $80
  call sub 
  to:main::@5
main::@5: scope:[main]  from main::@1
  (byte*) print_char_cursor#54 ← phi( main::@1/(byte*) print_char_cursor#55 )
  (byte*) print_line_cursor#24 ← phi( main::@1/(byte*) print_line_cursor#25 )
  (byte*) print_screen#6 ← phi( main::@1/(byte*) print_screen#7 )
  (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
  (byte) sub::idx#1 ← (byte) main::i#3
  (byte) sub::s#1 ← (number) $40
  call sub 
  to:main::@6
main::@6: scope:[main]  from main::@5
  (byte*) print_char_cursor#53 ← phi( main::@5/(byte*) print_char_cursor#54 )
  (byte*) print_line_cursor#23 ← phi( main::@5/(byte*) print_line_cursor#24 )
  (byte*) print_screen#5 ← phi( main::@5/(byte*) print_screen#6 )
  (byte) main::i#4 ← phi( main::@5/(byte) main::i#3 )
  (byte) sub::idx#2 ← (byte) main::i#4
  (byte) sub::s#2 ← (number) $40
  call sub 
  to:main::@7
main::@7: scope:[main]  from main::@6
  (byte*) print_char_cursor#52 ← phi( main::@6/(byte*) print_char_cursor#53 )
  (byte*) print_line_cursor#21 ← phi( main::@6/(byte*) print_line_cursor#23 )
  (byte*) print_screen#4 ← phi( main::@6/(byte*) print_screen#5 )
  (byte) main::i#5 ← phi( main::@6/(byte) main::i#4 )
  (byte) main::i#1 ← (byte) main::i#5 + rangenext(0,8)
  (bool~) main::$4 ← (byte) main::i#1 != rangelast(0,8)
  if((bool~) main::$4) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@7
  (byte*) print_char_cursor#48 ← phi( main::@7/(byte*) print_char_cursor#52 )
  (byte*) print_line_cursor#18 ← phi( main::@7/(byte*) print_line_cursor#21 )
  (byte*) print_screen#3 ← phi( main::@7/(byte*) print_screen#4 )
  call print_cls 
  to:main::@8
main::@8: scope:[main]  from main::@2
  (byte*) print_char_cursor#37 ← phi( main::@2/(byte*) print_char_cursor#16 )
  (byte*) print_line_cursor#13 ← phi( main::@2/(byte*) print_line_cursor#4 )
  (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#13
  (byte*) print_char_cursor#17 ← (byte*) print_char_cursor#37
  (byte) main::j#0 ← (byte) 0
  to:main::@3
main::@3: scope:[main]  from main::@10 main::@8
  (byte*) print_line_cursor#22 ← phi( main::@10/(byte*) print_line_cursor#6 main::@8/(byte*) print_line_cursor#5 )
  (byte*) print_char_cursor#49 ← phi( main::@10/(byte*) print_char_cursor#19 main::@8/(byte*) print_char_cursor#17 )
  (byte) main::j#2 ← phi( main::@10/(byte) main::j#1 main::@8/(byte) main::j#0 )
  (byte~) main::$8 ← (byte) main::j#2 * (const byte) SIZEOF_SIGNED_WORD
  (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8)
  call print_sword 
  to:main::@9
main::@9: scope:[main]  from main::@3
  (byte) main::j#4 ← phi( main::@3/(byte) main::j#2 )
  (byte*) print_line_cursor#19 ← phi( main::@3/(byte*) print_line_cursor#22 )
  (byte*) print_char_cursor#38 ← phi( main::@3/(byte*) print_char_cursor#6 )
  (byte*) print_char_cursor#18 ← (byte*) print_char_cursor#38
  call print_ln 
  to:main::@10
main::@10: scope:[main]  from main::@9
  (byte) main::j#3 ← phi( main::@9/(byte) main::j#4 )
  (byte*) print_char_cursor#39 ← phi( main::@9/(byte*) print_char_cursor#2 )
  (byte*) print_line_cursor#14 ← phi( main::@9/(byte*) print_line_cursor#2 )
  (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#14
  (byte*) print_char_cursor#19 ← (byte*) print_char_cursor#39
  (byte) main::j#1 ← (byte) main::j#3 + rangenext(0,8)
  (bool~) main::$7 ← (byte) main::j#1 != rangelast(0,8)
  if((bool~) main::$7) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@10
  (byte*) print_char_cursor#40 ← phi( main::@10/(byte*) print_char_cursor#19 )
  (byte*) print_line_cursor#15 ← phi( main::@10/(byte*) print_line_cursor#6 )
  (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#15
  (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#40
  return 
  to:@return

(void()) sub((byte) sub::idx , (byte) sub::s)
sub: scope:[sub]  from main::@1 main::@5 main::@6
  (byte) sub::s#3 ← phi( main::@1/(byte) sub::s#0 main::@5/(byte) sub::s#1 main::@6/(byte) sub::s#2 )
  (byte) sub::idx#3 ← phi( main::@1/(byte) sub::idx#0 main::@5/(byte) sub::idx#1 main::@6/(byte) sub::idx#2 )
  (byte~) sub::$0 ← (byte) sub::idx#3 * (const byte) SIZEOF_SIGNED_WORD
  *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3
  to:sub::@return
sub::@return: scope:[sub]  from sub
  return 
  to:@return
@39: scope:[]  from @13
  (byte*) print_screen#9 ← phi( @13/(byte*) print_screen#0 )
  (byte*) print_char_cursor#50 ← phi( @13/(byte*) print_char_cursor#0 )
  (byte*) print_line_cursor#20 ← phi( @13/(byte*) print_line_cursor#0 )
  call main 
  to:@40
@40: scope:[]  from @39
  (byte*) print_char_cursor#41 ← phi( @39/(byte*) print_char_cursor#20 )
  (byte*) print_line_cursor#16 ← phi( @39/(byte*) print_line_cursor#7 )
  (byte*) print_line_cursor#8 ← (byte*) print_line_cursor#16
  (byte*) print_char_cursor#21 ← (byte*) print_char_cursor#41
  to:@end
@end: scope:[]  from @40

SYMBOL TABLE SSA
(label) @13
(label) @39
(label) @40
(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
(const byte) SIZEOF_SIGNED_WORD = (byte) 2
(void()) main()
(bool~) main::$4
(bool~) main::$7
(byte~) main::$8
(label) main::@1
(label) main::@10
(label) main::@2
(label) main::@3
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(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) main::i#5
(byte) main::j
(byte) main::j#0
(byte) main::j#1
(byte) main::j#2
(byte) main::j#3
(byte) main::j#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
(void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0
(number~) print_byte::$2
(label) print_byte::@1
(label) print_byte::@2
(label) print_byte::@return
(byte) print_byte::b
(byte) print_byte::b#0
(byte) print_byte::b#1
(byte) print_byte::b#2
(byte) print_byte::b#3
(void()) print_char((byte) print_char::ch)
(label) print_char::@return
(byte) print_char::ch
(byte) print_char::ch#0
(byte) print_char::ch#1
(byte) print_char::ch#2
(byte) print_char::ch#3
(byte) print_char::ch#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#30
(byte*) print_char_cursor#31
(byte*) print_char_cursor#32
(byte*) print_char_cursor#33
(byte*) print_char_cursor#34
(byte*) print_char_cursor#35
(byte*) print_char_cursor#36
(byte*) print_char_cursor#37
(byte*) print_char_cursor#38
(byte*) print_char_cursor#39
(byte*) print_char_cursor#4
(byte*) print_char_cursor#40
(byte*) print_char_cursor#41
(byte*) print_char_cursor#42
(byte*) print_char_cursor#43
(byte*) print_char_cursor#44
(byte*) print_char_cursor#45
(byte*) print_char_cursor#46
(byte*) print_char_cursor#47
(byte*) print_char_cursor#48
(byte*) print_char_cursor#49
(byte*) print_char_cursor#5
(byte*) print_char_cursor#50
(byte*) print_char_cursor#51
(byte*) print_char_cursor#52
(byte*) print_char_cursor#53
(byte*) print_char_cursor#54
(byte*) print_char_cursor#55
(byte*) print_char_cursor#56
(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
(const byte*) print_hextab[]  = (string) "0123456789abcdef"z
(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#24
(byte*) print_line_cursor#25
(byte*) print_line_cursor#26
(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
(byte*) print_screen#8
(byte*) print_screen#9
(void()) print_sword((signed word) print_sword::w)
(bool~) print_sword::$0
(word~) print_sword::$1
(signed word~) print_sword::$5
(label) print_sword::@1
(label) print_sword::@2
(label) print_sword::@3
(label) print_sword::@5
(label) print_sword::@6
(label) print_sword::@7
(label) print_sword::@return
(signed word) print_sword::w
(signed word) print_sword::w#0
(signed word) print_sword::w#1
(signed word) print_sword::w#2
(signed word) print_sword::w#3
(signed word) print_sword::w#4
(signed word) print_sword::w#5
(signed word) print_sword::w#6
(signed word) print_sword::w#7
(void()) print_word((word) print_word::w)
(byte~) print_word::$0
(byte~) print_word::$2
(label) print_word::@1
(label) print_word::@2
(label) print_word::@return
(word) print_word::w
(word) print_word::w#0
(word) print_word::w#1
(word) print_word::w#2
(void()) sub((byte) sub::idx , (byte) sub::s)
(byte~) sub::$0
(label) sub::@return
(byte) sub::idx
(byte) sub::idx#0
(byte) sub::idx#1
(byte) sub::idx#2
(byte) sub::idx#3
(byte) sub::s
(byte) sub::s#0
(byte) sub::s#1
(byte) sub::s#2
(byte) sub::s#3
(const signed word*) words[]  = { (signed word) -$6000, (signed word) -$600, (signed word) -$60, (signed word) -6, (signed word) 0, (signed word) 6, (signed word) $60, (signed word) $600, (signed word) $6000 }

Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#1 > (number) 0
Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#9 + (number) $28
Adding number conversion cast (snumber) 0 in (bool~) print_sword::$0 ← (signed word) print_sword::w#2 < (number) 0
Adding number conversion cast (unumber) 4 in (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4
Adding number conversion cast (unumber) $f in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f
Adding number conversion cast (unumber) print_byte::$2 in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (unumber)(number) $f
Adding number conversion cast (unumber) $3e8 in (word) memset::num#0 ← (number) $3e8
Adding number conversion cast (unumber) $80 in (byte) sub::s#0 ← (number) $80
Adding number conversion cast (unumber) $40 in (byte) sub::s#1 ← (number) $40
Adding number conversion cast (unumber) $40 in (byte) sub::s#2 ← (number) $40
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 (word~) print_sword::$1 ← (word)(signed word) print_sword::w#4
Inlining cast (word) memset::num#0 ← (unumber)(number) $3e8
Inlining cast (byte) sub::s#0 ← (unumber)(number) $80
Inlining cast (byte) sub::s#1 ← (unumber)(number) $40
Inlining cast (byte) sub::s#2 ← (unumber)(number) $40
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 0
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast $28
Simplifying constant integer cast 0
Simplifying constant integer cast 4
Simplifying constant integer cast $f
Simplifying constant integer cast $3e8
Simplifying constant integer cast $80
Simplifying constant integer cast $40
Simplifying constant integer cast $40
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Finalized signed number type (signed byte) 0
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) $f
Finalized unsigned number type (word) $3e8
Finalized unsigned number type (byte) $80
Finalized unsigned number type (byte) $40
Finalized unsigned number type (byte) $40
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) print_byte::$2 ← (byte) print_byte::b#3 & (byte) $f
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#20 (byte*) print_char_cursor#50 (byte*) print_screen#9 
Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#10 (byte*) print_char_cursor#1 (byte*) print_line_cursor#11 (byte*) print_char_cursor#23 (byte*) print_line_cursor#2 (byte*) print_char_cursor#2 
Alias (byte*) print_char_cursor#43 = (byte*) print_char_cursor#51 (byte*) print_char_cursor#44 
Alias (signed word) print_sword::w#2 = (signed word) print_sword::w#5 (signed word) print_sword::w#3 (signed word) print_sword::w#7 (signed word) print_sword::w#6 
Alias (byte*) print_char_cursor#24 = (byte*) print_char_cursor#3 
Alias (signed word) print_sword::w#0 = (signed word~) print_sword::$5 
Alias (byte*) print_char_cursor#25 = (byte*) print_char_cursor#4 
Alias (word) print_word::w#0 = (word~) print_sword::$1 
Alias (byte*) print_char_cursor#26 = (byte*) print_char_cursor#5 (byte*) print_char_cursor#27 (byte*) print_char_cursor#6 
Alias (byte) print_byte::b#0 = (byte~) print_word::$0 
Alias (word) print_word::w#1 = (word) print_word::w#2 
Alias (byte*) print_char_cursor#28 = (byte*) print_char_cursor#7 
Alias (byte) print_byte::b#1 = (byte~) print_word::$2 
Alias (byte*) print_char_cursor#29 = (byte*) print_char_cursor#8 (byte*) print_char_cursor#30 (byte*) print_char_cursor#9 
Alias (byte) print_byte::b#2 = (byte) print_byte::b#3 
Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#31 
Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#32 (byte*) print_char_cursor#33 (byte*) print_char_cursor#12 
Alias (byte*) print_char_cursor#13 = (byte*) print_char_cursor#35 (byte*) print_char_cursor#14 
Alias (byte*) print_line_cursor#12 = (byte*) print_screen#2 (byte*) print_screen#1 (byte*) print_line_cursor#3 (byte*) print_char_cursor#15 (byte*) print_char_cursor#36 (byte*) print_line_cursor#4 (byte*) print_char_cursor#16 
Alias (byte) main::i#2 = (byte) main::i#3 (byte) main::i#4 (byte) main::i#5 
Alias (byte*) print_screen#3 = (byte*) print_screen#6 (byte*) print_screen#7 (byte*) print_screen#5 (byte*) print_screen#4 
Alias (byte*) print_line_cursor#18 = (byte*) print_line_cursor#24 (byte*) print_line_cursor#25 (byte*) print_line_cursor#23 (byte*) print_line_cursor#21 
Alias (byte*) print_char_cursor#48 = (byte*) print_char_cursor#54 (byte*) print_char_cursor#55 (byte*) print_char_cursor#53 (byte*) print_char_cursor#52 
Alias (byte*) print_line_cursor#13 = (byte*) print_line_cursor#5 
Alias (byte*) print_char_cursor#17 = (byte*) print_char_cursor#37 
Alias (byte*) print_line_cursor#19 = (byte*) print_line_cursor#22 
Alias (byte) main::j#2 = (byte) main::j#4 (byte) main::j#3 
Alias (byte*) print_char_cursor#18 = (byte*) print_char_cursor#38 
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#19 = (byte*) print_char_cursor#39 (byte*) print_char_cursor#40 (byte*) print_char_cursor#20 
Alias (byte*) print_line_cursor#16 = (byte*) print_line_cursor#8 
Alias (byte*) print_char_cursor#21 = (byte*) print_char_cursor#41 
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_line_cursor#17 (byte*) print_line_cursor#19
Identical Phi Values (byte*) print_char_cursor#42 (byte*) print_char_cursor#18
Identical Phi Values (byte*) print_char_cursor#22 (byte*) print_char_cursor#42
Identical Phi Values (signed word) print_sword::w#2 (signed word) print_sword::w#1
Identical Phi Values (byte*) print_char_cursor#43 (byte*) print_char_cursor#49
Identical Phi Values (byte*) print_char_cursor#24 (byte*) print_char_cursor#13
Identical Phi Values (byte*) print_char_cursor#25 (byte*) print_char_cursor#13
Identical Phi Values (byte*) print_char_cursor#26 (byte*) print_char_cursor#29
Identical Phi Values (word) print_word::w#1 (word) print_word::w#0
Identical Phi Values (byte*) print_char_cursor#46 (byte*) print_char_cursor#45
Identical Phi Values (byte*) print_char_cursor#28 (byte*) print_char_cursor#11
Identical Phi Values (byte*) print_char_cursor#29 (byte*) print_char_cursor#11
Identical Phi Values (byte*) print_char_cursor#10 (byte*) print_char_cursor#13
Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#13
Identical Phi Values (byte*) print_line_cursor#12 (byte*) print_screen#3
Identical Phi Values (byte*) print_screen#8 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_line_cursor#26 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_char_cursor#56 (byte*) print_line_cursor#0
Identical Phi Values (byte*) print_screen#3 (byte*) print_screen#8
Identical Phi Values (byte*) print_line_cursor#18 (byte*) print_line_cursor#26
Identical Phi Values (byte*) print_char_cursor#48 (byte*) print_char_cursor#56
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#26
Identical Phi Values (byte*) print_line_cursor#14 (byte*) print_line_cursor#1
Identical Phi Values (byte*) print_char_cursor#19 (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#21 (byte*) print_char_cursor#19
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (void*) memset::return#0 (void*) memset::str#0
Identical Phi Values (byte*) print_char_cursor#45 (byte*) print_char_cursor#13
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (byte*) print_char_cursor#47 (byte*) print_char_cursor#13
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_ln::$1 [28] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) goto print_ln::@1
Simple Condition (bool~) print_sword::$0 [37] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1
Simple Condition (bool~) main::$4 [123] if((byte) main::i#1!=rangelast(0,8)) goto main::@1
Simple Condition (bool~) main::$7 [142] if((byte) main::j#1!=rangelast(0,8)) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) print_line_cursor#0 = (byte*) 1024
Constant (const byte) print_char::ch#0 = '-'
Constant (const byte) print_char::ch#1 = ' '
Constant (const byte) memset::c#0 = ' '
Constant (const word) memset::num#0 = $3e8
Constant (const byte) main::i#0 = 0
Constant (const byte) sub::s#0 = $80
Constant (const byte) sub::s#1 = $40
Constant (const byte) sub::s#2 = $40
Constant (const byte) main::j#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const void*) memset::str#0 = (void*)print_line_cursor#0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) memset::$2 = (byte*)memset::str#0
Constant (const byte*) memset::dst#0 = (byte*)memset::str#0
Constant (const void*) memset::return#2 = memset::str#0
Successful SSA optimization Pass2ConstantIdentification
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 [121] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [123] if(main::i#1!=rangelast(0,8)) goto main::@1 to (number) 9
Resolved ranged next value [140] main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value [142] if(main::j#1!=rangelast(0,8)) goto main::@3 to (number) 9
Eliminating unused constant (const void*) memset::return#2
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 9 in if((byte) main::i#1!=(number) 9) goto main::@1
Adding number conversion cast (unumber) 9 in if((byte) main::j#1!=(number) 9) goto main::@3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 9
Simplifying constant integer cast 9
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 9
Finalized unsigned number type (byte) 9
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
Rewriting multiplication to use shift [47] (byte~) main::$8 ← (byte) main::j#2 * (const byte) SIZEOF_SIGNED_WORD
Rewriting multiplication to use shift [55] (byte~) sub::$0 ← (byte) sub::idx#3 * (const byte) SIZEOF_SIGNED_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte*) memset::dst#0
Inlining constant with var siblings (const byte) print_char::ch#0
Inlining constant with var siblings (const byte) print_char::ch#1
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) sub::s#0
Inlining constant with var siblings (const byte) sub::s#1
Inlining constant with var siblings (const byte) sub::s#2
Inlining constant with var siblings (const byte*) print_line_cursor#0
Constant inlined memset::$2 = (byte*)(const void*) memset::str#0
Constant inlined print_char::ch#1 = (byte) ' '
Constant inlined print_line_cursor#0 = (byte*) 1024
Constant inlined print_char::ch#0 = (byte) '-'
Constant inlined main::i#0 = (byte) 0
Constant inlined sub::s#0 = (byte) $80
Constant inlined sub::s#1 = (byte) $40
Constant inlined memset::dst#0 = (byte*)(const void*) memset::str#0
Constant inlined sub::s#2 = (byte) $40
Constant inlined main::j#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_SIGNED_WORD
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
Added new block during phi lifting main::@11(between main::@7 and main::@1)
Added new block during phi lifting main::@12(between main::@10 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @13
Adding NOP phi() at start of @39
Adding NOP phi() at start of @40
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 main::@8
Adding NOP phi() at start of main::@9
Adding NOP phi() at start of print_ln::@2
Adding NOP phi() at start of print_sword::@7
Adding NOP phi() at start of print_word::@2
Adding NOP phi() at start of print_byte::@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::@1
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to sub:10 sub:13 sub:16 print_cls:20 print_sword:25 print_ln:27 
Calls in [print_sword] to print_char:44 print_word:48 print_char:52 
Calls in [print_word] to print_byte:61 print_byte:64 
Calls in [print_byte] to print_char:72 print_char:77 
Calls in [print_cls] to memset:81 

Created 12 initial phi equivalence classes
Coalesced [9] sub::idx#4 ← sub::idx#0
Coalesced [12] sub::idx#5 ← sub::idx#1
Coalesced [15] sub::idx#6 ← sub::idx#2
Coalesced [31] main::j#5 ← main::j#1
Not coalescing [32] print_char_cursor#61 ← print_line_cursor#1
Coalesced [33] print_line_cursor#29 ← print_line_cursor#1
Coalesced [34] main::i#6 ← main::i#1
Coalesced [35] print_line_cursor#27 ← print_line_cursor#19
Coalesced (already) [41] print_line_cursor#28 ← print_line_cursor#1
Coalesced [43] print_char_cursor#60 ← print_char_cursor#49
Coalesced [45] print_sword::w#9 ← print_sword::w#1
Coalesced (already) [51] print_char_cursor#59 ← print_char_cursor#49
Coalesced [54] print_sword::w#8 ← print_sword::w#0
Coalesced [60] print_byte::b#4 ← print_byte::b#0
Coalesced [63] print_byte::b#5 ← print_byte::b#1
Coalesced [70] print_char::ch#5 ← print_char::ch#2
Coalesced [71] print_char_cursor#57 ← print_char_cursor#13
Coalesced [75] print_char::ch#6 ← print_char::ch#3
Coalesced (already) [76] print_char_cursor#58 ← print_char_cursor#13
Coalesced [92] memset::dst#4 ← memset::dst#1
Coalesced down to 10 phi equivalence classes
Culled Empty Block (label) @13
Culled Empty Block (label) @40
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@11
Culled Empty Block (label) print_ln::@2
Culled Empty Block (label) print_ln::@3
Culled Empty Block (label) print_sword::@6
Culled Empty Block (label) print_sword::@7
Culled Empty Block (label) print_word::@2
Culled Empty Block (label) print_byte::@2
Culled Empty Block (label) print_cls::@1
Culled Empty Block (label) memset::@2
Culled Empty Block (label) memset::@1
Renumbering block @39 to @1
Renumbering block memset::@4 to memset::@1
Renumbering block memset::@5 to memset::@2
Renumbering block print_sword::@5 to print_sword::@4
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@7 to main::@6
Renumbering block main::@9 to main::@7
Renumbering block main::@10 to main::@8
Renumbering block main::@12 to main::@9
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 main::@7
Adding NOP phi() at start of print_ln
Adding NOP phi() at start of print_sword::@3
Adding NOP phi() at start of print_sword::@1
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()

(void()) main()
main: scope:[main]  from @1
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@6
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@6/(byte) main::i#1 )
  [6] (byte) sub::idx#0 ← (byte) main::i#2
  [7] call sub 
  to:main::@4
main::@4: scope:[main]  from main::@1
  [8] (byte) sub::idx#1 ← (byte) main::i#2
  [9] call sub 
  to:main::@5
main::@5: scope:[main]  from main::@4
  [10] (byte) sub::idx#2 ← (byte) main::i#2
  [11] call sub 
  to:main::@6
main::@6: scope:[main]  from main::@5
  [12] (byte) main::i#1 ← ++ (byte) main::i#2
  [13] if((byte) main::i#1!=(byte) 9) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@6
  [14] phi()
  [15] call print_cls 
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@9
  [16] (byte*) print_line_cursor#19 ← phi( main::@9/(byte*) print_line_cursor#1 main::@2/(byte*) 1024 )
  [16] (byte*) print_char_cursor#49 ← phi( main::@9/(byte*) print_char_cursor#61 main::@2/(byte*) 1024 )
  [16] (byte) main::j#2 ← phi( main::@9/(byte) main::j#1 main::@2/(byte) 0 )
  [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1
  [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8)
  [19] call print_sword 
  to:main::@7
main::@7: scope:[main]  from main::@3
  [20] phi()
  [21] call print_ln 
  to:main::@8
main::@8: scope:[main]  from main::@7
  [22] (byte) main::j#1 ← ++ (byte) main::j#2
  [23] if((byte) main::j#1!=(byte) 9) goto main::@9
  to:main::@return
main::@return: scope:[main]  from main::@8
  [24] return 
  to:@return
main::@9: scope:[main]  from main::@8
  [25] (byte*) print_char_cursor#61 ← (byte*) print_line_cursor#1
  to:main::@3

(void()) print_ln()
print_ln: scope:[print_ln]  from main::@7
  [26] phi()
  to:print_ln::@1
print_ln::@1: scope:[print_ln]  from print_ln print_ln::@1
  [27] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#19 print_ln::@1/(byte*) print_line_cursor#1 )
  [28] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28
  [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) goto print_ln::@1
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@1
  [30] return 
  to:@return

(void()) print_sword((signed word) print_sword::w)
print_sword: scope:[print_sword]  from main::@3
  [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1
  to:print_sword::@3
print_sword::@3: scope:[print_sword]  from print_sword
  [32] phi()
  [33] call print_char 
  to:print_sword::@2
print_sword::@2: scope:[print_sword]  from print_sword::@3 print_sword::@4
  [34] (signed word) print_sword::w#4 ← phi( print_sword::@4/(signed word) print_sword::w#0 print_sword::@3/(signed word) print_sword::w#1 )
  [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4
  [36] call print_word 
  to:print_sword::@return
print_sword::@return: scope:[print_sword]  from print_sword::@2
  [37] return 
  to:@return
print_sword::@1: scope:[print_sword]  from print_sword
  [38] phi()
  [39] call print_char 
  to:print_sword::@4
print_sword::@4: scope:[print_sword]  from print_sword::@1
  [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1
  to:print_sword::@2

(void()) print_char((byte) print_char::ch)
print_char: scope:[print_char]  from print_byte print_byte::@1 print_sword::@1 print_sword::@3
  [41] (byte*) print_char_cursor#34 ← phi( print_byte/(byte*) print_char_cursor#13 print_byte::@1/(byte*) print_char_cursor#13 print_sword::@1/(byte*) print_char_cursor#49 print_sword::@3/(byte*) print_char_cursor#49 )
  [41] (byte) print_char::ch#4 ← phi( print_byte/(byte) print_char::ch#2 print_byte::@1/(byte) print_char::ch#3 print_sword::@1/(byte) '-' print_sword::@3/(byte) ' ' )
  [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4
  [43] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#34
  to:print_char::@return
print_char::@return: scope:[print_char]  from print_char
  [44] return 
  to:@return

(void()) print_word((word) print_word::w)
print_word: scope:[print_word]  from print_sword::@2
  [45] (byte) print_byte::b#0 ← > (word) print_word::w#0
  [46] call print_byte 
  to:print_word::@1
print_word::@1: scope:[print_word]  from print_word
  [47] (byte) print_byte::b#1 ← < (word) print_word::w#0
  [48] call print_byte 
  to:print_word::@return
print_word::@return: scope:[print_word]  from print_word::@1
  [49] return 
  to:@return

(void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte]  from print_word print_word::@1
  [50] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
  [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4
  [52] (byte) print_char::ch#2 ← *((const byte*) print_hextab + (byte~) print_byte::$0)
  [53] call print_char 
  to:print_byte::@1
print_byte::@1: scope:[print_byte]  from print_byte
  [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f
  [55] (byte) print_char::ch#3 ← *((const byte*) print_hextab + (byte~) print_byte::$2)
  [56] call print_char 
  to:print_byte::@return
print_byte::@return: scope:[print_byte]  from print_byte::@1
  [57] return 
  to:@return

(void()) print_cls()
print_cls: scope:[print_cls]  from main::@2
  [58] phi()
  [59] call memset 
  to:print_cls::@return
print_cls::@return: scope:[print_cls]  from print_cls
  [60] return 
  to:@return

(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
memset: scope:[memset]  from print_cls
  [61] phi()
  to:memset::@1
memset::@1: scope:[memset]  from memset memset::@2
  [62] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@2/(byte*) memset::dst#1 )
  [63] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2
  to:memset::@return
memset::@return: scope:[memset]  from memset::@1
  [64] return 
  to:@return
memset::@2: scope:[memset]  from memset::@1
  [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0
  [66] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
  to:memset::@1

(void()) sub((byte) sub::idx , (byte) sub::s)
sub: scope:[sub]  from main::@1 main::@4 main::@5
  [67] (byte) sub::s#3 ← phi( main::@1/(byte) $80 main::@4/(byte) $40 main::@5/(byte) $40 )
  [67] (byte) sub::idx#3 ← phi( main::@1/(byte) sub::idx#0 main::@4/(byte) sub::idx#1 main::@5/(byte) sub::idx#2 )
  [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1
  [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3
  to:sub::@return
sub::@return: scope:[sub]  from sub
  [70] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$8 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 7.857142857142857
(byte) main::j
(byte) main::j#1 11.0
(byte) main::j#2 5.5
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(byte) memset::c
(byte*) memset::dst
(byte*) memset::dst#1 22.0
(byte*) memset::dst#2 14.666666666666666
(byte*) memset::end
(word) memset::num
(void*) memset::return
(void*) memset::str
(void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0 4.0
(byte~) print_byte::$2 4.0
(byte) print_byte::b
(byte) print_byte::b#0 4.0
(byte) print_byte::b#1 4.0
(byte) print_byte::b#2 2.0
(void()) print_char((byte) print_char::ch)
(byte) print_char::ch
(byte) print_char::ch#2 4.0
(byte) print_char::ch#3 4.0
(byte) print_char::ch#4 6.0
(byte*) print_char_cursor
(byte*) print_char_cursor#13 3.821428571428572
(byte*) print_char_cursor#34 6.0
(byte*) print_char_cursor#49 2.5
(byte*) print_char_cursor#61 22.0
(void()) print_cls()
(byte*) print_line_cursor
(byte*) print_line_cursor#1 46.42857142857143
(byte*) print_line_cursor#19 2.1666666666666665
(byte*) print_line_cursor#9 204.0
(void()) print_ln()
(byte*) print_screen
(void()) print_sword((signed word) print_sword::w)
(signed word) print_sword::w
(signed word) print_sword::w#0 4.0
(signed word) print_sword::w#1 2.8333333333333335
(signed word) print_sword::w#4 4.0
(void()) print_word((word) print_word::w)
(word) print_word::w
(word) print_word::w#0 2.0
(void()) sub((byte) sub::idx , (byte) sub::s)
(byte~) sub::$0 6.0
(byte) sub::idx
(byte) sub::idx#0 22.0
(byte) sub::idx#1 22.0
(byte) sub::idx#2 22.0
(byte) sub::idx#3 35.0
(byte) sub::s
(byte) sub::s#3 1.0

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
[ print_sword::w#4 print_sword::w#0 print_sword::w#1 ]
[ print_char::ch#4 print_char::ch#2 print_char::ch#3 ]
[ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ]
[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
[ memset::dst#2 memset::dst#1 ]
[ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ]
[ sub::s#3 ]
Added variable main::$8 to live range equivalence class [ main::$8 ]
Added variable print_word::w#0 to live range equivalence class [ print_word::w#0 ]
Added variable print_byte::$0 to live range equivalence class [ print_byte::$0 ]
Added variable print_byte::$2 to live range equivalence class [ print_byte::$2 ]
Added variable sub::$0 to live range equivalence class [ sub::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
[ print_sword::w#4 print_sword::w#0 print_sword::w#1 ]
[ print_char::ch#4 print_char::ch#2 print_char::ch#3 ]
[ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ]
[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
[ memset::dst#2 memset::dst#1 ]
[ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ]
[ sub::s#3 ]
[ main::$8 ]
[ print_word::w#0 ]
[ print_byte::$0 ]
[ print_byte::$2 ]
[ sub::$0 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ main::j#2 main::j#1 ]
Allocated zp[2]:4 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
Allocated zp[2]:6 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 ]
Allocated zp[1]:8 [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ]
Allocated zp[2]:9 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ]
Allocated zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Allocated zp[2]:12 [ memset::dst#2 memset::dst#1 ]
Allocated zp[1]:14 [ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ]
Allocated zp[1]:15 [ sub::s#3 ]
Allocated zp[1]:16 [ main::$8 ]
Allocated zp[2]:17 [ print_word::w#0 ]
Allocated zp[1]:19 [ print_byte::$0 ]
Allocated zp[1]:20 [ print_byte::$2 ]
Allocated zp[1]:21 [ sub::$0 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Tests that signed indexed subtract works as intended
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_line_cursor = 4
  .label print_char_cursor = 9
  // @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 __8 = $10
    .label i = 2
    .label j = 3
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // [5] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  __b1_from___b6:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) sub::idx#0 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda.z i
    sta.z sub.idx
    // [7] call sub 
    // [67] phi from main::@1 to sub [phi:main::@1->sub]
  sub_from___b1:
    // [67] phi (byte) sub::s#3 = (byte) $80 [phi:main::@1->sub#0] -- vbuz1=vbuc1 
    lda #$80
    sta.z sub.s
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#0 [phi:main::@1->sub#1] -- register_copy 
    jsr sub
    jmp __b4
    // main::@4
  __b4:
    // [8] (byte) sub::idx#1 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda.z i
    sta.z sub.idx
    // [9] call sub 
    // [67] phi from main::@4 to sub [phi:main::@4->sub]
  sub_from___b4:
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@4->sub#0] -- vbuz1=vbuc1 
    lda #$40
    sta.z sub.s
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#1 [phi:main::@4->sub#1] -- register_copy 
    jsr sub
    jmp __b5
    // main::@5
  __b5:
    // [10] (byte) sub::idx#2 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda.z i
    sta.z sub.idx
    // [11] call sub 
    // [67] phi from main::@5 to sub [phi:main::@5->sub]
  sub_from___b5:
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@5->sub#0] -- vbuz1=vbuc1 
    lda #$40
    sta.z sub.s
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#2 [phi:main::@5->sub#1] -- register_copy 
    jsr sub
    jmp __b6
    // main::@6
  __b6:
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [13] if((byte) main::i#1!=(byte) 9) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #9
    cmp.z i
    bne __b1_from___b6
    // [14] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  __b2_from___b6:
    jmp __b2
    // main::@2
  __b2:
    // [15] call print_cls 
    // [58] phi from main::@2 to print_cls [phi:main::@2->print_cls]
  print_cls_from___b2:
    jsr print_cls
    // [16] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  __b3_from___b2:
    // [16] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main::@2->main::@3#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [16] phi (byte*) print_char_cursor#49 = (byte*) 1024 [phi:main::@2->main::@3#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [16] phi (byte) main::j#2 = (byte) 0 [phi:main::@2->main::@3#2] -- vbuz1=vbuc1 
    lda #0
    sta.z j
    jmp __b3
    // main::@3
  __b3:
    // [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z j
    asl
    sta.z __8
    // [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8) -- vwsz1=pwsc1_derefidx_vbuz2 
    ldy.z __8
    lda words,y
    sta.z print_sword.w
    lda words+1,y
    sta.z print_sword.w+1
    // [19] call print_sword 
    jsr print_sword
    // [20] phi from main::@3 to main::@7 [phi:main::@3->main::@7]
  __b7_from___b3:
    jmp __b7
    // main::@7
  __b7:
    // [21] call print_ln 
    // [26] phi from main::@7 to print_ln [phi:main::@7->print_ln]
  print_ln_from___b7:
    jsr print_ln
    jmp __b8
    // main::@8
  __b8:
    // [22] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1 
    inc.z j
    // [23] if((byte) main::j#1!=(byte) 9) goto main::@9 -- vbuz1_neq_vbuc1_then_la1 
    lda #9
    cmp.z j
    bne __b9
    jmp __breturn
    // main::@return
  __breturn:
    // [24] return 
    rts
    // main::@9
  __b9:
    // [25] (byte*) print_char_cursor#61 ← (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
    // [16] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
  __b3_from___b9:
    // [16] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@9->main::@3#0] -- register_copy 
    // [16] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#61 [phi:main::@9->main::@3#1] -- register_copy 
    // [16] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@9->main::@3#2] -- register_copy 
    jmp __b3
}
  // print_ln
// Print a newline
print_ln: {
    // [27] 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:
    // [27] 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:
    // [28] (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
  !:
    // [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) 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:
    // [30] return 
    rts
}
  // print_sword
// Print a signed word as HEX
// print_sword(signed word zp(6) w)
print_sword: {
    .label w = 6
    // [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1 -- vwsz1_lt_0_then_la1 
    lda.z w+1
    bmi __b1_from_print_sword
    // [32] phi from print_sword to print_sword::@3 [phi:print_sword->print_sword::@3]
  __b3_from_print_sword:
    jmp __b3
    // print_sword::@3
  __b3:
    // [33] call print_char 
    // [41] phi from print_sword::@3 to print_char [phi:print_sword::@3->print_char]
  print_char_from___b3:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@3->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) ' ' [phi:print_sword::@3->print_char#1] -- vbuz1=vbuc1 
    lda #' '
    sta.z print_char.ch
    jsr print_char
    // [34] phi from print_sword::@3 print_sword::@4 to print_sword::@2 [phi:print_sword::@3/print_sword::@4->print_sword::@2]
  __b2_from___b3:
  __b2_from___b4:
    // [34] phi (signed word) print_sword::w#4 = (signed word) print_sword::w#1 [phi:print_sword::@3/print_sword::@4->print_sword::@2#0] -- register_copy 
    jmp __b2
    // print_sword::@2
  __b2:
    // [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4 -- vwuz1=vwuz2 
    lda.z w
    sta.z print_word.w
    lda.z w+1
    sta.z print_word.w+1
    // [36] call print_word 
    jsr print_word
    jmp __breturn
    // print_sword::@return
  __breturn:
    // [37] return 
    rts
    // [38] phi from print_sword to print_sword::@1 [phi:print_sword->print_sword::@1]
  __b1_from_print_sword:
    jmp __b1
    // print_sword::@1
  __b1:
    // [39] call print_char 
    // [41] phi from print_sword::@1 to print_char [phi:print_sword::@1->print_char]
  print_char_from___b1:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) '-' [phi:print_sword::@1->print_char#1] -- vbuz1=vbuc1 
    lda #'-'
    sta.z print_char.ch
    jsr print_char
    jmp __b4
    // print_sword::@4
  __b4:
    // [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1 -- vwsz1=_neg_vwsz1 
    sec
    lda #0
    sbc.z w
    sta.z w
    lda #0
    sbc.z w+1
    sta.z w+1
    jmp __b2_from___b4
}
  // print_char
// Print a single char
// print_char(byte zp(8) ch)
print_char: {
    .label ch = 8
    // [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2 
    lda.z ch
    ldy #0
    sta (print_char_cursor),y
    // [43] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#34 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    jmp __breturn
    // print_char::@return
  __breturn:
    // [44] return 
    rts
}
  // print_word
// Print a word as HEX
// print_word(word zp($11) w)
print_word: {
    .label w = $11
    // [45] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 
    lda.z w+1
    sta.z print_byte.b
    // [46] call print_byte 
    // [50] phi from print_word to print_byte [phi:print_word->print_byte]
  print_byte_from_print_word:
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#0] -- register_copy 
    jsr print_byte
    jmp __b1
    // print_word::@1
  __b1:
    // [47] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 
    lda.z w
    sta.z print_byte.b
    // [48] call print_byte 
    // [50] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
  print_byte_from___b1:
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#0] -- register_copy 
    jsr print_byte
    jmp __breturn
    // print_word::@return
  __breturn:
    // [49] return 
    rts
}
  // print_byte
// Print a byte as HEX
// print_byte(byte zp($b) b)
print_byte: {
    .label __0 = $13
    .label __2 = $14
    .label b = $b
    // [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 
    lda.z b
    lsr
    lsr
    lsr
    lsr
    sta.z __0
    // [52] (byte) print_char::ch#2 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z __0
    lda print_hextab,y
    sta.z print_char.ch
    // [53] call print_char 
    // [41] phi from print_byte to print_char [phi:print_byte->print_char]
  print_char_from_print_byte:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#2 [phi:print_byte->print_char#1] -- register_copy 
    jsr print_char
    jmp __b1
    // print_byte::@1
  __b1:
    // [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 
    lda #$f
    and.z b
    sta.z __2
    // [55] (byte) print_char::ch#3 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z __2
    lda print_hextab,y
    sta.z print_char.ch
    // [56] call print_char 
    // [41] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
  print_char_from___b1:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#3 [phi:print_byte::@1->print_char#1] -- register_copy 
    jsr print_char
    jmp __breturn
    // print_byte::@return
  __breturn:
    // [57] return 
    rts
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // [59] call memset 
    // [61] phi from print_cls to memset [phi:print_cls->memset]
  memset_from_print_cls:
    jsr memset
    jmp __breturn
    // print_cls::@return
  __breturn:
    // [60] 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 = $c
    // [62] phi from memset to memset::@1 [phi:memset->memset::@1]
  __b1_from_memset:
    // [62] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    jmp __b1
    // memset::@1
  __b1:
    // [63] if((byte*) memset::dst#2!=(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
    jmp __breturn
    // memset::@return
  __breturn:
    // [64] return 
    rts
    // memset::@2
  __b2:
    // [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // [66] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // [62] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
  __b1_from___b2:
    // [62] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy 
    jmp __b1
}
  // sub
// sub(byte zp($e) idx, byte zp($f) s)
sub: {
    .label __0 = $15
    .label idx = $e
    .label s = $f
    // [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z idx
    asl
    sta.z __0
    // [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3 -- pwsc1_derefidx_vbuz1=pwsc1_derefidx_vbuz1_minus_vbuz2 
    ldx.z __0
    sec
    lda words,x
    sbc.z s
    sta words,x
    bcs !+
    dec words+1,x
  !:
    jmp __breturn
    // sub::@return
  __breturn:
    // [70] return 
    rts
}
  // File Data
  print_hextab: .text "0123456789abcdef"
  words: .word -$6000, -$600, -$60, -6, 0, 6, $60, $600, $6000

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1 [ main::j#2 print_char_cursor#49 print_line_cursor#19 main::$8 ] ( main:2 [ main::j#2 print_char_cursor#49 print_line_cursor#19 main::$8 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::j#2 main::j#1 ]
Statement [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8) [ main::j#2 print_char_cursor#49 print_line_cursor#19 print_sword::w#1 ] ( main:2 [ main::j#2 print_char_cursor#49 print_line_cursor#19 print_sword::w#1 ] ) always clobbers reg byte a 
Statement [25] (byte*) print_char_cursor#61 ← (byte*) print_line_cursor#1 [ main::j#1 print_char_cursor#61 print_line_cursor#1 ] ( main:2 [ main::j#1 print_char_cursor#61 print_line_cursor#1 ] ) always clobbers reg byte a 
Statement [28] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 [ print_line_cursor#1 print_char_cursor#13 ] ( main:2::print_ln:21 [ main::j#2 print_line_cursor#1 print_char_cursor#13 ] ) always clobbers reg byte a 
Statement [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#13 ] ( main:2::print_ln:21 [ main::j#2 print_line_cursor#1 print_char_cursor#13 ] ) always clobbers reg byte a 
Statement [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1 [ print_char_cursor#49 print_sword::w#1 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#49 print_sword::w#1 ] ) always clobbers reg byte a 
Statement [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4 [ print_char_cursor#13 print_word::w#0 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_word::w#0 ] ) always clobbers reg byte a 
Statement [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1 [ print_char_cursor#13 print_sword::w#0 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_sword::w#0 ] ) always clobbers reg byte a 
Statement [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4 [ print_char_cursor#34 ] ( main:2::print_sword:19::print_char:33 [ main::j#2 print_line_cursor#19 print_sword::w#1 print_char_cursor#34 ] main:2::print_sword:19::print_char:39 [ main::j#2 print_line_cursor#19 print_sword::w#1 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:46::print_char:53 [ main::j#2 print_line_cursor#19 print_word::w#0 print_byte::b#2 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:48::print_char:53 [ main::j#2 print_line_cursor#19 print_byte::b#2 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:46::print_char:56 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:48::print_char:56 [ main::j#2 print_line_cursor#19 print_char_cursor#34 ] ) always clobbers reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:3 [ main::j#2 main::j#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Statement [45] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#13 print_word::w#0 print_byte::b#0 ] ( main:2::print_sword:19::print_word:36 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a 
Statement [47] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#13 print_byte::b#1 ] ( main:2::print_sword:19::print_word:36 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::b#1 ] ) always clobbers reg byte a 
Statement [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_char_cursor#13 print_byte::b#2 print_byte::$0 ] ( main:2::print_sword:19::print_word:36::print_byte:46 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#13 print_byte::b#2 print_byte::$0 ] main:2::print_sword:19::print_word:36::print_byte:48 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::b#2 print_byte::$0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Statement [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#13 print_byte::$2 ] ( main:2::print_sword:19::print_word:36::print_byte:46 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#13 print_byte::$2 ] main:2::print_sword:19::print_word:36::print_byte:48 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::$2 ] ) always clobbers reg byte a 
Statement [63] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#2 ] ( main:2::print_cls:15::memset:59 [ memset::dst#2 ] ) always clobbers reg byte a 
Statement [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0 [ memset::dst#2 ] ( main:2::print_cls:15::memset:59 [ memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Statement [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1 [ sub::s#3 sub::$0 ] ( main:2::sub:7 [ main::i#2 sub::s#3 sub::$0 ] main:2::sub:9 [ main::i#2 sub::s#3 sub::$0 ] main:2::sub:11 [ main::i#2 sub::s#3 sub::$0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:15 [ sub::s#3 ]
Statement [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3 [ ] ( main:2::sub:7 [ main::i#2 ] main:2::sub:9 [ main::i#2 ] main:2::sub:11 [ main::i#2 ] ) always clobbers reg byte a 
Statement [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1 [ main::j#2 print_char_cursor#49 print_line_cursor#19 main::$8 ] ( main:2 [ main::j#2 print_char_cursor#49 print_line_cursor#19 main::$8 ] ) always clobbers reg byte a 
Statement [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8) [ main::j#2 print_char_cursor#49 print_line_cursor#19 print_sword::w#1 ] ( main:2 [ main::j#2 print_char_cursor#49 print_line_cursor#19 print_sword::w#1 ] ) always clobbers reg byte a 
Statement [25] (byte*) print_char_cursor#61 ← (byte*) print_line_cursor#1 [ main::j#1 print_char_cursor#61 print_line_cursor#1 ] ( main:2 [ main::j#1 print_char_cursor#61 print_line_cursor#1 ] ) always clobbers reg byte a 
Statement [28] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 [ print_line_cursor#1 print_char_cursor#13 ] ( main:2::print_ln:21 [ main::j#2 print_line_cursor#1 print_char_cursor#13 ] ) always clobbers reg byte a 
Statement [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#13 ] ( main:2::print_ln:21 [ main::j#2 print_line_cursor#1 print_char_cursor#13 ] ) always clobbers reg byte a 
Statement [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1 [ print_char_cursor#49 print_sword::w#1 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#49 print_sword::w#1 ] ) always clobbers reg byte a 
Statement [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4 [ print_char_cursor#13 print_word::w#0 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_word::w#0 ] ) always clobbers reg byte a 
Statement [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1 [ print_char_cursor#13 print_sword::w#0 ] ( main:2::print_sword:19 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_sword::w#0 ] ) always clobbers reg byte a 
Statement [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4 [ print_char_cursor#34 ] ( main:2::print_sword:19::print_char:33 [ main::j#2 print_line_cursor#19 print_sword::w#1 print_char_cursor#34 ] main:2::print_sword:19::print_char:39 [ main::j#2 print_line_cursor#19 print_sword::w#1 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:46::print_char:53 [ main::j#2 print_line_cursor#19 print_word::w#0 print_byte::b#2 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:48::print_char:53 [ main::j#2 print_line_cursor#19 print_byte::b#2 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:46::print_char:56 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#34 ] main:2::print_sword:19::print_word:36::print_byte:48::print_char:56 [ main::j#2 print_line_cursor#19 print_char_cursor#34 ] ) always clobbers reg byte y 
Statement [45] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#13 print_word::w#0 print_byte::b#0 ] ( main:2::print_sword:19::print_word:36 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a 
Statement [47] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#13 print_byte::b#1 ] ( main:2::print_sword:19::print_word:36 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::b#1 ] ) always clobbers reg byte a 
Statement [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_char_cursor#13 print_byte::b#2 print_byte::$0 ] ( main:2::print_sword:19::print_word:36::print_byte:46 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#13 print_byte::b#2 print_byte::$0 ] main:2::print_sword:19::print_word:36::print_byte:48 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::b#2 print_byte::$0 ] ) always clobbers reg byte a 
Statement [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#13 print_byte::$2 ] ( main:2::print_sword:19::print_word:36::print_byte:46 [ main::j#2 print_line_cursor#19 print_word::w#0 print_char_cursor#13 print_byte::$2 ] main:2::print_sword:19::print_word:36::print_byte:48 [ main::j#2 print_line_cursor#19 print_char_cursor#13 print_byte::$2 ] ) always clobbers reg byte a 
Statement [63] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#2 ] ( main:2::print_cls:15::memset:59 [ memset::dst#2 ] ) always clobbers reg byte a 
Statement [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0 [ memset::dst#2 ] ( main:2::print_cls:15::memset:59 [ memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Statement [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1 [ sub::s#3 sub::$0 ] ( main:2::sub:7 [ main::i#2 sub::s#3 sub::$0 ] main:2::sub:9 [ main::i#2 sub::s#3 sub::$0 ] main:2::sub:11 [ main::i#2 sub::s#3 sub::$0 ] ) always clobbers reg byte a 
Statement [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3 [ ] ( main:2::sub:7 [ main::i#2 ] main:2::sub:9 [ main::i#2 ] main:2::sub:11 [ main::i#2 ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ main::j#2 main::j#1 ] : zp[1]:3 , reg byte x , 
Potential registers zp[2]:4 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] : zp[2]:4 , 
Potential registers zp[2]:6 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 ] : zp[2]:6 , 
Potential registers zp[1]:8 [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:9 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ] : zp[2]:9 , 
Potential registers zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] : zp[1]:11 , reg byte x , 
Potential registers zp[2]:12 [ memset::dst#2 memset::dst#1 ] : zp[2]:12 , 
Potential registers zp[1]:14 [ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ] : zp[1]:14 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:15 [ sub::s#3 ] : zp[1]:15 , reg byte x , reg byte y , 
Potential registers zp[1]:16 [ main::$8 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:17 [ print_word::w#0 ] : zp[2]:17 , 
Potential registers zp[1]:19 [ print_byte::$0 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:20 [ print_byte::$2 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:21 [ sub::$0 ] : zp[1]:21 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 252.6: zp[2]:4 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] 34.32: zp[2]:9 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ] 
Uplift Scope [sub] 101: zp[1]:14 [ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ] 6: zp[1]:21 [ sub::$0 ] 1: zp[1]:15 [ sub::s#3 ] 
Uplift Scope [main] 24.36: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:16 [ main::$8 ] 16.5: zp[1]:3 [ main::j#2 main::j#1 ] 
Uplift Scope [memset] 36.67: zp[2]:12 [ memset::dst#2 memset::dst#1 ] 
Uplift Scope [print_byte] 10: zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp[1]:19 [ print_byte::$0 ] 4: zp[1]:20 [ print_byte::$2 ] 
Uplift Scope [print_char] 14: zp[1]:8 [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] 
Uplift Scope [print_sword] 10.83: zp[2]:6 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 ] 
Uplift Scope [print_word] 2: zp[2]:17 [ print_word::w#0 ] 
Uplift Scope [RADIX] 
Uplift Scope [print_ln] 
Uplift Scope [print_cls] 

Uplifting [] best 6585 combination zp[2]:4 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] zp[2]:9 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ] 
Uplifting [sub] best 6482 combination reg byte a [ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ] reg byte a [ sub::$0 ] reg byte x [ sub::s#3 ] 
Uplifting [main] best 6222 combination reg byte y [ main::i#2 main::i#1 ] reg byte a [ main::$8 ] reg byte x [ main::j#2 main::j#1 ] 
Uplifting [memset] best 6222 combination zp[2]:12 [ memset::dst#2 memset::dst#1 ] 
Uplifting [print_byte] best 6214 combination zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] 
Uplifting [print_char] best 6199 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] 
Uplifting [print_sword] best 6199 combination zp[2]:6 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 ] 
Uplifting [print_word] best 6199 combination zp[2]:17 [ print_word::w#0 ] 
Uplifting [RADIX] best 6199 combination 
Uplifting [print_ln] best 6199 combination 
Uplifting [print_cls] best 6199 combination 
Attempting to uplift remaining variables inzp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Uplifting [print_byte] best 6199 combination zp[1]:11 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 
Coalescing zero page register [ zp[2]:6 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 ] ] with [ zp[2]:17 [ print_word::w#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:12 [ memset::dst#2 memset::dst#1 ] ] with [ zp[2]:4 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ] ]
Allocated (was zp[2]:6) zp[2]:2 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 print_word::w#0 ]
Allocated (was zp[2]:9) zp[2]:4 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ]
Allocated (was zp[1]:11) zp[1]:6 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Allocated (was zp[2]:12) zp[2]:7 [ memset::dst#2 memset::dst#1 print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests that signed indexed subtract works as intended
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_line_cursor = 7
  .label print_char_cursor = 4
  // @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] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    jmp __b1
    // [5] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  __b1_from___b6:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) sub::idx#0 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [7] call sub 
    // [67] phi from main::@1 to sub [phi:main::@1->sub]
  sub_from___b1:
    // [67] phi (byte) sub::s#3 = (byte) $80 [phi:main::@1->sub#0] -- vbuxx=vbuc1 
    ldx #$80
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#0 [phi:main::@1->sub#1] -- register_copy 
    jsr sub
    jmp __b4
    // main::@4
  __b4:
    // [8] (byte) sub::idx#1 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [9] call sub 
    // [67] phi from main::@4 to sub [phi:main::@4->sub]
  sub_from___b4:
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@4->sub#0] -- vbuxx=vbuc1 
    ldx #$40
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#1 [phi:main::@4->sub#1] -- register_copy 
    jsr sub
    jmp __b5
    // main::@5
  __b5:
    // [10] (byte) sub::idx#2 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [11] call sub 
    // [67] phi from main::@5 to sub [phi:main::@5->sub]
  sub_from___b5:
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@5->sub#0] -- vbuxx=vbuc1 
    ldx #$40
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#2 [phi:main::@5->sub#1] -- register_copy 
    jsr sub
    jmp __b6
    // main::@6
  __b6:
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [13] if((byte) main::i#1!=(byte) 9) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #9
    bne __b1_from___b6
    // [14] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  __b2_from___b6:
    jmp __b2
    // main::@2
  __b2:
    // [15] call print_cls 
    // [58] phi from main::@2 to print_cls [phi:main::@2->print_cls]
  print_cls_from___b2:
    jsr print_cls
    // [16] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  __b3_from___b2:
    // [16] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main::@2->main::@3#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [16] phi (byte*) print_char_cursor#49 = (byte*) 1024 [phi:main::@2->main::@3#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [16] phi (byte) main::j#2 = (byte) 0 [phi:main::@2->main::@3#2] -- vbuxx=vbuc1 
    ldx #0
    jmp __b3
    // main::@3
  __b3:
    // [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8) -- vwsz1=pwsc1_derefidx_vbuaa 
    tay
    lda words,y
    sta.z print_sword.w
    lda words+1,y
    sta.z print_sword.w+1
    // [19] call print_sword 
    jsr print_sword
    // [20] phi from main::@3 to main::@7 [phi:main::@3->main::@7]
  __b7_from___b3:
    jmp __b7
    // main::@7
  __b7:
    // [21] call print_ln 
    // [26] phi from main::@7 to print_ln [phi:main::@7->print_ln]
  print_ln_from___b7:
    jsr print_ln
    jmp __b8
    // main::@8
  __b8:
    // [22] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
    // [23] if((byte) main::j#1!=(byte) 9) goto main::@9 -- vbuxx_neq_vbuc1_then_la1 
    cpx #9
    bne __b9
    jmp __breturn
    // main::@return
  __breturn:
    // [24] return 
    rts
    // main::@9
  __b9:
    // [25] (byte*) print_char_cursor#61 ← (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
    // [16] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
  __b3_from___b9:
    // [16] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@9->main::@3#0] -- register_copy 
    // [16] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#61 [phi:main::@9->main::@3#1] -- register_copy 
    // [16] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@9->main::@3#2] -- register_copy 
    jmp __b3
}
  // print_ln
// Print a newline
print_ln: {
    // [27] 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:
    // [27] 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:
    // [28] (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
  !:
    // [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) 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:
    // [30] return 
    rts
}
  // print_sword
// Print a signed word as HEX
// print_sword(signed word zp(2) w)
print_sword: {
    .label w = 2
    // [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1 -- vwsz1_lt_0_then_la1 
    lda.z w+1
    bmi __b1_from_print_sword
    // [32] phi from print_sword to print_sword::@3 [phi:print_sword->print_sword::@3]
  __b3_from_print_sword:
    jmp __b3
    // print_sword::@3
  __b3:
    // [33] call print_char 
    // [41] phi from print_sword::@3 to print_char [phi:print_sword::@3->print_char]
  print_char_from___b3:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@3->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) ' ' [phi:print_sword::@3->print_char#1] -- vbuaa=vbuc1 
    lda #' '
    jsr print_char
    // [34] phi from print_sword::@3 print_sword::@4 to print_sword::@2 [phi:print_sword::@3/print_sword::@4->print_sword::@2]
  __b2_from___b3:
  __b2_from___b4:
    // [34] phi (signed word) print_sword::w#4 = (signed word) print_sword::w#1 [phi:print_sword::@3/print_sword::@4->print_sword::@2#0] -- register_copy 
    jmp __b2
    // print_sword::@2
  __b2:
    // [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4
    // [36] call print_word 
    jsr print_word
    jmp __breturn
    // print_sword::@return
  __breturn:
    // [37] return 
    rts
    // [38] phi from print_sword to print_sword::@1 [phi:print_sword->print_sword::@1]
  __b1_from_print_sword:
    jmp __b1
    // print_sword::@1
  __b1:
    // [39] call print_char 
    // [41] phi from print_sword::@1 to print_char [phi:print_sword::@1->print_char]
  print_char_from___b1:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) '-' [phi:print_sword::@1->print_char#1] -- vbuaa=vbuc1 
    lda #'-'
    jsr print_char
    jmp __b4
    // print_sword::@4
  __b4:
    // [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1 -- vwsz1=_neg_vwsz1 
    sec
    lda #0
    sbc.z w
    sta.z w
    lda #0
    sbc.z w+1
    sta.z w+1
    jmp __b2_from___b4
}
  // print_char
// Print a single char
// print_char(byte register(A) ch)
print_char: {
    // [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (print_char_cursor),y
    // [43] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#34 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    jmp __breturn
    // print_char::@return
  __breturn:
    // [44] return 
    rts
}
  // print_word
// Print a word as HEX
// print_word(word zp(2) w)
print_word: {
    .label w = 2
    // [45] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 
    lda.z w+1
    sta.z print_byte.b
    // [46] call print_byte 
    // [50] phi from print_word to print_byte [phi:print_word->print_byte]
  print_byte_from_print_word:
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#0] -- register_copy 
    jsr print_byte
    jmp __b1
    // print_word::@1
  __b1:
    // [47] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 
    lda.z w
    sta.z print_byte.b
    // [48] call print_byte 
    // [50] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
  print_byte_from___b1:
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#0] -- register_copy 
    jsr print_byte
    jmp __breturn
    // print_word::@return
  __breturn:
    // [49] return 
    rts
}
  // print_byte
// Print a byte as HEX
// print_byte(byte zp(6) b)
print_byte: {
    .label b = 6
    // [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 
    lda.z b
    lsr
    lsr
    lsr
    lsr
    // [52] (byte) print_char::ch#2 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [53] call print_char 
    // [41] phi from print_byte to print_char [phi:print_byte->print_char]
  print_char_from_print_byte:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#2 [phi:print_byte->print_char#1] -- register_copy 
    jsr print_char
    jmp __b1
    // print_byte::@1
  __b1:
    // [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuaa=vbuz1_band_vbuc1 
    lda #$f
    and.z b
    // [55] (byte) print_char::ch#3 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [56] call print_char 
    // [41] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
  print_char_from___b1:
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#3 [phi:print_byte::@1->print_char#1] -- register_copy 
    jsr print_char
    jmp __breturn
    // print_byte::@return
  __breturn:
    // [57] return 
    rts
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // [59] call memset 
    // [61] phi from print_cls to memset [phi:print_cls->memset]
  memset_from_print_cls:
    jsr memset
    jmp __breturn
    // print_cls::@return
  __breturn:
    // [60] 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 = 7
    // [62] phi from memset to memset::@1 [phi:memset->memset::@1]
  __b1_from_memset:
    // [62] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    jmp __b1
    // memset::@1
  __b1:
    // [63] if((byte*) memset::dst#2!=(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
    jmp __breturn
    // memset::@return
  __breturn:
    // [64] return 
    rts
    // memset::@2
  __b2:
    // [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // [66] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // [62] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
  __b1_from___b2:
    // [62] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy 
    jmp __b1
}
  // sub
// sub(byte register(A) idx, byte register(X) s)
sub: {
    // [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1 -- vbuaa=vbuaa_rol_1 
    asl
    // [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3 -- pwsc1_derefidx_vbuaa=pwsc1_derefidx_vbuaa_minus_vbuxx 
    sec
    stx.z $ff
    tax
    lda words,x
    sbc.z $ff
    sta words,x
    bcs !+
    dec words+1,x
  !:
    jmp __breturn
    // sub::@return
  __breturn:
    // [70] return 
    rts
}
  // File Data
  print_hextab: .text "0123456789abcdef"
  words: .word -$6000, -$600, -$60, -6, 0, 6, $60, $600, $6000

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b4
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b7
Removing instruction jmp __b8
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b3
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b4
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 __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b6 with __b1
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from_print_sword with __b1
Replacing label __b2_from___b4 with __b2
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b6:
Removing instruction __b2_from___b6:
Removing instruction print_cls_from___b2:
Removing instruction __b7_from___b3:
Removing instruction print_ln_from___b7:
Removing instruction __b1_from_print_ln:
Removing instruction __b1_from___b1:
Removing instruction __b3_from_print_sword:
Removing instruction print_char_from___b3:
Removing instruction __b2_from___b3:
Removing instruction __b2_from___b4:
Removing instruction __b1_from_print_sword:
Removing instruction print_char_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction sub_from___b1:
Removing instruction __b4:
Removing instruction sub_from___b4:
Removing instruction __b5:
Removing instruction sub_from___b5:
Removing instruction __b6:
Removing instruction __b2:
Removing instruction __b3_from___b2:
Removing instruction __b7:
Removing instruction __b8:
Removing instruction __breturn:
Removing instruction __b3_from___b9:
Removing instruction __breturn:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __b4:
Removing instruction __breturn:
Removing instruction print_byte_from_print_word:
Removing instruction __b1:
Removing instruction print_byte_from___b1:
Removing instruction __breturn:
Removing instruction print_char_from_print_byte:
Removing instruction __b1:
Removing instruction print_char_from___b1:
Removing instruction __breturn:
Removing instruction memset_from_print_cls:
Removing instruction __breturn:
Removing instruction __b1_from_memset:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
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 __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(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()
(byte~) main::$8 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 7.857142857142857
(byte) main::j
(byte) main::j#1 reg byte x 11.0
(byte) main::j#2 reg byte x 5.5
(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[2]:7 22.0
(byte*) memset::dst#2 dst zp[2]:7 14.666666666666666
(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
(void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0 reg byte a 4.0
(byte~) print_byte::$2 reg byte a 4.0
(label) print_byte::@1
(label) print_byte::@return
(byte) print_byte::b
(byte) print_byte::b#0 b zp[1]:6 4.0
(byte) print_byte::b#1 b zp[1]:6 4.0
(byte) print_byte::b#2 b zp[1]:6 2.0
(void()) print_char((byte) print_char::ch)
(label) print_char::@return
(byte) print_char::ch
(byte) print_char::ch#2 reg byte a 4.0
(byte) print_char::ch#3 reg byte a 4.0
(byte) print_char::ch#4 reg byte a 6.0
(byte*) print_char_cursor
(byte*) print_char_cursor#13 print_char_cursor zp[2]:4 3.821428571428572
(byte*) print_char_cursor#34 print_char_cursor zp[2]:4 6.0
(byte*) print_char_cursor#49 print_char_cursor zp[2]:4 2.5
(byte*) print_char_cursor#61 print_char_cursor zp[2]:4 22.0
(void()) print_cls()
(label) print_cls::@return
(const byte*) print_hextab[]  = (string) "0123456789abcdef"z
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp[2]:7 46.42857142857143
(byte*) print_line_cursor#19 print_line_cursor zp[2]:7 2.1666666666666665
(byte*) print_line_cursor#9 print_line_cursor zp[2]:7 204.0
(void()) print_ln()
(label) print_ln::@1
(label) print_ln::@return
(byte*) print_screen
(void()) print_sword((signed word) print_sword::w)
(label) print_sword::@1
(label) print_sword::@2
(label) print_sword::@3
(label) print_sword::@4
(label) print_sword::@return
(signed word) print_sword::w
(signed word) print_sword::w#0 w zp[2]:2 4.0
(signed word) print_sword::w#1 w zp[2]:2 2.8333333333333335
(signed word) print_sword::w#4 w zp[2]:2 4.0
(void()) print_word((word) print_word::w)
(label) print_word::@1
(label) print_word::@return
(word) print_word::w
(word) print_word::w#0 w zp[2]:2 2.0
(void()) sub((byte) sub::idx , (byte) sub::s)
(byte~) sub::$0 reg byte a 6.0
(label) sub::@return
(byte) sub::idx
(byte) sub::idx#0 reg byte a 22.0
(byte) sub::idx#1 reg byte a 22.0
(byte) sub::idx#2 reg byte a 22.0
(byte) sub::idx#3 reg byte a 35.0
(byte) sub::s
(byte) sub::s#3 reg byte x 1.0
(const signed word*) words[]  = { (signed word) -$6000, (signed word) -$600, (signed word) -$60, (signed word) -6, (signed word) 0, (signed word) 6, (signed word) $60, (signed word) $600, (signed word) $6000 }

reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::j#2 main::j#1 ]
zp[2]:2 [ print_sword::w#4 print_sword::w#0 print_sword::w#1 print_word::w#0 ]
reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ]
zp[2]:4 [ print_char_cursor#34 print_char_cursor#13 print_char_cursor#49 print_char_cursor#61 ]
zp[1]:6 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
zp[2]:7 [ memset::dst#2 memset::dst#1 print_line_cursor#9 print_line_cursor#19 print_line_cursor#1 ]
reg byte a [ sub::idx#3 sub::idx#0 sub::idx#1 sub::idx#2 ]
reg byte x [ sub::s#3 ]
reg byte a [ main::$8 ]
reg byte a [ print_byte::$0 ]
reg byte a [ print_byte::$2 ]
reg byte a [ sub::$0 ]


FINAL ASSEMBLER
Score: 5314

  // File Comments
// Tests that signed indexed subtract works as intended
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_line_cursor = 7
  .label print_char_cursor = 4
  // @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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    // [5] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // sub(i, $80)
    // [6] (byte) sub::idx#0 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [7] call sub 
    // [67] phi from main::@1 to sub [phi:main::@1->sub]
    // [67] phi (byte) sub::s#3 = (byte) $80 [phi:main::@1->sub#0] -- vbuxx=vbuc1 
    ldx #$80
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#0 [phi:main::@1->sub#1] -- register_copy 
    jsr sub
    // main::@4
    // sub(i, $40)
    // [8] (byte) sub::idx#1 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [9] call sub 
    // [67] phi from main::@4 to sub [phi:main::@4->sub]
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@4->sub#0] -- vbuxx=vbuc1 
    ldx #$40
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#1 [phi:main::@4->sub#1] -- register_copy 
    jsr sub
    // main::@5
    // sub(i, $40)
    // [10] (byte) sub::idx#2 ← (byte) main::i#2 -- vbuaa=vbuyy 
    tya
    // [11] call sub 
    // [67] phi from main::@5 to sub [phi:main::@5->sub]
    // [67] phi (byte) sub::s#3 = (byte) $40 [phi:main::@5->sub#0] -- vbuxx=vbuc1 
    ldx #$40
    // [67] phi (byte) sub::idx#3 = (byte) sub::idx#2 [phi:main::@5->sub#1] -- register_copy 
    jsr sub
    // main::@6
    // for(byte i: 0..8)
    // [12] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [13] if((byte) main::i#1!=(byte) 9) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #9
    bne __b1
    // [14] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
    // main::@2
    // print_cls()
    // [15] call print_cls 
    // [58] phi from main::@2 to print_cls [phi:main::@2->print_cls]
    jsr print_cls
    // [16] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
    // [16] phi (byte*) print_line_cursor#19 = (byte*) 1024 [phi:main::@2->main::@3#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [16] phi (byte*) print_char_cursor#49 = (byte*) 1024 [phi:main::@2->main::@3#1] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [16] phi (byte) main::j#2 = (byte) 0 [phi:main::@2->main::@3#2] -- vbuxx=vbuc1 
    ldx #0
    // main::@3
  __b3:
    // print_sword(words[j])
    // [17] (byte~) main::$8 ← (byte) main::j#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [18] (signed word) print_sword::w#1 ← *((const signed word*) words + (byte~) main::$8) -- vwsz1=pwsc1_derefidx_vbuaa 
    tay
    lda words,y
    sta.z print_sword.w
    lda words+1,y
    sta.z print_sword.w+1
    // [19] call print_sword 
    jsr print_sword
    // [20] phi from main::@3 to main::@7 [phi:main::@3->main::@7]
    // main::@7
    // print_ln()
    // [21] call print_ln 
    // [26] phi from main::@7 to print_ln [phi:main::@7->print_ln]
    jsr print_ln
    // main::@8
    // for(byte j: 0..8)
    // [22] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuxx=_inc_vbuxx 
    inx
    // [23] if((byte) main::j#1!=(byte) 9) goto main::@9 -- vbuxx_neq_vbuc1_then_la1 
    cpx #9
    bne __b9
    // main::@return
    // }
    // [24] return 
    rts
    // main::@9
  __b9:
    // [25] (byte*) print_char_cursor#61 ← (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
    // [16] phi from main::@9 to main::@3 [phi:main::@9->main::@3]
    // [16] phi (byte*) print_line_cursor#19 = (byte*) print_line_cursor#1 [phi:main::@9->main::@3#0] -- register_copy 
    // [16] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#61 [phi:main::@9->main::@3#1] -- register_copy 
    // [16] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@9->main::@3#2] -- register_copy 
    jmp __b3
}
  // print_ln
// Print a newline
print_ln: {
    // [27] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
    // [27] 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
    // [28] (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)
    // [29] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#13) 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
    // }
    // [30] return 
    rts
}
  // print_sword
// Print a signed word as HEX
// print_sword(signed word zp(2) w)
print_sword: {
    .label w = 2
    // if(w<0)
    // [31] if((signed word) print_sword::w#1<(signed byte) 0) goto print_sword::@1 -- vwsz1_lt_0_then_la1 
    lda.z w+1
    bmi __b1
    // [32] phi from print_sword to print_sword::@3 [phi:print_sword->print_sword::@3]
    // print_sword::@3
    // print_char(' ')
    // [33] call print_char 
    // [41] phi from print_sword::@3 to print_char [phi:print_sword::@3->print_char]
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@3->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) ' ' [phi:print_sword::@3->print_char#1] -- vbuaa=vbuc1 
    lda #' '
    jsr print_char
    // [34] phi from print_sword::@3 print_sword::@4 to print_sword::@2 [phi:print_sword::@3/print_sword::@4->print_sword::@2]
    // [34] phi (signed word) print_sword::w#4 = (signed word) print_sword::w#1 [phi:print_sword::@3/print_sword::@4->print_sword::@2#0] -- register_copy 
    // print_sword::@2
  __b2:
    // print_word((word)w)
    // [35] (word) print_word::w#0 ← (word)(signed word) print_sword::w#4
    // [36] call print_word 
    jsr print_word
    // print_sword::@return
    // }
    // [37] return 
    rts
    // [38] phi from print_sword to print_sword::@1 [phi:print_sword->print_sword::@1]
    // print_sword::@1
  __b1:
    // print_char('-')
    // [39] call print_char 
    // [41] phi from print_sword::@1 to print_char [phi:print_sword::@1->print_char]
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#49 [phi:print_sword::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) '-' [phi:print_sword::@1->print_char#1] -- vbuaa=vbuc1 
    lda #'-'
    jsr print_char
    // print_sword::@4
    // w = -w
    // [40] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#1 -- vwsz1=_neg_vwsz1 
    sec
    lda #0
    sbc.z w
    sta.z w
    lda #0
    sbc.z w+1
    sta.z w+1
    jmp __b2
}
  // print_char
// Print a single char
// print_char(byte register(A) ch)
print_char: {
    // *(print_char_cursor++) = ch
    // [42] *((byte*) print_char_cursor#34) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (print_char_cursor),y
    // *(print_char_cursor++) = ch;
    // [43] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#34 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // print_char::@return
    // }
    // [44] return 
    rts
}
  // print_word
// Print a word as HEX
// print_word(word zp(2) w)
print_word: {
    .label w = 2
    // print_byte(>w)
    // [45] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 
    lda.z w+1
    sta.z print_byte.b
    // [46] call print_byte 
    // [50] phi from print_word to print_byte [phi:print_word->print_byte]
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#0] -- register_copy 
    jsr print_byte
    // print_word::@1
    // print_byte(<w)
    // [47] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 
    lda.z w
    sta.z print_byte.b
    // [48] call print_byte 
    // [50] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte]
    // [50] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#0] -- register_copy 
    jsr print_byte
    // print_word::@return
    // }
    // [49] return 
    rts
}
  // print_byte
// Print a byte as HEX
// print_byte(byte zp(6) b)
print_byte: {
    .label b = 6
    // b>>4
    // [51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 
    lda.z b
    lsr
    lsr
    lsr
    lsr
    // print_char(print_hextab[b>>4])
    // [52] (byte) print_char::ch#2 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [53] call print_char 
    // [41] phi from print_byte to print_char [phi:print_byte->print_char]
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#2 [phi:print_byte->print_char#1] -- register_copy 
    jsr print_char
    // print_byte::@1
    // b&$f
    // [54] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuaa=vbuz1_band_vbuc1 
    lda #$f
    and.z b
    // print_char(print_hextab[b&$f])
    // [55] (byte) print_char::ch#3 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuaa 
    tay
    lda print_hextab,y
    // [56] call print_char 
    // [41] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char]
    // [41] phi (byte*) print_char_cursor#34 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy 
    // [41] phi (byte) print_char::ch#4 = (byte) print_char::ch#3 [phi:print_byte::@1->print_char#1] -- register_copy 
    jsr print_char
    // print_byte::@return
    // }
    // [57] return 
    rts
}
  // print_cls
// Clear the screen. Also resets current line/char cursor.
print_cls: {
    // memset(print_screen, ' ', 1000)
    // [59] call memset 
    // [61] phi from print_cls to memset [phi:print_cls->memset]
    jsr memset
    // print_cls::@return
    // }
    // [60] 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 = 7
    // [62] phi from memset to memset::@1 [phi:memset->memset::@1]
    // [62] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1 
    lda #<str
    sta.z dst
    lda #>str
    sta.z dst+1
    // memset::@1
  __b1:
    // for(char* dst = str; dst!=end; dst++)
    // [63] if((byte*) memset::dst#2!=(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
    // }
    // [64] return 
    rts
    // memset::@2
  __b2:
    // *dst = c
    // [65] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1 
    lda #c
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [66] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    // [62] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
    // [62] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy 
    jmp __b1
}
  // sub
// sub(byte register(A) idx, byte register(X) s)
sub: {
    // words[idx] -= s
    // [68] (byte~) sub::$0 ← (byte) sub::idx#3 << (byte) 1 -- vbuaa=vbuaa_rol_1 
    asl
    // [69] *((const signed word*) words + (byte~) sub::$0) ← *((const signed word*) words + (byte~) sub::$0) - (byte) sub::s#3 -- pwsc1_derefidx_vbuaa=pwsc1_derefidx_vbuaa_minus_vbuxx 
    sec
    stx.z $ff
    tax
    lda words,x
    sbc.z $ff
    sta words,x
    bcs !+
    dec words+1,x
  !:
    // sub::@return
    // }
    // [70] return 
    rts
}
  // File Data
  print_hextab: .text "0123456789abcdef"
  words: .word -$6000, -$600, -$60, -6, 0, 6, $60, $600, $6000

