Identified constant variable (byte*) print::SCREEN
Culled Empty Block (label) main::@6
Culled Empty Block (label) @1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2
main: scope:[main]  from @2
  (byte) main::x#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@5
  (byte) main::x#7 ← phi( main/(byte) main::x#0 main::@5/(byte) main::x#1 )
  (byte) main::y#0 ← (byte) 0
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@4
  (byte) main::y#4 ← phi( main::@1/(byte) main::y#0 main::@4/(byte) main::y#1 )
  (byte) main::x#4 ← phi( main::@1/(byte) main::x#7 main::@4/(byte) main::x#6 )
  (byte) main::a#0 ← (byte) 0
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@7
  (byte) main::y#2 ← phi( main::@2/(byte) main::y#4 main::@7/(byte) main::y#5 )
  (byte) main::x#2 ← phi( main::@2/(byte) main::x#4 main::@7/(byte) main::x#5 )
  (byte) main::a#2 ← phi( main::@2/(byte) main::a#0 main::@7/(byte) main::a#1 )
  (byte~) main::$0 ← (byte) main::a#2 + (byte) main::x#2
  (byte) main::val1#0 ← (byte~) main::$0
  (byte) print::idx#0 ← (byte) main::y#2
  (byte) print::val#0 ← (byte) main::val1#0
  call print 
  to:main::@7
main::@7: scope:[main]  from main::@3
  (byte) main::y#5 ← phi( main::@3/(byte) main::y#2 )
  (byte) main::x#5 ← phi( main::@3/(byte) main::x#2 )
  (byte) main::a#3 ← phi( main::@3/(byte) main::a#2 )
  (byte) main::a#1 ← (byte) main::a#3 + rangenext(0,$64)
  (bool~) main::$2 ← (byte) main::a#1 != rangelast(0,$64)
  if((bool~) main::$2) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@7
  (byte) main::x#6 ← phi( main::@7/(byte) main::x#5 )
  (byte) main::y#3 ← phi( main::@7/(byte) main::y#5 )
  (byte) main::y#1 ← (byte) main::y#3 + rangenext(0,$64)
  (bool~) main::$3 ← (byte) main::y#1 != rangelast(0,$64)
  if((bool~) main::$3) goto main::@2
  to:main::@5
main::@5: scope:[main]  from main::@4
  (byte) main::x#3 ← phi( main::@4/(byte) main::x#6 )
  (byte) main::x#1 ← (byte) main::x#3 + rangenext(0,$64)
  (bool~) main::$4 ← (byte) main::x#1 != rangelast(0,$64)
  if((bool~) main::$4) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@5
  return 
  to:@return
print: scope:[print]  from main::@3
  (byte) print::idx#1 ← phi( main::@3/(byte) print::idx#0 )
  (byte) print::val#1 ← phi( main::@3/(byte) print::val#0 )
  (byte*) print::SCREEN#0 ← ((byte*)) (number) $400
  *((byte*) print::SCREEN#0 + (byte) print::idx#1) ← (byte) print::val#1
  to:print::@return
print::@return: scope:[print]  from print
  return 
  to:@return
@2: scope:[]  from @begin
  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
(void()) main()
(byte~) main::$0
(bool~) main::$2
(bool~) main::$3
(bool~) main::$4
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@7
(label) main::@return
(byte) main::a
(byte) main::a#0
(byte) main::a#1
(byte) main::a#2
(byte) main::a#3
(byte) main::val1 !reg byte a
(byte) main::val1#0 !reg byte a
(byte) main::x !reg byte y
(byte) main::x#0 !reg byte y
(byte) main::x#1 !reg byte y
(byte) main::x#2 !reg byte y
(byte) main::x#3 !reg byte y
(byte) main::x#4 !reg byte y
(byte) main::x#5 !reg byte y
(byte) main::x#6 !reg byte y
(byte) main::x#7 !reg byte y
(byte) main::y
(byte) main::y#0
(byte) main::y#1
(byte) main::y#2
(byte) main::y#3
(byte) main::y#4
(byte) main::y#5
(void()) print((byte) print::idx , (byte) print::val)
(label) print::@return
(byte*) print::SCREEN
(byte*) print::SCREEN#0
(byte) print::idx !reg byte x
(byte) print::idx#0 !reg byte x
(byte) print::idx#1 !reg byte x
(byte) print::val
(byte) print::val#0
(byte) print::val#1

Inlining cast (byte*) print::SCREEN#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) main::val1#0 = (byte~) main::$0 
Alias (byte) main::a#2 = (byte) main::a#3 
Alias (byte) main::x#2 = (byte) main::x#5 (byte) main::x#6 (byte) main::x#3 
Alias (byte) main::y#2 = (byte) main::y#5 (byte) main::y#3 
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (byte) main::x#2
Self Phi Eliminated (byte) main::y#2
Successful SSA optimization Pass2SelfPhiElimination
Identical Phi Values (byte) main::x#2 (byte) main::x#4
Identical Phi Values (byte) main::y#2 (byte) main::y#4
Identical Phi Values (byte) print::val#1 (byte) print::val#0
Identical Phi Values (byte) print::idx#1 (byte) print::idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$2 [14] if((byte) main::a#1!=rangelast(0,$64)) goto main::@3
Simple Condition (bool~) main::$3 [18] if((byte) main::y#1!=rangelast(0,$64)) goto main::@2
Simple Condition (bool~) main::$4 [22] if((byte) main::x#1!=rangelast(0,$64)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::x#0 = 0
Constant (const byte) main::y#0 = 0
Constant (const byte) main::a#0 = 0
Constant (const byte*) print::SCREEN#0 = (byte*) 1024
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [12] main::a#1 ← ++ main::a#2 to ++
Resolved ranged comparison value [14] if(main::a#1!=rangelast(0,$64)) goto main::@3 to (number) $65
Resolved ranged next value [16] main::y#1 ← ++ main::y#4 to ++
Resolved ranged comparison value [18] if(main::y#1!=rangelast(0,$64)) goto main::@2 to (number) $65
Resolved ranged next value [20] main::x#1 ← ++ main::x#4 to ++
Resolved ranged comparison value [22] if(main::x#1!=rangelast(0,$64)) goto main::@1 to (number) $65
Adding number conversion cast (unumber) $65 in if((byte) main::a#1!=(number) $65) goto main::@3
Adding number conversion cast (unumber) $65 in if((byte) main::y#1!=(number) $65) goto main::@2
Adding number conversion cast (unumber) $65 in if((byte) main::x#1!=(number) $65) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $65
Simplifying constant integer cast $65
Simplifying constant integer cast $65
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $65
Finalized unsigned number type (byte) $65
Finalized unsigned number type (byte) $65
Successful SSA optimization PassNFinalizeNumberTypeConversions
Self Phi Eliminated (byte) main::x#4
Successful SSA optimization Pass2SelfPhiElimination
Identical Phi Values (byte) main::x#4 (byte) main::x#7
Successful SSA optimization Pass2IdenticalPhiElimination
Inlining constant with var siblings (const byte) main::x#0
Inlining constant with var siblings (const byte) main::y#0
Inlining constant with var siblings (const byte) main::a#0
Constant inlined main::a#0 = (byte) 0
Constant inlined main::x#0 = (byte) 0
Constant inlined main::y#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@8(between main::@5 and main::@1)
Added new block during phi lifting main::@9(between main::@4 and main::@2)
Added new block during phi lifting main::@10(between main::@7 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
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 print:12 

Created 3 initial phi equivalence classes
Coalesced [20] main::x#8 ← main::x#1
Coalesced [21] main::y#6 ← main::y#1
Coalesced [22] main::a#4 ← main::a#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@10
Renumbering block @2 to @1
Renumbering block main::@7 to main::@6
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

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::@5
  [5] (byte) main::x#7 ← phi( main/(byte) 0 main::@5/(byte) main::x#1 )
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@4
  [6] (byte) main::y#4 ← phi( main::@1/(byte) 0 main::@4/(byte) main::y#1 )
  to:main::@3
main::@3: scope:[main]  from main::@2 main::@6
  [7] (byte) main::a#2 ← phi( main::@2/(byte) 0 main::@6/(byte) main::a#1 )
  [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7
  [9] (byte) print::idx#0 ← (byte) main::y#4
  [10] (byte) print::val#0 ← (byte) main::val1#0
  [11] call print 
  to:main::@6
main::@6: scope:[main]  from main::@3
  [12] (byte) main::a#1 ← ++ (byte) main::a#2
  [13] if((byte) main::a#1!=(byte) $65) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@6
  [14] (byte) main::y#1 ← ++ (byte) main::y#4
  [15] if((byte) main::y#1!=(byte) $65) goto main::@2
  to:main::@5
main::@5: scope:[main]  from main::@4
  [16] (byte) main::x#1 ← ++ (byte) main::x#7
  [17] if((byte) main::x#1!=(byte) $65) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@5
  [18] return 
  to:@return
print: scope:[print]  from main::@3
  [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0
  to:print::@return
print::@return: scope:[print]  from print
  [20] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::a
(byte) main::a#1 1501.5
(byte) main::a#2 600.5999999999999
(byte) main::val1 !reg byte a
(byte) main::val1#0 !reg byte a 1001.0
(byte) main::x !reg byte y
(byte) main::x#1 !reg byte y 16.5
(byte) main::x#7 !reg byte y 93.0
(byte) main::y
(byte) main::y#1 151.5
(byte) main::y#4 150.375
(void()) print((byte) print::idx , (byte) print::val)
(byte*) print::SCREEN
(byte) print::idx !reg byte x
(byte) print::idx#0 !reg byte x 501.5
(byte) print::val
(byte) print::val#0 1003.0

Initial phi equivalence classes
[ main::x#7 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
Added variable main::val1#0 to zero page equivalence class [ main::val1#0 ]
Added variable print::idx#0 to zero page equivalence class [ print::idx#0 ]
Added variable print::val#0 to zero page equivalence class [ print::val#0 ]
Complete equivalence classes
[ main::x#7 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
[ main::val1#0 ]
[ print::idx#0 ]
[ print::val#0 ]
Allocated zp ZP_BYTE:2 [ main::y#4 main::y#1 ]
Allocated zp ZP_BYTE:3 [ main::a#2 main::a#1 ]
Allocated zp ZP_BYTE:4 [ print::val#0 ]

INITIAL ASM
  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label a = 3
    .label y = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (byte) main::x#7 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    jmp b1
    // [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
  b1_from_b5:
    // [5] phi (byte) main::x#7 = (byte) main::x#1 [phi:main::@5->main::@1#0] -- register_copy 
    jmp b1
    // main::@1
  b1:
    // [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    // [6] phi (byte) main::y#4 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 
    lda #0
    sta y
    jmp b2
    // [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  b2_from_b4:
    // [6] phi (byte) main::y#4 = (byte) main::y#1 [phi:main::@4->main::@2#0] -- register_copy 
    jmp b2
    // main::@2
  b2:
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    // [7] phi (byte) main::a#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 
    lda #0
    sta a
    jmp b3
    // [7] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
  b3_from_b6:
    // [7] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@6->main::@3#0] -- register_copy 
    jmp b3
    // main::@3
  b3:
    // [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7 -- vbuaa=vbuz1_plus_vbuyy 
    tya
    clc
    adc a
    // [9] (byte) print::idx#0 ← (byte) main::y#4 -- vbuxx=vbuz1 
    ldx y
    // [10] (byte) print::val#0 ← (byte) main::val1#0 -- vbuz1=vbuaa 
    sta print.val
    // [11] call print 
    jsr print
    jmp b6
    // main::@6
  b6:
    // [12] (byte) main::a#1 ← ++ (byte) main::a#2 -- vbuz1=_inc_vbuz1 
    inc a
    // [13] if((byte) main::a#1!=(byte) $65) goto main::@3 -- vbuz1_neq_vbuc1_then_la1 
    lda #$65
    cmp a
    bne b3_from_b6
    jmp b4
    // main::@4
  b4:
    // [14] (byte) main::y#1 ← ++ (byte) main::y#4 -- vbuz1=_inc_vbuz1 
    inc y
    // [15] if((byte) main::y#1!=(byte) $65) goto main::@2 -- vbuz1_neq_vbuc1_then_la1 
    lda #$65
    cmp y
    bne b2_from_b4
    jmp b5
    // main::@5
  b5:
    // [16] (byte) main::x#1 ← ++ (byte) main::x#7 -- vbuyy=_inc_vbuyy 
    iny
    // [17] if((byte) main::x#1!=(byte) $65) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #$65
    bne b1_from_b5
    jmp breturn
    // main::@return
  breturn:
    // [18] return 
    rts
}
  // print
// print(byte register(X) idx, byte zeropage(4) val)
print: {
    .label SCREEN = $400
    .label val = 4
    // [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0 -- pbuc1_derefidx_vbuxx=vbuz1 
    lda val
    sta SCREEN,x
    jmp breturn
    // print::@return
  breturn:
    // [20] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7 [ main::x#7 main::y#4 main::a#2 main::val1#0 ] ( main:2 [ main::x#7 main::y#4 main::a#2 main::val1#0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::y#4 main::y#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::a#2 main::a#1 ]
Statement [16] (byte) main::x#1 ← ++ (byte) main::x#7 [ main::x#1 ] ( main:2 [ main::x#1 ] ) always clobbers reg byte y 
Statement [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7 [ main::x#7 main::y#4 main::a#2 main::val1#0 ] ( main:2 [ main::x#7 main::y#4 main::a#2 main::val1#0 ] ) always clobbers reg byte a 
Statement [16] (byte) main::x#1 ← ++ (byte) main::x#7 [ main::x#1 ] ( main:2 [ main::x#1 ] ) always clobbers reg byte y 
Potential registers reg byte y [ main::x#7 main::x#1 ] : reg byte y , 
Potential registers zp ZP_BYTE:2 [ main::y#4 main::y#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::a#2 main::a#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 
Potential registers reg byte a [ main::val1#0 ] : reg byte a , 
Potential registers reg byte x [ print::idx#0 ] : reg byte x , 
Potential registers zp ZP_BYTE:4 [ print::val#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 2,102.1: zp ZP_BYTE:3 [ main::a#2 main::a#1 ] 1,001: reg byte a [ main::val1#0 ] 301.88: zp ZP_BYTE:2 [ main::y#4 main::y#1 ] 109.5: reg byte y [ main::x#7 main::x#1 ] 
Uplift Scope [print] 1,003: zp ZP_BYTE:4 [ print::val#0 ] 501.5: reg byte x [ print::idx#0 ] 
Uplift Scope [] 

Uplifting [main] best 47460 combination zp ZP_BYTE:3 [ main::a#2 main::a#1 ] reg byte a [ main::val1#0 ] reg byte x [ main::y#4 main::y#1 ] reg byte y [ main::x#7 main::x#1 ] 
Uplifting [print] best 44457 combination reg byte a [ print::val#0 ] reg byte x [ print::idx#0 ] 
Uplifting [] best 44457 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::a#2 main::a#1 ]
Uplifting [main] best 44457 combination zp ZP_BYTE:3 [ main::a#2 main::a#1 ] 
Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ main::a#2 main::a#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
main_from_b1:
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label a = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    // [5] phi (byte) main::x#7 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    jmp b1
    // [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
  b1_from_b5:
    // [5] phi (byte) main::x#7 = (byte) main::x#1 [phi:main::@5->main::@1#0] -- register_copy 
    jmp b1
    // main::@1
  b1:
    // [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    // [6] phi (byte) main::y#4 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    jmp b2
    // [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
  b2_from_b4:
    // [6] phi (byte) main::y#4 = (byte) main::y#1 [phi:main::@4->main::@2#0] -- register_copy 
    jmp b2
    // main::@2
  b2:
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  b3_from_b2:
    // [7] phi (byte) main::a#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 
    lda #0
    sta a
    jmp b3
    // [7] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
  b3_from_b6:
    // [7] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@6->main::@3#0] -- register_copy 
    jmp b3
    // main::@3
  b3:
    // [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7 -- vbuaa=vbuz1_plus_vbuyy 
    tya
    clc
    adc a
    // [9] (byte) print::idx#0 ← (byte) main::y#4
    // [10] (byte) print::val#0 ← (byte) main::val1#0
    // [11] call print 
    jsr print
    jmp b6
    // main::@6
  b6:
    // [12] (byte) main::a#1 ← ++ (byte) main::a#2 -- vbuz1=_inc_vbuz1 
    inc a
    // [13] if((byte) main::a#1!=(byte) $65) goto main::@3 -- vbuz1_neq_vbuc1_then_la1 
    lda #$65
    cmp a
    bne b3_from_b6
    jmp b4
    // main::@4
  b4:
    // [14] (byte) main::y#1 ← ++ (byte) main::y#4 -- vbuxx=_inc_vbuxx 
    inx
    // [15] if((byte) main::y#1!=(byte) $65) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne b2_from_b4
    jmp b5
    // main::@5
  b5:
    // [16] (byte) main::x#1 ← ++ (byte) main::x#7 -- vbuyy=_inc_vbuyy 
    iny
    // [17] if((byte) main::x#1!=(byte) $65) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #$65
    bne b1_from_b5
    jmp breturn
    // main::@return
  breturn:
    // [18] return 
    rts
}
  // print
// print(byte register(X) idx, byte register(A) val)
print: {
    .label SCREEN = $400
    // [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    jmp breturn
    // print::@return
  breturn:
    // [20] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b6
Removing instruction jmp b4
Removing instruction jmp b5
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b3_from_b6 with b3
Replacing label b2_from_b4 with b2
Replacing label b1_from_b5 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b5:
Removing instruction b2_from_b1:
Removing instruction b2_from_b4:
Removing instruction b3_from_b2:
Removing instruction b3_from_b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b6:
Removing instruction b4:
Removing instruction b5:
Removing instruction breturn:
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 b2
Removing instruction jmp b3
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte) main::a
(byte) main::a#1 a zp ZP_BYTE:2 1501.5
(byte) main::a#2 a zp ZP_BYTE:2 600.5999999999999
(byte) main::val1 !reg byte a
(byte) main::val1#0 !reg byte a 1001.0
(byte) main::x !reg byte y
(byte) main::x#1 !reg byte y 16.5
(byte) main::x#7 !reg byte y 93.0
(byte) main::y
(byte) main::y#1 reg byte x 151.5
(byte) main::y#4 reg byte x 150.375
(void()) print((byte) print::idx , (byte) print::val)
(label) print::@return
(byte*) print::SCREEN
(const byte*) print::SCREEN#0 SCREEN = (byte*) 1024
(byte) print::idx !reg byte x
(byte) print::idx#0 !reg byte x 501.5
(byte) print::val
(byte) print::val#0 reg byte a 1003.0

reg byte y [ main::x#7 main::x#1 ]
reg byte x [ main::y#4 main::y#1 ]
zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
reg byte a [ main::val1#0 ]
reg byte x [ print::idx#0 ]
reg byte a [ print::val#0 ]


FINAL ASSEMBLER
Score: 31452

  // File Comments
  // Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [4] phi from @1 to main [phi:@1->main]
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label a = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::x#7 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    // [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
    // [5] phi (byte) main::x#7 = (byte) main::x#1 [phi:main::@5->main::@1#0] -- register_copy 
    // main::@1
  b1:
    // [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // [6] phi (byte) main::y#4 = (byte) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1 
    ldx #0
    // [6] phi from main::@4 to main::@2 [phi:main::@4->main::@2]
    // [6] phi (byte) main::y#4 = (byte) main::y#1 [phi:main::@4->main::@2#0] -- register_copy 
    // main::@2
  b2:
    // [7] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
    // [7] phi (byte) main::a#2 = (byte) 0 [phi:main::@2->main::@3#0] -- vbuz1=vbuc1 
    lda #0
    sta a
    // [7] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
    // [7] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@6->main::@3#0] -- register_copy 
    // main::@3
  b3:
    // val1 = a+x
    // [8] (byte) main::val1#0 ← (byte) main::a#2 + (byte) main::x#7 -- vbuaa=vbuz1_plus_vbuyy 
    tya
    clc
    adc a
    // print(y, val1)
    // [9] (byte) print::idx#0 ← (byte) main::y#4
    // [10] (byte) print::val#0 ← (byte) main::val1#0
    // [11] call print 
    jsr print
    // main::@6
    // for( byte a: 0..100 )
    // [12] (byte) main::a#1 ← ++ (byte) main::a#2 -- vbuz1=_inc_vbuz1 
    inc a
    // [13] if((byte) main::a#1!=(byte) $65) goto main::@3 -- vbuz1_neq_vbuc1_then_la1 
    lda #$65
    cmp a
    bne b3
    // main::@4
    // for( byte y: 0..100 )
    // [14] (byte) main::y#1 ← ++ (byte) main::y#4 -- vbuxx=_inc_vbuxx 
    inx
    // [15] if((byte) main::y#1!=(byte) $65) goto main::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne b2
    // main::@5
    // for( register(Y) byte x: 0..100 )
    // [16] (byte) main::x#1 ← ++ (byte) main::x#7 -- vbuyy=_inc_vbuyy 
    iny
    // [17] if((byte) main::x#1!=(byte) $65) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #$65
    bne b1
    // main::@return
    // }
    // [18] return 
    rts
}
  // print
// print(byte register(X) idx, byte register(A) val)
print: {
    .label SCREEN = $400
    // SCREEN[idx] = val
    // [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // print::@return
    // }
    // [20] return 
    rts
}
  // File Data

