Identified constant variable (byte*) main::screen
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@7
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@10
Culled Empty Block (label) main::@16
Culled Empty Block (label) main::@15
Culled Empty Block (label) main::@17
Culled Empty Block (label) main::@18

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1
main: scope:[main]  from @1
  (byte*) main::screen#0 ← ((byte*)) (number) $400
  (word) main::line#0 ← (word) 0
  (word) main::line#1 ← (number) 0
  to:main::@1
main::@1: scope:[main]  from main main::@6
  (word) main::line#3 ← phi( main/(word) main::line#1 main::@6/(word) main::line#2 )
  (bool~) main::$0 ← (word) main::line#3 < (number) $28*(number) $18
  if((bool~) main::$0) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1
  (word) main::line#9 ← phi( main::@1/(word) main::line#3 )
  (byte) main::c#0 ← (number) 0
  to:main::@4
main::@3: scope:[main]  from main::@1
  (word) main::line#10 ← phi( main::@1/(word) main::line#3 )
  (byte) main::c1#0 ← (number) 0
  to:main::@13
main::@4: scope:[main]  from main::@2 main::@5
  (word) main::line#7 ← phi( main::@2/(word) main::line#9 main::@5/(word) main::line#4 )
  (byte) main::c#2 ← phi( main::@2/(byte) main::c#0 main::@5/(byte) main::c#1 )
  (bool~) main::$1 ← (byte) main::c#2 < (number) $28
  if((bool~) main::$1) goto main::@5
  to:main::@6
main::@5: scope:[main]  from main::@4
  (byte) main::c#3 ← phi( main::@4/(byte) main::c#2 )
  (word) main::line#4 ← phi( main::@4/(word) main::line#7 )
  (word~) main::$2 ← (word) main::line#4 + (byte) main::c#3
  (word~) main::$3 ← (word) main::line#4 + (byte) main::c#3
  (number~) main::$4 ← (word~) main::$3 + (number) $28
  *((byte*) main::screen#0 + (word~) main::$2) ← *((byte*) main::screen#0 + (number~) main::$4)
  (byte) main::c#1 ← ++ (byte) main::c#3
  to:main::@4
main::@6: scope:[main]  from main::@4
  (word) main::line#5 ← phi( main::@4/(word) main::line#7 )
  (word) main::line#2 ← (word) main::line#5 + (number) $28
  to:main::@1
main::@13: scope:[main]  from main::@14 main::@3
  (word) main::line#8 ← phi( main::@14/(word) main::line#6 main::@3/(word) main::line#10 )
  (byte) main::c1#2 ← phi( main::@14/(byte) main::c1#1 main::@3/(byte) main::c1#0 )
  (bool~) main::$5 ← (byte) main::c1#2 < (number) $28
  if((bool~) main::$5) goto main::@14
  to:main::@return
main::@14: scope:[main]  from main::@13
  (byte) main::c1#3 ← phi( main::@13/(byte) main::c1#2 )
  (word) main::line#6 ← phi( main::@13/(word) main::line#8 )
  (word~) main::$6 ← (word) main::line#6 + (byte) main::c1#3
  *((byte*) main::screen#0 + (word~) main::$6) ← (byte) ' '
  (byte) main::c1#1 ← ++ (byte) main::c1#3
  to:main::@13
main::@return: scope:[main]  from main::@13
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(void()) main()
(bool~) main::$0
(bool~) main::$1
(word~) main::$2
(word~) main::$3
(number~) main::$4
(bool~) main::$5
(word~) main::$6
(label) main::@1
(label) main::@13
(label) main::@14
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte) main::c
(byte) main::c#0
(byte) main::c#1
(byte) main::c#2
(byte) main::c#3
(byte) main::c1
(byte) main::c1#0
(byte) main::c1#1
(byte) main::c1#2
(byte) main::c1#3
(word) main::line
(word) main::line#0
(word) main::line#1
(word) main::line#10
(word) main::line#2
(word) main::line#3
(word) main::line#4
(word) main::line#5
(word) main::line#6
(word) main::line#7
(word) main::line#8
(word) main::line#9
(byte*) main::screen
(byte*) main::screen#0

Adding number conversion cast (unumber) 0 in (word) main::line#1 ← (number) 0
Adding number conversion cast (unumber) $28*$18 in (bool~) main::$0 ← (word) main::line#3 < (number) $28*(number) $18
Adding number conversion cast (unumber) 0 in (byte) main::c#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) main::c1#0 ← (number) 0
Adding number conversion cast (unumber) $28 in (bool~) main::$1 ← (byte) main::c#2 < (number) $28
Adding number conversion cast (unumber) $28 in (number~) main::$4 ← (word~) main::$3 + (number) $28
Adding number conversion cast (unumber) main::$4 in (number~) main::$4 ← (word~) main::$3 + (unumber)(number) $28
Adding number conversion cast (unumber) $28 in (word) main::line#2 ← (word) main::line#5 + (number) $28
Adding number conversion cast (unumber) $28 in (bool~) main::$5 ← (byte) main::c1#2 < (number) $28
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) main::screen#0 ← (byte*)(number) $400
Inlining cast (word) main::line#1 ← (unumber)(number) 0
Inlining cast (byte) main::c#0 ← (unumber)(number) 0
Inlining cast (byte) main::c1#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $28
Simplifying constant integer cast $28
Simplifying constant integer cast $28
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to word in (unumber~) main::$4 ← (word~) main::$3 + (byte) $28
Alias (word) main::line#10 = (word) main::line#9 (word) main::line#3 
Alias (word) main::line#4 = (word) main::line#7 (word) main::line#5 
Alias (byte) main::c#2 = (byte) main::c#3 
Alias (word) main::line#6 = (word) main::line#8 
Alias (byte) main::c1#2 = (byte) main::c1#3 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (word) main::line#4 (word) main::line#10
Identical Phi Values (word) main::line#6 (word) main::line#10
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$0 [5] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2
Simple Condition (bool~) main::$1 [12] if((byte) main::c#2<(byte) $28) goto main::@5
Simple Condition (bool~) main::$5 [23] if((byte) main::c1#2<(byte) $28) goto main::@14
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) main::screen#0 = (byte*) 1024
Constant (const word) main::line#0 = 0
Constant (const word) main::line#1 = 0
Constant (const byte) main::c#0 = 0
Constant (const byte) main::c1#0 = 0
Successful SSA optimization Pass2ConstantIdentification
De-inlining pointer[w] to *(pointer+w)   [17] *((const byte*) main::screen#0 + (word~) main::$2) ← *((const byte*) main::screen#0 + (word~) main::$4)
De-inlining pointer[w] to *(pointer+w)   [17] *((const byte*) main::screen#0 + (word~) main::$2) ← *((byte*~) main::$7)
De-inlining pointer[w] to *(pointer+w)   [26] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' '
Successful SSA optimization Pass2DeInlineWordDerefIdx
Eliminating unused constant (const word) main::line#0
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization Pass2LoopHeadConstantIdentification
Successful SSA optimization Pass2LoopHeadConstantIdentification
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (word) main::line#10 = (word) main::line#2 
Alias (byte) main::c#1 = (byte) main::c#2 
Alias (word) main::line#11 = (word) main::line#14 
Alias (byte) main::c1#1 = (byte) main::c1#2 
Alias (word) main::line#13 = (word) main::line#16 
Alias (word) main::line#15 = (word) main::line#17 
Alias (word) main::line#18 = (word) main::line#20 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (word) main::line#11 (word) main::line#15
Identical Phi Values (word) main::line#13 (word) main::line#18
Identical Phi Values (byte) main::c#5 (const byte) main::c#0
Identical Phi Values (word) main::line#19 (const word) main::line#1
Identical Phi Values (byte) main::c1#5 (const byte) main::c1#0
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (word) main::line#12 (word) main::line#15
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always true - replacing block destination [27] if((const byte) main::c#0<(byte) $28) goto main::@5
Removing PHI-reference to removed block (main::@1_1) in block main::@3
if() condition always true - replacing block destination [29] if((const word) main::line#1<(word)(number) $28*(number) $18) goto main::@2
if() condition always true - replacing block destination [31] if((const byte) main::c1#0<(byte) $28) goto main::@14
Successful SSA optimization Pass2ConstantIfs
Alias (word) main::line#10 = (word) main::line#18 
Successful SSA optimization Pass2AliasElimination
Inlining constant with var siblings (const word) main::line#1
Inlining constant with var siblings (const byte) main::c#0
Inlining constant with var siblings (const byte) main::c1#0
Constant inlined main::c1#0 = (byte) 0
Constant inlined main::c#0 = (byte) 0
Constant inlined main::line#1 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Consolidated constant in assignment main::$7
Successful SSA optimization Pass2ConstantAdditionElimination
Alias (word~) main::$4 = (word~) main::$3 
Successful SSA optimization Pass2AliasElimination
Added new block during phi lifting main::@19(between main::@1 and main::@2)
Added new block during phi lifting main::@20(between main::@4 and main::@5)
Added new block during phi lifting main::@21(between main::@13 and main::@14)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
Adding NOP phi() at start of main::@4_1
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@13_1
CALL GRAPH
Calls in [] to main:2 

Created 3 initial phi equivalence classes
Coalesced [28] main::c1#6 ← main::c1#1
Coalesced [29] main::line#21 ← main::line#10
Coalesced [30] main::c#6 ← main::c#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@4_1
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@13_1
Culled Empty Block (label) main::@21
Culled Empty Block (label) main::@19
Culled Empty Block (label) main::@20
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@13 to main::@6
Renumbering block main::@14 to main::@7
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

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()
  to:main::@2
main::@2: scope:[main]  from main main::@1
  [5] (word) main::line#15 ← phi( main::@1/(word) main::line#10 main/(byte) 0 )
  to:main::@4
main::@4: scope:[main]  from main::@2 main::@3
  [6] (byte) main::c#4 ← phi( main::@3/(byte) main::c#1 main::@2/(byte) 0 )
  [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4
  [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4
  [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4
  [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2
  [11] *((byte*~) main::$8) ← *((byte*~) main::$7)
  [12] (byte) main::c#1 ← ++ (byte) main::c#4
  to:main::@3
main::@3: scope:[main]  from main::@4
  [13] if((byte) main::c#1<(byte) $28) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@3
  [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28
  to:main::@1
main::@1: scope:[main]  from main::@5
  [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2
  to:main::@7
main::@7: scope:[main]  from main::@1 main::@6
  [16] (byte) main::c1#4 ← phi( main::@6/(byte) main::c1#1 main::@1/(byte) 0 )
  [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4
  [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6
  [19] *((byte*~) main::$9) ← (byte) ' '
  [20] (byte) main::c1#1 ← ++ (byte) main::c1#4
  to:main::@6
main::@6: scope:[main]  from main::@7
  [21] if((byte) main::c1#1<(byte) $28) goto main::@7
  to:main::@return
main::@return: scope:[main]  from main::@6
  [22] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(word~) main::$2 67.33333333333333
(word~) main::$4 202.0
(word~) main::$6 22.0
(byte*~) main::$7 101.0
(byte*~) main::$8 202.0
(byte*~) main::$9 22.0
(byte) main::c
(byte) main::c#1 151.5
(byte) main::c#4 67.33333333333333
(byte) main::c1
(byte) main::c1#1 16.5
(byte) main::c1#4 8.25
(word) main::line
(word) main::line#10 5.5
(word) main::line#15 24.888888888888886
(byte*) main::screen

Initial phi equivalence classes
[ main::line#15 main::line#10 ]
[ main::c#4 main::c#1 ]
[ main::c1#4 main::c1#1 ]
Added variable main::$2 to zero page equivalence class [ main::$2 ]
Added variable main::$4 to zero page equivalence class [ main::$4 ]
Added variable main::$7 to zero page equivalence class [ main::$7 ]
Added variable main::$8 to zero page equivalence class [ main::$8 ]
Added variable main::$6 to zero page equivalence class [ main::$6 ]
Added variable main::$9 to zero page equivalence class [ main::$9 ]
Complete equivalence classes
[ main::line#15 main::line#10 ]
[ main::c#4 main::c#1 ]
[ main::c1#4 main::c1#1 ]
[ main::$2 ]
[ main::$4 ]
[ main::$7 ]
[ main::$8 ]
[ main::$6 ]
[ main::$9 ]
Allocated zp ZP_WORD:2 [ main::line#15 main::line#10 ]
Allocated zp ZP_BYTE:4 [ main::c#4 main::c#1 ]
Allocated zp ZP_BYTE:5 [ main::c1#4 main::c1#1 ]
Allocated zp ZP_WORD:6 [ main::$2 ]
Allocated zp ZP_WORD:8 [ main::$4 ]
Allocated zp ZP_WORD:10 [ main::$7 ]
Allocated zp ZP_WORD:12 [ main::$8 ]
Allocated zp ZP_WORD:14 [ main::$6 ]
Allocated zp ZP_WORD:16 [ main::$9 ]

INITIAL ASM
Target platform is c64basic
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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 screen = $400
    .label _2 = 6
    .label _4 = 8
    .label _6 = $e
    .label c = 4
    .label c1 = 5
    .label line = 2
    .label _7 = $a
    .label _8 = $c
    .label _9 = $10
    // [5] phi from main to main::@2 [phi:main->main::@2]
  b2_from_main:
    // [5] phi (word) main::line#15 = (byte) 0 [phi:main->main::@2#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    lda #>0
    sta.z line+1
    jmp b2
    // [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    // [5] phi (word) main::line#15 = (word) main::line#10 [phi:main::@1->main::@2#0] -- register_copy 
    jmp b2
    // main::@2
  b2:
    // [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
  b4_from_b2:
    // [6] phi (byte) main::c#4 = (byte) 0 [phi:main::@2->main::@4#0] -- vbuz1=vbuc1 
    lda #0
    sta.z c
    jmp b4
    // [6] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  b4_from_b3:
    // [6] phi (byte) main::c#4 = (byte) main::c#1 [phi:main::@3->main::@4#0] -- register_copy 
    jmp b4
    // main::@4
  b4:
    // [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c
    clc
    adc.z line
    sta.z _2
    lda #0
    adc.z line+1
    sta.z _2+1
    // [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c
    clc
    adc.z line
    sta.z _4
    lda #0
    adc.z line+1
    sta.z _4+1
    // [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z _4
    clc
    adc #<screen+$28
    sta.z _7
    lda.z _4+1
    adc #>screen+$28
    sta.z _7+1
    // [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z _2
    clc
    adc #<screen
    sta.z _8
    lda.z _2+1
    adc #>screen
    sta.z _8+1
    // [11] *((byte*~) main::$8) ← *((byte*~) main::$7) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (_7),y
    ldy #0
    sta (_8),y
    // [12] (byte) main::c#1 ← ++ (byte) main::c#4 -- vbuz1=_inc_vbuz1 
    inc.z c
    jmp b3
    // main::@3
  b3:
    // [13] if((byte) main::c#1<(byte) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1 
    lda.z c
    cmp #$28
    bcc b4_from_b3
    jmp b5
    // main::@5
  b5:
    // [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    jmp b1
    // main::@1
  b1:
    // [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2 -- vwuz1_lt_vwuc1_then_la1 
    lda.z line+1
    cmp #>$28*$18
    bcc b2_from_b1
    bne !+
    lda.z line
    cmp #<$28*$18
    bcc b2_from_b1
  !:
    // [16] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
  b7_from_b1:
    // [16] phi (byte) main::c1#4 = (byte) 0 [phi:main::@1->main::@7#0] -- vbuz1=vbuc1 
    lda #0
    sta.z c1
    jmp b7
    // [16] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
  b7_from_b6:
    // [16] phi (byte) main::c1#4 = (byte) main::c1#1 [phi:main::@6->main::@7#0] -- register_copy 
    jmp b7
    // main::@7
  b7:
    // [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c1
    clc
    adc.z line
    sta.z _6
    lda #0
    adc.z line+1
    sta.z _6+1
    // [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z _6
    clc
    adc #<screen
    sta.z _9
    lda.z _6+1
    adc #>screen
    sta.z _9+1
    // [19] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (_9),y
    // [20] (byte) main::c1#1 ← ++ (byte) main::c1#4 -- vbuz1=_inc_vbuz1 
    inc.z c1
    jmp b6
  // Cleare the bottom line
    // main::@6
  b6:
    // [21] if((byte) main::c1#1<(byte) $28) goto main::@7 -- vbuz1_lt_vbuc1_then_la1 
    lda.z c1
    cmp #$28
    bcc b7_from_b6
    jmp breturn
    // main::@return
  breturn:
    // [22] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4 [ main::line#15 main::c#4 main::$2 ] ( main:2 [ main::line#15 main::c#4 main::$2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::c#4 main::c#1 ]
Statement [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4 [ main::line#15 main::c#4 main::$2 main::$4 ] ( main:2 [ main::line#15 main::c#4 main::$2 main::$4 ] ) always clobbers reg byte a 
Statement [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4 [ main::line#15 main::c#4 main::$2 main::$7 ] ( main:2 [ main::line#15 main::c#4 main::$2 main::$7 ] ) always clobbers reg byte a 
Statement [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2 [ main::line#15 main::c#4 main::$7 main::$8 ] ( main:2 [ main::line#15 main::c#4 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [11] *((byte*~) main::$8) ← *((byte*~) main::$7) [ main::line#15 main::c#4 ] ( main:2 [ main::line#15 main::c#4 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ main::c#4 main::c#1 ]
Statement [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28 [ main::line#10 ] ( main:2 [ main::line#10 ] ) always clobbers reg byte a 
Statement [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2 [ main::line#10 ] ( main:2 [ main::line#10 ] ) always clobbers reg byte a 
Statement [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4 [ main::line#10 main::c1#4 main::$6 ] ( main:2 [ main::line#10 main::c1#4 main::$6 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::c1#4 main::c1#1 ]
Statement [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6 [ main::line#10 main::c1#4 main::$9 ] ( main:2 [ main::line#10 main::c1#4 main::$9 ] ) always clobbers reg byte a 
Statement [19] *((byte*~) main::$9) ← (byte) ' ' [ main::line#10 main::c1#4 ] ( main:2 [ main::line#10 main::c1#4 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::c1#4 main::c1#1 ]
Statement [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4 [ main::line#15 main::c#4 main::$2 ] ( main:2 [ main::line#15 main::c#4 main::$2 ] ) always clobbers reg byte a 
Statement [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4 [ main::line#15 main::c#4 main::$2 main::$4 ] ( main:2 [ main::line#15 main::c#4 main::$2 main::$4 ] ) always clobbers reg byte a 
Statement [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4 [ main::line#15 main::c#4 main::$2 main::$7 ] ( main:2 [ main::line#15 main::c#4 main::$2 main::$7 ] ) always clobbers reg byte a 
Statement [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2 [ main::line#15 main::c#4 main::$7 main::$8 ] ( main:2 [ main::line#15 main::c#4 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [11] *((byte*~) main::$8) ← *((byte*~) main::$7) [ main::line#15 main::c#4 ] ( main:2 [ main::line#15 main::c#4 ] ) always clobbers reg byte a reg byte y 
Statement [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28 [ main::line#10 ] ( main:2 [ main::line#10 ] ) always clobbers reg byte a 
Statement [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2 [ main::line#10 ] ( main:2 [ main::line#10 ] ) always clobbers reg byte a 
Statement [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4 [ main::line#10 main::c1#4 main::$6 ] ( main:2 [ main::line#10 main::c1#4 main::$6 ] ) always clobbers reg byte a 
Statement [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6 [ main::line#10 main::c1#4 main::$9 ] ( main:2 [ main::line#10 main::c1#4 main::$9 ] ) always clobbers reg byte a 
Statement [19] *((byte*~) main::$9) ← (byte) ' ' [ main::line#10 main::c1#4 ] ( main:2 [ main::line#10 main::c1#4 ] ) always clobbers reg byte a reg byte y 
Potential registers zp ZP_WORD:2 [ main::line#15 main::line#10 ] : zp ZP_WORD:2 , 
Potential registers zp ZP_BYTE:4 [ main::c#4 main::c#1 ] : zp ZP_BYTE:4 , reg byte x , 
Potential registers zp ZP_BYTE:5 [ main::c1#4 main::c1#1 ] : zp ZP_BYTE:5 , reg byte x , 
Potential registers zp ZP_WORD:6 [ main::$2 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_WORD:8 [ main::$4 ] : zp ZP_WORD:8 , 
Potential registers zp ZP_WORD:10 [ main::$7 ] : zp ZP_WORD:10 , 
Potential registers zp ZP_WORD:12 [ main::$8 ] : zp ZP_WORD:12 , 
Potential registers zp ZP_WORD:14 [ main::$6 ] : zp ZP_WORD:14 , 
Potential registers zp ZP_WORD:16 [ main::$9 ] : zp ZP_WORD:16 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 218.83: zp ZP_BYTE:4 [ main::c#4 main::c#1 ] 202: zp ZP_WORD:8 [ main::$4 ] 202: zp ZP_WORD:12 [ main::$8 ] 101: zp ZP_WORD:10 [ main::$7 ] 67.33: zp ZP_WORD:6 [ main::$2 ] 30.39: zp ZP_WORD:2 [ main::line#15 main::line#10 ] 24.75: zp ZP_BYTE:5 [ main::c1#4 main::c1#1 ] 22: zp ZP_WORD:14 [ main::$6 ] 22: zp ZP_WORD:16 [ main::$9 ] 
Uplift Scope [] 

Uplifting [main] best 12023 combination reg byte x [ main::c#4 main::c#1 ] zp ZP_WORD:8 [ main::$4 ] zp ZP_WORD:12 [ main::$8 ] zp ZP_WORD:10 [ main::$7 ] zp ZP_WORD:6 [ main::$2 ] zp ZP_WORD:2 [ main::line#15 main::line#10 ] reg byte x [ main::c1#4 main::c1#1 ] zp ZP_WORD:14 [ main::$6 ] zp ZP_WORD:16 [ main::$9 ] 
Uplifting [] best 12023 combination 
Coalescing zero page register [ zp ZP_WORD:6 [ main::$2 ] ] with [ zp ZP_WORD:12 [ main::$8 ] ] - score: 1
Coalescing zero page register [ zp ZP_WORD:8 [ main::$4 ] ] with [ zp ZP_WORD:10 [ main::$7 ] ] - score: 1
Coalescing zero page register [ zp ZP_WORD:14 [ main::$6 ] ] with [ zp ZP_WORD:16 [ main::$9 ] ] - score: 1
Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ main::$2 main::$8 ]
Allocated (was zp ZP_WORD:8) zp ZP_WORD:6 [ main::$4 main::$7 ]
Allocated (was zp ZP_WORD:14) zp ZP_WORD:8 [ main::$6 main::$9 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @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 screen = $400
    .label _2 = 4
    .label _4 = 6
    .label _6 = 8
    .label line = 2
    .label _7 = 6
    .label _8 = 4
    .label _9 = 8
    // [5] phi from main to main::@2 [phi:main->main::@2]
  b2_from_main:
    // [5] phi (word) main::line#15 = (byte) 0 [phi:main->main::@2#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    lda #>0
    sta.z line+1
    jmp b2
    // [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    // [5] phi (word) main::line#15 = (word) main::line#10 [phi:main::@1->main::@2#0] -- register_copy 
    jmp b2
    // main::@2
  b2:
    // [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
  b4_from_b2:
    // [6] phi (byte) main::c#4 = (byte) 0 [phi:main::@2->main::@4#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b4
    // [6] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  b4_from_b3:
    // [6] phi (byte) main::c#4 = (byte) main::c#1 [phi:main::@3->main::@4#0] -- register_copy 
    jmp b4
    // main::@4
  b4:
    // [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _2
    lda #0
    adc.z line+1
    sta.z _2+1
    // [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _4
    lda #0
    adc.z line+1
    sta.z _4+1
    // [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _7
    adc #<screen+$28
    sta.z _7
    lda.z _7+1
    adc #>screen+$28
    sta.z _7+1
    // [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _8
    adc #<screen
    sta.z _8
    lda.z _8+1
    adc #>screen
    sta.z _8+1
    // [11] *((byte*~) main::$8) ← *((byte*~) main::$7) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (_7),y
    ldy #0
    sta (_8),y
    // [12] (byte) main::c#1 ← ++ (byte) main::c#4 -- vbuxx=_inc_vbuxx 
    inx
    jmp b3
    // main::@3
  b3:
    // [13] if((byte) main::c#1<(byte) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc b4_from_b3
    jmp b5
    // main::@5
  b5:
    // [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    jmp b1
    // main::@1
  b1:
    // [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2 -- vwuz1_lt_vwuc1_then_la1 
    lda.z line+1
    cmp #>$28*$18
    bcc b2_from_b1
    bne !+
    lda.z line
    cmp #<$28*$18
    bcc b2_from_b1
  !:
    // [16] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
  b7_from_b1:
    // [16] phi (byte) main::c1#4 = (byte) 0 [phi:main::@1->main::@7#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b7
    // [16] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
  b7_from_b6:
    // [16] phi (byte) main::c1#4 = (byte) main::c1#1 [phi:main::@6->main::@7#0] -- register_copy 
    jmp b7
    // main::@7
  b7:
    // [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _6
    lda #0
    adc.z line+1
    sta.z _6+1
    // [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _9
    adc #<screen
    sta.z _9
    lda.z _9+1
    adc #>screen
    sta.z _9+1
    // [19] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (_9),y
    // [20] (byte) main::c1#1 ← ++ (byte) main::c1#4 -- vbuxx=_inc_vbuxx 
    inx
    jmp b6
  // Cleare the bottom line
    // main::@6
  b6:
    // [21] if((byte) main::c1#1<(byte) $28) goto main::@7 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc b7_from_b6
    jmp breturn
    // main::@return
  breturn:
    // [22] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b2
Removing instruction jmp b4
Removing instruction jmp b3
Removing instruction jmp b5
Removing instruction jmp b1
Removing instruction jmp b7
Removing instruction jmp b6
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #>0
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b4_from_b3 with b4
Replacing label b2_from_b1 with b2
Replacing label b2_from_b1 with b2
Replacing label b7_from_b6 with b7
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b2_from_b1:
Removing instruction b4_from_b2:
Removing instruction b4_from_b3:
Removing instruction b7_from_b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b2_from_main:
Removing instruction b3:
Removing instruction b5:
Removing instruction b1:
Removing instruction b7_from_b1:
Removing instruction b6:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b2
Removing instruction jmp b4
Removing instruction jmp b7
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(word~) main::$2 $2 zp ZP_WORD:4 67.33333333333333
(word~) main::$4 $4 zp ZP_WORD:6 202.0
(word~) main::$6 $6 zp ZP_WORD:8 22.0
(byte*~) main::$7 $7 zp ZP_WORD:6 101.0
(byte*~) main::$8 $8 zp ZP_WORD:4 202.0
(byte*~) main::$9 $9 zp ZP_WORD:8 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::@return
(byte) main::c
(byte) main::c#1 reg byte x 151.5
(byte) main::c#4 reg byte x 67.33333333333333
(byte) main::c1
(byte) main::c1#1 reg byte x 16.5
(byte) main::c1#4 reg byte x 8.25
(word) main::line
(word) main::line#10 line zp ZP_WORD:2 5.5
(word) main::line#15 line zp ZP_WORD:2 24.888888888888886
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024

zp ZP_WORD:2 [ main::line#15 main::line#10 ]
reg byte x [ main::c#4 main::c#1 ]
reg byte x [ main::c1#4 main::c1#1 ]
zp ZP_WORD:4 [ main::$2 main::$8 ]
zp ZP_WORD:6 [ main::$4 main::$7 ]
zp ZP_WORD:8 [ main::$6 main::$9 ]


FINAL ASSEMBLER
Score: 10381

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @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: {
    .label screen = $400
    .label _2 = 4
    .label _4 = 6
    .label _6 = 8
    .label line = 2
    .label _7 = 6
    .label _8 = 4
    .label _9 = 8
    // [5] phi from main to main::@2 [phi:main->main::@2]
    // [5] phi (word) main::line#15 = (byte) 0 [phi:main->main::@2#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    sta.z line+1
    // [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [5] phi (word) main::line#15 = (word) main::line#10 [phi:main::@1->main::@2#0] -- register_copy 
    // main::@2
  b2:
    // [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
    // [6] phi (byte) main::c#4 = (byte) 0 [phi:main::@2->main::@4#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // [6] phi (byte) main::c#4 = (byte) main::c#1 [phi:main::@3->main::@4#0] -- register_copy 
    // main::@4
  b4:
    // line+c
    // [7] (word~) main::$2 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _2
    lda #0
    adc.z line+1
    sta.z _2+1
    // line+c+40
    // [8] (word~) main::$4 ← (word) main::line#15 + (byte) main::c#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _4
    lda #0
    adc.z line+1
    sta.z _4+1
    // screen[line+c] = screen[line+c+40]
    // [9] (byte*~) main::$7 ← (const byte*) main::screen#0+(byte) $28 + (word~) main::$4 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _7
    adc #<screen+$28
    sta.z _7
    lda.z _7+1
    adc #>screen+$28
    sta.z _7+1
    // [10] (byte*~) main::$8 ← (const byte*) main::screen#0 + (word~) main::$2 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _8
    adc #<screen
    sta.z _8
    lda.z _8+1
    adc #>screen
    sta.z _8+1
    // [11] *((byte*~) main::$8) ← *((byte*~) main::$7) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (_7),y
    sta (_8),y
    // for (byte c=0; c<40; ++c)
    // [12] (byte) main::c#1 ← ++ (byte) main::c#4 -- vbuxx=_inc_vbuxx 
    inx
    // main::@3
    // [13] if((byte) main::c#1<(byte) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc b4
    // main::@5
    // line += 40
    // [14] (word) main::line#10 ← (word) main::line#15 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // main::@1
    // for (line = 0; line < 40*24; line += 40)
    // [15] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2 -- vwuz1_lt_vwuc1_then_la1 
    lda.z line+1
    cmp #>$28*$18
    bcc b2
    bne !+
    lda.z line
    cmp #<$28*$18
    bcc b2
  !:
    // [16] phi from main::@1 to main::@7 [phi:main::@1->main::@7]
    // [16] phi (byte) main::c1#4 = (byte) 0 [phi:main::@1->main::@7#0] -- vbuxx=vbuc1 
    ldx #0
    // [16] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
    // [16] phi (byte) main::c1#4 = (byte) main::c1#1 [phi:main::@6->main::@7#0] -- register_copy 
    // main::@7
  b7:
    // line+c
    // [17] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#4 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z _6
    lda #0
    adc.z line+1
    sta.z _6+1
    // screen[line+c] = ' '
    // [18] (byte*~) main::$9 ← (const byte*) main::screen#0 + (word~) main::$6 -- pbuz1=pbuc1_plus_vwuz1 
    clc
    lda.z _9
    adc #<screen
    sta.z _9
    lda.z _9+1
    adc #>screen
    sta.z _9+1
    // [19] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (_9),y
    // for (byte c=0; c<40; ++c)
    // [20] (byte) main::c1#1 ← ++ (byte) main::c1#4 -- vbuxx=_inc_vbuxx 
    inx
  // Cleare the bottom line
    // main::@6
    // [21] if((byte) main::c1#1<(byte) $28) goto main::@7 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc b7
    // main::@return
    // }
    // [22] return 
    rts
}
  // File Data

