Setting inferred volatile on symbol affected by address-of main::sb_ptr = (signed char *)&main::ub
Setting inferred volatile on symbol affected by address-of main::ub_ptr = (char *)&main::sb

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::ub = $ff
  *main::sb_ptr = 1
  *main::ub_screen = main::ub
  main::sb = (signed char)$7f
  *main::ub_ptr = 1
  *main::sb_screen = main::sb
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  call main
  to:__start::@1
__start::@1: scope:[__start]  from __start
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  return 
  to:@return

SYMBOL TABLE SSA
void __start()
void main()
__loadstore volatile signed char main::sb
__constant signed char *main::sb_ptr = (signed char *)&main::ub
__constant signed char * const main::sb_screen = (signed char *)$428
__loadstore volatile char main::ub
__constant char *main::ub_ptr = (char *)&main::sb
__constant char * const main::ub_screen = (char *)$400

Adding number conversion cast (snumber) 1 in *main::sb_ptr = 1
Adding number conversion cast (unumber) 1 in *main::ub_ptr = 1
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *main::sb_ptr = (snumber)1
Inlining cast *main::ub_ptr = (unumber)1
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (signed char *) 1064
Simplifying constant integer cast 1
Simplifying constant integer cast $7f
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized signed number type (signed char) 1
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] main::ub = $ff
  [1] *main::sb_ptr = 1
  [2] *main::ub_screen = main::ub
  [3] main::sb = $7f
  [4] *main::ub_ptr = 1
  [5] *main::sb_screen = main::sb
  to:main::@return
main::@return: scope:[main]  from main
  [6] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
__loadstore volatile signed char main::sb // 2.0
__loadstore volatile char main::ub // 2.0

Initial phi equivalence classes
Added variable main::ub to live range equivalence class [ main::ub ]
Added variable main::sb to live range equivalence class [ main::sb ]
Complete equivalence classes
[ main::ub ]
[ main::sb ]
Allocated zp[1]:2 [ main::ub ]
Allocated zp[1]:3 [ main::sb ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] main::ub = $ff [ main::ub ] (  [ main::ub ] { }  ) always clobbers reg byte a 
Statement [1] *main::sb_ptr = 1 [ main::ub ] (  [ main::ub ] { }  ) always clobbers reg byte a 
Statement [2] *main::ub_screen = main::ub [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] main::sb = $7f [ main::sb ] (  [ main::sb ] { }  ) always clobbers reg byte a 
Statement [4] *main::ub_ptr = 1 [ main::sb ] (  [ main::sb ] { }  ) always clobbers reg byte a 
Statement [5] *main::sb_screen = main::sb [ ] (  [ ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::ub ] : zp[1]:2 , 
Potential registers zp[1]:3 [ main::sb ] : zp[1]:3 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 2: zp[1]:2 [ main::ub ] 2: zp[1]:3 [ main::sb ] 
Uplift Scope [] 

Uplifting [main] best 43 combination zp[1]:2 [ main::ub ] zp[1]:3 [ main::sb ] 
Uplifting [] best 43 combination 
Attempting to uplift remaining variables inzp[1]:2 [ main::ub ]
Uplifting [main] best 43 combination zp[1]:2 [ main::ub ] 
Attempting to uplift remaining variables inzp[1]:3 [ main::sb ]
Uplifting [main] best 43 combination zp[1]:3 [ main::sb ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests casting pointer types to other pointer types
  // Upstart
  // Commodore 64 PRG executable file
.file [name="pointer-cast-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
.segment Code
  // main
main: {
    .label ub_screen = $400
    .label sb_screen = $428
    .label sb_ptr = ub
    .label ub_ptr = sb
    .label ub = 2
    .label sb = 3
    // [0] main::ub = $ff -- vbuz1=vbuc1 
    lda #$ff
    sta.z ub
    // [1] *main::sb_ptr = 1 -- _deref_pbsc1=vbsc2 
    lda #1
    sta.z sb_ptr
    // [2] *main::ub_screen = main::ub -- _deref_pbuc1=vbuz1 
    lda.z ub
    sta ub_screen
    // [3] main::sb = $7f -- vbsz1=vbsc1 
    lda #$7f
    sta.z sb
    // [4] *main::ub_ptr = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta.z ub_ptr
    // [5] *main::sb_screen = main::sb -- _deref_pbsc1=vbsz1 
    lda.z sb
    sta sb_screen
    jmp __breturn
    // main::@return
  __breturn:
    // [6] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
void main()
__loadstore volatile signed char main::sb // zp[1]:3 2.0
__constant signed char *main::sb_ptr = (signed char *)&main::ub
__constant signed char * const main::sb_screen = (signed char *) 1064
__loadstore volatile char main::ub // zp[1]:2 2.0
__constant char *main::ub_ptr = (char *)&main::sb
__constant char * const main::ub_screen = (char *) 1024

zp[1]:2 [ main::ub ]
zp[1]:3 [ main::sb ]


FINAL ASSEMBLER
Score: 40

  // File Comments
// Tests casting pointer types to other pointer types
  // Upstart
  // Commodore 64 PRG executable file
.file [name="pointer-cast-2.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
.segment Code
  // main
main: {
    .label ub_screen = $400
    .label sb_screen = $428
    .label sb_ptr = ub
    .label ub_ptr = sb
    .label ub = 2
    .label sb = 3
    // byte ub = 0xff
    // [0] main::ub = $ff -- vbuz1=vbuc1 
    lda #$ff
    sta.z ub
    // *sb_ptr = 1
    // [1] *main::sb_ptr = 1 -- _deref_pbsc1=vbsc2 
    lda #1
    sta.z sb_ptr
    // *ub_screen = ub
    // [2] *main::ub_screen = main::ub -- _deref_pbuc1=vbuz1 
    lda.z ub
    sta ub_screen
    // signed byte sb = (signed byte)0x7f
    // [3] main::sb = $7f -- vbsz1=vbsc1 
    lda #$7f
    sta.z sb
    // *ub_ptr = 1
    // [4] *main::ub_ptr = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta.z ub_ptr
    // *sb_screen = sb
    // [5] *main::sb_screen = main::sb -- _deref_pbsc1=vbsz1 
    lda.z sb
    sta sb_screen
    // main::@return
    // }
    // [6] return 
    rts
}
  // File Data

