
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  to:@1
main: scope:[main]  from @1
  (byte*) SCREEN#7 ← phi( @1/(byte*) SCREEN#8 )
  (byte) main::min#0 ← (byte/word/signed word/dword/signed dword) 255
  (byte) main::max#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) main::pos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  to:main::@1
main::@1: scope:[main]  from main main::@5
  (byte*) SCREEN#6 ← phi( main/(byte*) SCREEN#7 main::@5/(byte*) SCREEN#1 )
  (byte) main::max#6 ← phi( main/(byte) main::max#0 main::@5/(byte) main::max#3 )
  (byte) main::min#4 ← phi( main/(byte) main::min#0 main::@5/(byte) main::min#3 )
  (byte) main::pos#7 ← phi( main/(byte) main::pos#0 main::@5/(byte) main::pos#5 )
  if(true) goto main::@2
  to:main::@return
main::@2: scope:[main]  from main::@1
  (byte*) SCREEN#4 ← phi( main::@1/(byte*) SCREEN#6 )
  (byte) main::max#4 ← phi( main::@1/(byte) main::max#6 )
  (byte) main::min#2 ← phi( main::@1/(byte) main::min#4 )
  (byte) main::pos#2 ← phi( main::@1/(byte) main::pos#7 )
  (byte) main::pos#1 ← ++ (byte) main::pos#2
  (bool~) main::$0 ← (byte) main::pos#1 < (byte) main::min#2
  (bool~) main::$1 ← ! (bool~) main::$0
  if((bool~) main::$1) goto main::@4
  to:main::@8
main::@4: scope:[main]  from main::@2 main::@8
  (byte*) SCREEN#2 ← phi( main::@2/(byte*) SCREEN#4 main::@8/(byte*) SCREEN#5 )
  (byte) main::min#5 ← phi( main::@2/(byte) main::min#2 main::@8/(byte) main::min#1 )
  (byte) main::max#2 ← phi( main::@2/(byte) main::max#4 main::@8/(byte) main::max#5 )
  (byte) main::pos#3 ← phi( main::@2/(byte) main::pos#1 main::@8/(byte) main::pos#4 )
  (bool~) main::$2 ← (byte) main::pos#3 > (byte) main::max#2
  (bool~) main::$3 ← ! (bool~) main::$2
  if((bool~) main::$3) goto main::@5
  to:main::@9
main::@8: scope:[main]  from main::@2
  (byte*) SCREEN#5 ← phi( main::@2/(byte*) SCREEN#4 )
  (byte) main::max#5 ← phi( main::@2/(byte) main::max#4 )
  (byte) main::pos#4 ← phi( main::@2/(byte) main::pos#1 )
  (byte) main::min#1 ← (byte) main::pos#4
  to:main::@4
main::@5: scope:[main]  from main::@4 main::@9
  (byte) main::pos#5 ← phi( main::@4/(byte) main::pos#3 main::@9/(byte) main::pos#6 )
  (byte) main::max#3 ← phi( main::@4/(byte) main::max#2 main::@9/(byte) main::max#1 )
  (byte*) SCREEN#1 ← phi( main::@4/(byte*) SCREEN#2 main::@9/(byte*) SCREEN#3 )
  (byte) main::min#3 ← phi( main::@4/(byte) main::min#5 main::@9/(byte) main::min#6 )
  *((byte*) SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::min#3
  *((byte*) SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::max#3
  *((byte*) SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::pos#5
  to:main::@1
main::@9: scope:[main]  from main::@4
  (byte*) SCREEN#3 ← phi( main::@4/(byte*) SCREEN#2 )
  (byte) main::min#6 ← phi( main::@4/(byte) main::min#5 )
  (byte) main::pos#6 ← phi( main::@4/(byte) main::pos#3 )
  (byte) main::max#1 ← (byte) main::pos#6
  to:main::@5
main::@return: scope:[main]  from main::@1
  return 
  to:@return
@1: scope:[]  from @begin
  (byte*) SCREEN#8 ← phi( @begin/(byte*) SCREEN#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*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) SCREEN#6
(byte*) SCREEN#7
(byte*) SCREEN#8
(void()) main()
(bool~) main::$0
(bool~) main::$1
(bool~) main::$2
(bool~) main::$3
(label) main::@1
(label) main::@2
(label) main::@4
(label) main::@5
(label) main::@8
(label) main::@9
(label) main::@return
(byte) main::max
(byte) main::max#0
(byte) main::max#1
(byte) main::max#2
(byte) main::max#3
(byte) main::max#4
(byte) main::max#5
(byte) main::max#6
(byte) main::min
(byte) main::min#0
(byte) main::min#1
(byte) main::min#2
(byte) main::min#3
(byte) main::min#4
(byte) main::min#5
(byte) main::min#6
(byte) main::pos
(byte) main::pos#0
(byte) main::pos#1
(byte) main::pos#2
(byte) main::pos#3
(byte) main::pos#4
(byte) main::pos#5
(byte) main::pos#6
(byte) main::pos#7

Culled Empty Block (label) @2
Successful SSA optimization Pass2CullEmptyBlocks
Inversing boolean not [10] (bool~) main::$1 ← (byte) main::pos#1 >= (byte) main::min#2 from [9] (bool~) main::$0 ← (byte) main::pos#1 < (byte) main::min#2
Inversing boolean not [14] (bool~) main::$3 ← (byte) main::pos#3 <= (byte) main::max#2 from [13] (bool~) main::$2 ← (byte) main::pos#3 > (byte) main::max#2
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) main::pos#2 = (byte) main::pos#7 
Alias (byte) main::min#2 = (byte) main::min#4 
Alias (byte) main::max#4 = (byte) main::max#6 (byte) main::max#5 
Alias (byte*) SCREEN#4 = (byte*) SCREEN#6 (byte*) SCREEN#5 
Alias (byte) main::pos#1 = (byte) main::pos#4 (byte) main::min#1 
Alias (byte) main::pos#3 = (byte) main::pos#6 (byte) main::max#1 
Alias (byte) main::min#5 = (byte) main::min#6 
Alias (byte*) SCREEN#2 = (byte*) SCREEN#3 
Alias (byte*) SCREEN#0 = (byte*) SCREEN#8 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (phi-usage) (byte) main::pos#1
Alias (byte) main::pos#3 = (byte) main::pos#5 
Alias (byte) main::max#2 = (byte) main::max#4 
Alias (byte*) SCREEN#1 = (byte*) SCREEN#2 (byte*) SCREEN#4 
Alias (byte) main::min#3 = (byte) main::min#5 
Successful SSA optimization Pass2AliasElimination
Alias candidate removed (phi-usage) (byte) main::pos#1
Alias candidate removed (solo) (byte) main::pos#3 = 
Self Phi Eliminated (byte*) SCREEN#1
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte*) SCREEN#7 (byte*) SCREEN#0
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#7
Redundant Phi (byte) main::pos#3 (byte) main::pos#1
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$1 [11] if((byte) main::pos#1>=(byte) main::min#2) goto main::@4
Simple Condition (bool~) main::$3 [15] if((byte) main::pos#1<=(byte) main::max#2) goto main::@5
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte) main::min#0 = 255
Constant (const byte) main::max#0 = 0
Constant (const byte) main::pos#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(SCREEN#0+0)
Consolidated array index constant in *(SCREEN#0+1)
Consolidated array index constant in *(SCREEN#0+2)
Successful SSA optimization Pass2ConstantAdditionElimination
if() condition always true - replacing block destination [1] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Inlining constant with var siblings (const byte) main::min#0
Inlining constant with var siblings (const byte) main::max#0
Inlining constant with var siblings (const byte) main::pos#0
Constant inlined main::min#0 = (byte/word/signed word/dword/signed dword) 255
Constant inlined main::max#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::pos#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Simplifying constant plus zero SCREEN#0+0
Added new block during phi lifting main::@11(between main::@2 and main::@4)
Added new block during phi lifting main::@12(between main::@4 and 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
CALL GRAPH
Calls in [] to main:2 

Created 5 initial phi equivalence classes
Not coalescing [8] main::min#9 ← main::pos#1
Not coalescing [11] main::max#9 ← main::pos#1
Coalesced [16] main::pos#8 ← main::pos#1
Coalesced [17] main::min#7 ← main::min#3
Coalesced [18] main::max#7 ← main::max#3
Coalesced (already) [19] main::max#8 ← main::max#2
Coalesced (already) [20] main::min#8 ← main::min#2
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@11
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::max#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte) main::max#3 )
  [5] (byte) main::min#2 ← phi( main/(byte/word/signed word/dword/signed dword) 255 main::@5/(byte) main::min#3 )
  [5] (byte) main::pos#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte) main::pos#1 )
  to:main::@2
main::@2: scope:[main]  from main::@1
  [6] (byte) main::pos#1 ← ++ (byte) main::pos#2
  [7] if((byte) main::pos#1>=(byte) main::min#2) goto main::@4
  to:main::@8
main::@8: scope:[main]  from main::@2
  [8] (byte~) main::min#9 ← (byte) main::pos#1
  to:main::@4
main::@4: scope:[main]  from main::@2 main::@8
  [9] (byte) main::min#3 ← phi( main::@2/(byte) main::min#2 main::@8/(byte~) main::min#9 )
  [10] if((byte) main::pos#1<=(byte) main::max#2) goto main::@5
  to:main::@9
main::@9: scope:[main]  from main::@4
  [11] (byte~) main::max#9 ← (byte) main::pos#1
  to:main::@5
main::@5: scope:[main]  from main::@4 main::@9
  [12] (byte) main::max#3 ← phi( main::@4/(byte) main::max#2 main::@9/(byte~) main::max#9 )
  [13] *((const byte*) SCREEN#0) ← (byte) main::min#3
  [14] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::max#3
  [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::pos#1
  to:main::@1


VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::max
(byte) main::max#2 5.5
(byte) main::max#3 11.0
(byte~) main::max#9 22.0
(byte) main::min
(byte) main::min#2 11.0
(byte) main::min#3 6.285714285714286
(byte~) main::min#9 22.0
(byte) main::pos
(byte) main::pos#1 7.699999999999999
(byte) main::pos#2 22.0

Initial phi equivalence classes
[ main::pos#2 main::pos#1 ]
[ main::min#2 main::min#3 main::min#9 ]
[ main::max#2 main::max#3 main::max#9 ]
Complete equivalence classes
[ main::pos#2 main::pos#1 ]
[ main::min#2 main::min#3 main::min#9 ]
[ main::max#2 main::max#3 main::max#9 ]
Allocated zp ZP_BYTE:2 [ main::pos#2 main::pos#1 ]
Allocated zp ZP_BYTE:3 [ main::min#2 main::min#3 main::min#9 ]
Allocated zp ZP_BYTE:4 [ main::max#2 main::max#3 main::max#9 ]

INITIAL ASM
//SEG0 File Comments
// Results in infinite compile loop as the compiler keeps trying to remove the same (empty) alias
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//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 pos = 2
    .label min = 3
    .label max = 4
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::max#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta max
  //SEG13 [5] phi (byte) main::min#2 = (byte/word/signed word/dword/signed dword) 255 [phi:main->main::@1#1] -- vbuz1=vbuc1 
    lda #$ff
    sta min
  //SEG14 [5] phi (byte) main::pos#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1 
    lda #0
    sta pos
    jmp b1
  //SEG15 main::@1
  b1:
    jmp b2
  //SEG16 main::@2
  b2:
  //SEG17 [6] (byte) main::pos#1 ← ++ (byte) main::pos#2 -- vbuz1=_inc_vbuz1 
    inc pos
  //SEG18 [7] if((byte) main::pos#1>=(byte) main::min#2) goto main::@4 -- vbuz1_ge_vbuz2_then_la1 
    lda pos
    cmp min
    bcs b4_from_b2
    jmp b8
  //SEG19 main::@8
  b8:
  //SEG20 [8] (byte~) main::min#9 ← (byte) main::pos#1 -- vbuz1=vbuz2 
    lda pos
    sta min
  //SEG21 [9] phi from main::@2 main::@8 to main::@4 [phi:main::@2/main::@8->main::@4]
  b4_from_b2:
  b4_from_b8:
  //SEG22 [9] phi (byte) main::min#3 = (byte) main::min#2 [phi:main::@2/main::@8->main::@4#0] -- register_copy 
    jmp b4
  //SEG23 main::@4
  b4:
  //SEG24 [10] if((byte) main::pos#1<=(byte) main::max#2) goto main::@5 -- vbuz1_le_vbuz2_then_la1 
    lda max
    cmp pos
    bcs b5_from_b4
    jmp b9
  //SEG25 main::@9
  b9:
  //SEG26 [11] (byte~) main::max#9 ← (byte) main::pos#1 -- vbuz1=vbuz2 
    lda pos
    sta max
  //SEG27 [12] phi from main::@4 main::@9 to main::@5 [phi:main::@4/main::@9->main::@5]
  b5_from_b4:
  b5_from_b9:
  //SEG28 [12] phi (byte) main::max#3 = (byte) main::max#2 [phi:main::@4/main::@9->main::@5#0] -- register_copy 
    jmp b5
  //SEG29 main::@5
  b5:
  //SEG30 [13] *((const byte*) SCREEN#0) ← (byte) main::min#3 -- _deref_pbuc1=vbuz1 
    lda min
    sta SCREEN
  //SEG31 [14] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::max#3 -- _deref_pbuc1=vbuz1 
    lda max
    sta SCREEN+1
  //SEG32 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::pos#1 -- _deref_pbuc1=vbuz1 
    lda pos
    sta SCREEN+2
  //SEG33 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
  b1_from_b5:
  //SEG34 [5] phi (byte) main::max#2 = (byte) main::max#3 [phi:main::@5->main::@1#0] -- register_copy 
  //SEG35 [5] phi (byte) main::min#2 = (byte) main::min#3 [phi:main::@5->main::@1#1] -- register_copy 
  //SEG36 [5] phi (byte) main::pos#2 = (byte) main::pos#1 [phi:main::@5->main::@1#2] -- register_copy 
    jmp b1
}

REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::pos#2 main::pos#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ main::min#2 main::min#3 main::min#9 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ main::max#2 main::max#3 main::max#9 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 39.29: zp ZP_BYTE:3 [ main::min#2 main::min#3 main::min#9 ] 38.5: zp ZP_BYTE:4 [ main::max#2 main::max#3 main::max#9 ] 29.7: zp ZP_BYTE:2 [ main::pos#2 main::pos#1 ] 
Uplift Scope [] 

Uplifting [main] best 652 combination reg byte x [ main::min#2 main::min#3 main::min#9 ] reg byte y [ main::max#2 main::max#3 main::max#9 ] reg byte a [ main::pos#2 main::pos#1 ] 
Uplifting [] best 652 combination 

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Results in infinite compile loop as the compiler keeps trying to remove the same (empty) alias
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//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: {
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
  //SEG12 [5] phi (byte) main::max#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
  //SEG13 [5] phi (byte) main::min#2 = (byte/word/signed word/dword/signed dword) 255 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #$ff
  //SEG14 [5] phi (byte) main::pos#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuaa=vbuc1 
    lda #0
    jmp b1
  //SEG15 main::@1
  b1:
    jmp b2
  //SEG16 main::@2
  b2:
  //SEG17 [6] (byte) main::pos#1 ← ++ (byte) main::pos#2 -- vbuaa=_inc_vbuaa 
    clc
    adc #1
  //SEG18 [7] if((byte) main::pos#1>=(byte) main::min#2) goto main::@4 -- vbuaa_ge_vbuxx_then_la1 
    stx $ff
    cmp $ff
    bcs b4_from_b2
    jmp b8
  //SEG19 main::@8
  b8:
  //SEG20 [8] (byte~) main::min#9 ← (byte) main::pos#1 -- vbuxx=vbuaa 
    tax
  //SEG21 [9] phi from main::@2 main::@8 to main::@4 [phi:main::@2/main::@8->main::@4]
  b4_from_b2:
  b4_from_b8:
  //SEG22 [9] phi (byte) main::min#3 = (byte) main::min#2 [phi:main::@2/main::@8->main::@4#0] -- register_copy 
    jmp b4
  //SEG23 main::@4
  b4:
  //SEG24 [10] if((byte) main::pos#1<=(byte) main::max#2) goto main::@5 -- vbuaa_le_vbuyy_then_la1 
    sta $ff
    cpy $ff
    bcs b5_from_b4
    jmp b9
  //SEG25 main::@9
  b9:
  //SEG26 [11] (byte~) main::max#9 ← (byte) main::pos#1 -- vbuyy=vbuaa 
    tay
  //SEG27 [12] phi from main::@4 main::@9 to main::@5 [phi:main::@4/main::@9->main::@5]
  b5_from_b4:
  b5_from_b9:
  //SEG28 [12] phi (byte) main::max#3 = (byte) main::max#2 [phi:main::@4/main::@9->main::@5#0] -- register_copy 
    jmp b5
  //SEG29 main::@5
  b5:
  //SEG30 [13] *((const byte*) SCREEN#0) ← (byte) main::min#3 -- _deref_pbuc1=vbuxx 
    stx SCREEN
  //SEG31 [14] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::max#3 -- _deref_pbuc1=vbuyy 
    sty SCREEN+1
  //SEG32 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::pos#1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
  //SEG33 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
  b1_from_b5:
  //SEG34 [5] phi (byte) main::max#2 = (byte) main::max#3 [phi:main::@5->main::@1#0] -- register_copy 
  //SEG35 [5] phi (byte) main::min#2 = (byte) main::min#3 [phi:main::@5->main::@1#1] -- register_copy 
  //SEG36 [5] phi (byte) main::pos#2 = (byte) main::pos#1 [phi:main::@5->main::@1#2] -- register_copy 
    jmp b1
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b8
Removing instruction jmp b4
Removing instruction jmp b9
Removing instruction jmp b5
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction lda #0 with TYA
Replacing label b4_from_b2 with b4
Replacing label b5_from_b4 with b5
Replacing label b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1:
Removing instruction b4_from_b2:
Removing instruction b4_from_b8:
Removing instruction b5_from_b4:
Removing instruction b5_from_b9:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b8:
Removing instruction b9:
Removing instruction b1_from_b5:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@4
(label) main::@5
(label) main::@8
(label) main::@9
(byte) main::max
(byte) main::max#2 reg byte y 5.5
(byte) main::max#3 reg byte y 11.0
(byte~) main::max#9 reg byte y 22.0
(byte) main::min
(byte) main::min#2 reg byte x 11.0
(byte) main::min#3 reg byte x 6.285714285714286
(byte~) main::min#9 reg byte x 22.0
(byte) main::pos
(byte) main::pos#1 reg byte a 7.699999999999999
(byte) main::pos#2 reg byte a 22.0

reg byte a [ main::pos#2 main::pos#1 ]
reg byte x [ main::min#2 main::min#3 main::min#9 ]
reg byte y [ main::max#2 main::max#3 main::max#9 ]


FINAL ASSEMBLER
Score: 460

//SEG0 File Comments
// Results in infinite compile loop as the compiler keeps trying to remove the same (empty) alias
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
  .label SCREEN = $400
//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: {
  //SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
  //SEG12 [5] phi (byte) main::max#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
  //SEG13 [5] phi (byte) main::min#2 = (byte/word/signed word/dword/signed dword) 255 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #$ff
  //SEG14 [5] phi (byte) main::pos#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuaa=vbuc1 
    tya
  //SEG15 main::@1
  //SEG16 main::@2
  b2:
  //SEG17 [6] (byte) main::pos#1 ← ++ (byte) main::pos#2 -- vbuaa=_inc_vbuaa 
    clc
    adc #1
  //SEG18 [7] if((byte) main::pos#1>=(byte) main::min#2) goto main::@4 -- vbuaa_ge_vbuxx_then_la1 
    stx $ff
    cmp $ff
    bcs b4
  //SEG19 main::@8
  //SEG20 [8] (byte~) main::min#9 ← (byte) main::pos#1 -- vbuxx=vbuaa 
    tax
  //SEG21 [9] phi from main::@2 main::@8 to main::@4 [phi:main::@2/main::@8->main::@4]
  //SEG22 [9] phi (byte) main::min#3 = (byte) main::min#2 [phi:main::@2/main::@8->main::@4#0] -- register_copy 
  //SEG23 main::@4
  b4:
  //SEG24 [10] if((byte) main::pos#1<=(byte) main::max#2) goto main::@5 -- vbuaa_le_vbuyy_then_la1 
    sta $ff
    cpy $ff
    bcs b5
  //SEG25 main::@9
  //SEG26 [11] (byte~) main::max#9 ← (byte) main::pos#1 -- vbuyy=vbuaa 
    tay
  //SEG27 [12] phi from main::@4 main::@9 to main::@5 [phi:main::@4/main::@9->main::@5]
  //SEG28 [12] phi (byte) main::max#3 = (byte) main::max#2 [phi:main::@4/main::@9->main::@5#0] -- register_copy 
  //SEG29 main::@5
  b5:
  //SEG30 [13] *((const byte*) SCREEN#0) ← (byte) main::min#3 -- _deref_pbuc1=vbuxx 
    stx SCREEN
  //SEG31 [14] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::max#3 -- _deref_pbuc1=vbuyy 
    sty SCREEN+1
  //SEG32 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::pos#1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
  //SEG33 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
  //SEG34 [5] phi (byte) main::max#2 = (byte) main::max#3 [phi:main::@5->main::@1#0] -- register_copy 
  //SEG35 [5] phi (byte) main::min#2 = (byte) main::min#3 [phi:main::@5->main::@1#1] -- register_copy 
  //SEG36 [5] phi (byte) main::pos#2 = (byte) main::pos#1 [phi:main::@5->main::@1#2] -- register_copy 
    jmp b2
}

