Identified constant variable (byte) w
Identified constant variable (byte*) main::screen

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) b#0 ← (byte) 0
  (byte) s#0 ← (byte) 0
  to:@1
main: scope:[main]  from @1
  (byte) b#4 ← phi( @1/(byte) b#7 )
  (number~) main::$0 ← (byte) b#4 + (number) 1
  (byte) s#1 ← (number~) main::$0
  (byte) b#1 ← (number) 3
  (byte*) main::screen#0 ← ((byte*)) (number) $400
  *((byte*) main::screen#0) ← (byte) b#1
  (byte*~) main::$1 ← (byte*) main::screen#0 + (number) 1
  *((byte*~) main::$1) ← (byte) s#1
  to:main::@return
main::@return: scope:[main]  from main
  (byte) b#5 ← phi( main/(byte) b#1 )
  (byte) s#4 ← phi( main/(byte) s#1 )
  (byte) s#2 ← (byte) s#4
  (byte) b#2 ← (byte) b#5
  return 
  to:@return
@1: scope:[]  from @begin
  (byte) s#6 ← phi( @begin/(byte) s#0 )
  (byte) b#7 ← phi( @begin/(byte) b#0 )
  call main 
  to:@2
@2: scope:[]  from @1
  (byte) b#6 ← phi( @1/(byte) b#2 )
  (byte) s#5 ← phi( @1/(byte) s#2 )
  (byte) s#3 ← (byte) s#5
  (byte) b#3 ← (byte) b#6
  to:@end
@end: scope:[]  from @2

SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(byte) b
(byte) b#0
(byte) b#1
(byte) b#2
(byte) b#3
(byte) b#4
(byte) b#5
(byte) b#6
(byte) b#7
(void()) main()
(number~) main::$0
(byte*~) main::$1
(label) main::@return
(byte*) main::screen
(byte*) main::screen#0
(byte) s
(byte) s#0
(byte) s#1
(byte) s#2
(byte) s#3
(byte) s#4
(byte) s#5
(byte) s#6

Adding number conversion cast (unumber) 1 in (number~) main::$0 ← (byte) b#4 + (number) 1
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← (byte) b#4 + (unumber)(number) 1
Adding number conversion cast (unumber) 3 in (byte) b#1 ← (number) 3
Adding number conversion cast (unumber) 1 in (byte*~) main::$1 ← (byte*) main::screen#0 + (number) 1
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) b#1 ← (unumber)(number) 3
Inlining cast (byte*) main::screen#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast 1
Simplifying constant integer cast 3
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$0 ← (byte) b#4 + (byte) 1
Alias (byte) s#1 = (byte~) main::$0 (byte) s#4 (byte) s#2 
Alias (byte) b#1 = (byte) b#5 (byte) b#2 
Alias (byte) b#0 = (byte) b#7 
Alias (byte) s#0 = (byte) s#6 
Alias (byte) s#3 = (byte) s#5 
Alias (byte) b#3 = (byte) b#6 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) b#4 (byte) b#0
Identical Phi Values (byte) s#3 (byte) s#1
Identical Phi Values (byte) b#3 (byte) b#1
Successful SSA optimization Pass2IdenticalPhiElimination
Constant (const byte) b#0 = 0
Constant (const byte) s#0 = 0
Constant (const byte) b#1 = 3
Constant (const byte*) main::screen#0 = (byte*) 1024
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [9] *((byte*~) main::$1) ← (byte) s#1  -- *(main::screen#0 + 1)
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero 1 in [3] (byte) s#1 ← (const byte) b#0 + (byte) 1
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte*~) main::$1 and assignment [2] (byte*~) main::$1 ← (const byte*) main::screen#0 + (byte) 1
Eliminating unused constant (const byte) b#0
Eliminating unused constant (const byte) s#0
Successful SSA optimization PassNEliminateUnusedVars
Constant (const byte) s#1 = 1
Successful SSA optimization Pass2ConstantIdentification
Consolidated array index constant in *(main::screen#0+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

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] *((const byte*) main::screen#0) ← (const byte) b#1
  [5] *((const byte*) main::screen#0+(byte) 1) ← (const byte) s#1
  to:main::@return
main::@return: scope:[main]  from main
  [6] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) b
(void()) main()
(byte*) main::screen
(byte) s

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic
  // File Comments
// Use an uninitialized variable - should use the default value (0)!
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const b = 3
  .const s = 1
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label screen = $400
    // [4] *((const byte*) main::screen#0) ← (const byte) b#1 -- _deref_pbuc1=vbuc2 
    lda #b
    sta screen
    // [5] *((const byte*) main::screen#0+(byte) 1) ← (const byte) s#1 -- _deref_pbuc1=vbuc2 
    lda #s
    sta screen+1
    jmp breturn
    // main::@return
  breturn:
    // [6] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::screen#0) ← (const byte) b#1 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [5] *((const byte*) main::screen#0+(byte) 1) ← (const byte) s#1 [ ] ( main:2 [ ] ) always clobbers reg byte a 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 
Uplift Scope [] 

Uplifting [main] best 33 combination 
Uplifting [] best 33 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Use an uninitialized variable - should use the default value (0)!
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const b = 3
  .const s = 1
  // @begin
bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
  jmp b1
  // @1
b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
  jmp bend
  // @end
bend:
  // main
main: {
    .label screen = $400
    // [4] *((const byte*) main::screen#0) ← (const byte) b#1 -- _deref_pbuc1=vbuc2 
    lda #b
    sta screen
    // [5] *((const byte*) main::screen#0+(byte) 1) ← (const byte) s#1 -- _deref_pbuc1=vbuc2 
    lda #s
    sta screen+1
    jmp breturn
    // main::@return
  breturn:
    // [6] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
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) @1
(label) @begin
(label) @end
(byte) b
(const byte) b#1 b = (byte) 3
(void()) main()
(label) main::@return
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024
(byte) s
(const byte) s#1 s = (byte) 1



FINAL ASSEMBLER
Score: 18

  // File Comments
// Use an uninitialized variable - should use the default value (0)!
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const b = 3
  .const s = 1
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label screen = $400
    // *screen = b
    // [4] *((const byte*) main::screen#0) ← (const byte) b#1 -- _deref_pbuc1=vbuc2 
    lda #b
    sta screen
    // *(screen+1) = s
    // [5] *((const byte*) main::screen#0+(byte) 1) ← (const byte) s#1 -- _deref_pbuc1=vbuc2 
    lda #s
    sta screen+1
    // main::@return
    // }
    // [6] return 
    rts
}
  // File Data

