Culled Empty Block (label) main::@1
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::@16
Culled Empty Block (label) @1
Culled Empty Block (label) fillscreen::@4
Culled Empty Block (label) fillscreen::@3
Culled Empty Block (label) fillscreen::@5
Culled Empty Block (label) fillscreen::@6

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2

(void()) main()
main: scope:[main]  from @2
  (byte*) fillscreen::screen#0 ← (const byte*) SCREEN
  (byte) fillscreen::fill#0 ← (number) $20
  call fillscreen 
  to:main::@17
main::@17: scope:[main]  from main
  (byte) main::scroll#0 ← (byte) 7
  (byte*) main::nxt#0 ← (const byte*) TEXT
  to:main::@2
main::@2: scope:[main]  from main::@17 main::@2 main::@7
  (byte*) main::nxt#10 ← phi( main::@17/(byte*) main::nxt#0 main::@2/(byte*) main::nxt#10 main::@7/(byte*) main::nxt#11 )
  (byte) main::scroll#7 ← phi( main::@17/(byte) main::scroll#0 main::@2/(byte) main::scroll#7 main::@7/(byte) main::scroll#4 )
  (bool~) main::$1 ← *((const byte*) RASTER) != (number) $fe
  if((bool~) main::$1) goto main::@2
  to:main::@4
main::@4: scope:[main]  from main::@2 main::@4
  (byte*) main::nxt#9 ← phi( main::@2/(byte*) main::nxt#10 main::@4/(byte*) main::nxt#9 )
  (byte) main::scroll#5 ← phi( main::@2/(byte) main::scroll#7 main::@4/(byte) main::scroll#5 )
  (bool~) main::$2 ← *((const byte*) RASTER) != (number) $ff
  if((bool~) main::$2) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@4
  (byte*) main::nxt#8 ← phi( main::@4/(byte*) main::nxt#9 )
  (byte) main::scroll#3 ← phi( main::@4/(byte) main::scroll#5 )
  *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
  (byte) main::scroll#1 ← -- (byte) main::scroll#3
  (bool~) main::$4 ← (byte) main::scroll#1 == (number) $ff
  (bool~) main::$5 ← ! (bool~) main::$4
  if((bool~) main::$5) goto main::@7
  to:main::@6
main::@7: scope:[main]  from main::@15 main::@5
  (byte*) main::nxt#11 ← phi( main::@15/(byte*) main::nxt#1 main::@5/(byte*) main::nxt#8 )
  (byte) main::scroll#4 ← phi( main::@15/(byte) main::scroll#6 main::@5/(byte) main::scroll#1 )
  *((const byte*) SCROLL) ← (byte) main::scroll#4
  *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
  if(true) goto main::@2
  to:main::@return
main::@6: scope:[main]  from main::@5
  (byte*) main::nxt#6 ← phi( main::@5/(byte*) main::nxt#8 )
  (byte) main::scroll#2 ← (number) 7
  (byte) main::i#0 ← (byte) 0
  to:main::@8
main::@8: scope:[main]  from main::@6 main::@9
  (byte) main::scroll#10 ← phi( main::@6/(byte) main::scroll#2 main::@9/(byte) main::scroll#11 )
  (byte*) main::nxt#5 ← phi( main::@6/(byte*) main::nxt#6 main::@9/(byte*) main::nxt#7 )
  (byte) main::i#2 ← phi( main::@6/(byte) main::i#0 main::@9/(byte) main::i#1 )
  (bool~) main::$6 ← (byte) main::i#2 != (number) $27
  if((bool~) main::$6) goto main::@9
  to:main::@10
main::@9: scope:[main]  from main::@8
  (byte) main::scroll#11 ← phi( main::@8/(byte) main::scroll#10 )
  (byte*) main::nxt#7 ← phi( main::@8/(byte*) main::nxt#5 )
  (byte) main::i#3 ← phi( main::@8/(byte) main::i#2 )
  (number~) main::$7 ← (byte) main::i#3 + (number) 1
  *((const byte*) main::line + (byte) main::i#3) ← *((const byte*) main::line + (number~) main::$7)
  (byte) main::i#1 ← ++ (byte) main::i#3
  to:main::@8
main::@10: scope:[main]  from main::@8
  (byte) main::scroll#8 ← phi( main::@8/(byte) main::scroll#10 )
  (byte*) main::nxt#3 ← phi( main::@8/(byte*) main::nxt#5 )
  (byte) main::c#0 ← *((byte*) main::nxt#3)
  (bool~) main::$8 ← (byte) main::c#0 == (number) 0
  (bool~) main::$9 ← ! (bool~) main::$8
  if((bool~) main::$9) goto main::@15
  to:main::@14
main::@15: scope:[main]  from main::@10 main::@14
  (byte) main::scroll#6 ← phi( main::@10/(byte) main::scroll#8 main::@14/(byte) main::scroll#9 )
  (byte*) main::nxt#4 ← phi( main::@10/(byte*) main::nxt#3 main::@14/(byte*) main::nxt#2 )
  (byte) main::c#2 ← phi( main::@10/(byte) main::c#0 main::@14/(byte) main::c#1 )
  *((const byte*) main::line + (number) $27) ← (byte) main::c#2
  (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4
  to:main::@7
main::@14: scope:[main]  from main::@10
  (byte) main::scroll#9 ← phi( main::@10/(byte) main::scroll#8 )
  (byte*) main::nxt#2 ← (const byte*) TEXT
  (byte) main::c#1 ← *((byte*) main::nxt#2)
  to:main::@15
main::@return: scope:[main]  from main::@7
  return 
  to:@return

(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
fillscreen: scope:[fillscreen]  from main
  (byte) fillscreen::fill#3 ← phi( main/(byte) fillscreen::fill#0 )
  (byte*) fillscreen::screen#1 ← phi( main/(byte*) fillscreen::screen#0 )
  (byte*) fillscreen::cursor#0 ← (byte*) fillscreen::screen#1
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@2
  (byte) fillscreen::fill#2 ← phi( fillscreen/(byte) fillscreen::fill#3 fillscreen::@2/(byte) fillscreen::fill#1 )
  (byte*) fillscreen::cursor#2 ← phi( fillscreen/(byte*) fillscreen::cursor#0 fillscreen::@2/(byte*) fillscreen::cursor#1 )
  (byte*) fillscreen::screen#2 ← phi( fillscreen/(byte*) fillscreen::screen#1 fillscreen::@2/(byte*) fillscreen::screen#3 )
  (byte*~) fillscreen::$0 ← (byte*) fillscreen::screen#2 + (number) $3e8
  (bool~) fillscreen::$1 ← (byte*) fillscreen::cursor#2 < (byte*~) fillscreen::$0
  if((bool~) fillscreen::$1) goto fillscreen::@2
  to:fillscreen::@return
fillscreen::@2: scope:[fillscreen]  from fillscreen::@1
  (byte*) fillscreen::screen#3 ← phi( fillscreen::@1/(byte*) fillscreen::screen#2 )
  (byte*) fillscreen::cursor#3 ← phi( fillscreen::@1/(byte*) fillscreen::cursor#2 )
  (byte) fillscreen::fill#1 ← phi( fillscreen::@1/(byte) fillscreen::fill#2 )
  *((byte*) fillscreen::cursor#3) ← (byte) fillscreen::fill#1
  (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#3
  to:fillscreen::@1
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  return 
  to:@return
@2: scope:[]  from @begin
  call main 
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*)(number) $d020
(const byte*) RASTER = (byte*)(number) $d012
(const byte*) SCREEN = (byte*)(number) $400
(const byte*) SCROLL = (byte*)(number) $d016
(const byte*) TEXT[]  = (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(byte*~) fillscreen::$0
(bool~) fillscreen::$1
(label) fillscreen::@1
(label) fillscreen::@2
(label) fillscreen::@return
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#0
(byte*) fillscreen::cursor#1
(byte*) fillscreen::cursor#2
(byte*) fillscreen::cursor#3
(byte) fillscreen::fill
(byte) fillscreen::fill#0
(byte) fillscreen::fill#1
(byte) fillscreen::fill#2
(byte) fillscreen::fill#3
(byte*) fillscreen::screen
(byte*) fillscreen::screen#0
(byte*) fillscreen::screen#1
(byte*) fillscreen::screen#2
(byte*) fillscreen::screen#3
(void()) main()
(bool~) main::$1
(bool~) main::$2
(bool~) main::$4
(bool~) main::$5
(bool~) main::$6
(number~) main::$7
(bool~) main::$8
(bool~) main::$9
(label) main::@10
(label) main::@14
(label) main::@15
(label) main::@17
(label) main::@2
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::c
(byte) main::c#0
(byte) main::c#1
(byte) main::c#2
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(const byte*) main::line = (const byte*) SCREEN+(number) $28
(byte*) main::nxt
(byte*) main::nxt#0
(byte*) main::nxt#1
(byte*) main::nxt#10
(byte*) main::nxt#11
(byte*) main::nxt#2
(byte*) main::nxt#3
(byte*) main::nxt#4
(byte*) main::nxt#5
(byte*) main::nxt#6
(byte*) main::nxt#7
(byte*) main::nxt#8
(byte*) main::nxt#9
(byte) main::scroll
(byte) main::scroll#0
(byte) main::scroll#1
(byte) main::scroll#10
(byte) main::scroll#11
(byte) main::scroll#2
(byte) main::scroll#3
(byte) main::scroll#4
(byte) main::scroll#5
(byte) main::scroll#6
(byte) main::scroll#7
(byte) main::scroll#8
(byte) main::scroll#9

Adding number conversion cast (unumber) $28 in 
Adding number conversion cast (unumber) $20 in (byte) fillscreen::fill#0 ← (number) $20
Adding number conversion cast (unumber) $fe in (bool~) main::$1 ← *((const byte*) RASTER) != (number) $fe
Adding number conversion cast (unumber) $ff in (bool~) main::$2 ← *((const byte*) RASTER) != (number) $ff
Adding number conversion cast (unumber) $ff in (bool~) main::$4 ← (byte) main::scroll#1 == (number) $ff
Adding number conversion cast (unumber) 7 in (byte) main::scroll#2 ← (number) 7
Adding number conversion cast (unumber) $27 in (bool~) main::$6 ← (byte) main::i#2 != (number) $27
Adding number conversion cast (unumber) 1 in (number~) main::$7 ← (byte) main::i#3 + (number) 1
Adding number conversion cast (unumber) main::$7 in (number~) main::$7 ← (byte) main::i#3 + (unumber)(number) 1
Adding number conversion cast (unumber) 0 in (bool~) main::$8 ← (byte) main::c#0 == (number) 0
Adding number conversion cast (unumber) $27 in *((const byte*) main::line + (number) $27) ← (byte) main::c#2
Adding number conversion cast (unumber) $3e8 in (byte*~) fillscreen::$0 ← (byte*) fillscreen::screen#2 + (number) $3e8
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) fillscreen::fill#0 ← (unumber)(number) $20
Inlining cast (byte) main::scroll#2 ← (unumber)(number) 7
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 53270
Simplifying constant integer cast $28
Simplifying constant integer cast $20
Simplifying constant integer cast $fe
Simplifying constant integer cast $ff
Simplifying constant integer cast $ff
Simplifying constant integer cast 7
Simplifying constant integer cast $27
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast $27
Simplifying constant integer cast $3e8
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $20
Finalized unsigned number type (byte) $fe
Finalized unsigned number type (byte) $ff
Finalized unsigned number type (byte) $ff
Finalized unsigned number type (byte) 7
Finalized unsigned number type (byte) $27
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $27
Finalized unsigned number type (word) $3e8
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$7 ← (byte) main::i#3 + (byte) 1
Inversing boolean not [15] (bool~) main::$5 ← (byte) main::scroll#1 != (byte) $ff from [14] (bool~) main::$4 ← (byte) main::scroll#1 == (byte) $ff
Inversing boolean not [34] (bool~) main::$9 ← (byte) main::c#0 != (byte) 0 from [33] (bool~) main::$8 ← (byte) main::c#0 == (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) main::scroll#3 = (byte) main::scroll#5 
Alias (byte*) main::nxt#6 = (byte*) main::nxt#8 (byte*) main::nxt#9 
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (byte*) main::nxt#3 = (byte*) main::nxt#7 (byte*) main::nxt#5 
Alias (byte) main::scroll#10 = (byte) main::scroll#11 (byte) main::scroll#8 (byte) main::scroll#9 
Alias (byte*) fillscreen::cursor#0 = (byte*) fillscreen::screen#1 
Alias (byte) fillscreen::fill#1 = (byte) fillscreen::fill#2 
Alias (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#3 
Alias (byte*) fillscreen::screen#2 = (byte*) fillscreen::screen#3 
Successful SSA optimization Pass2AliasElimination
Alias (byte) main::scroll#10 = (byte) main::scroll#6 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::scroll#3 (byte) main::scroll#7
Identical Phi Values (byte*) main::nxt#6 (byte*) main::nxt#10
Identical Phi Values (byte*) main::nxt#3 (byte*) main::nxt#6
Identical Phi Values (byte) main::scroll#10 (byte) main::scroll#2
Identical Phi Values (byte*) fillscreen::cursor#0 (byte*) fillscreen::screen#0
Identical Phi Values (byte) fillscreen::fill#3 (byte) fillscreen::fill#0
Identical Phi Values (byte*) fillscreen::screen#2 (byte*) fillscreen::cursor#0
Identical Phi Values (byte) fillscreen::fill#1 (byte) fillscreen::fill#3
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@2
Simple Condition (bool~) main::$2 [10] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@4
Simple Condition (bool~) main::$5 [16] if((byte) main::scroll#1!=(byte) $ff) goto main::@7
Simple Condition (bool~) main::$6 [26] if((byte) main::i#2!=(byte) $27) goto main::@9
Simple Condition (bool~) main::$9 [35] if((byte) main::c#0!=(byte) 0) goto main::@15
Simple Condition (bool~) fillscreen::$1 [48] if((byte*) fillscreen::cursor#2<(byte*~) fillscreen::$0) goto fillscreen::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) fillscreen::screen#0 = SCREEN
Constant (const byte) fillscreen::fill#0 = $20
Constant (const byte) main::scroll#0 = 7
Constant (const byte*) main::nxt#0 = TEXT
Constant (const byte) main::scroll#2 = 7
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::nxt#2 = TEXT
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [20] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Constant right-side identified [22] (byte*~) fillscreen::$0 ← (const byte*) fillscreen::screen#0 + (word) $3e8
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) fillscreen::$0 = fillscreen::screen#0+$3e8
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) main::scroll#0
Inlining constant with var siblings (const byte*) main::nxt#0
Inlining constant with var siblings (const byte) main::scroll#2
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte*) main::nxt#2
Constant inlined main::nxt#0 = (const byte*) TEXT
Constant inlined main::scroll#0 = (byte) 7
Constant inlined fillscreen::screen#0 = (const byte*) SCREEN
Constant inlined fillscreen::$0 = (const byte*) SCREEN+(word) $3e8
Constant inlined main::scroll#2 = (byte) 7
Constant inlined main::i#0 = (byte) 0
Constant inlined main::nxt#2 = (const byte*) TEXT
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in assignment *(main::line+1 + main::$7)
Consolidated array index constant in *(main::line+$27)
Successful SSA optimization Pass2ConstantAdditionElimination
Alias (byte) main::i#2 = (byte~) main::$7 
Successful SSA optimization Pass2AliasElimination
Added new block during phi lifting main::@18(between main::@2 and main::@2)
Added new block during phi lifting main::@19(between main::@5 and main::@7)
Added new block during phi lifting main::@20(between main::@10 and main::@15)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@17
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of fillscreen
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to fillscreen:6 

Created 8 initial phi equivalence classes
Coalesced [20] main::c#4 ← main::c#1
Coalesced [24] main::nxt#14 ← main::nxt#1
Coalesced [28] main::scroll#13 ← main::scroll#4
Coalesced [29] main::nxt#13 ← main::nxt#11
Coalesced [30] main::c#3 ← main::c#0
Coalesced [31] main::nxt#16 ← main::nxt#10
Coalesced [34] main::i#4 ← main::i#1
Coalesced [35] main::scroll#14 ← main::scroll#1
Coalesced (already) [36] main::nxt#15 ← main::nxt#10
Coalesced (already) [37] main::scroll#12 ← main::scroll#7
Coalesced (already) [38] main::nxt#12 ← main::nxt#10
Coalesced [45] fillscreen::cursor#4 ← fillscreen::cursor#1
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@17
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@20
Culled Empty Block (label) main::@19
Culled Empty Block (label) main::@18
Renumbering block @2 to @1
Renumbering block main::@2 to main::@1
Renumbering block main::@4 to main::@2
Renumbering block main::@5 to main::@3
Renumbering block main::@7 to main::@4
Renumbering block main::@8 to main::@5
Renumbering block main::@9 to main::@6
Renumbering block main::@10 to main::@7
Renumbering block main::@14 to main::@8
Renumbering block main::@15 to main::@9
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of fillscreen

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()

(void()) main()
main: scope:[main]  from @1
  [4] phi()
  [5] call fillscreen 
  to:main::@1
main::@1: scope:[main]  from main main::@1 main::@4
  [6] (byte*) main::nxt#10 ← phi( main/(const byte*) TEXT main::@1/(byte*) main::nxt#10 main::@4/(byte*) main::nxt#11 )
  [6] (byte) main::scroll#7 ← phi( main/(byte) 7 main::@1/(byte) main::scroll#7 main::@4/(byte) main::scroll#4 )
  [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@2
  [9] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
  [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7
  [11] if((byte) main::scroll#1!=(byte) $ff) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@3 main::@6
  [12] (byte) main::i#2 ← phi( main::@3/(byte) 0 main::@6/(byte) main::i#1 )
  [13] if((byte) main::i#2!=(byte) $27) goto main::@6
  to:main::@7
main::@7: scope:[main]  from main::@5
  [14] (byte) main::c#0 ← *((byte*) main::nxt#10)
  [15] if((byte) main::c#0!=(byte) 0) goto main::@9
  to:main::@8
main::@8: scope:[main]  from main::@7
  [16] (byte) main::c#1 ← *((const byte*) TEXT)
  to:main::@9
main::@9: scope:[main]  from main::@7 main::@8
  [17] (byte*) main::nxt#4 ← phi( main::@7/(byte*) main::nxt#10 main::@8/(const byte*) TEXT )
  [17] (byte) main::c#2 ← phi( main::@7/(byte) main::c#0 main::@8/(byte) main::c#1 )
  [18] *((const byte*) main::line+(byte) $27) ← (byte) main::c#2
  [19] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4
  to:main::@4
main::@4: scope:[main]  from main::@3 main::@9
  [20] (byte*) main::nxt#11 ← phi( main::@9/(byte*) main::nxt#1 main::@3/(byte*) main::nxt#10 )
  [20] (byte) main::scroll#4 ← phi( main::@9/(byte) 7 main::@3/(byte) main::scroll#1 )
  [21] *((const byte*) SCROLL) ← (byte) main::scroll#4
  [22] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
  to:main::@1
main::@6: scope:[main]  from main::@5
  [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2)
  [24] (byte) main::i#1 ← ++ (byte) main::i#2
  to:main::@5

(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
fillscreen: scope:[fillscreen]  from main
  [25] phi()
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@2
  [26] (byte*) fillscreen::cursor#2 ← phi( fillscreen/(const byte*) SCREEN fillscreen::@2/(byte*) fillscreen::cursor#1 )
  [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2
  to:fillscreen::@return
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  [28] return 
  to:@return
fillscreen::@2: scope:[fillscreen]  from fillscreen::@1
  [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0
  [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2
  to:fillscreen::@1


VARIABLE REGISTER WEIGHTS
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#1 22.0
(byte*) fillscreen::cursor#2 14.666666666666666
(byte) fillscreen::fill
(byte*) fillscreen::screen
(void()) main()
(byte) main::c
(byte) main::c#0 16.5
(byte) main::c#1 22.0
(byte) main::c#2 33.0
(byte) main::i
(byte) main::i#1 202.0
(byte) main::i#2 168.33333333333331
(byte*) main::nxt
(byte*) main::nxt#1 22.0
(byte*) main::nxt#10 20.500000000000004
(byte*) main::nxt#11 11.0
(byte*) main::nxt#4 11.0
(byte) main::scroll
(byte) main::scroll#1 16.5
(byte) main::scroll#4 11.0
(byte) main::scroll#7 56.0

Initial phi equivalence classes
[ main::scroll#7 main::scroll#4 main::scroll#1 ]
[ main::i#2 main::i#1 ]
[ main::c#2 main::c#0 main::c#1 ]
[ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ]
[ fillscreen::cursor#2 fillscreen::cursor#1 ]
Complete equivalence classes
[ main::scroll#7 main::scroll#4 main::scroll#1 ]
[ main::i#2 main::i#1 ]
[ main::c#2 main::c#0 main::c#1 ]
[ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ]
[ fillscreen::cursor#2 fillscreen::cursor#1 ]
Allocated zp[1]:2 [ main::scroll#7 main::scroll#4 main::scroll#1 ]
Allocated zp[1]:3 [ main::i#2 main::i#1 ]
Allocated zp[1]:4 [ main::c#2 main::c#0 main::c#1 ]
Allocated zp[2]:5 [ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ]
Allocated zp[2]:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from___b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label line = SCREEN+$28
    .label scroll = 2
    .label i = 3
    .label c = 4
    .label nxt = 5
    // [5] call fillscreen 
    // [25] phi from main to fillscreen [phi:main->fillscreen]
  fillscreen_from_main:
    jsr fillscreen
    // [6] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [6] phi (byte*) main::nxt#10 = (const byte*) TEXT [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [6] phi (byte) main::scroll#7 = (byte) 7 [phi:main->main::@1#1] -- vbuz1=vbuc1 
    lda #7
    sta.z scroll
    jmp __b1
  // Wait for raster
    // [6] phi from main::@1 main::@4 to main::@1 [phi:main::@1/main::@4->main::@1]
  __b1_from___b1:
  __b1_from___b4:
    // [6] phi (byte*) main::nxt#10 = (byte*) main::nxt#10 [phi:main::@1/main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte) main::scroll#7 = (byte) main::scroll#7 [phi:main::@1/main::@4->main::@1#1] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$fe
    cmp RASTER
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp RASTER
    bne __b2
    jmp __b3
    // main::@3
  __b3:
    // [9] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    // [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 -- vbuz1=_dec_vbuz1 
    dec.z scroll
    // [11] if((byte) main::scroll#1!=(byte) $ff) goto main::@4 -- vbuz1_neq_vbuc1_then_la1 
    lda #$ff
    cmp.z scroll
    bne __b4_from___b3
    // [12] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
  __b5_from___b3:
    // [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@5#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b5
  // Hard scroll
    // main::@5
  __b5:
    // [13] if((byte) main::i#2!=(byte) $27) goto main::@6 -- vbuz1_neq_vbuc1_then_la1 
    lda #$27
    cmp.z i
    bne __b6
    jmp __b7
    // main::@7
  __b7:
    // [14] (byte) main::c#0 ← *((byte*) main::nxt#10) -- vbuz1=_deref_pbuz2 
    // Render next char
    ldy #0
    lda (nxt),y
    sta.z c
    // [15] if((byte) main::c#0!=(byte) 0) goto main::@9 -- vbuz1_neq_0_then_la1 
    lda.z c
    cmp #0
    bne __b9_from___b7
    jmp __b8
    // main::@8
  __b8:
    // [16] (byte) main::c#1 ← *((const byte*) TEXT) -- vbuz1=_deref_pbuc1 
    lda TEXT
    sta.z c
    // [17] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
  __b9_from___b8:
    // [17] phi (byte*) main::nxt#4 = (const byte*) TEXT [phi:main::@8->main::@9#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [17] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@9#1] -- register_copy 
    jmp __b9
    // [17] phi from main::@7 to main::@9 [phi:main::@7->main::@9]
  __b9_from___b7:
    // [17] phi (byte*) main::nxt#4 = (byte*) main::nxt#10 [phi:main::@7->main::@9#0] -- register_copy 
    // [17] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@7->main::@9#1] -- register_copy 
    jmp __b9
    // main::@9
  __b9:
    // [18] *((const byte*) main::line+(byte) $27) ← (byte) main::c#2 -- _deref_pbuc1=vbuz1 
    lda.z c
    sta line+$27
    // [19] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 -- pbuz1=_inc_pbuz1 
    inc.z nxt
    bne !+
    inc.z nxt+1
  !:
    // [20] phi from main::@9 to main::@4 [phi:main::@9->main::@4]
  __b4_from___b9:
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#1 [phi:main::@9->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) 7 [phi:main::@9->main::@4#1] -- vbuz1=vbuc1 
    lda #7
    sta.z scroll
    jmp __b4
    // [20] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#10 [phi:main::@3->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) main::scroll#1 [phi:main::@3->main::@4#1] -- register_copy 
    jmp __b4
    // main::@4
  __b4:
    // [21] *((const byte*) SCROLL) ← (byte) main::scroll#4 -- _deref_pbuc1=vbuz1 
    lda.z scroll
    sta SCROLL
    // [22] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
    jmp __b1_from___b4
    // main::@6
  __b6:
    // [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 
    ldy.z i
    lda line+1,y
    sta line,y
    // [24] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [12] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
  __b5_from___b6:
    // [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
}
  // fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 7
    // [26] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  __b1_from_fillscreen:
    // [26] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z cursor
    lda #>SCREEN
    sta.z cursor+1
    jmp __b1
    // fillscreen::@1
  __b1:
    // [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2 -- pbuz1_lt_pbuc1_then_la1 
    lda.z cursor+1
    cmp #>SCREEN+$3e8
    bcc __b2
    bne !+
    lda.z cursor
    cmp #<SCREEN+$3e8
    bcc __b2
  !:
    jmp __breturn
    // fillscreen::@return
  __breturn:
    // [28] return 
    rts
    // fillscreen::@2
  __b2:
    // [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
    // [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 -- pbuz1=_inc_pbuz1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [26] phi from fillscreen::@2 to fillscreen::@1 [phi:fillscreen::@2->fillscreen::@1]
  __b1_from___b2:
    // [26] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@2->fillscreen::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
  .byte 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1 [ main::scroll#7 main::nxt#10 ] ( main:2 [ main::scroll#7 main::nxt#10 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::scroll#7 main::scroll#4 main::scroll#1 ]
Statement [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 [ main::scroll#7 main::nxt#10 ] ( main:2 [ main::scroll#7 main::nxt#10 ] ) always clobbers reg byte a 
Statement [14] (byte) main::c#0 ← *((byte*) main::nxt#10) [ main::nxt#10 main::c#0 ] ( main:2 [ main::nxt#10 main::c#0 ] ) always clobbers reg byte a reg byte y 
Statement [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2) [ main::nxt#10 main::i#2 ] ( main:2 [ main::nxt#10 main::i#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i#2 main::i#1 ]
Statement [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) always clobbers reg byte a 
Statement [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) always clobbers reg byte a reg byte y 
Statement [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1 [ main::scroll#7 main::nxt#10 ] ( main:2 [ main::scroll#7 main::nxt#10 ] ) always clobbers reg byte a 
Statement [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 [ main::scroll#7 main::nxt#10 ] ( main:2 [ main::scroll#7 main::nxt#10 ] ) always clobbers reg byte a 
Statement [14] (byte) main::c#0 ← *((byte*) main::nxt#10) [ main::nxt#10 main::c#0 ] ( main:2 [ main::nxt#10 main::c#0 ] ) always clobbers reg byte a reg byte y 
Statement [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2) [ main::nxt#10 main::i#2 ] ( main:2 [ main::nxt#10 main::i#2 ] ) always clobbers reg byte a 
Statement [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) always clobbers reg byte a 
Statement [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:2 [ main::scroll#7 main::scroll#4 main::scroll#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ main::i#2 main::i#1 ] : zp[1]:3 , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::c#2 main::c#0 main::c#1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:5 [ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ] : zp[2]:5 , 
Potential registers zp[2]:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] : zp[2]:7 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 370.33: zp[1]:3 [ main::i#2 main::i#1 ] 83.5: zp[1]:2 [ main::scroll#7 main::scroll#4 main::scroll#1 ] 71.5: zp[1]:4 [ main::c#2 main::c#0 main::c#1 ] 64.5: zp[2]:5 [ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ] 
Uplift Scope [fillscreen] 36.67: zp[2]:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplift Scope [] 

Uplifting [main] best 8284 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::scroll#7 main::scroll#4 main::scroll#1 ] reg byte x [ main::c#2 main::c#0 main::c#1 ] zp[2]:5 [ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ] 
Uplifting [fillscreen] best 8284 combination zp[2]:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplifting [] best 8284 combination 
Coalescing zero page register [ zp[2]:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] ] with [ zp[2]:5 [ main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ] ]
Allocated (was zp[2]:7) zp[2]:2 [ fillscreen::cursor#2 fillscreen::cursor#1 main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from___b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label line = SCREEN+$28
    .label nxt = 2
    // [5] call fillscreen 
    // [25] phi from main to fillscreen [phi:main->fillscreen]
  fillscreen_from_main:
    jsr fillscreen
    // [6] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [6] phi (byte*) main::nxt#10 = (const byte*) TEXT [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [6] phi (byte) main::scroll#7 = (byte) 7 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #7
    jmp __b1
  // Wait for raster
    // [6] phi from main::@1 main::@4 to main::@1 [phi:main::@1/main::@4->main::@1]
  __b1_from___b1:
  __b1_from___b4:
    // [6] phi (byte*) main::nxt#10 = (byte*) main::nxt#10 [phi:main::@1/main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte) main::scroll#7 = (byte) main::scroll#7 [phi:main::@1/main::@4->main::@1#1] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$fe
    cmp RASTER
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp RASTER
    bne __b2
    jmp __b3
    // main::@3
  __b3:
    // [9] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    // [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 -- vbuxx=_dec_vbuxx 
    dex
    // [11] if((byte) main::scroll#1!=(byte) $ff) goto main::@4 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne __b4_from___b3
    // [12] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
  __b5_from___b3:
    // [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b5
  // Hard scroll
    // main::@5
  __b5:
    // [13] if((byte) main::i#2!=(byte) $27) goto main::@6 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne __b6
    jmp __b7
    // main::@7
  __b7:
    // [14] (byte) main::c#0 ← *((byte*) main::nxt#10) -- vbuxx=_deref_pbuz1 
    // Render next char
    ldy #0
    lda (nxt),y
    tax
    // [15] if((byte) main::c#0!=(byte) 0) goto main::@9 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b9_from___b7
    jmp __b8
    // main::@8
  __b8:
    // [16] (byte) main::c#1 ← *((const byte*) TEXT) -- vbuxx=_deref_pbuc1 
    ldx TEXT
    // [17] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
  __b9_from___b8:
    // [17] phi (byte*) main::nxt#4 = (const byte*) TEXT [phi:main::@8->main::@9#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [17] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@9#1] -- register_copy 
    jmp __b9
    // [17] phi from main::@7 to main::@9 [phi:main::@7->main::@9]
  __b9_from___b7:
    // [17] phi (byte*) main::nxt#4 = (byte*) main::nxt#10 [phi:main::@7->main::@9#0] -- register_copy 
    // [17] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@7->main::@9#1] -- register_copy 
    jmp __b9
    // main::@9
  __b9:
    // [18] *((const byte*) main::line+(byte) $27) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx 
    stx line+$27
    // [19] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 -- pbuz1=_inc_pbuz1 
    inc.z nxt
    bne !+
    inc.z nxt+1
  !:
    // [20] phi from main::@9 to main::@4 [phi:main::@9->main::@4]
  __b4_from___b9:
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#1 [phi:main::@9->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) 7 [phi:main::@9->main::@4#1] -- vbuxx=vbuc1 
    ldx #7
    jmp __b4
    // [20] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#10 [phi:main::@3->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) main::scroll#1 [phi:main::@3->main::@4#1] -- register_copy 
    jmp __b4
    // main::@4
  __b4:
    // [21] *((const byte*) SCROLL) ← (byte) main::scroll#4 -- _deref_pbuc1=vbuxx 
    stx SCROLL
    // [22] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
    jmp __b1_from___b4
    // main::@6
  __b6:
    // [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda line+1,x
    sta line,x
    // [24] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
  __b5_from___b6:
    // [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
}
  // fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 2
    // [26] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  __b1_from_fillscreen:
    // [26] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z cursor
    lda #>SCREEN
    sta.z cursor+1
    jmp __b1
    // fillscreen::@1
  __b1:
    // [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2 -- pbuz1_lt_pbuc1_then_la1 
    lda.z cursor+1
    cmp #>SCREEN+$3e8
    bcc __b2
    bne !+
    lda.z cursor
    cmp #<SCREEN+$3e8
    bcc __b2
  !:
    jmp __breturn
    // fillscreen::@return
  __breturn:
    // [28] return 
    rts
    // fillscreen::@2
  __b2:
    // [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
    // [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 -- pbuz1=_inc_pbuz1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [26] phi from fillscreen::@2 to fillscreen::@1 [phi:fillscreen::@2->fillscreen::@1]
  __b1_from___b2:
    // [26] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@2->fillscreen::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
  .byte 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b5
Removing instruction jmp __b7
Removing instruction jmp __b8
Removing instruction jmp __b9
Removing instruction jmp __b4
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b1 with __b1
Replacing label __b4_from___b3 with __b4
Replacing label __b9_from___b7 with __b9
Replacing label __b1_from___b4 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b1:
Removing instruction __b1_from___b4:
Removing instruction __b9_from___b7:
Removing instruction __b4_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction fillscreen_from_main:
Removing instruction __b1_from_main:
Removing instruction __b3:
Removing instruction __b5_from___b3:
Removing instruction __b7:
Removing instruction __b8:
Removing instruction __b9_from___b8:
Removing instruction __b4_from___b9:
Removing instruction __b5_from___b6:
Removing instruction __b1_from_fillscreen:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Removing instruction jmp __b9
Removing instruction jmp __b4
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const byte*) RASTER = (byte*) 53266
(const byte*) SCREEN = (byte*) 1024
(const byte*) SCROLL = (byte*) 53270
(const byte*) TEXT[]  = (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(label) fillscreen::@1
(label) fillscreen::@2
(label) fillscreen::@return
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#1 cursor zp[2]:2 22.0
(byte*) fillscreen::cursor#2 cursor zp[2]:2 14.666666666666666
(byte) fillscreen::fill
(const byte) fillscreen::fill#0 fill = (byte) $20
(byte*) fillscreen::screen
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(byte) main::c
(byte) main::c#0 reg byte x 16.5
(byte) main::c#1 reg byte x 22.0
(byte) main::c#2 reg byte x 33.0
(byte) main::i
(byte) main::i#1 reg byte x 202.0
(byte) main::i#2 reg byte x 168.33333333333331
(const byte*) main::line = (const byte*) SCREEN+(byte) $28
(byte*) main::nxt
(byte*) main::nxt#1 nxt zp[2]:2 22.0
(byte*) main::nxt#10 nxt zp[2]:2 20.500000000000004
(byte*) main::nxt#11 nxt zp[2]:2 11.0
(byte*) main::nxt#4 nxt zp[2]:2 11.0
(byte) main::scroll
(byte) main::scroll#1 reg byte x 16.5
(byte) main::scroll#4 reg byte x 11.0
(byte) main::scroll#7 reg byte x 56.0

reg byte x [ main::scroll#7 main::scroll#4 main::scroll#1 ]
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::c#2 main::c#0 main::c#1 ]
zp[2]:2 [ fillscreen::cursor#2 fillscreen::cursor#1 main::nxt#4 main::nxt#10 main::nxt#11 main::nxt#1 ]


FINAL ASSEMBLER
Score: 6262

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label line = SCREEN+$28
    .label nxt = 2
    // fillscreen(SCREEN, $20)
    // [5] call fillscreen 
    // [25] phi from main to fillscreen [phi:main->fillscreen]
    jsr fillscreen
    // [6] phi from main to main::@1 [phi:main->main::@1]
    // [6] phi (byte*) main::nxt#10 = (const byte*) TEXT [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [6] phi (byte) main::scroll#7 = (byte) 7 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #7
  // Wait for raster
    // [6] phi from main::@1 main::@4 to main::@1 [phi:main::@1/main::@4->main::@1]
    // [6] phi (byte*) main::nxt#10 = (byte*) main::nxt#10 [phi:main::@1/main::@4->main::@1#0] -- register_copy 
    // [6] phi (byte) main::scroll#7 = (byte) main::scroll#7 [phi:main::@1/main::@4->main::@1#1] -- register_copy 
    // main::@1
  __b1:
    // while(*RASTER!=$fe)
    // [7] if(*((const byte*) RASTER)!=(byte) $fe) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$fe
    cmp RASTER
    bne __b1
    // main::@2
  __b2:
    // while(*RASTER!=$ff)
    // [8] if(*((const byte*) RASTER)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp RASTER
    bne __b2
    // main::@3
    // ++*BGCOL;
    // [9] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
    // if(--scroll==$ff)
    // [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 -- vbuxx=_dec_vbuxx 
    dex
    // [11] if((byte) main::scroll#1!=(byte) $ff) goto main::@4 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne __b4
    // [12] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
    // [12] phi (byte) main::i#2 = (byte) 0 [phi:main::@3->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
  // Hard scroll
    // main::@5
  __b5:
    // for(byte i=0;i!=39;i++)
    // [13] if((byte) main::i#2!=(byte) $27) goto main::@6 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne __b6
    // main::@7
    // c = *nxt
    // [14] (byte) main::c#0 ← *((byte*) main::nxt#10) -- vbuxx=_deref_pbuz1 
    // Render next char
    ldy #0
    lda (nxt),y
    tax
    // if(c==0)
    // [15] if((byte) main::c#0!=(byte) 0) goto main::@9 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b9
    // main::@8
    // c = *nxt
    // [16] (byte) main::c#1 ← *((const byte*) TEXT) -- vbuxx=_deref_pbuc1 
    ldx TEXT
    // [17] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
    // [17] phi (byte*) main::nxt#4 = (const byte*) TEXT [phi:main::@8->main::@9#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [17] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@9#1] -- register_copy 
    // [17] phi from main::@7 to main::@9 [phi:main::@7->main::@9]
    // [17] phi (byte*) main::nxt#4 = (byte*) main::nxt#10 [phi:main::@7->main::@9#0] -- register_copy 
    // [17] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@7->main::@9#1] -- register_copy 
    // main::@9
  __b9:
    // line[39] = c
    // [18] *((const byte*) main::line+(byte) $27) ← (byte) main::c#2 -- _deref_pbuc1=vbuxx 
    stx line+$27
    // nxt++;
    // [19] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 -- pbuz1=_inc_pbuz1 
    inc.z nxt
    bne !+
    inc.z nxt+1
  !:
    // [20] phi from main::@9 to main::@4 [phi:main::@9->main::@4]
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#1 [phi:main::@9->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) 7 [phi:main::@9->main::@4#1] -- vbuxx=vbuc1 
    ldx #7
    // [20] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // [20] phi (byte*) main::nxt#11 = (byte*) main::nxt#10 [phi:main::@3->main::@4#0] -- register_copy 
    // [20] phi (byte) main::scroll#4 = (byte) main::scroll#1 [phi:main::@3->main::@4#1] -- register_copy 
    // main::@4
  __b4:
    // *SCROLL = scroll
    // [21] *((const byte*) SCROLL) ← (byte) main::scroll#4 -- _deref_pbuc1=vbuxx 
    stx SCROLL
    // --*BGCOL;
    // [22] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
    jmp __b1
    // main::@6
  __b6:
    // line[i]=line[i+1]
    // [23] *((const byte*) main::line + (byte) main::i#2) ← *((const byte*) main::line+(byte) 1 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda line+1,x
    sta line,x
    // for(byte i=0;i!=39;i++)
    // [24] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [12] phi from main::@6 to main::@5 [phi:main::@6->main::@5]
    // [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@6->main::@5#0] -- register_copy 
    jmp __b5
}
  // fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 2
    // [26] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
    // [26] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z cursor
    lda #>SCREEN
    sta.z cursor+1
    // fillscreen::@1
  __b1:
    // for( byte* cursor = screen; cursor < screen+1000; cursor++)
    // [27] if((byte*) fillscreen::cursor#2<(const byte*) SCREEN+(word) $3e8) goto fillscreen::@2 -- pbuz1_lt_pbuc1_then_la1 
    lda.z cursor+1
    cmp #>SCREEN+$3e8
    bcc __b2
    bne !+
    lda.z cursor
    cmp #<SCREEN+$3e8
    bcc __b2
  !:
    // fillscreen::@return
    // }
    // [28] return 
    rts
    // fillscreen::@2
  __b2:
    // *cursor = fill
    // [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
    // for( byte* cursor = screen; cursor < screen+1000; cursor++)
    // [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 -- pbuz1=_inc_pbuz1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [26] phi from fillscreen::@2 to fillscreen::@1 [phi:fillscreen::@2->fillscreen::@1]
    // [26] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@2->fillscreen::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
  .byte 0

