Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
Inlined call init::$3 = call toD018(screen, charset)
Inlined call call __init
Eliminating unused variable with no statement memset::$2
Eliminating unused variable with no statement main::$3
Eliminating unused variable with no statement draw_block::$1
Eliminating unused variable with no statement draw_block::$3

CONTROL FLOW GRAPH SSA

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from init::@2 init::@3
  memset::c#5 = phi( init::@2/memset::c#0, init::@3/memset::c#1 )
  memset::str#4 = phi( init::@2/memset::str#0, init::@3/memset::str#1 )
  memset::num#2 = phi( init::@2/memset::num#0, init::@3/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

unsigned int mul8u(char a , char b)
mul8u: scope:[mul8u]  from draw_block
  mul8u::a#5 = phi( draw_block/mul8u::a#1 )
  mul8u::b#1 = phi( draw_block/mul8u::b#0 )
  mul8u::res#0 = 0
  mul8u::mb#0 = (unsigned int)mul8u::b#1
  to:mul8u::@1
mul8u::@1: scope:[mul8u]  from mul8u mul8u::@4
  mul8u::mb#5 = phi( mul8u/mul8u::mb#0, mul8u::@4/mul8u::mb#1 )
  mul8u::res#4 = phi( mul8u/mul8u::res#0, mul8u::@4/mul8u::res#6 )
  mul8u::a#2 = phi( mul8u/mul8u::a#5, mul8u::@4/mul8u::a#0 )
  mul8u::$0 = mul8u::a#2 != 0
  if(mul8u::$0) goto mul8u::@2
  to:mul8u::@3
mul8u::@2: scope:[mul8u]  from mul8u::@1
  mul8u::res#5 = phi( mul8u::@1/mul8u::res#4 )
  mul8u::mb#4 = phi( mul8u::@1/mul8u::mb#5 )
  mul8u::a#3 = phi( mul8u::@1/mul8u::a#2 )
  mul8u::$1 = mul8u::a#3 & 1
  mul8u::$2 = mul8u::$1 != 0
  mul8u::$3 = ! mul8u::$2
  if(mul8u::$3) goto mul8u::@4
  to:mul8u::@5
mul8u::@3: scope:[mul8u]  from mul8u::@1
  mul8u::res#2 = phi( mul8u::@1/mul8u::res#4 )
  mul8u::return#0 = mul8u::res#2
  to:mul8u::@return
mul8u::@4: scope:[mul8u]  from mul8u::@2 mul8u::@5
  mul8u::res#6 = phi( mul8u::@2/mul8u::res#5, mul8u::@5/mul8u::res#1 )
  mul8u::mb#2 = phi( mul8u::@2/mul8u::mb#4, mul8u::@5/mul8u::mb#3 )
  mul8u::a#4 = phi( mul8u::@2/mul8u::a#3, mul8u::@5/mul8u::a#6 )
  mul8u::$5 = mul8u::a#4 >> 1
  mul8u::a#0 = mul8u::$5
  mul8u::$6 = mul8u::mb#2 << 1
  mul8u::mb#1 = mul8u::$6
  to:mul8u::@1
mul8u::@5: scope:[mul8u]  from mul8u::@2
  mul8u::a#6 = phi( mul8u::@2/mul8u::a#3 )
  mul8u::mb#3 = phi( mul8u::@2/mul8u::mb#4 )
  mul8u::res#3 = phi( mul8u::@2/mul8u::res#5 )
  mul8u::$4 = mul8u::res#3 + mul8u::mb#3
  mul8u::res#1 = mul8u::$4
  to:mul8u::@4
mul8u::@return: scope:[mul8u]  from mul8u::@3
  mul8u::return#3 = phi( mul8u::@3/mul8u::return#0 )
  mul8u::return#1 = mul8u::return#3
  return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  call init
  to:main::@7
main::@7: scope:[main]  from main
  main::x#0 = 0
  to:main::@1
main::@1: scope:[main]  from main::@5 main::@7
  main::x#2 = phi( main::@5/main::x#1, main::@7/main::x#0 )
  main::$1 = main::x#2 < $10
  if(main::$1) goto main::@2
  to:main::@6
main::@2: scope:[main]  from main::@1
  main::x#6 = phi( main::@1/main::x#2 )
  main::y#0 = 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@8
  main::x#5 = phi( main::@2/main::x#6, main::@8/main::x#7 )
  main::y#2 = phi( main::@2/main::y#0, main::@8/main::y#1 )
  main::$2 = main::y#2 < 9
  if(main::$2) goto main::@4
  to:main::@5
main::@4: scope:[main]  from main::@3
  main::y#3 = phi( main::@3/main::y#2 )
  main::x#3 = phi( main::@3/main::x#5 )
  main::z#0 = main::x#3 + main::y#3
  main::tile#0 = level_address[main::z#0]
  draw_block::tileno#0 = main::tile#0
  draw_block::x#0 = main::x#3
  draw_block::y#0 = main::y#3
  draw_block::color#0 = YELLOW
  call draw_block
  to:main::@8
main::@8: scope:[main]  from main::@4
  main::x#7 = phi( main::@4/main::x#3 )
  main::y#4 = phi( main::@4/main::y#3 )
  main::y#1 = ++ main::y#4
  to:main::@3
main::@5: scope:[main]  from main::@3
  main::x#4 = phi( main::@3/main::x#5 )
  main::x#1 = ++ main::x#4
  to:main::@1
main::@6: scope:[main]  from main::@1 main::@6
  if(true) goto main::@6
  to:main::@return
main::@return: scope:[main]  from main::@6
  return 
  to:@return

void init()
init: scope:[init]  from main
  call init_sprites
  to:init::@2
init::@2: scope:[init]  from init
  memset::str#0 = (void *)screen
  memset::c#0 = 0
  memset::num#0 = $3e8
  call memset
  memset::return#2 = memset::return#1
  to:init::@3
init::@3: scope:[init]  from init::@2
  memset::str#1 = (void *)colors
  memset::c#1 = BLACK
  memset::num#1 = $3e8
  call memset
  memset::return#3 = memset::return#1
  to:init::@4
init::@4: scope:[init]  from init::@3
  init::toD0181_screen#0 = screen
  init::toD0181_gfx#0 = charset
  to:init::toD0181
init::toD0181: scope:[init]  from init::@4
  init::toD0181_gfx#1 = phi( init::@4/init::toD0181_gfx#0 )
  init::toD0181_screen#1 = phi( init::@4/init::toD0181_screen#0 )
  init::toD0181_$7 = (unsigned int)init::toD0181_screen#1
  init::toD0181_$0 = init::toD0181_$7 & $3fff
  init::toD0181_$1 = init::toD0181_$0 * 4
  init::toD0181_$2 = byte1  init::toD0181_$1
  init::toD0181_$3 = byte1  (unsigned int)init::toD0181_gfx#1
  init::toD0181_$4 = init::toD0181_$3 / 4
  init::toD0181_$5 = init::toD0181_$4 & $f
  init::toD0181_$6 = init::toD0181_$2 | init::toD0181_$5
  init::toD0181_return#0 = init::toD0181_$6
  to:init::toD0181_@return
init::toD0181_@return: scope:[init]  from init::toD0181
  init::toD0181_return#2 = phi( init::toD0181/init::toD0181_return#0 )
  init::toD0181_return#1 = init::toD0181_return#2
  to:init::@1
init::@1: scope:[init]  from init::toD0181_@return
  init::toD0181_return#3 = phi( init::toD0181_@return/init::toD0181_return#1 )
  init::$3 = init::toD0181_return#3
  *D018 = init::$3
  asm { lda#$5b sta$d011  }
  *BORDER_COLOR = BLACK
  *BG_COLOR = BLACK
  *BG_COLOR1 = RED
  *BG_COLOR2 = BLUE
  *BG_COLOR3 = GREEN
  to:init::@return
init::@return: scope:[init]  from init::@1
  return 
  to:@return

void init_sprites()
init_sprites: scope:[init_sprites]  from init
  *SPRITES_ENABLE = 1
  *SPRITES_EXPAND_X = 0
  *SPRITES_EXPAND_Y = 0
  *SPRITES_XMSB = 0
  *SPRITES_COLOR = WHITE
  *SPRITES_MC = 0
  to:init_sprites::@return
init_sprites::@return: scope:[init_sprites]  from init_sprites
  return 
  to:@return

void draw_block(char tileno , char x , char y , char color)
draw_block: scope:[draw_block]  from main::@4
  draw_block::y#2 = phi( main::@4/draw_block::y#0 )
  draw_block::x#1 = phi( main::@4/draw_block::x#0 )
  draw_block::tileno#2 = phi( main::@4/draw_block::tileno#0 )
  draw_block::$0 = draw_block::tileno#2 << 2
  draw_block::tileno#1 = draw_block::$0
  draw_block::x1#0 = draw_block::x#1 << 1
  draw_block::$2 = draw_block::y#2 << 1
  draw_block::y#1 = draw_block::$2
  mul8u::a#1 = draw_block::y#1
  mul8u::b#0 = $28
  call mul8u
  mul8u::return#2 = mul8u::return#1
  to:draw_block::@1
draw_block::@1: scope:[draw_block]  from draw_block
  draw_block::tileno#3 = phi( draw_block/draw_block::tileno#1 )
  draw_block::x1#1 = phi( draw_block/draw_block::x1#0 )
  mul8u::return#4 = phi( draw_block/mul8u::return#2 )
  draw_block::z#0 = mul8u::return#4
  draw_block::$4 = draw_block::z#0 + draw_block::x1#1
  draw_block::z#1 = draw_block::$4
  draw_block::drawtile#0 = tileset[draw_block::tileno#3]
  screen[draw_block::z#1] = draw_block::drawtile#0
  colors[draw_block::z#1] = YELLOW
  draw_block::$5 = draw_block::z#1 + 1
  screen[draw_block::$5] = 1
  draw_block::$6 = draw_block::z#1 + 1
  colors[draw_block::$6] = YELLOW
  draw_block::$7 = draw_block::z#1 + $28
  screen[draw_block::$7] = 2
  draw_block::$8 = draw_block::z#1 + $28
  colors[draw_block::$8] = YELLOW
  draw_block::$9 = draw_block::z#1 + $29
  screen[draw_block::$9] = 3
  draw_block::$10 = draw_block::z#1 + $29
  colors[draw_block::$10] = YELLOW
  to:draw_block::@return
draw_block::@return: scope:[draw_block]  from draw_block::@1
  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 char * const BG_COLOR = (char *)$d021
__constant char * const BG_COLOR1 = (char *)$d022
__constant char * const BG_COLOR2 = (char *)$d023
__constant char * const BG_COLOR3 = (char *)$d024
__constant const char BLACK = 0
__constant const char BLUE = 6
__constant char * const BORDER_COLOR = (char *)$d020
__constant char * const D018 = (char *)$d018
__constant const char GREEN = 5
__constant const char RED = 2
__constant char * const SPRITES_COLOR = (char *)$d027
__constant char * const SPRITES_ENABLE = (char *)$d015
__constant char * const SPRITES_EXPAND_X = (char *)$d01d
__constant char * const SPRITES_EXPAND_Y = (char *)$d017
__constant char * const SPRITES_MC = (char *)$d01c
__constant char * const SPRITES_XMSB = (char *)$d010
__constant const char WHITE = 1
__constant const char YELLOW = 7
void __start()
__constant char * const charset = (char *)$2000
__constant char * const colors = (char *)$d800
void draw_block(char tileno , char x , char y , char color)
char draw_block::$0
number draw_block::$10
char draw_block::$2
unsigned int draw_block::$4
number draw_block::$5
number draw_block::$6
number draw_block::$7
number draw_block::$8
number draw_block::$9
char draw_block::color
char draw_block::color#0
char draw_block::drawtile
char draw_block::drawtile#0
char draw_block::tileno
char draw_block::tileno#0
char draw_block::tileno#1
char draw_block::tileno#2
char draw_block::tileno#3
char draw_block::x
char draw_block::x#0
char draw_block::x#1
unsigned int draw_block::x1
unsigned int draw_block::x1#0
unsigned int draw_block::x1#1
char draw_block::y
char draw_block::y#0
char draw_block::y#1
char draw_block::y#2
unsigned int draw_block::z
unsigned int draw_block::z#0
unsigned int draw_block::z#1
void init()
char init::$3
number init::toD0181_$0
number init::toD0181_$1
char init::toD0181_$2
char init::toD0181_$3
number init::toD0181_$4
number init::toD0181_$5
number init::toD0181_$6
unsigned int init::toD0181_$7
char *init::toD0181_gfx
char *init::toD0181_gfx#0
char *init::toD0181_gfx#1
char init::toD0181_return
char init::toD0181_return#0
char init::toD0181_return#1
char init::toD0181_return#2
char init::toD0181_return#3
char *init::toD0181_screen
char *init::toD0181_screen#0
char *init::toD0181_screen#1
void init_sprites()
__constant char * const level_address = (char *)$3000
void main()
bool main::$1
bool main::$2
char main::tile
char main::tile#0
char main::x
char main::x#0
char main::x#1
char main::x#2
char main::x#3
char main::x#4
char main::x#5
char main::x#6
char main::x#7
char main::y
char main::y#0
char main::y#1
char main::y#2
char main::y#3
char main::y#4
char main::z
char main::z#0
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
unsigned int mul8u(char a , char b)
bool mul8u::$0
number mul8u::$1
bool mul8u::$2
bool mul8u::$3
unsigned int mul8u::$4
char mul8u::$5
unsigned int mul8u::$6
char mul8u::a
char mul8u::a#0
char mul8u::a#1
char mul8u::a#2
char mul8u::a#3
char mul8u::a#4
char mul8u::a#5
char mul8u::a#6
char mul8u::b
char mul8u::b#0
char mul8u::b#1
unsigned int mul8u::mb
unsigned int mul8u::mb#0
unsigned int mul8u::mb#1
unsigned int mul8u::mb#2
unsigned int mul8u::mb#3
unsigned int mul8u::mb#4
unsigned int mul8u::mb#5
unsigned int mul8u::res
unsigned int mul8u::res#0
unsigned int mul8u::res#1
unsigned int mul8u::res#2
unsigned int mul8u::res#3
unsigned int mul8u::res#4
unsigned int mul8u::res#5
unsigned int mul8u::res#6
unsigned int mul8u::return
unsigned int mul8u::return#0
unsigned int mul8u::return#1
unsigned int mul8u::return#2
unsigned int mul8u::return#3
unsigned int mul8u::return#4
__constant char * const screen = (char *)$400
__constant char * const tileset = (char *)$2800

Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0
Adding number conversion cast (unumber) 0 in mul8u::$0 = mul8u::a#2 != 0
Adding number conversion cast (unumber) 1 in mul8u::$1 = mul8u::a#3 & 1
Adding number conversion cast (unumber) mul8u::$1 in mul8u::$1 = mul8u::a#3 & (unumber)1
Adding number conversion cast (unumber) 0 in mul8u::$2 = mul8u::$1 != 0
Adding number conversion cast (unumber) 1 in mul8u::$5 = mul8u::a#4 >> 1
Adding number conversion cast (unumber) 1 in mul8u::$6 = mul8u::mb#2 << 1
Adding number conversion cast (unumber) $10 in main::$1 = main::x#2 < $10
Adding number conversion cast (unumber) 9 in main::$2 = main::y#2 < 9
Adding number conversion cast (unumber) 0 in memset::c#0 = 0
Adding number conversion cast (unumber) $3e8 in memset::num#0 = $3e8
Adding number conversion cast (unumber) $3e8 in memset::num#1 = $3e8
Adding number conversion cast (unumber) $3fff in init::toD0181_$0 = init::toD0181_$7 & $3fff
Adding number conversion cast (unumber) init::toD0181_$0 in init::toD0181_$0 = init::toD0181_$7 & (unumber)$3fff
Adding number conversion cast (unumber) 4 in init::toD0181_$1 = init::toD0181_$0 * 4
Adding number conversion cast (unumber) init::toD0181_$1 in init::toD0181_$1 = init::toD0181_$0 * (unumber)4
Adding number conversion cast (unumber) 4 in init::toD0181_$4 = init::toD0181_$3 / 4
Adding number conversion cast (unumber) init::toD0181_$4 in init::toD0181_$4 = init::toD0181_$3 / (unumber)4
Adding number conversion cast (unumber) $f in init::toD0181_$5 = init::toD0181_$4 & $f
Adding number conversion cast (unumber) init::toD0181_$5 in init::toD0181_$5 = init::toD0181_$4 & (unumber)$f
Adding number conversion cast (unumber) init::toD0181_$6 in init::toD0181_$6 = init::toD0181_$2 | init::toD0181_$5
Adding number conversion cast (unumber) 1 in *SPRITES_ENABLE = 1
Adding number conversion cast (unumber) 0 in *SPRITES_EXPAND_X = 0
Adding number conversion cast (unumber) 0 in *SPRITES_EXPAND_Y = 0
Adding number conversion cast (unumber) 0 in *SPRITES_XMSB = 0
Adding number conversion cast (unumber) 0 in *SPRITES_MC = 0
Adding number conversion cast (unumber) 2 in draw_block::$0 = draw_block::tileno#2 << 2
Adding number conversion cast (unumber) 1 in draw_block::x1#0 = draw_block::x#1 << 1
Adding number conversion cast (unumber) 1 in draw_block::$2 = draw_block::y#2 << 1
Adding number conversion cast (unumber) $28 in mul8u::b#0 = $28
Adding number conversion cast (unumber) 1 in draw_block::$5 = draw_block::z#1 + 1
Adding number conversion cast (unumber) draw_block::$5 in draw_block::$5 = draw_block::z#1 + (unumber)1
Adding number conversion cast (unumber) 1 in screen[draw_block::$5] = 1
Adding number conversion cast (unumber) 1 in draw_block::$6 = draw_block::z#1 + 1
Adding number conversion cast (unumber) draw_block::$6 in draw_block::$6 = draw_block::z#1 + (unumber)1
Adding number conversion cast (unumber) $28 in draw_block::$7 = draw_block::z#1 + $28
Adding number conversion cast (unumber) draw_block::$7 in draw_block::$7 = draw_block::z#1 + (unumber)$28
Adding number conversion cast (unumber) 2 in screen[draw_block::$7] = 2
Adding number conversion cast (unumber) $28 in draw_block::$8 = draw_block::z#1 + $28
Adding number conversion cast (unumber) draw_block::$8 in draw_block::$8 = draw_block::z#1 + (unumber)$28
Adding number conversion cast (unumber) $29 in draw_block::$9 = draw_block::z#1 + $29
Adding number conversion cast (unumber) draw_block::$9 in draw_block::$9 = draw_block::z#1 + (unumber)$29
Adding number conversion cast (unumber) 3 in screen[draw_block::$9] = 3
Adding number conversion cast (unumber) $29 in draw_block::$10 = draw_block::z#1 + $29
Adding number conversion cast (unumber) draw_block::$10 in draw_block::$10 = draw_block::z#1 + (unumber)$29
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast memset::dst#0 = (char *)memset::str#3
Inlining cast memset::c#0 = (unumber)0
Inlining cast memset::num#0 = (unumber)$3e8
Inlining cast memset::num#1 = (unumber)$3e8
Inlining cast *SPRITES_ENABLE = (unumber)1
Inlining cast *SPRITES_EXPAND_X = (unumber)0
Inlining cast *SPRITES_EXPAND_Y = (unumber)0
Inlining cast *SPRITES_XMSB = (unumber)0
Inlining cast *SPRITES_MC = (unumber)0
Inlining cast mul8u::b#0 = (unumber)$28
Inlining cast screen[draw_block::$5] = (unumber)1
Inlining cast screen[draw_block::$7] = (unumber)2
Inlining cast screen[draw_block::$9] = (unumber)3
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 53264
Simplifying constant pointer cast (char *) 53287
Simplifying constant pointer cast (char *) 53269
Simplifying constant pointer cast (char *) 53271
Simplifying constant pointer cast (char *) 53276
Simplifying constant pointer cast (char *) 53277
Simplifying constant pointer cast (char *) 53280
Simplifying constant pointer cast (char *) 53281
Simplifying constant pointer cast (char *) 53282
Simplifying constant pointer cast (char *) 53283
Simplifying constant pointer cast (char *) 53284
Simplifying constant pointer cast (char *) 53272
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 8192
Simplifying constant pointer cast (char *) 10240
Simplifying constant pointer cast (char *) 55296
Simplifying constant pointer cast (char *) 12288
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $10
Simplifying constant integer cast 9
Simplifying constant integer cast 0
Simplifying constant integer cast $3e8
Simplifying constant integer cast $3e8
Simplifying constant integer cast $3fff
Simplifying constant integer cast 4
Simplifying constant integer cast 4
Simplifying constant integer cast $f
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 2
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $28
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $28
Simplifying constant integer cast 2
Simplifying constant integer cast $28
Simplifying constant integer cast $29
Simplifying constant integer cast 3
Simplifying constant integer cast $29
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $10
Finalized unsigned number type (char) 9
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $3e8
Finalized unsigned number type (unsigned int) $3e8
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) 1
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) $29
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) $29
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in mul8u::$1 = mul8u::a#3 & 1
Inferred type updated to unsigned int in init::toD0181_$0 = init::toD0181_$7 & $3fff
Inferred type updated to unsigned int in init::toD0181_$1 = init::toD0181_$0 * 4
Inferred type updated to char in init::toD0181_$4 = init::toD0181_$3 / 4
Inferred type updated to char in init::toD0181_$5 = init::toD0181_$4 & $f
Inferred type updated to char in init::toD0181_$6 = init::toD0181_$2 | init::toD0181_$5
Inferred type updated to unsigned int in draw_block::$5 = draw_block::z#1 + 1
Inferred type updated to unsigned int in draw_block::$6 = draw_block::z#1 + 1
Inferred type updated to unsigned int in draw_block::$7 = draw_block::z#1 + $28
Inferred type updated to unsigned int in draw_block::$8 = draw_block::z#1 + $28
Inferred type updated to unsigned int in draw_block::$9 = draw_block::z#1 + $29
Inferred type updated to unsigned int in draw_block::$10 = draw_block::z#1 + $29
Inversing boolean not [2] memset::$1 = memset::num#2 <= 0 from [1] memset::$0 = memset::num#2 > 0
Inversing boolean not [28] mul8u::$3 = mul8u::$1 == 0 from [27] mul8u::$2 = mul8u::$1 != 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 mul8u::a#2 = mul8u::a#3 mul8u::a#6 
Alias mul8u::mb#3 = mul8u::mb#4 mul8u::mb#5 
Alias mul8u::res#2 = mul8u::res#5 mul8u::res#4 mul8u::return#0 mul8u::res#3 mul8u::return#3 mul8u::return#1 
Alias mul8u::a#0 = mul8u::$5 
Alias mul8u::mb#1 = mul8u::$6 
Alias mul8u::res#1 = mul8u::$4 
Alias main::x#2 = main::x#6 
Alias main::x#3 = main::x#5 main::x#7 main::x#4 
Alias main::y#2 = main::y#3 main::y#4 
Alias init::toD0181_screen#0 = init::toD0181_screen#1 
Alias init::toD0181_gfx#0 = init::toD0181_gfx#1 
Alias init::toD0181_return#0 = init::toD0181_$6 init::toD0181_return#2 init::toD0181_return#1 init::toD0181_return#3 init::$3 
Alias draw_block::tileno#1 = draw_block::$0 draw_block::tileno#3 
Alias draw_block::y#1 = draw_block::$2 
Alias mul8u::return#2 = mul8u::return#4 
Alias draw_block::x1#0 = draw_block::x1#1 
Alias draw_block::z#1 = draw_block::$4 
Successful SSA optimization Pass2AliasElimination
Alias mul8u::a#2 = mul8u::a#4 
Alias mul8u::mb#2 = mul8u::mb#3 
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
Identical Phi Values mul8u::b#1 mul8u::b#0
Identical Phi Values mul8u::a#5 mul8u::a#1
Identical Phi Values main::x#3 main::x#2
Identical Phi Values draw_block::tileno#2 draw_block::tileno#0
Identical Phi Values draw_block::x#1 draw_block::x#0
Identical Phi Values draw_block::y#2 draw_block::y#0
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values memset::return#0 memset::str#3
Successful SSA optimization Pass2IdenticalPhiElimination
Identified duplicate assignment right side [128] draw_block::$6 = draw_block::z#1 + 1
Identified duplicate assignment right side [132] draw_block::$8 = draw_block::z#1 + $28
Identified duplicate assignment right side [136] draw_block::$10 = draw_block::z#1 + $29
Successful SSA optimization Pass2DuplicateRValueIdentification
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 mul8u::$0 [18] if(mul8u::a#2!=0) goto mul8u::@2
Simple Condition mul8u::$3 [21] if(mul8u::$1==0) goto mul8u::@4
Simple Condition main::$1 [31] if(main::x#2<$10) goto main::@2
Simple Condition main::$2 [35] if(main::y#2<9) goto main::@4
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant mul8u::res#0 = 0
Constant main::x#0 = 0
Constant main::y#0 = 0
Constant draw_block::color#0 = YELLOW
Constant memset::str#0 = (void *)screen
Constant memset::c#0 = 0
Constant memset::num#0 = $3e8
Constant memset::str#1 = (void *)colors
Constant memset::c#1 = BLACK
Constant memset::num#1 = $3e8
Constant init::toD0181_screen#0 = screen
Constant init::toD0181_gfx#0 = charset
Constant mul8u::b#0 = $28
Successful SSA optimization Pass2ConstantIdentification
Constant mul8u::mb#0 = (unsigned int)mul8u::b#0
Constant init::toD0181_$7 = (unsigned int)init::toD0181_screen#0
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (unsigned int)init::toD0181_gfx#0 in [64] init::toD0181_$3 = byte1  (unsigned int)init::toD0181_gfx#0
Successful SSA optimization Pass2ConstantValues
if() condition always true - replacing block destination [45] if(true) goto main::@6
Successful SSA optimization Pass2ConstantIfs
De-inlining pointer[w] to *(pointer+w)   [94] screen[draw_block::z#1] = draw_block::drawtile#0
De-inlining pointer[w] to *(pointer+w)   [95] colors[draw_block::z#1] = YELLOW
De-inlining pointer[w] to *(pointer+w)   [97] screen[draw_block::$5] = 1
De-inlining pointer[w] to *(pointer+w)   [99] colors[draw_block::$6] = YELLOW
De-inlining pointer[w] to *(pointer+w)   [101] screen[draw_block::$7] = 2
De-inlining pointer[w] to *(pointer+w)   [103] colors[draw_block::$8] = YELLOW
De-inlining pointer[w] to *(pointer+w)   [105] screen[draw_block::$9] = 3
De-inlining pointer[w] to *(pointer+w)   [107] colors[draw_block::$10] = YELLOW
Successful SSA optimization Pass2DeInlineWordDerefIdx
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused variable memset::return#2 and assignment [34] memset::return#2 = memset::str#3
Eliminating unused variable memset::return#3 and assignment [36] memset::return#3 = memset::str#3
Eliminating unused constant draw_block::color#0
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
Alias draw_block::$6 = draw_block::$5 
Alias draw_block::$8 = draw_block::$7 
Alias draw_block::$10 = draw_block::$9 
Successful SSA optimization Pass2AliasElimination
Constant right-side identified [35] init::toD0181_$0 = init::toD0181_$7 & $3fff
Constant right-side identified [38] init::toD0181_$3 = byte1  (unsigned int)init::toD0181_gfx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant init::toD0181_$0 = init::toD0181_$7&$3fff
Constant init::toD0181_$3 = byte1 (unsigned int)init::toD0181_gfx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [35] init::toD0181_$1 = init::toD0181_$0 * 4
Constant right-side identified [37] init::toD0181_$4 = init::toD0181_$3 / 4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant init::toD0181_$1 = init::toD0181_$0*4
Constant init::toD0181_$4 = init::toD0181_$3/4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [35] init::toD0181_$2 = byte1  init::toD0181_$1
Constant right-side identified [36] init::toD0181_$5 = init::toD0181_$4 & $f
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant init::toD0181_$2 = byte1 init::toD0181_$1
Constant init::toD0181_$5 = init::toD0181_$4&$f
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [35] init::toD0181_return#0 = init::toD0181_$2 | init::toD0181_$5
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant init::toD0181_return#0 = init::toD0181_$2|init::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 mul8u::res#0
Inlining constant with var siblings mul8u::mb#0
Inlining constant with var siblings main::x#0
Inlining constant with var siblings main::y#0
Constant inlined init::toD0181_gfx#0 = charset
Constant inlined init::toD0181_$2 = byte1 (unsigned int)screen&$3fff*4
Constant inlined init::toD0181_$3 = byte1 (unsigned int)charset
Constant inlined memset::str#1 = (void *)colors
Constant inlined init::toD0181_$0 = (unsigned int)screen&$3fff
Constant inlined memset::str#0 = (void *)screen
Constant inlined init::toD0181_$1 = (unsigned int)screen&$3fff*4
Constant inlined mul8u::mb#0 = (unsigned int)mul8u::b#0
Constant inlined init::toD0181_$7 = (unsigned int)screen
Constant inlined init::toD0181_$4 = byte1 (unsigned int)charset/4
Constant inlined init::toD0181_$5 = byte1 (unsigned int)charset/4&$f
Constant inlined memset::num#1 = $3e8
Constant inlined main::x#0 = 0
Constant inlined memset::num#0 = $3e8
Constant inlined main::y#0 = 0
Constant inlined mul8u::res#0 = 0
Constant inlined memset::c#0 = 0
Constant inlined memset::c#1 = BLACK
Constant inlined init::toD0181_screen#0 = screen
Successful SSA optimization Pass2ConstantInlining
Identical Phi Values memset::num#2 $3e8
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always false - eliminating [1] if($3e8<=0) goto memset::@1
Successful SSA optimization Pass2ConstantIfs
Added new block during phi lifting mul8u::@6(between mul8u::@2 and mul8u::@4)
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of init
Adding NOP phi() at start of init::@2
Adding NOP phi() at start of init::@3
Adding NOP phi() at start of init::@4
Adding NOP phi() at start of init::toD0181
Adding NOP phi() at start of init::toD0181_@return
Adding NOP phi() at start of memset::@1
Adding NOP phi() at start of mul8u::@3
CALL GRAPH
Calls in [main] to init:1 draw_block:16 
Calls in [init] to init_sprites:20 memset:22 memset:24 
Calls in [draw_block] to mul8u:40 

Created 9 initial phi equivalence classes
Coalesced [10] main::x#8 = main::x#1
Coalesced [18] main::y#5 = main::y#1
Coalesced [81] memset::dst#5 = memset::dst#1
Coalesced [82] mul8u::a#7 = mul8u::a#1
Coalesced [90] mul8u::res#9 = mul8u::res#1
Coalesced [94] mul8u::a#8 = mul8u::a#0
Coalesced [95] mul8u::res#7 = mul8u::res#6
Coalesced [96] mul8u::mb#6 = mul8u::mb#1
Coalesced (already) [97] mul8u::res#8 = mul8u::res#2
Coalesced down to 8 phi equivalence classes
Culled Empty Block label main::@7
Culled Empty Block label main::@2
Culled Empty Block label init::@4
Culled Empty Block label init::toD0181_@return
Culled Empty Block label memset::@1
Culled Empty Block label mul8u::@3
Culled Empty Block label mul8u::@6
Renumbering block memset::@2 to memset::@1
Renumbering block memset::@3 to memset::@2
Renumbering block memset::@4 to memset::@3
Renumbering block mul8u::@4 to mul8u::@3
Renumbering block mul8u::@5 to mul8u::@4
Renumbering block main::@3 to main::@2
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@8 to main::@6
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of init
Adding NOP phi() at start of init::@2
Adding NOP phi() at start of init::@3
Adding NOP phi() at start of init::toD0181
Adding NOP phi() at start of mul8u

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call init
  to:main::@1
main::@1: scope:[main]  from main main::@4
  [2] main::x#2 = phi( main::@4/main::x#1, main/0 )
  [3] if(main::x#2<$10) goto main::@2
  to:main::@5
main::@5: scope:[main]  from main::@1 main::@5
  [4] phi()
  to:main::@5
main::@2: scope:[main]  from main::@1 main::@6
  [5] main::y#2 = phi( main::@1/0, main::@6/main::y#1 )
  [6] if(main::y#2<9) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@2
  [7] main::x#1 = ++ main::x#2
  to:main::@1
main::@3: scope:[main]  from main::@2
  [8] main::z#0 = main::x#2 + main::y#2
  [9] main::tile#0 = level_address[main::z#0]
  [10] draw_block::tileno#0 = main::tile#0
  [11] draw_block::x#0 = main::x#2
  [12] draw_block::y#0 = main::y#2
  [13] call draw_block
  to:main::@6
main::@6: scope:[main]  from main::@3
  [14] main::y#1 = ++ main::y#2
  to:main::@2

void init()
init: scope:[init]  from main
  [15] phi()
  [16] call init_sprites
  to:init::@2
init::@2: scope:[init]  from init
  [17] phi()
  [18] call memset
  to:init::@3
init::@3: scope:[init]  from init::@2
  [19] phi()
  [20] call memset
  to:init::toD0181
init::toD0181: scope:[init]  from init::@3
  [21] phi()
  to:init::@1
init::@1: scope:[init]  from init::toD0181
  [22] *D018 = init::toD0181_return#0
  asm { lda#$5b sta$d011  }
  [24] *BORDER_COLOR = BLACK
  [25] *BG_COLOR = BLACK
  [26] *BG_COLOR1 = RED
  [27] *BG_COLOR2 = BLUE
  [28] *BG_COLOR3 = GREEN
  to:init::@return
init::@return: scope:[init]  from init::@1
  [29] return 
  to:@return

void draw_block(char tileno , char x , char y , char color)
draw_block: scope:[draw_block]  from main::@3
  [30] draw_block::tileno#1 = draw_block::tileno#0 << 2
  [31] draw_block::x1#0 = draw_block::x#0 << 1
  [32] draw_block::y#1 = draw_block::y#0 << 1
  [33] mul8u::a#1 = draw_block::y#1
  [34] call mul8u
  [35] mul8u::return#2 = mul8u::res#2
  to:draw_block::@1
draw_block::@1: scope:[draw_block]  from draw_block
  [36] draw_block::z#0 = mul8u::return#2
  [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0
  [38] draw_block::drawtile#0 = tileset[draw_block::tileno#1]
  [39] draw_block::$11 = screen + draw_block::z#1
  [40] *draw_block::$11 = draw_block::drawtile#0
  [41] draw_block::$12 = colors + draw_block::z#1
  [42] *draw_block::$12 = YELLOW
  [43] draw_block::$6 = draw_block::z#1 + 1
  [44] draw_block::$13 = screen + draw_block::$6
  [45] *draw_block::$13 = 1
  [46] draw_block::$14 = colors + draw_block::$6
  [47] *draw_block::$14 = YELLOW
  [48] draw_block::$8 = draw_block::z#1 + $28
  [49] draw_block::$15 = screen + draw_block::$8
  [50] *draw_block::$15 = 2
  [51] draw_block::$16 = colors + draw_block::$8
  [52] *draw_block::$16 = YELLOW
  [53] draw_block::$10 = draw_block::z#1 + $29
  [54] draw_block::$17 = screen + draw_block::$10
  [55] *draw_block::$17 = 3
  [56] draw_block::$18 = colors + draw_block::$10
  [57] *draw_block::$18 = YELLOW
  to:draw_block::@return
draw_block::@return: scope:[draw_block]  from draw_block::@1
  [58] return 
  to:@return

void init_sprites()
init_sprites: scope:[init_sprites]  from init
  [59] *SPRITES_ENABLE = 1
  [60] *SPRITES_EXPAND_X = 0
  [61] *SPRITES_EXPAND_Y = 0
  [62] *SPRITES_XMSB = 0
  [63] *SPRITES_COLOR = WHITE
  [64] *SPRITES_MC = 0
  to:init_sprites::@return
init_sprites::@return: scope:[init_sprites]  from init_sprites
  [65] return 
  to:@return

void * memset(void *str , char c , unsigned int num)
memset: scope:[memset]  from init::@2 init::@3
  [66] memset::c#4 = phi( init::@2/0, init::@3/BLACK )
  [66] memset::str#3 = phi( init::@2/(void *)screen, init::@3/(void *)colors )
  to:memset::@1
memset::@1: scope:[memset]  from memset
  [67] memset::end#0 = (char *)memset::str#3 + $3e8
  [68] memset::dst#4 = (char *)memset::str#3
  to:memset::@2
memset::@2: scope:[memset]  from memset::@1 memset::@3
  [69] memset::dst#2 = phi( memset::@1/memset::dst#4, memset::@3/memset::dst#1 )
  [70] if(memset::dst#2!=memset::end#0) goto memset::@3
  to:memset::@return
memset::@return: scope:[memset]  from memset::@2
  [71] return 
  to:@return
memset::@3: scope:[memset]  from memset::@2
  [72] *memset::dst#2 = memset::c#4
  [73] memset::dst#1 = ++ memset::dst#2
  to:memset::@2

unsigned int mul8u(char a , char b)
mul8u: scope:[mul8u]  from draw_block
  [74] phi()
  to:mul8u::@1
mul8u::@1: scope:[mul8u]  from mul8u mul8u::@3
  [75] mul8u::mb#2 = phi( mul8u/(unsigned int)mul8u::b#0, mul8u::@3/mul8u::mb#1 )
  [75] mul8u::res#2 = phi( mul8u/0, mul8u::@3/mul8u::res#6 )
  [75] mul8u::a#2 = phi( mul8u/mul8u::a#1, mul8u::@3/mul8u::a#0 )
  [76] if(mul8u::a#2!=0) goto mul8u::@2
  to:mul8u::@return
mul8u::@return: scope:[mul8u]  from mul8u::@1
  [77] return 
  to:@return
mul8u::@2: scope:[mul8u]  from mul8u::@1
  [78] mul8u::$1 = mul8u::a#2 & 1
  [79] if(mul8u::$1==0) goto mul8u::@3
  to:mul8u::@4
mul8u::@4: scope:[mul8u]  from mul8u::@2
  [80] mul8u::res#1 = mul8u::res#2 + mul8u::mb#2
  to:mul8u::@3
mul8u::@3: scope:[mul8u]  from mul8u::@2 mul8u::@4
  [81] mul8u::res#6 = phi( mul8u::@2/mul8u::res#2, mul8u::@4/mul8u::res#1 )
  [82] mul8u::a#0 = mul8u::a#2 >> 1
  [83] mul8u::mb#1 = mul8u::mb#2 << 1
  to:mul8u::@1


VARIABLE REGISTER WEIGHTS
void draw_block(char tileno , char x , char y , char color)
unsigned int draw_block::$10 // 1001.0
char *draw_block::$11 // 2002.0
char *draw_block::$12 // 2002.0
char *draw_block::$13 // 2002.0
char *draw_block::$14 // 2002.0
char *draw_block::$15 // 2002.0
char *draw_block::$16 // 2002.0
char *draw_block::$17 // 2002.0
char *draw_block::$18 // 2002.0
unsigned int draw_block::$6 // 1001.0
unsigned int draw_block::$8 // 1001.0
char draw_block::color
char draw_block::drawtile
char draw_block::drawtile#0 // 1001.0
char draw_block::tileno
char draw_block::tileno#0 // 367.33333333333337
char draw_block::tileno#1 // 250.25
char draw_block::x
char draw_block::x#0 // 367.33333333333337
unsigned int draw_block::x1
unsigned int draw_block::x1#0 // 333.6666666666667
char draw_block::y
char draw_block::y#0 // 367.33333333333337
char draw_block::y#1 // 2002.0
unsigned int draw_block::z
unsigned int draw_block::z#0 // 2002.0
unsigned int draw_block::z#1 // 375.375
void init()
char *init::toD0181_gfx
char init::toD0181_return
char *init::toD0181_screen
void init_sprites()
void main()
char main::tile
char main::tile#0 // 202.0
char main::x
char main::x#1 // 22.0
char main::x#2 // 21.363636363636363
char main::y
char main::y#1 // 202.0
char main::y#2 // 63.125
char main::z
char main::z#0 // 202.0
void * memset(void *str , char c , unsigned int num)
char memset::c
char memset::c#4 // 143.0
char *memset::dst
char *memset::dst#1 // 2002.0
char *memset::dst#2 // 1368.3333333333335
char *memset::dst#4 // 202.0
char *memset::end
char *memset::end#0 // 183.66666666666669
unsigned int memset::num
void *memset::return
void *memset::str
void *memset::str#3
unsigned int mul8u(char a , char b)
char mul8u::$1 // 2.0000002E7
char mul8u::a
char mul8u::a#0 // 1.0000001E7
char mul8u::a#1 // 5501.0
char mul8u::a#2 // 6668334.166666666
char mul8u::b
unsigned int mul8u::mb
unsigned int mul8u::mb#1 // 2.0000002E7
unsigned int mul8u::mb#2 // 4285714.714285715
unsigned int mul8u::res
unsigned int mul8u::res#1 // 2.0000002E7
unsigned int mul8u::res#2 // 5000167.333333333
unsigned int mul8u::res#6 // 1.0000001E7
unsigned int mul8u::return
unsigned int mul8u::return#2 // 2002.0

Initial phi equivalence classes
[ main::x#2 main::x#1 ]
[ main::y#2 main::y#1 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
[ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
[ mul8u::res#2 mul8u::res#6 mul8u::res#1 ]
[ mul8u::mb#2 mul8u::mb#1 ]
Added variable main::z#0 to live range equivalence class [ main::z#0 ]
Added variable main::tile#0 to live range equivalence class [ main::tile#0 ]
Added variable draw_block::tileno#0 to live range equivalence class [ draw_block::tileno#0 ]
Added variable draw_block::x#0 to live range equivalence class [ draw_block::x#0 ]
Added variable draw_block::y#0 to live range equivalence class [ draw_block::y#0 ]
Added variable draw_block::tileno#1 to live range equivalence class [ draw_block::tileno#1 ]
Added variable draw_block::x1#0 to live range equivalence class [ draw_block::x1#0 ]
Added variable draw_block::y#1 to live range equivalence class [ draw_block::y#1 ]
Added variable mul8u::return#2 to live range equivalence class [ mul8u::return#2 ]
Added variable draw_block::z#0 to live range equivalence class [ draw_block::z#0 ]
Added variable draw_block::z#1 to live range equivalence class [ draw_block::z#1 ]
Added variable draw_block::drawtile#0 to live range equivalence class [ draw_block::drawtile#0 ]
Added variable draw_block::$11 to live range equivalence class [ draw_block::$11 ]
Added variable draw_block::$12 to live range equivalence class [ draw_block::$12 ]
Added variable draw_block::$6 to live range equivalence class [ draw_block::$6 ]
Added variable draw_block::$13 to live range equivalence class [ draw_block::$13 ]
Added variable draw_block::$14 to live range equivalence class [ draw_block::$14 ]
Added variable draw_block::$8 to live range equivalence class [ draw_block::$8 ]
Added variable draw_block::$15 to live range equivalence class [ draw_block::$15 ]
Added variable draw_block::$16 to live range equivalence class [ draw_block::$16 ]
Added variable draw_block::$10 to live range equivalence class [ draw_block::$10 ]
Added variable draw_block::$17 to live range equivalence class [ draw_block::$17 ]
Added variable draw_block::$18 to live range equivalence class [ draw_block::$18 ]
Added variable memset::end#0 to live range equivalence class [ memset::end#0 ]
Added variable mul8u::$1 to live range equivalence class [ mul8u::$1 ]
Complete equivalence classes
[ main::x#2 main::x#1 ]
[ main::y#2 main::y#1 ]
[ memset::str#3 ]
[ memset::c#4 ]
[ memset::dst#2 memset::dst#4 memset::dst#1 ]
[ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
[ mul8u::res#2 mul8u::res#6 mul8u::res#1 ]
[ mul8u::mb#2 mul8u::mb#1 ]
[ main::z#0 ]
[ main::tile#0 ]
[ draw_block::tileno#0 ]
[ draw_block::x#0 ]
[ draw_block::y#0 ]
[ draw_block::tileno#1 ]
[ draw_block::x1#0 ]
[ draw_block::y#1 ]
[ mul8u::return#2 ]
[ draw_block::z#0 ]
[ draw_block::z#1 ]
[ draw_block::drawtile#0 ]
[ draw_block::$11 ]
[ draw_block::$12 ]
[ draw_block::$6 ]
[ draw_block::$13 ]
[ draw_block::$14 ]
[ draw_block::$8 ]
[ draw_block::$15 ]
[ draw_block::$16 ]
[ draw_block::$10 ]
[ draw_block::$17 ]
[ draw_block::$18 ]
[ memset::end#0 ]
[ mul8u::$1 ]
Allocated zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ]
Allocated zp[2]:4 [ mul8u::mb#2 mul8u::mb#1 ]
Allocated zp[1]:6 [ mul8u::$1 ]
Allocated zp[1]:7 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
Allocated zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ]
Allocated zp[1]:10 [ draw_block::y#1 ]
Allocated zp[2]:11 [ mul8u::return#2 ]
Allocated zp[2]:13 [ draw_block::z#0 ]
Allocated zp[2]:15 [ draw_block::$11 ]
Allocated zp[2]:17 [ draw_block::$12 ]
Allocated zp[2]:19 [ draw_block::$13 ]
Allocated zp[2]:21 [ draw_block::$14 ]
Allocated zp[2]:23 [ draw_block::$15 ]
Allocated zp[2]:25 [ draw_block::$16 ]
Allocated zp[2]:27 [ draw_block::$17 ]
Allocated zp[2]:29 [ draw_block::$18 ]
Allocated zp[1]:31 [ draw_block::drawtile#0 ]
Allocated zp[2]:32 [ draw_block::$6 ]
Allocated zp[2]:34 [ draw_block::$8 ]
Allocated zp[2]:36 [ draw_block::$10 ]
Allocated zp[2]:38 [ draw_block::z#1 ]
Allocated zp[1]:40 [ draw_block::tileno#0 ]
Allocated zp[1]:41 [ draw_block::x#0 ]
Allocated zp[1]:42 [ draw_block::y#0 ]
Allocated zp[2]:43 [ draw_block::x1#0 ]
Allocated zp[1]:45 [ main::y#2 main::y#1 ]
Allocated zp[1]:46 [ draw_block::tileno#1 ]
Allocated zp[1]:47 [ main::z#0 ]
Allocated zp[1]:48 [ main::tile#0 ]
Allocated zp[2]:49 [ memset::end#0 ]
Allocated zp[1]:51 [ memset::c#4 ]
Allocated zp[1]:52 [ main::x#2 main::x#1 ]
Allocated zp[2]:53 [ memset::str#3 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] main::z#0 = main::x#2 + main::y#2 [ main::x#2 main::y#2 main::z#0 ] (  [ main::x#2 main::y#2 main::z#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:52 [ main::x#2 main::x#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:45 [ main::y#2 main::y#1 ]
Statement [22] *D018 = init::toD0181_return#0 [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement asm { lda#$5b sta$d011  } always clobbers reg byte a 
Statement [24] *BORDER_COLOR = BLACK [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [25] *BG_COLOR = BLACK [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [26] *BG_COLOR1 = RED [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [27] *BG_COLOR2 = BLUE [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [28] *BG_COLOR3 = GREEN [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [30] draw_block::tileno#1 = draw_block::tileno#0 << 2 [ draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:41 [ draw_block::x#0 ]
Removing always clobbered register reg byte a as potential for zp[1]:42 [ draw_block::y#0 ]
Statement [31] draw_block::x1#0 = draw_block::x#0 << 1 [ draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:46 [ draw_block::tileno#1 ]
Statement [32] draw_block::y#1 = draw_block::y#0 << 1 [ draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [35] mul8u::return#2 = mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [36] draw_block::z#0 = mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [39] draw_block::$11 = screen + draw_block::z#1 [ draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:31 [ draw_block::drawtile#0 ]
Statement [40] *draw_block::$11 = draw_block::drawtile#0 [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:52 [ main::x#2 main::x#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:45 [ main::y#2 main::y#1 ]
Statement [41] draw_block::$12 = colors + draw_block::z#1 [ draw_block::z#1 draw_block::$12 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$12 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [42] *draw_block::$12 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [43] draw_block::$6 = draw_block::z#1 + 1 [ draw_block::z#1 draw_block::$6 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [44] draw_block::$13 = screen + draw_block::$6 [ draw_block::z#1 draw_block::$6 draw_block::$13 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 draw_block::$13 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [45] *draw_block::$13 = 1 [ draw_block::z#1 draw_block::$6 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [46] draw_block::$14 = colors + draw_block::$6 [ draw_block::z#1 draw_block::$14 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$14 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [47] *draw_block::$14 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [48] draw_block::$8 = draw_block::z#1 + $28 [ draw_block::z#1 draw_block::$8 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [49] draw_block::$15 = screen + draw_block::$8 [ draw_block::z#1 draw_block::$8 draw_block::$15 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 draw_block::$15 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [50] *draw_block::$15 = 2 [ draw_block::z#1 draw_block::$8 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [51] draw_block::$16 = colors + draw_block::$8 [ draw_block::z#1 draw_block::$16 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$16 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [52] *draw_block::$16 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [53] draw_block::$10 = draw_block::z#1 + $29 [ draw_block::$10 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [54] draw_block::$17 = screen + draw_block::$10 [ draw_block::$10 draw_block::$17 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 draw_block::$17 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [55] *draw_block::$17 = 3 [ draw_block::$10 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [56] draw_block::$18 = colors + draw_block::$10 [ draw_block::$18 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$18 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [57] *draw_block::$18 = YELLOW [ ] ( draw_block:13 [ main::x#2 main::y#2 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [59] *SPRITES_ENABLE = 1 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [60] *SPRITES_EXPAND_X = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [61] *SPRITES_EXPAND_Y = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [62] *SPRITES_XMSB = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [63] *SPRITES_COLOR = WHITE [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [64] *SPRITES_MC = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [67] memset::end#0 = (char *)memset::str#3 + $3e8 [ memset::str#3 memset::c#4 memset::end#0 ] ( init:1::memset:18 [ memset::str#3 memset::c#4 memset::end#0 ] { }  init:1::memset:20 [ 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]:51 [ memset::c#4 ]
Statement [68] memset::dst#4 = (char *)memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  init:1::memset:20 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  ) always clobbers reg byte a 
Statement [70] if(memset::dst#2!=memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  init:1::memset:20 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [72] *memset::dst#2 = memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  init:1::memset:20 [ 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]:51 [ memset::c#4 ]
Statement [80] mul8u::res#1 = mul8u::res#2 + mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( draw_block:13::mul8u:34 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:7 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
Statement [8] main::z#0 = main::x#2 + main::y#2 [ main::x#2 main::y#2 main::z#0 ] (  [ main::x#2 main::y#2 main::z#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [22] *D018 = init::toD0181_return#0 [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement asm { lda#$5b sta$d011  } always clobbers reg byte a 
Statement [24] *BORDER_COLOR = BLACK [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [25] *BG_COLOR = BLACK [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [26] *BG_COLOR1 = RED [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [27] *BG_COLOR2 = BLUE [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [28] *BG_COLOR3 = GREEN [ ] ( init:1 [ ] { }  ) always clobbers reg byte a 
Statement [30] draw_block::tileno#1 = draw_block::tileno#0 << 2 [ draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [31] draw_block::x1#0 = draw_block::x#0 << 1 [ draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [32] draw_block::y#1 = draw_block::y#0 << 1 [ draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [35] mul8u::return#2 = mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [36] draw_block::z#0 = mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [39] draw_block::$11 = screen + draw_block::z#1 [ draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [40] *draw_block::$11 = draw_block::drawtile#0 [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [41] draw_block::$12 = colors + draw_block::z#1 [ draw_block::z#1 draw_block::$12 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$12 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [42] *draw_block::$12 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [43] draw_block::$6 = draw_block::z#1 + 1 [ draw_block::z#1 draw_block::$6 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [44] draw_block::$13 = screen + draw_block::$6 [ draw_block::z#1 draw_block::$6 draw_block::$13 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 draw_block::$13 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [45] *draw_block::$13 = 1 [ draw_block::z#1 draw_block::$6 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$6 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [46] draw_block::$14 = colors + draw_block::$6 [ draw_block::z#1 draw_block::$14 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$14 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [47] *draw_block::$14 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [48] draw_block::$8 = draw_block::z#1 + $28 [ draw_block::z#1 draw_block::$8 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [49] draw_block::$15 = screen + draw_block::$8 [ draw_block::z#1 draw_block::$8 draw_block::$15 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 draw_block::$15 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [50] *draw_block::$15 = 2 [ draw_block::z#1 draw_block::$8 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$8 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [51] draw_block::$16 = colors + draw_block::$8 [ draw_block::z#1 draw_block::$16 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 draw_block::$16 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [52] *draw_block::$16 = YELLOW [ draw_block::z#1 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::z#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [53] draw_block::$10 = draw_block::z#1 + $29 [ draw_block::$10 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [54] draw_block::$17 = screen + draw_block::$10 [ draw_block::$10 draw_block::$17 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 draw_block::$17 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [55] *draw_block::$17 = 3 [ draw_block::$10 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$10 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [56] draw_block::$18 = colors + draw_block::$10 [ draw_block::$18 ] ( draw_block:13 [ main::x#2 main::y#2 draw_block::$18 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a 
Statement [57] *draw_block::$18 = YELLOW [ ] ( draw_block:13 [ main::x#2 main::y#2 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } }  ) always clobbers reg byte a reg byte y 
Statement [59] *SPRITES_ENABLE = 1 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [60] *SPRITES_EXPAND_X = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [61] *SPRITES_EXPAND_Y = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [62] *SPRITES_XMSB = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [63] *SPRITES_COLOR = WHITE [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [64] *SPRITES_MC = 0 [ ] ( init:1::init_sprites:16 [ ] { }  ) always clobbers reg byte a 
Statement [67] memset::end#0 = (char *)memset::str#3 + $3e8 [ memset::str#3 memset::c#4 memset::end#0 ] ( init:1::memset:18 [ memset::str#3 memset::c#4 memset::end#0 ] { }  init:1::memset:20 [ memset::str#3 memset::c#4 memset::end#0 ] { }  ) always clobbers reg byte a 
Statement [68] memset::dst#4 = (char *)memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  init:1::memset:20 [ memset::c#4 memset::end#0 memset::dst#4 ] { }  ) always clobbers reg byte a 
Statement [70] if(memset::dst#2!=memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  init:1::memset:20 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a 
Statement [72] *memset::dst#2 = memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( init:1::memset:18 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  init:1::memset:20 [ memset::c#4 memset::end#0 memset::dst#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [78] mul8u::$1 = mul8u::a#2 & 1 [ mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ( draw_block:13::mul8u:34 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Statement [80] mul8u::res#1 = mul8u::res#2 + mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( draw_block:13::mul8u:34 [ main::x#2 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] { { draw_block::tileno#0 = main::tile#0 } { draw_block::x#0 = main::x#2 } { draw_block::y#0 = main::y#2 } { mul8u::a#1 = draw_block::y#1 } { mul8u::return#2 = mul8u::res#2 } }  ) always clobbers reg byte a 
Potential registers zp[1]:52 [ main::x#2 main::x#1 ] : zp[1]:52 , reg byte x , 
Potential registers zp[1]:45 [ main::y#2 main::y#1 ] : zp[1]:45 , reg byte x , 
Potential registers zp[2]:53 [ memset::str#3 ] : zp[2]:53 , 
Potential registers zp[1]:51 [ memset::c#4 ] : zp[1]:51 , reg byte x , 
Potential registers zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] : zp[2]:8 , 
Potential registers zp[1]:7 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] : zp[1]:7 , reg byte x , reg byte y , 
Potential registers zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] : zp[2]:2 , 
Potential registers zp[2]:4 [ mul8u::mb#2 mul8u::mb#1 ] : zp[2]:4 , 
Potential registers zp[1]:47 [ main::z#0 ] : zp[1]:47 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:48 [ main::tile#0 ] : zp[1]:48 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:40 [ draw_block::tileno#0 ] : zp[1]:40 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:41 [ draw_block::x#0 ] : zp[1]:41 , reg byte x , reg byte y , 
Potential registers zp[1]:42 [ draw_block::y#0 ] : zp[1]:42 , reg byte x , reg byte y , 
Potential registers zp[1]:46 [ draw_block::tileno#1 ] : zp[1]:46 , reg byte x , reg byte y , 
Potential registers zp[2]:43 [ draw_block::x1#0 ] : zp[2]:43 , 
Potential registers zp[1]:10 [ draw_block::y#1 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:11 [ mul8u::return#2 ] : zp[2]:11 , 
Potential registers zp[2]:13 [ draw_block::z#0 ] : zp[2]:13 , 
Potential registers zp[2]:38 [ draw_block::z#1 ] : zp[2]:38 , 
Potential registers zp[1]:31 [ draw_block::drawtile#0 ] : zp[1]:31 , reg byte x , reg byte y , 
Potential registers zp[2]:15 [ draw_block::$11 ] : zp[2]:15 , 
Potential registers zp[2]:17 [ draw_block::$12 ] : zp[2]:17 , 
Potential registers zp[2]:32 [ draw_block::$6 ] : zp[2]:32 , 
Potential registers zp[2]:19 [ draw_block::$13 ] : zp[2]:19 , 
Potential registers zp[2]:21 [ draw_block::$14 ] : zp[2]:21 , 
Potential registers zp[2]:34 [ draw_block::$8 ] : zp[2]:34 , 
Potential registers zp[2]:23 [ draw_block::$15 ] : zp[2]:23 , 
Potential registers zp[2]:25 [ draw_block::$16 ] : zp[2]:25 , 
Potential registers zp[2]:36 [ draw_block::$10 ] : zp[2]:36 , 
Potential registers zp[2]:27 [ draw_block::$17 ] : zp[2]:27 , 
Potential registers zp[2]:29 [ draw_block::$18 ] : zp[2]:29 , 
Potential registers zp[2]:49 [ memset::end#0 ] : zp[2]:49 , 
Potential registers zp[1]:6 [ mul8u::$1 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [mul8u] 35,000,170.33: zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] 24,285,716.71: zp[2]:4 [ mul8u::mb#2 mul8u::mb#1 ] 20,000,002: zp[1]:6 [ mul8u::$1 ] 16,673,836.17: zp[1]:7 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] 2,002: zp[2]:11 [ mul8u::return#2 ] 
Uplift Scope [draw_block] 2,002: zp[1]:10 [ draw_block::y#1 ] 2,002: zp[2]:13 [ draw_block::z#0 ] 2,002: zp[2]:15 [ draw_block::$11 ] 2,002: zp[2]:17 [ draw_block::$12 ] 2,002: zp[2]:19 [ draw_block::$13 ] 2,002: zp[2]:21 [ draw_block::$14 ] 2,002: zp[2]:23 [ draw_block::$15 ] 2,002: zp[2]:25 [ draw_block::$16 ] 2,002: zp[2]:27 [ draw_block::$17 ] 2,002: zp[2]:29 [ draw_block::$18 ] 1,001: zp[1]:31 [ draw_block::drawtile#0 ] 1,001: zp[2]:32 [ draw_block::$6 ] 1,001: zp[2]:34 [ draw_block::$8 ] 1,001: zp[2]:36 [ draw_block::$10 ] 375.38: zp[2]:38 [ draw_block::z#1 ] 367.33: zp[1]:40 [ draw_block::tileno#0 ] 367.33: zp[1]:41 [ draw_block::x#0 ] 367.33: zp[1]:42 [ draw_block::y#0 ] 333.67: zp[2]:43 [ draw_block::x1#0 ] 250.25: zp[1]:46 [ draw_block::tileno#1 ] 
Uplift Scope [memset] 3,572.33: zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] 183.67: zp[2]:49 [ memset::end#0 ] 143: zp[1]:51 [ memset::c#4 ] 0: zp[2]:53 [ memset::str#3 ] 
Uplift Scope [main] 265.12: zp[1]:45 [ main::y#2 main::y#1 ] 202: zp[1]:47 [ main::z#0 ] 202: zp[1]:48 [ main::tile#0 ] 43.36: zp[1]:52 [ main::x#2 main::x#1 ] 
Uplift Scope [MOS6526_CIA] 
Uplift Scope [MOS6569_VICII] 
Uplift Scope [MOS6581_SID] 
Uplift Scope [init] 
Uplift Scope [init_sprites] 
Uplift Scope [] 

Uplifting [mul8u] best 92938 combination zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:4 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp[2]:11 [ mul8u::return#2 ] 
Uplifting [draw_block] best 92328 combination reg byte a [ draw_block::y#1 ] zp[2]:13 [ draw_block::z#0 ] zp[2]:15 [ draw_block::$11 ] zp[2]:17 [ draw_block::$12 ] zp[2]:19 [ draw_block::$13 ] zp[2]:21 [ draw_block::$14 ] zp[2]:23 [ draw_block::$15 ] zp[2]:25 [ draw_block::$16 ] zp[2]:27 [ draw_block::$17 ] zp[2]:29 [ draw_block::$18 ] reg byte x [ draw_block::drawtile#0 ] zp[2]:32 [ draw_block::$6 ] zp[2]:34 [ draw_block::$8 ] zp[2]:36 [ draw_block::$10 ] zp[2]:38 [ draw_block::z#1 ] reg byte y [ draw_block::tileno#0 ] reg byte x [ draw_block::x#0 ] zp[1]:42 [ draw_block::y#0 ] zp[2]:43 [ draw_block::x1#0 ] zp[1]:46 [ draw_block::tileno#1 ] 
Limited combination testing to 100 combinations of 1296 possible.
Uplifting [memset] best 92312 combination zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:49 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:53 [ memset::str#3 ] 
Uplifting [main] best 91312 combination zp[1]:45 [ main::y#2 main::y#1 ] reg byte a [ main::z#0 ] reg byte y [ main::tile#0 ] zp[1]:52 [ main::x#2 main::x#1 ] 
Uplifting [MOS6526_CIA] best 91312 combination 
Uplifting [MOS6569_VICII] best 91312 combination 
Uplifting [MOS6581_SID] best 91312 combination 
Uplifting [init] best 91312 combination 
Uplifting [init_sprites] best 91312 combination 
Uplifting [] best 91312 combination 
Attempting to uplift remaining variables inzp[1]:42 [ draw_block::y#0 ]
Uplifting [draw_block] best 91312 combination zp[1]:42 [ draw_block::y#0 ] 
Attempting to uplift remaining variables inzp[1]:45 [ main::y#2 main::y#1 ]
Uplifting [main] best 91312 combination zp[1]:45 [ main::y#2 main::y#1 ] 
Attempting to uplift remaining variables inzp[1]:46 [ draw_block::tileno#1 ]
Uplifting [draw_block] best 91308 combination reg byte y [ draw_block::tileno#1 ] 
Attempting to uplift remaining variables inzp[1]:52 [ main::x#2 main::x#1 ]
Uplifting [main] best 91308 combination zp[1]:52 [ main::x#2 main::x#1 ] 
Coalescing zero page register [ zp[1]:45 [ main::y#2 main::y#1 ] ] with [ zp[1]:42 [ draw_block::y#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:53 [ memset::str#3 ] ] with [ zp[2]:8 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1
Coalescing zero page register [ zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] ] with [ zp[2]:11 [ mul8u::return#2 ] ] - score: 1
Coalescing zero page register [ zp[2]:43 [ draw_block::x1#0 ] ] with [ zp[2]:38 [ draw_block::z#1 ] ] - score: 1
Coalescing zero page register [ zp[2]:32 [ draw_block::$6 ] ] with [ zp[2]:21 [ draw_block::$14 ] ] - score: 1
Coalescing zero page register [ zp[2]:34 [ draw_block::$8 ] ] with [ zp[2]:25 [ draw_block::$16 ] ] - score: 1
Coalescing zero page register [ zp[2]:36 [ draw_block::$10 ] ] with [ zp[2]:29 [ draw_block::$18 ] ] - score: 1
Coalescing zero page register [ zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 ] ] with [ zp[2]:13 [ draw_block::z#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:43 [ draw_block::x1#0 draw_block::z#1 ] ] with [ zp[2]:36 [ draw_block::$10 draw_block::$18 ] ] - score: 1
Coalescing zero page register [ zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 ] ] with [ zp[2]:53 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ] ]
Coalescing zero page register [ zp[2]:15 [ draw_block::$11 ] ] with [ zp[2]:4 [ mul8u::mb#2 mul8u::mb#1 ] ]
Coalescing zero page register [ zp[2]:49 [ memset::end#0 ] ] with [ zp[2]:43 [ draw_block::x1#0 draw_block::z#1 draw_block::$10 draw_block::$18 ] ]
Allocated (was zp[2]:15) zp[2]:4 [ draw_block::$11 mul8u::mb#2 mul8u::mb#1 ]
Allocated (was zp[2]:49) zp[2]:6 [ memset::end#0 draw_block::x1#0 draw_block::z#1 draw_block::$10 draw_block::$18 ]
Allocated (was zp[2]:32) zp[2]:8 [ draw_block::$6 draw_block::$14 ]
Allocated (was zp[2]:34) zp[2]:10 [ draw_block::$8 draw_block::$16 ]
Allocated (was zp[2]:17) zp[2]:12 [ draw_block::$12 ]
Allocated (was zp[2]:19) zp[2]:14 [ draw_block::$13 ]
Allocated (was zp[2]:23) zp[2]:16 [ draw_block::$15 ]
Allocated (was zp[2]:27) zp[2]:18 [ draw_block::$17 ]
Allocated (was zp[1]:45) zp[1]:20 [ main::y#2 main::y#1 draw_block::y#0 ]
Allocated (was zp[1]:52) zp[1]:21 [ main::x#2 main::x#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2
/// @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="scan-desire-problem.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
  /// The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const RED = 2
  .const GREEN = 5
  .const BLUE = 6
  .const YELLOW = 7
  /// Sprite X position MSB register
  .label SPRITES_XMSB = $d010
  /// Sprite colors register for sprite #0
  .label SPRITES_COLOR = $d027
  /// Sprite enable register
  .label SPRITES_ENABLE = $d015
  /// Sprite expand Y register
  .label SPRITES_EXPAND_Y = $d017
  /// Sprite multicolor enable register
  .label SPRITES_MC = $d01c
  /// Sprite expand X register
  .label SPRITES_EXPAND_X = $d01d
  /// $D020 Border Color
  .label BORDER_COLOR = $d020
  /// $D021 Background Color 0
  .label BG_COLOR = $d021
  /// $D022 Background Color 1
  .label BG_COLOR1 = $d022
  /// $D023 Background Color 2
  .label BG_COLOR2 = $d023
  /// $D024 Background Color 3
  .label BG_COLOR3 = $d024
  /// $D018 VIC-II base addresses
  // @see #VICII_MEMORY
  .label D018 = $d018
  .label screen = $400
  .label charset = $2000
  .label tileset = $2800
  .label colors = $d800
  .label level_address = $3000
.segment Code
  // main
main: {
    .label y = $14
    .label x = $15
    // [1] call init
    // [15] phi from main to init [phi:main->init]
  init_from_main:
    jsr init
    // [2] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [2] phi main::x#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z x
    jmp __b1
    // main::@1
  __b1:
    // [3] if(main::x#2<$10) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x
    cmp #$10
    bcc __b2_from___b1
    // [4] phi from main::@1 main::@5 to main::@5 [phi:main::@1/main::@5->main::@5]
  __b5_from___b1:
  __b5_from___b5:
    jmp __b5
    // main::@5
  __b5:
    jmp __b5_from___b5
    // [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    // [5] phi main::y#2 = 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z y
    jmp __b2
    // main::@2
  __b2:
    // [6] if(main::y#2<9) goto main::@3 -- vbuz1_lt_vbuc1_then_la1 
    lda.z y
    cmp #9
    bcc __b3
    jmp __b4
    // main::@4
  __b4:
    // [7] main::x#1 = ++ main::x#2 -- vbuz1=_inc_vbuz1 
    inc.z x
    // [2] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
  __b1_from___b4:
    // [2] phi main::x#2 = main::x#1 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@3
  __b3:
    // [8] main::z#0 = main::x#2 + main::y#2 -- vbuaa=vbuz1_plus_vbuz2 
    lda.z x
    clc
    adc.z y
    // [9] main::tile#0 = level_address[main::z#0] -- vbuyy=pbuc1_derefidx_vbuaa 
    tax
    ldy level_address,x
    // [10] draw_block::tileno#0 = main::tile#0
    // [11] draw_block::x#0 = main::x#2 -- vbuxx=vbuz1 
    ldx.z x
    // [12] draw_block::y#0 = main::y#2
    // [13] call draw_block
    jsr draw_block
    jmp __b6
    // main::@6
  __b6:
    // [14] main::y#1 = ++ main::y#2 -- vbuz1=_inc_vbuz1 
    inc.z y
    // [5] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  __b2_from___b6:
    // [5] phi main::y#2 = main::y#1 [phi:main::@6->main::@2#0] -- register_copy 
    jmp __b2
}
  // init
init: {
    .const toD0181_return = (>(screen&$3fff)*4)|(>charset)/4&$f
    // [16] call init_sprites
    jsr init_sprites
    // [17] phi from init to init::@2 [phi:init->init::@2]
  __b2_from_init:
    jmp __b2
    // init::@2
  __b2:
    // [18] call memset
    // [66] phi from init::@2 to memset [phi:init::@2->memset]
  memset_from___b2:
    // [66] phi memset::c#4 = 0 [phi:init::@2->memset#0] -- vbuxx=vbuc1 
    ldx #0
    // [66] phi memset::str#3 = (void *)screen [phi:init::@2->memset#1] -- pvoz1=pvoc1 
    lda #<screen
    sta.z memset.str
    lda #>screen
    sta.z memset.str+1
    jsr memset
    // [19] phi from init::@2 to init::@3 [phi:init::@2->init::@3]
  __b3_from___b2:
    jmp __b3
    // init::@3
  __b3:
    // [20] call memset
    // [66] phi from init::@3 to memset [phi:init::@3->memset]
  memset_from___b3:
    // [66] phi memset::c#4 = BLACK [phi:init::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [66] phi memset::str#3 = (void *)colors [phi:init::@3->memset#1] -- pvoz1=pvoc1 
    lda #<colors
    sta.z memset.str
    lda #>colors
    sta.z memset.str+1
    jsr memset
    // [21] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181]
  toD0181_from___b3:
    jmp toD0181
    // init::toD0181
  toD0181:
    jmp __b1
    // init::@1
  __b1:
    // [22] *D018 = init::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // asm { lda#$5b sta$d011  }
    lda #$5b
    sta $d011
    // [24] *BORDER_COLOR = BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDER_COLOR
    // [25] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BG_COLOR
    // [26] *BG_COLOR1 = RED -- _deref_pbuc1=vbuc2 
    lda #RED
    sta BG_COLOR1
    // [27] *BG_COLOR2 = BLUE -- _deref_pbuc1=vbuc2 
    lda #BLUE
    sta BG_COLOR2
    // [28] *BG_COLOR3 = GREEN -- _deref_pbuc1=vbuc2 
    lda #GREEN
    sta BG_COLOR3
    jmp __breturn
    // init::@return
  __breturn:
    // [29] return 
    rts
}
  // draw_block
// void draw_block(__register(Y) char tileno, __register(X) char x, __zp($14) char y, char color)
draw_block: {
    .label __6 = 8
    .label __8 = $a
    .label __10 = 6
    .label y = $14
    .label x1 = 6
    .label z = 2
    .label z_1 = 6
    .label __11 = 4
    .label __12 = $c
    .label __13 = $e
    .label __14 = 8
    .label __15 = $10
    .label __16 = $a
    .label __17 = $12
    .label __18 = 6
    // [30] draw_block::tileno#1 = draw_block::tileno#0 << 2 -- vbuyy=vbuyy_rol_2 
    tya
    asl
    asl
    tay
    // [31] draw_block::x1#0 = draw_block::x#0 << 1 -- vwuz1=vbuxx_rol_1 
    txa
    asl
    sta.z x1
    lda #0
    rol
    sta.z x1+1
    // [32] draw_block::y#1 = draw_block::y#0 << 1 -- vbuaa=vbuz1_rol_1 
    lda.z y
    asl
    // [33] mul8u::a#1 = draw_block::y#1 -- vbuxx=vbuaa 
    tax
    // [34] call mul8u
    // [74] phi from draw_block to mul8u [phi:draw_block->mul8u]
  mul8u_from_draw_block:
    jsr mul8u
    // [35] mul8u::return#2 = mul8u::res#2
    jmp __b1
    // draw_block::@1
  __b1:
    // [36] draw_block::z#0 = mul8u::return#2
    // [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz1 
    clc
    lda.z z_1
    adc.z z
    sta.z z_1
    lda.z z_1+1
    adc.z z+1
    sta.z z_1+1
    // [38] draw_block::drawtile#0 = tileset[draw_block::tileno#1] -- vbuxx=pbuc1_derefidx_vbuyy 
    ldx tileset,y
    // [39] draw_block::$11 = screen + draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z z_1
    clc
    adc #<screen
    sta.z __11
    lda.z z_1+1
    adc #>screen
    sta.z __11+1
    // [40] *draw_block::$11 = draw_block::drawtile#0 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (__11),y
    // [41] draw_block::$12 = colors + draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z z_1
    clc
    adc #<colors
    sta.z __12
    lda.z z_1+1
    adc #>colors
    sta.z __12+1
    // [42] *draw_block::$12 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    ldy #0
    sta (__12),y
    // [43] draw_block::$6 = draw_block::z#1 + 1 -- vwuz1=vwuz2_plus_1 
    clc
    lda.z z_1
    adc #1
    sta.z __6
    lda.z z_1+1
    adc #0
    sta.z __6+1
    // [44] draw_block::$13 = screen + draw_block::$6 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __6
    clc
    adc #<screen
    sta.z __13
    lda.z __6+1
    adc #>screen
    sta.z __13+1
    // [45] *draw_block::$13 = 1 -- _deref_pbuz1=vbuc1 
    lda #1
    ldy #0
    sta (__13),y
    // [46] draw_block::$14 = colors + draw_block::$6 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __14
    clc
    adc #<colors
    sta.z __14
    lda.z __14+1
    adc #>colors
    sta.z __14+1
    // [47] *draw_block::$14 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    ldy #0
    sta (__14),y
    // [48] draw_block::$8 = draw_block::z#1 + $28 -- vwuz1=vwuz2_plus_vbuc1 
    lda #$28
    clc
    adc.z z_1
    sta.z __8
    lda #0
    adc.z z_1+1
    sta.z __8+1
    // [49] draw_block::$15 = screen + draw_block::$8 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __8
    clc
    adc #<screen
    sta.z __15
    lda.z __8+1
    adc #>screen
    sta.z __15+1
    // [50] *draw_block::$15 = 2 -- _deref_pbuz1=vbuc1 
    lda #2
    ldy #0
    sta (__15),y
    // [51] draw_block::$16 = colors + draw_block::$8 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __16
    clc
    adc #<colors
    sta.z __16
    lda.z __16+1
    adc #>colors
    sta.z __16+1
    // [52] *draw_block::$16 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    ldy #0
    sta (__16),y
    // [53] draw_block::$10 = draw_block::z#1 + $29 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$29
    clc
    adc.z __10
    sta.z __10
    bcc !+
    inc.z __10+1
  !:
    // [54] draw_block::$17 = screen + draw_block::$10 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __10
    clc
    adc #<screen
    sta.z __17
    lda.z __10+1
    adc #>screen
    sta.z __17+1
    // [55] *draw_block::$17 = 3 -- _deref_pbuz1=vbuc1 
    lda #3
    ldy #0
    sta (__17),y
    // [56] draw_block::$18 = colors + draw_block::$10 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __18
    clc
    adc #<colors
    sta.z __18
    lda.z __18+1
    adc #>colors
    sta.z __18+1
    // [57] *draw_block::$18 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    ldy #0
    sta (__18),y
    jmp __breturn
    // draw_block::@return
  __breturn:
    // [58] return 
    rts
}
  // init_sprites
init_sprites: {
    // [59] *SPRITES_ENABLE = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta SPRITES_ENABLE
    // [60] *SPRITES_EXPAND_X = 0 -- _deref_pbuc1=vbuc2 
    // one sprite enabled
    lda #0
    sta SPRITES_EXPAND_X
    // [61] *SPRITES_EXPAND_Y = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SPRITES_EXPAND_Y
    // [62] *SPRITES_XMSB = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SPRITES_XMSB
    // [63] *SPRITES_COLOR = WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta SPRITES_COLOR
    // [64] *SPRITES_MC = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SPRITES_MC
    jmp __breturn
    // init_sprites::@return
  __breturn:
    // [65] return 
    rts
}
  // 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 = 6
    .label dst = 2
    .label str = 2
    jmp __b1
    // memset::@1
  __b1:
    // [67] memset::end#0 = (char *)memset::str#3 + $3e8 -- pbuz1=pbuz2_plus_vwuc1 
    lda.z str
    clc
    adc #<$3e8
    sta.z end
    lda.z str+1
    adc #>$3e8
    sta.z end+1
    // [68] memset::dst#4 = (char *)memset::str#3
    // [69] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [69] phi memset::dst#2 = memset::dst#4 [phi:memset::@1/memset::@3->memset::@2#0] -- register_copy 
    jmp __b2
    // memset::@2
  __b2:
    // [70] 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:
    // [71] return 
    rts
    // memset::@3
  __b3:
    // [72] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // [73] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2_from___b3
}
  // mul8u
// Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int
// __zp(2) unsigned int mul8u(__register(X) char a, char b)
mul8u: {
    .const b = $28
    .label mb = 4
    .label res = 2
    .label return = 2
    // [75] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1]
  __b1_from_mul8u:
    // [75] phi mul8u::mb#2 = (unsigned int)mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vwuc1 
    lda #<b
    sta.z mb
    lda #>b
    sta.z mb+1
    // [75] phi mul8u::res#2 = 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vwuc1 
    lda #<0
    sta.z res
    lda #>0
    sta.z res+1
    // [75] phi mul8u::a#2 = mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy 
    jmp __b1
    // mul8u::@1
  __b1:
    // [76] if(mul8u::a#2!=0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b2
    jmp __breturn
    // mul8u::@return
  __breturn:
    // [77] return 
    rts
    // mul8u::@2
  __b2:
    // [78] mul8u::$1 = mul8u::a#2 & 1 -- vbuaa=vbuxx_band_vbuc1 
    txa
    and #1
    // [79] if(mul8u::$1==0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b3_from___b2
    jmp __b4
    // mul8u::@4
  __b4:
    // [80] mul8u::res#1 = mul8u::res#2 + mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 
    clc
    lda.z res
    adc.z mb
    sta.z res
    lda.z res+1
    adc.z mb+1
    sta.z res+1
    // [81] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3]
  __b3_from___b2:
  __b3_from___b4:
    // [81] phi mul8u::res#6 = mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy 
    jmp __b3
    // mul8u::@3
  __b3:
    // [82] mul8u::a#0 = mul8u::a#2 >> 1 -- vbuxx=vbuxx_ror_1 
    txa
    lsr
    tax
    // [83] mul8u::mb#1 = mul8u::mb#2 << 1 -- vwuz1=vwuz1_rol_1 
    asl.z mb
    rol.z mb+1
    // [75] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1]
  __b1_from___b3:
    // [75] phi mul8u::mb#2 = mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy 
    // [75] phi mul8u::res#2 = mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy 
    // [75] phi mul8u::a#2 = mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy 
    jmp __b1
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b5
Removing instruction jmp __b2
Removing instruction jmp __b4
Removing instruction jmp __b6
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp toD0181
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b4
Removing instruction jmp __b3
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #BLACK
Removing instruction ldy #0
Removing instruction ldy #0
Removing instruction ldy #0
Replacing instruction lda #0 with TYA
Removing instruction ldy #0
Removing instruction ldy #0
Removing instruction ldy #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b5_from___b5 with __b5
Replacing label __b2_from___b3 with __b2
Replacing label __b3_from___b2 with __b3
Removing instruction __b5_from___b1:
Removing instruction __b5_from___b5:
Removing instruction __b2_from_init:
Removing instruction memset_from___b2:
Removing instruction __b3_from___b2:
Removing instruction memset_from___b3:
Removing instruction toD0181_from___b3:
Removing instruction toD0181:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b3:
Removing instruction __b3_from___b2:
Removing instruction __b3_from___b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction init_from_main:
Removing instruction __b1_from_main:
Removing instruction __b4:
Removing instruction __b1_from___b4:
Removing instruction __b6:
Removing instruction __b2_from___b6:
Removing instruction __b2:
Removing instruction __b3:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction mul8u_from_draw_block:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b1_from_mul8u:
Removing instruction __breturn:
Removing instruction __b4:
Removing instruction __b1_from___b3:
Succesful ASM optimization Pass5UnusedLabelElimination
Relabelling long label __b2_from___b1 to __b4
Succesful ASM optimization Pass5RelabelLongLabels

FINAL SYMBOL TABLE
__constant char * const BG_COLOR = (char *) 53281
__constant char * const BG_COLOR1 = (char *) 53282
__constant char * const BG_COLOR2 = (char *) 53283
__constant char * const BG_COLOR3 = (char *) 53284
__constant const char BLACK = 0
__constant const char BLUE = 6
__constant char * const BORDER_COLOR = (char *) 53280
__constant char * const D018 = (char *) 53272
__constant const char GREEN = 5
__constant const char RED = 2
__constant char * const SPRITES_COLOR = (char *) 53287
__constant char * const SPRITES_ENABLE = (char *) 53269
__constant char * const SPRITES_EXPAND_X = (char *) 53277
__constant char * const SPRITES_EXPAND_Y = (char *) 53271
__constant char * const SPRITES_MC = (char *) 53276
__constant char * const SPRITES_XMSB = (char *) 53264
__constant const char WHITE = 1
__constant const char YELLOW = 7
__constant char * const charset = (char *) 8192
__constant char * const colors = (char *) 55296
void draw_block(char tileno , char x , char y , char color)
unsigned int draw_block::$10 // zp[2]:6 1001.0
char *draw_block::$11 // zp[2]:4 2002.0
char *draw_block::$12 // zp[2]:12 2002.0
char *draw_block::$13 // zp[2]:14 2002.0
char *draw_block::$14 // zp[2]:8 2002.0
char *draw_block::$15 // zp[2]:16 2002.0
char *draw_block::$16 // zp[2]:10 2002.0
char *draw_block::$17 // zp[2]:18 2002.0
char *draw_block::$18 // zp[2]:6 2002.0
unsigned int draw_block::$6 // zp[2]:8 1001.0
unsigned int draw_block::$8 // zp[2]:10 1001.0
char draw_block::color
char draw_block::drawtile
char draw_block::drawtile#0 // reg byte x 1001.0
char draw_block::tileno
char draw_block::tileno#0 // reg byte y 367.33333333333337
char draw_block::tileno#1 // reg byte y 250.25
char draw_block::x
char draw_block::x#0 // reg byte x 367.33333333333337
unsigned int draw_block::x1
unsigned int draw_block::x1#0 // x1 zp[2]:6 333.6666666666667
char draw_block::y
char draw_block::y#0 // y zp[1]:20 367.33333333333337
char draw_block::y#1 // reg byte a 2002.0
unsigned int draw_block::z
unsigned int draw_block::z#0 // z zp[2]:2 2002.0
unsigned int draw_block::z#1 // z_1 zp[2]:6 375.375
void init()
char *init::toD0181_gfx
char init::toD0181_return
__constant char init::toD0181_return#0 = byte1 (unsigned int)screen&$3fff*4|byte1 (unsigned int)charset/4&$f // toD0181_return
char *init::toD0181_screen
void init_sprites()
__constant char * const level_address = (char *) 12288
void main()
char main::tile
char main::tile#0 // reg byte y 202.0
char main::x
char main::x#1 // x zp[1]:21 22.0
char main::x#2 // x zp[1]:21 21.363636363636363
char main::y
char main::y#1 // y zp[1]:20 202.0
char main::y#2 // y zp[1]:20 63.125
char main::z
char main::z#0 // reg byte a 202.0
void * memset(void *str , char c , unsigned int num)
char memset::c
char memset::c#4 // reg byte x 143.0
char *memset::dst
char *memset::dst#1 // dst zp[2]:2 2002.0
char *memset::dst#2 // dst zp[2]:2 1368.3333333333335
char *memset::dst#4 // dst zp[2]:2 202.0
char *memset::end
char *memset::end#0 // end zp[2]:6 183.66666666666669
unsigned int memset::num
void *memset::return
void *memset::str
void *memset::str#3 // str zp[2]:2
unsigned int mul8u(char a , char b)
char mul8u::$1 // reg byte a 2.0000002E7
char mul8u::a
char mul8u::a#0 // reg byte x 1.0000001E7
char mul8u::a#1 // reg byte x 5501.0
char mul8u::a#2 // reg byte x 6668334.166666666
char mul8u::b
__constant char mul8u::b#0 = $28 // b
unsigned int mul8u::mb
unsigned int mul8u::mb#1 // mb zp[2]:4 2.0000002E7
unsigned int mul8u::mb#2 // mb zp[2]:4 4285714.714285715
unsigned int mul8u::res
unsigned int mul8u::res#1 // res zp[2]:2 2.0000002E7
unsigned int mul8u::res#2 // res zp[2]:2 5000167.333333333
unsigned int mul8u::res#6 // res zp[2]:2 1.0000001E7
unsigned int mul8u::return
unsigned int mul8u::return#2 // return zp[2]:2 2002.0
__constant char * const screen = (char *) 1024
__constant char * const tileset = (char *) 10240

zp[1]:21 [ main::x#2 main::x#1 ]
zp[1]:20 [ main::y#2 main::y#1 draw_block::y#0 ]
reg byte x [ memset::c#4 ]
reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
zp[2]:2 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 ]
reg byte a [ main::z#0 ]
reg byte y [ main::tile#0 ]
reg byte y [ draw_block::tileno#0 ]
reg byte x [ draw_block::x#0 ]
reg byte y [ draw_block::tileno#1 ]
reg byte a [ draw_block::y#1 ]
reg byte x [ draw_block::drawtile#0 ]
zp[2]:4 [ draw_block::$11 mul8u::mb#2 mul8u::mb#1 ]
zp[2]:12 [ draw_block::$12 ]
zp[2]:8 [ draw_block::$6 draw_block::$14 ]
zp[2]:14 [ draw_block::$13 ]
zp[2]:10 [ draw_block::$8 draw_block::$16 ]
zp[2]:16 [ draw_block::$15 ]
zp[2]:18 [ draw_block::$17 ]
zp[2]:6 [ memset::end#0 draw_block::x1#0 draw_block::z#1 draw_block::$10 draw_block::$18 ]
reg byte a [ mul8u::$1 ]


FINAL ASSEMBLER
Score: 75552

  // File Comments
// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2
/// @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="scan-desire-problem.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
  /// The colors of the C64
  .const BLACK = 0
  .const WHITE = 1
  .const RED = 2
  .const GREEN = 5
  .const BLUE = 6
  .const YELLOW = 7
  /// Sprite X position MSB register
  .label SPRITES_XMSB = $d010
  /// Sprite colors register for sprite #0
  .label SPRITES_COLOR = $d027
  /// Sprite enable register
  .label SPRITES_ENABLE = $d015
  /// Sprite expand Y register
  .label SPRITES_EXPAND_Y = $d017
  /// Sprite multicolor enable register
  .label SPRITES_MC = $d01c
  /// Sprite expand X register
  .label SPRITES_EXPAND_X = $d01d
  /// $D020 Border Color
  .label BORDER_COLOR = $d020
  /// $D021 Background Color 0
  .label BG_COLOR = $d021
  /// $D022 Background Color 1
  .label BG_COLOR1 = $d022
  /// $D023 Background Color 2
  .label BG_COLOR2 = $d023
  /// $D024 Background Color 3
  .label BG_COLOR3 = $d024
  /// $D018 VIC-II base addresses
  // @see #VICII_MEMORY
  .label D018 = $d018
  .label screen = $400
  .label charset = $2000
  .label tileset = $2800
  .label colors = $d800
  .label level_address = $3000
.segment Code
  // main
main: {
    .label y = $14
    .label x = $15
    // init()
    // [1] call init
    // [15] phi from main to init [phi:main->init]
    jsr init
    // [2] phi from main to main::@1 [phi:main->main::@1]
    // [2] phi main::x#2 = 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z x
    // main::@1
  __b1:
    // for (byte x = 0; x < 16; x++ )
    // [3] if(main::x#2<$10) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x
    cmp #$10
    bcc __b4
    // [4] phi from main::@1 main::@5 to main::@5 [phi:main::@1/main::@5->main::@5]
    // main::@5
  __b5:
    jmp __b5
    // [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b4:
    // [5] phi main::y#2 = 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta.z y
    // main::@2
  __b2:
    // for (byte y = 0; y < 9; y++)
    // [6] if(main::y#2<9) goto main::@3 -- vbuz1_lt_vbuc1_then_la1 
    lda.z y
    cmp #9
    bcc __b3
    // main::@4
    // for (byte x = 0; x < 16; x++ )
    // [7] main::x#1 = ++ main::x#2 -- vbuz1=_inc_vbuz1 
    inc.z x
    // [2] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
    // [2] phi main::x#2 = main::x#1 [phi:main::@4->main::@1#0] -- register_copy 
    jmp __b1
    // main::@3
  __b3:
    // byte z = x+y
    // [8] main::z#0 = main::x#2 + main::y#2 -- vbuaa=vbuz1_plus_vbuz2 
    lda.z x
    clc
    adc.z y
    // byte tile = level_address[z]
    // [9] main::tile#0 = level_address[main::z#0] -- vbuyy=pbuc1_derefidx_vbuaa 
    tax
    ldy level_address,x
    // draw_block(tile,x,y,YELLOW)
    // [10] draw_block::tileno#0 = main::tile#0
    // [11] draw_block::x#0 = main::x#2 -- vbuxx=vbuz1 
    ldx.z x
    // [12] draw_block::y#0 = main::y#2
    // [13] call draw_block
    jsr draw_block
    // main::@6
    // for (byte y = 0; y < 9; y++)
    // [14] main::y#1 = ++ main::y#2 -- vbuz1=_inc_vbuz1 
    inc.z y
    // [5] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
    // [5] phi main::y#2 = main::y#1 [phi:main::@6->main::@2#0] -- register_copy 
    jmp __b2
}
  // init
init: {
    .const toD0181_return = (>(screen&$3fff)*4)|(>charset)/4&$f
    // init_sprites()
    // [16] call init_sprites
    jsr init_sprites
    // [17] phi from init to init::@2 [phi:init->init::@2]
    // init::@2
    // memset(screen, 0, 1000)
    // [18] call memset
    // [66] phi from init::@2 to memset [phi:init::@2->memset]
    // [66] phi memset::c#4 = 0 [phi:init::@2->memset#0] -- vbuxx=vbuc1 
    ldx #0
    // [66] phi memset::str#3 = (void *)screen [phi:init::@2->memset#1] -- pvoz1=pvoc1 
    lda #<screen
    sta.z memset.str
    lda #>screen
    sta.z memset.str+1
    jsr memset
    // [19] phi from init::@2 to init::@3 [phi:init::@2->init::@3]
    // init::@3
    // memset(colors, BLACK, 1000)
    // [20] call memset
    // [66] phi from init::@3 to memset [phi:init::@3->memset]
    // [66] phi memset::c#4 = BLACK [phi:init::@3->memset#0] -- vbuxx=vbuc1 
    ldx #BLACK
    // [66] phi memset::str#3 = (void *)colors [phi:init::@3->memset#1] -- pvoz1=pvoc1 
    lda #<colors
    sta.z memset.str
    lda #>colors
    sta.z memset.str+1
    jsr memset
    // [21] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181]
    // init::toD0181
    // init::@1
    // *D018 = toD018(screen, charset)
    // [22] *D018 = init::toD0181_return#0 -- _deref_pbuc1=vbuc2 
    lda #toD0181_return
    sta D018
    // asm
    // asm { lda#$5b sta$d011  }
    lda #$5b
    sta $d011
    // *BORDER_COLOR = BLACK
    // [24] *BORDER_COLOR = BLACK -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDER_COLOR
    // *BG_COLOR = BLACK
    // [25] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2 
    sta BG_COLOR
    // *BG_COLOR1 = RED
    // [26] *BG_COLOR1 = RED -- _deref_pbuc1=vbuc2 
    lda #RED
    sta BG_COLOR1
    // *BG_COLOR2 = BLUE
    // [27] *BG_COLOR2 = BLUE -- _deref_pbuc1=vbuc2 
    lda #BLUE
    sta BG_COLOR2
    // *BG_COLOR3 = GREEN
    // [28] *BG_COLOR3 = GREEN -- _deref_pbuc1=vbuc2 
    lda #GREEN
    sta BG_COLOR3
    // init::@return
    // }
    // [29] return 
    rts
}
  // draw_block
// void draw_block(__register(Y) char tileno, __register(X) char x, __zp($14) char y, char color)
draw_block: {
    .label __6 = 8
    .label __8 = $a
    .label __10 = 6
    .label y = $14
    .label x1 = 6
    .label z = 2
    .label z_1 = 6
    .label __11 = 4
    .label __12 = $c
    .label __13 = $e
    .label __14 = 8
    .label __15 = $10
    .label __16 = $a
    .label __17 = $12
    .label __18 = 6
    // tileno = tileno << 2
    // [30] draw_block::tileno#1 = draw_block::tileno#0 << 2 -- vbuyy=vbuyy_rol_2 
    tya
    asl
    asl
    tay
    // word x1 = x << 1
    // [31] draw_block::x1#0 = draw_block::x#0 << 1 -- vwuz1=vbuxx_rol_1 
    txa
    asl
    sta.z x1
    lda #0
    rol
    sta.z x1+1
    // y = y << 1
    // [32] draw_block::y#1 = draw_block::y#0 << 1 -- vbuaa=vbuz1_rol_1 
    lda.z y
    asl
    // word z = mul8u(y,40)
    // [33] mul8u::a#1 = draw_block::y#1 -- vbuxx=vbuaa 
    tax
    // [34] call mul8u
    // [74] phi from draw_block to mul8u [phi:draw_block->mul8u]
    jsr mul8u
    // word z = mul8u(y,40)
    // [35] mul8u::return#2 = mul8u::res#2
    // draw_block::@1
    // [36] draw_block::z#0 = mul8u::return#2
    // z = z + x1
    // [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz1 
    clc
    lda.z z_1
    adc.z z
    sta.z z_1
    lda.z z_1+1
    adc.z z+1
    sta.z z_1+1
    // byte drawtile = tileset[tileno]
    // [38] draw_block::drawtile#0 = tileset[draw_block::tileno#1] -- vbuxx=pbuc1_derefidx_vbuyy 
    ldx tileset,y
    // screen[z] = drawtile
    // [39] draw_block::$11 = screen + draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z z_1
    clc
    adc #<screen
    sta.z __11
    lda.z z_1+1
    adc #>screen
    sta.z __11+1
    // [40] *draw_block::$11 = draw_block::drawtile#0 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (__11),y
    // colors[z] = YELLOW
    // [41] draw_block::$12 = colors + draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z z_1
    clc
    adc #<colors
    sta.z __12
    lda.z z_1+1
    adc #>colors
    sta.z __12+1
    // [42] *draw_block::$12 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    sta (__12),y
    // z+1
    // [43] draw_block::$6 = draw_block::z#1 + 1 -- vwuz1=vwuz2_plus_1 
    clc
    lda.z z_1
    adc #1
    sta.z __6
    lda.z z_1+1
    adc #0
    sta.z __6+1
    // screen[z+1] = 1
    // [44] draw_block::$13 = screen + draw_block::$6 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __6
    clc
    adc #<screen
    sta.z __13
    lda.z __6+1
    adc #>screen
    sta.z __13+1
    // [45] *draw_block::$13 = 1 -- _deref_pbuz1=vbuc1 
    lda #1
    sta (__13),y
    // colors[z+1] = YELLOW
    // [46] draw_block::$14 = colors + draw_block::$6 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __14
    clc
    adc #<colors
    sta.z __14
    lda.z __14+1
    adc #>colors
    sta.z __14+1
    // [47] *draw_block::$14 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    sta (__14),y
    // z+40
    // [48] draw_block::$8 = draw_block::z#1 + $28 -- vwuz1=vwuz2_plus_vbuc1 
    lda #$28
    clc
    adc.z z_1
    sta.z __8
    tya
    adc.z z_1+1
    sta.z __8+1
    // screen[z+40] = 2
    // [49] draw_block::$15 = screen + draw_block::$8 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __8
    clc
    adc #<screen
    sta.z __15
    lda.z __8+1
    adc #>screen
    sta.z __15+1
    // [50] *draw_block::$15 = 2 -- _deref_pbuz1=vbuc1 
    lda #2
    sta (__15),y
    // colors[z+40] = YELLOW
    // [51] draw_block::$16 = colors + draw_block::$8 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __16
    clc
    adc #<colors
    sta.z __16
    lda.z __16+1
    adc #>colors
    sta.z __16+1
    // [52] *draw_block::$16 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    sta (__16),y
    // z+41
    // [53] draw_block::$10 = draw_block::z#1 + $29 -- vwuz1=vwuz1_plus_vbuc1 
    lda #$29
    clc
    adc.z __10
    sta.z __10
    bcc !+
    inc.z __10+1
  !:
    // screen[z+41] = 3
    // [54] draw_block::$17 = screen + draw_block::$10 -- pbuz1=pbuc1_plus_vwuz2 
    lda.z __10
    clc
    adc #<screen
    sta.z __17
    lda.z __10+1
    adc #>screen
    sta.z __17+1
    // [55] *draw_block::$17 = 3 -- _deref_pbuz1=vbuc1 
    lda #3
    ldy #0
    sta (__17),y
    // colors[z+41] = YELLOW
    // [56] draw_block::$18 = colors + draw_block::$10 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z __18
    clc
    adc #<colors
    sta.z __18
    lda.z __18+1
    adc #>colors
    sta.z __18+1
    // [57] *draw_block::$18 = YELLOW -- _deref_pbuz1=vbuc1 
    lda #YELLOW
    sta (__18),y
    // draw_block::@return
    // }
    // [58] return 
    rts
}
  // init_sprites
init_sprites: {
    // *SPRITES_ENABLE = %00000001
    // [59] *SPRITES_ENABLE = 1 -- _deref_pbuc1=vbuc2 
    lda #1
    sta SPRITES_ENABLE
    // *SPRITES_EXPAND_X = 0
    // [60] *SPRITES_EXPAND_X = 0 -- _deref_pbuc1=vbuc2 
    // one sprite enabled
    lda #0
    sta SPRITES_EXPAND_X
    // *SPRITES_EXPAND_Y = 0
    // [61] *SPRITES_EXPAND_Y = 0 -- _deref_pbuc1=vbuc2 
    sta SPRITES_EXPAND_Y
    // *SPRITES_XMSB = 0
    // [62] *SPRITES_XMSB = 0 -- _deref_pbuc1=vbuc2 
    sta SPRITES_XMSB
    // *SPRITES_COLOR = WHITE
    // [63] *SPRITES_COLOR = WHITE -- _deref_pbuc1=vbuc2 
    lda #WHITE
    sta SPRITES_COLOR
    // *SPRITES_MC = 0
    // [64] *SPRITES_MC = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta SPRITES_MC
    // init_sprites::@return
    // }
    // [65] return 
    rts
}
  // 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 = 6
    .label dst = 2
    .label str = 2
    // memset::@1
    // char* end = (char*)str + num
    // [67] memset::end#0 = (char *)memset::str#3 + $3e8 -- pbuz1=pbuz2_plus_vwuc1 
    lda.z str
    clc
    adc #<$3e8
    sta.z end
    lda.z str+1
    adc #>$3e8
    sta.z end+1
    // [68] memset::dst#4 = (char *)memset::str#3
    // [69] phi from memset::@1 memset::@3 to memset::@2 [phi:memset::@1/memset::@3->memset::@2]
    // [69] 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++)
    // [70] 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
    // }
    // [71] return 
    rts
    // memset::@3
  __b3:
    // *dst = c
    // [72] *memset::dst#2 = memset::c#4 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (dst),y
    // for(char* dst = str; dst!=end; dst++)
    // [73] memset::dst#1 = ++ memset::dst#2 -- pbuz1=_inc_pbuz1 
    inc.z dst
    bne !+
    inc.z dst+1
  !:
    jmp __b2
}
  // mul8u
// Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int
// __zp(2) unsigned int mul8u(__register(X) char a, char b)
mul8u: {
    .const b = $28
    .label mb = 4
    .label res = 2
    .label return = 2
    // [75] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1]
    // [75] phi mul8u::mb#2 = (unsigned int)mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vwuc1 
    lda #<b
    sta.z mb
    lda #>b
    sta.z mb+1
    // [75] phi mul8u::res#2 = 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vwuc1 
    lda #<0
    sta.z res
    sta.z res+1
    // [75] phi mul8u::a#2 = mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy 
    // mul8u::@1
  __b1:
    // while(a!=0)
    // [76] if(mul8u::a#2!=0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b2
    // mul8u::@return
    // }
    // [77] return 
    rts
    // mul8u::@2
  __b2:
    // a&1
    // [78] mul8u::$1 = mul8u::a#2 & 1 -- vbuaa=vbuxx_band_vbuc1 
    txa
    and #1
    // if( (a&1) != 0)
    // [79] if(mul8u::$1==0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b3
    // mul8u::@4
    // res = res + mb
    // [80] mul8u::res#1 = mul8u::res#2 + mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 
    clc
    lda.z res
    adc.z mb
    sta.z res
    lda.z res+1
    adc.z mb+1
    sta.z res+1
    // [81] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3]
    // [81] phi mul8u::res#6 = mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy 
    // mul8u::@3
  __b3:
    // a = a>>1
    // [82] mul8u::a#0 = mul8u::a#2 >> 1 -- vbuxx=vbuxx_ror_1 
    txa
    lsr
    tax
    // mb = mb<<1
    // [83] mul8u::mb#1 = mul8u::mb#2 << 1 -- vwuz1=vwuz1_rol_1 
    asl.z mb
    rol.z mb+1
    // [75] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1]
    // [75] phi mul8u::mb#2 = mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy 
    // [75] phi mul8u::res#2 = mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy 
    // [75] phi mul8u::a#2 = mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy 
    jmp __b1
}
  // File Data

