
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1
main: scope:[main]  from @1
  (byte*) main::SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte) main::a#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (byte*) main::SCREEN#1 ← phi( main/(byte*) main::SCREEN#0 main::@1/(byte*) main::SCREEN#1 )
  (byte) main::a#2 ← phi( main/(byte) main::a#0 main::@1/(byte) main::a#1 )
  *((byte*) main::SCREEN#1 + (byte) main::a#2) ← (byte) main::a#2
  (byte) main::a#1 ← ++ (byte) main::a#2
  (bool~) main::$0 ← (byte) main::a#1 < (byte/signed byte/word/signed word/dword/signed dword) 14
  unroll if((bool~) main::$0) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte*) main::SCREEN#2 ← phi( main::@1/(byte*) main::SCREEN#1 )
  (byte) main::a#3 ← phi( main::@1/(byte) main::a#1 )
  *((byte*) main::SCREEN#2 + (byte) main::a#3) ← (byte) main::a#3
  to:main::@return
main::@return: scope:[main]  from main::@2
  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
(label) main::@1
(label) main::@2
(label) main::@return
(byte*) main::SCREEN
(byte*) main::SCREEN#0
(byte*) main::SCREEN#1
(byte*) main::SCREEN#2
(byte) main::a
(byte) main::a#0
(byte) main::a#1
(byte) main::a#2
(byte) main::a#3

Culled Empty Block (label) @2
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte) main::a#1 = (byte) main::a#3 
Alias (byte*) main::SCREEN#1 = (byte*) main::SCREEN#2 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) main::SCREEN#1
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) main::SCREEN#1 (byte*) main::SCREEN#0
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$0 [6] unroll if((byte) main::a#1<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) main::SCREEN#0 = ((byte*))1024
Constant (const byte) main::a#0 = 3
Successful SSA optimization Pass2ConstantIdentification
Creating PHI for main::a#1 in block main::@2 - (byte) main::a#4 ← phi( main::@1/(byte) main::a#1 )
Unrolling loop Loop head: main::@1 tails: main::@1 blocks: main::@1 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#2 (const byte) main::a#0
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#1 = ++main::a#0
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#0)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1) in block main::@2
if() condition always true - replacing block destination [1] if((const byte) main::a#1<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_1
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#4 = (byte) main::a#6 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#4 in block main::@2 - (byte) main::a#7 ← phi( main::@1_1/(byte) main::a#4 )
Unrolling loop Loop head: main::@1_1 tails: main::@1_1 blocks: main::@1_1 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#5 (const byte) main::a#1
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#4 = ++main::a#1
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#1)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always true - replacing block destination [3] if((const byte) main::a#4<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_2
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#7 = (byte) main::a#9 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#7 in block main::@2 - (byte) main::a#10 ← phi( main::@1_2/(byte) main::a#7 )
Unrolling loop Loop head: main::@1_2 tails: main::@1_2 blocks: main::@1_2 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#8 (const byte) main::a#4
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#7 = ++main::a#4
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#4)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_2) in block main::@2
if() condition always true - replacing block destination [4] if((const byte) main::a#7<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_3
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#10 = (byte) main::a#12 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#10 in block main::@2 - (byte) main::a#13 ← phi( main::@1_3/(byte) main::a#10 )
Unrolling loop Loop head: main::@1_3 tails: main::@1_3 blocks: main::@1_3 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#11 (const byte) main::a#7
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#10 = ++main::a#7
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#7)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_3) in block main::@2
if() condition always true - replacing block destination [5] if((const byte) main::a#10<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_4
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#13 = (byte) main::a#15 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#13 in block main::@2 - (byte) main::a#16 ← phi( main::@1_4/(byte) main::a#13 )
Unrolling loop Loop head: main::@1_4 tails: main::@1_4 blocks: main::@1_4 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#14 (const byte) main::a#10
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#13 = ++main::a#10
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#10)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_4) in block main::@2
if() condition always true - replacing block destination [6] if((const byte) main::a#13<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_5
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#16 = (byte) main::a#18 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#16 in block main::@2 - (byte) main::a#19 ← phi( main::@1_5/(byte) main::a#16 )
Unrolling loop Loop head: main::@1_5 tails: main::@1_5 blocks: main::@1_5 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#17 (const byte) main::a#13
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#16 = ++main::a#13
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#13)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_5) in block main::@2
if() condition always true - replacing block destination [7] if((const byte) main::a#16<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_6
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#19 = (byte) main::a#21 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#19 in block main::@2 - (byte) main::a#22 ← phi( main::@1_6/(byte) main::a#19 )
Unrolling loop Loop head: main::@1_6 tails: main::@1_6 blocks: main::@1_6 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#20 (const byte) main::a#16
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#19 = ++main::a#16
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#16)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_6) in block main::@2
if() condition always true - replacing block destination [8] if((const byte) main::a#19<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_7
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#22 = (byte) main::a#24 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#22 in block main::@2 - (byte) main::a#25 ← phi( main::@1_7/(byte) main::a#22 )
Unrolling loop Loop head: main::@1_7 tails: main::@1_7 blocks: main::@1_7 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#23 (const byte) main::a#19
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#22 = ++main::a#19
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#19)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_7) in block main::@2
if() condition always true - replacing block destination [9] if((const byte) main::a#22<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_8
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#25 = (byte) main::a#27 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#25 in block main::@2 - (byte) main::a#28 ← phi( main::@1_8/(byte) main::a#25 )
Unrolling loop Loop head: main::@1_8 tails: main::@1_8 blocks: main::@1_8 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#26 (const byte) main::a#22
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#25 = ++main::a#22
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#22)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_8) in block main::@2
if() condition always true - replacing block destination [10] if((const byte) main::a#25<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_9
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#28 = (byte) main::a#30 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#28 in block main::@2 - (byte) main::a#31 ← phi( main::@1_9/(byte) main::a#28 )
Unrolling loop Loop head: main::@1_9 tails: main::@1_9 blocks: main::@1_9 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#29 (const byte) main::a#25
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#28 = ++main::a#25
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#25)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_9) in block main::@2
if() condition always true - replacing block destination [11] if((const byte) main::a#28<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_10
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#31 = (byte) main::a#33 
Successful SSA optimization Pass2AliasElimination
Creating PHI for main::a#31 in block main::@2 - (byte) main::a#34 ← phi( main::@1_10/(byte) main::a#31 )
Unrolling loop Loop head: main::@1_10 tails: main::@1_10 blocks: main::@1_10 
Successful SSA optimization Pass2LoopUnroll
Redundant Phi (byte) main::a#32 (const byte) main::a#28
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte) main::a#31 = ++main::a#28
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+main::a#28)
Successful SSA optimization Pass2ConstantAdditionElimination
Removing PHI-reference to removed block (main::@1_10) in block main::@1_11
if() condition always false - eliminating [12] if((const byte) main::a#31<(byte/signed byte/word/signed word/dword/signed dword) 14) goto main::@1_11
Successful SSA optimization Pass2ConstantIfs
Eliminating variable (byte) main::a#35 from unused block main::@1_11
Eliminating variable (byte) main::a#36 from unused block main::@1_11
Removing PHI-reference to removed block (main::@1_11) in block main::@2
Removing unused block main::@1_11
Successful SSA optimization Pass2EliminateUnusedBlocks
Redundant Phi (byte) main::a#34 (const byte) main::a#31
Successful SSA optimization Pass2RedundantPhiElimination
Consolidated array index constant in *(main::SCREEN#0+main::a#31)
Successful SSA optimization Pass2ConstantAdditionElimination
Inlining constant with different constant siblings (const byte) main::a#0
Inlining constant with different constant siblings (const byte) main::a#1
Inlining constant with different constant siblings (const byte) main::a#4
Inlining constant with different constant siblings (const byte) main::a#7
Inlining constant with different constant siblings (const byte) main::a#10
Inlining constant with different constant siblings (const byte) main::a#13
Inlining constant with different constant siblings (const byte) main::a#16
Inlining constant with different constant siblings (const byte) main::a#19
Inlining constant with different constant siblings (const byte) main::a#22
Inlining constant with different constant siblings (const byte) main::a#25
Inlining constant with different constant siblings (const byte) main::a#28
Inlining constant with different constant siblings (const byte) main::a#31
Constant inlined main::a#22 = ++++++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#10 = ++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#31 = ++++++++++++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#25 = ++++++++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#13 = ++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#0 = (byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#19 = ++++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#28 = ++++++++++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#1 = ++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#16 = ++++++++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#7 = ++++++(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined main::a#4 = ++++(byte/signed byte/word/signed word/dword/signed dword) 3
Successful SSA optimization Pass2ConstantInlining
Simplifying constant integer increment ++3
Simplifying constant integer increment ++3
Simplifying constant integer increment ++3
Simplifying constant integer increment ++4
Simplifying constant integer increment ++4
Simplifying constant integer increment ++5
Simplifying constant integer increment ++5
Simplifying constant integer increment ++6
Simplifying constant integer increment ++6
Simplifying constant integer increment ++7
Simplifying constant integer increment ++7
Simplifying constant integer increment ++8
Simplifying constant integer increment ++8
Simplifying constant integer increment ++9
Simplifying constant integer increment ++9
Simplifying constant integer increment ++10
Simplifying constant integer increment ++10
Simplifying constant integer increment ++11
Simplifying constant integer increment ++11
Simplifying constant integer increment ++12
Simplifying constant integer increment ++12
Simplifying constant integer increment ++13
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++4
Simplifying constant integer increment ++5
Simplifying constant integer increment ++6
Simplifying constant integer increment ++7
Simplifying constant integer increment ++8
Simplifying constant integer increment ++9
Simplifying constant integer increment ++10
Simplifying constant integer increment ++11
Simplifying constant integer increment ++12
Simplifying constant integer increment ++13
Successful SSA optimization Pass2ConstantSimplification
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
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
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::@1
main::@1: scope:[main]  from main
  [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 3
  to:main::@1_1
main::@1_1: scope:[main]  from main::@1
  [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte/signed byte/word/signed word/dword/signed dword) 4
  to:main::@1_2
main::@1_2: scope:[main]  from main::@1_1
  [7] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (byte/signed byte/word/signed word/dword/signed dword) 5
  to:main::@1_3
main::@1_3: scope:[main]  from main::@1_2
  [8] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte/signed byte/word/signed word/dword/signed dword) 6
  to:main::@1_4
main::@1_4: scope:[main]  from main::@1_3
  [9] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (byte/signed byte/word/signed word/dword/signed dword) 7
  to:main::@1_5
main::@1_5: scope:[main]  from main::@1_4
  [10] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (byte/signed byte/word/signed word/dword/signed dword) 8
  to:main::@1_6
main::@1_6: scope:[main]  from main::@1_5
  [11] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 9) ← (byte/signed byte/word/signed word/dword/signed dword) 9
  to:main::@1_7
main::@1_7: scope:[main]  from main::@1_6
  [12] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 10) ← (byte/signed byte/word/signed word/dword/signed dword) 10
  to:main::@1_8
main::@1_8: scope:[main]  from main::@1_7
  [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 11) ← (byte/signed byte/word/signed word/dword/signed dword) 11
  to:main::@1_9
main::@1_9: scope:[main]  from main::@1_8
  [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 12) ← (byte/signed byte/word/signed word/dword/signed dword) 12
  to:main::@1_10
main::@1_10: scope:[main]  from main::@1_9
  [15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 13) ← (byte/signed byte/word/signed word/dword/signed dword) 13
  to:main::@2
main::@2: scope:[main]  from main::@1_10
  [16] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 14) ← (byte/signed byte/word/signed word/dword/signed dword) 14
  to:main::@return
main::@return: scope:[main]  from main::@2
  [17] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*) main::SCREEN
(byte) main::a

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
//SEG0 File Comments
// An unrolled loop modifying a var used later
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label SCREEN = $400
    jmp b1
  //SEG11 main::@1
  b1:
  //SEG12 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta SCREEN+3
    jmp b1_1
  //SEG13 main::@1_1
  b1_1:
  //SEG14 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte/signed byte/word/signed word/dword/signed dword) 4 -- _deref_pbuc1=vbuc2 
    lda #4
    sta SCREEN+4
    jmp b1_2
  //SEG15 main::@1_2
  b1_2:
  //SEG16 [7] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2 
    lda #5
    sta SCREEN+5
    jmp b1_3
  //SEG17 main::@1_3
  b1_3:
  //SEG18 [8] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte/signed byte/word/signed word/dword/signed dword) 6 -- _deref_pbuc1=vbuc2 
    lda #6
    sta SCREEN+6
    jmp b1_4
  //SEG19 main::@1_4
  b1_4:
  //SEG20 [9] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (byte/signed byte/word/signed word/dword/signed dword) 7 -- _deref_pbuc1=vbuc2 
    lda #7
    sta SCREEN+7
    jmp b1_5
  //SEG21 main::@1_5
  b1_5:
  //SEG22 [10] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- _deref_pbuc1=vbuc2 
    lda #8
    sta SCREEN+8
    jmp b1_6
  //SEG23 main::@1_6
  b1_6:
  //SEG24 [11] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 9) ← (byte/signed byte/word/signed word/dword/signed dword) 9 -- _deref_pbuc1=vbuc2 
    lda #9
    sta SCREEN+9
    jmp b1_7
  //SEG25 main::@1_7
  b1_7:
  //SEG26 [12] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 10) ← (byte/signed byte/word/signed word/dword/signed dword) 10 -- _deref_pbuc1=vbuc2 
    lda #$a
    sta SCREEN+$a
    jmp b1_8
  //SEG27 main::@1_8
  b1_8:
  //SEG28 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 11) ← (byte/signed byte/word/signed word/dword/signed dword) 11 -- _deref_pbuc1=vbuc2 
    lda #$b
    sta SCREEN+$b
    jmp b1_9
  //SEG29 main::@1_9
  b1_9:
  //SEG30 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 12) ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- _deref_pbuc1=vbuc2 
    lda #$c
    sta SCREEN+$c
    jmp b1_10
  //SEG31 main::@1_10
  b1_10:
  //SEG32 [15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 13) ← (byte/signed byte/word/signed word/dword/signed dword) 13 -- _deref_pbuc1=vbuc2 
    lda #$d
    sta SCREEN+$d
    jmp b2
  //SEG33 main::@2
  b2:
  //SEG34 [16] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 14) ← (byte/signed byte/word/signed word/dword/signed dword) 14 -- _deref_pbuc1=vbuc2 
    lda #$e
    sta SCREEN+$e
    jmp breturn
  //SEG35 main::@return
  breturn:
  //SEG36 [17] return 
    rts
}

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte/signed byte/word/signed word/dword/signed dword) 4 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (byte/signed byte/word/signed word/dword/signed dword) 5 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte/signed byte/word/signed word/dword/signed dword) 6 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [9] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (byte/signed byte/word/signed word/dword/signed dword) 7 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (byte/signed byte/word/signed word/dword/signed dword) 8 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [11] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 9) ← (byte/signed byte/word/signed word/dword/signed dword) 9 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [12] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 10) ← (byte/signed byte/word/signed word/dword/signed dword) 10 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 11) ← (byte/signed byte/word/signed word/dword/signed dword) 11 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 12) ← (byte/signed byte/word/signed word/dword/signed dword) 12 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 13) ← (byte/signed byte/word/signed word/dword/signed dword) 13 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [16] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 14) ← (byte/signed byte/word/signed word/dword/signed dword) 14 [ ] ( main:2 [ ] ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [main] best 156 combination 
Uplifting [] best 156 combination 

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// An unrolled loop modifying a var used later
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label SCREEN = $400
    jmp b1
  //SEG11 main::@1
  b1:
  //SEG12 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta SCREEN+3
    jmp b1_1
  //SEG13 main::@1_1
  b1_1:
  //SEG14 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte/signed byte/word/signed word/dword/signed dword) 4 -- _deref_pbuc1=vbuc2 
    lda #4
    sta SCREEN+4
    jmp b1_2
  //SEG15 main::@1_2
  b1_2:
  //SEG16 [7] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2 
    lda #5
    sta SCREEN+5
    jmp b1_3
  //SEG17 main::@1_3
  b1_3:
  //SEG18 [8] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte/signed byte/word/signed word/dword/signed dword) 6 -- _deref_pbuc1=vbuc2 
    lda #6
    sta SCREEN+6
    jmp b1_4
  //SEG19 main::@1_4
  b1_4:
  //SEG20 [9] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (byte/signed byte/word/signed word/dword/signed dword) 7 -- _deref_pbuc1=vbuc2 
    lda #7
    sta SCREEN+7
    jmp b1_5
  //SEG21 main::@1_5
  b1_5:
  //SEG22 [10] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- _deref_pbuc1=vbuc2 
    lda #8
    sta SCREEN+8
    jmp b1_6
  //SEG23 main::@1_6
  b1_6:
  //SEG24 [11] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 9) ← (byte/signed byte/word/signed word/dword/signed dword) 9 -- _deref_pbuc1=vbuc2 
    lda #9
    sta SCREEN+9
    jmp b1_7
  //SEG25 main::@1_7
  b1_7:
  //SEG26 [12] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 10) ← (byte/signed byte/word/signed word/dword/signed dword) 10 -- _deref_pbuc1=vbuc2 
    lda #$a
    sta SCREEN+$a
    jmp b1_8
  //SEG27 main::@1_8
  b1_8:
  //SEG28 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 11) ← (byte/signed byte/word/signed word/dword/signed dword) 11 -- _deref_pbuc1=vbuc2 
    lda #$b
    sta SCREEN+$b
    jmp b1_9
  //SEG29 main::@1_9
  b1_9:
  //SEG30 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 12) ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- _deref_pbuc1=vbuc2 
    lda #$c
    sta SCREEN+$c
    jmp b1_10
  //SEG31 main::@1_10
  b1_10:
  //SEG32 [15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 13) ← (byte/signed byte/word/signed word/dword/signed dword) 13 -- _deref_pbuc1=vbuc2 
    lda #$d
    sta SCREEN+$d
    jmp b2
  //SEG33 main::@2
  b2:
  //SEG34 [16] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 14) ← (byte/signed byte/word/signed word/dword/signed dword) 14 -- _deref_pbuc1=vbuc2 
    lda #$e
    sta SCREEN+$e
    jmp breturn
  //SEG35 main::@return
  breturn:
  //SEG36 [17] return 
    rts
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b1_1
Removing instruction jmp b1_2
Removing instruction jmp b1_3
Removing instruction jmp b1_4
Removing instruction jmp b1_5
Removing instruction jmp b1_6
Removing instruction jmp b1_7
Removing instruction jmp b1_8
Removing instruction jmp b1_9
Removing instruction jmp b1_10
Removing instruction jmp b2
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1:
Removing instruction b1_1:
Removing instruction b1_2:
Removing instruction b1_3:
Removing instruction b1_4:
Removing instruction b1_5:
Removing instruction b1_6:
Removing instruction b1_7:
Removing instruction b1_8:
Removing instruction b1_9:
Removing instruction b1_10:
Removing instruction b2:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@1_1
(label) main::@1_10
(label) main::@1_2
(label) main::@1_3
(label) main::@1_4
(label) main::@1_5
(label) main::@1_6
(label) main::@1_7
(label) main::@1_8
(label) main::@1_9
(label) main::@2
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte) main::a



FINAL ASSEMBLER
Score: 78

//SEG0 File Comments
// An unrolled loop modifying a var used later
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
    .label SCREEN = $400
  //SEG11 main::@1
  //SEG12 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta SCREEN+3
  //SEG13 main::@1_1
  //SEG14 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte/signed byte/word/signed word/dword/signed dword) 4 -- _deref_pbuc1=vbuc2 
    lda #4
    sta SCREEN+4
  //SEG15 main::@1_2
  //SEG16 [7] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2 
    lda #5
    sta SCREEN+5
  //SEG17 main::@1_3
  //SEG18 [8] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte/signed byte/word/signed word/dword/signed dword) 6 -- _deref_pbuc1=vbuc2 
    lda #6
    sta SCREEN+6
  //SEG19 main::@1_4
  //SEG20 [9] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (byte/signed byte/word/signed word/dword/signed dword) 7 -- _deref_pbuc1=vbuc2 
    lda #7
    sta SCREEN+7
  //SEG21 main::@1_5
  //SEG22 [10] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- _deref_pbuc1=vbuc2 
    lda #8
    sta SCREEN+8
  //SEG23 main::@1_6
  //SEG24 [11] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 9) ← (byte/signed byte/word/signed word/dword/signed dword) 9 -- _deref_pbuc1=vbuc2 
    lda #9
    sta SCREEN+9
  //SEG25 main::@1_7
  //SEG26 [12] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 10) ← (byte/signed byte/word/signed word/dword/signed dword) 10 -- _deref_pbuc1=vbuc2 
    lda #$a
    sta SCREEN+$a
  //SEG27 main::@1_8
  //SEG28 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 11) ← (byte/signed byte/word/signed word/dword/signed dword) 11 -- _deref_pbuc1=vbuc2 
    lda #$b
    sta SCREEN+$b
  //SEG29 main::@1_9
  //SEG30 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 12) ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- _deref_pbuc1=vbuc2 
    lda #$c
    sta SCREEN+$c
  //SEG31 main::@1_10
  //SEG32 [15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 13) ← (byte/signed byte/word/signed word/dword/signed dword) 13 -- _deref_pbuc1=vbuc2 
    lda #$d
    sta SCREEN+$d
  //SEG33 main::@2
  //SEG34 [16] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 14) ← (byte/signed byte/word/signed word/dword/signed dword) 14 -- _deref_pbuc1=vbuc2 
    lda #$e
    sta SCREEN+$e
  //SEG35 main::@return
  //SEG36 [17] return 
    rts
}

