Last active
June 5, 2022 13:39
-
-
Save xacrimon/409990cfb113ed52237039c17f9051c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The Great Computer Language Shootout | |
-- http://shootout.alioth.debian.org/ | |
-- contributed by Isaac Gouy, tuned by Mike Pall | |
local sqrt = math.sqrt | |
local PI = 3.141592653589793 | |
local SOLAR_MASS = 4 * PI * PI | |
local DAYS_PER_YEAR = 365.24 | |
local Jupiter = { | |
x = 4.84143144246472090e+00 | |
,y = -1.16032004402742839e+00 | |
,z = -1.03622044471123109e-01 | |
,vx = 1.66007664274403694e-03 * DAYS_PER_YEAR | |
,vy = 7.69901118419740425e-03 * DAYS_PER_YEAR | |
,vz = -6.90460016972063023e-05 * DAYS_PER_YEAR | |
,mass = 9.54791938424326609e-04 * SOLAR_MASS | |
} | |
local Saturn = { | |
x = 8.34336671824457987e+00 | |
,y = 4.12479856412430479e+00 | |
,z = -4.03523417114321381e-01 | |
,vx = -2.76742510726862411e-03 * DAYS_PER_YEAR | |
,vy = 4.99852801234917238e-03 * DAYS_PER_YEAR | |
,vz = 2.30417297573763929e-05 * DAYS_PER_YEAR | |
,mass = 2.85885980666130812e-04 * SOLAR_MASS | |
} | |
local Uranus = { | |
x = 1.28943695621391310e+01 | |
,y = -1.51111514016986312e+01 | |
,z = -2.23307578892655734e-01 | |
,vx = 2.96460137564761618e-03 * DAYS_PER_YEAR | |
,vy = 2.37847173959480950e-03 * DAYS_PER_YEAR | |
,vz = -2.96589568540237556e-05 * DAYS_PER_YEAR | |
,mass = 4.36624404335156298e-05 * SOLAR_MASS | |
} | |
local Neptune = { | |
x = 1.53796971148509165e+01 | |
,y = -2.59193146099879641e+01 | |
,z = 1.79258772950371181e-01 | |
,vx = 2.68067772490389322e-03 * DAYS_PER_YEAR | |
,vy = 1.62824170038242295e-03 * DAYS_PER_YEAR | |
,vz = -9.51592254519715870e-05 * DAYS_PER_YEAR | |
,mass = 5.15138902046611451e-05 * SOLAR_MASS | |
} | |
local Sun = { x = 0, y = 0, z = 0, | |
vx = 0, vy = 0, vz = 0, mass = SOLAR_MASS } | |
local function advance(bodies, nbody, dt) | |
for i=1,nbody do | |
local bi = bodies[i] | |
local bix, biy, biz, bimass = bi.x, bi.y, bi.z, bi.mass | |
local bivx, bivy, bivz = bi.vx, bi.vy, bi.vz | |
for j=i+1,nbody do | |
local bj = bodies[j] | |
local dx, dy, dz = bix-bj.x, biy-bj.y, biz-bj.z | |
local distance = sqrt(dx*dx + dy*dy + dz*dz) | |
local mag = dt / (distance * distance * distance) | |
local bim, bjm = bimass*mag, bj.mass*mag | |
bivx = bivx - (dx * bjm) | |
bivy = bivy - (dy * bjm) | |
bivz = bivz - (dz * bjm) | |
bj.vx = bj.vx + (dx * bim) | |
bj.vy = bj.vy + (dy * bim) | |
bj.vz = bj.vz + (dz * bim) | |
end | |
bi.vx = bivx | |
bi.vy = bivy | |
bi.vz = bivz | |
end | |
for i=1,nbody do | |
local bi = bodies[i] | |
bi.x = bi.x + (dt * bi.vx) | |
bi.y = bi.y + (dt * bi.vy) | |
bi.z = bi.z + (dt * bi.vz) | |
end | |
end | |
local function energy(bodies, nbody) | |
local e = 0 | |
for i=1,nbody do | |
local bi = bodies[i] | |
local vx, vy, vz, bim = bi.vx, bi.vy, bi.vz, bi.mass | |
e = e + (0.5 * bim * (vx*vx + vy*vy + vz*vz)) | |
for j=i+1,nbody do | |
local bj = bodies[j] | |
local dx, dy, dz = bi.x-bj.x, bi.y-bj.y, bi.z-bj.z | |
local distance = sqrt(dx*dx + dy*dy + dz*dz) | |
e = e - ((bim * bj.mass) / distance) | |
end | |
end | |
return e | |
end | |
local function offsetMomentum(b, nbody) | |
local px, py, pz = 0, 0, 0 | |
for i=1,nbody do | |
local bi = b[i] | |
local bim = bi.mass | |
px = px + (bi.vx * bim) | |
py = py + (bi.vy * bim) | |
pz = pz + (bi.vz * bim) | |
end | |
b[1].vx = -px / SOLAR_MASS | |
b[1].vy = -py / SOLAR_MASS | |
b[1].vz = -pz / SOLAR_MASS | |
end | |
local N = tonumber(arg and arg[1]) or 1000 | |
local bodies = { Sun, Jupiter, Saturn, Uranus, Neptune } | |
local nbody = table.getn(bodies) | |
offsetMomentum(bodies, nbody) | |
io.write( string.format("%0.9f",energy(bodies, nbody)), "\n") | |
for i=1,N do advance(bodies, nbody, 0.01) end | |
io.write( string.format("%0.9f",energy(bodies, nbody)), "\n") | |
--- | |
source: src/engine/compiler.rs | |
expression: asm_str | |
--- | |
chunk 0 (advance): | |
0: apop dst:0 | |
1: apop dst:1 | |
2: apop dst:2 | |
3: aclear | |
4: cload dst:4 idx:0 <- val:1 | |
5: mov dst:3 src:4 | |
6: cload dst:5 idx:1 <- val:1 | |
7: tget tab:0 dst:6 idx:3 <- label:2 | |
8: mov dst:7 src:6 | |
9: cload dst:9 idx:2 <- val:x | |
10: tget tab:7 dst:8 idx:9 | |
11: cload dst:11 idx:3 <- val:y | |
12: tget tab:7 dst:10 idx:11 | |
13: cload dst:13 idx:4 <- val:z | |
14: tget tab:7 dst:12 idx:13 | |
15: cload dst:15 idx:5 <- val:mass | |
16: tget tab:7 dst:14 idx:15 | |
17: mov dst:16 src:8 | |
18: mov dst:17 src:10 | |
19: mov dst:18 src:12 | |
20: mov dst:19 src:14 | |
21: cload dst:21 idx:6 <- val:vx | |
22: tget tab:7 dst:20 idx:21 | |
23: cload dst:23 idx:7 <- val:vy | |
24: tget tab:7 dst:22 idx:23 | |
25: cload dst:25 idx:8 <- val:vz | |
26: tget tab:7 dst:24 idx:25 | |
27: mov dst:26 src:20 | |
28: mov dst:27 src:22 | |
29: mov dst:28 src:24 | |
30: cload dst:31 idx:9 <- val:1 | |
31: add dst:30 a:3 b:31 | |
32: mov dst:29 src:30 | |
33: cload dst:32 idx:10 <- val:1 | |
34: tget tab:0 dst:33 idx:29 <- label:4 | |
35: mov dst:34 src:33 | |
36: cload dst:37 idx:11 <- val:x | |
37: tget tab:34 dst:36 idx:37 | |
38: sub dst:35 a:16 b:36 | |
39: cload dst:40 idx:12 <- val:y | |
40: tget tab:34 dst:39 idx:40 | |
41: sub dst:38 a:17 b:39 | |
42: cload dst:43 idx:13 <- val:z | |
43: tget tab:34 dst:42 idx:43 | |
44: sub dst:41 a:18 b:42 | |
45: mov dst:44 src:35 | |
46: mov dst:45 src:38 | |
47: mov dst:46 src:41 | |
48: uget dst:47 idx:0 | |
49: mul dst:50 a:44 b:44 | |
50: mul dst:51 a:45 b:45 | |
51: add dst:49 a:50 b:51 | |
52: mul dst:52 a:46 b:46 | |
53: add dst:48 a:49 b:52 | |
54: apush src:48 | |
55: call idx:47 | |
56: apop dst:53 | |
57: aclear | |
58: mov dst:54 src:53 | |
59: mul dst:57 a:54 b:54 | |
60: mul dst:56 a:57 b:54 | |
61: div dst:55 a:2 b:56 | |
62: mov dst:58 src:55 | |
63: mul dst:59 a:19 b:58 | |
64: cload dst:62 idx:14 <- val:mass | |
65: tget tab:34 dst:61 idx:62 | |
66: mul dst:60 a:61 b:58 | |
67: mov dst:63 src:59 | |
68: mov dst:64 src:60 | |
69: mul dst:66 a:44 b:64 | |
70: sub dst:65 a:26 b:66 | |
71: mov dst:26 src:65 | |
72: mul dst:68 a:45 b:64 | |
73: sub dst:67 a:27 b:68 | |
74: mov dst:27 src:67 | |
75: mul dst:70 a:46 b:64 | |
76: sub dst:69 a:28 b:70 | |
77: mov dst:28 src:69 | |
78: cload dst:73 idx:15 <- val:vx | |
79: tget tab:34 dst:72 idx:73 | |
80: mul dst:74 a:44 b:63 | |
81: add dst:71 a:72 b:74 | |
82: cload dst:75 idx:16 <- val:vx | |
83: tset tab:34 idx:75 src:71 | |
84: cload dst:78 idx:17 <- val:vy | |
85: tget tab:34 dst:77 idx:78 | |
86: mul dst:79 a:45 b:63 | |
87: add dst:76 a:77 b:79 | |
88: cload dst:80 idx:18 <- val:vy | |
89: tset tab:34 idx:80 src:76 | |
90: cload dst:83 idx:19 <- val:vz | |
91: tget tab:34 dst:82 idx:83 | |
92: mul dst:84 a:46 b:63 | |
93: add dst:81 a:82 b:84 | |
94: cload dst:85 idx:20 <- val:vz | |
95: tset tab:34 idx:85 src:81 | |
96: add dst:29 a:29 b:32 | |
97: eq dst:86 a:29 b:1 | |
98: isf a:86 | |
99: cjmp label:4 | |
100: cload dst:87 idx:21 <- val:vx <- label:3 | |
101: tset tab:7 idx:87 src:26 | |
102: cload dst:88 idx:22 <- val:vy | |
103: tset tab:7 idx:88 src:27 | |
104: cload dst:89 idx:23 <- val:vz | |
105: tset tab:7 idx:89 src:28 | |
106: add dst:3 a:3 b:5 | |
107: eq dst:90 a:3 b:1 | |
108: isf a:90 | |
109: cjmp label:2 | |
110: cload dst:92 idx:24 <- val:1 <- label:1 | |
111: mov dst:91 src:92 | |
112: cload dst:93 idx:25 <- val:1 | |
113: tget tab:0 dst:94 idx:91 <- label:6 | |
114: mov dst:95 src:94 | |
115: cload dst:98 idx:26 <- val:x | |
116: tget tab:95 dst:97 idx:98 | |
117: cload dst:101 idx:27 <- val:vx | |
118: tget tab:95 dst:100 idx:101 | |
119: mul dst:99 a:2 b:100 | |
120: add dst:96 a:97 b:99 | |
121: cload dst:102 idx:28 <- val:x | |
122: tset tab:95 idx:102 src:96 | |
123: cload dst:105 idx:29 <- val:y | |
124: tget tab:95 dst:104 idx:105 | |
125: cload dst:108 idx:30 <- val:vy | |
126: tget tab:95 dst:107 idx:108 | |
127: mul dst:106 a:2 b:107 | |
128: add dst:103 a:104 b:106 | |
129: cload dst:109 idx:31 <- val:y | |
130: tset tab:95 idx:109 src:103 | |
131: cload dst:112 idx:32 <- val:z | |
132: tget tab:95 dst:111 idx:112 | |
133: cload dst:115 idx:33 <- val:vz | |
134: tget tab:95 dst:114 idx:115 | |
135: mul dst:113 a:2 b:114 | |
136: add dst:110 a:111 b:113 | |
137: cload dst:116 idx:34 <- val:z | |
138: tset tab:95 idx:116 src:110 | |
139: add dst:91 a:91 b:93 | |
140: eq dst:117 a:91 b:1 | |
141: isf a:117 | |
142: cjmp label:6 | |
143: ret <- label:0 <- label:5 | |
chunk 1 (energy): | |
0: apop dst:0 | |
1: apop dst:1 | |
2: aclear | |
3: cload dst:2 idx:0 <- val:0 | |
4: mov dst:3 src:2 | |
5: cload dst:5 idx:1 <- val:1 | |
6: mov dst:4 src:5 | |
7: cload dst:6 idx:2 <- val:1 | |
8: tget tab:0 dst:7 idx:4 <- label:2 | |
9: mov dst:8 src:7 | |
10: cload dst:10 idx:3 <- val:vx | |
11: tget tab:8 dst:9 idx:10 | |
12: cload dst:12 idx:4 <- val:vy | |
13: tget tab:8 dst:11 idx:12 | |
14: cload dst:14 idx:5 <- val:vz | |
15: tget tab:8 dst:13 idx:14 | |
16: cload dst:16 idx:6 <- val:mass | |
17: tget tab:8 dst:15 idx:16 | |
18: mov dst:17 src:9 | |
19: mov dst:18 src:11 | |
20: mov dst:19 src:13 | |
21: mov dst:20 src:15 | |
22: cload dst:24 idx:7 <- val:0.5 | |
23: mul dst:23 a:24 b:20 | |
24: mul dst:27 a:17 b:17 | |
25: mul dst:28 a:18 b:18 | |
26: add dst:26 a:27 b:28 | |
27: mul dst:29 a:19 b:19 | |
28: add dst:25 a:26 b:29 | |
29: mul dst:22 a:23 b:25 | |
30: add dst:21 a:3 b:22 | |
31: mov dst:3 src:21 | |
32: cload dst:32 idx:8 <- val:1 | |
33: add dst:31 a:4 b:32 | |
34: mov dst:30 src:31 | |
35: cload dst:33 idx:9 <- val:1 | |
36: tget tab:0 dst:34 idx:30 <- label:4 | |
37: mov dst:35 src:34 | |
38: cload dst:38 idx:10 <- val:x | |
39: tget tab:8 dst:37 idx:38 | |
40: cload dst:40 idx:11 <- val:x | |
41: tget tab:35 dst:39 idx:40 | |
42: sub dst:36 a:37 b:39 | |
43: cload dst:43 idx:12 <- val:y | |
44: tget tab:8 dst:42 idx:43 | |
45: cload dst:45 idx:13 <- val:y | |
46: tget tab:35 dst:44 idx:45 | |
47: sub dst:41 a:42 b:44 | |
48: cload dst:48 idx:14 <- val:z | |
49: tget tab:8 dst:47 idx:48 | |
50: cload dst:50 idx:15 <- val:z | |
51: tget tab:35 dst:49 idx:50 | |
52: sub dst:46 a:47 b:49 | |
53: mov dst:51 src:36 | |
54: mov dst:52 src:41 | |
55: mov dst:53 src:46 | |
56: uget dst:54 idx:0 | |
57: mul dst:57 a:51 b:51 | |
58: mul dst:58 a:52 b:52 | |
59: add dst:56 a:57 b:58 | |
60: mul dst:59 a:53 b:53 | |
61: add dst:55 a:56 b:59 | |
62: apush src:55 | |
63: call idx:54 | |
64: apop dst:60 | |
65: aclear | |
66: mov dst:61 src:60 | |
67: cload dst:66 idx:16 <- val:mass | |
68: tget tab:35 dst:65 idx:66 | |
69: mul dst:64 a:20 b:65 | |
70: div dst:63 a:64 b:61 | |
71: sub dst:62 a:3 b:63 | |
72: mov dst:3 src:62 | |
73: add dst:30 a:30 b:33 | |
74: eq dst:67 a:30 b:1 | |
75: isf a:67 | |
76: cjmp label:4 | |
77: add dst:4 a:4 b:6 <- label:3 | |
78: eq dst:68 a:4 b:1 | |
79: isf a:68 | |
80: cjmp label:2 | |
81: apush src:3 <- label:1 | |
82: jmp label:0 | |
83: ret <- label:0 | |
chunk 2 (offsetMomentum): | |
0: apop dst:0 | |
1: apop dst:1 | |
2: aclear | |
3: cload dst:2 idx:0 <- val:0 | |
4: cload dst:3 idx:1 <- val:0 | |
5: cload dst:4 idx:2 <- val:0 | |
6: mov dst:5 src:2 | |
7: mov dst:6 src:3 | |
8: mov dst:7 src:4 | |
9: cload dst:9 idx:3 <- val:1 | |
10: mov dst:8 src:9 | |
11: cload dst:10 idx:4 <- val:1 | |
12: tget tab:0 dst:11 idx:8 <- label:2 | |
13: mov dst:12 src:11 | |
14: cload dst:14 idx:5 <- val:mass | |
15: tget tab:12 dst:13 idx:14 | |
16: mov dst:15 src:13 | |
17: cload dst:19 idx:6 <- val:vx | |
18: tget tab:12 dst:18 idx:19 | |
19: mul dst:17 a:18 b:15 | |
20: add dst:16 a:5 b:17 | |
21: mov dst:5 src:16 | |
22: cload dst:23 idx:7 <- val:vy | |
23: tget tab:12 dst:22 idx:23 | |
24: mul dst:21 a:22 b:15 | |
25: add dst:20 a:6 b:21 | |
26: mov dst:6 src:20 | |
27: cload dst:27 idx:8 <- val:vz | |
28: tget tab:12 dst:26 idx:27 | |
29: mul dst:25 a:26 b:15 | |
30: add dst:24 a:7 b:25 | |
31: mov dst:7 src:24 | |
32: add dst:8 a:8 b:10 | |
33: eq dst:28 a:8 b:1 | |
34: isf a:28 | |
35: cjmp label:2 | |
36: neg dst:30 src:5 <- label:1 | |
37: uget dst:31 idx:0 | |
38: div dst:29 a:30 b:31 | |
39: cload dst:32 idx:9 <- val:1 | |
40: tget tab:0 dst:33 idx:32 | |
41: cload dst:34 idx:10 <- val:vx | |
42: tset tab:33 idx:34 src:29 | |
43: neg dst:36 src:6 | |
44: uget dst:37 idx:1 | |
45: div dst:35 a:36 b:37 | |
46: cload dst:38 idx:11 <- val:1 | |
47: tget tab:0 dst:39 idx:38 | |
48: cload dst:40 idx:12 <- val:vy | |
49: tset tab:39 idx:40 src:35 | |
50: neg dst:42 src:7 | |
51: uget dst:43 idx:2 | |
52: div dst:41 a:42 b:43 | |
53: cload dst:44 idx:13 <- val:1 | |
54: tget tab:0 dst:45 idx:44 | |
55: cload dst:46 idx:14 <- val:vz | |
56: tset tab:45 idx:46 src:41 | |
57: ret <- label:0 | |
chunk 3 (__main): | |
0: aclear | |
1: cload dst:2 idx:0 <- val:math | |
2: gget dst:1 idx:2 | |
3: cload dst:3 idx:1 <- val:sqrt | |
4: tget tab:1 dst:0 idx:3 | |
5: mov dst:4 src:0 | |
6: cload dst:5 idx:2 <- val:3.141592653589793 | |
7: mov dst:6 src:5 | |
8: cload dst:9 idx:3 <- val:4 | |
9: mul dst:8 a:9 b:6 | |
10: mul dst:7 a:8 b:6 | |
11: mov dst:10 src:7 | |
12: cload dst:11 idx:4 <- val:365.24 | |
13: mov dst:12 src:11 | |
14: tnew dst:13 | |
15: cload dst:14 idx:5 <- val:x | |
16: cload dst:15 idx:6 <- val:4.841431442464721 | |
17: tset tab:13 idx:14 src:15 | |
18: cload dst:16 idx:7 <- val:y | |
19: cload dst:18 idx:8 <- val:1.1603200440274284 | |
20: neg dst:17 src:18 | |
21: tset tab:13 idx:16 src:17 | |
22: cload dst:19 idx:9 <- val:z | |
23: cload dst:21 idx:10 <- val:0.10362204447112311 | |
24: neg dst:20 src:21 | |
25: tset tab:13 idx:19 src:20 | |
26: cload dst:22 idx:11 <- val:vx | |
27: cload dst:24 idx:12 <- val:0.001660076642744037 | |
28: mul dst:23 a:24 b:12 | |
29: tset tab:13 idx:22 src:23 | |
30: cload dst:25 idx:13 <- val:vy | |
31: cload dst:27 idx:14 <- val:0.007699011184197404 | |
32: mul dst:26 a:27 b:12 | |
33: tset tab:13 idx:25 src:26 | |
34: cload dst:28 idx:15 <- val:vz | |
35: cload dst:31 idx:16 <- val:0.0000690460016972063 | |
36: neg dst:30 src:31 | |
37: mul dst:29 a:30 b:12 | |
38: tset tab:13 idx:28 src:29 | |
39: cload dst:32 idx:17 <- val:mass | |
40: cload dst:34 idx:18 <- val:0.0009547919384243266 | |
41: mul dst:33 a:34 b:10 | |
42: tset tab:13 idx:32 src:33 | |
43: mov dst:35 src:13 | |
44: tnew dst:36 | |
45: cload dst:37 idx:19 <- val:x | |
46: cload dst:38 idx:20 <- val:8.34336671824458 | |
47: tset tab:36 idx:37 src:38 | |
48: cload dst:39 idx:21 <- val:y | |
49: cload dst:40 idx:22 <- val:4.124798564124305 | |
50: tset tab:36 idx:39 src:40 | |
51: cload dst:41 idx:23 <- val:z | |
52: cload dst:43 idx:24 <- val:0.4035234171143214 | |
53: neg dst:42 src:43 | |
54: tset tab:36 idx:41 src:42 | |
55: cload dst:44 idx:25 <- val:vx | |
56: cload dst:47 idx:26 <- val:0.002767425107268624 | |
57: neg dst:46 src:47 | |
58: mul dst:45 a:46 b:12 | |
59: tset tab:36 idx:44 src:45 | |
60: cload dst:48 idx:27 <- val:vy | |
61: cload dst:50 idx:28 <- val:0.004998528012349172 | |
62: mul dst:49 a:50 b:12 | |
63: tset tab:36 idx:48 src:49 | |
64: cload dst:51 idx:29 <- val:vz | |
65: cload dst:53 idx:30 <- val:0.000023041729757376393 | |
66: mul dst:52 a:53 b:12 | |
67: tset tab:36 idx:51 src:52 | |
68: cload dst:54 idx:31 <- val:mass | |
69: cload dst:56 idx:32 <- val:0.0002858859806661308 | |
70: mul dst:55 a:56 b:10 | |
71: tset tab:36 idx:54 src:55 | |
72: mov dst:57 src:36 | |
73: tnew dst:58 | |
74: cload dst:59 idx:33 <- val:x | |
75: cload dst:60 idx:34 <- val:12.894369562139131 | |
76: tset tab:58 idx:59 src:60 | |
77: cload dst:61 idx:35 <- val:y | |
78: cload dst:63 idx:36 <- val:15.111151401698631 | |
79: neg dst:62 src:63 | |
80: tset tab:58 idx:61 src:62 | |
81: cload dst:64 idx:37 <- val:z | |
82: cload dst:66 idx:38 <- val:0.22330757889265573 | |
83: neg dst:65 src:66 | |
84: tset tab:58 idx:64 src:65 | |
85: cload dst:67 idx:39 <- val:vx | |
86: cload dst:69 idx:40 <- val:0.002964601375647616 | |
87: mul dst:68 a:69 b:12 | |
88: tset tab:58 idx:67 src:68 | |
89: cload dst:70 idx:41 <- val:vy | |
90: cload dst:72 idx:42 <- val:0.0023784717395948095 | |
91: mul dst:71 a:72 b:12 | |
92: tset tab:58 idx:70 src:71 | |
93: cload dst:73 idx:43 <- val:vz | |
94: cload dst:76 idx:44 <- val:0.000029658956854023756 | |
95: neg dst:75 src:76 | |
96: mul dst:74 a:75 b:12 | |
97: tset tab:58 idx:73 src:74 | |
98: cload dst:77 idx:45 <- val:mass | |
99: cload dst:79 idx:46 <- val:0.00004366244043351563 | |
100: mul dst:78 a:79 b:10 | |
101: tset tab:58 idx:77 src:78 | |
102: mov dst:80 src:58 | |
103: tnew dst:81 | |
104: cload dst:82 idx:47 <- val:x | |
105: cload dst:83 idx:48 <- val:15.379697114850917 | |
106: tset tab:81 idx:82 src:83 | |
107: cload dst:84 idx:49 <- val:y | |
108: cload dst:86 idx:50 <- val:25.919314609987964 | |
109: neg dst:85 src:86 | |
110: tset tab:81 idx:84 src:85 | |
111: cload dst:87 idx:51 <- val:z | |
112: cload dst:88 idx:52 <- val:0.17925877295037118 | |
113: tset tab:81 idx:87 src:88 | |
114: cload dst:89 idx:53 <- val:vx | |
115: cload dst:91 idx:54 <- val:0.0026806777249038932 | |
116: mul dst:90 a:91 b:12 | |
117: tset tab:81 idx:89 src:90 | |
118: cload dst:92 idx:55 <- val:vy | |
119: cload dst:94 idx:56 <- val:0.001628241700382423 | |
120: mul dst:93 a:94 b:12 | |
121: tset tab:81 idx:92 src:93 | |
122: cload dst:95 idx:57 <- val:vz | |
123: cload dst:98 idx:58 <- val:0.00009515922545197159 | |
124: neg dst:97 src:98 | |
125: mul dst:96 a:97 b:12 | |
126: tset tab:81 idx:95 src:96 | |
127: cload dst:99 idx:59 <- val:mass | |
128: cload dst:101 idx:60 <- val:0.000051513890204661145 | |
129: mul dst:100 a:101 b:10 | |
130: tset tab:81 idx:99 src:100 | |
131: mov dst:102 src:81 | |
132: tnew dst:103 | |
133: cload dst:104 idx:61 <- val:x | |
134: cload dst:105 idx:62 <- val:0 | |
135: tset tab:103 idx:104 src:105 | |
136: cload dst:106 idx:63 <- val:y | |
137: cload dst:107 idx:64 <- val:0 | |
138: tset tab:103 idx:106 src:107 | |
139: cload dst:108 idx:65 <- val:z | |
140: cload dst:109 idx:66 <- val:0 | |
141: tset tab:103 idx:108 src:109 | |
142: cload dst:110 idx:67 <- val:vx | |
143: cload dst:111 idx:68 <- val:0 | |
144: tset tab:103 idx:110 src:111 | |
145: cload dst:112 idx:69 <- val:vy | |
146: cload dst:113 idx:70 <- val:0 | |
147: tset tab:103 idx:112 src:113 | |
148: cload dst:114 idx:71 <- val:vz | |
149: cload dst:115 idx:72 <- val:0 | |
150: tset tab:103 idx:114 src:115 | |
151: cload dst:116 idx:73 <- val:mass | |
152: tset tab:103 idx:116 src:10 | |
153: mov dst:117 src:103 | |
154: fnew dst:119 idx:0 captures:[Capture { location: 4, is_local: true }] | |
155: mov dst:118 src:119 | |
156: fnew dst:121 idx:1 captures:[Capture { location: 4, is_local: true }] | |
157: mov dst:120 src:121 | |
158: fnew dst:123 idx:2 captures:[Capture { location: 10, is_local: true }, Capture { location: 10, is_local: true }, Capture { location: 10, is_local: true }] | |
159: mov dst:122 src:123 | |
160: cload dst:126 idx:74 <- val:tonumber | |
161: gget dst:125 idx:126 | |
162: cload dst:129 idx:75 <- val:arg | |
163: gget dst:128 idx:129 | |
164: cload dst:131 idx:76 <- val:arg | |
165: gget dst:130 idx:131 | |
166: cload dst:132 idx:77 <- val:1 | |
167: tget tab:130 dst:133 idx:132 | |
168: and dst:127 a:128 b:133 | |
169: apush src:127 | |
170: call idx:125 | |
171: apop dst:134 | |
172: aclear | |
173: cload dst:135 idx:78 <- val:1000 | |
174: or dst:124 a:134 b:135 | |
175: mov dst:136 src:124 | |
176: tnew dst:137 | |
177: cload dst:138 idx:79 <- val:1 | |
178: tset tab:137 idx:138 src:117 | |
179: cload dst:139 idx:80 <- val:2 | |
180: tset tab:137 idx:139 src:35 | |
181: cload dst:140 idx:81 <- val:3 | |
182: tset tab:137 idx:140 src:57 | |
183: cload dst:141 idx:82 <- val:4 | |
184: tset tab:137 idx:141 src:80 | |
185: cload dst:142 idx:83 <- val:5 | |
186: tset tab:137 idx:142 src:102 | |
187: mov dst:143 src:137 | |
188: cload dst:146 idx:84 <- val:table | |
189: gget dst:145 idx:146 | |
190: cload dst:147 idx:85 <- val:getn | |
191: tget tab:145 dst:144 idx:147 | |
192: apush src:143 | |
193: call idx:144 | |
194: apop dst:148 | |
195: aclear | |
196: mov dst:149 src:148 | |
197: apush src:143 | |
198: apush src:149 | |
199: call idx:122 | |
200: apop dst:150 | |
201: aclear | |
202: cload dst:153 idx:86 <- val:io | |
203: gget dst:152 idx:153 | |
204: cload dst:154 idx:87 <- val:write | |
205: tget tab:152 dst:151 idx:154 | |
206: cload dst:157 idx:88 <- val:string | |
207: gget dst:156 idx:157 | |
208: cload dst:158 idx:89 <- val:format | |
209: tget tab:156 dst:155 idx:158 | |
210: cload dst:159 idx:90 <- val:%0.9 | |
211: apush src:143 | |
212: apush src:149 | |
213: call idx:120 | |
214: apop dst:160 | |
215: aclear | |
216: apush src:159 | |
217: apush src:160 | |
218: call idx:155 | |
219: apop dst:161 | |
220: aclear | |
221: cload dst:162 idx:91 <- val: | |
222: apush src:161 | |
223: apush src:162 | |
224: call idx:151 | |
225: apop dst:163 | |
226: aclear | |
227: cload dst:165 idx:92 <- val:1 | |
228: mov dst:164 src:165 | |
229: cload dst:166 idx:93 <- val:1 | |
230: cload dst:167 idx:94 <- val:0.01 <- label:2 | |
231: apush src:143 | |
232: apush src:149 | |
233: apush src:167 | |
234: call idx:118 | |
235: apop dst:168 | |
236: aclear | |
237: add dst:164 a:164 b:166 | |
238: eq dst:169 a:164 b:136 | |
239: isf a:169 | |
240: cjmp label:2 | |
241: cload dst:172 idx:95 <- val:io <- label:1 | |
242: gget dst:171 idx:172 | |
243: cload dst:173 idx:96 <- val:write | |
244: tget tab:171 dst:170 idx:173 | |
245: cload dst:176 idx:97 <- val:string | |
246: gget dst:175 idx:176 | |
247: cload dst:177 idx:98 <- val:format | |
248: tget tab:175 dst:174 idx:177 | |
249: cload dst:178 idx:99 <- val:%0.9 | |
250: apush src:143 | |
251: apush src:149 | |
252: call idx:120 | |
253: apop dst:179 | |
254: aclear | |
255: apush src:178 | |
256: apush src:179 | |
257: call idx:174 | |
258: apop dst:180 | |
259: aclear | |
260: cload dst:181 idx:100 <- val: | |
261: apush src:180 | |
262: apush src:181 | |
263: call idx:170 | |
264: apop dst:182 | |
265: aclear | |
266: uclo dst:4 <- label:0 | |
267: uclo dst:4 | |
268: uclo dst:10 | |
269: uclo dst:10 | |
270: uclo dst:10 | |
271: ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment