Setting inferred volatile on symbol affected by address-of main::$0 = call setByte(&main::b1, 'c')
Setting inferred volatile on symbol affected by address-of main::$1 = call setByte(&main::b2, 'm')
Setting inferred volatile on symbol affected by address-of main::$2 = call setByte(&main::b3, 'l')

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::b1 = 0
  main::b2 = 0
  main::b3 = 0
  setByte::ptr#0 = &main::b1
  setByte::b#0 = 'c'
  call setByte
  to:main::@1
main::@1: scope:[main]  from main
  setByte::ptr#1 = &main::b2
  setByte::b#1 = 'm'
  call setByte
  to:main::@2
main::@2: scope:[main]  from main::@1
  setByte::ptr#2 = &main::b3
  setByte::b#2 = 'l'
  call setByte
  to:main::@3
main::@3: scope:[main]  from main::@2
  main::SCREEN[0] = main::b1
  main::SCREEN[1] = main::b2
  main::SCREEN[2] = main::b3
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return

void setByte(char *ptr , char b)
setByte: scope:[setByte]  from main main::@1 main::@2
  setByte::ptr#3 = phi( main/setByte::ptr#0, main::@1/setByte::ptr#1, main::@2/setByte::ptr#2 )
  setByte::b#3 = phi( main/setByte::b#0, main::@1/setByte::b#1, main::@2/setByte::b#2 )
  *setByte::ptr#3 = setByte::b#3
  to:setByte::@return
setByte::@return: scope:[setByte]  from setByte
  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()
__constant char *main::SCREEN = (char *)$400
__loadstore volatile char main::b1
__loadstore volatile char main::b2
__loadstore volatile char main::b3
void setByte(char *ptr , char b)
char setByte::b
char setByte::b#0
char setByte::b#1
char setByte::b#2
char setByte::b#3
char *setByte::ptr
char *setByte::ptr#0
char *setByte::ptr#1
char *setByte::ptr#2
char *setByte::ptr#3

Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::b1
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::b2
Adding number conversion cast (unumber) 2 in main::SCREEN[2] = main::b3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant setByte::ptr#0 = &main::b1
Constant setByte::b#0 = 'c'
Constant setByte::ptr#1 = &main::b2
Constant setByte::b#1 = 'm'
Constant setByte::ptr#2 = &main::b3
Constant setByte::b#2 = 'l'
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero main::SCREEN in [12] main::SCREEN[0] = main::b1
Successful SSA optimization PassNSimplifyExpressionWithZero
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
Inlining constant with var siblings setByte::ptr#0
Inlining constant with var siblings setByte::b#0
Inlining constant with var siblings setByte::ptr#1
Inlining constant with var siblings setByte::b#1
Inlining constant with var siblings setByte::ptr#2
Inlining constant with var siblings setByte::b#2
Constant inlined setByte::ptr#1 = &main::b2
Constant inlined setByte::ptr#2 = &main::b3
Constant inlined setByte::ptr#0 = &main::b1
Constant inlined setByte::b#2 = 'l'
Constant inlined setByte::b#1 = 'm'
Constant inlined setByte::b#0 = 'c'
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
Consolidated array index constant in *(main::SCREEN+2)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [main] to setByte:3 setByte:5 setByte:7 

Created 2 initial phi equivalence classes
Coalesced down to 2 phi equivalence classes
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] main::b1 = 0
  [1] main::b2 = 0
  [2] main::b3 = 0
  [3] call setByte
  to:main::@1
main::@1: scope:[main]  from main
  [4] phi()
  [5] call setByte
  to:main::@2
main::@2: scope:[main]  from main::@1
  [6] phi()
  [7] call setByte
  to:main::@3
main::@3: scope:[main]  from main::@2
  [8] *main::SCREEN = main::b1
  [9] *(main::SCREEN+1) = main::b2
  [10] *(main::SCREEN+2) = main::b3
  to:main::@return
main::@return: scope:[main]  from main::@3
  [11] return 
  to:@return

void setByte(char *ptr , char b)
setByte: scope:[setByte]  from main main::@1 main::@2
  [12] setByte::ptr#3 = phi( main/&main::b1, main::@1/&main::b2, main::@2/&main::b3 )
  [12] setByte::b#3 = phi( main/'c', main::@1/'m', main::@2/'l' )
  [13] *setByte::ptr#3 = setByte::b#3
  to:setByte::@return
setByte::@return: scope:[setByte]  from setByte
  [14] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
__loadstore volatile char main::b1 // 0.36363636363636365
__loadstore volatile char main::b2 // 0.36363636363636365
__loadstore volatile char main::b3 // 0.36363636363636365
void setByte(char *ptr , char b)
char setByte::b
char setByte::b#3 // 11.0
char *setByte::ptr
char *setByte::ptr#3 // 11.0

Initial phi equivalence classes
[ setByte::b#3 ]
[ setByte::ptr#3 ]
Added variable main::b1 to live range equivalence class [ main::b1 ]
Added variable main::b2 to live range equivalence class [ main::b2 ]
Added variable main::b3 to live range equivalence class [ main::b3 ]
Complete equivalence classes
[ setByte::b#3 ]
[ setByte::ptr#3 ]
[ main::b1 ]
[ main::b2 ]
[ main::b3 ]
Allocated zp[1]:2 [ setByte::b#3 ]
Allocated zp[2]:3 [ setByte::ptr#3 ]
Allocated zp[1]:5 [ main::b1 ]
Allocated zp[1]:6 [ main::b2 ]
Allocated zp[1]:7 [ main::b3 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] main::b1 = 0 [ main::b1 ] (  [ main::b1 ] { }  ) always clobbers reg byte a 
Statement [1] main::b2 = 0 [ main::b1 main::b2 ] (  [ main::b1 main::b2 ] { }  ) always clobbers reg byte a 
Statement [2] main::b3 = 0 [ main::b1 main::b2 main::b3 ] (  [ main::b1 main::b2 main::b3 ] { }  ) always clobbers reg byte a 
Statement [8] *main::SCREEN = main::b1 [ main::b2 main::b3 ] (  [ main::b2 main::b3 ] { }  ) always clobbers reg byte a 
Statement [9] *(main::SCREEN+1) = main::b2 [ main::b3 ] (  [ main::b3 ] { }  ) always clobbers reg byte a 
Statement [10] *(main::SCREEN+2) = main::b3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [13] *setByte::ptr#3 = setByte::b#3 [ main::b1 main::b2 main::b3 ] ( setByte:3 [ main::b1 main::b2 main::b3 ] { }  setByte:5 [ main::b1 main::b2 main::b3 ] { }  setByte:7 [ main::b1 main::b2 main::b3 ] { }  ) always clobbers reg byte y 
Potential registers zp[1]:2 [ setByte::b#3 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:3 [ setByte::ptr#3 ] : zp[2]:3 , 
Potential registers zp[1]:5 [ main::b1 ] : zp[1]:5 , 
Potential registers zp[1]:6 [ main::b2 ] : zp[1]:6 , 
Potential registers zp[1]:7 [ main::b3 ] : zp[1]:7 , 

REGISTER UPLIFT SCOPES
Uplift Scope [setByte] 11: zp[1]:2 [ setByte::b#3 ] 11: zp[2]:3 [ setByte::ptr#3 ] 
Uplift Scope [main] 0.36: zp[1]:5 [ main::b1 ] 0.36: zp[1]:6 [ main::b2 ] 0.36: zp[1]:7 [ main::b3 ] 
Uplift Scope [] 

Uplifting [setByte] best 127 combination reg byte x [ setByte::b#3 ] zp[2]:3 [ setByte::ptr#3 ] 
Uplifting [main] best 127 combination zp[1]:5 [ main::b1 ] zp[1]:6 [ main::b2 ] zp[1]:7 [ main::b3 ] 
Uplifting [] best 127 combination 
Attempting to uplift remaining variables inzp[1]:5 [ main::b1 ]
Uplifting [main] best 127 combination zp[1]:5 [ main::b1 ] 
Attempting to uplift remaining variables inzp[1]:6 [ main::b2 ]
Uplifting [main] best 127 combination zp[1]:6 [ main::b2 ] 
Attempting to uplift remaining variables inzp[1]:7 [ main::b3 ]
Uplifting [main] best 127 combination zp[1]:7 [ main::b3 ] 
Allocated (was zp[2]:3) zp[2]:2 [ setByte::ptr#3 ]
Allocated (was zp[1]:5) zp[1]:4 [ main::b1 ]
Allocated (was zp[1]:6) zp[1]:5 [ main::b2 ]
Allocated (was zp[1]:7) zp[1]:6 [ main::b3 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test address-of - pass the pointer as parameter
  // Upstart
  // Commodore 64 PRG executable file
.file [name="address-of-1.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 SCREEN = $400
    .label b1 = 4
    .label b2 = 5
    .label b3 = 6
    // [0] main::b1 = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b1
    // [1] main::b2 = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b2
    // [2] main::b3 = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b3
    // [3] call setByte
    // [12] phi from main to setByte [phi:main->setByte]
  setByte_from_main:
    // [12] phi setByte::ptr#3 = &main::b1 [phi:main->setByte#0] -- pbuz1=pbuc1 
    lda #<b1
    sta.z setByte.ptr
    lda #>b1
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'c' [phi:main->setByte#1] -- vbuxx=vbuc1 
    ldx #'c'
    jsr setByte
    // [4] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    jmp __b1
    // main::@1
  __b1:
    // [5] call setByte
    // [12] phi from main::@1 to setByte [phi:main::@1->setByte]
  setByte_from___b1:
    // [12] phi setByte::ptr#3 = &main::b2 [phi:main::@1->setByte#0] -- pbuz1=pbuc1 
    lda #<b2
    sta.z setByte.ptr
    lda #>b2
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'm' [phi:main::@1->setByte#1] -- vbuxx=vbuc1 
    ldx #'m'
    jsr setByte
    // [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    jmp __b2
    // main::@2
  __b2:
    // [7] call setByte
    // [12] phi from main::@2 to setByte [phi:main::@2->setByte]
  setByte_from___b2:
    // [12] phi setByte::ptr#3 = &main::b3 [phi:main::@2->setByte#0] -- pbuz1=pbuc1 
    lda #<b3
    sta.z setByte.ptr
    lda #>b3
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'l' [phi:main::@2->setByte#1] -- vbuxx=vbuc1 
    ldx #'l'
    jsr setByte
    jmp __b3
    // main::@3
  __b3:
    // [8] *main::SCREEN = main::b1 -- _deref_pbuc1=vbuz1 
    lda.z b1
    sta SCREEN
    // [9] *(main::SCREEN+1) = main::b2 -- _deref_pbuc1=vbuz1 
    lda.z b2
    sta SCREEN+1
    // [10] *(main::SCREEN+2) = main::b3 -- _deref_pbuc1=vbuz1 
    lda.z b3
    sta SCREEN+2
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // setByte
// void setByte(__zp(2) char *ptr, __register(X) char b)
setByte: {
    .label ptr = 2
    // [13] *setByte::ptr#3 = setByte::b#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (ptr),y
    jmp __breturn
    // setByte::@return
  __breturn:
    // [14] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction __b1_from_main:
Removing instruction setByte_from___b1:
Removing instruction __b2_from___b1:
Removing instruction setByte_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction setByte_from_main:
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
void main()
__constant char *main::SCREEN = (char *) 1024
__loadstore volatile char main::b1 // zp[1]:4 0.36363636363636365
__loadstore volatile char main::b2 // zp[1]:5 0.36363636363636365
__loadstore volatile char main::b3 // zp[1]:6 0.36363636363636365
void setByte(char *ptr , char b)
char setByte::b
char setByte::b#3 // reg byte x 11.0
char *setByte::ptr
char *setByte::ptr#3 // ptr zp[2]:2 11.0

reg byte x [ setByte::b#3 ]
zp[2]:2 [ setByte::ptr#3 ]
zp[1]:4 [ main::b1 ]
zp[1]:5 [ main::b2 ]
zp[1]:6 [ main::b3 ]


FINAL ASSEMBLER
Score: 108

  // File Comments
// Test address-of - pass the pointer as parameter
  // Upstart
  // Commodore 64 PRG executable file
.file [name="address-of-1.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 SCREEN = $400
    .label b1 = 4
    .label b2 = 5
    .label b3 = 6
    // byte b1 = 0
    // [0] main::b1 = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z b1
    // byte b2 = 0
    // [1] main::b2 = 0 -- vbuz1=vbuc1 
    sta.z b2
    // byte b3 = 0
    // [2] main::b3 = 0 -- vbuz1=vbuc1 
    sta.z b3
    // setByte(&b1, 'c')
    // [3] call setByte
    // [12] phi from main to setByte [phi:main->setByte]
    // [12] phi setByte::ptr#3 = &main::b1 [phi:main->setByte#0] -- pbuz1=pbuc1 
    lda #<b1
    sta.z setByte.ptr
    lda #>b1
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'c' [phi:main->setByte#1] -- vbuxx=vbuc1 
    ldx #'c'
    jsr setByte
    // [4] phi from main to main::@1 [phi:main->main::@1]
    // main::@1
    // setByte(&b2, 'm')
    // [5] call setByte
    // [12] phi from main::@1 to setByte [phi:main::@1->setByte]
    // [12] phi setByte::ptr#3 = &main::b2 [phi:main::@1->setByte#0] -- pbuz1=pbuc1 
    lda #<b2
    sta.z setByte.ptr
    lda #>b2
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'm' [phi:main::@1->setByte#1] -- vbuxx=vbuc1 
    ldx #'m'
    jsr setByte
    // [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // main::@2
    // setByte(&b3, 'l')
    // [7] call setByte
    // [12] phi from main::@2 to setByte [phi:main::@2->setByte]
    // [12] phi setByte::ptr#3 = &main::b3 [phi:main::@2->setByte#0] -- pbuz1=pbuc1 
    lda #<b3
    sta.z setByte.ptr
    lda #>b3
    sta.z setByte.ptr+1
    // [12] phi setByte::b#3 = 'l' [phi:main::@2->setByte#1] -- vbuxx=vbuc1 
    ldx #'l'
    jsr setByte
    // main::@3
    // SCREEN[0] = b1
    // [8] *main::SCREEN = main::b1 -- _deref_pbuc1=vbuz1 
    lda.z b1
    sta SCREEN
    // SCREEN[1] = b2
    // [9] *(main::SCREEN+1) = main::b2 -- _deref_pbuc1=vbuz1 
    lda.z b2
    sta SCREEN+1
    // SCREEN[2] = b3
    // [10] *(main::SCREEN+2) = main::b3 -- _deref_pbuc1=vbuz1 
    lda.z b3
    sta SCREEN+2
    // main::@return
    // }
    // [11] return 
    rts
}
  // setByte
// void setByte(__zp(2) char *ptr, __register(X) char b)
setByte: {
    .label ptr = 2
    // *ptr = b
    // [13] *setByte::ptr#3 = setByte::b#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (ptr),y
    // setByte::@return
    // }
    // [14] return 
    rts
}
  // File Data

