Setting struct to load/store in variable affected by address-of (struct Point*) main::ptr ← &(struct Point) main::point
Created struct value member variable (byte) print::p_x
Created struct value member variable (byte) print::p_y
Converted struct value to member variables (struct Point) print::p
Converted procedure struct value parameter to member unwinding (void()) print((byte) print::p_x , (byte) print::p_y)
Adding value bulk copy *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
Converted procedure struct value parameter to member unwinding in call (void~) main::$0 ← call print *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_X) *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y) 
Converted procedure struct value parameter to member unwinding in call (void~) main::$1 ← call print *((byte*~) main::$2) *((byte*~) main::$3) 
Replacing struct member reference (struct Point) print::p.x with member unwinding reference (byte) print::p_x
Replacing struct member reference (struct Point) print::p.y with member unwinding reference (byte) print::p_y
Identified constant variable (struct Point*) main::ptr
Culled Empty Block (label) @1

CONTROL FLOW GRAPH SSA
@begin: scope:[]  from
  (byte) idx#0 ← (byte) 0
  to:@2

(void()) main()
main: scope:[main]  from @2
  (byte) idx#14 ← phi( @2/(byte) idx#15 )
  *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  (struct Point) main::point ← struct-unwound {*(&(struct Point) main::point)}
  (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_X)
  (byte) print::p_y#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y)
  call print 
  to:main::@1
main::@1: scope:[main]  from main
  (byte) idx#8 ← phi( main/(byte) idx#6 )
  (byte) idx#1 ← (byte) idx#8
  (byte*~) main::$2 ← (byte*)(const struct Point*) main::ptr + (const byte) OFFSET_STRUCT_POINT_X
  (byte*~) main::$3 ← (byte*)(const struct Point*) main::ptr + (const byte) OFFSET_STRUCT_POINT_Y
  (byte) print::p_x#1 ← *((byte*~) main::$2)
  (byte) print::p_y#1 ← *((byte*~) main::$3)
  call print 
  to:main::@2
main::@2: scope:[main]  from main::@1
  (byte) idx#9 ← phi( main::@1/(byte) idx#6 )
  (byte) idx#2 ← (byte) idx#9
  to:main::@return
main::@return: scope:[main]  from main::@2
  (byte) idx#10 ← phi( main::@2/(byte) idx#2 )
  (byte) idx#3 ← (byte) idx#10
  return 
  to:@return

(void()) print((byte) print::p_x , (byte) print::p_y)
print: scope:[print]  from main main::@1
  (byte) print::p_y#2 ← phi( main/(byte) print::p_y#0 main::@1/(byte) print::p_y#1 )
  (byte) idx#11 ← phi( main/(byte) idx#14 main::@1/(byte) idx#1 )
  (byte) print::p_x#2 ← phi( main/(byte) print::p_x#0 main::@1/(byte) print::p_x#1 )
  *((const byte*) SCREEN + (byte) idx#11) ← (byte) print::p_x#2
  (byte) idx#4 ← ++ (byte) idx#11
  *((const byte*) SCREEN + (byte) idx#4) ← (byte) print::p_y#2
  (byte) idx#5 ← ++ (byte) idx#4
  to:print::@return
print::@return: scope:[print]  from print
  (byte) idx#12 ← phi( print/(byte) idx#5 )
  (byte) idx#6 ← (byte) idx#12
  return 
  to:@return
@2: scope:[]  from @begin
  (byte) idx#15 ← phi( @begin/(byte) idx#0 )
  call main 
  to:@3
@3: scope:[]  from @2
  (byte) idx#13 ← phi( @2/(byte) idx#3 )
  (byte) idx#7 ← (byte) idx#13
  to:@end
@end: scope:[]  from @3

SYMBOL TABLE SSA
(const struct Point) $0 = { x: (byte) 1, y: (byte) 2 }
(label) @2
(label) @3
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_X = (byte) 0
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*)(number) $400
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(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#15
(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::$2
(byte*~) main::$3
(label) main::@1
(label) main::@2
(label) main::@return
(struct Point) main::point loadstore
(const struct Point*) main::ptr = &(struct Point) main::point
(void()) print((byte) print::p_x , (byte) print::p_y)
(label) print::@return
(struct Point) print::p
(byte) print::p_x
(byte) print::p_x#0
(byte) print::p_x#1
(byte) print::p_x#2
(byte) print::p_y
(byte) print::p_y#0
(byte) print::p_y#1
(byte) print::p_y#2

Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) idx#1 = (byte) idx#8 
Alias (byte) idx#10 = (byte) idx#2 (byte) idx#9 (byte) idx#3 
Alias (byte) idx#12 = (byte) idx#5 (byte) idx#6 
Alias (byte) idx#0 = (byte) idx#15 
Alias (byte) idx#13 = (byte) idx#7 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) idx#14 (byte) idx#0
Identical Phi Values (byte) idx#1 (byte) idx#12
Identical Phi Values (byte) idx#10 (byte) idx#12
Identical Phi Values (byte) idx#13 (byte) idx#10
Successful SSA optimization Pass2IdenticalPhiElimination
Removing C-classic struct-unwound assignment [3] (struct Point) main::point ← struct-unwound {*(&(struct Point) main::point)}
Constant right-side identified [9] (byte*~) main::$2 ← (byte*)(const struct Point*) main::ptr + (const byte) OFFSET_STRUCT_POINT_X
Constant right-side identified [10] (byte*~) main::$3 ← (byte*)(const struct Point*) main::ptr + (const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) idx#0 = 0
Constant (const byte*) main::$2 = (byte*)main::ptr+OFFSET_STRUCT_POINT_X
Constant (const byte*) main::$3 = (byte*)main::ptr+OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero (byte*)main::ptr in 
Simplifying expression containing zero (byte*)&main::point in [4] (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_X)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) idx#0
Constant inlined idx#0 = (byte) 0
Constant inlined main::$2 = (byte*)(const struct Point*) main::ptr
Constant inlined main::$3 = (byte*)(const struct Point*) main::ptr+(const byte) OFFSET_STRUCT_POINT_Y
Successful SSA optimization Pass2ConstantInlining
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::@2
CALL GRAPH
Calls in [] to main:2 
Calls in [main] to print:10 print:16 

Created 3 initial phi equivalence classes
Coalesced [8] print::p_x#3 ← print::p_x#0
Coalesced [9] print::p_y#3 ← print::p_y#0
Coalesced [13] print::p_x#4 ← print::p_x#1
Coalesced [14] idx#16 ← idx#12
Coalesced [15] print::p_y#4 ← print::p_y#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@2
Renumbering block @2 to @1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end

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] *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT)
  [5] (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point)
  [6] (byte) print::p_y#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y)
  [7] call print 
  to:main::@1
main::@1: scope:[main]  from main
  [8] (byte) print::p_x#1 ← *((byte*)(const struct Point*) main::ptr)
  [9] (byte) print::p_y#1 ← *((byte*)(const struct Point*) main::ptr+(const byte) OFFSET_STRUCT_POINT_Y)
  [10] call print 
  to:main::@return
main::@return: scope:[main]  from main::@1
  [11] return 
  to:@return

(void()) print((byte) print::p_x , (byte) print::p_y)
print: scope:[print]  from main main::@1
  [12] (byte) print::p_y#2 ← phi( main/(byte) print::p_y#0 main::@1/(byte) print::p_y#1 )
  [12] (byte) idx#11 ← phi( main/(byte) 0 main::@1/(byte) idx#12 )
  [12] (byte) print::p_x#2 ← phi( main/(byte) print::p_x#0 main::@1/(byte) print::p_x#1 )
  [13] *((const byte*) SCREEN + (byte) idx#11) ← (byte) print::p_x#2
  [14] (byte) idx#4 ← ++ (byte) idx#11
  [15] *((const byte*) SCREEN + (byte) idx#4) ← (byte) print::p_y#2
  [16] (byte) idx#12 ← ++ (byte) idx#4
  to:print::@return
print::@return: scope:[print]  from print
  [17] return 
  to:@return


VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(byte) idx
(byte) idx#11 3.0
(byte) idx#12 0.8
(byte) idx#4 3.0
(void()) main()
(struct Point) main::point loadstore
(void()) print((byte) print::p_x , (byte) print::p_y)
(struct Point) print::p
(byte) print::p_x
(byte) print::p_x#0 2.0
(byte) print::p_x#1 2.0
(byte) print::p_x#2 6.0
(byte) print::p_y
(byte) print::p_y#0 4.0
(byte) print::p_y#1 4.0
(byte) print::p_y#2 2.0

Initial phi equivalence classes
[ print::p_x#2 print::p_x#0 print::p_x#1 ]
[ idx#11 idx#12 ]
[ print::p_y#2 print::p_y#0 print::p_y#1 ]
Added variable idx#4 to live range equivalence class [ idx#4 ]
Added variable main::point to live range equivalence class [ main::point ]
Complete equivalence classes
[ print::p_x#2 print::p_x#0 print::p_x#1 ]
[ idx#11 idx#12 ]
[ print::p_y#2 print::p_y#0 print::p_y#1 ]
[ idx#4 ]
[ main::point ]
Allocated zp[1]:2 [ print::p_x#2 print::p_x#0 print::p_x#1 ]
Allocated zp[1]:3 [ idx#11 idx#12 ]
Allocated zp[1]:4 [ print::p_y#2 print::p_y#0 print::p_y#1 ]
Allocated zp[1]:5 [ idx#4 ]
Allocated zp[2]:6 [ main::point ]

INITIAL ASM
Target platform is c64basic / MOS6502X
  // File Comments
// Demonstrates problem with passing struct pointer deref as parameter to call
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  .label idx = 5
  .label idx_1 = 3
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label ptr = point
    .label point = 6
    // [4] *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_POINT
  !:
    lda __0-1,y
    sta point-1,y
    dey
    bne !-
    // [5] (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point) -- vbuz1=_deref_pbuc1 
    lda.z point
    sta.z print.p_x
    // [6] (byte) print::p_y#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuz1=_deref_pbuc1 
    lda point+OFFSET_STRUCT_POINT_Y
    sta.z print.p_y
    // [7] call print 
    // [12] phi from main to print [phi:main->print]
  print_from_main:
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#0 [phi:main->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) 0 [phi:main->print#1] -- vbuz1=vbuc1 
    lda #0
    sta.z idx_1
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#0 [phi:main->print#2] -- register_copy 
    jsr print
    jmp __b1
    // main::@1
  __b1:
    // [8] (byte) print::p_x#1 ← *((byte*)(const struct Point*) main::ptr) -- vbuz1=_deref_pbuc1 
    lda.z ptr
    sta.z print.p_x
    // [9] (byte) print::p_y#1 ← *((byte*)(const struct Point*) main::ptr+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuz1=_deref_pbuc1 
    lda ptr+OFFSET_STRUCT_POINT_Y
    sta.z print.p_y
    // [10] call print 
    // [12] phi from main::@1 to print [phi:main::@1->print]
  print_from___b1:
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#1 [phi:main::@1->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) idx#12 [phi:main::@1->print#1] -- register_copy 
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#1 [phi:main::@1->print#2] -- register_copy 
    jsr print
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // print
// print(byte zp(2) p_x, byte zp(4) p_y)
print: {
    .label p_x = 2
    .label p_y = 4
    // [13] *((const byte*) SCREEN + (byte) idx#11) ← (byte) print::p_x#2 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z p_x
    ldy.z idx_1
    sta SCREEN,y
    // [14] (byte) idx#4 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz2 
    ldy.z idx_1
    iny
    sty.z idx
    // [15] *((const byte*) SCREEN + (byte) idx#4) ← (byte) print::p_y#2 -- pbuc1_derefidx_vbuz1=vbuz2 
    lda.z p_y
    ldy.z idx
    sta SCREEN,y
    // [16] (byte) idx#12 ← ++ (byte) idx#4 -- vbuz1=_inc_vbuz2 
    ldy.z idx
    iny
    sty.z idx_1
    jmp __breturn
    // print::@return
  __breturn:
    // [17] return 
    rts
}
  // File Data
  __0: .byte 1, 2

REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) [ main::point ] ( main:2 [ main::point ] ) always clobbers reg byte a reg byte y 
Potential registers zp[1]:2 [ print::p_x#2 print::p_x#0 print::p_x#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:3 [ idx#11 idx#12 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ print::p_y#2 print::p_y#0 print::p_y#1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:5 [ idx#4 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:6 [ main::point ] : zp[2]:6 , 

REGISTER UPLIFT SCOPES
Uplift Scope [print] 10: zp[1]:2 [ print::p_x#2 print::p_x#0 print::p_x#1 ] 10: zp[1]:4 [ print::p_y#2 print::p_y#0 print::p_y#1 ] 
Uplift Scope [] 3.8: zp[1]:3 [ idx#11 idx#12 ] 3: zp[1]:5 [ idx#4 ] 
Uplift Scope [Point] 
Uplift Scope [main] 0: zp[2]:6 [ main::point ] 

Uplifting [print] best 116 combination reg byte y [ print::p_x#2 print::p_x#0 print::p_x#1 ] reg byte x [ print::p_y#2 print::p_y#0 print::p_y#1 ] 
Uplifting [] best 107 combination zp[1]:3 [ idx#11 idx#12 ] reg byte y [ idx#4 ] 
Uplifting [Point] best 107 combination 
Uplifting [main] best 107 combination zp[2]:6 [ main::point ] 
Attempting to uplift remaining variables inzp[1]:3 [ idx#11 idx#12 ]
Uplifting [] best 107 combination zp[1]:3 [ idx#11 idx#12 ] 
Allocated (was zp[1]:3) zp[1]:2 [ idx#11 idx#12 ]
Allocated (was zp[2]:6) zp[2]:3 [ main::point ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Demonstrates problem with passing struct pointer deref as parameter to call
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  .label idx = 2
  // @begin
__bbegin:
  // [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
  jmp __b1
  // @1
__b1:
  // [2] call main 
  jsr main
  // [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
  jmp __bend
  // @end
__bend:
  // main
main: {
    .label ptr = point
    .label point = 3
    // [4] *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_POINT
  !:
    lda __0-1,y
    sta point-1,y
    dey
    bne !-
    // [5] (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point) -- vbuyy=_deref_pbuc1 
    ldy.z point
    // [6] (byte) print::p_y#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuxx=_deref_pbuc1 
    ldx point+OFFSET_STRUCT_POINT_Y
    // [7] call print 
    // [12] phi from main to print [phi:main->print]
  print_from_main:
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#0 [phi:main->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) 0 [phi:main->print#1] -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#0 [phi:main->print#2] -- register_copy 
    jsr print
    jmp __b1
    // main::@1
  __b1:
    // [8] (byte) print::p_x#1 ← *((byte*)(const struct Point*) main::ptr) -- vbuyy=_deref_pbuc1 
    ldy.z ptr
    // [9] (byte) print::p_y#1 ← *((byte*)(const struct Point*) main::ptr+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuxx=_deref_pbuc1 
    ldx ptr+OFFSET_STRUCT_POINT_Y
    // [10] call print 
    // [12] phi from main::@1 to print [phi:main::@1->print]
  print_from___b1:
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#1 [phi:main::@1->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) idx#12 [phi:main::@1->print#1] -- register_copy 
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#1 [phi:main::@1->print#2] -- register_copy 
    jsr print
    jmp __breturn
    // main::@return
  __breturn:
    // [11] return 
    rts
}
  // print
// print(byte register(Y) p_x, byte register(X) p_y)
print: {
    // [13] *((const byte*) SCREEN + (byte) idx#11) ← (byte) print::p_x#2 -- pbuc1_derefidx_vbuz1=vbuyy 
    tya
    ldy.z idx
    sta SCREEN,y
    // [14] (byte) idx#4 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuz1 
    ldy.z idx
    iny
    // [15] *((const byte*) SCREEN + (byte) idx#4) ← (byte) print::p_y#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta SCREEN,y
    // [16] (byte) idx#12 ← ++ (byte) idx#4 -- vbuz1=_inc_vbuyy 
    iny
    sty.z idx
    jmp __breturn
    // print::@return
  __breturn:
    // [17] return 
    rts
}
  // File Data
  __0: .byte 1, 2

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy.z idx
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction print_from_main:
Removing instruction __b1:
Removing instruction print_from___b1:
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 __b1:
Succesful ASM optimization Pass5UnusedLabelElimination

FINAL SYMBOL TABLE
(const struct Point) $0 = { x: (byte) 1, y: (byte) 2 }
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(byte) idx
(byte) idx#11 idx zp[1]:2 3.0
(byte) idx#12 idx zp[1]:2 0.8
(byte) idx#4 reg byte y 3.0
(void()) main()
(label) main::@1
(label) main::@return
(struct Point) main::point loadstore zp[2]:3
(const struct Point*) main::ptr = &(struct Point) main::point
(void()) print((byte) print::p_x , (byte) print::p_y)
(label) print::@return
(struct Point) print::p
(byte) print::p_x
(byte) print::p_x#0 reg byte y 2.0
(byte) print::p_x#1 reg byte y 2.0
(byte) print::p_x#2 reg byte y 6.0
(byte) print::p_y
(byte) print::p_y#0 reg byte x 4.0
(byte) print::p_y#1 reg byte x 4.0
(byte) print::p_y#2 reg byte x 2.0

reg byte y [ print::p_x#2 print::p_x#0 print::p_x#1 ]
zp[1]:2 [ idx#11 idx#12 ]
reg byte x [ print::p_y#2 print::p_y#0 print::p_y#1 ]
reg byte y [ idx#4 ]
zp[2]:3 [ main::point ]


FINAL ASSEMBLER
Score: 83

  // File Comments
// Demonstrates problem with passing struct pointer deref as parameter to call
  // Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
  // Global Constants & labels
  .label SCREEN = $400
  .const SIZEOF_STRUCT_POINT = 2
  .const OFFSET_STRUCT_POINT_Y = 1
  .label idx = 2
  // @begin
  // [1] phi from @begin to @1 [phi:@begin->@1]
  // @1
  // [2] call main 
  // [3] phi from @1 to @end [phi:@1->@end]
  // @end
  // main
main: {
    .label ptr = point
    .label point = 3
    // point = { 1, 2 }
    // [4] *(&(struct Point) main::point) ← memcpy(*(&(const struct Point) $0), struct Point, (const byte) SIZEOF_STRUCT_POINT) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 
    ldy #SIZEOF_STRUCT_POINT
  !:
    lda __0-1,y
    sta point-1,y
    dey
    bne !-
    // print(point)
    // [5] (byte) print::p_x#0 ← *((byte*)&(struct Point) main::point) -- vbuyy=_deref_pbuc1 
    ldy.z point
    // [6] (byte) print::p_y#0 ← *((byte*)&(struct Point) main::point+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuxx=_deref_pbuc1 
    ldx point+OFFSET_STRUCT_POINT_Y
    // [7] call print 
    // [12] phi from main to print [phi:main->print]
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#0 [phi:main->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) 0 [phi:main->print#1] -- vbuz1=vbuc1 
    lda #0
    sta.z idx
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#0 [phi:main->print#2] -- register_copy 
    jsr print
    // main::@1
    // print(*ptr)
    // [8] (byte) print::p_x#1 ← *((byte*)(const struct Point*) main::ptr) -- vbuyy=_deref_pbuc1 
    ldy.z ptr
    // [9] (byte) print::p_y#1 ← *((byte*)(const struct Point*) main::ptr+(const byte) OFFSET_STRUCT_POINT_Y) -- vbuxx=_deref_pbuc1 
    ldx ptr+OFFSET_STRUCT_POINT_Y
    // [10] call print 
    // [12] phi from main::@1 to print [phi:main::@1->print]
    // [12] phi (byte) print::p_y#2 = (byte) print::p_y#1 [phi:main::@1->print#0] -- register_copy 
    // [12] phi (byte) idx#11 = (byte) idx#12 [phi:main::@1->print#1] -- register_copy 
    // [12] phi (byte) print::p_x#2 = (byte) print::p_x#1 [phi:main::@1->print#2] -- register_copy 
    jsr print
    // main::@return
    // }
    // [11] return 
    rts
}
  // print
// print(byte register(Y) p_x, byte register(X) p_y)
print: {
    // SCREEN[idx++] = p.x
    // [13] *((const byte*) SCREEN + (byte) idx#11) ← (byte) print::p_x#2 -- pbuc1_derefidx_vbuz1=vbuyy 
    tya
    ldy.z idx
    sta SCREEN,y
    // SCREEN[idx++] = p.x;
    // [14] (byte) idx#4 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuz1 
    iny
    // SCREEN[idx++] = p.y
    // [15] *((const byte*) SCREEN + (byte) idx#4) ← (byte) print::p_y#2 -- pbuc1_derefidx_vbuyy=vbuxx 
    txa
    sta SCREEN,y
    // SCREEN[idx++] = p.y;
    // [16] (byte) idx#12 ← ++ (byte) idx#4 -- vbuz1=_inc_vbuyy 
    iny
    sty.z idx
    // print::@return
    // }
    // [17] return 
    rts
}
  // File Data
  __0: .byte 1, 2

