Advertisement
Guest User

Loader.py

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