Loading link script "rom.ld"
Adding parameter assignment in __stackcall procedure call1::param2 = param(call1::param2)
Adding parameter assignment in __stackcall procedure call1::param1 = param(call1::param1)
Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call call1(1, 2)
Calling convention __stackcall adding prepare/execute/finalize for main::$1 = call call1(3, 4)
Calling convention STACK_CALL replacing param(call1::param1) with stackidx(char,call1::OFFSET_STACK_PARAM1)
Calling convention STACK_CALL replacing param(call1::param2) with stackidx(char,call1::OFFSET_STACK_PARAM2)
Calling convention STACK_CALL adding stack return stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return
Calling convention STACK_CALL adding stack pull main::$0 = stackpull(char)
Calling convention STACK_CALL adding stack pull main::$1 = stackpull(char)
Calling convention STACK_CALL adding stack push stackpush(char) = 1
Calling convention STACK_CALL adding stack push stackpush(char) = 2
Calling convention STACK_CALL adding stack push stackpush(char) = 3
Calling convention STACK_CALL adding stack push stackpush(char) = 4

CONTROL FLOW GRAPH SSA

__stackcall char call1(char param1 , char param2)
call1: scope:[call1]  from
  call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1)
  call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2)
  call1::$0 = call1::param1#0 + call1::param2#0
  call1::return#0 = call1::$0
  to:call1::@return
call1::@return: scope:[call1]  from call1
  call1::return#1 = phi( call1/call1::return#0 )
  stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#1
  return 
  to:@return

char call2(char param1 , char param2)
call2: scope:[call2]  from main main::@1
  call2::param2#2 = phi( main/call2::param2#0, main::@1/call2::param2#1 )
  call2::param1#2 = phi( main/call2::param1#0, main::@1/call2::param1#1 )
  call2::$0 = call2::param1#2 + call2::param2#2
  call2::return = call2::$0
  to:call2::@return
call2::@return: scope:[call2]  from call2
  return 
  to:@return

char call3(char param1 , char param2)
call3: scope:[call3]  from main::@2 main::@3
  call3::param2#2 = phi( main::@2/call3::param2#0, main::@3/call3::param2#1 )
  call3::param1#2 = phi( main::@2/call3::param1#0, main::@3/call3::param1#1 )
  call3::$0 = call3::param1#2 + call3::param2#2
  call3::return#0 = call3::$0
  to:call3::@return
call3::@return: scope:[call3]  from call3
  call3::return#4 = phi( call3/call3::return#0 )
  call3::return#1 = call3::return#4
  return 
  to:@return

void main()
main: scope:[main]  from __start
  stackpush(char) = 1
  stackpush(char) = 2
  callexecute call1 
  sideeffect stackpullbytes(1)
  main::$0 = stackpull(char)
  *main::ptr = main::$0
  stackpush(char) = 3
  stackpush(char) = 4
  callexecute call1 
  sideeffect stackpullbytes(1)
  main::$1 = stackpull(char)
  *main::ptr = main::$1
  call2::param1#0 = 1
  call2::param2#0 = 2
  call call2
  call2::return = call2::return
  to:main::@1
main::@1: scope:[main]  from main
  main::$2 = call2::return
  *main::ptr = main::$2
  call2::param1#1 = 3
  call2::param2#1 = 4
  call call2
  call2::return = call2::return
  to:main::@2
main::@2: scope:[main]  from main::@1
  main::$3 = call2::return
  *main::ptr = main::$3
  call3::param1#0 = 1
  call3::param2#0 = 2
  call call3
  call3::return#2 = call3::return#1
  to:main::@3
main::@3: scope:[main]  from main::@2
  call3::return#5 = phi( main::@2/call3::return#2 )
  main::$4 = call3::return#5
  *main::ptr = main::$4
  call3::param1#1 = 3
  call3::param2#1 = 4
  call call3
  call3::return#3 = call3::return#1
  to:main::@4
main::@4: scope:[main]  from main::@3
  call3::return#6 = phi( main::@3/call3::return#3 )
  main::$5 = call3::return#6
  *main::ptr = main::$5
  to:main::@return
main::@return: scope:[main]  from main::@4
  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
__constant unsigned int STACK_BASE = $103
void __start()
__stackcall char call1(char param1 , char param2)
char call1::$0
__constant char call1::OFFSET_STACK_PARAM1 = 1
__constant char call1::OFFSET_STACK_PARAM2 = 0
__constant char call1::OFFSET_STACK_RETURN_1 = 1
char call1::param1
char call1::param1#0
char call1::param2
char call1::param2#0
char call1::return
char call1::return#0
char call1::return#1
char call2(char param1 , char param2)
char call2::$0
char call2::param1
char call2::param1#0
char call2::param1#1
char call2::param1#2
char call2::param2
char call2::param2#0
char call2::param2#1
char call2::param2#2
__loadstore char call2::return
char call3(char param1 , char param2)
char call3::$0
char call3::param1
char call3::param1#0
char call3::param1#1
char call3::param1#2
char call3::param2
char call3::param2#0
char call3::param2#1
char call3::param2#2
char call3::return
char call3::return#0
char call3::return#1
char call3::return#2
char call3::return#3
char call3::return#4
char call3::return#5
char call3::return#6
void main()
char main::$0
char main::$1
char main::$2
char main::$3
char main::$4
char main::$5
__constant char *main::ptr = (char *)$fe

Adding number conversion cast (unumber) 1 in stackpush(char) = 1
Adding number conversion cast (unumber) 2 in stackpush(char) = 2
Adding number conversion cast (unumber) 3 in stackpush(char) = 3
Adding number conversion cast (unumber) 4 in stackpush(char) = 4
Adding number conversion cast (unumber) 1 in call2::param1#0 = 1
Adding number conversion cast (unumber) 2 in call2::param2#0 = 2
Adding number conversion cast (unumber) 3 in call2::param1#1 = 3
Adding number conversion cast (unumber) 4 in call2::param2#1 = 4
Adding number conversion cast (unumber) 1 in call3::param1#0 = 1
Adding number conversion cast (unumber) 2 in call3::param2#0 = 2
Adding number conversion cast (unumber) 3 in call3::param1#1 = 3
Adding number conversion cast (unumber) 4 in call3::param2#1 = 4
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast stackpush(char) = (unumber)1
Inlining cast stackpush(char) = (unumber)2
Inlining cast stackpush(char) = (unumber)3
Inlining cast stackpush(char) = (unumber)4
Inlining cast call2::param1#0 = (unumber)1
Inlining cast call2::param2#0 = (unumber)2
Inlining cast call2::param1#1 = (unumber)3
Inlining cast call2::param2#1 = (unumber)4
Inlining cast call3::param1#0 = (unumber)1
Inlining cast call3::param2#0 = (unumber)2
Inlining cast call3::param1#1 = (unumber)3
Inlining cast call3::param2#1 = (unumber)4
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 254
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Simplifying constant integer cast 4
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Simplifying constant integer cast 4
Simplifying constant integer cast 1
Simplifying constant integer cast 2
Simplifying constant integer cast 3
Simplifying constant integer cast 4
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) 4
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias candidate removed (volatile)call2::return = call2::$0 
Alias call1::return#0 = call1::$0 call1::return#1 
Alias call3::return#0 = call3::$0 call3::return#4 call3::return#1 
Alias call3::return#2 = call3::return#5 
Alias call3::return#3 = call3::return#6 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (volatile)call2::return = call2::$0 
Constant call2::param1#0 = 1
Constant call2::param2#0 = 2
Constant call2::param1#1 = 3
Constant call2::param2#1 = 4
Constant call3::param1#0 = 1
Constant call3::param2#0 = 2
Constant call3::param1#1 = 3
Constant call3::param2#1 = 4
Successful SSA optimization Pass2ConstantIdentification
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
Alias candidate removed (volatile)call2::return = call2::$0 
Inlining constant with var siblings call2::param1#0
Inlining constant with var siblings call2::param2#0
Inlining constant with var siblings call2::param1#1
Inlining constant with var siblings call2::param2#1
Inlining constant with var siblings call3::param1#0
Inlining constant with var siblings call3::param2#0
Inlining constant with var siblings call3::param1#1
Inlining constant with var siblings call3::param2#1
Constant inlined call3::param1#0 = 1
Constant inlined call3::param2#0 = 2
Constant inlined call3::param1#1 = 3
Constant inlined call2::param1#0 = 1
Constant inlined call2::param2#1 = 4
Constant inlined call3::param2#1 = 4
Constant inlined call2::param2#0 = 2
Constant inlined call2::param1#1 = 3
Successful SSA optimization Pass2ConstantInlining
Alias candidate removed (volatile)call2::return = call2::$0 
Alias candidate removed (volatile)call2::return = call2::$0 
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias candidate removed (volatile)call2::return = call2::$0 
Alias candidate removed (volatile)call2::return = call2::$0 
CALL GRAPH
Calls in [main] to call1:2 call1:8 call2:12 call2:16 call3:20 call3:24 

Created 4 initial phi equivalence classes
Coalesced down to 4 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] stackpush(char) = 1
  [1] stackpush(char) = 2
  [2] callexecute call1 
  sideeffect stackpullbytes(1)
  [4] main::$0 = stackpull(char)
  [5] *main::ptr = main::$0
  [6] stackpush(char) = 3
  [7] stackpush(char) = 4
  [8] callexecute call1 
  sideeffect stackpullbytes(1)
  [10] main::$1 = stackpull(char)
  [11] *main::ptr = main::$1
  [12] call call2
  [13] call2::return = call2::return
  to:main::@1
main::@1: scope:[main]  from main
  [14] main::$2 = call2::return
  [15] *main::ptr = main::$2
  [16] call call2
  [17] call2::return = call2::return
  to:main::@2
main::@2: scope:[main]  from main::@1
  [18] main::$3 = call2::return
  [19] *main::ptr = main::$3
  [20] call call3
  [21] call3::return#2 = call3::return#0
  to:main::@3
main::@3: scope:[main]  from main::@2
  [22] main::$4 = call3::return#2
  [23] *main::ptr = main::$4
  [24] call call3
  [25] call3::return#3 = call3::return#0
  to:main::@4
main::@4: scope:[main]  from main::@3
  [26] main::$5 = call3::return#3
  [27] *main::ptr = main::$5
  to:main::@return
main::@return: scope:[main]  from main::@4
  [28] return 
  to:@return

__stackcall char call1(char param1 , char param2)
call1: scope:[call1]  from
  [29] call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1)
  [30] call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2)
  [31] call1::return#0 = call1::param1#0 + call1::param2#0
  to:call1::@return
call1::@return: scope:[call1]  from call1
  [32] stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#0
  [33] return 
  to:@return

char call2(char param1 , char param2)
call2: scope:[call2]  from main main::@1
  [34] call2::param2#2 = phi( main/2, main::@1/4 )
  [34] call2::param1#2 = phi( main/1, main::@1/3 )
  [35] call2::$0 = call2::param1#2 + call2::param2#2
  [36] call2::return = call2::$0
  to:call2::@return
call2::@return: scope:[call2]  from call2
  [37] return 
  to:@return

char call3(char param1 , char param2)
call3: scope:[call3]  from main::@2 main::@3
  [38] call3::param2#2 = phi( main::@2/2, main::@3/4 )
  [38] call3::param1#2 = phi( main::@2/1, main::@3/3 )
  [39] call3::return#0 = call3::param1#2 + call3::param2#2
  to:call3::@return
call3::@return: scope:[call3]  from call3
  [40] return 
  to:@return


VARIABLE REGISTER WEIGHTS
__stackcall char call1(char param1 , char param2)
char call1::param1
char call1::param1#0 // 11.0
char call1::param2
char call1::param2#0 // 22.0
char call1::return
char call1::return#0 // 22.0
char call2(char param1 , char param2)
char call2::$0 // 22.0
char call2::param1
char call2::param1#2 // 11.0
char call2::param2
char call2::param2#2 // 11.0
__loadstore char call2::return // 3.833333333333333
char call3(char param1 , char param2)
char call3::param1
char call3::param1#2 // 11.0
char call3::param2
char call3::param2#2 // 11.0
char call3::return
char call3::return#0 // 3.75
char call3::return#2 // 4.0
char call3::return#3 // 4.0
void main()
char main::$0 // 4.0
char main::$1 // 4.0
char main::$2 // 4.0
char main::$3 // 4.0
char main::$4 // 4.0
char main::$5 // 4.0

Initial phi equivalence classes
[ call2::param1#2 ]
[ call2::param2#2 ]
[ call3::param1#2 ]
[ call3::param2#2 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable main::$1 to live range equivalence class [ main::$1 ]
Added variable call2::return to live range equivalence class [ call2::return ]
Added variable main::$2 to live range equivalence class [ main::$2 ]
Added variable main::$3 to live range equivalence class [ main::$3 ]
Added variable call3::return#2 to live range equivalence class [ call3::return#2 ]
Added variable main::$4 to live range equivalence class [ main::$4 ]
Added variable call3::return#3 to live range equivalence class [ call3::return#3 ]
Added variable main::$5 to live range equivalence class [ main::$5 ]
Added variable call1::param1#0 to live range equivalence class [ call1::param1#0 ]
Added variable call1::param2#0 to live range equivalence class [ call1::param2#0 ]
Added variable call1::return#0 to live range equivalence class [ call1::return#0 ]
Added variable call2::$0 to live range equivalence class [ call2::$0 ]
Added variable call3::return#0 to live range equivalence class [ call3::return#0 ]
Complete equivalence classes
[ call2::param1#2 ]
[ call2::param2#2 ]
[ call3::param1#2 ]
[ call3::param2#2 ]
[ main::$0 ]
[ main::$1 ]
[ call2::return ]
[ main::$2 ]
[ main::$3 ]
[ call3::return#2 ]
[ main::$4 ]
[ call3::return#3 ]
[ main::$5 ]
[ call1::param1#0 ]
[ call1::param2#0 ]
[ call1::return#0 ]
[ call2::$0 ]
[ call3::return#0 ]
Allocated zp[1]:2 [ call1::param2#0 ]
Allocated zp[1]:3 [ call1::return#0 ]
Allocated zp[1]:4 [ call2::$0 ]
Allocated zp[1]:5 [ call2::param1#2 ]
Allocated zp[1]:6 [ call2::param2#2 ]
Allocated zp[1]:7 [ call3::param1#2 ]
Allocated zp[1]:8 [ call3::param2#2 ]
Allocated zp[1]:9 [ call1::param1#0 ]
Allocated zp[1]:10 [ main::$0 ]
Allocated zp[1]:11 [ main::$1 ]
Allocated zp[1]:12 [ main::$2 ]
Allocated zp[1]:13 [ main::$3 ]
Allocated zp[1]:14 [ call3::return#2 ]
Allocated zp[1]:15 [ main::$4 ]
Allocated zp[1]:16 [ call3::return#3 ]
Allocated zp[1]:17 [ main::$5 ]
Allocated zp[1]:18 [ call2::return ]
Allocated zp[1]:19 [ call3::return#0 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] stackpush(char) = 1 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [1] stackpush(char) = 2 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(1) always clobbers reg byte a 
Statement [4] main::$0 = stackpull(char) [ main::$0 ] (  [ main::$0 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [6] stackpush(char) = 3 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [7] stackpush(char) = 4 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(1) always clobbers reg byte a 
Statement [10] main::$1 = stackpull(char) [ main::$1 ] (  [ main::$1 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [29] call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1) [ call1::param1#0 ] ( call1:2 [ call1::param1#0 ] { }  call1:8 [ call1::param1#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [30] call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2) [ call1::param1#0 call1::param2#0 ] ( call1:2 [ call1::param1#0 call1::param2#0 ] { }  call1:8 [ call1::param1#0 call1::param2#0 ] { }  ) always clobbers reg byte a reg byte x 
Removing always clobbered register reg byte a as potential for zp[1]:9 [ call1::param1#0 ]
Removing always clobbered register reg byte x as potential for zp[1]:9 [ call1::param1#0 ]
Statement [31] call1::return#0 = call1::param1#0 + call1::param2#0 [ call1::return#0 ] ( call1:2 [ call1::return#0 ] { }  call1:8 [ call1::return#0 ] { }  ) always clobbers reg byte a 
Statement [32] stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#0 [ ] ( call1:2 [ ] { }  call1:8 [ ] { }  ) always clobbers reg byte x 
Statement [35] call2::$0 = call2::param1#2 + call2::param2#2 [ call2::$0 ] ( call2:12 [ call2::$0 ] { { call2::return = } }  call2:16 [ call2::$0 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [39] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } }  call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } }  ) always clobbers reg byte a 
Statement [0] stackpush(char) = 1 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [1] stackpush(char) = 2 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(1) always clobbers reg byte a 
Statement [4] main::$0 = stackpull(char) [ main::$0 ] (  [ main::$0 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [6] stackpush(char) = 3 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [7] stackpush(char) = 4 [ ] (  [ ] { { call2::return = } }  ) always clobbers reg byte a 
Statement sideeffect stackpullbytes(1) always clobbers reg byte a 
Statement [10] main::$1 = stackpull(char) [ main::$1 ] (  [ main::$1 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [29] call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1) [ call1::param1#0 ] ( call1:2 [ call1::param1#0 ] { }  call1:8 [ call1::param1#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [30] call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2) [ call1::param1#0 call1::param2#0 ] ( call1:2 [ call1::param1#0 call1::param2#0 ] { }  call1:8 [ call1::param1#0 call1::param2#0 ] { }  ) always clobbers reg byte a reg byte x 
Statement [31] call1::return#0 = call1::param1#0 + call1::param2#0 [ call1::return#0 ] ( call1:2 [ call1::return#0 ] { }  call1:8 [ call1::return#0 ] { }  ) always clobbers reg byte a 
Statement [32] stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#0 [ ] ( call1:2 [ ] { }  call1:8 [ ] { }  ) always clobbers reg byte x 
Statement [35] call2::$0 = call2::param1#2 + call2::param2#2 [ call2::$0 ] ( call2:12 [ call2::$0 ] { { call2::return = } }  call2:16 [ call2::$0 ] { { call2::return = } }  ) always clobbers reg byte a 
Statement [39] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } }  call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } }  ) always clobbers reg byte a 
Potential registers zp[1]:5 [ call2::param1#2 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ call2::param2#2 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:7 [ call3::param1#2 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:8 [ call3::param2#2 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:10 [ main::$0 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:11 [ main::$1 ] : zp[1]:11 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:18 [ call2::return ] : zp[1]:18 , 
Potential registers zp[1]:12 [ main::$2 ] : zp[1]:12 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:13 [ main::$3 ] : zp[1]:13 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:14 [ call3::return#2 ] : zp[1]:14 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:15 [ main::$4 ] : zp[1]:15 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:16 [ call3::return#3 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:17 [ main::$5 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:9 [ call1::param1#0 ] : zp[1]:9 , reg byte y , 
Potential registers zp[1]:2 [ call1::param2#0 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ call1::return#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ call2::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:19 [ call3::return#0 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [call1] 22: zp[1]:2 [ call1::param2#0 ] 22: zp[1]:3 [ call1::return#0 ] 11: zp[1]:9 [ call1::param1#0 ] 
Uplift Scope [call2] 22: zp[1]:4 [ call2::$0 ] 11: zp[1]:5 [ call2::param1#2 ] 11: zp[1]:6 [ call2::param2#2 ] 3.83: zp[1]:18 [ call2::return ] 
Uplift Scope [call3] 11: zp[1]:7 [ call3::param1#2 ] 11: zp[1]:8 [ call3::param2#2 ] 4: zp[1]:14 [ call3::return#2 ] 4: zp[1]:16 [ call3::return#3 ] 3.75: zp[1]:19 [ call3::return#0 ] 
Uplift Scope [main] 4: zp[1]:10 [ main::$0 ] 4: zp[1]:11 [ main::$1 ] 4: zp[1]:12 [ main::$2 ] 4: zp[1]:13 [ main::$3 ] 4: zp[1]:15 [ main::$4 ] 4: zp[1]:17 [ main::$5 ] 
Uplift Scope [] 

Uplifting [call1] best 299 combination reg byte a [ call1::param2#0 ] reg byte a [ call1::return#0 ] zp[1]:9 [ call1::param1#0 ] 
Uplifting [call2] best 281 combination reg byte a [ call2::$0 ] reg byte x [ call2::param1#2 ] reg byte a [ call2::param2#2 ] zp[1]:18 [ call2::return ] 
Uplifting [call3] best 257 combination reg byte x [ call3::param1#2 ] reg byte a [ call3::param2#2 ] reg byte a [ call3::return#2 ] reg byte a [ call3::return#3 ] zp[1]:19 [ call3::return#0 ] 
Limited combination testing to 100 combinations of 1024 possible.
Uplifting [main] best 233 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] zp[1]:15 [ main::$4 ] zp[1]:17 [ main::$5 ] 
Limited combination testing to 100 combinations of 4096 possible.
Uplifting [] best 233 combination 
Attempting to uplift remaining variables inzp[1]:9 [ call1::param1#0 ]
Uplifting [call1] best 233 combination zp[1]:9 [ call1::param1#0 ] 
Attempting to uplift remaining variables inzp[1]:15 [ main::$4 ]
Uplifting [main] best 227 combination reg byte a [ main::$4 ] 
Attempting to uplift remaining variables inzp[1]:17 [ main::$5 ]
Uplifting [main] best 221 combination reg byte a [ main::$5 ] 
Attempting to uplift remaining variables inzp[1]:18 [ call2::return ]
Uplifting [call2] best 221 combination zp[1]:18 [ call2::return ] 
Attempting to uplift remaining variables inzp[1]:19 [ call3::return#0 ]
Uplifting [call3] best 212 combination reg byte a [ call3::return#0 ] 
Coalescing zero page register [ zp[1]:9 [ call1::param1#0 ] ] with [ zp[1]:18 [ call2::return ] ]
Allocated (was zp[1]:9) zp[1]:2 [ call1::param1#0 call2::return ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Demonstrates how to code a ROM
// The rom.ld linker file declares segments for RomCode and RomData. 
// It also declares a TestRom segment used for testing the ROM calls.This ensures that the compiler does not optimize them away.
  // Upstart
  // ROM linking file
.file [name="rom.bin", type="bin", segments="Rom"]
.segmentdef Rom [segments="RomCode, RomData"]
.segmentdef RomCode [start=$f000]
.segmentdef RomData [startAfter="RomCode"]
.segmentdef TestRom
  // Global Constants & labels
  .const STACK_BASE = $103
.segment TestRom
  // main
main: {
    .label ptr = $fe
    // [0] stackpush(char) = 1 -- _stackpushbyte_=vbuc1 
    lda #1
    pha
    // [1] stackpush(char) = 2 -- _stackpushbyte_=vbuc1 
    lda #2
    pha
    // [2] callexecute call1  -- call_vprc1 
    jsr call1
    // sideeffect stackpullbytes(1) -- _stackpullbyte_1 
    pla
    // [4] main::$0 = stackpull(char) -- vbuaa=_stackpullbyte_ 
    pla
    // [5] *main::ptr = main::$0 -- _deref_pbuc1=vbuaa 
    sta ptr
    // [6] stackpush(char) = 3 -- _stackpushbyte_=vbuc1 
    lda #3
    pha
    // [7] stackpush(char) = 4 -- _stackpushbyte_=vbuc1 
    lda #4
    pha
    // [8] callexecute call1  -- call_vprc1 
    jsr call1
    // sideeffect stackpullbytes(1) -- _stackpullbyte_1 
    pla
    // [10] main::$1 = stackpull(char) -- vbuaa=_stackpullbyte_ 
    pla
    // [11] *main::ptr = main::$1 -- _deref_pbuc1=vbuaa 
    sta ptr
    // [12] call call2
    // [34] phi from main to call2 [phi:main->call2]
  call2_from_main:
    // [34] phi call2::param2#2 = 2 [phi:main->call2#0] -- vbuaa=vbuc1 
    lda #2
    // [34] phi call2::param1#2 = 1 [phi:main->call2#1] -- vbuxx=vbuc1 
    ldx #1
    jsr call2
    // [13] call2::return = call2::return
    jmp __b1
    // main::@1
  __b1:
    // [14] main::$2 = call2::return -- vbuaa=vbuz1 
    lda.z call2.return
    // [15] *main::ptr = main::$2 -- _deref_pbuc1=vbuaa 
    sta ptr
    // [16] call call2
    // [34] phi from main::@1 to call2 [phi:main::@1->call2]
  call2_from___b1:
    // [34] phi call2::param2#2 = 4 [phi:main::@1->call2#0] -- vbuaa=vbuc1 
    lda #4
    // [34] phi call2::param1#2 = 3 [phi:main::@1->call2#1] -- vbuxx=vbuc1 
    ldx #3
    jsr call2
    // [17] call2::return = call2::return
    jmp __b2
    // main::@2
  __b2:
    // [18] main::$3 = call2::return -- vbuaa=vbuz1 
    lda.z call2.return
    // [19] *main::ptr = main::$3 -- _deref_pbuc1=vbuaa 
    sta ptr
    // [20] call call3
    // [38] phi from main::@2 to call3 [phi:main::@2->call3]
  call3_from___b2:
    // [38] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 
    lda #2
    // [38] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 
    ldx #1
    jsr call3
    // [21] call3::return#2 = call3::return#0
    jmp __b3
    // main::@3
  __b3:
    // [22] main::$4 = call3::return#2
    // [23] *main::ptr = main::$4 -- _deref_pbuc1=vbuaa 
    sta ptr
    // [24] call call3
    // [38] phi from main::@3 to call3 [phi:main::@3->call3]
  call3_from___b3:
    // [38] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 
    lda #4
    // [38] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 
    ldx #3
    jsr call3
    // [25] call3::return#3 = call3::return#0
    jmp __b4
    // main::@4
  __b4:
    // [26] main::$5 = call3::return#3
    // [27] *main::ptr = main::$5 -- _deref_pbuc1=vbuaa 
    sta ptr
    jmp __breturn
    // main::@return
  __breturn:
    // [28] return 
    rts
}
.segment RomCode
  // call1
// A stack based ROM function that will transfer all parameters and return values through the stack.
// __register(A) char call1(__zp(2) char param1, __register(A) char param2)
call1: {
    .const OFFSET_STACK_PARAM1 = 1
    .const OFFSET_STACK_PARAM2 = 0
    .const OFFSET_STACK_RETURN_1 = 1
    .label param1 = 2
    // [29] call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1) -- vbuz1=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_PARAM1,x
    sta.z param1
    // [30] call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2) -- vbuaa=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_PARAM2,x
    // [31] call1::return#0 = call1::param1#0 + call1::param2#0 -- vbuaa=vbuz1_plus_vbuaa 
    clc
    adc.z param1
    jmp __breturn
    // call1::@return
  __breturn:
    // [32] stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#0 -- _stackidxbyte_vbuc1=vbuaa 
    tsx
    sta STACK_BASE+OFFSET_STACK_RETURN_1,x
    // [33] return 
    rts
}
  // call2
// A memory based ROM function that will transfer all parameters and return values through zeropage.
// __zp(2) char call2(__register(X) char param1, __register(A) char param2)
call2: {
    .label return = 2
    // [35] call2::$0 = call2::param1#2 + call2::param2#2 -- vbuaa=vbuxx_plus_vbuaa 
    stx.z $ff
    clc
    adc.z $ff
    // [36] call2::return = call2::$0 -- vbuz1=vbuaa 
    sta.z return
    jmp __breturn
    // call2::@return
  __breturn:
    // [37] return 
    rts
}
  // call3
// A "normal" optimized ROM function that will transfer parameters and return value through registers or zeropage.
// __register(A) char call3(__register(X) char param1, __register(A) char param2)
call3: {
    // [39] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa 
    stx.z $ff
    clc
    adc.z $ff
    jmp __breturn
    // call3::@return
  __breturn:
    // [40] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction call2_from_main:
Removing instruction __b1:
Removing instruction call2_from___b1:
Removing instruction __b2:
Removing instruction call3_from___b2:
Removing instruction __b3:
Removing instruction call3_from___b3:
Removing instruction __b4:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant unsigned int STACK_BASE = $103
__stackcall char call1(char param1 , char param2)
__constant char call1::OFFSET_STACK_PARAM1 = 1
__constant char call1::OFFSET_STACK_PARAM2 = 0
__constant char call1::OFFSET_STACK_RETURN_1 = 1
char call1::param1
char call1::param1#0 // param1 zp[1]:2 11.0
char call1::param2
char call1::param2#0 // reg byte a 22.0
char call1::return
char call1::return#0 // reg byte a 22.0
char call2(char param1 , char param2)
char call2::$0 // reg byte a 22.0
char call2::param1
char call2::param1#2 // reg byte x 11.0
char call2::param2
char call2::param2#2 // reg byte a 11.0
__loadstore char call2::return // zp[1]:2 3.833333333333333
char call3(char param1 , char param2)
char call3::param1
char call3::param1#2 // reg byte x 11.0
char call3::param2
char call3::param2#2 // reg byte a 11.0
char call3::return
char call3::return#0 // reg byte a 3.75
char call3::return#2 // reg byte a 4.0
char call3::return#3 // reg byte a 4.0
void main()
char main::$0 // reg byte a 4.0
char main::$1 // reg byte a 4.0
char main::$2 // reg byte a 4.0
char main::$3 // reg byte a 4.0
char main::$4 // reg byte a 4.0
char main::$5 // reg byte a 4.0
__constant char *main::ptr = (char *) 254

reg byte x [ call2::param1#2 ]
reg byte a [ call2::param2#2 ]
reg byte x [ call3::param1#2 ]
reg byte a [ call3::param2#2 ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte a [ main::$2 ]
reg byte a [ main::$3 ]
reg byte a [ call3::return#2 ]
reg byte a [ main::$4 ]
reg byte a [ call3::return#3 ]
reg byte a [ main::$5 ]
zp[1]:2 [ call1::param1#0 call2::return ]
reg byte a [ call1::param2#0 ]
reg byte a [ call1::return#0 ]
reg byte a [ call2::$0 ]
reg byte a [ call3::return#0 ]


FINAL ASSEMBLER
Score: 188

  // File Comments
// Demonstrates how to code a ROM
// The rom.ld linker file declares segments for RomCode and RomData. 
// It also declares a TestRom segment used for testing the ROM calls.This ensures that the compiler does not optimize them away.
  // Upstart
  // ROM linking file
.file [name="rom.bin", type="bin", segments="Rom"]
.segmentdef Rom [segments="RomCode, RomData"]
.segmentdef RomCode [start=$f000]
.segmentdef RomData [startAfter="RomCode"]
.segmentdef TestRom
  // Global Constants & labels
  .const STACK_BASE = $103
.segment TestRom
  // main
main: {
    .label ptr = $fe
    // call1(1,2)
    // [0] stackpush(char) = 1 -- _stackpushbyte_=vbuc1 
    lda #1
    pha
    // [1] stackpush(char) = 2 -- _stackpushbyte_=vbuc1 
    lda #2
    pha
    // [2] callexecute call1  -- call_vprc1 
    jsr call1
    // sideeffect stackpullbytes(1) -- _stackpullbyte_1 
    pla
    // [4] main::$0 = stackpull(char) -- vbuaa=_stackpullbyte_ 
    pla
    // *ptr = call1(1,2)
    // [5] *main::ptr = main::$0 -- _deref_pbuc1=vbuaa 
    sta ptr
    // call1(3,4)
    // [6] stackpush(char) = 3 -- _stackpushbyte_=vbuc1 
    lda #3
    pha
    // [7] stackpush(char) = 4 -- _stackpushbyte_=vbuc1 
    lda #4
    pha
    // [8] callexecute call1  -- call_vprc1 
    jsr call1
    // sideeffect stackpullbytes(1) -- _stackpullbyte_1 
    pla
    // [10] main::$1 = stackpull(char) -- vbuaa=_stackpullbyte_ 
    pla
    // *ptr = call1(3,4)
    // [11] *main::ptr = main::$1 -- _deref_pbuc1=vbuaa 
    sta ptr
    // call2(1,2)
    // [12] call call2
    // [34] phi from main to call2 [phi:main->call2]
    // [34] phi call2::param2#2 = 2 [phi:main->call2#0] -- vbuaa=vbuc1 
    lda #2
    // [34] phi call2::param1#2 = 1 [phi:main->call2#1] -- vbuxx=vbuc1 
    ldx #1
    jsr call2
    // call2(1,2)
    // [13] call2::return = call2::return
    // main::@1
    // [14] main::$2 = call2::return -- vbuaa=vbuz1 
    lda.z call2.return
    // *ptr = call2(1,2)
    // [15] *main::ptr = main::$2 -- _deref_pbuc1=vbuaa 
    sta ptr
    // call2(3,4)
    // [16] call call2
    // [34] phi from main::@1 to call2 [phi:main::@1->call2]
    // [34] phi call2::param2#2 = 4 [phi:main::@1->call2#0] -- vbuaa=vbuc1 
    lda #4
    // [34] phi call2::param1#2 = 3 [phi:main::@1->call2#1] -- vbuxx=vbuc1 
    ldx #3
    jsr call2
    // call2(3,4)
    // [17] call2::return = call2::return
    // main::@2
    // [18] main::$3 = call2::return -- vbuaa=vbuz1 
    lda.z call2.return
    // *ptr = call2(3,4)
    // [19] *main::ptr = main::$3 -- _deref_pbuc1=vbuaa 
    sta ptr
    // call3(1,2)
    // [20] call call3
    // [38] phi from main::@2 to call3 [phi:main::@2->call3]
    // [38] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 
    lda #2
    // [38] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 
    ldx #1
    jsr call3
    // call3(1,2)
    // [21] call3::return#2 = call3::return#0
    // main::@3
    // [22] main::$4 = call3::return#2
    // *ptr = call3(1,2)
    // [23] *main::ptr = main::$4 -- _deref_pbuc1=vbuaa 
    sta ptr
    // call3(3,4)
    // [24] call call3
    // [38] phi from main::@3 to call3 [phi:main::@3->call3]
    // [38] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 
    lda #4
    // [38] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 
    ldx #3
    jsr call3
    // call3(3,4)
    // [25] call3::return#3 = call3::return#0
    // main::@4
    // [26] main::$5 = call3::return#3
    // *ptr = call3(3,4)
    // [27] *main::ptr = main::$5 -- _deref_pbuc1=vbuaa 
    sta ptr
    // main::@return
    // }
    // [28] return 
    rts
}
.segment RomCode
  // call1
// A stack based ROM function that will transfer all parameters and return values through the stack.
// __register(A) char call1(__zp(2) char param1, __register(A) char param2)
call1: {
    .const OFFSET_STACK_PARAM1 = 1
    .const OFFSET_STACK_PARAM2 = 0
    .const OFFSET_STACK_RETURN_1 = 1
    .label param1 = 2
    // [29] call1::param1#0 = stackidx(char,call1::OFFSET_STACK_PARAM1) -- vbuz1=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_PARAM1,x
    sta.z param1
    // [30] call1::param2#0 = stackidx(char,call1::OFFSET_STACK_PARAM2) -- vbuaa=_stackidxbyte_vbuc1 
    tsx
    lda STACK_BASE+OFFSET_STACK_PARAM2,x
    // return param1+param2;
    // [31] call1::return#0 = call1::param1#0 + call1::param2#0 -- vbuaa=vbuz1_plus_vbuaa 
    clc
    adc.z param1
    // call1::@return
    // }
    // [32] stackidx(char,call1::OFFSET_STACK_RETURN_1) = call1::return#0 -- _stackidxbyte_vbuc1=vbuaa 
    tsx
    sta STACK_BASE+OFFSET_STACK_RETURN_1,x
    // [33] return 
    rts
}
  // call2
// A memory based ROM function that will transfer all parameters and return values through zeropage.
// __zp(2) char call2(__register(X) char param1, __register(A) char param2)
call2: {
    .label return = 2
    // param1+param2
    // [35] call2::$0 = call2::param1#2 + call2::param2#2 -- vbuaa=vbuxx_plus_vbuaa 
    stx.z $ff
    clc
    adc.z $ff
    // return param1+param2;
    // [36] call2::return = call2::$0 -- vbuz1=vbuaa 
    sta.z return
    // call2::@return
    // }
    // [37] return 
    rts
}
  // call3
// A "normal" optimized ROM function that will transfer parameters and return value through registers or zeropage.
// __register(A) char call3(__register(X) char param1, __register(A) char param2)
call3: {
    // param1+param2
    // [39] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa 
    stx.z $ff
    clc
    adc.z $ff
    // call3::@return
    // }
    // [40] return 
    rts
}
  // File Data

