Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx 
Inlined call (byte~) main::$0 ← call toD018 (byte*) SCREEN (byte*) LOGO 

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) PROCPORT_RAM_ALL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48
  (byte) PROCPORT_RAM_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53
  (byte) PROCPORT_RAM_CHARROM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49
  (byte) PROCPORT_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54
  (byte) PROCPORT_BASIC_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55
  (byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248
  (word) SPRITE_PTRS#0 ← (word/signed word/dword/signed dword) 1016
  (byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) 53248
  (byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) 53249
  (byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) 53264
  (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
  (byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53269
  (byte*) SPRITES_EXPAND_Y#0 ← ((byte*)) (word/dword/signed dword) 53271
  (byte*) SPRITES_PRIORITY#0 ← ((byte*)) (word/dword/signed dword) 53275
  (byte*) SPRITES_MC#0 ← ((byte*)) (word/dword/signed dword) 53276
  (byte*) SPRITES_EXPAND_X#0 ← ((byte*)) (word/dword/signed dword) 53277
  (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280
  (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281
  (byte*) BGCOL1#0 ← ((byte*)) (word/dword/signed dword) 53281
  (byte*) BGCOL2#0 ← ((byte*)) (word/dword/signed dword) 53282
  (byte*) BGCOL3#0 ← ((byte*)) (word/dword/signed dword) 53283
  (byte*) BGCOL4#0 ← ((byte*)) (word/dword/signed dword) 53284
  (byte*) SPRITES_MC1#0 ← ((byte*)) (word/dword/signed dword) 53285
  (byte*) SPRITES_MC2#0 ← ((byte*)) (word/dword/signed dword) 53286
  (byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) 53287
  (byte*) VIC_CONTROL#0 ← ((byte*)) (word/dword/signed dword) 53265
  (byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265
  (byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) 128
  (byte) VIC_ECM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 64
  (byte) VIC_BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
  (byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
  (byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) VIC_CONTROL2#0 ← ((byte*)) (word/dword/signed dword) 53270
  (byte*) D016#0 ← ((byte*)) (word/dword/signed dword) 53270
  (byte) VIC_MCM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
  (byte) VIC_CSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272
  (byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272
  (byte*) LIGHTPEN_X#0 ← ((byte*)) (word/dword/signed dword) 53267
  (byte*) LIGHTPEN_Y#0 ← ((byte*)) (word/dword/signed dword) 53268
  (byte*) IRQ_STATUS#0 ← ((byte*)) (word/dword/signed dword) 53273
  (byte*) IRQ_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53274
  (byte) IRQ_RASTER#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) IRQ_COLLISION_BG#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) IRQ_COLLISION_SPRITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
  (byte) IRQ_LIGHTPEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) COLS#0 ← ((byte*)) (word/dword/signed dword) 55296
  (byte*) CIA1_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56320
  (byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321
  (byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322
  (byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323
  (byte*) CIA1_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56333
  (byte) CIA_INTERRUPT_CLEAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 127
  (byte*) CIA2_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56576
  (byte*) CIA2_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56577
  (byte*) CIA2_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56578
  (byte*) CIA2_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56579
  (byte*) CIA2_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56589
  (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
  (void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534
  (byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) CYAN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3
  (byte) PURPLE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
  (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
  (byte) BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6
  (byte) YELLOW#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) ORANGE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte) BROWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9
  (byte) PINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10
  (byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11
  (byte) GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12
  (byte) LIGHT_GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13
  (byte) LIGHT_BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14
  (byte) LIGHT_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15
  to:@4
@4: scope:[]  from @begin
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) LOGO#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192
  (byte/word/signed word/dword/signed dword~) $0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 * (byte/signed byte/word/signed word/dword/signed dword) 40
  (byte/signed word/word/dword/signed dword~) $1 ← (byte/word/signed word/dword/signed dword~) $0 * (byte/signed byte/word/signed word/dword/signed dword) 8
  kickasm(location (byte*) LOGO#0) {{ .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:@6
main: scope:[main]  from @6
  (byte*) LOGO#1 ← phi( @6/(byte*) LOGO#2 )
  (byte*) SCREEN#1 ← phi( @6/(byte*) SCREEN#5 )
  *((byte*) BORDERCOL#0) ← (byte) WHITE#0
  *((byte*) BGCOL2#0) ← (byte) DARK_GREY#0
  *((byte*) BGCOL#0) ← *((byte*) BGCOL2#0)
  *((byte*) BGCOL3#0) ← (byte) BLACK#0
  (byte*) main::toD0181_screen#0 ← (byte*) SCREEN#1
  (byte*) main::toD0181_gfx#0 ← (byte*) LOGO#1
  to:main::toD0181
main::toD0181: scope:[main]  from main
  (byte*) SCREEN#9 ← phi( main/(byte*) SCREEN#1 )
  (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#0 ← ((word)) (byte*) main::toD0181_screen#1
  (word) main::toD0181_$1#0 ← (word) main::toD0181_$0#0 & (word/signed word/dword/signed dword) 16383
  (word) main::toD0181_$2#0 ← (word) main::toD0181_$1#0 << (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) main::toD0181_$3#0 ← > (word) main::toD0181_$2#0
  (word) main::toD0181_$4#0 ← ((word)) (byte*) main::toD0181_gfx#1
  (byte) main::toD0181_$5#0 ← > (word) main::toD0181_$4#0
  (byte) main::toD0181_$6#0 ← (byte) main::toD0181_$5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) main::toD0181_$7#0 ← (byte) main::toD0181_$6#0 & (byte/signed byte/word/signed word/dword/signed dword) 15
  (byte) main::toD0181_$8#0 ← (byte) main::toD0181_$3#0 | (byte) main::toD0181_$7#0
  (byte) main::toD0181_return#0 ← (byte) main::toD0181_$8#0
  to:main::toD0181_@return
main::toD0181_@return: scope:[main]  from main::toD0181
  (byte*) SCREEN#6 ← phi( main::toD0181/(byte*) SCREEN#9 )
  (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*) SCREEN#2 ← phi( main::toD0181_@return/(byte*) SCREEN#6 )
  (byte) main::toD0181_return#3 ← phi( main::toD0181_@return/(byte) main::toD0181_return#1 )
  (byte~) main::$0 ← (byte) main::toD0181_return#3
  *((byte*) D018#0) ← (byte~) main::$0
  (byte~) main::$1 ← (byte) VIC_MCM#0 | (byte) VIC_CSEL#0
  *((byte*) D016#0) ← (byte~) main::$1
  (word/signed word/dword/signed dword~) main::$2 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 25
  (byte*) fill::start#0 ← (byte*) SCREEN#2
  (word) fill::size#0 ← (word/signed word/dword/signed dword~) main::$2
  (byte) fill::val#0 ← (byte) BLACK#0
  call fill 
  to:main::@10
main::@10: scope:[main]  from main::@9
  (byte*) SCREEN#10 ← phi( main::@9/(byte*) SCREEN#2 )
  (word/signed word/dword/signed dword~) main::$4 ← (byte/signed byte/word/signed word/dword/signed dword) 40 * (byte/signed byte/word/signed word/dword/signed dword) 25
  (byte/word/dword~) main::$5 ← (byte) WHITE#0 | (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) fill::start#1 ← (byte*) COLS#0
  (word) fill::size#1 ← (word/signed word/dword/signed dword~) main::$4
  (byte) fill::val#1 ← (byte/word/dword~) main::$5
  call fill 
  to:main::@11
main::@11: scope:[main]  from main::@10
  (byte*) SCREEN#7 ← phi( main::@10/(byte*) SCREEN#10 )
  (byte) main::ch#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@11
  (byte*) SCREEN#3 ← phi( main::@1/(byte*) SCREEN#3 main::@11/(byte*) SCREEN#7 )
  (byte) main::ch#2 ← phi( main::@1/(byte) main::ch#1 main::@11/(byte) main::ch#0 )
  *((byte*) SCREEN#3 + (byte) main::ch#2) ← (byte) main::ch#2
  (byte) main::ch#1 ← (byte) main::ch#2 + rangenext(0,239)
  (bool~) main::$7 ← (byte) main::ch#1 != rangelast(0,239)
  if((bool~) main::$7) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@3
  (byte*) SCREEN#8 ← phi( main::@1/(byte*) SCREEN#3 main::@3/(byte*) SCREEN#4 )
  if(true) goto main::@3
  to:main::@return
main::@3: scope:[main]  from main::@2
  (byte*) SCREEN#4 ← phi( main::@2/(byte*) SCREEN#8 )
  (byte*~) main::$8 ← (byte*) SCREEN#4 + (word/signed word/dword/signed dword) 999
  (byte*~) main::$9 ← (byte*) SCREEN#4 + (word/signed word/dword/signed dword) 999
  (byte*~) main::$10 ← (byte*) SCREEN#4 + (word/signed word/dword/signed dword) 999
  *((byte*~) main::$10) ← ++ *((byte*~) main::$10)
  kickasm {{ inc $d020  }}
  to:main::@2
main::@return: scope:[main]  from main::@2
  return 
  to:@return
fill: scope:[fill]  from main::@10 main::@9
  (byte) fill::val#3 ← phi( main::@10/(byte) fill::val#1 main::@9/(byte) fill::val#0 )
  (word) fill::size#2 ← phi( main::@10/(word) fill::size#1 main::@9/(word) fill::size#0 )
  (byte*) fill::start#2 ← phi( main::@10/(byte*) fill::start#1 main::@9/(byte*) fill::start#0 )
  (byte*~) fill::$0 ← (byte*) fill::start#2 + (word) fill::size#2
  (byte*) fill::end#0 ← (byte*~) fill::$0
  (byte*) fill::addr#0 ← (byte*) fill::start#2
  to:fill::@1
fill::@1: scope:[fill]  from fill fill::@1
  (byte*) fill::end#1 ← phi( fill/(byte*) fill::end#0 fill::@1/(byte*) fill::end#1 )
  (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 )
  (byte) fill::val#2 ← phi( fill/(byte) fill::val#3 fill::@1/(byte) fill::val#2 )
  *((byte*) fill::addr#2) ← (byte) fill::val#2
  (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2
  (bool~) fill::$1 ← (byte*) fill::addr#1 != (byte*) fill::end#1
  if((bool~) fill::$1) goto fill::@1
  to:fill::@return
fill::@return: scope:[fill]  from fill::@1
  return 
  to:@return
@6: scope:[]  from @4
  (byte*) LOGO#2 ← phi( @4/(byte*) LOGO#0 )
  (byte*) SCREEN#5 ← phi( @4/(byte*) SCREEN#0 )
  call main 
  to:@7
@7: scope:[]  from @6
  to:@end
@end: scope:[]  from @7

SYMBOL TABLE SSA
(byte/word/signed word/dword/signed dword~) $0
(byte/signed word/word/dword/signed dword~) $1
(label) @4
(label) @6
(label) @7
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BGCOL1
(byte*) BGCOL1#0
(byte*) BGCOL2
(byte*) BGCOL2#0
(byte*) BGCOL3
(byte*) BGCOL3#0
(byte*) BGCOL4
(byte*) BGCOL4#0
(byte) BLACK
(byte) BLACK#0
(byte) BLUE
(byte) BLUE#0
(byte*) BORDERCOL
(byte*) BORDERCOL#0
(byte) BROWN
(byte) BROWN#0
(byte*) CHARGEN
(byte*) CHARGEN#0
(byte*) CIA1_INTERRUPT
(byte*) CIA1_INTERRUPT#0
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A#0
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_A_DDR#0
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B#0
(byte*) CIA1_PORT_B_DDR
(byte*) CIA1_PORT_B_DDR#0
(byte*) CIA2_INTERRUPT
(byte*) CIA2_INTERRUPT#0
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A#0
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_A_DDR#0
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B#0
(byte*) CIA2_PORT_B_DDR
(byte*) CIA2_PORT_B_DDR#0
(byte) CIA_INTERRUPT_CLEAR
(byte) CIA_INTERRUPT_CLEAR#0
(byte*) COLS
(byte*) COLS#0
(byte) CYAN
(byte) CYAN#0
(byte*) D011
(byte*) D011#0
(byte*) D016
(byte*) D016#0
(byte*) D018
(byte*) D018#0
(byte) DARK_GREY
(byte) DARK_GREY#0
(byte) GREEN
(byte) GREEN#0
(byte) GREY
(byte) GREY#0
(void()**) HARDWARE_IRQ
(void()**) HARDWARE_IRQ#0
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_BG#0
(byte) IRQ_COLLISION_SPRITE
(byte) IRQ_COLLISION_SPRITE#0
(byte*) IRQ_ENABLE
(byte*) IRQ_ENABLE#0
(byte) IRQ_LIGHTPEN
(byte) IRQ_LIGHTPEN#0
(byte) IRQ_RASTER
(byte) IRQ_RASTER#0
(byte*) IRQ_STATUS
(byte*) IRQ_STATUS#0
(void()**) KERNEL_IRQ
(void()**) KERNEL_IRQ#0
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_X#0
(byte*) LIGHTPEN_Y
(byte*) LIGHTPEN_Y#0
(byte) LIGHT_BLUE
(byte) LIGHT_BLUE#0
(byte) LIGHT_GREEN
(byte) LIGHT_GREEN#0
(byte) LIGHT_GREY
(byte) LIGHT_GREY#0
(byte*) LOGO
(byte*) LOGO#0
(byte*) LOGO#1
(byte*) LOGO#2
(byte) ORANGE
(byte) ORANGE#0
(byte) PINK
(byte) PINK#0
(byte*) PROCPORT
(byte*) PROCPORT#0
(byte) PROCPORT_BASIC_KERNEL_IO
(byte) PROCPORT_BASIC_KERNEL_IO#0
(byte*) PROCPORT_DDR
(byte*) PROCPORT_DDR#0
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_DDR_MEMORY_MASK#0
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_KERNEL_IO#0
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_ALL#0
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_CHARROM#0
(byte) PROCPORT_RAM_IO
(byte) PROCPORT_RAM_IO#0
(byte) PURPLE
(byte) PURPLE#0
(byte*) RASTER
(byte*) RASTER#0
(byte) RED
(byte) RED#0
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#10
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) SCREEN#6
(byte*) SCREEN#7
(byte*) SCREEN#8
(byte*) SCREEN#9
(byte*) SPRITES_COLS
(byte*) SPRITES_COLS#0
(byte*) SPRITES_ENABLE
(byte*) SPRITES_ENABLE#0
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_X#0
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_EXPAND_Y#0
(byte*) SPRITES_MC
(byte*) SPRITES_MC#0
(byte*) SPRITES_MC1
(byte*) SPRITES_MC1#0
(byte*) SPRITES_MC2
(byte*) SPRITES_MC2#0
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_PRIORITY#0
(byte*) SPRITES_XMSB
(byte*) SPRITES_XMSB#0
(byte*) SPRITES_XPOS
(byte*) SPRITES_XPOS#0
(byte*) SPRITES_YPOS
(byte*) SPRITES_YPOS#0
(word) SPRITE_PTRS
(word) SPRITE_PTRS#0
(byte) VIC_BMM
(byte) VIC_BMM#0
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL#0
(byte*) VIC_CONTROL2
(byte*) VIC_CONTROL2#0
(byte) VIC_CSEL
(byte) VIC_CSEL#0
(byte) VIC_DEN
(byte) VIC_DEN#0
(byte) VIC_ECM
(byte) VIC_ECM#0
(byte) VIC_MCM
(byte) VIC_MCM#0
(byte*) VIC_MEMORY
(byte*) VIC_MEMORY#0
(byte) VIC_RSEL
(byte) VIC_RSEL#0
(byte) VIC_RST8
(byte) VIC_RST8#0
(byte) WHITE
(byte) WHITE#0
(byte) YELLOW
(byte) YELLOW#0
(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val)
(byte*~) fill::$0
(bool~) fill::$1
(label) fill::@1
(label) fill::@return
(byte*) fill::addr
(byte*) fill::addr#0
(byte*) fill::addr#1
(byte*) fill::addr#2
(byte*) fill::end
(byte*) fill::end#0
(byte*) fill::end#1
(word) fill::size
(word) fill::size#0
(word) fill::size#1
(word) fill::size#2
(byte*) fill::start
(byte*) fill::start#0
(byte*) fill::start#1
(byte*) fill::start#2
(byte) fill::val
(byte) fill::val#0
(byte) fill::val#1
(byte) fill::val#2
(byte) fill::val#3
(void()) main()
(byte~) main::$0
(byte~) main::$1
(byte*~) main::$10
(word/signed word/dword/signed dword~) main::$2
(word/signed word/dword/signed dword~) main::$4
(byte/word/dword~) main::$5
(bool~) main::$7
(byte*~) main::$8
(byte*~) main::$9
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@2
(label) main::@3
(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
(word) main::toD0181_$0#0
(word~) main::toD0181_$1
(word) main::toD0181_$1#0
(word~) main::toD0181_$2
(word) main::toD0181_$2#0
(byte~) main::toD0181_$3
(byte) main::toD0181_$3#0
(word~) main::toD0181_$4
(word) main::toD0181_$4#0
(byte~) main::toD0181_$5
(byte) main::toD0181_$5#0
(byte~) main::toD0181_$6
(byte) main::toD0181_$6#0
(byte~) main::toD0181_$7
(byte) main::toD0181_$7#0
(byte~) main::toD0181_$8
(byte) main::toD0181_$8#0
(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

Culled Empty Block (label) @7
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte*) main::toD0181_screen#0 = (byte*) main::toD0181_screen#1 
Alias (byte*) main::toD0181_gfx#0 = (byte*) main::toD0181_gfx#1 
Alias (byte*) SCREEN#1 = (byte*) SCREEN#9 (byte*) SCREEN#6 (byte*) SCREEN#2 (byte*) SCREEN#10 (byte*) SCREEN#7 
Alias (byte) main::toD0181_return#0 = (byte) main::toD0181_$8#0 (byte) main::toD0181_return#2 (byte) main::toD0181_return#1 (byte) main::toD0181_return#3 (byte~) main::$0 
Alias (word) fill::size#0 = (word/signed word/dword/signed dword~) main::$2 
Alias (word) fill::size#1 = (word/signed word/dword/signed dword~) main::$4 
Alias (byte) fill::val#1 = (byte/word/dword~) main::$5 
Alias (byte*) SCREEN#4 = (byte*) SCREEN#8 
Alias (byte*) fill::end#0 = (byte*~) fill::$0 
Alias (byte*) fill::addr#0 = (byte*) fill::start#2 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#5 
Alias (byte*) LOGO#0 = (byte*) LOGO#2 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) SCREEN#3
Self Phi Eliminated (byte*) SCREEN#4
Self Phi Eliminated (byte) fill::val#2
Self Phi Eliminated (byte*) fill::end#1
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#0
Redundant Phi (byte*) LOGO#1 (byte*) LOGO#0
Redundant Phi (byte*) SCREEN#3 (byte*) SCREEN#1
Redundant Phi (byte*) SCREEN#4 (byte*) SCREEN#3
Redundant Phi (byte) fill::val#2 (byte) fill::val#3
Redundant Phi (byte*) fill::end#1 (byte*) fill::end#0
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$7 [127] if((byte) main::ch#1!=rangelast(0,239)) goto main::@1
Simple Condition (bool~) fill::$1 [145] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0
Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7
Constant (const byte*) PROCPORT#0 = ((byte*))1
Constant (const byte) PROCPORT_RAM_ALL#0 = 48
Constant (const byte) PROCPORT_RAM_IO#0 = 53
Constant (const byte) PROCPORT_RAM_CHARROM#0 = 49
Constant (const byte) PROCPORT_KERNEL_IO#0 = 54
Constant (const byte) PROCPORT_BASIC_KERNEL_IO#0 = 55
Constant (const byte*) CHARGEN#0 = ((byte*))53248
Constant (const word) SPRITE_PTRS#0 = 1016
Constant (const byte*) SPRITES_XPOS#0 = ((byte*))53248
Constant (const byte*) SPRITES_YPOS#0 = ((byte*))53249
Constant (const byte*) SPRITES_XMSB#0 = ((byte*))53264
Constant (const byte*) RASTER#0 = ((byte*))53266
Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))53269
Constant (const byte*) SPRITES_EXPAND_Y#0 = ((byte*))53271
Constant (const byte*) SPRITES_PRIORITY#0 = ((byte*))53275
Constant (const byte*) SPRITES_MC#0 = ((byte*))53276
Constant (const byte*) SPRITES_EXPAND_X#0 = ((byte*))53277
Constant (const byte*) BORDERCOL#0 = ((byte*))53280
Constant (const byte*) BGCOL#0 = ((byte*))53281
Constant (const byte*) BGCOL1#0 = ((byte*))53281
Constant (const byte*) BGCOL2#0 = ((byte*))53282
Constant (const byte*) BGCOL3#0 = ((byte*))53283
Constant (const byte*) BGCOL4#0 = ((byte*))53284
Constant (const byte*) SPRITES_MC1#0 = ((byte*))53285
Constant (const byte*) SPRITES_MC2#0 = ((byte*))53286
Constant (const byte*) SPRITES_COLS#0 = ((byte*))53287
Constant (const byte*) VIC_CONTROL#0 = ((byte*))53265
Constant (const byte*) D011#0 = ((byte*))53265
Constant (const byte) VIC_RST8#0 = 128
Constant (const byte) VIC_ECM#0 = 64
Constant (const byte) VIC_BMM#0 = 32
Constant (const byte) VIC_DEN#0 = 16
Constant (const byte) VIC_RSEL#0 = 8
Constant (const byte*) VIC_CONTROL2#0 = ((byte*))53270
Constant (const byte*) D016#0 = ((byte*))53270
Constant (const byte) VIC_MCM#0 = 16
Constant (const byte) VIC_CSEL#0 = 8
Constant (const byte*) D018#0 = ((byte*))53272
Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272
Constant (const byte*) LIGHTPEN_X#0 = ((byte*))53267
Constant (const byte*) LIGHTPEN_Y#0 = ((byte*))53268
Constant (const byte*) IRQ_STATUS#0 = ((byte*))53273
Constant (const byte*) IRQ_ENABLE#0 = ((byte*))53274
Constant (const byte) IRQ_RASTER#0 = 1
Constant (const byte) IRQ_COLLISION_BG#0 = 2
Constant (const byte) IRQ_COLLISION_SPRITE#0 = 4
Constant (const byte) IRQ_LIGHTPEN#0 = 8
Constant (const byte*) COLS#0 = ((byte*))55296
Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320
Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321
Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322
Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323
Constant (const byte*) CIA1_INTERRUPT#0 = ((byte*))56333
Constant (const byte) CIA_INTERRUPT_CLEAR#0 = 127
Constant (const byte*) CIA2_PORT_A#0 = ((byte*))56576
Constant (const byte*) CIA2_PORT_B#0 = ((byte*))56577
Constant (const byte*) CIA2_PORT_A_DDR#0 = ((byte*))56578
Constant (const byte*) CIA2_PORT_B_DDR#0 = ((byte*))56579
Constant (const byte*) CIA2_INTERRUPT#0 = ((byte*))56589
Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788
Constant (const void()**) HARDWARE_IRQ#0 = ((void()**))65534
Constant (const byte) BLACK#0 = 0
Constant (const byte) WHITE#0 = 1
Constant (const byte) RED#0 = 2
Constant (const byte) CYAN#0 = 3
Constant (const byte) PURPLE#0 = 4
Constant (const byte) GREEN#0 = 5
Constant (const byte) BLUE#0 = 6
Constant (const byte) YELLOW#0 = 7
Constant (const byte) ORANGE#0 = 8
Constant (const byte) BROWN#0 = 9
Constant (const byte) PINK#0 = 10
Constant (const byte) DARK_GREY#0 = 11
Constant (const byte) GREY#0 = 12
Constant (const byte) LIGHT_GREEN#0 = 13
Constant (const byte) LIGHT_BLUE#0 = 14
Constant (const byte) LIGHT_GREY#0 = 15
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte*) LOGO#0 = ((byte*))8192
Constant (const byte/word/signed word/dword/signed dword) $0 = 6*40
Constant (const word) fill::size#0 = 40*25
Constant (const word) fill::size#1 = 40*25
Constant (const byte) main::ch#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word/signed word/dword/signed dword) $1 = $0*8
Constant (const byte*) main::toD0181_screen#0 = SCREEN#0
Constant (const byte*) main::toD0181_gfx#0 = LOGO#0
Constant (const byte) main::$1 = VIC_MCM#0|VIC_CSEL#0
Constant (const byte*) fill::start#0 = SCREEN#0
Constant (const byte) fill::val#0 = BLACK#0
Constant (const byte) fill::val#1 = WHITE#0|8
Constant (const byte*) fill::start#1 = COLS#0
Constant (const byte*) main::$8 = SCREEN#0+999
Constant (const byte*) main::$9 = SCREEN#0+999
Constant (const byte*) main::$10 = SCREEN#0+999
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::toD0181_$0#0 = ((word))main::toD0181_screen#0
Constant (const word) main::toD0181_$4#0 = ((word))main::toD0181_gfx#0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::toD0181_$1#0 = main::toD0181_$0#0&16383
Constant (const byte) main::toD0181_$5#0 = >main::toD0181_$4#0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::toD0181_$2#0 = main::toD0181_$1#0<<2
Constant (const byte) main::toD0181_$6#0 = main::toD0181_$5#0>>2
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) main::toD0181_$3#0 = >main::toD0181_$2#0
Constant (const byte) main::toD0181_$7#0 = main::toD0181_$6#0&15
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) main::toD0181_return#0 = main::toD0181_$3#0|main::toD0181_$7#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [13] if(true) goto main::@3
Successful SSA optimization Pass2ConstantIfs
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Resolved ranged next value main::ch#1 ← ++ main::ch#2 to ++
Resolved ranged comparison value if(main::ch#1!=rangelast(0,239)) goto main::@1 to (byte/word/signed word/dword/signed dword) 240
Culled Empty Block (label) main::toD0181_@return
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@2
Successful SSA optimization Pass2CullEmptyBlocks
Inlining constant with var siblings (const byte) main::ch#0
Inlining constant with var siblings (const word) fill::size#0
Inlining constant with var siblings (const word) fill::size#1
Inlining constant with var siblings (const byte) fill::val#0
Inlining constant with var siblings (const byte) fill::val#1
Constant inlined fill::val#0 = (const byte) BLACK#0
Constant inlined main::toD0181_screen#0 = (const byte*) SCREEN#0
Constant inlined main::toD0181_gfx#0 = (const byte*) LOGO#0
Constant inlined fill::val#1 = (const byte) WHITE#0|(byte/signed byte/word/signed word/dword/signed dword) 8
Constant inlined fill::size#1 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25
Constant inlined main::toD0181_$0#0 = ((word))(const byte*) SCREEN#0
Constant inlined fill::size#0 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25
Constant inlined main::toD0181_$1#0 = ((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383
Constant inlined $0 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40
Constant inlined $1 = (byte/signed byte/word/signed word/dword/signed dword) 6*(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 8
Constant inlined main::$10 = (const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999
Constant inlined main::toD0181_$6#0 = >((word))(const byte*) LOGO#0>>(byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined main::toD0181_$7#0 = >((word))(const byte*) LOGO#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15
Constant inlined main::$1 = (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0
Constant inlined main::toD0181_$2#0 = ((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined fill::start#1 = (const byte*) COLS#0
Constant inlined main::toD0181_$3#0 = >((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined fill::start#0 = (const byte*) SCREEN#0
Constant inlined main::toD0181_$4#0 = ((word))(const byte*) LOGO#0
Constant inlined main::toD0181_$5#0 = >((word))(const byte*) LOGO#0
Constant inlined main::ch#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@12(between main::@1 and main::@1)
Added new block during phi lifting fill::@3(between fill::@1 and fill::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @6
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::toD0181
Adding NOP phi() at start of main::@10
CALL GRAPH
Calls in [] to main:3 
Calls in [main] to fill:12 fill:14 

Created 5 initial phi equivalence classes
Coalesced [21] main::ch#3 ← main::ch#1
Coalesced [24] fill::addr#3 ← fill::addr#0
Coalesced [30] fill::addr#4 ← fill::addr#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) main::@12
Culled Empty Block (label) fill::@3
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @6
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::toD0181
Adding NOP phi() at start of main::@10

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@4
@4: scope:[]  from @begin
  kickasm(location (const byte*) LOGO#0) {{ .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:@6
@6: scope:[]  from @4
  [2] phi()
  [3] call main 
  to:@end
@end: scope:[]  from @6
  [4] phi()
main: scope:[main]  from @6
  [5] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0
  [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0
  [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0)
  [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0
  to:main::toD0181
main::toD0181: scope:[main]  from main
  [9] phi()
  to:main::@9
main::@9: scope:[main]  from main::toD0181
  [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
  [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0
  [12] call fill 
  to:main::@10
main::@10: scope:[main]  from main::@9
  [13] phi()
  [14] call fill 
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@10
  [15] (byte) main::ch#2 ← phi( main::@1/(byte) main::ch#1 main::@10/(byte/signed byte/word/signed word/dword/signed dword) 0 )
  [16] *((const byte*) SCREEN#0 + (byte) main::ch#2) ← (byte) main::ch#2
  [17] (byte) main::ch#1 ← ++ (byte) main::ch#2
  [18] if((byte) main::ch#1!=(byte/word/signed word/dword/signed dword) 240) goto main::@1
  to:main::@3
main::@3: scope:[main]  from main::@1 main::@3
  [19] *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) ← ++ *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999)
  kickasm {{ inc $d020  }}
  to:main::@3
fill: scope:[fill]  from main::@10 main::@9
  [21] (byte) fill::val#3 ← phi( main::@10/(const byte) WHITE#0|(byte/signed byte/word/signed word/dword/signed dword) 8 main::@9/(const byte) BLACK#0 )
  [21] (word) fill::size#2 ← phi( main::@10/(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 main::@9/(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 )
  [21] (byte*) fill::addr#0 ← phi( main::@10/(const byte*) COLS#0 main::@9/(const byte*) SCREEN#0 )
  [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2
  to:fill::@1
fill::@1: scope:[fill]  from fill fill::@1
  [23] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 )
  [24] *((byte*) fill::addr#2) ← (byte) fill::val#3
  [25] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2
  [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1
  to:fill::@return
fill::@return: scope:[fill]  from fill::@1
  [27] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(byte*) BGCOL1
(byte*) BGCOL2
(byte*) BGCOL3
(byte*) BGCOL4
(byte) BLACK
(byte) BLUE
(byte*) BORDERCOL
(byte) BROWN
(byte*) CHARGEN
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(byte) CYAN
(byte*) D011
(byte*) D016
(byte*) D018
(byte) DARK_GREY
(byte) GREEN
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte*) LOGO
(byte) ORANGE
(byte) PINK
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(byte) RED
(byte*) SCREEN
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(byte) VIC_DEN
(byte) VIC_ECM
(byte) VIC_MCM
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(byte) VIC_RST8
(byte) WHITE
(byte) YELLOW
(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val)
(byte*) fill::addr
(byte*) fill::addr#0 2.0
(byte*) fill::addr#1 16.5
(byte*) fill::addr#2 17.5
(byte*) fill::end
(byte*) fill::end#0 2.6
(word) fill::size
(word) fill::size#2 2.0
(byte*) fill::start
(byte) fill::val
(byte) fill::val#3 1.8333333333333333
(void()) main()
(byte) main::ch
(byte) main::ch#1 16.5
(byte) main::ch#2 22.0
(word~) main::toD0181_$0
(word~) main::toD0181_$1
(word~) main::toD0181_$2
(byte~) main::toD0181_$3
(word~) main::toD0181_$4
(byte~) main::toD0181_$5
(byte~) main::toD0181_$6
(byte~) main::toD0181_$7
(byte~) main::toD0181_$8
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(byte*) main::toD0181_screen

Initial phi equivalence classes
[ main::ch#2 main::ch#1 ]
[ fill::size#2 ]
[ fill::val#3 ]
[ fill::addr#2 fill::addr#0 fill::addr#1 ]
Added variable fill::end#0 to zero page equivalence class [ fill::end#0 ]
Complete equivalence classes
[ main::ch#2 main::ch#1 ]
[ fill::size#2 ]
[ fill::val#3 ]
[ fill::addr#2 fill::addr#0 fill::addr#1 ]
[ fill::end#0 ]
Allocated zp ZP_BYTE:2 [ main::ch#2 main::ch#1 ]
Allocated zp ZP_WORD:3 [ fill::size#2 ]
Allocated zp ZP_BYTE:5 [ fill::val#3 ]
Allocated zp ZP_WORD:6 [ fill::addr#2 fill::addr#0 fill::addr#1 ]
Allocated zp ZP_WORD:8 [ fill::end#0 ]

INITIAL ASM
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 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
//SEG3 @begin
bbegin:
  jmp b4
//SEG4 @4
b4:
//SEG5 kickasm(location (const byte*) LOGO#0) {{ .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)  }}
//SEG6 [2] phi from @4 to @6 [phi:@4->@6]
b6_from_b4:
  jmp b6
//SEG7 @6
b6:
//SEG8 [3] call main 
  jsr main
//SEG9 [4] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
  jmp bend
//SEG10 @end
bend:
//SEG11 main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>LOGO)>>2&$f
    .label ch = 2
  //SEG12 [5] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
  //SEG13 [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
  //SEG14 [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0) -- _deref_pbuc1=_deref_pbuc2 
    lda BGCOL2
    sta BGCOL
  //SEG15 [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
  //SEG16 [9] phi from main to main::toD0181 [phi:main->main::toD0181]
  toD0181_from_main:
    jmp toD0181
  //SEG17 main::toD0181
  toD0181:
    jmp b9
  //SEG18 main::@9
  b9:
  //SEG19 [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
  //SEG20 [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0 -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
  //SEG21 [12] call fill 
  //SEG22 [21] phi from main::@9 to fill [phi:main::@9->fill]
  fill_from_b9:
  //SEG23 [21] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:main::@9->fill#0] -- vbuz1=vbuc1 
    lda #BLACK
    sta fill.val
  //SEG24 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@9->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG25 [21] phi (byte*) fill::addr#0 = (const byte*) SCREEN#0 [phi:main::@9->fill#2] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta fill.addr
    lda #>SCREEN
    sta fill.addr+1
    jsr fill
  //SEG26 [13] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
  b10_from_b9:
    jmp b10
  //SEG27 main::@10
  b10:
  //SEG28 [14] call fill 
  //SEG29 [21] phi from main::@10 to fill [phi:main::@10->fill]
  fill_from_b10:
  //SEG30 [21] phi (byte) fill::val#3 = (const byte) WHITE#0|(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@10->fill#0] -- vbuz1=vbuc1 
    lda #WHITE|8
    sta fill.val
  //SEG31 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@10->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG32 [21] phi (byte*) fill::addr#0 = (const byte*) COLS#0 [phi:main::@10->fill#2] -- pbuz1=pbuc1 
    lda #<COLS
    sta fill.addr
    lda #>COLS
    sta fill.addr+1
    jsr fill
  //SEG33 [15] phi from main::@10 to main::@1 [phi:main::@10->main::@1]
  b1_from_b10:
  //SEG34 [15] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@10->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta ch
    jmp b1
  //SEG35 [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  b1_from_b1:
  //SEG36 [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp b1
  //SEG37 main::@1
  b1:
  //SEG38 [16] *((const byte*) SCREEN#0 + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuz1=vbuz1 
    ldy ch
    tya
    sta SCREEN,y
  //SEG39 [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuz1=_inc_vbuz1 
    inc ch
  //SEG40 [18] if((byte) main::ch#1!=(byte/word/signed word/dword/signed dword) 240) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda ch
    cmp #$f0
    bne b1_from_b1
    jmp b3
  //SEG41 main::@3
  b3:
  //SEG42 [19] *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) ← ++ *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
  //SEG43 kickasm {{ inc $d020  }}
    inc $d020 
    jmp b3
}
//SEG44 fill
// Fill some memory with a value
// fill(word zeropage(3) size, byte zeropage(5) val)
fill: {
    .label end = 8
    .label addr = 6
    .label size = 3
    .label val = 5
  //SEG45 [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2 -- pbuz1=pbuz2_plus_vwuz3 
    lda addr
    clc
    adc size
    sta end
    lda addr+1
    adc size+1
    sta end+1
  //SEG46 [23] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1]
  b1_from_fill:
  b1_from_b1:
  //SEG47 [23] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy 
    jmp b1
  //SEG48 fill::@1
  b1:
  //SEG49 [24] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuz2 
    lda val
    ldy #0
    sta (addr),y
  //SEG50 [25] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 
    inc addr
    bne !+
    inc addr+1
  !:
  //SEG51 [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 
    lda addr+1
    cmp end+1
    bne b1_from_b1
    lda addr
    cmp end
    bne b1_from_b1
    jmp breturn
  //SEG52 fill::@return
  breturn:
  //SEG53 [27] return 
    rts
}
.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#0) ← (const byte) WHITE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0) [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:3::fill:12 [ fill::addr#0 fill::val#3 fill::end#0 ] main:3::fill:14 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ fill::val#3 ]
Statement [24] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:3::fill:12 [ fill::val#3 fill::end#0 fill::addr#2 ] main:3::fill:14 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ fill::val#3 ]
Statement [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:3::fill:12 [ fill::val#3 fill::end#0 fill::addr#1 ] main:3::fill:14 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a 
Statement [5] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0) [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0 [ ] ( main:3 [ ] ) always clobbers reg byte a 
Statement [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:3::fill:12 [ fill::addr#0 fill::val#3 fill::end#0 ] main:3::fill:14 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a 
Statement [24] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:3::fill:12 [ fill::val#3 fill::end#0 fill::addr#2 ] main:3::fill:14 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y 
Statement [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:3::fill:12 [ fill::val#3 fill::end#0 fill::addr#1 ] main:3::fill:14 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::ch#2 main::ch#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:3 [ fill::size#2 ] : zp ZP_WORD:3 , 
Potential registers zp ZP_BYTE:5 [ fill::val#3 ] : zp ZP_BYTE:5 , reg byte x , 
Potential registers zp ZP_WORD:6 [ fill::addr#2 fill::addr#0 fill::addr#1 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_WORD:8 [ fill::end#0 ] : zp ZP_WORD:8 , 

REGISTER UPLIFT SCOPES
Uplift Scope [fill] 36: zp ZP_WORD:6 [ fill::addr#2 fill::addr#0 fill::addr#1 ] 2.6: zp ZP_WORD:8 [ fill::end#0 ] 2: zp ZP_WORD:3 [ fill::size#2 ] 1.83: zp ZP_BYTE:5 [ fill::val#3 ] 
Uplift Scope [main] 38.5: zp ZP_BYTE:2 [ main::ch#2 main::ch#1 ] 
Uplift Scope [] 

Uplifting [fill] best 3924 combination zp ZP_WORD:6 [ fill::addr#2 fill::addr#0 fill::addr#1 ] zp ZP_WORD:8 [ fill::end#0 ] zp ZP_WORD:3 [ fill::size#2 ] reg byte x [ fill::val#3 ] 
Uplifting [main] best 3804 combination reg byte x [ main::ch#2 main::ch#1 ] 
Uplifting [] best 3804 combination 
Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ fill::size#2 ] ] with [ zp ZP_WORD:8 [ fill::end#0 ] ] - score: 1
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ fill::size#2 fill::end#0 ]
Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ fill::addr#2 fill::addr#0 fill::addr#1 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 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
//SEG3 @begin
bbegin:
  jmp b4
//SEG4 @4
b4:
//SEG5 kickasm(location (const byte*) LOGO#0) {{ .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)  }}
//SEG6 [2] phi from @4 to @6 [phi:@4->@6]
b6_from_b4:
  jmp b6
//SEG7 @6
b6:
//SEG8 [3] call main 
  jsr main
//SEG9 [4] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
  jmp bend
//SEG10 @end
bend:
//SEG11 main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>LOGO)>>2&$f
  //SEG12 [5] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
  //SEG13 [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
  //SEG14 [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0) -- _deref_pbuc1=_deref_pbuc2 
    lda BGCOL2
    sta BGCOL
  //SEG15 [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
  //SEG16 [9] phi from main to main::toD0181 [phi:main->main::toD0181]
  toD0181_from_main:
    jmp toD0181
  //SEG17 main::toD0181
  toD0181:
    jmp b9
  //SEG18 main::@9
  b9:
  //SEG19 [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
  //SEG20 [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0 -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
  //SEG21 [12] call fill 
  //SEG22 [21] phi from main::@9 to fill [phi:main::@9->fill]
  fill_from_b9:
  //SEG23 [21] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:main::@9->fill#0] -- vbuxx=vbuc1 
    ldx #BLACK
  //SEG24 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@9->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG25 [21] phi (byte*) fill::addr#0 = (const byte*) SCREEN#0 [phi:main::@9->fill#2] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta fill.addr
    lda #>SCREEN
    sta fill.addr+1
    jsr fill
  //SEG26 [13] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
  b10_from_b9:
    jmp b10
  //SEG27 main::@10
  b10:
  //SEG28 [14] call fill 
  //SEG29 [21] phi from main::@10 to fill [phi:main::@10->fill]
  fill_from_b10:
  //SEG30 [21] phi (byte) fill::val#3 = (const byte) WHITE#0|(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@10->fill#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
  //SEG31 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@10->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG32 [21] phi (byte*) fill::addr#0 = (const byte*) COLS#0 [phi:main::@10->fill#2] -- pbuz1=pbuc1 
    lda #<COLS
    sta fill.addr
    lda #>COLS
    sta fill.addr+1
    jsr fill
  //SEG33 [15] phi from main::@10 to main::@1 [phi:main::@10->main::@1]
  b1_from_b10:
  //SEG34 [15] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@10->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
  //SEG35 [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  b1_from_b1:
  //SEG36 [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
    jmp b1
  //SEG37 main::@1
  b1:
  //SEG38 [16] *((const byte*) SCREEN#0 + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
  //SEG39 [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG40 [18] if((byte) main::ch#1!=(byte/word/signed word/dword/signed dword) 240) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne b1_from_b1
    jmp b3
  //SEG41 main::@3
  b3:
  //SEG42 [19] *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) ← ++ *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
  //SEG43 kickasm {{ inc $d020  }}
    inc $d020 
    jmp b3
}
//SEG44 fill
// Fill some memory with a value
// fill(word zeropage(2) size, byte register(X) val)
fill: {
    .label end = 2
    .label addr = 4
    .label size = 2
  //SEG45 [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda end
    clc
    adc addr
    sta end
    lda end+1
    adc addr+1
    sta end+1
  //SEG46 [23] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1]
  b1_from_fill:
  b1_from_b1:
  //SEG47 [23] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy 
    jmp b1
  //SEG48 fill::@1
  b1:
  //SEG49 [24] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (addr),y
  //SEG50 [25] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 
    inc addr
    bne !+
    inc addr+1
  !:
  //SEG51 [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 
    lda addr+1
    cmp end+1
    bne b1_from_b1
    lda addr
    cmp end
    bne b1_from_b1
    jmp breturn
  //SEG52 fill::@return
  breturn:
  //SEG53 [27] return 
    rts
}
.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 b4
Removing instruction jmp b6
Removing instruction jmp bend
Removing instruction jmp toD0181
Removing instruction jmp b9
Removing instruction jmp b10
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda BGCOL2
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction b4:
Removing instruction b6_from_b4:
Removing instruction b6:
Removing instruction bend_from_b6:
Removing instruction toD0181_from_main:
Removing instruction toD0181:
Removing instruction b10_from_b9:
Removing instruction fill_from_b10:
Removing instruction b1_from_b1:
Removing instruction b1_from_fill:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b9:
Removing instruction fill_from_b9:
Removing instruction b10:
Removing instruction b1_from_b10:
Removing instruction breturn:
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 bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @4
(label) @6
(label) @begin
(label) @end
(byte*) BGCOL
(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281
(byte*) BGCOL1
(byte*) BGCOL2
(const byte*) BGCOL2#0 BGCOL2 = ((byte*))(word/dword/signed dword) 53282
(byte*) BGCOL3
(const byte*) BGCOL3#0 BGCOL3 = ((byte*))(word/dword/signed dword) 53283
(byte*) BGCOL4
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) BLUE
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280
(byte) BROWN
(byte*) CHARGEN
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(const byte*) COLS#0 COLS = ((byte*))(word/dword/signed dword) 55296
(byte) CYAN
(byte*) D011
(byte*) D016
(const byte*) D016#0 D016 = ((byte*))(word/dword/signed dword) 53270
(byte*) D018
(const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) 53272
(byte) DARK_GREY
(const byte) DARK_GREY#0 DARK_GREY = (byte/signed byte/word/signed word/dword/signed dword) 11
(byte) GREEN
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte*) LOGO
(const byte*) LOGO#0 LOGO = ((byte*))(word/signed word/dword/signed dword) 8192
(byte) ORANGE
(byte) PINK
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(byte) RED
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(const byte) VIC_CSEL#0 VIC_CSEL = (byte/signed byte/word/signed word/dword/signed dword) 8
(byte) VIC_DEN
(byte) VIC_ECM
(byte) VIC_MCM
(const byte) VIC_MCM#0 VIC_MCM = (byte/signed byte/word/signed word/dword/signed dword) 16
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(byte) VIC_RST8
(byte) WHITE
(const byte) WHITE#0 WHITE = (byte/signed byte/word/signed word/dword/signed dword) 1
(byte) YELLOW
(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val)
(label) fill::@1
(label) fill::@return
(byte*) fill::addr
(byte*) fill::addr#0 addr zp ZP_WORD:4 2.0
(byte*) fill::addr#1 addr zp ZP_WORD:4 16.5
(byte*) fill::addr#2 addr zp ZP_WORD:4 17.5
(byte*) fill::end
(byte*) fill::end#0 end zp ZP_WORD:2 2.6
(word) fill::size
(word) fill::size#2 size zp ZP_WORD:2 2.0
(byte*) fill::start
(byte) fill::val
(byte) fill::val#3 reg byte x 1.8333333333333333
(void()) main()
(label) main::@1
(label) main::@10
(label) main::@3
(label) main::@9
(byte) main::ch
(byte) main::ch#1 reg byte x 16.5
(byte) main::ch#2 reg byte x 22.0
(label) main::toD0181
(word~) main::toD0181_$0
(word~) main::toD0181_$1
(word~) main::toD0181_$2
(byte~) main::toD0181_$3
(word~) main::toD0181_$4
(byte~) main::toD0181_$5
(byte~) main::toD0181_$6
(byte~) main::toD0181_$7
(byte~) main::toD0181_$8
(byte*) main::toD0181_gfx
(byte) main::toD0181_return
(const byte) main::toD0181_return#0 toD0181_return = >((word))(const byte*) SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) LOGO#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15
(byte*) main::toD0181_screen

reg byte x [ main::ch#2 main::ch#1 ]
zp ZP_WORD:2 [ fill::size#2 fill::end#0 ]
reg byte x [ fill::val#3 ]
zp ZP_WORD:4 [ fill::addr#2 fill::addr#0 fill::addr#1 ]


FINAL ASSEMBLER
Score: 3572

//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 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
//SEG3 @begin
//SEG4 @4
//SEG5 kickasm(location (const byte*) LOGO#0) {{ .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)  }}
//SEG6 [2] phi from @4 to @6 [phi:@4->@6]
//SEG7 @6
//SEG8 [3] call main 
//SEG9 [4] phi from @6 to @end [phi:@6->@end]
//SEG10 @end
//SEG11 main
main: {
    .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>LOGO)>>2&$f
  //SEG12 [5] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta BORDERCOL
  //SEG13 [6] *((const byte*) BGCOL2#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 
    lda #DARK_GREY
    sta BGCOL2
  //SEG14 [7] *((const byte*) BGCOL#0) ← *((const byte*) BGCOL2#0) -- _deref_pbuc1=_deref_pbuc2 
    sta BGCOL
  //SEG15 [8] *((const byte*) BGCOL3#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BGCOL3
  //SEG16 [9] phi from main to main::toD0181 [phi:main->main::toD0181]
  //SEG17 main::toD0181
  //SEG18 main::@9
  //SEG19 [10] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
  //SEG20 [11] *((const byte*) D016#0) ← (const byte) VIC_MCM#0|(const byte) VIC_CSEL#0 -- _deref_pbuc1=vbuc2 
    lda #VIC_MCM|VIC_CSEL
    sta D016
  //SEG21 [12] call fill 
  //SEG22 [21] phi from main::@9 to fill [phi:main::@9->fill]
  //SEG23 [21] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:main::@9->fill#0] -- vbuxx=vbuc1 
    ldx #BLACK
  //SEG24 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@9->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG25 [21] phi (byte*) fill::addr#0 = (const byte*) SCREEN#0 [phi:main::@9->fill#2] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta fill.addr
    lda #>SCREEN
    sta fill.addr+1
    jsr fill
  //SEG26 [13] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
  //SEG27 main::@10
  //SEG28 [14] call fill 
  //SEG29 [21] phi from main::@10 to fill [phi:main::@10->fill]
  //SEG30 [21] phi (byte) fill::val#3 = (const byte) WHITE#0|(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@10->fill#0] -- vbuxx=vbuc1 
    ldx #WHITE|8
  //SEG31 [21] phi (word) fill::size#2 = (byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 25 [phi:main::@10->fill#1] -- vwuz1=vwuc1 
    lda #<$28*$19
    sta fill.size
    lda #>$28*$19
    sta fill.size+1
  //SEG32 [21] phi (byte*) fill::addr#0 = (const byte*) COLS#0 [phi:main::@10->fill#2] -- pbuz1=pbuc1 
    lda #<COLS
    sta fill.addr
    lda #>COLS
    sta fill.addr+1
    jsr fill
  //SEG33 [15] phi from main::@10 to main::@1 [phi:main::@10->main::@1]
  //SEG34 [15] phi (byte) main::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@10->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG35 [15] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
  //SEG36 [15] phi (byte) main::ch#2 = (byte) main::ch#1 [phi:main::@1->main::@1#0] -- register_copy 
  //SEG37 main::@1
  b1:
  //SEG38 [16] *((const byte*) SCREEN#0 + (byte) main::ch#2) ← (byte) main::ch#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta SCREEN,x
  //SEG39 [17] (byte) main::ch#1 ← ++ (byte) main::ch#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG40 [18] if((byte) main::ch#1!=(byte/word/signed word/dword/signed dword) 240) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$f0
    bne b1
  //SEG41 main::@3
  b3:
  //SEG42 [19] *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) ← ++ *((const byte*) SCREEN#0+(word/signed word/dword/signed dword) 999) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc SCREEN+$3e7
  //SEG43 kickasm {{ inc $d020  }}
    inc $d020 
    jmp b3
}
//SEG44 fill
// Fill some memory with a value
// fill(word zeropage(2) size, byte register(X) val)
fill: {
    .label end = 2
    .label addr = 4
    .label size = 2
  //SEG45 [22] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word) fill::size#2 -- pbuz1=pbuz2_plus_vwuz1 
    lda end
    clc
    adc addr
    sta end
    lda end+1
    adc addr+1
    sta end+1
  //SEG46 [23] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1]
  //SEG47 [23] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy 
  //SEG48 fill::@1
  b1:
  //SEG49 [24] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (addr),y
  //SEG50 [25] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 
    inc addr
    bne !+
    inc addr+1
  !:
  //SEG51 [26] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 
    lda addr+1
    cmp end+1
    bne b1
    lda addr
    cmp end
    bne b1
  //SEG52 fill::@return
  //SEG53 [27] return 
    rts
}
.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)


