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

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@12
@12: scope:[]  from @begin
  (byte*) print_screen#0 ← ((byte*)) (number) $400
  (byte*) print_line_cursor#0 ← (byte*) print_screen#0
  (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0
  to:@37
print_str: scope:[print_str]  from main
  (byte*) print_char_cursor#21 ← phi( main/(byte*) print_char_cursor#19 )
  (byte*) print_str::str#4 ← phi( main/(byte*) print_str::str#1 )
  to:print_str::@1
print_str::@1: scope:[print_str]  from print_str print_str::@2
  (byte*) print_char_cursor#17 ← phi( print_str/(byte*) print_char_cursor#21 print_str::@2/(byte*) print_char_cursor#1 )
  (byte*) print_str::str#2 ← phi( print_str/(byte*) print_str::str#4 print_str::@2/(byte*) print_str::str#0 )
  (bool~) print_str::$0 ← (number) 0 != *((byte*) print_str::str#2)
  if((bool~) print_str::$0) goto print_str::@2
  to:print_str::@return
print_str::@2: scope:[print_str]  from print_str::@1
  (byte*) print_char_cursor#9 ← phi( print_str::@1/(byte*) print_char_cursor#17 )
  (byte*) print_str::str#3 ← phi( print_str::@1/(byte*) print_str::str#2 )
  *((byte*) print_char_cursor#9) ← *((byte*) print_str::str#3)
  (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#9
  (byte*) print_str::str#0 ← ++ (byte*) print_str::str#3
  to:print_str::@1
print_str::@return: scope:[print_str]  from print_str::@1
  (byte*) print_char_cursor#10 ← phi( print_str::@1/(byte*) print_char_cursor#17 )
  (byte*) print_char_cursor#2 ← (byte*) print_char_cursor#10
  return 
  to:@return
print_ln: scope:[print_ln]  from main::@1
  (byte*) print_char_cursor#18 ← phi( main::@1/(byte*) print_char_cursor#5 )
  (byte*) print_line_cursor#12 ← phi( main::@1/(byte*) print_line_cursor#13 )
  to:print_ln::@1
print_ln::@1: scope:[print_ln]  from print_ln print_ln::@1
  (byte*) print_char_cursor#11 ← phi( print_ln/(byte*) print_char_cursor#18 print_ln::@1/(byte*) print_char_cursor#11 )
  (byte*) print_line_cursor#6 ← phi( print_ln/(byte*) print_line_cursor#12 print_ln::@1/(byte*) print_line_cursor#1 )
  (byte*~) print_ln::$0 ← (byte*) print_line_cursor#6 + (number) $28
  (byte*) print_line_cursor#1 ← (byte*~) print_ln::$0
  (bool~) print_ln::$1 ← (byte*) print_line_cursor#1 < (byte*) print_char_cursor#11
  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#7 ← phi( print_ln::@1/(byte*) print_line_cursor#1 )
  (byte*) print_char_cursor#3 ← (byte*) print_line_cursor#7
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@2
  (byte*) print_char_cursor#12 ← phi( print_ln::@2/(byte*) print_char_cursor#3 )
  (byte*) print_line_cursor#8 ← phi( print_ln::@2/(byte*) print_line_cursor#7 )
  (byte*) print_line_cursor#2 ← (byte*) print_line_cursor#8
  (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#12
  return 
  to:@return
main: scope:[main]  from @37
  (byte*) print_line_cursor#15 ← phi( @37/(byte*) print_line_cursor#14 )
  (byte*) print_char_cursor#19 ← phi( @37/(byte*) print_char_cursor#20 )
  (byte*) print_str::str#1 ← (const string) main::str
  call print_str 
  to:main::@1
main::@1: scope:[main]  from main
  (byte*) print_line_cursor#13 ← phi( main/(byte*) print_line_cursor#15 )
  (byte*) print_char_cursor#13 ← phi( main/(byte*) print_char_cursor#2 )
  (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#13
  call print_ln 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte*) print_char_cursor#14 ← phi( main::@1/(byte*) print_char_cursor#4 )
  (byte*) print_line_cursor#9 ← phi( main::@1/(byte*) print_line_cursor#2 )
  (byte*) print_line_cursor#3 ← (byte*) print_line_cursor#9
  (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#14
  to:main::@return
main::@return: scope:[main]  from main::@2
  (byte*) print_line_cursor#10 ← phi( main::@2/(byte*) print_line_cursor#3 )
  (byte*) print_char_cursor#15 ← phi( main::@2/(byte*) print_char_cursor#6 )
  (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#15
  (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#10
  return 
  to:@return
@37: scope:[]  from @12
  (byte*) print_line_cursor#14 ← phi( @12/(byte*) print_line_cursor#0 )
  (byte*) print_char_cursor#20 ← phi( @12/(byte*) print_char_cursor#0 )
  call main 
  to:@38
@38: scope:[]  from @37
  (byte*) print_line_cursor#11 ← phi( @37/(byte*) print_line_cursor#4 )
  (byte*) print_char_cursor#16 ← phi( @37/(byte*) print_char_cursor#7 )
  (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#16
  (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#11
  to:@end
@end: scope:[]  from @38

SYMBOL TABLE SSA
(label) @12
(label) @37
(label) @38
(label) @begin
(label) @end
(const byte) RADIX::BINARY = (number) 2
(const byte) RADIX::DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(const string) main::str = (string) "hello world!"
(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#3
(byte*) print_char_cursor#4
(byte*) print_char_cursor#5
(byte*) print_char_cursor#6
(byte*) print_char_cursor#7
(byte*) print_char_cursor#8
(byte*) print_char_cursor#9
(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#2
(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
(void()) print_str((byte*) print_str::str)
(bool~) print_str::$0
(label) print_str::@1
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0
(byte*) print_str::str#1
(byte*) print_str::str#2
(byte*) print_str::str#3
(byte*) print_str::str#4

Adding number conversion cast (unumber) 0 in (bool~) print_str::$0 ← (number) 0 != *((byte*) print_str::str#2)
Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#6 + (number) $28
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte*) print_char_cursor#0 = (byte*) print_line_cursor#0 (byte*) print_screen#0 (byte*) print_char_cursor#20 (byte*) print_line_cursor#14 
Alias (byte*) print_str::str#2 = (byte*) print_str::str#3 
Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#9 (byte*) print_char_cursor#17 (byte*) print_char_cursor#2 
Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#7 (byte*) print_char_cursor#3 (byte*) print_line_cursor#8 (byte*) print_char_cursor#12 (byte*) print_line_cursor#2 (byte*) print_char_cursor#4 
Alias (byte*) print_line_cursor#13 = (byte*) print_line_cursor#15 
Alias (byte*) print_char_cursor#13 = (byte*) print_char_cursor#5 
Alias (byte*) print_line_cursor#10 = (byte*) print_line_cursor#3 (byte*) print_line_cursor#9 (byte*) print_line_cursor#4 
Alias (byte*) print_char_cursor#14 = (byte*) print_char_cursor#6 (byte*) print_char_cursor#15 (byte*) print_char_cursor#7 
Alias (byte*) print_char_cursor#16 = (byte*) print_char_cursor#8 
Alias (byte*) print_line_cursor#11 = (byte*) print_line_cursor#5 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) print_str::str#4 (byte*) print_str::str#1
Identical Phi Values (byte*) print_char_cursor#21 (byte*) print_char_cursor#19
Identical Phi Values (byte*) print_line_cursor#12 (byte*) print_line_cursor#13
Identical Phi Values (byte*) print_char_cursor#18 (byte*) print_char_cursor#13
Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#18
Identical Phi Values (byte*) print_char_cursor#19 (byte*) print_char_cursor#0
Identical Phi Values (byte*) print_line_cursor#13 (byte*) print_char_cursor#0
Identical Phi Values (byte*) print_char_cursor#13 (byte*) print_char_cursor#10
Identical Phi Values (byte*) print_line_cursor#10 (byte*) print_line_cursor#1
Identical Phi Values (byte*) print_char_cursor#14 (byte*) print_line_cursor#1
Identical Phi Values (byte*) print_char_cursor#16 (byte*) print_char_cursor#14
Identical Phi Values (byte*) print_line_cursor#11 (byte*) print_line_cursor#10
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) print_str::$0 [6] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2
Simple Condition (bool~) print_ln::$1 [19] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) print_char_cursor#0 = (byte*) 1024
Constant (const byte*) print_str::str#1 = main::str
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte*) print_str::str#1
Inlining constant with var siblings (const byte*) print_char_cursor#0
Constant inlined print_char_cursor#0 = (byte*) 1024
Constant inlined print_str::str#1 = (const string) main::str
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @12
Adding NOP phi() at start of @37
Adding NOP phi() at start of @38
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of print_ln
Adding NOP phi() at start of print_ln::@2
Adding NOP phi() at start of print_str
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to print_str:7 print_ln:9 

Created 3 initial phi equivalence classes
Coalesced [18] print_line_cursor#16 ← print_line_cursor#1
Coalesced [26] print_str::str#5 ← print_str::str#0
Coalesced [27] print_char_cursor#22 ← print_char_cursor#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @12
Culled Empty Block (label) @38
Culled Empty Block (label) main::@2
Culled Empty Block (label) print_ln::@2
Culled Empty Block (label) print_ln::@3
Renumbering block @37 to @1
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::@1
Adding NOP phi() at start of print_ln
Adding NOP phi() at start of print_str

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()
main: scope:[main]  from @1
  [4] phi()
  [5] call print_str 
  to:main::@1
main::@1: scope:[main]  from main
  [6] phi()
  [7] call print_ln 
  to:main::@return
main::@return: scope:[main]  from main::@1
  [8] return 
  to:@return
print_ln: scope:[print_ln]  from main::@1
  [9] phi()
  to:print_ln::@1
print_ln::@1: scope:[print_ln]  from print_ln print_ln::@1
  [10] (byte*) print_line_cursor#6 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 )
  [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte) $28
  [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1
  to:print_ln::@return
print_ln::@return: scope:[print_ln]  from print_ln::@1
  [13] return 
  to:@return
print_str: scope:[print_str]  from main
  [14] phi()
  to:print_str::@1
print_str::@1: scope:[print_str]  from print_str print_str::@2
  [15] (byte*) print_char_cursor#10 ← phi( print_str/(byte*) 1024 print_str::@2/(byte*) print_char_cursor#1 )
  [15] (byte*) print_str::str#2 ← phi( print_str/(const string) main::str print_str::@2/(byte*) print_str::str#0 )
  [16] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2
  to:print_str::@return
print_str::@return: scope:[print_str]  from print_str::@1
  [17] return 
  to:@return
print_str::@2: scope:[print_str]  from print_str::@1
  [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2)
  [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10
  [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2
  to:print_str::@1


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*) print_char_cursor
(byte*) print_char_cursor#1 11.0
(byte*) print_char_cursor#10 4.4
(byte*) print_line_cursor
(byte*) print_line_cursor#1 16.5
(byte*) print_line_cursor#6 22.0
(void()) print_ln()
(byte*) print_screen
(void()) print_str((byte*) print_str::str)
(byte*) print_str::str
(byte*) print_str::str#0 22.0
(byte*) print_str::str#2 11.0

Initial phi equivalence classes
[ print_line_cursor#6 print_line_cursor#1 ]
[ print_str::str#2 print_str::str#0 ]
[ print_char_cursor#10 print_char_cursor#1 ]
Complete equivalence classes
[ print_line_cursor#6 print_line_cursor#1 ]
[ print_str::str#2 print_str::str#0 ]
[ print_char_cursor#10 print_char_cursor#1 ]
Allocated zp ZP_WORD:2 [ print_line_cursor#6 print_line_cursor#1 ]
Allocated zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ]
Allocated zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ]

INITIAL ASM
Target platform is c64basic
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 6
  .label print_line_cursor = 2
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    // [5] call print_str 
    // [14] phi from main to print_str [phi:main->print_str]
  print_str_from_main:
    jsr print_str
    // [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
    // main::@1
  b1:
    // [7] call print_ln 
    // [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
  print_ln_from_b1:
    jsr print_ln
    jmp breturn
    // main::@return
  breturn:
    // [8] return 
    rts
    str: .text "hello world!"
    .byte 0
}
  // print_ln
// Print a newline
print_ln: {
    // [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
  b1_from_print_ln:
    // [10] phi (byte*) print_line_cursor#6 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    jmp b1
    // [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
  b1_from_b1:
    // [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy 
    jmp b1
    // print_ln::@1
  b1:
    // [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (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
  !:
    // [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) 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:
    // [13] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(4) str)
print_str: {
    .label str = 4
    // [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
    // [15] phi (byte*) print_char_cursor#10 = (byte*) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<main.str
    sta.z str
    lda #>main.str
    sta.z str+1
    jmp b1
    // print_str::@1
  b1:
    // [16] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    jmp breturn
    // print_str::@return
  breturn:
    // [17] return 
    rts
    // print_str::@2
  b2:
    // [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy #0
    sta (print_char_cursor),y
    // [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
    // [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte) $28 [ print_line_cursor#1 print_char_cursor#10 ] ( main:2::print_ln:7 [ print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a 
Statement [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#10 ] ( main:2::print_ln:7 [ print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a 
Statement [16] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 [ print_char_cursor#10 print_str::str#2 ] ( main:2::print_str:5 [ print_char_cursor#10 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Statement [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) [ print_char_cursor#10 print_str::str#2 ] ( main:2::print_str:5 [ print_char_cursor#10 print_str::str#2 ] ) always clobbers reg byte a reg byte y 
Potential registers zp ZP_WORD:2 [ print_line_cursor#6 print_line_cursor#1 ] : zp ZP_WORD:2 , 
Potential registers zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ] : zp ZP_WORD:4 , 
Potential registers zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ] : zp ZP_WORD:6 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 38.5: zp ZP_WORD:2 [ print_line_cursor#6 print_line_cursor#1 ] 15.4: zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ] 
Uplift Scope [print_str] 33: zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ] 
Uplift Scope [RADIX] 
Uplift Scope [print_ln] 
Uplift Scope [main] 

Uplifting [] best 1423 combination zp ZP_WORD:2 [ print_line_cursor#6 print_line_cursor#1 ] zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ] 
Uplifting [print_str] best 1423 combination zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ] 
Uplifting [RADIX] best 1423 combination 
Uplifting [print_ln] best 1423 combination 
Uplifting [main] best 1423 combination 
Coalescing zero page register [ zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ] ] with [ zp ZP_WORD:2 [ print_line_cursor#6 print_line_cursor#1 ] ]
Allocated (was zp ZP_WORD:4) zp ZP_WORD:2 [ print_str::str#2 print_str::str#0 print_line_cursor#6 print_line_cursor#1 ]
Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ print_char_cursor#10 print_char_cursor#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 4
  .label print_line_cursor = 2
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    // [5] call print_str 
    // [14] phi from main to print_str [phi:main->print_str]
  print_str_from_main:
    jsr print_str
    // [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
    // main::@1
  b1:
    // [7] call print_ln 
    // [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
  print_ln_from_b1:
    jsr print_ln
    jmp breturn
    // main::@return
  breturn:
    // [8] return 
    rts
    str: .text "hello world!"
    .byte 0
}
  // print_ln
// Print a newline
print_ln: {
    // [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
  b1_from_print_ln:
    // [10] phi (byte*) print_line_cursor#6 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    jmp b1
    // [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
  b1_from_b1:
    // [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy 
    jmp b1
    // print_ln::@1
  b1:
    // [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (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
  !:
    // [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) 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:
    // [13] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(2) str)
print_str: {
    .label str = 2
    // [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
  b1_from_print_str:
    // [15] phi (byte*) print_char_cursor#10 = (byte*) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<main.str
    sta.z str
    lda #>main.str
    sta.z str+1
    jmp b1
    // print_str::@1
  b1:
    // [16] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    jmp breturn
    // print_str::@return
  breturn:
    // [17] return 
    rts
    // print_str::@2
  b2:
    // [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    ldy #0
    sta (print_char_cursor),y
    // [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
  b1_from_b2:
    // [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_main:
Removing instruction print_ln_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction print_str_from_main:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_print_ln:
Removing instruction breturn:
Removing instruction b1_from_print_str:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) RADIX::BINARY BINARY = (number) 2
(const byte) RADIX::DECIMAL DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL OCTAL = (number) 8
(void()) main()
(label) main::@1
(label) main::@return
(const string) main::str str = (string) "hello world!"
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:4 11.0
(byte*) print_char_cursor#10 print_char_cursor zp ZP_WORD:4 4.4
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp ZP_WORD:2 16.5
(byte*) print_line_cursor#6 print_line_cursor zp ZP_WORD:2 22.0
(void()) print_ln()
(label) print_ln::@1
(label) print_ln::@return
(byte*) print_screen
(void()) print_str((byte*) print_str::str)
(label) print_str::@1
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0 str zp ZP_WORD:2 22.0
(byte*) print_str::str#2 str zp ZP_WORD:2 11.0

zp ZP_WORD:2 [ print_str::str#2 print_str::str#0 print_line_cursor#6 print_line_cursor#1 ]
zp ZP_WORD:4 [ print_char_cursor#10 print_char_cursor#1 ]


FINAL ASSEMBLER
Score: 1235

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label print_char_cursor = 4
  .label print_line_cursor = 2
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    // print_str("hello world!")
    // [5] call print_str 
    // [14] phi from main to print_str [phi:main->print_str]
    jsr print_str
    // [6] phi from main to main::@1 [phi:main->main::@1]
    // main::@1
    // print_ln()
    // [7] call print_ln 
    // [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
    jsr print_ln
    // main::@return
    // }
    // [8] return 
    rts
    str: .text "hello world!"
    .byte 0
}
  // print_ln
// Print a newline
print_ln: {
    // [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
    // [10] phi (byte*) print_line_cursor#6 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_line_cursor
    lda #>$400
    sta.z print_line_cursor+1
    // [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
    // [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy 
    // print_ln::@1
  b1:
    // print_line_cursor + $28
    // [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (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)
    // [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) 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
    // }
    // [13] return 
    rts
}
  // print_str
// Print a zero-terminated string
// print_str(byte* zeropage(2) str)
print_str: {
    .label str = 2
    // [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
    // [15] phi (byte*) print_char_cursor#10 = (byte*) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta.z print_char_cursor
    lda #>$400
    sta.z print_char_cursor+1
    // [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 
    lda #<main.str
    sta.z str
    lda #>main.str
    sta.z str+1
    // print_str::@1
  b1:
    // while(*str)
    // [16] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 
    ldy #0
    lda (str),y
    cmp #0
    bne b2
    // print_str::@return
    // }
    // [17] return 
    rts
    // print_str::@2
  b2:
    // *(print_char_cursor++) = *(str++)
    // [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (str),y
    sta (print_char_cursor),y
    // *(print_char_cursor++) = *(str++);
    // [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1 
    inc.z print_char_cursor
    bne !+
    inc.z print_char_cursor+1
  !:
    // [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 
    inc.z str
    bne !+
    inc.z str+1
  !:
    // [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
    // [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy 
    // [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy 
    jmp b1
}
  // File Data

