Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  i#15 = phi( __start::@1/i#16 )
  main::a#0 = 4
  call inci
  inci::return#0 = inci::return#3
  to:main::@1
main::@1: scope:[main]  from main
  main::a#3 = phi( main/main::a#0 )
  i#8 = phi( main/i#4 )
  inci::return#4 = phi( main/inci::return#0 )
  main::$0 = inci::return#4
  i#0 = i#8
  main::$1 = main::a#3 + main::$0
  main::a#1 = main::$1
  call inci
  inci::return#1 = inci::return#3
  to:main::@2
main::@2: scope:[main]  from main::@1
  main::a#4 = phi( main::@1/main::a#1 )
  i#9 = phi( main::@1/i#4 )
  inci::return#5 = phi( main::@1/inci::return#1 )
  main::$2 = inci::return#5
  i#1 = i#9
  main::$3 = main::a#4 + main::$2
  main::a#2 = main::$3
  *main::SCREEN = i#1
  main::$4 = main::SCREEN + 1
  *main::$4 = main::a#2
  to:main::@return
main::@return: scope:[main]  from main::@2
  i#10 = phi( main::@2/i#1 )
  i#2 = i#10
  return 
  to:@return

char inci()
inci: scope:[inci]  from main main::@1
  i#11 = phi( main/i#15, main::@1/i#0 )
  inci::$0 = i#11 + 7
  i#3 = inci::$0
  inci::return#2 = i#3
  to:inci::@return
inci::@return: scope:[inci]  from inci
  i#12 = phi( inci/i#3 )
  inci::return#6 = phi( inci/inci::return#2 )
  inci::return#3 = inci::return#6
  i#4 = i#12
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  i#5 = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  i#16 = phi( __start::__init1/i#5 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  i#13 = phi( __start::@1/i#2 )
  i#6 = i#13
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  i#14 = phi( __start::@2/i#6 )
  i#7 = i#14
  return 
  to:@return

SYMBOL TABLE SSA
void __start()
char i
char i#0
char i#1
char i#10
char i#11
char i#12
char i#13
char i#14
char i#15
char i#16
char i#2
char i#3
char i#4
char i#5
char i#6
char i#7
char i#8
char i#9
char inci()
number inci::$0
char inci::return
char inci::return#0
char inci::return#1
char inci::return#2
char inci::return#3
char inci::return#4
char inci::return#5
char inci::return#6
void main()
char main::$0
char main::$1
char main::$2
char main::$3
char *main::$4
__constant char *main::SCREEN = (char *)$400
char main::a
char main::a#0
char main::a#1
char main::a#2
char main::a#3
char main::a#4

Adding number conversion cast (unumber) 1 in main::$4 = main::SCREEN + 1
Adding number conversion cast (unumber) 7 in inci::$0 = i#11 + 7
Adding number conversion cast (unumber) inci::$0 in inci::$0 = i#11 + (unumber)7
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 1
Simplifying constant integer cast 7
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in inci::$0 = i#11 + 7
Alias inci::return#0 = inci::return#4 
Alias main::a#0 = main::a#3 
Alias i#0 = i#8 
Alias main::a#1 = main::$1 main::a#4 
Alias inci::return#1 = inci::return#5 
Alias i#1 = i#9 i#10 i#2 
Alias main::a#2 = main::$3 
Alias i#12 = i#3 inci::$0 i#4 
Alias inci::return#2 = inci::return#6 inci::return#3 
Alias i#16 = i#5 
Alias i#13 = i#6 i#14 i#7 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values i#15 i#16
Identical Phi Values i#0 i#12
Identical Phi Values i#1 i#12
Identical Phi Values i#13 i#1
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [13] main::$4 = main::SCREEN + 1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::a#0 = 4
Constant main::$4 = main::SCREEN+1
Constant i#16 = 0
Successful SSA optimization Pass2ConstantIdentification
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
Inlining constant with var siblings main::a#0
Inlining constant with var siblings i#16
Constant inlined main::a#0 = 4
Constant inlined main::$4 = main::SCREEN+1
Constant inlined i#16 = 0
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of main
CALL GRAPH
Calls in [main] to inci:1 inci:6 

Created 1 initial phi equivalence classes
Coalesced [5] i#17 = i#12
Coalesced down to 1 phi equivalence classes
Adding NOP phi() at start of main

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call inci
  [2] inci::return#0 = inci::return#2
  to:main::@1
main::@1: scope:[main]  from main
  [3] main::$0 = inci::return#0
  [4] main::a#1 = 4 + main::$0
  [5] call inci
  [6] inci::return#1 = inci::return#2
  to:main::@2
main::@2: scope:[main]  from main::@1
  [7] main::$2 = inci::return#1
  [8] main::a#2 = main::a#1 + main::$2
  [9] *main::SCREEN = i#12
  [10] *(main::SCREEN+1) = main::a#2
  to:main::@return
main::@return: scope:[main]  from main::@2
  [11] return 
  to:@return

char inci()
inci: scope:[inci]  from main main::@1
  [12] i#11 = phi( main/0, main::@1/i#12 )
  [13] i#12 = i#11 + 7
  [14] inci::return#2 = i#12
  to:inci::@return
inci::@return: scope:[inci]  from inci
  [15] return 
  to:@return


VARIABLE REGISTER WEIGHTS
char i
char i#11 // 13.0
char i#12 // 2.3636363636363638
char inci()
char inci::return
char inci::return#0 // 4.0
char inci::return#1 // 4.0
char inci::return#2 // 3.75
void main()
char main::$0 // 4.0
char main::$2 // 4.0
char main::a
char main::a#1 // 1.0
char main::a#2 // 2.0

Initial phi equivalence classes
[ i#11 i#12 ]
Added variable inci::return#0 to live range equivalence class [ inci::return#0 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::a#1 to live range equivalence class [ main::a#1 ]
Added variable inci::return#1 to live range equivalence class [ inci::return#1 ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::a#2 to live range equivalence class [ main::a#2 ]
Added variable inci::return#2 to live range equivalence class [ inci::return#2 ]
Complete equivalence classes
[ i#11 i#12 ]
[ inci::return#0 ]
[ main::$0 ]
[ main::a#1 ]
[ inci::return#1 ]
[ main::$2 ]
[ main::a#2 ]
[ inci::return#2 ]
Allocated zp[1]:2 [ i#11 i#12 ]
Allocated zp[1]:3 [ inci::return#0 ]
Allocated zp[1]:4 [ main::$0 ]
Allocated zp[1]:5 [ inci::return#1 ]
Allocated zp[1]:6 [ main::$2 ]
Allocated zp[1]:7 [ inci::return#2 ]
Allocated zp[1]:8 [ main::a#2 ]
Allocated zp[1]:9 [ main::a#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] main::a#2 = main::a#1 + main::$2 [ main::a#2 i#12 ] (  [ main::a#2 i#12 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ i#11 i#12 ]
Statement [13] i#12 = i#11 + 7 [ i#12 ] ( inci:1 [ i#12 ] { { inci::return#0 = inci::return#2 } }  inci:5 [ main::a#1 i#12 ] { { i#11 = i#12 } { inci::return#1 = inci::return#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:9 [ main::a#1 ]
Statement [8] main::a#2 = main::a#1 + main::$2 [ main::a#2 i#12 ] (  [ main::a#2 i#12 ] { }  ) always clobbers reg byte a 
Statement [13] i#12 = i#11 + 7 [ i#12 ] ( inci:1 [ i#12 ] { { inci::return#0 = inci::return#2 } }  inci:5 [ main::a#1 i#12 ] { { i#11 = i#12 } { inci::return#1 = inci::return#2 } }  ) always clobbers reg byte a 
Potential registers zp[1]:2 [ i#11 i#12 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ inci::return#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:9 [ main::a#1 ] : zp[1]:9 , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ inci::return#1 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ main::$2 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:8 [ main::a#2 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:7 [ inci::return#2 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 15.36: zp[1]:2 [ i#11 i#12 ] 
Uplift Scope [inci] 4: zp[1]:3 [ inci::return#0 ] 4: zp[1]:5 [ inci::return#1 ] 3.75: zp[1]:7 [ inci::return#2 ] 
Uplift Scope [main] 4: zp[1]:4 [ main::$0 ] 4: zp[1]:6 [ main::$2 ] 2: zp[1]:8 [ main::a#2 ] 1: zp[1]:9 [ main::a#1 ] 

Uplifting [] best 103 combination reg byte y [ i#11 i#12 ] 
Uplifting [inci] best 84 combination reg byte a [ inci::return#0 ] reg byte a [ inci::return#1 ] reg byte a [ inci::return#2 ] 
Uplifting [main] best 68 combination reg byte a [ main::$0 ] reg byte a [ main::$2 ] reg byte a [ main::a#2 ] zp[1]:9 [ main::a#1 ] 
Limited combination testing to 100 combinations of 192 possible.
Attempting to uplift remaining variables inzp[1]:9 [ main::a#1 ]
Uplifting [main] best 68 combination zp[1]:9 [ main::a#1 ] 
Allocated (was zp[1]:9) zp[1]:2 [ main::a#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="liverange.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 a = 2
    // [1] call inci
    // [12] phi from main to inci [phi:main->inci]
  inci_from_main:
    // [12] phi i#11 = 0 [phi:main->inci#0] -- vbuyy=vbuc1 
    ldy #0
    jsr inci
    // [2] inci::return#0 = inci::return#2
    jmp __b1
    // main::@1
  __b1:
    // [3] main::$0 = inci::return#0
    // [4] main::a#1 = 4 + main::$0 -- vbuz1=vbuc1_plus_vbuaa 
    clc
    adc #4
    sta.z a
    // [5] call inci
    // [12] phi from main::@1 to inci [phi:main::@1->inci]
  inci_from___b1:
    // [12] phi i#11 = i#12 [phi:main::@1->inci#0] -- register_copy 
    jsr inci
    // [6] inci::return#1 = inci::return#2
    jmp __b2
    // main::@2
  __b2:
    // [7] main::$2 = inci::return#1
    // [8] main::a#2 = main::a#1 + main::$2 -- vbuaa=vbuz1_plus_vbuaa 
    clc
    adc.z a
    // [9] *main::SCREEN = i#12 -- _deref_pbuc1=vbuyy 
    sty SCREEN
    // [10] *(main::SCREEN+1) = main::a#2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // inci
inci: {
    // [13] i#12 = i#11 + 7 -- vbuyy=vbuyy_plus_vbuc1 
    tya
    clc
    adc #7
    tay
    // [14] inci::return#2 = i#12 -- vbuaa=vbuyy 
    tya
    jmp __breturn
    // inci::@return
  __breturn:
    // [15] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction inci_from_main:
Removing instruction __b1:
Removing instruction inci_from___b1:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
char i
char i#11 // reg byte y 13.0
char i#12 // reg byte y 2.3636363636363638
char inci()
char inci::return
char inci::return#0 // reg byte a 4.0
char inci::return#1 // reg byte a 4.0
char inci::return#2 // reg byte a 3.75
void main()
char main::$0 // reg byte a 4.0
char main::$2 // reg byte a 4.0
__constant char *main::SCREEN = (char *) 1024
char main::a
char main::a#1 // a zp[1]:2 1.0
char main::a#2 // reg byte a 2.0

reg byte y [ i#11 i#12 ]
reg byte a [ inci::return#0 ]
reg byte a [ main::$0 ]
zp[1]:2 [ main::a#1 ]
reg byte a [ inci::return#1 ]
reg byte a [ main::$2 ]
reg byte a [ main::a#2 ]
reg byte a [ inci::return#2 ]


FINAL ASSEMBLER
Score: 56

  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="liverange.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 a = 2
    // inci()
    // [1] call inci
    // [12] phi from main to inci [phi:main->inci]
    // [12] phi i#11 = 0 [phi:main->inci#0] -- vbuyy=vbuc1 
    ldy #0
    jsr inci
    // inci()
    // [2] inci::return#0 = inci::return#2
    // main::@1
    // [3] main::$0 = inci::return#0
    // a=a+inci()
    // [4] main::a#1 = 4 + main::$0 -- vbuz1=vbuc1_plus_vbuaa 
    clc
    adc #4
    sta.z a
    // inci()
    // [5] call inci
    // [12] phi from main::@1 to inci [phi:main::@1->inci]
    // [12] phi i#11 = i#12 [phi:main::@1->inci#0] -- register_copy 
    jsr inci
    // inci()
    // [6] inci::return#1 = inci::return#2
    // main::@2
    // [7] main::$2 = inci::return#1
    // a=a+inci()
    // [8] main::a#2 = main::a#1 + main::$2 -- vbuaa=vbuz1_plus_vbuaa 
    clc
    adc.z a
    // *SCREEN = i
    // [9] *main::SCREEN = i#12 -- _deref_pbuc1=vbuyy 
    sty SCREEN
    // *(SCREEN+1) = a
    // [10] *(main::SCREEN+1) = main::a#2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    // main::@return
    // }
    // [11] return 
    rts
}
  // inci
inci: {
    // i+7
    // [13] i#12 = i#11 + 7 -- vbuyy=vbuyy_plus_vbuc1 
    tya
    clc
    adc #7
    tay
    // return i;
    // [14] inci::return#2 = i#12 -- vbuaa=vbuyy 
    tya
    // inci::@return
    // }
    // [15] return 
    rts
}
  // File Data

