
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  if(7<4) goto main::@1
  to:main::@2
main::@1: scope:[main]  from main
  main::SCREEN[0] = '*'
  to:main::@return
main::@2: scope:[main]  from main
  main::SCREEN[0] = '!'
  to:main::@return
main::@return: scope:[main]  from main::@1 main::@2
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  call main
  to:__start::@1
__start::@1: scope:[__start]  from __start
  to:__start::@return
__start::@return: scope:[__start]  from __start::@1
  return 
  to:@return

SYMBOL TABLE SSA
void __start()
void main()
__constant char * const main::SCREEN = (char *)$400

Adding number conversion cast (unumber) 0 in main::SCREEN[0] = '*'
Adding number conversion cast (unumber) 0 in main::SCREEN[0] = '!'
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
if() condition always false - eliminating [0] if(7<4) goto main::@1
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero main::SCREEN in [1] main::SCREEN[0] = '*'
Simplifying expression containing zero main::SCREEN in [2] main::SCREEN[0] = '!'
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@1
Successful SSA optimization Pass2EliminateUnusedBlocks
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Adding NOP phi() at start of main
CALL GRAPH

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

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  to:main::@1
main::@1: scope:[main]  from main
  [1] *main::SCREEN = '!'
  to:main::@return
main::@return: scope:[main]  from main::@1
  [2] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *main::SCREEN = '!' [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 45 combination 
Uplifting [] best 45 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Ensure that if()'s with constant comparisons are identified and eliminated
  // Upstart
  // Commodore 64 PRG executable file
.file [name="const-condition.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
.segment Code
  // main
main: {
    .label SCREEN = $400
    jmp __b1
    // main::@1
  __b1:
    // [1] *main::SCREEN = '!' -- _deref_pbuc1=vbuc2 
    lda #'!'
    sta SCREEN
    jmp __breturn
    // main::@return
  __breturn:
    // [2] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
void main()
__constant char * const main::SCREEN = (char *) 1024



FINAL ASSEMBLER
Score: 12

  // File Comments
// Ensure that if()'s with constant comparisons are identified and eliminated
  // Upstart
  // Commodore 64 PRG executable file
.file [name="const-condition.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
.segment Code
  // main
main: {
    .label SCREEN = $400
    // main::@1
    // SCREEN[0] = '!'
    // [1] *main::SCREEN = '!' -- _deref_pbuc1=vbuc2 
    lda #'!'
    sta SCREEN
    // main::@return
    // }
    // [2] return 
    rts
}
  // File Data

