PARSING src/test/java/dk/camelot64/kickc/test/kc/scroll.kc
byte* SCREEN = $0400;
byte* RASTER = $d012;
byte* BGCOL = $d020;
byte* SCROLL = $d016;
byte* TEXT = "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @";

void main() {
    fillscreen(SCREEN, $20);
    byte scroll = 7;
    byte* nxt = TEXT;
    byte[] line = SCREEN+40;
    do {
        // Wait for raster
        do {} while(*RASTER!=$fe);
        do {} while(*RASTER!=$ff);
        ++*BGCOL;
        // Soft scroll
        if(--scroll==$ff) {
            scroll = 7;
            // Hard scroll
            for(byte i=0;i!=39;i++) {
                line[i]=line[i+1];
            }
            // Render next char
            byte c = *nxt;
            if(c=='@') {
               nxt = TEXT;
               c = *nxt;
            }
            line[39] = c;
            nxt++;
        }
        *SCROLL = scroll;
        --*BGCOL;
    } while(true);
}

void fillscreen(byte* screen, byte fill) {
    for( byte* cursor = screen; cursor < screen+1000; cursor++) {
        *cursor = fill;
    }
}
Adding pre/post-modifier *((byte*) BGCOL) ← ++ *((byte*) BGCOL)
Adding pre/post-modifier (byte) main::scroll ← -- (byte) main::scroll
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
Adding pre/post-modifier (byte*) main::nxt ← ++ (byte*) main::nxt
Adding pre/post-modifier *((byte*) BGCOL) ← -- *((byte*) BGCOL)
Adding pre/post-modifier (byte*) fillscreen::cursor ← ++ (byte*) fillscreen::cursor

STATEMENTS
  (byte*) SCREEN ← (word/signed word/dword/signed dword) 1024
  (byte*) RASTER ← (word/dword/signed dword) 53266
  (byte*) BGCOL ← (word/dword/signed dword) 53280
  (byte*) SCROLL ← (word/dword/signed dword) 53270
  (byte*) TEXT ← (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"
proc (void()) main()
  (void~) main::$0 ← call fillscreen (byte*) SCREEN (byte/signed byte/word/signed word/dword/signed dword) 32 
  (byte) main::scroll ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte*) main::nxt ← (byte*) TEXT
  (byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 40
  (byte[]) main::line ← (byte*~) main::$1
main::@1:
main::@2:
  (boolean~) main::$2 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 254
  if((boolean~) main::$2) goto main::@2
main::@3:
  (boolean~) main::$3 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255
  if((boolean~) main::$3) goto main::@3
  *((byte*) BGCOL) ← ++ *((byte*) BGCOL)
  (byte) main::scroll ← -- (byte) main::scroll
  (boolean~) main::$4 ← (byte) main::scroll == (byte/word/signed word/dword/signed dword) 255
  (boolean~) main::$5 ← ! (boolean~) main::$4
  if((boolean~) main::$5) goto main::@4
  (byte) main::scroll ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
main::@5:
  (byte/word~) main::$6 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte[]) main::line + (byte) main::i) ← *((byte[]) main::line + (byte/word~) main::$6)
  (byte) main::i ← ++ (byte) main::i
  (boolean~) main::$7 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 39
  if((boolean~) main::$7) goto main::@5
  (byte) main::c ← *((byte*) main::nxt)
  (boolean~) main::$8 ← (byte) main::c == (byte) '@'
  (boolean~) main::$9 ← ! (boolean~) main::$8
  if((boolean~) main::$9) goto main::@6
  (byte*) main::nxt ← (byte*) TEXT
  (byte) main::c ← *((byte*) main::nxt)
main::@6:
  *((byte[]) main::line + (byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c
  (byte*) main::nxt ← ++ (byte*) main::nxt
main::@4:
  *((byte*) SCROLL) ← (byte) main::scroll
  *((byte*) BGCOL) ← -- *((byte*) BGCOL)
  if(true) goto main::@1
main::@return:
  return 
endproc // main()
proc (void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
  (byte*) fillscreen::cursor ← (byte*) fillscreen::screen
fillscreen::@1:
  *((byte*) fillscreen::cursor) ← (byte) fillscreen::fill
  (byte*) fillscreen::cursor ← ++ (byte*) fillscreen::cursor
  (byte*~) fillscreen::$0 ← (byte*) fillscreen::screen + (word/signed word/dword/signed dword) 1000
  (boolean~) fillscreen::$1 ← (byte*) fillscreen::cursor < (byte*~) fillscreen::$0
  if((boolean~) fillscreen::$1) goto fillscreen::@1
fillscreen::@return:
  return 
endproc // fillscreen()
  call main 

SYMBOLS
(byte*) BGCOL
(byte*) RASTER
(byte*) SCREEN
(byte*) SCROLL
(byte*) TEXT
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(byte*~) fillscreen::$0
(boolean~) fillscreen::$1
(label) fillscreen::@1
(label) fillscreen::@return
(byte*) fillscreen::cursor
(byte) fillscreen::fill
(byte*) fillscreen::screen
(void()) main()
(void~) main::$0
(byte*~) main::$1
(boolean~) main::$2
(boolean~) main::$3
(boolean~) main::$4
(boolean~) main::$5
(byte/word~) main::$6
(boolean~) main::$7
(boolean~) main::$8
(boolean~) main::$9
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte) main::c
(byte) main::i
(byte[]) main::line
(byte*) main::nxt
(byte) main::scroll

Promoting word/signed word/dword/signed dword to byte* in SCREEN ← ((byte*)) 1024
Promoting word/dword/signed dword to byte* in RASTER ← ((byte*)) 53266
Promoting word/dword/signed dword to byte* in BGCOL ← ((byte*)) 53280
Promoting word/dword/signed dword to byte* in SCROLL ← ((byte*)) 53270
INITIAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  (byte*) SCREEN ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) RASTER ← ((byte*)) (word/dword/signed dword) 53266
  (byte*) BGCOL ← ((byte*)) (word/dword/signed dword) 53280
  (byte*) SCROLL ← ((byte*)) (word/dword/signed dword) 53270
  (byte*) TEXT ← (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"
  to:@1
main: scope:[main]  from
  (void~) main::$0 ← call fillscreen (byte*) SCREEN (byte/signed byte/word/signed word/dword/signed dword) 32 
  (byte) main::scroll ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte*) main::nxt ← (byte*) TEXT
  (byte*~) main::$1 ← (byte*) SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 40
  (byte[]) main::line ← (byte*~) main::$1
  to:main::@1
main::@1: scope:[main]  from main main::@4
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  (boolean~) main::$2 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 254
  if((boolean~) main::$2) goto main::@2
  to:main::@7
main::@7: scope:[main]  from main::@2
  to:main::@3
main::@3: scope:[main]  from main::@3 main::@7
  (boolean~) main::$3 ← *((byte*) RASTER) != (byte/word/signed word/dword/signed dword) 255
  if((boolean~) main::$3) goto main::@3
  to:main::@8
main::@8: scope:[main]  from main::@3
  *((byte*) BGCOL) ← ++ *((byte*) BGCOL)
  (byte) main::scroll ← -- (byte) main::scroll
  (boolean~) main::$4 ← (byte) main::scroll == (byte/word/signed word/dword/signed dword) 255
  (boolean~) main::$5 ← ! (boolean~) main::$4
  if((boolean~) main::$5) goto main::@4
  to:main::@9
main::@4: scope:[main]  from main::@6 main::@8
  *((byte*) SCROLL) ← (byte) main::scroll
  *((byte*) BGCOL) ← -- *((byte*) BGCOL)
  if(true) goto main::@1
  to:main::@12
main::@9: scope:[main]  from main::@8
  (byte) main::scroll ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@5
main::@5: scope:[main]  from main::@5 main::@9
  (byte/word~) main::$6 ← (byte) main::i + (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte[]) main::line + (byte) main::i) ← *((byte[]) main::line + (byte/word~) main::$6)
  (byte) main::i ← ++ (byte) main::i
  (boolean~) main::$7 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 39
  if((boolean~) main::$7) goto main::@5
  to:main::@10
main::@10: scope:[main]  from main::@5
  (byte) main::c ← *((byte*) main::nxt)
  (boolean~) main::$8 ← (byte) main::c == (byte) '@'
  (boolean~) main::$9 ← ! (boolean~) main::$8
  if((boolean~) main::$9) goto main::@6
  to:main::@11
main::@6: scope:[main]  from main::@10 main::@11
  *((byte[]) main::line + (byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c
  (byte*) main::nxt ← ++ (byte*) main::nxt
  to:main::@4
main::@11: scope:[main]  from main::@10
  (byte*) main::nxt ← (byte*) TEXT
  (byte) main::c ← *((byte*) main::nxt)
  to:main::@6
main::@12: scope:[main]  from main::@4
  to:main::@return
main::@return: scope:[main]  from main::@12
  return 
  to:@return
@1: scope:[]  from @begin
  to:@2
fillscreen: scope:[fillscreen]  from
  (byte*) fillscreen::cursor ← (byte*) fillscreen::screen
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@1
  *((byte*) fillscreen::cursor) ← (byte) fillscreen::fill
  (byte*) fillscreen::cursor ← ++ (byte*) fillscreen::cursor
  (byte*~) fillscreen::$0 ← (byte*) fillscreen::screen + (word/signed word/dword/signed dword) 1000
  (boolean~) fillscreen::$1 ← (byte*) fillscreen::cursor < (byte*~) fillscreen::$0
  if((boolean~) fillscreen::$1) goto fillscreen::@1
  to:fillscreen::@2
fillscreen::@2: scope:[fillscreen]  from fillscreen::@1
  to:fillscreen::@return
fillscreen::@return: scope:[fillscreen]  from fillscreen::@2
  return 
  to:@return
@2: scope:[]  from @1
  call main 
  to:@end
@end: scope:[]  from @2

Eliminating unused variable - keeping the call (void~) main::$0
Creating constant string variable for inline (const string) $0 "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"
Removing empty block main::@7
Removing empty block main::@12
Removing empty block @1
Removing empty block fillscreen::@2
PROCEDURE MODIFY VARIABLE ANALYSIS

Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...

CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
@begin: scope:[]  from
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
  (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53280
  (byte*) SCROLL#0 ← ((byte*)) (word/dword/signed dword) 53270
  (byte*) TEXT#0 ← (const string) $0
  to:@2
main: scope:[main]  from @2
  (byte*) SCROLL#12 ← phi( @2/(byte*) SCROLL#13 )
  (byte*) BGCOL#11 ← phi( @2/(byte*) BGCOL#13 )
  (byte*) RASTER#5 ← phi( @2/(byte*) RASTER#7 )
  (byte*) TEXT#3 ← phi( @2/(byte*) TEXT#5 )
  (byte*) SCREEN#1 ← phi( @2/(byte*) SCREEN#3 )
  (byte*) fillscreen::screen#0 ← (byte*) SCREEN#1
  (byte) fillscreen::fill#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
  call fillscreen param-assignment
  to:main::@13
main::@13: scope:[main]  from main
  (byte*) SCROLL#10 ← phi( main/(byte*) SCROLL#12 )
  (byte*) BGCOL#9 ← phi( main/(byte*) BGCOL#11 )
  (byte*) RASTER#4 ← phi( main/(byte*) RASTER#5 )
  (byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 )
  (byte*) TEXT#1 ← phi( main/(byte*) TEXT#3 )
  (byte) main::scroll#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte*) main::nxt#0 ← (byte*) TEXT#1
  (byte*~) main::$1 ← (byte*) SCREEN#2 + (byte/signed byte/word/signed word/dword/signed dword) 40
  (byte[]) main::line#0 ← (byte*~) main::$1
  to:main::@2
main::@1: scope:[main]  from main::@4
  (byte*) TEXT#11 ← phi( main::@4/(byte*) TEXT#12 )
  (byte*) main::nxt#10 ← phi( main::@4/(byte*) main::nxt#11 )
  (byte*) SCROLL#9 ← phi( main::@4/(byte*) SCROLL#1 )
  (byte) main::scroll#10 ← phi( main::@4/(byte) main::scroll#4 )
  (byte*) BGCOL#8 ← phi( main::@4/(byte*) BGCOL#2 )
  (byte*) RASTER#3 ← phi( main::@4/(byte*) RASTER#6 )
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@13 main::@2
  (byte*) TEXT#10 ← phi( main::@1/(byte*) TEXT#11 main::@13/(byte*) TEXT#1 main::@2/(byte*) TEXT#10 )
  (byte*) main::nxt#9 ← phi( main::@1/(byte*) main::nxt#10 main::@13/(byte*) main::nxt#0 main::@2/(byte*) main::nxt#9 )
  (byte*) SCROLL#7 ← phi( main::@1/(byte*) SCROLL#9 main::@13/(byte*) SCROLL#10 main::@2/(byte*) SCROLL#7 )
  (byte) main::scroll#7 ← phi( main::@1/(byte) main::scroll#10 main::@13/(byte) main::scroll#0 main::@2/(byte) main::scroll#7 )
  (byte*) BGCOL#5 ← phi( main::@1/(byte*) BGCOL#8 main::@13/(byte*) BGCOL#9 main::@2/(byte*) BGCOL#5 )
  (byte*) RASTER#1 ← phi( main::@1/(byte*) RASTER#3 main::@13/(byte*) RASTER#4 main::@2/(byte*) RASTER#1 )
  (boolean~) main::$2 ← *((byte*) RASTER#1) != (byte/word/signed word/dword/signed dword) 254
  if((boolean~) main::$2) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@3
  (byte*) TEXT#9 ← phi( main::@2/(byte*) TEXT#10 main::@3/(byte*) TEXT#9 )
  (byte*) main::nxt#8 ← phi( main::@2/(byte*) main::nxt#9 main::@3/(byte*) main::nxt#8 )
  (byte*) SCROLL#4 ← phi( main::@2/(byte*) SCROLL#7 main::@3/(byte*) SCROLL#4 )
  (byte) main::scroll#5 ← phi( main::@2/(byte) main::scroll#7 main::@3/(byte) main::scroll#5 )
  (byte*) BGCOL#3 ← phi( main::@2/(byte*) BGCOL#5 main::@3/(byte*) BGCOL#3 )
  (byte*) RASTER#2 ← phi( main::@2/(byte*) RASTER#1 main::@3/(byte*) RASTER#2 )
  (boolean~) main::$3 ← *((byte*) RASTER#2) != (byte/word/signed word/dword/signed dword) 255
  if((boolean~) main::$3) goto main::@3
  to:main::@8
main::@8: scope:[main]  from main::@3
  (byte*) TEXT#8 ← phi( main::@3/(byte*) TEXT#9 )
  (byte*) main::nxt#7 ← phi( main::@3/(byte*) main::nxt#8 )
  (byte*) RASTER#9 ← phi( main::@3/(byte*) RASTER#2 )
  (byte*) SCROLL#3 ← phi( main::@3/(byte*) SCROLL#4 )
  (byte) main::scroll#3 ← phi( main::@3/(byte) main::scroll#5 )
  (byte*) BGCOL#1 ← phi( main::@3/(byte*) BGCOL#3 )
  *((byte*) BGCOL#1) ← ++ *((byte*) BGCOL#1)
  (byte) main::scroll#1 ← -- (byte) main::scroll#3
  (boolean~) main::$4 ← (byte) main::scroll#1 == (byte/word/signed word/dword/signed dword) 255
  (boolean~) main::$5 ← ! (boolean~) main::$4
  if((boolean~) main::$5) goto main::@4
  to:main::@9
main::@4: scope:[main]  from main::@6 main::@8
  (byte*) TEXT#12 ← phi( main::@6/(byte*) TEXT#13 main::@8/(byte*) TEXT#8 )
  (byte*) main::nxt#11 ← phi( main::@6/(byte*) main::nxt#1 main::@8/(byte*) main::nxt#7 )
  (byte*) RASTER#6 ← phi( main::@6/(byte*) RASTER#8 main::@8/(byte*) RASTER#9 )
  (byte*) BGCOL#2 ← phi( main::@6/(byte*) BGCOL#4 main::@8/(byte*) BGCOL#1 )
  (byte*) SCROLL#1 ← phi( main::@6/(byte*) SCROLL#2 main::@8/(byte*) SCROLL#3 )
  (byte) main::scroll#4 ← phi( main::@6/(byte) main::scroll#6 main::@8/(byte) main::scroll#1 )
  *((byte*) SCROLL#1) ← (byte) main::scroll#4
  *((byte*) BGCOL#2) ← -- *((byte*) BGCOL#2)
  if(true) goto main::@1
  to:main::@return
main::@9: scope:[main]  from main::@8
  (byte*) RASTER#13 ← phi( main::@8/(byte*) RASTER#9 )
  (byte*) BGCOL#12 ← phi( main::@8/(byte*) BGCOL#1 )
  (byte*) SCROLL#11 ← phi( main::@8/(byte*) SCROLL#3 )
  (byte*) TEXT#7 ← phi( main::@8/(byte*) TEXT#8 )
  (byte*) main::nxt#6 ← phi( main::@8/(byte*) main::nxt#7 )
  (byte) main::scroll#2 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@5
main::@5: scope:[main]  from main::@5 main::@9
  (byte*) RASTER#12 ← phi( main::@5/(byte*) RASTER#12 main::@9/(byte*) RASTER#13 )
  (byte*) BGCOL#10 ← phi( main::@5/(byte*) BGCOL#10 main::@9/(byte*) BGCOL#12 )
  (byte*) SCROLL#8 ← phi( main::@5/(byte*) SCROLL#8 main::@9/(byte*) SCROLL#11 )
  (byte) main::scroll#11 ← phi( main::@5/(byte) main::scroll#11 main::@9/(byte) main::scroll#2 )
  (byte*) TEXT#6 ← phi( main::@5/(byte*) TEXT#6 main::@9/(byte*) TEXT#7 )
  (byte*) main::nxt#5 ← phi( main::@5/(byte*) main::nxt#5 main::@9/(byte*) main::nxt#6 )
  (byte) main::i#2 ← phi( main::@5/(byte) main::i#1 main::@9/(byte) main::i#0 )
  (byte/word~) main::$6 ← (byte) main::i#2 + (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte[]) main::line#0 + (byte) main::i#2) ← *((byte[]) main::line#0 + (byte/word~) main::$6)
  (byte) main::i#1 ← ++ (byte) main::i#2
  (boolean~) main::$7 ← (byte) main::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 39
  if((boolean~) main::$7) goto main::@5
  to:main::@10
main::@10: scope:[main]  from main::@5
  (byte*) RASTER#10 ← phi( main::@5/(byte*) RASTER#12 )
  (byte*) BGCOL#6 ← phi( main::@5/(byte*) BGCOL#10 )
  (byte*) SCROLL#5 ← phi( main::@5/(byte*) SCROLL#8 )
  (byte) main::scroll#8 ← phi( main::@5/(byte) main::scroll#11 )
  (byte*) TEXT#4 ← phi( main::@5/(byte*) TEXT#6 )
  (byte*) main::nxt#3 ← phi( main::@5/(byte*) main::nxt#5 )
  (byte) main::c#0 ← *((byte*) main::nxt#3)
  (boolean~) main::$8 ← (byte) main::c#0 == (byte) '@'
  (boolean~) main::$9 ← ! (boolean~) main::$8
  if((boolean~) main::$9) goto main::@6
  to:main::@11
main::@6: scope:[main]  from main::@10 main::@11
  (byte*) TEXT#13 ← phi( main::@10/(byte*) TEXT#4 main::@11/(byte*) TEXT#2 )
  (byte*) RASTER#8 ← phi( main::@10/(byte*) RASTER#10 main::@11/(byte*) RASTER#11 )
  (byte*) BGCOL#4 ← phi( main::@10/(byte*) BGCOL#6 main::@11/(byte*) BGCOL#7 )
  (byte*) SCROLL#2 ← phi( main::@10/(byte*) SCROLL#5 main::@11/(byte*) SCROLL#6 )
  (byte) main::scroll#6 ← phi( main::@10/(byte) main::scroll#8 main::@11/(byte) main::scroll#9 )
  (byte*) main::nxt#4 ← phi( main::@10/(byte*) main::nxt#3 main::@11/(byte*) main::nxt#2 )
  (byte) main::c#2 ← phi( main::@10/(byte) main::c#0 main::@11/(byte) main::c#1 )
  *((byte[]) main::line#0 + (byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c#2
  (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4
  to:main::@4
main::@11: scope:[main]  from main::@10
  (byte*) RASTER#11 ← phi( main::@10/(byte*) RASTER#10 )
  (byte*) BGCOL#7 ← phi( main::@10/(byte*) BGCOL#6 )
  (byte*) SCROLL#6 ← phi( main::@10/(byte*) SCROLL#5 )
  (byte) main::scroll#9 ← phi( main::@10/(byte) main::scroll#8 )
  (byte*) TEXT#2 ← phi( main::@10/(byte*) TEXT#4 )
  (byte*) main::nxt#2 ← (byte*) TEXT#2
  (byte) main::c#1 ← *((byte*) main::nxt#2)
  to:main::@6
main::@return: scope:[main]  from main::@4
  return 
  to:@return
fillscreen: scope:[fillscreen]  from main
  (byte) fillscreen::fill#2 ← 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::@1
  (byte*) fillscreen::screen#2 ← phi( fillscreen/(byte*) fillscreen::screen#1 fillscreen::@1/(byte*) fillscreen::screen#2 )
  (byte*) fillscreen::cursor#2 ← phi( fillscreen/(byte*) fillscreen::cursor#0 fillscreen::@1/(byte*) fillscreen::cursor#1 )
  (byte) fillscreen::fill#1 ← phi( fillscreen/(byte) fillscreen::fill#2 fillscreen::@1/(byte) fillscreen::fill#1 )
  *((byte*) fillscreen::cursor#2) ← (byte) fillscreen::fill#1
  (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2
  (byte*~) fillscreen::$0 ← (byte*) fillscreen::screen#2 + (word/signed word/dword/signed dword) 1000
  (boolean~) fillscreen::$1 ← (byte*) fillscreen::cursor#1 < (byte*~) fillscreen::$0
  if((boolean~) fillscreen::$1) goto fillscreen::@1
  to:fillscreen::@return
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  return 
  to:@return
@2: scope:[]  from @begin
  (byte*) SCROLL#13 ← phi( @begin/(byte*) SCROLL#0 )
  (byte*) BGCOL#13 ← phi( @begin/(byte*) BGCOL#0 )
  (byte*) RASTER#7 ← phi( @begin/(byte*) RASTER#0 )
  (byte*) TEXT#5 ← phi( @begin/(byte*) TEXT#0 )
  (byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
  call main param-assignment
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(const string) $0 = (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BGCOL#1
(byte*) BGCOL#10
(byte*) BGCOL#11
(byte*) BGCOL#12
(byte*) BGCOL#13
(byte*) BGCOL#2
(byte*) BGCOL#3
(byte*) BGCOL#4
(byte*) BGCOL#5
(byte*) BGCOL#6
(byte*) BGCOL#7
(byte*) BGCOL#8
(byte*) BGCOL#9
(byte*) RASTER
(byte*) RASTER#0
(byte*) RASTER#1
(byte*) RASTER#10
(byte*) RASTER#11
(byte*) RASTER#12
(byte*) RASTER#13
(byte*) RASTER#2
(byte*) RASTER#3
(byte*) RASTER#4
(byte*) RASTER#5
(byte*) RASTER#6
(byte*) RASTER#7
(byte*) RASTER#8
(byte*) RASTER#9
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCROLL
(byte*) SCROLL#0
(byte*) SCROLL#1
(byte*) SCROLL#10
(byte*) SCROLL#11
(byte*) SCROLL#12
(byte*) SCROLL#13
(byte*) SCROLL#2
(byte*) SCROLL#3
(byte*) SCROLL#4
(byte*) SCROLL#5
(byte*) SCROLL#6
(byte*) SCROLL#7
(byte*) SCROLL#8
(byte*) SCROLL#9
(byte*) TEXT
(byte*) TEXT#0
(byte*) TEXT#1
(byte*) TEXT#10
(byte*) TEXT#11
(byte*) TEXT#12
(byte*) TEXT#13
(byte*) TEXT#2
(byte*) TEXT#3
(byte*) TEXT#4
(byte*) TEXT#5
(byte*) TEXT#6
(byte*) TEXT#7
(byte*) TEXT#8
(byte*) TEXT#9
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(byte*~) fillscreen::$0
(boolean~) fillscreen::$1
(label) fillscreen::@1
(label) fillscreen::@return
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#0
(byte*) fillscreen::cursor#1
(byte*) fillscreen::cursor#2
(byte) fillscreen::fill
(byte) fillscreen::fill#0
(byte) fillscreen::fill#1
(byte) fillscreen::fill#2
(byte*) fillscreen::screen
(byte*) fillscreen::screen#0
(byte*) fillscreen::screen#1
(byte*) fillscreen::screen#2
(void()) main()
(byte*~) main::$1
(boolean~) main::$2
(boolean~) main::$3
(boolean~) main::$4
(boolean~) main::$5
(byte/word~) main::$6
(boolean~) main::$7
(boolean~) main::$8
(boolean~) main::$9
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@13
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(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::line
(byte[]) main::line#0
(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

OPTIMIZING CONTROL FLOW GRAPH
Culled Empty Block (label) @3
Succesful SSA optimization Pass2CullEmptyBlocks
Inversing boolean not (boolean~) main::$5 ← (byte) main::scroll#1 != (byte/word/signed word/dword/signed dword) 255 from (boolean~) main::$4 ← (byte) main::scroll#1 == (byte/word/signed word/dword/signed dword) 255
Inversing boolean not (boolean~) main::$9 ← (byte) main::c#0 != (byte) '@' from (boolean~) main::$8 ← (byte) main::c#0 == (byte) '@'
Succesful SSA optimization Pass2UnaryNotSimplification
Not aliassing across scopes: SCREEN#1 SCREEN#3
Not aliassing across scopes: TEXT#3 TEXT#5
Not aliassing across scopes: RASTER#5 RASTER#7
Not aliassing across scopes: BGCOL#11 BGCOL#13
Not aliassing across scopes: SCROLL#12 SCROLL#13
Not aliassing across scopes: fillscreen::screen#0 SCREEN#1
Not aliassing across scopes: main::nxt#0 TEXT#1
Not aliassing identity: main::nxt#5 main::nxt#5
Not aliassing identity: TEXT#6 TEXT#6
Not aliassing identity: main::scroll#11 main::scroll#11
Not aliassing identity: SCROLL#8 SCROLL#8
Not aliassing identity: BGCOL#10 BGCOL#10
Not aliassing identity: RASTER#12 RASTER#12
Not aliassing across scopes: main::nxt#2 TEXT#2
Not aliassing across scopes: fillscreen::screen#1 fillscreen::screen#0
Not aliassing across scopes: fillscreen::fill#2 fillscreen::fill#0
Alias (byte*) TEXT#1 = (byte*) TEXT#3 
Alias (byte*) SCREEN#1 = (byte*) SCREEN#2 
Alias (byte*) RASTER#4 = (byte*) RASTER#5 
Alias (byte*) BGCOL#11 = (byte*) BGCOL#9 
Alias (byte*) SCROLL#10 = (byte*) SCROLL#12 
Alias (byte[]) main::line#0 = (byte*~) main::$1 
Alias (byte*) RASTER#3 = (byte*) RASTER#6 
Alias (byte*) BGCOL#2 = (byte*) BGCOL#8 
Alias (byte) main::scroll#10 = (byte) main::scroll#4 
Alias (byte*) SCROLL#1 = (byte*) SCROLL#9 
Alias (byte*) main::nxt#10 = (byte*) main::nxt#11 
Alias (byte*) TEXT#11 = (byte*) TEXT#12 
Alias (byte*) BGCOL#1 = (byte*) BGCOL#3 (byte*) BGCOL#12 
Alias (byte) main::scroll#3 = (byte) main::scroll#5 
Alias (byte*) SCROLL#11 = (byte*) SCROLL#3 (byte*) SCROLL#4 
Alias (byte*) RASTER#13 = (byte*) RASTER#9 (byte*) RASTER#2 
Alias (byte*) main::nxt#6 = (byte*) main::nxt#7 (byte*) main::nxt#8 
Alias (byte*) TEXT#7 = (byte*) TEXT#8 (byte*) TEXT#9 
Alias (byte*) main::nxt#3 = (byte*) main::nxt#5 
Alias (byte*) TEXT#2 = (byte*) TEXT#4 (byte*) TEXT#6 
Alias (byte) main::scroll#11 = (byte) main::scroll#8 (byte) main::scroll#9 
Alias (byte*) SCROLL#5 = (byte*) SCROLL#8 (byte*) SCROLL#6 
Alias (byte*) BGCOL#10 = (byte*) BGCOL#6 (byte*) BGCOL#7 
Alias (byte*) RASTER#10 = (byte*) RASTER#12 (byte*) RASTER#11 
Alias (byte*) fillscreen::cursor#0 = (byte*) fillscreen::screen#1 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#3 
Alias (byte*) TEXT#0 = (byte*) TEXT#5 
Alias (byte*) RASTER#0 = (byte*) RASTER#7 
Alias (byte*) BGCOL#0 = (byte*) BGCOL#13 
Alias (byte*) SCROLL#0 = (byte*) SCROLL#13 
Succesful SSA optimization Pass2AliasElimination
Not aliassing across scopes: SCREEN#1 SCREEN#0
Not aliassing across scopes: TEXT#1 TEXT#0
Not aliassing across scopes: RASTER#4 RASTER#0
Not aliassing across scopes: BGCOL#11 BGCOL#0
Not aliassing across scopes: SCROLL#10 SCROLL#0
Not aliassing across scopes: fillscreen::screen#0 SCREEN#1
Not aliassing across scopes: main::nxt#0 TEXT#1
Not aliassing identity: main::nxt#3 main::nxt#3
Not aliassing identity: TEXT#2 TEXT#2
Not aliassing identity: main::scroll#11 main::scroll#11
Not aliassing identity: SCROLL#5 SCROLL#5
Not aliassing identity: BGCOL#10 BGCOL#10
Not aliassing identity: RASTER#10 RASTER#10
Not aliassing across scopes: main::nxt#2 TEXT#2
Not aliassing across scopes: fillscreen::cursor#0 fillscreen::screen#0
Not aliassing across scopes: fillscreen::fill#2 fillscreen::fill#0
Alias (byte) main::scroll#11 = (byte) main::scroll#6 
Alias (byte*) SCROLL#2 = (byte*) SCROLL#5 
Alias (byte*) BGCOL#10 = (byte*) BGCOL#4 
Alias (byte*) RASTER#10 = (byte*) RASTER#8 
Alias (byte*) TEXT#13 = (byte*) TEXT#2 
Succesful SSA optimization Pass2AliasElimination
Not aliassing across scopes: SCREEN#1 SCREEN#0
Not aliassing across scopes: TEXT#1 TEXT#0
Not aliassing across scopes: RASTER#4 RASTER#0
Not aliassing across scopes: BGCOL#11 BGCOL#0
Not aliassing across scopes: SCROLL#10 SCROLL#0
Not aliassing across scopes: fillscreen::screen#0 SCREEN#1
Not aliassing across scopes: main::nxt#0 TEXT#1
Not aliassing identity: main::nxt#3 main::nxt#3
Not aliassing identity: TEXT#13 TEXT#13
Not aliassing identity: main::scroll#11 main::scroll#11
Not aliassing identity: SCROLL#2 SCROLL#2
Not aliassing identity: BGCOL#10 BGCOL#10
Not aliassing identity: RASTER#10 RASTER#10
Not aliassing across scopes: main::nxt#2 TEXT#13
Not aliassing across scopes: fillscreen::cursor#0 fillscreen::screen#0
Not aliassing across scopes: fillscreen::fill#2 fillscreen::fill#0
Self Phi Eliminated (byte*) RASTER#1
Self Phi Eliminated (byte*) BGCOL#5
Self Phi Eliminated (byte) main::scroll#7
Self Phi Eliminated (byte*) SCROLL#7
Self Phi Eliminated (byte*) main::nxt#9
Self Phi Eliminated (byte*) TEXT#10
Self Phi Eliminated (byte*) RASTER#13
Self Phi Eliminated (byte*) BGCOL#1
Self Phi Eliminated (byte) main::scroll#3
Self Phi Eliminated (byte*) SCROLL#11
Self Phi Eliminated (byte*) main::nxt#6
Self Phi Eliminated (byte*) TEXT#7
Self Phi Eliminated (byte*) main::nxt#3
Self Phi Eliminated (byte*) TEXT#13
Self Phi Eliminated (byte) main::scroll#11
Self Phi Eliminated (byte*) SCROLL#2
Self Phi Eliminated (byte*) BGCOL#10
Self Phi Eliminated (byte*) RASTER#10
Self Phi Eliminated (byte) fillscreen::fill#1
Self Phi Eliminated (byte*) fillscreen::screen#2
Succesful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#0
Redundant Phi (byte*) TEXT#1 (byte*) TEXT#0
Redundant Phi (byte*) RASTER#4 (byte*) RASTER#0
Redundant Phi (byte*) BGCOL#11 (byte*) BGCOL#0
Redundant Phi (byte*) SCROLL#10 (byte*) SCROLL#0
Redundant Phi (byte*) RASTER#13 (byte*) RASTER#1
Redundant Phi (byte*) BGCOL#1 (byte*) BGCOL#5
Redundant Phi (byte) main::scroll#3 (byte) main::scroll#7
Redundant Phi (byte*) SCROLL#11 (byte*) SCROLL#7
Redundant Phi (byte*) main::nxt#6 (byte*) main::nxt#9
Redundant Phi (byte*) TEXT#7 (byte*) TEXT#10
Redundant Phi (byte*) main::nxt#3 (byte*) main::nxt#6
Redundant Phi (byte*) TEXT#13 (byte*) TEXT#7
Redundant Phi (byte) main::scroll#11 (byte) main::scroll#2
Redundant Phi (byte*) SCROLL#2 (byte*) SCROLL#11
Redundant Phi (byte*) BGCOL#10 (byte*) BGCOL#1
Redundant Phi (byte*) RASTER#10 (byte*) RASTER#13
Redundant Phi (byte*) fillscreen::cursor#0 (byte*) fillscreen::screen#0
Redundant Phi (byte) fillscreen::fill#2 (byte) fillscreen::fill#0
Redundant Phi (byte) fillscreen::fill#1 (byte) fillscreen::fill#2
Redundant Phi (byte*) fillscreen::screen#2 (byte*) fillscreen::cursor#0
Succesful SSA optimization Pass2RedundantPhiElimination
Redundant Phi (byte*) SCROLL#1 (byte*) SCROLL#7
Redundant Phi (byte*) BGCOL#2 (byte*) BGCOL#5
Redundant Phi (byte*) RASTER#3 (byte*) RASTER#1
Redundant Phi (byte*) TEXT#11 (byte*) TEXT#10
Succesful SSA optimization Pass2RedundantPhiElimination
Simple Condition (boolean~) main::$2 if(*((byte*) RASTER#1)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2
Simple Condition (boolean~) main::$3 if(*((byte*) RASTER#1)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3
Simple Condition (boolean~) main::$5 if((byte) main::scroll#1!=(byte/word/signed word/dword/signed dword) 255) goto main::@4
Simple Condition (boolean~) main::$7 if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 39) goto main::@5
Simple Condition (boolean~) main::$9 if((byte) main::c#0!=(byte) '@') goto main::@6
Simple Condition (boolean~) fillscreen::$1 if((byte*) fillscreen::cursor#1<(byte*~) fillscreen::$0) goto fillscreen::@1
Succesful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte*) RASTER#0 = ((byte*))53266
Constant (const byte*) BGCOL#0 = ((byte*))53280
Constant (const byte*) SCROLL#0 = ((byte*))53270
Constant (const string) TEXT#0 = $0
Constant (const byte) fillscreen::fill#0 = 32
Constant (const byte) main::scroll#0 = 7
Constant (const byte) main::scroll#2 = 7
Constant (const byte) main::i#0 = 0
Succesful SSA optimization Pass2ConstantIdentification
Constant (const byte*) fillscreen::screen#0 = SCREEN#0
Constant (const string) main::nxt#0 = TEXT#0
Constant (const byte*) main::line#0 = SCREEN#0+40
Succesful SSA optimization Pass2ConstantIdentification
Constant (const byte*) fillscreen::$0 = fillscreen::screen#0+1000
Succesful SSA optimization Pass2ConstantIdentification
Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2
Consolidated array index constant in assignment *(main::line#0+1 + main::$6)
Consolidated array index constant in *(main::line#0+39)
Succesful SSA optimization Pass2ConstantAdditionElimination
Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::@1
Culled Empty Block (label) main::@9
Succesful SSA optimization Pass2CullEmptyBlocks
Not aliassing identity: RASTER#1 RASTER#1
Not aliassing identity: BGCOL#5 BGCOL#5
Not aliassing identity: SCROLL#7 SCROLL#7
Not aliassing identity: TEXT#10 TEXT#10
Not aliassing across scopes: main::nxt#2 TEXT#10
Alias (byte) main::i#2 = (byte/word~) main::$6 
Succesful SSA optimization Pass2AliasElimination
Not aliassing identity: RASTER#1 RASTER#1
Not aliassing identity: BGCOL#5 BGCOL#5
Not aliassing identity: SCROLL#7 SCROLL#7
Not aliassing identity: TEXT#10 TEXT#10
Not aliassing across scopes: main::nxt#2 TEXT#10
Self Phi Eliminated (byte*) RASTER#1
Self Phi Eliminated (byte*) BGCOL#5
Self Phi Eliminated (byte*) SCROLL#7
Self Phi Eliminated (byte*) TEXT#10
Succesful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) RASTER#1 (const byte*) RASTER#0
Redundant Phi (byte*) BGCOL#5 (const byte*) BGCOL#0
Redundant Phi (byte*) SCROLL#7 (const byte*) SCROLL#0
Redundant Phi (byte*) TEXT#10 (const string) TEXT#0
Succesful SSA optimization Pass2RedundantPhiElimination
Constant (const string) main::nxt#2 = TEXT#0
Succesful SSA optimization Pass2ConstantIdentification
OPTIMIZING CONTROL FLOW GRAPH
Inlining constant with var siblings (const byte) main::scroll#0
Inlining constant with var siblings (const byte) main::scroll#0
Inlining constant with var siblings (const byte) main::scroll#0
Inlining constant with var siblings (const byte) main::scroll#2
Inlining constant with var siblings (const byte) main::scroll#2
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::i#0
Inlining constant with var siblings (const string) main::nxt#0
Inlining constant with var siblings (const string) main::nxt#0
Inlining constant with var siblings (const string) main::nxt#0
Inlining constant with var siblings (const string) main::nxt#0
Inlining constant with var siblings (const string) main::nxt#2
Inlining constant with var siblings (const string) main::nxt#2
Inlining constant with var siblings (const string) main::nxt#2
Inlining constant with var siblings (const string) main::nxt#2
Constant inlined main::nxt#0 = (const string) TEXT#0
Constant inlined main::scroll#0 = (byte/signed byte/word/signed word/dword/signed dword) 7
Constant inlined fillscreen::$0 = (const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000
Constant inlined fillscreen::screen#0 = (const byte*) SCREEN#0
Constant inlined main::scroll#2 = (byte/signed byte/word/signed word/dword/signed dword) 7
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined $0 = (const string) TEXT#0
Constant inlined main::nxt#2 = (const string) TEXT#0
Succesful SSA optimization Pass2ConstantInlining
Block Sequence Planned @begin @2 @end main main::@2 main::@3 main::@8 main::@5 main::@10 main::@11 main::@6 main::@4 main::@return fillscreen fillscreen::@1 fillscreen::@return 
Added new block during phi lifting main::@14(between main::@4 and main::@2)
Added new block during phi lifting main::@15(between main::@5 and main::@5)
Added new block during phi lifting main::@16(between main::@10 and main::@6)
Added new block during phi lifting main::@17(between main::@8 and main::@4)
Added new block during phi lifting fillscreen::@3(between fillscreen::@1 and fillscreen::@1)
Block Sequence Planned @begin @2 @end main main::@2 main::@3 main::@8 main::@5 main::@10 main::@11 main::@6 main::@4 main::@return main::@14 main::@16 main::@15 main::@17 fillscreen fillscreen::@1 fillscreen::@return fillscreen::@3 
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of fillscreen
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to fillscreen:5 

Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Created 8 initial phi equivalence classes
Coalesced [19] main::c#4 ← main::c#1
Coalesced [23] main::nxt#14 ← main::nxt#1
Coalesced [29] main::scroll#12 ← main::scroll#10
Coalesced [30] main::nxt#12 ← main::nxt#10
Coalesced [31] main::c#3 ← main::c#0
Coalesced [32] main::nxt#13 ← main::nxt#9
Coalesced [33] main::i#3 ← main::i#1
Coalesced [34] main::scroll#13 ← main::scroll#1
Coalesced (already) [35] main::nxt#15 ← main::nxt#9
Coalesced [42] fillscreen::cursor#3 ← fillscreen::cursor#1
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) main::@14
Culled Empty Block (label) main::@16
Culled Empty Block (label) main::@15
Culled Empty Block (label) main::@17
Culled Empty Block (label) fillscreen::@3
Block Sequence Planned @begin @2 @end main main::@2 main::@3 main::@8 main::@5 main::@10 main::@11 main::@6 main::@4 main::@return fillscreen fillscreen::@1 fillscreen::@return 
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of fillscreen
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi() [ ] ( )
  to:@2
@2: scope:[]  from @begin
  [1] phi() [ ] ( )
  [2] call main param-assignment [ ] ( )
  to:@end
@end: scope:[]  from @2
  [3] phi() [ ] ( )
main: scope:[main]  from @2
  [4] phi() [ ] ( main:2 [ ] )
  [5] call fillscreen param-assignment [ ] ( main:2 [ ] )
  to:main::@2
main::@2: scope:[main]  from main main::@2 main::@4
  [6] (byte*) main::nxt#9 ← phi( main::@4/(byte*) main::nxt#10 main/(const string) TEXT#0 ) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] )
  [6] (byte) main::scroll#7 ← phi( main::@4/(byte) main::scroll#10 main/(byte/signed byte/word/signed word/dword/signed dword) 7 ) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] )
  [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] )
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@3
  [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] )
  to:main::@8
main::@8: scope:[main]  from main::@3
  [9] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] )
  [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] )
  [11] if((byte) main::scroll#1!=(byte/word/signed word/dword/signed dword) 255) goto main::@4 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] )
  to:main::@5
main::@5: scope:[main]  from main::@5 main::@8
  [12] (byte) main::i#2 ← phi( main::@5/(byte) main::i#1 main::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] )
  [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] )
  [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] )
  [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 39) goto main::@5 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] )
  to:main::@10
main::@10: scope:[main]  from main::@5
  [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] )
  [17] if((byte) main::c#0!=(byte) '@') goto main::@6 [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] )
  to:main::@11
main::@11: scope:[main]  from main::@10
  [18] (byte) main::c#1 ← *((const string) TEXT#0) [ main::c#1 ] ( main:2 [ main::c#1 ] )
  to:main::@6
main::@6: scope:[main]  from main::@10 main::@11
  [19] (byte*) main::nxt#4 ← phi( main::@10/(byte*) main::nxt#9 main::@11/(const string) TEXT#0 ) [ main::c#2 main::nxt#4 ] ( main:2 [ main::c#2 main::nxt#4 ] )
  [19] (byte) main::c#2 ← phi( main::@10/(byte) main::c#0 main::@11/(byte) main::c#1 ) [ main::c#2 main::nxt#4 ] ( main:2 [ main::c#2 main::nxt#4 ] )
  [20] *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c#2 [ main::nxt#4 ] ( main:2 [ main::nxt#4 ] )
  [21] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 [ main::nxt#1 ] ( main:2 [ main::nxt#1 ] )
  to:main::@4
main::@4: scope:[main]  from main::@6 main::@8
  [22] (byte*) main::nxt#10 ← phi( main::@6/(byte*) main::nxt#1 main::@8/(byte*) main::nxt#9 ) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] )
  [22] (byte) main::scroll#10 ← phi( main::@6/(byte/signed byte/word/signed word/dword/signed dword) 7 main::@8/(byte) main::scroll#1 ) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] )
  [23] *((const byte*) SCROLL#0) ← (byte) main::scroll#10 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] )
  [24] *((const byte*) BGCOL#0) ← -- *((const byte*) BGCOL#0) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] )
  [25] if(true) goto main::@2 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] )
  to:main::@return
main::@return: scope:[main]  from main::@4
  [26] return  [ ] ( main:2 [ ] )
  to:@return
fillscreen: scope:[fillscreen]  from main
  [27] phi() [ ] ( main:2::fillscreen:5 [ ] )
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@1
  [28] (byte*) fillscreen::cursor#2 ← phi( fillscreen/(const byte*) SCREEN#0 fillscreen::@1/(byte*) fillscreen::cursor#1 ) [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] )
  [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] )
  [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] )
  [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] )
  to:fillscreen::@return
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  [32] return  [ ] ( main:2::fillscreen:5 [ ] )
  to:@return

DOMINATORS
@begin dominated by  @begin 
@2 dominated by  @begin @2 
@end dominated by  @begin @end @2 
main dominated by  @begin main @2 
main::@2 dominated by  @begin main @2 main::@2 
main::@3 dominated by  @begin main @2 main::@2 main::@3 
main::@8 dominated by  @begin main::@8 main @2 main::@2 main::@3 
main::@5 dominated by  @begin main::@8 main @2 main::@2 main::@5 main::@3 
main::@10 dominated by  @begin main::@8 main::@10 main @2 main::@2 main::@5 main::@3 
main::@11 dominated by  main::@11 @begin main::@8 main::@10 main @2 main::@2 main::@5 main::@3 
main::@6 dominated by  @begin main::@8 main::@10 main @2 main::@2 main::@5 main::@6 main::@3 
main::@4 dominated by  @begin main::@8 main @2 main::@2 main::@3 main::@4 
main::@return dominated by  main::@return @begin main::@8 main @2 main::@2 main::@3 main::@4 
fillscreen dominated by  @begin main @2 fillscreen 
fillscreen::@1 dominated by  @begin main @2 fillscreen fillscreen::@1 
fillscreen::@return dominated by  @begin main @2 fillscreen fillscreen::@1 fillscreen::@return 

NATURAL LOOPS
Found back edge: Loop head: main::@2 tails: main::@2 blocks: null
Found back edge: Loop head: main::@3 tails: main::@3 blocks: null
Found back edge: Loop head: main::@5 tails: main::@5 blocks: null
Found back edge: Loop head: main::@2 tails: main::@4 blocks: null
Found back edge: Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: null
Populated: Loop head: main::@2 tails: main::@2 blocks: main::@2 
Populated: Loop head: main::@3 tails: main::@3 blocks: main::@3 
Populated: Loop head: main::@5 tails: main::@5 blocks: main::@5 
Populated: Loop head: main::@2 tails: main::@4 blocks: main::@4 main::@6 main::@8 main::@10 main::@11 main::@3 main::@5 main::@2 
Populated: Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: fillscreen::@1 
Loop head: main::@2 tails: main::@2 blocks: main::@2 
Loop head: main::@3 tails: main::@3 blocks: main::@3 
Loop head: main::@5 tails: main::@5 blocks: main::@5 
Loop head: main::@2 tails: main::@4 blocks: main::@4 main::@6 main::@8 main::@10 main::@11 main::@3 main::@5 main::@2 
Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: fillscreen::@1 

NATURAL LOOPS WITH DEPTH
Found 0 loops in scope []
Found 4 loops in scope [main]
  Loop head: main::@2 tails: main::@2 blocks: main::@2 
  Loop head: main::@3 tails: main::@3 blocks: main::@3 
  Loop head: main::@5 tails: main::@5 blocks: main::@5 
  Loop head: main::@2 tails: main::@4 blocks: main::@4 main::@6 main::@8 main::@10 main::@11 main::@3 main::@5 main::@2 
Found 1 loops in scope [fillscreen]
  Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: fillscreen::@1 
Loop head: main::@2 tails: main::@2 blocks: main::@2  depth: 2
Loop head: main::@3 tails: main::@3 blocks: main::@3  depth: 2
Loop head: main::@5 tails: main::@5 blocks: main::@5  depth: 2
Loop head: main::@2 tails: main::@4 blocks: main::@4 main::@6 main::@8 main::@10 main::@11 main::@3 main::@5 main::@2  depth: 1
Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: fillscreen::@1  depth: 1


VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(byte*) RASTER
(byte*) SCREEN
(byte*) SCROLL
(byte*) TEXT
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#1 16.5
(byte*) fillscreen::cursor#2 16.5
(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 151.5
(byte) main::i#2 202.0
(byte[]) main::line
(byte*) main::nxt
(byte*) main::nxt#1 22.0
(byte*) main::nxt#10 8.25
(byte*) main::nxt#4 11.0
(byte*) main::nxt#9 3.6666666666666665
(byte) main::scroll
(byte) main::scroll#1 16.5
(byte) main::scroll#10 8.25
(byte) main::scroll#7 5.5

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

INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG4 @2
b2:
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
    .label line = SCREEN+$28
    .label scroll = 2
    .label i = 3
    .label c = 4
    .label nxt = 5
  //SEG10 [5] call fillscreen param-assignment [ ] ( main:2 [ ] )
  //SEG11 [27] phi from main to fillscreen [phi:main->fillscreen]
  fillscreen_from_main:
    jsr fillscreen
  //SEG12 [6] phi from main to main::@2 [phi:main->main::@2]
  b2_from_main:
  //SEG13 [6] phi (byte*) main::nxt#9 = (const string) TEXT#0 [phi:main->main::@2#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG14 [6] phi (byte) main::scroll#7 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main->main::@2#1] -- vbuz1=vbuc1 
    lda #7
    sta scroll
    jmp b2
  //SEG15 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  b2_from_b2:
    jmp b2
  //SEG16 [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  b2_from_b4:
  //SEG17 [6] phi (byte*) main::nxt#9 = (byte*) main::nxt#10 [phi:main::@4->main::@2#0] -- register_copy 
  //SEG18 [6] phi (byte) main::scroll#7 = (byte) main::scroll#10 [phi:main::@4->main::@2#1] -- register_copy 
    jmp b2
  //SEG19 main::@2
  b2:
  //SEG20 [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$fe
    bne b2_from_b2
    jmp b3
  //SEG21 main::@3
  b3:
  //SEG22 [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b3
    jmp b8
  //SEG23 main::@8
  b8:
  //SEG24 [9] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
  //SEG25 [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuz1=_dec_vbuz1 
    dec scroll
  //SEG26 [11] if((byte) main::scroll#1!=(byte/word/signed word/dword/signed dword) 255) goto main::@4 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuz1_neq_vbuc1_then_la1 
    lda scroll
    cmp #$ff
    bne b4_from_b8
  //SEG27 [12] phi from main::@8 to main::@5 [phi:main::@8->main::@5]
  b5_from_b8:
  //SEG28 [12] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@5#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b5
  //SEG29 [12] phi from main::@5 to main::@5 [phi:main::@5->main::@5]
  b5_from_b5:
  //SEG30 [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@5#0] -- register_copy 
    jmp b5
  //SEG31 main::@5
  b5:
  //SEG32 [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] ) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 
    ldy i
    lda line+1,y
    sta line,y
  //SEG33 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuz1=_inc_vbuz1 
    inc i
  //SEG34 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 39) goto main::@5 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 
    lda i
    cmp #$27
    bne b5_from_b5
    jmp b10
  //SEG35 main::@10
  b10:
  //SEG36 [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuz1=_deref_pbuz2 
    ldy #0
    lda (nxt),y
    sta c
  //SEG37 [17] if((byte) main::c#0!=(byte) '@') goto main::@6 [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuz1_neq_vbuc1_then_la1 
    lda c
    cmp #'@'
    bne b6_from_b10
    jmp b11
  //SEG38 main::@11
  b11:
  //SEG39 [18] (byte) main::c#1 ← *((const string) TEXT#0) [ main::c#1 ] ( main:2 [ main::c#1 ] ) -- vbuz1=_deref_pbuc1 
    lda TEXT
    sta c
  //SEG40 [19] phi from main::@11 to main::@6 [phi:main::@11->main::@6]
  b6_from_b11:
  //SEG41 [19] phi (byte*) main::nxt#4 = (const string) TEXT#0 [phi:main::@11->main::@6#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG42 [19] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@11->main::@6#1] -- register_copy 
    jmp b6
  //SEG43 [19] phi from main::@10 to main::@6 [phi:main::@10->main::@6]
  b6_from_b10:
  //SEG44 [19] phi (byte*) main::nxt#4 = (byte*) main::nxt#9 [phi:main::@10->main::@6#0] -- register_copy 
  //SEG45 [19] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@10->main::@6#1] -- register_copy 
    jmp b6
  //SEG46 main::@6
  b6:
  //SEG47 [20] *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c#2 [ main::nxt#4 ] ( main:2 [ main::nxt#4 ] ) -- _deref_pbuc1=vbuz1 
    lda c
    sta line+$27
  //SEG48 [21] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 [ main::nxt#1 ] ( main:2 [ main::nxt#1 ] ) -- pbuz1=_inc_pbuz1 
    inc nxt
    bne !+
    inc nxt+1
  !:
  //SEG49 [22] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
  b4_from_b6:
  //SEG50 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#1 [phi:main::@6->main::@4#0] -- register_copy 
  //SEG51 [22] phi (byte) main::scroll#10 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@6->main::@4#1] -- vbuz1=vbuc1 
    lda #7
    sta scroll
    jmp b4
  //SEG52 [22] phi from main::@8 to main::@4 [phi:main::@8->main::@4]
  b4_from_b8:
  //SEG53 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#9 [phi:main::@8->main::@4#0] -- register_copy 
  //SEG54 [22] phi (byte) main::scroll#10 = (byte) main::scroll#1 [phi:main::@8->main::@4#1] -- register_copy 
    jmp b4
  //SEG55 main::@4
  b4:
  //SEG56 [23] *((const byte*) SCROLL#0) ← (byte) main::scroll#10 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=vbuz1 
    lda scroll
    sta SCROLL
  //SEG57 [24] *((const byte*) BGCOL#0) ← -- *((const byte*) BGCOL#0) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
  //SEG58 [25] if(true) goto main::@2 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- true_then_la1 
    jmp b2_from_b4
    jmp breturn
  //SEG59 main::@return
  breturn:
  //SEG60 [26] return  [ ] ( main:2 [ ] )
    rts
}
//SEG61 fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 7
  //SEG62 [28] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  b1_from_fillscreen:
  //SEG63 [28] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN#0 [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta cursor
    lda #>SCREEN
    sta cursor+1
    jmp b1
  //SEG64 [28] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1]
  b1_from_b1:
  //SEG65 [28] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy 
    jmp b1
  //SEG66 fillscreen::@1
  b1:
  //SEG67 [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
  //SEG68 [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1=_inc_pbuz1 
    inc cursor
    bne !+
    inc cursor+1
  !:
  //SEG69 [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1_lt_pbuc1_then_la1 
    lda cursor+1
    cmp #>SCREEN+$3e8
    bcc b1_from_b1
    bne !+
    lda cursor
    cmp #<SCREEN+$3e8
    bcc b1_from_b1
  !:
    jmp breturn
  //SEG70 fillscreen::@return
  breturn:
  //SEG71 [32] return  [ ] ( main:2::fillscreen:5 [ ] )
    rts
}
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::scroll#7 main::scroll#10 main::scroll#1 ]
Statement [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) always clobbers reg byte a 
Statement [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::i#2 main::i#1 ]
Statement [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) always clobbers reg byte a reg byte y 
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 [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) always clobbers reg byte a 
Statement [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) always clobbers reg byte a 
Statement [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) always clobbers reg byte a 
Statement [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] ) always clobbers reg byte a 
Statement [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) always clobbers reg byte a reg byte y 
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 [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::scroll#7 main::scroll#10 main::scroll#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::i#2 main::i#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ main::c#2 main::c#0 main::c#1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:5 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 ] : zp ZP_WORD:5 , 
Potential registers zp ZP_WORD:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] : zp ZP_WORD:7 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 353.5: zp ZP_BYTE:3 [ main::i#2 main::i#1 ] 71.5: zp ZP_BYTE:4 [ main::c#2 main::c#0 main::c#1 ] 44.92: zp ZP_WORD:5 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 ] 30.25: zp ZP_BYTE:2 [ main::scroll#7 main::scroll#10 main::scroll#1 ] 
Uplift Scope [fillscreen] 33: zp ZP_WORD:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplift Scope [] 

Uplifting [main] best 8620 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::c#2 main::c#0 main::c#1 ] zp ZP_WORD:5 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 ] reg byte x [ main::scroll#7 main::scroll#10 main::scroll#1 ] 
Uplifting [fillscreen] best 8620 combination zp ZP_WORD:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplifting [] best 8620 combination 
Allocated (was zp ZP_WORD:5) zp ZP_WORD:2 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 ]
Allocated (was zp ZP_WORD:7) zp ZP_WORD:4 [ fillscreen::cursor#2 fillscreen::cursor#1 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG4 @2
b2:
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
    .label line = SCREEN+$28
    .label nxt = 2
  //SEG10 [5] call fillscreen param-assignment [ ] ( main:2 [ ] )
  //SEG11 [27] phi from main to fillscreen [phi:main->fillscreen]
  fillscreen_from_main:
    jsr fillscreen
  //SEG12 [6] phi from main to main::@2 [phi:main->main::@2]
  b2_from_main:
  //SEG13 [6] phi (byte*) main::nxt#9 = (const string) TEXT#0 [phi:main->main::@2#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG14 [6] phi (byte) main::scroll#7 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main->main::@2#1] -- vbuxx=vbuc1 
    ldx #7
    jmp b2
  //SEG15 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  b2_from_b2:
    jmp b2
  //SEG16 [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  b2_from_b4:
  //SEG17 [6] phi (byte*) main::nxt#9 = (byte*) main::nxt#10 [phi:main::@4->main::@2#0] -- register_copy 
  //SEG18 [6] phi (byte) main::scroll#7 = (byte) main::scroll#10 [phi:main::@4->main::@2#1] -- register_copy 
    jmp b2
  //SEG19 main::@2
  b2:
  //SEG20 [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$fe
    bne b2_from_b2
    jmp b3
  //SEG21 main::@3
  b3:
  //SEG22 [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b3
    jmp b8
  //SEG23 main::@8
  b8:
  //SEG24 [9] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
  //SEG25 [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuxx=_dec_vbuxx 
    dex
  //SEG26 [11] if((byte) main::scroll#1!=(byte/word/signed word/dword/signed dword) 255) goto main::@4 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne b4_from_b8
  //SEG27 [12] phi from main::@8 to main::@5 [phi:main::@8->main::@5]
  b5_from_b8:
  //SEG28 [12] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b5
  //SEG29 [12] phi from main::@5 to main::@5 [phi:main::@5->main::@5]
  b5_from_b5:
  //SEG30 [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@5#0] -- register_copy 
    jmp b5
  //SEG31 main::@5
  b5:
  //SEG32 [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] ) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda line+1,x
    sta line,x
  //SEG33 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuxx=_inc_vbuxx 
    inx
  //SEG34 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 39) goto main::@5 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne b5_from_b5
    jmp b10
  //SEG35 main::@10
  b10:
  //SEG36 [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuxx=_deref_pbuz1 
    ldy #0
    lda (nxt),y
    tax
  //SEG37 [17] if((byte) main::c#0!=(byte) '@') goto main::@6 [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #'@'
    bne b6_from_b10
    jmp b11
  //SEG38 main::@11
  b11:
  //SEG39 [18] (byte) main::c#1 ← *((const string) TEXT#0) [ main::c#1 ] ( main:2 [ main::c#1 ] ) -- vbuxx=_deref_pbuc1 
    ldx TEXT
  //SEG40 [19] phi from main::@11 to main::@6 [phi:main::@11->main::@6]
  b6_from_b11:
  //SEG41 [19] phi (byte*) main::nxt#4 = (const string) TEXT#0 [phi:main::@11->main::@6#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG42 [19] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@11->main::@6#1] -- register_copy 
    jmp b6
  //SEG43 [19] phi from main::@10 to main::@6 [phi:main::@10->main::@6]
  b6_from_b10:
  //SEG44 [19] phi (byte*) main::nxt#4 = (byte*) main::nxt#9 [phi:main::@10->main::@6#0] -- register_copy 
  //SEG45 [19] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@10->main::@6#1] -- register_copy 
    jmp b6
  //SEG46 main::@6
  b6:
  //SEG47 [20] *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c#2 [ main::nxt#4 ] ( main:2 [ main::nxt#4 ] ) -- _deref_pbuc1=vbuxx 
    stx line+$27
  //SEG48 [21] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 [ main::nxt#1 ] ( main:2 [ main::nxt#1 ] ) -- pbuz1=_inc_pbuz1 
    inc nxt
    bne !+
    inc nxt+1
  !:
  //SEG49 [22] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
  b4_from_b6:
  //SEG50 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#1 [phi:main::@6->main::@4#0] -- register_copy 
  //SEG51 [22] phi (byte) main::scroll#10 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@6->main::@4#1] -- vbuxx=vbuc1 
    ldx #7
    jmp b4
  //SEG52 [22] phi from main::@8 to main::@4 [phi:main::@8->main::@4]
  b4_from_b8:
  //SEG53 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#9 [phi:main::@8->main::@4#0] -- register_copy 
  //SEG54 [22] phi (byte) main::scroll#10 = (byte) main::scroll#1 [phi:main::@8->main::@4#1] -- register_copy 
    jmp b4
  //SEG55 main::@4
  b4:
  //SEG56 [23] *((const byte*) SCROLL#0) ← (byte) main::scroll#10 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=vbuxx 
    stx SCROLL
  //SEG57 [24] *((const byte*) BGCOL#0) ← -- *((const byte*) BGCOL#0) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
  //SEG58 [25] if(true) goto main::@2 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- true_then_la1 
    jmp b2_from_b4
    jmp breturn
  //SEG59 main::@return
  breturn:
  //SEG60 [26] return  [ ] ( main:2 [ ] )
    rts
}
//SEG61 fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 4
  //SEG62 [28] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  b1_from_fillscreen:
  //SEG63 [28] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN#0 [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta cursor
    lda #>SCREEN
    sta cursor+1
    jmp b1
  //SEG64 [28] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1]
  b1_from_b1:
  //SEG65 [28] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy 
    jmp b1
  //SEG66 fillscreen::@1
  b1:
  //SEG67 [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
  //SEG68 [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1=_inc_pbuz1 
    inc cursor
    bne !+
    inc cursor+1
  !:
  //SEG69 [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1_lt_pbuc1_then_la1 
    lda cursor+1
    cmp #>SCREEN+$3e8
    bcc b1_from_b1
    bne !+
    lda cursor
    cmp #<SCREEN+$3e8
    bcc b1_from_b1
  !:
    jmp breturn
  //SEG70 fillscreen::@return
  breturn:
  //SEG71 [32] return  [ ] ( main:2::fillscreen:5 [ ] )
    rts
}
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b8
Removing instruction jmp b5
Removing instruction jmp b10
Removing instruction jmp b11
Removing instruction jmp b6
Removing instruction jmp b4
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b4_from_b8 with b4
Replacing label b5_from_b5 with b5
Replacing label b6_from_b10 with b6
Replacing label b2_from_b4 with b2
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction bbegin:
Removing instruction b2_from_bbegin:
Removing instruction main_from_b2:
Removing instruction bend_from_b2:
Removing instruction b2_from_b4:
Removing instruction b5_from_b5:
Removing instruction b6_from_b10:
Removing instruction b4_from_b8:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b2:
Removing instruction bend:
Removing instruction fillscreen_from_main:
Removing instruction b2_from_main:
Removing instruction b8:
Removing instruction b5_from_b8:
Removing instruction b10:
Removing instruction b11:
Removing instruction b6_from_b11:
Removing instruction b4_from_b6:
Removing instruction breturn:
Removing instruction b1_from_fillscreen:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Skipping double jump to b2 in bne b2_from_b2
Succesful ASM optimization Pass5DoubleJumpElimination
Removing unreachable instruction rts
Succesful ASM optimization Pass5UnreachableCodeElimination
Relabelling long label b2_from_b2 to b1
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp b2
Removing instruction jmp b5
Removing instruction jmp b6
Removing instruction jmp b4
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
(label) @2
(label) @begin
(label) @end
(byte*) BGCOL
(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53280
(byte*) RASTER
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte*) SCROLL
(const byte*) SCROLL#0 SCROLL = ((byte*))(word/dword/signed dword) 53270
(byte*) TEXT
(const string) TEXT#0 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::@return
(byte*) fillscreen::cursor
(byte*) fillscreen::cursor#1 cursor zp ZP_WORD:4 16.5
(byte*) fillscreen::cursor#2 cursor zp ZP_WORD:4 16.5
(byte) fillscreen::fill
(const byte) fillscreen::fill#0 fill = (byte/signed byte/word/signed word/dword/signed dword) 32
(byte*) fillscreen::screen
(void()) main()
(label) main::@10
(label) main::@11
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@8
(label) main::@return
(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 151.5
(byte) main::i#2 reg byte x 202.0
(byte[]) main::line
(const byte*) main::line#0 line = (const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 40
(byte*) main::nxt
(byte*) main::nxt#1 nxt zp ZP_WORD:2 22.0
(byte*) main::nxt#10 nxt zp ZP_WORD:2 8.25
(byte*) main::nxt#4 nxt zp ZP_WORD:2 11.0
(byte*) main::nxt#9 nxt zp ZP_WORD:2 3.6666666666666665
(byte) main::scroll
(byte) main::scroll#1 reg byte x 16.5
(byte) main::scroll#10 reg byte x 8.25
(byte) main::scroll#7 reg byte x 5.5

reg byte x [ main::scroll#7 main::scroll#10 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 ZP_WORD:2 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 ]
zp ZP_WORD:4 [ fillscreen::cursor#2 fillscreen::cursor#1 ]


FINAL ASSEMBLER
Score: 5938

//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
  .label SCREEN = $400
  .label RASTER = $d012
  .label BGCOL = $d020
  .label SCROLL = $d016
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @2 to main [phi:@2->main]
  jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
main: {
    .label line = SCREEN+$28
    .label nxt = 2
  //SEG10 [5] call fillscreen param-assignment [ ] ( main:2 [ ] )
  //SEG11 [27] phi from main to fillscreen [phi:main->fillscreen]
    jsr fillscreen
  //SEG12 [6] phi from main to main::@2 [phi:main->main::@2]
  //SEG13 [6] phi (byte*) main::nxt#9 = (const string) TEXT#0 [phi:main->main::@2#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG14 [6] phi (byte) main::scroll#7 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main->main::@2#1] -- vbuxx=vbuc1 
    ldx #7
  //SEG15 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
  //SEG16 [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  //SEG17 [6] phi (byte*) main::nxt#9 = (byte*) main::nxt#10 [phi:main::@4->main::@2#0] -- register_copy 
  //SEG18 [6] phi (byte) main::scroll#7 = (byte) main::scroll#10 [phi:main::@4->main::@2#1] -- register_copy 
  //SEG19 main::@2
  b2:
  //SEG20 [7] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 254) goto main::@2 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$fe
    bne b2
  //SEG21 main::@3
  b3:
  //SEG22 [8] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@3 [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b3
  //SEG23 main::@8
  //SEG24 [9] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) [ main::scroll#7 main::nxt#9 ] ( main:2 [ main::scroll#7 main::nxt#9 ] ) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BGCOL
  //SEG25 [10] (byte) main::scroll#1 ← -- (byte) main::scroll#7 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuxx=_dec_vbuxx 
    dex
  //SEG26 [11] if((byte) main::scroll#1!=(byte/word/signed word/dword/signed dword) 255) goto main::@4 [ main::nxt#9 main::scroll#1 ] ( main:2 [ main::nxt#9 main::scroll#1 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne b4
  //SEG27 [12] phi from main::@8 to main::@5 [phi:main::@8->main::@5]
  //SEG28 [12] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@8->main::@5#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG29 [12] phi from main::@5 to main::@5 [phi:main::@5->main::@5]
  //SEG30 [12] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@5->main::@5#0] -- register_copy 
  //SEG31 main::@5
  b5:
  //SEG32 [13] *((const byte*) main::line#0 + (byte) main::i#2) ← *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) main::i#2) [ main::nxt#9 main::i#2 ] ( main:2 [ main::nxt#9 main::i#2 ] ) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda line+1,x
    sta line,x
  //SEG33 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuxx=_inc_vbuxx 
    inx
  //SEG34 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 39) goto main::@5 [ main::nxt#9 main::i#1 ] ( main:2 [ main::nxt#9 main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne b5
  //SEG35 main::@10
  //SEG36 [16] (byte) main::c#0 ← *((byte*) main::nxt#9) [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuxx=_deref_pbuz1 
    ldy #0
    lda (nxt),y
    tax
  //SEG37 [17] if((byte) main::c#0!=(byte) '@') goto main::@6 [ main::nxt#9 main::c#0 ] ( main:2 [ main::nxt#9 main::c#0 ] ) -- vbuxx_neq_vbuc1_then_la1 
    cpx #'@'
    bne b6
  //SEG38 main::@11
  //SEG39 [18] (byte) main::c#1 ← *((const string) TEXT#0) [ main::c#1 ] ( main:2 [ main::c#1 ] ) -- vbuxx=_deref_pbuc1 
    ldx TEXT
  //SEG40 [19] phi from main::@11 to main::@6 [phi:main::@11->main::@6]
  //SEG41 [19] phi (byte*) main::nxt#4 = (const string) TEXT#0 [phi:main::@11->main::@6#0] -- pbuz1=pbuc1 
    lda #<TEXT
    sta nxt
    lda #>TEXT
    sta nxt+1
  //SEG42 [19] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@11->main::@6#1] -- register_copy 
  //SEG43 [19] phi from main::@10 to main::@6 [phi:main::@10->main::@6]
  //SEG44 [19] phi (byte*) main::nxt#4 = (byte*) main::nxt#9 [phi:main::@10->main::@6#0] -- register_copy 
  //SEG45 [19] phi (byte) main::c#2 = (byte) main::c#0 [phi:main::@10->main::@6#1] -- register_copy 
  //SEG46 main::@6
  b6:
  //SEG47 [20] *((const byte*) main::line#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte) main::c#2 [ main::nxt#4 ] ( main:2 [ main::nxt#4 ] ) -- _deref_pbuc1=vbuxx 
    stx line+$27
  //SEG48 [21] (byte*) main::nxt#1 ← ++ (byte*) main::nxt#4 [ main::nxt#1 ] ( main:2 [ main::nxt#1 ] ) -- pbuz1=_inc_pbuz1 
    inc nxt
    bne !+
    inc nxt+1
  !:
  //SEG49 [22] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
  //SEG50 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#1 [phi:main::@6->main::@4#0] -- register_copy 
  //SEG51 [22] phi (byte) main::scroll#10 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@6->main::@4#1] -- vbuxx=vbuc1 
    ldx #7
  //SEG52 [22] phi from main::@8 to main::@4 [phi:main::@8->main::@4]
  //SEG53 [22] phi (byte*) main::nxt#10 = (byte*) main::nxt#9 [phi:main::@8->main::@4#0] -- register_copy 
  //SEG54 [22] phi (byte) main::scroll#10 = (byte) main::scroll#1 [phi:main::@8->main::@4#1] -- register_copy 
  //SEG55 main::@4
  b4:
  //SEG56 [23] *((const byte*) SCROLL#0) ← (byte) main::scroll#10 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=vbuxx 
    stx SCROLL
  //SEG57 [24] *((const byte*) BGCOL#0) ← -- *((const byte*) BGCOL#0) [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BGCOL
  //SEG58 [25] if(true) goto main::@2 [ main::scroll#10 main::nxt#10 ] ( main:2 [ main::scroll#10 main::nxt#10 ] ) -- true_then_la1 
    jmp b2
  //SEG59 main::@return
  //SEG60 [26] return  [ ] ( main:2 [ ] )
}
//SEG61 fillscreen
fillscreen: {
    .const fill = $20
    .label cursor = 4
  //SEG62 [28] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  //SEG63 [28] phi (byte*) fillscreen::cursor#2 = (const byte*) SCREEN#0 [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta cursor
    lda #>SCREEN
    sta cursor+1
  //SEG64 [28] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1]
  //SEG65 [28] phi (byte*) fillscreen::cursor#2 = (byte*) fillscreen::cursor#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy 
  //SEG66 fillscreen::@1
  b1:
  //SEG67 [29] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] ( main:2::fillscreen:5 [ fillscreen::cursor#2 ] ) -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
  //SEG68 [30] (byte*) fillscreen::cursor#1 ← ++ (byte*) fillscreen::cursor#2 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1=_inc_pbuz1 
    inc cursor
    bne !+
    inc cursor+1
  !:
  //SEG69 [31] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] ( main:2::fillscreen:5 [ fillscreen::cursor#1 ] ) -- pbuz1_lt_pbuc1_then_la1 
    lda cursor+1
    cmp #>SCREEN+$3e8
    bcc b1
    bne !+
    lda cursor
    cmp #<SCREEN+$3e8
    bcc b1
  !:
  //SEG70 fillscreen::@return
  //SEG71 [32] return  [ ] ( main:2::fillscreen:5 [ ] )
    rts
}
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     @"

