~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to demos/raytrace.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//====================================================================================
 
2
// Auto-generated code. Original source + changes are
 
3
// sphere flake bvh raytracer (c) 2005, thierry berger-perrin <tbptbp@gmail.com>
 
4
//                            (c) 2010, azakai (Emscripten)
 
5
// this code is released under the GNU Public License.
 
6
//
 
7
// Optimized using Closure Compiler
 
8
//====================================================================================
 
9
 
 
10
function l() {
 
11
  return function() {
 
12
  }
 
13
}
 
14
function m() {
 
15
}
 
16
FUNCTION_TABLE = [];
 
17
var o = [];
 
18
function q(a, b) {
 
19
  if(!a) {
 
20
    b = "Assertion failed: " + b;
 
21
    print(b + ":\n" + Error().stack);
 
22
    throw"Assertion: " + b;
 
23
  }
 
24
}
 
25
ALLOC_NORMAL = 0;
 
26
ALLOC_STACK = 1;
 
27
ALLOC_STATIC = 2;
 
28
function r(a, b, c) {
 
29
  function d(g) {
 
30
    if(!g || g.length === undefined || typeof g === "function") {
 
31
      return[g]
 
32
    }
 
33
    return g.map(d).reduce(function(i, j) {
 
34
      return i.concat(j)
 
35
    }, [])
 
36
  }
 
37
  b = b ? b : 0;
 
38
  if(a === HEAP) {
 
39
    return b
 
40
  }
 
41
  a = d(a);
 
42
  c = [_malloc, aa, u][c ? c : ALLOC_STATIC](Math.max(a.length - b, 1));
 
43
  for(var e = 0;e < a.length - b;e++) {
 
44
    var h = a[b + e];
 
45
    if(typeof h === "number" || typeof h === "boolean") {
 
46
      IHEAP[c + e] = h;
 
47
      FHEAP[c + e] = h
 
48
    }else {
 
49
      HEAP[c + e] = h
 
50
    }
 
51
  }
 
52
  return c
 
53
}
 
54
function ba(a) {
 
55
  a = {e:IHEAP, d:a};
 
56
  for(var b = "", c = 0, d;;) {
 
57
    if(a.d + c >= a.e.length) {
 
58
      break
 
59
    }
 
60
    d = String.fromCharCode(a.e[a.d + c]);
 
61
    if(d == "\u0000") {
 
62
      break
 
63
    }
 
64
    b += d;
 
65
    c += 1
 
66
  }
 
67
  return b
 
68
}
 
69
PAGE_SIZE = 4096;
 
70
if(!this.f) {
 
71
  _malloc = u;
 
72
  _free = l()
 
73
}
 
74
__Znwm = __Znam = __Znaj = __Znwj = _malloc;
 
75
__ZdaPv = __ZdlPv = _free;
 
76
function ia() {
 
77
  HEAP = x("(null)");
 
78
  this.TOTAL_MEMORY || (TOTAL_MEMORY = 52428800);
 
79
  if(this.Int32Array) {
 
80
    IHEAP = new Int32Array(TOTAL_MEMORY);
 
81
    for(var a = 0;a < HEAP.length;a++) {
 
82
      IHEAP[a] = HEAP[a]
 
83
    }
 
84
  }else {
 
85
    IHEAP = HEAP
 
86
  }
 
87
  FHEAP = this.Float64Array ? new Float64Array(TOTAL_MEMORY) : HEAP;
 
88
  STACK_ROOT = STACKTOP = Math.ceil(10 / PAGE_SIZE) * PAGE_SIZE;
 
89
  this.TOTAL_STACK || (TOTAL_STACK = 1048576);
 
90
  STACK_MAX = STACK_ROOT + TOTAL_STACK;
 
91
  STATICTOP = Math.ceil(STACK_MAX / PAGE_SIZE) * PAGE_SIZE
 
92
}
 
93
function ja(a, b, c) {
 
94
  for(var d = 0;d < c;d++) {
 
95
    HEAP[a + d] = HEAP[b + d];
 
96
    IHEAP[a + d] = IHEAP[b + d];
 
97
    FHEAP[a + d] = FHEAP[b + d]
 
98
  }
 
99
}
 
100
_llvm_memcpy_p0i8_p0i8_i32 = _llvm_memcpy_i64 = ja;
 
101
_llvm_memset_p0i8_i32 = function(a, b, c) {
 
102
  for(var d = 0;d < c;d++) {
 
103
    HEAP[a + d] = IHEAP[a + d] = FHEAP[a + d] = b
 
104
  }
 
105
};
 
106
PRINTBUFFER = "";
 
107
function x(a) {
 
108
  for(var b = [], c = 0;c < a.length;) {
 
109
    b.push(a.charCodeAt(c));
 
110
    c += 1
 
111
  }
 
112
  b.push(0);
 
113
  return b
 
114
}
 
115
function aa(a) {
 
116
  var b = STACKTOP;
 
117
  q(a > 0);
 
118
  STACKTOP += a;
 
119
  STACKTOP = Math.ceil(STACKTOP / 4) * 4;
 
120
  q(STACKTOP < STACK_ROOT + STACK_MAX);
 
121
  return b
 
122
}
 
123
function u(a) {
 
124
  var b = STATICTOP;
 
125
  q(a > 0);
 
126
  STATICTOP += a;
 
127
  STATICTOP = Math.ceil(STATICTOP / 4) * 4;
 
128
  return b
 
129
}
 
130
var ka = [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16];
 
131
this.__defineGetter__("_screen", function() {
 
132
  delete _screen;
 
133
  return _screen = r([0], 0, ALLOC_STATIC)
 
134
});
 
135
this.__defineGetter__("__ZStL8__ioinit", function() {
 
136
  delete __ZStL8__ioinit;
 
137
  return __ZStL8__ioinit = r([0], 0, ALLOC_STATIC)
 
138
});
 
139
var la = 0;
 
140
this.__defineGetter__("__ZL5light", function() {
 
141
  delete __ZL5light;
 
142
  return __ZL5light = r([0, 0, 0], 0, ALLOC_STATIC)
 
143
});
 
144
this.__defineGetter__("__ZL4pool", function() {
 
145
  delete __ZL4pool;
 
146
  return __ZL4pool = r([0], 0, ALLOC_STATIC)
 
147
});
 
148
this.__defineGetter__("__ZL3end", function() {
 
149
  delete __ZL3end;
 
150
  return __ZL3end = r([0], 0, ALLOC_STATIC)
 
151
});
 
152
this.__defineGetter__("__ZL4grid", function() {
 
153
  delete __ZL4grid;
 
154
  return __ZL4grid = r([[-1, -0.3333333333333333], [0.3333333333333333, -1], [-0.3333333333333333, 1], [1, 0.3333333333333333]], 0, ALLOC_STATIC)
 
155
});
 
156
m = function() {
 
157
  B()
 
158
};
 
159
_sqrt = Math.sqrt;
 
160
__ZNSt8ios_base4InitC1Ev = function() {
 
161
  __ZSt4cout = 1;
 
162
  __ZSt4cerr = 2
 
163
};
 
164
___cxa_atexit = function(a) {
 
165
  o.push(a)
 
166
};
 
167
__ZNSt8ios_base4InitD1Ev = function() {
 
168
  __ZSt4cout = 1;
 
169
  __ZSt4cerr = 2
 
170
};
 
171
_cos = Math.cos;
 
172
_sin = Math.sin;
 
173
_SDL_LockSurface = function(a) {
 
174
  var b = SDL_SURFACES[a];
 
175
  b.a = b.c.getImageData(0, 0, b.width, b.height);
 
176
  for(var c = b.a.data.length, d = 0;d < c;d++) {
 
177
    IHEAP[b.b + d] = b.a.data[d]
 
178
  }
 
179
  IHEAP[a + 5] = b.b
 
180
};
 
181
_SDL_UnlockSurface = function(a) {
 
182
  a = SDL_SURFACES[a];
 
183
  for(var b = a.a.data.length, c = 0;c < b;c++) {
 
184
    a.a.data[c] = IHEAP[a.b + c]
 
185
  }
 
186
  for(c = 0;c < b / 4;c++) {
 
187
    a.a.data[c * 4 + 3] = 255
 
188
  }
 
189
  a.c.putImageData(a.a, 0, 0);
 
190
  a.a = null
 
191
};
 
192
_SDL_Flip = l();
 
193
_SDL_Init = function() {
 
194
  SDL_SURFACES = {};
 
195
  return 1
 
196
};
 
197
_SDL_SetVideoMode = function(a, b, c, d, e) {
 
198
  c = _malloc(14);
 
199
  SDL_SURFACES[c] = {width:a, height:b, canvas:e, c:e.getContext("2d"), g:c, b:_malloc(a * b * 4)};
 
200
  return c
 
201
};
 
202
_SDL_Delay = l();
 
203
_SDL_Quit = function() {
 
204
  return 1
 
205
};
 
206
function B() {
 
207
  C(1, 65535)
 
208
}
 
209
FUNCTION_TABLE[0] = B;
 
210
FUNCTION_TABLE[1] = function(a, b) {
 
211
  return b
 
212
};
 
213
FUNCTION_TABLE[2] = l();
 
214
function E(a, b) {
 
215
  return FHEAP[a] < FHEAP[b] ? b : a
 
216
}
 
217
FUNCTION_TABLE[3] = E;
 
218
function F(a, b) {
 
219
  return IHEAP[a] < IHEAP[b] ? b : a
 
220
}
 
221
FUNCTION_TABLE[4] = F;
 
222
var ma = 5;
 
223
FUNCTION_TABLE[5] = function() {
 
224
  __ZNSt8ios_base4InitD1Ev(__ZStL8__ioinit)
 
225
};
 
226
function G(a, b, c, d) {
 
227
  FHEAP[a] = b;
 
228
  FHEAP[a + 1] = c;
 
229
  FHEAP[a + 2] = d
 
230
}
 
231
FUNCTION_TABLE[6] = G;
 
232
function H(a, b, c) {
 
233
  G(a, FHEAP[b] + FHEAP[c], FHEAP[b + 1] + FHEAP[c + 1], FHEAP[b + 2] + FHEAP[c + 2])
 
234
}
 
235
FUNCTION_TABLE[7] = H;
 
236
function I(a, b, c) {
 
237
  G(a, FHEAP[b] - FHEAP[c], FHEAP[b + 1] - FHEAP[c + 1], FHEAP[b + 2] - FHEAP[c + 2])
 
238
}
 
239
FUNCTION_TABLE[8] = I;
 
240
function J(a, b) {
 
241
  G(a, 0 - FHEAP[b], 0 - FHEAP[b + 1], 0 - FHEAP[b + 2])
 
242
}
 
243
FUNCTION_TABLE[9] = J;
 
244
function K(a, b, c) {
 
245
  G(a, FHEAP[b] * c, FHEAP[b + 1] * c, FHEAP[b + 2] * c)
 
246
}
 
247
FUNCTION_TABLE[10] = K;
 
248
function L(a, b, c) {
 
249
  G(a, FHEAP[b + 1] * FHEAP[c + 2] - FHEAP[b + 2] * FHEAP[c + 1], FHEAP[b + 2] * FHEAP[c] - FHEAP[b] * FHEAP[c + 2], FHEAP[b] * FHEAP[c + 1] - FHEAP[b + 1] * FHEAP[c])
 
250
}
 
251
FUNCTION_TABLE[11] = L;
 
252
function M(a, b) {
 
253
  return FHEAP[a] * FHEAP[b] + FHEAP[a + 1] * FHEAP[b + 1] + FHEAP[a + 2] * FHEAP[b + 2]
 
254
}
 
255
FUNCTION_TABLE[12] = M;
 
256
function P(a, b) {
 
257
  FHEAP[a] = FHEAP[b];
 
258
  FHEAP[a + 1] = FHEAP[b + 1];
 
259
  FHEAP[a + 2] = FHEAP[b + 2]
 
260
}
 
261
FUNCTION_TABLE[13] = P;
 
262
function Q(a, b, c) {
 
263
  FHEAP[a] = FHEAP[b];
 
264
  FHEAP[a + 1] = FHEAP[b + 1];
 
265
  FHEAP[a + 2] = FHEAP[b + 2];
 
266
  a = a + 3;
 
267
  FHEAP[a] = FHEAP[c];
 
268
  FHEAP[a + 1] = FHEAP[c + 1];
 
269
  FHEAP[a + 2] = FHEAP[c + 2]
 
270
}
 
271
FUNCTION_TABLE[14] = Q;
 
272
function R(a) {
 
273
  G(a, 0, 0, 0);
 
274
  FHEAP[a + 3] = Infinity
 
275
}
 
276
FUNCTION_TABLE[15] = R;
 
277
FUNCTION_TABLE[16] = l();
 
278
function S(a, b, c) {
 
279
  FHEAP[a] = FHEAP[b];
 
280
  FHEAP[a + 1] = FHEAP[b + 1];
 
281
  FHEAP[a + 2] = FHEAP[b + 2];
 
282
  FHEAP[a + 3] = c
 
283
}
 
284
FUNCTION_TABLE[17] = S;
 
285
function T(a, b, c) {
 
286
  var d = STACKTOP;
 
287
  STACKTOP += 3;
 
288
  var e = 1 / FHEAP[b + 3];
 
289
  I(d, c, b);
 
290
  K(a, d, e);
 
291
  STACKTOP = d
 
292
}
 
293
FUNCTION_TABLE[18] = T;
 
294
FUNCTION_TABLE[19] = l();
 
295
function U(a, b, c, d) {
 
296
  FHEAP[a] = FHEAP[b];
 
297
  FHEAP[a + 1] = FHEAP[b + 1];
 
298
  FHEAP[a + 2] = FHEAP[b + 2];
 
299
  FHEAP[a + 3] = FHEAP[b + 3];
 
300
  b = a + 4;
 
301
  FHEAP[b] = FHEAP[c];
 
302
  FHEAP[b + 1] = FHEAP[c + 1];
 
303
  FHEAP[b + 2] = FHEAP[c + 2];
 
304
  FHEAP[b + 3] = FHEAP[c + 3];
 
305
  IHEAP[a + 8] = d
 
306
}
 
307
FUNCTION_TABLE[20] = U;
 
308
function V(a, b) {
 
309
  var c = STACKTOP;
 
310
  STACKTOP += 12;
 
311
  var d = c + 3, e = c + 6, h = c + 9;
 
312
  W(d, b);
 
313
  if((FHEAP[d] * FHEAP[d] != 1 != 0 & FHEAP[d + 1] * FHEAP[d + 1] != 1 != 0 & FHEAP[d + 2] * FHEAP[d + 2] != 1) != 0) {
 
314
    var g = a + 3;
 
315
    FHEAP[g] = FHEAP[d];
 
316
    FHEAP[g + 1] = FHEAP[d + 1];
 
317
    FHEAP[g + 2] = FHEAP[d + 2];
 
318
    if(FHEAP[d + 1] * FHEAP[d + 1] > FHEAP[d] * FHEAP[d]) {
 
319
      if(FHEAP[d + 1] * FHEAP[d + 1] > FHEAP[d + 2] * FHEAP[d + 2]) {
 
320
        FHEAP[a + 3 + 1] = 0 - FHEAP[a + 3 + 1]
 
321
      }else {
 
322
        FHEAP[a + 3 + 2] = 0 - FHEAP[a + 3 + 2]
 
323
      }
 
324
    }else {
 
325
      if(FHEAP[d + 2] * FHEAP[d + 2] > FHEAP[d] * FHEAP[d]) {
 
326
        FHEAP[a + 3 + 2] = 0 - FHEAP[a + 3 + 2]
 
327
      }else {
 
328
        FHEAP[a + 3] = 0 - FHEAP[a + 3]
 
329
      }
 
330
    }
 
331
  }else {
 
332
    G(c, FHEAP[d + 2], FHEAP[d], FHEAP[d + 1]);
 
333
    g = a + 3;
 
334
    FHEAP[g] = FHEAP[c];
 
335
    FHEAP[g + 1] = FHEAP[c + 1];
 
336
    FHEAP[g + 2] = FHEAP[c + 2]
 
337
  }
 
338
  FHEAP[a] = FHEAP[d];
 
339
  FHEAP[a + 1] = FHEAP[d + 1];
 
340
  FHEAP[a + 2] = FHEAP[d + 2];
 
341
  d = a + 6;
 
342
  L(e, a, a + 3);
 
343
  FHEAP[d] = FHEAP[e];
 
344
  FHEAP[d + 1] = FHEAP[e + 1];
 
345
  FHEAP[d + 2] = FHEAP[e + 2];
 
346
  e = a + 3;
 
347
  L(h, a, a + 6);
 
348
  FHEAP[e] = FHEAP[h];
 
349
  FHEAP[e + 1] = FHEAP[h + 1];
 
350
  FHEAP[e + 2] = FHEAP[h + 2];
 
351
  STACKTOP = c
 
352
}
 
353
FUNCTION_TABLE[21] = V;
 
354
function X(a) {
 
355
  return M(a, a)
 
356
}
 
357
FUNCTION_TABLE[22] = X;
 
358
function W(a, b) {
 
359
  var c = 1 / _sqrt(X(b));
 
360
  K(a, b, c)
 
361
}
 
362
FUNCTION_TABLE[23] = W;
 
363
function C(a, b) {
 
364
  var c = STACKTOP;
 
365
  STACKTOP += 3;
 
366
  var d = a == 1;
 
367
  a:do {
 
368
    if(d) {
 
369
      if(b != 65535) {
 
370
        break a
 
371
      }
 
372
      __ZNSt8ios_base4InitC1Ev(__ZStL8__ioinit);
 
373
      ___cxa_atexit(ma, 0, la);
 
374
      G(c, -0.5, -0.65, 0.9);
 
375
      W(__ZL5light, c)
 
376
    }
 
377
  }while(0);
 
378
  STACKTOP = c
 
379
}
 
380
FUNCTION_TABLE[24] = C;
 
381
function Y(a, b) {
 
382
  var c = STACKTOP;
 
383
  STACKTOP += 3;
 
384
  var d, e, h;
 
385
  I(c, a, b);
 
386
  d = M(b + 3, c);
 
387
  e = d * d - X(c) + FHEAP[a + 3] * FHEAP[a + 3];
 
388
  if(e < 0) {
 
389
    d = Infinity
 
390
  }else {
 
391
    h = _sqrt(e);
 
392
    e = d + h;
 
393
    d = d - h;
 
394
    if(e < 0) {
 
395
      d = Infinity
 
396
    }else {
 
397
      d = d = d > 0 ? d : e
 
398
    }
 
399
  }
 
400
  d = d;
 
401
  STACKTOP = c;
 
402
  return d
 
403
}
 
404
FUNCTION_TABLE[25] = Y;
 
405
function Z(a, b) {
 
406
  var c = STACKTOP;
 
407
  STACKTOP += 9;
 
408
  var d = c + 3, e, h, g = c + 6;
 
409
  h = IHEAP[__ZL4pool];
 
410
  a:for(;;) {
 
411
    if(!(h < IHEAP[__ZL3end])) {
 
412
      break a
 
413
    }
 
414
    e = Y(h, a) >= FHEAP[b + 3];
 
415
    if(e != 0) {
 
416
      h += 9 * IHEAP[h + 8]
 
417
    }else {
 
418
      e = Y(h + 4, a);
 
419
      if(FHEAP[b + 3] > e) {
 
420
        FHEAP[b + 3] = e;
 
421
        K(c, a + 3, e);
 
422
        H(d, a, c);
 
423
        e = b;
 
424
        T(g, h + 4, d);
 
425
        FHEAP[e] = FHEAP[g];
 
426
        FHEAP[e + 1] = FHEAP[g + 1];
 
427
        FHEAP[e + 2] = FHEAP[g + 2]
 
428
      }
 
429
      h += 9
 
430
    }
 
431
  }
 
432
  STACKTOP = c
 
433
}
 
434
FUNCTION_TABLE[26] = Z;
 
435
function na(a, b) {
 
436
  var c, d, e, h;
 
437
  e = IHEAP[__ZL4pool];
 
438
  a:for(;;) {
 
439
    if(!(e < IHEAP[__ZL3end])) {
 
440
      c = 7;
 
441
      break a
 
442
    }
 
443
    d = Y(e, a) >= FHEAP[b + 3];
 
444
    if(d != 0) {
 
445
      e += 9 * IHEAP[e + 8]
 
446
    }else {
 
447
      h = Y(e + 4, a);
 
448
      if(FHEAP[b + 3] > h) {
 
449
        c = 4;
 
450
        break a
 
451
      }
 
452
      e += 9
 
453
    }
 
454
  }
 
455
  if(c == 4) {
 
456
    FHEAP[b + 3] = h
 
457
  }
 
458
}
 
459
FUNCTION_TABLE[27] = na;
 
460
function oa(a, b) {
 
461
  var c = STACKTOP;
 
462
  STACKTOP += 29;
 
463
  var d;
 
464
  d = c + 3;
 
465
  var e = c + 6, h = c + 9, g = c + 12, i = c + 15, j, k = c + 19, n = c + 25;
 
466
  R(i);
 
467
  Z(b, i);
 
468
  j = FHEAP[i + 3] != Infinity ? 0 - M(i, __ZL5light) : 0;
 
469
  if(j <= 0) {
 
470
    d = 0
 
471
  }else {
 
472
    J(g, __ZL5light);
 
473
    K(e, i, 1.0E-12);
 
474
    K(c, b + 3, FHEAP[i + 3]);
 
475
    H(d, b, c);
 
476
    H(h, d, e);
 
477
    Q(k, h, g);
 
478
    R(n);
 
479
    na(k, n);
 
480
    d = d = FHEAP[n + 3] == Infinity ? j : 0
 
481
  }
 
482
  d = d;
 
483
  STACKTOP = c;
 
484
  return d
 
485
}
 
486
FUNCTION_TABLE[28] = oa;
 
487
function $(a, b, c, d, e, h) {
 
488
  var g = STACKTOP;
 
489
  STACKTOP += 67;
 
490
  var i = g + 3, j = g + 6, k = g + 9, n = g + 12, s = g + 15, ca = g + 18, y = g + 21, v = g + 24, da = g + 27, ea = g + 30, fa = g + 33, ga = g + 36, ha = g + 39, t = g + 42, p = g + 43, D, z = g + 44, w = g + 48, A = g + 52, N = g + 61, O = g + 64;
 
491
  a = a;
 
492
  c = c;
 
493
  S(w, d, h * 2);
 
494
  S(z, d, h);
 
495
  D = a;
 
496
  if(D != 0) {
 
497
    a = b > 1 ? c : 1;
 
498
    U(D, w, z, a)
 
499
  }
 
500
  a = D + 9;
 
501
  if(!(b <= 1)) {
 
502
    IHEAP[p] = 1;
 
503
    IHEAP[t] = Math.floor((c - 9) / 9);
 
504
    c = IHEAP[F(t, p)];
 
505
    V(A, e);
 
506
    t = h / 3;
 
507
    z = p = 0;
 
508
    a:for(;;) {
 
509
      if(!(z <= 5)) {
 
510
        break a
 
511
      }
 
512
      w = _cos(p);
 
513
      K(ga, A + 6, w);
 
514
      w = _sin(p);
 
515
      K(ea, A + 3, w);
 
516
      K(da, e, -0.2);
 
517
      H(fa, da, ea);
 
518
      H(ha, fa, ga);
 
519
      W(N, ha);
 
520
      K(y, N, h + t);
 
521
      H(v, d, y);
 
522
      a = $(a, b - 1, c, v, N, t);
 
523
      p += 1.0471975511965976;
 
524
      z += 1
 
525
    }
 
526
    p -= 0.3490658503988659;
 
527
    y = 0;
 
528
    a:for(;;) {
 
529
      if(!(y <= 2)) {
 
530
        break a
 
531
      }
 
532
      v = _cos(p);
 
533
      K(s, A + 6, v);
 
534
      v = _sin(p);
 
535
      K(k, A + 3, v);
 
536
      K(j, e, 0.6);
 
537
      H(n, j, k);
 
538
      H(ca, n, s);
 
539
      W(O, ca);
 
540
      K(g, O, h + t);
 
541
      H(i, d, g);
 
542
      a = $(a, b - 1, c, i, O, t);
 
543
      p += 2.0943951023931953;
 
544
      y += 1
 
545
    }
 
546
  }
 
547
  b = a;
 
548
  STACKTOP = g;
 
549
  return b
 
550
}
 
551
FUNCTION_TABLE[29] = $;
 
552
function pa(a, b, c) {
 
553
  var d = STACKTOP;
 
554
  STACKTOP += 35;
 
555
  var e = d + 3, h;
 
556
  h = d + 6;
 
557
  var g = d + 9, i = d + 10, j = d + 11, k = d + 17, n = d + 29, s = d + 32;
 
558
  FHEAP[g] = a;
 
559
  FHEAP[i] = b;
 
560
  G(h, 0, 0, -4.5);
 
561
  P(j, h);
 
562
  h = k;
 
563
  b = 3;
 
564
  a:for(;;) {
 
565
    if(b == -1) {
 
566
      break a
 
567
    }
 
568
    h += 3;
 
569
    b -= 1
 
570
  }
 
571
  b = 0;
 
572
  a:for(;;) {
 
573
    if(!(b <= 3)) {
 
574
      break a
 
575
    }
 
576
    h = b;
 
577
    G(e, FHEAP[__ZL4grid + b * 2] * 0.5 + FHEAP[g] / -2, FHEAP[__ZL4grid + b * 2 + 1] * 0.5 + FHEAP[i] / -2, 0);
 
578
    h = k + h * 3;
 
579
    FHEAP[h] = FHEAP[e];
 
580
    FHEAP[h + 1] = FHEAP[e + 1];
 
581
    FHEAP[h + 2] = FHEAP[e + 2];
 
582
    b += 1
 
583
  }
 
584
  G(n, 0, c, FHEAP[E(g, i)]);
 
585
  _SDL_LockSurface(IHEAP[_screen]);
 
586
  c = a;
 
587
  a:for(;;) {
 
588
    if(c == 0) {
 
589
      break a
 
590
    }
 
591
    g = e = 0;
 
592
    b:for(;;) {
 
593
      if(!(g <= 3)) {
 
594
        break b
 
595
      }
 
596
      H(d, n, k + g * 3);
 
597
      i = j + 3;
 
598
      W(s, d);
 
599
      FHEAP[i] = FHEAP[s];
 
600
      FHEAP[i + 1] = FHEAP[s + 1];
 
601
      FHEAP[i + 2] = FHEAP[s + 2];
 
602
      e = oa(IHEAP[__ZL4pool], j) + e;
 
603
      g += 1
 
604
    }
 
605
    g = 0;
 
606
    b:for(;;) {
 
607
      if(!(g <= 2)) {
 
608
        break b
 
609
      }
 
610
      IHEAP[IHEAP[IHEAP[_screen] + ka[5]] + Math.floor((a - FHEAP[n + 1]) * a * 4 + FHEAP[n] * 4) + g] = Math.floor(e * 64);
 
611
      g += 1
 
612
    }
 
613
    FHEAP[n] += 1;
 
614
    c -= 1
 
615
  }
 
616
  _SDL_UnlockSurface(IHEAP[_screen]);
 
617
  STACKTOP = d
 
618
}
 
619
FUNCTION_TABLE[30] = pa;
 
620
function qa(a, b) {
 
621
  var c = STACKTOP;
 
622
  STACKTOP += 11;
 
623
  var d = c + 3, e = c + 6, h, g, i, j = c + 9, k = c + 10;
 
624
  if(a == 2) {
 
625
    IHEAP[k] = 2;
 
626
    g = Math.floor(Number(ba(IHEAP[b + 1])));
 
627
    IHEAP[j] = g;
 
628
    j = IHEAP[F(j, k)]
 
629
  }else {
 
630
    j = 6
 
631
  }
 
632
  j = j;
 
633
  k = 9;
 
634
  i = j;
 
635
  a:for(;;) {
 
636
    i -= 1;
 
637
    g = i > 1;
 
638
    if(g == 0) {
 
639
      break a
 
640
    }
 
641
    k = (k + 1) * 9
 
642
  }
 
643
  k += 1;
 
644
  h = k;
 
645
  g = i = __Znaj(h * 68);
 
646
  h = h - 1;
 
647
  a:for(;;) {
 
648
    if(h == -1) {
 
649
      break a
 
650
    }
 
651
    g += 9;
 
652
    h -= 1
 
653
  }
 
654
  IHEAP[__ZL4pool] = i;
 
655
  IHEAP[__ZL3end] = IHEAP[__ZL4pool] + 9 * k;
 
656
  G(d, 0.25, 1, -0.5);
 
657
  W(e, d);
 
658
  G(c, 0, 0, 0);
 
659
  $(IHEAP[__ZL4pool], j, k, c, e, 1);
 
660
  return; // XXX
 
661
  _SDL_Init(32);
 
662
  d = _SDL_SetVideoMode(512, 512, 32, 0);
 
663
  IHEAP[_screen] = d;
 
664
  d = 511;
 
665
  a:for(;;) {
 
666
    if(!(d >= 0)) {
 
667
      break a
 
668
    }
 
669
    pa(512, 512, d);
 
670
    d -= 1
 
671
  }
 
672
  STACKTOP = c;
 
673
  return 0
 
674
}
 
675
FUNCTION_TABLE[31] = qa;
 
676
function ra(a) {
 
677
  function b() {
 
678
    for(var h = 0;h < 0;h++) {
 
679
      d.push(0)
 
680
    }
 
681
  }
 
682
  ia();
 
683
  var c = a.length + 1, d = [r(x("/bin/this.program"), null)];
 
684
  b();
 
685
  for(var e = 0;e < c - 1;e += 1) {
 
686
    d.push(r(x(a[e]), null));
 
687
    b()
 
688
  }
 
689
  d = r(d, null);
 
690
  m();
 
691
  for(qa(c, d);o.length > 0;) {
 
692
    a = o.pop();
 
693
    if(typeof a === "number") {
 
694
      a = FUNCTION_TABLE[a]
 
695
    }
 
696
    a()
 
697
  }
 
698
}
 
699
 
 
700
run = ra;
 
701
__ZL10trace_lineiii = pa;
 
702