Inlined call call __init
Eliminating unused variable with no statement main::$0
Eliminating unused variable with no statement main::$1
Eliminating unused variable with no statement main::$2
Eliminating unused variable with no statement main::$5

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  main::xd#0 = main::x1 - main::x0
  main::yd#0 = main::y1 - main::y0
  main::x#0 = main::x0
  main::y#0 = main::y0
  main::e#0 = main::yd#0 / 2
  main::$3 = main::y#0 * $28
  main::$4 = SCREEN + main::$3
  main::cursor#0 = main::$4 + main::x#0
  to:main::@1
main::@1: scope:[main]  from main main::@2
  main::y#3 = phi( main/main::y#0, main::@2/main::y#4 )
  main::xd#1 = phi( main/main::xd#0, main::@2/main::xd#3 )
  main::yd#1 = phi( main/main::yd#0, main::@2/main::yd#2 )
  main::e#3 = phi( main/main::e#0, main::@2/main::e#5 )
  main::x#2 = phi( main/main::x#0, main::@2/main::x#3 )
  main::cursor#3 = phi( main/main::cursor#0, main::@2/main::cursor#5 )
  *main::cursor#3 = STAR
  main::$6 = main::x#2 + 1
  main::x#1 = main::$6
  main::$7 = main::cursor#3 + 1
  main::cursor#1 = main::$7
  main::$8 = main::e#3 + main::yd#1
  main::e#1 = main::$8
  main::$9 = main::xd#1 <= main::e#1
  main::$10 = ! main::$9
  if(main::$10) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1 main::@3
  main::y#4 = phi( main::@1/main::y#3, main::@3/main::y#1 )
  main::xd#3 = phi( main::@1/main::xd#1, main::@3/main::xd#2 )
  main::yd#2 = phi( main::@1/main::yd#1, main::@3/main::yd#3 )
  main::e#5 = phi( main::@1/main::e#1, main::@3/main::e#2 )
  main::cursor#5 = phi( main::@1/main::cursor#1, main::@3/main::cursor#2 )
  main::x#3 = phi( main::@1/main::x#1, main::@3/main::x#4 )
  main::$14 = main::x1 + 1
  main::$15 = main::x#3 < main::$14
  if(main::$15) goto main::@1
  to:main::@return
main::@3: scope:[main]  from main::@1
  main::yd#3 = phi( main::@1/main::yd#1 )
  main::x#4 = phi( main::@1/main::x#1 )
  main::xd#2 = phi( main::@1/main::xd#1 )
  main::e#4 = phi( main::@1/main::e#1 )
  main::cursor#4 = phi( main::@1/main::cursor#1 )
  main::y#2 = phi( main::@1/main::y#3 )
  main::$11 = main::y#2 + 1
  main::y#1 = main::$11
  main::$12 = main::cursor#4 + $28
  main::cursor#2 = main::$12
  main::$13 = main::e#4 - main::xd#2
  main::e#2 = main::$13
  to:main::@2
main::@return: scope:[main]  from main::@2
  return 
  to:@return

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

SYMBOL TABLE SSA
__constant char SCREEN[$28*$19] = (char *)$400
__constant char STAR = $51
void __start()
void main()
bool main::$10
number main::$11
char *main::$12
char main::$13
number main::$14
bool main::$15
number main::$3
char *main::$4
number main::$6
char *main::$7
char main::$8
bool main::$9
char *main::cursor
char *main::cursor#0
char *main::cursor#1
char *main::cursor#2
char *main::cursor#3
char *main::cursor#4
char *main::cursor#5
char main::e
char main::e#0
char main::e#1
char main::e#2
char main::e#3
char main::e#4
char main::e#5
char main::x
char main::x#0
char main::x#1
char main::x#2
char main::x#3
char main::x#4
__constant char main::x0 = 4
__constant char main::x1 = $27
char main::xd
char main::xd#0
char main::xd#1
char main::xd#2
char main::xd#3
char main::y
char main::y#0
char main::y#1
char main::y#2
char main::y#3
char main::y#4
__constant char main::y0 = 4
__constant char main::y1 = $18
char main::yd
char main::yd#0
char main::yd#1
char main::yd#2
char main::yd#3

Adding number conversion cast (unumber) 2 in main::e#0 = main::yd#0 / 2
Adding number conversion cast (unumber) $28 in main::$3 = main::y#0 * $28
Adding number conversion cast (unumber) main::$3 in main::$3 = main::y#0 * (unumber)$28
Adding number conversion cast (unumber) 1 in main::$6 = main::x#2 + 1
Adding number conversion cast (unumber) main::$6 in main::$6 = main::x#2 + (unumber)1
Adding number conversion cast (unumber) 1 in main::$7 = main::cursor#3 + 1
Adding number conversion cast (unumber) 1 in main::$14 = main::x1 + 1
Adding number conversion cast (unumber) main::$14 in main::$14 = main::x1 + (unumber)1
Adding number conversion cast (unumber) 1 in main::$11 = main::y#2 + 1
Adding number conversion cast (unumber) main::$11 in main::$11 = main::y#2 + (unumber)1
Adding number conversion cast (unumber) $28 in main::$12 = main::cursor#4 + $28
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast 2
Simplifying constant integer cast $28
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in main::$3 = main::y#0 * $28
Inferred type updated to char in main::$6 = main::x#2 + 1
Inferred type updated to char in main::$14 = main::x1 + 1
Inferred type updated to char in main::$11 = main::y#2 + 1
Inversing boolean not [17] main::$10 = main::xd#1 > main::e#1 from [16] main::$9 = main::xd#1 <= main::e#1
Successful SSA optimization Pass2UnaryNotSimplification
Alias main::x#1 = main::$6 main::x#4 
Alias main::cursor#1 = main::$7 main::cursor#4 
Alias main::e#1 = main::$8 main::e#4 
Alias main::y#2 = main::y#3 
Alias main::xd#1 = main::xd#2 
Alias main::yd#1 = main::yd#3 
Alias main::y#1 = main::$11 
Alias main::cursor#2 = main::$12 
Alias main::e#2 = main::$13 
Successful SSA optimization Pass2AliasElimination
Alias main::x#1 = main::x#3 
Alias main::yd#1 = main::yd#2 
Alias main::xd#1 = main::xd#3 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values main::yd#1 main::yd#0
Identical Phi Values main::xd#1 main::xd#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition main::$10 [14] if(main::xd#0>main::e#1) goto main::@2
Simple Condition main::$15 [18] if(main::x#1<main::$14) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [0] main::xd#0 = main::x1 - main::x0
Constant right-side identified [1] main::yd#0 = main::y1 - main::y0
Constant right-side identified [16] main::$14 = main::x1 + 1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::xd#0 = main::x1-main::x0
Constant main::yd#0 = main::y1-main::y0
Constant main::x#0 = main::x0
Constant main::y#0 = main::y0
Constant main::$14 = main::x1+1
Successful SSA optimization Pass2ConstantIdentification
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Constant right-side identified [0] main::e#0 = main::yd#0 / 2
Constant right-side identified [1] main::$3 = main::y#0 * $28
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::e#0 = main::yd#0/2
Constant main::$3 = main::y#0*$28
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [0] main::$4 = SCREEN + main::$3
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::$4 = SCREEN+main::$3
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [0] main::cursor#0 = main::$4 + main::x#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant main::cursor#0 = main::$4+main::x#0
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings main::x#0
Inlining constant with var siblings main::y#0
Inlining constant with var siblings main::e#0
Inlining constant with var siblings main::cursor#0
Constant inlined main::cursor#0 = SCREEN+main::y0*$28+main::x0
Constant inlined main::x#0 = main::x0
Constant inlined main::$14 = main::x1+1
Constant inlined main::$3 = main::y0*$28
Constant inlined main::y#0 = main::y0
Constant inlined main::$4 = SCREEN+main::y0*$28
Constant inlined main::e#0 = main::yd#0/2
Successful SSA optimization Pass2ConstantInlining
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) $19
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@4(between main::@2 and main::@1)
Added new block during phi lifting main::@5(between main::@1 and main::@2)
Adding NOP phi() at start of main
CALL GRAPH

Created 7 initial phi equivalence classes
Coalesced [10] main::cursor#8 = main::cursor#2
Coalesced [11] main::e#8 = main::e#2
Coalesced [12] main::y#7 = main::y#1
Coalesced [16] main::cursor#6 = main::cursor#5
Coalesced [17] main::x#5 = main::x#1
Coalesced [18] main::e#6 = main::e#5
Coalesced [19] main::y#5 = main::y#4
Coalesced [20] main::cursor#7 = main::cursor#1
Coalesced [21] main::e#7 = main::e#1
Coalesced (already) [22] main::y#6 = main::y#2
Coalesced down to 4 phi equivalence classes
Culled Empty Block label main::@4
Culled Empty Block label main::@5
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 main::@2
  [1] main::y#2 = phi( main/main::y0, main::@2/main::y#4 )
  [1] main::e#3 = phi( main/main::yd#0/2, main::@2/main::e#5 )
  [1] main::x#2 = phi( main/main::x0, main::@2/main::x#1 )
  [1] main::cursor#3 = phi( main/SCREEN+main::y0*$28+main::x0, main::@2/main::cursor#5 )
  [2] *main::cursor#3 = STAR
  [3] main::x#1 = main::x#2 + 1
  [4] main::cursor#1 = main::cursor#3 + 1
  [5] main::e#1 = main::e#3 + main::yd#0
  [6] if(main::xd#0>main::e#1) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@1
  [7] main::y#1 = main::y#2 + 1
  [8] main::cursor#2 = main::cursor#1 + $28
  [9] main::e#2 = main::e#1 - main::xd#0
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@3
  [10] main::y#4 = phi( main::@1/main::y#2, main::@3/main::y#1 )
  [10] main::e#5 = phi( main::@1/main::e#1, main::@3/main::e#2 )
  [10] main::cursor#5 = phi( main::@1/main::cursor#1, main::@3/main::cursor#2 )
  [11] if(main::x#1<main::x1+1) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@2
  [12] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char *main::cursor
char *main::cursor#1 // 8.25
char *main::cursor#2 // 11.0
char *main::cursor#3 // 11.0
char *main::cursor#5 // 16.5
char main::e
char main::e#1 // 11.0
char main::e#2 // 22.0
char main::e#3 // 5.5
char main::e#5 // 16.5
char main::x
char main::x#1 // 3.666666666666667
char main::x#2 // 11.0
char main::xd
char main::y
char main::y#1 // 7.333333333333333
char main::y#2 // 5.5
char main::y#4 // 16.5
char main::yd

Initial phi equivalence classes
[ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ]
[ main::x#2 main::x#1 ]
[ main::e#3 main::e#5 main::e#1 main::e#2 ]
[ main::y#2 main::y#4 main::y#1 ]
Complete equivalence classes
[ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ]
[ main::x#2 main::x#1 ]
[ main::e#3 main::e#5 main::e#1 main::e#2 ]
[ main::y#2 main::y#4 main::y#1 ]
Allocated zp[1]:2 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Allocated zp[2]:3 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ]
Allocated zp[1]:5 [ main::y#2 main::y#4 main::y#1 ]
Allocated zp[1]:6 [ main::x#2 main::x#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [2] *main::cursor#3 = STAR [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] (  [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] { }  ) always clobbers reg byte a reg byte y 
Removing always clobbered register reg byte a as potential for zp[1]:6 [ main::x#2 main::x#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:6 [ main::x#2 main::x#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Removing always clobbered register reg byte a as potential for zp[1]:5 [ main::y#2 main::y#4 main::y#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:5 [ main::y#2 main::y#4 main::y#1 ]
Statement [5] main::e#1 = main::e#3 + main::yd#0 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] (  [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] { }  ) always clobbers reg byte a reg byte x 
Removing always clobbered register reg byte x as potential for zp[1]:5 [ main::y#2 main::y#4 main::y#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:6 [ main::x#2 main::x#1 ]
Statement [8] main::cursor#2 = main::cursor#1 + $28 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] (  [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] { }  ) always clobbers reg byte a 
Statement [9] main::e#2 = main::e#1 - main::xd#0 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] (  [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] { }  ) always clobbers reg byte a reg byte x 
Statement [11] if(main::x#1<main::x1+1) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] (  [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] { }  ) always clobbers reg byte a 
Statement [2] *main::cursor#3 = STAR [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] (  [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [5] main::e#1 = main::e#3 + main::yd#0 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] (  [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] { }  ) always clobbers reg byte a reg byte x 
Statement [8] main::cursor#2 = main::cursor#1 + $28 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] (  [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] { }  ) always clobbers reg byte a 
Statement [9] main::e#2 = main::e#1 - main::xd#0 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] (  [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] { }  ) always clobbers reg byte a reg byte x 
Statement [11] if(main::x#1<main::x1+1) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] (  [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] { }  ) always clobbers reg byte a 
Potential registers zp[2]:3 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] : zp[2]:3 , 
Potential registers zp[1]:6 [ main::x#2 main::x#1 ] : zp[1]:6 , 
Potential registers zp[1]:2 [ main::e#3 main::e#5 main::e#1 main::e#2 ] : zp[1]:2 , reg byte x , 
Potential registers zp[1]:5 [ main::y#2 main::y#4 main::y#1 ] : zp[1]:5 , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 55: zp[1]:2 [ main::e#3 main::e#5 main::e#1 main::e#2 ] 46.75: zp[2]:3 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] 29.33: zp[1]:5 [ main::y#2 main::y#4 main::y#1 ] 14.67: zp[1]:6 [ main::x#2 main::x#1 ] 
Uplift Scope [] 

Uplifting [main] best 1076 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp[2]:3 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp[1]:5 [ main::y#2 main::y#4 main::y#1 ] zp[1]:6 [ main::x#2 main::x#1 ] 
Uplifting [] best 1076 combination 
Attempting to uplift remaining variables inzp[1]:5 [ main::y#2 main::y#4 main::y#1 ]
Uplifting [main] best 1076 combination zp[1]:5 [ main::y#2 main::y#4 main::y#1 ] 
Attempting to uplift remaining variables inzp[1]:6 [ main::x#2 main::x#1 ]
Uplifting [main] best 1076 combination zp[1]:6 [ main::x#2 main::x#1 ] 
Allocated (was zp[2]:3) zp[2]:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ]
Allocated (was zp[1]:5) zp[1]:4 [ main::y#2 main::y#4 main::y#1 ]
Allocated (was zp[1]:6) zp[1]:5 [ main::x#2 main::x#1 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="bresenham.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 STAR = $51
  .label SCREEN = $400
.segment Code
  // main
main: {
    .const x0 = 4
    .const y0 = 4
    .const x1 = $27
    .const y1 = $18
    .const xd = x1-x0
    .const yd = y1-y0
    .label x = 5
    .label cursor = 2
    .label y = 4
    // [1] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [1] phi main::y#2 = main::y0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #y0
    sta.z y
    // [1] phi main::e#3 = main::yd#0/2 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #yd/2
    // [1] phi main::x#2 = main::x0 [phi:main->main::@1#2] -- vbuz1=vbuc1 
    lda #x0
    sta.z x
    // [1] phi main::cursor#3 = SCREEN+main::y0*$28+main::x0 [phi:main->main::@1#3] -- pbuz1=pbuc1 
    lda #<SCREEN+y0*$28+x0
    sta.z cursor
    lda #>SCREEN+y0*$28+x0
    sta.z cursor+1
    jmp __b1
    // [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [1] phi main::y#2 = main::y#4 [phi:main::@2->main::@1#0] -- register_copy 
    // [1] phi main::e#3 = main::e#5 [phi:main::@2->main::@1#1] -- register_copy 
    // [1] phi main::x#2 = main::x#1 [phi:main::@2->main::@1#2] -- register_copy 
    // [1] phi main::cursor#3 = main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [2] *main::cursor#3 = STAR -- _deref_pbuz1=vbuc1 
    lda #STAR
    ldy #0
    sta (cursor),y
    // [3] main::x#1 = main::x#2 + 1 -- vbuz1=vbuz1_plus_1 
    inc.z x
    // [4] main::cursor#1 = main::cursor#3 + 1 -- pbuz1=pbuz1_plus_1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [5] main::e#1 = main::e#3 + main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 
    txa
    axs #-[yd]
    // [6] if(main::xd#0>main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1 
    cpx #xd
    bcc __b2_from___b1
    jmp __b3
    // main::@3
  __b3:
    // [7] main::y#1 = main::y#2 + 1 -- vbuz1=vbuz1_plus_1 
    inc.z y
    // [8] main::cursor#2 = main::cursor#1 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z cursor
    sta.z cursor
    bcc !+
    inc.z cursor+1
  !:
    // [9] main::e#2 = main::e#1 - main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 
    txa
    axs #xd
    // [10] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
  __b2_from___b1:
  __b2_from___b3:
    // [10] phi main::y#4 = main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy 
    // [10] phi main::e#5 = main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy 
    // [10] phi main::cursor#5 = main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy 
    jmp __b2
    // main::@2
  __b2:
    // [11] if(main::x#1<main::x1+1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x
    cmp #x1+1
    bcc __b1_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [12] return 
    rts
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b2_from___b1 with __b2
Replacing label __b1_from___b2 with __b1
Removing instruction __b1_from___b2:
Removing instruction __b2_from___b1:
Removing instruction __b2_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __b3:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char SCREEN[$28*$19] = (char *) 1024
__constant char STAR = $51
void main()
char *main::cursor
char *main::cursor#1 // cursor zp[2]:2 8.25
char *main::cursor#2 // cursor zp[2]:2 11.0
char *main::cursor#3 // cursor zp[2]:2 11.0
char *main::cursor#5 // cursor zp[2]:2 16.5
char main::e
char main::e#1 // reg byte x 11.0
char main::e#2 // reg byte x 22.0
char main::e#3 // reg byte x 5.5
char main::e#5 // reg byte x 16.5
char main::x
char main::x#1 // x zp[1]:5 3.666666666666667
char main::x#2 // x zp[1]:5 11.0
__constant char main::x0 = 4
__constant char main::x1 = $27
char main::xd
__constant char main::xd#0 = main::x1-main::x0 // xd
char main::y
char main::y#1 // y zp[1]:4 7.333333333333333
char main::y#2 // y zp[1]:4 5.5
char main::y#4 // y zp[1]:4 16.5
__constant char main::y0 = 4
__constant char main::y1 = $18
char main::yd
__constant char main::yd#0 = main::y1-main::y0 // yd

zp[2]:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ]
zp[1]:5 [ main::x#2 main::x#1 ]
reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ]
zp[1]:4 [ main::y#2 main::y#4 main::y#1 ]


FINAL ASSEMBLER
Score: 926

  // File Comments
  // Upstart
  // Commodore 64 PRG executable file
.file [name="bresenham.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 STAR = $51
  .label SCREEN = $400
.segment Code
  // main
main: {
    .const x0 = 4
    .const y0 = 4
    .const x1 = $27
    .const y1 = $18
    .const xd = x1-x0
    .const yd = y1-y0
    .label x = 5
    .label cursor = 2
    .label y = 4
    // [1] phi from main to main::@1 [phi:main->main::@1]
    // [1] phi main::y#2 = main::y0 [phi:main->main::@1#0] -- vbuz1=vbuc1 
    lda #y0
    sta.z y
    // [1] phi main::e#3 = main::yd#0/2 [phi:main->main::@1#1] -- vbuxx=vbuc1 
    ldx #yd/2
    // [1] phi main::x#2 = main::x0 [phi:main->main::@1#2] -- vbuz1=vbuc1 
    lda #x0
    sta.z x
    // [1] phi main::cursor#3 = SCREEN+main::y0*$28+main::x0 [phi:main->main::@1#3] -- pbuz1=pbuc1 
    lda #<SCREEN+y0*$28+x0
    sta.z cursor
    lda #>SCREEN+y0*$28+x0
    sta.z cursor+1
    // [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [1] phi main::y#2 = main::y#4 [phi:main::@2->main::@1#0] -- register_copy 
    // [1] phi main::e#3 = main::e#5 [phi:main::@2->main::@1#1] -- register_copy 
    // [1] phi main::x#2 = main::x#1 [phi:main::@2->main::@1#2] -- register_copy 
    // [1] phi main::cursor#3 = main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy 
    // main::@1
  __b1:
    // *cursor = STAR
    // [2] *main::cursor#3 = STAR -- _deref_pbuz1=vbuc1 
    lda #STAR
    ldy #0
    sta (cursor),y
    // x = x + 1
    // [3] main::x#1 = main::x#2 + 1 -- vbuz1=vbuz1_plus_1 
    inc.z x
    // cursor = cursor + 1
    // [4] main::cursor#1 = main::cursor#3 + 1 -- pbuz1=pbuz1_plus_1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // e = e+yd
    // [5] main::e#1 = main::e#3 + main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 
    txa
    axs #-[yd]
    // if(xd<=e)
    // [6] if(main::xd#0>main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1 
    cpx #xd
    bcc __b2
    // main::@3
    // y = y+1
    // [7] main::y#1 = main::y#2 + 1 -- vbuz1=vbuz1_plus_1 
    inc.z y
    // cursor = cursor + 40
    // [8] main::cursor#2 = main::cursor#1 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z cursor
    sta.z cursor
    bcc !+
    inc.z cursor+1
  !:
    // e = e - xd
    // [9] main::e#2 = main::e#1 - main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 
    txa
    axs #xd
    // [10] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
    // [10] phi main::y#4 = main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy 
    // [10] phi main::e#5 = main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy 
    // [10] phi main::cursor#5 = main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy 
    // main::@2
  __b2:
    // while (x<(x1+1))
    // [11] if(main::x#1<main::x1+1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 
    lda.z x
    cmp #x1+1
    bcc __b1
    // main::@return
    // }
    // [12] return 
    rts
}
  // File Data

