Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx 
Inlined call call plexSetScreen (byte*) plexInit::screen 
Inlined call call plexFreePrepare 
Inlined call call plexFreeAdd (byte) plexShowSprite::ypos 
Inlined call (byte~) loop::$7 ← call plexFreeNextYpos 

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) PROCPORT_RAM_ALL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48
  (byte) PROCPORT_RAM_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53
  (byte) PROCPORT_RAM_CHARROM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49
  (byte) PROCPORT_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54
  (byte) PROCPORT_BASIC_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55
  (byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248
  (word) SPRITE_PTRS#0 ← (word/signed word/dword/signed dword) 1016
  (byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) 53248
  (byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) 53249
  (byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) 53264
  (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
  (byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53269
  (byte*) SPRITES_EXPAND_Y#0 ← ((byte*)) (word/dword/signed dword) 53271
  (byte*) SPRITES_PRIORITY#0 ← ((byte*)) (word/dword/signed dword) 53275
  (byte*) SPRITES_MC#0 ← ((byte*)) (word/dword/signed dword) 53276
  (byte*) SPRITES_EXPAND_X#0 ← ((byte*)) (word/dword/signed dword) 53277
  (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280
  (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281
  (byte*) BGCOL1#0 ← ((byte*)) (word/dword/signed dword) 53281
  (byte*) BGCOL2#0 ← ((byte*)) (word/dword/signed dword) 53282
  (byte*) BGCOL3#0 ← ((byte*)) (word/dword/signed dword) 53283
  (byte*) BGCOL4#0 ← ((byte*)) (word/dword/signed dword) 53284
  (byte*) SPRITES_MC1#0 ← ((byte*)) (word/dword/signed dword) 53285
  (byte*) SPRITES_MC2#0 ← ((byte*)) (word/dword/signed dword) 53286
  (byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) 53287
  (byte*) VIC_CONTROL#0 ← ((byte*)) (word/dword/signed dword) 53265
  (byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265
  (byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) 128
  (byte) VIC_ECM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 64
  (byte) VIC_BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
  (byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
  (byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) VIC_CONTROL2#0 ← ((byte*)) (word/dword/signed dword) 53270
  (byte*) D016#0 ← ((byte*)) (word/dword/signed dword) 53270
  (byte) VIC_MCM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
  (byte) VIC_CSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272
  (byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272
  (byte*) LIGHTPEN_X#0 ← ((byte*)) (word/dword/signed dword) 53267
  (byte*) LIGHTPEN_Y#0 ← ((byte*)) (word/dword/signed dword) 53268
  (byte*) IRQ_STATUS#0 ← ((byte*)) (word/dword/signed dword) 53273
  (byte*) IRQ_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53274
  (byte) IRQ_RASTER#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) IRQ_COLLISION_BG#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) IRQ_COLLISION_SPRITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
  (byte) IRQ_LIGHTPEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) COLS#0 ← ((byte*)) (word/dword/signed dword) 55296
  (byte*) CIA1_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56320
  (byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321
  (byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322
  (byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323
  (byte*) CIA1_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56333
  (byte) CIA_INTERRUPT_CLEAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 127
  (byte*) CIA2_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56576
  (byte*) CIA2_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56577
  (byte*) CIA2_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56578
  (byte*) CIA2_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56579
  (byte*) CIA2_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56589
  (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
  (void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534
  (byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) CYAN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3
  (byte) PURPLE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
  (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
  (byte) BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6
  (byte) YELLOW#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) ORANGE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte) BROWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9
  (byte) PINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10
  (byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11
  (byte) GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12
  (byte) LIGHT_GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13
  (byte) LIGHT_BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14
  (byte) LIGHT_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15
  to:@4
@4: scope:[]  from @begin
  (byte) PLEX_COUNT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
  (word[PLEX_COUNT#0]) PLEX_XPOS#0 ← { fill( PLEX_COUNT#0, 0) }
  (byte[PLEX_COUNT#0]) PLEX_YPOS#0 ← { fill( PLEX_COUNT#0, 0) }
  (byte[PLEX_COUNT#0]) PLEX_PTR#0 ← { fill( PLEX_COUNT#0, 0) }
  (word/signed word/dword/signed dword~) $0 ← (word/signed word/dword/signed dword) 1024 + (word/signed word/dword/signed dword) 1016
  (byte*) PLEX_SCREEN_PTR#0 ← ((byte*)) (word/signed word/dword/signed dword~) $0
  (byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 ← { fill( PLEX_COUNT#0, 0) }
  (byte) plex_show_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) plex_sprite_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) plex_sprite_msb#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  to:@9
plexInit: scope:[plexInit]  from init
  (byte*) plexInit::screen#1 ← phi( init/(byte*) plexInit::screen#0 )
  (byte*) plexInit::plexSetScreen1_screen#0 ← (byte*) plexInit::screen#1
  to:plexInit::plexSetScreen1
plexInit::plexSetScreen1: scope:[plexInit]  from plexInit
  (byte*) plexInit::plexSetScreen1_screen#1 ← phi( plexInit/(byte*) plexInit::plexSetScreen1_screen#0 )
  (byte*) plexInit::plexSetScreen1_$0#0 ← (byte*) plexInit::plexSetScreen1_screen#1 + (word/signed word/dword/signed dword) 1016
  (byte*) PLEX_SCREEN_PTR#1 ← (byte*) plexInit::plexSetScreen1_$0#0
  to:plexInit::@3
plexInit::@3: scope:[plexInit]  from plexInit::plexSetScreen1
  (byte*) PLEX_SCREEN_PTR#22 ← phi( plexInit::plexSetScreen1/(byte*) PLEX_SCREEN_PTR#1 )
  (byte/signed word/word/dword/signed dword~) plexInit::$1 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) plexInit::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:plexInit::@1
plexInit::@1: scope:[plexInit]  from plexInit::@1 plexInit::@3
  (byte*) PLEX_SCREEN_PTR#15 ← phi( plexInit::@1/(byte*) PLEX_SCREEN_PTR#15 plexInit::@3/(byte*) PLEX_SCREEN_PTR#22 )
  (byte) plexInit::i#2 ← phi( plexInit::@1/(byte) plexInit::i#1 plexInit::@3/(byte) plexInit::i#0 )
  *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2
  (byte) plexInit::i#1 ← (byte) plexInit::i#2 + rangenext(0,plexInit::$1)
  (bool~) plexInit::$2 ← (byte) plexInit::i#1 != rangelast(0,plexInit::$1)
  if((bool~) plexInit::$2) goto plexInit::@1
  to:plexInit::@return
plexInit::@return: scope:[plexInit]  from plexInit::@1
  (byte*) PLEX_SCREEN_PTR#8 ← phi( plexInit::@1/(byte*) PLEX_SCREEN_PTR#15 )
  (byte*) PLEX_SCREEN_PTR#2 ← (byte*) PLEX_SCREEN_PTR#8
  return 
  to:@return
plexSort: scope:[plexSort]  from loop::@20
  (byte/signed word/word/dword/signed dword~) plexSort::$0 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) plexSort::m#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:plexSort::@1
plexSort::@1: scope:[plexSort]  from plexSort plexSort::@2
  (byte) plexSort::m#2 ← phi( plexSort/(byte) plexSort::m#0 plexSort::@2/(byte) plexSort::m#1 )
  (byte/signed word/word/dword/signed dword~) plexSort::$1 ← (byte) plexSort::m#2 + (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) plexSort::nxt_idx#0 ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte/signed word/word/dword/signed dword~) plexSort::$1)
  (byte) plexSort::nxt_y#0 ← *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0)
  (bool~) plexSort::$2 ← (byte) plexSort::nxt_y#0 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))
  (bool~) plexSort::$3 ← ! (bool~) plexSort::$2
  if((bool~) plexSort::$3) goto plexSort::@2
  to:plexSort::@4
plexSort::@2: scope:[plexSort]  from plexSort::@1 plexSort::@5
  (byte) plexSort::m#3 ← phi( plexSort::@1/(byte) plexSort::m#2 plexSort::@5/(byte) plexSort::m#5 )
  (byte) plexSort::m#1 ← (byte) plexSort::m#3 + rangenext(0,plexSort::$0)
  (bool~) plexSort::$8 ← (byte) plexSort::m#1 != rangelast(0,plexSort::$0)
  if((bool~) plexSort::$8) goto plexSort::@1
  to:plexSort::@6
plexSort::@4: scope:[plexSort]  from plexSort::@1
  (byte) plexSort::nxt_idx#3 ← phi( plexSort::@1/(byte) plexSort::nxt_idx#0 )
  (byte) plexSort::nxt_y#2 ← phi( plexSort::@1/(byte) plexSort::nxt_y#0 )
  (byte) plexSort::m#4 ← phi( plexSort::@1/(byte) plexSort::m#2 )
  (byte) plexSort::s#0 ← (byte) plexSort::m#4
  to:plexSort::@3
plexSort::@3: scope:[plexSort]  from plexSort::@3 plexSort::@4
  (byte) plexSort::m#6 ← phi( plexSort::@3/(byte) plexSort::m#6 plexSort::@4/(byte) plexSort::m#4 )
  (byte) plexSort::nxt_idx#2 ← phi( plexSort::@3/(byte) plexSort::nxt_idx#2 plexSort::@4/(byte) plexSort::nxt_idx#3 )
  (byte) plexSort::nxt_y#1 ← phi( plexSort::@3/(byte) plexSort::nxt_y#1 plexSort::@4/(byte) plexSort::nxt_y#2 )
  (byte) plexSort::s#3 ← phi( plexSort::@3/(byte) plexSort::s#1 plexSort::@4/(byte) plexSort::s#0 )
  (byte/signed word/word/dword/signed dword~) plexSort::$4 ← (byte) plexSort::s#3 + (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte/signed word/word/dword/signed dword~) plexSort::$4) ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3)
  (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
  (bool~) plexSort::$5 ← (byte) plexSort::s#1 != (byte/word/signed word/dword/signed dword) 255
  (bool~) plexSort::$6 ← (byte) plexSort::nxt_y#1 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))
  (bool~) plexSort::$7 ← (bool~) plexSort::$5 && (bool~) plexSort::$6
  if((bool~) plexSort::$7) goto plexSort::@3
  to:plexSort::@5
plexSort::@5: scope:[plexSort]  from plexSort::@3
  (byte) plexSort::m#5 ← phi( plexSort::@3/(byte) plexSort::m#6 )
  (byte) plexSort::nxt_idx#1 ← phi( plexSort::@3/(byte) plexSort::nxt_idx#2 )
  (byte) plexSort::s#4 ← phi( plexSort::@3/(byte) plexSort::s#1 )
  (byte) plexSort::s#2 ← ++ (byte) plexSort::s#4
  *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#1
  to:plexSort::@2
plexSort::@6: scope:[plexSort]  from plexSort::@2
  (byte) plex_show_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  to:plexSort::plexFreePrepare1
plexSort::plexFreePrepare1: scope:[plexSort]  from plexSort::@6
  (byte) plex_sprite_msb#39 ← phi( plexSort::@6/(byte) plex_sprite_msb#1 )
  (byte) plex_sprite_idx#40 ← phi( plexSort::@6/(byte) plex_sprite_idx#1 )
  (byte) plex_show_idx#40 ← phi( plexSort::@6/(byte) plex_show_idx#1 )
  (byte) plexSort::plexFreePrepare1_s#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:plexSort::plexFreePrepare1_@1
plexSort::plexFreePrepare1_@1: scope:[plexSort]  from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
  (byte) plex_sprite_msb#31 ← phi( plexSort::plexFreePrepare1/(byte) plex_sprite_msb#39 plexSort::plexFreePrepare1_@1/(byte) plex_sprite_msb#31 )
  (byte) plex_sprite_idx#33 ← phi( plexSort::plexFreePrepare1/(byte) plex_sprite_idx#40 plexSort::plexFreePrepare1_@1/(byte) plex_sprite_idx#33 )
  (byte) plex_show_idx#33 ← phi( plexSort::plexFreePrepare1/(byte) plex_show_idx#40 plexSort::plexFreePrepare1_@1/(byte) plex_show_idx#33 )
  (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte) plexSort::plexFreePrepare1_s#0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
  *((byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) plexSort::plexFreePrepare1_s#1 ← (byte) plexSort::plexFreePrepare1_s#2 + rangenext(0,7)
  (bool) plexSort::plexFreePrepare1_$0#0 ← (byte) plexSort::plexFreePrepare1_s#1 != rangelast(0,7)
  if((bool) plexSort::plexFreePrepare1_$0#0) goto plexSort::plexFreePrepare1_@1
  to:plexSort::plexFreePrepare1_@2
plexSort::plexFreePrepare1_@2: scope:[plexSort]  from plexSort::plexFreePrepare1_@1
  (byte) plex_sprite_msb#23 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_sprite_msb#31 )
  (byte) plex_sprite_idx#22 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_sprite_idx#33 )
  (byte) plex_show_idx#22 ← phi( plexSort::plexFreePrepare1_@1/(byte) plex_show_idx#33 )
  (byte) plex_free_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:plexSort::@return
plexSort::@return: scope:[plexSort]  from plexSort::plexFreePrepare1_@2
  (byte) plex_free_next#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_free_next#0 )
  (byte) plex_sprite_msb#12 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_sprite_msb#23 )
  (byte) plex_sprite_idx#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_sprite_idx#22 )
  (byte) plex_show_idx#11 ← phi( plexSort::plexFreePrepare1_@2/(byte) plex_show_idx#22 )
  (byte) plex_show_idx#2 ← (byte) plex_show_idx#11
  (byte) plex_sprite_idx#2 ← (byte) plex_sprite_idx#11
  (byte) plex_sprite_msb#2 ← (byte) plex_sprite_msb#12
  (byte) plex_free_next#1 ← (byte) plex_free_next#11
  return 
  to:@return
plexShowSprite: scope:[plexShowSprite]  from loop::@14
  (byte) plex_sprite_msb#40 ← phi( loop::@14/(byte) plex_sprite_msb#28 )
  (byte*) PLEX_SCREEN_PTR#23 ← phi( loop::@14/(byte*) PLEX_SCREEN_PTR#26 )
  (byte) plex_free_next#21 ← phi( loop::@14/(byte) plex_free_next#27 )
  (byte) plex_show_idx#12 ← phi( loop::@14/(byte) plex_show_idx#23 )
  (byte) plex_sprite_idx#12 ← phi( loop::@14/(byte) plex_sprite_idx#23 )
  (byte~) plexShowSprite::$0 ← (byte) plex_sprite_idx#12 << (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte~) plexShowSprite::$0
  (byte) plexShowSprite::ypos#0 ← *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#12))
  *((byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::ypos#0
  (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← (byte) plexShowSprite::ypos#0
  to:plexShowSprite::plexFreeAdd1
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite]  from plexShowSprite
  (byte) plex_sprite_msb#32 ← phi( plexShowSprite/(byte) plex_sprite_msb#40 )
  (byte) plexShowSprite::plex_sprite_idx2#2 ← phi( plexShowSprite/(byte) plexShowSprite::plex_sprite_idx2#0 )
  (byte) plex_sprite_idx#24 ← phi( plexShowSprite/(byte) plex_sprite_idx#12 )
  (byte*) PLEX_SCREEN_PTR#16 ← phi( plexShowSprite/(byte*) PLEX_SCREEN_PTR#23 )
  (byte) plex_show_idx#24 ← phi( plexShowSprite/(byte) plex_show_idx#12 )
  (byte) plex_free_next#12 ← phi( plexShowSprite/(byte) plex_free_next#21 )
  (byte) plexShowSprite::plexFreeAdd1_ypos#1 ← phi( plexShowSprite/(byte) plexShowSprite::plexFreeAdd1_ypos#0 )
  (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#1 + (byte/signed byte/word/signed word/dword/signed dword) 21
  *((byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#12) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
  (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#12 + (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) plex_free_next#2 ← (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0
  to:plexShowSprite::@7
plexShowSprite::@7: scope:[plexShowSprite]  from plexShowSprite::plexFreeAdd1
  (byte) plex_free_next#44 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_free_next#2 )
  (byte) plex_sprite_msb#24 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_sprite_msb#32 )
  (byte) plexShowSprite::plex_sprite_idx2#1 ← phi( plexShowSprite::plexFreeAdd1/(byte) plexShowSprite::plex_sprite_idx2#2 )
  (byte) plex_sprite_idx#13 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_sprite_idx#24 )
  (byte*) PLEX_SCREEN_PTR#9 ← phi( plexShowSprite::plexFreeAdd1/(byte*) PLEX_SCREEN_PTR#16 )
  (byte) plex_show_idx#13 ← phi( plexShowSprite::plexFreeAdd1/(byte) plex_show_idx#24 )
  *((byte*) PLEX_SCREEN_PTR#9 + (byte) plex_sprite_idx#13) ← *((byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#13))
  (byte~) plexShowSprite::$2 ← *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#13) << (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) plexShowSprite::xpos_idx#0 ← (byte~) plexShowSprite::$2
  (byte~) plexShowSprite::$3 ← < *((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0)
  *((byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#1) ← (byte~) plexShowSprite::$3
  (byte~) plexShowSprite::$4 ← > *((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0)
  (bool~) plexShowSprite::$5 ← (byte~) plexShowSprite::$4 != (byte/signed byte/word/signed word/dword/signed dword) 0
  if((bool~) plexShowSprite::$5) goto plexShowSprite::@1
  to:plexShowSprite::@4
plexShowSprite::@1: scope:[plexShowSprite]  from plexShowSprite::@7
  (byte) plex_free_next#38 ← phi( plexShowSprite::@7/(byte) plex_free_next#44 )
  (byte) plex_show_idx#25 ← phi( plexShowSprite::@7/(byte) plex_show_idx#13 )
  (byte) plex_sprite_idx#25 ← phi( plexShowSprite::@7/(byte) plex_sprite_idx#13 )
  (byte) plex_sprite_msb#13 ← phi( plexShowSprite::@7/(byte) plex_sprite_msb#24 )
  *((byte*) SPRITES_XMSB#0) ← *((byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#13
  to:plexShowSprite::@2
plexShowSprite::@4: scope:[plexShowSprite]  from plexShowSprite::@7
  (byte) plex_free_next#39 ← phi( plexShowSprite::@7/(byte) plex_free_next#44 )
  (byte) plex_show_idx#26 ← phi( plexShowSprite::@7/(byte) plex_show_idx#13 )
  (byte) plex_sprite_idx#26 ← phi( plexShowSprite::@7/(byte) plex_sprite_idx#13 )
  (byte) plex_sprite_msb#14 ← phi( plexShowSprite::@7/(byte) plex_sprite_msb#24 )
  (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#14
  *((byte*) SPRITES_XMSB#0) ← *((byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6
  to:plexShowSprite::@2
plexShowSprite::@2: scope:[plexShowSprite]  from plexShowSprite::@1 plexShowSprite::@4
  (byte) plex_free_next#30 ← phi( plexShowSprite::@1/(byte) plex_free_next#38 plexShowSprite::@4/(byte) plex_free_next#39 )
  (byte) plex_sprite_msb#15 ← phi( plexShowSprite::@1/(byte) plex_sprite_msb#13 plexShowSprite::@4/(byte) plex_sprite_msb#14 )
  (byte) plex_show_idx#14 ← phi( plexShowSprite::@1/(byte) plex_show_idx#25 plexShowSprite::@4/(byte) plex_show_idx#26 )
  (byte) plex_sprite_idx#14 ← phi( plexShowSprite::@1/(byte) plex_sprite_idx#25 plexShowSprite::@4/(byte) plex_sprite_idx#26 )
  (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 ← (byte) plex_sprite_idx#14 + (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte/word/dword~) plexShowSprite::$8 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7
  (byte) plex_sprite_idx#3 ← (byte/word/dword~) plexShowSprite::$8
  (byte) plex_show_idx#3 ← ++ (byte) plex_show_idx#14
  (byte) plex_sprite_msb#3 ← (byte) plex_sprite_msb#15 << (byte/signed byte/word/signed word/dword/signed dword) 1
  (bool~) plexShowSprite::$9 ← (byte) plex_sprite_msb#3 == (byte/signed byte/word/signed word/dword/signed dword) 0
  (bool~) plexShowSprite::$10 ← ! (bool~) plexShowSprite::$9
  if((bool~) plexShowSprite::$10) goto plexShowSprite::@3
  to:plexShowSprite::@6
plexShowSprite::@3: scope:[plexShowSprite]  from plexShowSprite::@2
  (byte) plex_sprite_msb#25 ← phi( plexShowSprite::@2/(byte) plex_sprite_msb#3 )
  (byte) plex_show_idx#27 ← phi( plexShowSprite::@2/(byte) plex_show_idx#3 )
  (byte) plex_sprite_idx#27 ← phi( plexShowSprite::@2/(byte) plex_sprite_idx#3 )
  (byte) plex_free_next#22 ← phi( plexShowSprite::@2/(byte) plex_free_next#30 )
  to:plexShowSprite::@return
plexShowSprite::@6: scope:[plexShowSprite]  from plexShowSprite::@2
  (byte) plex_show_idx#28 ← phi( plexShowSprite::@2/(byte) plex_show_idx#3 )
  (byte) plex_sprite_idx#28 ← phi( plexShowSprite::@2/(byte) plex_sprite_idx#3 )
  (byte) plex_free_next#23 ← phi( plexShowSprite::@2/(byte) plex_free_next#30 )
  (byte) plex_sprite_msb#4 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  to:plexShowSprite::@return
plexShowSprite::@return: scope:[plexShowSprite]  from plexShowSprite::@3 plexShowSprite::@6
  (byte) plex_sprite_msb#16 ← phi( plexShowSprite::@3/(byte) plex_sprite_msb#25 plexShowSprite::@6/(byte) plex_sprite_msb#4 )
  (byte) plex_show_idx#15 ← phi( plexShowSprite::@3/(byte) plex_show_idx#27 plexShowSprite::@6/(byte) plex_show_idx#28 )
  (byte) plex_sprite_idx#15 ← phi( plexShowSprite::@3/(byte) plex_sprite_idx#27 plexShowSprite::@6/(byte) plex_sprite_idx#28 )
  (byte) plex_free_next#13 ← phi( plexShowSprite::@3/(byte) plex_free_next#22 plexShowSprite::@6/(byte) plex_free_next#23 )
  (byte) plex_free_next#3 ← (byte) plex_free_next#13
  (byte) plex_sprite_idx#4 ← (byte) plex_sprite_idx#15
  (byte) plex_show_idx#4 ← (byte) plex_show_idx#15
  (byte) plex_sprite_msb#5 ← (byte) plex_sprite_msb#16
  return 
  to:@return
@9: scope:[]  from @4
  (byte) plex_sprite_msb#41 ← phi( @4/(byte) plex_sprite_msb#0 )
  (byte) plex_sprite_idx#41 ← phi( @4/(byte) plex_sprite_idx#0 )
  (byte) plex_show_idx#41 ← phi( @4/(byte) plex_show_idx#0 )
  (byte*) PLEX_SCREEN_PTR#27 ← phi( @4/(byte*) PLEX_SCREEN_PTR#0 )
  (byte[8]) PLEX_FREE_YPOS#0 ← { fill( 8, 0) }
  (byte) plex_free_next#4 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:@12
@12: scope:[]  from @9
  (byte) plex_free_next#37 ← phi( @9/(byte) plex_free_next#4 )
  (byte) plex_sprite_msb#38 ← phi( @9/(byte) plex_sprite_msb#41 )
  (byte) plex_sprite_idx#39 ← phi( @9/(byte) plex_sprite_idx#41 )
  (byte) plex_show_idx#39 ← phi( @9/(byte) plex_show_idx#41 )
  (byte*) PLEX_SCREEN_PTR#25 ← phi( @9/(byte*) PLEX_SCREEN_PTR#27 )
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) SPRITE#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192
  (byte*) YSIN#0 ← ((byte*)) (word/signed word/dword/signed dword) 8448
  kickasm(location (byte*) YSIN#0) {{ .var min = 50
    .var max = 250-21
    .var ampl = max-min;
    .for(var i=0;i<256;i++)
        .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
 }}
  kickasm(location (byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)
 }}
  to:@15
main: scope:[main]  from @15
  (byte*) YSIN#11 ← phi( @15/(byte*) YSIN#13 )
  (byte*) SPRITE#4 ← phi( @15/(byte*) SPRITE#5 )
  (byte) plex_free_next#31 ← phi( @15/(byte) plex_free_next#29 )
  (byte) plex_sprite_msb#33 ← phi( @15/(byte) plex_sprite_msb#30 )
  (byte) plex_sprite_idx#34 ← phi( @15/(byte) plex_sprite_idx#32 )
  (byte) plex_show_idx#34 ← phi( @15/(byte) plex_show_idx#32 )
  (byte*) SCREEN#2 ← phi( @15/(byte*) SCREEN#3 )
  (byte*) PLEX_SCREEN_PTR#17 ← phi( @15/(byte*) PLEX_SCREEN_PTR#21 )
  asm { sei  }
  call init 
  to:main::@1
main::@1: scope:[main]  from main
  (byte*) YSIN#9 ← phi( main/(byte*) YSIN#11 )
  (byte) plex_free_next#24 ← phi( main/(byte) plex_free_next#31 )
  (byte) plex_sprite_msb#26 ← phi( main/(byte) plex_sprite_msb#33 )
  (byte) plex_sprite_idx#29 ← phi( main/(byte) plex_sprite_idx#34 )
  (byte) plex_show_idx#29 ← phi( main/(byte) plex_show_idx#34 )
  (byte*) PLEX_SCREEN_PTR#10 ← phi( main/(byte*) PLEX_SCREEN_PTR#6 )
  (byte*) PLEX_SCREEN_PTR#3 ← (byte*) PLEX_SCREEN_PTR#10
  call loop 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte*) PLEX_SCREEN_PTR#18 ← phi( main::@1/(byte*) PLEX_SCREEN_PTR#3 )
  (byte) plex_free_next#14 ← phi( main::@1/(byte) plex_free_next#9 )
  (byte) plex_sprite_msb#17 ← phi( main::@1/(byte) plex_sprite_msb#10 )
  (byte) plex_sprite_idx#16 ← phi( main::@1/(byte) plex_sprite_idx#9 )
  (byte) plex_show_idx#16 ← phi( main::@1/(byte) plex_show_idx#9 )
  (byte) plex_show_idx#5 ← (byte) plex_show_idx#16
  (byte) plex_sprite_idx#5 ← (byte) plex_sprite_idx#16
  (byte) plex_sprite_msb#6 ← (byte) plex_sprite_msb#17
  (byte) plex_free_next#5 ← (byte) plex_free_next#14
  to:main::@return
main::@return: scope:[main]  from main::@2
  (byte) plex_free_next#15 ← phi( main::@2/(byte) plex_free_next#5 )
  (byte) plex_sprite_msb#18 ← phi( main::@2/(byte) plex_sprite_msb#6 )
  (byte) plex_sprite_idx#17 ← phi( main::@2/(byte) plex_sprite_idx#5 )
  (byte) plex_show_idx#17 ← phi( main::@2/(byte) plex_show_idx#5 )
  (byte*) PLEX_SCREEN_PTR#11 ← phi( main::@2/(byte*) PLEX_SCREEN_PTR#18 )
  (byte*) PLEX_SCREEN_PTR#4 ← (byte*) PLEX_SCREEN_PTR#11
  (byte) plex_show_idx#6 ← (byte) plex_show_idx#17
  (byte) plex_sprite_idx#6 ← (byte) plex_sprite_idx#17
  (byte) plex_sprite_msb#7 ← (byte) plex_sprite_msb#18
  (byte) plex_free_next#6 ← (byte) plex_free_next#15
  return 
  to:@return
init: scope:[init]  from main
  (byte*) SPRITE#3 ← phi( main/(byte*) SPRITE#4 )
  (byte*) PLEX_SCREEN_PTR#19 ← phi( main/(byte*) PLEX_SCREEN_PTR#17 )
  (byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 )
  (byte~) init::$0 ← (byte) VIC_DEN#0 | (byte) VIC_RSEL#0
  (byte/word/dword~) init::$1 ← (byte~) init::$0 | (byte/signed byte/word/signed word/dword/signed dword) 3
  *((byte*) D011#0) ← (byte/word/dword~) init::$1
  (byte*) plexInit::screen#0 ← (byte*) SCREEN#1
  call plexInit 
  to:init::@5
init::@5: scope:[init]  from init
  (byte*) SPRITE#2 ← phi( init/(byte*) SPRITE#3 )
  (byte*) PLEX_SCREEN_PTR#12 ← phi( init/(byte*) PLEX_SCREEN_PTR#2 )
  (byte*) PLEX_SCREEN_PTR#5 ← (byte*) PLEX_SCREEN_PTR#12
  (word) init::xp#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
  (byte/signed word/word/dword/signed dword~) init::$3 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) init::sx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:init::@1
init::@1: scope:[init]  from init::@1 init::@5
  (byte*) PLEX_SCREEN_PTR#28 ← phi( init::@1/(byte*) PLEX_SCREEN_PTR#28 init::@5/(byte*) PLEX_SCREEN_PTR#5 )
  (word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init::@5/(word) init::xp#0 )
  (byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init::@5/(byte) init::sx#0 )
  (byte*) SPRITE#1 ← phi( init::@1/(byte*) SPRITE#1 init::@5/(byte*) SPRITE#2 )
  (byte*~) init::$4 ← (byte*) SPRITE#1 / (byte/signed byte/word/signed word/dword/signed dword) 64
  (byte~) init::$5 ← ((byte)) (byte*~) init::$4
  *((byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← (byte~) init::$5
  (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
  *((word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2
  (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9
  (byte) init::sx#1 ← (byte) init::sx#2 + rangenext(0,init::$3)
  (bool~) init::$7 ← (byte) init::sx#1 != rangelast(0,init::$3)
  if((bool~) init::$7) goto init::@1
  to:init::@3
init::@3: scope:[init]  from init::@1
  (byte*) PLEX_SCREEN_PTR#24 ← phi( init::@1/(byte*) PLEX_SCREEN_PTR#28 )
  *((byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255
  (byte) init::ss#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:init::@2
init::@2: scope:[init]  from init::@2 init::@3
  (byte*) PLEX_SCREEN_PTR#20 ← phi( init::@2/(byte*) PLEX_SCREEN_PTR#20 init::@3/(byte*) PLEX_SCREEN_PTR#24 )
  (byte) init::ss#2 ← phi( init::@2/(byte) init::ss#1 init::@3/(byte) init::ss#0 )
  *((byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (byte) GREEN#0
  (byte) init::ss#1 ← (byte) init::ss#2 + rangenext(0,7)
  (bool~) init::$8 ← (byte) init::ss#1 != rangelast(0,7)
  if((bool~) init::$8) goto init::@2
  to:init::@return
init::@return: scope:[init]  from init::@2
  (byte*) PLEX_SCREEN_PTR#13 ← phi( init::@2/(byte*) PLEX_SCREEN_PTR#20 )
  (byte*) PLEX_SCREEN_PTR#6 ← (byte*) PLEX_SCREEN_PTR#13
  return 
  to:@return
loop: scope:[loop]  from main::@1
  (byte*) PLEX_SCREEN_PTR#47 ← phi( main::@1/(byte*) PLEX_SCREEN_PTR#3 )
  (byte*) YSIN#7 ← phi( main::@1/(byte*) YSIN#9 )
  (byte) plex_free_next#32 ← phi( main::@1/(byte) plex_free_next#24 )
  (byte) plex_sprite_msb#34 ← phi( main::@1/(byte) plex_sprite_msb#26 )
  (byte) plex_sprite_idx#35 ← phi( main::@1/(byte) plex_sprite_idx#29 )
  (byte) plex_show_idx#35 ← phi( main::@1/(byte) plex_show_idx#29 )
  (byte) loop::sin_idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:loop::@1
loop::@1: scope:[loop]  from loop loop::@27
  (byte*) PLEX_SCREEN_PTR#46 ← phi( loop/(byte*) PLEX_SCREEN_PTR#47 loop::@27/(byte*) PLEX_SCREEN_PTR#48 )
  (byte*) YSIN#6 ← phi( loop/(byte*) YSIN#7 loop::@27/(byte*) YSIN#8 )
  (byte) loop::sin_idx#8 ← phi( loop/(byte) loop::sin_idx#0 loop::@27/(byte) loop::sin_idx#9 )
  (byte) plex_free_next#28 ← phi( loop/(byte) plex_free_next#32 loop::@27/(byte) plex_free_next#33 )
  (byte) plex_sprite_msb#29 ← phi( loop/(byte) plex_sprite_msb#34 loop::@27/(byte) plex_sprite_msb#35 )
  (byte) plex_sprite_idx#31 ← phi( loop/(byte) plex_sprite_idx#35 loop::@27/(byte) plex_sprite_idx#36 )
  (byte) plex_show_idx#31 ← phi( loop/(byte) plex_show_idx#35 loop::@27/(byte) plex_show_idx#36 )
  if(true) goto loop::@2
  to:loop::@return
loop::@2: scope:[loop]  from loop::@1
  (byte*) PLEX_SCREEN_PTR#44 ← phi( loop::@1/(byte*) PLEX_SCREEN_PTR#46 )
  (byte) plex_free_next#48 ← phi( loop::@1/(byte) plex_free_next#28 )
  (byte) plex_sprite_msb#47 ← phi( loop::@1/(byte) plex_sprite_msb#29 )
  (byte) plex_sprite_idx#47 ← phi( loop::@1/(byte) plex_sprite_idx#31 )
  (byte) plex_show_idx#47 ← phi( loop::@1/(byte) plex_show_idx#31 )
  (byte*) YSIN#4 ← phi( loop::@1/(byte*) YSIN#6 )
  (byte) loop::sin_idx#6 ← phi( loop::@1/(byte) loop::sin_idx#8 )
  to:loop::@4
loop::@4: scope:[loop]  from loop::@2 loop::@5
  (byte*) PLEX_SCREEN_PTR#43 ← phi( loop::@2/(byte*) PLEX_SCREEN_PTR#44 loop::@5/(byte*) PLEX_SCREEN_PTR#45 )
  (byte) plex_free_next#45 ← phi( loop::@2/(byte) plex_free_next#48 loop::@5/(byte) plex_free_next#49 )
  (byte) plex_sprite_msb#45 ← phi( loop::@2/(byte) plex_sprite_msb#47 loop::@5/(byte) plex_sprite_msb#48 )
  (byte) plex_sprite_idx#45 ← phi( loop::@2/(byte) plex_sprite_idx#47 loop::@5/(byte) plex_sprite_idx#48 )
  (byte) plex_show_idx#45 ← phi( loop::@2/(byte) plex_show_idx#47 loop::@5/(byte) plex_show_idx#48 )
  (byte*) YSIN#3 ← phi( loop::@2/(byte*) YSIN#4 loop::@5/(byte*) YSIN#5 )
  (byte) loop::sin_idx#4 ← phi( loop::@2/(byte) loop::sin_idx#6 loop::@5/(byte) loop::sin_idx#7 )
  (bool~) loop::$0 ← *((byte*) RASTER#0) != (byte/word/signed word/dword/signed dword) 255
  if((bool~) loop::$0) goto loop::@5
  to:loop::@6
loop::@5: scope:[loop]  from loop::@4
  (byte*) PLEX_SCREEN_PTR#45 ← phi( loop::@4/(byte*) PLEX_SCREEN_PTR#43 )
  (byte) plex_free_next#49 ← phi( loop::@4/(byte) plex_free_next#45 )
  (byte) plex_sprite_msb#48 ← phi( loop::@4/(byte) plex_sprite_msb#45 )
  (byte) plex_sprite_idx#48 ← phi( loop::@4/(byte) plex_sprite_idx#45 )
  (byte) plex_show_idx#48 ← phi( loop::@4/(byte) plex_show_idx#45 )
  (byte*) YSIN#5 ← phi( loop::@4/(byte*) YSIN#3 )
  (byte) loop::sin_idx#7 ← phi( loop::@4/(byte) loop::sin_idx#4 )
  to:loop::@4
loop::@6: scope:[loop]  from loop::@4
  (byte*) PLEX_SCREEN_PTR#42 ← phi( loop::@4/(byte*) PLEX_SCREEN_PTR#43 )
  (byte) plex_free_next#40 ← phi( loop::@4/(byte) plex_free_next#45 )
  (byte) plex_sprite_msb#42 ← phi( loop::@4/(byte) plex_sprite_msb#45 )
  (byte) plex_sprite_idx#42 ← phi( loop::@4/(byte) plex_sprite_idx#45 )
  (byte) plex_show_idx#42 ← phi( loop::@4/(byte) plex_show_idx#45 )
  (byte*) YSIN#2 ← phi( loop::@4/(byte*) YSIN#3 )
  (byte) loop::sin_idx#2 ← phi( loop::@4/(byte) loop::sin_idx#4 )
  *((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
  (byte) loop::y_idx#0 ← (byte) loop::sin_idx#2
  (byte/signed word/word/dword/signed dword~) loop::$1 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) loop::sy#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:loop::@7
loop::@7: scope:[loop]  from loop::@6 loop::@7
  (byte*) PLEX_SCREEN_PTR#41 ← phi( loop::@6/(byte*) PLEX_SCREEN_PTR#42 loop::@7/(byte*) PLEX_SCREEN_PTR#41 )
  (byte) plex_free_next#34 ← phi( loop::@6/(byte) plex_free_next#40 loop::@7/(byte) plex_free_next#34 )
  (byte) plex_sprite_msb#36 ← phi( loop::@6/(byte) plex_sprite_msb#42 loop::@7/(byte) plex_sprite_msb#36 )
  (byte) plex_sprite_idx#37 ← phi( loop::@6/(byte) plex_sprite_idx#42 loop::@7/(byte) plex_sprite_idx#37 )
  (byte) plex_show_idx#37 ← phi( loop::@6/(byte) plex_show_idx#42 loop::@7/(byte) plex_show_idx#37 )
  (byte) loop::sin_idx#5 ← phi( loop::@6/(byte) loop::sin_idx#2 loop::@7/(byte) loop::sin_idx#5 )
  (byte) loop::sy#2 ← phi( loop::@6/(byte) loop::sy#0 loop::@7/(byte) loop::sy#1 )
  (byte) loop::y_idx#2 ← phi( loop::@6/(byte) loop::y_idx#0 loop::@7/(byte) loop::y_idx#1 )
  (byte*) YSIN#1 ← phi( loop::@6/(byte*) YSIN#2 loop::@7/(byte*) YSIN#1 )
  *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((byte*) YSIN#1 + (byte) loop::y_idx#2)
  (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte) loop::sy#1 ← (byte) loop::sy#2 + rangenext(0,loop::$1)
  (bool~) loop::$2 ← (byte) loop::sy#1 != rangelast(0,loop::$1)
  if((bool~) loop::$2) goto loop::@7
  to:loop::@20
loop::@20: scope:[loop]  from loop::@7
  (byte*) YSIN#24 ← phi( loop::@7/(byte*) YSIN#1 )
  (byte*) PLEX_SCREEN_PTR#40 ← phi( loop::@7/(byte*) PLEX_SCREEN_PTR#41 )
  (byte) plex_free_next#25 ← phi( loop::@7/(byte) plex_free_next#34 )
  (byte) plex_sprite_msb#27 ← phi( loop::@7/(byte) plex_sprite_msb#36 )
  (byte) plex_sprite_idx#30 ← phi( loop::@7/(byte) plex_sprite_idx#37 )
  (byte) plex_show_idx#30 ← phi( loop::@7/(byte) plex_show_idx#37 )
  (byte) loop::sin_idx#3 ← phi( loop::@7/(byte) loop::sin_idx#5 )
  (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1
  *((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
  call plexSort 
  to:loop::@30
loop::@30: scope:[loop]  from loop::@20
  (byte*) YSIN#22 ← phi( loop::@20/(byte*) YSIN#24 )
  (byte) loop::sin_idx#20 ← phi( loop::@20/(byte) loop::sin_idx#1 )
  (byte*) PLEX_SCREEN_PTR#38 ← phi( loop::@20/(byte*) PLEX_SCREEN_PTR#40 )
  (byte) plex_free_next#16 ← phi( loop::@20/(byte) plex_free_next#1 )
  (byte) plex_sprite_msb#19 ← phi( loop::@20/(byte) plex_sprite_msb#2 )
  (byte) plex_sprite_idx#18 ← phi( loop::@20/(byte) plex_sprite_idx#2 )
  (byte) plex_show_idx#18 ← phi( loop::@20/(byte) plex_show_idx#2 )
  (byte) plex_show_idx#7 ← (byte) plex_show_idx#18
  (byte) plex_sprite_idx#7 ← (byte) plex_sprite_idx#18
  (byte) plex_sprite_msb#8 ← (byte) plex_sprite_msb#19
  (byte) plex_free_next#7 ← (byte) plex_free_next#16
  *((byte*) BORDERCOL#0) ← (byte) BLACK#0
  to:loop::@8
loop::@8: scope:[loop]  from loop::@30 loop::@9
  (byte*) YSIN#21 ← phi( loop::@30/(byte*) YSIN#22 loop::@9/(byte*) YSIN#23 )
  (byte) loop::sin_idx#19 ← phi( loop::@30/(byte) loop::sin_idx#20 loop::@9/(byte) loop::sin_idx#21 )
  (byte*) PLEX_SCREEN_PTR#37 ← phi( loop::@30/(byte*) PLEX_SCREEN_PTR#38 loop::@9/(byte*) PLEX_SCREEN_PTR#39 )
  (byte) plex_sprite_msb#52 ← phi( loop::@30/(byte) plex_sprite_msb#8 loop::@9/(byte) plex_sprite_msb#53 )
  (byte) plex_show_idx#52 ← phi( loop::@30/(byte) plex_show_idx#7 loop::@9/(byte) plex_show_idx#53 )
  (byte) plex_sprite_idx#52 ← phi( loop::@30/(byte) plex_sprite_idx#7 loop::@9/(byte) plex_sprite_idx#53 )
  (byte) plex_free_next#41 ← phi( loop::@30/(byte) plex_free_next#7 loop::@9/(byte) plex_free_next#46 )
  (byte~) loop::$4 ← *((byte*) D011#0) & (byte) VIC_RST8#0
  (bool~) loop::$5 ← (byte~) loop::$4 != (byte/signed byte/word/signed word/dword/signed dword) 0
  if((bool~) loop::$5) goto loop::@9
  to:loop::@10
loop::@9: scope:[loop]  from loop::@8
  (byte*) YSIN#23 ← phi( loop::@8/(byte*) YSIN#21 )
  (byte) loop::sin_idx#21 ← phi( loop::@8/(byte) loop::sin_idx#19 )
  (byte*) PLEX_SCREEN_PTR#39 ← phi( loop::@8/(byte*) PLEX_SCREEN_PTR#37 )
  (byte) plex_sprite_msb#53 ← phi( loop::@8/(byte) plex_sprite_msb#52 )
  (byte) plex_show_idx#53 ← phi( loop::@8/(byte) plex_show_idx#52 )
  (byte) plex_sprite_idx#53 ← phi( loop::@8/(byte) plex_sprite_idx#52 )
  (byte) plex_free_next#46 ← phi( loop::@8/(byte) plex_free_next#41 )
  to:loop::@8
loop::@10: scope:[loop]  from loop::@8
  (byte*) YSIN#20 ← phi( loop::@8/(byte*) YSIN#21 )
  (byte) loop::sin_idx#18 ← phi( loop::@8/(byte) loop::sin_idx#19 )
  (byte*) PLEX_SCREEN_PTR#35 ← phi( loop::@8/(byte*) PLEX_SCREEN_PTR#37 )
  (byte) plex_sprite_msb#51 ← phi( loop::@8/(byte) plex_sprite_msb#52 )
  (byte) plex_show_idx#51 ← phi( loop::@8/(byte) plex_show_idx#52 )
  (byte) plex_sprite_idx#51 ← phi( loop::@8/(byte) plex_sprite_idx#52 )
  (byte) plex_free_next#35 ← phi( loop::@8/(byte) plex_free_next#41 )
  (byte/signed word/word/dword/signed dword~) loop::$6 ← (byte) PLEX_COUNT#0 - (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) loop::ss#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:loop::@11
loop::@11: scope:[loop]  from loop::@10 loop::@31
  (byte*) YSIN#19 ← phi( loop::@10/(byte*) YSIN#20 loop::@31/(byte*) YSIN#10 )
  (byte) loop::sin_idx#17 ← phi( loop::@10/(byte) loop::sin_idx#18 loop::@31/(byte) loop::sin_idx#10 )
  (byte*) PLEX_SCREEN_PTR#34 ← phi( loop::@10/(byte*) PLEX_SCREEN_PTR#35 loop::@31/(byte*) PLEX_SCREEN_PTR#36 )
  (byte) loop::ss#9 ← phi( loop::@10/(byte) loop::ss#0 loop::@31/(byte) loop::ss#1 )
  (byte) plex_sprite_msb#50 ← phi( loop::@10/(byte) plex_sprite_msb#51 loop::@31/(byte) plex_sprite_msb#9 )
  (byte) plex_show_idx#50 ← phi( loop::@10/(byte) plex_show_idx#51 loop::@31/(byte) plex_show_idx#8 )
  (byte) plex_sprite_idx#50 ← phi( loop::@10/(byte) plex_sprite_idx#51 loop::@31/(byte) plex_sprite_idx#8 )
  (byte) plex_free_next#26 ← phi( loop::@10/(byte) plex_free_next#35 loop::@31/(byte) plex_free_next#8 )
  *((byte*) BORDERCOL#0) ← (byte) BLACK#0
  to:loop::plexFreeNextYpos1
loop::plexFreeNextYpos1: scope:[loop]  from loop::@11
  (byte*) YSIN#18 ← phi( loop::@11/(byte*) YSIN#19 )
  (byte) loop::sin_idx#16 ← phi( loop::@11/(byte) loop::sin_idx#17 )
  (byte*) PLEX_SCREEN_PTR#33 ← phi( loop::@11/(byte*) PLEX_SCREEN_PTR#34 )
  (byte) loop::ss#8 ← phi( loop::@11/(byte) loop::ss#9 )
  (byte) plex_sprite_msb#49 ← phi( loop::@11/(byte) plex_sprite_msb#50 )
  (byte) plex_show_idx#49 ← phi( loop::@11/(byte) plex_show_idx#50 )
  (byte) plex_sprite_idx#49 ← phi( loop::@11/(byte) plex_sprite_idx#50 )
  (byte) plex_free_next#17 ← phi( loop::@11/(byte) plex_free_next#26 )
  (byte) loop::plexFreeNextYpos1_return#0 ← *((byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17)
  to:loop::plexFreeNextYpos1_@return
loop::plexFreeNextYpos1_@return: scope:[loop]  from loop::plexFreeNextYpos1
  (byte*) YSIN#17 ← phi( loop::plexFreeNextYpos1/(byte*) YSIN#18 )
  (byte) loop::sin_idx#15 ← phi( loop::plexFreeNextYpos1/(byte) loop::sin_idx#16 )
  (byte*) PLEX_SCREEN_PTR#32 ← phi( loop::plexFreeNextYpos1/(byte*) PLEX_SCREEN_PTR#33 )
  (byte) loop::ss#7 ← phi( loop::plexFreeNextYpos1/(byte) loop::ss#8 )
  (byte) plex_sprite_msb#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_sprite_msb#49 )
  (byte) plex_free_next#47 ← phi( loop::plexFreeNextYpos1/(byte) plex_free_next#17 )
  (byte) plex_show_idx#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_show_idx#49 )
  (byte) plex_sprite_idx#46 ← phi( loop::plexFreeNextYpos1/(byte) plex_sprite_idx#49 )
  (byte) loop::plexFreeNextYpos1_return#2 ← phi( loop::plexFreeNextYpos1/(byte) loop::plexFreeNextYpos1_return#0 )
  (byte) loop::plexFreeNextYpos1_return#1 ← (byte) loop::plexFreeNextYpos1_return#2
  to:loop::@29
loop::@29: scope:[loop]  from loop::plexFreeNextYpos1_@return
  (byte*) YSIN#16 ← phi( loop::plexFreeNextYpos1_@return/(byte*) YSIN#17 )
  (byte) loop::sin_idx#14 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::sin_idx#15 )
  (byte*) PLEX_SCREEN_PTR#31 ← phi( loop::plexFreeNextYpos1_@return/(byte*) PLEX_SCREEN_PTR#32 )
  (byte) loop::ss#6 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::ss#7 )
  (byte) plex_sprite_msb#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_sprite_msb#46 )
  (byte) plex_free_next#43 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_free_next#47 )
  (byte) plex_show_idx#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_show_idx#46 )
  (byte) plex_sprite_idx#44 ← phi( loop::plexFreeNextYpos1_@return/(byte) plex_sprite_idx#46 )
  (byte) loop::plexFreeNextYpos1_return#3 ← phi( loop::plexFreeNextYpos1_@return/(byte) loop::plexFreeNextYpos1_return#1 )
  (byte~) loop::$7 ← (byte) loop::plexFreeNextYpos1_return#3
  (byte) loop::rasterY#0 ← (byte~) loop::$7
  to:loop::@12
loop::@12: scope:[loop]  from loop::@13 loop::@29
  (byte*) YSIN#14 ← phi( loop::@13/(byte*) YSIN#15 loop::@29/(byte*) YSIN#16 )
  (byte) loop::sin_idx#12 ← phi( loop::@13/(byte) loop::sin_idx#13 loop::@29/(byte) loop::sin_idx#14 )
  (byte*) PLEX_SCREEN_PTR#29 ← phi( loop::@13/(byte*) PLEX_SCREEN_PTR#30 loop::@29/(byte*) PLEX_SCREEN_PTR#31 )
  (byte) loop::ss#4 ← phi( loop::@13/(byte) loop::ss#5 loop::@29/(byte) loop::ss#6 )
  (byte) plex_sprite_msb#37 ← phi( loop::@13/(byte) plex_sprite_msb#43 loop::@29/(byte) plex_sprite_msb#44 )
  (byte) plex_free_next#36 ← phi( loop::@13/(byte) plex_free_next#42 loop::@29/(byte) plex_free_next#43 )
  (byte) plex_show_idx#38 ← phi( loop::@13/(byte) plex_show_idx#43 loop::@29/(byte) plex_show_idx#44 )
  (byte) plex_sprite_idx#38 ← phi( loop::@13/(byte) plex_sprite_idx#43 loop::@29/(byte) plex_sprite_idx#44 )
  (byte) loop::rasterY#1 ← phi( loop::@13/(byte) loop::rasterY#2 loop::@29/(byte) loop::rasterY#0 )
  (bool~) loop::$8 ← *((byte*) RASTER#0) < (byte) loop::rasterY#1
  if((bool~) loop::$8) goto loop::@13
  to:loop::@14
loop::@13: scope:[loop]  from loop::@12
  (byte*) YSIN#15 ← phi( loop::@12/(byte*) YSIN#14 )
  (byte) loop::sin_idx#13 ← phi( loop::@12/(byte) loop::sin_idx#12 )
  (byte*) PLEX_SCREEN_PTR#30 ← phi( loop::@12/(byte*) PLEX_SCREEN_PTR#29 )
  (byte) loop::ss#5 ← phi( loop::@12/(byte) loop::ss#4 )
  (byte) plex_sprite_msb#43 ← phi( loop::@12/(byte) plex_sprite_msb#37 )
  (byte) plex_free_next#42 ← phi( loop::@12/(byte) plex_free_next#36 )
  (byte) plex_show_idx#43 ← phi( loop::@12/(byte) plex_show_idx#38 )
  (byte) plex_sprite_idx#43 ← phi( loop::@12/(byte) plex_sprite_idx#38 )
  (byte) loop::rasterY#2 ← phi( loop::@12/(byte) loop::rasterY#1 )
  to:loop::@12
loop::@14: scope:[loop]  from loop::@12
  (byte*) YSIN#12 ← phi( loop::@12/(byte*) YSIN#14 )
  (byte) loop::sin_idx#11 ← phi( loop::@12/(byte) loop::sin_idx#12 )
  (byte*) PLEX_SCREEN_PTR#26 ← phi( loop::@12/(byte*) PLEX_SCREEN_PTR#29 )
  (byte) loop::ss#3 ← phi( loop::@12/(byte) loop::ss#4 )
  (byte) plex_sprite_msb#28 ← phi( loop::@12/(byte) plex_sprite_msb#37 )
  (byte) plex_free_next#27 ← phi( loop::@12/(byte) plex_free_next#36 )
  (byte) plex_show_idx#23 ← phi( loop::@12/(byte) plex_show_idx#38 )
  (byte) plex_sprite_idx#23 ← phi( loop::@12/(byte) plex_sprite_idx#38 )
  *((byte*) BORDERCOL#0) ← ++ *((byte*) BORDERCOL#0)
  call plexShowSprite 
  to:loop::@31
loop::@31: scope:[loop]  from loop::@14
  (byte*) PLEX_SCREEN_PTR#36 ← phi( loop::@14/(byte*) PLEX_SCREEN_PTR#26 )
  (byte*) YSIN#10 ← phi( loop::@14/(byte*) YSIN#12 )
  (byte) loop::sin_idx#10 ← phi( loop::@14/(byte) loop::sin_idx#11 )
  (byte) loop::ss#2 ← phi( loop::@14/(byte) loop::ss#3 )
  (byte) plex_sprite_msb#20 ← phi( loop::@14/(byte) plex_sprite_msb#5 )
  (byte) plex_show_idx#19 ← phi( loop::@14/(byte) plex_show_idx#4 )
  (byte) plex_sprite_idx#19 ← phi( loop::@14/(byte) plex_sprite_idx#4 )
  (byte) plex_free_next#18 ← phi( loop::@14/(byte) plex_free_next#3 )
  (byte) plex_free_next#8 ← (byte) plex_free_next#18
  (byte) plex_sprite_idx#8 ← (byte) plex_sprite_idx#19
  (byte) plex_show_idx#8 ← (byte) plex_show_idx#19
  (byte) plex_sprite_msb#9 ← (byte) plex_sprite_msb#20
  (byte) loop::ss#1 ← (byte) loop::ss#2 + rangenext(0,loop::$6)
  (bool~) loop::$10 ← (byte) loop::ss#1 != rangelast(0,loop::$6)
  if((bool~) loop::$10) goto loop::@11
  to:loop::@27
loop::@27: scope:[loop]  from loop::@31
  (byte*) PLEX_SCREEN_PTR#48 ← phi( loop::@31/(byte*) PLEX_SCREEN_PTR#36 )
  (byte*) YSIN#8 ← phi( loop::@31/(byte*) YSIN#10 )
  (byte) loop::sin_idx#9 ← phi( loop::@31/(byte) loop::sin_idx#10 )
  (byte) plex_free_next#33 ← phi( loop::@31/(byte) plex_free_next#8 )
  (byte) plex_sprite_msb#35 ← phi( loop::@31/(byte) plex_sprite_msb#9 )
  (byte) plex_sprite_idx#36 ← phi( loop::@31/(byte) plex_sprite_idx#8 )
  (byte) plex_show_idx#36 ← phi( loop::@31/(byte) plex_show_idx#8 )
  *((byte*) BORDERCOL#0) ← (byte) BLACK#0
  to:loop::@1
loop::@return: scope:[loop]  from loop::@1
  (byte) plex_free_next#19 ← phi( loop::@1/(byte) plex_free_next#28 )
  (byte) plex_sprite_msb#21 ← phi( loop::@1/(byte) plex_sprite_msb#29 )
  (byte) plex_sprite_idx#20 ← phi( loop::@1/(byte) plex_sprite_idx#31 )
  (byte) plex_show_idx#20 ← phi( loop::@1/(byte) plex_show_idx#31 )
  (byte) plex_show_idx#9 ← (byte) plex_show_idx#20
  (byte) plex_sprite_idx#9 ← (byte) plex_sprite_idx#20
  (byte) plex_sprite_msb#10 ← (byte) plex_sprite_msb#21
  (byte) plex_free_next#9 ← (byte) plex_free_next#19
  return 
  to:@return
@15: scope:[]  from @12
  (byte*) YSIN#13 ← phi( @12/(byte*) YSIN#0 )
  (byte*) SPRITE#5 ← phi( @12/(byte*) SPRITE#0 )
  (byte*) SCREEN#3 ← phi( @12/(byte*) SCREEN#0 )
  (byte) plex_free_next#29 ← phi( @12/(byte) plex_free_next#37 )
  (byte) plex_sprite_msb#30 ← phi( @12/(byte) plex_sprite_msb#38 )
  (byte) plex_sprite_idx#32 ← phi( @12/(byte) plex_sprite_idx#39 )
  (byte) plex_show_idx#32 ← phi( @12/(byte) plex_show_idx#39 )
  (byte*) PLEX_SCREEN_PTR#21 ← phi( @12/(byte*) PLEX_SCREEN_PTR#25 )
  call main 
  to:@16
@16: scope:[]  from @15
  (byte) plex_free_next#20 ← phi( @15/(byte) plex_free_next#6 )
  (byte) plex_sprite_msb#22 ← phi( @15/(byte) plex_sprite_msb#7 )
  (byte) plex_sprite_idx#21 ← phi( @15/(byte) plex_sprite_idx#6 )
  (byte) plex_show_idx#21 ← phi( @15/(byte) plex_show_idx#6 )
  (byte*) PLEX_SCREEN_PTR#14 ← phi( @15/(byte*) PLEX_SCREEN_PTR#4 )
  (byte*) PLEX_SCREEN_PTR#7 ← (byte*) PLEX_SCREEN_PTR#14
  (byte) plex_show_idx#10 ← (byte) plex_show_idx#21
  (byte) plex_sprite_idx#10 ← (byte) plex_sprite_idx#21
  (byte) plex_sprite_msb#11 ← (byte) plex_sprite_msb#22
  (byte) plex_free_next#10 ← (byte) plex_free_next#20
  to:@end
@end: scope:[]  from @16

SYMBOL TABLE SSA
(word/signed word/dword/signed dword~) $0
(label) @12
(label) @15
(label) @16
(label) @4
(label) @9
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BGCOL1
(byte*) BGCOL1#0
(byte*) BGCOL2
(byte*) BGCOL2#0
(byte*) BGCOL3
(byte*) BGCOL3#0
(byte*) BGCOL4
(byte*) BGCOL4#0
(byte) BLACK
(byte) BLACK#0
(byte) BLUE
(byte) BLUE#0
(byte*) BORDERCOL
(byte*) BORDERCOL#0
(byte) BROWN
(byte) BROWN#0
(byte*) CHARGEN
(byte*) CHARGEN#0
(byte*) CIA1_INTERRUPT
(byte*) CIA1_INTERRUPT#0
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A#0
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_A_DDR#0
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B#0
(byte*) CIA1_PORT_B_DDR
(byte*) CIA1_PORT_B_DDR#0
(byte*) CIA2_INTERRUPT
(byte*) CIA2_INTERRUPT#0
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A#0
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_A_DDR#0
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B#0
(byte*) CIA2_PORT_B_DDR
(byte*) CIA2_PORT_B_DDR#0
(byte) CIA_INTERRUPT_CLEAR
(byte) CIA_INTERRUPT_CLEAR#0
(byte*) COLS
(byte*) COLS#0
(byte) CYAN
(byte) CYAN#0
(byte*) D011
(byte*) D011#0
(byte*) D016
(byte*) D016#0
(byte*) D018
(byte*) D018#0
(byte) DARK_GREY
(byte) DARK_GREY#0
(byte) GREEN
(byte) GREEN#0
(byte) GREY
(byte) GREY#0
(void()**) HARDWARE_IRQ
(void()**) HARDWARE_IRQ#0
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_BG#0
(byte) IRQ_COLLISION_SPRITE
(byte) IRQ_COLLISION_SPRITE#0
(byte*) IRQ_ENABLE
(byte*) IRQ_ENABLE#0
(byte) IRQ_LIGHTPEN
(byte) IRQ_LIGHTPEN#0
(byte) IRQ_RASTER
(byte) IRQ_RASTER#0
(byte*) IRQ_STATUS
(byte*) IRQ_STATUS#0
(void()**) KERNEL_IRQ
(void()**) KERNEL_IRQ#0
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_X#0
(byte*) LIGHTPEN_Y
(byte*) LIGHTPEN_Y#0
(byte) LIGHT_BLUE
(byte) LIGHT_BLUE#0
(byte) LIGHT_GREEN
(byte) LIGHT_GREEN#0
(byte) LIGHT_GREY
(byte) LIGHT_GREY#0
(byte) ORANGE
(byte) ORANGE#0
(byte) PINK
(byte) PINK#0
(byte) PLEX_COUNT
(byte) PLEX_COUNT#0
(byte[8]) PLEX_FREE_YPOS
(byte[8]) PLEX_FREE_YPOS#0
(byte[PLEX_COUNT#0]) PLEX_PTR
(byte[PLEX_COUNT#0]) PLEX_PTR#0
(byte*) PLEX_SCREEN_PTR
(byte*) PLEX_SCREEN_PTR#0
(byte*) PLEX_SCREEN_PTR#1
(byte*) PLEX_SCREEN_PTR#10
(byte*) PLEX_SCREEN_PTR#11
(byte*) PLEX_SCREEN_PTR#12
(byte*) PLEX_SCREEN_PTR#13
(byte*) PLEX_SCREEN_PTR#14
(byte*) PLEX_SCREEN_PTR#15
(byte*) PLEX_SCREEN_PTR#16
(byte*) PLEX_SCREEN_PTR#17
(byte*) PLEX_SCREEN_PTR#18
(byte*) PLEX_SCREEN_PTR#19
(byte*) PLEX_SCREEN_PTR#2
(byte*) PLEX_SCREEN_PTR#20
(byte*) PLEX_SCREEN_PTR#21
(byte*) PLEX_SCREEN_PTR#22
(byte*) PLEX_SCREEN_PTR#23
(byte*) PLEX_SCREEN_PTR#24
(byte*) PLEX_SCREEN_PTR#25
(byte*) PLEX_SCREEN_PTR#26
(byte*) PLEX_SCREEN_PTR#27
(byte*) PLEX_SCREEN_PTR#28
(byte*) PLEX_SCREEN_PTR#29
(byte*) PLEX_SCREEN_PTR#3
(byte*) PLEX_SCREEN_PTR#30
(byte*) PLEX_SCREEN_PTR#31
(byte*) PLEX_SCREEN_PTR#32
(byte*) PLEX_SCREEN_PTR#33
(byte*) PLEX_SCREEN_PTR#34
(byte*) PLEX_SCREEN_PTR#35
(byte*) PLEX_SCREEN_PTR#36
(byte*) PLEX_SCREEN_PTR#37
(byte*) PLEX_SCREEN_PTR#38
(byte*) PLEX_SCREEN_PTR#39
(byte*) PLEX_SCREEN_PTR#4
(byte*) PLEX_SCREEN_PTR#40
(byte*) PLEX_SCREEN_PTR#41
(byte*) PLEX_SCREEN_PTR#42
(byte*) PLEX_SCREEN_PTR#43
(byte*) PLEX_SCREEN_PTR#44
(byte*) PLEX_SCREEN_PTR#45
(byte*) PLEX_SCREEN_PTR#46
(byte*) PLEX_SCREEN_PTR#47
(byte*) PLEX_SCREEN_PTR#48
(byte*) PLEX_SCREEN_PTR#5
(byte*) PLEX_SCREEN_PTR#6
(byte*) PLEX_SCREEN_PTR#7
(byte*) PLEX_SCREEN_PTR#8
(byte*) PLEX_SCREEN_PTR#9
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0
(word[PLEX_COUNT#0]) PLEX_XPOS
(word[PLEX_COUNT#0]) PLEX_XPOS#0
(byte[PLEX_COUNT#0]) PLEX_YPOS
(byte[PLEX_COUNT#0]) PLEX_YPOS#0
(byte*) PROCPORT
(byte*) PROCPORT#0
(byte) PROCPORT_BASIC_KERNEL_IO
(byte) PROCPORT_BASIC_KERNEL_IO#0
(byte*) PROCPORT_DDR
(byte*) PROCPORT_DDR#0
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_DDR_MEMORY_MASK#0
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_KERNEL_IO#0
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_ALL#0
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_CHARROM#0
(byte) PROCPORT_RAM_IO
(byte) PROCPORT_RAM_IO#0
(byte) PURPLE
(byte) PURPLE#0
(byte*) RASTER
(byte*) RASTER#0
(byte) RED
(byte) RED#0
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SPRITE
(byte*) SPRITE#0
(byte*) SPRITE#1
(byte*) SPRITE#2
(byte*) SPRITE#3
(byte*) SPRITE#4
(byte*) SPRITE#5
(byte*) SPRITES_COLS
(byte*) SPRITES_COLS#0
(byte*) SPRITES_ENABLE
(byte*) SPRITES_ENABLE#0
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_X#0
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_EXPAND_Y#0
(byte*) SPRITES_MC
(byte*) SPRITES_MC#0
(byte*) SPRITES_MC1
(byte*) SPRITES_MC1#0
(byte*) SPRITES_MC2
(byte*) SPRITES_MC2#0
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_PRIORITY#0
(byte*) SPRITES_XMSB
(byte*) SPRITES_XMSB#0
(byte*) SPRITES_XPOS
(byte*) SPRITES_XPOS#0
(byte*) SPRITES_YPOS
(byte*) SPRITES_YPOS#0
(word) SPRITE_PTRS
(word) SPRITE_PTRS#0
(byte) VIC_BMM
(byte) VIC_BMM#0
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL#0
(byte*) VIC_CONTROL2
(byte*) VIC_CONTROL2#0
(byte) VIC_CSEL
(byte) VIC_CSEL#0
(byte) VIC_DEN
(byte) VIC_DEN#0
(byte) VIC_ECM
(byte) VIC_ECM#0
(byte) VIC_MCM
(byte) VIC_MCM#0
(byte*) VIC_MEMORY
(byte*) VIC_MEMORY#0
(byte) VIC_RSEL
(byte) VIC_RSEL#0
(byte) VIC_RST8
(byte) VIC_RST8#0
(byte) WHITE
(byte) WHITE#0
(byte) YELLOW
(byte) YELLOW#0
(byte*) YSIN
(byte*) YSIN#0
(byte*) YSIN#1
(byte*) YSIN#10
(byte*) YSIN#11
(byte*) YSIN#12
(byte*) YSIN#13
(byte*) YSIN#14
(byte*) YSIN#15
(byte*) YSIN#16
(byte*) YSIN#17
(byte*) YSIN#18
(byte*) YSIN#19
(byte*) YSIN#2
(byte*) YSIN#20
(byte*) YSIN#21
(byte*) YSIN#22
(byte*) YSIN#23
(byte*) YSIN#24
(byte*) YSIN#3
(byte*) YSIN#4
(byte*) YSIN#5
(byte*) YSIN#6
(byte*) YSIN#7
(byte*) YSIN#8
(byte*) YSIN#9
(void()) init()
(byte~) init::$0
(byte/word/dword~) init::$1
(byte/signed word/word/dword/signed dword~) init::$3
(byte*~) init::$4
(byte~) init::$5
(byte~) init::$6
(bool~) init::$7
(bool~) init::$8
(label) init::@1
(label) init::@2
(label) init::@3
(label) init::@5
(label) init::@return
(byte) init::ss
(byte) init::ss#0
(byte) init::ss#1
(byte) init::ss#2
(byte) init::sx
(byte) init::sx#0
(byte) init::sx#1
(byte) init::sx#2
(word) init::xp
(word) init::xp#0
(word) init::xp#1
(word) init::xp#2
(void()) loop()
(bool~) loop::$0
(byte/signed word/word/dword/signed dword~) loop::$1
(bool~) loop::$10
(bool~) loop::$2
(byte~) loop::$4
(bool~) loop::$5
(byte/signed word/word/dword/signed dword~) loop::$6
(byte~) loop::$7
(bool~) loop::$8
(label) loop::@1
(label) loop::@10
(label) loop::@11
(label) loop::@12
(label) loop::@13
(label) loop::@14
(label) loop::@2
(label) loop::@20
(label) loop::@27
(label) loop::@29
(label) loop::@30
(label) loop::@31
(label) loop::@4
(label) loop::@5
(label) loop::@6
(label) loop::@7
(label) loop::@8
(label) loop::@9
(label) loop::@return
(label) loop::plexFreeNextYpos1
(label) loop::plexFreeNextYpos1_@return
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0
(byte) loop::plexFreeNextYpos1_return#1
(byte) loop::plexFreeNextYpos1_return#2
(byte) loop::plexFreeNextYpos1_return#3
(byte) loop::rasterY
(byte) loop::rasterY#0
(byte) loop::rasterY#1
(byte) loop::rasterY#2
(byte) loop::sin_idx
(byte) loop::sin_idx#0
(byte) loop::sin_idx#1
(byte) loop::sin_idx#10
(byte) loop::sin_idx#11
(byte) loop::sin_idx#12
(byte) loop::sin_idx#13
(byte) loop::sin_idx#14
(byte) loop::sin_idx#15
(byte) loop::sin_idx#16
(byte) loop::sin_idx#17
(byte) loop::sin_idx#18
(byte) loop::sin_idx#19
(byte) loop::sin_idx#2
(byte) loop::sin_idx#20
(byte) loop::sin_idx#21
(byte) loop::sin_idx#3
(byte) loop::sin_idx#4
(byte) loop::sin_idx#5
(byte) loop::sin_idx#6
(byte) loop::sin_idx#7
(byte) loop::sin_idx#8
(byte) loop::sin_idx#9
(byte) loop::ss
(byte) loop::ss#0
(byte) loop::ss#1
(byte) loop::ss#2
(byte) loop::ss#3
(byte) loop::ss#4
(byte) loop::ss#5
(byte) loop::ss#6
(byte) loop::ss#7
(byte) loop::ss#8
(byte) loop::ss#9
(byte) loop::sy
(byte) loop::sy#0
(byte) loop::sy#1
(byte) loop::sy#2
(byte) loop::y_idx
(byte) loop::y_idx#0
(byte) loop::y_idx#1
(byte) loop::y_idx#2
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(void()) plexInit((byte*) plexInit::screen)
(byte/signed word/word/dword/signed dword~) plexInit::$1
(bool~) plexInit::$2
(label) plexInit::@1
(label) plexInit::@3
(label) plexInit::@return
(byte) plexInit::i
(byte) plexInit::i#0
(byte) plexInit::i#1
(byte) plexInit::i#2
(label) plexInit::plexSetScreen1
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_$0#0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::plexSetScreen1_screen#0
(byte*) plexInit::plexSetScreen1_screen#1
(byte*) plexInit::screen
(byte*) plexInit::screen#0
(byte*) plexInit::screen#1
(void()) plexShowSprite()
(byte~) plexShowSprite::$0
(bool~) plexShowSprite::$10
(byte~) plexShowSprite::$2
(byte~) plexShowSprite::$3
(byte~) plexShowSprite::$4
(bool~) plexShowSprite::$5
(byte/word/dword~) plexShowSprite::$6
(byte/signed word/word/dword/signed dword~) plexShowSprite::$7
(byte/word/dword~) plexShowSprite::$8
(bool~) plexShowSprite::$9
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@3
(label) plexShowSprite::@4
(label) plexShowSprite::@6
(label) plexShowSprite::@7
(label) plexShowSprite::@return
(label) plexShowSprite::plexFreeAdd1
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0
(byte) plexShowSprite::plexFreeAdd1_ypos#1
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0
(byte) plexShowSprite::plex_sprite_idx2#1
(byte) plexShowSprite::plex_sprite_idx2#2
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0
(byte) plexShowSprite::ypos
(byte) plexShowSprite::ypos#0
(void()) plexSort()
(byte/signed word/word/dword/signed dword~) plexSort::$0
(byte/signed word/word/dword/signed dword~) plexSort::$1
(bool~) plexSort::$2
(bool~) plexSort::$3
(byte/signed word/word/dword/signed dword~) plexSort::$4
(bool~) plexSort::$5
(bool~) plexSort::$6
(bool~) plexSort::$7
(bool~) plexSort::$8
(label) plexSort::@1
(label) plexSort::@2
(label) plexSort::@3
(label) plexSort::@4
(label) plexSort::@5
(label) plexSort::@6
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#0
(byte) plexSort::m#1
(byte) plexSort::m#2
(byte) plexSort::m#3
(byte) plexSort::m#4
(byte) plexSort::m#5
(byte) plexSort::m#6
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0
(byte) plexSort::nxt_idx#1
(byte) plexSort::nxt_idx#2
(byte) plexSort::nxt_idx#3
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0
(byte) plexSort::nxt_y#1
(byte) plexSort::nxt_y#2
(label) plexSort::plexFreePrepare1
(bool~) plexSort::plexFreePrepare1_$0
(bool) plexSort::plexFreePrepare1_$0#0
(label) plexSort::plexFreePrepare1_@1
(label) plexSort::plexFreePrepare1_@2
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#0
(byte) plexSort::plexFreePrepare1_s#1
(byte) plexSort::plexFreePrepare1_s#2
(byte) plexSort::s
(byte) plexSort::s#0
(byte) plexSort::s#1
(byte) plexSort::s#2
(byte) plexSort::s#3
(byte) plexSort::s#4
(byte) plex_free_next
(byte) plex_free_next#0
(byte) plex_free_next#1
(byte) plex_free_next#10
(byte) plex_free_next#11
(byte) plex_free_next#12
(byte) plex_free_next#13
(byte) plex_free_next#14
(byte) plex_free_next#15
(byte) plex_free_next#16
(byte) plex_free_next#17
(byte) plex_free_next#18
(byte) plex_free_next#19
(byte) plex_free_next#2
(byte) plex_free_next#20
(byte) plex_free_next#21
(byte) plex_free_next#22
(byte) plex_free_next#23
(byte) plex_free_next#24
(byte) plex_free_next#25
(byte) plex_free_next#26
(byte) plex_free_next#27
(byte) plex_free_next#28
(byte) plex_free_next#29
(byte) plex_free_next#3
(byte) plex_free_next#30
(byte) plex_free_next#31
(byte) plex_free_next#32
(byte) plex_free_next#33
(byte) plex_free_next#34
(byte) plex_free_next#35
(byte) plex_free_next#36
(byte) plex_free_next#37
(byte) plex_free_next#38
(byte) plex_free_next#39
(byte) plex_free_next#4
(byte) plex_free_next#40
(byte) plex_free_next#41
(byte) plex_free_next#42
(byte) plex_free_next#43
(byte) plex_free_next#44
(byte) plex_free_next#45
(byte) plex_free_next#46
(byte) plex_free_next#47
(byte) plex_free_next#48
(byte) plex_free_next#49
(byte) plex_free_next#5
(byte) plex_free_next#6
(byte) plex_free_next#7
(byte) plex_free_next#8
(byte) plex_free_next#9
(byte) plex_show_idx
(byte) plex_show_idx#0
(byte) plex_show_idx#1
(byte) plex_show_idx#10
(byte) plex_show_idx#11
(byte) plex_show_idx#12
(byte) plex_show_idx#13
(byte) plex_show_idx#14
(byte) plex_show_idx#15
(byte) plex_show_idx#16
(byte) plex_show_idx#17
(byte) plex_show_idx#18
(byte) plex_show_idx#19
(byte) plex_show_idx#2
(byte) plex_show_idx#20
(byte) plex_show_idx#21
(byte) plex_show_idx#22
(byte) plex_show_idx#23
(byte) plex_show_idx#24
(byte) plex_show_idx#25
(byte) plex_show_idx#26
(byte) plex_show_idx#27
(byte) plex_show_idx#28
(byte) plex_show_idx#29
(byte) plex_show_idx#3
(byte) plex_show_idx#30
(byte) plex_show_idx#31
(byte) plex_show_idx#32
(byte) plex_show_idx#33
(byte) plex_show_idx#34
(byte) plex_show_idx#35
(byte) plex_show_idx#36
(byte) plex_show_idx#37
(byte) plex_show_idx#38
(byte) plex_show_idx#39
(byte) plex_show_idx#4
(byte) plex_show_idx#40
(byte) plex_show_idx#41
(byte) plex_show_idx#42
(byte) plex_show_idx#43
(byte) plex_show_idx#44
(byte) plex_show_idx#45
(byte) plex_show_idx#46
(byte) plex_show_idx#47
(byte) plex_show_idx#48
(byte) plex_show_idx#49
(byte) plex_show_idx#5
(byte) plex_show_idx#50
(byte) plex_show_idx#51
(byte) plex_show_idx#52
(byte) plex_show_idx#53
(byte) plex_show_idx#6
(byte) plex_show_idx#7
(byte) plex_show_idx#8
(byte) plex_show_idx#9
(byte) plex_sprite_idx
(byte) plex_sprite_idx#0
(byte) plex_sprite_idx#1
(byte) plex_sprite_idx#10
(byte) plex_sprite_idx#11
(byte) plex_sprite_idx#12
(byte) plex_sprite_idx#13
(byte) plex_sprite_idx#14
(byte) plex_sprite_idx#15
(byte) plex_sprite_idx#16
(byte) plex_sprite_idx#17
(byte) plex_sprite_idx#18
(byte) plex_sprite_idx#19
(byte) plex_sprite_idx#2
(byte) plex_sprite_idx#20
(byte) plex_sprite_idx#21
(byte) plex_sprite_idx#22
(byte) plex_sprite_idx#23
(byte) plex_sprite_idx#24
(byte) plex_sprite_idx#25
(byte) plex_sprite_idx#26
(byte) plex_sprite_idx#27
(byte) plex_sprite_idx#28
(byte) plex_sprite_idx#29
(byte) plex_sprite_idx#3
(byte) plex_sprite_idx#30
(byte) plex_sprite_idx#31
(byte) plex_sprite_idx#32
(byte) plex_sprite_idx#33
(byte) plex_sprite_idx#34
(byte) plex_sprite_idx#35
(byte) plex_sprite_idx#36
(byte) plex_sprite_idx#37
(byte) plex_sprite_idx#38
(byte) plex_sprite_idx#39
(byte) plex_sprite_idx#4
(byte) plex_sprite_idx#40
(byte) plex_sprite_idx#41
(byte) plex_sprite_idx#42
(byte) plex_sprite_idx#43
(byte) plex_sprite_idx#44
(byte) plex_sprite_idx#45
(byte) plex_sprite_idx#46
(byte) plex_sprite_idx#47
(byte) plex_sprite_idx#48
(byte) plex_sprite_idx#49
(byte) plex_sprite_idx#5
(byte) plex_sprite_idx#50
(byte) plex_sprite_idx#51
(byte) plex_sprite_idx#52
(byte) plex_sprite_idx#53
(byte) plex_sprite_idx#6
(byte) plex_sprite_idx#7
(byte) plex_sprite_idx#8
(byte) plex_sprite_idx#9
(byte) plex_sprite_msb
(byte) plex_sprite_msb#0
(byte) plex_sprite_msb#1
(byte) plex_sprite_msb#10
(byte) plex_sprite_msb#11
(byte) plex_sprite_msb#12
(byte) plex_sprite_msb#13
(byte) plex_sprite_msb#14
(byte) plex_sprite_msb#15
(byte) plex_sprite_msb#16
(byte) plex_sprite_msb#17
(byte) plex_sprite_msb#18
(byte) plex_sprite_msb#19
(byte) plex_sprite_msb#2
(byte) plex_sprite_msb#20
(byte) plex_sprite_msb#21
(byte) plex_sprite_msb#22
(byte) plex_sprite_msb#23
(byte) plex_sprite_msb#24
(byte) plex_sprite_msb#25
(byte) plex_sprite_msb#26
(byte) plex_sprite_msb#27
(byte) plex_sprite_msb#28
(byte) plex_sprite_msb#29
(byte) plex_sprite_msb#3
(byte) plex_sprite_msb#30
(byte) plex_sprite_msb#31
(byte) plex_sprite_msb#32
(byte) plex_sprite_msb#33
(byte) plex_sprite_msb#34
(byte) plex_sprite_msb#35
(byte) plex_sprite_msb#36
(byte) plex_sprite_msb#37
(byte) plex_sprite_msb#38
(byte) plex_sprite_msb#39
(byte) plex_sprite_msb#4
(byte) plex_sprite_msb#40
(byte) plex_sprite_msb#41
(byte) plex_sprite_msb#42
(byte) plex_sprite_msb#43
(byte) plex_sprite_msb#44
(byte) plex_sprite_msb#45
(byte) plex_sprite_msb#46
(byte) plex_sprite_msb#47
(byte) plex_sprite_msb#48
(byte) plex_sprite_msb#49
(byte) plex_sprite_msb#5
(byte) plex_sprite_msb#50
(byte) plex_sprite_msb#51
(byte) plex_sprite_msb#52
(byte) plex_sprite_msb#53
(byte) plex_sprite_msb#6
(byte) plex_sprite_msb#7
(byte) plex_sprite_msb#8
(byte) plex_sprite_msb#9

Inversing boolean not [112] (bool~) plexSort::$3 ← (byte) plexSort::nxt_y#0 >= *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2)) from [111] (bool~) plexSort::$2 ← (byte) plexSort::nxt_y#0 < *((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))
Inversing boolean not [182] (bool~) plexShowSprite::$10 ← (byte) plex_sprite_msb#3 != (byte/signed byte/word/signed word/dword/signed dword) 0 from [181] (bool~) plexShowSprite::$9 ← (byte) plex_sprite_msb#3 == (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte*) plexInit::plexSetScreen1_screen#0 = (byte*) plexInit::screen#1 (byte*) plexInit::plexSetScreen1_screen#1 
Alias (byte*) PLEX_SCREEN_PTR#1 = (byte*) plexInit::plexSetScreen1_$0#0 (byte*) PLEX_SCREEN_PTR#22 
Alias (byte*) PLEX_SCREEN_PTR#15 = (byte*) PLEX_SCREEN_PTR#8 (byte*) PLEX_SCREEN_PTR#2 
Alias (byte) plexSort::m#2 = (byte) plexSort::m#4 (byte) plexSort::s#0 
Alias (byte) plexSort::nxt_y#0 = (byte) plexSort::nxt_y#2 
Alias (byte) plexSort::nxt_idx#0 = (byte) plexSort::nxt_idx#3 
Alias (byte) plexSort::s#1 = (byte) plexSort::s#4 
Alias (byte) plexSort::nxt_idx#1 = (byte) plexSort::nxt_idx#2 
Alias (byte) plexSort::m#5 = (byte) plexSort::m#6 
Alias (byte) plex_show_idx#1 = (byte) plex_show_idx#40 
Alias (byte) plex_sprite_idx#1 = (byte) plex_sprite_idx#40 
Alias (byte) plex_sprite_msb#1 = (byte) plex_sprite_msb#39 
Alias (byte) plex_show_idx#11 = (byte) plex_show_idx#22 (byte) plex_show_idx#33 (byte) plex_show_idx#2 
Alias (byte) plex_sprite_idx#11 = (byte) plex_sprite_idx#22 (byte) plex_sprite_idx#33 (byte) plex_sprite_idx#2 
Alias (byte) plex_sprite_msb#12 = (byte) plex_sprite_msb#23 (byte) plex_sprite_msb#31 (byte) plex_sprite_msb#2 
Alias (byte) plex_free_next#0 = (byte) plex_free_next#11 (byte) plex_free_next#1 
Alias (byte) plexShowSprite::plex_sprite_idx2#0 = (byte~) plexShowSprite::$0 (byte) plexShowSprite::plex_sprite_idx2#2 (byte) plexShowSprite::plex_sprite_idx2#1 
Alias (byte) plexShowSprite::plexFreeAdd1_ypos#0 = (byte) plexShowSprite::ypos#0 (byte) plexShowSprite::plexFreeAdd1_ypos#1 
Alias (byte) plex_free_next#12 = (byte) plex_free_next#21 
Alias (byte) plex_show_idx#12 = (byte) plex_show_idx#24 (byte) plex_show_idx#13 (byte) plex_show_idx#25 (byte) plex_show_idx#26 
Alias (byte*) PLEX_SCREEN_PTR#16 = (byte*) PLEX_SCREEN_PTR#23 (byte*) PLEX_SCREEN_PTR#9 
Alias (byte) plex_sprite_idx#12 = (byte) plex_sprite_idx#24 (byte) plex_sprite_idx#13 (byte) plex_sprite_idx#25 (byte) plex_sprite_idx#26 
Alias (byte) plex_sprite_msb#13 = (byte) plex_sprite_msb#32 (byte) plex_sprite_msb#40 (byte) plex_sprite_msb#24 (byte) plex_sprite_msb#14 
Alias (byte) plex_free_next#2 = (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 (byte) plex_free_next#44 (byte) plex_free_next#38 (byte) plex_free_next#39 
Alias (byte) plexShowSprite::xpos_idx#0 = (byte~) plexShowSprite::$2 
Alias (byte) plex_sprite_idx#27 = (byte) plex_sprite_idx#3 (byte/word/dword~) plexShowSprite::$8 (byte) plex_sprite_idx#28 
Alias (byte) plex_free_next#22 = (byte) plex_free_next#30 (byte) plex_free_next#23 
Alias (byte) plex_show_idx#27 = (byte) plex_show_idx#3 (byte) plex_show_idx#28 
Alias (byte) plex_sprite_msb#25 = (byte) plex_sprite_msb#3 
Alias (byte) plex_free_next#13 = (byte) plex_free_next#3 
Alias (byte) plex_sprite_idx#15 = (byte) plex_sprite_idx#4 
Alias (byte) plex_show_idx#15 = (byte) plex_show_idx#4 
Alias (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#5 
Alias (byte*) PLEX_SCREEN_PTR#0 = (byte*) PLEX_SCREEN_PTR#27 (byte*) PLEX_SCREEN_PTR#25 (byte*) PLEX_SCREEN_PTR#21 
Alias (byte) plex_show_idx#0 = (byte) plex_show_idx#41 (byte) plex_show_idx#39 (byte) plex_show_idx#32 
Alias (byte) plex_sprite_idx#0 = (byte) plex_sprite_idx#41 (byte) plex_sprite_idx#39 (byte) plex_sprite_idx#32 
Alias (byte) plex_sprite_msb#0 = (byte) plex_sprite_msb#41 (byte) plex_sprite_msb#38 (byte) plex_sprite_msb#30 
Alias (byte) plex_free_next#29 = (byte) plex_free_next#37 (byte) plex_free_next#4 
Alias (byte) plex_show_idx#29 = (byte) plex_show_idx#34 
Alias (byte) plex_sprite_idx#29 = (byte) plex_sprite_idx#34 
Alias (byte) plex_sprite_msb#26 = (byte) plex_sprite_msb#33 
Alias (byte) plex_free_next#24 = (byte) plex_free_next#31 
Alias (byte*) YSIN#11 = (byte*) YSIN#9 
Alias (byte*) PLEX_SCREEN_PTR#10 = (byte*) PLEX_SCREEN_PTR#3 (byte*) PLEX_SCREEN_PTR#18 (byte*) PLEX_SCREEN_PTR#11 (byte*) PLEX_SCREEN_PTR#4 
Alias (byte) plex_show_idx#16 = (byte) plex_show_idx#5 (byte) plex_show_idx#17 (byte) plex_show_idx#6 
Alias (byte) plex_sprite_idx#16 = (byte) plex_sprite_idx#5 (byte) plex_sprite_idx#17 (byte) plex_sprite_idx#6 
Alias (byte) plex_sprite_msb#17 = (byte) plex_sprite_msb#6 (byte) plex_sprite_msb#18 (byte) plex_sprite_msb#7 
Alias (byte) plex_free_next#14 = (byte) plex_free_next#5 (byte) plex_free_next#15 (byte) plex_free_next#6 
Alias (byte*) SPRITE#2 = (byte*) SPRITE#3 
Alias (byte*) PLEX_SCREEN_PTR#12 = (byte*) PLEX_SCREEN_PTR#5 
Alias (byte*) PLEX_SCREEN_PTR#24 = (byte*) PLEX_SCREEN_PTR#28 
Alias (byte*) PLEX_SCREEN_PTR#13 = (byte*) PLEX_SCREEN_PTR#20 (byte*) PLEX_SCREEN_PTR#6 
Alias (byte) loop::sin_idx#6 = (byte) loop::sin_idx#8 
Alias (byte*) YSIN#4 = (byte*) YSIN#6 
Alias (byte) plex_show_idx#20 = (byte) plex_show_idx#47 (byte) plex_show_idx#31 (byte) plex_show_idx#9 
Alias (byte) plex_sprite_idx#20 = (byte) plex_sprite_idx#47 (byte) plex_sprite_idx#31 (byte) plex_sprite_idx#9 
Alias (byte) plex_sprite_msb#10 = (byte) plex_sprite_msb#47 (byte) plex_sprite_msb#29 (byte) plex_sprite_msb#21 
Alias (byte) plex_free_next#19 = (byte) plex_free_next#48 (byte) plex_free_next#28 (byte) plex_free_next#9 
Alias (byte*) PLEX_SCREEN_PTR#44 = (byte*) PLEX_SCREEN_PTR#46 
Alias (byte) loop::sin_idx#2 = (byte) loop::sin_idx#7 (byte) loop::sin_idx#4 (byte) loop::y_idx#0 
Alias (byte*) YSIN#2 = (byte*) YSIN#5 (byte*) YSIN#3 
Alias (byte) plex_show_idx#42 = (byte) plex_show_idx#48 (byte) plex_show_idx#45 
Alias (byte) plex_sprite_idx#42 = (byte) plex_sprite_idx#48 (byte) plex_sprite_idx#45 
Alias (byte) plex_sprite_msb#42 = (byte) plex_sprite_msb#48 (byte) plex_sprite_msb#45 
Alias (byte) plex_free_next#40 = (byte) plex_free_next#49 (byte) plex_free_next#45 
Alias (byte*) PLEX_SCREEN_PTR#42 = (byte*) PLEX_SCREEN_PTR#45 (byte*) PLEX_SCREEN_PTR#43 
Alias (byte) loop::sin_idx#3 = (byte) loop::sin_idx#5 
Alias (byte) plex_show_idx#30 = (byte) plex_show_idx#37 
Alias (byte) plex_sprite_idx#30 = (byte) plex_sprite_idx#37 
Alias (byte) plex_sprite_msb#27 = (byte) plex_sprite_msb#36 
Alias (byte) plex_free_next#25 = (byte) plex_free_next#34 
Alias (byte*) PLEX_SCREEN_PTR#38 = (byte*) PLEX_SCREEN_PTR#40 (byte*) PLEX_SCREEN_PTR#41 
Alias (byte*) YSIN#1 = (byte*) YSIN#24 (byte*) YSIN#22 
Alias (byte) loop::sin_idx#1 = (byte) loop::sin_idx#20 
Alias (byte) plex_show_idx#18 = (byte) plex_show_idx#7 
Alias (byte) plex_sprite_idx#18 = (byte) plex_sprite_idx#7 
Alias (byte) plex_sprite_msb#19 = (byte) plex_sprite_msb#8 
Alias (byte) plex_free_next#16 = (byte) plex_free_next#7 
Alias (byte) plex_free_next#35 = (byte) plex_free_next#46 (byte) plex_free_next#41 
Alias (byte) plex_sprite_idx#51 = (byte) plex_sprite_idx#53 (byte) plex_sprite_idx#52 
Alias (byte) plex_show_idx#51 = (byte) plex_show_idx#53 (byte) plex_show_idx#52 
Alias (byte) plex_sprite_msb#51 = (byte) plex_sprite_msb#53 (byte) plex_sprite_msb#52 
Alias (byte*) PLEX_SCREEN_PTR#35 = (byte*) PLEX_SCREEN_PTR#39 (byte*) PLEX_SCREEN_PTR#37 
Alias (byte) loop::sin_idx#18 = (byte) loop::sin_idx#21 (byte) loop::sin_idx#19 
Alias (byte*) YSIN#20 = (byte*) YSIN#23 (byte*) YSIN#21 
Alias (byte) plex_free_next#17 = (byte) plex_free_next#26 (byte) plex_free_next#47 (byte) plex_free_next#43 
Alias (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#49 (byte) plex_sprite_idx#50 (byte) plex_sprite_idx#46 
Alias (byte) plex_show_idx#44 = (byte) plex_show_idx#49 (byte) plex_show_idx#50 (byte) plex_show_idx#46 
Alias (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#49 (byte) plex_sprite_msb#50 (byte) plex_sprite_msb#46 
Alias (byte) loop::ss#6 = (byte) loop::ss#8 (byte) loop::ss#9 (byte) loop::ss#7 
Alias (byte*) PLEX_SCREEN_PTR#31 = (byte*) PLEX_SCREEN_PTR#33 (byte*) PLEX_SCREEN_PTR#34 (byte*) PLEX_SCREEN_PTR#32 
Alias (byte) loop::sin_idx#14 = (byte) loop::sin_idx#16 (byte) loop::sin_idx#17 (byte) loop::sin_idx#15 
Alias (byte*) YSIN#16 = (byte*) YSIN#18 (byte*) YSIN#19 (byte*) YSIN#17 
Alias (byte) loop::plexFreeNextYpos1_return#0 = (byte) loop::plexFreeNextYpos1_return#2 (byte) loop::plexFreeNextYpos1_return#1 (byte) loop::plexFreeNextYpos1_return#3 (byte~) loop::$7 (byte) loop::rasterY#0 
Alias (byte) loop::rasterY#1 = (byte) loop::rasterY#2 
Alias (byte) plex_sprite_idx#23 = (byte) plex_sprite_idx#43 (byte) plex_sprite_idx#38 
Alias (byte) plex_show_idx#23 = (byte) plex_show_idx#43 (byte) plex_show_idx#38 
Alias (byte) plex_free_next#27 = (byte) plex_free_next#42 (byte) plex_free_next#36 
Alias (byte) plex_sprite_msb#28 = (byte) plex_sprite_msb#43 (byte) plex_sprite_msb#37 
Alias (byte) loop::ss#2 = (byte) loop::ss#5 (byte) loop::ss#4 (byte) loop::ss#3 
Alias (byte*) PLEX_SCREEN_PTR#26 = (byte*) PLEX_SCREEN_PTR#30 (byte*) PLEX_SCREEN_PTR#29 (byte*) PLEX_SCREEN_PTR#36 (byte*) PLEX_SCREEN_PTR#48 
Alias (byte) loop::sin_idx#10 = (byte) loop::sin_idx#13 (byte) loop::sin_idx#12 (byte) loop::sin_idx#11 (byte) loop::sin_idx#9 
Alias (byte*) YSIN#10 = (byte*) YSIN#15 (byte*) YSIN#14 (byte*) YSIN#12 (byte*) YSIN#8 
Alias (byte) plex_free_next#18 = (byte) plex_free_next#8 (byte) plex_free_next#33 
Alias (byte) plex_sprite_idx#19 = (byte) plex_sprite_idx#8 (byte) plex_sprite_idx#36 
Alias (byte) plex_show_idx#19 = (byte) plex_show_idx#8 (byte) plex_show_idx#36 
Alias (byte) plex_sprite_msb#20 = (byte) plex_sprite_msb#9 (byte) plex_sprite_msb#35 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#3 
Alias (byte*) SPRITE#0 = (byte*) SPRITE#5 
Alias (byte*) YSIN#0 = (byte*) YSIN#13 
Alias (byte*) PLEX_SCREEN_PTR#14 = (byte*) PLEX_SCREEN_PTR#7 
Alias (byte) plex_show_idx#10 = (byte) plex_show_idx#21 
Alias (byte) plex_sprite_idx#10 = (byte) plex_sprite_idx#21 
Alias (byte) plex_sprite_msb#11 = (byte) plex_sprite_msb#22 
Alias (byte) plex_free_next#10 = (byte) plex_free_next#20 
Successful SSA optimization Pass2AliasElimination
Alias (byte) plex_sprite_idx#12 = (byte) plex_sprite_idx#14 
Alias (byte) plex_show_idx#12 = (byte) plex_show_idx#14 
Alias (byte) plex_sprite_msb#13 = (byte) plex_sprite_msb#15 
Alias (byte) plex_free_next#13 = (byte) plex_free_next#22 (byte) plex_free_next#2 
Alias (byte) plex_sprite_idx#15 = (byte) plex_sprite_idx#27 
Alias (byte) plex_show_idx#15 = (byte) plex_show_idx#27 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#15
Self Phi Eliminated (byte) plexSort::nxt_y#1
Self Phi Eliminated (byte) plexSort::nxt_idx#1
Self Phi Eliminated (byte) plexSort::m#5
Self Phi Eliminated (byte) plex_show_idx#11
Self Phi Eliminated (byte) plex_sprite_idx#11
Self Phi Eliminated (byte) plex_sprite_msb#12
Self Phi Eliminated (byte*) SPRITE#1
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#24
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#13
Self Phi Eliminated (byte) loop::sin_idx#2
Self Phi Eliminated (byte*) YSIN#2
Self Phi Eliminated (byte) plex_show_idx#42
Self Phi Eliminated (byte) plex_sprite_idx#42
Self Phi Eliminated (byte) plex_sprite_msb#42
Self Phi Eliminated (byte) plex_free_next#40
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#42
Self Phi Eliminated (byte*) YSIN#1
Self Phi Eliminated (byte) loop::sin_idx#3
Self Phi Eliminated (byte) plex_show_idx#30
Self Phi Eliminated (byte) plex_sprite_idx#30
Self Phi Eliminated (byte) plex_sprite_msb#27
Self Phi Eliminated (byte) plex_free_next#25
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#38
Self Phi Eliminated (byte) plex_free_next#35
Self Phi Eliminated (byte) plex_sprite_idx#51
Self Phi Eliminated (byte) plex_show_idx#51
Self Phi Eliminated (byte) plex_sprite_msb#51
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#35
Self Phi Eliminated (byte) loop::sin_idx#18
Self Phi Eliminated (byte*) YSIN#20
Self Phi Eliminated (byte) loop::rasterY#1
Self Phi Eliminated (byte) plex_sprite_idx#23
Self Phi Eliminated (byte) plex_show_idx#23
Self Phi Eliminated (byte) plex_free_next#27
Self Phi Eliminated (byte) plex_sprite_msb#28
Self Phi Eliminated (byte) loop::ss#2
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#26
Self Phi Eliminated (byte) loop::sin_idx#10
Self Phi Eliminated (byte*) YSIN#10
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) plexInit::plexSetScreen1_screen#0 (byte*) plexInit::screen#0
Redundant Phi (byte*) PLEX_SCREEN_PTR#15 (byte*) PLEX_SCREEN_PTR#1
Redundant Phi (byte) plexSort::nxt_y#1 (byte) plexSort::nxt_y#0
Redundant Phi (byte) plexSort::nxt_idx#1 (byte) plexSort::nxt_idx#0
Redundant Phi (byte) plexSort::m#5 (byte) plexSort::m#2
Redundant Phi (byte) plex_show_idx#11 (byte) plex_show_idx#1
Redundant Phi (byte) plex_sprite_idx#11 (byte) plex_sprite_idx#1
Redundant Phi (byte) plex_sprite_msb#12 (byte) plex_sprite_msb#1
Redundant Phi (byte) plex_sprite_idx#12 (byte) plex_sprite_idx#23
Redundant Phi (byte) plex_show_idx#12 (byte) plex_show_idx#23
Redundant Phi (byte) plex_free_next#12 (byte) plex_free_next#27
Redundant Phi (byte*) PLEX_SCREEN_PTR#16 (byte*) PLEX_SCREEN_PTR#26
Redundant Phi (byte) plex_sprite_msb#13 (byte) plex_sprite_msb#28
Redundant Phi (byte*) PLEX_SCREEN_PTR#17 (byte*) PLEX_SCREEN_PTR#0
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#0
Redundant Phi (byte) plex_show_idx#29 (byte) plex_show_idx#0
Redundant Phi (byte) plex_sprite_idx#29 (byte) plex_sprite_idx#0
Redundant Phi (byte) plex_sprite_msb#26 (byte) plex_sprite_msb#0
Redundant Phi (byte) plex_free_next#24 (byte) plex_free_next#29
Redundant Phi (byte*) SPRITE#4 (byte*) SPRITE#0
Redundant Phi (byte*) YSIN#11 (byte*) YSIN#0
Redundant Phi (byte*) PLEX_SCREEN_PTR#10 (byte*) PLEX_SCREEN_PTR#13
Redundant Phi (byte) plex_show_idx#16 (byte) plex_show_idx#20
Redundant Phi (byte) plex_sprite_idx#16 (byte) plex_sprite_idx#20
Redundant Phi (byte) plex_sprite_msb#17 (byte) plex_sprite_msb#10
Redundant Phi (byte) plex_free_next#14 (byte) plex_free_next#19
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#2
Redundant Phi (byte*) PLEX_SCREEN_PTR#19 (byte*) PLEX_SCREEN_PTR#17
Redundant Phi (byte*) SPRITE#2 (byte*) SPRITE#4
Redundant Phi (byte*) PLEX_SCREEN_PTR#12 (byte*) PLEX_SCREEN_PTR#15
Redundant Phi (byte*) SPRITE#1 (byte*) SPRITE#2
Redundant Phi (byte*) PLEX_SCREEN_PTR#24 (byte*) PLEX_SCREEN_PTR#12
Redundant Phi (byte*) PLEX_SCREEN_PTR#13 (byte*) PLEX_SCREEN_PTR#24
Redundant Phi (byte) plex_show_idx#35 (byte) plex_show_idx#29
Redundant Phi (byte) plex_sprite_idx#35 (byte) plex_sprite_idx#29
Redundant Phi (byte) plex_sprite_msb#34 (byte) plex_sprite_msb#26
Redundant Phi (byte) plex_free_next#32 (byte) plex_free_next#24
Redundant Phi (byte*) YSIN#7 (byte*) YSIN#11
Redundant Phi (byte*) PLEX_SCREEN_PTR#47 (byte*) PLEX_SCREEN_PTR#10
Redundant Phi (byte) loop::sin_idx#2 (byte) loop::sin_idx#6
Redundant Phi (byte*) YSIN#2 (byte*) YSIN#4
Redundant Phi (byte) plex_show_idx#42 (byte) plex_show_idx#20
Redundant Phi (byte) plex_sprite_idx#42 (byte) plex_sprite_idx#20
Redundant Phi (byte) plex_sprite_msb#42 (byte) plex_sprite_msb#10
Redundant Phi (byte) plex_free_next#40 (byte) plex_free_next#19
Redundant Phi (byte*) PLEX_SCREEN_PTR#42 (byte*) PLEX_SCREEN_PTR#44
Redundant Phi (byte*) YSIN#1 (byte*) YSIN#2
Redundant Phi (byte) loop::sin_idx#3 (byte) loop::sin_idx#2
Redundant Phi (byte) plex_show_idx#30 (byte) plex_show_idx#42
Redundant Phi (byte) plex_sprite_idx#30 (byte) plex_sprite_idx#42
Redundant Phi (byte) plex_sprite_msb#27 (byte) plex_sprite_msb#42
Redundant Phi (byte) plex_free_next#25 (byte) plex_free_next#40
Redundant Phi (byte*) PLEX_SCREEN_PTR#38 (byte*) PLEX_SCREEN_PTR#42
Redundant Phi (byte) plex_show_idx#18 (byte) plex_show_idx#11
Redundant Phi (byte) plex_sprite_idx#18 (byte) plex_sprite_idx#11
Redundant Phi (byte) plex_sprite_msb#19 (byte) plex_sprite_msb#12
Redundant Phi (byte) plex_free_next#16 (byte) plex_free_next#0
Redundant Phi (byte) plex_free_next#35 (byte) plex_free_next#16
Redundant Phi (byte) plex_sprite_idx#51 (byte) plex_sprite_idx#18
Redundant Phi (byte) plex_show_idx#51 (byte) plex_show_idx#18
Redundant Phi (byte) plex_sprite_msb#51 (byte) plex_sprite_msb#19
Redundant Phi (byte*) PLEX_SCREEN_PTR#35 (byte*) PLEX_SCREEN_PTR#38
Redundant Phi (byte) loop::sin_idx#18 (byte) loop::sin_idx#1
Redundant Phi (byte*) YSIN#20 (byte*) YSIN#1
Redundant Phi (byte) loop::rasterY#1 (byte) loop::plexFreeNextYpos1_return#0
Redundant Phi (byte) plex_sprite_idx#23 (byte) plex_sprite_idx#44
Redundant Phi (byte) plex_show_idx#23 (byte) plex_show_idx#44
Redundant Phi (byte) plex_free_next#27 (byte) plex_free_next#17
Redundant Phi (byte) plex_sprite_msb#28 (byte) plex_sprite_msb#44
Redundant Phi (byte) loop::ss#2 (byte) loop::ss#6
Redundant Phi (byte*) PLEX_SCREEN_PTR#26 (byte*) PLEX_SCREEN_PTR#31
Redundant Phi (byte) loop::sin_idx#10 (byte) loop::sin_idx#14
Redundant Phi (byte*) YSIN#10 (byte*) YSIN#16
Redundant Phi (byte) plex_free_next#18 (byte) plex_free_next#13
Redundant Phi (byte) plex_sprite_idx#19 (byte) plex_sprite_idx#15
Redundant Phi (byte) plex_show_idx#19 (byte) plex_show_idx#15
Redundant Phi (byte) plex_sprite_msb#20 (byte) plex_sprite_msb#16
Redundant Phi (byte*) PLEX_SCREEN_PTR#14 (byte*) PLEX_SCREEN_PTR#10
Redundant Phi (byte) plex_show_idx#10 (byte) plex_show_idx#16
Redundant Phi (byte) plex_sprite_idx#10 (byte) plex_sprite_idx#16
Redundant Phi (byte) plex_sprite_msb#11 (byte) plex_sprite_msb#17
Redundant Phi (byte) plex_free_next#10 (byte) plex_free_next#14
Successful SSA optimization Pass2RedundantPhiElimination
Redundant Phi (byte) plexSort::m#3 (byte) plexSort::m#2
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) plexInit::$2 [101] if((byte) plexInit::i#1!=rangelast(0,plexInit::$1)) goto plexInit::@1
Simple Condition (bool~) plexSort::$3 [113] if((byte) plexSort::nxt_y#0>=*((byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2
Simple Condition (bool~) plexSort::$8 [117] if((byte) plexSort::m#1!=rangelast(0,plexSort::$0)) goto plexSort::@1
Simple Condition (bool) plexSort::plexFreePrepare1_$0#0 [140] if((byte) plexSort::plexFreePrepare1_s#1!=rangelast(0,7)) goto plexSort::plexFreePrepare1_@1
Simple Condition (bool~) plexShowSprite::$5 [169] if((byte~) plexShowSprite::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1
Simple Condition (bool~) plexShowSprite::$10 [183] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@3
Simple Condition (bool~) init::$7 [240] if((byte) init::sx#1!=rangelast(0,init::$3)) goto init::@1
Simple Condition (bool~) init::$8 [248] if((byte) init::ss#1!=rangelast(0,7)) goto init::@2
Simple Condition (bool~) loop::$0 [259] if(*((byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@5
Simple Condition (bool~) loop::$2 [271] if((byte) loop::sy#1!=rangelast(0,loop::$1)) goto loop::@7
Simple Condition (bool~) loop::$5 [285] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@9
Simple Condition (bool~) loop::$8 [301] if(*((byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@13
Simple Condition (bool~) loop::$10 [313] if((byte) loop::ss#1!=rangelast(0,loop::$6)) goto loop::@11
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting && if()-condition to two if()s [126] (bool~) plexSort::$7 ← (bool~) plexSort::$5 && (bool~) plexSort::$6
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0
Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7
Constant (const byte*) PROCPORT#0 = ((byte*))1
Constant (const byte) PROCPORT_RAM_ALL#0 = 48
Constant (const byte) PROCPORT_RAM_IO#0 = 53
Constant (const byte) PROCPORT_RAM_CHARROM#0 = 49
Constant (const byte) PROCPORT_KERNEL_IO#0 = 54
Constant (const byte) PROCPORT_BASIC_KERNEL_IO#0 = 55
Constant (const byte*) CHARGEN#0 = ((byte*))53248
Constant (const word) SPRITE_PTRS#0 = 1016
Constant (const byte*) SPRITES_XPOS#0 = ((byte*))53248
Constant (const byte*) SPRITES_YPOS#0 = ((byte*))53249
Constant (const byte*) SPRITES_XMSB#0 = ((byte*))53264
Constant (const byte*) RASTER#0 = ((byte*))53266
Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))53269
Constant (const byte*) SPRITES_EXPAND_Y#0 = ((byte*))53271
Constant (const byte*) SPRITES_PRIORITY#0 = ((byte*))53275
Constant (const byte*) SPRITES_MC#0 = ((byte*))53276
Constant (const byte*) SPRITES_EXPAND_X#0 = ((byte*))53277
Constant (const byte*) BORDERCOL#0 = ((byte*))53280
Constant (const byte*) BGCOL#0 = ((byte*))53281
Constant (const byte*) BGCOL1#0 = ((byte*))53281
Constant (const byte*) BGCOL2#0 = ((byte*))53282
Constant (const byte*) BGCOL3#0 = ((byte*))53283
Constant (const byte*) BGCOL4#0 = ((byte*))53284
Constant (const byte*) SPRITES_MC1#0 = ((byte*))53285
Constant (const byte*) SPRITES_MC2#0 = ((byte*))53286
Constant (const byte*) SPRITES_COLS#0 = ((byte*))53287
Constant (const byte*) VIC_CONTROL#0 = ((byte*))53265
Constant (const byte*) D011#0 = ((byte*))53265
Constant (const byte) VIC_RST8#0 = 128
Constant (const byte) VIC_ECM#0 = 64
Constant (const byte) VIC_BMM#0 = 32
Constant (const byte) VIC_DEN#0 = 16
Constant (const byte) VIC_RSEL#0 = 8
Constant (const byte*) VIC_CONTROL2#0 = ((byte*))53270
Constant (const byte*) D016#0 = ((byte*))53270
Constant (const byte) VIC_MCM#0 = 16
Constant (const byte) VIC_CSEL#0 = 8
Constant (const byte*) D018#0 = ((byte*))53272
Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272
Constant (const byte*) LIGHTPEN_X#0 = ((byte*))53267
Constant (const byte*) LIGHTPEN_Y#0 = ((byte*))53268
Constant (const byte*) IRQ_STATUS#0 = ((byte*))53273
Constant (const byte*) IRQ_ENABLE#0 = ((byte*))53274
Constant (const byte) IRQ_RASTER#0 = 1
Constant (const byte) IRQ_COLLISION_BG#0 = 2
Constant (const byte) IRQ_COLLISION_SPRITE#0 = 4
Constant (const byte) IRQ_LIGHTPEN#0 = 8
Constant (const byte*) COLS#0 = ((byte*))55296
Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320
Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321
Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322
Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323
Constant (const byte*) CIA1_INTERRUPT#0 = ((byte*))56333
Constant (const byte) CIA_INTERRUPT_CLEAR#0 = 127
Constant (const byte*) CIA2_PORT_A#0 = ((byte*))56576
Constant (const byte*) CIA2_PORT_B#0 = ((byte*))56577
Constant (const byte*) CIA2_PORT_A_DDR#0 = ((byte*))56578
Constant (const byte*) CIA2_PORT_B_DDR#0 = ((byte*))56579
Constant (const byte*) CIA2_INTERRUPT#0 = ((byte*))56589
Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788
Constant (const void()**) HARDWARE_IRQ#0 = ((void()**))65534
Constant (const byte) BLACK#0 = 0
Constant (const byte) WHITE#0 = 1
Constant (const byte) RED#0 = 2
Constant (const byte) CYAN#0 = 3
Constant (const byte) PURPLE#0 = 4
Constant (const byte) GREEN#0 = 5
Constant (const byte) BLUE#0 = 6
Constant (const byte) YELLOW#0 = 7
Constant (const byte) ORANGE#0 = 8
Constant (const byte) BROWN#0 = 9
Constant (const byte) PINK#0 = 10
Constant (const byte) DARK_GREY#0 = 11
Constant (const byte) GREY#0 = 12
Constant (const byte) LIGHT_GREEN#0 = 13
Constant (const byte) LIGHT_BLUE#0 = 14
Constant (const byte) LIGHT_GREY#0 = 15
Constant (const byte) PLEX_COUNT#0 = 32
Constant (const word/signed word/dword/signed dword) $0 = 1024+1016
Constant (const byte) plex_show_idx#0 = 0
Constant (const byte) plex_sprite_idx#0 = 0
Constant (const byte) plex_sprite_msb#0 = 1
Constant (const byte) plexInit::i#0 = 0
Constant (const byte) plexSort::m#0 = 0
Constant (const byte) plex_show_idx#1 = 0
Constant (const byte) plex_sprite_idx#1 = 0
Constant (const byte) plex_sprite_msb#1 = 1
Constant (const byte) plexSort::plexFreePrepare1_s#0 = 0
Constant (const byte) plex_free_next#0 = 0
Constant (const byte) plex_sprite_msb#4 = 1
Constant (const byte[8]) PLEX_FREE_YPOS#0 = { fill( 8, 0) }
Constant (const byte) plex_free_next#29 = 0
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte*) SPRITE#0 = ((byte*))8192
Constant (const byte*) YSIN#0 = ((byte*))8448
Constant (const word) init::xp#0 = 32
Constant (const byte) init::sx#0 = 0
Constant (const byte) init::ss#0 = 0
Constant (const byte) loop::sin_idx#0 = 0
Constant (const byte) loop::sy#0 = 0
Constant (const byte) loop::ss#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word[PLEX_COUNT#0]) PLEX_XPOS#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte[PLEX_COUNT#0]) PLEX_YPOS#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte[PLEX_COUNT#0]) PLEX_PTR#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte*) PLEX_SCREEN_PTR#0 = ((byte*))$0
Constant (const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 = { fill( PLEX_COUNT#0, 0) }
Constant (const byte/signed word/word/dword/signed dword) plexInit::$1 = PLEX_COUNT#0-1
Constant (const byte/signed word/word/dword/signed dword) plexSort::$0 = PLEX_COUNT#0-2
Constant (const byte) init::$0 = VIC_DEN#0|VIC_RSEL#0
Constant (const byte*) plexInit::screen#0 = SCREEN#0
Constant (const byte/signed word/word/dword/signed dword) init::$3 = PLEX_COUNT#0-1
Constant (const byte*) init::$4 = SPRITE#0/64
Constant (const byte/signed word/word/dword/signed dword) loop::$1 = PLEX_COUNT#0-1
Constant (const byte/signed word/word/dword/signed dword) loop::$6 = PLEX_COUNT#0-1
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) PLEX_SCREEN_PTR#1 = plexInit::screen#0+1016
Constant (const byte/word/dword) init::$1 = init::$0|3
Constant (const byte) init::$5 = ((byte))init::$4
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in assignment *(PLEX_SORTED_IDX#0+1 + plexSort::$1)
Consolidated array index constant in assignment *(PLEX_SORTED_IDX#0+1 + plexSort::$4)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [71] if(true) goto loop::@2
Successful SSA optimization Pass2ConstantIfs
Inferred type updated to byte in [6] (byte/signed word/word/dword/signed dword~) plexSort::$1 ← (byte) plexSort::m#2
Inferred type updated to byte in [13] (byte/signed word/word/dword/signed dword~) plexSort::$4 ← (byte) plexSort::s#3
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization PassNEliminateUnusedVars
Removing unused block loop::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Resolved ranged next value plexInit::i#1 ← ++ plexInit::i#2 to ++
Resolved ranged comparison value if(plexInit::i#1!=rangelast(0,plexInit::$1)) goto plexInit::@1 to (const byte/signed word/word/dword/signed dword) plexInit::$1+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value plexSort::m#1 ← ++ plexSort::m#2 to ++
Resolved ranged comparison value if(plexSort::m#1!=rangelast(0,plexSort::$0)) goto plexSort::@1 to (const byte/signed word/word/dword/signed dword) plexSort::$0+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value plexSort::plexFreePrepare1_s#1 ← ++ plexSort::plexFreePrepare1_s#2 to ++
Resolved ranged comparison value if(plexSort::plexFreePrepare1_s#1!=rangelast(0,7)) goto plexSort::plexFreePrepare1_@1 to (byte/signed byte/word/signed word/dword/signed dword) 8
Resolved ranged next value init::sx#1 ← ++ init::sx#2 to ++
Resolved ranged comparison value if(init::sx#1!=rangelast(0,init::$3)) goto init::@1 to (const byte/signed word/word/dword/signed dword) init::$3+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value init::ss#1 ← ++ init::ss#2 to ++
Resolved ranged comparison value if(init::ss#1!=rangelast(0,7)) goto init::@2 to (byte/signed byte/word/signed word/dword/signed dword) 8
Resolved ranged next value loop::sy#1 ← ++ loop::sy#2 to ++
Resolved ranged comparison value if(loop::sy#1!=rangelast(0,loop::$1)) goto loop::@7 to (const byte/signed word/word/dword/signed dword) loop::$1+(byte/signed byte/word/signed word/dword/signed dword) 1
Resolved ranged next value loop::ss#1 ← ++ loop::ss#6 to ++
Resolved ranged comparison value if(loop::ss#1!=rangelast(0,loop::$6)) goto loop::@11 to (const byte/signed word/word/dword/signed dword) loop::$6+(byte/signed byte/word/signed word/dword/signed dword) 1
Culled Empty Block (label) @4
Culled Empty Block (label) plexInit::@3
Culled Empty Block (label) plexSort::@4
Culled Empty Block (label) plexSort::@6
Culled Empty Block (label) plexSort::plexFreePrepare1_@2
Culled Empty Block (label) plexShowSprite::@3
Culled Empty Block (label) @9
Culled Empty Block (label) main::@2
Culled Empty Block (label) init::@5
Culled Empty Block (label) loop::@2
Culled Empty Block (label) loop::@5
Culled Empty Block (label) loop::@9
Culled Empty Block (label) loop::@10
Culled Empty Block (label) loop::plexFreeNextYpos1_@return
Culled Empty Block (label) loop::@29
Culled Empty Block (label) loop::@13
Culled Empty Block (label) @16
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte) plexSort::m#2 = (byte~) plexSort::$1 
Alias (byte) plexSort::s#3 = (byte~) plexSort::$4 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#31
Self Phi Eliminated (byte) loop::sin_idx#14
Self Phi Eliminated (byte*) YSIN#16
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) PLEX_SCREEN_PTR#31 (byte*) PLEX_SCREEN_PTR#44
Redundant Phi (byte) loop::sin_idx#14 (byte) loop::sin_idx#1
Redundant Phi (byte*) YSIN#16 (byte*) YSIN#4
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) plexSort::$5 [18] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) 255) goto plexSort::@8
Simple Condition (bool~) plexSort::$6 [94] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Self Phi Eliminated (byte*) YSIN#4
Self Phi Eliminated (byte*) PLEX_SCREEN_PTR#44
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) YSIN#4 (const byte*) YSIN#0
Redundant Phi (byte*) PLEX_SCREEN_PTR#44 (const byte*) PLEX_SCREEN_PTR#1
Successful SSA optimization Pass2RedundantPhiElimination
Inlining constant with var siblings (const byte) plexInit::i#0
Inlining constant with var siblings (const byte) plexSort::m#0
Inlining constant with var siblings (const byte) plexSort::plexFreePrepare1_s#0
Inlining constant with var siblings (const word) init::xp#0
Inlining constant with var siblings (const byte) init::sx#0
Inlining constant with var siblings (const byte) init::ss#0
Inlining constant with var siblings (const byte) loop::sin_idx#0
Inlining constant with var siblings (const byte) loop::sy#0
Inlining constant with var siblings (const byte) loop::ss#0
Inlining constant with var siblings (const byte) plex_show_idx#1
Inlining constant with var siblings (const byte) plex_sprite_idx#1
Inlining constant with var siblings (const byte) plex_sprite_msb#1
Inlining constant with var siblings (const byte) plex_free_next#0
Inlining constant with var siblings (const byte) plex_sprite_msb#4
Constant inlined init::xp#0 = (byte/signed byte/word/signed word/dword/signed dword) 32
Constant inlined plexInit::$1 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined plexSort::$0 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2
Constant inlined plexSort::plexFreePrepare1_s#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::ss#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plexInit::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plexSort::m#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::$3 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$1 = (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3
Constant inlined loop::sin_idx#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::$0 = (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0
Constant inlined plexInit::screen#0 = (const byte*) SCREEN#0
Constant inlined plex_sprite_msb#4 = (byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$5 = ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64
Constant inlined plex_show_idx#1 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_sprite_idx#1 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_sprite_msb#1 = (byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined init::$4 = (const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64
Constant inlined loop::$1 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined loop::sy#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined plex_free_next#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined loop::$6 = (const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1
Constant inlined loop::ss#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined init::sx#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting loop::@32(between loop::@7 and loop::@7)
Added new block during phi lifting loop::@33(between loop::@31 and loop::@11)
Added new block during phi lifting plexShowSprite::@8(between plexShowSprite::@2 and plexShowSprite::@return)
Added new block during phi lifting plexSort::@9(between plexSort::@2 and plexSort::@1)
Added new block during phi lifting plexSort::@10(between plexSort::@8 and plexSort::@3)
Added new block during phi lifting plexSort::@11(between plexSort::@1 and plexSort::@3)
Added new block during phi lifting plexSort::@12(between plexSort::plexFreePrepare1_@1 and plexSort::plexFreePrepare1_@1)
Added new block during phi lifting init::@6(between init::@1 and init::@1)
Added new block during phi lifting init::@7(between init::@2 and init::@2)
Added new block during phi lifting plexInit::@4(between plexInit::@1 and plexInit::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @15
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of loop
Adding NOP phi() at start of plexShowSprite::@6
Adding NOP phi() at start of plexSort
Adding NOP phi() at start of plexSort::plexFreePrepare1
Adding NOP phi() at start of plexInit
Adding NOP phi() at start of plexInit::plexSetScreen1
CALL GRAPH
Calls in [] to main:4 
Calls in [main] to init:7 loop:9 
Calls in [loop] to plexSort:23 plexShowSprite:32 
Calls in [init] to plexInit:94 

Created 16 initial phi equivalence classes
Not coalescing [15] loop::y_idx#3 ← loop::sin_idx#6
Coalesced [36] loop::sin_idx#22 ← loop::sin_idx#1
Coalesced [37] plex_free_next#50 ← plex_free_next#13
Coalesced [38] plex_sprite_idx#54 ← plex_sprite_idx#15
Coalesced [39] plex_show_idx#54 ← plex_show_idx#15
Coalesced [40] plex_sprite_msb#54 ← plex_sprite_msb#16
Coalesced [41] loop::ss#10 ← loop::ss#1
Coalesced [42] loop::y_idx#4 ← loop::y_idx#1
Coalesced [43] loop::sy#3 ← loop::sy#1
Coalesced [67] plex_sprite_msb#55 ← plex_sprite_msb#25
Not coalescing [74] plexSort::s#6 ← plexSort::m#2
Coalesced [89] plexSort::plexFreePrepare1_s#3 ← plexSort::plexFreePrepare1_s#1
Coalesced [90] plexSort::m#7 ← plexSort::m#1
Coalesced [92] plexSort::s#5 ← plexSort::s#1
Coalesced [108] init::ss#3 ← init::ss#1
Coalesced [109] init::sx#3 ← init::sx#1
Coalesced [110] init::xp#3 ← init::xp#1
Coalesced [118] plexInit::i#3 ← plexInit::i#1
Coalesced down to 15 phi equivalence classes
Culled Empty Block (label) loop::@33
Culled Empty Block (label) loop::@32
Culled Empty Block (label) plexShowSprite::@6
Culled Empty Block (label) plexSort::@12
Culled Empty Block (label) plexSort::@9
Culled Empty Block (label) plexSort::@10
Culled Empty Block (label) init::@7
Culled Empty Block (label) init::@6
Culled Empty Block (label) plexInit::@4
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @15
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of loop
Adding NOP phi() at start of plexShowSprite::@8
Adding NOP phi() at start of plexSort
Adding NOP phi() at start of plexSort::plexFreePrepare1
Adding NOP phi() at start of plexInit
Adding NOP phi() at start of plexInit::plexSetScreen1

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@12
@12: scope:[]  from @begin
  kickasm(location (const byte*) YSIN#0) {{ .var min = 50
    .var max = 250-21
    .var ampl = max-min;
    .for(var i=0;i<256;i++)
        .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
 }}
  kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)
 }}
  to:@15
@15: scope:[]  from @12
  [3] phi()
  [4] call main 
  to:@end
@end: scope:[]  from @15
  [5] phi()
main: scope:[main]  from @15
  asm { sei  }
  [7] call init 
  to:main::@1
main::@1: scope:[main]  from main
  [8] phi()
  [9] call loop 
  to:main::@return
main::@return: scope:[main]  from main::@1
  [10] return 
  to:@return
loop: scope:[loop]  from main::@1
  [11] phi()
  to:loop::@1
loop::@1: scope:[loop]  from loop loop::@27
  [12] (byte) loop::sin_idx#6 ← phi( loop/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@27/(byte) loop::sin_idx#1 )
  to:loop::@4
loop::@4: scope:[loop]  from loop::@1 loop::@4
  [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4
  to:loop::@6
loop::@6: scope:[loop]  from loop::@4
  [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
  [15] (byte~) loop::y_idx#3 ← (byte) loop::sin_idx#6
  to:loop::@7
loop::@7: scope:[loop]  from loop::@6 loop::@7
  [16] (byte) loop::sy#2 ← phi( loop::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@7/(byte) loop::sy#1 )
  [16] (byte) loop::y_idx#2 ← phi( loop::@6/(byte~) loop::y_idx#3 loop::@7/(byte) loop::y_idx#1 )
  [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2)
  [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8
  [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2
  [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7
  to:loop::@20
loop::@20: scope:[loop]  from loop::@7
  [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1
  [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
  [23] call plexSort 
  to:loop::@30
loop::@30: scope:[loop]  from loop::@20
  [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
  to:loop::@8
loop::@8: scope:[loop]  from loop::@30 loop::@8
  [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0
  [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@8
  to:loop::@11
loop::@11: scope:[loop]  from loop::@31 loop::@8
  [27] (byte) loop::ss#6 ← phi( loop::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@31/(byte) loop::ss#1 )
  [27] (byte) plex_sprite_msb#44 ← phi( loop::@8/(byte/signed byte/word/signed word/dword/signed dword) 1 loop::@31/(byte) plex_sprite_msb#16 )
  [27] (byte) plex_show_idx#44 ← phi( loop::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@31/(byte) plex_show_idx#15 )
  [27] (byte) plex_sprite_idx#44 ← phi( loop::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@31/(byte) plex_sprite_idx#15 )
  [27] (byte) plex_free_next#17 ← phi( loop::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 loop::@31/(byte) plex_free_next#13 )
  [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
  to:loop::plexFreeNextYpos1
loop::plexFreeNextYpos1: scope:[loop]  from loop::@11
  [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17)
  to:loop::@12
loop::@12: scope:[loop]  from loop::@12 loop::plexFreeNextYpos1
  [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@12
  to:loop::@14
loop::@14: scope:[loop]  from loop::@12
  [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0)
  [32] call plexShowSprite 
  to:loop::@31
loop::@31: scope:[loop]  from loop::@14
  [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6
  [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@11
  to:loop::@27
loop::@27: scope:[loop]  from loop::@31
  [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
  to:loop::@1
plexShowSprite: scope:[plexShowSprite]  from loop::@14
  [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1
  [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44))
  [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
  to:plexShowSprite::plexFreeAdd1
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite]  from plexShowSprite
  [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21
  [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0
  [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1
  [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7
  to:plexShowSprite::@7
plexShowSprite::@7: scope:[plexShowSprite]  from plexShowSprite::plexFreeAdd1
  [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44))
  [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1
  [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0)
  [46] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$3
  [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0)
  [48] if((byte~) plexShowSprite::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1
  to:plexShowSprite::@4
plexShowSprite::@4: scope:[plexShowSprite]  from plexShowSprite::@7
  [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44
  [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6
  to:plexShowSprite::@2
plexShowSprite::@2: scope:[plexShowSprite]  from plexShowSprite::@1 plexShowSprite::@4
  [51] (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1
  [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7
  [53] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44
  [54] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1
  [55] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@8
  to:plexShowSprite::@return
plexShowSprite::@return: scope:[plexShowSprite]  from plexShowSprite::@2 plexShowSprite::@8
  [56] (byte) plex_sprite_msb#16 ← phi( plexShowSprite::@8/(byte) plex_sprite_msb#25 plexShowSprite::@2/(byte/signed byte/word/signed word/dword/signed dword) 1 )
  [57] return 
  to:@return
plexShowSprite::@8: scope:[plexShowSprite]  from plexShowSprite::@2
  [58] phi()
  to:plexShowSprite::@return
plexShowSprite::@1: scope:[plexShowSprite]  from plexShowSprite::@7
  [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44
  to:plexShowSprite::@2
plexSort: scope:[plexSort]  from loop::@20
  [60] phi()
  to:plexSort::@1
plexSort::@1: scope:[plexSort]  from plexSort plexSort::@2
  [61] (byte) plexSort::m#2 ← phi( plexSort/(byte/signed byte/word/signed word/dword/signed dword) 0 plexSort::@2/(byte) plexSort::m#1 )
  [62] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2)
  [63] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0)
  [64] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2
  to:plexSort::@11
plexSort::@11: scope:[plexSort]  from plexSort::@1
  [65] (byte~) plexSort::s#6 ← (byte) plexSort::m#2
  to:plexSort::@3
plexSort::@3: scope:[plexSort]  from plexSort::@11 plexSort::@8
  [66] (byte) plexSort::s#3 ← phi( plexSort::@8/(byte) plexSort::s#1 plexSort::@11/(byte~) plexSort::s#6 )
  [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3)
  [68] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3
  [69] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) 255) goto plexSort::@8
  to:plexSort::@5
plexSort::@5: scope:[plexSort]  from plexSort::@3 plexSort::@8
  [70] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1
  [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0
  to:plexSort::@2
plexSort::@2: scope:[plexSort]  from plexSort::@1 plexSort::@5
  [72] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2
  [73] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1
  to:plexSort::plexFreePrepare1
plexSort::plexFreePrepare1: scope:[plexSort]  from plexSort::@2
  [74] phi()
  to:plexSort::plexFreePrepare1_@1
plexSort::plexFreePrepare1_@1: scope:[plexSort]  from plexSort::plexFreePrepare1 plexSort::plexFreePrepare1_@1
  [75] (byte) plexSort::plexFreePrepare1_s#2 ← phi( plexSort::plexFreePrepare1/(byte/signed byte/word/signed word/dword/signed dword) 0 plexSort::plexFreePrepare1_@1/(byte) plexSort::plexFreePrepare1_s#1 )
  [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0
  [77] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2
  [78] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1
  to:plexSort::@return
plexSort::@return: scope:[plexSort]  from plexSort::plexFreePrepare1_@1
  [79] return 
  to:@return
plexSort::@8: scope:[plexSort]  from plexSort::@3
  [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3
  to:plexSort::@5
init: scope:[init]  from main
  [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3
  [82] call plexInit 
  to:init::@1
init::@1: scope:[init]  from init init::@1
  [83] (word) init::xp#2 ← phi( init::@1/(word) init::xp#1 init/(byte/signed byte/word/signed word/dword/signed dword) 32 )
  [83] (byte) init::sx#2 ← phi( init::@1/(byte) init::sx#1 init/(byte/signed byte/word/signed word/dword/signed dword) 0 )
  [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64
  [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
  [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2
  [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9
  [88] (byte) init::sx#1 ← ++ (byte) init::sx#2
  [89] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1
  to:init::@3
init::@3: scope:[init]  from init::@1
  [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255
  to:init::@2
init::@2: scope:[init]  from init::@2 init::@3
  [91] (byte) init::ss#2 ← phi( init::@2/(byte) init::ss#1 init::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 )
  [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0
  [93] (byte) init::ss#1 ← ++ (byte) init::ss#2
  [94] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@2
  to:init::@return
init::@return: scope:[init]  from init::@2
  [95] return 
  to:@return
plexInit: scope:[plexInit]  from init
  [96] phi()
  to:plexInit::plexSetScreen1
plexInit::plexSetScreen1: scope:[plexInit]  from plexInit
  [97] phi()
  to:plexInit::@1
plexInit::@1: scope:[plexInit]  from plexInit::@1 plexInit::plexSetScreen1
  [98] (byte) plexInit::i#2 ← phi( plexInit::@1/(byte) plexInit::i#1 plexInit::plexSetScreen1/(byte/signed byte/word/signed word/dword/signed dword) 0 )
  [99] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2
  [100] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2
  [101] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1
  to:plexInit::@return
plexInit::@return: scope:[plexInit]  from plexInit::@1
  [102] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(byte*) BGCOL1
(byte*) BGCOL2
(byte*) BGCOL3
(byte*) BGCOL4
(byte) BLACK
(byte) BLUE
(byte*) BORDERCOL
(byte) BROWN
(byte*) CHARGEN
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(byte) CYAN
(byte*) D011
(byte*) D016
(byte*) D018
(byte) DARK_GREY
(byte) GREEN
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte) ORANGE
(byte) PINK
(byte) PLEX_COUNT
(byte[8]) PLEX_FREE_YPOS
(byte[PLEX_COUNT#0]) PLEX_PTR
(byte*) PLEX_SCREEN_PTR
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(word[PLEX_COUNT#0]) PLEX_XPOS
(byte[PLEX_COUNT#0]) PLEX_YPOS
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(byte) RED
(byte*) SCREEN
(byte*) SPRITE
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(byte) VIC_DEN
(byte) VIC_ECM
(byte) VIC_MCM
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(byte) VIC_RST8
(byte) WHITE
(byte) YELLOW
(byte*) YSIN
(void()) init()
(byte~) init::$6 22.0
(byte) init::ss
(byte) init::ss#1 16.5
(byte) init::ss#2 16.5
(byte) init::sx
(byte) init::sx#1 16.5
(byte) init::sx#2 8.8
(word) init::xp
(word) init::xp#1 7.333333333333333
(word) init::xp#2 8.25
(void()) loop()
(byte~) loop::$4 202.0
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0 551.0
(byte) loop::rasterY
(byte) loop::sin_idx
(byte) loop::sin_idx#1 1.4666666666666666
(byte) loop::sin_idx#6 3.666666666666667
(byte) loop::ss
(byte) loop::ss#1 151.5
(byte) loop::ss#6 33.666666666666664
(byte) loop::sy
(byte) loop::sy#1 151.5
(byte) loop::sy#2 101.0
(byte) loop::y_idx
(byte) loop::y_idx#1 67.33333333333333
(byte) loop::y_idx#2 157.0
(byte~) loop::y_idx#3 22.0
(void()) main()
(void()) plexInit((byte*) plexInit::screen)
(byte) plexInit::i
(byte) plexInit::i#1 16.5
(byte) plexInit::i#2 22.0
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::screen
(void()) plexShowSprite()
(byte~) plexShowSprite::$3 4.0
(byte~) plexShowSprite::$4 4.0
(byte/word/dword~) plexShowSprite::$6 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$7 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 4.0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 0.6000000000000001
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 2.0
(byte) plexShowSprite::ypos
(void()) plexSort()
(byte) plexSort::m
(byte) plexSort::m#1 151.5
(byte) plexSort::m#2 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 30.299999999999997
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0 150.375
(bool~) plexSort::plexFreePrepare1_$0
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#1 151.5
(byte) plexSort::plexFreePrepare1_s#2 151.5
(byte) plexSort::s
(byte) plexSort::s#1 1368.3333333333335
(byte) plexSort::s#2 202.0
(byte) plexSort::s#3 2052.5
(byte~) plexSort::s#6 202.0
(byte) plex_free_next
(byte) plex_free_next#13 4.904761904761904
(byte) plex_free_next#17 20.599999999999998
(byte) plex_show_idx
(byte) plex_show_idx#15 11.444444444444443
(byte) plex_show_idx#44 4.73913043478261
(byte) plex_sprite_idx
(byte) plex_sprite_idx#15 10.299999999999999
(byte) plex_sprite_idx#44 5.095238095238094
(byte) plex_sprite_msb
(byte) plex_sprite_msb#16 20.599999999999998
(byte) plex_sprite_msb#25 2.0
(byte) plex_sprite_msb#44 4.458333333333332

Initial phi equivalence classes
[ loop::sin_idx#6 loop::sin_idx#1 ]
[ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
[ loop::sy#2 loop::sy#1 ]
[ plex_free_next#17 plex_free_next#13 ]
[ plex_sprite_idx#44 plex_sprite_idx#15 ]
[ plex_show_idx#44 plex_show_idx#15 ]
[ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
[ loop::ss#6 loop::ss#1 ]
[ plexSort::m#2 plexSort::m#1 ]
[ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
[ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
[ init::sx#2 init::sx#1 ]
[ init::xp#2 init::xp#1 ]
[ init::ss#2 init::ss#1 ]
[ plexInit::i#2 plexInit::i#1 ]
Added variable loop::$4 to zero page equivalence class [ loop::$4 ]
Added variable loop::plexFreeNextYpos1_return#0 to zero page equivalence class [ loop::plexFreeNextYpos1_return#0 ]
Added variable plexShowSprite::plex_sprite_idx2#0 to zero page equivalence class [ plexShowSprite::plex_sprite_idx2#0 ]
Added variable plexShowSprite::plexFreeAdd1_ypos#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Added variable plexShowSprite::plexFreeAdd1_$0#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_$0#0 ]
Added variable plexShowSprite::plexFreeAdd1_$1#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_$1#0 ]
Added variable plexShowSprite::xpos_idx#0 to zero page equivalence class [ plexShowSprite::xpos_idx#0 ]
Added variable plexShowSprite::$3 to zero page equivalence class [ plexShowSprite::$3 ]
Added variable plexShowSprite::$4 to zero page equivalence class [ plexShowSprite::$4 ]
Added variable plexShowSprite::$6 to zero page equivalence class [ plexShowSprite::$6 ]
Added variable plexShowSprite::$7 to zero page equivalence class [ plexShowSprite::$7 ]
Added variable plexSort::nxt_idx#0 to zero page equivalence class [ plexSort::nxt_idx#0 ]
Added variable plexSort::nxt_y#0 to zero page equivalence class [ plexSort::nxt_y#0 ]
Added variable plexSort::s#2 to zero page equivalence class [ plexSort::s#2 ]
Added variable init::$6 to zero page equivalence class [ init::$6 ]
Complete equivalence classes
[ loop::sin_idx#6 loop::sin_idx#1 ]
[ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
[ loop::sy#2 loop::sy#1 ]
[ plex_free_next#17 plex_free_next#13 ]
[ plex_sprite_idx#44 plex_sprite_idx#15 ]
[ plex_show_idx#44 plex_show_idx#15 ]
[ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
[ loop::ss#6 loop::ss#1 ]
[ plexSort::m#2 plexSort::m#1 ]
[ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
[ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
[ init::sx#2 init::sx#1 ]
[ init::xp#2 init::xp#1 ]
[ init::ss#2 init::ss#1 ]
[ plexInit::i#2 plexInit::i#1 ]
[ loop::$4 ]
[ loop::plexFreeNextYpos1_return#0 ]
[ plexShowSprite::plex_sprite_idx2#0 ]
[ plexShowSprite::plexFreeAdd1_ypos#0 ]
[ plexShowSprite::plexFreeAdd1_$0#0 ]
[ plexShowSprite::plexFreeAdd1_$1#0 ]
[ plexShowSprite::xpos_idx#0 ]
[ plexShowSprite::$3 ]
[ plexShowSprite::$4 ]
[ plexShowSprite::$6 ]
[ plexShowSprite::$7 ]
[ plexSort::nxt_idx#0 ]
[ plexSort::nxt_y#0 ]
[ plexSort::s#2 ]
[ init::$6 ]
Allocated zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Allocated zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
Allocated zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Allocated zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Allocated zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Allocated zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Allocated zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Allocated zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Allocated zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Allocated zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Allocated zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Allocated zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ]
Allocated zp ZP_WORD:14 [ init::xp#2 init::xp#1 ]
Allocated zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ]
Allocated zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ]
Allocated zp ZP_BYTE:18 [ loop::$4 ]
Allocated zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ]
Allocated zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Allocated zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Allocated zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ]
Allocated zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ]
Allocated zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Allocated zp ZP_BYTE:25 [ plexShowSprite::$3 ]
Allocated zp ZP_BYTE:26 [ plexShowSprite::$4 ]
Allocated zp ZP_BYTE:27 [ plexShowSprite::$6 ]
Allocated zp ZP_BYTE:28 [ plexShowSprite::$7 ]
Allocated zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ]
Allocated zp ZP_BYTE:30 [ plexSort::nxt_y#0 ]
Allocated zp ZP_BYTE:31 [ plexSort::s#2 ]
Allocated zp ZP_BYTE:32 [ init::$6 ]

INITIAL ASM
//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SPRITES_XPOS = $d000
  .label SPRITES_YPOS = $d001
  .label SPRITES_XMSB = $d010
  .label RASTER = $d012
  .label SPRITES_ENABLE = $d015
  .label BORDERCOL = $d020
  .label SPRITES_COLS = $d027
  .label D011 = $d011
  .const VIC_RST8 = $80
  .const VIC_DEN = $10
  .const VIC_RSEL = 8
  // The colors of the C64
  .const BLACK = 0
  .const GREEN = 5
  // The number of sprites in the multiplexer
  .const PLEX_COUNT = $20
  // Location of screen & sprites
  .label SCREEN = $400
  .label SPRITE = $2000
  .label YSIN = $2100
  .label PLEX_SCREEN_PTR = SCREEN+$3f8
  .label plex_free_next = 5
  .label plex_sprite_idx = 6
  .label plex_show_idx = 7
  .label plex_sprite_msb = 8
//SEG3 @begin
bbegin:
  jmp b12
//SEG4 @12
b12:
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50     .var max = 250-21     .var ampl = max-min;     .for(var i=0;i<256;i++)         .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))  }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))     .for (var y=0; y<21; y++)         .for (var x=0;x<3; x++)             .byte pic.getSinglecolorByte(x,y)  }}
//SEG7 [3] phi from @12 to @15 [phi:@12->@15]
b15_from_b12:
  jmp b15
//SEG8 @15
b15:
//SEG9 [4] call main 
  jsr main
//SEG10 [5] phi from @15 to @end [phi:@15->@end]
bend_from_b15:
  jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
  //SEG13 asm { sei  }
    sei
  //SEG14 [7] call init 
    jsr init
  //SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG16 main::@1
  b1:
  //SEG17 [9] call loop 
  //SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
  loop_from_b1:
    jsr loop
    jmp breturn
  //SEG19 main::@return
  breturn:
  //SEG20 [10] return 
    rts
}
//SEG21 loop
// The raster loop
loop: {
    .label _4 = $12
    .label y_idx = 3
    .label sy = 4
    .label sin_idx = 2
    .label plexFreeNextYpos1_return = $13
    .label ss = 9
  //SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
  b1_from_loop:
  //SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta sin_idx
    jmp b1
  //SEG24 loop::@1
  b1:
    jmp b4
  //SEG25 loop::@4
  b4:
  //SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b4
    jmp b6
  //SEG27 loop::@6
  b6:
  //SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG29 [15] (byte~) loop::y_idx#3 ← (byte) loop::sin_idx#6 -- vbuz1=vbuz2 
    lda sin_idx
    sta y_idx
  //SEG30 [16] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
  b7_from_b6:
  //SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuz1=vbuc1 
    lda #0
    sta sy
  //SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#3 [phi:loop::@6->loop::@7#1] -- register_copy 
    jmp b7
  //SEG33 [16] phi from loop::@7 to loop::@7 [phi:loop::@7->loop::@7]
  b7_from_b7:
  //SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@7->loop::@7#0] -- register_copy 
  //SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@7->loop::@7#1] -- register_copy 
    jmp b7
  //SEG36 loop::@7
  b7:
  //SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy y_idx
    lda YSIN,y
    ldy sy
    sta PLEX_YPOS,y
  //SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuz1_plus_vbuc1 
    lda #8
    clc
    adc y_idx
    sta y_idx
  //SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuz1=_inc_vbuz1 
    inc sy
  //SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuz1_neq_vbuc1_then_la1 
    lda sy
    cmp #PLEX_COUNT-1+1
    bne b7_from_b7
    jmp b20
  //SEG41 loop::@20
  b20:
  //SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 
    inc sin_idx
  //SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG44 [23] call plexSort 
  //SEG45 [60] phi from loop::@20 to plexSort [phi:loop::@20->plexSort]
  plexSort_from_b20:
    jsr plexSort
    jmp b30
  //SEG46 loop::@30
  b30:
  //SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
    jmp b8
  //SEG48 loop::@8
  b8:
  //SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuz1=_deref_pbuc1_band_vbuc2 
    lda D011
    and #VIC_RST8
    sta _4
  //SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@8 -- vbuz1_neq_0_then_la1 
    lda _4
    cmp #0
    bne b8
  //SEG51 [27] phi from loop::@8 to loop::@11 [phi:loop::@8->loop::@11]
  b11_from_b8:
  //SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#0] -- vbuz1=vbuc1 
    lda #0
    sta ss
  //SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@8->loop::@11#1] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
  //SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#2] -- vbuz1=vbuc1 
    lda #0
    sta plex_show_idx
  //SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#3] -- vbuz1=vbuc1 
    lda #0
    sta plex_sprite_idx
  //SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#4] -- vbuz1=vbuc1 
    lda #0
    sta plex_free_next
    jmp b11
  // Show the sprites
  //SEG57 [27] phi from loop::@31 to loop::@11 [phi:loop::@31->loop::@11]
  b11_from_b31:
  //SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@31->loop::@11#0] -- register_copy 
  //SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@31->loop::@11#1] -- register_copy 
  //SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@31->loop::@11#2] -- register_copy 
  //SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@31->loop::@11#3] -- register_copy 
  //SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@31->loop::@11#4] -- register_copy 
    jmp b11
  //SEG63 loop::@11
  b11:
  //SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
    jmp plexFreeNextYpos1
  //SEG65 loop::plexFreeNextYpos1
  plexFreeNextYpos1:
  //SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy plex_free_next
    lda PLEX_FREE_YPOS,y
    sta plexFreeNextYpos1_return
    jmp b12
  //SEG67 loop::@12
  b12:
  //SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@12 -- _deref_pbuc1_lt_vbuz1_then_la1 
    lda RASTER
    cmp plexFreeNextYpos1_return
    bcc b12
    jmp b14
  //SEG69 loop::@14
  b14:
  //SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG71 [32] call plexShowSprite 
    jsr plexShowSprite
    jmp b31
  //SEG72 loop::@31
  b31:
  //SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1 
    inc ss
  //SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@11 -- vbuz1_neq_vbuc1_then_la1 
    lda ss
    cmp #PLEX_COUNT-1+1
    bne b11_from_b31
    jmp b27
  //SEG75 loop::@27
  b27:
  //SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
  //SEG77 [12] phi from loop::@27 to loop::@1 [phi:loop::@27->loop::@1]
  b1_from_b27:
  //SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@27->loop::@1#0] -- register_copy 
    jmp b1
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
    .label _3 = $19
    .label _4 = $1a
    .label _6 = $1b
    .label _7 = $1c
    .label plex_sprite_idx2 = $14
    .label plexFreeAdd1_ypos = $15
    .label plexFreeAdd1__0 = $16
    .label plexFreeAdd1__1 = $17
    .label xpos_idx = $18
  //SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 
    lda plex_sprite_idx
    asl
    sta plex_sprite_idx2
  //SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuz1=pbuc1_derefidx_pbuc2_derefidx_vbuz2 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    tay
    lda PLEX_YPOS,y
    sta plexFreeAdd1_ypos
  //SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda plexFreeAdd1_ypos
    ldy plex_sprite_idx2
    sta SPRITES_YPOS,y
    jmp plexFreeAdd1
  //SEG83 plexShowSprite::plexFreeAdd1
  plexFreeAdd1:
  //SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 
    lda #$15
    clc
    adc plexFreeAdd1_ypos
    sta plexFreeAdd1__0
  //SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda plexFreeAdd1__0
    ldy plex_free_next
    sta PLEX_FREE_YPOS,y
  //SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_plus_1 
    ldy plex_free_next
    iny
    sty plexFreeAdd1__1
  //SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1 
    lda #7
    and plexFreeAdd1__1
    sta plex_free_next
    jmp b7
  //SEG88 plexShowSprite::@7
  b7:
  //SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_pbuc3_derefidx_vbuz2 
    ldx plex_show_idx
    lda PLEX_SORTED_IDX,x
    tax
    lda PLEX_PTR,x
    ldx plex_sprite_idx
    sta PLEX_SCREEN_PTR,x
  //SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=pbuc1_derefidx_vbuz2_rol_1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    asl
    sta xpos_idx
  //SEG91 [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuz1=_lo_pwuc1_derefidx_vbuz2 
    ldy xpos_idx
    lda PLEX_XPOS,y
    sta _3
  //SEG92 [46] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$3 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda _3
    ldy plex_sprite_idx2
    sta SPRITES_XPOS,y
  //SEG93 [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuz1=_hi_pwuc1_derefidx_vbuz2 
    ldy xpos_idx
    lda PLEX_XPOS+1,y
    sta _4
  //SEG94 [48] if((byte~) plexShowSprite::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuz1_neq_0_then_la1 
    lda _4
    cmp #0
    bne b1
    jmp b4
  //SEG95 plexShowSprite::@4
  b4:
  //SEG96 [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44 -- vbuz1=vbuc1_bxor_vbuz2 
    lda plex_sprite_msb
    eor #$ff
    sta _6
  //SEG97 [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6 -- _deref_pbuc1=_deref_pbuc1_band_vbuz1 
    lda SPRITES_XMSB
    and _6
    sta SPRITES_XMSB
    jmp b2
  //SEG98 plexShowSprite::@2
  b2:
  //SEG99 [51] (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_plus_1 
    ldy plex_sprite_idx
    iny
    sty _7
  //SEG100 [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1 
    lda #7
    and _7
    sta plex_sprite_idx
  //SEG101 [53] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1 
    inc plex_show_idx
  //SEG102 [54] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1 
    asl plex_sprite_msb
  //SEG103 [55] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@8 -- vbuz1_neq_0_then_la1 
    lda plex_sprite_msb
    cmp #0
    bne b8_from_b2
  //SEG104 [56] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
  breturn_from_b2:
  //SEG105 [56] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
    jmp breturn
  //SEG106 plexShowSprite::@return
  breturn:
  //SEG107 [57] return 
    rts
  //SEG108 [58] phi from plexShowSprite::@2 to plexShowSprite::@8 [phi:plexShowSprite::@2->plexShowSprite::@8]
  b8_from_b2:
    jmp b8
  //SEG109 plexShowSprite::@8
  b8:
  //SEG110 [56] phi from plexShowSprite::@8 to plexShowSprite::@return [phi:plexShowSprite::@8->plexShowSprite::@return]
  breturn_from_b8:
  //SEG111 [56] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@8->plexShowSprite::@return#0] -- register_copy 
    jmp breturn
  //SEG112 plexShowSprite::@1
  b1:
  //SEG113 [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1 
    lda SPRITES_XMSB
    ora plex_sprite_msb
    sta SPRITES_XMSB
    jmp b2
}
//SEG114 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
//     the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
//     elements before the marker are shifted right one at a time until encountering one smaller than the current one.
//      It is then inserted at the spot. Now the marker can move forward.
plexSort: {
    .label nxt_idx = $1d
    .label nxt_y = $1e
    .label m = $a
    .label s = $b
    .label s_2 = $1f
    .label plexFreePrepare1_s = $c
  //SEG115 [61] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
  b1_from_plexSort:
  //SEG116 [61] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta m
    jmp b1
  //SEG117 [61] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
  b1_from_b2:
  //SEG118 [61] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy 
    jmp b1
  //SEG119 plexSort::@1
  b1:
  //SEG120 [62] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy m
    lda PLEX_SORTED_IDX+1,y
    sta nxt_idx
  //SEG121 [63] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy nxt_idx
    lda PLEX_YPOS,y
    sta nxt_y
  //SEG122 [64] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1 
    lda nxt_y
    ldx m
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcs b2
    jmp b11
  //SEG123 plexSort::@11
  b11:
  //SEG124 [65] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuz1=vbuz2 
    lda m
    sta s
  //SEG125 [66] phi from plexSort::@11 plexSort::@8 to plexSort::@3 [phi:plexSort::@11/plexSort::@8->plexSort::@3]
  b3_from_b11:
  b3_from_b8:
  //SEG126 [66] phi (byte) plexSort::s#3 = (byte~) plexSort::s#6 [phi:plexSort::@11/plexSort::@8->plexSort::@3#0] -- register_copy 
    jmp b3
  //SEG127 plexSort::@3
  b3:
  //SEG128 [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1 
    ldy s
    lda PLEX_SORTED_IDX,y
    sta PLEX_SORTED_IDX+1,y
  //SEG129 [68] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuz1=_dec_vbuz1 
    dec s
  //SEG130 [69] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) 255) goto plexSort::@8 -- vbuz1_neq_vbuc1_then_la1 
    lda s
    cmp #$ff
    bne b8
    jmp b5
  //SEG131 plexSort::@5
  b5:
  //SEG132 [70] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuz1=_inc_vbuz2 
    ldy s
    iny
    sty s_2
  //SEG133 [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda nxt_idx
    ldy s_2
    sta PLEX_SORTED_IDX,y
    jmp b2
  //SEG134 plexSort::@2
  b2:
  //SEG135 [72] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1 
    inc m
  //SEG136 [73] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda m
    cmp #PLEX_COUNT-2+1
    bne b1_from_b2
  //SEG137 [74] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
  plexFreePrepare1_from_b2:
    jmp plexFreePrepare1
  //SEG138 plexSort::plexFreePrepare1
  plexFreePrepare1:
  //SEG139 [75] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
  plexFreePrepare1_b1_from_plexFreePrepare1:
  //SEG140 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuz1=vbuc1 
    lda #0
    sta plexFreePrepare1_s
    jmp plexFreePrepare1_b1
  //SEG141 [75] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
  plexFreePrepare1_b1_from_plexFreePrepare1_b1:
  //SEG142 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy 
    jmp plexFreePrepare1_b1
  //SEG143 plexSort::plexFreePrepare1_@1
  plexFreePrepare1_b1:
  //SEG144 [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy plexFreePrepare1_s
    lda #0
    sta PLEX_FREE_YPOS,y
  //SEG145 [77] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuz1=_inc_vbuz1 
    inc plexFreePrepare1_s
  //SEG146 [78] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuz1_neq_vbuc1_then_la1 
    lda plexFreePrepare1_s
    cmp #8
    bne plexFreePrepare1_b1_from_plexFreePrepare1_b1
    jmp breturn
  //SEG147 plexSort::@return
  breturn:
  //SEG148 [79] return 
    rts
  //SEG149 plexSort::@8
  b8:
  //SEG150 [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1 
    lda nxt_y
    ldx s
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcc b3_from_b8
    jmp b5
}
//SEG151 init
// Initialize the program
init: {
    .label _6 = $20
    .label xp = $e
    .label sx = $d
    .label ss = $10
  //SEG152 [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #VIC_DEN|VIC_RSEL|3
    sta D011
  //SEG153 [82] call plexInit 
  //SEG154 [96] phi from init to plexInit [phi:init->plexInit]
  plexInit_from_init:
    jsr plexInit
  //SEG155 [83] phi from init to init::@1 [phi:init->init::@1]
  b1_from_init:
  //SEG156 [83] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:init->init::@1#0] -- vwuz1=vbuc1 
    lda #<$20
    sta xp
    lda #>$20
    sta xp+1
  //SEG157 [83] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta sx
    jmp b1
  //SEG158 [83] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
  b1_from_b1:
  //SEG159 [83] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy 
  //SEG160 [83] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy 
    jmp b1
  //SEG161 init::@1
  b1:
  //SEG162 [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy sx
    lda #$ff&SPRITE/$40
    sta PLEX_PTR,y
  //SEG163 [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 
    lda sx
    asl
    sta _6
  //SEG164 [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2 -- pwuc1_derefidx_vbuz1=vwuz2 
    ldy _6
    lda xp
    sta PLEX_XPOS,y
    lda xp+1
    sta PLEX_XPOS+1,y
  //SEG165 [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1 
    clc
    lda xp
    adc #<9
    sta xp
    lda xp+1
    adc #>9
    sta xp+1
  //SEG166 [88] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuz1=_inc_vbuz1 
    inc sx
  //SEG167 [89] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda sx
    cmp #PLEX_COUNT-1+1
    bne b1_from_b1
    jmp b3
  //SEG168 init::@3
  b3:
  //SEG169 [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255 -- _deref_pbuc1=vbuc2 
    // Enable & initialize sprites
    lda #$ff
    sta SPRITES_ENABLE
  //SEG170 [91] phi from init::@3 to init::@2 [phi:init::@3->init::@2]
  b2_from_b3:
  //SEG171 [91] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@3->init::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta ss
    jmp b2
  //SEG172 [91] phi from init::@2 to init::@2 [phi:init::@2->init::@2]
  b2_from_b2:
  //SEG173 [91] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@2->init::@2#0] -- register_copy 
    jmp b2
  //SEG174 init::@2
  b2:
  //SEG175 [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy ss
    lda #GREEN
    sta SPRITES_COLS,y
  //SEG176 [93] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuz1=_inc_vbuz1 
    inc ss
  //SEG177 [94] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda ss
    cmp #8
    bne b2_from_b2
    jmp breturn
  //SEG178 init::@return
  breturn:
  //SEG179 [95] return 
    rts
}
//SEG180 plexInit
// Initialize the multiplexer data structures
plexInit: {
    .label i = $11
  //SEG181 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
  plexSetScreen1_from_plexInit:
    jmp plexSetScreen1
  //SEG182 plexInit::plexSetScreen1
  plexSetScreen1:
  //SEG183 [98] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
  b1_from_plexSetScreen1:
  //SEG184 [98] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
  //SEG185 [98] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
  b1_from_b1:
  //SEG186 [98] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy 
    jmp b1
  //SEG187 plexInit::@1
  b1:
  //SEG188 [99] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuz1=vbuz1 
    ldy i
    tya
    sta PLEX_SORTED_IDX,y
  //SEG189 [100] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG190 [101] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda i
    cmp #PLEX_COUNT-1+1
    bne b1_from_b1
    jmp breturn
  //SEG191 plexInit::@return
  breturn:
  //SEG192 [102] return 
    rts
}
  // Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
  PLEX_FREE_YPOS: .fill 8, 0
  // The x-positions of the multiplexer sprites ($000-$1ff)
  PLEX_XPOS: .fill 2*PLEX_COUNT, 0
  // The y-positions of the multiplexer sprites.
  PLEX_YPOS: .fill PLEX_COUNT, 0
  // The sprite pointers for the multiplexed sprites
  PLEX_PTR: .fill PLEX_COUNT, 0
  // Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
  PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
  .var min = 50
    .var max = 250-21
    .var ampl = max-min;
    .for(var i=0;i<256;i++)
        .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))

.pc = SPRITE "SPRITE"
  .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)


REGISTER UPLIFT POTENTIAL REGISTERS
Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4 [ loop::sin_idx#6 ] ( main:4::loop:9 [ loop::sin_idx#6 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Statement [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Statement [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ) always clobbers reg byte a 
Statement [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a 
Statement [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 [ loop::sin_idx#1 loop::$4 ] ( main:4::loop:9 [ loop::sin_idx#1 loop::$4 ] ) always clobbers reg byte a 
Statement [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ( main:4::loop:9 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Statement [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a 
Statement [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Statement [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_$0#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_$0#0 ] ) always clobbers reg byte a 
Statement [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ) always clobbers reg byte a 
Statement [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Statement [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$4 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$4 ] ) always clobbers reg byte a 
Statement [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$6 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$6 ] ) always clobbers reg byte a 
Statement [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a 
Statement [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plex_sprite_idx#15 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plex_sprite_idx#15 ] ) always clobbers reg byte a 
Statement [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a 
Statement [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:30 [ plexSort::nxt_y#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Statement [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 [ plexSort::m#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 ] ) always clobbers reg byte a 
Statement [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ plexSort::plexFreePrepare1_s#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::plexFreePrepare1_s#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Statement [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ) always clobbers reg byte a 
Statement [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a 
Statement [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ]
Statement [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init::sx#2 init::xp#2 init::$6 ] ( main:4::init:7 [ init::sx#2 init::xp#2 init::$6 ] ) always clobbers reg byte a 
Statement [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a 
Statement [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 [ init::sx#2 init::xp#1 ] ( main:4::init:7 [ init::sx#2 init::xp#1 ] ) always clobbers reg byte a 
Statement [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a 
Statement [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 [ init::ss#2 ] ( main:4::init:7 [ init::ss#2 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ]
Statement [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4 [ loop::sin_idx#6 ] ( main:4::loop:9 [ loop::sin_idx#6 ] ) always clobbers reg byte a 
Statement [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ) always clobbers reg byte a 
Statement [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ) always clobbers reg byte a 
Statement [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a 
Statement [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 [ loop::sin_idx#1 loop::$4 ] ( main:4::loop:9 [ loop::sin_idx#1 loop::$4 ] ) always clobbers reg byte a 
Statement [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ( main:4::loop:9 [ loop::sin_idx#1 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 loop::ss#6 ] ) always clobbers reg byte a 
Statement [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ loop::sin_idx#1 ] ( main:4::loop:9 [ loop::sin_idx#1 ] ) always clobbers reg byte a 
Statement [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ) always clobbers reg byte a 
Statement [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_$0#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_free_next#17 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_$0#0 ] ) always clobbers reg byte a 
Statement [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a 
Statement [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ) always clobbers reg byte a 
Statement [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ) always clobbers reg byte a 
Statement [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$4 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$4 ] ) always clobbers reg byte a 
Statement [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$6 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plexShowSprite::$6 ] ) always clobbers reg byte a 
Statement [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a 
Statement [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plex_sprite_idx#15 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 plex_sprite_idx#15 ] ) always clobbers reg byte a 
Statement [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 [ plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ( main:4::loop:9::plexShowSprite:32 [ loop::sin_idx#1 loop::ss#6 plex_sprite_idx#44 plex_show_idx#44 plex_sprite_msb#44 plex_free_next#13 ] ) always clobbers reg byte a 
Statement [64] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 ] ) always clobbers reg byte a 
Statement [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ) always clobbers reg byte a 
Statement [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 [ plexSort::m#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 ] ) always clobbers reg byte a 
Statement [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ plexSort::plexFreePrepare1_s#2 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::plexFreePrepare1_s#2 ] ) always clobbers reg byte a 
Statement [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ( main:4::loop:9::plexSort:23 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ) always clobbers reg byte a 
Statement [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a 
Statement [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a 
Statement [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init::sx#2 init::xp#2 init::$6 ] ( main:4::init:7 [ init::sx#2 init::xp#2 init::$6 ] ) always clobbers reg byte a 
Statement [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2 [ init::sx#2 init::xp#2 ] ( main:4::init:7 [ init::sx#2 init::xp#2 ] ) always clobbers reg byte a 
Statement [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 [ init::sx#2 init::xp#1 ] ( main:4::init:7 [ init::sx#2 init::xp#1 ] ) always clobbers reg byte a 
Statement [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255 [ ] ( main:4::init:7 [ ] ) always clobbers reg byte a 
Statement [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 [ init::ss#2 ] ( main:4::init:7 [ init::ss#2 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] : zp ZP_BYTE:7 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] : zp ZP_BYTE:8 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] : zp ZP_BYTE:10 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] : zp ZP_BYTE:11 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] : zp ZP_BYTE:12 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ] : zp ZP_BYTE:13 , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:14 [ init::xp#2 init::xp#1 ] : zp ZP_WORD:14 , 
Potential registers zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ] : zp ZP_BYTE:16 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:18 [ loop::$4 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] : zp ZP_BYTE:19 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] : zp ZP_BYTE:20 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ] : zp ZP_BYTE:22 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] : zp ZP_BYTE:24 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:25 [ plexShowSprite::$3 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:26 [ plexShowSprite::$4 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:27 [ plexShowSprite::$6 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:28 [ plexShowSprite::$7 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ] : zp ZP_BYTE:29 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:30 [ plexSort::nxt_y#0 ] : zp ZP_BYTE:30 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:31 [ plexSort::s#2 ] : zp ZP_BYTE:31 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:32 [ init::$6 ] : zp ZP_BYTE:32 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [plexSort] 3,622.83: zp ZP_BYTE:11 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] 303: zp ZP_BYTE:12 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] 202: zp ZP_BYTE:31 [ plexSort::s#2 ] 193.58: zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] 150.38: zp ZP_BYTE:30 [ plexSort::nxt_y#0 ] 30.3: zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ] 
Uplift Scope [loop] 551: zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] 252.5: zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] 246.33: zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ] 202: zp ZP_BYTE:18 [ loop::$4 ] 185.17: zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] 5.13: zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] 
Uplift Scope [init] 33: zp ZP_BYTE:16 [ init::ss#2 init::ss#1 ] 25.3: zp ZP_BYTE:13 [ init::sx#2 init::sx#1 ] 22: zp ZP_BYTE:32 [ init::$6 ] 15.58: zp ZP_WORD:14 [ init::xp#2 init::xp#1 ] 
Uplift Scope [] 27.06: zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] 25.5: zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] 16.18: zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] 15.4: zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ] 
Uplift Scope [plexInit] 38.5: zp ZP_BYTE:17 [ plexInit::i#2 plexInit::i#1 ] 
Uplift Scope [plexShowSprite] 4: zp ZP_BYTE:22 [ plexShowSprite::plexFreeAdd1_$0#0 ] 4: zp ZP_BYTE:23 [ plexShowSprite::plexFreeAdd1_$1#0 ] 4: zp ZP_BYTE:25 [ plexShowSprite::$3 ] 4: zp ZP_BYTE:26 [ plexShowSprite::$4 ] 4: zp ZP_BYTE:27 [ plexShowSprite::$6 ] 4: zp ZP_BYTE:28 [ plexShowSprite::$7 ] 3: zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] 2: zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] 0.6: zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] 
Uplift Scope [main] 

Uplifting [plexSort] best 82589 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] zp ZP_BYTE:31 [ plexSort::s#2 ] zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] zp ZP_BYTE:30 [ plexSort::nxt_y#0 ] zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ] 
Limited combination testing to 10 combinations of 972 possible.
Uplifting [loop] best 81389 combination zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] reg byte x [ loop::sy#2 loop::sy#1 ] zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ] zp ZP_BYTE:18 [ loop::$4 ] zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] 
Limited combination testing to 10 combinations of 1296 possible.
Uplifting [init] best 81139 combination reg byte x [ init::ss#2 init::ss#1 ] reg byte x [ init::sx#2 init::sx#1 ] zp ZP_BYTE:32 [ init::$6 ] zp ZP_WORD:14 [ init::xp#2 init::xp#1 ] 
Limited combination testing to 10 combinations of 36 possible.
Uplifting [] best 81139 combination zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] zp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ] 
Limited combination testing to 10 combinations of 81 possible.
Uplifting [plexInit] best 81019 combination reg byte x [ plexInit::i#2 plexInit::i#1 ] 
Uplifting [plexShowSprite] best 81009 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ] reg byte a [ plexShowSprite::plexFreeAdd1_$1#0 ] zp ZP_BYTE:25 [ plexShowSprite::$3 ] zp ZP_BYTE:26 [ plexShowSprite::$4 ] zp ZP_BYTE:27 [ plexShowSprite::$6 ] zp ZP_BYTE:28 [ plexShowSprite::$7 ] zp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] 
Limited combination testing to 10 combinations of 147456 possible.
Uplifting [main] best 81009 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ]
Uplifting [loop] best 81009 combination zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
Uplifting [loop] best 80479 combination reg byte y [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:18 [ loop::$4 ]
Uplifting [loop] best 79879 combination reg byte a [ loop::$4 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:31 [ plexSort::s#2 ]
Uplifting [plexSort] best 79279 combination reg byte x [ plexSort::s#2 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ]
Uplifting [plexSort] best 79279 combination zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ]
Uplifting [loop] best 79279 combination zp ZP_BYTE:9 [ loop::ss#6 loop::ss#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:30 [ plexSort::nxt_y#0 ]
Uplifting [plexSort] best 79279 combination zp ZP_BYTE:30 [ plexSort::nxt_y#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ plexSort::nxt_idx#0 ]
Uplifting [plexSort] best 79279 combination zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ]
Uplifting [] best 79279 combination zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ]
Uplifting [] best 79279 combination zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:32 [ init::$6 ]
Uplifting [init] best 79239 combination reg byte a [ init::$6 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ]
Uplifting [] best 79239 combination zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ plex_sprite_idx#44 plex_sprite_idx#15 ]
Uplifting [] best 78931 combination reg byte x [ plex_sprite_idx#44 plex_sprite_idx#15 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplifting [loop] best 78931 combination zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:25 [ plexShowSprite::$3 ]
Uplifting [plexShowSprite] best 78925 combination reg byte a [ plexShowSprite::$3 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:26 [ plexShowSprite::$4 ]
Uplifting [plexShowSprite] best 78919 combination reg byte a [ plexShowSprite::$4 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:27 [ plexShowSprite::$6 ]
Uplifting [plexShowSprite] best 78913 combination reg byte a [ plexShowSprite::$6 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:28 [ plexShowSprite::$7 ]
Uplifting [plexShowSprite] best 78909 combination reg byte x [ plexShowSprite::$7 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:21 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Uplifting [plexShowSprite] best 78900 combination reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ]
Uplifting [plexShowSprite] best 78900 combination zp ZP_BYTE:24 [ plexShowSprite::xpos_idx#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplifting [plexShowSprite] best 78900 combination zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] 
Coalescing zero page register [ zp ZP_BYTE:5 [ plex_free_next#17 plex_free_next#13 ] ] with [ zp ZP_BYTE:10 [ plexSort::m#2 plexSort::m#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:7 [ plex_show_idx#44 plex_show_idx#15 ] ] with [ zp ZP_BYTE:29 [ plexSort::nxt_idx#0 ] ]
Coalescing zero page register [ zp ZP_BYTE:8 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 ] ] with [ zp ZP_BYTE:30 [ plexSort::nxt_y#0 ] ]
Coalescing zero page register [ zp ZP_BYTE:19 [ loop::plexFreeNextYpos1_return#0 ] ] with [ zp ZP_BYTE:20 [ plexShowSprite::plex_sprite_idx2#0 ] ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ plex_free_next#17 plex_free_next#13 plexSort::m#2 plexSort::m#1 ]
Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:4 [ plex_show_idx#44 plex_show_idx#15 plexSort::nxt_idx#0 ]
Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:5 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 plexSort::nxt_y#0 ]
Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:6 [ loop::ss#6 loop::ss#1 ]
Allocated (was zp ZP_WORD:14) zp ZP_WORD:7 [ init::xp#2 init::xp#1 ]
Allocated (was zp ZP_BYTE:19) zp ZP_BYTE:9 [ loop::plexFreeNextYpos1_return#0 plexShowSprite::plex_sprite_idx2#0 ]
Allocated (was zp ZP_BYTE:24) zp ZP_BYTE:10 [ plexShowSprite::xpos_idx#0 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SPRITES_XPOS = $d000
  .label SPRITES_YPOS = $d001
  .label SPRITES_XMSB = $d010
  .label RASTER = $d012
  .label SPRITES_ENABLE = $d015
  .label BORDERCOL = $d020
  .label SPRITES_COLS = $d027
  .label D011 = $d011
  .const VIC_RST8 = $80
  .const VIC_DEN = $10
  .const VIC_RSEL = 8
  // The colors of the C64
  .const BLACK = 0
  .const GREEN = 5
  // The number of sprites in the multiplexer
  .const PLEX_COUNT = $20
  // Location of screen & sprites
  .label SCREEN = $400
  .label SPRITE = $2000
  .label YSIN = $2100
  .label PLEX_SCREEN_PTR = SCREEN+$3f8
  .label plex_free_next = 3
  .label plex_show_idx = 4
  .label plex_sprite_msb = 5
//SEG3 @begin
bbegin:
  jmp b12
//SEG4 @12
b12:
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50     .var max = 250-21     .var ampl = max-min;     .for(var i=0;i<256;i++)         .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))  }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))     .for (var y=0; y<21; y++)         .for (var x=0;x<3; x++)             .byte pic.getSinglecolorByte(x,y)  }}
//SEG7 [3] phi from @12 to @15 [phi:@12->@15]
b15_from_b12:
  jmp b15
//SEG8 @15
b15:
//SEG9 [4] call main 
  jsr main
//SEG10 [5] phi from @15 to @end [phi:@15->@end]
bend_from_b15:
  jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
  //SEG13 asm { sei  }
    sei
  //SEG14 [7] call init 
    jsr init
  //SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG16 main::@1
  b1:
  //SEG17 [9] call loop 
  //SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
  loop_from_b1:
    jsr loop
    jmp breturn
  //SEG19 main::@return
  breturn:
  //SEG20 [10] return 
    rts
}
//SEG21 loop
// The raster loop
loop: {
    .label sin_idx = 2
    .label plexFreeNextYpos1_return = 9
    .label ss = 6
  //SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
  b1_from_loop:
  //SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta sin_idx
    jmp b1
  //SEG24 loop::@1
  b1:
    jmp b4
  //SEG25 loop::@4
  b4:
  //SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b4
    jmp b6
  //SEG27 loop::@6
  b6:
  //SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG29 [15] (byte~) loop::y_idx#3 ← (byte) loop::sin_idx#6 -- vbuyy=vbuz1 
    ldy sin_idx
  //SEG30 [16] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
  b7_from_b6:
  //SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#3 [phi:loop::@6->loop::@7#1] -- register_copy 
    jmp b7
  //SEG33 [16] phi from loop::@7 to loop::@7 [phi:loop::@7->loop::@7]
  b7_from_b7:
  //SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@7->loop::@7#0] -- register_copy 
  //SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@7->loop::@7#1] -- register_copy 
    jmp b7
  //SEG36 loop::@7
  b7:
  //SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda YSIN,y
    sta PLEX_YPOS,x
  //SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuyy=vbuyy_plus_vbuc1 
    tya
    clc
    adc #8
    tay
  //SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b7_from_b7
    jmp b20
  //SEG41 loop::@20
  b20:
  //SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 
    inc sin_idx
  //SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG44 [23] call plexSort 
  //SEG45 [60] phi from loop::@20 to plexSort [phi:loop::@20->plexSort]
  plexSort_from_b20:
    jsr plexSort
    jmp b30
  //SEG46 loop::@30
  b30:
  //SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
    jmp b8
  //SEG48 loop::@8
  b8:
  //SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda D011
    and #VIC_RST8
  //SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@8 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne b8
  //SEG51 [27] phi from loop::@8 to loop::@11 [phi:loop::@8->loop::@11]
  b11_from_b8:
  //SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#0] -- vbuz1=vbuc1 
    lda #0
    sta ss
  //SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@8->loop::@11#1] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
  //SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#2] -- vbuz1=vbuc1 
    lda #0
    sta plex_show_idx
  //SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#3] -- vbuxx=vbuc1 
    ldx #0
  //SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#4] -- vbuz1=vbuc1 
    lda #0
    sta plex_free_next
    jmp b11
  // Show the sprites
  //SEG57 [27] phi from loop::@31 to loop::@11 [phi:loop::@31->loop::@11]
  b11_from_b31:
  //SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@31->loop::@11#0] -- register_copy 
  //SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@31->loop::@11#1] -- register_copy 
  //SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@31->loop::@11#2] -- register_copy 
  //SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@31->loop::@11#3] -- register_copy 
  //SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@31->loop::@11#4] -- register_copy 
    jmp b11
  //SEG63 loop::@11
  b11:
  //SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
    jmp plexFreeNextYpos1
  //SEG65 loop::plexFreeNextYpos1
  plexFreeNextYpos1:
  //SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy plex_free_next
    lda PLEX_FREE_YPOS,y
    sta plexFreeNextYpos1_return
    jmp b12
  //SEG67 loop::@12
  b12:
  //SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@12 -- _deref_pbuc1_lt_vbuz1_then_la1 
    lda RASTER
    cmp plexFreeNextYpos1_return
    bcc b12
    jmp b14
  //SEG69 loop::@14
  b14:
  //SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG71 [32] call plexShowSprite 
    jsr plexShowSprite
    jmp b31
  //SEG72 loop::@31
  b31:
  //SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1 
    inc ss
  //SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@11 -- vbuz1_neq_vbuc1_then_la1 
    lda ss
    cmp #PLEX_COUNT-1+1
    bne b11_from_b31
    jmp b27
  //SEG75 loop::@27
  b27:
  //SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
  //SEG77 [12] phi from loop::@27 to loop::@1 [phi:loop::@27->loop::@1]
  b1_from_b27:
  //SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@27->loop::@1#0] -- register_copy 
    jmp b1
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
    .label plex_sprite_idx2 = 9
    .label xpos_idx = $a
  //SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuxx_rol_1 
    txa
    asl
    sta plex_sprite_idx2
  //SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuaa=pbuc1_derefidx_pbuc2_derefidx_vbuz1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    tay
    lda PLEX_YPOS,y
  //SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_sprite_idx2
    sta SPRITES_YPOS,y
    jmp plexFreeAdd1
  //SEG83 plexShowSprite::plexFreeAdd1
  plexFreeAdd1:
  //SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuaa=vbuaa_plus_vbuc1 
    clc
    adc #$15
  //SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_free_next
    sta PLEX_FREE_YPOS,y
  //SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuz1_plus_1 
    lda plex_free_next
    clc
    adc #1
  //SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuaa_band_vbuc1 
    and #7
    sta plex_free_next
    jmp b7
  //SEG88 plexShowSprite::@7
  b7:
  //SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_pbuc3_derefidx_vbuz1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    tay
    lda PLEX_PTR,y
    sta PLEX_SCREEN_PTR,x
  //SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=pbuc1_derefidx_vbuz2_rol_1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    asl
    sta xpos_idx
  //SEG91 [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuaa=_lo_pwuc1_derefidx_vbuz1 
    ldy xpos_idx
    lda PLEX_XPOS,y
  //SEG92 [46] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$3 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_sprite_idx2
    sta SPRITES_XPOS,y
  //SEG93 [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuaa=_hi_pwuc1_derefidx_vbuz1 
    ldy xpos_idx
    lda PLEX_XPOS+1,y
  //SEG94 [48] if((byte~) plexShowSprite::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne b1
    jmp b4
  //SEG95 plexShowSprite::@4
  b4:
  //SEG96 [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44 -- vbuaa=vbuc1_bxor_vbuz1 
    lda plex_sprite_msb
    eor #$ff
  //SEG97 [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6 -- _deref_pbuc1=_deref_pbuc1_band_vbuaa 
    and SPRITES_XMSB
    sta SPRITES_XMSB
    jmp b2
  //SEG98 plexShowSprite::@2
  b2:
  //SEG99 [51] (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1 
    inx
  //SEG100 [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuxx=vbuxx_band_vbuc1 
    txa
    and #7
    tax
  //SEG101 [53] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1 
    inc plex_show_idx
  //SEG102 [54] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1 
    asl plex_sprite_msb
  //SEG103 [55] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@8 -- vbuz1_neq_0_then_la1 
    lda plex_sprite_msb
    cmp #0
    bne b8_from_b2
  //SEG104 [56] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
  breturn_from_b2:
  //SEG105 [56] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
    jmp breturn
  //SEG106 plexShowSprite::@return
  breturn:
  //SEG107 [57] return 
    rts
  //SEG108 [58] phi from plexShowSprite::@2 to plexShowSprite::@8 [phi:plexShowSprite::@2->plexShowSprite::@8]
  b8_from_b2:
    jmp b8
  //SEG109 plexShowSprite::@8
  b8:
  //SEG110 [56] phi from plexShowSprite::@8 to plexShowSprite::@return [phi:plexShowSprite::@8->plexShowSprite::@return]
  breturn_from_b8:
  //SEG111 [56] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@8->plexShowSprite::@return#0] -- register_copy 
    jmp breturn
  //SEG112 plexShowSprite::@1
  b1:
  //SEG113 [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1 
    lda SPRITES_XMSB
    ora plex_sprite_msb
    sta SPRITES_XMSB
    jmp b2
}
//SEG114 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
//     the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
//     elements before the marker are shifted right one at a time until encountering one smaller than the current one.
//      It is then inserted at the spot. Now the marker can move forward.
plexSort: {
    .label nxt_idx = 4
    .label nxt_y = 5
    .label m = 3
  //SEG115 [61] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
  b1_from_plexSort:
  //SEG116 [61] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta m
    jmp b1
  //SEG117 [61] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
  b1_from_b2:
  //SEG118 [61] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy 
    jmp b1
  //SEG119 plexSort::@1
  b1:
  //SEG120 [62] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy m
    lda PLEX_SORTED_IDX+1,y
    sta nxt_idx
  //SEG121 [63] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy nxt_idx
    lda PLEX_YPOS,y
    sta nxt_y
  //SEG122 [64] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1 
    lda nxt_y
    ldx m
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcs b2
    jmp b11
  //SEG123 plexSort::@11
  b11:
  //SEG124 [65] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuxx=vbuz1 
    ldx m
  //SEG125 [66] phi from plexSort::@11 plexSort::@8 to plexSort::@3 [phi:plexSort::@11/plexSort::@8->plexSort::@3]
  b3_from_b11:
  b3_from_b8:
  //SEG126 [66] phi (byte) plexSort::s#3 = (byte~) plexSort::s#6 [phi:plexSort::@11/plexSort::@8->plexSort::@3#0] -- register_copy 
    jmp b3
  //SEG127 plexSort::@3
  b3:
  //SEG128 [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda PLEX_SORTED_IDX,x
    sta PLEX_SORTED_IDX+1,x
  //SEG129 [68] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuxx=_dec_vbuxx 
    dex
  //SEG130 [69] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) 255) goto plexSort::@8 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne b8
    jmp b5
  //SEG131 plexSort::@5
  b5:
  //SEG132 [70] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuxx=_inc_vbuxx 
    inx
  //SEG133 [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuxx=vbuz1 
    lda nxt_idx
    sta PLEX_SORTED_IDX,x
    jmp b2
  //SEG134 plexSort::@2
  b2:
  //SEG135 [72] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1 
    inc m
  //SEG136 [73] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda m
    cmp #PLEX_COUNT-2+1
    bne b1_from_b2
  //SEG137 [74] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
  plexFreePrepare1_from_b2:
    jmp plexFreePrepare1
  //SEG138 plexSort::plexFreePrepare1
  plexFreePrepare1:
  //SEG139 [75] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
  plexFreePrepare1_b1_from_plexFreePrepare1:
  //SEG140 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp plexFreePrepare1_b1
  //SEG141 [75] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
  plexFreePrepare1_b1_from_plexFreePrepare1_b1:
  //SEG142 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy 
    jmp plexFreePrepare1_b1
  //SEG143 plexSort::plexFreePrepare1_@1
  plexFreePrepare1_b1:
  //SEG144 [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta PLEX_FREE_YPOS,x
  //SEG145 [77] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG146 [78] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne plexFreePrepare1_b1_from_plexFreePrepare1_b1
    jmp breturn
  //SEG147 plexSort::@return
  breturn:
  //SEG148 [79] return 
    rts
  //SEG149 plexSort::@8
  b8:
  //SEG150 [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuxx_then_la1 
    lda nxt_y
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcc b3_from_b8
    jmp b5
}
//SEG151 init
// Initialize the program
init: {
    .label xp = 7
  //SEG152 [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #VIC_DEN|VIC_RSEL|3
    sta D011
  //SEG153 [82] call plexInit 
  //SEG154 [96] phi from init to plexInit [phi:init->plexInit]
  plexInit_from_init:
    jsr plexInit
  //SEG155 [83] phi from init to init::@1 [phi:init->init::@1]
  b1_from_init:
  //SEG156 [83] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:init->init::@1#0] -- vwuz1=vbuc1 
    lda #<$20
    sta xp
    lda #>$20
    sta xp+1
  //SEG157 [83] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
  //SEG158 [83] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
  b1_from_b1:
  //SEG159 [83] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy 
  //SEG160 [83] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy 
    jmp b1
  //SEG161 init::@1
  b1:
  //SEG162 [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #$ff&SPRITE/$40
    sta PLEX_PTR,x
  //SEG163 [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
  //SEG164 [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2 -- pwuc1_derefidx_vbuaa=vwuz1 
    tay
    lda xp
    sta PLEX_XPOS,y
    lda xp+1
    sta PLEX_XPOS+1,y
  //SEG165 [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1 
    clc
    lda xp
    adc #<9
    sta xp
    lda xp+1
    adc #>9
    sta xp+1
  //SEG166 [88] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG167 [89] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b1_from_b1
    jmp b3
  //SEG168 init::@3
  b3:
  //SEG169 [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255 -- _deref_pbuc1=vbuc2 
    // Enable & initialize sprites
    lda #$ff
    sta SPRITES_ENABLE
  //SEG170 [91] phi from init::@3 to init::@2 [phi:init::@3->init::@2]
  b2_from_b3:
  //SEG171 [91] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@3->init::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b2
  //SEG172 [91] phi from init::@2 to init::@2 [phi:init::@2->init::@2]
  b2_from_b2:
  //SEG173 [91] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@2->init::@2#0] -- register_copy 
    jmp b2
  //SEG174 init::@2
  b2:
  //SEG175 [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #GREEN
    sta SPRITES_COLS,x
  //SEG176 [93] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG177 [94] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne b2_from_b2
    jmp breturn
  //SEG178 init::@return
  breturn:
  //SEG179 [95] return 
    rts
}
//SEG180 plexInit
// Initialize the multiplexer data structures
plexInit: {
  //SEG181 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
  plexSetScreen1_from_plexInit:
    jmp plexSetScreen1
  //SEG182 plexInit::plexSetScreen1
  plexSetScreen1:
  //SEG183 [98] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
  b1_from_plexSetScreen1:
  //SEG184 [98] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
  //SEG185 [98] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
  b1_from_b1:
  //SEG186 [98] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy 
    jmp b1
  //SEG187 plexInit::@1
  b1:
  //SEG188 [99] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta PLEX_SORTED_IDX,x
  //SEG189 [100] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG190 [101] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b1_from_b1
    jmp breturn
  //SEG191 plexInit::@return
  breturn:
  //SEG192 [102] return 
    rts
}
  // Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
  PLEX_FREE_YPOS: .fill 8, 0
  // The x-positions of the multiplexer sprites ($000-$1ff)
  PLEX_XPOS: .fill 2*PLEX_COUNT, 0
  // The y-positions of the multiplexer sprites.
  PLEX_YPOS: .fill PLEX_COUNT, 0
  // The sprite pointers for the multiplexed sprites
  PLEX_PTR: .fill PLEX_COUNT, 0
  // Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
  PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
  .var min = 50
    .var max = 250-21
    .var ampl = max-min;
    .for(var i=0;i<256;i++)
        .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))

.pc = SPRITE "SPRITE"
  .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)


ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b12
Removing instruction jmp b15
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp b4
Removing instruction jmp b6
Removing instruction jmp b7
Removing instruction jmp b20
Removing instruction jmp b30
Removing instruction jmp b8
Removing instruction jmp b11
Removing instruction jmp plexFreeNextYpos1
Removing instruction jmp b12
Removing instruction jmp b14
Removing instruction jmp b31
Removing instruction jmp b27
Removing instruction jmp plexFreeAdd1
Removing instruction jmp b7
Removing instruction jmp b4
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp b8
Removing instruction jmp b1
Removing instruction jmp b11
Removing instruction jmp b3
Removing instruction jmp b5
Removing instruction jmp b2
Removing instruction jmp plexFreePrepare1
Removing instruction jmp plexFreePrepare1_b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp plexSetScreen1
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction ldx #0 with TAX
Removing instruction lda #0
Replacing instruction lda plex_free_next with TYA
Replacing instruction ldy xpos_idx with TAY
Replacing instruction ldy nxt_idx with TAY
Removing instruction lda nxt_y
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b7_from_b7 with b7
Replacing label b11_from_b31 with b11
Replacing label b1 with b4
Replacing label b8_from_b2 with b8
Replacing label b1_from_b2 with b1
Replacing label plexFreePrepare1_b1_from_plexFreePrepare1_b1 with plexFreePrepare1_b1
Replacing label b3_from_b8 with b3
Replacing label b1_from_b1 with b1
Replacing label b2_from_b2 with b2
Replacing label b1_from_b1 with b1
Removing instruction b12:
Removing instruction b15_from_b12:
Removing instruction b15:
Removing instruction bend_from_b15:
Removing instruction b1_from_main:
Removing instruction loop_from_b1:
Removing instruction b1:
Removing instruction b7_from_b7:
Removing instruction b11_from_b31:
Removing instruction b8_from_b2:
Removing instruction breturn_from_b8:
Removing instruction b1_from_b2:
Removing instruction b3_from_b11:
Removing instruction b3_from_b8:
Removing instruction plexFreePrepare1_from_b2:
Removing instruction plexFreePrepare1_b1_from_plexFreePrepare1:
Removing instruction plexFreePrepare1_b1_from_plexFreePrepare1_b1:
Removing instruction b1_from_b1:
Removing instruction b2_from_b2:
Removing instruction plexSetScreen1_from_plexInit:
Removing instruction b1_from_plexSetScreen1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_loop:
Removing instruction b6:
Removing instruction b7_from_b6:
Removing instruction b20:
Removing instruction plexSort_from_b20:
Removing instruction b30:
Removing instruction b11_from_b8:
Removing instruction plexFreeNextYpos1:
Removing instruction b14:
Removing instruction b31:
Removing instruction b27:
Removing instruction b1_from_b27:
Removing instruction plexFreeAdd1:
Removing instruction b7:
Removing instruction b4:
Removing instruction breturn_from_b2:
Removing instruction b1_from_plexSort:
Removing instruction b11:
Removing instruction plexFreePrepare1:
Removing instruction breturn:
Removing instruction plexInit_from_init:
Removing instruction b1_from_init:
Removing instruction b3:
Removing instruction b2_from_b3:
Removing instruction breturn:
Removing instruction plexSetScreen1:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Skipping double jump to breturn in bne b8
Succesful ASM optimization Pass5DoubleJumpElimination
Removing instruction jmp b7
Removing instruction jmp b11
Removing instruction jmp b1
Removing instruction jmp plexFreePrepare1_b1
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldx m
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction bbegin:
Removing instruction b8:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction jmp breturn
Succesful ASM optimization Pass5UnreachableCodeElimination

FINAL SYMBOL TABLE
(label) @12
(label) @15
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL1
(byte*) BGCOL2
(byte*) BGCOL3
(byte*) BGCOL4
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) BLUE
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280
(byte) BROWN
(byte*) CHARGEN
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(byte) CYAN
(byte*) D011
(const byte*) D011#0 D011 = ((byte*))(word/dword/signed dword) 53265
(byte*) D016
(byte*) D018
(byte) DARK_GREY
(byte) GREEN
(const byte) GREEN#0 GREEN = (byte/signed byte/word/signed word/dword/signed dword) 5
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte) ORANGE
(byte) PINK
(byte) PLEX_COUNT
(const byte) PLEX_COUNT#0 PLEX_COUNT = (byte/signed byte/word/signed word/dword/signed dword) 32
(byte[8]) PLEX_FREE_YPOS
(const byte[8]) PLEX_FREE_YPOS#0 PLEX_FREE_YPOS = { fill( 8, 0) }
(byte[PLEX_COUNT#0]) PLEX_PTR
(const byte[PLEX_COUNT#0]) PLEX_PTR#0 PLEX_PTR = { fill( PLEX_COUNT#0, 0) }
(byte*) PLEX_SCREEN_PTR
(const byte*) PLEX_SCREEN_PTR#1 PLEX_SCREEN_PTR = (const byte*) SCREEN#0+(word/signed word/dword/signed dword) 1016
(byte[PLEX_COUNT#0]) PLEX_SORTED_IDX
(const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 PLEX_SORTED_IDX = { fill( PLEX_COUNT#0, 0) }
(word[PLEX_COUNT#0]) PLEX_XPOS
(const word[PLEX_COUNT#0]) PLEX_XPOS#0 PLEX_XPOS = { fill( PLEX_COUNT#0, 0) }
(byte[PLEX_COUNT#0]) PLEX_YPOS
(const byte[PLEX_COUNT#0]) PLEX_YPOS#0 PLEX_YPOS = { fill( PLEX_COUNT#0, 0) }
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266
(byte) RED
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte*) SPRITE
(const byte*) SPRITE#0 SPRITE = ((byte*))(word/signed word/dword/signed dword) 8192
(byte*) SPRITES_COLS
(const byte*) SPRITES_COLS#0 SPRITES_COLS = ((byte*))(word/dword/signed dword) 53287
(byte*) SPRITES_ENABLE
(const byte*) SPRITES_ENABLE#0 SPRITES_ENABLE = ((byte*))(word/dword/signed dword) 53269
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(const byte*) SPRITES_XMSB#0 SPRITES_XMSB = ((byte*))(word/dword/signed dword) 53264
(byte*) SPRITES_XPOS
(const byte*) SPRITES_XPOS#0 SPRITES_XPOS = ((byte*))(word/dword/signed dword) 53248
(byte*) SPRITES_YPOS
(const byte*) SPRITES_YPOS#0 SPRITES_YPOS = ((byte*))(word/dword/signed dword) 53249
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(byte) VIC_DEN
(const byte) VIC_DEN#0 VIC_DEN = (byte/signed byte/word/signed word/dword/signed dword) 16
(byte) VIC_ECM
(byte) VIC_MCM
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(const byte) VIC_RSEL#0 VIC_RSEL = (byte/signed byte/word/signed word/dword/signed dword) 8
(byte) VIC_RST8
(const byte) VIC_RST8#0 VIC_RST8 = (byte/word/signed word/dword/signed dword) 128
(byte) WHITE
(byte) YELLOW
(byte*) YSIN
(const byte*) YSIN#0 YSIN = ((byte*))(word/signed word/dword/signed dword) 8448
(void()) init()
(byte~) init::$6 reg byte a 22.0
(label) init::@1
(label) init::@2
(label) init::@3
(label) init::@return
(byte) init::ss
(byte) init::ss#1 reg byte x 16.5
(byte) init::ss#2 reg byte x 16.5
(byte) init::sx
(byte) init::sx#1 reg byte x 16.5
(byte) init::sx#2 reg byte x 8.8
(word) init::xp
(word) init::xp#1 xp zp ZP_WORD:7 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:7 8.25
(void()) loop()
(byte~) loop::$4 reg byte a 202.0
(label) loop::@1
(label) loop::@11
(label) loop::@12
(label) loop::@14
(label) loop::@20
(label) loop::@27
(label) loop::@30
(label) loop::@31
(label) loop::@4
(label) loop::@6
(label) loop::@7
(label) loop::@8
(label) loop::plexFreeNextYpos1
(byte) loop::plexFreeNextYpos1_return
(byte) loop::plexFreeNextYpos1_return#0 plexFreeNextYpos1_return zp ZP_BYTE:9 551.0
(byte) loop::rasterY
(byte) loop::sin_idx
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:2 1.4666666666666666
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:2 3.666666666666667
(byte) loop::ss
(byte) loop::ss#1 ss zp ZP_BYTE:6 151.5
(byte) loop::ss#6 ss zp ZP_BYTE:6 33.666666666666664
(byte) loop::sy
(byte) loop::sy#1 reg byte x 151.5
(byte) loop::sy#2 reg byte x 101.0
(byte) loop::y_idx
(byte) loop::y_idx#1 reg byte y 67.33333333333333
(byte) loop::y_idx#2 reg byte y 157.0
(byte~) loop::y_idx#3 reg byte y 22.0
(void()) main()
(label) main::@1
(label) main::@return
(void()) plexInit((byte*) plexInit::screen)
(label) plexInit::@1
(label) plexInit::@return
(byte) plexInit::i
(byte) plexInit::i#1 reg byte x 16.5
(byte) plexInit::i#2 reg byte x 22.0
(label) plexInit::plexSetScreen1
(byte*~) plexInit::plexSetScreen1_$0
(byte*) plexInit::plexSetScreen1_screen
(byte*) plexInit::screen
(void()) plexShowSprite()
(byte~) plexShowSprite::$3 reg byte a 4.0
(byte~) plexShowSprite::$4 reg byte a 4.0
(byte/word/dword~) plexShowSprite::$6 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$7 reg byte x 4.0
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@4
(label) plexShowSprite::@7
(label) plexShowSprite::@8
(label) plexShowSprite::@return
(label) plexShowSprite::plexFreeAdd1
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$0
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::plexFreeAdd1_$1
(byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 reg byte a 4.0
(byte/word/dword~) plexShowSprite::plexFreeAdd1_$2
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 reg byte a 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:9 0.6000000000000001
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 xpos_idx zp ZP_BYTE:10 2.0
(byte) plexShowSprite::ypos
(void()) plexSort()
(label) plexSort::@1
(label) plexSort::@11
(label) plexSort::@2
(label) plexSort::@3
(label) plexSort::@5
(label) plexSort::@8
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#1 m zp ZP_BYTE:3 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:3 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 nxt_idx zp ZP_BYTE:4 30.299999999999997
(byte) plexSort::nxt_y
(byte) plexSort::nxt_y#0 nxt_y zp ZP_BYTE:5 150.375
(label) plexSort::plexFreePrepare1
(bool~) plexSort::plexFreePrepare1_$0
(label) plexSort::plexFreePrepare1_@1
(byte) plexSort::plexFreePrepare1_s
(byte) plexSort::plexFreePrepare1_s#1 reg byte x 151.5
(byte) plexSort::plexFreePrepare1_s#2 reg byte x 151.5
(byte) plexSort::s
(byte) plexSort::s#1 reg byte x 1368.3333333333335
(byte) plexSort::s#2 reg byte x 202.0
(byte) plexSort::s#3 reg byte x 2052.5
(byte~) plexSort::s#6 reg byte x 202.0
(byte) plex_free_next
(byte) plex_free_next#13 plex_free_next zp ZP_BYTE:3 4.904761904761904
(byte) plex_free_next#17 plex_free_next zp ZP_BYTE:3 20.599999999999998
(byte) plex_show_idx
(byte) plex_show_idx#15 plex_show_idx zp ZP_BYTE:4 11.444444444444443
(byte) plex_show_idx#44 plex_show_idx zp ZP_BYTE:4 4.73913043478261
(byte) plex_sprite_idx
(byte) plex_sprite_idx#15 reg byte x 10.299999999999999
(byte) plex_sprite_idx#44 reg byte x 5.095238095238094
(byte) plex_sprite_msb
(byte) plex_sprite_msb#16 plex_sprite_msb zp ZP_BYTE:5 20.599999999999998
(byte) plex_sprite_msb#25 plex_sprite_msb zp ZP_BYTE:5 2.0
(byte) plex_sprite_msb#44 plex_sprite_msb zp ZP_BYTE:5 4.458333333333332

zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
reg byte y [ loop::y_idx#2 loop::y_idx#3 loop::y_idx#1 ]
reg byte x [ loop::sy#2 loop::sy#1 ]
zp ZP_BYTE:3 [ plex_free_next#17 plex_free_next#13 plexSort::m#2 plexSort::m#1 ]
reg byte x [ plex_sprite_idx#44 plex_sprite_idx#15 ]
zp ZP_BYTE:4 [ plex_show_idx#44 plex_show_idx#15 plexSort::nxt_idx#0 ]
zp ZP_BYTE:5 [ plex_sprite_msb#44 plex_sprite_msb#16 plex_sprite_msb#25 plexSort::nxt_y#0 ]
zp ZP_BYTE:6 [ loop::ss#6 loop::ss#1 ]
reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
reg byte x [ init::sx#2 init::sx#1 ]
zp ZP_WORD:7 [ init::xp#2 init::xp#1 ]
reg byte x [ init::ss#2 init::ss#1 ]
reg byte x [ plexInit::i#2 plexInit::i#1 ]
reg byte a [ loop::$4 ]
zp ZP_BYTE:9 [ loop::plexFreeNextYpos1_return#0 plexShowSprite::plex_sprite_idx2#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$1#0 ]
zp ZP_BYTE:10 [ plexShowSprite::xpos_idx#0 ]
reg byte a [ plexShowSprite::$3 ]
reg byte a [ plexShowSprite::$4 ]
reg byte a [ plexShowSprite::$6 ]
reg byte x [ plexShowSprite::$7 ]
reg byte x [ plexSort::s#2 ]
reg byte a [ init::$6 ]


FINAL ASSEMBLER
Score: 63460

//SEG0 File Comments
// A simple usage of the flexible sprite multiplexer routine
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SPRITES_XPOS = $d000
  .label SPRITES_YPOS = $d001
  .label SPRITES_XMSB = $d010
  .label RASTER = $d012
  .label SPRITES_ENABLE = $d015
  .label BORDERCOL = $d020
  .label SPRITES_COLS = $d027
  .label D011 = $d011
  .const VIC_RST8 = $80
  .const VIC_DEN = $10
  .const VIC_RSEL = 8
  // The colors of the C64
  .const BLACK = 0
  .const GREEN = 5
  // The number of sprites in the multiplexer
  .const PLEX_COUNT = $20
  // Location of screen & sprites
  .label SCREEN = $400
  .label SPRITE = $2000
  .label YSIN = $2100
  .label PLEX_SCREEN_PTR = SCREEN+$3f8
  .label plex_free_next = 3
  .label plex_show_idx = 4
  .label plex_sprite_msb = 5
//SEG3 @begin
//SEG4 @12
//SEG5 kickasm(location (const byte*) YSIN#0) {{ .var min = 50     .var max = 250-21     .var ampl = max-min;     .for(var i=0;i<256;i++)         .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))  }}
//SEG6 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))     .for (var y=0; y<21; y++)         .for (var x=0;x<3; x++)             .byte pic.getSinglecolorByte(x,y)  }}
//SEG7 [3] phi from @12 to @15 [phi:@12->@15]
//SEG8 @15
//SEG9 [4] call main 
//SEG10 [5] phi from @15 to @end [phi:@15->@end]
//SEG11 @end
//SEG12 main
main: {
  //SEG13 asm { sei  }
    sei
  //SEG14 [7] call init 
    jsr init
  //SEG15 [8] phi from main to main::@1 [phi:main->main::@1]
  //SEG16 main::@1
  //SEG17 [9] call loop 
  //SEG18 [11] phi from main::@1 to loop [phi:main::@1->loop]
    jsr loop
  //SEG19 main::@return
  //SEG20 [10] return 
    rts
}
//SEG21 loop
// The raster loop
loop: {
    .label sin_idx = 2
    .label plexFreeNextYpos1_return = 9
    .label ss = 6
  //SEG22 [12] phi from loop to loop::@1 [phi:loop->loop::@1]
  //SEG23 [12] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta sin_idx
  //SEG24 loop::@1
  //SEG25 loop::@4
  b4:
  //SEG26 [13] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto loop::@4 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda RASTER
    cmp #$ff
    bne b4
  //SEG27 loop::@6
  //SEG28 [14] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG29 [15] (byte~) loop::y_idx#3 ← (byte) loop::sin_idx#6 -- vbuyy=vbuz1 
    ldy sin_idx
  //SEG30 [16] phi from loop::@6 to loop::@7 [phi:loop::@6->loop::@7]
  //SEG31 [16] phi (byte) loop::sy#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@6->loop::@7#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG32 [16] phi (byte) loop::y_idx#2 = (byte~) loop::y_idx#3 [phi:loop::@6->loop::@7#1] -- register_copy 
  //SEG33 [16] phi from loop::@7 to loop::@7 [phi:loop::@7->loop::@7]
  //SEG34 [16] phi (byte) loop::sy#2 = (byte) loop::sy#1 [phi:loop::@7->loop::@7#0] -- register_copy 
  //SEG35 [16] phi (byte) loop::y_idx#2 = (byte) loop::y_idx#1 [phi:loop::@7->loop::@7#1] -- register_copy 
  //SEG36 loop::@7
  b7:
  //SEG37 [17] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda YSIN,y
    sta PLEX_YPOS,x
  //SEG38 [18] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuyy=vbuyy_plus_vbuc1 
    tya
    clc
    adc #8
    tay
  //SEG39 [19] (byte) loop::sy#1 ← ++ (byte) loop::sy#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG40 [20] if((byte) loop::sy#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@7 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b7
  //SEG41 loop::@20
  //SEG42 [21] (byte) loop::sin_idx#1 ← (byte) loop::sin_idx#6 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 
    inc sin_idx
  //SEG43 [22] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG44 [23] call plexSort 
  //SEG45 [60] phi from loop::@20 to plexSort [phi:loop::@20->plexSort]
    jsr plexSort
  //SEG46 loop::@30
  //SEG47 [24] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
  //SEG48 loop::@8
  b8:
  //SEG49 [25] (byte~) loop::$4 ← *((const byte*) D011#0) & (const byte) VIC_RST8#0 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda D011
    and #VIC_RST8
  //SEG50 [26] if((byte~) loop::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto loop::@8 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne b8
  //SEG51 [27] phi from loop::@8 to loop::@11 [phi:loop::@8->loop::@11]
  //SEG52 [27] phi (byte) loop::ss#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#0] -- vbuz1=vbuc1 
    lda #0
    sta ss
  //SEG53 [27] phi (byte) plex_sprite_msb#44 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:loop::@8->loop::@11#1] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
  //SEG54 [27] phi (byte) plex_show_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#2] -- vbuz1=vbuc1 
    lda #0
    sta plex_show_idx
  //SEG55 [27] phi (byte) plex_sprite_idx#44 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#3] -- vbuxx=vbuc1 
    tax
  //SEG56 [27] phi (byte) plex_free_next#17 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop::@8->loop::@11#4] -- vbuz1=vbuc1 
    sta plex_free_next
  // Show the sprites
  //SEG57 [27] phi from loop::@31 to loop::@11 [phi:loop::@31->loop::@11]
  //SEG58 [27] phi (byte) loop::ss#6 = (byte) loop::ss#1 [phi:loop::@31->loop::@11#0] -- register_copy 
  //SEG59 [27] phi (byte) plex_sprite_msb#44 = (byte) plex_sprite_msb#16 [phi:loop::@31->loop::@11#1] -- register_copy 
  //SEG60 [27] phi (byte) plex_show_idx#44 = (byte) plex_show_idx#15 [phi:loop::@31->loop::@11#2] -- register_copy 
  //SEG61 [27] phi (byte) plex_sprite_idx#44 = (byte) plex_sprite_idx#15 [phi:loop::@31->loop::@11#3] -- register_copy 
  //SEG62 [27] phi (byte) plex_free_next#17 = (byte) plex_free_next#13 [phi:loop::@31->loop::@11#4] -- register_copy 
  //SEG63 loop::@11
  b11:
  //SEG64 [28] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
  //SEG65 loop::plexFreeNextYpos1
  //SEG66 [29] (byte) loop::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy plex_free_next
    lda PLEX_FREE_YPOS,y
    sta plexFreeNextYpos1_return
  //SEG67 loop::@12
  b12:
  //SEG68 [30] if(*((const byte*) RASTER#0)<(byte) loop::plexFreeNextYpos1_return#0) goto loop::@12 -- _deref_pbuc1_lt_vbuz1_then_la1 
    lda RASTER
    cmp plexFreeNextYpos1_return
    bcc b12
  //SEG69 loop::@14
  //SEG70 [31] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BORDERCOL
  //SEG71 [32] call plexShowSprite 
    jsr plexShowSprite
  //SEG72 loop::@31
  //SEG73 [33] (byte) loop::ss#1 ← ++ (byte) loop::ss#6 -- vbuz1=_inc_vbuz1 
    inc ss
  //SEG74 [34] if((byte) loop::ss#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto loop::@11 -- vbuz1_neq_vbuc1_then_la1 
    lda ss
    cmp #PLEX_COUNT-1+1
    bne b11
  //SEG75 loop::@27
  //SEG76 [35] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 
    lda #BLACK
    sta BORDERCOL
  //SEG77 [12] phi from loop::@27 to loop::@1 [phi:loop::@27->loop::@1]
  //SEG78 [12] phi (byte) loop::sin_idx#6 = (byte) loop::sin_idx#1 [phi:loop::@27->loop::@1#0] -- register_copy 
    jmp b4
}
//SEG79 plexShowSprite
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
    .label plex_sprite_idx2 = 9
    .label xpos_idx = $a
  //SEG80 [36] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuxx_rol_1 
    txa
    asl
    sta plex_sprite_idx2
  //SEG81 [37] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- vbuaa=pbuc1_derefidx_pbuc2_derefidx_vbuz1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    tay
    lda PLEX_YPOS,y
  //SEG82 [38] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_sprite_idx2
    sta SPRITES_YPOS,y
  //SEG83 plexShowSprite::plexFreeAdd1
  //SEG84 [39] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuaa=vbuaa_plus_vbuc1 
    clc
    adc #$15
  //SEG85 [40] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#17) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_free_next
    sta PLEX_FREE_YPOS,y
  //SEG86 [41] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#17 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuz1_plus_1 
    tya
    clc
    adc #1
  //SEG87 [42] (byte) plex_free_next#13 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuaa_band_vbuc1 
    and #7
    sta plex_free_next
  //SEG88 plexShowSprite::@7
  //SEG89 [43] *((const byte*) PLEX_SCREEN_PTR#1 + (byte) plex_sprite_idx#44) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44)) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_pbuc3_derefidx_vbuz1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    tay
    lda PLEX_PTR,y
    sta PLEX_SCREEN_PTR,x
  //SEG90 [44] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#44) << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=pbuc1_derefidx_vbuz2_rol_1 
    ldy plex_show_idx
    lda PLEX_SORTED_IDX,y
    asl
    sta xpos_idx
  //SEG91 [45] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuaa=_lo_pwuc1_derefidx_vbuz1 
    tay
    lda PLEX_XPOS,y
  //SEG92 [46] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$3 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy plex_sprite_idx2
    sta SPRITES_XPOS,y
  //SEG93 [47] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) -- vbuaa=_hi_pwuc1_derefidx_vbuz1 
    ldy xpos_idx
    lda PLEX_XPOS+1,y
  //SEG94 [48] if((byte~) plexShowSprite::$4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@1 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne b1
  //SEG95 plexShowSprite::@4
  //SEG96 [49] (byte/word/dword~) plexShowSprite::$6 ← (byte/word/signed word/dword/signed dword) 255 ^ (byte) plex_sprite_msb#44 -- vbuaa=vbuc1_bxor_vbuz1 
    lda plex_sprite_msb
    eor #$ff
  //SEG97 [50] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$6 -- _deref_pbuc1=_deref_pbuc1_band_vbuaa 
    and SPRITES_XMSB
    sta SPRITES_XMSB
  //SEG98 plexShowSprite::@2
  b2:
  //SEG99 [51] (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 ← (byte) plex_sprite_idx#44 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1 
    inx
  //SEG100 [52] (byte) plex_sprite_idx#15 ← (byte/signed word/word/dword/signed dword~) plexShowSprite::$7 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuxx=vbuxx_band_vbuc1 
    txa
    and #7
    tax
  //SEG101 [53] (byte) plex_show_idx#15 ← ++ (byte) plex_show_idx#44 -- vbuz1=_inc_vbuz1 
    inc plex_show_idx
  //SEG102 [54] (byte) plex_sprite_msb#25 ← (byte) plex_sprite_msb#44 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1 
    asl plex_sprite_msb
  //SEG103 [55] if((byte) plex_sprite_msb#25!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@8 -- vbuz1_neq_0_then_la1 
    lda plex_sprite_msb
    cmp #0
    bne breturn
  //SEG104 [56] phi from plexShowSprite::@2 to plexShowSprite::@return [phi:plexShowSprite::@2->plexShowSprite::@return]
  //SEG105 [56] phi (byte) plex_sprite_msb#16 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:plexShowSprite::@2->plexShowSprite::@return#0] -- vbuz1=vbuc1 
    lda #1
    sta plex_sprite_msb
  //SEG106 plexShowSprite::@return
  breturn:
  //SEG107 [57] return 
    rts
  //SEG108 [58] phi from plexShowSprite::@2 to plexShowSprite::@8 [phi:plexShowSprite::@2->plexShowSprite::@8]
  //SEG109 plexShowSprite::@8
  //SEG110 [56] phi from plexShowSprite::@8 to plexShowSprite::@return [phi:plexShowSprite::@8->plexShowSprite::@return]
  //SEG111 [56] phi (byte) plex_sprite_msb#16 = (byte) plex_sprite_msb#25 [phi:plexShowSprite::@8->plexShowSprite::@return#0] -- register_copy 
  //SEG112 plexShowSprite::@1
  b1:
  //SEG113 [59] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#44 -- _deref_pbuc1=_deref_pbuc1_bor_vbuz1 
    lda SPRITES_XMSB
    ora plex_sprite_msb
    sta SPRITES_XMSB
    jmp b2
}
//SEG114 plexSort
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
//     the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
//     elements before the marker are shifted right one at a time until encountering one smaller than the current one.
//      It is then inserted at the spot. Now the marker can move forward.
plexSort: {
    .label nxt_idx = 4
    .label nxt_y = 5
    .label m = 3
  //SEG115 [61] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
  //SEG116 [61] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta m
  //SEG117 [61] phi from plexSort::@2 to plexSort::@1 [phi:plexSort::@2->plexSort::@1]
  //SEG118 [61] phi (byte) plexSort::m#2 = (byte) plexSort::m#1 [phi:plexSort::@2->plexSort::@1#0] -- register_copy 
  //SEG119 plexSort::@1
  b1:
  //SEG120 [62] (byte) plexSort::nxt_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::m#2) -- vbuz1=pbuc1_derefidx_vbuz2 
    ldy m
    lda PLEX_SORTED_IDX+1,y
    sta nxt_idx
  //SEG121 [63] (byte) plexSort::nxt_y#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) plexSort::nxt_idx#0) -- vbuz1=pbuc1_derefidx_vbuz2 
    tay
    lda PLEX_YPOS,y
    sta nxt_y
  //SEG122 [64] if((byte) plexSort::nxt_y#0>=*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::m#2))) goto plexSort::@2 -- vbuz1_ge_pbuc1_derefidx_pbuc2_derefidx_vbuz2_then_la1 
    ldx m
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcs b2
  //SEG123 plexSort::@11
  //SEG124 [65] (byte~) plexSort::s#6 ← (byte) plexSort::m#2 -- vbuxx=vbuz1 
  //SEG125 [66] phi from plexSort::@11 plexSort::@8 to plexSort::@3 [phi:plexSort::@11/plexSort::@8->plexSort::@3]
  //SEG126 [66] phi (byte) plexSort::s#3 = (byte~) plexSort::s#6 [phi:plexSort::@11/plexSort::@8->plexSort::@3#0] -- register_copy 
  //SEG127 plexSort::@3
  b3:
  //SEG128 [67] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda PLEX_SORTED_IDX,x
    sta PLEX_SORTED_IDX+1,x
  //SEG129 [68] (byte) plexSort::s#1 ← -- (byte) plexSort::s#3 -- vbuxx=_dec_vbuxx 
    dex
  //SEG130 [69] if((byte) plexSort::s#1!=(byte/word/signed word/dword/signed dword) 255) goto plexSort::@8 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne b8
  //SEG131 plexSort::@5
  b5:
  //SEG132 [70] (byte) plexSort::s#2 ← ++ (byte) plexSort::s#1 -- vbuxx=_inc_vbuxx 
    inx
  //SEG133 [71] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 -- pbuc1_derefidx_vbuxx=vbuz1 
    lda nxt_idx
    sta PLEX_SORTED_IDX,x
  //SEG134 plexSort::@2
  b2:
  //SEG135 [72] (byte) plexSort::m#1 ← ++ (byte) plexSort::m#2 -- vbuz1=_inc_vbuz1 
    inc m
  //SEG136 [73] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 2+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexSort::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda m
    cmp #PLEX_COUNT-2+1
    bne b1
  //SEG137 [74] phi from plexSort::@2 to plexSort::plexFreePrepare1 [phi:plexSort::@2->plexSort::plexFreePrepare1]
  //SEG138 plexSort::plexFreePrepare1
  //SEG139 [75] phi from plexSort::plexFreePrepare1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1]
  //SEG140 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort::plexFreePrepare1->plexSort::plexFreePrepare1_@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG141 [75] phi from plexSort::plexFreePrepare1_@1 to plexSort::plexFreePrepare1_@1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1]
  //SEG142 [75] phi (byte) plexSort::plexFreePrepare1_s#2 = (byte) plexSort::plexFreePrepare1_s#1 [phi:plexSort::plexFreePrepare1_@1->plexSort::plexFreePrepare1_@1#0] -- register_copy 
  //SEG143 plexSort::plexFreePrepare1_@1
  plexFreePrepare1_b1:
  //SEG144 [76] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta PLEX_FREE_YPOS,x
  //SEG145 [77] (byte) plexSort::plexFreePrepare1_s#1 ← ++ (byte) plexSort::plexFreePrepare1_s#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG146 [78] if((byte) plexSort::plexFreePrepare1_s#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto plexSort::plexFreePrepare1_@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne plexFreePrepare1_b1
  //SEG147 plexSort::@return
  //SEG148 [79] return 
    rts
  //SEG149 plexSort::@8
  b8:
  //SEG150 [80] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 -- vbuz1_lt_pbuc1_derefidx_pbuc2_derefidx_vbuxx_then_la1 
    lda nxt_y
    ldy PLEX_SORTED_IDX,x
    cmp PLEX_YPOS,y
    bcc b3
    jmp b5
}
//SEG151 init
// Initialize the program
init: {
    .label xp = 7
  //SEG152 [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 
    lda #VIC_DEN|VIC_RSEL|3
    sta D011
  //SEG153 [82] call plexInit 
  //SEG154 [96] phi from init to plexInit [phi:init->plexInit]
    jsr plexInit
  //SEG155 [83] phi from init to init::@1 [phi:init->init::@1]
  //SEG156 [83] phi (word) init::xp#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:init->init::@1#0] -- vwuz1=vbuc1 
    lda #<$20
    sta xp
    lda #>$20
    sta xp+1
  //SEG157 [83] phi (byte) init::sx#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init->init::@1#1] -- vbuxx=vbuc1 
    ldx #0
  //SEG158 [83] phi from init::@1 to init::@1 [phi:init::@1->init::@1]
  //SEG159 [83] phi (word) init::xp#2 = (word) init::xp#1 [phi:init::@1->init::@1#0] -- register_copy 
  //SEG160 [83] phi (byte) init::sx#2 = (byte) init::sx#1 [phi:init::@1->init::@1#1] -- register_copy 
  //SEG161 init::@1
  b1:
  //SEG162 [84] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #$ff&SPRITE/$40
    sta PLEX_PTR,x
  //SEG163 [85] (byte~) init::$6 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
  //SEG164 [86] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$6) ← (word) init::xp#2 -- pwuc1_derefidx_vbuaa=vwuz1 
    tay
    lda xp
    sta PLEX_XPOS,y
    lda xp+1
    sta PLEX_XPOS+1,y
  //SEG165 [87] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 -- vwuz1=vwuz1_plus_vbuc1 
    clc
    lda xp
    adc #<9
    sta xp
    lda xp+1
    adc #>9
    sta xp+1
  //SEG166 [88] (byte) init::sx#1 ← ++ (byte) init::sx#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG167 [89] if((byte) init::sx#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto init::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b1
  //SEG168 init::@3
  //SEG169 [90] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) 255 -- _deref_pbuc1=vbuc2 
    // Enable & initialize sprites
    lda #$ff
    sta SPRITES_ENABLE
  //SEG170 [91] phi from init::@3 to init::@2 [phi:init::@3->init::@2]
  //SEG171 [91] phi (byte) init::ss#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@3->init::@2#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG172 [91] phi from init::@2 to init::@2 [phi:init::@2->init::@2]
  //SEG173 [91] phi (byte) init::ss#2 = (byte) init::ss#1 [phi:init::@2->init::@2#0] -- register_copy 
  //SEG174 init::@2
  b2:
  //SEG175 [92] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #GREEN
    sta SPRITES_COLS,x
  //SEG176 [93] (byte) init::ss#1 ← ++ (byte) init::ss#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG177 [94] if((byte) init::ss#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto init::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne b2
  //SEG178 init::@return
  //SEG179 [95] return 
    rts
}
//SEG180 plexInit
// Initialize the multiplexer data structures
plexInit: {
  //SEG181 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
  //SEG182 plexInit::plexSetScreen1
  //SEG183 [98] phi from plexInit::plexSetScreen1 to plexInit::@1 [phi:plexInit::plexSetScreen1->plexInit::@1]
  //SEG184 [98] phi (byte) plexInit::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexInit::plexSetScreen1->plexInit::@1#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG185 [98] phi from plexInit::@1 to plexInit::@1 [phi:plexInit::@1->plexInit::@1]
  //SEG186 [98] phi (byte) plexInit::i#2 = (byte) plexInit::i#1 [phi:plexInit::@1->plexInit::@1#0] -- register_copy 
  //SEG187 plexInit::@1
  b1:
  //SEG188 [99] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexInit::i#2) ← (byte) plexInit::i#2 -- pbuc1_derefidx_vbuxx=vbuxx 
    txa
    sta PLEX_SORTED_IDX,x
  //SEG189 [100] (byte) plexInit::i#1 ← ++ (byte) plexInit::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG190 [101] if((byte) plexInit::i#1!=(const byte) PLEX_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto plexInit::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #PLEX_COUNT-1+1
    bne b1
  //SEG191 plexInit::@return
  //SEG192 [102] return 
    rts
}
  // Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
  PLEX_FREE_YPOS: .fill 8, 0
  // The x-positions of the multiplexer sprites ($000-$1ff)
  PLEX_XPOS: .fill 2*PLEX_COUNT, 0
  // The y-positions of the multiplexer sprites.
  PLEX_YPOS: .fill PLEX_COUNT, 0
  // The sprite pointers for the multiplexed sprites
  PLEX_PTR: .fill PLEX_COUNT, 0
  // Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
  PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
.pc = YSIN "YSIN"
  .var min = 50
    .var max = 250-21
    .var ampl = max-min;
    .for(var i=0;i<256;i++)
        .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))

.pc = SPRITE "SPRITE"
  .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
    .for (var y=0; y<21; y++)
        .for (var x=0;x<3; x++)
            .byte pic.getSinglecolorByte(x,y)


