Fixing struct type size struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
Fixing struct type SIZE_OF struct MOS6532_RIOT to 24
Setting inferred volatile on symbol affected by address-of: p0_xpos in asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  }
Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  p0_ypos#12 = phi( __start::@1/p0_ypos#11 )
  idx2#11 = phi( __start::@1/idx2#10 )
  idx#11 = phi( __start::@1/idx#10 )
  asm { cld  }
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5
  to:main::@1
main::@1: scope:[main]  from main main::@15
  p0_ypos#10 = phi( main/p0_ypos#12, main::@15/p0_ypos#13 )
  idx2#9 = phi( main/idx2#11, main::@15/idx2#12 )
  idx#9 = phi( main/idx#11, main::@15/idx#12 )
  main::$4 = 0 != 1
  if(main::$4) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  idx2#5 = phi( main::@1/idx2#9 )
  idx#5 = phi( main::@1/idx#9 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 2
  *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 0
  asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  }
  p0_xpos = SINTABLE_160[idx#5]
  idx#0 = ++ idx#5
  p0_ypos#0 = SINTABLE_160[idx2#5]
  idx2#0 = ++ idx2#5
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@4
  idx2#18 = phi( main::@2/idx2#0, main::@4/idx2#23 )
  idx#18 = phi( main::@2/idx#0, main::@4/idx#23 )
  p0_ypos#19 = phi( main::@2/p0_ypos#0, main::@4/p0_ypos#23 )
  main::$5 = 0 != *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)
  if(main::$5) goto main::@4
  to:main::@5
main::@4: scope:[main]  from main::@3
  idx2#23 = phi( main::@3/idx2#18 )
  idx#23 = phi( main::@3/idx#18 )
  p0_ypos#23 = phi( main::@3/p0_ypos#19 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  to:main::@3
main::@5: scope:[main]  from main::@3
  idx2#17 = phi( main::@3/idx2#18 )
  idx#17 = phi( main::@3/idx#18 )
  p0_ypos#16 = phi( main::@3/p0_ypos#19 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
  main::p0_idx#0 = 0
  main::i#0 = 1
  to:main::@6
main::@6: scope:[main]  from main::@10 main::@5
  idx2#15 = phi( main::@10/idx2#16, main::@5/idx2#17 )
  idx#15 = phi( main::@10/idx#16, main::@5/idx#17 )
  p0_ypos#14 = phi( main::@10/p0_ypos#15, main::@5/p0_ypos#16 )
  main::p0_idx#7 = phi( main::@10/main::p0_idx#8, main::@5/main::p0_idx#0 )
  main::i#2 = phi( main::@10/main::i#1, main::@5/main::i#0 )
  main::$0 = main::i#2 < $c0
  if(main::$0) goto main::@7
  to:main::@8
main::@7: scope:[main]  from main::@6
  idx2#24 = phi( main::@6/idx2#15 )
  idx#24 = phi( main::@6/idx#15 )
  p0_ypos#9 = phi( main::@6/p0_ypos#14 )
  main::p0_idx#4 = phi( main::@6/main::p0_idx#7 )
  main::i#3 = phi( main::@6/main::i#2 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = main::i#3
  main::$6 = 0 != main::p0_idx#4
  if(main::$6) goto main::@9
  to:main::@12
main::@8: scope:[main]  from main::@6
  p0_ypos#18 = phi( main::@6/p0_ypos#14 )
  idx2#14 = phi( main::@6/idx2#15 )
  idx#14 = phi( main::@6/idx#15 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
  *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40
  to:main::@15
main::@9: scope:[main]  from main::@7
  idx2#25 = phi( main::@7/idx2#24 )
  idx#25 = phi( main::@7/idx#24 )
  p0_ypos#24 = phi( main::@7/p0_ypos#9 )
  main::i#9 = phi( main::@7/main::i#3 )
  main::p0_idx#5 = phi( main::@7/main::p0_idx#4 )
  main::gfx#0 = SPRITE_C[main::p0_idx#5]
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = main::gfx#0
  main::$3 = main::gfx#0 == 0
  if(main::$3) goto main::@11
  to:main::@14
main::@12: scope:[main]  from main::@7
  idx2#20 = phi( main::@7/idx2#24 )
  idx#20 = phi( main::@7/idx#24 )
  main::p0_idx#9 = phi( main::@7/main::p0_idx#4 )
  main::i#4 = phi( main::@7/main::i#3 )
  p0_ypos#5 = phi( main::@7/p0_ypos#9 )
  main::$1 = p0_ypos#5 == main::i#4
  main::$2 = ! main::$1
  if(main::$2) goto main::@10
  to:main::@13
main::@13: scope:[main]  from main::@12
  idx2#21 = phi( main::@12/idx2#20 )
  idx#21 = phi( main::@12/idx#20 )
  p0_ypos#21 = phi( main::@12/p0_ypos#5 )
  main::i#7 = phi( main::@12/main::i#4 )
  main::p0_idx#1 = 1
  to:main::@10
main::@10: scope:[main]  from main::@11 main::@12 main::@13 main::@14
  idx2#16 = phi( main::@11/idx2#19, main::@12/idx2#20, main::@13/idx2#21, main::@14/idx2#22 )
  idx#16 = phi( main::@11/idx#19, main::@12/idx#20, main::@13/idx#21, main::@14/idx#22 )
  p0_ypos#15 = phi( main::@11/p0_ypos#20, main::@12/p0_ypos#5, main::@13/p0_ypos#21, main::@14/p0_ypos#22 )
  main::p0_idx#8 = phi( main::@11/main::p0_idx#2, main::@12/main::p0_idx#9, main::@13/main::p0_idx#1, main::@14/main::p0_idx#3 )
  main::i#5 = phi( main::@11/main::i#6, main::@12/main::i#4, main::@13/main::i#7, main::@14/main::i#8 )
  main::i#1 = ++ main::i#5
  to:main::@6
main::@11: scope:[main]  from main::@9
  idx2#19 = phi( main::@9/idx2#25 )
  idx#19 = phi( main::@9/idx#25 )
  p0_ypos#20 = phi( main::@9/p0_ypos#24 )
  main::i#6 = phi( main::@9/main::i#9 )
  main::p0_idx#2 = 0
  to:main::@10
main::@14: scope:[main]  from main::@9
  idx2#22 = phi( main::@9/idx2#25 )
  idx#22 = phi( main::@9/idx#25 )
  p0_ypos#22 = phi( main::@9/p0_ypos#24 )
  main::i#8 = phi( main::@9/main::i#9 )
  main::p0_idx#6 = phi( main::@9/main::p0_idx#5 )
  main::p0_idx#3 = ++ main::p0_idx#6
  to:main::@10
main::@15: scope:[main]  from main::@16 main::@8
  p0_ypos#13 = phi( main::@16/p0_ypos#17, main::@8/p0_ypos#18 )
  idx2#12 = phi( main::@16/idx2#13, main::@8/idx2#14 )
  idx#12 = phi( main::@16/idx#13, main::@8/idx#14 )
  main::$7 = 0 != *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)
  if(main::$7) goto main::@16
  to:main::@1
main::@16: scope:[main]  from main::@15
  p0_ypos#17 = phi( main::@15/p0_ypos#13 )
  idx2#13 = phi( main::@15/idx2#12 )
  idx#13 = phi( main::@15/idx#12 )
  *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  to:main::@15
main::@return: scope:[main]  from main::@1
  idx2#6 = phi( main::@1/idx2#9 )
  p0_ypos#6 = phi( main::@1/p0_ypos#10 )
  idx#6 = phi( main::@1/idx#9 )
  idx#1 = idx#6
  p0_ypos#1 = p0_ypos#6
  idx2#1 = idx2#6
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  idx#2 = 0
  idx2#2 = $39
  p0_xpos = 0
  p0_ypos#2 = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  idx2#10 = phi( __start::__init1/idx2#2 )
  p0_ypos#11 = phi( __start::__init1/p0_ypos#2 )
  idx#10 = phi( __start::__init1/idx#2 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  idx2#7 = phi( __start::@1/idx2#1 )
  p0_ypos#7 = phi( __start::@1/p0_ypos#1 )
  idx#7 = phi( __start::@1/idx#1 )
  idx#3 = idx#7
  p0_ypos#3 = p0_ypos#7
  idx2#3 = idx2#7
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  p0_ypos#8 = phi( __start::@2/p0_ypos#3 )
  idx2#8 = phi( __start::@2/idx2#3 )
  idx#8 = phi( __start::@2/idx#3 )
  idx#4 = idx#8
  idx2#4 = idx2#8
  p0_ypos#4 = p0_ypos#8
  return 
  to:@return

SYMBOL TABLE SSA
__constant const char CYCLES_PER_SCANLINE = $4c
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0 = 6
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0 = $1b
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE = $2a
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0 = 4
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC = 0
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
__constant char OFFSET_STRUCT_MOS6532_RIOT_INTIM = 4
__constant char OFFSET_STRUCT_MOS6532_RIOT_TIM64T = $16
__constant struct MOS6532_RIOT * const RIOT = (struct MOS6532_RIOT *)$280
__constant const char SINTABLE_160[$100] = kickasm {{ .fill $100, 10+round(64.5+64.5*sin(2*PI*i/256))
 }}
__constant char SPRITE_C[] = { 0, $18, $18, $18, $18, $3c, $3c, $3c, $3c, $66, $66, $66, $66, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $66, $66, $66, $66, $3c, $3c, $3c, $3c, $18, $18, $18, $18, 0 }
__constant struct ATARI_TIA_WRITE * const TIA = (struct ATARI_TIA_WRITE *)0
__constant char * const TIA_HMP0 = (char *)$20
__constant char * const TIA_RESP0 = (char *)$10
__constant char * const TIA_WSYNC = (char *)2
void __start()
char idx
char idx#0
char idx#1
char idx#10
char idx#11
char idx#12
char idx#13
char idx#14
char idx#15
char idx#16
char idx#17
char idx#18
char idx#19
char idx#2
char idx#20
char idx#21
char idx#22
char idx#23
char idx#24
char idx#25
char idx#3
char idx#4
char idx#5
char idx#6
char idx#7
char idx#8
char idx#9
char idx2
char idx2#0
char idx2#1
char idx2#10
char idx2#11
char idx2#12
char idx2#13
char idx2#14
char idx2#15
char idx2#16
char idx2#17
char idx2#18
char idx2#19
char idx2#2
char idx2#20
char idx2#21
char idx2#22
char idx2#23
char idx2#24
char idx2#25
char idx2#3
char idx2#4
char idx2#5
char idx2#6
char idx2#7
char idx2#8
char idx2#9
void main()
bool main::$0
bool main::$1
bool main::$2
bool main::$3
bool main::$4
bool main::$5
bool main::$6
bool main::$7
char main::gfx
char main::gfx#0
char main::i
char main::i#0
char main::i#1
char main::i#2
char main::i#3
char main::i#4
char main::i#5
char main::i#6
char main::i#7
char main::i#8
char main::i#9
char main::p0_idx
char main::p0_idx#0
char main::p0_idx#1
char main::p0_idx#2
char main::p0_idx#3
char main::p0_idx#4
char main::p0_idx#5
char main::p0_idx#6
char main::p0_idx#7
char main::p0_idx#8
char main::p0_idx#9
__loadstore volatile char p0_xpos
char p0_ypos
char p0_ypos#0
char p0_ypos#1
char p0_ypos#10
char p0_ypos#11
char p0_ypos#12
char p0_ypos#13
char p0_ypos#14
char p0_ypos#15
char p0_ypos#16
char p0_ypos#17
char p0_ypos#18
char p0_ypos#19
char p0_ypos#2
char p0_ypos#20
char p0_ypos#21
char p0_ypos#22
char p0_ypos#23
char p0_ypos#24
char p0_ypos#3
char p0_ypos#4
char p0_ypos#5
char p0_ypos#6
char p0_ypos#7
char p0_ypos#8
char p0_ypos#9

Adding number conversion cast (unumber) $f0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0
Adding number conversion cast (unumber) $af in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af
Adding number conversion cast (unumber) 5 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5
Adding number conversion cast (unumber) 2 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 2
Adding number conversion cast (unumber) $29*CYCLES_PER_SCANLINE/$40 in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40
Adding number conversion cast (unumber) $29 in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = ((unumber)) $29*CYCLES_PER_SCANLINE/$40
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0
Adding number conversion cast (unumber) 0 in main::$5 = 0 != *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
Adding number conversion cast (unumber) $c0 in main::$0 = main::i#2 < $c0
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 0 in main::$6 = 0 != main::p0_idx#4
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Adding number conversion cast (unumber) 2 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
Adding number conversion cast (unumber) $1b*CYCLES_PER_SCANLINE/$40 in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40
Adding number conversion cast (unumber) $1b in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = ((unumber)) $1b*CYCLES_PER_SCANLINE/$40
Adding number conversion cast (unumber) 0 in main::$3 = main::gfx#0 == 0
Adding number conversion cast (unumber) 1 in main::p0_idx#1 = 1
Adding number conversion cast (unumber) 0 in main::p0_idx#2 = 0
Adding number conversion cast (unumber) 0 in main::$7 = 0 != *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)
Adding number conversion cast (unumber) 0 in *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
Successful SSA optimization PassNAddNumberTypeConversions
Adding number conversion cast (unumber) $40 in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = ((unumber)) (unumber)$29*CYCLES_PER_SCANLINE/$40
Adding number conversion cast (unumber) $40 in *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = ((unumber)) (unumber)$1b*CYCLES_PER_SCANLINE/$40
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = (unumber)$f0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = (unumber)$af
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = (unumber)5
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = (unumber)2
Inlining cast *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = (unumber)(unumber)$29*CYCLES_PER_SCANLINE/(unumber)$40
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = (unumber)2
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = (unumber)0
Inlining cast *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = (unumber)(unumber)$1b*CYCLES_PER_SCANLINE/(unumber)$40
Inlining cast main::p0_idx#1 = (unumber)1
Inlining cast main::p0_idx#2 = (unumber)0
Inlining cast *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 2
Simplifying constant pointer cast (char *) 16
Simplifying constant pointer cast (char *) 32
Simplifying constant pointer cast (struct ATARI_TIA_WRITE *) 0
Simplifying constant pointer cast (struct MOS6532_RIOT *) 640
Simplifying constant integer cast $f0
Simplifying constant integer cast $af
Simplifying constant integer cast 5
Simplifying constant integer cast 2
Simplifying constant integer cast (unumber)$29*CYCLES_PER_SCANLINE/(unumber)$40
Simplifying constant integer cast $29
Simplifying constant integer cast $40
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $c0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 2
Simplifying constant integer cast 0
Simplifying constant integer cast (unumber)$1b*CYCLES_PER_SCANLINE/(unumber)$40
Simplifying constant integer cast $1b
Simplifying constant integer cast $40
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $f0
Finalized unsigned number type (char) $af
Finalized unsigned number type (char) 5
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) $29
Finalized unsigned number type (char) $40
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) 0
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) 0
Finalized unsigned number type (char) $c0
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) 0
Finalized unsigned number type (char) $1b
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [52] main::$2 = p0_ypos#5 != main::i#4 from [51] main::$1 = p0_ypos#5 == main::i#4
Successful SSA optimization Pass2UnaryNotSimplification
Alias idx#1 = idx#5 idx#9 idx#6 
Alias idx2#1 = idx2#5 idx2#9 idx2#6 
Alias p0_ypos#16 = p0_ypos#23 p0_ypos#19 
Alias idx#17 = idx#23 idx#18 
Alias idx2#17 = idx2#23 idx2#18 
Alias main::i#2 = main::i#3 main::i#9 main::i#4 main::i#7 main::i#6 main::i#8 
Alias main::p0_idx#4 = main::p0_idx#7 main::p0_idx#5 main::p0_idx#9 main::p0_idx#6 
Alias p0_ypos#14 = p0_ypos#9 p0_ypos#18 p0_ypos#24 p0_ypos#5 p0_ypos#21 p0_ypos#20 p0_ypos#22 
Alias idx#14 = idx#24 idx#15 idx#25 idx#20 idx#21 idx#19 idx#22 
Alias idx2#14 = idx2#24 idx2#15 idx2#25 idx2#20 idx2#21 idx2#19 idx2#22 
Alias idx#12 = idx#13 
Alias idx2#12 = idx2#13 
Alias p0_ypos#13 = p0_ypos#17 
Alias p0_ypos#1 = p0_ypos#6 p0_ypos#10 
Alias idx#10 = idx#2 
Alias p0_ypos#11 = p0_ypos#2 
Alias idx2#10 = idx2#2 
Alias idx#3 = idx#7 idx#8 idx#4 
Alias p0_ypos#3 = p0_ypos#7 p0_ypos#8 p0_ypos#4 
Alias idx2#3 = idx2#7 idx2#8 idx2#4 
Successful SSA optimization Pass2AliasElimination
Alias main::i#2 = main::i#5 
Alias p0_ypos#14 = p0_ypos#15 
Alias idx#14 = idx#16 
Alias idx2#14 = idx2#16 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values idx#11 idx#10
Identical Phi Values idx2#11 idx2#10
Identical Phi Values p0_ypos#12 p0_ypos#11
Identical Phi Values p0_ypos#16 p0_ypos#0
Identical Phi Values idx#17 idx#0
Identical Phi Values idx2#17 idx2#0
Identical Phi Values p0_ypos#14 p0_ypos#16
Identical Phi Values idx#14 idx#17
Identical Phi Values idx2#14 idx2#17
Identical Phi Values idx#12 idx#14
Identical Phi Values idx2#12 idx2#14
Identical Phi Values p0_ypos#13 p0_ypos#14
Identical Phi Values idx#3 idx#1
Identical Phi Values p0_ypos#3 p0_ypos#1
Identical Phi Values idx2#3 idx2#1
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition main::$4 [7] if(0!=1) goto main::@2
Simple Condition main::$5 [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4
Simple Condition main::$0 [31] if(main::i#2<$c0) goto main::@7
Simple Condition main::$6 [35] if(0!=main::p0_idx#4) goto main::@9
Simple Condition main::$3 [43] if(main::gfx#0==0) goto main::@11
Simple Condition main::$2 [45] if(p0_ypos#0!=main::i#2) goto main::@10
Simple Condition main::$7 [53] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@16
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::p0_idx#0 = 0
Constant main::i#0 = 1
Constant main::p0_idx#1 = 1
Constant main::p0_idx#2 = 0
Constant idx#10 = 0
Constant idx2#10 = $39
Constant p0_ypos#11 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [7] if(0!=1) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero (char *)TIA in [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 2
Simplifying expression containing zero (char *)TIA in [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC) = 0
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused variable - keeping the phi block p0_ypos#1
Eliminating unused constant OFFSET_STRUCT_ATARI_TIA_WRITE_VSYNC
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant p0_ypos#11
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings main::p0_idx#0
Inlining constant with var siblings main::i#0
Inlining constant with var siblings main::p0_idx#1
Inlining constant with var siblings main::p0_idx#2
Inlining constant with var siblings idx#10
Inlining constant with var siblings idx2#10
Constant inlined idx#10 = 0
Constant inlined main::p0_idx#0 = 0
Constant inlined main::i#0 = 1
Constant inlined idx2#10 = $39
Constant inlined main::p0_idx#1 = 1
Constant inlined main::p0_idx#2 = 0
Successful SSA optimization Pass2ConstantInlining
Finalized unsigned number type (char) $f
Finalized unsigned number type (char) $f
Finalized unsigned number type (unsigned int) $100
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@17(between main::@15 and main::@1)
Added new block during phi lifting main::@18(between main::@12 and main::@10)
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of __start::@2
Adding NOP phi() at start of main::@13
Adding NOP phi() at start of main::@11
CALL GRAPH
Calls in [__start] to main:3 

Created 5 initial phi equivalence classes
Coalesced [34] idx#26 = idx#0
Coalesced [35] idx2#26 = idx2#0
Coalesced [44] main::i#10 = main::i#1
Coalesced [45] main::p0_idx#10 = main::p0_idx#8
Coalesced (already) [46] main::p0_idx#11 = main::p0_idx#4
Coalesced [51] main::p0_idx#12 = main::p0_idx#3
Coalesced down to 4 phi equivalence classes
Culled Empty Block label __start::@2
Culled Empty Block label main::@17
Culled Empty Block label main::@13
Culled Empty Block label main::@11
Renumbering block main::@12 to main::@11
Renumbering block main::@14 to main::@12
Renumbering block main::@15 to main::@13
Renumbering block main::@16 to main::@14
Renumbering block main::@18 to main::@15
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of main::@15

FINAL CONTROL FLOW GRAPH

void __start()
__start: scope:[__start]  from
  [0] phi()
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  [1] p0_xpos = 0
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  [2] phi()
  [3] call main
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  [4] return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  asm { cld  }
  [6] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0
  [7] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af
  [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5
  to:main::@1
main::@1: scope:[main]  from main main::@13
  [9] idx2#1 = phi( main/$39, main::@13/idx2#0 )
  [9] idx#1 = phi( main/0, main::@13/idx#0 )
  to:main::@2
main::@2: scope:[main]  from main::@1
  [10] *((char *)TIA) = 2
  [11] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40
  [12] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [14] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [15] *((char *)TIA) = 0
  asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  }
  [17] p0_xpos = SINTABLE_160[idx#1]
  [18] idx#0 = ++ idx#1
  [19] p0_ypos#0 = SINTABLE_160[idx2#1]
  [20] idx2#0 = ++ idx2#1
  [21] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [22] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@4
  [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@3
  [24] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0
  [25] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
  to:main::@6
main::@6: scope:[main]  from main::@10 main::@5
  [26] main::p0_idx#4 = phi( main::@10/main::p0_idx#8, main::@5/0 )
  [26] main::i#2 = phi( main::@10/main::i#1, main::@5/1 )
  [27] if(main::i#2<$c0) goto main::@7
  to:main::@8
main::@8: scope:[main]  from main::@6
  [28] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [29] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2
  [30] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0
  [31] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40
  to:main::@13
main::@13: scope:[main]  from main::@14 main::@8
  [32] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@14
  to:main::@1
main::@14: scope:[main]  from main::@13
  [33] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  to:main::@13
main::@7: scope:[main]  from main::@6
  [34] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  [35] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = main::i#2
  [36] if(0!=main::p0_idx#4) goto main::@9
  to:main::@11
main::@11: scope:[main]  from main::@7
  [37] if(p0_ypos#0!=main::i#2) goto main::@15
  to:main::@10
main::@15: scope:[main]  from main::@11
  [38] phi()
  to:main::@10
main::@10: scope:[main]  from main::@11 main::@12 main::@15 main::@9
  [39] main::p0_idx#8 = phi( main::@9/0, main::@15/main::p0_idx#4, main::@11/1, main::@12/main::p0_idx#3 )
  [40] main::i#1 = ++ main::i#2
  to:main::@6
main::@9: scope:[main]  from main::@7
  [41] main::gfx#0 = SPRITE_C[main::p0_idx#4]
  [42] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = main::gfx#0
  [43] if(main::gfx#0==0) goto main::@10
  to:main::@12
main::@12: scope:[main]  from main::@9
  [44] main::p0_idx#3 = ++ main::p0_idx#4
  to:main::@10
main::@4: scope:[main]  from main::@3
  [45] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0
  to:main::@3


VARIABLE REGISTER WEIGHTS
void __start()
char idx
char idx#0 // 39.357142857142854
char idx#1 // 133.66666666666669
char idx2
char idx2#0 // 42.38461538461539
char idx2#1 // 109.36363636363637
void main()
char main::gfx
char main::gfx#0 // 1501.5
char main::i
char main::i#1 // 2002.0
char main::i#2 // 417.08333333333337
char main::p0_idx
char main::p0_idx#3 // 2002.0
char main::p0_idx#4 // 500.5
char main::p0_idx#8 // 1501.5
__loadstore volatile char p0_xpos // 2.452380952380952
char p0_ypos
char p0_ypos#0 // 52.476190476190474

Initial phi equivalence classes
[ idx#1 idx#0 ]
[ idx2#1 idx2#0 ]
[ main::i#2 main::i#1 ]
[ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ]
Added variable p0_xpos to live range equivalence class [ p0_xpos ]
Added variable p0_ypos#0 to live range equivalence class [ p0_ypos#0 ]
Added variable main::gfx#0 to live range equivalence class [ main::gfx#0 ]
Complete equivalence classes
[ idx#1 idx#0 ]
[ idx2#1 idx2#0 ]
[ main::i#2 main::i#1 ]
[ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ]
[ p0_xpos ]
[ p0_ypos#0 ]
[ main::gfx#0 ]
Allocated zp[1]:128 [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ]
Allocated zp[1]:129 [ main::i#2 main::i#1 ]
Allocated zp[1]:130 [ main::gfx#0 ]
Allocated zp[1]:131 [ idx#1 idx#0 ]
Allocated zp[1]:132 [ idx2#1 idx2#0 ]
Allocated zp[1]:133 [ p0_ypos#0 ]
Allocated zp[1]:134 [ p0_xpos ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] p0_xpos = 0 [ p0_xpos ] (  [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [6] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0 [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [7] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5 [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [10] *((char *)TIA) = 2 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:131 [ idx#1 idx#0 ]
Removing always clobbered register reg byte a as potential for zp[1]:132 [ idx2#1 idx2#0 ]
Statement [11] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [12] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [14] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [15] *((char *)TIA) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  } always clobbers reg byte a 
Statement [17] p0_xpos = SINTABLE_160[idx#1] [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [21] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:133 [ p0_ypos#0 ]
Statement [22] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [24] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [25] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [28] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [29] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [30] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [31] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [32] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@14 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [33] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [34] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 main::i#2 main::p0_idx#4 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 main::i#2 main::p0_idx#4 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:129 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:128 [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ]
Statement [45] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [1] p0_xpos = 0 [ p0_xpos ] (  [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [6] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0 [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [7] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5 [ p0_xpos ] ( main:3 [ p0_xpos ] { }  ) always clobbers reg byte a 
Statement [10] *((char *)TIA) = 2 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [11] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [12] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [14] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [15] *((char *)TIA) = 0 [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  } always clobbers reg byte a 
Statement [17] p0_xpos = SINTABLE_160[idx#1] [ p0_xpos idx#1 idx2#1 ] ( main:3 [ p0_xpos idx#1 idx2#1 ] { }  ) always clobbers reg byte a 
Statement [21] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [22] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [24] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [25] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Statement [28] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [29] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [30] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [31] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [32] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@14 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [33] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 ] { }  ) always clobbers reg byte a 
Statement [34] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 main::i#2 main::p0_idx#4 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 main::i#2 main::p0_idx#4 ] { }  ) always clobbers reg byte a 
Statement [45] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] ( main:3 [ p0_xpos idx#0 idx2#0 p0_ypos#0 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:131 [ idx#1 idx#0 ] : zp[1]:131 , reg byte x , reg byte y , 
Potential registers zp[1]:132 [ idx2#1 idx2#0 ] : zp[1]:132 , reg byte x , reg byte y , 
Potential registers zp[1]:129 [ main::i#2 main::i#1 ] : zp[1]:129 , reg byte x , reg byte y , 
Potential registers zp[1]:128 [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ] : zp[1]:128 , reg byte x , reg byte y , 
Potential registers zp[1]:134 [ p0_xpos ] : zp[1]:134 , 
Potential registers zp[1]:133 [ p0_ypos#0 ] : zp[1]:133 , reg byte x , reg byte y , 
Potential registers zp[1]:130 [ main::gfx#0 ] : zp[1]:130 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 4,004: zp[1]:128 [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ] 2,419.08: zp[1]:129 [ main::i#2 main::i#1 ] 1,501.5: zp[1]:130 [ main::gfx#0 ] 
Uplift Scope [] 173.02: zp[1]:131 [ idx#1 idx#0 ] 151.75: zp[1]:132 [ idx2#1 idx2#0 ] 52.48: zp[1]:133 [ p0_ypos#0 ] 2.45: zp[1]:134 [ p0_xpos ] 
Uplift Scope [ATARI_TIA_WRITE] 
Uplift Scope [ATARI_TIA_READ] 
Uplift Scope [MOS6532_RIOT] 
Uplift Scope [__start] 

Uplifting [main] best 13148 combination reg byte y [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::gfx#0 ] 
Uplifting [] best 13148 combination zp[1]:131 [ idx#1 idx#0 ] zp[1]:132 [ idx2#1 idx2#0 ] zp[1]:133 [ p0_ypos#0 ] zp[1]:134 [ p0_xpos ] 
Uplifting [ATARI_TIA_WRITE] best 13148 combination 
Uplifting [ATARI_TIA_READ] best 13148 combination 
Uplifting [MOS6532_RIOT] best 13148 combination 
Uplifting [__start] best 13148 combination 
Attempting to uplift remaining variables inzp[1]:131 [ idx#1 idx#0 ]
Uplifting [] best 13148 combination zp[1]:131 [ idx#1 idx#0 ] 
Attempting to uplift remaining variables inzp[1]:132 [ idx2#1 idx2#0 ]
Uplifting [] best 13148 combination zp[1]:132 [ idx2#1 idx2#0 ] 
Attempting to uplift remaining variables inzp[1]:133 [ p0_ypos#0 ]
Uplifting [] best 13148 combination zp[1]:133 [ p0_ypos#0 ] 
Attempting to uplift remaining variables inzp[1]:134 [ p0_xpos ]
Uplifting [] best 13148 combination zp[1]:134 [ p0_xpos ] 
Allocated (was zp[1]:131) zp[1]:128 [ idx#1 idx#0 ]
Allocated (was zp[1]:132) zp[1]:129 [ idx2#1 idx2#0 ]
Allocated (was zp[1]:133) zp[1]:130 [ p0_ypos#0 ]
Allocated (was zp[1]:134) zp[1]:131 [ p0_xpos ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Minimal Atari 2600 VCS Program using Sprites
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
/// @file
/// Atari 2600 Registers and Constants
///
/// https://web.archive.org/web/20170215054248/http://www.atariguide.com/pdfs/Atari_2600_VCS_Domestic_Field_Service_Manual.pdf
  // Upstart
  // Atari 2600 VCS 2K ROM in A26 executable file
.file [name="atari2600-sprites.a26", type="bin", segments="Code, Data, Vectors"]
.segmentdef Code [start=$f800,min=$f800,max=$fff9]
.segmentdef Data [startAfter="Code",max=$fff9]
.segmentdef Vectors [start=$fffa,max=$ffff]
.segment Vectors
.word __start // NMI
.word __start // RESET
.word __start // IRQ
  // Global Constants & labels
  /// The number of CPU cycles per scanline
  .const CYCLES_PER_SCANLINE = $4c
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0 = 6
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0 = $1b
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0 = 4
  .const OFFSET_STRUCT_MOS6532_RIOT_TIM64T = $16
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE = $2a
  .const OFFSET_STRUCT_MOS6532_RIOT_INTIM = 4
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
  /// The TIA WSYNC register (for access from inline ASM)
  .label TIA_WSYNC = 2
  /// The TIA RESP0 register (for access from inline ASM)
  .label TIA_RESP0 = $10
  /// The TIA HMP0 register (for access from inline ASM)
  .label TIA_HMP0 = $20
  /// Atari TIA write registers
  .label TIA = 0
  /// Atari RIOT registers
  .label RIOT = $280
  // Player 0 X position
  .label p0_xpos = $83
  // Counts frames
  .label idx = $80
  // Player 0 Y position
  .label p0_ypos = $82
  .label idx2 = $81
.segment Code
  // __start
__start: {
    jmp __init1
    // __start::__init1
  __init1:
    // [1] p0_xpos = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z p0_xpos
    // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
  __b1_from___init1:
    jmp __b1
    // __start::@1
  __b1:
    // [3] call main
    jsr main
    jmp __breturn
    // __start::@return
  __breturn:
    // [4] return 
    rts
}
  // main
main: {
    // asm { cld  }
    cld
    // [6] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0 -- _deref_pbuc1=vbuc2 
    // Player 0
    // - Color
    lda #$f0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0
    // [7] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af -- _deref_pbuc1=vbuc2 
    // - Graphics
    lda #$af
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0
    // [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5 -- _deref_pbuc1=vbuc2 
    // - Size
    lda #5
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0
    // [9] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [9] phi idx2#1 = $39 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #$39
    sta.z idx2
    // [9] phi idx#1 = 0 [phi:main->main::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    jmp __b1
    // main::@1
  __b1:
    jmp __b2
    // main::@2
  __b2:
    // [10] *((char *)TIA) = 2 -- _deref_pbuc1=vbuc2 
    // Vertical Sync
    // here we generate the signal that tells the TV to move the beam to the top of
    // the screen so we can start the next frame of video.
    // The Sync Signal must be on for 3 scanlines.
    lda #2
    sta TIA
    // [11] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40 -- _deref_pbuc1=vbuc2 
    // D1=1, turns on Vertical Sync signal
    lda #$29*CYCLES_PER_SCANLINE/$40
    sta RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T
    // [12] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Set timer to wait 41 lines
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Wait for Sync - halts CPU until end of 1st scanline of VSYNC
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [14] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // wait until end of 2nd scanline of VSYNC
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [15] *((char *)TIA) = 0 -- _deref_pbuc1=vbuc2 
    // wait until end of 3rd scanline of VSYNC
    lda #0
    sta TIA
    // asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  }
    // Vertical Sprite Position Player 0 - inline ASM to achieve cycle exact code
    lda p0_xpos
    sta TIA_WSYNC
    sec
  !:
    sbc #$f
    bcs !-
    eor #7
    asl
    asl
    asl
    asl
    sta TIA_HMP0
    sta TIA_RESP0
    // [17] p0_xpos = SINTABLE_160[idx#1] -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z idx
    lda SINTABLE_160,y
    sta.z p0_xpos
    // [18] idx#0 = ++ idx#1 -- vbuz1=_inc_vbuz1 
    inc.z idx
    // [19] p0_ypos#0 = SINTABLE_160[idx2#1] -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z idx2
    lda SINTABLE_160,y
    sta.z p0_ypos
    // [20] idx2#0 = ++ idx2#1 -- vbuz1=_inc_vbuz1 
    inc.z idx2
    // [21] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Execute horisontal movement
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [22] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE
    jmp __b3
  // Wait for the timer to run out
    // main::@3
  __b3:
    // [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4 -- 0_neq__deref_pbuc1_then_la1 
    lda RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM
    bne __b4
    jmp __b5
    // main::@5
  __b5:
    // [24] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0 -- _deref_pbuc1=vbuc2 
    // Screen - display logic
    // Update the registers in TIA (the video chip) in order to generate what the player sees.
    // For now we're just going to output 192 colored scanlines lines so we have something to see.
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
    // [25] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 -- _deref_pbuc1=vbuc2 
    // D1=1, turns off Vertical Blank signal (image output on)
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // [26] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
  __b6_from___b5:
    // [26] phi main::p0_idx#4 = 0 [phi:main::@5->main::@6#0] -- vbuyy=vbuc1 
    ldy #0
    // [26] phi main::i#2 = 1 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 
    ldx #1
    jmp __b6
    // main::@6
  __b6:
    // [27] if(main::i#2<$c0) goto main::@7 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$c0
    bcc __b7
    jmp __b8
    // main::@8
  __b8:
    // [28] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Start OverScan
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [29] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2 -- _deref_pbuc1=vbuc2 
    // Wait for SYNC (halts CPU until end of scanline)
    lda #2
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
    // [30] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 -- _deref_pbuc1=vbuc2 
    // D1=1 turns image output off
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // [31] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40 -- _deref_pbuc1=vbuc2 
    // Set background color to black
    lda #$1b*CYCLES_PER_SCANLINE/$40
    sta RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T
    jmp __b13
  // Wait for the timer to run out
    // main::@13
  __b13:
    // [32] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@14 -- 0_neq__deref_pbuc1_then_la1 
    lda RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM
    bne __b14
    // [9] phi from main::@13 to main::@1 [phi:main::@13->main::@1]
  __b1_from___b13:
    // [9] phi idx2#1 = idx2#0 [phi:main::@13->main::@1#0] -- register_copy 
    // [9] phi idx#1 = idx#0 [phi:main::@13->main::@1#1] -- register_copy 
    jmp __b1
    // main::@14
  __b14:
    // [33] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    jmp __b13
    // main::@7
  __b7:
    // [34] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Wait for SYNC (halts CPU until end of scanline)
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [35] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = main::i#2 -- _deref_pbuc1=vbuxx 
    stx TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // [36] if(0!=main::p0_idx#4) goto main::@9 -- 0_neq_vbuyy_then_la1 
    cpy #0
    bne __b9
    jmp __b11
    // main::@11
  __b11:
    // [37] if(p0_ypos#0!=main::i#2) goto main::@15 -- vbuz1_neq_vbuxx_then_la1 
    cpx.z p0_ypos
    bne __b15_from___b11
    // [39] phi from main::@11 to main::@10 [phi:main::@11->main::@10]
  __b10_from___b11:
    // [39] phi main::p0_idx#8 = 1 [phi:main::@11->main::@10#0] -- vbuyy=vbuc1 
    ldy #1
    jmp __b10
    // [38] phi from main::@11 to main::@15 [phi:main::@11->main::@15]
  __b15_from___b11:
    jmp __b15
    // main::@15
  __b15:
    // [39] phi from main::@12 main::@15 to main::@10 [phi:main::@12/main::@15->main::@10]
  __b10_from___b12:
  __b10_from___b15:
    // [39] phi main::p0_idx#8 = main::p0_idx#3 [phi:main::@12/main::@15->main::@10#0] -- register_copy 
    jmp __b10
    // [39] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
  __b10_from___b9:
    // [39] phi main::p0_idx#8 = 0 [phi:main::@9->main::@10#0] -- vbuyy=vbuc1 
    ldy #0
    jmp __b10
    // main::@10
  __b10:
    // [40] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [26] phi from main::@10 to main::@6 [phi:main::@10->main::@6]
  __b6_from___b10:
    // [26] phi main::p0_idx#4 = main::p0_idx#8 [phi:main::@10->main::@6#0] -- register_copy 
    // [26] phi main::i#2 = main::i#1 [phi:main::@10->main::@6#1] -- register_copy 
    jmp __b6
    // main::@9
  __b9:
    // [41] main::gfx#0 = SPRITE_C[main::p0_idx#4] -- vbuaa=pbuc1_derefidx_vbuyy 
    // Player 0 is active - show it
    lda SPRITE_C,y
    // [42] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = main::gfx#0 -- _deref_pbuc1=vbuaa 
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0
    // [43] if(main::gfx#0==0) goto main::@10 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b10_from___b9
    jmp __b12
    // main::@12
  __b12:
    // [44] main::p0_idx#3 = ++ main::p0_idx#4 -- vbuyy=_inc_vbuyy 
    iny
    jmp __b10_from___b12
    // main::@4
  __b4:
    // [45] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    jmp __b3
}
  // File Data
.segment Data
  // Sine table
SINTABLE_160:
.fill $100, 10+round(64.5+64.5*sin(2*PI*i/256))

  // The letter C
  SPRITE_C: .byte 0, $18, $18, $18, $18, $3c, $3c, $3c, $3c, $66, $66, $66, $66, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $66, $66, $66, $66, $3c, $3c, $3c, $3c, $18, $18, $18, $18, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __init1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b8
Removing instruction jmp __b13
Removing instruction jmp __b11
Removing instruction jmp __b15
Removing instruction jmp __b10
Removing instruction jmp __b12
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1 with __b2
Replacing label __b15_from___b11 with __b15
Replacing label __b10_from___b12 with __b15
Removing instruction __b1_from___init1:
Removing instruction __b1:
Removing instruction __b15_from___b11:
Removing instruction __b10_from___b12:
Removing instruction __b10_from___b15:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b1_from_main:
Removing instruction __b5:
Removing instruction __b6_from___b5:
Removing instruction __b8:
Removing instruction __b1_from___b13:
Removing instruction __b11:
Removing instruction __b10_from___b11:
Removing instruction __b6_from___b10:
Removing instruction __b12:
Succesful ASM optimization Pass5UnusedLabelElimination
Skipping double jump to __b10 in bne __b15
Skipping double jump to __b10 in jmp __b15
Succesful ASM optimization Pass5DoubleJumpElimination
Relabelling long label __b10_from___b9 to __b1
Succesful ASM optimization Pass5RelabelLongLabels
Replacing instruction ldy #0 with TAY
Removing instruction __b15:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction jmp __b10
Succesful ASM optimization Pass5UnreachableCodeElimination

FINAL SYMBOL TABLE
__constant const char CYCLES_PER_SCANLINE = $4c
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0 = 6
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0 = $1b
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE = $2a
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0 = 4
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
__constant char OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
__constant char OFFSET_STRUCT_MOS6532_RIOT_INTIM = 4
__constant char OFFSET_STRUCT_MOS6532_RIOT_TIM64T = $16
__constant struct MOS6532_RIOT * const RIOT = (struct MOS6532_RIOT *) 640
__constant const char SINTABLE_160[$100] = kickasm {{ .fill $100, 10+round(64.5+64.5*sin(2*PI*i/256))
 }}
__constant char SPRITE_C[] = { 0, $18, $18, $18, $18, $3c, $3c, $3c, $3c, $66, $66, $66, $66, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $66, $66, $66, $66, $3c, $3c, $3c, $3c, $18, $18, $18, $18, 0 }
__constant struct ATARI_TIA_WRITE * const TIA = (struct ATARI_TIA_WRITE *) 0
__constant char * const TIA_HMP0 = (char *) 32
__constant char * const TIA_RESP0 = (char *) 16
__constant char * const TIA_WSYNC = (char *) 2
void __start()
char idx
char idx#0 // idx zp[1]:128 39.357142857142854
char idx#1 // idx zp[1]:128 133.66666666666669
char idx2
char idx2#0 // idx2 zp[1]:129 42.38461538461539
char idx2#1 // idx2 zp[1]:129 109.36363636363637
void main()
char main::gfx
char main::gfx#0 // reg byte a 1501.5
char main::i
char main::i#1 // reg byte x 2002.0
char main::i#2 // reg byte x 417.08333333333337
char main::p0_idx
char main::p0_idx#3 // reg byte y 2002.0
char main::p0_idx#4 // reg byte y 500.5
char main::p0_idx#8 // reg byte y 1501.5
__loadstore volatile char p0_xpos // zp[1]:131 2.452380952380952
char p0_ypos
char p0_ypos#0 // p0_ypos zp[1]:130 52.476190476190474

zp[1]:128 [ idx#1 idx#0 ]
zp[1]:129 [ idx2#1 idx2#0 ]
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::p0_idx#4 main::p0_idx#8 main::p0_idx#3 ]
zp[1]:131 [ p0_xpos ]
zp[1]:130 [ p0_ypos#0 ]
reg byte a [ main::gfx#0 ]


FINAL ASSEMBLER
Score: 10492

  // File Comments
// Minimal Atari 2600 VCS Program using Sprites
// Source: https://atariage.com/forums/blogs/entry/11109-step-1-generate-a-stable-display/
/// @file
/// Atari 2600 Registers and Constants
///
/// https://web.archive.org/web/20170215054248/http://www.atariguide.com/pdfs/Atari_2600_VCS_Domestic_Field_Service_Manual.pdf
  // Upstart
  // Atari 2600 VCS 2K ROM in A26 executable file
.file [name="atari2600-sprites.a26", type="bin", segments="Code, Data, Vectors"]
.segmentdef Code [start=$f800,min=$f800,max=$fff9]
.segmentdef Data [startAfter="Code",max=$fff9]
.segmentdef Vectors [start=$fffa,max=$ffff]
.segment Vectors
.word __start // NMI
.word __start // RESET
.word __start // IRQ
  // Global Constants & labels
  /// The number of CPU cycles per scanline
  .const CYCLES_PER_SCANLINE = $4c
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0 = 6
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0 = $1b
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0 = 4
  .const OFFSET_STRUCT_MOS6532_RIOT_TIM64T = $16
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC = 2
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE = $2a
  .const OFFSET_STRUCT_MOS6532_RIOT_INTIM = 4
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK = 1
  .const OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK = 9
  /// The TIA WSYNC register (for access from inline ASM)
  .label TIA_WSYNC = 2
  /// The TIA RESP0 register (for access from inline ASM)
  .label TIA_RESP0 = $10
  /// The TIA HMP0 register (for access from inline ASM)
  .label TIA_HMP0 = $20
  /// Atari TIA write registers
  .label TIA = 0
  /// Atari RIOT registers
  .label RIOT = $280
  // Player 0 X position
  .label p0_xpos = $83
  // Counts frames
  .label idx = $80
  // Player 0 Y position
  .label p0_ypos = $82
  .label idx2 = $81
.segment Code
  // __start
__start: {
    // __start::__init1
    // __ma char p0_xpos
    // [1] p0_xpos = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z p0_xpos
    // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
    // __start::@1
    // [3] call main
    jsr main
    // __start::@return
    // [4] return 
    rts
}
  // main
main: {
    // asm
    // asm { cld  }
    cld
    // TIA->COLUP0 = 0xf0
    // [6] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0) = $f0 -- _deref_pbuc1=vbuc2 
    // Player 0
    // - Color
    lda #$f0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUP0
    // TIA->GRP0 = 0xaf
    // [7] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = $af -- _deref_pbuc1=vbuc2 
    // - Graphics
    lda #$af
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0
    // TIA->NUSIZ0 = 0x05
    // [8] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0) = 5 -- _deref_pbuc1=vbuc2 
    // - Size
    lda #5
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_NUSIZ0
    // [9] phi from main to main::@1 [phi:main->main::@1]
    // [9] phi idx2#1 = $39 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #$39
    sta.z idx2
    // [9] phi idx#1 = 0 [phi:main->main::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    // main::@1
    // main::@2
  __b2:
    // TIA->VSYNC = 2
    // [10] *((char *)TIA) = 2 -- _deref_pbuc1=vbuc2 
    // Vertical Sync
    // here we generate the signal that tells the TV to move the beam to the top of
    // the screen so we can start the next frame of video.
    // The Sync Signal must be on for 3 scanlines.
    lda #2
    sta TIA
    // RIOT->TIM64T = (41*CYCLES_PER_SCANLINE)/64
    // [11] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $29*CYCLES_PER_SCANLINE/$40 -- _deref_pbuc1=vbuc2 
    // D1=1, turns on Vertical Sync signal
    lda #$29*CYCLES_PER_SCANLINE/$40
    sta RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T
    // TIA->WSYNC = 0
    // [12] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Set timer to wait 41 lines
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [13] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Wait for Sync - halts CPU until end of 1st scanline of VSYNC
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // [14] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // wait until end of 2nd scanline of VSYNC
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // TIA->VSYNC = 0
    // [15] *((char *)TIA) = 0 -- _deref_pbuc1=vbuc2 
    // wait until end of 3rd scanline of VSYNC
    sta TIA
    // asm
    // asm { ldap0_xpos staTIA_WSYNC sec !: sbc#$f bcs!- eor#7 asl asl asl asl staTIA_HMP0 staTIA_RESP0  }
    // Vertical Sprite Position Player 0 - inline ASM to achieve cycle exact code
    lda p0_xpos
    sta TIA_WSYNC
    sec
  !:
    sbc #$f
    bcs !-
    eor #7
    asl
    asl
    asl
    asl
    sta TIA_HMP0
    sta TIA_RESP0
    // p0_xpos = SINTABLE_160[idx++]
    // [17] p0_xpos = SINTABLE_160[idx#1] -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z idx
    lda SINTABLE_160,y
    sta.z p0_xpos
    // p0_xpos = SINTABLE_160[idx++];
    // [18] idx#0 = ++ idx#1 -- vbuz1=_inc_vbuz1 
    inc.z idx
    // p0_ypos = SINTABLE_160[idx2++]
    // [19] p0_ypos#0 = SINTABLE_160[idx2#1] -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy.z idx2
    lda SINTABLE_160,y
    sta.z p0_ypos
    // p0_ypos = SINTABLE_160[idx2++];
    // [20] idx2#0 = ++ idx2#1 -- vbuz1=_inc_vbuz1 
    inc.z idx2
    // TIA->WSYNC = 0
    // [21] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Execute horisontal movement
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // TIA->HMOVE = 0
    // [22] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE) = 0 -- _deref_pbuc1=vbuc2 
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_HMOVE
  // Wait for the timer to run out
    // main::@3
  __b3:
    // while(RIOT->INTIM)
    // [23] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@4 -- 0_neq__deref_pbuc1_then_la1 
    lda RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM
    bne __b4
    // main::@5
    // TIA->VBLANK = 0
    // [24] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 0 -- _deref_pbuc1=vbuc2 
    // Screen - display logic
    // Update the registers in TIA (the video chip) in order to generate what the player sees.
    // For now we're just going to output 192 colored scanlines lines so we have something to see.
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
    // TIA->COLUBK = 0x0
    // [25] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 -- _deref_pbuc1=vbuc2 
    // D1=1, turns off Vertical Blank signal (image output on)
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // [26] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
    // [26] phi main::p0_idx#4 = 0 [phi:main::@5->main::@6#0] -- vbuyy=vbuc1 
    tay
    // [26] phi main::i#2 = 1 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 
    ldx #1
    // main::@6
  __b6:
    // for(char i=1;i<192;i++)
    // [27] if(main::i#2<$c0) goto main::@7 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$c0
    bcc __b7
    // main::@8
    // TIA->WSYNC = 0
    // [28] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Start OverScan
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // TIA->VBLANK = 2
    // [29] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK) = 2 -- _deref_pbuc1=vbuc2 
    // Wait for SYNC (halts CPU until end of scanline)
    lda #2
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_VBLANK
    // TIA->COLUBK = 0
    // [30] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = 0 -- _deref_pbuc1=vbuc2 
    // D1=1 turns image output off
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // RIOT->TIM64T = (27*CYCLES_PER_SCANLINE)/64
    // [31] *((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T) = $1b*CYCLES_PER_SCANLINE/$40 -- _deref_pbuc1=vbuc2 
    // Set background color to black
    lda #$1b*CYCLES_PER_SCANLINE/$40
    sta RIOT+OFFSET_STRUCT_MOS6532_RIOT_TIM64T
  // Wait for the timer to run out
    // main::@13
  __b13:
    // while(RIOT->INTIM)
    // [32] if(0!=*((char *)RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM)) goto main::@14 -- 0_neq__deref_pbuc1_then_la1 
    lda RIOT+OFFSET_STRUCT_MOS6532_RIOT_INTIM
    bne __b14
    // [9] phi from main::@13 to main::@1 [phi:main::@13->main::@1]
    // [9] phi idx2#1 = idx2#0 [phi:main::@13->main::@1#0] -- register_copy 
    // [9] phi idx#1 = idx#0 [phi:main::@13->main::@1#1] -- register_copy 
    jmp __b2
    // main::@14
  __b14:
    // TIA->WSYNC = 0
    // [33] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    jmp __b13
    // main::@7
  __b7:
    // [34] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    // Wait for SYNC (halts CPU until end of scanline)
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    // TIA->COLUBK = i
    // [35] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK) = main::i#2 -- _deref_pbuc1=vbuxx 
    stx TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_COLUBK
    // if(p0_idx)
    // [36] if(0!=main::p0_idx#4) goto main::@9 -- 0_neq_vbuyy_then_la1 
    cpy #0
    bne __b9
    // main::@11
    // if(p0_ypos==i)
    // [37] if(p0_ypos#0!=main::i#2) goto main::@15 -- vbuz1_neq_vbuxx_then_la1 
    cpx.z p0_ypos
    bne __b10
    // [39] phi from main::@11 to main::@10 [phi:main::@11->main::@10]
    // [39] phi main::p0_idx#8 = 1 [phi:main::@11->main::@10#0] -- vbuyy=vbuc1 
    ldy #1
    jmp __b10
    // [38] phi from main::@11 to main::@15 [phi:main::@11->main::@15]
    // main::@15
    // [39] phi from main::@12 main::@15 to main::@10 [phi:main::@12/main::@15->main::@10]
    // [39] phi main::p0_idx#8 = main::p0_idx#3 [phi:main::@12/main::@15->main::@10#0] -- register_copy 
    // [39] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
  __b1:
    // [39] phi main::p0_idx#8 = 0 [phi:main::@9->main::@10#0] -- vbuyy=vbuc1 
    ldy #0
    // main::@10
  __b10:
    // for(char i=1;i<192;i++)
    // [40] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [26] phi from main::@10 to main::@6 [phi:main::@10->main::@6]
    // [26] phi main::p0_idx#4 = main::p0_idx#8 [phi:main::@10->main::@6#0] -- register_copy 
    // [26] phi main::i#2 = main::i#1 [phi:main::@10->main::@6#1] -- register_copy 
    jmp __b6
    // main::@9
  __b9:
    // char gfx = SPRITE_C[p0_idx]
    // [41] main::gfx#0 = SPRITE_C[main::p0_idx#4] -- vbuaa=pbuc1_derefidx_vbuyy 
    // Player 0 is active - show it
    lda SPRITE_C,y
    // TIA->GRP0 = gfx
    // [42] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0) = main::gfx#0 -- _deref_pbuc1=vbuaa 
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_GRP0
    // if(gfx==0)
    // [43] if(main::gfx#0==0) goto main::@10 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b1
    // main::@12
    // p0_idx++;
    // [44] main::p0_idx#3 = ++ main::p0_idx#4 -- vbuyy=_inc_vbuyy 
    iny
    jmp __b10
    // main::@4
  __b4:
    // TIA->WSYNC = 0
    // [45] *((char *)TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta TIA+OFFSET_STRUCT_ATARI_TIA_WRITE_WSYNC
    jmp __b3
}
  // File Data
.segment Data
  // Sine table
SINTABLE_160:
.fill $100, 10+round(64.5+64.5*sin(2*PI*i/256))

  // The letter C
  SPRITE_C: .byte 0, $18, $18, $18, $18, $3c, $3c, $3c, $3c, $66, $66, $66, $66, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $66, $66, $66, $66, $3c, $3c, $3c, $3c, $18, $18, $18, $18, 0

