
CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@2
main: scope:[main]  from @2
  (byte*) main::SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
  (byte) main::b1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) main::b2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte) main::b3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  (byte*~) main::$0 ← & (byte) main::b1#0
  (byte*) setByte::ptr#0 ← (byte*~) main::$0
  (byte) setByte::b#0 ← (byte) 'c'
  call setByte 
  to:main::@1
main::@1: scope:[main]  from main
  (byte*) main::SCREEN#3 ← phi( main/(byte*) main::SCREEN#0 )
  (byte) main::b1#3 ← phi( main/(byte) main::b1#0 )
  (byte) main::b3#3 ← phi( main/(byte) main::b3#0 )
  (byte) main::b2#1 ← phi( main/(byte) main::b2#0 )
  (byte*~) main::$2 ← & (byte) main::b2#1
  (byte*) setByte::ptr#1 ← (byte*~) main::$2
  (byte) setByte::b#1 ← (byte) 'm'
  call setByte 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) main::b2#3 ← phi( main::@1/(byte) main::b2#1 )
  (byte*) main::SCREEN#2 ← phi( main::@1/(byte*) main::SCREEN#3 )
  (byte) main::b1#2 ← phi( main::@1/(byte) main::b1#3 )
  (byte) main::b3#1 ← phi( main::@1/(byte) main::b3#3 )
  (byte*~) main::$4 ← & (byte) main::b3#1
  (byte*) setByte::ptr#2 ← (byte*~) main::$4
  (byte) setByte::b#2 ← (byte) 'l'
  call setByte 
  to:main::@3
main::@3: scope:[main]  from main::@2
  (byte) main::b3#2 ← phi( main::@2/(byte) main::b3#1 )
  (byte) main::b2#2 ← phi( main::@2/(byte) main::b2#3 )
  (byte*) main::SCREEN#1 ← phi( main::@2/(byte*) main::SCREEN#2 )
  (byte) main::b1#1 ← phi( main::@2/(byte) main::b1#2 )
  *((byte*) main::SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::b1#1
  *((byte*) main::SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b2#2
  *((byte*) main::SCREEN#1 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::b3#2
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return
setByte: scope:[setByte]  from main main::@1 main::@2
  (byte*) setByte::ptr#3 ← phi( main/(byte*) setByte::ptr#0 main::@1/(byte*) setByte::ptr#1 main::@2/(byte*) setByte::ptr#2 )
  (byte) setByte::b#3 ← phi( main/(byte) setByte::b#0 main::@1/(byte) setByte::b#1 main::@2/(byte) setByte::b#2 )
  *((byte*) setByte::ptr#3) ← (byte) setByte::b#3
  to:setByte::@return
setByte::@return: scope:[setByte]  from setByte
  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
(byte*~) main::$2
(byte*~) main::$4
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte*) main::SCREEN
(byte*) main::SCREEN#0
(byte*) main::SCREEN#1
(byte*) main::SCREEN#2
(byte*) main::SCREEN#3
(byte) main::b1
(byte) main::b1#0
(byte) main::b1#1
(byte) main::b1#2
(byte) main::b1#3
(byte) main::b2
(byte) main::b2#0
(byte) main::b2#1
(byte) main::b2#2
(byte) main::b2#3
(byte) main::b3
(byte) main::b3#0
(byte) main::b3#1
(byte) main::b3#2
(byte) main::b3#3
(void()) setByte((byte*) setByte::ptr , (byte) setByte::b)
(label) setByte::@return
(byte) setByte::b
(byte) setByte::b#0
(byte) setByte::b#1
(byte) setByte::b#2
(byte) setByte::b#3
(byte*) setByte::ptr
(byte*) setByte::ptr#0
(byte*) setByte::ptr#1
(byte*) setByte::ptr#2
(byte*) setByte::ptr#3

Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Alias (byte*) setByte::ptr#0 = (byte*~) main::$0 
Alias (byte) main::b2#0 = (byte) main::b2#1 (byte) main::b2#3 (byte) main::b2#2 
Alias (byte) main::b3#0 = (byte) main::b3#3 (byte) main::b3#1 (byte) main::b3#2 
Alias (byte) main::b1#0 = (byte) main::b1#3 (byte) main::b1#2 (byte) main::b1#1 
Alias (byte*) main::SCREEN#0 = (byte*) main::SCREEN#3 (byte*) main::SCREEN#2 (byte*) main::SCREEN#1 
Alias (byte*) setByte::ptr#1 = (byte*~) main::$2 
Alias (byte*) setByte::ptr#2 = (byte*~) main::$4 
Successful SSA optimization Pass2AliasElimination
Constant (const byte*) main::SCREEN#0 = ((byte*))1024
Constant (const byte*) setByte::ptr#0 = &main::b1#0
Constant (const byte) setByte::b#0 = 'c'
Constant (const byte*) setByte::ptr#1 = &main::b2#0
Constant (const byte) setByte::b#1 = 'm'
Constant (const byte*) setByte::ptr#2 = &main::b3#0
Constant (const byte) setByte::b#2 = 'l'
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::SCREEN#0+0)
Consolidated array index constant in *(main::SCREEN#0+1)
Consolidated array index constant in *(main::SCREEN#0+2)
Successful SSA optimization Pass2ConstantAdditionElimination
Inlining constant with var siblings (const byte*) setByte::ptr#0
Inlining constant with var siblings (const byte) setByte::b#0
Inlining constant with var siblings (const byte*) setByte::ptr#1
Inlining constant with var siblings (const byte) setByte::b#1
Inlining constant with var siblings (const byte*) setByte::ptr#2
Inlining constant with var siblings (const byte) setByte::b#2
Constant inlined setByte::ptr#1 = &(byte) main::b2#0
Constant inlined setByte::ptr#2 = &(byte) main::b3#0
Constant inlined setByte::ptr#0 = &(byte) main::b1#0
Constant inlined setByte::b#2 = (byte) 'l'
Constant inlined setByte::b#1 = (byte) 'm'
Constant inlined setByte::b#0 = (byte) 'c'
Successful SSA optimization Pass2ConstantInlining
Simplifying constant plus zero main::SCREEN#0+0
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to setByte:7 setByte:9 setByte:11 

Created 2 initial phi equivalence classes
Coalesced down to 2 phi equivalence classes
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of main::@2

FINAL CONTROL FLOW GRAPH
@begin: scope:[]  from
  [0] phi()
  to:@2
@2: scope:[]  from @begin
  [1] phi()
  [2] call main 
  to:@end
@end: scope:[]  from @2
  [3] phi()
main: scope:[main]  from @2
  [4] (byte) main::b1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  [5] (byte) main::b2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  [6] (byte) main::b3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
  [7] call setByte 
  to:main::@1
main::@1: scope:[main]  from main
  [8] phi()
  [9] call setByte 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [10] phi()
  [11] call setByte 
  to:main::@3
main::@3: scope:[main]  from main::@2
  [12] *((const byte*) main::SCREEN#0) ← (byte) main::b1#0
  [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b2#0
  [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::b3#0
  to:main::@return
main::@return: scope:[main]  from main::@3
  [15] return 
  to:@return
setByte: scope:[setByte]  from main main::@1 main::@2
  [16] (byte*) setByte::ptr#3 ← phi( main/&(byte) main::b1#0 main::@1/&(byte) main::b2#0 main::@2/&(byte) main::b3#0 )
  [16] (byte) setByte::b#3 ← phi( main/(byte) 'c' main::@1/(byte) 'm' main::@2/(byte) 'l' )
  [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3
  to:setByte::@return
setByte::@return: scope:[setByte]  from setByte
  [18] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*) main::SCREEN
(byte) main::b1
(byte) main::b1#0 0.36363636363636365
(byte) main::b2
(byte) main::b2#0 0.36363636363636365
(byte) main::b3
(byte) main::b3#0 0.36363636363636365
(void()) setByte((byte*) setByte::ptr , (byte) setByte::b)
(byte) setByte::b
(byte) setByte::b#3 2.0
(byte*) setByte::ptr
(byte*) setByte::ptr#3 2.0

Initial phi equivalence classes
[ setByte::b#3 ]
[ setByte::ptr#3 ]
Added variable main::b1#0 to zero page equivalence class [ main::b1#0 ]
Added variable main::b2#0 to zero page equivalence class [ main::b2#0 ]
Added variable main::b3#0 to zero page equivalence class [ main::b3#0 ]
Complete equivalence classes
[ setByte::b#3 ]
[ setByte::ptr#3 ]
[ main::b1#0 ]
[ main::b2#0 ]
[ main::b3#0 ]
Allocated zp ZP_BYTE:2 [ setByte::b#3 ]
Allocated zp ZP_WORD:3 [ setByte::ptr#3 ]
Allocated zp ZP_BYTE:5 [ main::b1#0 ]
Allocated zp ZP_BYTE:6 [ main::b2#0 ]
Allocated zp ZP_BYTE:7 [ main::b3#0 ]

INITIAL ASM
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
  jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
    .label SCREEN = $400
    .label b1 = 5
    .label b2 = 6
    .label b3 = 7
  //SEG10 [4] (byte) main::b1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b1
  //SEG11 [5] (byte) main::b2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b2
  //SEG12 [6] (byte) main::b3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b3
  //SEG13 [7] call setByte 
  //SEG14 [16] phi from main to setByte [phi:main->setByte]
  setByte_from_main:
  //SEG15 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b1#0 [phi:main->setByte#0] -- pbuz1=pbuc1 
    lda #<b1
    sta setByte.ptr
    lda #>b1
    sta setByte.ptr+1
  //SEG16 [16] phi (byte) setByte::b#3 = (byte) 'c' [phi:main->setByte#1] -- vbuz1=vbuc1 
    lda #'c'
    sta setByte.b
    jsr setByte
  //SEG17 [8] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG18 main::@1
  b1:
  //SEG19 [9] call setByte 
  //SEG20 [16] phi from main::@1 to setByte [phi:main::@1->setByte]
  setByte_from_b1:
  //SEG21 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b2#0 [phi:main::@1->setByte#0] -- pbuz1=pbuc1 
    lda #<b2
    sta setByte.ptr
    lda #>b2
    sta setByte.ptr+1
  //SEG22 [16] phi (byte) setByte::b#3 = (byte) 'm' [phi:main::@1->setByte#1] -- vbuz1=vbuc1 
    lda #'m'
    sta setByte.b
    jsr setByte
  //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
  //SEG24 main::@2
  b2:
  //SEG25 [11] call setByte 
  //SEG26 [16] phi from main::@2 to setByte [phi:main::@2->setByte]
  setByte_from_b2:
  //SEG27 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b3#0 [phi:main::@2->setByte#0] -- pbuz1=pbuc1 
    lda #<b3
    sta setByte.ptr
    lda #>b3
    sta setByte.ptr+1
  //SEG28 [16] phi (byte) setByte::b#3 = (byte) 'l' [phi:main::@2->setByte#1] -- vbuz1=vbuc1 
    lda #'l'
    sta setByte.b
    jsr setByte
    jmp b3
  //SEG29 main::@3
  b3:
  //SEG30 [12] *((const byte*) main::SCREEN#0) ← (byte) main::b1#0 -- _deref_pbuc1=vbuz1 
    lda b1
    sta SCREEN
  //SEG31 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b2#0 -- _deref_pbuc1=vbuz1 
    lda b2
    sta SCREEN+1
  //SEG32 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::b3#0 -- _deref_pbuc1=vbuz1 
    lda b3
    sta SCREEN+2
    jmp breturn
  //SEG33 main::@return
  breturn:
  //SEG34 [15] return 
    rts
}
//SEG35 setByte
// setByte(byte* zeropage(3) ptr, byte zeropage(2) b)
setByte: {
    .label b = 2
    .label ptr = 3
  //SEG36 [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 -- _deref_pbuz1=vbuz2 
    lda b
    ldy #0
    sta (ptr),y
    jmp breturn
  //SEG37 setByte::@return
  breturn:
  //SEG38 [18] return 
    rts
}

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 [ main::b1#0 main::b2#0 main::b3#0 ] ( main:2::setByte:7 [ main::b1#0 main::b2#0 main::b3#0 ] main:2::setByte:9 [ main::b1#0 main::b2#0 main::b3#0 ] main:2::setByte:11 [ main::b1#0 main::b2#0 main::b3#0 ] ) always clobbers reg byte y 
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::b1#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ main::b2#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:7 [ main::b3#0 ]
Statement [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 [ main::b1#0 main::b2#0 main::b3#0 ] ( main:2::setByte:7 [ main::b1#0 main::b2#0 main::b3#0 ] main:2::setByte:9 [ main::b1#0 main::b2#0 main::b3#0 ] main:2::setByte:11 [ main::b1#0 main::b2#0 main::b3#0 ] ) always clobbers reg byte y 
Potential registers zp ZP_BYTE:2 [ setByte::b#3 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_WORD:3 [ setByte::ptr#3 ] : zp ZP_WORD:3 , 
Potential registers zp ZP_BYTE:5 [ main::b1#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , 
Potential registers zp ZP_BYTE:6 [ main::b2#0 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , 
Potential registers zp ZP_BYTE:7 [ main::b3#0 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , 

REGISTER UPLIFT SCOPES
Uplift Scope [setByte] 2: zp ZP_BYTE:2 [ setByte::b#3 ] 2: zp ZP_WORD:3 [ setByte::ptr#3 ] 
Uplift Scope [main] 0.36: zp ZP_BYTE:5 [ main::b1#0 ] 0.36: zp ZP_BYTE:6 [ main::b2#0 ] 0.36: zp ZP_BYTE:7 [ main::b3#0 ] 
Uplift Scope [] 

Uplifting [setByte] best 139 combination reg byte x [ setByte::b#3 ] zp ZP_WORD:3 [ setByte::ptr#3 ] 
Uplifting [main] best 139 combination zp ZP_BYTE:5 [ main::b1#0 ] zp ZP_BYTE:6 [ main::b2#0 ] zp ZP_BYTE:7 [ main::b3#0 ] 
Uplifting [] best 139 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::b1#0 ]
Uplifting [main] best 139 combination zp ZP_BYTE:5 [ main::b1#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::b2#0 ]
Uplifting [main] best 139 combination zp ZP_BYTE:6 [ main::b2#0 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::b3#0 ]
Uplifting [main] best 139 combination zp ZP_BYTE:7 [ main::b3#0 ] 
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ setByte::ptr#3 ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:4 [ main::b1#0 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::b2#0 ]
Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ main::b3#0 ]

ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
  jmp b2
//SEG5 @2
b2:
//SEG6 [2] call main 
  jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
  jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
    .label SCREEN = $400
    .label b1 = 4
    .label b2 = 5
    .label b3 = 6
  //SEG10 [4] (byte) main::b1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b1
  //SEG11 [5] (byte) main::b2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b2
  //SEG12 [6] (byte) main::b3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b3
  //SEG13 [7] call setByte 
  //SEG14 [16] phi from main to setByte [phi:main->setByte]
  setByte_from_main:
  //SEG15 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b1#0 [phi:main->setByte#0] -- pbuz1=pbuc1 
    lda #<b1
    sta setByte.ptr
    lda #>b1
    sta setByte.ptr+1
  //SEG16 [16] phi (byte) setByte::b#3 = (byte) 'c' [phi:main->setByte#1] -- vbuxx=vbuc1 
    ldx #'c'
    jsr setByte
  //SEG17 [8] phi from main to main::@1 [phi:main->main::@1]
  b1_from_main:
    jmp b1
  //SEG18 main::@1
  b1:
  //SEG19 [9] call setByte 
  //SEG20 [16] phi from main::@1 to setByte [phi:main::@1->setByte]
  setByte_from_b1:
  //SEG21 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b2#0 [phi:main::@1->setByte#0] -- pbuz1=pbuc1 
    lda #<b2
    sta setByte.ptr
    lda #>b2
    sta setByte.ptr+1
  //SEG22 [16] phi (byte) setByte::b#3 = (byte) 'm' [phi:main::@1->setByte#1] -- vbuxx=vbuc1 
    ldx #'m'
    jsr setByte
  //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  b2_from_b1:
    jmp b2
  //SEG24 main::@2
  b2:
  //SEG25 [11] call setByte 
  //SEG26 [16] phi from main::@2 to setByte [phi:main::@2->setByte]
  setByte_from_b2:
  //SEG27 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b3#0 [phi:main::@2->setByte#0] -- pbuz1=pbuc1 
    lda #<b3
    sta setByte.ptr
    lda #>b3
    sta setByte.ptr+1
  //SEG28 [16] phi (byte) setByte::b#3 = (byte) 'l' [phi:main::@2->setByte#1] -- vbuxx=vbuc1 
    ldx #'l'
    jsr setByte
    jmp b3
  //SEG29 main::@3
  b3:
  //SEG30 [12] *((const byte*) main::SCREEN#0) ← (byte) main::b1#0 -- _deref_pbuc1=vbuz1 
    lda b1
    sta SCREEN
  //SEG31 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b2#0 -- _deref_pbuc1=vbuz1 
    lda b2
    sta SCREEN+1
  //SEG32 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::b3#0 -- _deref_pbuc1=vbuz1 
    lda b3
    sta SCREEN+2
    jmp breturn
  //SEG33 main::@return
  breturn:
  //SEG34 [15] return 
    rts
}
//SEG35 setByte
// setByte(byte* zeropage(2) ptr, byte register(X) b)
setByte: {
    .label ptr = 2
  //SEG36 [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (ptr),y
    jmp breturn
  //SEG37 setByte::@return
  breturn:
  //SEG38 [18] return 
    rts
}

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction b2_from_bbegin:
Removing instruction b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_main:
Removing instruction setByte_from_b1:
Removing instruction b2_from_b1:
Removing instruction setByte_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction setByte_from_main:
Removing instruction b1:
Removing instruction b2:
Removing instruction b3:
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 bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @2
(label) @begin
(label) @end
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(byte) main::b1
(byte) main::b1#0 b1 zp ZP_BYTE:4 0.36363636363636365
(byte) main::b2
(byte) main::b2#0 b2 zp ZP_BYTE:5 0.36363636363636365
(byte) main::b3
(byte) main::b3#0 b3 zp ZP_BYTE:6 0.36363636363636365
(void()) setByte((byte*) setByte::ptr , (byte) setByte::b)
(label) setByte::@return
(byte) setByte::b
(byte) setByte::b#3 reg byte x 2.0
(byte*) setByte::ptr
(byte*) setByte::ptr#3 ptr zp ZP_WORD:2 2.0

reg byte x [ setByte::b#3 ]
zp ZP_WORD:2 [ setByte::ptr#3 ]
zp ZP_BYTE:4 [ main::b1#0 ]
zp ZP_BYTE:5 [ main::b2#0 ]
zp ZP_BYTE:6 [ main::b3#0 ]


FINAL ASSEMBLER
Score: 108

//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main 
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
main: {
    .label SCREEN = $400
    .label b1 = 4
    .label b2 = 5
    .label b3 = 6
  //SEG10 [4] (byte) main::b1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    lda #0
    sta b1
  //SEG11 [5] (byte) main::b2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    sta b2
  //SEG12 [6] (byte) main::b3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 
    sta b3
  //SEG13 [7] call setByte 
  //SEG14 [16] phi from main to setByte [phi:main->setByte]
  //SEG15 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b1#0 [phi:main->setByte#0] -- pbuz1=pbuc1 
    lda #<b1
    sta setByte.ptr
    lda #>b1
    sta setByte.ptr+1
  //SEG16 [16] phi (byte) setByte::b#3 = (byte) 'c' [phi:main->setByte#1] -- vbuxx=vbuc1 
    ldx #'c'
    jsr setByte
  //SEG17 [8] phi from main to main::@1 [phi:main->main::@1]
  //SEG18 main::@1
  //SEG19 [9] call setByte 
  //SEG20 [16] phi from main::@1 to setByte [phi:main::@1->setByte]
  //SEG21 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b2#0 [phi:main::@1->setByte#0] -- pbuz1=pbuc1 
    lda #<b2
    sta setByte.ptr
    lda #>b2
    sta setByte.ptr+1
  //SEG22 [16] phi (byte) setByte::b#3 = (byte) 'm' [phi:main::@1->setByte#1] -- vbuxx=vbuc1 
    ldx #'m'
    jsr setByte
  //SEG23 [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
  //SEG24 main::@2
  //SEG25 [11] call setByte 
  //SEG26 [16] phi from main::@2 to setByte [phi:main::@2->setByte]
  //SEG27 [16] phi (byte*) setByte::ptr#3 = &(byte) main::b3#0 [phi:main::@2->setByte#0] -- pbuz1=pbuc1 
    lda #<b3
    sta setByte.ptr
    lda #>b3
    sta setByte.ptr+1
  //SEG28 [16] phi (byte) setByte::b#3 = (byte) 'l' [phi:main::@2->setByte#1] -- vbuxx=vbuc1 
    ldx #'l'
    jsr setByte
  //SEG29 main::@3
  //SEG30 [12] *((const byte*) main::SCREEN#0) ← (byte) main::b1#0 -- _deref_pbuc1=vbuz1 
    lda b1
    sta SCREEN
  //SEG31 [13] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::b2#0 -- _deref_pbuc1=vbuz1 
    lda b2
    sta SCREEN+1
  //SEG32 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) main::b3#0 -- _deref_pbuc1=vbuz1 
    lda b3
    sta SCREEN+2
  //SEG33 main::@return
  //SEG34 [15] return 
    rts
}
//SEG35 setByte
// setByte(byte* zeropage(2) ptr, byte register(X) b)
setByte: {
    .label ptr = 2
  //SEG36 [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 -- _deref_pbuz1=vbuxx 
    txa
    ldy #0
    sta (ptr),y
  //SEG37 setByte::@return
  //SEG38 [18] return 
    rts
}

