
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@5
main: scope:[main]  from @5
  call lvalue 
  to:main::@1
main::@1: scope:[main]  from main
  call rvalue 
  to:main::@2
main::@2: scope:[main]  from main::@1
  call rvaluevar 
  to:main::@3
main::@3: scope:[main]  from main::@2
  call lvaluevar 
  to:main::@4
main::@4: scope:[main]  from main::@3
  to:main::@return
main::@return: scope:[main]  from main::@4
  return 
  to:@return
lvalue: scope:[lvalue]  from main
  (byte[1024]) lvalue::SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  *((byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte[1024]) lvalue::SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) lvalue::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  to:lvalue::@1
lvalue::@1: scope:[lvalue]  from lvalue lvalue::@2
  (byte) lvalue::i#2 ← phi( lvalue/(byte) lvalue::i#0 lvalue::@2/(byte) lvalue::i#1 )
  (bool~) lvalue::$0 ← (byte) lvalue::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10
  if((bool~) lvalue::$0) goto lvalue::@2
  to:lvalue::@return
lvalue::@2: scope:[lvalue]  from lvalue::@1
  (byte) lvalue::i#3 ← phi( lvalue::@1/(byte) lvalue::i#2 )
  *((byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#3) ← (byte/signed byte/word/signed word/dword/signed dword) 3
  (byte) lvalue::i#1 ← ++ (byte) lvalue::i#3
  to:lvalue::@1
lvalue::@return: scope:[lvalue]  from lvalue::@1
  return 
  to:@return
rvalue: scope:[rvalue]  from main::@1
  (byte[1024]) rvalue::SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte) rvalue::b#0 ← *((byte[1024]) rvalue::SCREEN#0)
  (byte) rvalue::b#1 ← *((byte[1024]) rvalue::SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) 1)
  (byte) rvalue::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  to:rvalue::@1
rvalue::@1: scope:[rvalue]  from rvalue rvalue::@2
  (byte) rvalue::i#2 ← phi( rvalue/(byte) rvalue::i#0 rvalue::@2/(byte) rvalue::i#1 )
  (bool~) rvalue::$0 ← (byte) rvalue::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10
  if((bool~) rvalue::$0) goto rvalue::@2
  to:rvalue::@return
rvalue::@2: scope:[rvalue]  from rvalue::@1
  (byte) rvalue::i#3 ← phi( rvalue::@1/(byte) rvalue::i#2 )
  (byte) rvalue::b#2 ← *((byte[1024]) rvalue::SCREEN#0 + (byte) rvalue::i#3)
  (byte) rvalue::i#1 ← ++ (byte) rvalue::i#3
  to:rvalue::@1
rvalue::@return: scope:[rvalue]  from rvalue::@1
  return 
  to:@return
lvaluevar: scope:[lvaluevar]  from main::@3
  (byte*) lvaluevar::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte) lvaluevar::b#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
  (byte) lvaluevar::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  to:lvaluevar::@1
lvaluevar::@1: scope:[lvaluevar]  from lvaluevar lvaluevar::@2
  (byte*) lvaluevar::screen#3 ← phi( lvaluevar/(byte*) lvaluevar::screen#0 lvaluevar::@2/(byte*) lvaluevar::screen#1 )
  (byte) lvaluevar::b#2 ← phi( lvaluevar/(byte) lvaluevar::b#0 lvaluevar::@2/(byte) lvaluevar::b#1 )
  (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) lvaluevar::i#0 lvaluevar::@2/(byte) lvaluevar::i#1 )
  (bool~) lvaluevar::$0 ← (byte) lvaluevar::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10
  if((bool~) lvaluevar::$0) goto lvaluevar::@2
  to:lvaluevar::@return
lvaluevar::@2: scope:[lvaluevar]  from lvaluevar::@1
  (byte) lvaluevar::i#3 ← phi( lvaluevar::@1/(byte) lvaluevar::i#2 )
  (byte*) lvaluevar::screen#2 ← phi( lvaluevar::@1/(byte*) lvaluevar::screen#3 )
  (byte) lvaluevar::b#1 ← phi( lvaluevar::@1/(byte) lvaluevar::b#2 )
  *((byte*) lvaluevar::screen#2) ← (byte) lvaluevar::b#1
  (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2
  (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#3
  to:lvaluevar::@1
lvaluevar::@return: scope:[lvaluevar]  from lvaluevar::@1
  return 
  to:@return
rvaluevar: scope:[rvaluevar]  from main::@2
  (byte*) rvaluevar::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte) rvaluevar::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  to:rvaluevar::@1
rvaluevar::@1: scope:[rvaluevar]  from rvaluevar rvaluevar::@2
  (byte*) rvaluevar::screen#3 ← phi( rvaluevar/(byte*) rvaluevar::screen#0 rvaluevar::@2/(byte*) rvaluevar::screen#1 )
  (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) rvaluevar::i#0 rvaluevar::@2/(byte) rvaluevar::i#1 )
  (bool~) rvaluevar::$0 ← (byte) rvaluevar::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10
  if((bool~) rvaluevar::$0) goto rvaluevar::@2
  to:rvaluevar::@return
rvaluevar::@2: scope:[rvaluevar]  from rvaluevar::@1
  (byte) rvaluevar::i#3 ← phi( rvaluevar::@1/(byte) rvaluevar::i#2 )
  (byte*) rvaluevar::screen#2 ← phi( rvaluevar::@1/(byte*) rvaluevar::screen#3 )
  (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2)
  (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2
  (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#3
  to:rvaluevar::@1
rvaluevar::@return: scope:[rvaluevar]  from rvaluevar::@1
  return 
  to:@return
@5: scope:[]  from @begin
  call main 
  to:@6
@6: scope:[]  from @5
  to:@end
@end: scope:[]  from @6

SYMBOL TABLE SSA
(label) @5
(label) @6
(label) @begin
(label) @end
(void()) lvalue()
(bool~) lvalue::$0
(label) lvalue::@1
(label) lvalue::@2
(label) lvalue::@return
(byte[1024]) lvalue::SCREEN
(byte[1024]) lvalue::SCREEN#0
(byte) lvalue::i
(byte) lvalue::i#0
(byte) lvalue::i#1
(byte) lvalue::i#2
(byte) lvalue::i#3
(void()) lvaluevar()
(bool~) lvaluevar::$0
(label) lvaluevar::@1
(label) lvaluevar::@2
(label) lvaluevar::@return
(byte) lvaluevar::b
(byte) lvaluevar::b#0
(byte) lvaluevar::b#1
(byte) lvaluevar::b#2
(byte) lvaluevar::i
(byte) lvaluevar::i#0
(byte) lvaluevar::i#1
(byte) lvaluevar::i#2
(byte) lvaluevar::i#3
(byte*) lvaluevar::screen
(byte*) lvaluevar::screen#0
(byte*) lvaluevar::screen#1
(byte*) lvaluevar::screen#2
(byte*) lvaluevar::screen#3
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(void()) rvalue()
(bool~) rvalue::$0
(label) rvalue::@1
(label) rvalue::@2
(label) rvalue::@return
(byte[1024]) rvalue::SCREEN
(byte[1024]) rvalue::SCREEN#0
(byte) rvalue::b
(byte) rvalue::b#0
(byte) rvalue::b#1
(byte) rvalue::b#2
(byte) rvalue::i
(byte) rvalue::i#0
(byte) rvalue::i#1
(byte) rvalue::i#2
(byte) rvalue::i#3
(void()) rvaluevar()
(bool~) rvaluevar::$0
(label) rvaluevar::@1
(label) rvaluevar::@2
(label) rvaluevar::@return
(byte) rvaluevar::b
(byte) rvaluevar::b#0
(byte) rvaluevar::i
(byte) rvaluevar::i#0
(byte) rvaluevar::i#1
(byte) rvaluevar::i#2
(byte) rvaluevar::i#3
(byte*) rvaluevar::screen
(byte*) rvaluevar::screen#0
(byte*) rvaluevar::screen#1
(byte*) rvaluevar::screen#2
(byte*) rvaluevar::screen#3

Culled Empty Block (label) main::@4
Culled Empty Block (label) @6
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte) lvalue::i#2 = (byte) lvalue::i#3 
Alias (byte) rvalue::i#2 = (byte) rvalue::i#3 
Alias (byte) lvaluevar::b#1 = (byte) lvaluevar::b#2 
Alias (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#3 
Alias (byte) lvaluevar::i#2 = (byte) lvaluevar::i#3 
Alias (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#3 
Alias (byte) rvaluevar::i#2 = (byte) rvaluevar::i#3 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte) lvaluevar::b#1
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte) lvaluevar::b#1 (byte) lvaluevar::b#0
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) lvalue::$0 [11] if((byte) lvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvalue::@2
Simple Condition (bool~) rvalue::$0 [22] if((byte) rvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvalue::@2
Simple Condition (bool~) lvaluevar::$0 [32] if((byte) lvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvaluevar::@2
Simple Condition (bool~) rvaluevar::$0 [42] if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvaluevar::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte[1024]) lvalue::SCREEN#0 = ((byte*))1024
Constant (const byte) lvalue::i#0 = 2
Constant (const byte[1024]) rvalue::SCREEN#0 = ((byte*))1024
Constant (const byte) rvalue::i#0 = 2
Constant (const byte*) lvaluevar::screen#0 = ((byte*))1024
Constant (const byte) lvaluevar::b#0 = 4
Constant (const byte) lvaluevar::i#0 = 2
Constant (const byte*) rvaluevar::screen#0 = ((byte*))1024
Constant (const byte) rvaluevar::i#0 = 2
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(lvalue::SCREEN#0+1)
Consolidated array index constant in *(rvalue::SCREEN#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Inlining constant with var siblings (const byte) lvalue::i#0
Inlining constant with var siblings (const byte) rvalue::i#0
Inlining constant with var siblings (const byte*) lvaluevar::screen#0
Inlining constant with var siblings (const byte) lvaluevar::i#0
Inlining constant with var siblings (const byte*) rvaluevar::screen#0
Inlining constant with var siblings (const byte) rvaluevar::i#0
Constant inlined lvalue::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined rvaluevar::screen#0 = ((byte*))(word/signed word/dword/signed dword) 1024
Constant inlined rvalue::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined lvaluevar::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined lvaluevar::screen#0 = ((byte*))(word/signed word/dword/signed dword) 1024
Constant inlined rvaluevar::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 2
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @5
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of lvaluevar
Adding NOP phi() at start of rvaluevar
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to lvalue:5 rvalue:7 rvaluevar:9 lvaluevar:11 

Created 6 initial phi equivalence classes
Coalesced [20] lvaluevar::i#4 ← lvaluevar::i#1
Coalesced [21] lvaluevar::screen#4 ← lvaluevar::screen#1
Coalesced [29] rvaluevar::i#4 ← rvaluevar::i#1
Coalesced [30] rvaluevar::screen#4 ← rvaluevar::screen#1
Coalesced [38] rvalue::i#4 ← rvalue::i#1
Coalesced [46] lvalue::i#4 ← lvalue::i#1
Coalesced down to 6 phi equivalence classes
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @5
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of lvaluevar
Adding NOP phi() at start of rvaluevar

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@5
@5: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @5
  [3] phi()
main: scope:[main]  from @5
  [4] phi()
  [5] call lvalue 
  to:main::@1
main::@1: scope:[main]  from main
  [6] phi()
  [7] call rvalue 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [8] phi()
  [9] call rvaluevar 
  to:main::@3
main::@3: scope:[main]  from main::@2
  [10] phi()
  [11] call lvaluevar 
  to:main::@return
main::@return: scope:[main]  from main::@3
  [12] return 
  to:@return
lvaluevar: scope:[lvaluevar]  from main::@3
  [13] phi()
  to:lvaluevar::@1
lvaluevar::@1: scope:[lvaluevar]  from lvaluevar lvaluevar::@2
  [14] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/((byte*))(word/signed word/dword/signed dword) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 )
  [14] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte/signed byte/word/signed word/dword/signed dword) 2 lvaluevar::@2/(byte) lvaluevar::i#1 )
  [15] if((byte) lvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvaluevar::@2
  to:lvaluevar::@return
lvaluevar::@return: scope:[lvaluevar]  from lvaluevar::@1
  [16] return 
  to:@return
lvaluevar::@2: scope:[lvaluevar]  from lvaluevar::@1
  [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0
  [18] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2
  [19] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2
  to:lvaluevar::@1
rvaluevar: scope:[rvaluevar]  from main::@2
  [20] phi()
  to:rvaluevar::@1
rvaluevar::@1: scope:[rvaluevar]  from rvaluevar rvaluevar::@2
  [21] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/((byte*))(word/signed word/dword/signed dword) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 )
  [21] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte/signed byte/word/signed word/dword/signed dword) 2 rvaluevar::@2/(byte) rvaluevar::i#1 )
  [22] if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvaluevar::@2
  to:rvaluevar::@return
rvaluevar::@return: scope:[rvaluevar]  from rvaluevar::@1
  [23] return 
  to:@return
rvaluevar::@2: scope:[rvaluevar]  from rvaluevar::@1
  [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2)
  [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2
  [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2
  to:rvaluevar::@1
rvalue: scope:[rvalue]  from main::@1
  [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0)
  [28] (byte) rvalue::b#1 ← *((const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)
  to:rvalue::@1
rvalue::@1: scope:[rvalue]  from rvalue rvalue::@2
  [29] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word/dword/signed dword) 2 rvalue::@2/(byte) rvalue::i#1 )
  [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvalue::@2
  to:rvalue::@return
rvalue::@return: scope:[rvalue]  from rvalue::@1
  [31] return 
  to:@return
rvalue::@2: scope:[rvalue]  from rvalue::@1
  [32] (byte) rvalue::b#2 ← *((const byte[1024]) rvalue::SCREEN#0 + (byte) rvalue::i#2)
  [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2
  to:rvalue::@1
lvalue: scope:[lvalue]  from main
  [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1
  [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2
  to:lvalue::@1
lvalue::@1: scope:[lvalue]  from lvalue lvalue::@2
  [36] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word/dword/signed dword) 2 lvalue::@2/(byte) lvalue::i#1 )
  [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvalue::@2
  to:lvalue::@return
lvalue::@return: scope:[lvalue]  from lvalue::@1
  [38] return 
  to:@return
lvalue::@2: scope:[lvalue]  from lvalue::@1
  [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3
  [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2
  to:lvalue::@1


VARIABLE REGISTER WEIGHTS
(void()) lvalue()
(byte[1024]) lvalue::SCREEN
(byte) lvalue::i
(byte) lvalue::i#1 22.0
(byte) lvalue::i#2 14.666666666666666
(void()) lvaluevar()
(byte) lvaluevar::b
(byte) lvaluevar::i
(byte) lvaluevar::i#1 22.0
(byte) lvaluevar::i#2 8.25
(byte*) lvaluevar::screen
(byte*) lvaluevar::screen#1 11.0
(byte*) lvaluevar::screen#2 11.0
(void()) main()
(void()) rvalue()
(byte[1024]) rvalue::SCREEN
(byte) rvalue::b
(byte) rvalue::b#0 20.0
(byte) rvalue::b#1 20.0
(byte) rvalue::b#2 110.0
(byte) rvalue::i
(byte) rvalue::i#1 22.0
(byte) rvalue::i#2 14.666666666666666
(void()) rvaluevar()
(byte) rvaluevar::b
(byte) rvaluevar::b#0 110.0
(byte) rvaluevar::i
(byte) rvaluevar::i#1 22.0
(byte) rvaluevar::i#2 8.25
(byte*) rvaluevar::screen
(byte*) rvaluevar::screen#1 11.0
(byte*) rvaluevar::screen#2 11.0

Initial phi equivalence classes
[ lvaluevar::i#2 lvaluevar::i#1 ]
[ lvaluevar::screen#2 lvaluevar::screen#1 ]
[ rvaluevar::i#2 rvaluevar::i#1 ]
[ rvaluevar::screen#2 rvaluevar::screen#1 ]
[ rvalue::i#2 rvalue::i#1 ]
[ lvalue::i#2 lvalue::i#1 ]
Added variable rvaluevar::b#0 to zero page equivalence class [ rvaluevar::b#0 ]
Added variable rvalue::b#0 to zero page equivalence class [ rvalue::b#0 ]
Added variable rvalue::b#1 to zero page equivalence class [ rvalue::b#1 ]
Added variable rvalue::b#2 to zero page equivalence class [ rvalue::b#2 ]
Complete equivalence classes
[ lvaluevar::i#2 lvaluevar::i#1 ]
[ lvaluevar::screen#2 lvaluevar::screen#1 ]
[ rvaluevar::i#2 rvaluevar::i#1 ]
[ rvaluevar::screen#2 rvaluevar::screen#1 ]
[ rvalue::i#2 rvalue::i#1 ]
[ lvalue::i#2 lvalue::i#1 ]
[ rvaluevar::b#0 ]
[ rvalue::b#0 ]
[ rvalue::b#1 ]
[ rvalue::b#2 ]
Allocated zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ]
Allocated zp ZP_WORD:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ]
Allocated zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ]
Allocated zp ZP_WORD:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ]
Allocated zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ]
Allocated zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ]
Allocated zp ZP_BYTE:10 [ rvaluevar::b#0 ]
Allocated zp ZP_BYTE:11 [ rvalue::b#0 ]
Allocated zp ZP_BYTE:12 [ rvalue::b#1 ]
Allocated zp ZP_BYTE:13 [ rvalue::b#2 ]

INITIAL ASM
//SEG0 File Comments
// Test all types of pointers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
b5_from_bbegin:
  jmp b5
//SEG5 @5
b5:
//SEG6 [2] call main 
//SEG7 [4] phi from @5 to main [phi:@5->main]
main_from_b5:
  jsr main
//SEG8 [3] phi from @5 to @end [phi:@5->@end]
bend_from_b5:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
  //SEG11 [5] call lvalue 
    jsr lvalue
  //SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG13 main::@1
  b1:
  //SEG14 [7] call rvalue 
    jsr rvalue
  //SEG15 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
  //SEG16 main::@2
  b2:
  //SEG17 [9] call rvaluevar 
  //SEG18 [20] phi from main::@2 to rvaluevar [phi:main::@2->rvaluevar]
  rvaluevar_from_b2:
    jsr rvaluevar
  //SEG19 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    jmp b3
  //SEG20 main::@3
  b3:
  //SEG21 [11] call lvaluevar 
  //SEG22 [13] phi from main::@3 to lvaluevar [phi:main::@3->lvaluevar]
  lvaluevar_from_b3:
    jsr lvaluevar
    jmp breturn
  //SEG23 main::@return
  breturn:
  //SEG24 [12] return 
    rts
}
//SEG25 lvaluevar
lvaluevar: {
    // LValue Variable pointer dereference
    .const b = 4
    .label screen = 3
    .label i = 2
  //SEG26 [14] phi from lvaluevar to lvaluevar::@1 [phi:lvaluevar->lvaluevar::@1]
  b1_from_lvaluevar:
  //SEG27 [14] phi (byte*) lvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:lvaluevar->lvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG28 [14] phi (byte) lvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvaluevar->lvaluevar::@1#1] -- vbuz1=vbuc1 
    lda #2
    sta i
    jmp b1
  //SEG29 lvaluevar::@1
  b1:
  //SEG30 [15] if((byte) lvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvaluevar::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda i
    cmp #$a
    bcc b2
    jmp breturn
  //SEG31 lvaluevar::@return
  breturn:
  //SEG32 [16] return 
    rts
  //SEG33 lvaluevar::@2
  b2:
  //SEG34 [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 -- _deref_pbuz1=vbuc1 
    lda #b
    ldy #0
    sta (screen),y
  //SEG35 [18] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG36 [19] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG37 [14] phi from lvaluevar::@2 to lvaluevar::@1 [phi:lvaluevar::@2->lvaluevar::@1]
  b1_from_b2:
  //SEG38 [14] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 [phi:lvaluevar::@2->lvaluevar::@1#0] -- register_copy 
  //SEG39 [14] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 [phi:lvaluevar::@2->lvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG40 rvaluevar
rvaluevar: {
    .label b = $a
    .label screen = 6
    .label i = 5
  //SEG41 [21] phi from rvaluevar to rvaluevar::@1 [phi:rvaluevar->rvaluevar::@1]
  b1_from_rvaluevar:
  //SEG42 [21] phi (byte*) rvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:rvaluevar->rvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG43 [21] phi (byte) rvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvaluevar->rvaluevar::@1#1] -- vbuz1=vbuc1 
    lda #2
    sta i
    jmp b1
  //SEG44 rvaluevar::@1
  b1:
  //SEG45 [22] if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvaluevar::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda i
    cmp #$a
    bcc b2
    jmp breturn
  //SEG46 rvaluevar::@return
  breturn:
  //SEG47 [23] return 
    rts
  //SEG48 rvaluevar::@2
  b2:
  //SEG49 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) -- vbuz1=_deref_pbuz2 
    ldy #0
    lda (screen),y
    sta b
  //SEG50 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG51 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG52 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1]
  b1_from_b2:
  //SEG53 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy 
  //SEG54 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG55 rvalue
rvalue: {
    // A constant pointer
    .label SCREEN = $400
    .label b = $b
    .label b_1 = $c
    .label b_2 = $d
    .label i = 8
  //SEG56 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) -- vbuz1=_deref_pbuc1 
    // RValue constant pointer
    lda SCREEN
    sta b
  //SEG57 [28] (byte) rvalue::b#1 ← *((const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuz1=_deref_pbuc1 
    // RValue constant array pointer constant index
    lda SCREEN+1
    sta b_1
  //SEG58 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1]
  b1_from_rvalue:
  //SEG59 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvalue->rvalue::@1#0] -- vbuz1=vbuc1 
    lda #2
    sta i
    jmp b1
  //SEG60 rvalue::@1
  b1:
  //SEG61 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvalue::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda i
    cmp #$a
    bcc b2
    jmp breturn
  //SEG62 rvalue::@return
  breturn:
  //SEG63 [31] return 
    rts
  //SEG64 rvalue::@2
  b2:
  //SEG65 [32] (byte) rvalue::b#2 ← *((const byte[1024]) rvalue::SCREEN#0 + (byte) rvalue::i#2) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy i
    lda SCREEN,y
    sta b_2
  //SEG66 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG67 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1]
  b1_from_b2:
  //SEG68 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy 
    jmp b1
}
//SEG69 lvalue
lvalue: {
    // A constant pointer
    .label SCREEN = $400
    .label i = 9
  //SEG70 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 
    // LValue constant pointer dereference
    lda #1
    sta SCREEN
  //SEG71 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2 
    // LValue constant array constant indexing
    lda #2
    sta SCREEN+1
  //SEG72 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1]
  b1_from_lvalue:
  //SEG73 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvalue->lvalue::@1#0] -- vbuz1=vbuc1 
    lda #2
    sta i
    jmp b1
  //SEG74 lvalue::@1
  b1:
  //SEG75 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvalue::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda i
    cmp #$a
    bcc b2
    jmp breturn
  //SEG76 lvalue::@return
  breturn:
  //SEG77 [38] return 
    rts
  //SEG78 lvalue::@2
  b2:
  //SEG79 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy i
    lda #3
    sta SCREEN,y
  //SEG80 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG81 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1]
  b1_from_b2:
  //SEG82 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy 
    jmp b1
}

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 [ lvaluevar::i#2 lvaluevar::screen#2 ] ( main:2::lvaluevar:11 [ lvaluevar::i#2 lvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ]
Statement [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ]
Statement [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a 
Statement [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a 
Statement [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ]
Statement [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 [ lvaluevar::i#2 lvaluevar::screen#2 ] ( main:2::lvaluevar:11 [ lvaluevar::i#2 lvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y 
Statement [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y 
Statement [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a 
Statement [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a 
Statement [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] : zp ZP_BYTE:2 , reg byte x , 
Potential registers zp ZP_WORD:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] : zp ZP_WORD:3 , 
Potential registers zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] : zp ZP_BYTE:5 , reg byte x , 
Potential registers zp ZP_WORD:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:10 [ rvaluevar::b#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:11 [ rvalue::b#0 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:12 [ rvalue::b#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:13 [ rvalue::b#2 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [rvalue] 110: zp ZP_BYTE:13 [ rvalue::b#2 ] 36.67: zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] 20: zp ZP_BYTE:11 [ rvalue::b#0 ] 20: zp ZP_BYTE:12 [ rvalue::b#1 ] 
Uplift Scope [rvaluevar] 110: zp ZP_BYTE:10 [ rvaluevar::b#0 ] 30.25: zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] 22: zp ZP_WORD:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] 
Uplift Scope [lvaluevar] 30.25: zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] 22: zp ZP_WORD:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] 
Uplift Scope [lvalue] 36.67: zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] 
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [rvalue] best 1868 combination reg byte a [ rvalue::b#2 ] reg byte x [ rvalue::i#2 rvalue::i#1 ] reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] 
Limited combination testing to 100 combinations of 256 possible.
Uplifting [rvaluevar] best 1748 combination reg byte a [ rvaluevar::b#0 ] reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] zp ZP_WORD:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] 
Uplifting [lvaluevar] best 1658 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_WORD:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] 
Uplifting [lvalue] best 1538 combination reg byte x [ lvalue::i#2 lvalue::i#1 ] 
Uplifting [main] best 1538 combination 
Uplifting [] best 1538 combination 
Coalescing zero page register [ zp ZP_WORD:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] ] with [ zp ZP_WORD:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] ]
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 rvaluevar::screen#1 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Test all types of pointers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
b5_from_bbegin:
  jmp b5
//SEG5 @5
b5:
//SEG6 [2] call main 
//SEG7 [4] phi from @5 to main [phi:@5->main]
main_from_b5:
  jsr main
//SEG8 [3] phi from @5 to @end [phi:@5->@end]
bend_from_b5:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
  //SEG11 [5] call lvalue 
    jsr lvalue
  //SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG13 main::@1
  b1:
  //SEG14 [7] call rvalue 
    jsr rvalue
  //SEG15 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
  //SEG16 main::@2
  b2:
  //SEG17 [9] call rvaluevar 
  //SEG18 [20] phi from main::@2 to rvaluevar [phi:main::@2->rvaluevar]
  rvaluevar_from_b2:
    jsr rvaluevar
  //SEG19 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    jmp b3
  //SEG20 main::@3
  b3:
  //SEG21 [11] call lvaluevar 
  //SEG22 [13] phi from main::@3 to lvaluevar [phi:main::@3->lvaluevar]
  lvaluevar_from_b3:
    jsr lvaluevar
    jmp breturn
  //SEG23 main::@return
  breturn:
  //SEG24 [12] return 
    rts
}
//SEG25 lvaluevar
lvaluevar: {
    // LValue Variable pointer dereference
    .const b = 4
    .label screen = 2
  //SEG26 [14] phi from lvaluevar to lvaluevar::@1 [phi:lvaluevar->lvaluevar::@1]
  b1_from_lvaluevar:
  //SEG27 [14] phi (byte*) lvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:lvaluevar->lvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG28 [14] phi (byte) lvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvaluevar->lvaluevar::@1#1] -- vbuxx=vbuc1 
    ldx #2
    jmp b1
  //SEG29 lvaluevar::@1
  b1:
  //SEG30 [15] if((byte) lvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvaluevar::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
    jmp breturn
  //SEG31 lvaluevar::@return
  breturn:
  //SEG32 [16] return 
    rts
  //SEG33 lvaluevar::@2
  b2:
  //SEG34 [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 -- _deref_pbuz1=vbuc1 
    lda #b
    ldy #0
    sta (screen),y
  //SEG35 [18] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG36 [19] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG37 [14] phi from lvaluevar::@2 to lvaluevar::@1 [phi:lvaluevar::@2->lvaluevar::@1]
  b1_from_b2:
  //SEG38 [14] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 [phi:lvaluevar::@2->lvaluevar::@1#0] -- register_copy 
  //SEG39 [14] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 [phi:lvaluevar::@2->lvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG40 rvaluevar
rvaluevar: {
    .label screen = 2
  //SEG41 [21] phi from rvaluevar to rvaluevar::@1 [phi:rvaluevar->rvaluevar::@1]
  b1_from_rvaluevar:
  //SEG42 [21] phi (byte*) rvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:rvaluevar->rvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG43 [21] phi (byte) rvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvaluevar->rvaluevar::@1#1] -- vbuxx=vbuc1 
    ldx #2
    jmp b1
  //SEG44 rvaluevar::@1
  b1:
  //SEG45 [22] if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvaluevar::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
    jmp breturn
  //SEG46 rvaluevar::@return
  breturn:
  //SEG47 [23] return 
    rts
  //SEG48 rvaluevar::@2
  b2:
  //SEG49 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) -- vbuaa=_deref_pbuz1 
    ldy #0
    lda (screen),y
  //SEG50 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG51 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG52 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1]
  b1_from_b2:
  //SEG53 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy 
  //SEG54 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG55 rvalue
rvalue: {
    // A constant pointer
    .label SCREEN = $400
  //SEG56 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) -- vbuaa=_deref_pbuc1 
    // RValue constant pointer
    lda SCREEN
  //SEG57 [28] (byte) rvalue::b#1 ← *((const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1 
    // RValue constant array pointer constant index
    lda SCREEN+1
  //SEG58 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1]
  b1_from_rvalue:
  //SEG59 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvalue->rvalue::@1#0] -- vbuxx=vbuc1 
    ldx #2
    jmp b1
  //SEG60 rvalue::@1
  b1:
  //SEG61 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvalue::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
    jmp breturn
  //SEG62 rvalue::@return
  breturn:
  //SEG63 [31] return 
    rts
  //SEG64 rvalue::@2
  b2:
  //SEG65 [32] (byte) rvalue::b#2 ← *((const byte[1024]) rvalue::SCREEN#0 + (byte) rvalue::i#2) -- vbuaa=pbuc1_derefidx_vbuxx 
    lda SCREEN,x
  //SEG66 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG67 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1]
  b1_from_b2:
  //SEG68 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy 
    jmp b1
}
//SEG69 lvalue
lvalue: {
    // A constant pointer
    .label SCREEN = $400
  //SEG70 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 
    // LValue constant pointer dereference
    lda #1
    sta SCREEN
  //SEG71 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2 
    // LValue constant array constant indexing
    lda #2
    sta SCREEN+1
  //SEG72 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1]
  b1_from_lvalue:
  //SEG73 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvalue->lvalue::@1#0] -- vbuxx=vbuc1 
    ldx #2
    jmp b1
  //SEG74 lvalue::@1
  b1:
  //SEG75 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvalue::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
    jmp breturn
  //SEG76 lvalue::@return
  breturn:
  //SEG77 [38] return 
    rts
  //SEG78 lvalue::@2
  b2:
  //SEG79 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #3
    sta SCREEN,x
  //SEG80 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG81 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1]
  b1_from_b2:
  //SEG82 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy 
    jmp b1
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b5
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b5_from_bbegin:
Removing instruction b5:
Removing instruction main_from_b5:
Removing instruction bend_from_b5:
Removing instruction b1_from_main:
Removing instruction b2_from_b1:
Removing instruction rvaluevar_from_b2:
Removing instruction b3_from_b2:
Removing instruction lvaluevar_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1:
Removing instruction b2:
Removing instruction b3:
Removing instruction breturn:
Removing instruction b1_from_lvaluevar:
Removing instruction breturn:
Removing instruction b1_from_b2:
Removing instruction b1_from_rvaluevar:
Removing instruction breturn:
Removing instruction b1_from_b2:
Removing instruction b1_from_rvalue:
Removing instruction breturn:
Removing instruction b1_from_b2:
Removing instruction b1_from_lvalue:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Replacing instruction ldx #2 with TAX
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @5
(label) @begin
(label) @end
(void()) lvalue()
(label) lvalue::@1
(label) lvalue::@2
(label) lvalue::@return
(byte[1024]) lvalue::SCREEN
(const byte[1024]) lvalue::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte) lvalue::i
(byte) lvalue::i#1 reg byte x 22.0
(byte) lvalue::i#2 reg byte x 14.666666666666666
(void()) lvaluevar()
(label) lvaluevar::@1
(label) lvaluevar::@2
(label) lvaluevar::@return
(byte) lvaluevar::b
(const byte) lvaluevar::b#0 b = (byte/signed byte/word/signed word/dword/signed dword) 4
(byte) lvaluevar::i
(byte) lvaluevar::i#1 reg byte x 22.0
(byte) lvaluevar::i#2 reg byte x 8.25
(byte*) lvaluevar::screen
(byte*) lvaluevar::screen#1 screen zp ZP_WORD:2 11.0
(byte*) lvaluevar::screen#2 screen zp ZP_WORD:2 11.0
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(void()) rvalue()
(label) rvalue::@1
(label) rvalue::@2
(label) rvalue::@return
(byte[1024]) rvalue::SCREEN
(const byte[1024]) rvalue::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte) rvalue::b
(byte) rvalue::b#0 reg byte a 20.0
(byte) rvalue::b#1 reg byte a 20.0
(byte) rvalue::b#2 reg byte a 110.0
(byte) rvalue::i
(byte) rvalue::i#1 reg byte x 22.0
(byte) rvalue::i#2 reg byte x 14.666666666666666
(void()) rvaluevar()
(label) rvaluevar::@1
(label) rvaluevar::@2
(label) rvaluevar::@return
(byte) rvaluevar::b
(byte) rvaluevar::b#0 reg byte a 110.0
(byte) rvaluevar::i
(byte) rvaluevar::i#1 reg byte x 22.0
(byte) rvaluevar::i#2 reg byte x 8.25
(byte*) rvaluevar::screen
(byte*) rvaluevar::screen#1 screen zp ZP_WORD:2 11.0
(byte*) rvaluevar::screen#2 screen zp ZP_WORD:2 11.0

reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ]
zp ZP_WORD:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 rvaluevar::screen#1 ]
reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ]
reg byte x [ rvalue::i#2 rvalue::i#1 ]
reg byte x [ lvalue::i#2 lvalue::i#1 ]
reg byte a [ rvaluevar::b#0 ]
reg byte a [ rvalue::b#0 ]
reg byte a [ rvalue::b#1 ]
reg byte a [ rvalue::b#2 ]


FINAL ASSEMBLER
Score: 1274

//SEG0 File Comments
// Test all types of pointers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
//SEG5 @5
//SEG6 [2] call main 
//SEG7 [4] phi from @5 to main [phi:@5->main]
//SEG8 [3] phi from @5 to @end [phi:@5->@end]
//SEG9 @end
//SEG10 main
main: {
  //SEG11 [5] call lvalue 
    jsr lvalue
  //SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
  //SEG13 main::@1
  //SEG14 [7] call rvalue 
    jsr rvalue
  //SEG15 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  //SEG16 main::@2
  //SEG17 [9] call rvaluevar 
  //SEG18 [20] phi from main::@2 to rvaluevar [phi:main::@2->rvaluevar]
    jsr rvaluevar
  //SEG19 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  //SEG20 main::@3
  //SEG21 [11] call lvaluevar 
  //SEG22 [13] phi from main::@3 to lvaluevar [phi:main::@3->lvaluevar]
    jsr lvaluevar
  //SEG23 main::@return
  //SEG24 [12] return 
    rts
}
//SEG25 lvaluevar
lvaluevar: {
    // LValue Variable pointer dereference
    .const b = 4
    .label screen = 2
  //SEG26 [14] phi from lvaluevar to lvaluevar::@1 [phi:lvaluevar->lvaluevar::@1]
  //SEG27 [14] phi (byte*) lvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:lvaluevar->lvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG28 [14] phi (byte) lvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvaluevar->lvaluevar::@1#1] -- vbuxx=vbuc1 
    ldx #2
  //SEG29 lvaluevar::@1
  b1:
  //SEG30 [15] if((byte) lvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvaluevar::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
  //SEG31 lvaluevar::@return
  //SEG32 [16] return 
    rts
  //SEG33 lvaluevar::@2
  b2:
  //SEG34 [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 -- _deref_pbuz1=vbuc1 
    lda #b
    ldy #0
    sta (screen),y
  //SEG35 [18] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG36 [19] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG37 [14] phi from lvaluevar::@2 to lvaluevar::@1 [phi:lvaluevar::@2->lvaluevar::@1]
  //SEG38 [14] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 [phi:lvaluevar::@2->lvaluevar::@1#0] -- register_copy 
  //SEG39 [14] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 [phi:lvaluevar::@2->lvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG40 rvaluevar
rvaluevar: {
    .label screen = 2
  //SEG41 [21] phi from rvaluevar to rvaluevar::@1 [phi:rvaluevar->rvaluevar::@1]
  //SEG42 [21] phi (byte*) rvaluevar::screen#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:rvaluevar->rvaluevar::@1#0] -- pbuz1=pbuc1 
    lda #<$400
    sta screen
    lda #>$400
    sta screen+1
  //SEG43 [21] phi (byte) rvaluevar::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvaluevar->rvaluevar::@1#1] -- vbuxx=vbuc1 
    ldx #2
  //SEG44 rvaluevar::@1
  b1:
  //SEG45 [22] if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvaluevar::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
  //SEG46 rvaluevar::@return
  //SEG47 [23] return 
    rts
  //SEG48 rvaluevar::@2
  b2:
  //SEG49 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) -- vbuaa=_deref_pbuz1 
    ldy #0
    lda (screen),y
  //SEG50 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 -- pbuz1=_inc_pbuz1 
    inc screen
    bne !+
    inc screen+1
  !:
  //SEG51 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG52 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1]
  //SEG53 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy 
  //SEG54 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy 
    jmp b1
}
//SEG55 rvalue
rvalue: {
    // A constant pointer
    .label SCREEN = $400
  //SEG56 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) -- vbuaa=_deref_pbuc1 
    // RValue constant pointer
    lda SCREEN
  //SEG57 [28] (byte) rvalue::b#1 ← *((const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1 
    // RValue constant array pointer constant index
    lda SCREEN+1
  //SEG58 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1]
  //SEG59 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:rvalue->rvalue::@1#0] -- vbuxx=vbuc1 
    ldx #2
  //SEG60 rvalue::@1
  b1:
  //SEG61 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto rvalue::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
  //SEG62 rvalue::@return
  //SEG63 [31] return 
    rts
  //SEG64 rvalue::@2
  b2:
  //SEG65 [32] (byte) rvalue::b#2 ← *((const byte[1024]) rvalue::SCREEN#0 + (byte) rvalue::i#2) -- vbuaa=pbuc1_derefidx_vbuxx 
    lda SCREEN,x
  //SEG66 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG67 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1]
  //SEG68 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy 
    jmp b1
}
//SEG69 lvalue
lvalue: {
    // A constant pointer
    .label SCREEN = $400
  //SEG70 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 
    // LValue constant pointer dereference
    lda #1
    sta SCREEN
  //SEG71 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2 
    // LValue constant array constant indexing
    lda #2
    sta SCREEN+1
  //SEG72 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1]
  //SEG73 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:lvalue->lvalue::@1#0] -- vbuxx=vbuc1 
    tax
  //SEG74 lvalue::@1
  b1:
  //SEG75 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto lvalue::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$a
    bcc b2
  //SEG76 lvalue::@return
  //SEG77 [38] return 
    rts
  //SEG78 lvalue::@2
  b2:
  //SEG79 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #3
    sta SCREEN,x
  //SEG80 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG81 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1]
  //SEG82 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy 
    jmp b1
}

