Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::i#0 = 0
  to:main::@1
main::@1: scope:[main]  from main main::@3
  main::i#2 = phi( main/main::i#0, main::@3/main::i#1 )
  main::$0 = main::i#2 + 1
  main::$1 = main::i#2 + 2
  sum::a#0 = main::i#2
  sum::b#0 = main::$0
  sum::c#0 = main::$1
  call sum
  sum::return#0 = sum::return#2
  to:main::@2
main::@2: scope:[main]  from main::@1
  main::i#3 = phi( main::@1/main::i#2 )
  sum::return#3 = phi( main::@1/sum::return#0 )
  main::$2 = sum::return#3
  SCREEN[main::i#3] = main::$2
  main::$3 = main::i#3 + 1
  main::$4 = main::i#3 + 2
  sum2::a#0 = main::i#3
  sum2::b#0 = main::$3
  sum2::c#0 = main::$4
  call sum2
  sum2::return#0 = sum2::return#2
  to:main::@3
main::@3: scope:[main]  from main::@2
  main::i#4 = phi( main::@2/main::i#3 )
  sum2::return#3 = phi( main::@2/sum2::return#0 )
  main::$5 = sum2::return#3
  SCREEN2[main::i#4] = main::$5
  main::i#1 = main::i#4 + rangenext(0,$a)
  main::$6 = main::i#1 != rangelast(0,$a)
  if(main::$6) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return

char sum(char a , char b , char c)
sum: scope:[sum]  from main::@1
  sum::c#1 = phi( main::@1/sum::c#0 )
  sum::b#1 = phi( main::@1/sum::b#0 )
  sum::a#1 = phi( main::@1/sum::a#0 )
  sum::$0 = sum::a#1 + sum::b#1
  sum::$1 = sum::$0 + sum::c#1
  sum::return#1 = sum::$1
  to:sum::@return
sum::@return: scope:[sum]  from sum
  sum::return#4 = phi( sum/sum::return#1 )
  sum::return#2 = sum::return#4
  return 
  to:@return

char sum2(char a , char b , char c)
sum2: scope:[sum2]  from main::@2
  sum2::c#1 = phi( main::@2/sum2::c#0 )
  sum2::b#1 = phi( main::@2/sum2::b#0 )
  sum2::a#1 = phi( main::@2/sum2::a#0 )
  sum2::$0 = sum2::a#1 + sum2::b#1
  sum2::$1 = sum2::$0 + sum2::c#1
  sum2::return#1 = sum2::$1
  to:sum2::@return
sum2::@return: scope:[sum2]  from sum2
  sum2::return#4 = phi( sum2/sum2::return#1 )
  sum2::return#2 = sum2::return#4
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  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 *SCREEN = (char *)$400
__constant char *SCREEN2 = (char *)$400+$28
void __start()
void main()
number main::$0
number main::$1
char main::$2
number main::$3
number main::$4
char main::$5
bool main::$6
char main::i
char main::i#0
char main::i#1
char main::i#2
char main::i#3
char main::i#4
char sum(char a , char b , char c)
char sum::$0
char sum::$1
char sum::a
char sum::a#0
char sum::a#1
char sum::b
char sum::b#0
char sum::b#1
char sum::c
char sum::c#0
char sum::c#1
char sum::return
char sum::return#0
char sum::return#1
char sum::return#2
char sum::return#3
char sum::return#4
char sum2(char a , char b , char c)
char sum2::$0
char sum2::$1
char sum2::a
char sum2::a#0
char sum2::a#1
char sum2::b
char sum2::b#0
char sum2::b#1
char sum2::c
char sum2::c#0
char sum2::c#1
char sum2::return
char sum2::return#0
char sum2::return#1
char sum2::return#2
char sum2::return#3
char sum2::return#4

Adding number conversion cast (unumber) $28 in 
Adding number conversion cast (unumber) 1 in main::$0 = main::i#2 + 1
Adding number conversion cast (unumber) main::$0 in main::$0 = main::i#2 + (unumber)1
Adding number conversion cast (unumber) 2 in main::$1 = main::i#2 + 2
Adding number conversion cast (unumber) main::$1 in main::$1 = main::i#2 + (unumber)2
Adding number conversion cast (unumber) 1 in main::$3 = main::i#3 + 1
Adding number conversion cast (unumber) main::$3 in main::$3 = main::i#3 + (unumber)1
Adding number conversion cast (unumber) 2 in main::$4 = main::i#3 + 2
Adding number conversion cast (unumber) main::$4 in main::$4 = main::i#3 + (unumber)2
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast $28
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in main::$0 = main::i#2 + 1
Inferred type updated to char in main::$1 = main::i#2 + 2
Inferred type updated to char in main::$3 = main::i#3 + 1
Inferred type updated to char in main::$4 = main::i#3 + 2
Alias sum::b#0 = main::$0 
Alias sum::c#0 = main::$1 
Alias sum::return#0 = sum::return#3 
Alias main::i#2 = main::i#3 main::i#4 
Alias sum2::b#0 = main::$3 
Alias sum2::c#0 = main::$4 
Alias sum2::return#0 = sum2::return#3 
Alias sum::return#1 = sum::$1 sum::return#4 sum::return#2 
Alias sum2::return#1 = sum2::$1 sum2::return#4 sum2::return#2 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values sum::a#1 sum::a#0
Identical Phi Values sum::b#1 sum::b#0
Identical Phi Values sum::c#1 sum::c#0
Identical Phi Values sum2::a#1 sum2::a#0
Identical Phi Values sum2::b#1 sum2::b#0
Identical Phi Values sum2::c#1 sum2::c#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition main::$6 [18] if(main::i#1!=rangelast(0,$a)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [16] main::i#1 = ++ main::i#2 to ++
Resolved ranged comparison value [18] if(main::i#1!=rangelast(0,$a)) goto main::@1 to $b
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
Adding number conversion cast (unumber) $b in [16] if(main::i#1!=$b) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $b
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings main::i#0
Constant inlined main::i#0 = 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of main
CALL GRAPH
Calls in [main] to sum:5 sum2:12 

Created 1 initial phi equivalence classes
Coalesced [19] main::i#5 = main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block label main::@4
Adding NOP phi() at start of main

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@3
  [1] main::i#2 = phi( main/0, main::@3/main::i#1 )
  [2] sum::b#0 = main::i#2 + 1
  [3] sum::c#0 = main::i#2 + 2
  [4] sum::a#0 = main::i#2
  [5] call sum
  [6] sum::return#0 = sum::return#1
  to:main::@2
main::@2: scope:[main]  from main::@1
  [7] main::$2 = sum::return#0
  [8] SCREEN[main::i#2] = main::$2
  [9] sum2::b#0 = main::i#2 + 1
  [10] sum2::c#0 = main::i#2 + 2
  [11] sum2::a#0 = main::i#2
  [12] call sum2
  [13] sum2::return#0 = sum2::return#1
  to:main::@3
main::@3: scope:[main]  from main::@2
  [14] main::$5 = sum2::return#0
  [15] SCREEN2[main::i#2] = main::$5
  [16] main::i#1 = ++ main::i#2
  [17] if(main::i#1!=$b) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@3
  [18] return 
  to:@return

char sum(char a , char b , char c)
sum: scope:[sum]  from main::@1
  [19] sum::$0 = sum::a#0 + sum::b#0
  [20] sum::return#1 = sum::$0 + sum::c#0
  to:sum::@return
sum::@return: scope:[sum]  from sum
  [21] return 
  to:@return

char sum2(char a , char b , char c)
sum2: scope:[sum2]  from main::@2
  [22] sum2::$0 = sum2::a#0 + sum2::b#0
  [23] sum2::return#1 = sum2::$0 + sum2::c#0
  to:sum2::@return
sum2::@return: scope:[sum2]  from sum2
  [24] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::$2 // 22.0
char main::$5 // 22.0
char main::i
char main::i#1 // 16.5
char main::i#2 // 7.333333333333333
char sum(char a , char b , char c)
char sum::$0 // 202.0
char sum::a
char sum::a#0 // 112.0
char sum::b
char sum::b#0 // 37.33333333333333
char sum::c
char sum::c#0 // 37.33333333333333
char sum::return
char sum::return#0 // 22.0
char sum::return#1 // 37.33333333333333
char sum2(char a , char b , char c)
char sum2::$0 // 202.0
char sum2::a
char sum2::a#0 // 112.0
char sum2::b
char sum2::b#0 // 37.33333333333333
char sum2::c
char sum2::c#0 // 37.33333333333333
char sum2::return
char sum2::return#0 // 22.0
char sum2::return#1 // 37.33333333333333

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

REGISTER UPLIFT SCOPES
Uplift Scope [sum] 202: zp[1]:2 [ sum::$0 ] 112: zp[1]:4 [ sum::a#0 ] 37.33: zp[1]:6 [ sum::b#0 ] 37.33: zp[1]:7 [ sum::c#0 ] 37.33: zp[1]:10 [ sum::return#1 ] 22: zp[1]:13 [ sum::return#0 ] 
Uplift Scope [sum2] 202: zp[1]:3 [ sum2::$0 ] 112: zp[1]:5 [ sum2::a#0 ] 37.33: zp[1]:8 [ sum2::b#0 ] 37.33: zp[1]:9 [ sum2::c#0 ] 37.33: zp[1]:11 [ sum2::return#1 ] 22: zp[1]:15 [ sum2::return#0 ] 
Uplift Scope [main] 23.83: zp[1]:12 [ main::i#2 main::i#1 ] 22: zp[1]:14 [ main::$2 ] 22: zp[1]:16 [ main::$5 ] 
Uplift Scope [] 

Uplifting [sum] best 1380 combination reg byte a [ sum::$0 ] reg byte y [ sum::a#0 ] reg byte a [ sum::b#0 ] reg byte x [ sum::c#0 ] zp[1]:10 [ sum::return#1 ] zp[1]:13 [ sum::return#0 ] 
Limited combination testing to 100 combinations of 3072 possible.
Uplifting [sum2] best 1307 combination reg byte a [ sum2::$0 ] reg byte y [ sum2::a#0 ] reg byte a [ sum2::b#0 ] reg byte x [ sum2::c#0 ] zp[1]:11 [ sum2::return#1 ] zp[1]:15 [ sum2::return#0 ] 
Limited combination testing to 100 combinations of 3072 possible.
Uplifting [main] best 1187 combination zp[1]:12 [ main::i#2 main::i#1 ] reg byte a [ main::$2 ] reg byte a [ main::$5 ] 
Uplifting [] best 1187 combination 
Attempting to uplift remaining variables inzp[1]:10 [ sum::return#1 ]
Uplifting [sum] best 1154 combination reg byte a [ sum::return#1 ] 
Attempting to uplift remaining variables inzp[1]:11 [ sum2::return#1 ]
Uplifting [sum2] best 1121 combination reg byte a [ sum2::return#1 ] 
Attempting to uplift remaining variables inzp[1]:12 [ main::i#2 main::i#1 ]
Uplifting [main] best 1121 combination zp[1]:12 [ main::i#2 main::i#1 ] 
Attempting to uplift remaining variables inzp[1]:13 [ sum::return#0 ]
Uplifting [sum] best 1061 combination reg byte a [ sum::return#0 ] 
Attempting to uplift remaining variables inzp[1]:15 [ sum2::return#0 ]
Uplifting [sum2] best 1001 combination reg byte a [ sum2::return#0 ] 
Allocated (was zp[1]:12) zp[1]:2 [ main::i#2 main::i#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="zpparammin.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
  .label SCREEN2 = $400+$28
.segment Code
  // main
main: {
    .label i = 2
    // [1] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // [1] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  __b1_from___b3:
    // [1] phi main::i#2 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [2] sum::b#0 = main::i#2 + 1 -- vbuaa=vbuz1_plus_1 
    lda.z i
    clc
    adc #1
    // [3] sum::c#0 = main::i#2 + 2 -- vbuxx=vbuz1_plus_2 
    ldx.z i
    inx
    inx
    // [4] sum::a#0 = main::i#2 -- vbuyy=vbuz1 
    ldy.z i
    // [5] call sum
    jsr sum
    // [6] sum::return#0 = sum::return#1
    jmp __b2
    // main::@2
  __b2:
    // [7] main::$2 = sum::return#0
    // [8] SCREEN[main::i#2] = main::$2 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z i
    sta SCREEN,y
    // [9] sum2::b#0 = main::i#2 + 1 -- vbuaa=vbuz1_plus_1 
    lda.z i
    clc
    adc #1
    // [10] sum2::c#0 = main::i#2 + 2 -- vbuxx=vbuz1_plus_2 
    ldx.z i
    inx
    inx
    // [11] sum2::a#0 = main::i#2 -- vbuyy=vbuz1 
    ldy.z i
    // [12] call sum2
    jsr sum2
    // [13] sum2::return#0 = sum2::return#1
    jmp __b3
    // main::@3
  __b3:
    // [14] main::$5 = sum2::return#0
    // [15] SCREEN2[main::i#2] = main::$5 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z i
    sta SCREEN2,y
    // [16] main::i#1 = ++ main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [17] if(main::i#1!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z i
    bne __b1_from___b3
    jmp __breturn
    // main::@return
  __breturn:
    // [18] return 
    rts
}
  // sum
// __register(A) char sum(__register(Y) char a, __register(A) char b, __register(X) char c)
sum: {
    // [19] sum::$0 = sum::a#0 + sum::b#0 -- vbuaa=vbuyy_plus_vbuaa 
    sty.z $ff
    clc
    adc.z $ff
    // [20] sum::return#1 = sum::$0 + sum::c#0 -- vbuaa=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    jmp __breturn
    // sum::@return
  __breturn:
    // [21] return 
    rts
}
  // sum2
// __register(A) char sum2(__register(Y) char a, __register(A) char b, __register(X) char c)
sum2: {
    // [22] sum2::$0 = sum2::a#0 + sum2::b#0 -- vbuaa=vbuyy_plus_vbuaa 
    sty.z $ff
    clc
    adc.z $ff
    // [23] sum2::return#1 = sum2::$0 + sum2::c#0 -- vbuaa=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    jmp __breturn
    // sum2::@return
  __breturn:
    // [24] 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
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction lda.z i with TYA
Removing instruction ldy.z i
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1_from___b3 with __b1
Removing instruction __b1_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __b2:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char *SCREEN = (char *) 1024
__constant char *SCREEN2 = (char *) 1024+$28
void main()
char main::$2 // reg byte a 22.0
char main::$5 // reg byte a 22.0
char main::i
char main::i#1 // i zp[1]:2 16.5
char main::i#2 // i zp[1]:2 7.333333333333333
char sum(char a , char b , char c)
char sum::$0 // reg byte a 202.0
char sum::a
char sum::a#0 // reg byte y 112.0
char sum::b
char sum::b#0 // reg byte a 37.33333333333333
char sum::c
char sum::c#0 // reg byte x 37.33333333333333
char sum::return
char sum::return#0 // reg byte a 22.0
char sum::return#1 // reg byte a 37.33333333333333
char sum2(char a , char b , char c)
char sum2::$0 // reg byte a 202.0
char sum2::a
char sum2::a#0 // reg byte y 112.0
char sum2::b
char sum2::b#0 // reg byte a 37.33333333333333
char sum2::c
char sum2::c#0 // reg byte x 37.33333333333333
char sum2::return
char sum2::return#0 // reg byte a 22.0
char sum2::return#1 // reg byte a 37.33333333333333

zp[1]:2 [ main::i#2 main::i#1 ]
reg byte a [ sum::b#0 ]
reg byte x [ sum::c#0 ]
reg byte y [ sum::a#0 ]
reg byte a [ sum::return#0 ]
reg byte a [ main::$2 ]
reg byte a [ sum2::b#0 ]
reg byte x [ sum2::c#0 ]
reg byte y [ sum2::a#0 ]
reg byte a [ sum2::return#0 ]
reg byte a [ main::$5 ]
reg byte a [ sum::$0 ]
reg byte a [ sum::return#1 ]
reg byte a [ sum2::$0 ]
reg byte a [ sum2::return#1 ]


FINAL ASSEMBLER
Score: 805

  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="zpparammin.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
  .label SCREEN2 = $400+$28
.segment Code
  // main
main: {
    .label i = 2
    // [1] phi from main to main::@1 [phi:main->main::@1]
    // [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    // [1] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
    // [1] phi main::i#2 = main::i#1 [phi:main::@3->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // sum(i,i+1,i+2)
    // [2] sum::b#0 = main::i#2 + 1 -- vbuaa=vbuz1_plus_1 
    lda.z i
    clc
    adc #1
    // [3] sum::c#0 = main::i#2 + 2 -- vbuxx=vbuz1_plus_2 
    ldx.z i
    inx
    inx
    // [4] sum::a#0 = main::i#2 -- vbuyy=vbuz1 
    ldy.z i
    // [5] call sum
    jsr sum
    // [6] sum::return#0 = sum::return#1
    // main::@2
    // [7] main::$2 = sum::return#0
    // SCREEN[i] = sum(i,i+1,i+2)
    // [8] SCREEN[main::i#2] = main::$2 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z i
    sta SCREEN,y
    // sum2(i,i+1,i+2)
    // [9] sum2::b#0 = main::i#2 + 1 -- vbuaa=vbuz1_plus_1 
    tya
    clc
    adc #1
    // [10] sum2::c#0 = main::i#2 + 2 -- vbuxx=vbuz1_plus_2 
    ldx.z i
    inx
    inx
    // [11] sum2::a#0 = main::i#2 -- vbuyy=vbuz1 
    // [12] call sum2
    jsr sum2
    // [13] sum2::return#0 = sum2::return#1
    // main::@3
    // [14] main::$5 = sum2::return#0
    // SCREEN2[i] = sum2(i,i+1,i+2)
    // [15] SCREEN2[main::i#2] = main::$5 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z i
    sta SCREEN2,y
    // for(byte i : 0..10)
    // [16] main::i#1 = ++ main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [17] if(main::i#1!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$b
    cmp.z i
    bne __b1
    // main::@return
    // }
    // [18] return 
    rts
}
  // sum
// __register(A) char sum(__register(Y) char a, __register(A) char b, __register(X) char c)
sum: {
    // a+b
    // [19] sum::$0 = sum::a#0 + sum::b#0 -- vbuaa=vbuyy_plus_vbuaa 
    sty.z $ff
    clc
    adc.z $ff
    // a+b+c
    // [20] sum::return#1 = sum::$0 + sum::c#0 -- vbuaa=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    // sum::@return
    // }
    // [21] return 
    rts
}
  // sum2
// __register(A) char sum2(__register(Y) char a, __register(A) char b, __register(X) char c)
sum2: {
    // a+b
    // [22] sum2::$0 = sum2::a#0 + sum2::b#0 -- vbuaa=vbuyy_plus_vbuaa 
    sty.z $ff
    clc
    adc.z $ff
    // a+b+c
    // [23] sum2::return#1 = sum2::$0 + sum2::c#0 -- vbuaa=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    // sum2::@return
    // }
    // [24] return 
    rts
}
  // File Data

