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

(void()) main()
main: scope:[main]  from @1
  (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 ← (byte) 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 ← (byte) 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
  *((const byte*) main::screen + (word~) main::$2) ← *((const byte*) main::screen + (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
  *((const byte*) main::screen + (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
(const byte*) main::screen = (byte*)(number) $400

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) $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 (word) main::line#1 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
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) $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 [4] if((word) main::line#10<(word)(number) $28*(number) $18) goto main::@2
Simple Condition (bool~) main::$1 [11] if((byte) main::c#2<(byte) $28) goto main::@5
Simple Condition (bool~) main::$5 [22] if((byte) main::c1#2<(byte) $28) goto main::@14
Successful SSA optimization Pass2ConditionalJumpSimplification
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)   [16] *((const byte*) main::screen + (word~) main::$2) ← *((const byte*) main::screen + (word~) main::$4)
De-inlining pointer[w] to *(pointer+w)   [16] *((const byte*) main::screen + (word~) main::$2) ← *((byte*~) main::$7)
De-inlining pointer[w] to *(pointer+w)   [25] *((const byte*) main::screen + (word~) main::$6) ← (byte) ' '
Successful SSA optimization Pass2DeInlineWordDerefIdx
Eliminating unused constant (const word) main::line#0
Successful SSA optimization PassNEliminateUnusedVars
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
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::@3
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:2 

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

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


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 202.0
(byte) main::c#2 72.14285714285714
(byte) main::c1
(byte) main::c1#1 22.0
(byte) main::c1#2 8.8
(word) main::line
(word) main::line#10 15.375
(word) main::line#2 22.0

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

INITIAL ASM
Target platform is c64basic / MOS6502X
  // 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 = $a
    .label __4 = $c
    .label __6 = 6
    .label c = 5
    .label line = 2
    .label c1 = 4
    .label __7 = $e
    .label __8 = $10
    .label __9 = 8
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (word) main::line#10 = (byte) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    lda #>0
    sta.z line+1
    jmp __b1
    // main::@1
  __b1:
    // [6] 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
  !:
    // [7] phi from main::@1 to main::@5 [phi:main::@1->main::@5]
  __b5_from___b1:
    // [7] phi (byte) main::c1#2 = (byte) 0 [phi:main::@1->main::@5#0] -- vbuz1=vbuc1 
    lda #0
    sta.z c1
    jmp __b5
  // Cleare the bottom line
    // main::@5
  __b5:
    // [8] if((byte) main::c1#2<(byte) $28) goto main::@6 -- vbuz1_lt_vbuc1_then_la1 
    lda.z c1
    cmp #$28
    bcc __b6
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
    // main::@6
  __b6:
    // [10] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c1
    clc
    adc.z line
    sta.z __6
    lda #0
    adc.z line+1
    sta.z __6+1
    // [11] (byte*~) main::$9 ← (const byte*) main::screen + (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
    // [12] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (__9),y
    // [13] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuz1=_inc_vbuz1 
    inc.z c1
    // [7] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
  __b5_from___b6:
    // [7] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (byte) main::c#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z c
    jmp __b2
    // main::@2
  __b2:
    // [15] if((byte) main::c#2<(byte) $28) goto main::@3 -- vbuz1_lt_vbuc1_then_la1 
    lda.z c
    cmp #$28
    bcc __b3
    jmp __b4
    // main::@4
  __b4:
    // [16] (word) main::line#2 ← (word) main::line#10 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [5] phi (word) main::line#10 = (word) main::line#2 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@3
  __b3:
    // [17] (word~) main::$2 ← (word) main::line#10 + (byte) main::c#2 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c
    clc
    adc.z line
    sta.z __2
    lda #0
    adc.z line+1
    sta.z __2+1
    // [18] (word~) main::$4 ← (word) main::line#10 + (byte) main::c#2 -- vwuz1=vwuz2_plus_vbuz3 
    lda.z c
    clc
    adc.z line
    sta.z __4
    lda #0
    adc.z line+1
    sta.z __4+1
    // [19] (byte*~) main::$7 ← (const byte*) main::screen+(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
    // [20] (byte*~) main::$8 ← (const byte*) main::screen + (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
    // [21] *((byte*~) main::$8) ← *((byte*~) main::$7) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (__7),y
    ldy #0
    sta (__8),y
    // [22] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1 
    inc.z c
    // [14] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
  __b2_from___b3:
    // [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@2#0] -- register_copy 
    jmp __b2
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] 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 [10] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#2 [ main::line#10 main::c1#2 main::$6 ] ( main:2 [ main::line#10 main::c1#2 main::$6 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::c1#2 main::c1#1 ]
Statement [11] (byte*~) main::$9 ← (const byte*) main::screen + (word~) main::$6 [ main::line#10 main::c1#2 main::$9 ] ( main:2 [ main::line#10 main::c1#2 main::$9 ] ) always clobbers reg byte a 
Statement [12] *((byte*~) main::$9) ← (byte) ' ' [ main::line#10 main::c1#2 ] ( main:2 [ main::line#10 main::c1#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:4 [ main::c1#2 main::c1#1 ]
Statement [16] (word) main::line#2 ← (word) main::line#10 + (byte) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a 
Statement [17] (word~) main::$2 ← (word) main::line#10 + (byte) main::c#2 [ main::line#10 main::c#2 main::$2 ] ( main:2 [ main::line#10 main::c#2 main::$2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::c#2 main::c#1 ]
Statement [18] (word~) main::$4 ← (word) main::line#10 + (byte) main::c#2 [ main::line#10 main::c#2 main::$2 main::$4 ] ( main:2 [ main::line#10 main::c#2 main::$2 main::$4 ] ) always clobbers reg byte a 
Statement [19] (byte*~) main::$7 ← (const byte*) main::screen+(byte) $28 + (word~) main::$4 [ main::line#10 main::c#2 main::$2 main::$7 ] ( main:2 [ main::line#10 main::c#2 main::$2 main::$7 ] ) always clobbers reg byte a 
Statement [20] (byte*~) main::$8 ← (const byte*) main::screen + (word~) main::$2 [ main::line#10 main::c#2 main::$7 main::$8 ] ( main:2 [ main::line#10 main::c#2 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [21] *((byte*~) main::$8) ← *((byte*~) main::$7) [ main::line#10 main::c#2 ] ( main:2 [ main::line#10 main::c#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:5 [ main::c#2 main::c#1 ]
Statement [6] 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 [10] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#2 [ main::line#10 main::c1#2 main::$6 ] ( main:2 [ main::line#10 main::c1#2 main::$6 ] ) always clobbers reg byte a 
Statement [11] (byte*~) main::$9 ← (const byte*) main::screen + (word~) main::$6 [ main::line#10 main::c1#2 main::$9 ] ( main:2 [ main::line#10 main::c1#2 main::$9 ] ) always clobbers reg byte a 
Statement [12] *((byte*~) main::$9) ← (byte) ' ' [ main::line#10 main::c1#2 ] ( main:2 [ main::line#10 main::c1#2 ] ) always clobbers reg byte a reg byte y 
Statement [16] (word) main::line#2 ← (word) main::line#10 + (byte) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a 
Statement [17] (word~) main::$2 ← (word) main::line#10 + (byte) main::c#2 [ main::line#10 main::c#2 main::$2 ] ( main:2 [ main::line#10 main::c#2 main::$2 ] ) always clobbers reg byte a 
Statement [18] (word~) main::$4 ← (word) main::line#10 + (byte) main::c#2 [ main::line#10 main::c#2 main::$2 main::$4 ] ( main:2 [ main::line#10 main::c#2 main::$2 main::$4 ] ) always clobbers reg byte a 
Statement [19] (byte*~) main::$7 ← (const byte*) main::screen+(byte) $28 + (word~) main::$4 [ main::line#10 main::c#2 main::$2 main::$7 ] ( main:2 [ main::line#10 main::c#2 main::$2 main::$7 ] ) always clobbers reg byte a 
Statement [20] (byte*~) main::$8 ← (const byte*) main::screen + (word~) main::$2 [ main::line#10 main::c#2 main::$7 main::$8 ] ( main:2 [ main::line#10 main::c#2 main::$7 main::$8 ] ) always clobbers reg byte a 
Statement [21] *((byte*~) main::$8) ← *((byte*~) main::$7) [ main::line#10 main::c#2 ] ( main:2 [ main::line#10 main::c#2 ] ) always clobbers reg byte a reg byte y 
Potential registers zp[2]:2 [ main::line#10 main::line#2 ] : zp[2]:2 , 
Potential registers zp[1]:4 [ main::c1#2 main::c1#1 ] : zp[1]:4 , reg byte x , 
Potential registers zp[1]:5 [ main::c#2 main::c#1 ] : zp[1]:5 , reg byte x , 
Potential registers zp[2]:6 [ main::$6 ] : zp[2]:6 , 
Potential registers zp[2]:8 [ main::$9 ] : zp[2]:8 , 
Potential registers zp[2]:10 [ main::$2 ] : zp[2]:10 , 
Potential registers zp[2]:12 [ main::$4 ] : zp[2]:12 , 
Potential registers zp[2]:14 [ main::$7 ] : zp[2]:14 , 
Potential registers zp[2]:16 [ main::$8 ] : zp[2]:16 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 274.14: zp[1]:5 [ main::c#2 main::c#1 ] 202: zp[2]:12 [ main::$4 ] 202: zp[2]:16 [ main::$8 ] 101: zp[2]:14 [ main::$7 ] 67.33: zp[2]:10 [ main::$2 ] 37.38: zp[2]:2 [ main::line#10 main::line#2 ] 30.8: zp[1]:4 [ main::c1#2 main::c1#1 ] 22: zp[2]:6 [ main::$6 ] 22: zp[2]:8 [ main::$9 ] 
Uplift Scope [] 

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

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 = 6
    .label __4 = 8
    .label __6 = 4
    .label line = 2
    .label __7 = 8
    .label __8 = 6
    .label __9 = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (word) main::line#10 = (byte) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    lda #>0
    sta.z line+1
    jmp __b1
    // main::@1
  __b1:
    // [6] 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
  !:
    // [7] phi from main::@1 to main::@5 [phi:main::@1->main::@5]
  __b5_from___b1:
    // [7] phi (byte) main::c1#2 = (byte) 0 [phi:main::@1->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b5
  // Cleare the bottom line
    // main::@5
  __b5:
    // [8] if((byte) main::c1#2<(byte) $28) goto main::@6 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc __b6
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
    // main::@6
  __b6:
    // [10] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z __6
    lda #0
    adc.z line+1
    sta.z __6+1
    // [11] (byte*~) main::$9 ← (const byte*) main::screen + (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
    // [12] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (__9),y
    // [13] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx 
    inx
    // [7] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
  __b5_from___b6:
    // [7] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [14] phi (byte) main::c#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b2
    // main::@2
  __b2:
    // [15] if((byte) main::c#2<(byte) $28) goto main::@3 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc __b3
    jmp __b4
    // main::@4
  __b4:
    // [16] (word) main::line#2 ← (word) main::line#10 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [5] phi (word) main::line#10 = (word) main::line#2 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@3
  __b3:
    // [17] (word~) main::$2 ← (word) main::line#10 + (byte) main::c#2 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z __2
    lda #0
    adc.z line+1
    sta.z __2+1
    // [18] (word~) main::$4 ← (word) main::line#10 + (byte) main::c#2 -- vwuz1=vwuz2_plus_vbuxx 
    txa
    clc
    adc.z line
    sta.z __4
    lda #0
    adc.z line+1
    sta.z __4+1
    // [19] (byte*~) main::$7 ← (const byte*) main::screen+(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
    // [20] (byte*~) main::$8 ← (const byte*) main::screen + (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
    // [21] *((byte*~) main::$8) ← *((byte*~) main::$7) -- _deref_pbuz1=_deref_pbuz2 
    ldy #0
    lda (__7),y
    ldy #0
    sta (__8),y
    // [22] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx 
    inx
    // [14] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
  __b2_from___b3:
    // [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@2#0] -- register_copy 
    jmp __b2
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b5
Removing instruction jmp __breturn
Removing instruction jmp __b2
Removing instruction jmp __b4
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #>0
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction __b5_from___b1:
Removing instruction __breturn:
Removing instruction __b5_from___b6:
Removing instruction __b4:
Removing instruction __b1_from___b4:
Removing instruction __b2_from___b3:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Relabelling long label __b2_from___b1 to b1
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(word~) main::$2 zp[2]:6 67.33333333333333
(word~) main::$4 zp[2]:8 202.0
(word~) main::$6 zp[2]:4 22.0
(byte*~) main::$7 zp[2]:8 101.0
(byte*~) main::$8 zp[2]:6 202.0
(byte*~) main::$9 zp[2]:4 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte) main::c
(byte) main::c#1 reg byte x 202.0
(byte) main::c#2 reg byte x 72.14285714285714
(byte) main::c1
(byte) main::c1#1 reg byte x 22.0
(byte) main::c1#2 reg byte x 8.8
(word) main::line
(word) main::line#10 line zp[2]:2 15.375
(word) main::line#2 line zp[2]:2 22.0
(const byte*) main::screen = (byte*) 1024

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


FINAL ASSEMBLER
Score: 10741

  // 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 = 6
    .label __4 = 8
    .label __6 = 4
    .label line = 2
    .label __7 = 8
    .label __8 = 6
    .label __9 = 4
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (word) main::line#10 = (byte) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 
    lda #<0
    sta.z line
    sta.z line+1
    // main::@1
  __b1:
    // for (line = 0; line < 40*24; line += 40)
    // [6] 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 b1
    bne !+
    lda.z line
    cmp #<$28*$18
    bcc b1
  !:
    // [7] phi from main::@1 to main::@5 [phi:main::@1->main::@5]
    // [7] phi (byte) main::c1#2 = (byte) 0 [phi:main::@1->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
  // Cleare the bottom line
    // main::@5
  __b5:
    // for (byte c=0; c<40; ++c)
    // [8] if((byte) main::c1#2<(byte) $28) goto main::@6 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc __b6
    // main::@return
    // }
    // [9] return 
    rts
    // main::@6
  __b6:
    // line+c
    // [10] (word~) main::$6 ← (word) main::line#10 + (byte) main::c1#2 -- 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] = ' '
    // [11] (byte*~) main::$9 ← (const byte*) main::screen + (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
    // [12] *((byte*~) main::$9) ← (byte) ' ' -- _deref_pbuz1=vbuc1 
    lda #' '
    ldy #0
    sta (__9),y
    // for (byte c=0; c<40; ++c)
    // [13] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx 
    inx
    // [7] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
    // [7] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
    // [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b1:
    // [14] phi (byte) main::c#2 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    // main::@2
  __b2:
    // for (byte c=0; c<40; ++c)
    // [15] if((byte) main::c#2<(byte) $28) goto main::@3 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$28
    bcc __b3
    // main::@4
    // line += 40
    // [16] (word) main::line#2 ← (word) main::line#10 + (byte) $28 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // [5] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [5] phi (word) main::line#10 = (word) main::line#2 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@3
  __b3:
    // line+c
    // [17] (word~) main::$2 ← (word) main::line#10 + (byte) main::c#2 -- 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
    // [18] (word~) main::$4 ← (word) main::line#10 + (byte) main::c#2 -- 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]
    // [19] (byte*~) main::$7 ← (const byte*) main::screen+(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
    // [20] (byte*~) main::$8 ← (const byte*) main::screen + (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
    // [21] *((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)
    // [22] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx 
    inx
    // [14] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
    // [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@2#0] -- register_copy 
    jmp __b2
}
  // File Data

