Setting inferred volatile on symbol affected by address-of (byte*) main::bp ← &(byte) main::b
Identified constant variable (byte*) main::SCREEN
Identified constant variable (byte*) main::bp
Culled Empty Block (label) main::@2

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@1

(void()) main()
main: scope:[main]  from @1
  (byte) main::b ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  (number~) main::$0 ← *((const byte*) main::bp) + (number) 1
  (byte) main::c#0 ← (number~) main::$0
  *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0
  (byte) main::b ← (byte) main::b + rangenext(0,$a)
  (bool~) main::$1 ← (byte) main::b != rangelast(0,$a)
  if((bool~) main::$1) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@1
  return 
  to:@return
@1: scope:[]  from @begin
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(void()) main()
(number~) main::$0
(bool~) main::$1
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::b loadstore
(const byte*) main::bp = &(byte) main::b
(byte) main::c
(byte) main::c#0

Adding number conversion cast (unumber) 1 in (number~) main::$0 ← *((const byte*) main::bp) + (number) 1
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← *((const byte*) main::bp) + (unumber)(number) 1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$0 ← *((const byte*) main::bp) + (byte) 1
Alias (byte) main::c#0 = (byte~) main::$0 
Successful SSA optimization Pass2AliasElimination
Simple Condition (bool~) main::$1 [6] if((byte) main::b!=rangelast(0,$a)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [4] main::b ← ++ main::b to ++
Resolved ranged comparison value [6] if(main::b!=rangelast(0,$a)) goto main::@1 to (number) $b
Adding number conversion cast (unumber) $b in if((byte) main::b!=(number) $b) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()

(void()) main()
main: scope:[main]  from @1
  [4] (byte) main::b ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@1
  [5] (byte) main::c#0 ← *((const byte*) main::bp) + (byte) 1
  [6] *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0
  [7] (byte) main::b ← ++ (byte) main::b
  [8] if((byte) main::b!=(byte) $b) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@1
  [9] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::b loadstore 11.5
(byte) main::c
(byte) main::c#0 22.0

Initial phi equivalence classes
Added variable main::b to live range equivalence class [ main::b ]
Added variable main::c#0 to live range equivalence class [ main::c#0 ]
Complete equivalence classes
[ main::b ]
[ main::c#0 ]
Allocated zp[1]:2 [ main::b ]
Allocated zp[1]:3 [ main::c#0 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test address-of - use the pointer to get the value
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    .label bp = b
    .label b = 2
    .label c = 3
    // [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) main::c#0 ← *((const byte*) main::bp) + (byte) 1 -- vbuz1=_deref_pbuc1_plus_1 
    ldy.z bp
    iny
    sty.z c
    // [6] *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z c
    ldy.z b
    sta SCREEN,y
    // [7] (byte) main::b ← ++ (byte) main::b -- vbuz1=_inc_vbuz1 
    inc.z b
    // [8] if((byte) main::b!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z b
    bne __b1
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::b ← (byte) 0 [ main::b ] ( main:2 [ main::b ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0 [ ] ( main:2 [ ] ) always clobbers reg byte y 
Statement [8] if((byte) main::b!=(byte) $b) goto main::@1 [ main::b ] ( main:2 [ main::b ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::b ] : zp[1]:2 , 
Potential registers zp[1]:3 [ main::c#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 22: zp[1]:3 [ main::c#0 ] 11.5: zp[1]:2 [ main::b ] 
Uplift Scope [] 

Uplifting [main] best 331 combination reg byte a [ main::c#0 ] zp[1]:2 [ main::b ] 
Uplifting [] best 331 combination 
Attempting to uplift remaining variables inzp[1]:2 [ main::b ]
Uplifting [main] best 331 combination zp[1]:2 [ main::b ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test address-of - use the pointer to get the value
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label SCREEN = $400
    .label bp = b
    .label b = 2
    // [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b
    jmp __b1
    // main::@1
  __b1:
    // [5] (byte) main::c#0 ← *((const byte*) main::bp) + (byte) 1 -- vbuaa=_deref_pbuc1_plus_1 
    lda.z bp
    clc
    adc #1
    // [6] *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z b
    sta SCREEN,y
    // [7] (byte) main::b ← ++ (byte) main::b -- vbuz1=_inc_vbuz1 
    inc.z b
    // [8] if((byte) main::b!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z b
    bne __b1
    jmp __breturn
    // main::@return
  __breturn:
    // [9] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::b loadstore zp[1]:2 11.5
(const byte*) main::bp = &(byte) main::b
(byte) main::c
(byte) main::c#0 reg byte a 22.0

zp[1]:2 [ main::b ]
reg byte a [ main::c#0 ]


FINAL ASSEMBLER
Score: 286

  // File Comments
// Test address-of - use the pointer to get the value
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label SCREEN = $400
    .label bp = b
    .label b = 2
    // for( byte b: 0..10)
    // [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b
    // main::@1
  __b1:
    // c = *bp +1
    // [5] (byte) main::c#0 ← *((const byte*) main::bp) + (byte) 1 -- vbuaa=_deref_pbuc1_plus_1 
    lda.z bp
    clc
    adc #1
    // SCREEN[b] = c
    // [6] *((const byte*) main::SCREEN + (byte) main::b) ← (byte) main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z b
    sta SCREEN,y
    // for( byte b: 0..10)
    // [7] (byte) main::b ← ++ (byte) main::b -- vbuz1=_inc_vbuz1 
    inc.z b
    // [8] if((byte) main::b!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z b
    bne __b1
    // main::@return
    // }
    // [9] return 
    rts
}
  // File Data

