Setting inferred volatile on symbol affected by address-of (byte*~) main::$1 ← & (byte) val
Culled Empty Block (label) @1
Culled Empty Block (label) @2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) val#0 ← (number) 0
  to:@3
main: scope:[main]  from @3
  (byte) val#8 ← phi( @3/(byte) val#14 )
  (byte*) main::SCREEN1#0 ← ((byte*)) (number) $400
  (byte*~) main::$0 ← (byte*) main::SCREEN1#0 + (number) $28
  (byte*) main::SCREEN2#0 ← (byte*~) main::$0
  (byte) main::idx#0 ← (number) 0
  *((byte*) main::SCREEN1#0 + (byte) main::idx#0) ← (byte) val#8
  *((byte*) main::SCREEN2#0 + (byte) main::idx#0) ← (byte) '.'
  (byte) main::idx#1 ← ++ (byte) main::idx#0
  (byte) val#1 ← (number) 1
  *((byte*) main::SCREEN1#0 + (byte) main::idx#1) ← (byte) val#1
  *((byte*) main::SCREEN2#0 + (byte) main::idx#1) ← (byte) '.'
  (byte) main::idx#2 ← ++ (byte) main::idx#1
  (byte*~) main::$1 ← & (byte) val#1
  (byte*) main::ptr#0 ← (byte*~) main::$1
  (byte) val#2 ← (number) 2
  *((byte*) main::SCREEN1#0 + (byte) main::idx#2) ← (byte) val#2
  *((byte*) main::SCREEN2#0 + (byte) main::idx#2) ← *((byte*) main::ptr#0)
  (byte) main::idx#3 ← ++ (byte) main::idx#2
  *((byte*) main::ptr#0) ← (number) 3
  *((byte*) main::SCREEN1#0 + (byte) main::idx#3) ← (byte) val#2
  *((byte*) main::SCREEN2#0 + (byte) main::idx#3) ← *((byte*) main::ptr#0)
  (byte) main::idx#4 ← ++ (byte) main::idx#3
  (byte) setv::v#0 ← (number) 4
  call setv 
  to:main::@1
main::@1: scope:[main]  from main
  (byte*) main::ptr#1 ← phi( main/(byte*) main::ptr#0 )
  (byte) main::idx#7 ← phi( main/(byte) main::idx#4 )
  (byte) val#9 ← phi( main/(byte) val#6 )
  (byte) val#3 ← (byte) val#9
  *((byte*) main::SCREEN1#0 + (byte) main::idx#7) ← (byte) val#3
  *((byte*) main::SCREEN2#0 + (byte) main::idx#7) ← *((byte*) main::ptr#1)
  (byte) main::idx#5 ← ++ (byte) main::idx#7
  (byte*) setp::p#0 ← (byte*) main::ptr#1
  (byte) setp::v#0 ← (number) 5
  call setp 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte*) main::ptr#2 ← phi( main::@1/(byte*) main::ptr#1 )
  (byte) main::idx#8 ← phi( main::@1/(byte) main::idx#5 )
  (byte) val#10 ← phi( main::@1/(byte) val#3 )
  *((byte*) main::SCREEN1#0 + (byte) main::idx#8) ← (byte) val#10
  *((byte*) main::SCREEN2#0 + (byte) main::idx#8) ← *((byte*) main::ptr#2)
  (byte) main::idx#6 ← ++ (byte) main::idx#8
  to:main::@return
main::@return: scope:[main]  from main::@2
  (byte) val#11 ← phi( main::@2/(byte) val#10 )
  (byte) val#4 ← (byte) val#11
  return 
  to:@return
setv: scope:[setv]  from main
  (byte) setv::v#1 ← phi( main/(byte) setv::v#0 )
  (byte) val#5 ← (byte) setv::v#1
  to:setv::@return
setv::@return: scope:[setv]  from setv
  (byte) val#12 ← phi( setv/(byte) val#5 )
  (byte) val#6 ← (byte) val#12
  return 
  to:@return
setp: scope:[setp]  from main::@1
  (byte*) setp::p#1 ← phi( main::@1/(byte*) setp::p#0 )
  (byte) setp::v#1 ← phi( main::@1/(byte) setp::v#0 )
  *((byte*) setp::p#1) ← (byte) setp::v#1
  to:setp::@return
setp::@return: scope:[setp]  from setp
  return 
  to:@return
@3: scope:[]  from @begin
  (byte) val#14 ← phi( @begin/(byte) val#0 )
  call main 
  to:@4
@4: scope:[]  from @3
  (byte) val#13 ← phi( @3/(byte) val#4 )
  (byte) val#7 ← (byte) val#13
  to:@end
@end: scope:[]  from @4

SYMBOL TABLE SSA
(label) @3
(label) @4
(label) @begin
(label) @end
(void()) main()
(byte*~) main::$0
(byte*~) main::$1
(label) main::@1
(label) main::@2
(label) main::@return
(byte*) main::SCREEN1
(byte*) main::SCREEN1#0
(byte*) main::SCREEN2
(byte*) main::SCREEN2#0
(byte) main::idx
(byte) main::idx#0
(byte) main::idx#1
(byte) main::idx#2
(byte) main::idx#3
(byte) main::idx#4
(byte) main::idx#5
(byte) main::idx#6
(byte) main::idx#7
(byte) main::idx#8
(byte*) main::ptr
(byte*) main::ptr#0
(byte*) main::ptr#1
(byte*) main::ptr#2
(void()) setp((byte*) setp::p , (byte) setp::v)
(label) setp::@return
(byte*) setp::p
(byte*) setp::p#0
(byte*) setp::p#1
(byte) setp::v
(byte) setp::v#0
(byte) setp::v#1
(void()) setv((byte) setv::v)
(label) setv::@return
(byte) setv::v
(byte) setv::v#0
(byte) setv::v#1
(byte) val
(byte) val#0
(byte) val#1
(byte) val#10
(byte) val#11
(byte) val#12
(byte) val#13
(byte) val#14
(byte) val#2
(byte) val#3
(byte) val#4
(byte) val#5
(byte) val#6
(byte) val#7
(byte) val#8
(byte) val#9

Adding number conversion cast (unumber) 0 in (byte) val#0 ← (number) 0
Adding number conversion cast (unumber) $28 in (byte*~) main::$0 ← (byte*) main::SCREEN1#0 + (number) $28
Adding number conversion cast (unumber) 0 in (byte) main::idx#0 ← (number) 0
Adding number conversion cast (unumber) 1 in (byte) val#1 ← (number) 1
Adding number conversion cast (unumber) 2 in (byte) val#2 ← (number) 2
Adding number conversion cast (unumber) 3 in *((byte*) main::ptr#0) ← (number) 3
Adding number conversion cast (unumber) 4 in (byte) setv::v#0 ← (number) 4
Adding number conversion cast (unumber) 5 in (byte) setp::v#0 ← (number) 5
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) val#0 ← (unumber)(number) 0
Inlining cast (byte*) main::SCREEN1#0 ← (byte*)(number) $400
Inlining cast (byte) main::idx#0 ← (unumber)(number) 0
Inlining cast (byte) val#1 ← (unumber)(number) 1
Inlining cast (byte) val#2 ← (unumber)(number) 2
Inlining cast *((byte*) main::ptr#0) ← (unumber)(number) 3
Inlining cast (byte) setv::v#0 ← (unumber)(number) 4
Inlining cast (byte) setp::v#0 ← (unumber)(number) 5
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 0
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast $28
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Simplifying constant integer cast 4
Simplifying constant integer cast 5
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) 5
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte*) main::SCREEN2#0 = (byte*~) main::$0 
Alias (byte*) main::ptr#0 = (byte*~) main::$1 (byte*) main::ptr#1 (byte*) main::ptr#2 
Alias (byte) main::idx#4 = (byte) main::idx#7 
Alias (byte) val#10 = (byte) val#3 (byte) val#9 (byte) val#11 (byte) val#4 
Alias (byte) main::idx#5 = (byte) main::idx#8 
Alias (byte) val#12 = (byte) val#5 (byte) val#6 
Alias (byte) val#0 = (byte) val#14 
Alias (byte) val#13 = (byte) val#7 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) val#8 (byte) val#0
Identical Phi Values (byte) val#10 (byte) val#12
Identical Phi Values (byte) setv::v#1 (byte) setv::v#0
Identical Phi Values (byte) setp::v#1 (byte) setp::v#0
Identical Phi Values (byte*) setp::p#1 (byte*) setp::p#0
Identical Phi Values (byte) val#13 (byte) val#10
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [13] (byte*) main::ptr#0 ← & (byte) val#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::SCREEN1#0 = (byte*) 1024
Constant (const byte) main::idx#0 = 0
Constant (const byte*) main::ptr#0 = &val#1
Constant (const byte) setv::v#0 = 4
Constant (const byte) setp::v#0 = 5
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) setp::p#0 = main::ptr#0
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN1#0 in [6] *((const byte*) main::SCREEN1#0 + (const byte) main::idx#0) ← (byte) val#0
Simplifying expression containing zero main::SCREEN2#0 in [7] *((byte*) main::SCREEN2#0 + (const byte) main::idx#0) ← (byte) '.'
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte) main::idx#6 and assignment [24] (byte) main::idx#6 ← ++ (byte) main::idx#5
Successful SSA optimization PassNEliminateUnusedVars
Constant right-side identified [1] (byte*) main::SCREEN2#0 ← (const byte*) main::SCREEN1#0 + (byte) $28
Constant right-side identified [4] (byte) main::idx#1 ← ++ (const byte) main::idx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::SCREEN2#0 = main::SCREEN1#0+$28
Constant (const byte) main::idx#1 = ++main::idx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [6] (byte) main::idx#2 ← ++ (const byte) main::idx#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::idx#2 = ++main::idx#1
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [9] (byte) main::idx#3 ← ++ (const byte) main::idx#2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::idx#3 = ++main::idx#2
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [12] (byte) main::idx#4 ← ++ (const byte) main::idx#3
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::idx#4 = ++main::idx#3
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [15] (byte) main::idx#5 ← ++ (const byte) main::idx#4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::idx#5 = ++main::idx#4
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings (const byte) main::idx#0
Inlining constant with different constant siblings (const byte) main::idx#1
Inlining constant with different constant siblings (const byte) main::idx#2
Inlining constant with different constant siblings (const byte) main::idx#3
Inlining constant with different constant siblings (const byte) main::idx#4
Inlining constant with different constant siblings (const byte) main::idx#5
Constant inlined main::idx#0 = (byte) 0
Constant inlined main::idx#1 = ++(byte) 0
Constant inlined main::idx#2 = ++++(byte) 0
Constant inlined main::idx#3 = ++++++(byte) 0
Constant inlined main::idx#4 = ++++++++(byte) 0
Constant inlined main::idx#5 = ++++++++++(byte) 0
Constant inlined setp::p#0 = (const byte*) main::ptr#0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN1#0+++0)
Consolidated array index constant in *(main::SCREEN2#0+++0)
Consolidated array index constant in *(main::SCREEN1#0+++++0)
Consolidated array index constant in *(main::SCREEN2#0+++++0)
Consolidated array index constant in *(main::SCREEN1#0+++++++0)
Consolidated array index constant in *(main::SCREEN2#0+++++++0)
Consolidated array index constant in *(main::SCREEN1#0+++++++++0)
Consolidated array index constant in *(main::SCREEN2#0+++++++++0)
Consolidated array index constant in *(main::SCREEN1#0+++++++++++0)
Consolidated array index constant in *(main::SCREEN2#0+++++++++++0)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Simplifying constant integer increment ++1
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Simplifying constant integer increment ++2
Simplifying constant integer increment ++3
Simplifying constant integer increment ++3
Simplifying constant integer increment ++4
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Simplifying constant integer increment ++3
Simplifying constant integer increment ++4
Successful SSA optimization Pass2ConstantSimplification
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to setv:16 setp:19 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @4
Renumbering block @3 to @1
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] (byte) val#0 ← (byte) 0
  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] *((const byte*) main::SCREEN1#0) ← (byte) val#0
  [5] *((const byte*) main::SCREEN2#0) ← (byte) '.'
  [6] (byte) val#1 ← (byte) 1
  [7] *((const byte*) main::SCREEN1#0+(byte) 1) ← (byte) val#1
  [8] *((const byte*) main::SCREEN2#0+(byte) 1) ← (byte) '.'
  [9] (byte) val#2 ← (byte) 2
  [10] *((const byte*) main::SCREEN1#0+(byte) 2) ← (byte) val#2
  [11] *((const byte*) main::SCREEN2#0+(byte) 2) ← *((const byte*) main::ptr#0)
  [12] *((const byte*) main::ptr#0) ← (byte) 3
  [13] *((const byte*) main::SCREEN1#0+(byte) 3) ← (byte) val#2
  [14] *((const byte*) main::SCREEN2#0+(byte) 3) ← *((const byte*) main::ptr#0)
  [15] call setv 
  to:main::@1
main::@1: scope:[main]  from main
  [16] *((const byte*) main::SCREEN1#0+(byte) 4) ← (byte) val#12
  [17] *((const byte*) main::SCREEN2#0+(byte) 4) ← *((const byte*) main::ptr#0)
  [18] call setp 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [19] *((const byte*) main::SCREEN1#0+(byte) 5) ← (byte) val#12
  [20] *((const byte*) main::SCREEN2#0+(byte) 5) ← *((const byte*) main::ptr#0)
  to:main::@return
main::@return: scope:[main]  from main::@2
  [21] return 
  to:@return
setp: scope:[setp]  from main::@1
  [22] *((const byte*) main::ptr#0) ← (const byte) setp::v#0
  to:setp::@return
setp::@return: scope:[setp]  from setp
  [23] return 
  to:@return
setv: scope:[setv]  from main
  [24] (byte) val#12 ← (const byte) setv::v#0
  to:setv::@return
setv::@return: scope:[setv]  from setv
  [25] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*) main::SCREEN1
(byte*) main::SCREEN2
(byte) main::idx
(byte*) main::ptr
(void()) setp((byte*) setp::p , (byte) setp::v)
(byte*) setp::p
(byte) setp::v
(void()) setv((byte) setv::v)
(byte) setv::v
(byte) val
(byte) val#0 2.0
(byte) val#1 4.0
(byte) val#12 1.0
(byte) val#2 1.5

Initial phi equivalence classes
Coalescing volatile variable equivalence classes [ val#0 ] and [ val#1 ]
Coalescing volatile variable equivalence classes [ val#0 val#1 ] and [ val#2 ]
Coalescing volatile variable equivalence classes [ val#0 val#1 val#2 ] and [ val#12 ]
Complete equivalence classes
[ val#0 val#1 val#2 val#12 ]
Allocated zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ]

INITIAL ASM
  // File Comments
// Test address-of by assigning the affected variable in multiple ways
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label val = 2
  // @begin
bbegin:
  // [0] (byte) val#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta val
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN1 = $400
    .label ptr = val
    .label SCREEN2 = SCREEN1+$28
    // [4] *((const byte*) main::SCREEN1#0) ← (byte) val#0 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1
    // [5] *((const byte*) main::SCREEN2#0) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2
    // [6] (byte) val#1 ← (byte) 1 -- vbuz1=vbuc1 
    // Here we have not yet used address-of - so val can be versioned freely
    lda #1
    sta val
    // [7] *((const byte*) main::SCREEN1#0+(byte) 1) ← (byte) val#1 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+1
    // [8] *((const byte*) main::SCREEN2#0+(byte) 1) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2+1
    // [9] (byte) val#2 ← (byte) 2 -- vbuz1=vbuc1 
    // Set value directly
    lda #2
    sta val
    // [10] *((const byte*) main::SCREEN1#0+(byte) 2) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+2
    // [11] *((const byte*) main::SCREEN2#0+(byte) 2) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+2
    // [12] *((const byte*) main::ptr#0) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    // Set value through pointer
    lda #3
    sta ptr
    // [13] *((const byte*) main::SCREEN1#0+(byte) 3) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+3
    // [14] *((const byte*) main::SCREEN2#0+(byte) 3) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+3
    // [15] call setv 
    jsr setv
    jmp b1
    // main::@1
  b1:
    // [16] *((const byte*) main::SCREEN1#0+(byte) 4) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+4
    // [17] *((const byte*) main::SCREEN2#0+(byte) 4) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+4
    // [18] call setp 
    jsr setp
    jmp b2
    // main::@2
  b2:
    // [19] *((const byte*) main::SCREEN1#0+(byte) 5) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+5
    // [20] *((const byte*) main::SCREEN2#0+(byte) 5) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+5
    jmp breturn
    // main::@return
  breturn:
    // [21] return 
    rts
}
  // setp
setp: {
    .const v = 5
    // [22] *((const byte*) main::ptr#0) ← (const byte) setp::v#0 -- _deref_pbuc1=vbuc2 
    lda #v
    sta main.ptr
    jmp breturn
    // setp::@return
  breturn:
    // [23] return 
    rts
}
  // setv
setv: {
    .const v = 4
    // [24] (byte) val#12 ← (const byte) setv::v#0 -- vbuz1=vbuc1 
    lda #v
    sta val
    jmp breturn
    // setv::@return
  breturn:
    // [25] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) val#0 ← (byte) 0 [ val#0 ] (  [ val#0 ] ) always clobbers reg byte a 
Statement [4] *((const byte*) main::SCREEN1#0) ← (byte) val#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [5] *((const byte*) main::SCREEN2#0) ← (byte) '.' [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] (byte) val#1 ← (byte) 1 [ val#1 ] ( main:2 [ val#1 ] ) always clobbers reg byte a 
Statement [7] *((const byte*) main::SCREEN1#0+(byte) 1) ← (byte) val#1 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) main::SCREEN2#0+(byte) 1) ← (byte) '.' [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [9] (byte) val#2 ← (byte) 2 [ val#2 ] ( main:2 [ val#2 ] ) always clobbers reg byte a 
Statement [10] *((const byte*) main::SCREEN1#0+(byte) 2) ← (byte) val#2 [ val#2 ] ( main:2 [ val#2 ] ) always clobbers reg byte a 
Statement [11] *((const byte*) main::SCREEN2#0+(byte) 2) ← *((const byte*) main::ptr#0) [ val#2 ] ( main:2 [ val#2 ] ) always clobbers reg byte a 
Statement [12] *((const byte*) main::ptr#0) ← (byte) 3 [ val#2 ] ( main:2 [ val#2 ] ) always clobbers reg byte a 
Statement [13] *((const byte*) main::SCREEN1#0+(byte) 3) ← (byte) val#2 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [14] *((const byte*) main::SCREEN2#0+(byte) 3) ← *((const byte*) main::ptr#0) [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [16] *((const byte*) main::SCREEN1#0+(byte) 4) ← (byte) val#12 [ val#12 ] ( main:2 [ val#12 ] ) always clobbers reg byte a 
Statement [17] *((const byte*) main::SCREEN2#0+(byte) 4) ← *((const byte*) main::ptr#0) [ val#12 ] ( main:2 [ val#12 ] ) always clobbers reg byte a 
Statement [19] *((const byte*) main::SCREEN1#0+(byte) 5) ← (byte) val#12 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [20] *((const byte*) main::SCREEN2#0+(byte) 5) ← *((const byte*) main::ptr#0) [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [22] *((const byte*) main::ptr#0) ← (const byte) setp::v#0 [ ] ( main:2::setp:18 [ val#12 ] ) always clobbers reg byte a 
Statement [24] (byte) val#12 ← (const byte) setv::v#0 [ val#12 ] ( main:2::setv:15 [ val#12 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ] : zp ZP_BYTE:2 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 8.5: zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ] 
Uplift Scope [main] 
Uplift Scope [setv] 
Uplift Scope [setp] 

Uplifting [] best 175 combination zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ] 
Uplifting [main] best 175 combination 
Uplifting [setv] best 175 combination 
Uplifting [setp] best 175 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ]
Uplifting [] best 175 combination zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test address-of by assigning the affected variable in multiple ways
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label val = 2
  // @begin
bbegin:
  // [0] (byte) val#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta val
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label SCREEN1 = $400
    .label ptr = val
    .label SCREEN2 = SCREEN1+$28
    // [4] *((const byte*) main::SCREEN1#0) ← (byte) val#0 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1
    // [5] *((const byte*) main::SCREEN2#0) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2
    // [6] (byte) val#1 ← (byte) 1 -- vbuz1=vbuc1 
    // Here we have not yet used address-of - so val can be versioned freely
    lda #1
    sta val
    // [7] *((const byte*) main::SCREEN1#0+(byte) 1) ← (byte) val#1 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+1
    // [8] *((const byte*) main::SCREEN2#0+(byte) 1) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2+1
    // [9] (byte) val#2 ← (byte) 2 -- vbuz1=vbuc1 
    // Set value directly
    lda #2
    sta val
    // [10] *((const byte*) main::SCREEN1#0+(byte) 2) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+2
    // [11] *((const byte*) main::SCREEN2#0+(byte) 2) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+2
    // [12] *((const byte*) main::ptr#0) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    // Set value through pointer
    lda #3
    sta ptr
    // [13] *((const byte*) main::SCREEN1#0+(byte) 3) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+3
    // [14] *((const byte*) main::SCREEN2#0+(byte) 3) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+3
    // [15] call setv 
    jsr setv
    jmp b1
    // main::@1
  b1:
    // [16] *((const byte*) main::SCREEN1#0+(byte) 4) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+4
    // [17] *((const byte*) main::SCREEN2#0+(byte) 4) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+4
    // [18] call setp 
    jsr setp
    jmp b2
    // main::@2
  b2:
    // [19] *((const byte*) main::SCREEN1#0+(byte) 5) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+5
    // [20] *((const byte*) main::SCREEN2#0+(byte) 5) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+5
    jmp breturn
    // main::@return
  breturn:
    // [21] return 
    rts
}
  // setp
setp: {
    .const v = 5
    // [22] *((const byte*) main::ptr#0) ← (const byte) setp::v#0 -- _deref_pbuc1=vbuc2 
    lda #v
    sta main.ptr
    jmp breturn
    // setp::@return
  breturn:
    // [23] return 
    rts
}
  // setv
setv: {
    .const v = 4
    // [24] (byte) val#12 ← (const byte) setv::v#0 -- vbuz1=vbuc1 
    lda #v
    sta val
    jmp breturn
    // setv::@return
  breturn:
    // [25] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda val
Removing instruction lda val
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction b1_from_bbegin:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b1:
Removing instruction bend:
Removing instruction b1:
Removing instruction b2:
Removing instruction breturn:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block 
Succesful ASM optimization Pass5AddMainRts

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(byte*) main::SCREEN1
(const byte*) main::SCREEN1#0 SCREEN1 = (byte*) 1024
(byte*) main::SCREEN2
(const byte*) main::SCREEN2#0 SCREEN2 = (const byte*) main::SCREEN1#0+(byte) $28
(byte) main::idx
(byte*) main::ptr
(const byte*) main::ptr#0 ptr = &(byte) val#1
(void()) setp((byte*) setp::p , (byte) setp::v)
(label) setp::@return
(byte*) setp::p
(byte) setp::v
(const byte) setp::v#0 v = (byte) 5
(void()) setv((byte) setv::v)
(label) setv::@return
(byte) setv::v
(const byte) setv::v#0 v = (byte) 4
(byte) val
(byte) val#0 val zp ZP_BYTE:2 2.0
(byte) val#1 val zp ZP_BYTE:2 4.0
(byte) val#12 val zp ZP_BYTE:2 1.0
(byte) val#2 val zp ZP_BYTE:2 1.5

zp ZP_BYTE:2 [ val#0 val#1 val#2 val#12 ]


FINAL ASSEMBLER
Score: 154

  // File Comments
// Test address-of by assigning the affected variable in multiple ways
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label val = 2
  // @begin
bbegin:
  // val = 0
  // [0] (byte) val#0 ← (byte) 0 -- vbuz1=vbuc1 
  lda #0
  sta val
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  jsr main
  rts
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN1 = $400
    .label ptr = val
    .label SCREEN2 = SCREEN1+$28
    // SCREEN1[idx] = val
    // [4] *((const byte*) main::SCREEN1#0) ← (byte) val#0 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1
    // SCREEN2[idx++] = '.'
    // [5] *((const byte*) main::SCREEN2#0) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2
    // val = 1
    // [6] (byte) val#1 ← (byte) 1 -- vbuz1=vbuc1 
    // Here we have not yet used address-of - so val can be versioned freely
    lda #1
    sta val
    // SCREEN1[idx] = val
    // [7] *((const byte*) main::SCREEN1#0+(byte) 1) ← (byte) val#1 -- _deref_pbuc1=vbuz1 
    sta SCREEN1+1
    // SCREEN2[idx++] = '.'
    // [8] *((const byte*) main::SCREEN2#0+(byte) 1) ← (byte) '.' -- _deref_pbuc1=vbuc2 
    lda #'.'
    sta SCREEN2+1
    // val = 2
    // [9] (byte) val#2 ← (byte) 2 -- vbuz1=vbuc1 
    // Set value directly
    lda #2
    sta val
    // SCREEN1[idx] = val
    // [10] *((const byte*) main::SCREEN1#0+(byte) 2) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    sta SCREEN1+2
    // SCREEN2[idx++] = *ptr
    // [11] *((const byte*) main::SCREEN2#0+(byte) 2) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+2
    // *ptr = 3
    // [12] *((const byte*) main::ptr#0) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    // Set value through pointer
    lda #3
    sta ptr
    // SCREEN1[idx] = val
    // [13] *((const byte*) main::SCREEN1#0+(byte) 3) ← (byte) val#2 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+3
    // SCREEN2[idx++] = *ptr
    // [14] *((const byte*) main::SCREEN2#0+(byte) 3) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+3
    // setv(4)
    // [15] call setv 
    jsr setv
    // main::@1
    // SCREEN1[idx] = val
    // [16] *((const byte*) main::SCREEN1#0+(byte) 4) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+4
    // SCREEN2[idx++] = *ptr
    // [17] *((const byte*) main::SCREEN2#0+(byte) 4) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+4
    // setp(ptr, 5)
    // [18] call setp 
    jsr setp
    // main::@2
    // SCREEN1[idx] = val
    // [19] *((const byte*) main::SCREEN1#0+(byte) 5) ← (byte) val#12 -- _deref_pbuc1=vbuz1 
    lda val
    sta SCREEN1+5
    // SCREEN2[idx++] = *ptr
    // [20] *((const byte*) main::SCREEN2#0+(byte) 5) ← *((const byte*) main::ptr#0) -- _deref_pbuc1=_deref_pbuc2 
    lda ptr
    sta SCREEN2+5
    // main::@return
    // }
    // [21] return 
    rts
}
  // setp
setp: {
    .const v = 5
    // *p = v
    // [22] *((const byte*) main::ptr#0) ← (const byte) setp::v#0 -- _deref_pbuc1=vbuc2 
    lda #v
    sta main.ptr
    // setp::@return
    // }
    // [23] return 
    rts
}
  // setv
setv: {
    .const v = 4
    // val = v
    // [24] (byte) val#12 ← (const byte) setv::v#0 -- vbuz1=vbuc1 
    lda #v
    sta val
    // setv::@return
    // }
    // [25] return 
    rts
}
  // File Data

