Culled Empty Block (label) @1
Culled Empty Block (label) euclid::@6
Culled Empty Block (label) euclid::@7
Culled Empty Block (label) euclid::@5
Culled Empty Block (label) euclid::@9
Culled Empty Block (label) euclid::@10
Culled Empty Block (label) euclid::@11

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte*) SCREEN#0 ← ((byte*)) (number) $400
  (byte) idx#0 ← (number) 0
  to:@2
main: scope:[main]  from @2
  (byte) idx#13 ← phi( @2/(byte) idx#14 )
  (byte) euclid::a#0 ← (number) $80
  (byte) euclid::b#0 ← (number) 2
  call euclid 
  (byte) euclid::return#0 ← (byte) euclid::return#5
  to:main::@1
main::@1: scope:[main]  from main
  (byte) idx#7 ← phi( main/(byte) idx#13 )
  (byte) euclid::return#6 ← phi( main/(byte) euclid::return#0 )
  (byte~) main::$0 ← (byte) euclid::return#6
  *((byte*) SCREEN#0 + (byte) idx#7) ← (byte~) main::$0
  (byte) idx#1 ← ++ (byte) idx#7
  (byte) euclid::a#1 ← (number) $a9
  (byte) euclid::b#1 ← (number) $45
  call euclid 
  (byte) euclid::return#1 ← (byte) euclid::return#5
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) idx#8 ← phi( main::@1/(byte) idx#1 )
  (byte) euclid::return#7 ← phi( main::@1/(byte) euclid::return#1 )
  (byte~) main::$1 ← (byte) euclid::return#7
  *((byte*) SCREEN#0 + (byte) idx#8) ← (byte~) main::$1
  (byte) idx#2 ← ++ (byte) idx#8
  (byte) euclid::a#2 ← (number) $ff
  (byte) euclid::b#2 ← (number) $9b
  call euclid 
  (byte) euclid::return#2 ← (byte) euclid::return#5
  to:main::@3
main::@3: scope:[main]  from main::@2
  (byte) idx#9 ← phi( main::@2/(byte) idx#2 )
  (byte) euclid::return#8 ← phi( main::@2/(byte) euclid::return#2 )
  (byte~) main::$2 ← (byte) euclid::return#8
  *((byte*) SCREEN#0 + (byte) idx#9) ← (byte~) main::$2
  (byte) idx#3 ← ++ (byte) idx#9
  (byte) euclid::a#3 ← (number) $63
  (byte) euclid::b#3 ← (number) 3
  call euclid 
  (byte) euclid::return#3 ← (byte) euclid::return#5
  to:main::@4
main::@4: scope:[main]  from main::@3
  (byte) idx#10 ← phi( main::@3/(byte) idx#3 )
  (byte) euclid::return#9 ← phi( main::@3/(byte) euclid::return#3 )
  (byte~) main::$3 ← (byte) euclid::return#9
  *((byte*) SCREEN#0 + (byte) idx#10) ← (byte~) main::$3
  (byte) idx#4 ← ++ (byte) idx#10
  to:main::@return
main::@return: scope:[main]  from main::@4
  (byte) idx#11 ← phi( main::@4/(byte) idx#4 )
  (byte) idx#5 ← (byte) idx#11
  return 
  to:@return
euclid: scope:[euclid]  from main main::@1 main::@2 main::@3
  (byte) euclid::b#9 ← phi( main/(byte) euclid::b#0 main::@1/(byte) euclid::b#1 main::@2/(byte) euclid::b#2 main::@3/(byte) euclid::b#3 )
  (byte) euclid::a#10 ← phi( main/(byte) euclid::a#0 main::@1/(byte) euclid::a#1 main::@2/(byte) euclid::a#2 main::@3/(byte) euclid::a#3 )
  to:euclid::@1
euclid::@1: scope:[euclid]  from euclid euclid::@4 euclid::@8
  (byte) euclid::b#5 ← phi( euclid/(byte) euclid::b#9 euclid::@4/(byte) euclid::b#7 euclid::@8/(byte) euclid::b#4 )
  (byte) euclid::a#5 ← phi( euclid/(byte) euclid::a#10 euclid::@4/(byte) euclid::a#4 euclid::@8/(byte) euclid::a#9 )
  (bool~) euclid::$0 ← (byte) euclid::a#5 != (byte) euclid::b#5
  if((bool~) euclid::$0) goto euclid::@2
  to:euclid::@3
euclid::@2: scope:[euclid]  from euclid::@1
  (byte) euclid::b#6 ← phi( euclid::@1/(byte) euclid::b#5 )
  (byte) euclid::a#6 ← phi( euclid::@1/(byte) euclid::a#5 )
  (bool~) euclid::$1 ← (byte) euclid::a#6 > (byte) euclid::b#6
  if((bool~) euclid::$1) goto euclid::@4
  to:euclid::@8
euclid::@3: scope:[euclid]  from euclid::@1
  (byte) euclid::a#7 ← phi( euclid::@1/(byte) euclid::a#5 )
  (byte) euclid::return#4 ← (byte) euclid::a#7
  to:euclid::@return
euclid::@4: scope:[euclid]  from euclid::@2
  (byte) euclid::b#7 ← phi( euclid::@2/(byte) euclid::b#6 )
  (byte) euclid::a#8 ← phi( euclid::@2/(byte) euclid::a#6 )
  (byte~) euclid::$3 ← (byte) euclid::a#8 - (byte) euclid::b#7
  (byte) euclid::a#4 ← (byte~) euclid::$3
  to:euclid::@1
euclid::@8: scope:[euclid]  from euclid::@2
  (byte) euclid::a#9 ← phi( euclid::@2/(byte) euclid::a#6 )
  (byte) euclid::b#8 ← phi( euclid::@2/(byte) euclid::b#6 )
  (byte~) euclid::$2 ← (byte) euclid::b#8 - (byte) euclid::a#9
  (byte) euclid::b#4 ← (byte~) euclid::$2
  to:euclid::@1
euclid::@return: scope:[euclid]  from euclid::@3
  (byte) euclid::return#10 ← phi( euclid::@3/(byte) euclid::return#4 )
  (byte) euclid::return#5 ← (byte) euclid::return#10
  return 
  to:@return
@2: scope:[]  from @begin
  (byte) idx#14 ← phi( @begin/(byte) idx#0 )
  call main 
  to:@3
@3: scope:[]  from @2
  (byte) idx#12 ← phi( @2/(byte) idx#5 )
  (byte) idx#6 ← (byte) idx#12
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(byte()) euclid((byte) euclid::a , (byte) euclid::b)
(bool~) euclid::$0
(bool~) euclid::$1
(byte~) euclid::$2
(byte~) euclid::$3
(label) euclid::@1
(label) euclid::@2
(label) euclid::@3
(label) euclid::@4
(label) euclid::@8
(label) euclid::@return
(byte) euclid::a
(byte) euclid::a#0
(byte) euclid::a#1
(byte) euclid::a#10
(byte) euclid::a#2
(byte) euclid::a#3
(byte) euclid::a#4
(byte) euclid::a#5
(byte) euclid::a#6
(byte) euclid::a#7
(byte) euclid::a#8
(byte) euclid::a#9
(byte) euclid::b
(byte) euclid::b#0
(byte) euclid::b#1
(byte) euclid::b#2
(byte) euclid::b#3
(byte) euclid::b#4
(byte) euclid::b#5
(byte) euclid::b#6
(byte) euclid::b#7
(byte) euclid::b#8
(byte) euclid::b#9
(byte) euclid::return
(byte) euclid::return#0
(byte) euclid::return#1
(byte) euclid::return#10
(byte) euclid::return#2
(byte) euclid::return#3
(byte) euclid::return#4
(byte) euclid::return#5
(byte) euclid::return#6
(byte) euclid::return#7
(byte) euclid::return#8
(byte) euclid::return#9
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#10
(byte) idx#11
(byte) idx#12
(byte) idx#13
(byte) idx#14
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx#7
(byte) idx#8
(byte) idx#9
(void()) main()
(byte~) main::$0
(byte~) main::$1
(byte~) main::$2
(byte~) main::$3
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return

Adding number conversion cast (unumber) 0 in (byte) idx#0 ← (number) 0
Adding number conversion cast (unumber) $80 in (byte) euclid::a#0 ← (number) $80
Adding number conversion cast (unumber) 2 in (byte) euclid::b#0 ← (number) 2
Adding number conversion cast (unumber) $a9 in (byte) euclid::a#1 ← (number) $a9
Adding number conversion cast (unumber) $45 in (byte) euclid::b#1 ← (number) $45
Adding number conversion cast (unumber) $ff in (byte) euclid::a#2 ← (number) $ff
Adding number conversion cast (unumber) $9b in (byte) euclid::b#2 ← (number) $9b
Adding number conversion cast (unumber) $63 in (byte) euclid::a#3 ← (number) $63
Adding number conversion cast (unumber) 3 in (byte) euclid::b#3 ← (number) 3
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
Inlining cast (byte) idx#0 ← (unumber)(number) 0
Inlining cast (byte) euclid::a#0 ← (unumber)(number) $80
Inlining cast (byte) euclid::b#0 ← (unumber)(number) 2
Inlining cast (byte) euclid::a#1 ← (unumber)(number) $a9
Inlining cast (byte) euclid::b#1 ← (unumber)(number) $45
Inlining cast (byte) euclid::a#2 ← (unumber)(number) $ff
Inlining cast (byte) euclid::b#2 ← (unumber)(number) $9b
Inlining cast (byte) euclid::a#3 ← (unumber)(number) $63
Inlining cast (byte) euclid::b#3 ← (unumber)(number) 3
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast $80
Simplifying constant integer cast 2
Simplifying constant integer cast $a9
Simplifying constant integer cast $45
Simplifying constant integer cast $ff
Simplifying constant integer cast $9b
Simplifying constant integer cast $63
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $80
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) $a9
Finalized unsigned number type (byte) $45
Finalized unsigned number type (byte) $ff
Finalized unsigned number type (byte) $9b
Finalized unsigned number type (byte) $63
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) euclid::return#0 = (byte) euclid::return#6 
Alias (byte) idx#13 = (byte) idx#7 
Alias (byte) euclid::return#1 = (byte) euclid::return#7 
Alias (byte) idx#1 = (byte) idx#8 
Alias (byte) euclid::return#2 = (byte) euclid::return#8 
Alias (byte) idx#2 = (byte) idx#9 
Alias (byte) euclid::return#3 = (byte) euclid::return#9 
Alias (byte) idx#10 = (byte) idx#3 
Alias (byte) idx#11 = (byte) idx#4 (byte) idx#5 
Alias (byte) euclid::a#5 = (byte) euclid::a#6 (byte) euclid::a#7 (byte) euclid::return#4 (byte) euclid::a#8 (byte) euclid::a#9 (byte) euclid::return#10 (byte) euclid::return#5 
Alias (byte) euclid::b#5 = (byte) euclid::b#6 (byte) euclid::b#7 (byte) euclid::b#8 
Alias (byte) euclid::a#4 = (byte~) euclid::$3 
Alias (byte) euclid::b#4 = (byte~) euclid::$2 
Alias (byte) idx#0 = (byte) idx#14 
Alias (byte) idx#12 = (byte) idx#6 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) idx#13 (byte) idx#0
Identical Phi Values (byte) idx#12 (byte) idx#11
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) euclid::$0 [41] if((byte) euclid::a#5!=(byte) euclid::b#5) goto euclid::@2
Simple Condition (bool~) euclid::$1 [44] if((byte) euclid::a#5>(byte) euclid::b#5) goto euclid::@4
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte) idx#0 = 0
Constant (const byte) euclid::a#0 = $80
Constant (const byte) euclid::b#0 = 2
Constant (const byte) euclid::a#1 = $a9
Constant (const byte) euclid::b#1 = $45
Constant (const byte) euclid::a#2 = $ff
Constant (const byte) euclid::b#2 = $9b
Constant (const byte) euclid::a#3 = $63
Constant (const byte) euclid::b#3 = 3
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero SCREEN#0 in [9] *((const byte*) SCREEN#0 + (const byte) idx#0) ← (byte~) main::$0
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte) idx#11 and assignment [19] (byte) idx#11 ← ++ (byte) idx#10
Successful SSA optimization PassNEliminateUnusedVars
Constant right-side identified [4] (byte) idx#1 ← ++ (const byte) idx#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) idx#1 = ++idx#0
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [8] (byte) idx#2 ← ++ (const byte) idx#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) idx#2 = ++idx#1
Successful SSA optimization Pass2ConstantIdentification
Constant right-side identified [12] (byte) idx#10 ← ++ (const byte) idx#2
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) idx#10 = ++idx#2
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) euclid::a#0
Inlining constant with var siblings (const byte) euclid::b#0
Inlining constant with var siblings (const byte) euclid::a#1
Inlining constant with var siblings (const byte) euclid::b#1
Inlining constant with var siblings (const byte) euclid::a#2
Inlining constant with var siblings (const byte) euclid::b#2
Inlining constant with var siblings (const byte) euclid::a#3
Inlining constant with var siblings (const byte) euclid::b#3
Inlining constant with different constant siblings (const byte) idx#0
Inlining constant with different constant siblings (const byte) idx#1
Inlining constant with different constant siblings (const byte) idx#2
Inlining constant with different constant siblings (const byte) idx#10
Constant inlined idx#10 = ++++++(byte) 0
Constant inlined euclid::b#0 = (byte) 2
Constant inlined euclid::a#1 = (byte) $a9
Constant inlined idx#2 = ++++(byte) 0
Constant inlined euclid::a#0 = (byte) $80
Constant inlined euclid::b#2 = (byte) $9b
Constant inlined euclid::a#3 = (byte) $63
Constant inlined idx#0 = (byte) 0
Constant inlined euclid::b#1 = (byte) $45
Constant inlined euclid::a#2 = (byte) $ff
Constant inlined idx#1 = ++(byte) 0
Constant inlined euclid::b#3 = (byte) 3
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN#0+++0)
Consolidated array index constant in *(SCREEN#0+++++0)
Consolidated array index constant in *(SCREEN#0+++++++0)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++0
Simplifying constant integer increment ++0
Simplifying constant integer increment ++1
Successful SSA optimization Pass2ConstantSimplification
Simplifying constant integer increment ++1
Simplifying constant integer increment ++2
Successful SSA optimization Pass2ConstantSimplification
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of euclid::@3
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to euclid:6 euclid:10 euclid:14 euclid:18 

Created 4 initial phi equivalence classes
Coalesced [24] euclid::a#11 ← euclid::a#10
Coalesced [25] euclid::b#10 ← euclid::b#9
Coalesced (already) [32] euclid::a#13 ← euclid::a#5
Coalesced [33] euclid::b#12 ← euclid::b#4
Coalesced [35] euclid::a#12 ← euclid::a#4
Coalesced (already) [36] euclid::b#11 ← euclid::b#5
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) euclid::@3
Renumbering block @2 to @1
Renumbering block euclid::@4 to euclid::@3
Renumbering block euclid::@8 to euclid::@4
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()
main: scope:[main]  from @1
  [4] phi()
  [5] call euclid 
  [6] (byte) euclid::return#0 ← (byte) euclid::a#5
  to:main::@1
main::@1: scope:[main]  from main
  [7] (byte~) main::$0 ← (byte) euclid::return#0
  [8] *((const byte*) SCREEN#0) ← (byte~) main::$0
  [9] call euclid 
  [10] (byte) euclid::return#1 ← (byte) euclid::a#5
  to:main::@2
main::@2: scope:[main]  from main::@1
  [11] (byte~) main::$1 ← (byte) euclid::return#1
  [12] *((const byte*) SCREEN#0+(byte) 1) ← (byte~) main::$1
  [13] call euclid 
  [14] (byte) euclid::return#2 ← (byte) euclid::a#5
  to:main::@3
main::@3: scope:[main]  from main::@2
  [15] (byte~) main::$2 ← (byte) euclid::return#2
  [16] *((const byte*) SCREEN#0+(byte) 2) ← (byte~) main::$2
  [17] call euclid 
  [18] (byte) euclid::return#3 ← (byte) euclid::a#5
  to:main::@4
main::@4: scope:[main]  from main::@3
  [19] (byte~) main::$3 ← (byte) euclid::return#3
  [20] *((const byte*) SCREEN#0+(byte) 3) ← (byte~) main::$3
  to:main::@return
main::@return: scope:[main]  from main::@4
  [21] return 
  to:@return
euclid: scope:[euclid]  from main main::@1 main::@2 main::@3
  [22] (byte) euclid::b#9 ← phi( main/(byte) 2 main::@1/(byte) $45 main::@2/(byte) $9b main::@3/(byte) 3 )
  [22] (byte) euclid::a#10 ← phi( main/(byte) $80 main::@1/(byte) $a9 main::@2/(byte) $ff main::@3/(byte) $63 )
  to:euclid::@1
euclid::@1: scope:[euclid]  from euclid euclid::@3 euclid::@4
  [23] (byte) euclid::b#5 ← phi( euclid/(byte) euclid::b#9 euclid::@3/(byte) euclid::b#5 euclid::@4/(byte) euclid::b#4 )
  [23] (byte) euclid::a#5 ← phi( euclid/(byte) euclid::a#10 euclid::@3/(byte) euclid::a#4 euclid::@4/(byte) euclid::a#5 )
  [24] if((byte) euclid::a#5!=(byte) euclid::b#5) goto euclid::@2
  to:euclid::@return
euclid::@return: scope:[euclid]  from euclid::@1
  [25] return 
  to:@return
euclid::@2: scope:[euclid]  from euclid::@1
  [26] if((byte) euclid::a#5>(byte) euclid::b#5) goto euclid::@3
  to:euclid::@4
euclid::@4: scope:[euclid]  from euclid::@2
  [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5
  to:euclid::@1
euclid::@3: scope:[euclid]  from euclid::@2
  [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5
  to:euclid::@1


VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(byte()) euclid((byte) euclid::a , (byte) euclid::b)
(byte) euclid::a
(byte) euclid::a#10 2.0
(byte) euclid::a#4 22.0
(byte) euclid::a#5 9.666666666666668
(byte) euclid::b
(byte) euclid::b#4 22.0
(byte) euclid::b#5 19.75
(byte) euclid::b#9 2.0
(byte) euclid::return
(byte) euclid::return#0 4.0
(byte) euclid::return#1 4.0
(byte) euclid::return#2 4.0
(byte) euclid::return#3 4.0
(byte) idx
(void()) main()
(byte~) main::$0 4.0
(byte~) main::$1 4.0
(byte~) main::$2 4.0
(byte~) main::$3 4.0

Initial phi equivalence classes
[ euclid::a#5 euclid::a#10 euclid::a#4 ]
[ euclid::b#5 euclid::b#9 euclid::b#4 ]
Added variable euclid::return#0 to zero page equivalence class [ euclid::return#0 ]
Added variable main::$0 to zero page equivalence class [ main::$0 ]
Added variable euclid::return#1 to zero page equivalence class [ euclid::return#1 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Added variable euclid::return#2 to zero page equivalence class [ euclid::return#2 ]
Added variable main::$2 to zero page equivalence class [ main::$2 ]
Added variable euclid::return#3 to zero page equivalence class [ euclid::return#3 ]
Added variable main::$3 to zero page equivalence class [ main::$3 ]
Complete equivalence classes
[ euclid::a#5 euclid::a#10 euclid::a#4 ]
[ euclid::b#5 euclid::b#9 euclid::b#4 ]
[ euclid::return#0 ]
[ main::$0 ]
[ euclid::return#1 ]
[ main::$1 ]
[ euclid::return#2 ]
[ main::$2 ]
[ euclid::return#3 ]
[ main::$3 ]
Allocated zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ]
Allocated zp ZP_BYTE:3 [ euclid::b#5 euclid::b#9 euclid::b#4 ]
Allocated zp ZP_BYTE:4 [ euclid::return#0 ]
Allocated zp ZP_BYTE:5 [ main::$0 ]
Allocated zp ZP_BYTE:6 [ euclid::return#1 ]
Allocated zp ZP_BYTE:7 [ main::$1 ]
Allocated zp ZP_BYTE:8 [ euclid::return#2 ]
Allocated zp ZP_BYTE:9 [ main::$2 ]
Allocated zp ZP_BYTE:10 [ euclid::return#3 ]
Allocated zp ZP_BYTE:11 [ main::$3 ]

INITIAL ASM
Target platform is c64basic
  // File Comments
// Demonstrates a problem where wrong alive ranges result in clobbering an alive variable
// The compiler does not realize that A is alive in the statement b=b-a - and thus can clobber it.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  // @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 _0 = 5
    .label _1 = 7
    .label _2 = 9
    .label _3 = $b
    // [5] call euclid 
    // [22] phi from main to euclid [phi:main->euclid]
  euclid_from_main:
    // [22] phi (byte) euclid::b#9 = (byte) 2 [phi:main->euclid#0] -- vbuz1=vbuc1 
    lda #2
    sta.z euclid.b
    // [22] phi (byte) euclid::a#10 = (byte) $80 [phi:main->euclid#1] -- vbuz1=vbuc1 
    lda #$80
    sta.z euclid.a
    jsr euclid
    // [6] (byte) euclid::return#0 ← (byte) euclid::a#5 -- vbuz1=vbuz2 
    lda.z euclid.a
    sta.z euclid.return
    jmp b1
    // main::@1
  b1:
    // [7] (byte~) main::$0 ← (byte) euclid::return#0 -- vbuz1=vbuz2 
    lda.z euclid.return
    sta.z _0
    // [8] *((const byte*) SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuz1 
    lda.z _0
    sta SCREEN
    // [9] call euclid 
    // [22] phi from main::@1 to euclid [phi:main::@1->euclid]
  euclid_from_b1:
    // [22] phi (byte) euclid::b#9 = (byte) $45 [phi:main::@1->euclid#0] -- vbuz1=vbuc1 
    lda #$45
    sta.z euclid.b
    // [22] phi (byte) euclid::a#10 = (byte) $a9 [phi:main::@1->euclid#1] -- vbuz1=vbuc1 
    lda #$a9
    sta.z euclid.a
    jsr euclid
    // [10] (byte) euclid::return#1 ← (byte) euclid::a#5 -- vbuz1=vbuz2 
    lda.z euclid.a
    sta.z euclid.return_1
    jmp b2
    // main::@2
  b2:
    // [11] (byte~) main::$1 ← (byte) euclid::return#1 -- vbuz1=vbuz2 
    lda.z euclid.return_1
    sta.z _1
    // [12] *((const byte*) SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1 
    lda.z _1
    sta SCREEN+1
    // [13] call euclid 
    // [22] phi from main::@2 to euclid [phi:main::@2->euclid]
  euclid_from_b2:
    // [22] phi (byte) euclid::b#9 = (byte) $9b [phi:main::@2->euclid#0] -- vbuz1=vbuc1 
    lda #$9b
    sta.z euclid.b
    // [22] phi (byte) euclid::a#10 = (byte) $ff [phi:main::@2->euclid#1] -- vbuz1=vbuc1 
    lda #$ff
    sta.z euclid.a
    jsr euclid
    // [14] (byte) euclid::return#2 ← (byte) euclid::a#5 -- vbuz1=vbuz2 
    lda.z euclid.a
    sta.z euclid.return_2
    jmp b3
    // main::@3
  b3:
    // [15] (byte~) main::$2 ← (byte) euclid::return#2 -- vbuz1=vbuz2 
    lda.z euclid.return_2
    sta.z _2
    // [16] *((const byte*) SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1 
    lda.z _2
    sta SCREEN+2
    // [17] call euclid 
    // [22] phi from main::@3 to euclid [phi:main::@3->euclid]
  euclid_from_b3:
    // [22] phi (byte) euclid::b#9 = (byte) 3 [phi:main::@3->euclid#0] -- vbuz1=vbuc1 
    lda #3
    sta.z euclid.b
    // [22] phi (byte) euclid::a#10 = (byte) $63 [phi:main::@3->euclid#1] -- vbuz1=vbuc1 
    lda #$63
    sta.z euclid.a
    jsr euclid
    // [18] (byte) euclid::return#3 ← (byte) euclid::a#5 -- vbuz1=vbuz2 
    lda.z euclid.a
    sta.z euclid.return_3
    jmp b4
    // main::@4
  b4:
    // [19] (byte~) main::$3 ← (byte) euclid::return#3 -- vbuz1=vbuz2 
    lda.z euclid.return_3
    sta.z _3
    // [20] *((const byte*) SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuz1 
    lda.z _3
    sta SCREEN+3
    jmp breturn
    // main::@return
  breturn:
    // [21] return 
    rts
}
  // euclid
// Calculate least common denominator using euclids subtraction method
// euclid(byte zeropage(2) a, byte zeropage(3) b)
euclid: {
    .label return = 4
    .label return_1 = 6
    .label return_2 = 8
    .label return_3 = $a
    .label a = 2
    .label b = 3
    // [23] phi from euclid euclid::@3 euclid::@4 to euclid::@1 [phi:euclid/euclid::@3/euclid::@4->euclid::@1]
  b1_from_euclid:
  b1_from_b3:
  b1_from_b4:
    // [23] phi (byte) euclid::b#5 = (byte) euclid::b#9 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#0] -- register_copy 
    // [23] phi (byte) euclid::a#5 = (byte) euclid::a#10 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#1] -- register_copy 
    jmp b1
    // euclid::@1
  b1:
    // [24] if((byte) euclid::a#5!=(byte) euclid::b#5) goto euclid::@2 -- vbuz1_neq_vbuz2_then_la1 
    lda.z a
    cmp.z b
    bne b2
    jmp breturn
    // euclid::@return
  breturn:
    // [25] return 
    rts
    // euclid::@2
  b2:
    // [26] if((byte) euclid::a#5>(byte) euclid::b#5) goto euclid::@3 -- vbuz1_gt_vbuz2_then_la1 
    lda.z b
    cmp.z a
    bcc b3
    jmp b4
    // euclid::@4
  b4:
    // [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5 -- vbuz1=vbuz1_minus_vbuz2 
    lda.z b
    sec
    sbc.z a
    sta.z b
    jmp b1_from_b4
    // euclid::@3
  b3:
    // [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5 -- vbuz1=vbuz1_minus_vbuz2 
    lda.z a
    sec
    sbc.z b
    sta.z a
    jmp b1_from_b3
}
  // File Data

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5 [ euclid::a#5 euclid::b#4 ] ( main:2::euclid:5 [ euclid::a#5 euclid::b#4 ] main:2::euclid:9 [ euclid::a#5 euclid::b#4 ] main:2::euclid:13 [ euclid::a#5 euclid::b#4 ] main:2::euclid:17 [ euclid::a#5 euclid::b#4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ]
Statement [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5 [ euclid::b#5 euclid::a#4 ] ( main:2::euclid:5 [ euclid::b#5 euclid::a#4 ] main:2::euclid:9 [ euclid::b#5 euclid::a#4 ] main:2::euclid:13 [ euclid::b#5 euclid::a#4 ] main:2::euclid:17 [ euclid::b#5 euclid::a#4 ] ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ euclid::b#5 euclid::b#9 euclid::b#4 ]
Statement [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5 [ euclid::a#5 euclid::b#4 ] ( main:2::euclid:5 [ euclid::a#5 euclid::b#4 ] main:2::euclid:9 [ euclid::a#5 euclid::b#4 ] main:2::euclid:13 [ euclid::a#5 euclid::b#4 ] main:2::euclid:17 [ euclid::a#5 euclid::b#4 ] ) always clobbers reg byte a 
Statement [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5 [ euclid::b#5 euclid::a#4 ] ( main:2::euclid:5 [ euclid::b#5 euclid::a#4 ] main:2::euclid:9 [ euclid::b#5 euclid::a#4 ] main:2::euclid:13 [ euclid::b#5 euclid::a#4 ] main:2::euclid:17 [ euclid::b#5 euclid::a#4 ] ) always clobbers reg byte a 
Potential registers zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:3 [ euclid::b#5 euclid::b#9 euclid::b#4 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:4 [ euclid::return#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:5 [ main::$0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:6 [ euclid::return#1 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:7 [ main::$1 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:8 [ euclid::return#2 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:9 [ main::$2 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:10 [ euclid::return#3 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , 
Potential registers zp ZP_BYTE:11 [ main::$3 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [euclid] 43.75: zp ZP_BYTE:3 [ euclid::b#5 euclid::b#9 euclid::b#4 ] 33.67: zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ] 4: zp ZP_BYTE:4 [ euclid::return#0 ] 4: zp ZP_BYTE:6 [ euclid::return#1 ] 4: zp ZP_BYTE:8 [ euclid::return#2 ] 4: zp ZP_BYTE:10 [ euclid::return#3 ] 
Uplift Scope [main] 4: zp ZP_BYTE:5 [ main::$0 ] 4: zp ZP_BYTE:7 [ main::$1 ] 4: zp ZP_BYTE:9 [ main::$2 ] 4: zp ZP_BYTE:11 [ main::$3 ] 
Uplift Scope [] 

Uplifting [euclid] best 625 combination reg byte x [ euclid::b#5 euclid::b#9 euclid::b#4 ] zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ] reg byte a [ euclid::return#0 ] reg byte a [ euclid::return#1 ] zp ZP_BYTE:8 [ euclid::return#2 ] zp ZP_BYTE:10 [ euclid::return#3 ] 
Limited combination testing to 100 combinations of 2304 possible.
Uplifting [main] best 601 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] 
Limited combination testing to 100 combinations of 256 possible.
Uplifting [] best 601 combination 
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ]
Uplifting [euclid] best 601 combination zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ euclid::return#2 ]
Uplifting [euclid] best 595 combination reg byte a [ euclid::return#2 ] 
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ euclid::return#3 ]
Uplifting [euclid] best 589 combination reg byte a [ euclid::return#3 ] 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Demonstrates a problem where wrong alive ranges result in clobbering an alive variable
// The compiler does not realize that A is alive in the statement b=b-a - and thus can clobber it.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  // @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] call euclid 
    // [22] phi from main to euclid [phi:main->euclid]
  euclid_from_main:
    // [22] phi (byte) euclid::b#9 = (byte) 2 [phi:main->euclid#0] -- vbuxx=vbuc1 
    ldx #2
    // [22] phi (byte) euclid::a#10 = (byte) $80 [phi:main->euclid#1] -- vbuz1=vbuc1 
    lda #$80
    sta.z euclid.a
    jsr euclid
    // [6] (byte) euclid::return#0 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    jmp b1
    // main::@1
  b1:
    // [7] (byte~) main::$0 ← (byte) euclid::return#0
    // [8] *((const byte*) SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    // [9] call euclid 
    // [22] phi from main::@1 to euclid [phi:main::@1->euclid]
  euclid_from_b1:
    // [22] phi (byte) euclid::b#9 = (byte) $45 [phi:main::@1->euclid#0] -- vbuxx=vbuc1 
    ldx #$45
    // [22] phi (byte) euclid::a#10 = (byte) $a9 [phi:main::@1->euclid#1] -- vbuz1=vbuc1 
    lda #$a9
    sta.z euclid.a
    jsr euclid
    // [10] (byte) euclid::return#1 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    jmp b2
    // main::@2
  b2:
    // [11] (byte~) main::$1 ← (byte) euclid::return#1
    // [12] *((const byte*) SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    // [13] call euclid 
    // [22] phi from main::@2 to euclid [phi:main::@2->euclid]
  euclid_from_b2:
    // [22] phi (byte) euclid::b#9 = (byte) $9b [phi:main::@2->euclid#0] -- vbuxx=vbuc1 
    ldx #$9b
    // [22] phi (byte) euclid::a#10 = (byte) $ff [phi:main::@2->euclid#1] -- vbuz1=vbuc1 
    lda #$ff
    sta.z euclid.a
    jsr euclid
    // [14] (byte) euclid::return#2 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    jmp b3
    // main::@3
  b3:
    // [15] (byte~) main::$2 ← (byte) euclid::return#2
    // [16] *((const byte*) SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
    // [17] call euclid 
    // [22] phi from main::@3 to euclid [phi:main::@3->euclid]
  euclid_from_b3:
    // [22] phi (byte) euclid::b#9 = (byte) 3 [phi:main::@3->euclid#0] -- vbuxx=vbuc1 
    ldx #3
    // [22] phi (byte) euclid::a#10 = (byte) $63 [phi:main::@3->euclid#1] -- vbuz1=vbuc1 
    lda #$63
    sta.z euclid.a
    jsr euclid
    // [18] (byte) euclid::return#3 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    jmp b4
    // main::@4
  b4:
    // [19] (byte~) main::$3 ← (byte) euclid::return#3
    // [20] *((const byte*) SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa 
    sta SCREEN+3
    jmp breturn
    // main::@return
  breturn:
    // [21] return 
    rts
}
  // euclid
// Calculate least common denominator using euclids subtraction method
// euclid(byte zeropage(2) a, byte register(X) b)
euclid: {
    .label a = 2
    // [23] phi from euclid euclid::@3 euclid::@4 to euclid::@1 [phi:euclid/euclid::@3/euclid::@4->euclid::@1]
  b1_from_euclid:
  b1_from_b3:
  b1_from_b4:
    // [23] phi (byte) euclid::b#5 = (byte) euclid::b#9 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#0] -- register_copy 
    // [23] phi (byte) euclid::a#5 = (byte) euclid::a#10 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#1] -- register_copy 
    jmp b1
    // euclid::@1
  b1:
    // [24] if((byte) euclid::a#5!=(byte) euclid::b#5) goto euclid::@2 -- vbuz1_neq_vbuxx_then_la1 
    cpx.z a
    bne b2
    jmp breturn
    // euclid::@return
  breturn:
    // [25] return 
    rts
    // euclid::@2
  b2:
    // [26] if((byte) euclid::a#5>(byte) euclid::b#5) goto euclid::@3 -- vbuz1_gt_vbuxx_then_la1 
    cpx.z a
    bcc b3
    jmp b4
    // euclid::@4
  b4:
    // [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5 -- vbuxx=vbuxx_minus_vbuz1 
    txa
    sec
    sbc.z a
    tax
    jmp b1_from_b4
    // euclid::@3
  b3:
    // [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5 -- vbuz1=vbuz1_minus_vbuxx 
    txa
    eor #$ff
    sec
    adc.z a
    sta.z a
    jmp b1_from_b3
}
  // File Data

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b4
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b4
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b4 with b1
Replacing label b1_from_b3 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_euclid:
Removing instruction b1_from_b3:
Removing instruction b1_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction euclid_from_main:
Removing instruction b1:
Removing instruction euclid_from_b1:
Removing instruction b2:
Removing instruction euclid_from_b2:
Removing instruction b3:
Removing instruction euclid_from_b3:
Removing instruction b4:
Removing instruction breturn:
Removing instruction breturn:
Removing instruction b4:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(byte()) euclid((byte) euclid::a , (byte) euclid::b)
(label) euclid::@1
(label) euclid::@2
(label) euclid::@3
(label) euclid::@4
(label) euclid::@return
(byte) euclid::a
(byte) euclid::a#10 a zp ZP_BYTE:2 2.0
(byte) euclid::a#4 a zp ZP_BYTE:2 22.0
(byte) euclid::a#5 a zp ZP_BYTE:2 9.666666666666668
(byte) euclid::b
(byte) euclid::b#4 reg byte x 22.0
(byte) euclid::b#5 reg byte x 19.75
(byte) euclid::b#9 reg byte x 2.0
(byte) euclid::return
(byte) euclid::return#0 reg byte a 4.0
(byte) euclid::return#1 reg byte a 4.0
(byte) euclid::return#2 reg byte a 4.0
(byte) euclid::return#3 reg byte a 4.0
(byte) idx
(void()) main()
(byte~) main::$0 reg byte a 4.0
(byte~) main::$1 reg byte a 4.0
(byte~) main::$2 reg byte a 4.0
(byte~) main::$3 reg byte a 4.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return

zp ZP_BYTE:2 [ euclid::a#5 euclid::a#10 euclid::a#4 ]
reg byte x [ euclid::b#5 euclid::b#9 euclid::b#4 ]
reg byte a [ euclid::return#0 ]
reg byte a [ main::$0 ]
reg byte a [ euclid::return#1 ]
reg byte a [ main::$1 ]
reg byte a [ euclid::return#2 ]
reg byte a [ main::$2 ]
reg byte a [ euclid::return#3 ]
reg byte a [ main::$3 ]


FINAL ASSEMBLER
Score: 472

  // File Comments
// Demonstrates a problem where wrong alive ranges result in clobbering an alive variable
// The compiler does not realize that A is alive in the statement b=b-a - and thus can clobber it.
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  // @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: {
    // euclid(128,2)
    // [5] call euclid 
    // [22] phi from main to euclid [phi:main->euclid]
    // [22] phi (byte) euclid::b#9 = (byte) 2 [phi:main->euclid#0] -- vbuxx=vbuc1 
    ldx #2
    // [22] phi (byte) euclid::a#10 = (byte) $80 [phi:main->euclid#1] -- vbuz1=vbuc1 
    lda #$80
    sta.z euclid.a
    jsr euclid
    // euclid(128,2)
    // [6] (byte) euclid::return#0 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    // main::@1
    // [7] (byte~) main::$0 ← (byte) euclid::return#0
    // SCREEN[idx++] = euclid(128,2)
    // [8] *((const byte*) SCREEN#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa 
    sta SCREEN
    // euclid(169,69)
    // [9] call euclid 
    // [22] phi from main::@1 to euclid [phi:main::@1->euclid]
    // [22] phi (byte) euclid::b#9 = (byte) $45 [phi:main::@1->euclid#0] -- vbuxx=vbuc1 
    ldx #$45
    // [22] phi (byte) euclid::a#10 = (byte) $a9 [phi:main::@1->euclid#1] -- vbuz1=vbuc1 
    lda #$a9
    sta.z euclid.a
    jsr euclid
    // euclid(169,69)
    // [10] (byte) euclid::return#1 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    // main::@2
    // [11] (byte~) main::$1 ← (byte) euclid::return#1
    // SCREEN[idx++] = euclid(169,69)
    // [12] *((const byte*) SCREEN#0+(byte) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa 
    sta SCREEN+1
    // euclid(255,155)
    // [13] call euclid 
    // [22] phi from main::@2 to euclid [phi:main::@2->euclid]
    // [22] phi (byte) euclid::b#9 = (byte) $9b [phi:main::@2->euclid#0] -- vbuxx=vbuc1 
    ldx #$9b
    // [22] phi (byte) euclid::a#10 = (byte) $ff [phi:main::@2->euclid#1] -- vbuz1=vbuc1 
    lda #$ff
    sta.z euclid.a
    jsr euclid
    // euclid(255,155)
    // [14] (byte) euclid::return#2 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    // main::@3
    // [15] (byte~) main::$2 ← (byte) euclid::return#2
    // SCREEN[idx++] = euclid(255,155)
    // [16] *((const byte*) SCREEN#0+(byte) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa 
    sta SCREEN+2
    // euclid(99,3)
    // [17] call euclid 
    // [22] phi from main::@3 to euclid [phi:main::@3->euclid]
    // [22] phi (byte) euclid::b#9 = (byte) 3 [phi:main::@3->euclid#0] -- vbuxx=vbuc1 
    ldx #3
    // [22] phi (byte) euclid::a#10 = (byte) $63 [phi:main::@3->euclid#1] -- vbuz1=vbuc1 
    lda #$63
    sta.z euclid.a
    jsr euclid
    // euclid(99,3)
    // [18] (byte) euclid::return#3 ← (byte) euclid::a#5 -- vbuaa=vbuz1 
    lda.z euclid.a
    // main::@4
    // [19] (byte~) main::$3 ← (byte) euclid::return#3
    // SCREEN[idx++] = euclid(99,3)
    // [20] *((const byte*) SCREEN#0+(byte) 3) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa 
    sta SCREEN+3
    // main::@return
    // }
    // [21] return 
    rts
}
  // euclid
// Calculate least common denominator using euclids subtraction method
// euclid(byte zeropage(2) a, byte register(X) b)
euclid: {
    .label a = 2
    // [23] phi from euclid euclid::@3 euclid::@4 to euclid::@1 [phi:euclid/euclid::@3/euclid::@4->euclid::@1]
    // [23] phi (byte) euclid::b#5 = (byte) euclid::b#9 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#0] -- register_copy 
    // [23] phi (byte) euclid::a#5 = (byte) euclid::a#10 [phi:euclid/euclid::@3/euclid::@4->euclid::@1#1] -- register_copy 
    // euclid::@1
  b1:
    // while (a!=b)
    // [24] if((byte) euclid::a#5!=(byte) euclid::b#5) goto euclid::@2 -- vbuz1_neq_vbuxx_then_la1 
    cpx.z a
    bne b2
    // euclid::@return
    // }
    // [25] return 
    rts
    // euclid::@2
  b2:
    // if(a>b)
    // [26] if((byte) euclid::a#5>(byte) euclid::b#5) goto euclid::@3 -- vbuz1_gt_vbuxx_then_la1 
    cpx.z a
    bcc b3
    // euclid::@4
    // b = b-a
    // [27] (byte) euclid::b#4 ← (byte) euclid::b#5 - (byte) euclid::a#5 -- vbuxx=vbuxx_minus_vbuz1 
    txa
    sec
    sbc.z a
    tax
    jmp b1
    // euclid::@3
  b3:
    // a = a-b
    // [28] (byte) euclid::a#4 ← (byte) euclid::a#5 - (byte) euclid::b#5 -- vbuz1=vbuz1_minus_vbuxx 
    txa
    eor #$ff
    sec
    adc.z a
    sta.z a
    jmp b1
}
  // File Data

