Resolved forward reference PALETTE to PALETTE
Resolved forward reference PALETTE to PALETTE
Resolved forward reference MESSAGE to MESSAGE
Resolved forward reference SPRITE_BUFFER to SPRITE_BUFFER
Resolved forward reference SPRITE_BUFFER to SPRITE_BUFFER
Resolved forward reference SINTABLE_240 to SINTABLE_240
Resolved forward reference SPRITE_BUFFER to SPRITE_BUFFER
Resolved forward reference SINTABLE_184 to SINTABLE_184
Resolved forward reference SINTABLE_64 to SINTABLE_64
Resolved forward reference SPRITE_BUFFER to SPRITE_BUFFER
Constantified RValue SPRITE_BUFFER[main::$7] = (struct SpriteData){ 0, MESSAGE[main::s], 2, 0 }
Inlined call call disableVideoOutput
Inlined call call disableAudioOutput
Inlined call call clearVBlankFlag
Inlined call call waitForVBlank
Inlined call call waitForVBlank
Inlined call call ppuDataPrepare(ppuDataFill::ppuData)
Inlined call call ppuDataPut(ppuDataFill::val)
Inlined call call ppuDataPrepare(ppuDataTransfer::ppuData)
Inlined call call ppuDataPut(*ppuDataTransfer::cpuSrc)
Inlined call call ppuDataPrepare(ppuDataFetch::ppuData)
Inlined call ppuDataFetch::$2 = call ppuDataRead
Inlined call call ppuDataPrepare(ppuDataPutTile::ppuData)
Inlined call call ppuDataPut(ppuDataPutTile::tile[0])
Inlined call call ppuDataPut(ppuDataPutTile::tile[1])
Inlined call call ppuDataPrepare((void * const )ppuDataPutTile::$3)
Inlined call call ppuDataPut(ppuDataPutTile::tile[2])
Inlined call call ppuDataPut(ppuDataPutTile::tile[3])
Inlined call call ppuDataPrepare(ppuDataSet::ppuData)
Inlined call call ppuDataPut(ppuDataSet::val)
Inlined call call ppuDataPrepare(ppuDataGet::ppuData)
Inlined call ppuDataGet::$1 = call ppuDataRead
Inlined call call initNES
Inlined call call enableVideoOutput
Inlined call call ppuSpriteBufferDmaTransfer(SPRITE_BUFFER)
Inlined call call __init
Eliminating unused variable with no statement vblank::$1

CONTROL FLOW GRAPH SSA

char readJoy1()
readJoy1: scope:[readJoy1]  from vblank::@16
  readJoy1::$7 = (char *)APU
  readJoy1::$4 = readJoy1::$7 + OFFSET_STRUCT_RICOH_2A03_JOY1
  *readJoy1::$4 = 1
  readJoy1::$8 = (char *)APU
  readJoy1::$5 = readJoy1::$8 + OFFSET_STRUCT_RICOH_2A03_JOY1
  *readJoy1::$5 = 0
  readJoy1::joy#0 = 0
  readJoy1::i#0 = 0
  to:readJoy1::@1
readJoy1::@1: scope:[readJoy1]  from readJoy1 readJoy1::@2
  readJoy1::joy#4 = phi( readJoy1/readJoy1::joy#0, readJoy1::@2/readJoy1::joy#1 )
  readJoy1::i#2 = phi( readJoy1/readJoy1::i#0, readJoy1::@2/readJoy1::i#1 )
  readJoy1::$0 = readJoy1::i#2 < 8
  if(readJoy1::$0) goto readJoy1::@2
  to:readJoy1::@3
readJoy1::@2: scope:[readJoy1]  from readJoy1::@1
  readJoy1::i#3 = phi( readJoy1::@1/readJoy1::i#2 )
  readJoy1::joy#2 = phi( readJoy1::@1/readJoy1::joy#4 )
  readJoy1::$1 = readJoy1::joy#2 << 1
  readJoy1::$9 = (char *)APU
  readJoy1::$6 = readJoy1::$9 + OFFSET_STRUCT_RICOH_2A03_JOY1
  readJoy1::$2 = *readJoy1::$6 & 1
  readJoy1::$3 = readJoy1::$1 | readJoy1::$2
  readJoy1::joy#1 = readJoy1::$3
  readJoy1::i#1 = ++ readJoy1::i#3
  to:readJoy1::@1
readJoy1::@3: scope:[readJoy1]  from readJoy1::@1
  readJoy1::joy#3 = phi( readJoy1::@1/readJoy1::joy#4 )
  readJoy1::return#0 = readJoy1::joy#3
  to:readJoy1::@return
readJoy1::@return: scope:[readJoy1]  from readJoy1::@3
  readJoy1::return#3 = phi( readJoy1::@3/readJoy1::return#0 )
  readJoy1::return#1 = readJoy1::return#3
  return 
  to:@return

void ppuDataFill(void * const ppuData , char val , unsigned int size)
ppuDataFill: scope:[ppuDataFill]  from main::@5 main::@6
  ppuDataFill::val#8 = phi( main::@5/ppuDataFill::val#0, main::@6/ppuDataFill::val#1 )
  ppuDataFill::size#7 = phi( main::@5/ppuDataFill::size#0, main::@6/ppuDataFill::size#1 )
  ppuDataFill::ppuData#2 = phi( main::@5/ppuDataFill::ppuData#0, main::@6/ppuDataFill::ppuData#1 )
  ppuDataFill::ppuDataPrepare1_ppuData#0 = ppuDataFill::ppuData#2
  to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill]  from ppuDataFill
  ppuDataFill::val#6 = phi( ppuDataFill/ppuDataFill::val#8 )
  ppuDataFill::size#5 = phi( ppuDataFill/ppuDataFill::size#7 )
  ppuDataFill::ppuDataPrepare1_ppuData#1 = phi( ppuDataFill/ppuDataFill::ppuDataPrepare1_ppuData#0 )
  ppuDataFill::ppuDataPrepare1_$0 = byte1  ppuDataFill::ppuDataPrepare1_ppuData#1
  ppuDataFill::ppuDataPrepare1_$4 = (char *)PPU
  ppuDataFill::ppuDataPrepare1_$2 = ppuDataFill::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
  *ppuDataFill::ppuDataPrepare1_$2 = ppuDataFill::ppuDataPrepare1_$0
  ppuDataFill::ppuDataPrepare1_$1 = byte0  ppuDataFill::ppuDataPrepare1_ppuData#1
  ppuDataFill::ppuDataPrepare1_$5 = (char *)PPU
  ppuDataFill::ppuDataPrepare1_$3 = ppuDataFill::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
  *ppuDataFill::ppuDataPrepare1_$3 = ppuDataFill::ppuDataPrepare1_$1
  to:ppuDataFill::@3
ppuDataFill::@3: scope:[ppuDataFill]  from ppuDataFill::ppuDataPrepare1
  ppuDataFill::val#4 = phi( ppuDataFill::ppuDataPrepare1/ppuDataFill::val#6 )
  ppuDataFill::size#3 = phi( ppuDataFill::ppuDataPrepare1/ppuDataFill::size#5 )
  ppuDataFill::i#0 = 0
  to:ppuDataFill::@1
ppuDataFill::@1: scope:[ppuDataFill]  from ppuDataFill::@3 ppuDataFill::@4
  ppuDataFill::val#3 = phi( ppuDataFill::@3/ppuDataFill::val#4, ppuDataFill::@4/ppuDataFill::val#5 )
  ppuDataFill::size#2 = phi( ppuDataFill::@3/ppuDataFill::size#3, ppuDataFill::@4/ppuDataFill::size#4 )
  ppuDataFill::i#2 = phi( ppuDataFill::@3/ppuDataFill::i#0, ppuDataFill::@4/ppuDataFill::i#1 )
  ppuDataFill::$1 = ppuDataFill::i#2 < ppuDataFill::size#2
  if(ppuDataFill::$1) goto ppuDataFill::@2
  to:ppuDataFill::@return
ppuDataFill::@2: scope:[ppuDataFill]  from ppuDataFill::@1
  ppuDataFill::size#8 = phi( ppuDataFill::@1/ppuDataFill::size#2 )
  ppuDataFill::i#5 = phi( ppuDataFill::@1/ppuDataFill::i#2 )
  ppuDataFill::val#2 = phi( ppuDataFill::@1/ppuDataFill::val#3 )
  ppuDataFill::ppuDataPut1_val#0 = ppuDataFill::val#2
  to:ppuDataFill::ppuDataPut1
ppuDataFill::ppuDataPut1: scope:[ppuDataFill]  from ppuDataFill::@2
  ppuDataFill::val#7 = phi( ppuDataFill::@2/ppuDataFill::val#2 )
  ppuDataFill::size#6 = phi( ppuDataFill::@2/ppuDataFill::size#8 )
  ppuDataFill::i#4 = phi( ppuDataFill::@2/ppuDataFill::i#5 )
  ppuDataFill::ppuDataPut1_val#1 = phi( ppuDataFill::@2/ppuDataFill::ppuDataPut1_val#0 )
  ppuDataFill::ppuDataPut1_$1 = (char *)PPU
  ppuDataFill::ppuDataPut1_$0 = ppuDataFill::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA
  *ppuDataFill::ppuDataPut1_$0 = ppuDataFill::ppuDataPut1_val#1
  to:ppuDataFill::@4
ppuDataFill::@4: scope:[ppuDataFill]  from ppuDataFill::ppuDataPut1
  ppuDataFill::val#5 = phi( ppuDataFill::ppuDataPut1/ppuDataFill::val#7 )
  ppuDataFill::size#4 = phi( ppuDataFill::ppuDataPut1/ppuDataFill::size#6 )
  ppuDataFill::i#3 = phi( ppuDataFill::ppuDataPut1/ppuDataFill::i#4 )
  ppuDataFill::i#1 = ++ ppuDataFill::i#3
  to:ppuDataFill::@1
ppuDataFill::@return: scope:[ppuDataFill]  from ppuDataFill::@1
  return 
  to:@return

void ppuDataTransfer(void * const ppuData , void * const cpuData , unsigned int size)
ppuDataTransfer: scope:[ppuDataTransfer]  from main::@4
  ppuDataTransfer::size#6 = phi( main::@4/ppuDataTransfer::size#0 )
  ppuDataTransfer::cpuData#3 = phi( main::@4/ppuDataTransfer::cpuData#0 )
  ppuDataTransfer::ppuData#1 = phi( main::@4/ppuDataTransfer::ppuData#0 )
  ppuDataTransfer::ppuDataPrepare1_ppuData#0 = ppuDataTransfer::ppuData#1
  to:ppuDataTransfer::ppuDataPrepare1
ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer]  from ppuDataTransfer
  ppuDataTransfer::size#4 = phi( ppuDataTransfer/ppuDataTransfer::size#6 )
  ppuDataTransfer::cpuData#2 = phi( ppuDataTransfer/ppuDataTransfer::cpuData#3 )
  ppuDataTransfer::ppuDataPrepare1_ppuData#1 = phi( ppuDataTransfer/ppuDataTransfer::ppuDataPrepare1_ppuData#0 )
  ppuDataTransfer::ppuDataPrepare1_$0 = byte1  ppuDataTransfer::ppuDataPrepare1_ppuData#1
  ppuDataTransfer::ppuDataPrepare1_$4 = (char *)PPU
  ppuDataTransfer::ppuDataPrepare1_$2 = ppuDataTransfer::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
  *ppuDataTransfer::ppuDataPrepare1_$2 = ppuDataTransfer::ppuDataPrepare1_$0
  ppuDataTransfer::ppuDataPrepare1_$1 = byte0  ppuDataTransfer::ppuDataPrepare1_ppuData#1
  ppuDataTransfer::ppuDataPrepare1_$5 = (char *)PPU
  ppuDataTransfer::ppuDataPrepare1_$3 = ppuDataTransfer::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
  *ppuDataTransfer::ppuDataPrepare1_$3 = ppuDataTransfer::ppuDataPrepare1_$1
  to:ppuDataTransfer::@3
ppuDataTransfer::@3: scope:[ppuDataTransfer]  from ppuDataTransfer::ppuDataPrepare1
  ppuDataTransfer::size#2 = phi( ppuDataTransfer::ppuDataPrepare1/ppuDataTransfer::size#4 )
  ppuDataTransfer::cpuData#1 = phi( ppuDataTransfer::ppuDataPrepare1/ppuDataTransfer::cpuData#2 )
  ppuDataTransfer::cpuSrc#0 = (char *)ppuDataTransfer::cpuData#1
  ppuDataTransfer::i#0 = 0
  to:ppuDataTransfer::@1
ppuDataTransfer::@1: scope:[ppuDataTransfer]  from ppuDataTransfer::@3 ppuDataTransfer::@4
  ppuDataTransfer::cpuSrc#4 = phi( ppuDataTransfer::@3/ppuDataTransfer::cpuSrc#0, ppuDataTransfer::@4/ppuDataTransfer::cpuSrc#1 )
  ppuDataTransfer::size#1 = phi( ppuDataTransfer::@3/ppuDataTransfer::size#2, ppuDataTransfer::@4/ppuDataTransfer::size#3 )
  ppuDataTransfer::i#2 = phi( ppuDataTransfer::@3/ppuDataTransfer::i#0, ppuDataTransfer::@4/ppuDataTransfer::i#1 )
  ppuDataTransfer::$1 = ppuDataTransfer::i#2 < ppuDataTransfer::size#1
  if(ppuDataTransfer::$1) goto ppuDataTransfer::@2
  to:ppuDataTransfer::@return
ppuDataTransfer::@2: scope:[ppuDataTransfer]  from ppuDataTransfer::@1
  ppuDataTransfer::size#7 = phi( ppuDataTransfer::@1/ppuDataTransfer::size#1 )
  ppuDataTransfer::i#5 = phi( ppuDataTransfer::@1/ppuDataTransfer::i#2 )
  ppuDataTransfer::cpuSrc#2 = phi( ppuDataTransfer::@1/ppuDataTransfer::cpuSrc#4 )
  ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2
  to:ppuDataTransfer::ppuDataPut1
ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer]  from ppuDataTransfer::@2
  ppuDataTransfer::size#5 = phi( ppuDataTransfer::@2/ppuDataTransfer::size#7 )
  ppuDataTransfer::i#4 = phi( ppuDataTransfer::@2/ppuDataTransfer::i#5 )
  ppuDataTransfer::cpuSrc#5 = phi( ppuDataTransfer::@2/ppuDataTransfer::cpuSrc#2 )
  ppuDataTransfer::ppuDataPut1_val#1 = phi( ppuDataTransfer::@2/ppuDataTransfer::ppuDataPut1_val#0 )
  ppuDataTransfer::ppuDataPut1_$1 = (char *)PPU
  ppuDataTransfer::ppuDataPut1_$0 = ppuDataTransfer::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA
  *ppuDataTransfer::ppuDataPut1_$0 = ppuDataTransfer::ppuDataPut1_val#1
  to:ppuDataTransfer::@4
ppuDataTransfer::@4: scope:[ppuDataTransfer]  from ppuDataTransfer::ppuDataPut1
  ppuDataTransfer::size#3 = phi( ppuDataTransfer::ppuDataPut1/ppuDataTransfer::size#5 )
  ppuDataTransfer::i#3 = phi( ppuDataTransfer::ppuDataPut1/ppuDataTransfer::i#4 )
  ppuDataTransfer::cpuSrc#3 = phi( ppuDataTransfer::ppuDataPut1/ppuDataTransfer::cpuSrc#5 )
  ppuDataTransfer::cpuSrc#1 = ++ ppuDataTransfer::cpuSrc#3
  ppuDataTransfer::i#1 = ++ ppuDataTransfer::i#3
  to:ppuDataTransfer::@1
ppuDataTransfer::@return: scope:[ppuDataTransfer]  from ppuDataTransfer::@1
  return 
  to:@return

void main()
main: scope:[main]  from __start::@1
  to:main::initNES1
main::initNES1: scope:[main]  from main
  asm { cld ldx#$ff txs  }
  to:main::initNES1_disableVideoOutput1
main::initNES1_disableVideoOutput1: scope:[main]  from main::initNES1
  main::initNES1_disableVideoOutput1_$2 = (char *)PPU
  main::initNES1_disableVideoOutput1_$0 = main::initNES1_disableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL
  *main::initNES1_disableVideoOutput1_$0 = 0
  main::initNES1_disableVideoOutput1_$3 = (char *)PPU
  main::initNES1_disableVideoOutput1_$1 = main::initNES1_disableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK
  *main::initNES1_disableVideoOutput1_$1 = 0
  to:main::initNES1_disableAudioOutput1
main::initNES1_disableAudioOutput1: scope:[main]  from main::initNES1_disableVideoOutput1
  *FR_COUNTER = $40
  main::initNES1_disableAudioOutput1_$1 = (char *)APU
  main::initNES1_disableAudioOutput1_$0 = main::initNES1_disableAudioOutput1_$1 + OFFSET_STRUCT_RICOH_2A03_DMC_FREQ
  *main::initNES1_disableAudioOutput1_$0 = $40
  to:main::initNES1_clearVBlankFlag1
main::initNES1_clearVBlankFlag1: scope:[main]  from main::initNES1_disableAudioOutput1
  asm { ldaPPU_PPUSTATUS  }
  to:main::initNES1_waitForVBlank1
main::initNES1_waitForVBlank1: scope:[main]  from main::initNES1_clearVBlankFlag1
  to:main::initNES1_waitForVBlank1_@1
main::initNES1_waitForVBlank1_@1: scope:[main]  from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1
  main::initNES1_waitForVBlank1_$3 = (volatile char *)PPU
  main::initNES1_waitForVBlank1_$2 = main::initNES1_waitForVBlank1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
  main::initNES1_waitForVBlank1_$0 = *main::initNES1_waitForVBlank1_$2 & $80
  main::initNES1_waitForVBlank1_$4 = 0 != main::initNES1_waitForVBlank1_$0
  main::initNES1_waitForVBlank1_$1 = ! main::initNES1_waitForVBlank1_$4
  if(main::initNES1_waitForVBlank1_$1) goto main::initNES1_waitForVBlank1_@1
  to:main::initNES1_@6
main::initNES1_@6: scope:[main]  from main::initNES1_waitForVBlank1_@1
  main::initNES1_i#0 = 0
  to:main::initNES1_@1
main::initNES1_@1: scope:[main]  from main::initNES1_@1 main::initNES1_@6
  main::initNES1_i#2 = phi( main::initNES1_@1/main::initNES1_i#1, main::initNES1_@6/main::initNES1_i#0 )
  (MEMORY+0)[main::initNES1_i#2] = 0
  (MEMORY+$100)[main::initNES1_i#2] = 0
  (MEMORY+$200)[main::initNES1_i#2] = 0
  (MEMORY+$300)[main::initNES1_i#2] = 0
  (MEMORY+$400)[main::initNES1_i#2] = 0
  (MEMORY+$500)[main::initNES1_i#2] = 0
  (MEMORY+$600)[main::initNES1_i#2] = 0
  (MEMORY+$700)[main::initNES1_i#2] = 0
  main::initNES1_i#1 = ++ main::initNES1_i#2
  main::initNES1_$5 = 0 != main::initNES1_i#1
  if(main::initNES1_$5) goto main::initNES1_@1
  to:main::initNES1_waitForVBlank2
main::initNES1_waitForVBlank2: scope:[main]  from main::initNES1_@1
  to:main::initNES1_waitForVBlank2_@1
main::initNES1_waitForVBlank2_@1: scope:[main]  from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1
  main::initNES1_waitForVBlank2_$3 = (volatile char *)PPU
  main::initNES1_waitForVBlank2_$2 = main::initNES1_waitForVBlank2_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
  main::initNES1_waitForVBlank2_$0 = *main::initNES1_waitForVBlank2_$2 & $80
  main::initNES1_waitForVBlank2_$4 = 0 != main::initNES1_waitForVBlank2_$0
  main::initNES1_waitForVBlank2_$1 = ! main::initNES1_waitForVBlank2_$4
  if(main::initNES1_waitForVBlank2_$1) goto main::initNES1_waitForVBlank2_@1
  to:main::initNES1_@7
main::initNES1_@7: scope:[main]  from main::initNES1_waitForVBlank2_@1
  asm { ldaPPU_PPUSTATUS  }
  to:main::@4
main::@4: scope:[main]  from main::initNES1_@7
  main::$1 = sizeof  PALETTE
  ppuDataTransfer::ppuData#0 = (void * const )PPU_PALETTE
  ppuDataTransfer::cpuData#0 = (void * const )PALETTE
  ppuDataTransfer::size#0 = main::$1
  call ppuDataTransfer
  to:main::@5
main::@5: scope:[main]  from main::@4
  ppuDataFill::ppuData#0 = (void * const )PPU_NAME_TABLE_0
  ppuDataFill::val#0 = '*'
  ppuDataFill::size#0 = $20*$1e
  call ppuDataFill
  to:main::@6
main::@6: scope:[main]  from main::@5
  ppuDataFill::ppuData#1 = (void * const )PPU_ATTRIBUTE_TABLE_0
  ppuDataFill::val#1 = 0
  ppuDataFill::size#1 = $40
  call ppuDataFill
  to:main::@7
main::@7: scope:[main]  from main::@6
  main::s#0 = 0
  to:main::@1
main::@1: scope:[main]  from main::@2 main::@7
  main::s#2 = phi( main::@2/main::s#1, main::@7/main::s#0 )
  main::$6 = main::s#2 < $40
  if(main::$6) goto main::@2
  to:main::enableVideoOutput1
main::@2: scope:[main]  from main::@1
  main::s#3 = phi( main::@1/main::s#2 )
  main::$7 = main::s#3 * SIZEOF_STRUCT_SPRITEDATA
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y)[main::$7] = 0
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#3]
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0
  main::s#1 = ++ main::s#3
  to:main::@1
main::enableVideoOutput1: scope:[main]  from main::@1
  main::enableVideoOutput1_$2 = (char *)PPU
  main::enableVideoOutput1_$0 = main::enableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL
  *main::enableVideoOutput1_$0 = $80
  main::enableVideoOutput1_$3 = (char *)PPU
  main::enableVideoOutput1_$1 = main::enableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK
  *main::enableVideoOutput1_$1 = $1e
  to:main::@3
main::@3: scope:[main]  from main::@3 main::enableVideoOutput1
  main::$8 = 0 != 1
  if(main::$8) goto main::@3
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return

__interrupt(hardware_all) void vblank()
vblank: scope:[vblank]  from
  vblank::$31 = (char *)PPU
  vblank::$29 = vblank::$31 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
  *vblank::$29 = 0
  vblank::$32 = (char *)PPU
  vblank::$30 = vblank::$32 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
  *vblank::$30 = 0
  vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = SPRITE_BUFFER
  to:vblank::ppuSpriteBufferDmaTransfer1
vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank]  from vblank
  vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 = phi( vblank/vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 )
  vblank::ppuSpriteBufferDmaTransfer1_$3 = (char *)PPU
  vblank::ppuSpriteBufferDmaTransfer1_$1 = vblank::ppuSpriteBufferDmaTransfer1_$3 + OFFSET_STRUCT_RICOH_2C02_OAMADDR
  *vblank::ppuSpriteBufferDmaTransfer1_$1 = 0
  vblank::ppuSpriteBufferDmaTransfer1_$0 = byte1  vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1
  vblank::ppuSpriteBufferDmaTransfer1_$4 = (char *)APU
  vblank::ppuSpriteBufferDmaTransfer1_$2 = vblank::ppuSpriteBufferDmaTransfer1_$4 + OFFSET_STRUCT_RICOH_2A03_OAMDMA
  *vblank::ppuSpriteBufferDmaTransfer1_$2 = vblank::ppuSpriteBufferDmaTransfer1_$0
  to:vblank::@16
vblank::@16: scope:[vblank]  from vblank::ppuSpriteBufferDmaTransfer1
  call readJoy1
  readJoy1::return#2 = readJoy1::return#1
  to:vblank::@17
vblank::@17: scope:[vblank]  from vblank::@16
  readJoy1::return#4 = phi( vblank::@16/readJoy1::return#2 )
  vblank::joy#0 = readJoy1::return#4
  vblank::$33 = 0 != vblank::joy#0
  vblank::$2 = ! vblank::$33
  if(vblank::$2) goto vblank::@1
  to:vblank::@return
vblank::@1: scope:[vblank]  from vblank::@17
  vblank::y_idx#0 = y_sin_idx
  y_sin_idx = ++ y_sin_idx
  vblank::$3 = x_sin_idx == $ee
  if(vblank::$3) goto vblank::@2
  to:vblank::@3
vblank::@return: scope:[vblank]  from vblank::@17 vblank::@8
  return 
  to:@return
vblank::@2: scope:[vblank]  from vblank::@1
  vblank::y_idx#12 = phi( vblank::@1/vblank::y_idx#0 )
  vblank::$6 = 0
  to:vblank::@4
vblank::@3: scope:[vblank]  from vblank::@1
  vblank::y_idx#13 = phi( vblank::@1/vblank::y_idx#0 )
  vblank::$4 = x_sin_idx + 1
  vblank::$5 = vblank::$4
  to:vblank::@4
vblank::@4: scope:[vblank]  from vblank::@2 vblank::@3
  vblank::y_idx#10 = phi( vblank::@2/vblank::y_idx#12, vblank::@3/vblank::y_idx#13 )
  vblank::$7 = phi( vblank::@2/vblank::$6, vblank::@3/vblank::$5 )
  x_sin_idx = vblank::$7
  vblank::x_idx#0 = x_sin_idx
  vblank::$8 = x_sin_idx_2 == $58
  if(vblank::$8) goto vblank::@5
  to:vblank::@6
vblank::@5: scope:[vblank]  from vblank::@4
  vblank::x_idx#8 = phi( vblank::@4/vblank::x_idx#0 )
  vblank::y_idx#6 = phi( vblank::@4/vblank::y_idx#10 )
  vblank::$11 = 0
  to:vblank::@7
vblank::@6: scope:[vblank]  from vblank::@4
  vblank::x_idx#9 = phi( vblank::@4/vblank::x_idx#0 )
  vblank::y_idx#7 = phi( vblank::@4/vblank::y_idx#10 )
  vblank::$9 = x_sin_idx_2 + 1
  vblank::$10 = vblank::$9
  to:vblank::@7
vblank::@7: scope:[vblank]  from vblank::@5 vblank::@6
  vblank::x_idx#7 = phi( vblank::@5/vblank::x_idx#8, vblank::@6/vblank::x_idx#9 )
  vblank::y_idx#5 = phi( vblank::@5/vblank::y_idx#6, vblank::@6/vblank::y_idx#7 )
  vblank::$12 = phi( vblank::@5/vblank::$11, vblank::@6/vblank::$10 )
  x_sin_idx_2 = vblank::$12
  vblank::x_idx_2#0 = x_sin_idx_2
  vblank::s#0 = 0
  to:vblank::@8
vblank::@8: scope:[vblank]  from vblank::@15 vblank::@7
  vblank::x_idx_2#6 = phi( vblank::@15/vblank::x_idx_2#1, vblank::@7/vblank::x_idx_2#0 )
  vblank::x_idx#5 = phi( vblank::@15/vblank::x_idx#6, vblank::@7/vblank::x_idx#7 )
  vblank::y_idx#3 = phi( vblank::@15/vblank::y_idx#4, vblank::@7/vblank::y_idx#5 )
  vblank::s#2 = phi( vblank::@15/vblank::s#1, vblank::@7/vblank::s#0 )
  vblank::$13 = vblank::s#2 < $40
  if(vblank::$13) goto vblank::@9
  to:vblank::@return
vblank::@9: scope:[vblank]  from vblank::@8
  vblank::x_idx_2#2 = phi( vblank::@8/vblank::x_idx_2#6 )
  vblank::x_idx#2 = phi( vblank::@8/vblank::x_idx#5 )
  vblank::y_idx#2 = phi( vblank::@8/vblank::y_idx#3 )
  vblank::s#3 = phi( vblank::@8/vblank::s#2 )
  vblank::$27 = vblank::s#3 * SIZEOF_STRUCT_SPRITEDATA
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y)[vblank::$27] = SINTABLE_240[vblank::y_idx#2]
  vblank::y_idx#1 = vblank::y_idx#2 - 4
  vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2]
  vblank::$28 = vblank::s#3 * SIZEOF_STRUCT_SPRITEDATA
  ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[vblank::$28] = vblank::$14
  vblank::$15 = vblank::x_idx#2 < 3
  if(vblank::$15) goto vblank::@10
  to:vblank::@11
vblank::@10: scope:[vblank]  from vblank::@9
  vblank::y_idx#14 = phi( vblank::@9/vblank::y_idx#1 )
  vblank::s#8 = phi( vblank::@9/vblank::s#3 )
  vblank::x_idx_2#7 = phi( vblank::@9/vblank::x_idx_2#2 )
  vblank::x_idx#3 = phi( vblank::@9/vblank::x_idx#2 )
  vblank::$18 = vblank::x_idx#3 + $ec
  vblank::$19 = vblank::$18
  to:vblank::@12
vblank::@11: scope:[vblank]  from vblank::@9
  vblank::y_idx#15 = phi( vblank::@9/vblank::y_idx#1 )
  vblank::s#9 = phi( vblank::@9/vblank::s#3 )
  vblank::x_idx_2#8 = phi( vblank::@9/vblank::x_idx_2#2 )
  vblank::x_idx#4 = phi( vblank::@9/vblank::x_idx#2 )
  vblank::$16 = vblank::x_idx#4 - 3
  vblank::$17 = vblank::$16
  to:vblank::@12
vblank::@12: scope:[vblank]  from vblank::@10 vblank::@11
  vblank::y_idx#11 = phi( vblank::@10/vblank::y_idx#14, vblank::@11/vblank::y_idx#15 )
  vblank::s#7 = phi( vblank::@10/vblank::s#8, vblank::@11/vblank::s#9 )
  vblank::x_idx_2#3 = phi( vblank::@10/vblank::x_idx_2#7, vblank::@11/vblank::x_idx_2#8 )
  vblank::$20 = phi( vblank::@10/vblank::$19, vblank::@11/vblank::$17 )
  vblank::x_idx#1 = vblank::$20
  vblank::$21 = vblank::x_idx_2#3 >= $56
  if(vblank::$21) goto vblank::@13
  to:vblank::@14
vblank::@13: scope:[vblank]  from vblank::@12
  vblank::x_idx#10 = phi( vblank::@12/vblank::x_idx#1 )
  vblank::y_idx#8 = phi( vblank::@12/vblank::y_idx#11 )
  vblank::s#5 = phi( vblank::@12/vblank::s#7 )
  vblank::x_idx_2#4 = phi( vblank::@12/vblank::x_idx_2#3 )
  vblank::$24 = vblank::x_idx_2#4 - $56
  vblank::$25 = vblank::$24
  to:vblank::@15
vblank::@14: scope:[vblank]  from vblank::@12
  vblank::x_idx#11 = phi( vblank::@12/vblank::x_idx#1 )
  vblank::y_idx#9 = phi( vblank::@12/vblank::y_idx#11 )
  vblank::s#6 = phi( vblank::@12/vblank::s#7 )
  vblank::x_idx_2#5 = phi( vblank::@12/vblank::x_idx_2#3 )
  vblank::$22 = vblank::x_idx_2#5 + 3
  vblank::$23 = vblank::$22
  to:vblank::@15
vblank::@15: scope:[vblank]  from vblank::@13 vblank::@14
  vblank::x_idx#6 = phi( vblank::@13/vblank::x_idx#10, vblank::@14/vblank::x_idx#11 )
  vblank::y_idx#4 = phi( vblank::@13/vblank::y_idx#8, vblank::@14/vblank::y_idx#9 )
  vblank::s#4 = phi( vblank::@13/vblank::s#5, vblank::@14/vblank::s#6 )
  vblank::$26 = phi( vblank::@13/vblank::$25, vblank::@14/vblank::$23 )
  vblank::x_idx_2#1 = vblank::$26
  vblank::s#1 = ++ vblank::s#4
  to:vblank::@8

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  y_sin_idx = 0
  x_sin_idx = $49
  x_sin_idx_2 = $52
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant struct RICOH_2A03 *APU = (struct RICOH_2A03 *)$4000
__constant char * const FR_COUNTER = (char *)$4017
__constant char * const MEMORY = (char *)0
__constant char MESSAGE[$40] = "rex-of-camelot-presents-a-dxycp-on-nintendo-entertainment-system"z
__constant char OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
__constant char OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
__constant char OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
__constant char OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
__constant char OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
__constant char OFFSET_STRUCT_RICOH_2C02_PPUCTRL = 0
__constant char OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
__constant char OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
__constant char OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5
__constant char OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
__constant char OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES = 2
__constant char OFFSET_STRUCT_SPRITEDATA_TILE = 1
__constant char OFFSET_STRUCT_SPRITEDATA_X = 3
__constant char OFFSET_STRUCT_SPRITEDATA_Y = 0
__constant char PALETTE[$20] = { 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $f, $30, 8, 1, $f, $18, 8, 1, $30, $37, $1a, $f, $f, $f, $f }
__constant struct RICOH_2C02 *PPU = (struct RICOH_2C02 *)$2000
__constant char * const PPU_ATTRIBUTE_TABLE_0 = (char *)$23c0
__constant char * const PPU_NAME_TABLE_0 = (char *)$2000
__constant char * const PPU_PALETTE = (char *)$3f00
__constant volatile char * const PPU_PPUSTATUS = (char *)$2002
__constant const char SINTABLE_184[$ef] = kickasm {{ .fill 239, round(71.5+71.5*sin(2*PI*i/239))
 }}
__constant const char SINTABLE_240[$100] = kickasm {{ .fill $100, round(115.5+107.5*sin(2*PI*i/256))
 }}
__constant const char SINTABLE_64[$59] = kickasm {{ .fill 89, round(52.5+52.5*sin(2*PI*i/89))
 }}
__constant char SIZEOF_STRUCT_SPRITEDATA = 4
__constant struct SpriteData SPRITE_BUFFER[$100] = { fill( $100, 0) }
__constant char TILES[] = kickasm {{ .var filechargen = LoadBinary("characters.901225-01.bin")
     .for(var c=0; c<256; c++) {
        // Plane 0
        .fill 8, filechargen.get(c*8+i)
        // Plane 1
        .fill 8, 0
    }
 }}
__constant void (*VECTORS[])() = { &vblank, &main, 0 }
void __start()
void main()
unsigned int main::$1
bool main::$6
char main::$7
bool main::$8
char *main::enableVideoOutput1_$0
char *main::enableVideoOutput1_$1
char *main::enableVideoOutput1_$2
char *main::enableVideoOutput1_$3
bool main::initNES1_$5
char *main::initNES1_disableAudioOutput1_$0
char *main::initNES1_disableAudioOutput1_$1
char *main::initNES1_disableVideoOutput1_$0
char *main::initNES1_disableVideoOutput1_$1
char *main::initNES1_disableVideoOutput1_$2
char *main::initNES1_disableVideoOutput1_$3
char main::initNES1_i
char main::initNES1_i#0
char main::initNES1_i#1
char main::initNES1_i#2
number main::initNES1_waitForVBlank1_$0
bool main::initNES1_waitForVBlank1_$1
volatile char *main::initNES1_waitForVBlank1_$2
volatile char *main::initNES1_waitForVBlank1_$3
bool main::initNES1_waitForVBlank1_$4
number main::initNES1_waitForVBlank2_$0
bool main::initNES1_waitForVBlank2_$1
volatile char *main::initNES1_waitForVBlank2_$2
volatile char *main::initNES1_waitForVBlank2_$3
bool main::initNES1_waitForVBlank2_$4
char main::s
char main::s#0
char main::s#1
char main::s#2
char main::s#3
void ppuDataFill(void * const ppuData , char val , unsigned int size)
bool ppuDataFill::$1
unsigned int ppuDataFill::i
unsigned int ppuDataFill::i#0
unsigned int ppuDataFill::i#1
unsigned int ppuDataFill::i#2
unsigned int ppuDataFill::i#3
unsigned int ppuDataFill::i#4
unsigned int ppuDataFill::i#5
void * const ppuDataFill::ppuData
void * const ppuDataFill::ppuData#0
void * const ppuDataFill::ppuData#1
void * const ppuDataFill::ppuData#2
char ppuDataFill::ppuDataPrepare1_$0
char ppuDataFill::ppuDataPrepare1_$1
char *ppuDataFill::ppuDataPrepare1_$2
char *ppuDataFill::ppuDataPrepare1_$3
char *ppuDataFill::ppuDataPrepare1_$4
char *ppuDataFill::ppuDataPrepare1_$5
void * const ppuDataFill::ppuDataPrepare1_ppuData
void * const ppuDataFill::ppuDataPrepare1_ppuData#0
void * const ppuDataFill::ppuDataPrepare1_ppuData#1
char *ppuDataFill::ppuDataPut1_$0
char *ppuDataFill::ppuDataPut1_$1
char ppuDataFill::ppuDataPut1_val
char ppuDataFill::ppuDataPut1_val#0
char ppuDataFill::ppuDataPut1_val#1
unsigned int ppuDataFill::size
unsigned int ppuDataFill::size#0
unsigned int ppuDataFill::size#1
unsigned int ppuDataFill::size#2
unsigned int ppuDataFill::size#3
unsigned int ppuDataFill::size#4
unsigned int ppuDataFill::size#5
unsigned int ppuDataFill::size#6
unsigned int ppuDataFill::size#7
unsigned int ppuDataFill::size#8
char ppuDataFill::val
char ppuDataFill::val#0
char ppuDataFill::val#1
char ppuDataFill::val#2
char ppuDataFill::val#3
char ppuDataFill::val#4
char ppuDataFill::val#5
char ppuDataFill::val#6
char ppuDataFill::val#7
char ppuDataFill::val#8
void ppuDataTransfer(void * const ppuData , void * const cpuData , unsigned int size)
bool ppuDataTransfer::$1
void * const ppuDataTransfer::cpuData
void * const ppuDataTransfer::cpuData#0
void * const ppuDataTransfer::cpuData#1
void * const ppuDataTransfer::cpuData#2
void * const ppuDataTransfer::cpuData#3
char *ppuDataTransfer::cpuSrc
char *ppuDataTransfer::cpuSrc#0
char *ppuDataTransfer::cpuSrc#1
char *ppuDataTransfer::cpuSrc#2
char *ppuDataTransfer::cpuSrc#3
char *ppuDataTransfer::cpuSrc#4
char *ppuDataTransfer::cpuSrc#5
unsigned int ppuDataTransfer::i
unsigned int ppuDataTransfer::i#0
unsigned int ppuDataTransfer::i#1
unsigned int ppuDataTransfer::i#2
unsigned int ppuDataTransfer::i#3
unsigned int ppuDataTransfer::i#4
unsigned int ppuDataTransfer::i#5
void * const ppuDataTransfer::ppuData
void * const ppuDataTransfer::ppuData#0
void * const ppuDataTransfer::ppuData#1
char ppuDataTransfer::ppuDataPrepare1_$0
char ppuDataTransfer::ppuDataPrepare1_$1
char *ppuDataTransfer::ppuDataPrepare1_$2
char *ppuDataTransfer::ppuDataPrepare1_$3
char *ppuDataTransfer::ppuDataPrepare1_$4
char *ppuDataTransfer::ppuDataPrepare1_$5
void * const ppuDataTransfer::ppuDataPrepare1_ppuData
void * const ppuDataTransfer::ppuDataPrepare1_ppuData#0
void * const ppuDataTransfer::ppuDataPrepare1_ppuData#1
char *ppuDataTransfer::ppuDataPut1_$0
char *ppuDataTransfer::ppuDataPut1_$1
char ppuDataTransfer::ppuDataPut1_val
char ppuDataTransfer::ppuDataPut1_val#0
char ppuDataTransfer::ppuDataPut1_val#1
unsigned int ppuDataTransfer::size
unsigned int ppuDataTransfer::size#0
unsigned int ppuDataTransfer::size#1
unsigned int ppuDataTransfer::size#2
unsigned int ppuDataTransfer::size#3
unsigned int ppuDataTransfer::size#4
unsigned int ppuDataTransfer::size#5
unsigned int ppuDataTransfer::size#6
unsigned int ppuDataTransfer::size#7
char readJoy1()
bool readJoy1::$0
char readJoy1::$1
number readJoy1::$2
number readJoy1::$3
char *readJoy1::$4
char *readJoy1::$5
char *readJoy1::$6
char *readJoy1::$7
char *readJoy1::$8
char *readJoy1::$9
char readJoy1::i
char readJoy1::i#0
char readJoy1::i#1
char readJoy1::i#2
char readJoy1::i#3
char readJoy1::joy
char readJoy1::joy#0
char readJoy1::joy#1
char readJoy1::joy#2
char readJoy1::joy#3
char readJoy1::joy#4
char readJoy1::return
char readJoy1::return#0
char readJoy1::return#1
char readJoy1::return#2
char readJoy1::return#3
char readJoy1::return#4
__interrupt(hardware_all) void vblank()
number vblank::$10
number vblank::$11
number vblank::$12
bool vblank::$13
char vblank::$14
bool vblank::$15
number vblank::$16
number vblank::$17
number vblank::$18
number vblank::$19
bool vblank::$2
number vblank::$20
bool vblank::$21
number vblank::$22
number vblank::$23
number vblank::$24
number vblank::$25
number vblank::$26
char vblank::$27
char vblank::$28
char *vblank::$29
bool vblank::$3
char *vblank::$30
char *vblank::$31
char *vblank::$32
bool vblank::$33
number vblank::$4
number vblank::$5
number vblank::$6
number vblank::$7
bool vblank::$8
number vblank::$9
char vblank::joy
char vblank::joy#0
char vblank::ppuSpriteBufferDmaTransfer1_$0
char *vblank::ppuSpriteBufferDmaTransfer1_$1
char *vblank::ppuSpriteBufferDmaTransfer1_$2
char *vblank::ppuSpriteBufferDmaTransfer1_$3
char *vblank::ppuSpriteBufferDmaTransfer1_$4
struct SpriteData *vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer
struct SpriteData *vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0
struct SpriteData *vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1
char vblank::s
char vblank::s#0
char vblank::s#1
char vblank::s#2
char vblank::s#3
char vblank::s#4
char vblank::s#5
char vblank::s#6
char vblank::s#7
char vblank::s#8
char vblank::s#9
char vblank::x_idx
char vblank::x_idx#0
char vblank::x_idx#1
char vblank::x_idx#10
char vblank::x_idx#11
char vblank::x_idx#2
char vblank::x_idx#3
char vblank::x_idx#4
char vblank::x_idx#5
char vblank::x_idx#6
char vblank::x_idx#7
char vblank::x_idx#8
char vblank::x_idx#9
char vblank::x_idx_2
char vblank::x_idx_2#0
char vblank::x_idx_2#1
char vblank::x_idx_2#2
char vblank::x_idx_2#3
char vblank::x_idx_2#4
char vblank::x_idx_2#5
char vblank::x_idx_2#6
char vblank::x_idx_2#7
char vblank::x_idx_2#8
char vblank::y_idx
char vblank::y_idx#0
char vblank::y_idx#1
char vblank::y_idx#10
char vblank::y_idx#11
char vblank::y_idx#12
char vblank::y_idx#13
char vblank::y_idx#14
char vblank::y_idx#15
char vblank::y_idx#2
char vblank::y_idx#3
char vblank::y_idx#4
char vblank::y_idx#5
char vblank::y_idx#6
char vblank::y_idx#7
char vblank::y_idx#8
char vblank::y_idx#9
__loadstore volatile char x_sin_idx
__loadstore volatile char x_sin_idx_2
__loadstore volatile char y_sin_idx

Adding number conversion cast (unumber) 1 in *readJoy1::$4 = 1
Adding number conversion cast (unumber) 0 in *readJoy1::$5 = 0
Adding number conversion cast (unumber) 8 in readJoy1::$0 = readJoy1::i#2 < 8
Adding number conversion cast (unumber) 1 in readJoy1::$1 = readJoy1::joy#2 << 1
Adding number conversion cast (unumber) 1 in readJoy1::$2 = *readJoy1::$6 & 1
Adding number conversion cast (unumber) readJoy1::$2 in readJoy1::$2 = *readJoy1::$6 & (unumber)1
Adding number conversion cast (unumber) readJoy1::$3 in readJoy1::$3 = readJoy1::$1 | readJoy1::$2
Adding number conversion cast (unumber) 0 in *main::initNES1_disableVideoOutput1_$0 = 0
Adding number conversion cast (unumber) 0 in *main::initNES1_disableVideoOutput1_$1 = 0
Adding number conversion cast (unumber) $40 in *FR_COUNTER = $40
Adding number conversion cast (unumber) $40 in *main::initNES1_disableAudioOutput1_$0 = $40
Adding number conversion cast (unumber) $80 in main::initNES1_waitForVBlank1_$0 = *main::initNES1_waitForVBlank1_$2 & $80
Adding number conversion cast (unumber) main::initNES1_waitForVBlank1_$0 in main::initNES1_waitForVBlank1_$0 = *main::initNES1_waitForVBlank1_$2 & (unumber)$80
Adding number conversion cast (unumber) 0 in main::initNES1_waitForVBlank1_$4 = 0 != main::initNES1_waitForVBlank1_$0
Adding number conversion cast (unumber) 0 in (MEMORY+0)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) 0 in (MEMORY+0)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$100)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $100 in (MEMORY+$100)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$200)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $200 in (MEMORY+$200)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$300)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $300 in (MEMORY+$300)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$400)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $400 in (MEMORY+$400)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$500)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $500 in (MEMORY+$500)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$600)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $600 in (MEMORY+$600)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in (MEMORY+$700)[main::initNES1_i#2] = 0
Adding number conversion cast (unumber) $700 in (MEMORY+$700)[main::initNES1_i#2] = ((unumber)) 0
Adding number conversion cast (unumber) 0 in main::initNES1_$5 = 0 != main::initNES1_i#1
Adding number conversion cast (unumber) $80 in main::initNES1_waitForVBlank2_$0 = *main::initNES1_waitForVBlank2_$2 & $80
Adding number conversion cast (unumber) main::initNES1_waitForVBlank2_$0 in main::initNES1_waitForVBlank2_$0 = *main::initNES1_waitForVBlank2_$2 & (unumber)$80
Adding number conversion cast (unumber) 0 in main::initNES1_waitForVBlank2_$4 = 0 != main::initNES1_waitForVBlank2_$0
Adding number conversion cast (unumber) $20*$1e in ppuDataFill::size#0 = $20*$1e
Adding number conversion cast (unumber) 0 in ppuDataFill::val#1 = 0
Adding number conversion cast (unumber) $40 in ppuDataFill::size#1 = $40
Adding number conversion cast (unumber) $40 in main::$6 = main::s#2 < $40
Adding number conversion cast (unumber) $80 in *main::enableVideoOutput1_$0 = $80
Adding number conversion cast (unumber) $1e in *main::enableVideoOutput1_$1 = $1e
Adding number conversion cast (unumber) 0 in *vblank::$29 = 0
Adding number conversion cast (unumber) 0 in *vblank::$30 = 0
Adding number conversion cast (unumber) 0 in *vblank::ppuSpriteBufferDmaTransfer1_$1 = 0
Adding number conversion cast (unumber) 0 in vblank::$33 = 0 != vblank::joy#0
Adding number conversion cast (unumber) $ee in vblank::$3 = x_sin_idx == $ee
Adding number conversion cast (unumber) 1 in vblank::$4 = x_sin_idx + 1
Adding number conversion cast (unumber) vblank::$4 in vblank::$4 = x_sin_idx + (unumber)1
Adding number conversion cast (unumber) vblank::$5 in vblank::$5 = vblank::$4
Adding number conversion cast (unumber) vblank::$7 in vblank::y_idx#10 = phi( vblank::@2/vblank::y_idx#12, vblank::@3/vblank::y_idx#13 )
  vblank::$7 = phi( vblank::@2/vblank::$6, vblank::@3/vblank::$5 )
Adding number conversion cast (unumber) $58 in vblank::$8 = x_sin_idx_2 == $58
Adding number conversion cast (unumber) 1 in vblank::$9 = x_sin_idx_2 + 1
Adding number conversion cast (unumber) vblank::$9 in vblank::$9 = x_sin_idx_2 + (unumber)1
Adding number conversion cast (unumber) vblank::$10 in vblank::$10 = vblank::$9
Adding number conversion cast (unumber) vblank::$12 in vblank::x_idx#7 = phi( vblank::@5/vblank::x_idx#8, vblank::@6/vblank::x_idx#9 )
  vblank::y_idx#5 = phi( vblank::@5/vblank::y_idx#6, vblank::@6/vblank::y_idx#7 )
  vblank::$12 = phi( vblank::@5/vblank::$11, vblank::@6/vblank::$10 )
Adding number conversion cast (unumber) $40 in vblank::$13 = vblank::s#2 < $40
Adding number conversion cast (unumber) 4 in vblank::y_idx#1 = vblank::y_idx#2 - 4
Adding number conversion cast (unumber) 3 in vblank::$15 = vblank::x_idx#2 < 3
Adding number conversion cast (unumber) $ec in vblank::$18 = vblank::x_idx#3 + $ec
Adding number conversion cast (unumber) vblank::$18 in vblank::$18 = vblank::x_idx#3 + (unumber)$ec
Adding number conversion cast (unumber) vblank::$19 in vblank::$19 = vblank::$18
Adding number conversion cast (unumber) 3 in vblank::$16 = vblank::x_idx#4 - 3
Adding number conversion cast (unumber) vblank::$16 in vblank::$16 = vblank::x_idx#4 - (unumber)3
Adding number conversion cast (unumber) vblank::$17 in vblank::$17 = vblank::$16
Adding number conversion cast (unumber) vblank::$20 in vblank::y_idx#11 = phi( vblank::@10/vblank::y_idx#14, vblank::@11/vblank::y_idx#15 )
  vblank::s#7 = phi( vblank::@10/vblank::s#8, vblank::@11/vblank::s#9 )
  vblank::x_idx_2#3 = phi( vblank::@10/vblank::x_idx_2#7, vblank::@11/vblank::x_idx_2#8 )
  vblank::$20 = phi( vblank::@10/vblank::$19, vblank::@11/vblank::$17 )
Adding number conversion cast (unumber) $56 in vblank::$21 = vblank::x_idx_2#3 >= $56
Adding number conversion cast (unumber) $56 in vblank::$24 = vblank::x_idx_2#4 - $56
Adding number conversion cast (unumber) vblank::$24 in vblank::$24 = vblank::x_idx_2#4 - (unumber)$56
Adding number conversion cast (unumber) vblank::$25 in vblank::$25 = vblank::$24
Adding number conversion cast (unumber) 3 in vblank::$22 = vblank::x_idx_2#5 + 3
Adding number conversion cast (unumber) vblank::$22 in vblank::$22 = vblank::x_idx_2#5 + (unumber)3
Adding number conversion cast (unumber) vblank::$23 in vblank::$23 = vblank::$22
Adding number conversion cast (unumber) vblank::$26 in vblank::x_idx#6 = phi( vblank::@13/vblank::x_idx#10, vblank::@14/vblank::x_idx#11 )
  vblank::y_idx#4 = phi( vblank::@13/vblank::y_idx#8, vblank::@14/vblank::y_idx#9 )
  vblank::s#4 = phi( vblank::@13/vblank::s#5, vblank::@14/vblank::s#6 )
  vblank::$26 = phi( vblank::@13/vblank::$25, vblank::@14/vblank::$23 )
Successful SSA optimization PassNAddNumberTypeConversions
Adding number conversion cast (unumber) vblank::$6 in vblank::y_idx#10 = phi( vblank::@2/vblank::y_idx#12, vblank::@3/vblank::y_idx#13 )
  vblank::$7 = phi( vblank::@2/vblank::$6, vblank::@3/vblank::$5 )
Adding number conversion cast (unumber) vblank::$11 in vblank::x_idx#7 = phi( vblank::@5/vblank::x_idx#8, vblank::@6/vblank::x_idx#9 )
  vblank::y_idx#5 = phi( vblank::@5/vblank::y_idx#6, vblank::@6/vblank::y_idx#7 )
  vblank::$12 = phi( vblank::@5/vblank::$11, vblank::@6/vblank::$10 )
Successful SSA optimization PassNAddNumberTypeConversions
Adding number conversion cast (unumber) 0 in vblank::$6 = 0
Adding number conversion cast (unumber) 0 in vblank::$11 = 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *readJoy1::$4 = (unumber)1
Inlining cast *readJoy1::$5 = (unumber)0
Inlining cast *main::initNES1_disableVideoOutput1_$0 = (unumber)0
Inlining cast *main::initNES1_disableVideoOutput1_$1 = (unumber)0
Inlining cast *FR_COUNTER = (unumber)$40
Inlining cast *main::initNES1_disableAudioOutput1_$0 = (unumber)$40
Inlining cast (MEMORY+(unumber)0)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$100)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$200)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$300)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$400)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$500)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$600)[main::initNES1_i#2] = (unumber)0
Inlining cast (MEMORY+(unumber)$700)[main::initNES1_i#2] = (unumber)0
Inlining cast ppuDataFill::size#0 = (unumber)$20*$1e
Inlining cast ppuDataFill::val#1 = (unumber)0
Inlining cast ppuDataFill::size#1 = (unumber)$40
Inlining cast *main::enableVideoOutput1_$0 = (unumber)$80
Inlining cast *main::enableVideoOutput1_$1 = (unumber)$1e
Inlining cast *vblank::$29 = (unumber)0
Inlining cast *vblank::$30 = (unumber)0
Inlining cast *vblank::ppuSpriteBufferDmaTransfer1_$1 = (unumber)0
Inlining cast vblank::$6 = (unumber)0
Inlining cast vblank::$11 = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 8192
Simplifying constant pointer cast (char *) 9152
Simplifying constant pointer cast (char *) 16128
Simplifying constant pointer cast (char *) 8194
Simplifying constant pointer cast (char *) 16407
Simplifying constant pointer cast (char *) 0
Simplifying constant pointer cast (struct RICOH_2C02 *) 8192
Simplifying constant pointer cast (struct RICOH_2A03 *) 16384
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 8
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $40
Simplifying constant integer cast $40
Simplifying constant integer cast $80
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $100
Simplifying constant integer cast 0
Simplifying constant integer cast $200
Simplifying constant integer cast 0
Simplifying constant integer cast $300
Simplifying constant integer cast 0
Simplifying constant integer cast $400
Simplifying constant integer cast 0
Simplifying constant integer cast $500
Simplifying constant integer cast 0
Simplifying constant integer cast $600
Simplifying constant integer cast 0
Simplifying constant integer cast $700
Simplifying constant integer cast 0
Simplifying constant integer cast $80
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $40
Simplifying constant integer cast $40
Simplifying constant integer cast $80
Simplifying constant integer cast $1e
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $ee
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast $58
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast $40
Simplifying constant integer cast 4
Simplifying constant integer cast 3
Simplifying constant integer cast $ec
Simplifying constant integer cast 3
Simplifying constant integer cast $56
Simplifying constant integer cast $56
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 8
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) $80
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $100
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $200
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $300
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $400
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $500
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $600
Finalized unsigned number type (char) 0
Finalized unsigned number type (unsigned int) $700
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $80
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) $80
Finalized unsigned number type (char) $1e
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $ee
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $58
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) $ec
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) $56
Finalized unsigned number type (char) $56
Finalized unsigned number type (char) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in readJoy1::$2 = *readJoy1::$6 & 1
Inferred type updated to char in readJoy1::$3 = readJoy1::$1 | readJoy1::$2
Inferred type updated to char in main::initNES1_waitForVBlank1_$0 = *main::initNES1_waitForVBlank1_$2 & $80
Inferred type updated to char in main::initNES1_waitForVBlank2_$0 = *main::initNES1_waitForVBlank2_$2 & $80
Inferred type updated to char in vblank::$6 = 0
Inferred type updated to char in vblank::$4 = x_sin_idx + 1
Inferred type updated to char in vblank::$5 = vblank::$4
Inferred type updated to char for vblank::$7
Inferred type updated to char in vblank::$11 = 0
Inferred type updated to char in vblank::$9 = x_sin_idx_2 + 1
Inferred type updated to char in vblank::$10 = vblank::$9
Inferred type updated to char for vblank::$12
Inferred type updated to char in vblank::$18 = vblank::x_idx#3 + $ec
Inferred type updated to char in vblank::$19 = vblank::$18
Inferred type updated to char in vblank::$16 = vblank::x_idx#4 - 3
Inferred type updated to char in vblank::$17 = vblank::$16
Inferred type updated to char for vblank::$20
Inferred type updated to char in vblank::$24 = vblank::x_idx_2#4 - $56
Inferred type updated to char in vblank::$25 = vblank::$24
Inferred type updated to char in vblank::$22 = vblank::x_idx_2#5 + 3
Inferred type updated to char in vblank::$23 = vblank::$22
Inferred type updated to char for vblank::$26
Inversing boolean not [92] main::initNES1_waitForVBlank1_$1 = 0 == main::initNES1_waitForVBlank1_$0 from [91] main::initNES1_waitForVBlank1_$4 = 0 != main::initNES1_waitForVBlank1_$0
Inversing boolean not [111] main::initNES1_waitForVBlank2_$1 = 0 == main::initNES1_waitForVBlank2_$0 from [110] main::initNES1_waitForVBlank2_$4 = 0 != main::initNES1_waitForVBlank2_$0
Inversing boolean not [167] vblank::$2 = 0 == vblank::joy#0 from [166] vblank::$33 = 0 != vblank::joy#0
Successful SSA optimization Pass2UnaryNotSimplification
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Alias readJoy1::joy#2 = readJoy1::joy#4 readJoy1::joy#3 readJoy1::return#0 readJoy1::return#3 readJoy1::return#1 
Alias readJoy1::i#2 = readJoy1::i#3 
Alias readJoy1::joy#1 = readJoy1::$3 
Alias ppuDataFill::ppuDataPrepare1_ppuData#0 = ppuDataFill::ppuData#2 ppuDataFill::ppuDataPrepare1_ppuData#1 
Alias ppuDataFill::size#3 = ppuDataFill::size#5 ppuDataFill::size#7 
Alias ppuDataFill::val#4 = ppuDataFill::val#6 ppuDataFill::val#8 
Alias ppuDataFill::val#2 = ppuDataFill::val#3 ppuDataFill::ppuDataPut1_val#0 ppuDataFill::ppuDataPut1_val#1 ppuDataFill::val#7 ppuDataFill::val#5 
Alias ppuDataFill::i#2 = ppuDataFill::i#5 ppuDataFill::i#4 ppuDataFill::i#3 
Alias ppuDataFill::size#2 = ppuDataFill::size#8 ppuDataFill::size#6 ppuDataFill::size#4 
Alias ppuDataTransfer::ppuDataPrepare1_ppuData#0 = ppuDataTransfer::ppuData#1 ppuDataTransfer::ppuDataPrepare1_ppuData#1 
Alias ppuDataTransfer::cpuData#1 = ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuData#3 
Alias ppuDataTransfer::size#2 = ppuDataTransfer::size#4 ppuDataTransfer::size#6 
Alias ppuDataTransfer::cpuSrc#2 = ppuDataTransfer::cpuSrc#4 ppuDataTransfer::cpuSrc#5 ppuDataTransfer::cpuSrc#3 
Alias ppuDataTransfer::i#2 = ppuDataTransfer::i#5 ppuDataTransfer::i#4 ppuDataTransfer::i#3 
Alias ppuDataTransfer::size#1 = ppuDataTransfer::size#7 ppuDataTransfer::size#5 ppuDataTransfer::size#3 
Alias ppuDataTransfer::ppuDataPut1_val#0 = ppuDataTransfer::ppuDataPut1_val#1 
Alias ppuDataTransfer::size#0 = main::$1 
Alias main::s#2 = main::s#3 
Alias vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 
Alias readJoy1::return#2 = readJoy1::return#4 
Alias vblank::y_idx#0 = vblank::y_idx#12 vblank::y_idx#13 
Alias vblank::$5 = vblank::$4 
Alias vblank::y_idx#10 = vblank::y_idx#6 vblank::y_idx#7 
Alias vblank::x_idx#0 = vblank::x_idx#8 vblank::x_idx#9 
Alias vblank::$10 = vblank::$9 
Alias vblank::s#2 = vblank::s#3 vblank::s#8 vblank::s#9 
Alias vblank::y_idx#2 = vblank::y_idx#3 
Alias vblank::x_idx#2 = vblank::x_idx#5 vblank::x_idx#3 vblank::x_idx#4 
Alias vblank::x_idx_2#2 = vblank::x_idx_2#6 vblank::x_idx_2#7 vblank::x_idx_2#8 
Alias vblank::y_idx#1 = vblank::y_idx#14 vblank::y_idx#15 
Alias vblank::$19 = vblank::$18 
Alias vblank::$17 = vblank::$16 
Alias vblank::x_idx#1 = vblank::$20 vblank::x_idx#10 vblank::x_idx#11 
Alias vblank::x_idx_2#3 = vblank::x_idx_2#4 vblank::x_idx_2#5 
Alias vblank::s#5 = vblank::s#7 vblank::s#6 
Alias vblank::y_idx#11 = vblank::y_idx#8 vblank::y_idx#9 
Alias vblank::$25 = vblank::$24 
Alias vblank::$23 = vblank::$22 
Alias vblank::x_idx_2#1 = vblank::$26 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Alias vblank::y_idx#0 = vblank::y_idx#10 vblank::y_idx#5 
Alias vblank::x_idx#0 = vblank::x_idx#7 
Alias vblank::x_idx_2#2 = vblank::x_idx_2#3 
Alias vblank::s#2 = vblank::s#5 vblank::s#4 
Alias vblank::y_idx#1 = vblank::y_idx#11 vblank::y_idx#4 
Alias vblank::x_idx#1 = vblank::x_idx#6 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Identical Phi Values ppuDataFill::size#2 ppuDataFill::size#3
Identical Phi Values ppuDataFill::val#2 ppuDataFill::val#4
Identical Phi Values ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuData#0
Identical Phi Values ppuDataTransfer::cpuData#1 ppuDataTransfer::cpuData#0
Identical Phi Values ppuDataTransfer::size#2 ppuDataTransfer::size#0
Identical Phi Values ppuDataTransfer::size#1 ppuDataTransfer::size#2
Successful SSA optimization Pass2IdenticalPhiElimination
Identified duplicate assignment right side [201] vblank::$28 = vblank::s#2 * SIZEOF_STRUCT_SPRITEDATA
Successful SSA optimization Pass2DuplicateRValueIdentification
Simple Condition readJoy1::$0 [10] if(readJoy1::i#2<8) goto readJoy1::@2
Simple Condition ppuDataFill::$1 [30] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::@2
Simple Condition ppuDataTransfer::$1 [49] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2
Simple Condition main::initNES1_waitForVBlank1_$1 [73] if(0==main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1
Simple Condition main::initNES1_$5 [86] if(0!=main::initNES1_i#1) goto main::initNES1_@1
Simple Condition main::initNES1_waitForVBlank2_$1 [91] if(0==main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1
Simple Condition main::$6 [108] if(main::s#2<$40) goto main::@2
Simple Condition main::$8 [122] if(0!=1) goto main::@3
Simple Condition vblank::$2 [142] if(0==vblank::joy#0) goto vblank::@1
Simple Condition vblank::$3 [146] if(x_sin_idx==$ee) goto vblank::@2
Simple Condition vblank::$8 [154] if(x_sin_idx_2==$58) goto vblank::@5
Simple Condition vblank::$13 [163] if(vblank::s#2<$40) goto vblank::@9
Simple Condition vblank::$15 [171] if(vblank::x_idx#2<3) goto vblank::@10
Simple Condition vblank::$21 [176] if(vblank::x_idx_2#2>=$56) goto vblank::@13
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [0] readJoy1::$7 = (char *)APU
Constant right-side identified [3] readJoy1::$8 = (char *)APU
Constant right-side identified [12] readJoy1::$9 = (char *)APU
Constant right-side identified [20] ppuDataFill::ppuDataPrepare1_$4 = (char *)PPU
Constant right-side identified [24] ppuDataFill::ppuDataPrepare1_$5 = (char *)PPU
Constant right-side identified [31] ppuDataFill::ppuDataPut1_$1 = (char *)PPU
Constant right-side identified [38] ppuDataTransfer::ppuDataPrepare1_$4 = (char *)PPU
Constant right-side identified [42] ppuDataTransfer::ppuDataPrepare1_$5 = (char *)PPU
Constant right-side identified [51] ppuDataTransfer::ppuDataPut1_$1 = (char *)PPU
Constant right-side identified [58] main::initNES1_disableVideoOutput1_$2 = (char *)PPU
Constant right-side identified [61] main::initNES1_disableVideoOutput1_$3 = (char *)PPU
Constant right-side identified [65] main::initNES1_disableAudioOutput1_$1 = (char *)APU
Constant right-side identified [69] main::initNES1_waitForVBlank1_$3 = (volatile char *)PPU
Constant right-side identified [87] main::initNES1_waitForVBlank2_$3 = (volatile char *)PPU
Constant right-side identified [93] ppuDataTransfer::size#0 = sizeof  PALETTE
Constant right-side identified [99] ppuDataFill::size#0 = (unumber)$20*$1e
Constant right-side identified [115] main::enableVideoOutput1_$2 = (char *)PPU
Constant right-side identified [118] main::enableVideoOutput1_$3 = (char *)PPU
Constant right-side identified [124] vblank::$31 = (char *)PPU
Constant right-side identified [127] vblank::$32 = (char *)PPU
Constant right-side identified [131] vblank::ppuSpriteBufferDmaTransfer1_$3 = (char *)PPU
Constant right-side identified [135] vblank::ppuSpriteBufferDmaTransfer1_$4 = (char *)APU
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant readJoy1::$7 = (char *)APU
Constant readJoy1::$8 = (char *)APU
Constant readJoy1::joy#0 = 0
Constant readJoy1::i#0 = 0
Constant readJoy1::$9 = (char *)APU
Constant ppuDataFill::ppuDataPrepare1_$4 = (char *)PPU
Constant ppuDataFill::ppuDataPrepare1_$5 = (char *)PPU
Constant ppuDataFill::i#0 = 0
Constant ppuDataFill::ppuDataPut1_$1 = (char *)PPU
Constant ppuDataTransfer::ppuDataPrepare1_$4 = (char *)PPU
Constant ppuDataTransfer::ppuDataPrepare1_$5 = (char *)PPU
Constant ppuDataTransfer::i#0 = 0
Constant ppuDataTransfer::ppuDataPut1_$1 = (char *)PPU
Constant main::initNES1_disableVideoOutput1_$2 = (char *)PPU
Constant main::initNES1_disableVideoOutput1_$3 = (char *)PPU
Constant main::initNES1_disableAudioOutput1_$1 = (char *)APU
Constant main::initNES1_waitForVBlank1_$3 = (volatile char *)PPU
Constant main::initNES1_i#0 = 0
Constant main::initNES1_waitForVBlank2_$3 = (volatile char *)PPU
Constant ppuDataTransfer::size#0 = sizeof PALETTE
Constant ppuDataTransfer::ppuData#0 = (void * const )PPU_PALETTE
Constant ppuDataTransfer::cpuData#0 = (void * const )PALETTE
Constant ppuDataFill::ppuData#0 = (void * const )PPU_NAME_TABLE_0
Constant ppuDataFill::val#0 = '*'
Constant ppuDataFill::size#0 = (unumber)$20*$1e
Constant ppuDataFill::ppuData#1 = (void * const )PPU_ATTRIBUTE_TABLE_0
Constant ppuDataFill::val#1 = 0
Constant ppuDataFill::size#1 = $40
Constant main::s#0 = 0
Constant main::enableVideoOutput1_$2 = (char *)PPU
Constant main::enableVideoOutput1_$3 = (char *)PPU
Constant vblank::$31 = (char *)PPU
Constant vblank::$32 = (char *)PPU
Constant vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = SPRITE_BUFFER
Constant vblank::ppuSpriteBufferDmaTransfer1_$3 = (char *)PPU
Constant vblank::ppuSpriteBufferDmaTransfer1_$4 = (char *)APU
Constant vblank::$6 = 0
Constant vblank::$11 = 0
Constant vblank::s#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant ppuDataTransfer::cpuSrc#0 = (char *)ppuDataTransfer::cpuData#0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [122] if(0!=1) goto main::@3
Successful SSA optimization Pass2ConstantIfs
Converting *(pointer+n) to pointer[n] [2] *readJoy1::$4 = 1  -- readJoy1::$7[OFFSET_STRUCT_RICOH_2A03_JOY1]
Converting *(pointer+n) to pointer[n] [5] *readJoy1::$5 = 0  -- readJoy1::$8[OFFSET_STRUCT_RICOH_2A03_JOY1]
Converting *(pointer+n) to pointer[n] [14] readJoy1::$2 = *readJoy1::$6 & 1  -- readJoy1::$9[OFFSET_STRUCT_RICOH_2A03_JOY1]
Converting *(pointer+n) to pointer[n] [22] *ppuDataFill::ppuDataPrepare1_$2 = ppuDataFill::ppuDataPrepare1_$0  -- ppuDataFill::ppuDataPrepare1_$4[OFFSET_STRUCT_RICOH_2C02_PPUADDR]
Converting *(pointer+n) to pointer[n] [26] *ppuDataFill::ppuDataPrepare1_$3 = ppuDataFill::ppuDataPrepare1_$1  -- ppuDataFill::ppuDataPrepare1_$5[OFFSET_STRUCT_RICOH_2C02_PPUADDR]
Converting *(pointer+n) to pointer[n] [33] *ppuDataFill::ppuDataPut1_$0 = ppuDataFill::val#4  -- ppuDataFill::ppuDataPut1_$1[OFFSET_STRUCT_RICOH_2C02_PPUDATA]
Converting *(pointer+n) to pointer[n] [40] *ppuDataTransfer::ppuDataPrepare1_$2 = ppuDataTransfer::ppuDataPrepare1_$0  -- ppuDataTransfer::ppuDataPrepare1_$4[OFFSET_STRUCT_RICOH_2C02_PPUADDR]
Converting *(pointer+n) to pointer[n] [44] *ppuDataTransfer::ppuDataPrepare1_$3 = ppuDataTransfer::ppuDataPrepare1_$1  -- ppuDataTransfer::ppuDataPrepare1_$5[OFFSET_STRUCT_RICOH_2C02_PPUADDR]
Converting *(pointer+n) to pointer[n] [53] *ppuDataTransfer::ppuDataPut1_$0 = ppuDataTransfer::ppuDataPut1_val#0  -- ppuDataTransfer::ppuDataPut1_$1[OFFSET_STRUCT_RICOH_2C02_PPUDATA]
Converting *(pointer+n) to pointer[n] [60] *main::initNES1_disableVideoOutput1_$0 = 0  -- main::initNES1_disableVideoOutput1_$2[OFFSET_STRUCT_RICOH_2C02_PPUCTRL]
Converting *(pointer+n) to pointer[n] [63] *main::initNES1_disableVideoOutput1_$1 = 0  -- main::initNES1_disableVideoOutput1_$3[OFFSET_STRUCT_RICOH_2C02_PPUMASK]
Converting *(pointer+n) to pointer[n] [67] *main::initNES1_disableAudioOutput1_$0 = $40  -- main::initNES1_disableAudioOutput1_$1[OFFSET_STRUCT_RICOH_2A03_DMC_FREQ]
Converting *(pointer+n) to pointer[n] [71] main::initNES1_waitForVBlank1_$0 = *main::initNES1_waitForVBlank1_$2 & $80  -- main::initNES1_waitForVBlank1_$3[OFFSET_STRUCT_RICOH_2C02_PPUSTATUS]
Converting *(pointer+n) to pointer[n] [89] main::initNES1_waitForVBlank2_$0 = *main::initNES1_waitForVBlank2_$2 & $80  -- main::initNES1_waitForVBlank2_$3[OFFSET_STRUCT_RICOH_2C02_PPUSTATUS]
Converting *(pointer+n) to pointer[n] [117] *main::enableVideoOutput1_$0 = $80  -- main::enableVideoOutput1_$2[OFFSET_STRUCT_RICOH_2C02_PPUCTRL]
Converting *(pointer+n) to pointer[n] [120] *main::enableVideoOutput1_$1 = $1e  -- main::enableVideoOutput1_$3[OFFSET_STRUCT_RICOH_2C02_PPUMASK]
Converting *(pointer+n) to pointer[n] [126] *vblank::$29 = 0  -- vblank::$31[OFFSET_STRUCT_RICOH_2C02_PPUSCROLL]
Converting *(pointer+n) to pointer[n] [129] *vblank::$30 = 0  -- vblank::$32[OFFSET_STRUCT_RICOH_2C02_PPUSCROLL]
Converting *(pointer+n) to pointer[n] [133] *vblank::ppuSpriteBufferDmaTransfer1_$1 = 0  -- vblank::ppuSpriteBufferDmaTransfer1_$3[OFFSET_STRUCT_RICOH_2C02_OAMADDR]
Converting *(pointer+n) to pointer[n] [137] *vblank::ppuSpriteBufferDmaTransfer1_$2 = vblank::ppuSpriteBufferDmaTransfer1_$0  -- vblank::ppuSpriteBufferDmaTransfer1_$4[OFFSET_STRUCT_RICOH_2A03_OAMDMA]
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero main::initNES1_disableVideoOutput1_$2 in [59] main::initNES1_disableVideoOutput1_$0 = main::initNES1_disableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL
Simplifying expression containing zero main::initNES1_disableVideoOutput1_$2 in [60] main::initNES1_disableVideoOutput1_$2[OFFSET_STRUCT_RICOH_2C02_PPUCTRL] = 0
Simplifying expression containing zero MEMORY in [76] (MEMORY+0)[main::initNES1_i#2] = 0
Simplifying expression containing zero (char *)SPRITE_BUFFER in [110] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y)[main::$7] = 0
Simplifying expression containing zero main::enableVideoOutput1_$2 in [116] main::enableVideoOutput1_$0 = main::enableVideoOutput1_$2 + OFFSET_STRUCT_RICOH_2C02_PPUCTRL
Simplifying expression containing zero main::enableVideoOutput1_$2 in [117] main::enableVideoOutput1_$2[OFFSET_STRUCT_RICOH_2C02_PPUCTRL] = $80
Simplifying expression containing zero (char *)SPRITE_BUFFER in [165] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_Y)[vblank::$27] = SINTABLE_240[vblank::y_idx#2]
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused variable readJoy1::$4 and assignment [0] readJoy1::$4 = readJoy1::$7 + OFFSET_STRUCT_RICOH_2A03_JOY1
Eliminating unused variable readJoy1::$5 and assignment [2] readJoy1::$5 = readJoy1::$8 + OFFSET_STRUCT_RICOH_2A03_JOY1
Eliminating unused variable readJoy1::$6 and assignment [7] readJoy1::$6 = readJoy1::$9 + OFFSET_STRUCT_RICOH_2A03_JOY1
Eliminating unused variable ppuDataFill::ppuDataPrepare1_$2 and assignment [14] ppuDataFill::ppuDataPrepare1_$2 = ppuDataFill::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
Eliminating unused variable ppuDataFill::ppuDataPrepare1_$3 and assignment [17] ppuDataFill::ppuDataPrepare1_$3 = ppuDataFill::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
Eliminating unused variable ppuDataFill::ppuDataPut1_$0 and assignment [21] ppuDataFill::ppuDataPut1_$0 = ppuDataFill::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA
Eliminating unused variable ppuDataTransfer::ppuDataPrepare1_$2 and assignment [26] ppuDataTransfer::ppuDataPrepare1_$2 = ppuDataTransfer::ppuDataPrepare1_$4 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
Eliminating unused variable ppuDataTransfer::ppuDataPrepare1_$3 and assignment [29] ppuDataTransfer::ppuDataPrepare1_$3 = ppuDataTransfer::ppuDataPrepare1_$5 + OFFSET_STRUCT_RICOH_2C02_PPUADDR
Eliminating unused variable ppuDataTransfer::ppuDataPut1_$0 and assignment [34] ppuDataTransfer::ppuDataPut1_$0 = ppuDataTransfer::ppuDataPut1_$1 + OFFSET_STRUCT_RICOH_2C02_PPUDATA
Eliminating unused variable main::initNES1_disableVideoOutput1_$0 and assignment [40] main::initNES1_disableVideoOutput1_$0 = main::initNES1_disableVideoOutput1_$2
Eliminating unused variable main::initNES1_disableVideoOutput1_$1 and assignment [42] main::initNES1_disableVideoOutput1_$1 = main::initNES1_disableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK
Eliminating unused variable main::initNES1_disableAudioOutput1_$0 and assignment [45] main::initNES1_disableAudioOutput1_$0 = main::initNES1_disableAudioOutput1_$1 + OFFSET_STRUCT_RICOH_2A03_DMC_FREQ
Eliminating unused variable main::initNES1_waitForVBlank1_$2 and assignment [48] main::initNES1_waitForVBlank1_$2 = main::initNES1_waitForVBlank1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
Eliminating unused variable main::initNES1_waitForVBlank2_$2 and assignment [62] main::initNES1_waitForVBlank2_$2 = main::initNES1_waitForVBlank2_$3 + OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
Eliminating unused variable main::enableVideoOutput1_$0 and assignment [77] main::enableVideoOutput1_$0 = main::enableVideoOutput1_$2
Eliminating unused variable main::enableVideoOutput1_$1 and assignment [79] main::enableVideoOutput1_$1 = main::enableVideoOutput1_$3 + OFFSET_STRUCT_RICOH_2C02_PPUMASK
Eliminating unused variable vblank::$29 and assignment [81] vblank::$29 = vblank::$31 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
Eliminating unused variable vblank::$30 and assignment [83] vblank::$30 = vblank::$32 + OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
Eliminating unused variable vblank::ppuSpriteBufferDmaTransfer1_$1 and assignment [85] vblank::ppuSpriteBufferDmaTransfer1_$1 = vblank::ppuSpriteBufferDmaTransfer1_$3 + OFFSET_STRUCT_RICOH_2C02_OAMADDR
Eliminating unused variable vblank::ppuSpriteBufferDmaTransfer1_$2 and assignment [88] vblank::ppuSpriteBufferDmaTransfer1_$2 = vblank::ppuSpriteBufferDmaTransfer1_$4 + OFFSET_STRUCT_RICOH_2A03_OAMDMA
Eliminating unused constant OFFSET_STRUCT_SPRITEDATA_Y
Eliminating unused constant OFFSET_STRUCT_RICOH_2C02_PPUCTRL
Successful SSA optimization PassNEliminateUnusedVars
Resolving array sizeof() sizeof PALETTE
Successful SSA optimization PassNSizeOfSimplification
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Alias vblank::$28 = vblank::$27 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Constant right-side identified [19] ppuDataTransfer::ppuDataPrepare1_$0 = byte1  ppuDataTransfer::ppuData#0
Constant right-side identified [21] ppuDataTransfer::ppuDataPrepare1_$1 = byte0  ppuDataTransfer::ppuData#0
Constant right-side identified [68] vblank::ppuSpriteBufferDmaTransfer1_$0 = byte1  vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant ppuDataTransfer::ppuDataPrepare1_$0 = byte1 ppuDataTransfer::ppuData#0
Constant ppuDataTransfer::ppuDataPrepare1_$1 = byte0 ppuDataTransfer::ppuData#0
Constant vblank::ppuSpriteBufferDmaTransfer1_$0 = byte1 vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0
Successful SSA optimization Pass2ConstantIdentification
Simplifying constant evaluating to zero byte0 ppuDataTransfer::ppuData#0 in 
Successful SSA optimization PassNSimplifyConstantZero
Adding number conversion cast (unumber) $20 in 
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $20
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $20
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Rewriting multiplication to use shift [55] main::$7 = main::s#2 * SIZEOF_STRUCT_SPRITEDATA
Rewriting multiplication to use shift [86] vblank::$28 = vblank::s#2 * SIZEOF_STRUCT_SPRITEDATA
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings readJoy1::joy#0
Inlining constant with var siblings readJoy1::i#0
Inlining constant with var siblings ppuDataFill::i#0
Inlining constant with different constant siblings ppuDataFill::ppuData#0
Inlining constant with var siblings ppuDataFill::val#0
Inlining constant with var siblings ppuDataFill::size#0
Inlining constant with different constant siblings ppuDataFill::ppuData#1
Inlining constant with var siblings ppuDataFill::val#1
Inlining constant with var siblings ppuDataFill::size#1
Inlining constant with var siblings ppuDataTransfer::i#0
Inlining constant with var siblings ppuDataTransfer::cpuSrc#0
Inlining constant with var siblings main::initNES1_i#0
Inlining constant with var siblings main::s#0
Inlining constant with var siblings vblank::s#0
Constant inlined ppuDataTransfer::i#0 = 0
Constant inlined ppuDataTransfer::ppuDataPrepare1_$1 = 0
Constant inlined ppuDataTransfer::ppuDataPrepare1_$0 = byte1 ppuDataTransfer::ppuData#0
Constant inlined vblank::s#0 = 0
Constant inlined main::enableVideoOutput1_$3 = (char *)PPU
Constant inlined vblank::$6 = 0
Constant inlined main::enableVideoOutput1_$2 = (char *)PPU
Constant inlined readJoy1::i#0 = 0
Constant inlined ppuDataTransfer::ppuDataPut1_$1 = (char *)PPU
Constant inlined ppuDataFill::val#1 = 0
Constant inlined ppuDataFill::ppuDataPut1_$1 = (char *)PPU
Constant inlined ppuDataFill::val#0 = '*'
Constant inlined main::initNES1_waitForVBlank2_$3 = (volatile char *)PPU
Constant inlined ppuDataFill::ppuDataPrepare1_$4 = (char *)PPU
Constant inlined ppuDataTransfer::ppuDataPrepare1_$5 = (char *)PPU
Constant inlined ppuDataFill::ppuDataPrepare1_$5 = (char *)PPU
Constant inlined ppuDataTransfer::ppuDataPrepare1_$4 = (char *)PPU
Constant inlined main::initNES1_disableVideoOutput1_$3 = (char *)PPU
Constant inlined main::initNES1_disableVideoOutput1_$2 = (char *)PPU
Constant inlined ppuDataFill::ppuData#1 = (void * const )PPU_ATTRIBUTE_TABLE_0
Constant inlined ppuDataFill::ppuData#0 = (void * const )PPU_NAME_TABLE_0
Constant inlined main::initNES1_disableAudioOutput1_$1 = (char *)APU
Constant inlined readJoy1::joy#0 = 0
Constant inlined ppuDataTransfer::cpuSrc#0 = (char *)ppuDataTransfer::cpuData#0
Constant inlined main::s#0 = 0
Constant inlined main::initNES1_i#0 = 0
Constant inlined vblank::$31 = (char *)PPU
Constant inlined vblank::$32 = (char *)PPU
Constant inlined vblank::$11 = 0
Constant inlined readJoy1::$9 = (char *)APU
Constant inlined vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = SPRITE_BUFFER
Constant inlined main::initNES1_waitForVBlank1_$3 = (volatile char *)PPU
Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$0 = byte1 SPRITE_BUFFER
Constant inlined ppuDataFill::size#1 = $40
Constant inlined ppuDataFill::size#0 = (unsigned int)$20*$1e
Constant inlined readJoy1::$7 = (char *)APU
Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$3 = (char *)PPU
Constant inlined ppuDataFill::i#0 = 0
Constant inlined readJoy1::$8 = (char *)APU
Constant inlined vblank::ppuSpriteBufferDmaTransfer1_$4 = (char *)APU
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1)
Consolidated array index constant in *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1)
Consolidated array index constant in *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK)
Consolidated array index constant in *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ)
Consolidated array index constant in *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS)
Consolidated array index constant in *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL)
Consolidated array index constant in *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR)
Consolidated array index constant in *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA)
Successful SSA optimization Pass2ConstantAdditionElimination
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Eliminating unused constant SIZEOF_STRUCT_SPRITEDATA
Successful SSA optimization PassNEliminateUnusedVars
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Finalized unsigned number type (char) $40
Finalized unsigned number type (char) $20
Finalized unsigned number type (unsigned int) $100
Finalized unsigned number type (char) $59
Finalized unsigned number type (char) $ef
Finalized unsigned number type (unsigned int) $100
Finalized unsigned number type (unsigned int) $100
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $20
Finalized unsigned number type (char) $1e
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Alias candidate removed (volatile)x_sin_idx = vblank::$7 
Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 
Added new block during phi lifting main::@8(between main::initNES1_@1 and main::initNES1_@1)
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of __start::@2
Adding NOP phi() at start of vblank::@16
Adding NOP phi() at start of vblank::@5
Adding NOP phi() at start of vblank::@2
Adding NOP phi() at start of main
Adding NOP phi() at start of main::initNES1_waitForVBlank1
Adding NOP phi() at start of main::initNES1_@6
Adding NOP phi() at start of main::initNES1_waitForVBlank2
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of readJoy1::@3
Adding NOP phi() at start of ppuDataTransfer
Adding NOP phi() at start of ppuDataTransfer::@3
Adding NOP phi() at start of ppuDataFill::@3
Adding NOP phi() at start of ppuDataFill::@2
CALL GRAPH
Calls in [__start] to main:5 
Calls in [vblank] to readJoy1:13 
Calls in [main] to ppuDataTransfer:88 ppuDataFill:90 ppuDataFill:92 

Created 18 initial phi equivalence classes
Coalesced [22] vblank::$34 = vblank::$5
Coalesced [28] vblank::$35 = vblank::$10
Coalesced [32] vblank::y_idx#17 = vblank::y_idx#0
Coalesced [33] vblank::x_idx#13 = vblank::x_idx#0
Coalesced [34] vblank::x_idx_2#10 = vblank::x_idx_2#0
Coalesced [44] vblank::x_idx#15 = vblank::$17
Coalesced [48] vblank::x_idx_2#12 = vblank::$23
Coalesced [51] vblank::s#10 = vblank::s#1
Coalesced [52] vblank::y_idx#16 = vblank::y_idx#1
Coalesced [53] vblank::x_idx#12 = vblank::x_idx#1
Coalesced [54] vblank::x_idx_2#9 = vblank::x_idx_2#1
Coalesced [56] vblank::x_idx_2#11 = vblank::$25
Coalesced [58] vblank::x_idx#14 = vblank::$19
Coalesced [105] main::s#4 = main::s#1
Coalesced [106] main::initNES1_i#3 = main::initNES1_i#1
Coalesced [117] readJoy1::i#4 = readJoy1::i#1
Coalesced [118] readJoy1::joy#5 = readJoy1::joy#1
Coalesced [130] ppuDataTransfer::i#6 = ppuDataTransfer::i#1
Coalesced [131] ppuDataTransfer::cpuSrc#6 = ppuDataTransfer::cpuSrc#1
Coalesced [144] ppuDataFill::i#6 = ppuDataFill::i#1
Coalesced down to 16 phi equivalence classes
Culled Empty Block label __start::@2
Culled Empty Block label vblank::@5
Culled Empty Block label vblank::@2
Culled Empty Block label main::initNES1_@6
Culled Empty Block label main::@7
Culled Empty Block label main::@8
Culled Empty Block label readJoy1::@3
Culled Empty Block label ppuDataTransfer::@3
Culled Empty Block label ppuDataFill::@3
Culled Empty Block label ppuDataFill::@2
Renumbering block ppuDataFill::@4 to ppuDataFill::@2
Renumbering block ppuDataTransfer::@4 to ppuDataTransfer::@3
Renumbering block vblank::@3 to vblank::@2
Renumbering block vblank::@4 to vblank::@3
Renumbering block vblank::@6 to vblank::@4
Renumbering block vblank::@7 to vblank::@5
Renumbering block vblank::@8 to vblank::@6
Renumbering block vblank::@9 to vblank::@7
Renumbering block vblank::@10 to vblank::@8
Renumbering block vblank::@11 to vblank::@9
Renumbering block vblank::@12 to vblank::@10
Renumbering block vblank::@13 to vblank::@11
Renumbering block vblank::@14 to vblank::@12
Renumbering block vblank::@15 to vblank::@13
Renumbering block vblank::@16 to vblank::@14
Renumbering block vblank::@17 to vblank::@15
Adding NOP phi() at start of __start
Adding NOP phi() at start of __start::@1
Adding NOP phi() at start of vblank::@14
Adding NOP phi() at start of main
Adding NOP phi() at start of main::initNES1_waitForVBlank1
Adding NOP phi() at start of main::initNES1_waitForVBlank2
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of ppuDataTransfer

FINAL CONTROL FLOW GRAPH

void __start()
__start: scope:[__start]  from
  [0] phi()
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  [1] y_sin_idx = 0
  [2] x_sin_idx = $49
  [3] x_sin_idx_2 = $52
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  [4] phi()
  [5] call main
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  [6] return 
  to:@return

__interrupt(hardware_all) void vblank()
vblank: scope:[vblank]  from
  [7] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0
  [8] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0
  to:vblank::ppuSpriteBufferDmaTransfer1
vblank::ppuSpriteBufferDmaTransfer1: scope:[vblank]  from vblank
  [9] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) = 0
  [10] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) = byte1 SPRITE_BUFFER
  to:vblank::@14
vblank::@14: scope:[vblank]  from vblank::ppuSpriteBufferDmaTransfer1
  [11] phi()
  [12] call readJoy1
  [13] readJoy1::return#2 = readJoy1::joy#2
  to:vblank::@15
vblank::@15: scope:[vblank]  from vblank::@14
  [14] vblank::joy#0 = readJoy1::return#2
  [15] if(0==vblank::joy#0) goto vblank::@1
  to:vblank::@return
vblank::@return: scope:[vblank]  from vblank::@15 vblank::@6
  [16] return 
  to:@return
vblank::@1: scope:[vblank]  from vblank::@15
  [17] vblank::y_idx#0 = y_sin_idx
  [18] y_sin_idx = ++ y_sin_idx
  [19] if(x_sin_idx==$ee) goto vblank::@3
  to:vblank::@2
vblank::@2: scope:[vblank]  from vblank::@1
  [20] vblank::$5 = x_sin_idx + 1
  to:vblank::@3
vblank::@3: scope:[vblank]  from vblank::@1 vblank::@2
  [21] vblank::$7 = phi( vblank::@1/0, vblank::@2/vblank::$5 )
  [22] x_sin_idx = vblank::$7
  [23] vblank::x_idx#0 = x_sin_idx
  [24] if(x_sin_idx_2==$58) goto vblank::@5
  to:vblank::@4
vblank::@4: scope:[vblank]  from vblank::@3
  [25] vblank::$10 = x_sin_idx_2 + 1
  to:vblank::@5
vblank::@5: scope:[vblank]  from vblank::@3 vblank::@4
  [26] vblank::$12 = phi( vblank::@3/0, vblank::@4/vblank::$10 )
  [27] x_sin_idx_2 = vblank::$12
  [28] vblank::x_idx_2#0 = x_sin_idx_2
  to:vblank::@6
vblank::@6: scope:[vblank]  from vblank::@13 vblank::@5
  [29] vblank::x_idx_2#2 = phi( vblank::@13/vblank::x_idx_2#1, vblank::@5/vblank::x_idx_2#0 )
  [29] vblank::x_idx#2 = phi( vblank::@13/vblank::x_idx#1, vblank::@5/vblank::x_idx#0 )
  [29] vblank::y_idx#2 = phi( vblank::@13/vblank::y_idx#1, vblank::@5/vblank::y_idx#0 )
  [29] vblank::s#2 = phi( vblank::@13/vblank::s#1, vblank::@5/0 )
  [30] if(vblank::s#2<$40) goto vblank::@7
  to:vblank::@return
vblank::@7: scope:[vblank]  from vblank::@6
  [31] vblank::$28 = vblank::s#2 << 2
  [32] ((char *)SPRITE_BUFFER)[vblank::$28] = SINTABLE_240[vblank::y_idx#2]
  [33] vblank::y_idx#1 = vblank::y_idx#2 - 4
  [34] vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2]
  [35] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[vblank::$28] = vblank::$14
  [36] if(vblank::x_idx#2<3) goto vblank::@8
  to:vblank::@9
vblank::@9: scope:[vblank]  from vblank::@7
  [37] vblank::$17 = vblank::x_idx#2 - 3
  to:vblank::@10
vblank::@10: scope:[vblank]  from vblank::@8 vblank::@9
  [38] vblank::x_idx#1 = phi( vblank::@8/vblank::$19, vblank::@9/vblank::$17 )
  [39] if(vblank::x_idx_2#2>=$56) goto vblank::@11
  to:vblank::@12
vblank::@12: scope:[vblank]  from vblank::@10
  [40] vblank::$23 = vblank::x_idx_2#2 + 3
  to:vblank::@13
vblank::@13: scope:[vblank]  from vblank::@11 vblank::@12
  [41] vblank::x_idx_2#1 = phi( vblank::@11/vblank::$25, vblank::@12/vblank::$23 )
  [42] vblank::s#1 = ++ vblank::s#2
  to:vblank::@6
vblank::@11: scope:[vblank]  from vblank::@10
  [43] vblank::$25 = vblank::x_idx_2#2 - $56
  to:vblank::@13
vblank::@8: scope:[vblank]  from vblank::@7
  [44] vblank::$19 = vblank::x_idx#2 + $ec
  to:vblank::@10

void main()
main: scope:[main]  from __start::@1
  [45] phi()
  to:main::initNES1
main::initNES1: scope:[main]  from main
  asm { cld ldx#$ff txs  }
  to:main::initNES1_disableVideoOutput1
main::initNES1_disableVideoOutput1: scope:[main]  from main::initNES1
  [47] *((char *)PPU) = 0
  [48] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = 0
  to:main::initNES1_disableAudioOutput1
main::initNES1_disableAudioOutput1: scope:[main]  from main::initNES1_disableVideoOutput1
  [49] *FR_COUNTER = $40
  [50] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) = $40
  to:main::initNES1_clearVBlankFlag1
main::initNES1_clearVBlankFlag1: scope:[main]  from main::initNES1_disableAudioOutput1
  asm { ldaPPU_PPUSTATUS  }
  to:main::initNES1_waitForVBlank1
main::initNES1_waitForVBlank1: scope:[main]  from main::initNES1_clearVBlankFlag1
  [52] phi()
  to:main::initNES1_waitForVBlank1_@1
main::initNES1_waitForVBlank1_@1: scope:[main]  from main::initNES1_waitForVBlank1 main::initNES1_waitForVBlank1_@1
  [53] main::initNES1_waitForVBlank1_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80
  [54] if(0==main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1
  to:main::initNES1_@1
main::initNES1_@1: scope:[main]  from main::initNES1_@1 main::initNES1_waitForVBlank1_@1
  [55] main::initNES1_i#2 = phi( main::initNES1_@1/main::initNES1_i#1, main::initNES1_waitForVBlank1_@1/0 )
  [56] MEMORY[main::initNES1_i#2] = 0
  [57] (MEMORY+$100)[main::initNES1_i#2] = 0
  [58] (MEMORY+$200)[main::initNES1_i#2] = 0
  [59] (MEMORY+$300)[main::initNES1_i#2] = 0
  [60] (MEMORY+$400)[main::initNES1_i#2] = 0
  [61] (MEMORY+$500)[main::initNES1_i#2] = 0
  [62] (MEMORY+$600)[main::initNES1_i#2] = 0
  [63] (MEMORY+$700)[main::initNES1_i#2] = 0
  [64] main::initNES1_i#1 = ++ main::initNES1_i#2
  [65] if(0!=main::initNES1_i#1) goto main::initNES1_@1
  to:main::initNES1_waitForVBlank2
main::initNES1_waitForVBlank2: scope:[main]  from main::initNES1_@1
  [66] phi()
  to:main::initNES1_waitForVBlank2_@1
main::initNES1_waitForVBlank2_@1: scope:[main]  from main::initNES1_waitForVBlank2 main::initNES1_waitForVBlank2_@1
  [67] main::initNES1_waitForVBlank2_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80
  [68] if(0==main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1
  to:main::initNES1_@7
main::initNES1_@7: scope:[main]  from main::initNES1_waitForVBlank2_@1
  asm { ldaPPU_PPUSTATUS  }
  to:main::@4
main::@4: scope:[main]  from main::initNES1_@7
  [70] phi()
  [71] call ppuDataTransfer
  to:main::@5
main::@5: scope:[main]  from main::@4
  [72] phi()
  [73] call ppuDataFill
  to:main::@6
main::@6: scope:[main]  from main::@5
  [74] phi()
  [75] call ppuDataFill
  to:main::@1
main::@1: scope:[main]  from main::@2 main::@6
  [76] main::s#2 = phi( main::@2/main::s#1, main::@6/0 )
  [77] if(main::s#2<$40) goto main::@2
  to:main::enableVideoOutput1
main::enableVideoOutput1: scope:[main]  from main::@1
  [78] *((char *)PPU) = $80
  [79] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = $1e
  to:main::@3
main::@3: scope:[main]  from main::@3 main::enableVideoOutput1
  [80] phi()
  to:main::@3
main::@2: scope:[main]  from main::@1
  [81] main::$7 = main::s#2 << 2
  [82] ((char *)SPRITE_BUFFER)[main::$7] = 0
  [83] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#2]
  [84] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2
  [85] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0
  [86] main::s#1 = ++ main::s#2
  to:main::@1

char readJoy1()
readJoy1: scope:[readJoy1]  from vblank::@14
  [87] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 1
  [88] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 0
  to:readJoy1::@1
readJoy1::@1: scope:[readJoy1]  from readJoy1 readJoy1::@2
  [89] readJoy1::joy#2 = phi( readJoy1/0, readJoy1::@2/readJoy1::joy#1 )
  [89] readJoy1::i#2 = phi( readJoy1/0, readJoy1::@2/readJoy1::i#1 )
  [90] if(readJoy1::i#2<8) goto readJoy1::@2
  to:readJoy1::@return
readJoy1::@return: scope:[readJoy1]  from readJoy1::@1
  [91] return 
  to:@return
readJoy1::@2: scope:[readJoy1]  from readJoy1::@1
  [92] readJoy1::$1 = readJoy1::joy#2 << 1
  [93] readJoy1::$2 = *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) & 1
  [94] readJoy1::joy#1 = readJoy1::$1 | readJoy1::$2
  [95] readJoy1::i#1 = ++ readJoy1::i#2
  to:readJoy1::@1

void ppuDataTransfer(void * const ppuData , void * const cpuData , unsigned int size)
ppuDataTransfer: scope:[ppuDataTransfer]  from main::@4
  [96] phi()
  to:ppuDataTransfer::ppuDataPrepare1
ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer]  from ppuDataTransfer
  [97] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = byte1 ppuDataTransfer::ppuData#0
  [98] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = 0
  to:ppuDataTransfer::@1
ppuDataTransfer::@1: scope:[ppuDataTransfer]  from ppuDataTransfer::@3 ppuDataTransfer::ppuDataPrepare1
  [99] ppuDataTransfer::cpuSrc#2 = phi( ppuDataTransfer::ppuDataPrepare1/(char *)ppuDataTransfer::cpuData#0, ppuDataTransfer::@3/ppuDataTransfer::cpuSrc#1 )
  [99] ppuDataTransfer::i#2 = phi( ppuDataTransfer::ppuDataPrepare1/0, ppuDataTransfer::@3/ppuDataTransfer::i#1 )
  [100] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2
  to:ppuDataTransfer::@return
ppuDataTransfer::@return: scope:[ppuDataTransfer]  from ppuDataTransfer::@1
  [101] return 
  to:@return
ppuDataTransfer::@2: scope:[ppuDataTransfer]  from ppuDataTransfer::@1
  [102] ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2
  to:ppuDataTransfer::ppuDataPut1
ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer]  from ppuDataTransfer::@2
  [103] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataTransfer::ppuDataPut1_val#0
  to:ppuDataTransfer::@3
ppuDataTransfer::@3: scope:[ppuDataTransfer]  from ppuDataTransfer::ppuDataPut1
  [104] ppuDataTransfer::cpuSrc#1 = ++ ppuDataTransfer::cpuSrc#2
  [105] ppuDataTransfer::i#1 = ++ ppuDataTransfer::i#2
  to:ppuDataTransfer::@1

void ppuDataFill(void * const ppuData , char val , unsigned int size)
ppuDataFill: scope:[ppuDataFill]  from main::@5 main::@6
  [106] ppuDataFill::val#4 = phi( main::@5/'*', main::@6/0 )
  [106] ppuDataFill::size#3 = phi( main::@5/(unsigned int)$20*$1e, main::@6/$40 )
  [106] ppuDataFill::ppuDataPrepare1_ppuData#0 = phi( main::@5/(void * const )PPU_NAME_TABLE_0, main::@6/(void * const )PPU_ATTRIBUTE_TABLE_0 )
  to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill]  from ppuDataFill
  [107] ppuDataFill::ppuDataPrepare1_$0 = byte1  ppuDataFill::ppuDataPrepare1_ppuData#0
  [108] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$0
  [109] ppuDataFill::ppuDataPrepare1_$1 = byte0  ppuDataFill::ppuDataPrepare1_ppuData#0
  [110] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$1
  to:ppuDataFill::@1
ppuDataFill::@1: scope:[ppuDataFill]  from ppuDataFill::@2 ppuDataFill::ppuDataPrepare1
  [111] ppuDataFill::i#2 = phi( ppuDataFill::ppuDataPrepare1/0, ppuDataFill::@2/ppuDataFill::i#1 )
  [112] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1
  to:ppuDataFill::@return
ppuDataFill::@return: scope:[ppuDataFill]  from ppuDataFill::@1
  [113] return 
  to:@return
ppuDataFill::ppuDataPut1: scope:[ppuDataFill]  from ppuDataFill::@1
  [114] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataFill::val#4
  to:ppuDataFill::@2
ppuDataFill::@2: scope:[ppuDataFill]  from ppuDataFill::ppuDataPut1
  [115] ppuDataFill::i#1 = ++ ppuDataFill::i#2
  to:ppuDataFill::@1


VARIABLE REGISTER WEIGHTS
void __start()
void main()
char main::$7 // 126.25
char main::initNES1_i
char main::initNES1_i#1 // 151.5
char main::initNES1_i#2 // 112.22222222222223
char main::initNES1_waitForVBlank1_$0 // 202.0
char main::initNES1_waitForVBlank2_$0 // 202.0
char main::s
char main::s#1 // 202.0
char main::s#2 // 72.14285714285714
void ppuDataFill(void * const ppuData , char val , unsigned int size)
unsigned int ppuDataFill::i
unsigned int ppuDataFill::i#1 // 2002.0
unsigned int ppuDataFill::i#2 // 1001.0
void * const ppuDataFill::ppuData
char ppuDataFill::ppuDataPrepare1_$0 // 202.0
char ppuDataFill::ppuDataPrepare1_$1 // 202.0
void * const ppuDataFill::ppuDataPrepare1_ppuData
void * const ppuDataFill::ppuDataPrepare1_ppuData#0 // 67.33333333333333
char ppuDataFill::ppuDataPut1_val
unsigned int ppuDataFill::size
unsigned int ppuDataFill::size#3 // 111.22222222222223
char ppuDataFill::val
char ppuDataFill::val#4 // 111.22222222222223
void ppuDataTransfer(void * const ppuData , void * const cpuData , unsigned int size)
void * const ppuDataTransfer::cpuData
char *ppuDataTransfer::cpuSrc
char *ppuDataTransfer::cpuSrc#1 // 1001.0
char *ppuDataTransfer::cpuSrc#2 // 750.75
unsigned int ppuDataTransfer::i
unsigned int ppuDataTransfer::i#1 // 2002.0
unsigned int ppuDataTransfer::i#2 // 600.5999999999999
void * const ppuDataTransfer::ppuData
void * const ppuDataTransfer::ppuDataPrepare1_ppuData
char ppuDataTransfer::ppuDataPut1_val
char ppuDataTransfer::ppuDataPut1_val#0 // 2002.0
unsigned int ppuDataTransfer::size
char readJoy1()
char readJoy1::$1 // 101.0
char readJoy1::$2 // 202.0
char readJoy1::i
char readJoy1::i#1 // 202.0
char readJoy1::i#2 // 60.599999999999994
char readJoy1::joy
char readJoy1::joy#1 // 101.0
char readJoy1::joy#2 // 51.0
char readJoy1::return
char readJoy1::return#2 // 4.0
__interrupt(hardware_all) void vblank()
char vblank::$10 // 4.0
char vblank::$12 // 4.0
char vblank::$14 // 22.0
char vblank::$17 // 22.0
char vblank::$19 // 22.0
char vblank::$23 // 22.0
char vblank::$25 // 22.0
char vblank::$28 // 8.25
char vblank::$5 // 4.0
char vblank::$7 // 4.0
char vblank::joy
char vblank::joy#0 // 4.0
struct SpriteData *vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer
char vblank::s
char vblank::s#1 // 22.0
char vblank::s#2 // 2.933333333333333
char vblank::x_idx
char vblank::x_idx#0 // 0.6666666666666666
char vblank::x_idx#1 // 5.5
char vblank::x_idx#2 // 7.125
char vblank::x_idx_2
char vblank::x_idx_2#0 // 4.0
char vblank::x_idx_2#1 // 16.5
char vblank::x_idx_2#2 // 4.75
char vblank::y_idx
char vblank::y_idx#0 // 0.3333333333333333
char vblank::y_idx#1 // 1.8333333333333333
char vblank::y_idx#2 // 8.75
__loadstore volatile char x_sin_idx // 0.7692307692307693
__loadstore volatile char x_sin_idx_2 // 0.5555555555555556
__loadstore volatile char y_sin_idx // 0.8

Initial phi equivalence classes
[ vblank::$7 vblank::$5 ]
[ vblank::$12 vblank::$10 ]
[ vblank::s#2 vblank::s#1 ]
[ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
[ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
[ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
[ main::initNES1_i#2 main::initNES1_i#1 ]
[ main::s#2 main::s#1 ]
[ readJoy1::i#2 readJoy1::i#1 ]
[ readJoy1::joy#2 readJoy1::joy#1 ]
[ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
[ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ]
[ ppuDataFill::ppuDataPrepare1_ppuData#0 ]
[ ppuDataFill::size#3 ]
[ ppuDataFill::val#4 ]
[ ppuDataFill::i#2 ppuDataFill::i#1 ]
Added variable y_sin_idx to live range equivalence class [ y_sin_idx ]
Added variable x_sin_idx to live range equivalence class [ x_sin_idx ]
Added variable x_sin_idx_2 to live range equivalence class [ x_sin_idx_2 ]
Added variable readJoy1::return#2 to live range equivalence class [ readJoy1::return#2 ]
Added variable vblank::joy#0 to live range equivalence class [ vblank::joy#0 ]
Added variable vblank::$28 to live range equivalence class [ vblank::$28 ]
Added variable vblank::$14 to live range equivalence class [ vblank::$14 ]
Added variable main::initNES1_waitForVBlank1_$0 to live range equivalence class [ main::initNES1_waitForVBlank1_$0 ]
Added variable main::initNES1_waitForVBlank2_$0 to live range equivalence class [ main::initNES1_waitForVBlank2_$0 ]
Added variable main::$7 to live range equivalence class [ main::$7 ]
Added variable readJoy1::$1 to live range equivalence class [ readJoy1::$1 ]
Added variable readJoy1::$2 to live range equivalence class [ readJoy1::$2 ]
Added variable ppuDataTransfer::ppuDataPut1_val#0 to live range equivalence class [ ppuDataTransfer::ppuDataPut1_val#0 ]
Added variable ppuDataFill::ppuDataPrepare1_$0 to live range equivalence class [ ppuDataFill::ppuDataPrepare1_$0 ]
Added variable ppuDataFill::ppuDataPrepare1_$1 to live range equivalence class [ ppuDataFill::ppuDataPrepare1_$1 ]
Complete equivalence classes
[ vblank::$7 vblank::$5 ]
[ vblank::$12 vblank::$10 ]
[ vblank::s#2 vblank::s#1 ]
[ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
[ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
[ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
[ main::initNES1_i#2 main::initNES1_i#1 ]
[ main::s#2 main::s#1 ]
[ readJoy1::i#2 readJoy1::i#1 ]
[ readJoy1::joy#2 readJoy1::joy#1 ]
[ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
[ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ]
[ ppuDataFill::ppuDataPrepare1_ppuData#0 ]
[ ppuDataFill::size#3 ]
[ ppuDataFill::val#4 ]
[ ppuDataFill::i#2 ppuDataFill::i#1 ]
[ y_sin_idx ]
[ x_sin_idx ]
[ x_sin_idx_2 ]
[ readJoy1::return#2 ]
[ vblank::joy#0 ]
[ vblank::$28 ]
[ vblank::$14 ]
[ main::initNES1_waitForVBlank1_$0 ]
[ main::initNES1_waitForVBlank2_$0 ]
[ main::$7 ]
[ readJoy1::$1 ]
[ readJoy1::$2 ]
[ ppuDataTransfer::ppuDataPut1_val#0 ]
[ ppuDataFill::ppuDataPrepare1_$0 ]
[ ppuDataFill::ppuDataPrepare1_$1 ]
Allocated zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ]
Allocated zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
Allocated zp[1]:6 [ ppuDataTransfer::ppuDataPut1_val#0 ]
Allocated zp[2]:7 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ]
Allocated zp[1]:9 [ main::s#2 main::s#1 ]
Allocated zp[1]:10 [ main::initNES1_i#2 main::initNES1_i#1 ]
Allocated zp[1]:11 [ readJoy1::i#2 readJoy1::i#1 ]
Allocated zp[1]:12 [ main::initNES1_waitForVBlank1_$0 ]
Allocated zp[1]:13 [ main::initNES1_waitForVBlank2_$0 ]
Allocated zp[1]:14 [ readJoy1::$2 ]
Allocated zp[1]:15 [ ppuDataFill::ppuDataPrepare1_$0 ]
Allocated zp[1]:16 [ ppuDataFill::ppuDataPrepare1_$1 ]
Allocated zp[1]:17 [ readJoy1::joy#2 readJoy1::joy#1 ]
Allocated zp[1]:18 [ main::$7 ]
Allocated zp[2]:19 [ ppuDataFill::size#3 ]
Allocated zp[1]:21 [ ppuDataFill::val#4 ]
Allocated zp[1]:22 [ readJoy1::$1 ]
Allocated zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
Allocated zp[2]:24 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ]
Allocated zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
Allocated zp[1]:27 [ vblank::s#2 vblank::s#1 ]
Allocated zp[1]:28 [ vblank::$14 ]
Allocated zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
Allocated zp[1]:30 [ vblank::$28 ]
Allocated zp[1]:31 [ vblank::$7 vblank::$5 ]
Allocated zp[1]:32 [ vblank::$12 vblank::$10 ]
Allocated zp[1]:33 [ readJoy1::return#2 ]
Allocated zp[1]:34 [ vblank::joy#0 ]
Allocated zp[1]:35 [ y_sin_idx ]
Allocated zp[1]:36 [ x_sin_idx ]
Allocated zp[1]:37 [ x_sin_idx_2 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] y_sin_idx = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] x_sin_idx = $49 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] x_sin_idx_2 = $52 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [8] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [9] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [10] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) = byte1 SPRITE_BUFFER [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [16] return  [ ] (  [ ] { }  ) always clobbers reg byte a reg byte x reg byte y 
Statement [19] if(x_sin_idx==$ee) goto vblank::@3 [ x_sin_idx x_sin_idx_2 vblank::y_idx#0 ] (  [ x_sin_idx x_sin_idx_2 vblank::y_idx#0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
Statement [24] if(x_sin_idx_2==$58) goto vblank::@5 [ x_sin_idx_2 vblank::y_idx#0 vblank::x_idx#0 ] (  [ x_sin_idx_2 vblank::y_idx#0 vblank::x_idx#0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
Statement [31] vblank::$28 = vblank::s#2 << 2 [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] (  [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:27 [ vblank::s#2 vblank::s#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
Statement [32] ((char *)SPRITE_BUFFER)[vblank::$28] = SINTABLE_240[vblank::y_idx#2] [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] (  [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:30 [ vblank::$28 ]
Statement [33] vblank::y_idx#1 = vblank::y_idx#2 - 4 [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 ] (  [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 ] { }  ) always clobbers reg byte a 
Statement [34] vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2] [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 vblank::$14 ] (  [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 vblank::$14 ] { }  ) always clobbers reg byte a 
Statement [37] vblank::$17 = vblank::x_idx#2 - 3 [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$17 ] (  [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$17 ] { }  ) always clobbers reg byte a 
Statement [40] vblank::$23 = vblank::x_idx_2#2 + 3 [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$23 ] (  [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$23 ] { }  ) always clobbers reg byte a 
Statement [43] vblank::$25 = vblank::x_idx_2#2 - $56 [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$25 ] (  [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$25 ] { }  ) always clobbers reg byte a 
Statement [44] vblank::$19 = vblank::x_idx#2 + $ec [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$19 ] (  [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$19 ] { }  ) always clobbers reg byte a 
Statement asm { cld ldx#$ff txs  } always clobbers reg byte x 
Statement [47] *((char *)PPU) = 0 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [48] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = 0 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [49] *FR_COUNTER = $40 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [50] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) = $40 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement asm { ldaPPU_PPUSTATUS  } always clobbers reg byte a 
Statement [53] main::initNES1_waitForVBlank1_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 [ main::initNES1_waitForVBlank1_$0 ] (  [ main::initNES1_waitForVBlank1_$0 ] { }  main:5 [ main::initNES1_waitForVBlank1_$0 ] { }  ) always clobbers reg byte a 
Statement [56] MEMORY[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:10 [ main::initNES1_i#2 main::initNES1_i#1 ]
Statement [57] (MEMORY+$100)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [58] (MEMORY+$200)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [59] (MEMORY+$300)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [60] (MEMORY+$400)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [61] (MEMORY+$500)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [62] (MEMORY+$600)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [63] (MEMORY+$700)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [67] main::initNES1_waitForVBlank2_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 [ main::initNES1_waitForVBlank2_$0 ] (  [ main::initNES1_waitForVBlank2_$0 ] { }  main:5 [ main::initNES1_waitForVBlank2_$0 ] { }  ) always clobbers reg byte a 
Statement asm { ldaPPU_PPUSTATUS  } always clobbers reg byte a 
Statement [78] *((char *)PPU) = $80 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [79] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = $1e [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [81] main::$7 = main::s#2 << 2 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:9 [ main::s#2 main::s#1 ]
Statement [82] ((char *)SPRITE_BUFFER)[main::$7] = 0 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:18 [ main::$7 ]
Statement [83] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#2] [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [84] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [85] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0 [ main::s#2 ] (  [ main::s#2 ] { }  main:5 [ main::s#2 ] { }  ) always clobbers reg byte a 
Statement [87] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 1 [ ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [88] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 0 [ ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [92] readJoy1::$1 = readJoy1::joy#2 << 1 [ readJoy1::i#2 readJoy1::$1 ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 readJoy1::i#2 readJoy1::$1 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:11 [ readJoy1::i#2 readJoy1::i#1 ]
Statement [93] readJoy1::$2 = *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) & 1 [ readJoy1::i#2 readJoy1::$1 readJoy1::$2 ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 readJoy1::i#2 readJoy1::$1 readJoy1::$2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:22 [ readJoy1::$1 ]
Statement [97] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = byte1 ppuDataTransfer::ppuData#0 [ ] ( ppuDataTransfer:71 [ ] { }  main:5::ppuDataTransfer:71 [ ] { }  ) always clobbers reg byte a 
Statement [98] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = 0 [ ] ( ppuDataTransfer:71 [ ] { }  main:5::ppuDataTransfer:71 [ ] { }  ) always clobbers reg byte a 
Statement [100] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] ( ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { }  main:5::ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { }  ) always clobbers reg byte a 
Statement [102] ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] ( ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { }  main:5::ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { }  ) always clobbers reg byte a reg byte y 
Statement [112] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] ( ppuDataFill:73 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  main:5::ppuDataFill:73 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  ppuDataFill:75 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  main:5::ppuDataFill:75 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:21 [ ppuDataFill::val#4 ]
Statement [1] y_sin_idx = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] x_sin_idx = $49 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] x_sin_idx_2 = $52 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [8] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [9] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) = 0 [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [10] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) = byte1 SPRITE_BUFFER [ y_sin_idx x_sin_idx x_sin_idx_2 ] (  [ y_sin_idx x_sin_idx x_sin_idx_2 ] { }  ) always clobbers reg byte a 
Statement [16] return  [ ] (  [ ] { }  ) always clobbers reg byte a reg byte x reg byte y 
Statement [19] if(x_sin_idx==$ee) goto vblank::@3 [ x_sin_idx x_sin_idx_2 vblank::y_idx#0 ] (  [ x_sin_idx x_sin_idx_2 vblank::y_idx#0 ] { }  ) always clobbers reg byte a 
Statement [24] if(x_sin_idx_2==$58) goto vblank::@5 [ x_sin_idx_2 vblank::y_idx#0 vblank::x_idx#0 ] (  [ x_sin_idx_2 vblank::y_idx#0 vblank::x_idx#0 ] { }  ) always clobbers reg byte a 
Statement [31] vblank::$28 = vblank::s#2 << 2 [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] (  [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] { }  ) always clobbers reg byte a 
Statement [32] ((char *)SPRITE_BUFFER)[vblank::$28] = SINTABLE_240[vblank::y_idx#2] [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] (  [ vblank::s#2 vblank::y_idx#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::$28 ] { }  ) always clobbers reg byte a 
Statement [33] vblank::y_idx#1 = vblank::y_idx#2 - 4 [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 ] (  [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 ] { }  ) always clobbers reg byte a 
Statement [34] vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2] [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 vblank::$14 ] (  [ vblank::s#2 vblank::x_idx#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$28 vblank::$14 ] { }  ) always clobbers reg byte a 
Statement [37] vblank::$17 = vblank::x_idx#2 - 3 [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$17 ] (  [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$17 ] { }  ) always clobbers reg byte a 
Statement [40] vblank::$23 = vblank::x_idx_2#2 + 3 [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$23 ] (  [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$23 ] { }  ) always clobbers reg byte a 
Statement [43] vblank::$25 = vblank::x_idx_2#2 - $56 [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$25 ] (  [ vblank::s#2 vblank::y_idx#1 vblank::x_idx#1 vblank::$25 ] { }  ) always clobbers reg byte a 
Statement [44] vblank::$19 = vblank::x_idx#2 + $ec [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$19 ] (  [ vblank::s#2 vblank::x_idx_2#2 vblank::y_idx#1 vblank::$19 ] { }  ) always clobbers reg byte a 
Statement asm { cld ldx#$ff txs  } always clobbers reg byte x 
Statement [47] *((char *)PPU) = 0 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [48] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = 0 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [49] *FR_COUNTER = $40 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [50] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) = $40 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement asm { ldaPPU_PPUSTATUS  } always clobbers reg byte a 
Statement [53] main::initNES1_waitForVBlank1_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 [ main::initNES1_waitForVBlank1_$0 ] (  [ main::initNES1_waitForVBlank1_$0 ] { }  main:5 [ main::initNES1_waitForVBlank1_$0 ] { }  ) always clobbers reg byte a 
Statement [56] MEMORY[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [57] (MEMORY+$100)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [58] (MEMORY+$200)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [59] (MEMORY+$300)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [60] (MEMORY+$400)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [61] (MEMORY+$500)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [62] (MEMORY+$600)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [63] (MEMORY+$700)[main::initNES1_i#2] = 0 [ main::initNES1_i#2 ] (  [ main::initNES1_i#2 ] { }  main:5 [ main::initNES1_i#2 ] { }  ) always clobbers reg byte a 
Statement [67] main::initNES1_waitForVBlank2_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 [ main::initNES1_waitForVBlank2_$0 ] (  [ main::initNES1_waitForVBlank2_$0 ] { }  main:5 [ main::initNES1_waitForVBlank2_$0 ] { }  ) always clobbers reg byte a 
Statement asm { ldaPPU_PPUSTATUS  } always clobbers reg byte a 
Statement [78] *((char *)PPU) = $80 [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [79] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = $1e [ ] (  [ ] { }  main:5 [ ] { }  ) always clobbers reg byte a 
Statement [81] main::$7 = main::s#2 << 2 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [82] ((char *)SPRITE_BUFFER)[main::$7] = 0 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [83] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#2] [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [84] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2 [ main::s#2 main::$7 ] (  [ main::s#2 main::$7 ] { }  main:5 [ main::s#2 main::$7 ] { }  ) always clobbers reg byte a 
Statement [85] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0 [ main::s#2 ] (  [ main::s#2 ] { }  main:5 [ main::s#2 ] { }  ) always clobbers reg byte a 
Statement [87] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 1 [ ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [88] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 0 [ ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [92] readJoy1::$1 = readJoy1::joy#2 << 1 [ readJoy1::i#2 readJoy1::$1 ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 readJoy1::i#2 readJoy1::$1 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [93] readJoy1::$2 = *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) & 1 [ readJoy1::i#2 readJoy1::$1 readJoy1::$2 ] ( readJoy1:12 [ y_sin_idx x_sin_idx x_sin_idx_2 readJoy1::i#2 readJoy1::$1 readJoy1::$2 ] { { readJoy1::return#2 = readJoy1::joy#2 } }  ) always clobbers reg byte a 
Statement [97] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = byte1 ppuDataTransfer::ppuData#0 [ ] ( ppuDataTransfer:71 [ ] { }  main:5::ppuDataTransfer:71 [ ] { }  ) always clobbers reg byte a 
Statement [98] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = 0 [ ] ( ppuDataTransfer:71 [ ] { }  main:5::ppuDataTransfer:71 [ ] { }  ) always clobbers reg byte a 
Statement [100] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] ( ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { }  main:5::ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ] { }  ) always clobbers reg byte a 
Statement [102] ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] ( ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { }  main:5::ppuDataTransfer:71 [ ppuDataTransfer::i#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::ppuDataPut1_val#0 ] { }  ) always clobbers reg byte a reg byte y 
Statement [112] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] ( ppuDataFill:73 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  main:5::ppuDataFill:73 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  ppuDataFill:75 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  main:5::ppuDataFill:75 [ ppuDataFill::size#3 ppuDataFill::val#4 ppuDataFill::i#2 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:31 [ vblank::$7 vblank::$5 ] : zp[1]:31 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:32 [ vblank::$12 vblank::$10 ] : zp[1]:32 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:27 [ vblank::s#2 vblank::s#1 ] : zp[1]:27 , reg byte x , reg byte y , 
Potential registers zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ] : zp[1]:29 , reg byte x , reg byte y , 
Potential registers zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ] : zp[1]:26 , reg byte x , reg byte y , 
Potential registers zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ] : zp[1]:23 , reg byte x , reg byte y , 
Potential registers zp[1]:10 [ main::initNES1_i#2 main::initNES1_i#1 ] : zp[1]:10 , reg byte x , reg byte y , 
Potential registers zp[1]:9 [ main::s#2 main::s#1 ] : zp[1]:9 , reg byte x , reg byte y , 
Potential registers zp[1]:11 [ readJoy1::i#2 readJoy1::i#1 ] : zp[1]:11 , reg byte x , reg byte y , 
Potential registers zp[1]:17 [ readJoy1::joy#2 readJoy1::joy#1 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] : zp[2]:4 , 
Potential registers zp[2]:7 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] : zp[2]:7 , 
Potential registers zp[2]:24 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] : zp[2]:24 , 
Potential registers zp[2]:19 [ ppuDataFill::size#3 ] : zp[2]:19 , 
Potential registers zp[1]:21 [ ppuDataFill::val#4 ] : zp[1]:21 , reg byte x , reg byte y , 
Potential registers zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ] : zp[2]:2 , 
Potential registers zp[1]:35 [ y_sin_idx ] : zp[1]:35 , 
Potential registers zp[1]:36 [ x_sin_idx ] : zp[1]:36 , 
Potential registers zp[1]:37 [ x_sin_idx_2 ] : zp[1]:37 , 
Potential registers zp[1]:33 [ readJoy1::return#2 ] : zp[1]:33 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:34 [ vblank::joy#0 ] : zp[1]:34 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:30 [ vblank::$28 ] : zp[1]:30 , reg byte x , reg byte y , 
Potential registers zp[1]:28 [ vblank::$14 ] : zp[1]:28 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:12 [ main::initNES1_waitForVBlank1_$0 ] : zp[1]:12 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:13 [ main::initNES1_waitForVBlank2_$0 ] : zp[1]:13 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:18 [ main::$7 ] : zp[1]:18 , reg byte x , reg byte y , 
Potential registers zp[1]:22 [ readJoy1::$1 ] : zp[1]:22 , reg byte x , reg byte y , 
Potential registers zp[1]:14 [ readJoy1::$2 ] : zp[1]:14 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:6 [ ppuDataTransfer::ppuDataPut1_val#0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:15 [ ppuDataFill::ppuDataPrepare1_$0 ] : zp[1]:15 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:16 [ ppuDataFill::ppuDataPrepare1_$1 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [ppuDataTransfer] 2,602.6: zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] 2,002: zp[1]:6 [ ppuDataTransfer::ppuDataPut1_val#0 ] 1,751.75: zp[2]:7 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] 
Uplift Scope [ppuDataFill] 3,003: zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ] 202: zp[1]:15 [ ppuDataFill::ppuDataPrepare1_$0 ] 202: zp[1]:16 [ ppuDataFill::ppuDataPrepare1_$1 ] 111.22: zp[2]:19 [ ppuDataFill::size#3 ] 111.22: zp[1]:21 [ ppuDataFill::val#4 ] 67.33: zp[2]:24 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] 
Uplift Scope [main] 274.14: zp[1]:9 [ main::s#2 main::s#1 ] 263.72: zp[1]:10 [ main::initNES1_i#2 main::initNES1_i#1 ] 202: zp[1]:12 [ main::initNES1_waitForVBlank1_$0 ] 202: zp[1]:13 [ main::initNES1_waitForVBlank2_$0 ] 126.25: zp[1]:18 [ main::$7 ] 
Uplift Scope [readJoy1] 262.6: zp[1]:11 [ readJoy1::i#2 readJoy1::i#1 ] 202: zp[1]:14 [ readJoy1::$2 ] 152: zp[1]:17 [ readJoy1::joy#2 readJoy1::joy#1 ] 101: zp[1]:22 [ readJoy1::$1 ] 4: zp[1]:33 [ readJoy1::return#2 ] 
Uplift Scope [vblank] 69.25: zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ] 57.29: zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ] 24.93: zp[1]:27 [ vblank::s#2 vblank::s#1 ] 22: zp[1]:28 [ vblank::$14 ] 10.92: zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ] 8.25: zp[1]:30 [ vblank::$28 ] 8: zp[1]:31 [ vblank::$7 vblank::$5 ] 8: zp[1]:32 [ vblank::$12 vblank::$10 ] 4: zp[1]:34 [ vblank::joy#0 ] 
Uplift Scope [] 0.8: zp[1]:35 [ y_sin_idx ] 0.77: zp[1]:36 [ x_sin_idx ] 0.56: zp[1]:37 [ x_sin_idx_2 ] 
Uplift Scope [RICOH_2C02] 
Uplift Scope [RICOH_2A03] 
Uplift Scope [SpriteData] 
Uplift Scope [__start] 

Uplifting [ppuDataTransfer] best 6775 combination zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] zp[2]:7 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] 
Uplifting [ppuDataFill] best 6727 combination zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] zp[2]:19 [ ppuDataFill::size#3 ] reg byte x [ ppuDataFill::val#4 ] zp[2]:24 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] 
Uplifting [main] best 6207 combination reg byte x [ main::s#2 main::s#1 ] reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] reg byte a [ main::initNES1_waitForVBlank1_$0 ] reg byte a [ main::initNES1_waitForVBlank2_$0 ] zp[1]:18 [ main::$7 ] 
Limited combination testing to 100 combinations of 432 possible.
Uplifting [readJoy1] best 5964 combination reg byte x [ readJoy1::i#2 readJoy1::i#1 ] reg byte a [ readJoy1::$2 ] reg byte a [ readJoy1::joy#2 readJoy1::joy#1 ] zp[1]:22 [ readJoy1::$1 ] zp[1]:33 [ readJoy1::return#2 ] 
Limited combination testing to 100 combinations of 576 possible.
Uplifting [vblank] best 5904 combination zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ] zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ] zp[1]:27 [ vblank::s#2 vblank::s#1 ] reg byte a [ vblank::$14 ] zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ] zp[1]:30 [ vblank::$28 ] zp[1]:31 [ vblank::$7 vblank::$5 ] zp[1]:32 [ vblank::$12 vblank::$10 ] zp[1]:34 [ vblank::joy#0 ] 
Limited combination testing to 100 combinations of 62208 possible.
Uplifting [] best 5904 combination zp[1]:35 [ y_sin_idx ] zp[1]:36 [ x_sin_idx ] zp[1]:37 [ x_sin_idx_2 ] 
Uplifting [RICOH_2C02] best 5904 combination 
Uplifting [RICOH_2A03] best 5904 combination 
Uplifting [SpriteData] best 5904 combination 
Uplifting [__start] best 5904 combination 
Attempting to uplift remaining variables inzp[1]:18 [ main::$7 ]
Uplifting [main] best 5774 combination reg byte y [ main::$7 ] 
Attempting to uplift remaining variables inzp[1]:22 [ readJoy1::$1 ]
Uplifting [readJoy1] best 5774 combination zp[1]:22 [ readJoy1::$1 ] 
Attempting to uplift remaining variables inzp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
Uplifting [vblank] best 5774 combination zp[1]:23 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ] 
Attempting to uplift remaining variables inzp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
Uplifting [vblank] best 5774 combination zp[1]:26 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ] 
Attempting to uplift remaining variables inzp[1]:27 [ vblank::s#2 vblank::s#1 ]
Uplifting [vblank] best 5774 combination zp[1]:27 [ vblank::s#2 vblank::s#1 ] 
Attempting to uplift remaining variables inzp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
Uplifting [vblank] best 5774 combination zp[1]:29 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ] 
Attempting to uplift remaining variables inzp[1]:30 [ vblank::$28 ]
Uplifting [vblank] best 5774 combination zp[1]:30 [ vblank::$28 ] 
Attempting to uplift remaining variables inzp[1]:31 [ vblank::$7 vblank::$5 ]
Uplifting [vblank] best 5765 combination reg byte x [ vblank::$7 vblank::$5 ] 
Attempting to uplift remaining variables inzp[1]:32 [ vblank::$12 vblank::$10 ]
Uplifting [vblank] best 5756 combination reg byte x [ vblank::$12 vblank::$10 ] 
Attempting to uplift remaining variables inzp[1]:33 [ readJoy1::return#2 ]
Uplifting [readJoy1] best 5750 combination reg byte a [ readJoy1::return#2 ] 
Attempting to uplift remaining variables inzp[1]:34 [ vblank::joy#0 ]
Uplifting [vblank] best 5746 combination reg byte a [ vblank::joy#0 ] 
Attempting to uplift remaining variables inzp[1]:35 [ y_sin_idx ]
Uplifting [] best 5746 combination zp[1]:35 [ y_sin_idx ] 
Attempting to uplift remaining variables inzp[1]:36 [ x_sin_idx ]
Uplifting [] best 5746 combination zp[1]:36 [ x_sin_idx ] 
Attempting to uplift remaining variables inzp[1]:37 [ x_sin_idx_2 ]
Uplifting [] best 5746 combination zp[1]:37 [ x_sin_idx_2 ] 
Coalescing zero page register [ zp[2]:24 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] ] with [ zp[2]:4 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] ]
Coalescing zero page register [ zp[2]:19 [ ppuDataFill::size#3 ] ] with [ zp[2]:7 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ] ]
Allocated (was zp[2]:24) zp[2]:4 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
Allocated (was zp[2]:19) zp[2]:6 [ ppuDataFill::size#3 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ]
Allocated (was zp[1]:22) zp[1]:8 [ readJoy1::$1 ]
Allocated (was zp[1]:23) zp[1]:9 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
Allocated (was zp[1]:26) zp[1]:10 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
Allocated (was zp[1]:27) zp[1]:11 [ vblank::s#2 vblank::s#1 ]
Allocated (was zp[1]:29) zp[1]:12 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
Allocated (was zp[1]:30) zp[1]:13 [ vblank::$28 ]
Allocated (was zp[1]:35) zp[1]:14 [ y_sin_idx ]
Allocated (was zp[1]:36) zp[1]:15 [ x_sin_idx ]
Allocated (was zp[1]:37) zp[1]:16 [ x_sin_idx_2 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// NES DXYCP using sprites
/// @file
/// Nintendo Entertainment System (NES
///
/// https://en.wikipedia.org/wiki/Nintendo_Entertainment_System_(Model_NES-101)
/// https://github.com/gregkrsak/first_nes
/// @file
/// Ricoh 2C02 - NES Picture Processing Unit (PPU)
///
/// Ricoh RP2C02 (NTSC version) / RP2C07 (PAL version),
/// https://en.wikipedia.org/wiki/Picture_Processing_Unit
/// https://wiki.nesdev.com/w/index.php/PPU_registers
/// http://nesdev.com/2C02%20technical%20reference.TXT
/// Based on: https://github.com/gregkrsak/first_nes written by Greg M. Krsak, 2018.
  // Upstart
.cpu _6502
  // Nintendo Entertainment System (NES) ROM (Mapper 0 NROM, Vertical Mirroring)
// https://sadistech.com/nesromtool/romdoc.html
// https://forums.nesdev.com/viewtopic.php?f=2&t=9896
// https://github.com/gregkrsak/first_nes
.file [name="nes-dxycp.nes", type="bin", segments="NesRom"]
.file [name="nes-dxycp.nes_hdr", type="bin", segments="Header"]
.file [name="nes-dxycp.nes_prg", type="bin", segments="ProgramRom"]
.file [name="nes-dxycp.nes_chr", type="bin", segments="CharacterRom"]
.segmentdef Header  [ start=$0000,       min=$0000, max=$000f, fill ]
.segmentdef Tiles   [ start=$0000,       min=$0000, max=$1fff, fill ]
.segmentdef Code    [ start=$c000,       min=$c000, max=$fff9 ]
.segmentdef Data    [ startAfter="Code", min=$c000, max=$fff9 ]
.segmentdef Vectors [ start=$fffa,       min=$fffa, max=$ffff ]
.segmentdef GameRam [start=$200,max=$7ff, virtual]
.segmentdef ProgramRom [ segments="Code, Data, Vectors" ]
.segmentdef CharacterRom [ segments="Tiles" ]
.segmentdef NesRom
.segment NesRom
.segmentout [ segments="Header" ]
.segmentout [ segments="ProgramRom" ]
.segmentout [ segments="CharacterRom" ]
.segment Header
.text   @"NES\$1a"
.byte   $01           // 1x 16KB ROM (PRG)
.byte   $01           // 1x 8KB VROM (CHR)
.byte   %00000001     // Mapper nibble 0000 == No mapping (a simple 16KB PRG + 8KB CHR game)
                      // Mirroring nibble 0001 == Vertical mirroring only
  // Global Constants & labels
  .const OFFSET_STRUCT_SPRITEDATA_TILE = 1
  .const OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES = 2
  .const OFFSET_STRUCT_SPRITEDATA_X = 3
  .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
  .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
  .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
  .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
  .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
  .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
  .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
  .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
  .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5
  .const SIZEOF_CHAR = 1
  /// $2000-$23bf	$03c0	Name table 0
  .label PPU_NAME_TABLE_0 = $2000
  /// $23c0-$23ff	$0040	Attribute table 0
  .label PPU_ATTRIBUTE_TABLE_0 = $23c0
  /// $3000-$3eff	$0f00	Mirrors of $2000-$2eff
  /// $3f00-$3f1f	$0020	Palette RAM indexes
  .label PPU_PALETTE = $3f00
  /// PPU Status Register for reading in ASM
  .label PPU_PPUSTATUS = $2002
  /// APU Frame Counter
  /// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
  /// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
  /// ------+-----+---------------------------------------------------------------
  ///  $4017 |	 W  | FR_COUNTER Frame Counter	Set mode and interrupt
  ///  ------+-----+---------------------------------------------------------------
  ///        |   7	| Sequencer mode: 0 selects 4-step sequence, 1 selects 5-step sequence
  ///        |   6	| Interrupt inhibit flag. If set, the frame interrupt flag is cleared, otherwise it is unaffected.
  ///  ------+-----+---------------------------------------------------------------
  /// Side effects	After 3 or 4 CPU clock cycles*, the timer is reset.
  /// If the mode flag is set, then both "quarter frame" and "half frame" signals are also generated.
  .label FR_COUNTER = $4017
  /// Pointer to the start of RAM memory
  .label MEMORY = 0
  /// NES Picture Processing Unit (PPU)
  .label PPU = $2000
  /// NES CPU and audion processing unit (APU)
  .label APU = $4000
  // Index into the Y sine
  .label y_sin_idx = $e
  // Index into the X sine
  .label x_sin_idx = $f
  // Index into the small X sine
  .label x_sin_idx_2 = $10
.segment Code
  // __start
__start: {
    jmp __init1
    // __start::__init1
  __init1:
    // [1] y_sin_idx = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z y_sin_idx
    // [2] x_sin_idx = $49 -- vbuz1=vbuc1 
    lda #$49
    sta.z x_sin_idx
    // [3] x_sin_idx_2 = $52 -- vbuz1=vbuc1 
    lda #$52
    sta.z x_sin_idx_2
    // [4] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
  __b1_from___init1:
    jmp __b1
    // __start::@1
  __b1:
    // [5] call main
    // [45] phi from __start::@1 to main [phi:__start::@1->main]
  main_from___b1:
    jsr main
    jmp __breturn
    // __start::@return
  __breturn:
    // [6] return 
    rts
}
  // vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
    .label __17 = $a
    .label __19 = $a
    .label __23 = 9
    .label __25 = 9
    .label __28 = $d
    .label y_idx = $c
    .label x_idx = $a
    .label x_idx_2 = 9
    .label s = $b
    // interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry 
    pha
    txa
    pha
    tya
    pha
    // [7] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2 
    // Set scroll
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
    // [8] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
    jmp ppuSpriteBufferDmaTransfer1
    // vblank::ppuSpriteBufferDmaTransfer1
  ppuSpriteBufferDmaTransfer1:
    // [9] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR
    // [10] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) = byte1 SPRITE_BUFFER -- _deref_pbuc1=vbuc2 
    lda #>SPRITE_BUFFER
    sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
    // [11] phi from vblank::ppuSpriteBufferDmaTransfer1 to vblank::@14 [phi:vblank::ppuSpriteBufferDmaTransfer1->vblank::@14]
  __b14_from_ppuSpriteBufferDmaTransfer1:
    jmp __b14
    // vblank::@14
  __b14:
    // [12] call readJoy1
    // Read controller 1
    jsr readJoy1
    // [13] readJoy1::return#2 = readJoy1::joy#2
    jmp __b15
    // vblank::@15
  __b15:
    // [14] vblank::joy#0 = readJoy1::return#2
    // [15] if(0==vblank::joy#0) goto vblank::@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq __b1
    jmp __breturn
    // vblank::@return
  __breturn:
    // [16] return 
    // interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit 
    pla
    tay
    pla
    tax
    pla
    rti
    // vblank::@1
  __b1:
    // [17] vblank::y_idx#0 = y_sin_idx -- vbuz1=vbuz2 
    // Update sprite positions
    lda.z y_sin_idx
    sta.z y_idx
    // [18] y_sin_idx = ++ y_sin_idx -- vbuz1=_inc_vbuz1 
    inc.z y_sin_idx
    // [19] if(x_sin_idx==$ee) goto vblank::@3 -- vbuz1_eq_vbuc1_then_la1 
    lda #$ee
    cmp.z x_sin_idx
    beq __b3_from___b1
    jmp __b2
    // vblank::@2
  __b2:
    // [20] vblank::$5 = x_sin_idx + 1 -- vbuxx=vbuz1_plus_1 
    ldx.z x_sin_idx
    inx
    // [21] phi from vblank::@2 to vblank::@3 [phi:vblank::@2->vblank::@3]
  __b3_from___b2:
    // [21] phi vblank::$7 = vblank::$5 [phi:vblank::@2->vblank::@3#0] -- register_copy 
    jmp __b3
    // [21] phi from vblank::@1 to vblank::@3 [phi:vblank::@1->vblank::@3]
  __b3_from___b1:
    // [21] phi vblank::$7 = 0 [phi:vblank::@1->vblank::@3#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b3
    // vblank::@3
  __b3:
    // [22] x_sin_idx = vblank::$7 -- vbuz1=vbuxx 
    stx.z x_sin_idx
    // [23] vblank::x_idx#0 = x_sin_idx -- vbuz1=vbuz2 
    lda.z x_sin_idx
    sta.z x_idx
    // [24] if(x_sin_idx_2==$58) goto vblank::@5 -- vbuz1_eq_vbuc1_then_la1 
    lda #$58
    cmp.z x_sin_idx_2
    beq __b5_from___b3
    jmp __b4
    // vblank::@4
  __b4:
    // [25] vblank::$10 = x_sin_idx_2 + 1 -- vbuxx=vbuz1_plus_1 
    ldx.z x_sin_idx_2
    inx
    // [26] phi from vblank::@4 to vblank::@5 [phi:vblank::@4->vblank::@5]
  __b5_from___b4:
    // [26] phi vblank::$12 = vblank::$10 [phi:vblank::@4->vblank::@5#0] -- register_copy 
    jmp __b5
    // [26] phi from vblank::@3 to vblank::@5 [phi:vblank::@3->vblank::@5]
  __b5_from___b3:
    // [26] phi vblank::$12 = 0 [phi:vblank::@3->vblank::@5#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b5
    // vblank::@5
  __b5:
    // [27] x_sin_idx_2 = vblank::$12 -- vbuz1=vbuxx 
    stx.z x_sin_idx_2
    // [28] vblank::x_idx_2#0 = x_sin_idx_2 -- vbuz1=vbuz2 
    lda.z x_sin_idx_2
    sta.z x_idx_2
    // [29] phi from vblank::@5 to vblank::@6 [phi:vblank::@5->vblank::@6]
  __b6_from___b5:
    // [29] phi vblank::x_idx_2#2 = vblank::x_idx_2#0 [phi:vblank::@5->vblank::@6#0] -- register_copy 
    // [29] phi vblank::x_idx#2 = vblank::x_idx#0 [phi:vblank::@5->vblank::@6#1] -- register_copy 
    // [29] phi vblank::y_idx#2 = vblank::y_idx#0 [phi:vblank::@5->vblank::@6#2] -- register_copy 
    // [29] phi vblank::s#2 = 0 [phi:vblank::@5->vblank::@6#3] -- vbuz1=vbuc1 
    lda #0
    sta.z s
    jmp __b6
    // vblank::@6
  __b6:
    // [30] if(vblank::s#2<$40) goto vblank::@7 -- vbuz1_lt_vbuc1_then_la1 
    lda.z s
    cmp #$40
    bcc __b7
    jmp __breturn
    // vblank::@7
  __b7:
    // [31] vblank::$28 = vblank::s#2 << 2 -- vbuz1=vbuz2_rol_2 
    lda.z s
    asl
    asl
    sta.z __28
    // [32] ((char *)SPRITE_BUFFER)[vblank::$28] = SINTABLE_240[vblank::y_idx#2] -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy.z y_idx
    lda SINTABLE_240,y
    ldy.z __28
    sta SPRITE_BUFFER,y
    // [33] vblank::y_idx#1 = vblank::y_idx#2 - 4 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z y_idx
    axs #4
    stx.z y_idx
    // [34] vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2] -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz2 
    ldy.z x_idx
    lda SINTABLE_184,y
    ldy.z x_idx_2
    clc
    adc SINTABLE_64,y
    // [35] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[vblank::$28] = vblank::$14 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z __28
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
    // [36] if(vblank::x_idx#2<3) goto vblank::@8 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x_idx
    cmp #3
    bcc __b8
    jmp __b9
    // vblank::@9
  __b9:
    // [37] vblank::$17 = vblank::x_idx#2 - 3 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z __17
    axs #3
    stx.z __17
    // [38] phi from vblank::@8 vblank::@9 to vblank::@10 [phi:vblank::@8/vblank::@9->vblank::@10]
  __b10_from___b8:
  __b10_from___b9:
    // [38] phi vblank::x_idx#1 = vblank::$19 [phi:vblank::@8/vblank::@9->vblank::@10#0] -- register_copy 
    jmp __b10
    // vblank::@10
  __b10:
    // [39] if(vblank::x_idx_2#2>=$56) goto vblank::@11 -- vbuz1_ge_vbuc1_then_la1 
    lda.z x_idx_2
    cmp #$56
    bcs __b11
    jmp __b12
    // vblank::@12
  __b12:
    // [40] vblank::$23 = vblank::x_idx_2#2 + 3 -- vbuz1=vbuz1_plus_vbuc1 
    lax.z __23
    axs #-[3]
    stx.z __23
    // [41] phi from vblank::@11 vblank::@12 to vblank::@13 [phi:vblank::@11/vblank::@12->vblank::@13]
  __b13_from___b11:
  __b13_from___b12:
    // [41] phi vblank::x_idx_2#1 = vblank::$25 [phi:vblank::@11/vblank::@12->vblank::@13#0] -- register_copy 
    jmp __b13
    // vblank::@13
  __b13:
    // [42] vblank::s#1 = ++ vblank::s#2 -- vbuz1=_inc_vbuz1 
    inc.z s
    // [29] phi from vblank::@13 to vblank::@6 [phi:vblank::@13->vblank::@6]
  __b6_from___b13:
    // [29] phi vblank::x_idx_2#2 = vblank::x_idx_2#1 [phi:vblank::@13->vblank::@6#0] -- register_copy 
    // [29] phi vblank::x_idx#2 = vblank::x_idx#1 [phi:vblank::@13->vblank::@6#1] -- register_copy 
    // [29] phi vblank::y_idx#2 = vblank::y_idx#1 [phi:vblank::@13->vblank::@6#2] -- register_copy 
    // [29] phi vblank::s#2 = vblank::s#1 [phi:vblank::@13->vblank::@6#3] -- register_copy 
    jmp __b6
    // vblank::@11
  __b11:
    // [43] vblank::$25 = vblank::x_idx_2#2 - $56 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z __25
    axs #$56
    stx.z __25
    jmp __b13_from___b11
    // vblank::@8
  __b8:
    // [44] vblank::$19 = vblank::x_idx#2 + $ec -- vbuz1=vbuz1_plus_vbuc1 
    lax.z __19
    axs #-[$ec]
    stx.z __19
    jmp __b10_from___b8
}
  // main
// RESET Called when the NES is reset, including when it is turned on.
main: {
    jmp initNES1
    // main::initNES1
  initNES1:
    // asm { cld ldx#$ff txs  }
    cld
    ldx #$ff
    txs
    jmp initNES1_disableVideoOutput1
    // main::initNES1_disableVideoOutput1
  initNES1_disableVideoOutput1:
    // [47] *((char *)PPU) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU
    // [48] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK
    jmp initNES1_disableAudioOutput1
    // main::initNES1_disableAudioOutput1
  initNES1_disableAudioOutput1:
    // [49] *FR_COUNTER = $40 -- _deref_pbuc1=vbuc2 
    lda #$40
    sta FR_COUNTER
    // [50] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) = $40 -- _deref_pbuc1=vbuc2 
    lda #$40
    sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ
    jmp initNES1_clearVBlankFlag1
    // main::initNES1_clearVBlankFlag1
  initNES1_clearVBlankFlag1:
    // asm { ldaPPU_PPUSTATUS  }
    lda PPU_PPUSTATUS
    // [52] phi from main::initNES1_clearVBlankFlag1 to main::initNES1_waitForVBlank1 [phi:main::initNES1_clearVBlankFlag1->main::initNES1_waitForVBlank1]
  initNES1_waitForVBlank1_from_initNES1_clearVBlankFlag1:
    jmp initNES1_waitForVBlank1
    // main::initNES1_waitForVBlank1
  initNES1_waitForVBlank1:
    jmp initNES1_waitForVBlank1___b1
    // main::initNES1_waitForVBlank1_@1
  initNES1_waitForVBlank1___b1:
    // [53] main::initNES1_waitForVBlank1_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #$80
    and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
    // [54] if(0==main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq initNES1_waitForVBlank1___b1
    // [55] phi from main::initNES1_waitForVBlank1_@1 to main::initNES1_@1 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1]
  initNES1___b1_from_initNES1_waitForVBlank1___b1:
    // [55] phi main::initNES1_i#2 = 0 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp initNES1___b1
    // [55] phi from main::initNES1_@1 to main::initNES1_@1 [phi:main::initNES1_@1->main::initNES1_@1]
  initNES1___b1_from_initNES1___b1:
    // [55] phi main::initNES1_i#2 = main::initNES1_i#1 [phi:main::initNES1_@1->main::initNES1_@1#0] -- register_copy 
    jmp initNES1___b1
    // main::initNES1_@1
  initNES1___b1:
    // [56] MEMORY[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY,x
    // [57] (MEMORY+$100)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$100,x
    // [58] (MEMORY+$200)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$200,x
    // [59] (MEMORY+$300)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$300,x
    // [60] (MEMORY+$400)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$400,x
    // [61] (MEMORY+$500)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$500,x
    // [62] (MEMORY+$600)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$600,x
    // [63] (MEMORY+$700)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY+$700,x
    // [64] main::initNES1_i#1 = ++ main::initNES1_i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [65] if(0!=main::initNES1_i#1) goto main::initNES1_@1 -- 0_neq_vbuxx_then_la1 
    cpx #0
    bne initNES1___b1_from_initNES1___b1
    // [66] phi from main::initNES1_@1 to main::initNES1_waitForVBlank2 [phi:main::initNES1_@1->main::initNES1_waitForVBlank2]
  initNES1_waitForVBlank2_from_initNES1___b1:
    jmp initNES1_waitForVBlank2
    // main::initNES1_waitForVBlank2
  initNES1_waitForVBlank2:
    jmp initNES1_waitForVBlank2___b1
    // main::initNES1_waitForVBlank2_@1
  initNES1_waitForVBlank2___b1:
    // [67] main::initNES1_waitForVBlank2_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #$80
    and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
    // [68] if(0==main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq initNES1_waitForVBlank2___b1
    jmp initNES1___b7
    // main::initNES1_@7
  initNES1___b7:
    // asm { ldaPPU_PPUSTATUS  }
    lda PPU_PPUSTATUS
    // [70] phi from main::initNES1_@7 to main::@4 [phi:main::initNES1_@7->main::@4]
  __b4_from_initNES1___b7:
    jmp __b4
    // main::@4
  __b4:
    // [71] call ppuDataTransfer
  // Transfer the palette
    // [96] phi from main::@4 to ppuDataTransfer [phi:main::@4->ppuDataTransfer]
  ppuDataTransfer_from___b4:
    jsr ppuDataTransfer
    // [72] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
  __b5_from___b4:
    jmp __b5
    // main::@5
  __b5:
    // [73] call ppuDataFill
  // Fill the PPU attribute table
    // [106] phi from main::@5 to ppuDataFill [phi:main::@5->ppuDataFill]
  ppuDataFill_from___b5:
    // [106] phi ppuDataFill::val#4 = '*' [phi:main::@5->ppuDataFill#0] -- vbuxx=vbuc1 
    ldx #'*'
    // [106] phi ppuDataFill::size#3 = (unsigned int)$20*$1e [phi:main::@5->ppuDataFill#1] -- vwuz1=vwuc1 
    lda #<$20*$1e
    sta.z ppuDataFill.size
    lda #>$20*$1e
    sta.z ppuDataFill.size+1
    // [106] phi ppuDataFill::ppuDataPrepare1_ppuData#0 = (void * const )PPU_NAME_TABLE_0 [phi:main::@5->ppuDataFill#2] -- pvoz1=pvoc1 
    lda #<PPU_NAME_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData
    lda #>PPU_NAME_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData+1
    jsr ppuDataFill
    // [74] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
  __b6_from___b5:
    jmp __b6
    // main::@6
  __b6:
    // [75] call ppuDataFill
    // [106] phi from main::@6 to ppuDataFill [phi:main::@6->ppuDataFill]
  ppuDataFill_from___b6:
    // [106] phi ppuDataFill::val#4 = 0 [phi:main::@6->ppuDataFill#0] -- vbuxx=vbuc1 
    ldx #0
    // [106] phi ppuDataFill::size#3 = $40 [phi:main::@6->ppuDataFill#1] -- vwuz1=vbuc1 
    lda #<$40
    sta.z ppuDataFill.size
    lda #>$40
    sta.z ppuDataFill.size+1
    // [106] phi ppuDataFill::ppuDataPrepare1_ppuData#0 = (void * const )PPU_ATTRIBUTE_TABLE_0 [phi:main::@6->ppuDataFill#2] -- pvoz1=pvoc1 
    lda #<PPU_ATTRIBUTE_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData
    lda #>PPU_ATTRIBUTE_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData+1
    jsr ppuDataFill
    // [76] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
  __b1_from___b6:
    // [76] phi main::s#2 = 0 [phi:main::@6->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
  // Initialize Sprite Buffer with the SPRITE data
    // main::@1
  __b1:
    // [77] if(main::s#2<$40) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$40
    bcc __b2
    jmp enableVideoOutput1
    // main::enableVideoOutput1
  enableVideoOutput1:
    // [78] *((char *)PPU) = $80 -- _deref_pbuc1=vbuc2 
    lda #$80
    sta PPU
    // [79] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = $1e -- _deref_pbuc1=vbuc2 
    lda #$1e
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK
    // [80] phi from main::@3 main::enableVideoOutput1 to main::@3 [phi:main::@3/main::enableVideoOutput1->main::@3]
  __b3_from___b3:
  __b3_from_enableVideoOutput1:
    jmp __b3
  // Infinite loop
    // main::@3
  __b3:
    jmp __b3_from___b3
    // main::@2
  __b2:
    // [81] main::$7 = main::s#2 << 2 -- vbuyy=vbuxx_rol_2 
    txa
    asl
    asl
    tay
    // [82] ((char *)SPRITE_BUFFER)[main::$7] = 0 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #0
    sta SPRITE_BUFFER,y
    // [83] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#2] -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda MESSAGE,x
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE,y
    // [84] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #2
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES,y
    // [85] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #0
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
    // [86] main::s#1 = ++ main::s#2 -- vbuxx=_inc_vbuxx 
    inx
    // [76] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [76] phi main::s#2 = main::s#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
}
  // readJoy1
// Read Standard Controller #1
// Returns a byte representing the pushed buttons
// - bit 0: right
// - bit 1: left
// - bit 2: down
// - bit 3: up
// - bit 4: start
// - bit 5: select
// - bit 6: B
// - bit 7: A
readJoy1: {
    .label __1 = 8
    // [87] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 1 -- _deref_pbuc1=vbuc2 
    // Latch the controller buttons
    lda #1
    sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // [88] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // [89] phi from readJoy1 to readJoy1::@1 [phi:readJoy1->readJoy1::@1]
  __b1_from_readJoy1:
    // [89] phi readJoy1::joy#2 = 0 [phi:readJoy1->readJoy1::@1#0] -- vbuaa=vbuc1 
    lda #0
    // [89] phi readJoy1::i#2 = 0 [phi:readJoy1->readJoy1::@1#1] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // readJoy1::@1
  __b1:
    // [90] if(readJoy1::i#2<8) goto readJoy1::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #8
    bcc __b2
    jmp __breturn
    // readJoy1::@return
  __breturn:
    // [91] return 
    rts
    // readJoy1::@2
  __b2:
    // [92] readJoy1::$1 = readJoy1::joy#2 << 1 -- vbuz1=vbuaa_rol_1 
    asl
    sta.z __1
    // [93] readJoy1::$2 = *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) & 1 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #1
    and APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // [94] readJoy1::joy#1 = readJoy1::$1 | readJoy1::$2 -- vbuaa=vbuz1_bor_vbuaa 
    ora.z __1
    // [95] readJoy1::i#1 = ++ readJoy1::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [89] phi from readJoy1::@2 to readJoy1::@1 [phi:readJoy1::@2->readJoy1::@1]
  __b1_from___b2:
    // [89] phi readJoy1::joy#2 = readJoy1::joy#1 [phi:readJoy1::@2->readJoy1::@1#0] -- register_copy 
    // [89] phi readJoy1::i#2 = readJoy1::i#1 [phi:readJoy1::@2->readJoy1::@1#1] -- register_copy 
    jmp __b1
}
  // ppuDataTransfer
// Transfer a number of bytes from the CPU memory to the PPU memory
// - ppuData : Pointer in the PPU memory
// - cpuData : Pointer to the CPU memory (RAM of ROM)
// - size : The number of bytes to transfer
// void ppuDataTransfer(void * const ppuData, void * const cpuData, unsigned int size)
ppuDataTransfer: {
    .const size = $20*SIZEOF_CHAR
    .label ppuData = PPU_PALETTE
    .label cpuData = PALETTE
    // Transfer to PPU
    .label cpuSrc = 6
    .label i = 4
    jmp ppuDataPrepare1
    // ppuDataTransfer::ppuDataPrepare1
  ppuDataPrepare1:
    // [97] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = byte1 ppuDataTransfer::ppuData#0 -- _deref_pbuc1=vbuc2 
    lda #>ppuData
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [98] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [99] phi from ppuDataTransfer::ppuDataPrepare1 to ppuDataTransfer::@1 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1]
  __b1_from_ppuDataPrepare1:
    // [99] phi ppuDataTransfer::cpuSrc#2 = (char *)ppuDataTransfer::cpuData#0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#0] -- pbuz1=pbuc1 
    lda #<cpuData
    sta.z cpuSrc
    lda #>cpuData
    sta.z cpuSrc+1
    // [99] phi ppuDataTransfer::i#2 = 0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#1] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    lda #>0
    sta.z i+1
    jmp __b1
    // ppuDataTransfer::@1
  __b1:
    // [100] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2 -- vwuz1_lt_vwuc1_then_la1 
    lda.z i+1
    cmp #>size
    bcc __b2
    bne !+
    lda.z i
    cmp #<size
    bcc __b2
  !:
    jmp __breturn
    // ppuDataTransfer::@return
  __breturn:
    // [101] return 
    rts
    // ppuDataTransfer::@2
  __b2:
    // [102] ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2 -- vbuaa=_deref_pbuz1 
    ldy #0
    lda (cpuSrc),y
    jmp ppuDataPut1
    // ppuDataTransfer::ppuDataPut1
  ppuDataPut1:
    // [103] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataTransfer::ppuDataPut1_val#0 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
    jmp __b3
    // ppuDataTransfer::@3
  __b3:
    // [104] ppuDataTransfer::cpuSrc#1 = ++ ppuDataTransfer::cpuSrc#2 -- pbuz1=_inc_pbuz1 
    inc.z cpuSrc
    bne !+
    inc.z cpuSrc+1
  !:
    // [105] ppuDataTransfer::i#1 = ++ ppuDataTransfer::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [99] phi from ppuDataTransfer::@3 to ppuDataTransfer::@1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1]
  __b1_from___b3:
    // [99] phi ppuDataTransfer::cpuSrc#2 = ppuDataTransfer::cpuSrc#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#0] -- register_copy 
    // [99] phi ppuDataTransfer::i#2 = ppuDataTransfer::i#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#1] -- register_copy 
    jmp __b1
}
  // ppuDataFill
// Fill a number of bytes in the PPU memory
// - ppuData : Pointer in the PPU memory
// - size : The number of bytes to transfer
// void ppuDataFill(void * const ppuData, __register(X) char val, __zp(6) unsigned int size)
ppuDataFill: {
    .label ppuDataPrepare1_ppuData = 4
    .label i = 2
    .label size = 6
    jmp ppuDataPrepare1
    // ppuDataFill::ppuDataPrepare1
  ppuDataPrepare1:
    // [107] ppuDataFill::ppuDataPrepare1_$0 = byte1  ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_byte1_pvoz1 
    lda.z ppuDataPrepare1_ppuData+1
    // [108] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [109] ppuDataFill::ppuDataPrepare1_$1 = byte0  ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_byte0_pvoz1 
    lda.z ppuDataPrepare1_ppuData
    // [110] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [111] phi from ppuDataFill::ppuDataPrepare1 to ppuDataFill::@1 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1]
  __b1_from_ppuDataPrepare1:
    // [111] phi ppuDataFill::i#2 = 0 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    lda #>0
    sta.z i+1
    jmp __b1
  // Transfer to PPU
    // ppuDataFill::@1
  __b1:
    // [112] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 -- vwuz1_lt_vwuz2_then_la1 
    lda.z i+1
    cmp.z size+1
    bcc ppuDataPut1
    bne !+
    lda.z i
    cmp.z size
    bcc ppuDataPut1
  !:
    jmp __breturn
    // ppuDataFill::@return
  __breturn:
    // [113] return 
    rts
    // ppuDataFill::ppuDataPut1
  ppuDataPut1:
    // [114] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataFill::val#4 -- _deref_pbuc1=vbuxx 
    stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
    jmp __b2
    // ppuDataFill::@2
  __b2:
    // [115] ppuDataFill::i#1 = ++ ppuDataFill::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [111] phi from ppuDataFill::@2 to ppuDataFill::@1 [phi:ppuDataFill::@2->ppuDataFill::@1]
  __b1_from___b2:
    // [111] phi ppuDataFill::i#2 = ppuDataFill::i#1 [phi:ppuDataFill::@2->ppuDataFill::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  // The DXYCP message  0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
  MESSAGE: .text "rex-of-camelot-presents-a-dxycp-on-nintendo-entertainment-system"
  // Color Palette
  PALETTE: .byte 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $f, $30, 8, 1, $f, $18, 8, 1, $30, $37, $1a, $f, $f, $f, $f
  // Sine Table (0-239)
SINTABLE_240:
.fill $100, round(115.5+107.5*sin(2*PI*i/256))

  // Sine Table (0-63)
SINTABLE_64:
.fill 89, round(52.5+52.5*sin(2*PI*i/89))

  // Sine Table (0-183)
SINTABLE_184:
.fill 239, round(71.5+71.5*sin(2*PI*i/239))

.segment Tiles
TILES:
.var filechargen = LoadBinary("characters.901225-01.bin")
     .for(var c=0; c<256; c++) {
        // Plane 0
        .fill 8, filechargen.get(c*8+i)
        // Plane 1
        .fill 8, 0
    }

.segment GameRam
  .align $100
  SPRITE_BUFFER: .fill 4*$100, 0
.segment Vectors
  VECTORS: .word vblank, main, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __init1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp ppuSpriteBufferDmaTransfer1
Removing instruction jmp __b14
Removing instruction jmp __b15
Removing instruction jmp __breturn
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b9
Removing instruction jmp __b10
Removing instruction jmp __b12
Removing instruction jmp __b13
Removing instruction jmp initNES1
Removing instruction jmp initNES1_disableVideoOutput1
Removing instruction jmp initNES1_disableAudioOutput1
Removing instruction jmp initNES1_clearVBlankFlag1
Removing instruction jmp initNES1_waitForVBlank1
Removing instruction jmp initNES1_waitForVBlank1___b1
Removing instruction jmp initNES1___b1
Removing instruction jmp initNES1_waitForVBlank2
Removing instruction jmp initNES1_waitForVBlank2___b1
Removing instruction jmp initNES1___b7
Removing instruction jmp __b4
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b1
Removing instruction jmp enableVideoOutput1
Removing instruction jmp __b3
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp ppuDataPrepare1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp ppuDataPut1
Removing instruction jmp __b3
Removing instruction jmp ppuDataPrepare1
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Replacing instruction lda.z x_sin_idx with TXA
Replacing instruction lda.z x_sin_idx_2 with TXA
Removing instruction lda #0
Removing instruction lda #$40
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Replacing instruction ldx #0 with TAX
Removing instruction lda #>0
Removing instruction lda #>0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b13_from___b11 with __b13
Replacing label __b10_from___b8 with __b10
Replacing label initNES1_waitForVBlank1___b1 with initNES1_waitForVBlank1
Replacing label initNES1___b1_from_initNES1___b1 with initNES1___b1
Replacing label initNES1_waitForVBlank2___b1 with initNES1_waitForVBlank2
Removing instruction __b1_from___init1:
Removing instruction main_from___b1:
Removing instruction __b14_from_ppuSpriteBufferDmaTransfer1:
Removing instruction __b10_from___b8:
Removing instruction __b10_from___b9:
Removing instruction __b13_from___b11:
Removing instruction __b13_from___b12:
Removing instruction initNES1_waitForVBlank1_from_initNES1_clearVBlankFlag1:
Removing instruction initNES1_waitForVBlank1___b1:
Removing instruction initNES1___b1_from_initNES1___b1:
Removing instruction initNES1_waitForVBlank2_from_initNES1___b1:
Removing instruction initNES1_waitForVBlank2___b1:
Removing instruction __b4_from_initNES1___b7:
Removing instruction __b5_from___b4:
Removing instruction __b6_from___b5:
Removing instruction ppuDataFill_from___b6:
Removing instruction __b3_from_enableVideoOutput1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction ppuSpriteBufferDmaTransfer1:
Removing instruction __b14:
Removing instruction __b15:
Removing instruction __b2:
Removing instruction __b3_from___b2:
Removing instruction __b4:
Removing instruction __b5_from___b4:
Removing instruction __b6_from___b5:
Removing instruction __b9:
Removing instruction __b12:
Removing instruction __b6_from___b13:
Removing instruction initNES1:
Removing instruction initNES1_disableVideoOutput1:
Removing instruction initNES1_disableAudioOutput1:
Removing instruction initNES1_clearVBlankFlag1:
Removing instruction initNES1___b1_from_initNES1_waitForVBlank1___b1:
Removing instruction initNES1___b7:
Removing instruction __b4:
Removing instruction ppuDataTransfer_from___b4:
Removing instruction __b5:
Removing instruction ppuDataFill_from___b5:
Removing instruction __b6:
Removing instruction __b1_from___b6:
Removing instruction enableVideoOutput1:
Removing instruction __b3:
Removing instruction __b1_from___b2:
Removing instruction __b1_from_readJoy1:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Removing instruction ppuDataPrepare1:
Removing instruction __b1_from_ppuDataPrepare1:
Removing instruction __breturn:
Removing instruction ppuDataPut1:
Removing instruction __b3:
Removing instruction __b1_from___b3:
Removing instruction ppuDataPrepare1:
Removing instruction __b1_from_ppuDataPrepare1:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Relabelling long label __b3_from___b1 to __b2
Relabelling long label __b5_from___b3 to __b4
Relabelling long label __b3_from___b3 to __b3
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp initNES1___b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination

FINAL SYMBOL TABLE
__constant struct RICOH_2A03 *APU = (struct RICOH_2A03 *) 16384
__constant char * const FR_COUNTER = (char *) 16407
__constant char * const MEMORY = (char *) 0
__constant char MESSAGE[$40] = "rex-of-camelot-presents-a-dxycp-on-nintendo-entertainment-system"z
__constant char OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
__constant char OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
__constant char OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
__constant char OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
__constant char OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
__constant char OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
__constant char OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
__constant char OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5
__constant char OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
__constant char OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES = 2
__constant char OFFSET_STRUCT_SPRITEDATA_TILE = 1
__constant char OFFSET_STRUCT_SPRITEDATA_X = 3
__constant char PALETTE[$20] = { 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $f, $30, 8, 1, $f, $18, 8, 1, $30, $37, $1a, $f, $f, $f, $f }
__constant struct RICOH_2C02 *PPU = (struct RICOH_2C02 *) 8192
__constant char * const PPU_ATTRIBUTE_TABLE_0 = (char *) 9152
__constant char * const PPU_NAME_TABLE_0 = (char *) 8192
__constant char * const PPU_PALETTE = (char *) 16128
__constant volatile char * const PPU_PPUSTATUS = (char *) 8194
__constant const char SINTABLE_184[$ef] = kickasm {{ .fill 239, round(71.5+71.5*sin(2*PI*i/239))
 }}
__constant const char SINTABLE_240[$100] = kickasm {{ .fill $100, round(115.5+107.5*sin(2*PI*i/256))
 }}
__constant const char SINTABLE_64[$59] = kickasm {{ .fill 89, round(52.5+52.5*sin(2*PI*i/89))
 }}
__constant char SIZEOF_CHAR = 1
__constant struct SpriteData SPRITE_BUFFER[$100] = { fill( $100, 0) }
__constant char TILES[] = kickasm {{ .var filechargen = LoadBinary("characters.901225-01.bin")
     .for(var c=0; c<256; c++) {
        // Plane 0
        .fill 8, filechargen.get(c*8+i)
        // Plane 1
        .fill 8, 0
    }
 }}
__constant void (*VECTORS[])() = { &vblank, &main, 0 }
void __start()
void main()
char main::$7 // reg byte y 126.25
char main::initNES1_i
char main::initNES1_i#1 // reg byte x 151.5
char main::initNES1_i#2 // reg byte x 112.22222222222223
char main::initNES1_waitForVBlank1_$0 // reg byte a 202.0
char main::initNES1_waitForVBlank2_$0 // reg byte a 202.0
char main::s
char main::s#1 // reg byte x 202.0
char main::s#2 // reg byte x 72.14285714285714
void ppuDataFill(void * const ppuData , char val , unsigned int size)
unsigned int ppuDataFill::i
unsigned int ppuDataFill::i#1 // i zp[2]:2 2002.0
unsigned int ppuDataFill::i#2 // i zp[2]:2 1001.0
void * const ppuDataFill::ppuData
char ppuDataFill::ppuDataPrepare1_$0 // reg byte a 202.0
char ppuDataFill::ppuDataPrepare1_$1 // reg byte a 202.0
void * const ppuDataFill::ppuDataPrepare1_ppuData
void * const ppuDataFill::ppuDataPrepare1_ppuData#0 // ppuDataPrepare1_ppuData zp[2]:4 67.33333333333333
char ppuDataFill::ppuDataPut1_val
unsigned int ppuDataFill::size
unsigned int ppuDataFill::size#3 // size zp[2]:6 111.22222222222223
char ppuDataFill::val
char ppuDataFill::val#4 // reg byte x 111.22222222222223
void ppuDataTransfer(void * const ppuData , void * const cpuData , unsigned int size)
void * const ppuDataTransfer::cpuData
__constant void * const ppuDataTransfer::cpuData#0 = (void * const )PALETTE // cpuData
char *ppuDataTransfer::cpuSrc
char *ppuDataTransfer::cpuSrc#1 // cpuSrc zp[2]:6 1001.0
char *ppuDataTransfer::cpuSrc#2 // cpuSrc zp[2]:6 750.75
unsigned int ppuDataTransfer::i
unsigned int ppuDataTransfer::i#1 // i zp[2]:4 2002.0
unsigned int ppuDataTransfer::i#2 // i zp[2]:4 600.5999999999999
void * const ppuDataTransfer::ppuData
__constant void * const ppuDataTransfer::ppuData#0 = (void * const )PPU_PALETTE // ppuData
void * const ppuDataTransfer::ppuDataPrepare1_ppuData
char ppuDataTransfer::ppuDataPut1_val
char ppuDataTransfer::ppuDataPut1_val#0 // reg byte a 2002.0
unsigned int ppuDataTransfer::size
__constant unsigned int ppuDataTransfer::size#0 = $20*SIZEOF_CHAR // size
char readJoy1()
char readJoy1::$1 // zp[1]:8 101.0
char readJoy1::$2 // reg byte a 202.0
char readJoy1::i
char readJoy1::i#1 // reg byte x 202.0
char readJoy1::i#2 // reg byte x 60.599999999999994
char readJoy1::joy
char readJoy1::joy#1 // reg byte a 101.0
char readJoy1::joy#2 // reg byte a 51.0
char readJoy1::return
char readJoy1::return#2 // reg byte a 4.0
__interrupt(hardware_all) void vblank()
char vblank::$10 // reg byte x 4.0
char vblank::$12 // reg byte x 4.0
char vblank::$14 // reg byte a 22.0
char vblank::$17 // zp[1]:10 22.0
char vblank::$19 // zp[1]:10 22.0
char vblank::$23 // zp[1]:9 22.0
char vblank::$25 // zp[1]:9 22.0
char vblank::$28 // zp[1]:13 8.25
char vblank::$5 // reg byte x 4.0
char vblank::$7 // reg byte x 4.0
char vblank::joy
char vblank::joy#0 // reg byte a 4.0
struct SpriteData *vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer
char vblank::s
char vblank::s#1 // s zp[1]:11 22.0
char vblank::s#2 // s zp[1]:11 2.933333333333333
char vblank::x_idx
char vblank::x_idx#0 // x_idx zp[1]:10 0.6666666666666666
char vblank::x_idx#1 // x_idx zp[1]:10 5.5
char vblank::x_idx#2 // x_idx zp[1]:10 7.125
char vblank::x_idx_2
char vblank::x_idx_2#0 // x_idx_2 zp[1]:9 4.0
char vblank::x_idx_2#1 // x_idx_2 zp[1]:9 16.5
char vblank::x_idx_2#2 // x_idx_2 zp[1]:9 4.75
char vblank::y_idx
char vblank::y_idx#0 // y_idx zp[1]:12 0.3333333333333333
char vblank::y_idx#1 // y_idx zp[1]:12 1.8333333333333333
char vblank::y_idx#2 // y_idx zp[1]:12 8.75
__loadstore volatile char x_sin_idx // zp[1]:15 0.7692307692307693
__loadstore volatile char x_sin_idx_2 // zp[1]:16 0.5555555555555556
__loadstore volatile char y_sin_idx // zp[1]:14 0.8

reg byte x [ vblank::$7 vblank::$5 ]
reg byte x [ vblank::$12 vblank::$10 ]
zp[1]:11 [ vblank::s#2 vblank::s#1 ]
zp[1]:12 [ vblank::y_idx#2 vblank::y_idx#1 vblank::y_idx#0 ]
zp[1]:10 [ vblank::x_idx#2 vblank::x_idx#1 vblank::x_idx#0 vblank::$19 vblank::$17 ]
zp[1]:9 [ vblank::x_idx_2#2 vblank::x_idx_2#1 vblank::x_idx_2#0 vblank::$25 vblank::$23 ]
reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ]
reg byte x [ main::s#2 main::s#1 ]
reg byte x [ readJoy1::i#2 readJoy1::i#1 ]
reg byte a [ readJoy1::joy#2 readJoy1::joy#1 ]
zp[2]:4 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
zp[2]:6 [ ppuDataFill::size#3 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#1 ]
reg byte x [ ppuDataFill::val#4 ]
zp[2]:2 [ ppuDataFill::i#2 ppuDataFill::i#1 ]
zp[1]:14 [ y_sin_idx ]
zp[1]:15 [ x_sin_idx ]
zp[1]:16 [ x_sin_idx_2 ]
reg byte a [ readJoy1::return#2 ]
reg byte a [ vblank::joy#0 ]
zp[1]:13 [ vblank::$28 ]
reg byte a [ vblank::$14 ]
reg byte a [ main::initNES1_waitForVBlank1_$0 ]
reg byte a [ main::initNES1_waitForVBlank2_$0 ]
reg byte y [ main::$7 ]
zp[1]:8 [ readJoy1::$1 ]
reg byte a [ readJoy1::$2 ]
reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ]


FINAL ASSEMBLER
Score: 4702

  // File Comments
// NES DXYCP using sprites
/// @file
/// Nintendo Entertainment System (NES
///
/// https://en.wikipedia.org/wiki/Nintendo_Entertainment_System_(Model_NES-101)
/// https://github.com/gregkrsak/first_nes
/// @file
/// Ricoh 2C02 - NES Picture Processing Unit (PPU)
///
/// Ricoh RP2C02 (NTSC version) / RP2C07 (PAL version),
/// https://en.wikipedia.org/wiki/Picture_Processing_Unit
/// https://wiki.nesdev.com/w/index.php/PPU_registers
/// http://nesdev.com/2C02%20technical%20reference.TXT
/// Based on: https://github.com/gregkrsak/first_nes written by Greg M. Krsak, 2018.
  // Upstart
.cpu _6502
  // Nintendo Entertainment System (NES) ROM (Mapper 0 NROM, Vertical Mirroring)
// https://sadistech.com/nesromtool/romdoc.html
// https://forums.nesdev.com/viewtopic.php?f=2&t=9896
// https://github.com/gregkrsak/first_nes
.file [name="nes-dxycp.nes", type="bin", segments="NesRom"]
.file [name="nes-dxycp.nes_hdr", type="bin", segments="Header"]
.file [name="nes-dxycp.nes_prg", type="bin", segments="ProgramRom"]
.file [name="nes-dxycp.nes_chr", type="bin", segments="CharacterRom"]
.segmentdef Header  [ start=$0000,       min=$0000, max=$000f, fill ]
.segmentdef Tiles   [ start=$0000,       min=$0000, max=$1fff, fill ]
.segmentdef Code    [ start=$c000,       min=$c000, max=$fff9 ]
.segmentdef Data    [ startAfter="Code", min=$c000, max=$fff9 ]
.segmentdef Vectors [ start=$fffa,       min=$fffa, max=$ffff ]
.segmentdef GameRam [start=$200,max=$7ff, virtual]
.segmentdef ProgramRom [ segments="Code, Data, Vectors" ]
.segmentdef CharacterRom [ segments="Tiles" ]
.segmentdef NesRom
.segment NesRom
.segmentout [ segments="Header" ]
.segmentout [ segments="ProgramRom" ]
.segmentout [ segments="CharacterRom" ]
.segment Header
.text   @"NES\$1a"
.byte   $01           // 1x 16KB ROM (PRG)
.byte   $01           // 1x 8KB VROM (CHR)
.byte   %00000001     // Mapper nibble 0000 == No mapping (a simple 16KB PRG + 8KB CHR game)
                      // Mirroring nibble 0001 == Vertical mirroring only
  // Global Constants & labels
  .const OFFSET_STRUCT_SPRITEDATA_TILE = 1
  .const OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES = 2
  .const OFFSET_STRUCT_SPRITEDATA_X = 3
  .const OFFSET_STRUCT_RICOH_2C02_OAMADDR = 3
  .const OFFSET_STRUCT_RICOH_2A03_OAMDMA = $14
  .const OFFSET_STRUCT_RICOH_2A03_DMC_FREQ = $10
  .const OFFSET_STRUCT_RICOH_2C02_PPUMASK = 1
  .const OFFSET_STRUCT_RICOH_2C02_PPUSTATUS = 2
  .const OFFSET_STRUCT_RICOH_2A03_JOY1 = $16
  .const OFFSET_STRUCT_RICOH_2C02_PPUADDR = 6
  .const OFFSET_STRUCT_RICOH_2C02_PPUDATA = 7
  .const OFFSET_STRUCT_RICOH_2C02_PPUSCROLL = 5
  .const SIZEOF_CHAR = 1
  /// $2000-$23bf	$03c0	Name table 0
  .label PPU_NAME_TABLE_0 = $2000
  /// $23c0-$23ff	$0040	Attribute table 0
  .label PPU_ATTRIBUTE_TABLE_0 = $23c0
  /// $3000-$3eff	$0f00	Mirrors of $2000-$2eff
  /// $3f00-$3f1f	$0020	Palette RAM indexes
  .label PPU_PALETTE = $3f00
  /// PPU Status Register for reading in ASM
  .label PPU_PPUSTATUS = $2002
  /// APU Frame Counter
  /// generates low-frequency clocks for the channels and an optional 60 Hz interrupt.
  /// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
  /// ------+-----+---------------------------------------------------------------
  ///  $4017 |	 W  | FR_COUNTER Frame Counter	Set mode and interrupt
  ///  ------+-----+---------------------------------------------------------------
  ///        |   7	| Sequencer mode: 0 selects 4-step sequence, 1 selects 5-step sequence
  ///        |   6	| Interrupt inhibit flag. If set, the frame interrupt flag is cleared, otherwise it is unaffected.
  ///  ------+-----+---------------------------------------------------------------
  /// Side effects	After 3 or 4 CPU clock cycles*, the timer is reset.
  /// If the mode flag is set, then both "quarter frame" and "half frame" signals are also generated.
  .label FR_COUNTER = $4017
  /// Pointer to the start of RAM memory
  .label MEMORY = 0
  /// NES Picture Processing Unit (PPU)
  .label PPU = $2000
  /// NES CPU and audion processing unit (APU)
  .label APU = $4000
  // Index into the Y sine
  .label y_sin_idx = $e
  // Index into the X sine
  .label x_sin_idx = $f
  // Index into the small X sine
  .label x_sin_idx_2 = $10
.segment Code
  // __start
__start: {
    // __start::__init1
    // volatile char y_sin_idx = 0
    // [1] y_sin_idx = 0 -- vbuz1=vbuc1 
    lda #0
    sta.z y_sin_idx
    // volatile char x_sin_idx = 73
    // [2] x_sin_idx = $49 -- vbuz1=vbuc1 
    lda #$49
    sta.z x_sin_idx
    // volatile char x_sin_idx_2 = 82
    // [3] x_sin_idx_2 = $52 -- vbuz1=vbuc1 
    lda #$52
    sta.z x_sin_idx_2
    // [4] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
    // __start::@1
    // [5] call main
    // [45] phi from __start::@1 to main [phi:__start::@1->main]
    jsr main
    // __start::@return
    // [6] return 
    rts
}
  // vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
    .label __17 = $a
    .label __19 = $a
    .label __23 = 9
    .label __25 = 9
    .label __28 = $d
    .label y_idx = $c
    .label x_idx = $a
    .label x_idx_2 = 9
    .label s = $b
    // interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry 
    pha
    txa
    pha
    tya
    pha
    // PPU->PPUSCROLL = 0
    // [7] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2 
    // Set scroll
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
    // [8] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL
    // vblank::ppuSpriteBufferDmaTransfer1
    // PPU->OAMADDR = 0
    // [9] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR) = 0 -- _deref_pbuc1=vbuc2 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_OAMADDR
    // APU->OAMDMA = BYTE1(spriteBuffer)
    // [10] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA) = byte1 SPRITE_BUFFER -- _deref_pbuc1=vbuc2 
    lda #>SPRITE_BUFFER
    sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA
    // [11] phi from vblank::ppuSpriteBufferDmaTransfer1 to vblank::@14 [phi:vblank::ppuSpriteBufferDmaTransfer1->vblank::@14]
    // vblank::@14
    // char joy = readJoy1()
    // [12] call readJoy1
    // Read controller 1
    jsr readJoy1
    // [13] readJoy1::return#2 = readJoy1::joy#2
    // vblank::@15
    // [14] vblank::joy#0 = readJoy1::return#2
    // if(joy)
    // [15] if(0==vblank::joy#0) goto vblank::@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq __b1
    // vblank::@return
  __breturn:
    // }
    // [16] return 
    // interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit 
    pla
    tay
    pla
    tax
    pla
    rti
    // vblank::@1
  __b1:
    // char y_idx = y_sin_idx++
    // [17] vblank::y_idx#0 = y_sin_idx -- vbuz1=vbuz2 
    // Update sprite positions
    lda.z y_sin_idx
    sta.z y_idx
    // [18] y_sin_idx = ++ y_sin_idx -- vbuz1=_inc_vbuz1 
    inc.z y_sin_idx
    // (x_sin_idx==238) ? 0 : x_sin_idx+1
    // [19] if(x_sin_idx==$ee) goto vblank::@3 -- vbuz1_eq_vbuc1_then_la1 
    lda #$ee
    cmp.z x_sin_idx
    beq __b2
    // vblank::@2
    // [20] vblank::$5 = x_sin_idx + 1 -- vbuxx=vbuz1_plus_1 
    ldx.z x_sin_idx
    inx
    // [21] phi from vblank::@2 to vblank::@3 [phi:vblank::@2->vblank::@3]
    // [21] phi vblank::$7 = vblank::$5 [phi:vblank::@2->vblank::@3#0] -- register_copy 
    jmp __b3
    // [21] phi from vblank::@1 to vblank::@3 [phi:vblank::@1->vblank::@3]
  __b2:
    // [21] phi vblank::$7 = 0 [phi:vblank::@1->vblank::@3#0] -- vbuxx=vbuc1 
    ldx #0
    // vblank::@3
  __b3:
    // x_sin_idx = (x_sin_idx==238) ? 0 : x_sin_idx+1
    // [22] x_sin_idx = vblank::$7 -- vbuz1=vbuxx 
    stx.z x_sin_idx
    // char x_idx = x_sin_idx
    // [23] vblank::x_idx#0 = x_sin_idx -- vbuz1=vbuz2 
    txa
    sta.z x_idx
    // (x_sin_idx_2==88) ? 0 : x_sin_idx_2+1
    // [24] if(x_sin_idx_2==$58) goto vblank::@5 -- vbuz1_eq_vbuc1_then_la1 
    lda #$58
    cmp.z x_sin_idx_2
    beq __b4
    // vblank::@4
    // [25] vblank::$10 = x_sin_idx_2 + 1 -- vbuxx=vbuz1_plus_1 
    ldx.z x_sin_idx_2
    inx
    // [26] phi from vblank::@4 to vblank::@5 [phi:vblank::@4->vblank::@5]
    // [26] phi vblank::$12 = vblank::$10 [phi:vblank::@4->vblank::@5#0] -- register_copy 
    jmp __b5
    // [26] phi from vblank::@3 to vblank::@5 [phi:vblank::@3->vblank::@5]
  __b4:
    // [26] phi vblank::$12 = 0 [phi:vblank::@3->vblank::@5#0] -- vbuxx=vbuc1 
    ldx #0
    // vblank::@5
  __b5:
    // x_sin_idx_2 = (x_sin_idx_2==88) ? 0 : x_sin_idx_2+1
    // [27] x_sin_idx_2 = vblank::$12 -- vbuz1=vbuxx 
    stx.z x_sin_idx_2
    // char x_idx_2 = x_sin_idx_2
    // [28] vblank::x_idx_2#0 = x_sin_idx_2 -- vbuz1=vbuz2 
    txa
    sta.z x_idx_2
    // [29] phi from vblank::@5 to vblank::@6 [phi:vblank::@5->vblank::@6]
    // [29] phi vblank::x_idx_2#2 = vblank::x_idx_2#0 [phi:vblank::@5->vblank::@6#0] -- register_copy 
    // [29] phi vblank::x_idx#2 = vblank::x_idx#0 [phi:vblank::@5->vblank::@6#1] -- register_copy 
    // [29] phi vblank::y_idx#2 = vblank::y_idx#0 [phi:vblank::@5->vblank::@6#2] -- register_copy 
    // [29] phi vblank::s#2 = 0 [phi:vblank::@5->vblank::@6#3] -- vbuz1=vbuc1 
    lda #0
    sta.z s
    // vblank::@6
  __b6:
    // for(char s=0;s<0x40;s++)
    // [30] if(vblank::s#2<$40) goto vblank::@7 -- vbuz1_lt_vbuc1_then_la1 
    lda.z s
    cmp #$40
    bcc __b7
    jmp __breturn
    // vblank::@7
  __b7:
    // SPRITE_BUFFER[s].y = SINTABLE_240[y_idx]
    // [31] vblank::$28 = vblank::s#2 << 2 -- vbuz1=vbuz2_rol_2 
    lda.z s
    asl
    asl
    sta.z __28
    // [32] ((char *)SPRITE_BUFFER)[vblank::$28] = SINTABLE_240[vblank::y_idx#2] -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy.z y_idx
    lda SINTABLE_240,y
    ldy.z __28
    sta SPRITE_BUFFER,y
    // y_idx -= 4
    // [33] vblank::y_idx#1 = vblank::y_idx#2 - 4 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z y_idx
    axs #4
    stx.z y_idx
    // SINTABLE_184[x_idx] + SINTABLE_64[x_idx_2]
    // [34] vblank::$14 = SINTABLE_184[vblank::x_idx#2] + SINTABLE_64[vblank::x_idx_2#2] -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz2 
    ldy.z x_idx
    lda SINTABLE_184,y
    ldy.z x_idx_2
    clc
    adc SINTABLE_64,y
    // SPRITE_BUFFER[s].x = SINTABLE_184[x_idx] + SINTABLE_64[x_idx_2]
    // [35] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[vblank::$28] = vblank::$14 -- pbuc1_derefidx_vbuz1=vbuaa 
    ldy.z __28
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
    // (x_idx<3) ? x_idx+236 : x_idx-3
    // [36] if(vblank::x_idx#2<3) goto vblank::@8 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x_idx
    cmp #3
    bcc __b8
    // vblank::@9
    // [37] vblank::$17 = vblank::x_idx#2 - 3 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z __17
    axs #3
    stx.z __17
    // [38] phi from vblank::@8 vblank::@9 to vblank::@10 [phi:vblank::@8/vblank::@9->vblank::@10]
    // [38] phi vblank::x_idx#1 = vblank::$19 [phi:vblank::@8/vblank::@9->vblank::@10#0] -- register_copy 
    // vblank::@10
  __b10:
    // (x_idx_2>=86) ? x_idx_2-86 : x_idx_2+3
    // [39] if(vblank::x_idx_2#2>=$56) goto vblank::@11 -- vbuz1_ge_vbuc1_then_la1 
    lda.z x_idx_2
    cmp #$56
    bcs __b11
    // vblank::@12
    // [40] vblank::$23 = vblank::x_idx_2#2 + 3 -- vbuz1=vbuz1_plus_vbuc1 
    lax.z __23
    axs #-[3]
    stx.z __23
    // [41] phi from vblank::@11 vblank::@12 to vblank::@13 [phi:vblank::@11/vblank::@12->vblank::@13]
    // [41] phi vblank::x_idx_2#1 = vblank::$25 [phi:vblank::@11/vblank::@12->vblank::@13#0] -- register_copy 
    // vblank::@13
  __b13:
    // for(char s=0;s<0x40;s++)
    // [42] vblank::s#1 = ++ vblank::s#2 -- vbuz1=_inc_vbuz1 
    inc.z s
    // [29] phi from vblank::@13 to vblank::@6 [phi:vblank::@13->vblank::@6]
    // [29] phi vblank::x_idx_2#2 = vblank::x_idx_2#1 [phi:vblank::@13->vblank::@6#0] -- register_copy 
    // [29] phi vblank::x_idx#2 = vblank::x_idx#1 [phi:vblank::@13->vblank::@6#1] -- register_copy 
    // [29] phi vblank::y_idx#2 = vblank::y_idx#1 [phi:vblank::@13->vblank::@6#2] -- register_copy 
    // [29] phi vblank::s#2 = vblank::s#1 [phi:vblank::@13->vblank::@6#3] -- register_copy 
    jmp __b6
    // vblank::@11
  __b11:
    // (x_idx_2>=86) ? x_idx_2-86 : x_idx_2+3
    // [43] vblank::$25 = vblank::x_idx_2#2 - $56 -- vbuz1=vbuz1_minus_vbuc1 
    lax.z __25
    axs #$56
    stx.z __25
    jmp __b13
    // vblank::@8
  __b8:
    // (x_idx<3) ? x_idx+236 : x_idx-3
    // [44] vblank::$19 = vblank::x_idx#2 + $ec -- vbuz1=vbuz1_plus_vbuc1 
    lax.z __19
    axs #-[$ec]
    stx.z __19
    jmp __b10
}
  // main
// RESET Called when the NES is reset, including when it is turned on.
main: {
    // main::initNES1
    // asm
    // asm { cld ldx#$ff txs  }
    cld
    ldx #$ff
    txs
    // main::initNES1_disableVideoOutput1
    // PPU->PPUCTRL = 0
    // [47] *((char *)PPU) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU
    // PPU->PPUMASK = 0
    // [48] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = 0 -- _deref_pbuc1=vbuc2 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK
    // main::initNES1_disableAudioOutput1
    // *FR_COUNTER = 0b01000000
    // [49] *FR_COUNTER = $40 -- _deref_pbuc1=vbuc2 
    lda #$40
    sta FR_COUNTER
    // APU->DMC_FREQ  = 0b01000000
    // [50] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ) = $40 -- _deref_pbuc1=vbuc2 
    sta APU+OFFSET_STRUCT_RICOH_2A03_DMC_FREQ
    // main::initNES1_clearVBlankFlag1
    // asm
    // asm { ldaPPU_PPUSTATUS  }
    lda PPU_PPUSTATUS
    // [52] phi from main::initNES1_clearVBlankFlag1 to main::initNES1_waitForVBlank1 [phi:main::initNES1_clearVBlankFlag1->main::initNES1_waitForVBlank1]
    // main::initNES1_waitForVBlank1
  initNES1_waitForVBlank1:
    // main::initNES1_waitForVBlank1_@1
    // PPU->PPUSTATUS&0x80
    // [53] main::initNES1_waitForVBlank1_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #$80
    and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
    // while(!(PPU->PPUSTATUS&0x80))
    // [54] if(0==main::initNES1_waitForVBlank1_$0) goto main::initNES1_waitForVBlank1_@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq initNES1_waitForVBlank1
    // [55] phi from main::initNES1_waitForVBlank1_@1 to main::initNES1_@1 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1]
    // [55] phi main::initNES1_i#2 = 0 [phi:main::initNES1_waitForVBlank1_@1->main::initNES1_@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [55] phi from main::initNES1_@1 to main::initNES1_@1 [phi:main::initNES1_@1->main::initNES1_@1]
    // [55] phi main::initNES1_i#2 = main::initNES1_i#1 [phi:main::initNES1_@1->main::initNES1_@1#0] -- register_copy 
    // main::initNES1_@1
  initNES1___b1:
    // (MEMORY+0x000)[i] = 0
    // [56] MEMORY[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #0
    sta MEMORY,x
    // (MEMORY+0x100)[i] = 0
    // [57] (MEMORY+$100)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$100,x
    // (MEMORY+0x200)[i] = 0
    // [58] (MEMORY+$200)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$200,x
    // (MEMORY+0x300)[i] = 0
    // [59] (MEMORY+$300)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$300,x
    // (MEMORY+0x400)[i] = 0
    // [60] (MEMORY+$400)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$400,x
    // (MEMORY+0x500)[i] = 0
    // [61] (MEMORY+$500)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$500,x
    // (MEMORY+0x600)[i] = 0
    // [62] (MEMORY+$600)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$600,x
    // (MEMORY+0x700)[i] = 0
    // [63] (MEMORY+$700)[main::initNES1_i#2] = 0 -- pbuc1_derefidx_vbuxx=vbuc2 
    sta MEMORY+$700,x
    // while (++i)
    // [64] main::initNES1_i#1 = ++ main::initNES1_i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [65] if(0!=main::initNES1_i#1) goto main::initNES1_@1 -- 0_neq_vbuxx_then_la1 
    cpx #0
    bne initNES1___b1
    // [66] phi from main::initNES1_@1 to main::initNES1_waitForVBlank2 [phi:main::initNES1_@1->main::initNES1_waitForVBlank2]
    // main::initNES1_waitForVBlank2
  initNES1_waitForVBlank2:
    // main::initNES1_waitForVBlank2_@1
    // PPU->PPUSTATUS&0x80
    // [67] main::initNES1_waitForVBlank2_$0 = *((volatile char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS) & $80 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #$80
    and PPU+OFFSET_STRUCT_RICOH_2C02_PPUSTATUS
    // while(!(PPU->PPUSTATUS&0x80))
    // [68] if(0==main::initNES1_waitForVBlank2_$0) goto main::initNES1_waitForVBlank2_@1 -- 0_eq_vbuaa_then_la1 
    cmp #0
    beq initNES1_waitForVBlank2
    // main::initNES1_@7
    // asm
    // asm { ldaPPU_PPUSTATUS  }
    lda PPU_PPUSTATUS
    // [70] phi from main::initNES1_@7 to main::@4 [phi:main::initNES1_@7->main::@4]
    // main::@4
    // ppuDataTransfer(PPU_PALETTE, PALETTE, sizeof(PALETTE))
    // [71] call ppuDataTransfer
  // Transfer the palette
    // [96] phi from main::@4 to ppuDataTransfer [phi:main::@4->ppuDataTransfer]
    jsr ppuDataTransfer
    // [72] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
    // main::@5
    // ppuDataFill(PPU_NAME_TABLE_0, '*', 32*30)
    // [73] call ppuDataFill
  // Fill the PPU attribute table
    // [106] phi from main::@5 to ppuDataFill [phi:main::@5->ppuDataFill]
    // [106] phi ppuDataFill::val#4 = '*' [phi:main::@5->ppuDataFill#0] -- vbuxx=vbuc1 
    ldx #'*'
    // [106] phi ppuDataFill::size#3 = (unsigned int)$20*$1e [phi:main::@5->ppuDataFill#1] -- vwuz1=vwuc1 
    lda #<$20*$1e
    sta.z ppuDataFill.size
    lda #>$20*$1e
    sta.z ppuDataFill.size+1
    // [106] phi ppuDataFill::ppuDataPrepare1_ppuData#0 = (void * const )PPU_NAME_TABLE_0 [phi:main::@5->ppuDataFill#2] -- pvoz1=pvoc1 
    lda #<PPU_NAME_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData
    lda #>PPU_NAME_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData+1
    jsr ppuDataFill
    // [74] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
    // main::@6
    // ppuDataFill(PPU_ATTRIBUTE_TABLE_0, 0, 0x40)
    // [75] call ppuDataFill
    // [106] phi from main::@6 to ppuDataFill [phi:main::@6->ppuDataFill]
    // [106] phi ppuDataFill::val#4 = 0 [phi:main::@6->ppuDataFill#0] -- vbuxx=vbuc1 
    ldx #0
    // [106] phi ppuDataFill::size#3 = $40 [phi:main::@6->ppuDataFill#1] -- vwuz1=vbuc1 
    lda #<$40
    sta.z ppuDataFill.size
    lda #>$40
    sta.z ppuDataFill.size+1
    // [106] phi ppuDataFill::ppuDataPrepare1_ppuData#0 = (void * const )PPU_ATTRIBUTE_TABLE_0 [phi:main::@6->ppuDataFill#2] -- pvoz1=pvoc1 
    lda #<PPU_ATTRIBUTE_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData
    lda #>PPU_ATTRIBUTE_TABLE_0
    sta.z ppuDataFill.ppuDataPrepare1_ppuData+1
    jsr ppuDataFill
    // [76] phi from main::@6 to main::@1 [phi:main::@6->main::@1]
    // [76] phi main::s#2 = 0 [phi:main::@6->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  // Initialize Sprite Buffer with the SPRITE data
    // main::@1
  __b1:
    // for(char s=0;s<0x40;s++)
    // [77] if(main::s#2<$40) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$40
    bcc __b2
    // main::enableVideoOutput1
    // PPU->PPUCTRL = 0b10000000
    // [78] *((char *)PPU) = $80 -- _deref_pbuc1=vbuc2 
    lda #$80
    sta PPU
    // PPU->PPUMASK = 0b00011110
    // [79] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK) = $1e -- _deref_pbuc1=vbuc2 
    lda #$1e
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUMASK
    // [80] phi from main::@3 main::enableVideoOutput1 to main::@3 [phi:main::@3/main::enableVideoOutput1->main::@3]
  __b3:
  // Infinite loop
    // main::@3
    jmp __b3
    // main::@2
  __b2:
    // SPRITE_BUFFER[s] = { 0, MESSAGE[s], 0b00000010, 0 }
    // [81] main::$7 = main::s#2 << 2 -- vbuyy=vbuxx_rol_2 
    txa
    asl
    asl
    tay
    // [82] ((char *)SPRITE_BUFFER)[main::$7] = 0 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #0
    sta SPRITE_BUFFER,y
    // [83] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE)[main::$7] = MESSAGE[main::s#2] -- pbuc1_derefidx_vbuyy=pbuc2_derefidx_vbuxx 
    lda MESSAGE,x
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_TILE,y
    // [84] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES)[main::$7] = 2 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #2
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES,y
    // [85] ((char *)SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X)[main::$7] = 0 -- pbuc1_derefidx_vbuyy=vbuc2 
    lda #0
    sta SPRITE_BUFFER+OFFSET_STRUCT_SPRITEDATA_X,y
    // for(char s=0;s<0x40;s++)
    // [86] main::s#1 = ++ main::s#2 -- vbuxx=_inc_vbuxx 
    inx
    // [76] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [76] phi main::s#2 = main::s#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
}
  // readJoy1
// Read Standard Controller #1
// Returns a byte representing the pushed buttons
// - bit 0: right
// - bit 1: left
// - bit 2: down
// - bit 3: up
// - bit 4: start
// - bit 5: select
// - bit 6: B
// - bit 7: A
readJoy1: {
    .label __1 = 8
    // APU->JOY1 = 1
    // [87] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 1 -- _deref_pbuc1=vbuc2 
    // Latch the controller buttons
    lda #1
    sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // APU->JOY1 = 0
    // [88] *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // [89] phi from readJoy1 to readJoy1::@1 [phi:readJoy1->readJoy1::@1]
    // [89] phi readJoy1::joy#2 = 0 [phi:readJoy1->readJoy1::@1#0] -- vbuaa=vbuc1 
    // [89] phi readJoy1::i#2 = 0 [phi:readJoy1->readJoy1::@1#1] -- vbuxx=vbuc1 
    tax
    // readJoy1::@1
  __b1:
    // for(char i=0;i<8;i++)
    // [90] if(readJoy1::i#2<8) goto readJoy1::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #8
    bcc __b2
    // readJoy1::@return
    // }
    // [91] return 
    rts
    // readJoy1::@2
  __b2:
    // joy<<1
    // [92] readJoy1::$1 = readJoy1::joy#2 << 1 -- vbuz1=vbuaa_rol_1 
    asl
    sta.z __1
    // APU->JOY1&1
    // [93] readJoy1::$2 = *((char *)APU+OFFSET_STRUCT_RICOH_2A03_JOY1) & 1 -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #1
    and APU+OFFSET_STRUCT_RICOH_2A03_JOY1
    // joy = joy<<1 | APU->JOY1&1
    // [94] readJoy1::joy#1 = readJoy1::$1 | readJoy1::$2 -- vbuaa=vbuz1_bor_vbuaa 
    ora.z __1
    // for(char i=0;i<8;i++)
    // [95] readJoy1::i#1 = ++ readJoy1::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [89] phi from readJoy1::@2 to readJoy1::@1 [phi:readJoy1::@2->readJoy1::@1]
    // [89] phi readJoy1::joy#2 = readJoy1::joy#1 [phi:readJoy1::@2->readJoy1::@1#0] -- register_copy 
    // [89] phi readJoy1::i#2 = readJoy1::i#1 [phi:readJoy1::@2->readJoy1::@1#1] -- register_copy 
    jmp __b1
}
  // ppuDataTransfer
// Transfer a number of bytes from the CPU memory to the PPU memory
// - ppuData : Pointer in the PPU memory
// - cpuData : Pointer to the CPU memory (RAM of ROM)
// - size : The number of bytes to transfer
// void ppuDataTransfer(void * const ppuData, void * const cpuData, unsigned int size)
ppuDataTransfer: {
    .const size = $20*SIZEOF_CHAR
    .label ppuData = PPU_PALETTE
    .label cpuData = PALETTE
    // Transfer to PPU
    .label cpuSrc = 6
    .label i = 4
    // ppuDataTransfer::ppuDataPrepare1
    // PPU->PPUADDR = BYTE1(ppuData)
    // [97] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = byte1 ppuDataTransfer::ppuData#0 -- _deref_pbuc1=vbuc2 
    lda #>ppuData
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // PPU->PPUADDR = BYTE0(ppuData)
    // [98] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [99] phi from ppuDataTransfer::ppuDataPrepare1 to ppuDataTransfer::@1 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1]
    // [99] phi ppuDataTransfer::cpuSrc#2 = (char *)ppuDataTransfer::cpuData#0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#0] -- pbuz1=pbuc1 
    lda #<cpuData
    sta.z cpuSrc
    lda #>cpuData
    sta.z cpuSrc+1
    // [99] phi ppuDataTransfer::i#2 = 0 [phi:ppuDataTransfer::ppuDataPrepare1->ppuDataTransfer::@1#1] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    sta.z i+1
    // ppuDataTransfer::@1
  __b1:
    // for(unsigned int i=0;i<size;i++)
    // [100] if(ppuDataTransfer::i#2<ppuDataTransfer::size#0) goto ppuDataTransfer::@2 -- vwuz1_lt_vwuc1_then_la1 
    lda.z i+1
    cmp #>size
    bcc __b2
    bne !+
    lda.z i
    cmp #<size
    bcc __b2
  !:
    // ppuDataTransfer::@return
    // }
    // [101] return 
    rts
    // ppuDataTransfer::@2
  __b2:
    // ppuDataPut(*cpuSrc++)
    // [102] ppuDataTransfer::ppuDataPut1_val#0 = *ppuDataTransfer::cpuSrc#2 -- vbuaa=_deref_pbuz1 
    ldy #0
    lda (cpuSrc),y
    // ppuDataTransfer::ppuDataPut1
    // PPU->PPUDATA = val
    // [103] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataTransfer::ppuDataPut1_val#0 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
    // ppuDataTransfer::@3
    // ppuDataPut(*cpuSrc++);
    // [104] ppuDataTransfer::cpuSrc#1 = ++ ppuDataTransfer::cpuSrc#2 -- pbuz1=_inc_pbuz1 
    inc.z cpuSrc
    bne !+
    inc.z cpuSrc+1
  !:
    // for(unsigned int i=0;i<size;i++)
    // [105] ppuDataTransfer::i#1 = ++ ppuDataTransfer::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [99] phi from ppuDataTransfer::@3 to ppuDataTransfer::@1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1]
    // [99] phi ppuDataTransfer::cpuSrc#2 = ppuDataTransfer::cpuSrc#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#0] -- register_copy 
    // [99] phi ppuDataTransfer::i#2 = ppuDataTransfer::i#1 [phi:ppuDataTransfer::@3->ppuDataTransfer::@1#1] -- register_copy 
    jmp __b1
}
  // ppuDataFill
// Fill a number of bytes in the PPU memory
// - ppuData : Pointer in the PPU memory
// - size : The number of bytes to transfer
// void ppuDataFill(void * const ppuData, __register(X) char val, __zp(6) unsigned int size)
ppuDataFill: {
    .label ppuDataPrepare1_ppuData = 4
    .label i = 2
    .label size = 6
    // ppuDataFill::ppuDataPrepare1
    // BYTE1(ppuData)
    // [107] ppuDataFill::ppuDataPrepare1_$0 = byte1  ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_byte1_pvoz1 
    lda.z ppuDataPrepare1_ppuData+1
    // PPU->PPUADDR = BYTE1(ppuData)
    // [108] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$0 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // BYTE0(ppuData)
    // [109] ppuDataFill::ppuDataPrepare1_$1 = byte0  ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_byte0_pvoz1 
    lda.z ppuDataPrepare1_ppuData
    // PPU->PPUADDR = BYTE0(ppuData)
    // [110] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR) = ppuDataFill::ppuDataPrepare1_$1 -- _deref_pbuc1=vbuaa 
    sta PPU+OFFSET_STRUCT_RICOH_2C02_PPUADDR
    // [111] phi from ppuDataFill::ppuDataPrepare1 to ppuDataFill::@1 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1]
    // [111] phi ppuDataFill::i#2 = 0 [phi:ppuDataFill::ppuDataPrepare1->ppuDataFill::@1#0] -- vwuz1=vwuc1 
    lda #<0
    sta.z i
    sta.z i+1
  // Transfer to PPU
    // ppuDataFill::@1
  __b1:
    // for(unsigned int i=0;i<size;i++)
    // [112] if(ppuDataFill::i#2<ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1 -- vwuz1_lt_vwuz2_then_la1 
    lda.z i+1
    cmp.z size+1
    bcc ppuDataPut1
    bne !+
    lda.z i
    cmp.z size
    bcc ppuDataPut1
  !:
    // ppuDataFill::@return
    // }
    // [113] return 
    rts
    // ppuDataFill::ppuDataPut1
  ppuDataPut1:
    // PPU->PPUDATA = val
    // [114] *((char *)PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA) = ppuDataFill::val#4 -- _deref_pbuc1=vbuxx 
    stx PPU+OFFSET_STRUCT_RICOH_2C02_PPUDATA
    // ppuDataFill::@2
    // for(unsigned int i=0;i<size;i++)
    // [115] ppuDataFill::i#1 = ++ ppuDataFill::i#2 -- vwuz1=_inc_vwuz1 
    inc.z i
    bne !+
    inc.z i+1
  !:
    // [111] phi from ppuDataFill::@2 to ppuDataFill::@1 [phi:ppuDataFill::@2->ppuDataFill::@1]
    // [111] phi ppuDataFill::i#2 = ppuDataFill::i#1 [phi:ppuDataFill::@2->ppuDataFill::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  // The DXYCP message  0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
  MESSAGE: .text "rex-of-camelot-presents-a-dxycp-on-nintendo-entertainment-system"
  // Color Palette
  PALETTE: .byte 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $21, $f, $30, 1, $f, $30, 8, 1, $f, $18, 8, 1, $30, $37, $1a, $f, $f, $f, $f
  // Sine Table (0-239)
SINTABLE_240:
.fill $100, round(115.5+107.5*sin(2*PI*i/256))

  // Sine Table (0-63)
SINTABLE_64:
.fill 89, round(52.5+52.5*sin(2*PI*i/89))

  // Sine Table (0-183)
SINTABLE_184:
.fill 239, round(71.5+71.5*sin(2*PI*i/239))

.segment Tiles
TILES:
.var filechargen = LoadBinary("characters.901225-01.bin")
     .for(var c=0; c<256; c++) {
        // Plane 0
        .fill 8, filechargen.get(c*8+i)
        // Plane 1
        .fill 8, 0
    }

.segment GameRam
  .align $100
  SPRITE_BUFFER: .fill 4*$100, 0
.segment Vectors
  VECTORS: .word vblank, main, 0

