Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Warning! Adding boolean cast to non-boolean condition *((byte*) strlen::str)
Identified constant variable (byte*) SCREEN
Identified constant variable (byte*) LOGO
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx 
Inlined call (byte~) main::$0 ← call toD018 (const byte*) SCREEN (const byte*) LOGO 
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) @3
Culled Empty Block (label) @4
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) memset::@7
Culled Empty Block (label) memset::@6
Culled Empty Block (label) memset::@8
Culled Empty Block (label) memset::@9
Culled Empty Block (label) memset::@3
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) main::toD0181_@1
Culled Empty Block (label) main::@2
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@7
Culled Empty Block (label) main::@8

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

(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
memset: scope:[memset]  from main::@10 main::@9
  (byte) memset::c#5 ← phi( main::@10/(byte) memset::c#1 main::@9/(byte) memset::c#0 )
  (void*) memset::str#4 ← phi( main::@10/(void*) memset::str#1 main::@9/(void*) memset::str#0 )
  (word) memset::num#2 ← phi( main::@10/(word) memset::num#1 main::@9/(word) memset::num#0 )
  (bool~) memset::$0 ← (word) memset::num#2 > (number) 0
  (bool~) memset::$1 ← ! (bool~) memset::$0
  if((bool~) memset::$1) goto memset::@1
  to:memset::@2
memset::@1: scope:[memset]  from memset memset::@4
  (void*) memset::str#2 ← phi( memset/(void*) memset::str#4 memset::@4/(void*) memset::str#5 )
  (void*) memset::return#0 ← (void*) memset::str#2
  to:memset::@return
memset::@2: scope:[memset]  from memset
  (byte) memset::c#4 ← phi( memset/(byte) memset::c#5 )
  (word) memset::num#3 ← phi( memset/(word) memset::num#2 )
  (void*) memset::str#3 ← phi( memset/(void*) memset::str#4 )
  (byte*~) memset::$2 ← ((byte*)) (void*) memset::str#3
  (byte*~) memset::$3 ← (byte*~) memset::$2 + (word) memset::num#3
  (byte*) memset::end#0 ← (byte*~) memset::$3
  (byte*) memset::dst#0 ← ((byte*)) (void*) memset::str#3
  to:memset::@4
memset::@4: scope:[memset]  from memset::@2 memset::@5
  (byte) memset::c#3 ← phi( memset::@2/(byte) memset::c#4 memset::@5/(byte) memset::c#2 )
  (void*) memset::str#5 ← phi( memset::@2/(void*) memset::str#3 memset::@5/(void*) memset::str#6 )
  (byte*) memset::end#1 ← phi( memset::@2/(byte*) memset::end#0 memset::@5/(byte*) memset::end#2 )
  (byte*) memset::dst#2 ← phi( memset::@2/(byte*) memset::dst#0 memset::@5/(byte*) memset::dst#1 )
  (bool~) memset::$4 ← (byte*) memset::dst#2 != (byte*) memset::end#1
  if((bool~) memset::$4) goto memset::@5
  to:memset::@1
memset::@5: scope:[memset]  from memset::@4
  (void*) memset::str#6 ← phi( memset::@4/(void*) memset::str#5 )
  (byte*) memset::end#2 ← phi( memset::@4/(byte*) memset::end#1 )
  (byte*) memset::dst#3 ← phi( memset::@4/(byte*) memset::dst#2 )
  (byte) memset::c#2 ← phi( memset::@4/(byte) memset::c#3 )
  *((byte*) memset::dst#3) ← (byte) memset::c#2
  (byte*) memset::dst#1 ← ++ (byte*) memset::dst#3
  to:memset::@4
memset::@return: scope:[memset]  from memset::@1
  (void*) memset::return#4 ← phi( memset::@1/(void*) memset::return#0 )
  (void*) memset::return#1 ← (void*) memset::return#4
  return 
  to:@return
@9: scope:[]  from @begin
  kickasm(location (const byte*) LOGO) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
    .for (var y=0; y<6	; y++)
        .for (var x=0;x<40; x++)
            .for(var cp=0; cp<8; cp++)
                .byte logoPic.getMulticolorByte(x,cp+y*8)
 }}
  to:@10

(void()) main()
main: scope:[main]  from @10
  *((const byte*) BORDERCOL) ← (const byte) WHITE
  *((const byte*) BGCOL2) ← (const byte) DARK_GREY
  *((const byte*) BGCOL) ← *((const byte*) BGCOL2)
  *((const byte*) BGCOL3) ← (const byte) BLACK
  (byte*) main::toD0181_screen#0 ← (const byte*) SCREEN
  (byte*) main::toD0181_gfx#0 ← (const byte*) LOGO
  to:main::toD0181
main::toD0181: scope:[main]  from main
  (byte*) main::toD0181_gfx#1 ← phi( main/(byte*) main::toD0181_gfx#0 )
  (byte*) main::toD0181_screen#1 ← phi( main/(byte*) main::toD0181_screen#0 )
  (word~) main::toD0181_$0 ← ((word)) (byte*) main::toD0181_screen#1
  (number~) main::toD0181_$1 ← (word~) main::toD0181_$0 & (number) $3fff
  (number~) main::toD0181_$2 ← (number~) main::toD0181_$1 * (number) 4
  (number~) main::toD0181_$3 ← > (number~) main::toD0181_$2
  (word~) main::toD0181_$4 ← ((word)) (byte*) main::toD0181_gfx#1
  (byte~) main::toD0181_$5 ← > (word~) main::toD0181_$4
  (number~) main::toD0181_$6 ← (byte~) main::toD0181_$5 / (number) 4
  (number~) main::toD0181_$7 ← (number~) main::toD0181_$6 & (number) $f
  (number~) main::toD0181_$8 ← (number~) main::toD0181_$3 | (number~) main::toD0181_$7
  (byte) main::toD0181_return#0 ← (number~) main::toD0181_$8
  to:main::toD0181_@return
main::toD0181_@return: scope:[main]  from main::toD0181
  (byte) main::toD0181_return#2 ← phi( main::toD0181/(byte) main::toD0181_return#0 )
  (byte) main::toD0181_return#1 ← (byte) main::toD0181_return#2
  to:main::@9
main::@9: scope:[main]  from main::toD0181_@return
  (byte) main::toD0181_return#3 ← phi( main::toD0181_@return/(byte) main::toD0181_return#1 )
  (byte~) main::$0 ← (byte) main::toD0181_return#3
  *((const byte*) D018) ← (byte~) main::$0
  *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL
  (void*) memset::str#0 ← (void*)(const byte*) SCREEN
  (byte) memset::c#0 ← (const byte) BLACK
  (word) memset::num#0 ← (number) $28*(number) $19
  call memset 
  (void*) memset::return#2 ← (void*) memset::return#1
  to:main::@10
main::@10: scope:[main]  from main::@9
  (void*) memset::str#1 ← (void*)(const byte*) COLS
  (byte) memset::c#1 ← (const byte) WHITE|(number) 8
  (word) memset::num#1 ← (number) $28*(number) $19
  call memset 
  (void*) memset::return#3 ← (void*) memset::return#1
  to:main::@11
main::@11: scope:[main]  from main::@10
  (byte) main::ch#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@11
  (byte) main::ch#2 ← phi( main::@1/(byte) main::ch#1 main::@11/(byte) main::ch#0 )
  *((const byte*) SCREEN + (byte) main::ch#2) ← (byte) main::ch#2
  (byte) main::ch#1 ← (byte) main::ch#2 + rangenext(0,$ef)
  (bool~) main::$3 ← (byte) main::ch#1 != rangelast(0,$ef)
  if((bool~) main::$3) goto main::@1
  to:main::@3
main::@3: scope:[main]  from main::@1 main::@4
  if(true) goto main::@4
  to:main::@return
main::@4: scope:[main]  from main::@3
  (byte*~) main::$7 ← (const byte*) SCREEN + (number) $3e7
  *((byte*~) main::$7) ← ++ *((byte*~) main::$7)
  kickasm() {{ inc $d020  }}
  to:main::@3
main::@return: scope:[main]  from main::@3
  return 
  to:@return
@10: scope:[]  from @9
  call main 
  to:@11
@11: scope:[]  from @10
  to:@end
@end: scope:[]  from @11

SYMBOL TABLE SSA
(label) @10
(label) @11
(label) @9
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*)(number) $d021
(const byte*) BGCOL2 = (byte*)(number) $d022
(const byte*) BGCOL3 = (byte*)(number) $d023
(const byte) BLACK = (byte) 0
(const byte*) BORDERCOL = (byte*)(number) $d020
(const byte*) COLS = (byte*)(number) $d800
(const byte*) D016 = (byte*)(number) $d016
(const byte*) D018 = (byte*)(number) $d018
(const byte) DARK_GREY = (byte) $b
(const byte*) LOGO = (byte*)(number) $2000
(const byte*) SCREEN = (byte*)(number) $400
(const byte) VIC_CSEL = (byte) 8
(const byte) VIC_MCM = (byte) $10
(const byte) WHITE = (byte) 1
(void()) main()
(byte~) main::$0
(bool~) main::$3
(byte*~) main::$7
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@3
(label) main::@4
(label) main::@9
(label) main::@return
(byte) main::ch
(byte) main::ch#0
(byte) main::ch#1
(byte) main::ch#2
(label) main::toD0181
(word~) main::toD0181_$0
(number~) main::toD0181_$1
(number~) main::toD0181_$2
(number~) main::toD0181_$3
(word~) main::toD0181_$4
(byte~) main::toD0181_$5
(number~) main::toD0181_$6
(number~) main::toD0181_$7
(number~) main::toD0181_$8
(label) main::toD0181_@return
(byte*) main::toD0181_gfx
(byte*) main::toD0181_gfx#0
(byte*) main::toD0181_gfx#1
(byte) main::toD0181_return
(byte) main::toD0181_return#0
(byte) main::toD0181_return#1
(byte) main::toD0181_return#2
(byte) main::toD0181_return#3
(byte*) main::toD0181_screen
(byte*) main::toD0181_screen#0
(byte*) main::toD0181_screen#1
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(bool~) memset::$0
(bool~) memset::$1
(byte*~) memset::$2
(byte*~) memset::$3
(bool~) memset::$4
(label) memset::@1
(label) memset::@2
(label) memset::@4
(label) memset::@5
(label) memset::@return
(byte) memset::c
(byte) memset::c#0
(byte) memset::c#1
(byte) memset::c#2
(byte) memset::c#3
(byte) memset::c#4
(byte) memset::c#5
(byte*) memset::dst
(byte*) memset::dst#0
(byte*) memset::dst#1
(byte*) memset::dst#2
(byte*) memset::dst#3
(byte*) memset::end
(byte*) memset::end#0
(byte*) memset::end#1
(byte*) memset::end#2
(word) memset::num
(word) memset::num#0
(word) memset::num#1
(word) memset::num#2
(word) memset::num#3
(void*) memset::return
(void*) memset::return#0
(void*) memset::return#1
(void*) memset::return#2
(void*) memset::return#3
(void*) memset::return#4
(void*) memset::str
(void*) memset::str#0
(void*) memset::str#1
(void*) memset::str#2
(void*) memset::str#3
(void*) memset::str#4
(void*) memset::str#5
(void*) memset::str#6

Adding number conversion cast (unumber) 0 in (bool~) memset::$0 ← (word) memset::num#2 > (number) 0
Adding number conversion cast (unumber) $3fff in (number~) main::toD0181_$1 ← (word~) main::toD0181_$0 & (number) $3fff
Adding number conversion cast (unumber) main::toD0181_$1 in (number~) main::toD0181_$1 ← (word~) main::toD0181_$0 & (unumber)(number) $3fff
Adding number conversion cast (unumber) 4 in (number~) main::toD0181_$2 ← (unumber~) main::toD0181_$1 * (number) 4
Adding number conversion cast (unumber) main::toD0181_$2 in (number~) main::toD0181_$2 ← (unumber~) main::toD0181_$1 * (unumber)(number) 4
Adding number conversion cast (unumber) main::toD0181_$3 in (number~) main::toD0181_$3 ← > (unumber~) main::toD0181_$2
Adding number conversion cast (unumber) 4 in (number~) main::toD0181_$6 ← (byte~) main::toD0181_$5 / (number) 4
Adding number conversion cast (unumber) main::toD0181_$6 in (number~) main::toD0181_$6 ← (byte~) main::toD0181_$5 / (unumber)(number) 4
Adding number conversion cast (unumber) $f in (number~) main::toD0181_$7 ← (unumber~) main::toD0181_$6 & (number) $f
Adding number conversion cast (unumber) main::toD0181_$7 in (number~) main::toD0181_$7 ← (unumber~) main::toD0181_$6 & (unumber)(number) $f
Adding number conversion cast (unumber) main::toD0181_$8 in (number~) main::toD0181_$8 ← (unumber~) main::toD0181_$3 | (unumber~) main::toD0181_$7
Adding number conversion cast (unumber) $28*$19 in (word) memset::num#0 ← (number) $28*(number) $19
Adding number conversion cast (unumber) WHITE|8 in (byte) memset::c#1 ← (const byte) WHITE|(number) 8
Adding number conversion cast (unumber) 8 in (byte) memset::c#1 ← ((unumber)) (const byte) WHITE|(number) 8
Adding number conversion cast (unumber) $28*$19 in (word) memset::num#1 ← (number) $28*(number) $19
Adding number conversion cast (unumber) $3e7 in (byte*~) main::$7 ← (const byte*) SCREEN + (number) $3e7
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*~) memset::$2 ← (byte*)(void*) memset::str#3
Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3
Inlining cast (word~) main::toD0181_$0 ← (word)(byte*) main::toD0181_screen#1
Inlining cast (word~) main::toD0181_$4 ← (word)(byte*) main::toD0181_gfx#1
Inlining cast (word) memset::num#0 ← (unumber)(number) $28*(number) $19
Inlining cast (byte) memset::c#1 ← (unumber)(const byte) WHITE|(unumber)(number) 8
Inlining cast (word) memset::num#1 ← (unumber)(number) $28*(number) $19
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53280
Simplifying constant pointer cast (byte*) 53281
Simplifying constant pointer cast (byte*) 53282
Simplifying constant pointer cast (byte*) 53283
Simplifying constant pointer cast (byte*) 53270
Simplifying constant pointer cast (byte*) 53272
Simplifying constant pointer cast (byte*) 55296
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 8192
Simplifying constant integer cast 0
Simplifying constant integer cast $3fff
Simplifying constant integer cast 4
Simplifying constant integer cast 4
Simplifying constant integer cast $f
Simplifying constant integer cast (const byte) WHITE|(unumber)(number) 8
Simplifying constant integer cast 8
Simplifying constant integer cast $3e7
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (word) $3fff
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) 4
Finalized unsigned number type (byte) $f
Finalized unsigned number type (byte) 8
Finalized unsigned number type (word) $3e7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to word in (unumber~) main::toD0181_$1 ← (word~) main::toD0181_$0 & (word) $3fff
Inferred type updated to word in (unumber~) main::toD0181_$2 ← (word~) main::toD0181_$1 * (byte) 4
Inferred type updated to byte in (unumber~) main::toD0181_$3 ← > (word~) main::toD0181_$2
Inferred type updated to byte in (unumber~) main::toD0181_$6 ← (byte~) main::toD0181_$5 / (byte) 4
Inferred type updated to byte in (unumber~) main::toD0181_$7 ← (byte~) main::toD0181_$6 & (byte) $f
Inferred type updated to byte in (unumber~) main::toD0181_$8 ← (byte~) main::toD0181_$3 | (byte~) main::toD0181_$7
Inversing boolean not [2] (bool~) memset::$1 ← (word) memset::num#2 <= (byte) 0 from [1] (bool~) memset::$0 ← (word) memset::num#2 > (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (void*) memset::return#0 = (void*) memset::str#2 (void*) memset::return#4 (void*) memset::return#1 
Alias (void*) memset::str#3 = (void*) memset::str#4 
Alias (word) memset::num#2 = (word) memset::num#3 
Alias (byte) memset::c#4 = (byte) memset::c#5 
Alias (byte*) memset::end#0 = (byte*~) memset::$3 
Alias (byte) memset::c#2 = (byte) memset::c#3 
Alias (byte*) memset::dst#2 = (byte*) memset::dst#3 
Alias (byte*) memset::end#1 = (byte*) memset::end#2 
Alias (void*) memset::str#5 = (void*) memset::str#6 
Alias (byte*) main::toD0181_screen#0 = (byte*) main::toD0181_screen#1 
Alias (byte*) main::toD0181_gfx#0 = (byte*) main::toD0181_gfx#1 
Alias (byte) main::toD0181_return#0 = (byte~) main::toD0181_$8 (byte) main::toD0181_return#2 (byte) main::toD0181_return#1 (byte) main::toD0181_return#3 (byte~) main::$0 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) memset::end#1 (byte*) memset::end#0
Identical Phi Values (void*) memset::str#5 (void*) memset::str#3
Identical Phi Values (byte) memset::c#2 (byte) memset::c#4
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (void*) memset::return#0 (void*) memset::str#3
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) memset::$1 [3] if((word) memset::num#2<=(byte) 0) goto memset::@1
Simple Condition (bool~) memset::$4 [13] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@5
Simple Condition (bool~) main::$3 [59] if((byte) main::ch#1!=rangelast(0,$ef)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [44] (void*) memset::str#0 ← (void*)(const byte*) SCREEN
Constant right-side identified [46] (word) memset::num#0 ← (unumber)(number) $28*(number) $19
Constant right-side identified [51] (word) memset::num#1 ← (unumber)(number) $28*(number) $19
Constant right-side identified [61] (byte*~) main::$7 ← (const byte*) SCREEN + (word) $3e7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::toD0181_screen#0 = SCREEN
Constant (const byte*) main::toD0181_gfx#0 = LOGO
Constant (const void*) memset::str#0 = (void*)SCREEN
Constant (const byte) memset::c#0 = BLACK
Constant (const word) memset::num#0 = (unumber)$28*$19
Constant (const void*) memset::str#1 = (void*)COLS
Constant (const byte) memset::c#1 = WHITE|8
Constant (const word) memset::num#1 = (unumber)$28*$19
Constant (const byte) main::ch#0 = 0
Constant (const byte*) main::$7 = SCREEN+$3e7
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::toD0181_$0 = (word)main::toD0181_screen#0
Constant (const word) main::toD0181_$4 = (word)main::toD0181_gfx#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [60] if(true) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Resolved ranged next value [57] main::ch#1 ← ++ main::ch#2 to ++
Resolved ranged comparison value [59] if(main::ch#1!=rangelast(0,$ef)) goto main::@1 to (number) $f0
Eliminating unused variable (void*) memset::return#2 and assignment [25] (void*) memset::return#2 ← (void*) memset::str#3
Eliminating unused variable (void*) memset::return#3 and assignment [27] (void*) memset::return#3 ← (void*) memset::str#3
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Adding number conversion cast (unumber) $f0 in if((byte) main::ch#1!=(number) $f0) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $f0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $f0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant right-side identified [15] (word~) main::toD0181_$1 ← (const word) main::toD0181_$0 & (word) $3fff
Constant right-side identified [18] (byte~) main::toD0181_$5 ← > (const word) main::toD0181_$4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word) main::toD0181_$1 = main::toD0181_$0&$3fff
Constant (const byte) main::toD0181_$5 = >main::toD0181_$4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [15] (word~) main::toD0181_$2 ← (const word) main::toD0181_$1 * (byte) 4
Constant right-side identified [17] (byte~) main::toD0181_$6 ← (const byte) main::toD0181_$5 / (byte) 4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const word) main::toD0181_$2 = main::toD0181_$1*4
Constant (const byte) main::toD0181_$6 = main::toD0181_$5/4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [15] (byte~) main::toD0181_$3 ← > (const word) main::toD0181_$2
Constant right-side identified [16] (byte~) main::toD0181_$7 ← (const byte) main::toD0181_$6 & (byte) $f
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::toD0181_$3 = >main::toD0181_$2
Constant (const byte) main::toD0181_$7 = main::toD0181_$6&$f
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [15] (byte) main::toD0181_return#0 ← (const byte) main::toD0181_$3 | (const byte) main::toD0181_$7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::toD0181_return#0 = main::toD0181_$3|main::toD0181_$7
Successful SSA optimization Pass2ConstantIdentification
Inlining Noop Cast [2] (byte*~) memset::$2 ← (byte*)(void*) memset::str#3 keeping memset::str#3
Inlining Noop Cast [4] (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3 keeping memset::str#3
Successful SSA optimization Pass2NopCastInlining
Inlining constant with var siblings (const void*) memset::str#0
Inlining constant with var siblings (const byte) memset::c#0
Inlining constant with var siblings (const word) memset::num#0
Inlining constant with var siblings (const void*) memset::str#1
Inlining constant with var siblings (const byte) memset::c#1
Inlining constant with var siblings (const word) memset::num#1
Inlining constant with var siblings (const byte) main::ch#0
Constant inlined main::toD0181_screen#0 = (const byte*) SCREEN
Constant inlined main::toD0181_gfx#0 = (const byte*) LOGO
Constant inlined memset::str#1 = (void*)(const byte*) COLS
Constant inlined memset::str#0 = (void*)(const byte*) SCREEN
Constant inlined main::toD0181_$7 = >(word)(const byte*) LOGO/(byte) 4&(byte) $f
Constant inlined main::toD0181_$2 = (word)(const byte*) SCREEN&(word) $3fff*(byte) 4
Constant inlined main::toD0181_$1 = (word)(const byte*) SCREEN&(word) $3fff
Constant inlined main::toD0181_$0 = (word)(const byte*) SCREEN
Constant inlined memset::num#1 = (word)(number) $28*(number) $19
Constant inlined memset::num#0 = (word)(number) $28*(number) $19
Constant inlined main::toD0181_$6 = >(word)(const byte*) LOGO/(byte) 4
Constant inlined main::toD0181_$5 = >(word)(const byte*) LOGO
Constant inlined main::toD0181_$4 = (word)(const byte*) LOGO
Constant inlined main::toD0181_$3 = >(word)(const byte*) SCREEN&(word) $3fff*(byte) 4
Constant inlined memset::c#0 = (const byte) BLACK
Constant inlined memset::c#1 = (const byte) WHITE|(byte) 8
Constant inlined main::$7 = (const byte*) SCREEN+(word) $3e7
Constant inlined main::ch#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@12(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @10
Adding NOP phi() at start of @11
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::toD0181
Adding NOP phi() at start of main::toD0181_@return
Adding NOP phi() at start of main::@10
Adding NOP phi() at start of main::@11
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of memset::@1
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to memset:14 memset:16 

Created 5 initial phi equivalence classes
Coalesced [25] main::ch#3 ← main::ch#1
Coalesced [36] memset::dst#5 ← memset::dst#1
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) @11
Culled Empty Block (label) main::toD0181_@return
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@12
Culled Empty Block (label) memset::@1
Renumbering block @9 to @1
Renumbering block @10 to @2
Renumbering block memset::@2 to memset::@1
Renumbering block memset::@4 to memset::@2
Renumbering block memset::@5 to memset::@3
Renumbering block main::@4 to main::@2
Renumbering block main::@9 to main::@3
Renumbering block main::@10 to main::@4
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::toD0181
Adding NOP phi() at start of main::@4

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  kickasm(location (const byte*) LOGO) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
    .for (var y=0; y<6	; y++)
        .for (var x=0;x<40; x++)
            .for(var cp=0; cp<8; cp++)
                .byte logoPic.getMulticolorByte(x,cp+y*8)
 }}
  to:@2
@2: scope:[]  from @1
  [2] phi()
  [3] call main 
  to:@end
@end: scope:[]  from @2
  [4] phi()

(void()) main()
main: scope:[main]  from @2
  [5] *((const byte*) BORDERCOL) ← (const byte) WHITE
  [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY
  [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2)
  [8] *((const byte*) BGCOL3) ← (const byte) BLACK
  to:main::toD0181
main::toD0181: scope:[main]  from main
  [9] phi()
  to:main::@3
main::@3: scope:[main]  from main::toD0181
  [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0
  [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL
  [12] call memset 
  to:main::@4
main::@4: scope:[main]  from main::@3
  [13] phi()
  [14] call memset 
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@4
  [15] (byte) main::ch#2 ← phi( main::@1/(byte) main::ch#1 main::@4/(byte) 0 )
  [16] *((const byte*) SCREEN + (byte) main::ch#2) ← (byte) main::ch#2
  [17] (byte) main::ch#1 ← ++ (byte) main::ch#2
  [18] if((byte) main::ch#1!=(byte) $f0) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [19] *((const byte*) SCREEN+(word) $3e7) ← ++ *((const byte*) SCREEN+(word) $3e7)
  kickasm() {{ inc $d020  }}
  to:main::@2

(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
memset: scope:[memset]  from main::@3 main::@4
  [21] (byte) memset::c#4 ← phi( main::@4/(const byte) WHITE|(byte) 8 main::@3/(const byte) BLACK )
  [21] (void*) memset::str#3 ← phi( main::@4/(void*)(const byte*) COLS main::@3/(void*)(const byte*) SCREEN )
  [21] (word) memset::num#2 ← phi( main::@4/(word)(number) $28*(number) $19 main::@3/(word)(number) $28*(number) $19 )
  [22] if((word) memset::num#2<=(byte) 0) goto memset::@return
  to:memset::@1
memset::@1: scope:[memset]  from memset
  [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2
  [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3
  to:memset::@2
memset::@2: scope:[memset]  from memset::@1 memset::@3
  [25] (byte*) memset::dst#2 ← phi( memset::@1/(byte*) memset::dst#4 memset::@3/(byte*) memset::dst#1 )
  [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3
  to:memset::@return
memset::@return: scope:[memset]  from memset memset::@2
  [27] return 
  to:@return
memset::@3: scope:[memset]  from memset::@2
  [28] *((byte*) memset::dst#2) ← (byte) memset::c#4
  [29] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
  to:memset::@2


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::ch
(byte) main::ch#1 16.5
(byte) main::ch#2 22.0
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(byte*) main::toD0181_screen
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(byte) memset::c
(byte) memset::c#4 1.375
(byte*) memset::dst
(byte*) memset::dst#1 22.0
(byte*) memset::dst#2 15.333333333333332
(byte*) memset::dst#4 4.0
(byte*) memset::end
(byte*) memset::end#0 2.1666666666666665
(word) memset::num
(word) memset::num#2 2.0
(void*) memset::return
(void*) memset::str
(void*) memset::str#3

Initial phi equivalence classes
[ main::ch#2 main::ch#1 ]
[ memset::num#2 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
Added variable memset::end#0 to live range equivalence class [ memset::end#0 ]
Complete equivalence classes
[ main::ch#2 main::ch#1 ]
[ memset::num#2 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
[ memset::end#0 ]
Allocated zp[1]:2 [ main::ch#2 main::ch#1 ]
Allocated zp[2]:3 [ memset::num#2 ]
Allocated zp[2]:5 [ memset::str#3 ]
Allocated zp[1]:7 [ memset::c#4 ]
Allocated zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ]
Allocated zp[2]:10 [ memset::end#0 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  .label BGCOL2 = $d022
  .label BGCOL3 = $d023
  .label D016 = $d016
  .const VIC_MCM = $10
  .const VIC_CSEL = 8
  .label D018 = $d018
  // Color Ram
  .label COLS = $d800
  // The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const DARK_GREY = $b
  .label SCREEN = $400
  .label LOGO = $2000
  // @begin
__bbegin:
  jmp __b1
  // @1
__b1:
  // kickasm(location (const byte*) LOGO) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))     .for (var y=0; y<6	; y++)         .for (var x=0;x<40; x++)             .for(var cp=0; cp<8; cp++)                 .byte logoPic.getMulticolorByte(x,cp+y*8)  }}
  // [2] phi from @1 to @2 [phi:@1->@2]
__b2_from___b1:
  jmp __b2
  // @2
__b2:
  // [3] call main 
  jsr main
  // [4] phi from @2 to @end [phi:@2->@end]
__bend_from___b2:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)*4)|(>LOGO)/4&$f
    .label ch = 2
    // [5] *((const byte*) BORDERCOL) ← (const byte) WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
    // [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
    // [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2) -- _deref_pbuc1=_deref_pbuc2 
    lda BGCOL2
    sta BGCOL
    // [8] *((const byte*) BGCOL3) ← (const byte) BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
    // [9] phi from main to main::toD0181 [phi:main->main::toD0181]
  toD0181_from_main:
    jmp toD0181
    // main::toD0181
  toD0181:
    jmp __b3
    // main::@3
  __b3:
    // [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
    // [12] call memset 
    // [21] phi from main::@3 to memset [phi:main::@3->memset]
  memset_from___b3:
    // [21] phi (byte) memset::c#4 = (const byte) BLACK [phi:main::@3->memset#0] -- vbuz1=vbuc1 
    lda #BLACK
    sta.z memset.c
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN [phi:main::@3->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@3->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [14] call memset 
    // [21] phi from main::@4 to memset [phi:main::@4->memset]
  memset_from___b4:
    // [21] phi (byte) memset::c#4 = (const byte) WHITE|(byte) 8 [phi:main::@4->memset#0] -- vbuz1=vbuc1 
    lda #WHITE|8
    sta.z memset.c
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) COLS [phi:main::@4->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@4->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [15] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [15] phi (byte) main::ch#2 = (byte) 0 [phi:main::@4->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z ch
    jmp __b1
    // [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [16] *((const byte*) SCREEN + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuz1=vbuz1 
    ldy.z ch
    tya
    sta SCREEN,y
    // [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuz1=_inc_vbuz1 
    inc.z ch
    // [18] if((byte) main::ch#1!=(byte) $f0) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #$f0
    cmp.z ch
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [19] *((const byte*) SCREEN+(word) $3e7) ← ++ *((const byte*) SCREEN+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
    // kickasm() {{ inc $d020  }}
    inc $d020 
    jmp __b2
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp(5) str, byte zp(7) c, word zp(3) num)
memset: {
    .label end = $a
    .label dst = 8
    .label num = 3
    .label str = 5
    .label c = 7
    // [22] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq __breturn
  !:
    jmp __b1
    // memset::@1
  __b1:
    // [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz3 
    lda.z str
    clc
    adc.z num
    sta.z end
    lda.z str+1
    adc.z num+1
    sta.z end+1
    // [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 -- pbuz1=pbuz2 
    lda.z str
    sta.z dst
    lda.z str+1
    sta.z dst+1
    // [25] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [25] phi (byte*) memset::dst#2 = (byte*) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp __b2
    // memset::@2
  __b2:
    // [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne __b3
    lda.z dst
    cmp.z end
    bne __b3
    jmp __breturn
    // memset::@return
  __breturn:
    // [27] return 
    rts
    // memset::@3
  __b3:
    // [28] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuz2 
    lda.z c
    ldy #0
    sta (dst),y
    // [29] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2_from___b3
}
  // File Data
.pc = LOGO "LOGO"
  .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
    .for (var y=0; y<6	; y++)
        .for (var x=0;x<40; x++)
            .for(var cp=0; cp<8; cp++)
                .byte logoPic.getMulticolorByte(x,cp+y*8)


REGISTER UPLIFT POTENTIAL REGISTERS
Statement [5] *((const byte*) BORDERCOL) ← (const byte) WHITE [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2) [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) BGCOL3) ← (const byte) BLACK [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [22] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::memset:12 [ memset::num#2 memset::str#3 memset::c#4 ] main:3::memset:14 [ memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ memset::c#4 ]
Statement [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::memset:12 [ memset::str#3 memset::c#4 memset::end#0 ] main:3::memset:14 [ memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a 
Statement [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#4 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a 
Statement [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#2 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a 
Statement [28] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#2 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:7 [ memset::c#4 ]
Statement [5] *((const byte*) BORDERCOL) ← (const byte) WHITE [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2) [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) BGCOL3) ← (const byte) BLACK [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [22] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::memset:12 [ memset::num#2 memset::str#3 memset::c#4 ] main:3::memset:14 [ memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a 
Statement [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::memset:12 [ memset::str#3 memset::c#4 memset::end#0 ] main:3::memset:14 [ memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a 
Statement [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#4 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a 
Statement [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#2 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a 
Statement [28] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::memset:12 [ memset::c#4 memset::end#0 memset::dst#2 ] main:3::memset:14 [ memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:2 [ main::ch#2 main::ch#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:3 [ memset::num#2 ] : zp[2]:3 , 
Potential registers zp[2]:5 [ memset::str#3 ] : zp[2]:5 , 
Potential registers zp[1]:7 [ memset::c#4 ] : zp[1]:7 , reg byte x , 
Potential registers zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] : zp[2]:8 , 
Potential registers zp[2]:10 [ memset::end#0 ] : zp[2]:10 , 

REGISTER UPLIFT SCOPES
Uplift Scope [memset] 41.33: zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] 2.17: zp[2]:10 [ memset::end#0 ] 2: zp[2]:3 [ memset::num#2 ] 1.38: zp[1]:7 [ memset::c#4 ] 0: zp[2]:5 [ memset::str#3 ] 
Uplift Scope [main] 38.5: zp[1]:2 [ main::ch#2 main::ch#1 ] 
Uplift Scope [] 

Uplifting [memset] best 6284 combination zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:10 [ memset::end#0 ] zp[2]:3 [ memset::num#2 ] reg byte x [ memset::c#4 ] zp[2]:5 [ memset::str#3 ] 
Uplifting [main] best 6164 combination reg byte x [ main::ch#2 main::ch#1 ] 
Uplifting [] best 6164 combination 
Coalescing zero page register [ zp[2]:3 [ memset::num#2 ] ] with [ zp[2]:10 [ memset::end#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:5 [ memset::str#3 ] ] with [ zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1
Allocated (was zp[2]:3) zp[2]:2 [ memset::num#2 memset::end#0 ]
Allocated (was zp[2]:5) zp[2]:4 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  .label BGCOL2 = $d022
  .label BGCOL3 = $d023
  .label D016 = $d016
  .const VIC_MCM = $10
  .const VIC_CSEL = 8
  .label D018 = $d018
  // Color Ram
  .label COLS = $d800
  // The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const DARK_GREY = $b
  .label SCREEN = $400
  .label LOGO = $2000
  // @begin
__bbegin:
  jmp __b1
  // @1
__b1:
  // kickasm(location (const byte*) LOGO) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))     .for (var y=0; y<6	; y++)         .for (var x=0;x<40; x++)             .for(var cp=0; cp<8; cp++)                 .byte logoPic.getMulticolorByte(x,cp+y*8)  }}
  // [2] phi from @1 to @2 [phi:@1->@2]
__b2_from___b1:
  jmp __b2
  // @2
__b2:
  // [3] call main 
  jsr main
  // [4] phi from @2 to @end [phi:@2->@end]
__bend_from___b2:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)*4)|(>LOGO)/4&$f
    // [5] *((const byte*) BORDERCOL) ← (const byte) WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
    // [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
    // [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2) -- _deref_pbuc1=_deref_pbuc2 
    lda BGCOL2
    sta BGCOL
    // [8] *((const byte*) BGCOL3) ← (const byte) BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
    // [9] phi from main to main::toD0181 [phi:main->main::toD0181]
  toD0181_from_main:
    jmp toD0181
    // main::toD0181
  toD0181:
    jmp __b3
    // main::@3
  __b3:
    // [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
    // [12] call memset 
    // [21] phi from main::@3 to memset [phi:main::@3->memset]
  memset_from___b3:
    // [21] phi (byte) memset::c#4 = (const byte) BLACK [phi:main::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN [phi:main::@3->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@3->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [14] call memset 
    // [21] phi from main::@4 to memset [phi:main::@4->memset]
  memset_from___b4:
    // [21] phi (byte) memset::c#4 = (const byte) WHITE|(byte) 8 [phi:main::@4->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) COLS [phi:main::@4->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@4->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [15] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [15] phi (byte) main::ch#2 = (byte) 0 [phi:main::@4->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [16] *((const byte*) SCREEN + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
    // [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
    // [18] if((byte) main::ch#1!=(byte) $f0) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [19] *((const byte*) SCREEN+(word) $3e7) ← ++ *((const byte*) SCREEN+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
    // kickasm() {{ inc $d020  }}
    inc $d020 
    jmp __b2
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp(4) str, byte register(X) c, word zp(2) num)
memset: {
    .label end = 2
    .label dst = 4
    .label num = 2
    .label str = 4
    // [22] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq __breturn
  !:
    jmp __b1
    // memset::@1
  __b1:
    // [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda.z end
    clc
    adc.z str
    sta.z end
    lda.z end+1
    adc.z str+1
    sta.z end+1
    // [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3
    // [25] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [25] phi (byte*) memset::dst#2 = (byte*) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp __b2
    // memset::@2
  __b2:
    // [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne __b3
    lda.z dst
    cmp.z end
    bne __b3
    jmp __breturn
    // memset::@return
  __breturn:
    // [27] return 
    rts
    // memset::@3
  __b3:
    // [28] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // [29] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2_from___b3
}
  // File Data
.pc = LOGO "LOGO"
  .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
    .for (var y=0; y<6	; y++)
        .for (var x=0;x<40; x++)
            .for(var cp=0; cp<8; cp++)
                .byte logoPic.getMulticolorByte(x,cp+y*8)


ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __bend
Removing instruction jmp toD0181
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda BGCOL2
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b2
Replacing label __b1_from___b1 with __b1
Replacing label __b2_from___b3 with __b2
Removing instruction __bbegin:
Removing instruction __b1:
Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2:
Removing instruction toD0181_from_main:
Removing instruction toD0181:
Removing instruction __b4_from___b3:
Removing instruction memset_from___b4:
Removing instruction __b1_from___b1:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b3:
Removing instruction memset_from___b3:
Removing instruction __b4:
Removing instruction __b1_from___b4:
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b2:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte*) BGCOL = (byte*) 53281
(const byte*) BGCOL2 = (byte*) 53282
(const byte*) BGCOL3 = (byte*) 53283
(const byte) BLACK = (byte) 0
(const byte*) BORDERCOL = (byte*) 53280
(const byte*) COLS = (byte*) 55296
(const byte*) D016 = (byte*) 53270
(const byte*) D018 = (byte*) 53272
(const byte) DARK_GREY = (byte) $b
(const byte*) LOGO = (byte*) 8192
(const byte*) SCREEN = (byte*) 1024
(const byte) VIC_CSEL = (byte) 8
(const byte) VIC_MCM = (byte) $10
(const byte) WHITE = (byte) 1
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(byte) main::ch
(byte) main::ch#1 reg byte x 16.5
(byte) main::ch#2 reg byte x 22.0
(label) main::toD0181
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(const byte) main::toD0181_return#0 toD0181_return = >(word)(const byte*) SCREEN&(word) $3fff*(byte) 4|>(word)(const byte*) LOGO/(byte) 4&(byte) $f
(byte*) main::toD0181_screen
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@2
(label) memset::@3
(label) memset::@return
(byte) memset::c
(byte) memset::c#4 reg byte x 1.375
(byte*) memset::dst
(byte*) memset::dst#1 dst zp[2]:4 22.0
(byte*) memset::dst#2 dst zp[2]:4 15.333333333333332
(byte*) memset::dst#4 dst zp[2]:4 4.0
(byte*) memset::end
(byte*) memset::end#0 end zp[2]:2 2.1666666666666665
(word) memset::num
(word) memset::num#2 num zp[2]:2 2.0
(void*) memset::return
(void*) memset::str
(void*) memset::str#3 str zp[2]:4

reg byte x [ main::ch#2 main::ch#1 ]
zp[2]:2 [ memset::num#2 memset::end#0 ]
zp[2]:4 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ]
reg byte x [ memset::c#4 ]


FINAL ASSEMBLER
Score: 5917

  // File Comments
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label BORDERCOL = $d020
  .label BGCOL = $d021
  .label BGCOL2 = $d022
  .label BGCOL3 = $d023
  .label D016 = $d016
  .const VIC_MCM = $10
  .const VIC_CSEL = 8
  .label D018 = $d018
  // Color Ram
  .label COLS = $d800
  // The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const DARK_GREY = $b
  .label SCREEN = $400
  .label LOGO = $2000
  // @begin
  // @1
  // kickasm
  // kickasm(location (const byte*) LOGO) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))     .for (var y=0; y<6	; y++)         .for (var x=0;x<40; x++)             .for(var cp=0; cp<8; cp++)                 .byte logoPic.getMulticolorByte(x,cp+y*8)  }}
  // [2] phi from @1 to @2 [phi:@1->@2]
  // @2
  // [3] call main 
  // [4] phi from @2 to @end [phi:@2->@end]
  // @end
  // main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)*4)|(>LOGO)/4&$f
    // *BORDERCOL = WHITE
    // [5] *((const byte*) BORDERCOL) ← (const byte) WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
    // *BGCOL2 = DARK_GREY
    // [6] *((const byte*) BGCOL2) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
    // *BGCOL = *BGCOL2 = DARK_GREY
    // [7] *((const byte*) BGCOL) ← *((const byte*) BGCOL2) -- _deref_pbuc1=_deref_pbuc2 
    sta BGCOL
    // *BGCOL3 = BLACK
    // [8] *((const byte*) BGCOL3) ← (const byte) BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
    // [9] phi from main to main::toD0181 [phi:main->main::toD0181]
    // main::toD0181
    // main::@3
    // *D018 = toD018(SCREEN, LOGO)
    // [10] *((const byte*) D018) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // *D016 = VIC_MCM | VIC_CSEL
    // [11] *((const byte*) D016) ← (const byte) VIC_MCM|(const byte) VIC_CSEL -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
    // memset(SCREEN, BLACK, 40*25)
    // [12] call memset 
    // [21] phi from main::@3 to memset [phi:main::@3->memset]
    // [21] phi (byte) memset::c#4 = (const byte) BLACK [phi:main::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) SCREEN [phi:main::@3->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@3->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // main::@4
    // memset(COLS, WHITE|8, 40*25)
    // [14] call memset 
    // [21] phi from main::@4 to memset [phi:main::@4->memset]
    // [21] phi (byte) memset::c#4 = (const byte) WHITE|(byte) 8 [phi:main::@4->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
    // [21] phi (void*) memset::str#3 = (void*)(const byte*) COLS [phi:main::@4->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    // [21] phi (word) memset::num#2 = (word)(number) $28*(number) $19 [phi:main::@4->memset#2] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta.z memset.num
    lda #>$28*$19
    sta.z memset.num+1
    jsr memset
    // [15] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [15] phi (byte) main::ch#2 = (byte) 0 [phi:main::@4->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // SCREEN[ch] = ch
    // [16] *((const byte*) SCREEN + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
    // for(byte ch: 0..239)
    // [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
    // [18] if((byte) main::ch#1!=(byte) $f0) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne __b1
    // main::@2
  __b2:
    // (*(SCREEN+999))++;
    // [19] *((const byte*) SCREEN+(word) $3e7) ← ++ *((const byte*) SCREEN+(word) $3e7) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
    // kickasm
    // kickasm() {{ inc $d020  }}
    inc $d020 
    jmp __b2
}
  // memset
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp(4) str, byte register(X) c, word zp(2) num)
memset: {
    .label end = 2
    .label dst = 4
    .label num = 2
    .label str = 4
    // if(num>0)
    // [22] if((word) memset::num#2<=(byte) 0) goto memset::@return -- vwuz1_le_0_then_la1 
    lda.z num
    bne !+
    lda.z num+1
    beq __breturn
  !:
    // memset::@1
    // end = (char*)str + num
    // [23] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda.z end
    clc
    adc.z str
    sta.z end
    lda.z end+1
    adc.z str+1
    sta.z end+1
    // [24] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3
    // [25] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
    // [25] phi (byte*) memset::dst#2 = (byte*) memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    // memset::@2
  __b2:
    // for(char* dst = str; dst!=end; dst++)
    // [26] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 -- pbuz1_neq_pbuz2_then_la1 
    lda.z dst+1
    cmp.z end+1
    bne __b3
    lda.z dst
    cmp.z end
    bne __b3
    // memset::@return
  __breturn:
    // }
    // [27] return 
    rts
    // memset::@3
  __b3:
    // *dst = c
    // [28] *((byte*) memset::dst#2) ← (byte) memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [29] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2
}
  // File Data
.pc = LOGO "LOGO"
  .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff))
    .for (var y=0; y<6	; y++)
        .for (var x=0;x<40; x++)
            .for(var cp=0; cp<8; cp++)
                .byte logoPic.getMulticolorByte(x,cp+y*8)


