Resolved forward reference c2 to c2
Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  SCREEN[0] = c1
  SCREEN[1] = c2
  to:main::@return
main::@return: scope:[main]  from main
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  c1 = 'o'
  c2 = 'k'
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant char * const SCREEN = (char *)$400
void __start()
__loadstore volatile char c1
__loadstore volatile char c2
void main()

Adding number conversion cast (unumber) 0 in SCREEN[0] = c1
Adding number conversion cast (unumber) 1 in SCREEN[1] = c2
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero SCREEN in [0] SCREEN[0] = c1
Successful SSA optimization PassNSimplifyExpressionWithZero
Consolidated array index constant in *(SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of __start::@2
CALL GRAPH
Calls in [__start] to main:4 

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

FINAL CONTROL FLOW GRAPH

void __start()
__start: scope:[__start]  from
  [0] phi()
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  [1] c1 = 'o'
  [2] c2 = 'k'
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  [3] phi()
  [4] call main
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  [5] return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  [6] *SCREEN = c1
  [7] *(SCREEN+1) = c2
  to:main::@return
main::@return: scope:[main]  from main
  [8] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void __start()
__loadstore volatile char c1 // 4.333333333333333
__loadstore volatile char c2 // 4.333333333333333
void main()

Initial phi equivalence classes
Added variable c1 to live range equivalence class [ c1 ]
Added variable c2 to live range equivalence class [ c2 ]
Complete equivalence classes
[ c1 ]
[ c2 ]
Allocated zp[1]:2 [ c1 ]
Allocated zp[1]:3 [ c2 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] c1 = 'o' [ c1 ] (  [ c1 ] { }  ) always clobbers reg byte a 
Statement [2] c2 = 'k' [ c1 c2 ] (  [ c1 c2 ] { }  ) always clobbers reg byte a 
Statement [6] *SCREEN = c1 [ c2 ] ( main:4 [ c2 ] { }  ) always clobbers reg byte a 
Statement [7] *(SCREEN+1) = c2 [ ] ( main:4 [ ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:2 [ c1 ] : zp[1]:2 , 
Potential registers zp[1]:3 [ c2 ] : zp[1]:3 , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 4.33: zp[1]:2 [ c1 ] 4.33: zp[1]:3 [ c2 ] 
Uplift Scope [main] 
Uplift Scope [__start] 

Uplifting [] best 81 combination zp[1]:2 [ c1 ] zp[1]:3 [ c2 ] 
Uplifting [main] best 81 combination 
Uplifting [__start] best 81 combination 
Attempting to uplift remaining variables inzp[1]:2 [ c1 ]
Uplifting [] best 81 combination zp[1]:2 [ c1 ] 
Attempting to uplift remaining variables inzp[1]:3 [ c2 ]
Uplifting [] best 81 combination zp[1]:3 [ c2 ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests static initialization code
// Currently placed outside any function scope and pushed into @begin block.
// To be put into an initializer function.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="static-init-code-0.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(__start)
  // Global Constants & labels
  .label SCREEN = $400
  // Initialize a volatile ZP-variable (will be done in the initializer)
  .label c1 = 2
  // Initialize another volatile ZP-variable (will be done in the initializer)
  .label c2 = 3
.segment Code
  // __start
__start: {
    jmp __init1
    // __start::__init1
  __init1:
    // [1] c1 = 'o' -- vbuz1=vbuc1 
    lda #'o'
    sta.z c1
    // [2] c2 = 'k' -- vbuz1=vbuc1 
    lda #'k'
    sta.z c2
    // [3] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
  __b1_from___init1:
    jmp __b1
    // __start::@1
  __b1:
    // [4] call main
    jsr main
    jmp __breturn
    // __start::@return
  __breturn:
    // [5] return 
    rts
}
  // main
main: {
    // [6] *SCREEN = c1 -- _deref_pbuc1=vbuz1 
    lda.z c1
    sta SCREEN
    // [7] *(SCREEN+1) = c2 -- _deref_pbuc1=vbuz1 
    lda.z c2
    sta SCREEN+1
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __init1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___init1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
void __start()
__loadstore volatile char c1 // zp[1]:2 4.333333333333333
__loadstore volatile char c2 // zp[1]:3 4.333333333333333
void main()

zp[1]:2 [ c1 ]
zp[1]:3 [ c2 ]


FINAL ASSEMBLER
Score: 42

  // File Comments
// Tests static initialization code
// Currently placed outside any function scope and pushed into @begin block.
// To be put into an initializer function.
  // Upstart
  // Commodore 64 PRG executable file
.file [name="static-init-code-0.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(__start)
  // Global Constants & labels
  .label SCREEN = $400
  // Initialize a volatile ZP-variable (will be done in the initializer)
  .label c1 = 2
  // Initialize another volatile ZP-variable (will be done in the initializer)
  .label c2 = 3
.segment Code
  // __start
__start: {
    // __start::__init1
    // volatile char c1 = 'o'
    // [1] c1 = 'o' -- vbuz1=vbuc1 
    lda #'o'
    sta.z c1
    // volatile char c2 = 'k'
    // [2] c2 = 'k' -- vbuz1=vbuc1 
    lda #'k'
    sta.z c2
    // [3] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
    // __start::@1
    // [4] call main
    jsr main
    // __start::@return
    // [5] return 
    rts
}
  // main
main: {
    // SCREEN[0] = c1
    // [6] *SCREEN = c1 -- _deref_pbuc1=vbuz1 
    lda.z c1
    sta SCREEN
    // SCREEN[1] = c2
    // [7] *(SCREEN+1) = c2 -- _deref_pbuc1=vbuz1 
    lda.z c2
    sta SCREEN+1
    // main::@return
    // }
    // [8] return 
    rts
}
  // File Data

