
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) CHARSET#0 ← ((byte*)) (word/signed word/dword/signed dword) 12288
  (word[]) charset_spec_row#0 ← { (word/dword/signed dword) 63450, (word/dword/signed dword) 63454, (word/dword/signed dword) 62030, (word/dword/signed dword) 55006 }
  to:@2
main: scope:[main]  from @2
  (byte*) VIC_MEMORY#4 ← phi( @2/(byte*) VIC_MEMORY#5 )
  (byte*) SCREEN#4 ← phi( @2/(byte*) SCREEN#5 )
  (byte*) CHARSET#1 ← phi( @2/(byte*) CHARSET#3 )
  (byte*~) main::$0 ← (byte*) CHARSET#1 + (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) main::charset#0 ← (byte*~) main::$0
  (byte) main::c#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main main::@3
  (byte*) VIC_MEMORY#3 ← phi( main/(byte*) VIC_MEMORY#4 main::@3/(byte*) VIC_MEMORY#2 )
  (byte*) CHARSET#5 ← phi( main/(byte*) CHARSET#1 main::@3/(byte*) CHARSET#4 )
  (byte*) SCREEN#3 ← phi( main/(byte*) SCREEN#4 main::@3/(byte*) SCREEN#2 )
  (byte) main::c#2 ← phi( main/(byte) main::c#0 main::@3/(byte) main::c#1 )
  (byte*) main::charset#2 ← phi( main/(byte*) main::charset#0 main::@3/(byte*) main::charset#1 )
  (byte*) gen_char3::dst#0 ← (byte*) main::charset#2
  (word) gen_char3::spec#0 ← *((word[]) charset_spec_row#0 + (byte) main::c#2)
  call gen_char3 
  to:main::@3
main::@3: scope:[main]  from main::@1
  (byte*) VIC_MEMORY#2 ← phi( main::@1/(byte*) VIC_MEMORY#3 )
  (byte*) CHARSET#4 ← phi( main::@1/(byte*) CHARSET#5 )
  (byte*) SCREEN#2 ← phi( main::@1/(byte*) SCREEN#3 )
  (byte) main::c#3 ← phi( main::@1/(byte) main::c#2 )
  (byte*) main::charset#3 ← phi( main::@1/(byte*) main::charset#2 )
  (byte*~) main::$2 ← (byte*) main::charset#3 + (byte/signed byte/word/signed word/dword/signed dword) 8
  (byte*) main::charset#1 ← (byte*~) main::$2
  (byte/signed word/word/dword/signed dword~) main::$3 ← (byte) main::c#3 + (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) main::c#1 ← (byte/signed word/word/dword/signed dword~) main::$3
  (bool~) main::$4 ← (byte) main::c#1 != (byte/signed byte/word/signed word/dword/signed dword) 6
  if((bool~) main::$4) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@3
  (byte*) VIC_MEMORY#1 ← phi( main::@3/(byte*) VIC_MEMORY#2 )
  (byte*) CHARSET#2 ← phi( main::@3/(byte*) CHARSET#4 )
  (byte*) SCREEN#1 ← phi( main::@3/(byte*) SCREEN#2 )
  (word~) main::$5 ← ((word)) (byte*) SCREEN#1
  (word/signed dword/dword~) main::$6 ← (word~) main::$5 / (byte/signed byte/word/signed word/dword/signed dword) 64
  (word~) main::$7 ← ((word)) (byte*) CHARSET#2
  (word/signed dword/dword~) main::$8 ← (word~) main::$7 / (word/signed word/dword/signed dword) 1024
  (word/dword~) main::$9 ← (word/signed dword/dword~) main::$6 | (word/signed dword/dword~) main::$8
  (byte~) main::$10 ← ((byte)) (word/dword~) main::$9
  *((byte*) VIC_MEMORY#1) ← (byte~) main::$10
  to:main::@return
main::@return: scope:[main]  from main::@2
  return 
  to:@return
gen_char3: scope:[gen_char3]  from main::@1
  (byte*) gen_char3::dst#6 ← phi( main::@1/(byte*) gen_char3::dst#0 )
  (word) gen_char3::spec#6 ← phi( main::@1/(word) gen_char3::spec#0 )
  (byte) gen_char3::r#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:gen_char3::@1
gen_char3::@1: scope:[gen_char3]  from gen_char3 gen_char3::@5
  (byte) gen_char3::r#6 ← phi( gen_char3/(byte) gen_char3::r#0 gen_char3::@5/(byte) gen_char3::r#1 )
  (byte*) gen_char3::dst#5 ← phi( gen_char3/(byte*) gen_char3::dst#6 gen_char3::@5/(byte*) gen_char3::dst#1 )
  (word) gen_char3::spec#4 ← phi( gen_char3/(word) gen_char3::spec#6 gen_char3::@5/(word) gen_char3::spec#7 )
  (byte) gen_char3::b#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) gen_char3::c#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:gen_char3::@2
gen_char3::@2: scope:[gen_char3]  from gen_char3::@1 gen_char3::@3
  (byte) gen_char3::r#4 ← phi( gen_char3::@1/(byte) gen_char3::r#6 gen_char3::@3/(byte) gen_char3::r#3 )
  (byte*) gen_char3::dst#3 ← phi( gen_char3::@1/(byte*) gen_char3::dst#5 gen_char3::@3/(byte*) gen_char3::dst#2 )
  (byte) gen_char3::c#3 ← phi( gen_char3::@1/(byte) gen_char3::c#0 gen_char3::@3/(byte) gen_char3::c#1 )
  (byte) gen_char3::b#6 ← phi( gen_char3::@1/(byte) gen_char3::b#0 gen_char3::@3/(byte) gen_char3::b#1 )
  (word) gen_char3::spec#2 ← phi( gen_char3::@1/(word) gen_char3::spec#4 gen_char3::@3/(word) gen_char3::spec#1 )
  (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2
  (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128
  (bool~) gen_char3::$2 ← (byte~) gen_char3::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0
  (bool~) gen_char3::$3 ← ! (bool~) gen_char3::$2
  if((bool~) gen_char3::$3) goto gen_char3::@3
  to:gen_char3::@4
gen_char3::@3: scope:[gen_char3]  from gen_char3::@2 gen_char3::@4
  (byte) gen_char3::r#3 ← phi( gen_char3::@2/(byte) gen_char3::r#4 gen_char3::@4/(byte) gen_char3::r#5 )
  (byte*) gen_char3::dst#2 ← phi( gen_char3::@2/(byte*) gen_char3::dst#3 gen_char3::@4/(byte*) gen_char3::dst#4 )
  (byte) gen_char3::c#2 ← phi( gen_char3::@2/(byte) gen_char3::c#3 gen_char3::@4/(byte) gen_char3::c#4 )
  (word) gen_char3::spec#3 ← phi( gen_char3::@2/(word) gen_char3::spec#2 gen_char3::@4/(word) gen_char3::spec#5 )
  (byte) gen_char3::b#3 ← phi( gen_char3::@2/(byte) gen_char3::b#6 gen_char3::@4/(byte) gen_char3::b#2 )
  (byte~) gen_char3::$5 ← (byte) gen_char3::b#3 << (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) gen_char3::b#1 ← (byte~) gen_char3::$5
  (word~) gen_char3::$6 ← (word) gen_char3::spec#3 << (byte/signed byte/word/signed word/dword/signed dword) 1
  (word) gen_char3::spec#1 ← (word~) gen_char3::$6
  (byte) gen_char3::c#1 ← (byte) gen_char3::c#2 + rangenext(0,2)
  (bool~) gen_char3::$7 ← (byte) gen_char3::c#1 != rangelast(0,2)
  if((bool~) gen_char3::$7) goto gen_char3::@2
  to:gen_char3::@5
gen_char3::@4: scope:[gen_char3]  from gen_char3::@2
  (byte) gen_char3::r#5 ← phi( gen_char3::@2/(byte) gen_char3::r#4 )
  (byte*) gen_char3::dst#4 ← phi( gen_char3::@2/(byte*) gen_char3::dst#3 )
  (byte) gen_char3::c#4 ← phi( gen_char3::@2/(byte) gen_char3::c#3 )
  (word) gen_char3::spec#5 ← phi( gen_char3::@2/(word) gen_char3::spec#2 )
  (byte) gen_char3::b#4 ← phi( gen_char3::@2/(byte) gen_char3::b#6 )
  (byte/word/dword~) gen_char3::$4 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) gen_char3::b#2 ← (byte/word/dword~) gen_char3::$4
  to:gen_char3::@3
gen_char3::@5: scope:[gen_char3]  from gen_char3::@3
  (word) gen_char3::spec#7 ← phi( gen_char3::@3/(word) gen_char3::spec#1 )
  (byte) gen_char3::r#2 ← phi( gen_char3::@3/(byte) gen_char3::r#3 )
  (byte*) gen_char3::dst#1 ← phi( gen_char3::@3/(byte*) gen_char3::dst#2 )
  (byte) gen_char3::b#5 ← phi( gen_char3::@3/(byte) gen_char3::b#1 )
  *((byte*) gen_char3::dst#1 + (byte) gen_char3::r#2) ← (byte) gen_char3::b#5
  (byte) gen_char3::r#1 ← (byte) gen_char3::r#2 + rangenext(0,4)
  (bool~) gen_char3::$8 ← (byte) gen_char3::r#1 != rangelast(0,4)
  if((bool~) gen_char3::$8) goto gen_char3::@1
  to:gen_char3::@return
gen_char3::@return: scope:[gen_char3]  from gen_char3::@5
  return 
  to:@return
@2: scope:[]  from @begin
  (byte*) VIC_MEMORY#5 ← phi( @begin/(byte*) VIC_MEMORY#0 )
  (byte*) SCREEN#5 ← phi( @begin/(byte*) SCREEN#0 )
  (byte*) CHARSET#3 ← phi( @begin/(byte*) CHARSET#0 )
  call main 
  to:@3
@3: scope:[]  from @2
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) CHARSET
(byte*) CHARSET#0
(byte*) CHARSET#1
(byte*) CHARSET#2
(byte*) CHARSET#3
(byte*) CHARSET#4
(byte*) CHARSET#5
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) VIC_MEMORY
(byte*) VIC_MEMORY#0
(byte*) VIC_MEMORY#1
(byte*) VIC_MEMORY#2
(byte*) VIC_MEMORY#3
(byte*) VIC_MEMORY#4
(byte*) VIC_MEMORY#5
(word[]) charset_spec_row
(word[]) charset_spec_row#0
(void()) gen_char3((byte*) gen_char3::dst , (word) gen_char3::spec)
(byte~) gen_char3::$0
(byte~) gen_char3::$1
(bool~) gen_char3::$2
(bool~) gen_char3::$3
(byte/word/dword~) gen_char3::$4
(byte~) gen_char3::$5
(word~) gen_char3::$6
(bool~) gen_char3::$7
(bool~) gen_char3::$8
(label) gen_char3::@1
(label) gen_char3::@2
(label) gen_char3::@3
(label) gen_char3::@4
(label) gen_char3::@5
(label) gen_char3::@return
(byte) gen_char3::b
(byte) gen_char3::b#0
(byte) gen_char3::b#1
(byte) gen_char3::b#2
(byte) gen_char3::b#3
(byte) gen_char3::b#4
(byte) gen_char3::b#5
(byte) gen_char3::b#6
(byte) gen_char3::c
(byte) gen_char3::c#0
(byte) gen_char3::c#1
(byte) gen_char3::c#2
(byte) gen_char3::c#3
(byte) gen_char3::c#4
(byte*) gen_char3::dst
(byte*) gen_char3::dst#0
(byte*) gen_char3::dst#1
(byte*) gen_char3::dst#2
(byte*) gen_char3::dst#3
(byte*) gen_char3::dst#4
(byte*) gen_char3::dst#5
(byte*) gen_char3::dst#6
(byte) gen_char3::r
(byte) gen_char3::r#0
(byte) gen_char3::r#1
(byte) gen_char3::r#2
(byte) gen_char3::r#3
(byte) gen_char3::r#4
(byte) gen_char3::r#5
(byte) gen_char3::r#6
(word) gen_char3::spec
(word) gen_char3::spec#0
(word) gen_char3::spec#1
(word) gen_char3::spec#2
(word) gen_char3::spec#3
(word) gen_char3::spec#4
(word) gen_char3::spec#5
(word) gen_char3::spec#6
(word) gen_char3::spec#7
(void()) main()
(byte*~) main::$0
(byte~) main::$10
(byte*~) main::$2
(byte/signed word/word/dword/signed dword~) main::$3
(bool~) main::$4
(word~) main::$5
(word/signed dword/dword~) main::$6
(word~) main::$7
(word/signed dword/dword~) main::$8
(word/dword~) main::$9
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::c
(byte) main::c#0
(byte) main::c#1
(byte) main::c#2
(byte) main::c#3
(byte*) main::charset
(byte*) main::charset#0
(byte*) main::charset#1
(byte*) main::charset#2
(byte*) main::charset#3

Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Inversing boolean not [37] (bool~) gen_char3::$3 ← (byte~) gen_char3::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 from [36] (bool~) gen_char3::$2 ← (byte~) gen_char3::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte*) main::charset#0 = (byte*~) main::$0 
Alias (byte*) main::charset#2 = (byte*) main::charset#3 
Alias (byte) main::c#2 = (byte) main::c#3 
Alias (byte*) SCREEN#1 = (byte*) SCREEN#2 (byte*) SCREEN#3 
Alias (byte*) CHARSET#2 = (byte*) CHARSET#4 (byte*) CHARSET#5 
Alias (byte*) VIC_MEMORY#1 = (byte*) VIC_MEMORY#2 (byte*) VIC_MEMORY#3 
Alias (byte*) main::charset#1 = (byte*~) main::$2 
Alias (byte) main::c#1 = (byte/signed word/word/dword/signed dword~) main::$3 
Alias (byte) gen_char3::b#1 = (byte~) gen_char3::$5 (byte) gen_char3::b#5 
Alias (word) gen_char3::spec#1 = (word~) gen_char3::$6 (word) gen_char3::spec#7 
Alias (byte) gen_char3::b#4 = (byte) gen_char3::b#6 
Alias (word) gen_char3::spec#2 = (word) gen_char3::spec#5 
Alias (byte) gen_char3::c#3 = (byte) gen_char3::c#4 
Alias (byte*) gen_char3::dst#3 = (byte*) gen_char3::dst#4 
Alias (byte) gen_char3::r#4 = (byte) gen_char3::r#5 
Alias (byte) gen_char3::b#2 = (byte/word/dword~) gen_char3::$4 
Alias (byte*) gen_char3::dst#1 = (byte*) gen_char3::dst#2 
Alias (byte) gen_char3::r#2 = (byte) gen_char3::r#3 
Alias (byte*) CHARSET#0 = (byte*) CHARSET#3 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#5 
Alias (byte*) VIC_MEMORY#0 = (byte*) VIC_MEMORY#5 
Successful SSA optimization Pass2AliasElimination
Alias (word) gen_char3::spec#2 = (word) gen_char3::spec#3 
Alias (byte) gen_char3::c#2 = (byte) gen_char3::c#3 
Alias (byte*) gen_char3::dst#1 = (byte*) gen_char3::dst#3 
Alias (byte) gen_char3::r#2 = (byte) gen_char3::r#4 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) SCREEN#1
Self Phi Eliminated (byte*) CHARSET#2
Self Phi Eliminated (byte*) VIC_MEMORY#1
Self Phi Eliminated (byte*) gen_char3::dst#1
Self Phi Eliminated (byte) gen_char3::r#2
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) CHARSET#1 (byte*) CHARSET#0
Redundant Phi (byte*) SCREEN#4 (byte*) SCREEN#0
Redundant Phi (byte*) VIC_MEMORY#4 (byte*) VIC_MEMORY#0
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#4
Redundant Phi (byte*) CHARSET#2 (byte*) CHARSET#1
Redundant Phi (byte*) VIC_MEMORY#1 (byte*) VIC_MEMORY#4
Redundant Phi (word) gen_char3::spec#6 (word) gen_char3::spec#0
Redundant Phi (byte*) gen_char3::dst#6 (byte*) gen_char3::dst#0
Redundant Phi (byte*) gen_char3::dst#1 (byte*) gen_char3::dst#5
Redundant Phi (byte) gen_char3::r#2 (byte) gen_char3::r#6
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$4 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@1
Simple Condition (bool~) gen_char3::$3 [38] if((byte~) gen_char3::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto gen_char3::@3
Simple Condition (bool~) gen_char3::$7 [46] if((byte) gen_char3::c#1!=rangelast(0,2)) goto gen_char3::@2
Simple Condition (bool~) gen_char3::$8 [54] if((byte) gen_char3::r#1!=rangelast(0,4)) goto gen_char3::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte*) CHARSET#0 = ((byte*))12288
Constant (const word[]) charset_spec_row#0 = { 63450, 63454, 62030, 55006 }
Constant (const byte) main::c#0 = 0
Constant (const byte) gen_char3::r#0 = 0
Constant (const byte) gen_char3::b#0 = 0
Constant (const byte) gen_char3::c#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte*) main::charset#0 = CHARSET#0+8
Constant (const word) main::$5 = ((word))SCREEN#0
Constant (const word) main::$7 = ((word))CHARSET#0
Successful SSA optimization Pass2ConstantIdentification
Constant (const word/signed dword/dword) main::$6 = main::$5/64
Constant (const word/signed dword/dword) main::$8 = main::$7/1024
Successful SSA optimization Pass2ConstantIdentification
Constant (const word/dword) main::$9 = main::$6|main::$8
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte) main::$10 = ((byte))main::$9
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value gen_char3::c#1 ← ++ gen_char3::c#2 to ++
Resolved ranged comparison value if(gen_char3::c#1!=rangelast(0,2)) goto gen_char3::@2 to (byte/signed byte/word/signed word/dword/signed dword) 3
Resolved ranged next value gen_char3::r#1 ← ++ gen_char3::r#6 to ++
Resolved ranged comparison value if(gen_char3::r#1!=rangelast(0,4)) goto gen_char3::@1 to (byte/signed byte/word/signed word/dword/signed dword) 5
Self Phi Eliminated (byte*) gen_char3::dst#5
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) gen_char3::dst#5 (byte*) gen_char3::dst#0
Successful SSA optimization Pass2RedundantPhiElimination
Inlining constant with var siblings (const byte) main::c#0
Inlining constant with var siblings (const byte*) main::charset#0
Inlining constant with var siblings (const byte) gen_char3::r#0
Inlining constant with var siblings (const byte) gen_char3::b#0
Inlining constant with var siblings (const byte) gen_char3::c#0
Constant inlined gen_char3::r#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined gen_char3::b#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::c#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined gen_char3::c#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::charset#0 = (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 8
Constant inlined main::$5 = ((word))(const byte*) SCREEN#0
Constant inlined main::$6 = ((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64
Constant inlined main::$9 = ((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024
Constant inlined main::$7 = ((word))(const byte*) CHARSET#0
Constant inlined main::$10 = ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024
Constant inlined main::$8 = ((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Added new block during phi lifting gen_char3::@7(between gen_char3::@5 and gen_char3::@1)
Added new block during phi lifting gen_char3::@8(between gen_char3::@3 and gen_char3::@2)
Added new block during phi lifting gen_char3::@9(between gen_char3::@2 and gen_char3::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to gen_char3:8 

Created 8 initial phi equivalence classes
Coalesced [14] main::charset#4 ← main::charset#1
Coalesced [15] main::c#4 ← main::c#1
Coalesced [16] gen_char3::spec#8 ← gen_char3::spec#0
Coalesced [18] gen_char3::spec#10 ← gen_char3::spec#4
Coalesced [24] gen_char3::b#9 ← gen_char3::b#2
Coalesced [34] gen_char3::spec#9 ← gen_char3::spec#1
Coalesced [35] gen_char3::r#7 ← gen_char3::r#1
Coalesced (already) [36] gen_char3::spec#11 ← gen_char3::spec#1
Coalesced [37] gen_char3::b#7 ← gen_char3::b#1
Coalesced [38] gen_char3::c#5 ← gen_char3::c#1
Coalesced [39] gen_char3::b#8 ← gen_char3::b#4
Coalesced down to 6 phi equivalence classes
Culled Empty Block (label) main::@4
Culled Empty Block (label) gen_char3::@7
Culled Empty Block (label) gen_char3::@8
Culled Empty Block (label) gen_char3::@9
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of gen_char3

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@2
@2: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @2
  [3] phi()
main: scope:[main]  from @2
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@3
  [5] (byte) main::c#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::c#1 )
  [5] (byte*) main::charset#2 ← phi( main/(const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 8 main::@3/(byte*) main::charset#1 )
  [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2
  [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2)
  [8] call gen_char3 
  to:main::@3
main::@3: scope:[main]  from main::@1
  [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8
  [10] (byte) main::c#1 ← (byte) main::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 2
  [11] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@3
  [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024
  to:main::@return
main::@return: scope:[main]  from main::@2
  [13] return 
  to:@return
gen_char3: scope:[gen_char3]  from main::@1
  [14] phi()
  to:gen_char3::@1
gen_char3::@1: scope:[gen_char3]  from gen_char3 gen_char3::@5
  [15] (byte) gen_char3::r#6 ← phi( gen_char3/(byte/signed byte/word/signed word/dword/signed dword) 0 gen_char3::@5/(byte) gen_char3::r#1 )
  [15] (word) gen_char3::spec#4 ← phi( gen_char3/(word) gen_char3::spec#0 gen_char3::@5/(word) gen_char3::spec#1 )
  to:gen_char3::@2
gen_char3::@2: scope:[gen_char3]  from gen_char3::@1 gen_char3::@3
  [16] (byte) gen_char3::c#2 ← phi( gen_char3::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 gen_char3::@3/(byte) gen_char3::c#1 )
  [16] (byte) gen_char3::b#4 ← phi( gen_char3::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 gen_char3::@3/(byte) gen_char3::b#1 )
  [16] (word) gen_char3::spec#2 ← phi( gen_char3::@1/(word) gen_char3::spec#4 gen_char3::@3/(word) gen_char3::spec#1 )
  [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2
  [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128
  [19] if((byte~) gen_char3::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto gen_char3::@3
  to:gen_char3::@4
gen_char3::@4: scope:[gen_char3]  from gen_char3::@2
  [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1
  to:gen_char3::@3
gen_char3::@3: scope:[gen_char3]  from gen_char3::@2 gen_char3::@4
  [21] (byte) gen_char3::b#3 ← phi( gen_char3::@2/(byte) gen_char3::b#4 gen_char3::@4/(byte) gen_char3::b#2 )
  [22] (byte) gen_char3::b#1 ← (byte) gen_char3::b#3 << (byte/signed byte/word/signed word/dword/signed dword) 1
  [23] (word) gen_char3::spec#1 ← (word) gen_char3::spec#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
  [24] (byte) gen_char3::c#1 ← ++ (byte) gen_char3::c#2
  [25] if((byte) gen_char3::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto gen_char3::@2
  to:gen_char3::@5
gen_char3::@5: scope:[gen_char3]  from gen_char3::@3
  [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1
  [27] (byte) gen_char3::r#1 ← ++ (byte) gen_char3::r#6
  [28] if((byte) gen_char3::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto gen_char3::@1
  to:gen_char3::@return
gen_char3::@return: scope:[gen_char3]  from gen_char3::@5
  [29] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte*) CHARSET
(byte*) SCREEN
(byte*) VIC_MEMORY
(word[]) charset_spec_row
(void()) gen_char3((byte*) gen_char3::dst , (word) gen_char3::spec)
(byte~) gen_char3::$0 2002.0
(byte~) gen_char3::$1 2002.0
(byte) gen_char3::b
(byte) gen_char3::b#1 525.75
(byte) gen_char3::b#2 2002.0
(byte) gen_char3::b#3 3003.0
(byte) gen_char3::b#4 750.75
(byte) gen_char3::c
(byte) gen_char3::c#1 1501.5
(byte) gen_char3::c#2 250.25
(byte*) gen_char3::dst
(byte*) gen_char3::dst#0 6.588235294117648
(byte) gen_char3::r
(byte) gen_char3::r#1 151.5
(byte) gen_char3::r#6 25.25
(word) gen_char3::spec
(word) gen_char3::spec#0 6.5
(word) gen_char3::spec#1 350.5
(word) gen_char3::spec#2 443.42857142857144
(word) gen_char3::spec#4 204.0
(void()) main()
(byte) main::c
(byte) main::c#1 16.5
(byte) main::c#2 6.6000000000000005
(byte*) main::charset
(byte*) main::charset#1 7.333333333333333
(byte*) main::charset#2 8.25

Initial phi equivalence classes
[ main::charset#2 main::charset#1 ]
[ main::c#2 main::c#1 ]
[ gen_char3::r#6 gen_char3::r#1 ]
[ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ]
[ gen_char3::c#2 gen_char3::c#1 ]
[ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ]
Added variable gen_char3::dst#0 to zero page equivalence class [ gen_char3::dst#0 ]
Added variable gen_char3::$0 to zero page equivalence class [ gen_char3::$0 ]
Added variable gen_char3::$1 to zero page equivalence class [ gen_char3::$1 ]
Complete equivalence classes
[ main::charset#2 main::charset#1 ]
[ main::c#2 main::c#1 ]
[ gen_char3::r#6 gen_char3::r#1 ]
[ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ]
[ gen_char3::c#2 gen_char3::c#1 ]
[ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ]
[ gen_char3::dst#0 ]
[ gen_char3::$0 ]
[ gen_char3::$1 ]
Allocated zp ZP_WORD:2 [ main::charset#2 main::charset#1 ]
Allocated zp ZP_BYTE:4 [ main::c#2 main::c#1 ]
Allocated zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ]
Allocated zp ZP_WORD:6 [ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ]
Allocated zp ZP_BYTE:8 [ gen_char3::c#2 gen_char3::c#1 ]
Allocated zp ZP_BYTE:9 [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ]
Allocated zp ZP_WORD:10 [ gen_char3::dst#0 ]
Allocated zp ZP_BYTE:12 [ gen_char3::$0 ]
Allocated zp ZP_BYTE:13 [ gen_char3::$1 ]

INITIAL ASM
//SEG0 File Comments
// Generate a charset based on a 5x3 pattern stored in 2 bytes
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label CHARSET = $3000
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label charset = 2
    .label c = 4
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta c
  //SEG13 [5] phi (byte*) main::charset#2 = (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<CHARSET+8
    sta charset
    lda #>CHARSET+8
    sta charset+1
    jmp b1
  //SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  b1_from_b3:
  //SEG15 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte*) main::charset#2 = (byte*) main::charset#1 [phi:main::@3->main::@1#1] -- register_copy 
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2 -- pbuz1=pbuz2 
    lda charset
    sta gen_char3.dst
    lda charset+1
    sta gen_char3.dst+1
  //SEG19 [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2) -- vwuz1=pwuc1_derefidx_vbuz2 
    ldy c
    lda charset_spec_row,y
    sta gen_char3.spec
    lda charset_spec_row+1,y
    sta gen_char3.spec+1
  //SEG20 [8] call gen_char3 
  //SEG21 [14] phi from main::@1 to gen_char3 [phi:main::@1->gen_char3]
  gen_char3_from_b1:
    jsr gen_char3
    jmp b3
  //SEG22 main::@3
  b3:
  //SEG23 [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- pbuz1=pbuz1_plus_vbuc1 
    lda charset
    clc
    adc #8
    sta charset
    bcc !+
    inc charset+1
  !:
  //SEG24 [10] (byte) main::c#1 ← (byte) main::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz1_plus_2 
    lda c
    clc
    adc #2
    sta c
  //SEG25 [11] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda c
    cmp #6
    bne b1_from_b3
    jmp b2
  //SEG26 main::@2
  b2:
  //SEG27 [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024 -- _deref_pbuc1=vbuc2 
    lda #SCREEN/$40|CHARSET/$400
    sta VIC_MEMORY
    jmp breturn
  //SEG28 main::@return
  breturn:
  //SEG29 [13] return 
    rts
}
//SEG30 gen_char3
// Generate one 5x3 character from a 16-bit char spec
// The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
// gen_char3(byte* zeropage($a) dst, word zeropage(6) spec)
gen_char3: {
    .label _0 = $c
    .label _1 = $d
    .label dst = $a
    .label spec = 6
    .label b = 9
    .label c = 8
    .label r = 5
  //SEG31 [15] phi from gen_char3 to gen_char3::@1 [phi:gen_char3->gen_char3::@1]
  b1_from_gen_char3:
  //SEG32 [15] phi (byte) gen_char3::r#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3->gen_char3::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta r
  //SEG33 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#0 [phi:gen_char3->gen_char3::@1#1] -- register_copy 
    jmp b1
  //SEG34 [15] phi from gen_char3::@5 to gen_char3::@1 [phi:gen_char3::@5->gen_char3::@1]
  b1_from_b5:
  //SEG35 [15] phi (byte) gen_char3::r#6 = (byte) gen_char3::r#1 [phi:gen_char3::@5->gen_char3::@1#0] -- register_copy 
  //SEG36 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#1 [phi:gen_char3::@5->gen_char3::@1#1] -- register_copy 
    jmp b1
  //SEG37 gen_char3::@1
  b1:
  //SEG38 [16] phi from gen_char3::@1 to gen_char3::@2 [phi:gen_char3::@1->gen_char3::@2]
  b2_from_b1:
  //SEG39 [16] phi (byte) gen_char3::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta c
  //SEG40 [16] phi (byte) gen_char3::b#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#1] -- vbuz1=vbuc1 
    lda #0
    sta b
  //SEG41 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#4 [phi:gen_char3::@1->gen_char3::@2#2] -- register_copy 
    jmp b2
  //SEG42 [16] phi from gen_char3::@3 to gen_char3::@2 [phi:gen_char3::@3->gen_char3::@2]
  b2_from_b3:
  //SEG43 [16] phi (byte) gen_char3::c#2 = (byte) gen_char3::c#1 [phi:gen_char3::@3->gen_char3::@2#0] -- register_copy 
  //SEG44 [16] phi (byte) gen_char3::b#4 = (byte) gen_char3::b#1 [phi:gen_char3::@3->gen_char3::@2#1] -- register_copy 
  //SEG45 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#1 [phi:gen_char3::@3->gen_char3::@2#2] -- register_copy 
    jmp b2
  //SEG46 gen_char3::@2
  b2:
  //SEG47 [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2 -- vbuz1=_hi_vwuz2 
    lda spec+1
    sta _0
  //SEG48 [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128 -- vbuz1=vbuz2_band_vbuc1 
    lda #$80
    and _0
    sta _1
  //SEG49 [19] if((byte~) gen_char3::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto gen_char3::@3 -- vbuz1_eq_0_then_la1 
    lda _1
    cmp #0
    beq b3_from_b2
    jmp b4
  //SEG50 gen_char3::@4
  b4:
  //SEG51 [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_bor_vbuc1 
    lda #1
    ora b
    sta b
  //SEG52 [21] phi from gen_char3::@2 gen_char3::@4 to gen_char3::@3 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3]
  b3_from_b2:
  b3_from_b4:
  //SEG53 [21] phi (byte) gen_char3::b#3 = (byte) gen_char3::b#4 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3#0] -- register_copy 
    jmp b3
  //SEG54 gen_char3::@3
  b3:
  //SEG55 [22] (byte) gen_char3::b#1 ← (byte) gen_char3::b#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1 
    asl b
  //SEG56 [23] (word) gen_char3::spec#1 ← (word) gen_char3::spec#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 
    asl spec
    rol spec+1
  //SEG57 [24] (byte) gen_char3::c#1 ← ++ (byte) gen_char3::c#2 -- vbuz1=_inc_vbuz1 
    inc c
  //SEG58 [25] if((byte) gen_char3::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto gen_char3::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda c
    cmp #3
    bne b2_from_b3
    jmp b5
  //SEG59 gen_char3::@5
  b5:
  //SEG60 [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1 -- pbuz1_derefidx_vbuz2=vbuz3 
    lda b
    ldy r
    sta (dst),y
  //SEG61 [27] (byte) gen_char3::r#1 ← ++ (byte) gen_char3::r#6 -- vbuz1=_inc_vbuz1 
    inc r
  //SEG62 [28] if((byte) gen_char3::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto gen_char3::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda r
    cmp #5
    bne b1_from_b5
    jmp breturn
  //SEG63 gen_char3::@return
  breturn:
  //SEG64 [29] return 
    rts
}
  // Stores chars as 15 bits (in 2 bytes) specifying the 3x5
  // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
  charset_spec_row: .word $f7da, $f7de, $f24e, $d6de

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2 [ main::charset#2 main::c#2 gen_char3::dst#0 ] ( main:2 [ main::charset#2 main::c#2 gen_char3::dst#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::c#2 main::c#1 ]
Statement [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2) [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::spec#0 ] ( main:2 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::spec#0 ] ) always clobbers reg byte a 
Statement [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ main::c#2 main::charset#1 ] ( main:2 [ main::c#2 main::charset#1 ] ) always clobbers reg byte a 
Statement [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$0 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ gen_char3::c#2 gen_char3::c#1 ]
Statement [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$1 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$1 ] ) always clobbers reg byte a 
Statement [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::c#2 gen_char3::b#2 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::c#2 gen_char3::b#2 ] ) always clobbers reg byte a 
Statement [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#1 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#1 ] ) always clobbers reg byte a 
Statement [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2 [ main::charset#2 main::c#2 gen_char3::dst#0 ] ( main:2 [ main::charset#2 main::c#2 gen_char3::dst#0 ] ) always clobbers reg byte a 
Statement [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2) [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::spec#0 ] ( main:2 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::spec#0 ] ) always clobbers reg byte a 
Statement [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ main::c#2 main::charset#1 ] ( main:2 [ main::c#2 main::charset#1 ] ) always clobbers reg byte a 
Statement [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$0 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$0 ] ) always clobbers reg byte a 
Statement [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$1 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::b#4 gen_char3::c#2 gen_char3::$1 ] ) always clobbers reg byte a 
Statement [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::c#2 gen_char3::b#2 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#2 gen_char3::c#2 gen_char3::b#2 ] ) always clobbers reg byte a 
Statement [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1 [ gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#1 ] ( main:2::gen_char3:8 [ main::charset#2 main::c#2 gen_char3::dst#0 gen_char3::r#6 gen_char3::spec#1 ] ) always clobbers reg byte a 
Potential registers zp ZP_WORD:2 [ main::charset#2 main::charset#1 ] : zp ZP_WORD:2 , 
Potential registers zp ZP_BYTE:4 [ main::c#2 main::c#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:6 [ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ] : zp ZP_WORD:6 , 
Potential registers zp ZP_BYTE:8 [ gen_char3::c#2 gen_char3::c#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:9 [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:10 [ gen_char3::dst#0 ] : zp ZP_WORD:10 , 
Potential registers zp ZP_BYTE:12 [ gen_char3::$0 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:13 [ gen_char3::$1 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [gen_char3] 6,281.5: zp ZP_BYTE:9 [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ] 2,002: zp ZP_BYTE:12 [ gen_char3::$0 ] 2,002: zp ZP_BYTE:13 [ gen_char3::$1 ] 1,751.75: zp ZP_BYTE:8 [ gen_char3::c#2 gen_char3::c#1 ] 1,004.43: zp ZP_WORD:6 [ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ] 176.75: zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ] 6.59: zp ZP_WORD:10 [ gen_char3::dst#0 ] 
Uplift Scope [main] 23.1: zp ZP_BYTE:4 [ main::c#2 main::c#1 ] 15.58: zp ZP_WORD:2 [ main::charset#2 main::charset#1 ] 
Uplift Scope [] 

Uplifting [gen_char3] best 61682 combination reg byte y [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ] reg byte a [ gen_char3::$0 ] reg byte a [ gen_char3::$1 ] reg byte x [ gen_char3::c#2 gen_char3::c#1 ] zp ZP_WORD:6 [ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ] zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ] zp ZP_WORD:10 [ gen_char3::dst#0 ] 
Limited combination testing to 100 combinations of 432 possible.
Uplifting [main] best 61682 combination zp ZP_BYTE:4 [ main::c#2 main::c#1 ] zp ZP_WORD:2 [ main::charset#2 main::charset#1 ] 
Uplifting [] best 61682 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ]
Uplifting [gen_char3] best 61682 combination zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::c#2 main::c#1 ]
Uplifting [main] best 61682 combination zp ZP_BYTE:4 [ main::c#2 main::c#1 ] 
Coalescing zero page register with common assignment [ zp ZP_WORD:2 [ main::charset#2 main::charset#1 ] ] with [ zp ZP_WORD:10 [ gen_char3::dst#0 ] ] - score: 1

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Generate a charset based on a 5x3 pattern stored in 2 bytes
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label CHARSET = $3000
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
  jsr main
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label charset = 2
    .label c = 4
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta c
  //SEG13 [5] phi (byte*) main::charset#2 = (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<CHARSET+8
    sta charset
    lda #>CHARSET+8
    sta charset+1
    jmp b1
  //SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  b1_from_b3:
  //SEG15 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte*) main::charset#2 = (byte*) main::charset#1 [phi:main::@3->main::@1#1] -- register_copy 
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2
  //SEG19 [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2) -- vwuz1=pwuc1_derefidx_vbuz2 
    ldy c
    lda charset_spec_row,y
    sta gen_char3.spec
    lda charset_spec_row+1,y
    sta gen_char3.spec+1
  //SEG20 [8] call gen_char3 
  //SEG21 [14] phi from main::@1 to gen_char3 [phi:main::@1->gen_char3]
  gen_char3_from_b1:
    jsr gen_char3
    jmp b3
  //SEG22 main::@3
  b3:
  //SEG23 [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- pbuz1=pbuz1_plus_vbuc1 
    lda charset
    clc
    adc #8
    sta charset
    bcc !+
    inc charset+1
  !:
  //SEG24 [10] (byte) main::c#1 ← (byte) main::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz1_plus_2 
    lda c
    clc
    adc #2
    sta c
  //SEG25 [11] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda c
    cmp #6
    bne b1_from_b3
    jmp b2
  //SEG26 main::@2
  b2:
  //SEG27 [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024 -- _deref_pbuc1=vbuc2 
    lda #SCREEN/$40|CHARSET/$400
    sta VIC_MEMORY
    jmp breturn
  //SEG28 main::@return
  breturn:
  //SEG29 [13] return 
    rts
}
//SEG30 gen_char3
// Generate one 5x3 character from a 16-bit char spec
// The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
// gen_char3(byte* zeropage(2) dst, word zeropage(6) spec)
gen_char3: {
    .label dst = 2
    .label spec = 6
    .label r = 5
  //SEG31 [15] phi from gen_char3 to gen_char3::@1 [phi:gen_char3->gen_char3::@1]
  b1_from_gen_char3:
  //SEG32 [15] phi (byte) gen_char3::r#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3->gen_char3::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta r
  //SEG33 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#0 [phi:gen_char3->gen_char3::@1#1] -- register_copy 
    jmp b1
  //SEG34 [15] phi from gen_char3::@5 to gen_char3::@1 [phi:gen_char3::@5->gen_char3::@1]
  b1_from_b5:
  //SEG35 [15] phi (byte) gen_char3::r#6 = (byte) gen_char3::r#1 [phi:gen_char3::@5->gen_char3::@1#0] -- register_copy 
  //SEG36 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#1 [phi:gen_char3::@5->gen_char3::@1#1] -- register_copy 
    jmp b1
  //SEG37 gen_char3::@1
  b1:
  //SEG38 [16] phi from gen_char3::@1 to gen_char3::@2 [phi:gen_char3::@1->gen_char3::@2]
  b2_from_b1:
  //SEG39 [16] phi (byte) gen_char3::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG40 [16] phi (byte) gen_char3::b#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#1] -- vbuyy=vbuc1 
    ldy #0
  //SEG41 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#4 [phi:gen_char3::@1->gen_char3::@2#2] -- register_copy 
    jmp b2
  //SEG42 [16] phi from gen_char3::@3 to gen_char3::@2 [phi:gen_char3::@3->gen_char3::@2]
  b2_from_b3:
  //SEG43 [16] phi (byte) gen_char3::c#2 = (byte) gen_char3::c#1 [phi:gen_char3::@3->gen_char3::@2#0] -- register_copy 
  //SEG44 [16] phi (byte) gen_char3::b#4 = (byte) gen_char3::b#1 [phi:gen_char3::@3->gen_char3::@2#1] -- register_copy 
  //SEG45 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#1 [phi:gen_char3::@3->gen_char3::@2#2] -- register_copy 
    jmp b2
  //SEG46 gen_char3::@2
  b2:
  //SEG47 [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2 -- vbuaa=_hi_vwuz1 
    lda spec+1
  //SEG48 [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuaa_band_vbuc1 
    and #$80
  //SEG49 [19] if((byte~) gen_char3::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto gen_char3::@3 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq b3_from_b2
    jmp b4
  //SEG50 gen_char3::@4
  b4:
  //SEG51 [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_bor_vbuc1 
    tya
    ora #1
    tay
  //SEG52 [21] phi from gen_char3::@2 gen_char3::@4 to gen_char3::@3 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3]
  b3_from_b2:
  b3_from_b4:
  //SEG53 [21] phi (byte) gen_char3::b#3 = (byte) gen_char3::b#4 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3#0] -- register_copy 
    jmp b3
  //SEG54 gen_char3::@3
  b3:
  //SEG55 [22] (byte) gen_char3::b#1 ← (byte) gen_char3::b#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_rol_1 
    tya
    asl
    tay
  //SEG56 [23] (word) gen_char3::spec#1 ← (word) gen_char3::spec#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 
    asl spec
    rol spec+1
  //SEG57 [24] (byte) gen_char3::c#1 ← ++ (byte) gen_char3::c#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG58 [25] if((byte) gen_char3::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto gen_char3::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne b2_from_b3
    jmp b5
  //SEG59 gen_char3::@5
  b5:
  //SEG60 [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1 -- pbuz1_derefidx_vbuz2=vbuyy 
    tya
    ldy r
    sta (dst),y
  //SEG61 [27] (byte) gen_char3::r#1 ← ++ (byte) gen_char3::r#6 -- vbuz1=_inc_vbuz1 
    inc r
  //SEG62 [28] if((byte) gen_char3::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto gen_char3::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda r
    cmp #5
    bne b1_from_b5
    jmp breturn
  //SEG63 gen_char3::@return
  breturn:
  //SEG64 [29] return 
    rts
}
  // Stores chars as 15 bits (in 2 bytes) specifying the 3x5
  // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
  charset_spec_row: .word $f7da, $f7de, $f24e, $d6de

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b4
Removing instruction jmp b3
Removing instruction jmp b5
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda c
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label b1_from_b3 with b1
Replacing label b3_from_b2 with b3
Replacing label b2_from_b3 with b2
Replacing label b1_from_b5 with b1
Removing instruction b2_from_bbegin:
Removing instruction b2:
Removing instruction main_from_b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_b3:
Removing instruction b1_from_b5:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Removing instruction b3_from_b2:
Removing instruction b3_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction gen_char3_from_b1:
Removing instruction b3:
Removing instruction b2:
Removing instruction breturn:
Removing instruction b1_from_gen_char3:
Removing instruction b4:
Removing instruction b5:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @2
(label) @begin
(label) @end
(byte*) CHARSET
(const byte*) CHARSET#0 CHARSET = ((byte*))(word/signed word/dword/signed dword) 12288
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte*) VIC_MEMORY
(const byte*) VIC_MEMORY#0 VIC_MEMORY = ((byte*))(word/dword/signed dword) 53272
(word[]) charset_spec_row
(const word[]) charset_spec_row#0 charset_spec_row = { (word/dword/signed dword) 63450, (word/dword/signed dword) 63454, (word/dword/signed dword) 62030, (word/dword/signed dword) 55006 }
(void()) gen_char3((byte*) gen_char3::dst , (word) gen_char3::spec)
(byte~) gen_char3::$0 reg byte a 2002.0
(byte~) gen_char3::$1 reg byte a 2002.0
(label) gen_char3::@1
(label) gen_char3::@2
(label) gen_char3::@3
(label) gen_char3::@4
(label) gen_char3::@5
(label) gen_char3::@return
(byte) gen_char3::b
(byte) gen_char3::b#1 reg byte y 525.75
(byte) gen_char3::b#2 reg byte y 2002.0
(byte) gen_char3::b#3 reg byte y 3003.0
(byte) gen_char3::b#4 reg byte y 750.75
(byte) gen_char3::c
(byte) gen_char3::c#1 reg byte x 1501.5
(byte) gen_char3::c#2 reg byte x 250.25
(byte*) gen_char3::dst
(byte*) gen_char3::dst#0 dst zp ZP_WORD:2 6.588235294117648
(byte) gen_char3::r
(byte) gen_char3::r#1 r zp ZP_BYTE:5 151.5
(byte) gen_char3::r#6 r zp ZP_BYTE:5 25.25
(word) gen_char3::spec
(word) gen_char3::spec#0 spec zp ZP_WORD:6 6.5
(word) gen_char3::spec#1 spec zp ZP_WORD:6 350.5
(word) gen_char3::spec#2 spec zp ZP_WORD:6 443.42857142857144
(word) gen_char3::spec#4 spec zp ZP_WORD:6 204.0
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::c
(byte) main::c#1 c zp ZP_BYTE:4 16.5
(byte) main::c#2 c zp ZP_BYTE:4 6.6000000000000005
(byte*) main::charset
(byte*) main::charset#1 charset zp ZP_WORD:2 7.333333333333333
(byte*) main::charset#2 charset zp ZP_WORD:2 8.25

zp ZP_WORD:2 [ main::charset#2 main::charset#1 gen_char3::dst#0 ]
zp ZP_BYTE:4 [ main::c#2 main::c#1 ]
zp ZP_BYTE:5 [ gen_char3::r#6 gen_char3::r#1 ]
zp ZP_WORD:6 [ gen_char3::spec#2 gen_char3::spec#4 gen_char3::spec#0 gen_char3::spec#1 ]
reg byte x [ gen_char3::c#2 gen_char3::c#1 ]
reg byte y [ gen_char3::b#3 gen_char3::b#4 gen_char3::b#1 gen_char3::b#2 ]
reg byte a [ gen_char3::$0 ]
reg byte a [ gen_char3::$1 ]


FINAL ASSEMBLER
Score: 45524

//SEG0 File Comments
// Generate a charset based on a 5x3 pattern stored in 2 bytes
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label VIC_MEMORY = $d018
  .label SCREEN = $400
  .label CHARSET = $3000
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main 
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
    .label charset = 2
    .label c = 4
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  //SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta c
  //SEG13 [5] phi (byte*) main::charset#2 = (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<CHARSET+8
    sta charset
    lda #>CHARSET+8
    sta charset+1
  //SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
  //SEG15 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@3->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte*) main::charset#2 = (byte*) main::charset#1 [phi:main::@3->main::@1#1] -- register_copy 
  //SEG17 main::@1
  b1:
  //SEG18 [6] (byte*) gen_char3::dst#0 ← (byte*) main::charset#2
  //SEG19 [7] (word) gen_char3::spec#0 ← *((const word[]) charset_spec_row#0 + (byte) main::c#2) -- vwuz1=pwuc1_derefidx_vbuz2 
    ldy c
    lda charset_spec_row,y
    sta gen_char3.spec
    lda charset_spec_row+1,y
    sta gen_char3.spec+1
  //SEG20 [8] call gen_char3 
  //SEG21 [14] phi from main::@1 to gen_char3 [phi:main::@1->gen_char3]
    jsr gen_char3
  //SEG22 main::@3
  //SEG23 [9] (byte*) main::charset#1 ← (byte*) main::charset#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 -- pbuz1=pbuz1_plus_vbuc1 
    lda charset
    clc
    adc #8
    sta charset
    bcc !+
    inc charset+1
  !:
  //SEG24 [10] (byte) main::c#1 ← (byte) main::c#2 + (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz1_plus_2 
    lda c
    clc
    adc #2
    sta c
  //SEG25 [11] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    cmp #6
    bne b1
  //SEG26 main::@2
  //SEG27 [12] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) CHARSET#0/(word/signed word/dword/signed dword) 1024 -- _deref_pbuc1=vbuc2 
    lda #SCREEN/$40|CHARSET/$400
    sta VIC_MEMORY
  //SEG28 main::@return
  //SEG29 [13] return 
    rts
}
//SEG30 gen_char3
// Generate one 5x3 character from a 16-bit char spec
// The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
// gen_char3(byte* zeropage(2) dst, word zeropage(6) spec)
gen_char3: {
    .label dst = 2
    .label spec = 6
    .label r = 5
  //SEG31 [15] phi from gen_char3 to gen_char3::@1 [phi:gen_char3->gen_char3::@1]
  //SEG32 [15] phi (byte) gen_char3::r#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3->gen_char3::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta r
  //SEG33 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#0 [phi:gen_char3->gen_char3::@1#1] -- register_copy 
  //SEG34 [15] phi from gen_char3::@5 to gen_char3::@1 [phi:gen_char3::@5->gen_char3::@1]
  //SEG35 [15] phi (byte) gen_char3::r#6 = (byte) gen_char3::r#1 [phi:gen_char3::@5->gen_char3::@1#0] -- register_copy 
  //SEG36 [15] phi (word) gen_char3::spec#4 = (word) gen_char3::spec#1 [phi:gen_char3::@5->gen_char3::@1#1] -- register_copy 
  //SEG37 gen_char3::@1
  b1:
  //SEG38 [16] phi from gen_char3::@1 to gen_char3::@2 [phi:gen_char3::@1->gen_char3::@2]
  //SEG39 [16] phi (byte) gen_char3::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#0] -- vbuxx=vbuc1 
    ldx #0
  //SEG40 [16] phi (byte) gen_char3::b#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:gen_char3::@1->gen_char3::@2#1] -- vbuyy=vbuc1 
    ldy #0
  //SEG41 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#4 [phi:gen_char3::@1->gen_char3::@2#2] -- register_copy 
  //SEG42 [16] phi from gen_char3::@3 to gen_char3::@2 [phi:gen_char3::@3->gen_char3::@2]
  //SEG43 [16] phi (byte) gen_char3::c#2 = (byte) gen_char3::c#1 [phi:gen_char3::@3->gen_char3::@2#0] -- register_copy 
  //SEG44 [16] phi (byte) gen_char3::b#4 = (byte) gen_char3::b#1 [phi:gen_char3::@3->gen_char3::@2#1] -- register_copy 
  //SEG45 [16] phi (word) gen_char3::spec#2 = (word) gen_char3::spec#1 [phi:gen_char3::@3->gen_char3::@2#2] -- register_copy 
  //SEG46 gen_char3::@2
  b2:
  //SEG47 [17] (byte~) gen_char3::$0 ← > (word) gen_char3::spec#2 -- vbuaa=_hi_vwuz1 
    lda spec+1
  //SEG48 [18] (byte~) gen_char3::$1 ← (byte~) gen_char3::$0 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuaa_band_vbuc1 
    and #$80
  //SEG49 [19] if((byte~) gen_char3::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto gen_char3::@3 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq b3
  //SEG50 gen_char3::@4
  //SEG51 [20] (byte) gen_char3::b#2 ← (byte) gen_char3::b#4 | (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_bor_vbuc1 
    tya
    ora #1
    tay
  //SEG52 [21] phi from gen_char3::@2 gen_char3::@4 to gen_char3::@3 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3]
  //SEG53 [21] phi (byte) gen_char3::b#3 = (byte) gen_char3::b#4 [phi:gen_char3::@2/gen_char3::@4->gen_char3::@3#0] -- register_copy 
  //SEG54 gen_char3::@3
  b3:
  //SEG55 [22] (byte) gen_char3::b#1 ← (byte) gen_char3::b#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_rol_1 
    tya
    asl
    tay
  //SEG56 [23] (word) gen_char3::spec#1 ← (word) gen_char3::spec#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 
    asl spec
    rol spec+1
  //SEG57 [24] (byte) gen_char3::c#1 ← ++ (byte) gen_char3::c#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG58 [25] if((byte) gen_char3::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto gen_char3::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #3
    bne b2
  //SEG59 gen_char3::@5
  //SEG60 [26] *((byte*) gen_char3::dst#0 + (byte) gen_char3::r#6) ← (byte) gen_char3::b#1 -- pbuz1_derefidx_vbuz2=vbuyy 
    tya
    ldy r
    sta (dst),y
  //SEG61 [27] (byte) gen_char3::r#1 ← ++ (byte) gen_char3::r#6 -- vbuz1=_inc_vbuz1 
    inc r
  //SEG62 [28] if((byte) gen_char3::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto gen_char3::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda r
    cmp #5
    bne b1
  //SEG63 gen_char3::@return
  //SEG64 [29] return 
    rts
}
  // Stores chars as 15 bits (in 2 bytes) specifying the 3x5
  // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0
  charset_spec_row: .word $f7da, $f7de, $f24e, $d6de

