             if -p <= delta {
                 for k in -p..<delta {
                     ctl.path[k + offset] = ctl.pathPosition.count
-                    let kRes = calcFootPrint(ctl: ctl, fp: fp, index: k + offset)
+                    let kRes = calcFootPrint(ctl: ctl, fp: fpBuffer, index: k + offset)
                     
-                    (fp[k + offset], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: k, y: kRes.y, r: kRes.r)
+                    (fpBuffer[k + offset], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: k, y: kRes.y, r: kRes.r)
                 }
             }
             
             if delta <= delta + p {
                 for k in stride(from: delta + p, to: delta, by: -1) {
                     ctl.path[k + offset] = ctl.pathPosition.count
-                    let kRes = calcFootPrint(ctl: ctl, fp: fp, index: k + offset)
+                    let kRes = calcFootPrint(ctl: ctl, fp: fpBuffer, index: k + offset)
                     
-                    (fp[k + offset], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: k, y: kRes.y, r: kRes.r)
+                    (fpBuffer[k + offset], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: k, y: kRes.y, r: kRes.r)
                 }
             }
             
-            ctl.path[delta + offset] = ctl.pathPosition.count
-            let deltaResult = calcFootPrint(ctl: ctl, fp: fp, index: delta + offset)
+            ctl.path[tailIdx] = ctl.pathPosition.count
+            let deltaResult = calcFootPrint(ctl: ctl, fp: fpBuffer, index: tailIdx)
             
-            (fp[delta + offset], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: delta, y: deltaResult.y, r: deltaResult.r)
+            (fpBuffer[tailIdx], ctl.pathPosition[ctl.pathPosition.count]) = snake(xAxis: xAxisPointer, yAxis: yAxisPointer, xAxisCount: xAxisCount, yAxisCount: yAxisCount, k: delta, y: deltaResult.y, r: deltaResult.r)
             
-            if fp[delta + offset] >= yAxisCount {
+            if fpBuffer[tailIdx] >= yAxisCount {
                 break
             }
             
             p += 1
         }
         
-        var r = ctl.path[delta + offset]
+        var r = ctl.path[tailIdx]
         var epc = [Int: Point]()
         while (r != -1) {
             epc[epc.count] = Point(x: ctl.pathPosition[r]!.x, y: ctl.pathPosition[r]!.y, k: -1)


private struct Ctl {
    let reverse: Bool
    var path : [Int]
    var pathPosition: [Int: Point]
}

        return editScript
    }
    
    private func calcFootPrint(ctl: Ctl, fp: UnsafeMutablePointer<Int>, index: Int) -> (r: Int, y: Int) {
        let lsP = fp[index - 1] + 1
        let rsP = fp[index + 1]
        let r = lsP > rsP ? ctl.path[index - 1] : ctl.path[index + 1]
