Setting inferred volatile on symbol affected by address-of (byte*) main::pb ← &(byte) main::b
Setting inferred volatile on symbol affected by address-of (byte**) main::ppb ← &(byte*) main::pb
Identified constant variable (byte**) main::ppb

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

(void()) main()
main: scope:[main]  from @1
  (byte) main::b ← (byte) 'a'
  (byte*) main::pb ← &(byte) main::b
  *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb))
  to:main::@return
main::@return: scope:[main]  from main
  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()
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::b loadstore
(byte*) main::pb loadstore
(const byte**) main::ppb = &(byte*) main::pb

Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
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) 'a'
  [5] (byte*) main::pb ← &(byte) main::b
  [6] *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb))
  to:main::@return
main::@return: scope:[main]  from main
  [7] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::b loadstore 2.0
(byte*) main::pb loadstore 20.0

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

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Tests a simple pointer to a pointer
  // 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 ppb = pb
    .label b = 2
    .label pb = 3
    // [4] (byte) main::b ← (byte) 'a' -- vbuz1=vbuc1 
    lda #'a'
    sta.z b
    // [5] (byte*) main::pb ← &(byte) main::b -- pbuz1=pbuc1 
    lda #<b
    sta.z pb
    lda #>b
    sta.z pb+1
    // [6] *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb)) -- _deref_pbuc1=_deref_(_deref_pptc2) 
    ldy.z ppb
    sty.z $fe
    ldy.z ppb+1
    sty.z $ff
    ldy #0
    lda ($fe),y
    sta SCREEN
    jmp __breturn
    // main::@return
  __breturn:
    // [7] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::b ← (byte) 'a' [ main::b ] ( main:2 [ main::b ] ) always clobbers reg byte a 
Statement [5] (byte*) main::pb ← &(byte) main::b [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb)) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:2 [ main::b ] : zp[1]:2 , 
Potential registers zp[2]:3 [ main::pb ] : zp[2]:3 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 20: zp[2]:3 [ main::pb ] 2: zp[1]:2 [ main::b ] 
Uplift Scope [] 

Uplifting [main] best 59 combination zp[2]:3 [ main::pb ] zp[1]:2 [ main::b ] 
Uplifting [] best 59 combination 
Attempting to uplift remaining variables inzp[1]:2 [ main::b ]
Uplifting [main] best 59 combination zp[1]:2 [ main::b ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests a simple pointer to a pointer
  // 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 ppb = pb
    .label b = 2
    .label pb = 3
    // [4] (byte) main::b ← (byte) 'a' -- vbuz1=vbuc1 
    lda #'a'
    sta.z b
    // [5] (byte*) main::pb ← &(byte) main::b -- pbuz1=pbuc1 
    lda #<b
    sta.z pb
    lda #>b
    sta.z pb+1
    // [6] *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb)) -- _deref_pbuc1=_deref_(_deref_pptc2) 
    ldy.z ppb
    sty.z $fe
    ldy.z ppb+1
    sty.z $ff
    ldy #0
    lda ($fe),y
    sta SCREEN
    jmp __breturn
    // main::@return
  __breturn:
    // [7] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
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::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::b loadstore zp[1]:2 2.0
(byte*) main::pb loadstore zp[2]:3 20.0
(const byte**) main::ppb = &(byte*) main::pb

zp[1]:2 [ main::b ]
zp[2]:3 [ main::pb ]


FINAL ASSEMBLER
Score: 44

  // File Comments
// Tests a simple pointer to a pointer
  // 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 ppb = pb
    .label b = 2
    .label pb = 3
    // b = 'a'
    // [4] (byte) main::b ← (byte) 'a' -- vbuz1=vbuc1 
    lda #'a'
    sta.z b
    // pb = &b
    // [5] (byte*) main::pb ← &(byte) main::b -- pbuz1=pbuc1 
    lda #<b
    sta.z pb
    lda #>b
    sta.z pb+1
    // *SCREEN = **ppb
    // [6] *((const byte*) main::SCREEN) ← *(*((const byte**) main::ppb)) -- _deref_pbuc1=_deref_(_deref_pptc2) 
    ldy.z ppb
    sty.z $fe
    ldy.z ppb+1
    sty.z $ff
    ldy #0
    lda ($fe),y
    sta SCREEN
    // main::@return
    // }
    // [7] return 
    rts
}
  // File Data

