Identified constant variable (byte) main::reg_zp_flex
Identified constant variable (byte) main::reg_zp_abs
Identified constant variable (byte) main::reg_mem_flex
Identified constant variable (byte) main::reg_mem_abs
Identified constant variable (byte) main::default_default
Identified constant variable (byte) main::reg_default
Identified constant variable (byte) main::default_zp_flex
Identified constant variable (byte) main::default_zp_abs
Identified constant variable (byte) main::default_mem_flex
Identified constant variable (byte) main::default_mem_abs
Culled Empty Block (label) @1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) i#0 ← (byte) 0
  to:@2

(void()) main()
main: scope:[main]  from @2
  (byte) i#29 ← phi( @2/(byte) i#30 )
  (byte) out::c#0 ← (const byte) main::reg_zp_flex
  call out 
  to:main::@1
main::@1: scope:[main]  from main
  (byte) i#15 ← phi( main/(byte) i#13 )
  (byte) i#1 ← (byte) i#15
  (byte) out::c#1 ← (const byte) main::reg_zp_abs
  call out 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) i#16 ← phi( main::@1/(byte) i#13 )
  (byte) i#2 ← (byte) i#16
  (byte) out::c#2 ← (const byte) main::reg_mem_flex
  call out 
  to:main::@3
main::@3: scope:[main]  from main::@2
  (byte) i#17 ← phi( main::@2/(byte) i#13 )
  (byte) i#3 ← (byte) i#17
  (byte) out::c#3 ← (const byte) main::reg_mem_abs
  call out 
  to:main::@4
main::@4: scope:[main]  from main::@3
  (byte) i#18 ← phi( main::@3/(byte) i#13 )
  (byte) i#4 ← (byte) i#18
  (byte) out::c#4 ← (const byte) main::default_default
  call out 
  to:main::@5
main::@5: scope:[main]  from main::@4
  (byte) i#19 ← phi( main::@4/(byte) i#13 )
  (byte) i#5 ← (byte) i#19
  (byte) out::c#5 ← (const byte) main::reg_default
  call out 
  to:main::@6
main::@6: scope:[main]  from main::@5
  (byte) i#20 ← phi( main::@5/(byte) i#13 )
  (byte) i#6 ← (byte) i#20
  (byte) out::c#6 ← (const byte) main::default_zp_flex
  call out 
  to:main::@7
main::@7: scope:[main]  from main::@6
  (byte) i#21 ← phi( main::@6/(byte) i#13 )
  (byte) i#7 ← (byte) i#21
  (byte) out::c#7 ← (const byte) main::default_zp_abs
  call out 
  to:main::@8
main::@8: scope:[main]  from main::@7
  (byte) i#22 ← phi( main::@7/(byte) i#13 )
  (byte) i#8 ← (byte) i#22
  (byte) out::c#8 ← (const byte) main::default_mem_flex
  call out 
  to:main::@9
main::@9: scope:[main]  from main::@8
  (byte) i#23 ← phi( main::@8/(byte) i#13 )
  (byte) i#9 ← (byte) i#23
  (byte) out::c#9 ← (const byte) main::default_mem_abs
  call out 
  to:main::@10
main::@10: scope:[main]  from main::@9
  (byte) i#24 ← phi( main::@9/(byte) i#13 )
  (byte) i#10 ← (byte) i#24
  to:main::@return
main::@return: scope:[main]  from main::@10
  (byte) i#25 ← phi( main::@10/(byte) i#10 )
  (byte) i#11 ← (byte) i#25
  return 
  to:@return

(void()) out((byte) out::c)
out: scope:[out]  from main main::@1 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9
  (byte) i#26 ← phi( main/(byte) i#29 main::@1/(byte) i#1 main::@2/(byte) i#2 main::@3/(byte) i#3 main::@4/(byte) i#4 main::@5/(byte) i#5 main::@6/(byte) i#6 main::@7/(byte) i#7 main::@8/(byte) i#8 main::@9/(byte) i#9 )
  (byte) out::c#10 ← phi( main/(byte) out::c#0 main::@1/(byte) out::c#1 main::@2/(byte) out::c#2 main::@3/(byte) out::c#3 main::@4/(byte) out::c#4 main::@5/(byte) out::c#5 main::@6/(byte) out::c#6 main::@7/(byte) out::c#7 main::@8/(byte) out::c#8 main::@9/(byte) out::c#9 )
  *((const byte*) SCREEN + (byte) i#26) ← (byte) out::c#10
  (byte) i#12 ← ++ (byte) i#26
  to:out::@return
out::@return: scope:[out]  from out
  (byte) i#27 ← phi( out/(byte) i#12 )
  (byte) i#13 ← (byte) i#27
  return 
  to:@return
@2: scope:[]  from @begin
  (byte) i#30 ← phi( @begin/(byte) i#0 )
  call main 
  to:@3
@3: scope:[]  from @2
  (byte) i#28 ← phi( @2/(byte) i#11 )
  (byte) i#14 ← (byte) i#28
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte) i
(byte) i#0
(byte) i#1
(byte) i#10
(byte) i#11
(byte) i#12
(byte) i#13
(byte) i#14
(byte) i#15
(byte) i#16
(byte) i#17
(byte) i#18
(byte) i#19
(byte) i#2
(byte) i#20
(byte) i#21
(byte) i#22
(byte) i#23
(byte) i#24
(byte) i#25
(byte) i#26
(byte) i#27
(byte) i#28
(byte) i#29
(byte) i#3
(byte) i#30
(byte) i#4
(byte) i#5
(byte) i#6
(byte) i#7
(byte) i#8
(byte) i#9
(void()) main()
(label) main::@1
(label) main::@10
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(const byte) main::default_default = (byte) '.'
(const byte) main::default_mem_abs !mem[-1]:4096 = (byte) '.'
(const byte) main::default_mem_flex = (byte) '.'
(const byte) main::default_zp_abs !zp[-1]:16 = (byte) '.'
(const byte) main::default_zp_flex = (byte) '.'
(const byte) main::reg_default = (byte) '.'
(const byte) main::reg_mem_abs !mem[-1]:4096 = (byte) '.'
(const byte) main::reg_mem_flex = (byte) '.'
(const byte) main::reg_zp_abs !zp[-1]:16 = (byte) '.'
(const byte) main::reg_zp_flex = (byte) '.'
(void()) out((byte) out::c)
(label) out::@return
(byte) out::c
(byte) out::c#0
(byte) out::c#1
(byte) out::c#10
(byte) out::c#2
(byte) out::c#3
(byte) out::c#4
(byte) out::c#5
(byte) out::c#6
(byte) out::c#7
(byte) out::c#8
(byte) out::c#9

Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) i#1 = (byte) i#15 
Alias (byte) i#16 = (byte) i#2 
Alias (byte) i#17 = (byte) i#3 
Alias (byte) i#18 = (byte) i#4 
Alias (byte) i#19 = (byte) i#5 
Alias (byte) i#20 = (byte) i#6 
Alias (byte) i#21 = (byte) i#7 
Alias (byte) i#22 = (byte) i#8 
Alias (byte) i#23 = (byte) i#9 
Alias (byte) i#10 = (byte) i#24 (byte) i#25 (byte) i#11 
Alias (byte) i#12 = (byte) i#27 (byte) i#13 
Alias (byte) i#0 = (byte) i#30 
Alias (byte) i#14 = (byte) i#28 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) i#29 (byte) i#0
Identical Phi Values (byte) i#1 (byte) i#12
Identical Phi Values (byte) i#16 (byte) i#12
Identical Phi Values (byte) i#17 (byte) i#12
Identical Phi Values (byte) i#18 (byte) i#12
Identical Phi Values (byte) i#19 (byte) i#12
Identical Phi Values (byte) i#20 (byte) i#12
Identical Phi Values (byte) i#21 (byte) i#12
Identical Phi Values (byte) i#22 (byte) i#12
Identical Phi Values (byte) i#23 (byte) i#12
Identical Phi Values (byte) i#10 (byte) i#12
Identical Phi Values (byte) i#14 (byte) i#10
Successful SSA optimization Pass2IdenticalPhiElimination
Constant (const byte) i#0 = 0
Constant (const byte) out::c#0 = main::reg_zp_flex
Constant (const byte) out::c#1 = main::reg_zp_abs
Constant (const byte) out::c#2 = main::reg_mem_flex
Constant (const byte) out::c#3 = main::reg_mem_abs
Constant (const byte) out::c#4 = main::default_default
Constant (const byte) out::c#5 = main::reg_default
Constant (const byte) out::c#6 = main::default_zp_flex
Constant (const byte) out::c#7 = main::default_zp_abs
Constant (const byte) out::c#8 = main::default_mem_flex
Constant (const byte) out::c#9 = main::default_mem_abs
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) out::c#0
Inlining constant with var siblings (const byte) out::c#1
Inlining constant with var siblings (const byte) out::c#2
Inlining constant with var siblings (const byte) out::c#3
Inlining constant with var siblings (const byte) out::c#4
Inlining constant with var siblings (const byte) out::c#5
Inlining constant with var siblings (const byte) out::c#6
Inlining constant with var siblings (const byte) out::c#7
Inlining constant with var siblings (const byte) out::c#8
Inlining constant with var siblings (const byte) out::c#9
Inlining constant with var siblings (const byte) i#0
Constant inlined out::c#8 = (const byte) main::default_mem_flex
Constant inlined out::c#9 = (const byte) main::default_mem_abs
Constant inlined out::c#6 = (const byte) main::default_zp_flex
Constant inlined out::c#7 = (const byte) main::default_zp_abs
Constant inlined i#0 = (byte) 0
Constant inlined out::c#0 = (const byte) main::reg_zp_flex
Constant inlined out::c#1 = (const byte) main::reg_zp_abs
Constant inlined out::c#4 = (const byte) main::default_default
Constant inlined out::c#5 = (const byte) main::reg_default
Constant inlined out::c#2 = (const byte) main::reg_mem_flex
Constant inlined out::c#3 = (const byte) main::reg_mem_abs
Successful SSA optimization Pass2ConstantInlining
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
Adding NOP phi() at start of main::@10
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to out:6 out:8 out:10 out:12 out:14 out:16 out:18 out:20 out:22 out:24 

Created 2 initial phi equivalence classes
Coalesced [7] i#31 ← i#12
Coalesced (already) [9] i#32 ← i#12
Coalesced (already) [11] i#33 ← i#12
Coalesced (already) [13] i#34 ← i#12
Coalesced (already) [15] i#35 ← i#12
Coalesced (already) [17] i#36 ← i#12
Coalesced (already) [19] i#37 ← i#12
Coalesced (already) [21] i#38 ← i#12
Coalesced (already) [23] i#39 ← i#12
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@10
Renumbering block @2 to @1
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::@1
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of main::@8
Adding NOP phi() at start of main::@9

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()

(void()) main()
main: scope:[main]  from @1
  [4] phi()
  [5] call out 
  to:main::@1
main::@1: scope:[main]  from main
  [6] phi()
  [7] call out 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [8] phi()
  [9] call out 
  to:main::@3
main::@3: scope:[main]  from main::@2
  [10] phi()
  [11] call out 
  to:main::@4
main::@4: scope:[main]  from main::@3
  [12] phi()
  [13] call out 
  to:main::@5
main::@5: scope:[main]  from main::@4
  [14] phi()
  [15] call out 
  to:main::@6
main::@6: scope:[main]  from main::@5
  [16] phi()
  [17] call out 
  to:main::@7
main::@7: scope:[main]  from main::@6
  [18] phi()
  [19] call out 
  to:main::@8
main::@8: scope:[main]  from main::@7
  [20] phi()
  [21] call out 
  to:main::@9
main::@9: scope:[main]  from main::@8
  [22] phi()
  [23] call out 
  to:main::@return
main::@return: scope:[main]  from main::@9
  [24] return 
  to:@return

(void()) out((byte) out::c)
out: scope:[out]  from main main::@1 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9
  [25] (byte) i#26 ← phi( main/(byte) 0 main::@1/(byte) i#12 main::@2/(byte) i#12 main::@3/(byte) i#12 main::@4/(byte) i#12 main::@5/(byte) i#12 main::@6/(byte) i#12 main::@7/(byte) i#12 main::@8/(byte) i#12 main::@9/(byte) i#12 )
  [25] (byte) out::c#10 ← phi( main/(const byte) main::reg_zp_flex main::@1/(const byte) main::reg_zp_abs main::@2/(const byte) main::reg_mem_flex main::@3/(const byte) main::reg_mem_abs main::@4/(const byte) main::default_default main::@5/(const byte) main::reg_default main::@6/(const byte) main::default_zp_flex main::@7/(const byte) main::default_zp_abs main::@8/(const byte) main::default_mem_flex main::@9/(const byte) main::default_mem_abs )
  [26] *((const byte*) SCREEN + (byte) i#26) ← (byte) out::c#10
  [27] (byte) i#12 ← ++ (byte) i#26
  to:out::@return
out::@return: scope:[out]  from out
  [28] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) i
(byte) i#12 0.9999999999999999
(byte) i#26 11.0
(void()) main()
(void()) out((byte) out::c)
(byte) out::c
(byte) out::c#10 2.0

Initial phi equivalence classes
[ out::c#10 ]
[ i#26 i#12 ]
Complete equivalence classes
[ out::c#10 ]
[ i#26 i#12 ]
Allocated zp[1]:2 [ out::c#10 ]
Allocated zp[1]:3 [ i#26 i#12 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .label i = 3
  // @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: {
    .const reg_zp_flex = '.'
    .const reg_zp_abs = '.'
    .const reg_mem_flex = '.'
    .const reg_mem_abs = '.'
    .const default_default = '.'
    .const reg_default = '.'
    .const default_zp_flex = '.'
    .const default_zp_abs = '.'
    .const default_mem_flex = '.'
    .const default_mem_abs = '.'
    // [5] call out 
    // [25] phi from main to out [phi:main->out]
  out_from_main:
    // [25] phi (byte) i#26 = (byte) 0 [phi:main->out#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_flex [phi:main->out#1] -- vbuz1=vbuc1 
    lda #reg_zp_flex
    sta.z out.c
    jsr out
    // [6] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    jmp __b1
    // main::@1
  __b1:
    // [7] call out 
    // [25] phi from main::@1 to out [phi:main::@1->out]
  out_from___b1:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@1->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_abs [phi:main::@1->out#1] -- vbuz1=vbuc1 
    lda #reg_zp_abs
    sta.z out.c
    jsr out
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    jmp __b2
    // main::@2
  __b2:
    // [9] call out 
    // [25] phi from main::@2 to out [phi:main::@2->out]
  out_from___b2:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@2->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_flex [phi:main::@2->out#1] -- vbuz1=vbuc1 
    lda #reg_mem_flex
    sta.z out.c
    jsr out
    // [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  __b3_from___b2:
    jmp __b3
    // main::@3
  __b3:
    // [11] call out 
    // [25] phi from main::@3 to out [phi:main::@3->out]
  out_from___b3:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@3->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_abs [phi:main::@3->out#1] -- vbuz1=vbuc1 
    lda #reg_mem_abs
    sta.z out.c
    jsr out
    // [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [13] call out 
    // [25] phi from main::@4 to out [phi:main::@4->out]
  out_from___b4:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@4->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_default [phi:main::@4->out#1] -- vbuz1=vbuc1 
    lda #default_default
    sta.z out.c
    jsr out
    // [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
  __b5_from___b4:
    jmp __b5
    // main::@5
  __b5:
    // [15] call out 
    // [25] phi from main::@5 to out [phi:main::@5->out]
  out_from___b5:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@5->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_default [phi:main::@5->out#1] -- vbuz1=vbuc1 
    lda #reg_default
    sta.z out.c
    jsr out
    // [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
  __b6_from___b5:
    jmp __b6
    // main::@6
  __b6:
    // [17] call out 
    // [25] phi from main::@6 to out [phi:main::@6->out]
  out_from___b6:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@6->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_flex [phi:main::@6->out#1] -- vbuz1=vbuc1 
    lda #default_zp_flex
    sta.z out.c
    jsr out
    // [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
  __b7_from___b6:
    jmp __b7
    // main::@7
  __b7:
    // [19] call out 
    // [25] phi from main::@7 to out [phi:main::@7->out]
  out_from___b7:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@7->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_abs [phi:main::@7->out#1] -- vbuz1=vbuc1 
    lda #default_zp_abs
    sta.z out.c
    jsr out
    // [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
  __b8_from___b7:
    jmp __b8
    // main::@8
  __b8:
    // [21] call out 
    // [25] phi from main::@8 to out [phi:main::@8->out]
  out_from___b8:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@8->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_flex [phi:main::@8->out#1] -- vbuz1=vbuc1 
    lda #default_mem_flex
    sta.z out.c
    jsr out
    // [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
  __b9_from___b8:
    jmp __b9
    // main::@9
  __b9:
    // [23] call out 
    // [25] phi from main::@9 to out [phi:main::@9->out]
  out_from___b9:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@9->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_abs [phi:main::@9->out#1] -- vbuz1=vbuc1 
    lda #default_mem_abs
    sta.z out.c
    jsr out
    jmp __breturn
    // main::@return
  __breturn:
    // [24] return 
    rts
}
  // out
// out(byte zp(2) c)
out: {
    .label c = 2
    // [26] *((const byte*) SCREEN + (byte) i#26) ← (byte) out::c#10 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z c
    ldy.z i
    sta SCREEN,y
    // [27] (byte) i#12 ← ++ (byte) i#26 -- vbuz1=_inc_vbuz1 
    inc.z i
    jmp __breturn
    // out::@return
  __breturn:
    // [28] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp[1]:2 [ out::c#10 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ i#26 i#12 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [] 12: zp[1]:3 [ i#26 i#12 ] 
Uplift Scope [out] 2: zp[1]:2 [ out::c#10 ] 
Uplift Scope [main] 

Uplifting [] best 179 combination reg byte x [ i#26 i#12 ] 
Uplifting [out] best 146 combination reg byte a [ out::c#10 ] 
Uplifting [main] best 146 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  // @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: {
    .const reg_zp_flex = '.'
    .const reg_zp_abs = '.'
    .const reg_mem_flex = '.'
    .const reg_mem_abs = '.'
    .const default_default = '.'
    .const reg_default = '.'
    .const default_zp_flex = '.'
    .const default_zp_abs = '.'
    .const default_mem_flex = '.'
    .const default_mem_abs = '.'
    // [5] call out 
    // [25] phi from main to out [phi:main->out]
  out_from_main:
    // [25] phi (byte) i#26 = (byte) 0 [phi:main->out#0] -- vbuxx=vbuc1 
    ldx #0
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_flex [phi:main->out#1] -- vbuaa=vbuc1 
    lda #reg_zp_flex
    jsr out
    // [6] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    jmp __b1
    // main::@1
  __b1:
    // [7] call out 
    // [25] phi from main::@1 to out [phi:main::@1->out]
  out_from___b1:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@1->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_abs [phi:main::@1->out#1] -- vbuaa=vbuc1 
    lda #reg_zp_abs
    jsr out
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  __b2_from___b1:
    jmp __b2
    // main::@2
  __b2:
    // [9] call out 
    // [25] phi from main::@2 to out [phi:main::@2->out]
  out_from___b2:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@2->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_flex [phi:main::@2->out#1] -- vbuaa=vbuc1 
    lda #reg_mem_flex
    jsr out
    // [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
  __b3_from___b2:
    jmp __b3
    // main::@3
  __b3:
    // [11] call out 
    // [25] phi from main::@3 to out [phi:main::@3->out]
  out_from___b3:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@3->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_abs [phi:main::@3->out#1] -- vbuaa=vbuc1 
    lda #reg_mem_abs
    jsr out
    // [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [13] call out 
    // [25] phi from main::@4 to out [phi:main::@4->out]
  out_from___b4:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@4->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_default [phi:main::@4->out#1] -- vbuaa=vbuc1 
    lda #default_default
    jsr out
    // [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
  __b5_from___b4:
    jmp __b5
    // main::@5
  __b5:
    // [15] call out 
    // [25] phi from main::@5 to out [phi:main::@5->out]
  out_from___b5:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@5->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_default [phi:main::@5->out#1] -- vbuaa=vbuc1 
    lda #reg_default
    jsr out
    // [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
  __b6_from___b5:
    jmp __b6
    // main::@6
  __b6:
    // [17] call out 
    // [25] phi from main::@6 to out [phi:main::@6->out]
  out_from___b6:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@6->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_flex [phi:main::@6->out#1] -- vbuaa=vbuc1 
    lda #default_zp_flex
    jsr out
    // [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
  __b7_from___b6:
    jmp __b7
    // main::@7
  __b7:
    // [19] call out 
    // [25] phi from main::@7 to out [phi:main::@7->out]
  out_from___b7:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@7->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_abs [phi:main::@7->out#1] -- vbuaa=vbuc1 
    lda #default_zp_abs
    jsr out
    // [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
  __b8_from___b7:
    jmp __b8
    // main::@8
  __b8:
    // [21] call out 
    // [25] phi from main::@8 to out [phi:main::@8->out]
  out_from___b8:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@8->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_flex [phi:main::@8->out#1] -- vbuaa=vbuc1 
    lda #default_mem_flex
    jsr out
    // [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
  __b9_from___b8:
    jmp __b9
    // main::@9
  __b9:
    // [23] call out 
    // [25] phi from main::@9 to out [phi:main::@9->out]
  out_from___b9:
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@9->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_abs [phi:main::@9->out#1] -- vbuaa=vbuc1 
    lda #default_mem_abs
    jsr out
    jmp __breturn
    // main::@return
  __breturn:
    // [24] return 
    rts
}
  // out
// out(byte register(A) c)
out: {
    // [26] *((const byte*) SCREEN + (byte) i#26) ← (byte) out::c#10 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // [27] (byte) i#12 ← ++ (byte) i#26 -- vbuxx=_inc_vbuxx 
    inx
    jmp __breturn
    // out::@return
  __breturn:
    // [28] 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 __b4
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b7
Removing instruction jmp __b8
Removing instruction jmp __b9
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction out_from___b1:
Removing instruction __b2_from___b1:
Removing instruction out_from___b2:
Removing instruction __b3_from___b2:
Removing instruction out_from___b3:
Removing instruction __b4_from___b3:
Removing instruction out_from___b4:
Removing instruction __b5_from___b4:
Removing instruction out_from___b5:
Removing instruction __b6_from___b5:
Removing instruction out_from___b6:
Removing instruction __b7_from___b6:
Removing instruction out_from___b7:
Removing instruction __b8_from___b7:
Removing instruction out_from___b8:
Removing instruction __b9_from___b8:
Removing instruction out_from___b9:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction out_from_main:
Removing instruction __b1:
Removing instruction __b2:
Removing instruction __b3:
Removing instruction __b4:
Removing instruction __b5:
Removing instruction __b6:
Removing instruction __b7:
Removing instruction __b8:
Removing instruction __b9:
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 __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) i
(byte) i#12 reg byte x 0.9999999999999999
(byte) i#26 reg byte x 11.0
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(const byte) main::default_default = (byte) '.'
(const byte) main::default_mem_abs !mem[-1]:4096 = (byte) '.'
(const byte) main::default_mem_flex = (byte) '.'
(const byte) main::default_zp_abs !zp[-1]:16 = (byte) '.'
(const byte) main::default_zp_flex = (byte) '.'
(const byte) main::reg_default = (byte) '.'
(const byte) main::reg_mem_abs !mem[-1]:4096 = (byte) '.'
(const byte) main::reg_mem_flex = (byte) '.'
(const byte) main::reg_zp_abs !zp[-1]:16 = (byte) '.'
(const byte) main::reg_zp_flex = (byte) '.'
(void()) out((byte) out::c)
(label) out::@return
(byte) out::c
(byte) out::c#10 reg byte a 2.0

reg byte a [ out::c#10 ]
reg byte x [ i#26 i#12 ]


FINAL ASSEMBLER
Score: 101

  // File Comments
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store)
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  // @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: {
    .const reg_zp_flex = '.'
    .const reg_zp_abs = '.'
    .const reg_mem_flex = '.'
    .const reg_mem_abs = '.'
    .const default_default = '.'
    .const reg_default = '.'
    .const default_zp_flex = '.'
    .const default_zp_abs = '.'
    .const default_mem_flex = '.'
    .const default_mem_abs = '.'
    // out(reg_zp_flex)
    // [5] call out 
    // [25] phi from main to out [phi:main->out]
    // [25] phi (byte) i#26 = (byte) 0 [phi:main->out#0] -- vbuxx=vbuc1 
    ldx #0
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_flex [phi:main->out#1] -- vbuaa=vbuc1 
    lda #reg_zp_flex
    jsr out
    // [6] phi from main to main::@1 [phi:main->main::@1]
    // main::@1
    // out(reg_zp_abs)
    // [7] call out 
    // [25] phi from main::@1 to out [phi:main::@1->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@1->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_zp_abs [phi:main::@1->out#1] -- vbuaa=vbuc1 
    lda #reg_zp_abs
    jsr out
    // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
    // main::@2
    // out(reg_mem_flex)
    // [9] call out 
    // [25] phi from main::@2 to out [phi:main::@2->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@2->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_flex [phi:main::@2->out#1] -- vbuaa=vbuc1 
    lda #reg_mem_flex
    jsr out
    // [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
    // main::@3
    // out(reg_mem_abs)
    // [11] call out 
    // [25] phi from main::@3 to out [phi:main::@3->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@3->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_mem_abs [phi:main::@3->out#1] -- vbuaa=vbuc1 
    lda #reg_mem_abs
    jsr out
    // [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // main::@4
    // out(default_default)
    // [13] call out 
    // [25] phi from main::@4 to out [phi:main::@4->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@4->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_default [phi:main::@4->out#1] -- vbuaa=vbuc1 
    lda #default_default
    jsr out
    // [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
    // main::@5
    // out(reg_default)
    // [15] call out 
    // [25] phi from main::@5 to out [phi:main::@5->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@5->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::reg_default [phi:main::@5->out#1] -- vbuaa=vbuc1 
    lda #reg_default
    jsr out
    // [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
    // main::@6
    // out(default_zp_flex)
    // [17] call out 
    // [25] phi from main::@6 to out [phi:main::@6->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@6->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_flex [phi:main::@6->out#1] -- vbuaa=vbuc1 
    lda #default_zp_flex
    jsr out
    // [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
    // main::@7
    // out(default_zp_abs)
    // [19] call out 
    // [25] phi from main::@7 to out [phi:main::@7->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@7->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_zp_abs [phi:main::@7->out#1] -- vbuaa=vbuc1 
    lda #default_zp_abs
    jsr out
    // [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
    // main::@8
    // out(default_mem_flex)
    // [21] call out 
    // [25] phi from main::@8 to out [phi:main::@8->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@8->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_flex [phi:main::@8->out#1] -- vbuaa=vbuc1 
    lda #default_mem_flex
    jsr out
    // [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
    // main::@9
    // out(default_mem_abs)
    // [23] call out 
    // [25] phi from main::@9 to out [phi:main::@9->out]
    // [25] phi (byte) i#26 = (byte) i#12 [phi:main::@9->out#0] -- register_copy 
    // [25] phi (byte) out::c#10 = (const byte) main::default_mem_abs [phi:main::@9->out#1] -- vbuaa=vbuc1 
    lda #default_mem_abs
    jsr out
    // main::@return
    // }
    // [24] return 
    rts
}
  // out
// out(byte register(A) c)
out: {
    // SCREEN[i++] = c
    // [26] *((const byte*) SCREEN + (byte) i#26) ← (byte) out::c#10 -- pbuc1_derefidx_vbuxx=vbuaa 
    sta SCREEN,x
    // SCREEN[i++] = c;
    // [27] (byte) i#12 ← ++ (byte) i#26 -- vbuxx=_inc_vbuxx 
    inx
    // out::@return
    // }
    // [28] return 
    rts
}
  // File Data

