
CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start
  asm { sei  }
  main::v#0 = -1
  main::i#0 = 0
  to:main::@1
main::@1: scope:[main]  from main main::@2
  main::v#3 = phi( main/main::v#0, main::@2/main::v#1 )
  main::i#2 = phi( main/main::i#0, main::@2/main::i#1 )
  main::$0 = main::i#2 < $19
  if(main::$0) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1
  main::v#2 = phi( main::@1/main::v#3 )
  main::i#3 = phi( main::@1/main::i#2 )
  main::$9 = main::i#3 * SIZEOF_STRUCT_ENTITY
  ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$9] = (signed char)main::i#3
  main::$10 = main::i#3 * SIZEOF_STRUCT_ENTITY
  ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2
  main::$11 = main::i#3 * SIZEOF_STRUCT_ENTITY
  ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$11] = main::i#3
  main::$1 = - main::v#2
  main::v#1 = main::$1
  main::i#1 = ++ main::i#3
  to:main::@1
main::@3: scope:[main]  from main::@1 main::@8
  main::$20 = 0 != 1
  if(main::$20) goto main::@4
  to:main::@return
main::@4: scope:[main]  from main::@3 main::@4
  main::$2 = *VICII_RASTER != $ff
  if(main::$2) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@4
  *VICII_BG_COLOR = 0
  main::line#0 = SCREEN
  main::i1#0 = 0
  to:main::@6
main::@6: scope:[main]  from main::@5 main::@9
  main::line#4 = phi( main::@5/main::line#0, main::@9/main::line#1 )
  main::i1#2 = phi( main::@5/main::i1#0, main::@9/main::i1#1 )
  main::$3 = main::i1#2 < $19
  if(main::$3) goto main::@7
  to:main::@8
main::@7: scope:[main]  from main::@6
  main::line#2 = phi( main::@6/main::line#4 )
  main::i1#3 = phi( main::@6/main::i1#2 )
  main::$12 = main::i1#3 * SIZEOF_STRUCT_ENTITY
  main::line#2[((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$12]] = ' '
  main::$13 = main::i1#3 * SIZEOF_STRUCT_ENTITY
  ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$13] = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$13] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$13]
  main::$14 = main::i1#3 * SIZEOF_STRUCT_ENTITY
  main::$4 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$14] < 0
  main::$15 = main::i1#3 * SIZEOF_STRUCT_ENTITY
  main::$5 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$15] > $27
  main::$6 = main::$4 || main::$5
  main::$7 = ! main::$6
  if(main::$7) goto main::@9
  to:main::@10
main::@8: scope:[main]  from main::@6
  *VICII_BG_COLOR = $f
  to:main::@3
main::@9: scope:[main]  from main::@10 main::@7
  main::line#3 = phi( main::@10/main::line#5, main::@7/main::line#2 )
  main::i1#4 = phi( main::@10/main::i1#5, main::@7/main::i1#3 )
  main::$16 = main::i1#4 * SIZEOF_STRUCT_ENTITY
  main::line#3[((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16]
  main::line#1 = main::line#3 + $28
  main::i1#1 = ++ main::i1#4
  to:main::@6
main::@10: scope:[main]  from main::@7
  main::line#5 = phi( main::@7/main::line#2 )
  main::i1#5 = phi( main::@7/main::i1#3 )
  main::$17 = main::i1#5 * SIZEOF_STRUCT_ENTITY
  main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$17]
  main::$18 = main::i1#5 * SIZEOF_STRUCT_ENTITY
  ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$18] = main::$8
  main::$19 = main::i1#5 * SIZEOF_STRUCT_ENTITY
  ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$19] = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$19] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$19]
  to:main::@9
main::@return: scope:[main]  from main::@3
  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 OFFSET_STRUCT_ENTITY_SYMBOL = 2
__constant char OFFSET_STRUCT_ENTITY_X_POS = 0
__constant char OFFSET_STRUCT_ENTITY_X_VEL = 1
__constant char * const SCREEN = (char *)$400
__constant char SIZEOF_STRUCT_ENTITY = 3
__constant char * const VICII_BG_COLOR = (char *)$d020
__constant char * const VICII_RASTER = (char *)$d012
void __start()
__constant struct Entity entities[$19] = { fill( $19, 0) }
void main()
bool main::$0
signed char main::$1
char main::$10
char main::$11
char main::$12
char main::$13
char main::$14
char main::$15
char main::$16
char main::$17
char main::$18
char main::$19
bool main::$2
bool main::$20
bool main::$3
bool main::$4
bool main::$5
bool main::$6
bool main::$7
signed char main::$8
char main::$9
char main::i
char main::i#0
char main::i#1
char main::i#2
char main::i#3
char main::i1
char main::i1#0
char main::i1#1
char main::i1#2
char main::i1#3
char main::i1#4
char main::i1#5
char *main::line
char *main::line#0
char *main::line#1
char *main::line#2
char *main::line#3
char *main::line#4
char *main::line#5
signed char main::v
signed char main::v#0
signed char main::v#1
signed char main::v#2
signed char main::v#3

Adding number conversion cast (unumber) $19 in main::$0 = main::i#2 < $19
Adding number conversion cast (unumber) $ff in main::$2 = *VICII_RASTER != $ff
Adding number conversion cast (unumber) 0 in *VICII_BG_COLOR = 0
Adding number conversion cast (unumber) $19 in main::$3 = main::i1#2 < $19
Adding number conversion cast (snumber) 0 in main::$4 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$14] < 0
Adding number conversion cast (snumber) $27 in main::$5 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$15] > $27
Adding number conversion cast (unumber) $f in *VICII_BG_COLOR = $f
Adding number conversion cast (unumber) $28 in main::line#1 = main::line#3 + $28
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *VICII_BG_COLOR = (unumber)0
Inlining cast *VICII_BG_COLOR = (unumber)$f
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 53266
Simplifying constant pointer cast (char *) 53280
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast $19
Simplifying constant integer cast $ff
Simplifying constant integer cast 0
Simplifying constant integer cast $19
Simplifying constant integer cast 0
Simplifying constant integer cast $27
Simplifying constant integer cast $f
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $19
Finalized unsigned number type (char) $ff
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $19
Finalized signed number type (signed char) 0
Finalized signed number type (signed char) $27
Finalized unsigned number type (char) $f
Finalized unsigned number type (char) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::i#2 = main::i#3 
Alias main::v#2 = main::v#3 
Alias main::v#1 = main::$1 
Alias main::i1#2 = main::i1#3 main::i1#5 
Alias main::line#2 = main::line#4 main::line#5 
Successful SSA optimization Pass2AliasElimination
Alias main::i1#2 = main::i1#4 
Alias main::line#2 = main::line#3 
Successful SSA optimization Pass2AliasElimination
Identified duplicate assignment right side [9] main::$10 = main::i#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [11] main::$11 = main::i#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [29] main::$13 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [31] main::$14 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [33] main::$15 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [47] main::$18 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Identified duplicate assignment right side [49] main::$19 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Successful SSA optimization Pass2DuplicateRValueIdentification
Simple Condition main::$0 [5] if(main::i#2<$19) goto main::@2
Simple Condition main::$20 [15] if(0!=1) goto main::@4
Simple Condition main::$2 [17] if(*VICII_RASTER!=$ff) goto main::@4
Simple Condition main::$3 [23] if(main::i1#2<$19) goto main::@7
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting ! if()-condition to reversed if() [33] main::$7 = ! main::$6
Rewriting || if()-condition to two if()s [32] main::$6 = main::$4 || main::$5
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant main::v#0 = -1
Constant main::i#0 = 0
Constant main::line#0 = SCREEN
Constant main::i1#0 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [15] if(0!=1) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero (signed char *)entities in [7] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$9] = (signed char)main::i#2
Simplifying expression containing zero (signed char *)entities in [25] main::line#2[((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$12]] = ' '
Simplifying expression containing zero (signed char *)entities in [27] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$13] = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$13] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$13]
Simplifying expression containing zero (signed char *)entities in [27] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$13] = ((signed char *)entities)[main::$13] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$13]
Simplifying expression containing zero (signed char *)entities in [29] main::$4 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$14] < 0
Simplifying expression containing zero (signed char *)entities in [31] main::$5 = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$15] > $27
Simplifying expression containing zero (signed char *)entities in [37] main::line#2[((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16]
Simplifying expression containing zero (signed char *)entities in [45] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$19] = ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$19] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$19]
Simplifying expression containing zero (signed char *)entities in [45] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_POS)[main::$19] = ((signed char *)entities)[main::$19] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$19]
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Eliminating unused constant OFFSET_STRUCT_ENTITY_X_POS
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
Alias main::$10 = main::$9 main::$11 
Alias main::$13 = main::$12 main::$14 main::$15 
Alias main::$18 = main::$17 main::$19 
Successful SSA optimization Pass2AliasElimination
Simple Condition main::$4 [18] if(((signed char *)entities)[main::$13]<0) goto main::@10
Simple Condition main::$5 [28] if(((signed char *)entities)[main::$13]>$27) goto main::@10
Successful SSA optimization Pass2ConditionalJumpSimplification
Negating conditional jump and destination [28] if(((signed char *)entities)[main::$13]<=$27) goto main::@9
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
Rewriting conditional comparison [28] if(((signed char *)entities)[main::$13]<=$27) goto main::@9
Adding number conversion cast (snumber) $27+1 in if(((signed char *)entities)[main::$13]<$27+1) goto main::@9
Adding number conversion cast (snumber) 1 in if(((signed char *)entities)[main::$13]<(snumber)$27+1) goto main::@9
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $27+(snumber)1
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized signed number type (signed char) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift and addition[3] main::$10 = main::i#2 * SIZEOF_STRUCT_ENTITY
Rewriting multiplication to use shift and addition[13] main::$13 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Rewriting multiplication to use shift and addition[18] main::$16 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Rewriting multiplication to use shift and addition[22] main::$18 = main::i1#2 * SIZEOF_STRUCT_ENTITY
Inlining constant with var siblings main::v#0
Inlining constant with var siblings main::i#0
Inlining constant with var siblings main::line#0
Inlining constant with var siblings main::i1#0
Constant inlined main::i#0 = 0
Constant inlined main::i1#0 = 0
Constant inlined main::line#0 = SCREEN
Constant inlined main::v#0 = -1
Successful SSA optimization Pass2ConstantInlining
Alias main::$10 = main::$22 
Alias main::$13 = main::$24 
Alias main::$16 = main::$26 
Alias main::$18 = main::$28 
Successful SSA optimization Pass2AliasElimination
Identified duplicate assignment right side [22] main::$25 = main::i1#2 << 1
Identified duplicate assignment right side [28] main::$27 = main::i1#2 << 1
Successful SSA optimization Pass2DuplicateRValueIdentification
Eliminating unused constant SIZEOF_STRUCT_ENTITY
Successful SSA optimization PassNEliminateUnusedVars
Alias main::$25 = main::$23 main::$27 
Successful SSA optimization Pass2AliasElimination
Identified duplicate assignment right side [21] main::$16 = main::$25 + main::i1#2
Identified duplicate assignment right side [26] main::$18 = main::$25 + main::i1#2
Successful SSA optimization Pass2DuplicateRValueIdentification
Alias main::$16 = main::$13 main::$18 
Successful SSA optimization Pass2AliasElimination
Finalized unsigned number type (char) $19
Finalized unsigned number type (char) $19
Successful SSA optimization PassNFinalizeNumberTypeConversions
Adding NOP phi() at start of main::@3
CALL GRAPH

Created 4 initial phi equivalence classes
Coalesced [21] main::i1#6 = main::i1#1
Coalesced [22] main::line#6 = main::line#1
Coalesced [30] main::i#4 = main::i#1
Coalesced [31] main::v#4 = main::v#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block label main::@3
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@7 to main::@6
Renumbering block main::@8 to main::@7
Renumbering block main::@9 to main::@8
Renumbering block main::@10 to main::@9
Renumbering block main::@11 to main::@10

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  asm { sei  }
  to:main::@1
main::@1: scope:[main]  from main main::@2
  [1] main::v#2 = phi( main/-1, main::@2/main::v#1 )
  [1] main::i#2 = phi( main/0, main::@2/main::i#1 )
  [2] if(main::i#2<$19) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@1 main::@3 main::@7
  [3] if(*VICII_RASTER!=$ff) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@3
  [4] *VICII_BG_COLOR = 0
  to:main::@5
main::@5: scope:[main]  from main::@4 main::@8
  [5] main::line#2 = phi( main::@4/SCREEN, main::@8/main::line#1 )
  [5] main::i1#2 = phi( main::@4/0, main::@8/main::i1#1 )
  [6] if(main::i1#2<$19) goto main::@6
  to:main::@7
main::@7: scope:[main]  from main::@5
  [7] *VICII_BG_COLOR = $f
  to:main::@3
main::@6: scope:[main]  from main::@5
  [8] main::$25 = main::i1#2 << 1
  [9] main::$16 = main::$25 + main::i1#2
  [10] main::line#2[((signed char *)entities)[main::$16]] = ' '
  [11] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16]
  [12] if(((signed char *)entities)[main::$16]<0) goto main::@9
  to:main::@10
main::@10: scope:[main]  from main::@6
  [13] if(((signed char *)entities)[main::$16]<$27+1) goto main::@8
  to:main::@9
main::@9: scope:[main]  from main::@10 main::@6
  [14] main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16]
  [15] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] = main::$8
  [16] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16]
  to:main::@8
main::@8: scope:[main]  from main::@10 main::@9
  [17] main::line#2[((signed char *)entities)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16]
  [18] main::line#1 = main::line#2 + $28
  [19] main::i1#1 = ++ main::i1#2
  to:main::@5
main::@2: scope:[main]  from main::@1
  [20] main::$21 = main::i#2 << 1
  [21] main::$10 = main::$21 + main::i#2
  [22] ((signed char *)entities)[main::$10] = (signed char)main::i#2
  [23] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2
  [24] ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$10] = main::i#2
  [25] main::v#1 = - main::v#2
  [26] main::i#1 = ++ main::i#2
  to:main::@1


VARIABLE REGISTER WEIGHTS
void main()
char main::$10 // 14.666666666666666
char main::$16 // 176.75
char main::$21 // 22.0
char main::$25 // 202.0
signed char main::$8 // 202.0
char main::i
char main::i#1 // 22.0
char main::i#2 // 8.25
char main::i1
char main::i1#1 // 202.0
char main::i1#2 // 38.84615384615385
char *main::line
char *main::line#1 // 101.0
char *main::line#2 // 33.666666666666664
signed char main::v
signed char main::v#1 // 11.0
signed char main::v#2 // 4.714285714285714

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::v#2 main::v#1 ]
[ main::i1#2 main::i1#1 ]
[ main::line#2 main::line#1 ]
Added variable main::$25 to live range equivalence class [ main::$25 ]
Added variable main::$16 to live range equivalence class [ main::$16 ]
Added variable main::$8 to live range equivalence class [ main::$8 ]
Added variable main::$21 to live range equivalence class [ main::$21 ]
Added variable main::$10 to live range equivalence class [ main::$10 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::v#2 main::v#1 ]
[ main::i1#2 main::i1#1 ]
[ main::line#2 main::line#1 ]
[ main::$25 ]
[ main::$16 ]
[ main::$8 ]
[ main::$21 ]
[ main::$10 ]
Allocated zp[1]:2 [ main::i1#2 main::i1#1 ]
Allocated zp[1]:3 [ main::$25 ]
Allocated zp[1]:4 [ main::$8 ]
Allocated zp[1]:5 [ main::$16 ]
Allocated zp[2]:6 [ main::line#2 main::line#1 ]
Allocated zp[1]:8 [ main::i#2 main::i#1 ]
Allocated zp[1]:9 [ main::$21 ]
Allocated zp[1]:10 [ main::v#2 main::v#1 ]
Allocated zp[1]:11 [ main::$10 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] if(*VICII_RASTER!=$ff) goto main::@3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *VICII_BG_COLOR = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *VICII_BG_COLOR = $f [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [8] main::$25 = main::i1#2 << 1 [ main::i1#2 main::line#2 main::$25 ] (  [ main::i1#2 main::line#2 main::$25 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i1#2 main::i1#1 ]
Statement [9] main::$16 = main::$25 + main::i1#2 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [10] main::line#2[((signed char *)entities)[main::$16]] = ' ' [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::i1#2 main::i1#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::$16 ]
Removing always clobbered register reg byte y as potential for zp[1]:5 [ main::$16 ]
Statement [11] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [12] if(((signed char *)entities)[main::$16]<0) goto main::@9 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [13] if(((signed char *)entities)[main::$16]<$27+1) goto main::@8 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [14] main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 main::$8 ] (  [ main::i1#2 main::line#2 main::$16 main::$8 ] { }  ) always clobbers reg byte a 
Statement [16] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [17] main::line#2[((signed char *)entities)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16] [ main::i1#2 main::line#2 ] (  [ main::i1#2 main::line#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [18] main::line#1 = main::line#2 + $28 [ main::i1#2 main::line#1 ] (  [ main::i1#2 main::line#1 ] { }  ) always clobbers reg byte a 
Statement [20] main::$21 = main::i#2 << 1 [ main::i#2 main::v#2 main::$21 ] (  [ main::i#2 main::v#2 main::$21 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:8 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:10 [ main::v#2 main::v#1 ]
Statement [21] main::$10 = main::$21 + main::i#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Statement [22] ((signed char *)entities)[main::$10] = (signed char)main::i#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:11 [ main::$10 ]
Statement [23] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Statement [24] ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$10] = main::i#2 [ main::i#2 main::v#2 ] (  [ main::i#2 main::v#2 ] { }  ) always clobbers reg byte a 
Statement [25] main::v#1 = - main::v#2 [ main::i#2 main::v#1 ] (  [ main::i#2 main::v#1 ] { }  ) always clobbers reg byte a 
Statement [3] if(*VICII_RASTER!=$ff) goto main::@3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *VICII_BG_COLOR = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *VICII_BG_COLOR = $f [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [8] main::$25 = main::i1#2 << 1 [ main::i1#2 main::line#2 main::$25 ] (  [ main::i1#2 main::line#2 main::$25 ] { }  ) always clobbers reg byte a 
Statement [9] main::$16 = main::$25 + main::i1#2 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [10] main::line#2[((signed char *)entities)[main::$16]] = ' ' [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a reg byte y 
Statement [11] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [12] if(((signed char *)entities)[main::$16]<0) goto main::@9 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [13] if(((signed char *)entities)[main::$16]<$27+1) goto main::@8 [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [14] main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 main::$8 ] (  [ main::i1#2 main::line#2 main::$16 main::$8 ] { }  ) always clobbers reg byte a 
Statement [16] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] [ main::i1#2 main::line#2 main::$16 ] (  [ main::i1#2 main::line#2 main::$16 ] { }  ) always clobbers reg byte a 
Statement [17] main::line#2[((signed char *)entities)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16] [ main::i1#2 main::line#2 ] (  [ main::i1#2 main::line#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [18] main::line#1 = main::line#2 + $28 [ main::i1#2 main::line#1 ] (  [ main::i1#2 main::line#1 ] { }  ) always clobbers reg byte a 
Statement [20] main::$21 = main::i#2 << 1 [ main::i#2 main::v#2 main::$21 ] (  [ main::i#2 main::v#2 main::$21 ] { }  ) always clobbers reg byte a 
Statement [21] main::$10 = main::$21 + main::i#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Statement [22] ((signed char *)entities)[main::$10] = (signed char)main::i#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Statement [23] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2 [ main::i#2 main::v#2 main::$10 ] (  [ main::i#2 main::v#2 main::$10 ] { }  ) always clobbers reg byte a 
Statement [24] ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$10] = main::i#2 [ main::i#2 main::v#2 ] (  [ main::i#2 main::v#2 ] { }  ) always clobbers reg byte a 
Statement [25] main::v#1 = - main::v#2 [ main::i#2 main::v#1 ] (  [ main::i#2 main::v#1 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:8 [ main::i#2 main::i#1 ] : zp[1]:8 , reg byte x , reg byte y , 
Potential registers zp[1]:10 [ main::v#2 main::v#1 ] : zp[1]:10 , reg byte x , reg byte y , 
Potential registers zp[1]:2 [ main::i1#2 main::i1#1 ] : zp[1]:2 , reg byte x , 
Potential registers zp[2]:6 [ main::line#2 main::line#1 ] : zp[2]:6 , 
Potential registers zp[1]:3 [ main::$25 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ main::$16 ] : zp[1]:5 , reg byte x , 
Potential registers zp[1]:4 [ main::$8 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:9 [ main::$21 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:11 [ main::$10 ] : zp[1]:11 , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 240.85: zp[1]:2 [ main::i1#2 main::i1#1 ] 202: zp[1]:3 [ main::$25 ] 202: zp[1]:4 [ main::$8 ] 176.75: zp[1]:5 [ main::$16 ] 134.67: zp[2]:6 [ main::line#2 main::line#1 ] 30.25: zp[1]:8 [ main::i#2 main::i#1 ] 22: zp[1]:9 [ main::$21 ] 15.71: zp[1]:10 [ main::v#2 main::v#1 ] 14.67: zp[1]:11 [ main::$10 ] 
Uplift Scope [Entity] 
Uplift Scope [] 

Uplifting [main] best 19707 combination zp[1]:2 [ main::i1#2 main::i1#1 ] reg byte a [ main::$25 ] reg byte a [ main::$8 ] reg byte x [ main::$16 ] zp[2]:6 [ main::line#2 main::line#1 ] zp[1]:8 [ main::i#2 main::i#1 ] zp[1]:9 [ main::$21 ] zp[1]:10 [ main::v#2 main::v#1 ] zp[1]:11 [ main::$10 ] 
Limited combination testing to 100 combinations of 6912 possible.
Uplifting [Entity] best 19707 combination 
Uplifting [] best 19707 combination 
Attempting to uplift remaining variables inzp[1]:2 [ main::i1#2 main::i1#1 ]
Uplifting [main] best 19707 combination zp[1]:2 [ main::i1#2 main::i1#1 ] 
Attempting to uplift remaining variables inzp[1]:8 [ main::i#2 main::i#1 ]
Uplifting [main] best 19577 combination reg byte x [ main::i#2 main::i#1 ] 
Attempting to uplift remaining variables inzp[1]:9 [ main::$21 ]
Uplifting [main] best 19557 combination reg byte a [ main::$21 ] 
Attempting to uplift remaining variables inzp[1]:10 [ main::v#2 main::v#1 ]
Uplifting [main] best 19557 combination zp[1]:10 [ main::v#2 main::v#1 ] 
Attempting to uplift remaining variables inzp[1]:11 [ main::$10 ]
Uplifting [main] best 19457 combination reg byte y [ main::$10 ] 
Allocated (was zp[2]:6) zp[2]:3 [ main::line#2 main::line#1 ]
Allocated (was zp[1]:10) zp[1]:5 [ main::v#2 main::v#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Test that the multiplication of a idx*sizeof(element) is reused inside loops
  // Upstart
  // Commodore 64 PRG executable file
.file [name="index-sizeof-reuse.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 OFFSET_STRUCT_ENTITY_X_VEL = 1
  .const OFFSET_STRUCT_ENTITY_SYMBOL = 2
  .label VICII_RASTER = $d012
  .label VICII_BG_COLOR = $d020
  .label SCREEN = $400
.segment Code
  // main
main: {
    // Initialize velocities
    .label v = 5
    // Move the entities
    .label line = 3
    .label i1 = 2
    // asm { sei  }
    sei
    // [1] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [1] phi main::v#2 = -1 [phi:main->main::@1#0] -- vbsz1=vbsc1 
    lda #-1
    sta.z v
    // [1] phi main::i#2 = 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // main::@1
  __b1:
    // [2] if(main::i#2<$19) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$19
    bcc __b2
    jmp __b3
  // Wait for raster refresh
    // main::@3
  __b3:
    // [3] if(*VICII_RASTER!=$ff) goto main::@3 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp VICII_RASTER
    bne __b3
    jmp __b4
    // main::@4
  __b4:
    // [4] *VICII_BG_COLOR = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta VICII_BG_COLOR
    // [5] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
  __b5_from___b4:
    // [5] phi main::line#2 = SCREEN [phi:main::@4->main::@5#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z line
    lda #>SCREEN
    sta.z line+1
    // [5] phi main::i1#2 = 0 [phi:main::@4->main::@5#1] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    jmp __b5
    // main::@5
  __b5:
    // [6] if(main::i1#2<$19) goto main::@6 -- vbuz1_lt_vbuc1_then_la1 
    lda.z i1
    cmp #$19
    bcc __b6
    jmp __b7
    // main::@7
  __b7:
    // [7] *VICII_BG_COLOR = $f -- _deref_pbuc1=vbuc2 
    lda #$f
    sta VICII_BG_COLOR
    jmp __b3
    // main::@6
  __b6:
    // [8] main::$25 = main::i1#2 << 1 -- vbuaa=vbuz1_rol_1 
    lda.z i1
    asl
    // [9] main::$16 = main::$25 + main::i1#2 -- vbuxx=vbuaa_plus_vbuz1 
    clc
    adc.z i1
    tax
    // [10] main::line#2[((signed char *)entities)[main::$16]] = ' ' -- pbuz1_derefidx_(pbsc1_derefidx_vbuxx)=vbuc2 
    // Delete old symbol
    lda #' '
    ldy entities,x
    sta (line),y
    // [11] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- pbsc1_derefidx_vbuxx=pbsc1_derefidx_vbuxx_plus_pbsc2_derefidx_vbuxx 
    // Move by velocity
    lda entities,x
    clc
    adc entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    sta entities,x
    // [12] if(((signed char *)entities)[main::$16]<0) goto main::@9 -- pbsc1_derefidx_vbuxx_lt_0_then_la1 
    lda entities,x
    cmp #0
    bmi __b9
    jmp __b10
    // main::@10
  __b10:
    // [13] if(((signed char *)entities)[main::$16]<$27+1) goto main::@8 -- pbsc1_derefidx_vbuxx_lt_vbsc2_then_la1 
    lda entities,x
    sec
    sbc #$27+1
    bvc !+
    eor #$80
  !:
    bmi __b8
    jmp __b9
    // main::@9
  __b9:
    // [14] main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- vbsaa=_neg_pbsc1_derefidx_vbuxx 
    lda entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    eor #$ff
    clc
    adc #1
    // [15] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] = main::$8 -- pbsc1_derefidx_vbuxx=vbsaa 
    sta entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    // [16] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- pbsc1_derefidx_vbuxx=pbsc1_derefidx_vbuxx_plus_pbsc2_derefidx_vbuxx 
    lda entities,x
    clc
    adc entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    sta entities,x
    jmp __b8
    // main::@8
  __b8:
    // [17] main::line#2[((signed char *)entities)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16] -- pbuz1_derefidx_(pbsc1_derefidx_vbuxx)=pbuc2_derefidx_vbuxx 
    // Draw symbol
    lda entities+OFFSET_STRUCT_ENTITY_SYMBOL,x
    ldy entities,x
    sta (line),y
    // [18] main::line#1 = main::line#2 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    // Next line
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // [19] main::i1#1 = ++ main::i1#2 -- vbuz1=_inc_vbuz1 
    inc.z i1
    // [5] phi from main::@8 to main::@5 [phi:main::@8->main::@5]
  __b5_from___b8:
    // [5] phi main::line#2 = main::line#1 [phi:main::@8->main::@5#0] -- register_copy 
    // [5] phi main::i1#2 = main::i1#1 [phi:main::@8->main::@5#1] -- register_copy 
    jmp __b5
    // main::@2
  __b2:
    // [20] main::$21 = main::i#2 << 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [21] main::$10 = main::$21 + main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [22] ((signed char *)entities)[main::$10] = (signed char)main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta entities,y
    // [23] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2 -- pbsc1_derefidx_vbuyy=vbsz1 
    lda.z v
    sta entities+OFFSET_STRUCT_ENTITY_X_VEL,y
    // [24] ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$10] = main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta entities+OFFSET_STRUCT_ENTITY_SYMBOL,y
    // [25] main::v#1 = - main::v#2 -- vbsz1=_neg_vbsz1 
    lda.z v
    eor #$ff
    clc
    adc #1
    sta.z v
    // [26] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [1] phi main::v#2 = main::v#1 [phi:main::@2->main::@1#0] -- register_copy 
    // [1] phi main::i#2 = main::i#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  entities: .fill 3*$19, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b5
Removing instruction jmp __b7
Removing instruction jmp __b10
Removing instruction jmp __b9
Removing instruction jmp __b8
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from_main:
Removing instruction __b4:
Removing instruction __b5_from___b4:
Removing instruction __b7:
Removing instruction __b10:
Removing instruction __b5_from___b8:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
__constant char OFFSET_STRUCT_ENTITY_SYMBOL = 2
__constant char OFFSET_STRUCT_ENTITY_X_VEL = 1
__constant char * const SCREEN = (char *) 1024
__constant char * const VICII_BG_COLOR = (char *) 53280
__constant char * const VICII_RASTER = (char *) 53266
__constant struct Entity entities[$19] = { fill( $19, 0) }
void main()
char main::$10 // reg byte y 14.666666666666666
char main::$16 // reg byte x 176.75
char main::$21 // reg byte a 22.0
char main::$25 // reg byte a 202.0
signed char main::$8 // reg byte a 202.0
char main::i
char main::i#1 // reg byte x 22.0
char main::i#2 // reg byte x 8.25
char main::i1
char main::i1#1 // i1 zp[1]:2 202.0
char main::i1#2 // i1 zp[1]:2 38.84615384615385
char *main::line
char *main::line#1 // line zp[2]:3 101.0
char *main::line#2 // line zp[2]:3 33.666666666666664
signed char main::v
signed char main::v#1 // v zp[1]:5 11.0
signed char main::v#2 // v zp[1]:5 4.714285714285714

reg byte x [ main::i#2 main::i#1 ]
zp[1]:5 [ main::v#2 main::v#1 ]
zp[1]:2 [ main::i1#2 main::i1#1 ]
zp[2]:3 [ main::line#2 main::line#1 ]
reg byte a [ main::$25 ]
reg byte x [ main::$16 ]
reg byte a [ main::$8 ]
reg byte a [ main::$21 ]
reg byte y [ main::$10 ]


FINAL ASSEMBLER
Score: 17597

  // File Comments
// Test that the multiplication of a idx*sizeof(element) is reused inside loops
  // Upstart
  // Commodore 64 PRG executable file
.file [name="index-sizeof-reuse.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 OFFSET_STRUCT_ENTITY_X_VEL = 1
  .const OFFSET_STRUCT_ENTITY_SYMBOL = 2
  .label VICII_RASTER = $d012
  .label VICII_BG_COLOR = $d020
  .label SCREEN = $400
.segment Code
  // main
main: {
    // Initialize velocities
    .label v = 5
    // Move the entities
    .label line = 3
    .label i1 = 2
    // asm
    // asm { sei  }
    sei
    // [1] phi from main to main::@1 [phi:main->main::@1]
    // [1] phi main::v#2 = -1 [phi:main->main::@1#0] -- vbsz1=vbsc1 
    lda #-1
    sta.z v
    // [1] phi main::i#2 = 0 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #0
    // main::@1
  __b1:
    // for(char i=0;i<NUM_ENTITIES;i++)
    // [2] if(main::i#2<$19) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$19
    bcc __b2
  // Wait for raster refresh
    // main::@3
  __b3:
    // while(*VICII_RASTER!=0xff)
    // [3] if(*VICII_RASTER!=$ff) goto main::@3 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp VICII_RASTER
    bne __b3
    // main::@4
    // *VICII_BG_COLOR = 0
    // [4] *VICII_BG_COLOR = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta VICII_BG_COLOR
    // [5] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
    // [5] phi main::line#2 = SCREEN [phi:main::@4->main::@5#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z line
    lda #>SCREEN
    sta.z line+1
    // [5] phi main::i1#2 = 0 [phi:main::@4->main::@5#1] -- vbuz1=vbuc1 
    lda #0
    sta.z i1
    // main::@5
  __b5:
    // for(char i=0;i<NUM_ENTITIES;i++)
    // [6] if(main::i1#2<$19) goto main::@6 -- vbuz1_lt_vbuc1_then_la1 
    lda.z i1
    cmp #$19
    bcc __b6
    // main::@7
    // *VICII_BG_COLOR = 15
    // [7] *VICII_BG_COLOR = $f -- _deref_pbuc1=vbuc2 
    lda #$f
    sta VICII_BG_COLOR
    jmp __b3
    // main::@6
  __b6:
    // line[entities[i].x_pos] = ' '
    // [8] main::$25 = main::i1#2 << 1 -- vbuaa=vbuz1_rol_1 
    lda.z i1
    asl
    // [9] main::$16 = main::$25 + main::i1#2 -- vbuxx=vbuaa_plus_vbuz1 
    clc
    adc.z i1
    tax
    // [10] main::line#2[((signed char *)entities)[main::$16]] = ' ' -- pbuz1_derefidx_(pbsc1_derefidx_vbuxx)=vbuc2 
    // Delete old symbol
    lda #' '
    ldy entities,x
    sta (line),y
    // entities[i].x_pos += entities[i].x_vel
    // [11] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- pbsc1_derefidx_vbuxx=pbsc1_derefidx_vbuxx_plus_pbsc2_derefidx_vbuxx 
    // Move by velocity
    lda entities,x
    clc
    adc entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    sta entities,x
    // if(entities[i].x_pos<0 || entities[i].x_pos>39)
    // [12] if(((signed char *)entities)[main::$16]<0) goto main::@9 -- pbsc1_derefidx_vbuxx_lt_0_then_la1 
    lda entities,x
    cmp #0
    bmi __b9
    // main::@10
    // [13] if(((signed char *)entities)[main::$16]<$27+1) goto main::@8 -- pbsc1_derefidx_vbuxx_lt_vbsc2_then_la1 
    lda entities,x
    sec
    sbc #$27+1
    bvc !+
    eor #$80
  !:
    bmi __b8
    // main::@9
  __b9:
    // -entities[i].x_vel
    // [14] main::$8 = - ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- vbsaa=_neg_pbsc1_derefidx_vbuxx 
    lda entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    eor #$ff
    clc
    adc #1
    // entities[i].x_vel = -entities[i].x_vel
    // [15] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] = main::$8 -- pbsc1_derefidx_vbuxx=vbsaa 
    sta entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    // entities[i].x_pos += entities[i].x_vel
    // [16] ((signed char *)entities)[main::$16] = ((signed char *)entities)[main::$16] + ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$16] -- pbsc1_derefidx_vbuxx=pbsc1_derefidx_vbuxx_plus_pbsc2_derefidx_vbuxx 
    lda entities,x
    clc
    adc entities+OFFSET_STRUCT_ENTITY_X_VEL,x
    sta entities,x
    // main::@8
  __b8:
    // line[entities[i].x_pos] = entities[i].symbol
    // [17] main::line#2[((signed char *)entities)[main::$16]] = ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$16] -- pbuz1_derefidx_(pbsc1_derefidx_vbuxx)=pbuc2_derefidx_vbuxx 
    // Draw symbol
    lda entities+OFFSET_STRUCT_ENTITY_SYMBOL,x
    ldy entities,x
    sta (line),y
    // line +=40
    // [18] main::line#1 = main::line#2 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    // Next line
    lda #$28
    clc
    adc.z line
    sta.z line
    bcc !+
    inc.z line+1
  !:
    // for(char i=0;i<NUM_ENTITIES;i++)
    // [19] main::i1#1 = ++ main::i1#2 -- vbuz1=_inc_vbuz1 
    inc.z i1
    // [5] phi from main::@8 to main::@5 [phi:main::@8->main::@5]
    // [5] phi main::line#2 = main::line#1 [phi:main::@8->main::@5#0] -- register_copy 
    // [5] phi main::i1#2 = main::i1#1 [phi:main::@8->main::@5#1] -- register_copy 
    jmp __b5
    // main::@2
  __b2:
    // entities[i].x_pos = (signed char)i
    // [20] main::$21 = main::i#2 << 1 -- vbuaa=vbuxx_rol_1 
    txa
    asl
    // [21] main::$10 = main::$21 + main::i#2 -- vbuyy=vbuaa_plus_vbuxx 
    stx.z $ff
    clc
    adc.z $ff
    tay
    // [22] ((signed char *)entities)[main::$10] = (signed char)main::i#2 -- pbsc1_derefidx_vbuyy=vbsxx 
    txa
    sta entities,y
    // entities[i].x_vel = v
    // [23] ((signed char *)entities+OFFSET_STRUCT_ENTITY_X_VEL)[main::$10] = main::v#2 -- pbsc1_derefidx_vbuyy=vbsz1 
    lda.z v
    sta entities+OFFSET_STRUCT_ENTITY_X_VEL,y
    // entities[i].symbol = i
    // [24] ((char *)entities+OFFSET_STRUCT_ENTITY_SYMBOL)[main::$10] = main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta entities+OFFSET_STRUCT_ENTITY_SYMBOL,y
    // v = -v
    // [25] main::v#1 = - main::v#2 -- vbsz1=_neg_vbsz1 
    lda.z v
    eor #$ff
    clc
    adc #1
    sta.z v
    // for(char i=0;i<NUM_ENTITIES;i++)
    // [26] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [1] phi main::v#2 = main::v#1 [phi:main::@2->main::@1#0] -- register_copy 
    // [1] phi main::i#2 = main::i#1 [phi:main::@2->main::@1#1] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  entities: .fill 3*$19, 0

