text: import { pipeNewLine } from "../utility/pipeNewLine.js";
  import { popEmptyHandler } from "./pop/popEmptyHandler.js";
  import { range } from "../utility/range.js";
  import { Segment } from "../enums/segment.js";
  
  export function returnHandler() {
    return pipeNewLine(
      // FRAME = LCL
      `@${Segment.LOCAL}`,
      "D=M",
      `@R14`,
      "M=D",
  
      // RET = *(FRAME-5)
      `@R14`,
      "A=M",
      "A=A-1",
      "A=A-1",
      "A=A-1",
      "A=A-1",
      "A=A-1",
      "D=M",
      `@R14`,
      "A=A+1",
      "M=D",
  
      // *ARG = pop()
      popEmptyHandler(), // <- D === 1196
      `@${Segment.ARGUMENT}`, // <-
      "A=M",
      `M=D`,
  
      // SP = ARG+
      `@${Segment.ARGUMENT}`, // <-
      "D=M",
      `@${Segment.SP}`,
      "M=D+1", // <- 311
  
      // THAT = *(FRAME-1)
      `@R14`,
      "A=M-1", // <- 316
      "D=M",
      `@${Segment.THAT}`,
      "M=D",
  
      // THIS = *(FRAME-2)
      `@R14`,
      "A=M-1",
      "A=A-1", // <- 315
      "D=M",
      `@${Segment.THIS}`,
      "M=D",
  
      // ARG = *(FRAME-3)
      `@R14`,
      "A=M-1",
      "A=A-1",
      "A=A-1", // <- 314
      "D=M",
      `@${Segment.ARGUMENT}`,
      "M=D",
  
      // LCL = *(FRAME-4)
      `@R14`,
      "A=M-1",
      "A=A-1",
      "A=A-1",
      "A=A-1", // <- 313
      "D=M",
      `@${Segment.LOCAL}`,
      "M=D",
  
      // GOTO
      `@R14`,
      "A=A+1",
      "A=M",
      "0;JMP"
    )
  }