Skip to content

Instantly share code, notes, and snippets.

@trashhalo trashhalo/beltGet.js Secret
Created Mar 31, 2019

Embed
What would you like to do?
(function() {
var p = ["Out_of_memory", 0],
n = ["Sys_error", -1],
t = ["Failure", -2],
w = ["Invalid_argument", -3],
e = ["End_of_file", -4],
f = ["Division_by_zero", -5],
g = ["Not_found", -6],
h = ["Match_failure", -7],
i = ["Stack_overflow", -8],
j = ["Sys_blocked_io", -9],
k = ["Assert_failure", -10],
l = ["Undefined_recursive_module", -11];
(p.tag = 248),
(n.tag = 248),
(t.tag = 248),
(w.tag = 248),
(e.tag = 248),
(f.tag = 248),
(g.tag = 248),
(h.tag = 248),
(i.tag = 248),
(j.tag = 248),
(k.tag = 248),
(l.tag = 248);
function m(a, r, $) {
for (var n = new Array($), t = 0, _ = r; t < $; )
(n[t] = a[_]), (t = (t + 1) | 0), (_ = (_ + 1) | 0);
return n;
}
var b = m;
function o(r, c) {
for (;;) {
var $ = c,
t = r,
e = t.length,
a = 0 === e ? 1 : e,
n = (a - $.length) | 0;
if (0 === n) return t.apply(null, $);
if (!(n < 0))
return (function(r, c) {
return function($) {
return o(r, c.concat([$]));
};
})(t, $);
(c = b($, a, 0 | -n)), (r = t.apply(null, b($, 0, a)));
}
}
var a = [];
function q(r) {
if (void 0 === r) {
var $ = [a, 0];
return ($.tag = 256), $;
}
if (null !== r && r[0] === a) {
var o = (r[1] + 1) | 0,
t = [a, o];
return (t.tag = 256), t;
}
return r;
}
var s = q;
function r($, r, e, t, a) {
if (t <= r) {
for (var n = 0, F = (a - 1) | 0; n <= F; ++n)
e[(n + t) | 0] = $[(n + r) | 0];
return 0;
}
for (var v = (a - 1) | 0; v >= 0; --v) e[(v + t) | 0] = $[(v + r) | 0];
return 0;
}
var d = r;
function u(r, $, t, e, a, n, p, o, i) {
for (
var v = ($ + t) | 0,
E = (a + n) | 0,
Z = $,
s = r[$],
f = a,
u = e[a],
y = o;
;
) {
var c = y,
l = u,
S = f,
x = s,
U = Z;
if (i(x, l) <= 0) {
p[c] = x;
var b = (U + 1) | 0;
if (b < v) {
(y = (c + 1) | 0), (s = r[b]), (Z = b);
continue;
}
return d(e, S, p, (c + 1) | 0, (E - S) | 0);
}
p[c] = l;
var B = (S + 1) | 0;
if (!(B < E)) return d(r, U, p, (c + 1) | 0, (v - U) | 0);
(y = (c + 1) | 0), (u = e[B]), (f = B);
}
}
function v(r, $, t, e, a, n) {
for (var p = 0, o = (a - 1) | 0; p <= o; ++p) {
for (
var i = r[($ + p) | 0], v = (((e + p) | 0) - 1) | 0;
v >= e && n(t[v], i) > 0;
)
(t[(v + 1) | 0] = t[v]), (v = (v - 1) | 0);
t[(v + 1) | 0] = i;
}
return 0;
}
function c(r, $, t, e, a, n) {
if (a <= 5) return v(r, $, t, e, a, n);
var p = (a / 2) | 0,
o = (a - p) | 0;
return (
c(r, ($ + p) | 0, t, (e + p) | 0, o, n),
c(r, $, r, ($ + o) | 0, p, n),
u(r, ($ + o) | 0, p, t, (e + p) | 0, o, t, e, n)
);
}
function x($, r) {
if (!(r < 0))
for (var C = $, e = r; ; ) {
var t = e,
a = C;
if (!a) return;
if (0 === t) return s(a[0]);
(e = (t - 1) | 0), (C = a[1]);
}
}
function y($, r, C) {
return $ ? C(y($[1], r, C), $[0]) : r;
}
function z($, r, C, e) {
return $ && r ? e(z($[1], r[1], C, e), $[0], r[0]) : C;
}
var A = x;
console.log(A([1, [2, [3, 0]]], 1));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.