Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx 
Inlined call call vicSelectGfxBank (const byte*) main::PLAYFIELD_CHARSET 
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) @3
Culled Empty Block (label) @4
Culled Empty Block (label) main::vicSelectGfxBank1_toDd001_@1
Culled Empty Block (label) main::vicSelectGfxBank1_@return
Culled Empty Block (label) main::@1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  to:@5

(void()) main()
main: scope:[main]  from @5
  (byte*) main::vicSelectGfxBank1_gfx#0 ← (const byte*) main::PLAYFIELD_CHARSET
  to:main::vicSelectGfxBank1
main::vicSelectGfxBank1: scope:[main]  from main
  (byte*) main::vicSelectGfxBank1_gfx#1 ← phi( main/(byte*) main::vicSelectGfxBank1_gfx#0 )
  *((const byte*) CIA2_PORT_A_DDR) ← (number) 3
  (byte*) main::vicSelectGfxBank1_toDd001_gfx#0 ← (byte*) main::vicSelectGfxBank1_gfx#1
  to:main::vicSelectGfxBank1_toDd001
main::vicSelectGfxBank1_toDd001: scope:[main]  from main::vicSelectGfxBank1
  (byte*) main::vicSelectGfxBank1_toDd001_gfx#1 ← phi( main::vicSelectGfxBank1/(byte*) main::vicSelectGfxBank1_toDd001_gfx#0 )
  (word~) main::vicSelectGfxBank1_toDd001_$0 ← ((word)) (byte*) main::vicSelectGfxBank1_toDd001_gfx#1
  (byte~) main::vicSelectGfxBank1_toDd001_$1 ← > (word~) main::vicSelectGfxBank1_toDd001_$0
  (number~) main::vicSelectGfxBank1_toDd001_$2 ← (byte~) main::vicSelectGfxBank1_toDd001_$1 / (number) $40
  (number~) main::vicSelectGfxBank1_toDd001_$3 ← (number) 3 ^ (number~) main::vicSelectGfxBank1_toDd001_$2
  (byte) main::vicSelectGfxBank1_toDd001_return#0 ← (number~) main::vicSelectGfxBank1_toDd001_$3
  to:main::vicSelectGfxBank1_toDd001_@return
main::vicSelectGfxBank1_toDd001_@return: scope:[main]  from main::vicSelectGfxBank1_toDd001
  (byte) main::vicSelectGfxBank1_toDd001_return#2 ← phi( main::vicSelectGfxBank1_toDd001/(byte) main::vicSelectGfxBank1_toDd001_return#0 )
  (byte) main::vicSelectGfxBank1_toDd001_return#1 ← (byte) main::vicSelectGfxBank1_toDd001_return#2
  to:main::vicSelectGfxBank1_@1
main::vicSelectGfxBank1_@1: scope:[main]  from main::vicSelectGfxBank1_toDd001_@return
  (byte) main::vicSelectGfxBank1_toDd001_return#3 ← phi( main::vicSelectGfxBank1_toDd001_@return/(byte) main::vicSelectGfxBank1_toDd001_return#1 )
  (byte~) main::vicSelectGfxBank1_$0 ← (byte) main::vicSelectGfxBank1_toDd001_return#3
  *((const byte*) CIA2_PORT_A) ← (byte~) main::vicSelectGfxBank1_$0
  to:main::@return
main::@return: scope:[main]  from main::vicSelectGfxBank1_@1
  return 
  to:@return
@5: scope:[]  from @begin
  call main 
  to:@6
@6: scope:[]  from @5
  to:@end
@end: scope:[]  from @6

SYMBOL TABLE SSA
(label) @5
(label) @6
(label) @begin
(label) @end
(const byte*) CIA2_PORT_A = (byte*)(number) $dd00
(const byte*) CIA2_PORT_A_DDR = (byte*)(number) $dd02
(void()) main()
(label) main::@return
(const byte*) main::PLAYFIELD_CHARSET = (byte*)(number) $2800
(label) main::vicSelectGfxBank1
(byte~) main::vicSelectGfxBank1_$0
(label) main::vicSelectGfxBank1_@1
(byte*) main::vicSelectGfxBank1_gfx
(byte*) main::vicSelectGfxBank1_gfx#0
(byte*) main::vicSelectGfxBank1_gfx#1
(label) main::vicSelectGfxBank1_toDd001
(word~) main::vicSelectGfxBank1_toDd001_$0
(byte~) main::vicSelectGfxBank1_toDd001_$1
(number~) main::vicSelectGfxBank1_toDd001_$2
(number~) main::vicSelectGfxBank1_toDd001_$3
(label) main::vicSelectGfxBank1_toDd001_@return
(byte*) main::vicSelectGfxBank1_toDd001_gfx
(byte*) main::vicSelectGfxBank1_toDd001_gfx#0
(byte*) main::vicSelectGfxBank1_toDd001_gfx#1
(byte) main::vicSelectGfxBank1_toDd001_return
(byte) main::vicSelectGfxBank1_toDd001_return#0
(byte) main::vicSelectGfxBank1_toDd001_return#1
(byte) main::vicSelectGfxBank1_toDd001_return#2
(byte) main::vicSelectGfxBank1_toDd001_return#3

Adding number conversion cast (unumber) 3 in *((const byte*) CIA2_PORT_A_DDR) ← (number) 3
Adding number conversion cast (unumber) $40 in (number~) main::vicSelectGfxBank1_toDd001_$2 ← (byte~) main::vicSelectGfxBank1_toDd001_$1 / (number) $40
Adding number conversion cast (unumber) main::vicSelectGfxBank1_toDd001_$2 in (number~) main::vicSelectGfxBank1_toDd001_$2 ← (byte~) main::vicSelectGfxBank1_toDd001_$1 / (unumber)(number) $40
Adding number conversion cast (unumber) 3 in (number~) main::vicSelectGfxBank1_toDd001_$3 ← (number) 3 ^ (unumber~) main::vicSelectGfxBank1_toDd001_$2
Adding number conversion cast (unumber) main::vicSelectGfxBank1_toDd001_$3 in (number~) main::vicSelectGfxBank1_toDd001_$3 ← (unumber)(number) 3 ^ (unumber~) main::vicSelectGfxBank1_toDd001_$2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((const byte*) CIA2_PORT_A_DDR) ← (unumber)(number) 3
Inlining cast (word~) main::vicSelectGfxBank1_toDd001_$0 ← (word)(byte*) main::vicSelectGfxBank1_toDd001_gfx#1
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 56576
Simplifying constant pointer cast (byte*) 56578
Simplifying constant pointer cast (byte*) 10240
Simplifying constant integer cast 3
Simplifying constant integer cast $40
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) $40
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::vicSelectGfxBank1_toDd001_$2 ← (byte~) main::vicSelectGfxBank1_toDd001_$1 / (byte) $40
Inferred type updated to byte in (unumber~) main::vicSelectGfxBank1_toDd001_$3 ← (byte) 3 ^ (byte~) main::vicSelectGfxBank1_toDd001_$2
Alias (byte*) main::vicSelectGfxBank1_gfx#0 = (byte*) main::vicSelectGfxBank1_gfx#1 (byte*) main::vicSelectGfxBank1_toDd001_gfx#0 (byte*) main::vicSelectGfxBank1_toDd001_gfx#1 
Alias (byte) main::vicSelectGfxBank1_toDd001_return#0 = (byte~) main::vicSelectGfxBank1_toDd001_$3 (byte) main::vicSelectGfxBank1_toDd001_return#2 (byte) main::vicSelectGfxBank1_toDd001_return#1 (byte) main::vicSelectGfxBank1_toDd001_return#3 (byte~) main::vicSelectGfxBank1_$0 
Successful SSA optimization Pass2AliasElimination
Constant (const byte*) main::vicSelectGfxBank1_gfx#0 = main::PLAYFIELD_CHARSET
Successful SSA optimization Pass2ConstantIdentification
Constant (const word) main::vicSelectGfxBank1_toDd001_$0 = (word)main::vicSelectGfxBank1_gfx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [1] (byte~) main::vicSelectGfxBank1_toDd001_$1 ← > (const word) main::vicSelectGfxBank1_toDd001_$0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::vicSelectGfxBank1_toDd001_$1 = >main::vicSelectGfxBank1_toDd001_$0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [1] (byte~) main::vicSelectGfxBank1_toDd001_$2 ← (const byte) main::vicSelectGfxBank1_toDd001_$1 / (byte) $40
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::vicSelectGfxBank1_toDd001_$2 = main::vicSelectGfxBank1_toDd001_$1/$40
Successful SSA optimization Pass2ConstantIdentification
Simplifying constant evaluating to zero (const byte) main::vicSelectGfxBank1_toDd001_$1/(byte) $40 in 
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero 3 in [2] (byte) main::vicSelectGfxBank1_toDd001_return#0 ← (byte) 3 ^ (const byte) main::vicSelectGfxBank1_toDd001_$2
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) main::vicSelectGfxBank1_toDd001_$1
Eliminating unused constant (const byte) main::vicSelectGfxBank1_toDd001_$2
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const word) main::vicSelectGfxBank1_toDd001_$0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte*) main::vicSelectGfxBank1_gfx#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const byte*) main::PLAYFIELD_CHARSET
Successful SSA optimization PassNEliminateUnusedVars
Constant (const byte) main::vicSelectGfxBank1_toDd001_return#0 = 3
Successful SSA optimization Pass2ConstantIdentification
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @5
Adding NOP phi() at start of @6
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::vicSelectGfxBank1_toDd001
Adding NOP phi() at start of main::vicSelectGfxBank1_toDd001_@return
CALL GRAPH
Calls in [] to main:2 

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @6
Culled Empty Block (label) main::vicSelectGfxBank1_toDd001_@return
Renumbering block @5 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::vicSelectGfxBank1_toDd001

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()
  to:main::vicSelectGfxBank1
main::vicSelectGfxBank1: scope:[main]  from main
  [5] *((const byte*) CIA2_PORT_A_DDR) ← (byte) 3
  to:main::vicSelectGfxBank1_toDd001
main::vicSelectGfxBank1_toDd001: scope:[main]  from main::vicSelectGfxBank1
  [6] phi()
  to:main::vicSelectGfxBank1_@1
main::vicSelectGfxBank1_@1: scope:[main]  from main::vicSelectGfxBank1_toDd001
  [7] *((const byte*) CIA2_PORT_A) ← (const byte) main::vicSelectGfxBank1_toDd001_return#0
  to:main::@return
main::@return: scope:[main]  from main::vicSelectGfxBank1_@1
  [8] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte*) main::vicSelectGfxBank1_gfx
(byte*) main::vicSelectGfxBank1_toDd001_gfx
(byte) main::vicSelectGfxBank1_toDd001_return

Initial phi equivalence classes
Complete equivalence classes

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Test minimization of constants
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // CIA#2 Port A: Serial bus, RS-232, VIC memory bank
  .label CIA2_PORT_A = $dd00
  // CIA #2 Port A data direction register.
  .label CIA2_PORT_A_DDR = $dd02
  // @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 vicSelectGfxBank1_toDd001_return = 3
    jmp vicSelectGfxBank1
    // main::vicSelectGfxBank1
  vicSelectGfxBank1:
    // [5] *((const byte*) CIA2_PORT_A_DDR) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta CIA2_PORT_A_DDR
    // [6] phi from main::vicSelectGfxBank1 to main::vicSelectGfxBank1_toDd001 [phi:main::vicSelectGfxBank1->main::vicSelectGfxBank1_toDd001]
  vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1:
    jmp vicSelectGfxBank1_toDd001
    // main::vicSelectGfxBank1_toDd001
  vicSelectGfxBank1_toDd001:
    jmp vicSelectGfxBank1___b1
    // main::vicSelectGfxBank1_@1
  vicSelectGfxBank1___b1:
    // [7] *((const byte*) CIA2_PORT_A) ← (const byte) main::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 
    lda #vicSelectGfxBank1_toDd001_return
    sta CIA2_PORT_A
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [5] *((const byte*) CIA2_PORT_A_DDR) ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a 
Statement [7] *((const byte*) CIA2_PORT_A) ← (const byte) main::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a 

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

Uplifting [main] best 96 combination 
Uplifting [] best 96 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test minimization of constants
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  // CIA#2 Port A: Serial bus, RS-232, VIC memory bank
  .label CIA2_PORT_A = $dd00
  // CIA #2 Port A data direction register.
  .label CIA2_PORT_A_DDR = $dd02
  // @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 vicSelectGfxBank1_toDd001_return = 3
    jmp vicSelectGfxBank1
    // main::vicSelectGfxBank1
  vicSelectGfxBank1:
    // [5] *((const byte*) CIA2_PORT_A_DDR) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta CIA2_PORT_A_DDR
    // [6] phi from main::vicSelectGfxBank1 to main::vicSelectGfxBank1_toDd001 [phi:main::vicSelectGfxBank1->main::vicSelectGfxBank1_toDd001]
  vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1:
    jmp vicSelectGfxBank1_toDd001
    // main::vicSelectGfxBank1_toDd001
  vicSelectGfxBank1_toDd001:
    jmp vicSelectGfxBank1___b1
    // main::vicSelectGfxBank1_@1
  vicSelectGfxBank1___b1:
    // [7] *((const byte*) CIA2_PORT_A) ← (const byte) main::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 
    lda #vicSelectGfxBank1_toDd001_return
    sta CIA2_PORT_A
    jmp __breturn
    // main::@return
  __breturn:
    // [8] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp vicSelectGfxBank1
Removing instruction jmp vicSelectGfxBank1_toDd001
Removing instruction jmp vicSelectGfxBank1___b1
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 vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1:
Removing instruction vicSelectGfxBank1_toDd001:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction vicSelectGfxBank1:
Removing instruction vicSelectGfxBank1___b1:
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*) CIA2_PORT_A = (byte*) 56576
(const byte*) CIA2_PORT_A_DDR = (byte*) 56578
(void()) main()
(label) main::@return
(label) main::vicSelectGfxBank1
(label) main::vicSelectGfxBank1_@1
(byte*) main::vicSelectGfxBank1_gfx
(label) main::vicSelectGfxBank1_toDd001
(byte*) main::vicSelectGfxBank1_toDd001_gfx
(byte) main::vicSelectGfxBank1_toDd001_return
(const byte) main::vicSelectGfxBank1_toDd001_return#0 vicSelectGfxBank1_toDd001_return = (byte) 3



FINAL ASSEMBLER
Score: 18

  // File Comments
// Test minimization of constants
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  // CIA#2 Port A: Serial bus, RS-232, VIC memory bank
  .label CIA2_PORT_A = $dd00
  // CIA #2 Port A data direction register.
  .label CIA2_PORT_A_DDR = $dd02
  // @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 vicSelectGfxBank1_toDd001_return = 3
    // main::vicSelectGfxBank1
    // *CIA2_PORT_A_DDR = %00000011
    // [5] *((const byte*) CIA2_PORT_A_DDR) ← (byte) 3 -- _deref_pbuc1=vbuc2 
    lda #3
    sta CIA2_PORT_A_DDR
    // [6] phi from main::vicSelectGfxBank1 to main::vicSelectGfxBank1_toDd001 [phi:main::vicSelectGfxBank1->main::vicSelectGfxBank1_toDd001]
    // main::vicSelectGfxBank1_toDd001
    // main::vicSelectGfxBank1_@1
    // *CIA2_PORT_A = toDd00(gfx)
    // [7] *((const byte*) CIA2_PORT_A) ← (const byte) main::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 
    lda #vicSelectGfxBank1_toDd001_return
    sta CIA2_PORT_A
    // main::@return
    // }
    // [8] return 
    rts
}
  // File Data

