Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  idx#7 = phi( __start::@1/idx#11 )
  SCREEN[idx#7] = '-'
  idx#0 = ++ idx#7
  SCREEN[idx#0] = 'a'
  idx#1 = ++ idx#0
  SCREEN[idx#1] = '-'
  idx#2 = ++ idx#1
  to:main::@return
main::@return: scope:[main]  from main
  idx#8 = phi( main/idx#2 )
  idx#3 = idx#8
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  idx#4 = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  idx#11 = phi( __start::__init1/idx#4 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  idx#9 = phi( __start::@1/idx#3 )
  idx#5 = idx#9
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  idx#10 = phi( __start::@2/idx#5 )
  idx#6 = idx#10
  return 
  to:@return

SYMBOL TABLE SSA
__constant char *SCREEN = (char *)$400
void __start()
char idx
char idx#0
char idx#1
char idx#10
char idx#11
char idx#2
char idx#3
char idx#4
char idx#5
char idx#6
char idx#7
char idx#8
char idx#9
void main()

Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Alias idx#2 = idx#8 idx#3 
Alias idx#11 = idx#4 
Alias idx#10 = idx#5 idx#9 idx#6 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values idx#7 idx#11
Identical Phi Values idx#10 idx#2
Successful SSA optimization Pass2IdenticalPhiElimination
Constant idx#11 = 0
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero SCREEN in [1] SCREEN[idx#11] = '-'
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable idx#2 and assignment [5] idx#2 = ++ idx#1
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant right-side identified [1] idx#0 = ++ idx#11
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant idx#0 = ++idx#11
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [2] idx#1 = ++ idx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant idx#1 = ++idx#0
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings idx#11
Inlining constant with different constant siblings idx#0
Inlining constant with different constant siblings idx#1
Constant inlined idx#11 = 0
Constant inlined idx#0 = ++0
Constant inlined idx#1 = ++++0
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+++0)
Consolidated array index constant in *(SCREEN+++++0)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Successful SSA optimization Pass2ConstantSimplification
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] *SCREEN = '-'
  [1] *(SCREEN+1) = 'a'
  [2] *(SCREEN+2) = '-'
  to:main::@return
main::@return: scope:[main]  from main
  [3] return 
  to:@return


VARIABLE REGISTER WEIGHTS
char idx
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *SCREEN = '-' [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *(SCREEN+1) = 'a' [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *(SCREEN+2) = '-' [ ] (  [ ] { }  ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [main] best 27 combination 
Uplifting [] best 27 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test the preprocessor
// Test #ifdef
  // Upstart
  // Commodore 64 PRG executable file
.file [name="preprocessor-4.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
  .label SCREEN = $400
.segment Code
  // main
main: {
    // [0] *SCREEN = '-' -- _deref_pbuc1=vbuc2 
    lda #'-'
    sta SCREEN
    // [1] *(SCREEN+1) = 'a' -- _deref_pbuc1=vbuc2 
    lda #'a'
    sta SCREEN+1
    // [2] *(SCREEN+2) = '-' -- _deref_pbuc1=vbuc2 
    lda #'-'
    sta SCREEN+2
    jmp __breturn
    // main::@return
  __breturn:
    // [3] return 
    rts
}
  // File Data

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

FINAL SYMBOL TABLE
__constant char *SCREEN = (char *) 1024
char idx
void main()



FINAL ASSEMBLER
Score: 24

  // File Comments
// Test the preprocessor
// Test #ifdef
  // Upstart
  // Commodore 64 PRG executable file
.file [name="preprocessor-4.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
  .label SCREEN = $400
.segment Code
  // main
main: {
    // SCREEN[idx++] = '-'
    // [0] *SCREEN = '-' -- _deref_pbuc1=vbuc2 
    lda #'-'
    sta SCREEN
    // SCREEN[idx++] = 'a'
    // [1] *(SCREEN+1) = 'a' -- _deref_pbuc1=vbuc2 
    lda #'a'
    sta SCREEN+1
    // SCREEN[idx++] = '-'
    // [2] *(SCREEN+2) = '-' -- _deref_pbuc1=vbuc2 
    lda #'-'
    sta SCREEN+2
    // main::@return
    // }
    // [3] return 
    rts
}
  // File Data

