Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
Inlined call main::$0 = call toD018(SCREEN, LOGO)
Inlined call call __init
Eliminating unused variable with no statement memset::$2

CONTROL FLOW GRAPH SSA

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from main::@4 main::@5
  memset::c#5 = phi( main::@4/memset::c#0, main::@5/memset::c#1 )
  memset::str#4 = phi( main::@4/memset::str#0, main::@5/memset::str#1 )
  memset::num#2 = phi( main::@4/memset::num#0, main::@5/memset::num#1 )
  memset::$0 = memset::num#2 > 0
  memset::$1 = ! memset::$0
  if(memset::$1) goto memset::@1
  to:memset::@2
memset::@1: scope:[memset]  from memset memset::@3
  memset::str#2 = phi( memset/memset::str#4, memset::@3/memset::str#5 )
  memset::return#0 = memset::str#2
  to:memset::@return
memset::@2: scope:[memset]  from memset
  memset::c#4 = phi( memset/memset::c#5 )
  memset::num#3 = phi( memset/memset::num#2 )
  memset::str#3 = phi( memset/memset::str#4 )
  memset::$4 = (char *)memset::str#3
  memset::end#0 = memset::$4 + memset::num#3
  memset::dst#0 = ((char *)) memset::str#3
  to:memset::@3
memset::@3: scope:[memset]  from memset::@2 memset::@4
  memset::c#3 = phi( memset::@2/memset::c#4, memset::@4/memset::c#2 )
  memset::str#5 = phi( memset::@2/memset::str#3, memset::@4/memset::str#6 )
  memset::end#1 = phi( memset::@2/memset::end#0, memset::@4/memset::end#2 )
  memset::dst#2 = phi( memset::@2/memset::dst#0, memset::@4/memset::dst#1 )
  memset::$3 = memset::dst#2 != memset::end#1
  if(memset::$3) goto memset::@4
  to:memset::@1
memset::@4: scope:[memset]  from memset::@3
  memset::str#6 = phi( memset::@3/memset::str#5 )
  memset::end#2 = phi( memset::@3/memset::end#1 )
  memset::dst#3 = phi( memset::@3/memset::dst#2 )
  memset::c#2 = phi( memset::@3/memset::c#3 )
  *memset::dst#3 = memset::c#2
  memset::dst#1 = ++ memset::dst#3
  to:memset::@3
memset::@return: scope:[memset]  from memset::@1
  memset::return#4 = phi( memset::@1/memset::return#0 )
  memset::return#1 = memset::return#4
  return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1)
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK
  main::toD0181_screen#0 = SCREEN
  main::toD0181_gfx#0 = LOGO
  to:main::toD0181
main::toD0181: scope:[main]  from main
  main::toD0181_gfx#1 = phi( main/main::toD0181_gfx#0 )
  main::toD0181_screen#1 = phi( main/main::toD0181_screen#0 )
  main::toD0181_$7 = (unsigned int)main::toD0181_screen#1
  main::toD0181_$0 = main::toD0181_$7 & $3fff
  main::toD0181_$1 = main::toD0181_$0 * 4
  main::toD0181_$2 = byte1  main::toD0181_$1
  main::toD0181_$3 = byte1  (unsigned int)main::toD0181_gfx#1
  main::toD0181_$4 = main::toD0181_$3 / 4
  main::toD0181_$5 = main::toD0181_$4 & $f
  main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5
  main::toD0181_return#0 = main::toD0181_$6
  to:main::toD0181_@return
main::toD0181_@return: scope:[main]  from main::toD0181
  main::toD0181_return#2 = phi( main::toD0181/main::toD0181_return#0 )
  main::toD0181_return#1 = main::toD0181_return#2
  to:main::@4
main::@4: scope:[main]  from main::toD0181_@return
  main::toD0181_return#3 = phi( main::toD0181_@return/main::toD0181_return#1 )
  main::$0 = main::toD0181_return#3
  *D018 = main::$0
  *D016 = VICII_MCM|VICII_CSEL
  memset::str#0 = (void *)SCREEN
  memset::c#0 = BLACK
  memset::num#0 = $28*$19
  call memset
  memset::return#2 = memset::return#1
  to:main::@5
main::@5: scope:[main]  from main::@4
  memset::str#1 = (void *)COLS
  memset::c#1 = WHITE|8
  memset::num#1 = $28*$19
  call memset
  memset::return#3 = memset::return#1
  to:main::@6
main::@6: scope:[main]  from main::@5
  main::ch#0 = 0
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@6
  main::ch#2 = phi( main::@1/main::ch#1, main::@6/main::ch#0 )
  SCREEN[main::ch#2] = main::ch#2
  main::ch#1 = main::ch#2 + rangenext(0,$ef)
  main::$3 = main::ch#1 != rangelast(0,$ef)
  if(main::$3) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@3
  if(true) goto main::@3
  to:main::@return
main::@3: scope:[main]  from main::@2
  main::$7 = SCREEN + $3e7
  *main::$7 = ++ *main::$7
  kickasm() {{ inc $d020  }}
  to:main::@2
main::@return: scope:[main]  from main::@2
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant const char BLACK = 0
__constant char * const COLS = (char *)$d800
__constant char * const D016 = (char *)$d016
__constant char * const D018 = (char *)$d018
__constant const char DARK_GREY = $b
__constant char LOGO[6*$28*8] = kickasm {{ .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)
 }}
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1 = $22
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2 = $23
__constant char OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
__constant char *SCREEN = (char *)$400
__constant struct MOS6569_VICII * const VICII = (struct MOS6569_VICII *)$d000
__constant const char VICII_CSEL = 8
__constant const char VICII_MCM = $10
__constant const char WHITE = 1
void __start()
void main()
char main::$0
bool main::$3
char *main::$7
char main::ch
char main::ch#0
char main::ch#1
char main::ch#2
number main::toD0181_$0
number main::toD0181_$1
char main::toD0181_$2
char main::toD0181_$3
number main::toD0181_$4
number main::toD0181_$5
number main::toD0181_$6
unsigned int main::toD0181_$7
char *main::toD0181_gfx
char *main::toD0181_gfx#0
char *main::toD0181_gfx#1
char main::toD0181_return
char main::toD0181_return#0
char main::toD0181_return#1
char main::toD0181_return#2
char main::toD0181_return#3
char *main::toD0181_screen
char *main::toD0181_screen#0
char *main::toD0181_screen#1
void * memset(void *str , char c , unsigned int num)
bool memset::$0
bool memset::$1
bool memset::$3
char *memset::$4
char memset::c
char memset::c#0
char memset::c#1
char memset::c#2
char memset::c#3
char memset::c#4
char memset::c#5
char *memset::dst
char *memset::dst#0
char *memset::dst#1
char *memset::dst#2
char *memset::dst#3
char *memset::end
char *memset::end#0
char *memset::end#1
char *memset::end#2
unsigned int memset::num
unsigned int memset::num#0
unsigned int memset::num#1
unsigned int memset::num#2
unsigned int 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 memset::$0 = memset::num#2 > 0
Adding number conversion cast (unumber) $3fff in main::toD0181_$0 = main::toD0181_$7 & $3fff
Adding number conversion cast (unumber) main::toD0181_$0 in main::toD0181_$0 = main::toD0181_$7 & (unumber)$3fff
Adding number conversion cast (unumber) 4 in main::toD0181_$1 = main::toD0181_$0 * 4
Adding number conversion cast (unumber) main::toD0181_$1 in main::toD0181_$1 = main::toD0181_$0 * (unumber)4
Adding number conversion cast (unumber) 4 in main::toD0181_$4 = main::toD0181_$3 / 4
Adding number conversion cast (unumber) main::toD0181_$4 in main::toD0181_$4 = main::toD0181_$3 / (unumber)4
Adding number conversion cast (unumber) $f in main::toD0181_$5 = main::toD0181_$4 & $f
Adding number conversion cast (unumber) main::toD0181_$5 in main::toD0181_$5 = main::toD0181_$4 & (unumber)$f
Adding number conversion cast (unumber) main::toD0181_$6 in main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5
Adding number conversion cast (unumber) $28*$19 in memset::num#0 = $28*$19
Adding number conversion cast (unumber) WHITE|8 in memset::c#1 = WHITE|8
Adding number conversion cast (unumber) 8 in memset::c#1 = ((unumber)) WHITE|8
Adding number conversion cast (unumber) $28*$19 in memset::num#1 = $28*$19
Adding number conversion cast (unumber) $3e7 in main::$7 = SCREEN + $3e7
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast memset::dst#0 = (char *)memset::str#3
Inlining cast memset::num#0 = (unumber)$28*$19
Inlining cast memset::c#1 = (unumber)WHITE|(unumber)8
Inlining cast memset::num#1 = (unumber)$28*$19
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 53270
Simplifying constant pointer cast (char *) 53272
Simplifying constant pointer cast (struct MOS6569_VICII *) 53248
Simplifying constant pointer cast (char *) 55296
Simplifying constant pointer cast (char *) 1024
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 WHITE|(unumber)8
Simplifying constant integer cast 8
Simplifying constant integer cast $3e7
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $3fff
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) $f
Finalized unsigned number type (char) 8
Finalized unsigned number type (unsigned int) $3e7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to unsigned int in main::toD0181_$0 = main::toD0181_$7 & $3fff
Inferred type updated to unsigned int in main::toD0181_$1 = main::toD0181_$0 * 4
Inferred type updated to char in main::toD0181_$4 = main::toD0181_$3 / 4
Inferred type updated to char in main::toD0181_$5 = main::toD0181_$4 & $f
Inferred type updated to char in main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5
Inversing boolean not [2] memset::$1 = memset::num#2 <= 0 from [1] memset::$0 = memset::num#2 > 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 
Alias memset::str#3 = memset::str#4 
Alias memset::num#2 = memset::num#3 
Alias memset::c#4 = memset::c#5 
Alias memset::c#2 = memset::c#3 
Alias memset::dst#2 = memset::dst#3 
Alias memset::end#1 = memset::end#2 
Alias memset::str#5 = memset::str#6 
Alias main::toD0181_screen#0 = main::toD0181_screen#1 
Alias main::toD0181_gfx#0 = main::toD0181_gfx#1 
Alias main::toD0181_return#0 = main::toD0181_$6 main::toD0181_return#2 main::toD0181_return#1 main::toD0181_return#3 main::$0 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values memset::end#1 memset::end#0
Identical Phi Values memset::str#5 memset::str#3
Identical Phi Values memset::c#2 memset::c#4
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values memset::return#0 memset::str#3
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition memset::$1 [2] if(memset::num#2<=0) goto memset::@1
Simple Condition memset::$3 [9] if(memset::dst#2!=memset::end#0) goto memset::@4
Simple Condition main::$3 [44] if(main::ch#1!=rangelast(0,$ef)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [29] memset::str#0 = (void *)SCREEN
Constant right-side identified [31] memset::num#0 = (unumber)$28*$19
Constant right-side identified [36] memset::num#1 = (unumber)$28*$19
Constant right-side identified [46] main::$7 = SCREEN + $3e7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toD0181_screen#0 = SCREEN
Constant main::toD0181_gfx#0 = LOGO
Constant memset::str#0 = (void *)SCREEN
Constant memset::c#0 = BLACK
Constant memset::num#0 = (unumber)$28*$19
Constant memset::str#1 = (void *)COLS
Constant memset::c#1 = WHITE|8
Constant memset::num#1 = (unumber)$28*$19
Constant main::ch#0 = 0
Constant main::$7 = SCREEN+$3e7
Successful SSA optimization Pass2ConstantIdentification
Constant main::toD0181_$7 = (unsigned int)main::toD0181_screen#0
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (unsigned int)main::toD0181_gfx#0 in [23] main::toD0181_$3 = byte1  (unsigned int)main::toD0181_gfx#0
Successful SSA optimization Pass2ConstantValues
if() condition always true - replacing block destination [45] if(true) goto main::@3
Successful SSA optimization Pass2ConstantIfs
Resolved ranged next value [42] main::ch#1 = ++ main::ch#2 to ++
Resolved ranged comparison value [44] if(main::ch#1!=rangelast(0,$ef)) goto main::@1 to $f0
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused variable memset::return#2 and assignment [24] memset::return#2 = memset::str#3
Eliminating unused variable memset::return#3 and assignment [26] memset::return#3 = memset::str#3
Successful SSA optimization PassNEliminateUnusedVars
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Adding number conversion cast (unumber) $f0 in [28] if(main::ch#1!=$f0) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $f0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $f0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant right-side identified [14] main::toD0181_$0 = main::toD0181_$7 & $3fff
Constant right-side identified [17] main::toD0181_$3 = byte1  (unsigned int)main::toD0181_gfx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toD0181_$0 = main::toD0181_$7&$3fff
Constant main::toD0181_$3 = byte1 (unsigned int)main::toD0181_gfx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [14] main::toD0181_$1 = main::toD0181_$0 * 4
Constant right-side identified [16] main::toD0181_$4 = main::toD0181_$3 / 4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toD0181_$1 = main::toD0181_$0*4
Constant main::toD0181_$4 = main::toD0181_$3/4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [14] main::toD0181_$2 = byte1  main::toD0181_$1
Constant right-side identified [15] main::toD0181_$5 = main::toD0181_$4 & $f
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toD0181_$2 = byte1 main::toD0181_$1
Constant main::toD0181_$5 = main::toD0181_$4&$f
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [14] main::toD0181_return#0 = main::toD0181_$2 | main::toD0181_$5
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::toD0181_return#0 = main::toD0181_$2|main::toD0181_$5
Successful SSA optimization Pass2ConstantIdentification
Inlining Noop Cast [2] memset::$4 = (char *)memset::str#3 keeping memset::str#3
Inlining Noop Cast [4] memset::dst#0 = (char *)memset::str#3 keeping memset::str#3
Successful SSA optimization Pass2NopCastInlining
Inlining constant with var siblings memset::str#0
Inlining constant with var siblings memset::c#0
Inlining constant with var siblings memset::num#0
Inlining constant with var siblings memset::str#1
Inlining constant with var siblings memset::c#1
Inlining constant with var siblings memset::num#1
Inlining constant with var siblings main::ch#0
Constant inlined main::toD0181_screen#0 = SCREEN
Constant inlined main::toD0181_gfx#0 = LOGO
Constant inlined memset::str#1 = (void *)COLS
Constant inlined memset::str#0 = (void *)SCREEN
Constant inlined main::toD0181_$7 = (unsigned int)SCREEN
Constant inlined main::toD0181_$2 = byte1 (unsigned int)SCREEN&$3fff*4
Constant inlined main::toD0181_$1 = (unsigned int)SCREEN&$3fff*4
Constant inlined main::toD0181_$0 = (unsigned int)SCREEN&$3fff
Constant inlined memset::num#1 = (unsigned int)$28*$19
Constant inlined memset::num#0 = (unsigned int)$28*$19
Constant inlined main::toD0181_$5 = byte1 (unsigned int)LOGO/4&$f
Constant inlined main::toD0181_$4 = byte1 (unsigned int)LOGO/4
Constant inlined main::toD0181_$3 = byte1 (unsigned int)LOGO
Constant inlined memset::c#0 = BLACK
Constant inlined memset::c#1 = WHITE|8
Constant inlined main::$7 = SCREEN+$3e7
Constant inlined main::ch#0 = 0
Successful SSA optimization Pass2ConstantInlining
Identical Phi Values memset::num#2 (unsigned int)$28*$19
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always false - eliminating [1] if((unsigned int)$28*$19<=0) goto memset::@1
Successful SSA optimization Pass2ConstantIfs
Finalized unsigned number type (char) 6
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 8
Finalized unsigned number type (unsigned int) $2000
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) $19
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@7(between main::@1 and main::@1)
Adding NOP phi() at start of main::toD0181
Adding NOP phi() at start of main::toD0181_@return
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of memset::@1
CALL GRAPH
Calls in [main] to memset:8 memset:10 

Created 4 initial phi equivalence classes
Coalesced [19] main::ch#3 = main::ch#1
Coalesced [29] memset::dst#5 = memset::dst#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block label main::toD0181_@return
Culled Empty Block label main::@6
Culled Empty Block label main::@2
Culled Empty Block label main::@7
Culled Empty Block label memset::@1
Renumbering block memset::@2 to memset::@1
Renumbering block memset::@3 to memset::@2
Renumbering block memset::@4 to memset::@3
Renumbering block main::@3 to main::@2
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Adding NOP phi() at start of main::toD0181
Adding NOP phi() at start of main::@4

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE
  [1] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY
  [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1)
  [3] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK
  to:main::toD0181
main::toD0181: scope:[main]  from main
  [4] phi()
  to:main::@3
main::@3: scope:[main]  from main::toD0181
  [5] *D018 = main::toD0181_return#0
  [6] *D016 = VICII_MCM|VICII_CSEL
  [7] call memset
  to:main::@4
main::@4: scope:[main]  from main::@3
  [8] phi()
  [9] call memset
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@4
  [10] main::ch#2 = phi( main::@1/main::ch#1, main::@4/0 )
  [11] SCREEN[main::ch#2] = main::ch#2
  [12] main::ch#1 = ++ main::ch#2
  [13] if(main::ch#1!=$f0) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [14] *(SCREEN+$3e7) = ++ *(SCREEN+$3e7)
  kickasm() {{ inc $d020  }}
  to:main::@2

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from main::@3 main::@4
  [16] memset::c#4 = phi( main::@3/BLACK, main::@4/WHITE|8 )
  [16] memset::str#3 = phi( main::@3/(void *)SCREEN, main::@4/(void *)COLS )
  to:memset::@1
memset::@1: scope:[memset]  from memset
  [17] memset::end#0 = (char *)memset::str#3 + (unsigned int)$28*$19
  [18] memset::dst#4 = (char *)memset::str#3
  to:memset::@2
memset::@2: scope:[memset]  from memset::@1 memset::@3
  [19] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 )
  [20] if(memset::dst#2!=memset::end#0) goto memset::@3
  to:memset::@return
memset::@return: scope:[memset]  from memset::@2
  [21] return 
  to:@return
memset::@3: scope:[memset]  from memset::@2
  [22] *memset::dst#2 = memset::c#4
  [23] memset::dst#1 = ++ memset::dst#2
  to:memset::@2


VARIABLE REGISTER WEIGHTS
void main()
char main::ch
char main::ch#1 // 16.5
char main::ch#2 // 22.0
char *main::toD0181_gfx
char main::toD0181_return
char *main::toD0181_screen
void * memset(void *str , char c , unsigned int num)
char memset::c
char memset::c#4 // 14.428571428571429
char *memset::dst
char *memset::dst#1 // 202.0
char *memset::dst#2 // 138.33333333333331
char *memset::dst#4 // 22.0
char *memset::end
char *memset::end#0 // 18.666666666666664
unsigned int memset::num
void *memset::return
void *memset::str
void *memset::str#3

Initial phi equivalence classes
[ main::ch#2 main::ch#1 ]
[ 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::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
[ memset::end#0 ]
Allocated zp[2]:2 [ memset::dst#2 memset::dst#4 memset::dst#1 ]
Allocated zp[1]:4 [ main::ch#2 main::ch#1 ]
Allocated zp[2]:5 [ memset::end#0 ]
Allocated zp[1]:7 [ memset::c#4 ]
Allocated zp[2]:8 [ memset::str#3 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *D018 = main::toD0181_return#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [6] *D016 = VICII_MCM|VICII_CSEL [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [17] memset::end#0 = (char *)memset::str#3 + (unsigned int)$28*$19 [ memset::str#3 memset::c#4 memset::end#0 ] ( memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] { }  memset:9 [ memset::str#3 memset::c#4 memset::end#0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ memset::c#4 ]
Statement [18] memset::dst#4 = (char *)memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  memset:9 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  ) always clobbers reg byte a 
Statement [20] if(memset::dst#2!=memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  memset:9 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [22] *memset::dst#2 = memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  memset:9 [ 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 [0] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *D018 = main::toD0181_return#0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [6] *D016 = VICII_MCM|VICII_CSEL [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [17] memset::end#0 = (char *)memset::str#3 + (unsigned int)$28*$19 [ memset::str#3 memset::c#4 memset::end#0 ] ( memset:7 [ memset::str#3 memset::c#4 memset::end#0 ] { }  memset:9 [ memset::str#3 memset::c#4 memset::end#0 ] { }  ) always clobbers reg byte a 
Statement [18] memset::dst#4 = (char *)memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  memset:9 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  ) always clobbers reg byte a 
Statement [20] if(memset::dst#2!=memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  memset:9 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [22] *memset::dst#2 = memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( memset:7 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  memset:9 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:4 [ main::ch#2 main::ch#1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:8 [ memset::str#3 ] : zp[2]:8 , 
Potential registers zp[1]:7 [ memset::c#4 ] : zp[1]:7 , reg byte x , 
Potential registers zp[2]:2 [ memset::dst#2 memset::dst#4 memset::dst#1 ] : zp[2]:2 , 
Potential registers zp[2]:5 [ memset::end#0 ] : zp[2]:5 , 

REGISTER UPLIFT SCOPES
Uplift Scope [memset] 362.33: zp[2]:2 [ memset::dst#2 memset::dst#4 memset::dst#1 ] 18.67: zp[2]:5 [ memset::end#0 ] 14.43: zp[1]:7 [ memset::c#4 ] 0: zp[2]:8 [ memset::str#3 ] 
Uplift Scope [main] 38.5: zp[1]:4 [ main::ch#2 main::ch#1 ] 
Uplift Scope [MOS6526_CIA] 
Uplift Scope [MOS6569_VICII] 
Uplift Scope [MOS6581_SID] 
Uplift Scope [] 

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

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
/// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
  // Upstart
  // Commodore 64 PRG executable file
.file [name="showlogo.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  /// $D016 Control register #2 Bit#4: MCM Turn Multicolor Mode on/off
  .const VICII_MCM = $10
  /// $D016 Control register #2 Bit#3: CSEL Switch betweem 40 or 38 visible columns
  ///           CSEL|   Display window width   | First X coo. | Last X coo.
  ///           ----+--------------------------+--------------+------------
  ///             0 | 38 characters/304 pixels |   31 ($1f)   |  334 ($14e)
  ///             1 | 40 characters/320 pixels |   24 ($18)   |  343 ($157)
  .const VICII_CSEL = 8
  /// The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const DARK_GREY = $b
  .const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1 = $22
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2 = $23
  /// $D016 Control register 2
  /// @see #VICII_CONTROL2
  .label D016 = $d016
  /// $D018 VIC-II base addresses
  // @see #VICII_MEMORY
  .label D018 = $d018
  /// The VIC-II MOS 6567/6569
  .label VICII = $d000
  /// Color Ram
  .label COLS = $d800
  .label SCREEN = $400
.segment Code
  // main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)*4)|(>LOGO)/4&$f
    // [0] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
    // [1] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1
    // [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) -- _deref_pbuc1=_deref_pbuc2 
    lda VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    // [3] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2
    // [4] phi from main to main::toD0181 [phi:main->main::toD0181]
  toD0181_from_main:
    jmp toD0181
    // main::toD0181
  toD0181:
    jmp __b3
    // main::@3
  __b3:
    // [5] *D018 = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // [6] *D016 = VICII_MCM|VICII_CSEL -- _deref_pbuc1=vbuc2 
    lda #VICII_MCM|VICII_CSEL
    sta D016
    // [7] call memset
    // [16] phi from main::@3 to memset [phi:main::@3->memset]
  memset_from___b3:
    // [16] phi memset::c#4 = BLACK [phi:main::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [16] phi memset::str#3 = (void *)SCREEN [phi:main::@3->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    jsr memset
    // [8] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [9] call memset
    // [16] phi from main::@4 to memset [phi:main::@4->memset]
  memset_from___b4:
    // [16] phi memset::c#4 = WHITE|8 [phi:main::@4->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
    // [16] phi memset::str#3 = (void *)COLS [phi:main::@4->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    jsr memset
    // [10] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [10] phi main::ch#2 = 0 [phi:main::@4->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [10] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  __b1_from___b1:
    // [10] phi main::ch#2 = main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [11] SCREEN[main::ch#2] = main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
    // [12] main::ch#1 = ++ main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] if(main::ch#1!=$f0) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [14] *(SCREEN+$3e7) = ++ *(SCREEN+$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.
// void * memset(__zp(2) void *str, __register(X) char c, unsigned int num)
memset: {
    .label end = 4
    .label dst = 2
    .label str = 2
    jmp __b1
    // memset::@1
  __b1:
    // [17] memset::end#0 = (char *)memset::str#3 + (unsigned int)$28*$19 -- pbuz1=pbuz2_plus_vwuc1 
    lda.z str
    clc
    adc #<$28*$19
    sta.z end
    lda.z str+1
    adc #>$28*$19
    sta.z end+1
    // [18] memset::dst#4 = (char *)memset::str#3
    // [19] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [19] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp __b2
    // memset::@2
  __b2:
    // [20] if(memset::dst#2!=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:
    // [21] return 
    rts
    // memset::@3
  __b3:
    // [22] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // [23] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2_from___b3
}
  // File Data
.segment Data
.pc = $2000 "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 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 VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1_from___b1 with __b1
Replacing label __b2_from___b3 with __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 __b3:
Removing instruction memset_from___b3:
Removing instruction __b4:
Removing instruction __b1_from___b4:
Removing instruction __b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant const char BLACK = 0
__constant char * const COLS = (char *) 55296
__constant char * const D016 = (char *) 53270
__constant char * const D018 = (char *) 53272
__constant const char DARK_GREY = $b
__constant char LOGO[6*$28*8] = kickasm {{ .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)
 }}
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1 = $22
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2 = $23
__constant char OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
__constant char *SCREEN = (char *) 1024
__constant struct MOS6569_VICII * const VICII = (struct MOS6569_VICII *) 53248
__constant const char VICII_CSEL = 8
__constant const char VICII_MCM = $10
__constant const char WHITE = 1
void main()
char main::ch
char main::ch#1 // reg byte x 16.5
char main::ch#2 // reg byte x 22.0
char *main::toD0181_gfx
char main::toD0181_return
__constant char main::toD0181_return#0 = byte1 (unsigned int)SCREEN&$3fff*4|byte1 (unsigned int)LOGO/4&$f // toD0181_return
char *main::toD0181_screen
void * memset(void *str , char c , unsigned int num)
char memset::c
char memset::c#4 // reg byte x 14.428571428571429
char *memset::dst
char *memset::dst#1 // dst zp[2]:2 202.0
char *memset::dst#2 // dst zp[2]:2 138.33333333333331
char *memset::dst#4 // dst zp[2]:2 22.0
char *memset::end
char *memset::end#0 // end zp[2]:4 18.666666666666664
unsigned int memset::num
void *memset::return
void *memset::str
void *memset::str#3 // str zp[2]:2

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


FINAL ASSEMBLER
Score: 3324

  // File Comments
/// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
  // Upstart
  // Commodore 64 PRG executable file
.file [name="showlogo.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  /// $D016 Control register #2 Bit#4: MCM Turn Multicolor Mode on/off
  .const VICII_MCM = $10
  /// $D016 Control register #2 Bit#3: CSEL Switch betweem 40 or 38 visible columns
  ///           CSEL|   Display window width   | First X coo. | Last X coo.
  ///           ----+--------------------------+--------------+------------
  ///             0 | 38 characters/304 pixels |   31 ($1f)   |  334 ($14e)
  ///             1 | 40 characters/320 pixels |   24 ($18)   |  343 ($157)
  .const VICII_CSEL = 8
  /// The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const DARK_GREY = $b
  .const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1 = $22
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2 = $23
  /// $D016 Control register 2
  /// @see #VICII_CONTROL2
  .label D016 = $d016
  /// $D018 VIC-II base addresses
  // @see #VICII_MEMORY
  .label D018 = $d018
  /// The VIC-II MOS 6567/6569
  .label VICII = $d000
  /// Color Ram
  .label COLS = $d800
  .label SCREEN = $400
.segment Code
  // main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)*4)|(>LOGO)/4&$f
    // VICII->BORDER_COLOR = WHITE
    // [0] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
    // VICII->BG_COLOR1 = DARK_GREY
    // [1] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) = DARK_GREY -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1
    // VICII->BG_COLOR = VICII->BG_COLOR1 = DARK_GREY
    // [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR1) -- _deref_pbuc1=_deref_pbuc2 
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    // VICII->BG_COLOR2 = BLACK
    // [3] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2) = BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR2
    // [4] phi from main to main::toD0181 [phi:main->main::toD0181]
    // main::toD0181
    // main::@3
    // *D018 = toD018(SCREEN, LOGO)
    // [5] *D018 = main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // *D016 = VICII_MCM | VICII_CSEL
    // [6] *D016 = VICII_MCM|VICII_CSEL -- _deref_pbuc1=vbuc2 
    lda #VICII_MCM|VICII_CSEL
    sta D016
    // memset(SCREEN, BLACK, 40*25)
    // [7] call memset
    // [16] phi from main::@3 to memset [phi:main::@3->memset]
    // [16] phi memset::c#4 = BLACK [phi:main::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [16] phi memset::str#3 = (void *)SCREEN [phi:main::@3->memset#1] -- pvoz1=pvoc1 
    lda #<SCREEN
    sta.z memset.str
    lda #>SCREEN
    sta.z memset.str+1
    jsr memset
    // [8] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // main::@4
    // memset(COLS, WHITE|8, 40*25)
    // [9] call memset
    // [16] phi from main::@4 to memset [phi:main::@4->memset]
    // [16] phi memset::c#4 = WHITE|8 [phi:main::@4->memset#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
    // [16] phi memset::str#3 = (void *)COLS [phi:main::@4->memset#1] -- pvoz1=pvoc1 
    lda #<COLS
    sta.z memset.str
    lda #>COLS
    sta.z memset.str+1
    jsr memset
    // [10] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [10] phi main::ch#2 = 0 [phi:main::@4->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [10] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
    // [10] phi main::ch#2 = main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // SCREEN[ch] = ch
    // [11] SCREEN[main::ch#2] = main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
    // for(char ch: 0..239)
    // [12] main::ch#1 = ++ main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
    // [13] if(main::ch#1!=$f0) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne __b1
    // main::@2
  __b2:
    // (*(SCREEN+999))++;
    // [14] *(SCREEN+$3e7) = ++ *(SCREEN+$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.
// void * memset(__zp(2) void *str, __register(X) char c, unsigned int num)
memset: {
    .label end = 4
    .label dst = 2
    .label str = 2
    // memset::@1
    // char* end = (char*)str + num
    // [17] memset::end#0 = (char *)memset::str#3 + (unsigned int)$28*$19 -- pbuz1=pbuz2_plus_vwuc1 
    lda.z str
    clc
    adc #<$28*$19
    sta.z end
    lda.z str+1
    adc #>$28*$19
    sta.z end+1
    // [18] memset::dst#4 = (char *)memset::str#3
    // [19] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
    // [19] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    // memset::@2
  __b2:
    // for(char* dst = str; dst!=end; dst++)
    // [20] if(memset::dst#2!=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
    // }
    // [21] return 
    rts
    // memset::@3
  __b3:
    // *dst = c
    // [22] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [23] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2
}
  // File Data
.segment Data
.pc = $2000 "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)


