Resolving sizeof() main::$2 = sizeof  main::b
Resolving sizeof() main::$4 = sizeof  main::w

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  main::idx#0 = 0
  main::$0 = sizeof  0
  main::$1 = '0' + main::$0
  SCREEN[main::idx#0] = main::$1
  main::idx#1 = ++ main::idx#0
  main::$2 = SIZEOF_CHAR
  main::$3 = '0' + main::$2
  SCREEN[main::idx#1] = main::$3
  main::idx#2 = ++ main::idx#1
  main::$4 = SIZEOF_INT
  main::$5 = '0' + main::$4
  SCREEN[main::idx#2] = main::$5
  main::idx#3 = ++ main::idx#2
  SCREEN[main::idx#3] = '0'+SIZEOF_CHAR
  main::idx#4 = ++ main::idx#3
  SCREEN[main::idx#4] = '0'+SIZEOF_INT
  main::idx#5 = ++ main::idx#4
  to:main::@return
main::@return: scope:[main]  from main
  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
__constant char * const SCREEN = (char *)$400
__constant char SIZEOF_CHAR = 1
__constant char SIZEOF_INT = 2
void __start()
void main()
unsigned int main::$0
unsigned int main::$1
unsigned int main::$2
unsigned int main::$3
unsigned int main::$4
unsigned int main::$5
char main::idx
char main::idx#0
char main::idx#1
char main::idx#2
char main::idx#3
char main::idx#4
char main::idx#5

Simplifying constant pointer cast (char *) 1024
Successful SSA optimization PassNCastSimplification
Constant right-side identified [1] main::$0 = sizeof  0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#0 = 0
Constant main::$0 = sizeof 0
Constant main::$2 = SIZEOF_CHAR
Constant main::$4 = SIZEOF_INT
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero SCREEN in [3] SCREEN[main::idx#0] = main::$1
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable main::idx#5 and assignment [12] main::idx#5 = ++ main::idx#4
Successful SSA optimization PassNEliminateUnusedVars
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
Resolving sizeof() sizeof 0
Successful SSA optimization PassNSizeOfSimplification
Constant right-side identified [0] main::$1 = '0' + main::$0
Constant right-side identified [2] main::idx#1 = ++ main::idx#0
Constant right-side identified [3] main::$3 = '0' + main::$2
Constant right-side identified [6] main::$5 = '0' + main::$4
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::$1 = '0'+main::$0
Constant main::idx#1 = ++main::idx#0
Constant main::$3 = '0'+main::$2
Constant main::$5 = '0'+main::$4
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [2] main::idx#2 = ++ main::idx#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#2 = ++main::idx#1
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [3] main::idx#3 = ++ main::idx#2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#3 = ++main::idx#2
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [4] main::idx#4 = ++ main::idx#3
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::idx#4 = ++main::idx#3
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings main::idx#0
Inlining constant with different constant siblings main::idx#1
Inlining constant with different constant siblings main::idx#2
Inlining constant with different constant siblings main::idx#3
Inlining constant with different constant siblings main::idx#4
Constant inlined main::idx#0 = 0
Constant inlined main::idx#1 = ++0
Constant inlined main::idx#2 = ++++0
Constant inlined main::$1 = '0'+SIZEOF_NUMBER
Constant inlined main::idx#3 = ++++++0
Constant inlined main::$2 = SIZEOF_CHAR
Constant inlined main::idx#4 = ++++++++0
Constant inlined main::$0 = SIZEOF_NUMBER
Constant inlined main::$5 = '0'+SIZEOF_INT
Constant inlined main::$3 = '0'+SIZEOF_CHAR
Constant inlined main::$4 = SIZEOF_INT
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN+++0)
Consolidated array index constant in *(SCREEN+++++0)
Consolidated array index constant in *(SCREEN+++++++0)
Consolidated array index constant in *(SCREEN+++++++++0)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Simplifying constant integer increment ++3
Successful SSA optimization Pass2ConstantSimplification
CALL GRAPH

Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *SCREEN = '0'+SIZEOF_NUMBER
  [1] *(SCREEN+1) = '0'+SIZEOF_CHAR
  [2] *(SCREEN+2) = '0'+SIZEOF_INT
  [3] *(SCREEN+3) = '0'+SIZEOF_CHAR
  [4] *(SCREEN+4) = '0'+SIZEOF_INT
  to:main::@return
main::@return: scope:[main]  from main
  [5] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::idx

Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *SCREEN = '0'+SIZEOF_NUMBER [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *(SCREEN+1) = '0'+SIZEOF_CHAR [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *(SCREEN+2) = '0'+SIZEOF_INT [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *(SCREEN+3) = '0'+SIZEOF_CHAR [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *(SCREEN+4) = '0'+SIZEOF_INT [ ] (  [ ] { }  ) always clobbers reg byte a 

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

Uplifting [main] best 39 combination 
Uplifting [] best 39 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Tests the sizeof operator without parenthesis
  // Upstart
  // Commodore 64 PRG executable file
.file [name="sizeof-noparen.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
  .const SIZEOF_CHAR = 1
  .const SIZEOF_INT = 2
  .const SIZEOF_NUMBER = -1
  .label SCREEN = $400
.segment Code
  // main
main: {
    // [0] *SCREEN = '0'+SIZEOF_NUMBER -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_NUMBER
    sta SCREEN
    // [1] *(SCREEN+1) = '0'+SIZEOF_CHAR -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_CHAR
    sta SCREEN+1
    // [2] *(SCREEN+2) = '0'+SIZEOF_INT -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_INT
    sta SCREEN+2
    // [3] *(SCREEN+3) = '0'+SIZEOF_CHAR -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_CHAR
    sta SCREEN+3
    // [4] *(SCREEN+4) = '0'+SIZEOF_INT -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_INT
    sta SCREEN+4
    jmp __breturn
    // main::@return
  __breturn:
    // [5] return 
    rts
}
  // File Data

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

FINAL SYMBOL TABLE
__constant char * const SCREEN = (char *) 1024
__constant char SIZEOF_CHAR = 1
__constant char SIZEOF_INT = 2
__constant char SIZEOF_NUMBER = -1
void main()
char main::idx



FINAL ASSEMBLER
Score: 36

  // File Comments
// Tests the sizeof operator without parenthesis
  // Upstart
  // Commodore 64 PRG executable file
.file [name="sizeof-noparen.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
  .const SIZEOF_CHAR = 1
  .const SIZEOF_INT = 2
  .const SIZEOF_NUMBER = -1
  .label SCREEN = $400
.segment Code
  // main
main: {
    // SCREEN[idx++] = '0'+sizeof 0
    // [0] *SCREEN = '0'+SIZEOF_NUMBER -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_NUMBER
    sta SCREEN
    // SCREEN[idx++] = '0'+sizeof b
    // [1] *(SCREEN+1) = '0'+SIZEOF_CHAR -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_CHAR
    sta SCREEN+1
    // SCREEN[idx++] = '0'+sizeof w
    // [2] *(SCREEN+2) = '0'+SIZEOF_INT -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_INT
    sta SCREEN+2
    // SCREEN[idx++] = '0'+sizeof (char)
    // [3] *(SCREEN+3) = '0'+SIZEOF_CHAR -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_CHAR
    sta SCREEN+3
    // SCREEN[idx++] = '0'+sizeof (int)
    // [4] *(SCREEN+4) = '0'+SIZEOF_INT -- _deref_pbuc1=vbuc2 
    lda #'0'+SIZEOF_INT
    sta SCREEN+4
    // main::@return
    // }
    // [5] return 
    rts
}
  // File Data

