
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
  (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
  (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
  to:@1
main: scope:[main]  from @1
  (byte) GREEN#1 ← phi( @1/(byte) GREEN#2 )
  (byte) RED#1 ← phi( @1/(byte) RED#2 )
  (byte) WHITE#1 ← phi( @1/(byte) WHITE#2 )
  (byte[]) main::colseq#0 ← { (byte) WHITE#1, (byte) RED#1, (byte) GREEN#1 }
  (byte*) main::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte*) main::cols#0 ← ((byte*)) (word/dword/signed dword) 55296
  (byte) main::j#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main main::@2
  (byte*) main::cols#1 ← phi( main/(byte*) main::cols#0 main::@2/(byte*) main::cols#2 )
  (byte) main::j#3 ← phi( main/(byte) main::j#0 main::@2/(byte) main::j#4 )
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
  (byte*) main::screen#1 ← phi( main/(byte*) main::screen#0 main::@2/(byte*) main::screen#2 )
  *((byte*) main::screen#1 + (byte) main::i#2) ← (byte) '*'
  *((byte*) main::cols#1 + (byte) main::i#2) ← *((byte[]) main::colseq#0 + (byte) main::j#3)
  (byte) main::j#1 ← ++ (byte) main::j#3
  (bool~) main::$0 ← (byte) main::j#1 == (byte/signed byte/word/signed word/dword/signed dword) 3
  (bool~) main::$1 ← ! (bool~) main::$0
  if((bool~) main::$1) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1 main::@3
  (byte*) main::cols#2 ← phi( main::@1/(byte*) main::cols#1 main::@3/(byte*) main::cols#3 )
  (byte) main::j#4 ← phi( main::@1/(byte) main::j#1 main::@3/(byte) main::j#2 )
  (byte*) main::screen#2 ← phi( main::@1/(byte*) main::screen#1 main::@3/(byte*) main::screen#3 )
  (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 main::@3/(byte) main::i#4 )
  (byte) main::i#1 ← (byte) main::i#3 + rangenext(0,39)
  (bool~) main::$2 ← (byte) main::i#1 != rangelast(0,39)
  if((bool~) main::$2) goto main::@1
  to:main::@return
main::@3: scope:[main]  from main::@1
  (byte*) main::cols#3 ← phi( main::@1/(byte*) main::cols#1 )
  (byte*) main::screen#3 ← phi( main::@1/(byte*) main::screen#1 )
  (byte) main::i#4 ← phi( main::@1/(byte) main::i#2 )
  (byte) main::j#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@2
main::@return: scope:[main]  from main::@2
  return 
  to:@return
@1: scope:[]  from @begin
  (byte) GREEN#2 ← phi( @begin/(byte) GREEN#0 )
  (byte) RED#2 ← phi( @begin/(byte) RED#0 )
  (byte) WHITE#2 ← phi( @begin/(byte) WHITE#0 )
  call main 
  to:@2
@2: scope:[]  from @1
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(byte) GREEN
(byte) GREEN#0
(byte) GREEN#1
(byte) GREEN#2
(byte) RED
(byte) RED#0
(byte) RED#1
(byte) RED#2
(byte) WHITE
(byte) WHITE#0
(byte) WHITE#1
(byte) WHITE#2
(void()) main()
(bool~) main::$0
(bool~) main::$1
(bool~) main::$2
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte*) main::cols
(byte*) main::cols#0
(byte*) main::cols#1
(byte*) main::cols#2
(byte*) main::cols#3
(byte[]) main::colseq
(byte[]) main::colseq#0
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i#4
(byte) main::j
(byte) main::j#0
(byte) main::j#1
(byte) main::j#2
(byte) main::j#3
(byte) main::j#4
(byte*) main::screen
(byte*) main::screen#0
(byte*) main::screen#1
(byte*) main::screen#2
(byte*) main::screen#3

Culled Empty Block (label) @2
Successful SSA optimization Pass2CullEmptyBlocks
Inversing boolean not [14] (bool~) main::$1 ← (byte) main::j#1 != (byte/signed byte/word/signed word/dword/signed dword) 3 from [13] (bool~) main::$0 ← (byte) main::j#1 == (byte/signed byte/word/signed word/dword/signed dword) 3
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) main::i#2 = (byte) main::i#4 
Alias (byte*) main::screen#1 = (byte*) main::screen#3 
Alias (byte*) main::cols#1 = (byte*) main::cols#3 
Alias (byte) WHITE#0 = (byte) WHITE#2 
Alias (byte) RED#0 = (byte) RED#2 
Alias (byte) GREEN#0 = (byte) GREEN#2 
Successful SSA optimization Pass2AliasElimination
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (byte*) main::screen#1 = (byte*) main::screen#2 
Alias (byte*) main::cols#1 = (byte*) main::cols#2 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte*) main::screen#1
Self Phi Eliminated (byte*) main::cols#1
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte) WHITE#1 (byte) WHITE#0
Redundant Phi (byte) RED#1 (byte) RED#0
Redundant Phi (byte) GREEN#1 (byte) GREEN#0
Redundant Phi (byte*) main::screen#1 (byte*) main::screen#0
Redundant Phi (byte*) main::cols#1 (byte*) main::cols#0
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$1 [15] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@2
Simple Condition (bool~) main::$2 [19] if((byte) main::i#1!=rangelast(0,39)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) WHITE#0 = 1
Constant (const byte) RED#0 = 2
Constant (const byte) GREEN#0 = 5
Constant (const byte*) main::screen#0 = ((byte*))1024
Constant (const byte*) main::cols#0 = ((byte*))55296
Constant (const byte) main::j#0 = 0
Constant (const byte) main::i#0 = 0
Constant (const byte) main::j#2 = 0
Successful SSA optimization Pass2ConstantIdentification
Constant (const byte[]) main::colseq#0 = { WHITE#0, RED#0, GREEN#0 }
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,39)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 40
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::j#2
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::j#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@5(between main::@2 and main::@1)
Added new block during phi lifting main::@6(between main::@1 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
CALL GRAPH
Calls in [] to main:2 

Created 3 initial phi equivalence classes
Coalesced [15] main::i#5 ← main::i#1
Coalesced [16] main::j#5 ← main::j#4
Coalesced [17] main::j#6 ← main::j#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@5
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@6

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@1
@1: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @1
  [3] phi()
main: scope:[main]  from @1
  [4] phi()
  to:main::@1
main::@1: scope:[main]  from main main::@2
  [5] (byte) main::j#3 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@2/(byte) main::j#4 )
  [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@2/(byte) main::i#1 )
  [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*'
  [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3)
  [8] (byte) main::j#1 ← ++ (byte) main::j#3
  [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@6
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@6
  [10] (byte) main::j#4 ← phi( main::@6/(byte) main::j#1 main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 )
  [11] (byte) main::i#1 ← ++ (byte) main::i#2
  [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@2
  [13] return 
  to:@return
main::@6: scope:[main]  from main::@1
  [14] phi()
  to:main::@2


VARIABLE REGISTER WEIGHTS
(byte) GREEN
(byte) RED
(byte) WHITE
(void()) main()
(byte*) main::cols
(byte[]) main::colseq
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 6.285714285714286
(byte) main::j
(byte) main::j#1 11.0
(byte) main::j#3 11.0
(byte) main::j#4 7.333333333333333
(byte*) main::screen

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#3 main::j#4 main::j#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#3 main::j#4 main::j#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::j#3 main::j#4 main::j#1 ]

INITIAL ASM
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .const WHITE = 1
  .const RED = 2
  .const GREEN = 5
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label screen = $400
    .label cols = $d800
    .label j = 3
    .label i = 2
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::j#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta j
  //SEG13 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1 
    lda #0
    sta i
    jmp b1
  //SEG14 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
  //SEG15 [5] phi (byte) main::j#3 = (byte) main::j#4 [phi:main::@2->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2 
    ldy i
    lda #'*'
    sta screen,y
  //SEG19 [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2 
    ldy j
    lda colseq,y
    ldy i
    sta cols,y
  //SEG20 [8] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuz1=_inc_vbuz1 
    inc j
  //SEG21 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@6 -- vbuz1_neq_vbuc1_then_la1 
    lda j
    cmp #3
    bne b6_from_b1
  //SEG22 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
  //SEG23 [10] phi (byte) main::j#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta j
    jmp b2
  //SEG24 main::@2
  b2:
  //SEG25 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc i
  //SEG26 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda i
    cmp #$28
    bne b1_from_b2
    jmp breturn
  //SEG27 main::@return
  breturn:
  //SEG28 [13] return 
    rts
  //SEG29 [14] phi from main::@1 to main::@6 [phi:main::@1->main::@6]
  b6_from_b1:
    jmp b6
  //SEG30 main::@6
  b6:
  //SEG31 [10] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  b2_from_b6:
  //SEG32 [10] phi (byte) main::j#4 = (byte) main::j#1 [phi:main::@6->main::@2#0] -- register_copy 
    jmp b2
    colseq: .byte WHITE, RED, GREEN
}

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 main::j#3 ] ( main:2 [ main::i#2 main::j#3 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::j#3 main::j#4 main::j#1 ]
Statement [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3) [ main::i#2 main::j#3 ] ( main:2 [ main::i#2 main::j#3 ] ) always clobbers reg byte a 
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 main::j#3 ] ( main:2 [ main::i#2 main::j#3 ] ) always clobbers reg byte a 
Statement [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3) [ main::i#2 main::j#3 ] ( main:2 [ main::i#2 main::j#3 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::j#3 main::j#4 main::j#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 29.33: zp ZP_BYTE:3 [ main::j#3 main::j#4 main::j#1 ] 22.79: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 
Uplift Scope [] 

Uplifting [main] best 553 combination reg byte y [ main::j#3 main::j#4 main::j#1 ] reg byte x [ main::i#2 main::i#1 ] 
Uplifting [] best 553 combination 

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .const WHITE = 1
  .const RED = 2
  .const GREEN = 5
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
//SEG5 @1
b1:
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
//SEG9 @end
bend:
//SEG10 main
main: {
    .label screen = $400
    .label cols = $d800
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::j#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
  //SEG13 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #0
    jmp b1
  //SEG14 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  b1_from_b2:
  //SEG15 [5] phi (byte) main::j#3 = (byte) main::j#4 [phi:main::@2->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp b1
  //SEG17 main::@1
  b1:
  //SEG18 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta screen,x
  //SEG19 [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda colseq,y
    sta cols,x
  //SEG20 [8] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuyy=_inc_vbuyy 
    iny
  //SEG21 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@6 -- vbuyy_neq_vbuc1_then_la1 
    cpy #3
    bne b6_from_b1
  //SEG22 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
  //SEG23 [10] phi (byte) main::j#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1 
    ldy #0
    jmp b2
  //SEG24 main::@2
  b2:
  //SEG25 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG26 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$28
    bne b1_from_b2
    jmp breturn
  //SEG27 main::@return
  breturn:
  //SEG28 [13] return 
    rts
  //SEG29 [14] phi from main::@1 to main::@6 [phi:main::@1->main::@6]
  b6_from_b1:
    jmp b6
  //SEG30 main::@6
  b6:
  //SEG31 [10] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  b2_from_b6:
  //SEG32 [10] phi (byte) main::j#4 = (byte) main::j#1 [phi:main::@6->main::@2#0] -- register_copy 
    jmp b2
    colseq: .byte WHITE, RED, GREEN
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp b6
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b6_from_b1 with b6
Replacing label b1_from_b2 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b2:
Removing instruction b6_from_b1:
Removing instruction b2_from_b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b2_from_b1:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Skipping double jump to b2 in bne b6
Succesful ASM optimization Pass5DoubleJumpElimination
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Removing instruction b6:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction jmp b2
Succesful ASM optimization Pass5UnreachableCodeElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte) GREEN
(const byte) GREEN#0 GREEN = (byte/signed byte/word/signed word/dword/signed dword) 5
(byte) RED
(const byte) RED#0 RED = (byte/signed byte/word/signed word/dword/signed dword) 2
(byte) WHITE
(const byte) WHITE#0 WHITE = (byte/signed byte/word/signed word/dword/signed dword) 1
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@6
(label) main::@return
(byte*) main::cols
(const byte*) main::cols#0 cols = ((byte*))(word/dword/signed dword) 55296
(byte[]) main::colseq
(const byte[]) main::colseq#0 colseq = { (const byte) WHITE#0, (const byte) RED#0, (const byte) GREEN#0 }
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.285714285714286
(byte) main::j
(byte) main::j#1 reg byte y 11.0
(byte) main::j#3 reg byte y 11.0
(byte) main::j#4 reg byte y 7.333333333333333
(byte*) main::screen
(const byte*) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024

reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::j#3 main::j#4 main::j#1 ]


FINAL ASSEMBLER
Score: 361

//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .const WHITE = 1
  .const RED = 2
  .const GREEN = 5
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main 
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
    .label screen = $400
    .label cols = $d800
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  //SEG12 [5] phi (byte) main::j#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
  //SEG13 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #0
  //SEG14 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  //SEG15 [5] phi (byte) main::j#3 = (byte) main::j#4 [phi:main::@2->main::@1#0] -- register_copy 
  //SEG16 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy 
  //SEG17 main::@1
  b1:
  //SEG18 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 
    lda #'*'
    sta screen,x
  //SEG19 [7] *((const byte*) main::cols#0 + (byte) main::i#2) ← *((const byte[]) main::colseq#0 + (byte) main::j#3) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy 
    lda colseq,y
    sta cols,x
  //SEG20 [8] (byte) main::j#1 ← ++ (byte) main::j#3 -- vbuyy=_inc_vbuyy 
    iny
  //SEG21 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@6 -- vbuyy_neq_vbuc1_then_la1 
    cpy #3
    bne b2
  //SEG22 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  //SEG23 [10] phi (byte) main::j#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1 
    ldy #0
  //SEG24 main::@2
  b2:
  //SEG25 [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx 
    inx
  //SEG26 [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$28
    bne b1
  //SEG27 main::@return
  //SEG28 [13] return 
    rts
  //SEG29 [14] phi from main::@1 to main::@6 [phi:main::@1->main::@6]
  //SEG30 main::@6
  //SEG31 [10] phi from main::@6 to main::@2 [phi:main::@6->main::@2]
  //SEG32 [10] phi (byte) main::j#4 = (byte) main::j#1 [phi:main::@6->main::@2#0] -- register_copy 
    colseq: .byte WHITE, RED, GREEN
}

