# Function 4 Double Link with stem. Sorts the two points that make up the Double Link by their coordinate, measures which point is closer to the grid and rounds it to the grid. Moves the other point so that its distance from the first point equals the CVT stem. Arguments on stack: _point1, cvt_stem, point2_

Assembly |  | Stack
--- | --- | ---
PUSHW[ ] | 1 value pushed
4 | function index
FDEF[ ] | FunctionDefinition
DUP[ ] | DuplicateTopStack | point1 cvt_stem point2 point2
GC[0] | GetCoordOnPVector | point1 cvt_stem point2 coord2
PUSHB[ ] | 1 value pushed
4 |  | point1 cvt_stem point2 coord2 4
CINDEX[ ] | CopyXToTopStack | point1 cvt_stem point2 coord2
GC[0] | GetCoordOnPVector | point1 cvt_stem point2 coord2 point1
GT[ ] | GreaterThan | point1 cvt_stem point2 coord2>point1
IF[ ] | If | point1 cvt_stem point2
SWAP[ ] | SwapTopStack | point1 point2 cvt_stem
ROLL[ ] | RollTopThreeStack | point2 cvt_stem point1
EIF[ ] | EndIf | ptmax cvt_stem ptmin
DUP[ ] | DuplicateTopStack | ptmax cvt_stem ptmin ptmin
GC[0] | GetCoordOnPVector | ptmax cvt_stem ptmin coordmin
DUP[ ] | DuplicateTopStack | ptmax cvt_stem ptmin coordmin coordmin
ROUND[10] | Round | ptmax cvt_stem ptmin coordmin round(coordmin)
SUB[ ] | Subtract | ptmax cvt_stem ptmin coordmin-round(coordmin)
ABS[ ] | Absolute | ptmax cvt_stem ptmin abs(coordmin-round(coordmin))
PUSHB[ ] | 1 value pushed
4 |  | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) 4
CINDEX[ ] | CopyXToTopStack | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) ptmax
GC[0] | GetCoordOnPVector | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) coordmax
DUP[ ] | DuplicateTopStack | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) coordmax coordmax
ROUND[10] | Round | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) coordmax round(coordmax)
SUB[ ] | Subtract | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) coordmax-round(coordmax)
ABS[ ] | Absolute | ptmax cvt_stem ptmin abs(coordmin-round(coordmin)) abs(coordmax-round(coordmax))
GT[ ] | GreaterThan | ptmax cvt_stem ptmin abs(coordmin-round(coordmin))>abs(coordmax-round(coordmax))
IF[ ] | If | ptmax cvt_stem ptmin | ptmax cvt_stem ptmin
SWAP[ ] | SwapTopStack | ptmax ptmin cvt_stem | |
ROLL[ ] | RollTopThreeStack | ptmin cvt_stem ptmax | |
EIF[ ] | EndIf | ptmin cvt_stem ptmax | ptmax cvt_stem ptmin
MDAP[1] | MoveDirectAbsPt | ptmin cvt_stem | ptmax cvt_stem
MIRP[11101] | MoveIndirectRelPt | —
ENDF[ ] | EndFunctionDefinition