Advertisement
Haraken

Loader.c translated

Feb 17th, 2020
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. # Loader.c translated
  2.  
  3. P(y, x) := (y*2+1) * 2**x
  4.  
  5. Z(x) := do
  6.   zeros := 0
  7.   while (x & 1) == 0
  8.     zeros += 1
  9.     x >>= 1
  10.   return zeros
  11.  
  12. L(x) := x >> (1 + Z(x))
  13.  
  14. S(v, y, c, t) := do
  15.   f := L(t)
  16.   x := 1
  17.  
  18.   if f > 2
  19.     if f > v
  20.       return t - c
  21.     elif f < v
  22.       return t
  23.     else
  24.       return y
  25.   elif f < 2
  26.     t = S(4, 13, -4, y)
  27.     return P(f, P(S(v, y, c, L(x)), S(v+2, t, c, Z(x))))
  28.   else
  29.     return A(S(v, y, c, L(x)), S(v, y, c, Z(x)))
  30.  
  31. A(y, x) := do
  32.   if L(y) != 1
  33.     return 5 << P(y, x)
  34.   else
  35.     return S(4, x, 4, 0)
  36.  
  37. D(x) := do
  38.   c := 0
  39.   t := 7
  40.   u := 14
  41.  
  42.   loop do
  43.  
  44.     if x != 0
  45.       D(x-1)
  46.    
  47.     x >>= 1
  48.     if (x & 1) == 0
  49.       break
  50.  
  51.     d = L(L(D(x)))
  52.     f = 0
  53.     x = 0
  54.    
  55.     if c == 1
  56.       if L(u) == 0 and 0 == f
  57.         x >>= 1
  58.         if (x & 1) == 0
  59.           u = S(4, d, 4, 1)
  60.           t = A(t, d)
  61.  
  62.       x >>= 1
  63.       if (f >> 1 & 1) != 0 and (x & 1) != 0
  64.         c = P(d, c)
  65.         t = S(4, 13, -4, t)
  66.         u = S(4, 13, -4, u)
  67.  
  68.     if c != 0
  69.       x >>= 1
  70.       if (x & 1) != 0
  71.         x >>= 1
  72.         if (u&2) == 0 or (x&1) != 0
  73.           u = 1 << P(L(c), u)
  74.           t = P(u, 1)
  75.         else
  76.           t = 2
  77.         c = 1
  78.  
  79.     x >>= 1
  80.     if (u >> 1) != 0 and (x & 1) != 0
  81.       c = P(t, c)
  82.       u = S(4, 13, -4, t)
  83.       t = 9
  84.  
  85.   a = P(P(t, P(u, P(x, c))), a)
  86.   return a
  87.  
  88. main() := D(D(D(D(D(99)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement