Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6
Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1
Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1
Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit)
Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit)
Fixing pointer array-indexing *((const word*) OBJ_WORLD_X + (byte) move_enemy::obj_slot)
Fixing pointer array-indexing *((const word*) OBJ_WORLD_X + (byte) move_enemy::obj_slot)
Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src)
Warning! Adding boolean cast to non-boolean condition *((byte*) strlen::str)
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str)
Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str)
Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str)
Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch
Identified constant variable (byte*) HEAP_TOP
Culled Empty Block (label) @1
Culled Empty Block (label) @2
Culled Empty Block (label) @3
Culled Empty Block (label) @4
Culled Empty Block (label) @5
Culled Empty Block (label) @6
Culled Empty Block (label) @7
Culled Empty Block (label) @8
Culled Empty Block (label) @9
Culled Empty Block (label) @10
Culled Empty Block (label) @11
Culled Empty Block (label) @12
Culled Empty Block (label) @13
Culled Empty Block (label) @14
Culled Empty Block (label) @15
Culled Empty Block (label) @16
Culled Empty Block (label) @17
Culled Empty Block (label) @18
Culled Empty Block (label) @19
Culled Empty Block (label) @20
Culled Empty Block (label) @21
Culled Empty Block (label) @22
Culled Empty Block (label) @23
Culled Empty Block (label) @24
Culled Empty Block (label) @25
Culled Empty Block (label) @26
Culled Empty Block (label) @27
Culled Empty Block (label) @28
Culled Empty Block (label) @29
Culled Empty Block (label) @30
Culled Empty Block (label) @31
Culled Empty Block (label) @32
Culled Empty Block (label) @33
Culled Empty Block (label) @34
Culled Empty Block (label) @35
Culled Empty Block (label) @36
Culled Empty Block (label) @37
Culled Empty Block (label) main::@2
Culled Empty Block (label) @38
Culled Empty Block (label) move_enemy::@1
Culled Empty Block (label) @39

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

(void()) main()
main: scope:[main]  from @40
  (byte) main::i#0 ← (byte) 0
  to:main::@1
main::@1: scope:[main]  from main main::@3
  (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
  (byte) move_enemy::obj_slot#0 ← (byte) main::i#2
  call move_enemy 
  (bool) move_enemy::return#0 ← (bool) move_enemy::return#2
  to:main::@3
main::@3: scope:[main]  from main::@1
  (byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
  (byte) main::i#1 ← (byte) main::i#3 + rangenext(0,5)
  (bool~) main::$1 ← (byte) main::i#1 != rangelast(0,5)
  if((bool~) main::$1) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@3
  return 
  to:@return

(bool()) move_enemy((byte) move_enemy::obj_slot)
move_enemy: scope:[move_enemy]  from main::@1
  (byte) move_enemy::obj_slot#1 ← phi( main::@1/(byte) move_enemy::obj_slot#0 )
  (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#1 * (const byte) SIZEOF_WORD
  *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (number) 1
  (bool) move_enemy::return#1 ← true
  to:move_enemy::@return
move_enemy::@return: scope:[move_enemy]  from move_enemy
  (bool) move_enemy::return#3 ← phi( move_enemy/(bool) move_enemy::return#1 )
  (bool) move_enemy::return#2 ← (bool) move_enemy::return#3
  return 
  to:@return
@40: scope:[]  from @begin
  call main 
  to:@41
@41: scope:[]  from @40
  to:@end
@end: scope:[]  from @41

SYMBOL TABLE SSA
(label) @40
(label) @41
(label) @begin
(label) @end
(const byte) MAX_OBJECTS = (byte) $10
(const word*) OBJ_WORLD_X[(const byte) MAX_OBJECTS]  = { fill( MAX_OBJECTS, 0) }
(const byte) RADIX::BINARY = (number) 2
(const byte) RADIX::DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8
(const byte) SIZEOF_WORD = (byte) 2
(void()) main()
(bool~) main::$1
(label) main::@1
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(bool()) move_enemy((byte) move_enemy::obj_slot)
(byte~) move_enemy::$0
(label) move_enemy::@return
(byte) move_enemy::obj_slot
(byte) move_enemy::obj_slot#0
(byte) move_enemy::obj_slot#1
(bool) move_enemy::return
(bool) move_enemy::return#0
(bool) move_enemy::return#1
(bool) move_enemy::return#2
(bool) move_enemy::return#3

Adding number conversion cast (unumber) 1 in *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (number) 1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::i#2 = (byte) main::i#3 
Alias (bool) move_enemy::return#1 = (bool) move_enemy::return#3 (bool) move_enemy::return#2 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) move_enemy::obj_slot#1 (byte) move_enemy::obj_slot#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [7] if((byte) main::i#1!=rangelast(0,5)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::i#0 = 0
Constant (const bool) move_enemy::return#1 = true
Successful SSA optimization Pass2ConstantIdentification
Constant (const bool) move_enemy::return#0 = move_enemy::return#1
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [5] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [7] if(main::i#1!=rangelast(0,5)) goto main::@1 to (number) 6
Eliminating unused constant (const bool) move_enemy::return#0
Successful SSA optimization PassNEliminateUnusedVars
Eliminating unused constant (const bool) move_enemy::return#1
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) 6 in if((byte) main::i#1!=(number) 6) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 6
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 6
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting multiplication to use shift [6] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 * (const byte) SIZEOF_WORD
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Eliminating unused constant (const byte) SIZEOF_WORD
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @40
Adding NOP phi() at start of @41
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to move_enemy:8 

Created 1 initial phi equivalence classes
Coalesced [12] main::i#4 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @41
Culled Empty Block (label) main::@4
Renumbering block @40 to @1
Renumbering block main::@3 to main::@2
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

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::@1
main::@1: scope:[main]  from main main::@2
  [5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
  [6] (byte) move_enemy::obj_slot#0 ← (byte) main::i#2
  [7] call move_enemy 
  to:main::@2
main::@2: scope:[main]  from main::@1
  [8] (byte) main::i#1 ← ++ (byte) main::i#2
  [9] if((byte) main::i#1!=(byte) 6) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@2
  [10] return 
  to:@return

(bool()) move_enemy((byte) move_enemy::obj_slot)
move_enemy: scope:[move_enemy]  from main::@1
  [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1
  [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1
  to:move_enemy::@return
move_enemy::@return: scope:[move_enemy]  from move_enemy
  [13] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(bool()) move_enemy((byte) move_enemy::obj_slot)
(byte~) move_enemy::$0 6.0
(byte) move_enemy::obj_slot
(byte) move_enemy::obj_slot#0 13.0
(bool) move_enemy::return

Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Added variable move_enemy::obj_slot#0 to live range equivalence class [ move_enemy::obj_slot#0 ]
Added variable move_enemy::$0 to live range equivalence class [ move_enemy::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ move_enemy::obj_slot#0 ]
[ move_enemy::$0 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ move_enemy::obj_slot#0 ]
Allocated zp[1]:4 [ move_enemy::$0 ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Adding a missing word-fragment for Travis Fisher
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const MAX_OBJECTS = $10
  // @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: {
    .label i = 2
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #0
    sta.z i
    jmp __b1
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) move_enemy::obj_slot#0 ← (byte) main::i#2 -- vbuz1=vbuz2 
    lda.z i
    sta.z move_enemy.obj_slot
    // [7] call move_enemy 
    jsr move_enemy
    jmp __b2
    // main::@2
  __b2:
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 
    inc.z i
    // [9] if((byte) main::i#1!=(byte) 6) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 
    lda #6
    cmp.z i
    bne __b1_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [10] return 
    rts
}
  // move_enemy
// move_enemy(byte zp(3) obj_slot)
move_enemy: {
    .label __0 = 4
    .label obj_slot = 3
    // [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1 -- vbuz1=vbuz2_rol_1 
    lda.z obj_slot
    asl
    sta.z __0
    // [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1 -- pwuc1_derefidx_vbuz1=pwuc1_derefidx_vbuz1_minus_1 
    ldx.z __0
    lda OBJ_WORLD_X,x
    bne !+
    dec OBJ_WORLD_X+1,x
  !:
    dec OBJ_WORLD_X,x
    jmp __breturn
    // move_enemy::@return
  __breturn:
    // [13] return 
    rts
}
  // File Data
  OBJ_WORLD_X: .fill 2*MAX_OBJECTS, 0

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1 [ move_enemy::$0 ] ( main:2::move_enemy:7 [ main::i#2 move_enemy::$0 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1 [ ] ( main:2::move_enemy:7 [ main::i#2 ] ) always clobbers reg byte a 
Statement [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1 [ move_enemy::$0 ] ( main:2::move_enemy:7 [ main::i#2 move_enemy::$0 ] ) always clobbers reg byte a 
Statement [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1 [ ] ( main:2::move_enemy:7 [ main::i#2 ] ) always clobbers reg byte a 
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ move_enemy::obj_slot#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ move_enemy::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp[1]:2 [ main::i#2 main::i#1 ] 
Uplift Scope [move_enemy] 13: zp[1]:3 [ move_enemy::obj_slot#0 ] 6: zp[1]:4 [ move_enemy::$0 ] 
Uplift Scope [RADIX] 
Uplift Scope [] 

Uplifting [main] best 354 combination reg byte y [ main::i#2 main::i#1 ] 
Uplifting [move_enemy] best 319 combination reg byte y [ move_enemy::obj_slot#0 ] reg byte a [ move_enemy::$0 ] 
Uplifting [RADIX] best 319 combination 
Uplifting [] best 319 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Adding a missing word-fragment for Travis Fisher
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .const MAX_OBJECTS = $10
  // @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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    jmp __b1
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [6] (byte) move_enemy::obj_slot#0 ← (byte) main::i#2
    // [7] call move_enemy 
    jsr move_enemy
    jmp __b2
    // main::@2
  __b2:
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [9] if((byte) main::i#1!=(byte) 6) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #6
    bne __b1_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [10] return 
    rts
}
  // move_enemy
// move_enemy(byte register(Y) obj_slot)
move_enemy: {
    // [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1 -- vbuaa=vbuyy_rol_1 
    tya
    asl
    // [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1 -- pwuc1_derefidx_vbuaa=pwuc1_derefidx_vbuaa_minus_1 
    tax
    lda OBJ_WORLD_X,x
    bne !+
    dec OBJ_WORLD_X+1,x
  !:
    dec OBJ_WORLD_X,x
    jmp __breturn
    // move_enemy::@return
  __breturn:
    // [13] return 
    rts
}
  // File Data
  OBJ_WORLD_X: .fill 2*MAX_OBJECTS, 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) MAX_OBJECTS = (byte) $10
(const word*) OBJ_WORLD_X[(const byte) MAX_OBJECTS]  = { fill( MAX_OBJECTS, 0) }
(const byte) RADIX::BINARY = (number) 2
(const byte) RADIX::DECIMAL = (number) $a
(const byte) RADIX::HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL = (number) 8
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 11.0
(bool()) move_enemy((byte) move_enemy::obj_slot)
(byte~) move_enemy::$0 reg byte a 6.0
(label) move_enemy::@return
(byte) move_enemy::obj_slot
(byte) move_enemy::obj_slot#0 reg byte y 13.0
(bool) move_enemy::return

reg byte y [ main::i#2 main::i#1 ]
reg byte y [ move_enemy::obj_slot#0 ]
reg byte a [ move_enemy::$0 ]


FINAL ASSEMBLER
Score: 184

  // File Comments
// Adding a missing word-fragment for Travis Fisher
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .const MAX_OBJECTS = $10
  // @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: {
    // [5] phi from main to main::@1 [phi:main->main::@1]
    // [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 
    ldy #0
    // [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // move_enemy(i)
    // [6] (byte) move_enemy::obj_slot#0 ← (byte) main::i#2
    // [7] call move_enemy 
    jsr move_enemy
    // main::@2
    // for(byte i:0..5)
    // [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuyy=_inc_vbuyy 
    iny
    // [9] if((byte) main::i#1!=(byte) 6) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 
    cpy #6
    bne __b1
    // main::@return
    // }
    // [10] return 
    rts
}
  // move_enemy
// move_enemy(byte register(Y) obj_slot)
move_enemy: {
    // OBJ_WORLD_X[obj_slot] -= 1
    // [11] (byte~) move_enemy::$0 ← (byte) move_enemy::obj_slot#0 << (byte) 1 -- vbuaa=vbuyy_rol_1 
    tya
    asl
    // [12] *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) ← *((const word*) OBJ_WORLD_X + (byte~) move_enemy::$0) - (byte) 1 -- pwuc1_derefidx_vbuaa=pwuc1_derefidx_vbuaa_minus_1 
    tax
    lda OBJ_WORLD_X,x
    bne !+
    dec OBJ_WORLD_X+1,x
  !:
    dec OBJ_WORLD_X,x
    // move_enemy::@return
    // }
    // [13] return 
    rts
}
  // File Data
  OBJ_WORLD_X: .fill 2*MAX_OBJECTS, 0

