Fixing pointer array-indexing *((word[]) main::words + (byte) main::i)
Fixing pointer array-indexing *((word[]) main::words + (byte) main::i)
Fixing pointer array-indexing *((word[]) main::words + (number) 0)
Fixing pointer array-indexing *((word[]) main::words + (number) 0)
Fixing pointer array-indexing *((word[]) main::words + (number) 1)
Fixing pointer array-indexing *((word[]) main::words + (number) 1)
Fixing pointer array-indexing *((word[]) main::words + (number) 2)
Fixing pointer array-indexing *((word[]) main::words + (number) 2)

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1
main: scope:[main]  from @1
  (word[]) main::words#0 ← { (number) $3031, (number) $3233, (number) $3435 }
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
  (byte~) main::$7 ← (byte) main::i#2 * (const byte) SIZEOF_WORD
  *((word[]) main::words#0 + (byte~) main::$7) ← *((word[]) main::words#0 + (byte~) main::$7) + (number) $101
  (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,2)
  (bool~) main::$6 ← (byte) main::i#1 != rangelast(0,2)
  if((bool~) main::$6) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte*) main::SCREEN#0 ← ((byte*)) (number) $400
  (number~) main::$8 ← (number) 0 * (const byte) SIZEOF_WORD
  (byte~) main::$0 ← > *((word[]) main::words#0 + (number~) main::$8)
  *((byte*) main::SCREEN#0 + (number) 0) ← (byte~) main::$0
  (number~) main::$9 ← (number) 0 * (const byte) SIZEOF_WORD
  (byte~) main::$1 ← < *((word[]) main::words#0 + (number~) main::$9)
  *((byte*) main::SCREEN#0 + (number) 1) ← (byte~) main::$1
  (number~) main::$10 ← (number) 1 * (const byte) SIZEOF_WORD
  (byte~) main::$2 ← > *((word[]) main::words#0 + (number~) main::$10)
  *((byte*) main::SCREEN#0 + (number) 2) ← (byte~) main::$2
  (number~) main::$11 ← (number) 1 * (const byte) SIZEOF_WORD
  (byte~) main::$3 ← < *((word[]) main::words#0 + (number~) main::$11)
  *((byte*) main::SCREEN#0 + (number) 3) ← (byte~) main::$3
  (number~) main::$12 ← (number) 2 * (const byte) SIZEOF_WORD
  (byte~) main::$4 ← > *((word[]) main::words#0 + (number~) main::$12)
  *((byte*) main::SCREEN#0 + (number) 4) ← (byte~) main::$4
  (number~) main::$13 ← (number) 2 * (const byte) SIZEOF_WORD
  (byte~) main::$5 ← < *((word[]) main::words#0 + (number~) main::$13)
  *((byte*) main::SCREEN#0 + (number) 5) ← (byte~) main::$5
  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
(const byte) SIZEOF_WORD = (byte) 2
(void()) main()
(byte~) main::$0
(byte~) main::$1
(number~) main::$10
(number~) main::$11
(number~) main::$12
(number~) main::$13
(byte~) main::$2
(byte~) main::$3
(byte~) main::$4
(byte~) main::$5
(bool~) main::$6
(byte~) main::$7
(number~) main::$8
(number~) main::$9
(label) main::@1
(label) main::@2
(label) main::@return
(byte*) main::SCREEN
(byte*) main::SCREEN#0
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(word[]) main::words
(word[]) main::words#0

Adding number conversion cast (unumber) $101 in *((word[]) main::words#0 + (byte~) main::$7) ← *((word[]) main::words#0 + (byte~) main::$7) + (number) $101
Adding number conversion cast (unumber) 0 in (number~) main::$8 ← (number) 0 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$8 in (number~) main::$8 ← (unumber)(number) 0 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 0 in *((byte*) main::SCREEN#0 + (number) 0) ← (byte~) main::$0
Adding number conversion cast (unumber) 0 in (number~) main::$9 ← (number) 0 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$9 in (number~) main::$9 ← (unumber)(number) 0 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 1 in *((byte*) main::SCREEN#0 + (number) 1) ← (byte~) main::$1
Adding number conversion cast (unumber) 1 in (number~) main::$10 ← (number) 1 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$10 in (number~) main::$10 ← (unumber)(number) 1 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 2 in *((byte*) main::SCREEN#0 + (number) 2) ← (byte~) main::$2
Adding number conversion cast (unumber) 1 in (number~) main::$11 ← (number) 1 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$11 in (number~) main::$11 ← (unumber)(number) 1 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 3 in *((byte*) main::SCREEN#0 + (number) 3) ← (byte~) main::$3
Adding number conversion cast (unumber) 2 in (number~) main::$12 ← (number) 2 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$12 in (number~) main::$12 ← (unumber)(number) 2 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 4 in *((byte*) main::SCREEN#0 + (number) 4) ← (byte~) main::$4
Adding number conversion cast (unumber) 2 in (number~) main::$13 ← (number) 2 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) main::$13 in (number~) main::$13 ← (unumber)(number) 2 * (const byte) SIZEOF_WORD
Adding number conversion cast (unumber) 5 in *((byte*) main::SCREEN#0 + (number) 5) ← (byte~) main::$5
Successful SSA optimization PassNAddNumberTypeConversions
Adding number conversion cast (word) to elements in (word[]) main::words#0 ← { (word)(number) $3031, (word)(number) $3233, (word)(number) $3435 }
Successful SSA optimization PassNAddArrayNumberTypeConversions
Inlining cast (byte*) main::SCREEN#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast $3031
Simplifying constant integer cast $3233
Simplifying constant integer cast $3435
Simplifying constant integer cast $101
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast 3
Simplifying constant integer cast 2
Simplifying constant integer cast 4
Simplifying constant integer cast 2
Simplifying constant integer cast 5
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (word) $101
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 5
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$8 ← (byte) 0 * (const byte) SIZEOF_WORD
Inferred type updated to byte in (unumber~) main::$9 ← (byte) 0 * (const byte) SIZEOF_WORD
Inferred type updated to byte in (unumber~) main::$10 ← (byte) 1 * (const byte) SIZEOF_WORD
Inferred type updated to byte in (unumber~) main::$11 ← (byte) 1 * (const byte) SIZEOF_WORD
Inferred type updated to byte in (unumber~) main::$12 ← (byte) 2 * (const byte) SIZEOF_WORD
Inferred type updated to byte in (unumber~) main::$13 ← (byte) 2 * (const byte) SIZEOF_WORD
Simple Condition (bool~) main::$6 [7] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [0] (word[]) main::words#0 ← { (word) $3031, (word) $3233, (word) $3435 }
Constant right-side identified [9] (byte~) main::$8 ← (byte) 0 * (const byte) SIZEOF_WORD
Constant right-side identified [12] (byte~) main::$9 ← (byte) 0 * (const byte) SIZEOF_WORD
Constant right-side identified [15] (byte~) main::$10 ← (byte) 1 * (const byte) SIZEOF_WORD
Constant right-side identified [18] (byte~) main::$11 ← (byte) 1 * (const byte) SIZEOF_WORD
Constant right-side identified [21] (byte~) main::$12 ← (byte) 2 * (const byte) SIZEOF_WORD
Constant right-side identified [24] (byte~) main::$13 ← (byte) 2 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word[]) main::words#0 = { $3031, $3233, $3435 }
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::SCREEN#0 = (byte*) 1024
Constant (const byte) main::$8 = 0*SIZEOF_WORD
Constant (const byte) main::$9 = 0*SIZEOF_WORD
Constant (const byte) main::$10 = 1*SIZEOF_WORD
Constant (const byte) main::$11 = 1*SIZEOF_WORD
Constant (const byte) main::$12 = 2*SIZEOF_WORD
Constant (const byte) main::$13 = 2*SIZEOF_WORD
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [5] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [7] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_WORD in 
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_WORD in 
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero main::words#0 in [10] (byte~) main::$0 ← > *((const word[]) main::words#0 + (const byte) main::$8)
Simplifying expression containing zero main::SCREEN#0 in [11] *((const byte*) main::SCREEN#0 + (byte) 0) ← (byte~) main::$0
Simplifying expression containing zero main::words#0 in [13] (byte~) main::$1 ← < *((const word[]) main::words#0 + (const byte) main::$9)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) main::$8
Eliminating unused constant (const byte) main::$9
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift [1] (byte~) main::$7 ← (byte) main::i#2 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::$12 = (byte) 2*(const byte) SIZEOF_WORD
Constant inlined main::i#0 = (byte) 0
Constant inlined main::$13 = (byte) 2*(const byte) SIZEOF_WORD
Constant inlined main::$10 = (byte) 1*(const byte) SIZEOF_WORD
Constant inlined main::$11 = (byte) 1*(const byte) SIZEOF_WORD
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN#0+1)
Consolidated array index constant in *(main::words#0+1*SIZEOF_WORD)
Consolidated array index constant in *(main::SCREEN#0+2)
Consolidated array index constant in *(main::words#0+1*SIZEOF_WORD)
Consolidated array index constant in *(main::SCREEN#0+3)
Consolidated array index constant in *(main::words#0+2*SIZEOF_WORD)
Consolidated array index constant in *(main::SCREEN#0+4)
Consolidated array index constant in *(main::words#0+2*SIZEOF_WORD)
Consolidated array index constant in *(main::SCREEN#0+5)
Successful SSA optimization Pass2ConstantAdditionElimination
Added new block during phi lifting main::@3(between main::@1 and main::@1)
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
CALL GRAPH
Calls in [] to main:2 

Created 1 initial phi equivalence classes
Coalesced [24] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@3
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 main::@1
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
  [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1
  [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101
  [8] (byte) main::i#1 ← ++ (byte) main::i#2
  [9] if((byte) main::i#1!=(byte) 3) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  [10] (byte~) main::$0 ← > *((const word[]) main::words#0)
  [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$0
  [12] (byte~) main::$1 ← < *((const word[]) main::words#0)
  [13] *((const byte*) main::SCREEN#0+(byte) 1) ← (byte~) main::$1
  [14] (byte~) main::$2 ← > *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD)
  [15] *((const byte*) main::SCREEN#0+(byte) 2) ← (byte~) main::$2
  [16] (byte~) main::$3 ← < *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD)
  [17] *((const byte*) main::SCREEN#0+(byte) 3) ← (byte~) main::$3
  [18] (byte~) main::$4 ← > *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD)
  [19] *((const byte*) main::SCREEN#0+(byte) 4) ← (byte~) main::$4
  [20] (byte~) main::$5 ← < *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD)
  [21] *((const byte*) main::SCREEN#0+(byte) 5) ← (byte~) main::$5
  to:main::@return
main::@return: scope:[main]  from main::@2
  [22] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$0 4.0
(byte~) main::$1 4.0
(byte~) main::$2 4.0
(byte~) main::$3 4.0
(byte~) main::$4 4.0
(byte~) main::$5 4.0
(byte~) main::$7 33.0
(byte*) main::SCREEN
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(word[]) main::words

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Added variable main::$7 to zero page equivalence class [ main::$7 ]
Added variable main::$0 to zero page equivalence class [ main::$0 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Added variable main::$2 to zero page equivalence class [ main::$2 ]
Added variable main::$3 to zero page equivalence class [ main::$3 ]
Added variable main::$4 to zero page equivalence class [ main::$4 ]
Added variable main::$5 to zero page equivalence class [ main::$5 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::$7 ]
[ main::$0 ]
[ main::$1 ]
[ main::$2 ]
[ main::$3 ]
[ main::$4 ]
[ main::$5 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::$7 ]
Allocated zp ZP_BYTE:4 [ main::$0 ]
Allocated zp ZP_BYTE:5 [ main::$1 ]
Allocated zp ZP_BYTE:6 [ main::$2 ]
Allocated zp ZP_BYTE:7 [ main::$3 ]
Allocated zp ZP_BYTE:8 [ main::$4 ]
Allocated zp ZP_BYTE:9 [ main::$5 ]

INITIAL ASM
  // File Comments
// Test word pointer compound assignment
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_WORD = 2
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN = $400
    .label _0 = 4
    .label _1 = 5
    .label _2 = 6
    .label _3 = 7
    .label _4 = 8
    .label _5 = 9
    .label _7 = 3
    .label i = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  b1_from_b1:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp b1
    // main::@1
  b1:
    // [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda i
    asl
    sta _7
    // [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101 -- pwuc1_derefidx_vbuz1=pwuc1_derefidx_vbuz1_plus_vwuc2 
    ldy _7
    clc
    lda words,y
    adc #<$101
    sta words,y
    lda words+1,y
    adc #>$101
    sta words+1,y
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
    // [9] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #3
    cmp i
    bne b1_from_b1
    jmp b2
    // main::@2
  b2:
    // [10] (byte~) main::$0 ← > *((const word[]) main::words#0) -- vbuz1=_hi__deref_pwuc1 
    lda words+1
    sta _0
    // [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuz1 
    lda _0
    sta SCREEN
    // [12] (byte~) main::$1 ← < *((const word[]) main::words#0) -- vbuz1=_lo__deref_pwuc1 
    lda words
    sta _1
    // [13] *((const byte*) main::SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1 
    lda _1
    sta SCREEN+1
    // [14] (byte~) main::$2 ← > *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuz1=_hi__deref_pwuc1 
    lda words+1*SIZEOF_WORD+1
    sta _2
    // [15] *((const byte*) main::SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1 
    lda _2
    sta SCREEN+2
    // [16] (byte~) main::$3 ← < *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuz1=_lo__deref_pwuc1 
    lda words+1*SIZEOF_WORD
    sta _3
    // [17] *((const byte*) main::SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuz1 
    lda _3
    sta SCREEN+3
    // [18] (byte~) main::$4 ← > *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuz1=_hi__deref_pwuc1 
    lda words+2*SIZEOF_WORD+1
    sta _4
    // [19] *((const byte*) main::SCREEN#0+(byte) 4) ← (byte~) main::$4 -- _deref_pbuc1=vbuz1 
    lda _4
    sta SCREEN+4
    // [20] (byte~) main::$5 ← < *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuz1=_lo__deref_pwuc1 
    lda words+2*SIZEOF_WORD
    sta _5
    // [21] *((const byte*) main::SCREEN#0+(byte) 5) ← (byte~) main::$5 -- _deref_pbuc1=vbuz1 
    lda _5
    sta SCREEN+5
    jmp breturn
    // main::@return
  breturn:
    // [22] return 
    rts
    words: .word $3031, $3233, $3435
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$7 ] ( main:2 [ main::i#2 main::$7 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a 
Statement [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1 [ main::i#2 main::$7 ] ( main:2 [ main::i#2 main::$7 ] ) always clobbers reg byte a 
Statement [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::$7 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ main::$0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:5 [ main::$1 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:6 [ main::$2 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:7 [ main::$3 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:8 [ main::$4 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:9 [ main::$5 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp ZP_BYTE:3 [ main::$7 ] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 4: zp ZP_BYTE:4 [ main::$0 ] 4: zp ZP_BYTE:5 [ main::$1 ] 4: zp ZP_BYTE:6 [ main::$2 ] 4: zp ZP_BYTE:7 [ main::$3 ] 4: zp ZP_BYTE:8 [ main::$4 ] 4: zp ZP_BYTE:9 [ main::$5 ] 
Uplift Scope [] 

Uplifting [main] best 578 combination reg byte a [ main::$7 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$0 ] reg byte a [ main::$1 ] zp ZP_BYTE:6 [ main::$2 ] zp ZP_BYTE:7 [ main::$3 ] zp ZP_BYTE:8 [ main::$4 ] zp ZP_BYTE:9 [ main::$5 ] 
Limited combination testing to 100 combinations of 49152 possible.
Uplifting [] best 578 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::$2 ]
Uplifting [main] best 572 combination reg byte a [ main::$2 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::$3 ]
Uplifting [main] best 566 combination reg byte a [ main::$3 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ main::$4 ]
Uplifting [main] best 560 combination reg byte a [ main::$4 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:9 [ main::$5 ]
Uplifting [main] best 554 combination reg byte a [ main::$5 ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test word pointer compound assignment
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_WORD = 2
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN = $400
    // [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  b1_from_b1:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp b1
    // main::@1
  b1:
    // [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101 -- pwuc1_derefidx_vbuaa=pwuc1_derefidx_vbuaa_plus_vwuc2 
    tay
    clc
    lda words,y
    adc #<$101
    sta words,y
    lda words+1,y
    adc #>$101
    sta words+1,y
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [9] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne b1_from_b1
    jmp b2
    // main::@2
  b2:
    // [10] (byte~) main::$0 ← > *((const word[]) main::words#0) -- vbuaa=_hi__deref_pwuc1 
    lda words+1
    // [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    // [12] (byte~) main::$1 ← < *((const word[]) main::words#0) -- vbuaa=_lo__deref_pwuc1 
    lda words
    // [13] *((const byte*) main::SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    // [14] (byte~) main::$2 ← > *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuaa=_hi__deref_pwuc1 
    lda words+1*SIZEOF_WORD+1
    // [15] *((const byte*) main::SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
    // [16] (byte~) main::$3 ← < *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuaa=_lo__deref_pwuc1 
    lda words+1*SIZEOF_WORD
    // [17] *((const byte*) main::SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa 
    sta SCREEN+3
    // [18] (byte~) main::$4 ← > *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuaa=_hi__deref_pwuc1 
    lda words+2*SIZEOF_WORD+1
    // [19] *((const byte*) main::SCREEN#0+(byte) 4) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa 
    sta SCREEN+4
    // [20] (byte~) main::$5 ← < *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuaa=_lo__deref_pwuc1 
    lda words+2*SIZEOF_WORD
    // [21] *((const byte*) main::SCREEN#0+(byte) 5) ← (byte~) main::$5 -- _deref_pbuc1=vbuaa 
    sta SCREEN+5
    jmp breturn
    // main::@return
  breturn:
    // [22] return 
    rts
    words: .word $3031, $3233, $3435
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b1 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
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 jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(void()) main()
(byte~) main::$0 reg byte a 4.0
(byte~) main::$1 reg byte a 4.0
(byte~) main::$2 reg byte a 4.0
(byte~) main::$3 reg byte a 4.0
(byte~) main::$4 reg byte a 4.0
(byte~) main::$5 reg byte a 4.0
(byte~) main::$7 reg byte a 33.0
(label) main::@1
(label) main::@2
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(word[]) main::words
(const word[]) main::words#0 words = { (word) $3031, (word) $3233, (word) $3435 }

reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::$7 ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ main::$4 ]
reg byte a [ main::$5 ]


FINAL ASSEMBLER
Score: 449

  // File Comments
// Test word pointer compound assignment
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const SIZEOF_WORD = 2
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN = $400
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy 
    // main::@1
  b1:
    // words[i] += $0101
    // [6] (byte~) main::$7 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [7] *((const word[]) main::words#0 + (byte~) main::$7) ← *((const word[]) main::words#0 + (byte~) main::$7) + (word) $101 -- pwuc1_derefidx_vbuaa=pwuc1_derefidx_vbuaa_plus_vwuc2 
    tay
    clc
    lda words,y
    adc #<$101
    sta words,y
    lda words+1,y
    adc #>$101
    sta words+1,y
    // for( byte i: 0..2)
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [9] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne b1
    // main::@2
    // >words[0]
    // [10] (byte~) main::$0 ← > *((const word[]) main::words#0) -- vbuaa=_hi__deref_pwuc1 
    lda words+1
    // SCREEN[0] = >words[0]
    // [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    // <words[0]
    // [12] (byte~) main::$1 ← < *((const word[]) main::words#0) -- vbuaa=_lo__deref_pwuc1 
    lda words
    // SCREEN[1] = <words[0]
    // [13] *((const byte*) main::SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    // >words[1]
    // [14] (byte~) main::$2 ← > *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuaa=_hi__deref_pwuc1 
    lda words+1*SIZEOF_WORD+1
    // SCREEN[2] = >words[1]
    // [15] *((const byte*) main::SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
    // <words[1]
    // [16] (byte~) main::$3 ← < *((const word[]) main::words#0+(byte) 1*(const byte) SIZEOF_WORD) -- vbuaa=_lo__deref_pwuc1 
    lda words+1*SIZEOF_WORD
    // SCREEN[3] = <words[1]
    // [17] *((const byte*) main::SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa 
    sta SCREEN+3
    // >words[2]
    // [18] (byte~) main::$4 ← > *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuaa=_hi__deref_pwuc1 
    lda words+2*SIZEOF_WORD+1
    // SCREEN[4] = >words[2]
    // [19] *((const byte*) main::SCREEN#0+(byte) 4) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa 
    sta SCREEN+4
    // <words[2]
    // [20] (byte~) main::$5 ← < *((const word[]) main::words#0+(byte) 2*(const byte) SIZEOF_WORD) -- vbuaa=_lo__deref_pwuc1 
    lda words+2*SIZEOF_WORD
    // SCREEN[5] = <words[2]
    // [21] *((const byte*) main::SCREEN#0+(byte) 5) ← (byte~) main::$5 -- _deref_pbuc1=vbuaa 
    sta SCREEN+5
    // main::@return
    // }
    // [22] return 
    rts
    words: .word $3031, $3233, $3435
}
  // File Data

