Skip to content

Instantly share code, notes, and snippets.

@pepyakin
Last active January 8, 2018 09:21
Show Gist options
  • Save pepyakin/47b6e8102f2017d330351eec4ad6b034 to your computer and use it in GitHub Desktop.
Save pepyakin/47b6e8102f2017d330351eec4ad6b034 to your computer and use it in GitHub Desktop.
/* The Computer Language Benchmarks Game
* http://benchmarksgame.alioth.debian.org/
*
* contributed by Christoph Bauer
*
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define pi 3.141592653589793
#define solar_mass (4 * pi * pi)
#define days_per_year 365.24
struct planet {
double x, y, z;
double vx, vy, vz;
double mass;
};
void advance(int nbodies, struct planet * bodies, double dt)
{
int i, j;
for (i = 0; i < nbodies; i++) {
struct planet * b = &(bodies[i]);
for (j = i + 1; j < nbodies; j++) {
struct planet * b2 = &(bodies[j]);
double dx = b->x - b2->x;
double dy = b->y - b2->y;
double dz = b->z - b2->z;
double distance = sqrt(dx * dx + dy * dy + dz * dz);
double mag = dt / (distance * distance * distance);
b->vx -= dx * b2->mass * mag;
b->vy -= dy * b2->mass * mag;
b->vz -= dz * b2->mass * mag;
b2->vx += dx * b->mass * mag;
b2->vy += dy * b->mass * mag;
b2->vz += dz * b->mass * mag;
}
}
for (i = 0; i < nbodies; i++) {
struct planet * b = &(bodies[i]);
b->x += dt * b->vx;
b->y += dt * b->vy;
b->z += dt * b->vz;
}
}
double energy(int nbodies, struct planet * bodies)
{
double e;
int i, j;
e = 0.0;
for (i = 0; i < nbodies; i++) {
struct planet * b = &(bodies[i]);
e += 0.5 * b->mass * (b->vx * b->vx + b->vy * b->vy + b->vz * b->vz);
for (j = i + 1; j < nbodies; j++) {
struct planet * b2 = &(bodies[j]);
double dx = b->x - b2->x;
double dy = b->y - b2->y;
double dz = b->z - b2->z;
double distance = sqrt(dx * dx + dy * dy + dz * dz);
e -= (b->mass * b2->mass) / distance;
}
}
return e;
}
void offset_momentum(int nbodies, struct planet * bodies)
{
double px = 0.0, py = 0.0, pz = 0.0;
int i;
for (i = 0; i < nbodies; i++) {
px += bodies[i].vx * bodies[i].mass;
py += bodies[i].vy * bodies[i].mass;
pz += bodies[i].vz * bodies[i].mass;
}
bodies[0].vx = - px / solar_mass;
bodies[0].vy = - py / solar_mass;
bodies[0].vz = - pz / solar_mass;
}
#define NBODIES 5
struct planet bodies[NBODIES] = {
{ /* sun */
0, 0, 0, 0, 0, 0, solar_mass
},
{ /* jupiter */
4.84143144246472090e+00,
-1.16032004402742839e+00,
-1.03622044471123109e-01,
1.66007664274403694e-03 * days_per_year,
7.69901118419740425e-03 * days_per_year,
-6.90460016972063023e-05 * days_per_year,
9.54791938424326609e-04 * solar_mass
},
{ /* saturn */
8.34336671824457987e+00,
4.12479856412430479e+00,
-4.03523417114321381e-01,
-2.76742510726862411e-03 * days_per_year,
4.99852801234917238e-03 * days_per_year,
2.30417297573763929e-05 * days_per_year,
2.85885980666130812e-04 * solar_mass
},
{ /* uranus */
1.28943695621391310e+01,
-1.51111514016986312e+01,
-2.23307578892655734e-01,
2.96460137564761618e-03 * days_per_year,
2.37847173959480950e-03 * days_per_year,
-2.96589568540237556e-05 * days_per_year,
4.36624404335156298e-05 * solar_mass
},
{ /* neptune */
1.53796971148509165e+01,
-2.59193146099879641e+01,
1.79258772950371181e-01,
2.68067772490389322e-03 * days_per_year,
1.62824170038242295e-03 * days_per_year,
-9.51592254519715870e-05 * days_per_year,
5.15138902046611451e-05 * solar_mass
}
};
double start() {
offset_momentum(NBODIES, bodies);
return energy(NBODIES, bodies);
}
double run(int n) {
int i;
for (i = 1; i <= n; i++)
advance(NBODIES, bodies, 0.01);
return energy(NBODIES, bodies);
}
#ifndef WASM_H_GENERATED_
#define WASM_H_GENERATED_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WASM_RT_INCLUDED_
#define WASM_RT_INCLUDED_
#include <stdint.h>
#ifndef WASM_RT_MAX_CALL_STACK_DEPTH
#define WASM_RT_MAX_CALL_STACK_DEPTH 500
#endif
#ifndef WASM_RT_MODULE_PREFIX
#define WASM_RT_MODULE_PREFIX
#endif
#define WASM_RT_PASTE_(x, y) x ## y
#define WASM_RT_PASTE(x, y) WASM_RT_PASTE_(x, y)
#define WASM_RT_ADD_PREFIX(x) WASM_RT_PASTE(WASM_RT_MODULE_PREFIX, x)
#define WASM_RT_DEFINE_EXTERNAL(decl, target) decl = &target;
/* TODO(binji): only use stdint.h types in header */
typedef uint8_t u8;
typedef int8_t s8;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
typedef int64_t s64;
typedef float f32;
typedef double f64;
typedef enum {
WASM_RT_TRAP_NONE,
WASM_RT_TRAP_OOB,
WASM_RT_TRAP_INT_OVERFLOW,
WASM_RT_TRAP_DIV_BY_ZERO,
WASM_RT_TRAP_INVALID_CONVERSION,
WASM_RT_TRAP_UNREACHABLE,
WASM_RT_TRAP_CALL_INDIRECT,
WASM_RT_TRAP_EXHAUSTION,
} wasm_rt_trap_t;
typedef enum {
WASM_RT_I32,
WASM_RT_I64,
WASM_RT_F32,
WASM_RT_F64,
} wasm_rt_type_t;
typedef void (*wasm_rt_anyfunc_t)(void);
typedef struct {
uint32_t func_type;
wasm_rt_anyfunc_t func;
} wasm_rt_elem_t;
typedef struct {
uint8_t* data;
uint32_t pages, max_pages;
uint32_t size;
} wasm_rt_memory_t;
typedef struct {
wasm_rt_elem_t* data;
uint32_t max_size;
uint32_t size;
} wasm_rt_table_t;
extern void wasm_rt_trap(wasm_rt_trap_t) __attribute__((noreturn));
extern uint32_t wasm_rt_register_func_type(uint32_t params, uint32_t results, ...);
extern void wasm_rt_allocate_memory(wasm_rt_memory_t*, uint32_t initial_pages, uint32_t max_pages);
extern uint32_t wasm_rt_grow_memory(wasm_rt_memory_t*, uint32_t pages);
extern void wasm_rt_allocate_table(wasm_rt_table_t*, uint32_t elements, uint32_t max_elements);
extern uint32_t wasm_rt_call_stack_depth;
#endif /* WASM_RT_INCLUDED_ */
extern void WASM_RT_ADD_PREFIX(init)(void);
/* import: 'env' 'memoryBase' */
extern u32 (*Z_envZ_memoryBaseZ_i);
/* import: 'env' 'memory' */
extern wasm_rt_memory_t (*Z_envZ_memory);
/* import: 'env' 'table' */
extern wasm_rt_table_t (*Z_envZ_table);
/* import: 'env' 'tableBase' */
extern u32 (*Z_envZ_tableBaseZ_i);
/* export: '_run' */
extern f64 (*WASM_RT_ADD_PREFIX(Z__runZ_di))(u32);
/* export: '__post_instantiate' */
extern void (*WASM_RT_ADD_PREFIX(Z___post_instantiateZ_vv))(void);
/* export: 'runPostSets' */
extern void (*WASM_RT_ADD_PREFIX(Z_runPostSetsZ_vv))(void);
/* export: '_energy' */
extern f64 (*WASM_RT_ADD_PREFIX(Z__energyZ_dii))(u32, u32);
/* export: '_start' */
extern f64 (*WASM_RT_ADD_PREFIX(Z__startZ_dv))(void);
/* export: '_offset_momentum' */
extern void (*WASM_RT_ADD_PREFIX(Z__offset_momentumZ_vii))(u32, u32);
/* export: '_advance' */
extern void (*WASM_RT_ADD_PREFIX(Z__advanceZ_viid))(u32, u32, f64);
/* export: '_bodies' */
extern u32 (*WASM_RT_ADD_PREFIX(Z__bodiesZ_i));
#ifdef __cplusplus
}
#endif
#endif /* WASM_H_GENERATED_ */
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "wasm.h"
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#define LIKELY(x) __builtin_expect(!!(x), 1)
#define TRAP(x) (wasm_rt_trap(WASM_RT_TRAP_##x), 0)
#define FUNC_PROLOGUE \
if (++wasm_rt_call_stack_depth > WASM_RT_MAX_CALL_STACK_DEPTH) \
TRAP(EXHAUSTION)
#define FUNC_EPILOGUE --wasm_rt_call_stack_depth
#define UNREACHABLE TRAP(UNREACHABLE)
#define CALL_INDIRECT(table, t, ft, x, ...) \
(LIKELY((x) < table.size && table.data[x].func && \
table.data[x].func_type == func_types[ft]) \
? ((t)table.data[x].func)(__VA_ARGS__) \
: TRAP(CALL_INDIRECT))
#define MEMCHECK(mem, a, t) \
if (UNLIKELY((a) + sizeof(t) > mem->size)) TRAP(OOB)
#define DEFINE_LOAD(name, t1, t2, t3) \
static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \
MEMCHECK(mem, addr, t1); \
t1 result; \
memcpy(&result, &mem->data[addr], sizeof(t1)); \
return (t3)(t2)result; \
}
#define DEFINE_STORE(name, t1, t2) \
static inline void name(wasm_rt_memory_t* mem, u64 addr, t2 value) { \
MEMCHECK(mem, addr, t1); \
t1 wrapped = (t1)value; \
memcpy(&mem->data[addr], &wrapped, sizeof(t1)); \
}
DEFINE_LOAD(i32_load, u32, u32, u32);
DEFINE_LOAD(i64_load, u64, u64, u64);
DEFINE_LOAD(f32_load, f32, f32, f32);
DEFINE_LOAD(f64_load, f64, f64, f64);
DEFINE_LOAD(i32_load8_s, s8, s32, u32);
DEFINE_LOAD(i64_load8_s, s8, s64, u64);
DEFINE_LOAD(i32_load8_u, u8, u32, u32);
DEFINE_LOAD(i64_load8_u, u8, u64, u64);
DEFINE_LOAD(i32_load16_s, s16, s32, u32);
DEFINE_LOAD(i64_load16_s, s16, s64, u64);
DEFINE_LOAD(i32_load16_u, u16, u32, u32);
DEFINE_LOAD(i64_load16_u, u16, u64, u64);
DEFINE_LOAD(i64_load32_s, s32, s64, u64);
DEFINE_LOAD(i64_load32_u, u32, u64, u64);
DEFINE_STORE(i32_store, u32, u32);
DEFINE_STORE(i64_store, u64, u64);
DEFINE_STORE(f32_store, f32, f32);
DEFINE_STORE(f64_store, f64, f64);
DEFINE_STORE(i32_store8, u8, u32);
DEFINE_STORE(i32_store16, u16, u32);
DEFINE_STORE(i64_store8, u8, u64);
DEFINE_STORE(i64_store16, u16, u64);
DEFINE_STORE(i64_store32, u32, u64);
#define I32_CLZ(x) ((x) ? __builtin_clz(x) : 32)
#define I64_CLZ(x) ((x) ? __builtin_clzll(x) : 64)
#define I32_CTZ(x) ((x) ? __builtin_ctz(x) : 32)
#define I64_CTZ(x) ((x) ? __builtin_ctzll(x) : 64)
#define I32_POPCNT(x) (__builtin_popcount(x))
#define I64_POPCNT(x) (__builtin_popcountll(x))
#define DIV_S(ut, min, x, y) \
((UNLIKELY((y) == 0)) ? TRAP(DIV_BY_ZERO) \
: (UNLIKELY((x) == min && (y) == -1)) ? TRAP(INT_OVERFLOW) \
: (ut)((x) / (y)))
#define REM_S(ut, min, x, y) \
((UNLIKELY((y) == 0)) ? TRAP(DIV_BY_ZERO) \
: (UNLIKELY((x) == min && (y) == -1)) ? 0 \
: (ut)((x) % (y)))
#define I32_DIV_S(x, y) DIV_S(u32, INT32_MIN, (s32)x, (s32)y)
#define I64_DIV_S(x, y) DIV_S(u64, INT64_MIN, (s64)x, (s64)y)
#define I32_REM_S(x, y) REM_S(u32, INT32_MIN, (s32)x, (s32)y)
#define I64_REM_S(x, y) REM_S(u64, INT64_MIN, (s64)x, (s64)y)
#define DIVREM_U(op, x, y) \
((UNLIKELY((y) == 0)) ? TRAP(DIV_BY_ZERO) : ((x) op (y)))
#define DIV_U(x, y) DIVREM_U(/, x, y)
#define REM_U(x, y) DIVREM_U(%, x, y)
#define ROTL(x, y, mask) \
(((x) << ((y) & (mask))) | ((x) >> (((mask) - (y) + 1) & (mask))))
#define ROTR(x, y, mask) \
(((x) >> ((y) & (mask))) | ((x) << (((mask) - (y) + 1) & (mask))))
#define I32_ROTL(x, y) ROTL(x, y, 31)
#define I64_ROTL(x, y) ROTL(x, y, 63)
#define I32_ROTR(x, y) ROTR(x, y, 31)
#define I64_ROTR(x, y) ROTR(x, y, 63)
#define FMIN(x, y) \
((UNLIKELY((x) != (x))) ? NAN \
: (UNLIKELY((y) != (y))) ? NAN \
: (UNLIKELY((x) == 0 && (y) == 0)) ? (signbit(x) ? x : y) \
: (x < y) ? x : y)
#define FMAX(x, y) \
((UNLIKELY((x) != (x))) ? NAN \
: (UNLIKELY((y) != (y))) ? NAN \
: (UNLIKELY((x) == 0 && (y) == 0)) ? (signbit(x) ? y : x) \
: (x > y) ? x : y)
#define TRUNC_S(ut, st, ft, min, max, maxop, x) \
((UNLIKELY((x) != (x))) ? TRAP(INVALID_CONVERSION) \
: (UNLIKELY((x) < (ft)(min) || (x) maxop (ft)(max))) ? TRAP(INT_OVERFLOW) \
: (ut)(st)(x))
#define I32_TRUNC_S_F32(x) TRUNC_S(u32, s32, f32, INT32_MIN, INT32_MAX, >=, x)
#define I64_TRUNC_S_F32(x) TRUNC_S(u64, s64, f32, INT64_MIN, INT64_MAX, >=, x)
#define I32_TRUNC_S_F64(x) TRUNC_S(u32, s32, f64, INT32_MIN, INT32_MAX, >, x)
#define I64_TRUNC_S_F64(x) TRUNC_S(u64, s64, f64, INT64_MIN, INT64_MAX, >=, x)
#define TRUNC_U(ut, ft, max, maxop, x) \
((UNLIKELY((x) != (x))) ? TRAP(INVALID_CONVERSION) \
: (UNLIKELY((x) <= (ft)-1 || (x) maxop (ft)(max))) ? TRAP(INT_OVERFLOW) \
: (ut)(x))
#define I32_TRUNC_U_F32(x) TRUNC_U(u32, f32, UINT32_MAX, >=, x)
#define I64_TRUNC_U_F32(x) TRUNC_U(u64, f32, UINT64_MAX, >=, x)
#define I32_TRUNC_U_F64(x) TRUNC_U(u32, f64, UINT32_MAX, >, x)
#define I64_TRUNC_U_F64(x) TRUNC_U(u64, f64, UINT64_MAX, >=, x)
#define DEFINE_REINTERPRET(name, t1, t2) \
static inline t2 name(t1 x) { \
t2 result; \
memcpy(&result, &x, sizeof(result)); \
return result; \
}
DEFINE_REINTERPRET(f32_reinterpret_i32, u32, f32)
DEFINE_REINTERPRET(i32_reinterpret_f32, f32, u32)
DEFINE_REINTERPRET(f64_reinterpret_i64, u64, f64)
DEFINE_REINTERPRET(i64_reinterpret_f64, f64, u64)
static u32 func_types[6];
static void init_func_types(void) {
func_types[0] = wasm_rt_register_func_type(3, 0, WASM_RT_I32, WASM_RT_I32, WASM_RT_F64);
func_types[1] = wasm_rt_register_func_type(2, 1, WASM_RT_I32, WASM_RT_I32, WASM_RT_F64);
func_types[2] = wasm_rt_register_func_type(2, 0, WASM_RT_I32, WASM_RT_I32);
func_types[3] = wasm_rt_register_func_type(0, 1, WASM_RT_F64);
func_types[4] = wasm_rt_register_func_type(1, 1, WASM_RT_I32, WASM_RT_F64);
func_types[5] = wasm_rt_register_func_type(0, 0);
}
static void _advance(u32, u32, f64);
static f64 _energy(u32, u32);
static void _offset_momentum(u32, u32);
static f64 _start(void);
static f64 _run(u32);
static void runPostSets(void);
static void __post_instantiate(void);
static u32 g2;
static u32 g3;
static u32 _bodies;
static void init_globals(void) {
g2 = 0u;
g3 = 0u;
_bodies = 0u;
}
static void _advance(u32 p0, u32 p1, f64 p2) {
u32 l0 = 0, l1 = 0, l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0;
f64 l7 = 0, l8 = 0, l9 = 0, l10 = 0, l11 = 0, l12 = 0, l13 = 0, l14 = 0,
l15 = 0;
FUNC_PROLOGUE;
u32 i0, i1, i2, i3, i4, i5;
f64 d0, d1, d2, d3, d4;
i0 = p0;
i1 = 0u;
i0 = (u32)((s32)i0 > (s32)i1);
l6 = i0;
if (i0) {
i0 = 0u;
l0 = i0;
} else {
goto Bfunc;
}
L2:
i0 = l0;
i1 = 1u;
i0 += i1;
l1 = i0;
i1 = p0;
i0 = (u32)((s32)i0 < (s32)i1);
if (i0) {
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0));
l13 = d0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 8));
l14 = d0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 16));
l15 = d0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 24u;
i0 += i1;
l3 = i0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 32u;
i0 += i1;
l4 = i0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 40u;
i0 += i1;
l5 = i0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 48));
l9 = d0;
i0 = l1;
l0 = i0;
L4:
d0 = p2;
d1 = l13;
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2));
d1 -= d2;
l10 = d1;
d2 = l10;
d1 *= d2;
d2 = l14;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 8));
d2 -= d3;
l11 = d2;
d3 = l11;
d2 *= d3;
d1 += d2;
d2 = l15;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 16));
d2 -= d3;
l12 = d2;
d3 = l12;
d2 *= d3;
d1 += d2;
d1 = sqrt(d1);
l8 = d1;
d2 = l8;
d3 = l8;
d2 *= d3;
d1 *= d2;
d0 /= d1;
l7 = d0;
i0 = l3;
i1 = l3;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l10;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 48));
l8 = d3;
d2 *= d3;
d3 = l7;
d2 *= d3;
d1 -= d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = l4;
i1 = l4;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l7;
d3 = l11;
d4 = l8;
d3 *= d4;
d2 *= d3;
d1 -= d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = l5;
i1 = l5;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l7;
d3 = l12;
d4 = l8;
d3 *= d4;
d2 *= d3;
d1 -= d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 24u;
i0 += i1;
l2 = i0;
i1 = l2;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l7;
d3 = l10;
d4 = l9;
d3 *= d4;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 32u;
i0 += i1;
l2 = i0;
i1 = l2;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l7;
d3 = l11;
d4 = l9;
d3 *= d4;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 40u;
i0 += i1;
l2 = i0;
i1 = l2;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
d2 = l7;
d3 = l12;
d4 = l9;
d3 *= d4;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = l0;
i1 = 1u;
i0 += i1;
l0 = i0;
i1 = p0;
i0 = i0 != i1;
if (i0) {goto L4;}
}
i0 = l1;
i1 = p0;
i0 = i0 != i1;
if (i0) {
i0 = l1;
l0 = i0;
goto L2;
}
i0 = l6;
if (i0) {
i0 = 0u;
l1 = i0;
} else {
goto Bfunc;
}
L7:
i0 = p1;
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
l0 = i0;
i1 = l0;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
i2 = p1;
i3 = l1;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 24));
d3 = p2;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = p1;
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 8u;
i0 += i1;
l0 = i0;
i1 = l0;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
i2 = p1;
i3 = l1;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 32));
d3 = p2;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = p1;
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
i1 = 16u;
i0 += i1;
l0 = i0;
i1 = l0;
d1 = f64_load(Z_envZ_memory, (u64)(i1));
i2 = p1;
i3 = l1;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 40));
d3 = p2;
d2 *= d3;
d1 += d2;
f64_store(Z_envZ_memory, (u64)(i0), d1);
i0 = l1;
i1 = 1u;
i0 += i1;
l1 = i0;
i1 = p0;
i0 = i0 != i1;
if (i0) {goto L7;}
Bfunc:;
FUNC_EPILOGUE;
}
static f64 _energy(u32 p0, u32 p1) {
u32 l0 = 0, l1 = 0;
f64 l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0;
FUNC_PROLOGUE;
u32 i0, i1, i2, i3, i4, i5, i6;
f64 d0, d1, d2, d3, d4;
i0 = p0;
i1 = 0u;
i0 = (u32)((s32)i0 > (s32)i1);
if (i0) {
i0 = 0u;
l0 = i0;
d0 = 0;
l2 = d0;
} else {
d0 = 0;
goto Bfunc;
}
L2:
d0 = l2;
i1 = p1;
i2 = l0;
i3 = 56u;
i2 *= i3;
i1 += i2;
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 48));
l3 = d1;
d2 = 0.5;
d1 *= d2;
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 24));
l2 = d2;
d3 = l2;
d2 *= d3;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 32));
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 40));
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d1 *= d2;
d0 += d1;
l2 = d0;
i0 = l0;
i1 = 1u;
i0 += i1;
l1 = i0;
i1 = p0;
i0 = (u32)((s32)i0 < (s32)i1);
if (i0) {
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0));
l4 = d0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 8));
l5 = d0;
i0 = p1;
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 16));
l6 = d0;
i0 = l1;
l0 = i0;
L4:
d0 = l2;
d1 = l3;
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 48));
d1 *= d2;
d2 = l4;
i3 = p1;
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3));
d2 -= d3;
l2 = d2;
d3 = l2;
d2 *= d3;
d3 = l5;
i4 = p1;
i5 = l0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 8));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d3 = l6;
i4 = p1;
i5 = l0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 16));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d2 = sqrt(d2);
d1 /= d2;
d0 -= d1;
l2 = d0;
i0 = l0;
i1 = 1u;
i0 += i1;
l0 = i0;
i1 = p0;
i0 = i0 != i1;
if (i0) {goto L4;}
}
i0 = l1;
i1 = p0;
i0 = i0 != i1;
if (i0) {
i0 = l1;
l0 = i0;
goto L2;
}
d0 = l2;
Bfunc:;
FUNC_EPILOGUE;
return d0;
}
static void _offset_momentum(u32 p0, u32 p1) {
u32 l0 = 0;
f64 l1 = 0, l2 = 0, l3 = 0, l4 = 0;
FUNC_PROLOGUE;
u32 i0, i1, i2, i3, i4;
f64 d0, d1, d2;
i0 = p0;
i1 = 0u;
i0 = (u32)((s32)i0 > (s32)i1);
if (i0) {
d0 = 0;
l1 = d0;
d0 = 0;
l2 = d0;
d0 = 0;
l3 = d0;
i0 = 0u;
l0 = i0;
L2:
d0 = l3;
i1 = p1;
i2 = l0;
i3 = 56u;
i2 *= i3;
i1 += i2;
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 24));
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 48));
l4 = d2;
d1 *= d2;
d0 += d1;
l3 = d0;
d0 = l2;
d1 = l4;
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 32));
d1 *= d2;
d0 += d1;
l2 = d0;
d0 = l1;
d1 = l4;
i2 = p1;
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 40));
d1 *= d2;
d0 += d1;
l1 = d0;
i0 = l0;
i1 = 1u;
i0 += i1;
l0 = i0;
i1 = p0;
i0 = i0 != i1;
if (i0) {goto L2;}
} else {
d0 = 0;
l1 = d0;
d0 = 0;
l2 = d0;
d0 = 0;
l3 = d0;
}
i0 = p1;
d1 = l3;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
f64_store(Z_envZ_memory, (u64)(i0 + 24), d1);
i0 = p1;
d1 = l2;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
f64_store(Z_envZ_memory, (u64)(i0 + 32), d1);
i0 = p1;
d1 = l1;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
f64_store(Z_envZ_memory, (u64)(i0 + 40), d1);
FUNC_EPILOGUE;
}
static f64 _start(void) {
u32 l0 = 0, l1 = 0;
f64 l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0, l7 = 0, l8 = 0;
FUNC_PROLOGUE;
u32 i0, i1, i2, i3, i4, i5, i6;
f64 d0, d1, d2, d3, d4;
i0 = (*Z_envZ_memoryBaseZ_i);
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 48));
l6 = d0;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 32));
d0 *= d1;
d1 = 0;
d0 += d1;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 104));
l7 = d1;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 88));
d1 *= d2;
d0 += d1;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 160));
l8 = d1;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 144));
d1 *= d2;
d0 += d1;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 216));
l3 = d1;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 200));
d1 *= d2;
d0 += d1;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 272));
l4 = d1;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 256));
d1 *= d2;
d0 += d1;
l5 = d0;
d0 = l6;
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 40));
d0 *= d1;
d1 = 0;
d0 += d1;
d1 = l7;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 96));
d1 *= d2;
d0 += d1;
d1 = l8;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 152));
d1 *= d2;
d0 += d1;
d1 = l3;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 208));
d1 *= d2;
d0 += d1;
d1 = l4;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 264));
d1 *= d2;
d0 += d1;
l2 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = (*Z_envZ_memoryBaseZ_i);
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 24));
d2 = l6;
d1 *= d2;
d2 = 0;
d1 += d2;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 80));
d3 = l7;
d2 *= d3;
d1 += d2;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 136));
d3 = l8;
d2 *= d3;
d1 += d2;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 192));
d3 = l3;
d2 *= d3;
d1 += d2;
i2 = (*Z_envZ_memoryBaseZ_i);
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 248));
d3 = l4;
d2 *= d3;
d1 += d2;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
l3 = d1;
f64_store(Z_envZ_memory, (u64)(i0 + 24), d1);
i0 = (*Z_envZ_memoryBaseZ_i);
d1 = l5;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
l4 = d1;
f64_store(Z_envZ_memory, (u64)(i0 + 32), d1);
i0 = (*Z_envZ_memoryBaseZ_i);
d1 = l2;
d1 = -(d1);
d2 = 39.478417604357432;
d1 /= d2;
l5 = d1;
f64_store(Z_envZ_memory, (u64)(i0 + 40), d1);
i0 = 0u;
l0 = i0;
d0 = 0;
l2 = d0;
L1:
d0 = l2;
d1 = l6;
d2 = 0.5;
d1 *= d2;
d2 = l3;
d3 = l3;
d2 *= d3;
d3 = l4;
d4 = l4;
d3 *= d4;
d2 += d3;
d3 = l5;
d4 = l5;
d3 *= d4;
d2 += d3;
d1 *= d2;
d0 += d1;
l2 = d0;
i0 = l0;
i1 = 1u;
i0 += i1;
l1 = i0;
i1 = 5u;
i0 = (u32)((s32)i0 < (s32)i1);
if (i0) {
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0));
l3 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 8));
l4 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 16));
l5 = d0;
i0 = l1;
l0 = i0;
L3:
d0 = l2;
d1 = l6;
i2 = (*Z_envZ_memoryBaseZ_i);
i3 = l0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 48));
d1 *= d2;
d2 = l3;
i3 = (*Z_envZ_memoryBaseZ_i);
i4 = l0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3));
d2 -= d3;
l2 = d2;
d3 = l2;
d2 *= d3;
d3 = l4;
i4 = (*Z_envZ_memoryBaseZ_i);
i5 = l0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 8));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d3 = l5;
i4 = (*Z_envZ_memoryBaseZ_i);
i5 = l0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 16));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d2 = sqrt(d2);
d1 /= d2;
d0 -= d1;
l2 = d0;
i0 = l0;
i1 = 1u;
i0 += i1;
l0 = i0;
i1 = 5u;
i0 = i0 != i1;
if (i0) {goto L3;}
}
i0 = l1;
i1 = 5u;
i0 = i0 != i1;
if (i0) {
i0 = l1;
l0 = i0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 48));
l6 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 24));
l3 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 32));
l4 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = l1;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 40));
l5 = d0;
goto L1;
}
d0 = l2;
FUNC_EPILOGUE;
return d0;
}
static f64 _run(u32 p0) {
u32 l0 = 0, l1 = 0;
f64 l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0;
FUNC_PROLOGUE;
u32 i0, i1, i2, i3, i4, i5, i6;
f64 d0, d1, d2, d3, d4;
i0 = p0;
i1 = 1u;
i0 = (u32)((s32)i0 < (s32)i1);
if (i0) {
i0 = 0u;
p0 = i0;
d0 = 0;
l2 = d0;
} else {
i0 = 1u;
l0 = i0;
L2:
i0 = 5u;
i1 = (*Z_envZ_memoryBaseZ_i);
d2 = 0.01;
_advance(i0, i1, d2);
i0 = l0;
i1 = 1u;
i0 += i1;
l1 = i0;
i0 = l0;
i1 = p0;
i0 = i0 == i1;
if (i0) {
i0 = 0u;
p0 = i0;
d0 = 0;
l2 = d0;
} else {
i0 = l1;
l0 = i0;
goto L2;
}
}
L4:
d0 = l2;
i1 = (*Z_envZ_memoryBaseZ_i);
i2 = p0;
i3 = 56u;
i2 *= i3;
i1 += i2;
d1 = f64_load(Z_envZ_memory, (u64)(i1 + 48));
l3 = d1;
d2 = 0.5;
d1 *= d2;
i2 = (*Z_envZ_memoryBaseZ_i);
i3 = p0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 24));
l2 = d2;
d3 = l2;
d2 *= d3;
i3 = (*Z_envZ_memoryBaseZ_i);
i4 = p0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 32));
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
i3 = (*Z_envZ_memoryBaseZ_i);
i4 = p0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3 + 40));
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d1 *= d2;
d0 += d1;
l2 = d0;
i0 = p0;
i1 = 1u;
i0 += i1;
l0 = i0;
i1 = 5u;
i0 = (u32)((s32)i0 < (s32)i1);
if (i0) {
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = p0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0));
l4 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = p0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 8));
l5 = d0;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = p0;
i2 = 56u;
i1 *= i2;
i0 += i1;
d0 = f64_load(Z_envZ_memory, (u64)(i0 + 16));
l6 = d0;
i0 = l0;
p0 = i0;
L6:
d0 = l2;
d1 = l3;
i2 = (*Z_envZ_memoryBaseZ_i);
i3 = p0;
i4 = 56u;
i3 *= i4;
i2 += i3;
d2 = f64_load(Z_envZ_memory, (u64)(i2 + 48));
d1 *= d2;
d2 = l4;
i3 = (*Z_envZ_memoryBaseZ_i);
i4 = p0;
i5 = 56u;
i4 *= i5;
i3 += i4;
d3 = f64_load(Z_envZ_memory, (u64)(i3));
d2 -= d3;
l2 = d2;
d3 = l2;
d2 *= d3;
d3 = l5;
i4 = (*Z_envZ_memoryBaseZ_i);
i5 = p0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 8));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d3 = l6;
i4 = (*Z_envZ_memoryBaseZ_i);
i5 = p0;
i6 = 56u;
i5 *= i6;
i4 += i5;
d4 = f64_load(Z_envZ_memory, (u64)(i4 + 16));
d3 -= d4;
l2 = d3;
d4 = l2;
d3 *= d4;
d2 += d3;
d2 = sqrt(d2);
d1 /= d2;
d0 -= d1;
l2 = d0;
i0 = p0;
i1 = 1u;
i0 += i1;
p0 = i0;
i1 = 5u;
i0 = i0 != i1;
if (i0) {goto L6;}
}
i0 = l0;
i1 = 5u;
i0 = i0 != i1;
if (i0) {
i0 = l0;
p0 = i0;
goto L4;
}
d0 = l2;
FUNC_EPILOGUE;
return d0;
}
static void runPostSets(void) {
FUNC_PROLOGUE;
FUNC_EPILOGUE;
}
static void __post_instantiate(void) {
FUNC_PROLOGUE;
u32 i0, i1;
i0 = (*Z_envZ_memoryBaseZ_i);
i1 = 288u;
i0 += i1;
g2 = i0;
i0 = g2;
i1 = 5242880u;
i0 += i1;
g3 = i0;
runPostSets();
FUNC_EPILOGUE;
}
static const u8 data_segment_data_0[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xde, 0x45, 0xbe, 0xc9, 0x3c, 0xbd, 0x43, 0x40, 0x2c, 0xd9, 0x3c, 0x34,
0xa0, 0x5d, 0x13, 0x40, 0x7c, 0xdb, 0x1f, 0xc0, 0xab, 0x90, 0xf2, 0xbf,
0xf0, 0xeb, 0x25, 0x6c, 0xf9, 0x86, 0xba, 0xbf, 0xbc, 0xcc, 0x93, 0x9b,
0x06, 0x67, 0xe3, 0x3f, 0x9b, 0x94, 0x7d, 0xf5, 0xf2, 0x7e, 0x06, 0x40,
0x15, 0x07, 0x5a, 0x9a, 0xd7, 0xd2, 0x99, 0xbf, 0xd8, 0x33, 0xab, 0xd9,
0x95, 0x4c, 0xa3, 0x3f, 0x67, 0xca, 0x32, 0xc3, 0xcd, 0xaf, 0x20, 0x40,
0xb0, 0x01, 0xde, 0x31, 0xcb, 0x7f, 0x10, 0x40, 0x7c, 0x46, 0xeb, 0xe1,
0x53, 0xd3, 0xd9, 0xbf, 0x42, 0x94, 0x87, 0xb8, 0x21, 0x2c, 0xf0, 0xbf,
0x13, 0x8f, 0x1f, 0xbf, 0xe9, 0x35, 0xfd, 0x3f, 0xb4, 0x23, 0x11, 0x5f,
0x48, 0x3c, 0x81, 0x3f, 0x37, 0xc6, 0x07, 0x0d, 0x49, 0x1d, 0x87, 0x3f,
0xcf, 0xd9, 0xa7, 0xce, 0xea, 0xc9, 0x29, 0x40, 0x7e, 0x66, 0x26, 0xd6,
0xe8, 0x38, 0x2e, 0xc0, 0xa0, 0x7d, 0x25, 0xbe, 0x57, 0x95, 0xcc, 0xbf,
0xef, 0x1b, 0x91, 0xa9, 0x1c, 0x53, 0xf1, 0x3f, 0xc5, 0xbb, 0x54, 0x3e,
0x7f, 0xcc, 0xeb, 0x3f, 0x7c, 0x3e, 0xf2, 0xfa, 0x6b, 0x2f, 0x86, 0xbf,
0xb3, 0x1e, 0xf4, 0x9c, 0xd2, 0x3d, 0x5c, 0x3f, 0x2a, 0x57, 0x05, 0xa9,
0x67, 0xc2, 0x2e, 0x40, 0x20, 0xa2, 0xc8, 0x33, 0x58, 0xeb, 0x39, 0xc0,
0x40, 0xe5, 0xab, 0x93, 0xf3, 0xf1, 0xc6, 0x3f, 0x4a, 0xbc, 0x59, 0x16,
0xb6, 0x54, 0xef, 0x3f, 0xa3, 0xfb, 0xc4, 0x31, 0xc6, 0x07, 0xe3, 0x3f,
0xf6, 0x65, 0x76, 0x58, 0x88, 0xcb, 0xa1, 0xbf, 0xac, 0x99, 0x17, 0x53,
0xf3, 0xa8, 0x60, 0x3f,
};
static void init_memory(void) {
memcpy(&((*Z_envZ_memory).data[(*Z_envZ_memoryBaseZ_i)]), data_segment_data_0, 280);
}
static void init_table(void) {
uint32_t offset;
}
/* export: '_run' */
f64 (*WASM_RT_ADD_PREFIX(Z__runZ_di))(u32);
/* export: '__post_instantiate' */
void (*WASM_RT_ADD_PREFIX(Z___post_instantiateZ_vv))(void);
/* export: 'runPostSets' */
void (*WASM_RT_ADD_PREFIX(Z_runPostSetsZ_vv))(void);
/* export: '_energy' */
f64 (*WASM_RT_ADD_PREFIX(Z__energyZ_dii))(u32, u32);
/* export: '_start' */
f64 (*WASM_RT_ADD_PREFIX(Z__startZ_dv))(void);
/* export: '_offset_momentum' */
void (*WASM_RT_ADD_PREFIX(Z__offset_momentumZ_vii))(u32, u32);
/* export: '_advance' */
void (*WASM_RT_ADD_PREFIX(Z__advanceZ_viid))(u32, u32, f64);
/* export: '_bodies' */
u32 (*WASM_RT_ADD_PREFIX(Z__bodiesZ_i));
static void init_exports(void) {
/* export: '_run' */
WASM_RT_ADD_PREFIX(Z__runZ_di) = (&_run);
/* export: '__post_instantiate' */
WASM_RT_ADD_PREFIX(Z___post_instantiateZ_vv) = (&__post_instantiate);
/* export: 'runPostSets' */
WASM_RT_ADD_PREFIX(Z_runPostSetsZ_vv) = (&runPostSets);
/* export: '_energy' */
WASM_RT_ADD_PREFIX(Z__energyZ_dii) = (&_energy);
/* export: '_start' */
WASM_RT_ADD_PREFIX(Z__startZ_dv) = (&_start);
/* export: '_offset_momentum' */
WASM_RT_ADD_PREFIX(Z__offset_momentumZ_vii) = (&_offset_momentum);
/* export: '_advance' */
WASM_RT_ADD_PREFIX(Z__advanceZ_viid) = (&_advance);
/* export: '_bodies' */
WASM_RT_ADD_PREFIX(Z__bodiesZ_i) = (&_bodies);
}
void WASM_RT_ADD_PREFIX(init)(void) {
init_func_types();
init_globals();
init_memory();
init_table();
init_exports();
}
(module
(type (;0;) (func (param i32 i32 f64)))
(type (;1;) (func (param i32 i32) (result f64)))
(type (;2;) (func (param i32 i32)))
(type (;3;) (func (result f64)))
(type (;4;) (func (param i32) (result f64)))
(type (;5;) (func))
(import "env" "memoryBase" (global (;0;) i32))
(import "env" "memory" (memory (;0;) 256))
(import "env" "table" (table (;0;) 0 anyfunc))
(import "env" "tableBase" (global (;1;) i32))
(func (;0;) (type 0) (param i32 i32 f64)
(local i32 i32 i32 i32 i32 i32 i32 f64 f64 f64 f64 f64 f64 f64 f64 f64)
block ;; label = @1
get_local 0
i32.const 0
i32.gt_s
tee_local 9
if ;; label = @2
i32.const 0
set_local 3
else
return
end
loop ;; label = @2
get_local 3
i32.const 1
i32.add
tee_local 4
get_local 0
i32.lt_s
if ;; label = @3
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load
set_local 16
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=8
set_local 17
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=16
set_local 18
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 24
i32.add
set_local 6
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 32
i32.add
set_local 7
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 40
i32.add
set_local 8
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=48
set_local 12
get_local 4
set_local 3
loop ;; label = @4
get_local 2
get_local 16
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load
f64.sub
tee_local 13
get_local 13
f64.mul
get_local 17
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=8
f64.sub
tee_local 14
get_local 14
f64.mul
f64.add
get_local 18
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=16
f64.sub
tee_local 15
get_local 15
f64.mul
f64.add
f64.sqrt
tee_local 11
get_local 11
get_local 11
f64.mul
f64.mul
f64.div
set_local 10
get_local 6
get_local 6
f64.load
get_local 13
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
f64.load offset=48
tee_local 11
f64.mul
get_local 10
f64.mul
f64.sub
f64.store
get_local 7
get_local 7
f64.load
get_local 10
get_local 14
get_local 11
f64.mul
f64.mul
f64.sub
f64.store
get_local 8
get_local 8
f64.load
get_local 10
get_local 15
get_local 11
f64.mul
f64.mul
f64.sub
f64.store
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 24
i32.add
tee_local 5
get_local 5
f64.load
get_local 10
get_local 13
get_local 12
f64.mul
f64.mul
f64.add
f64.store
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 32
i32.add
tee_local 5
get_local 5
f64.load
get_local 10
get_local 14
get_local 12
f64.mul
f64.mul
f64.add
f64.store
get_local 1
get_local 3
i32.const 56
i32.mul
i32.add
i32.const 40
i32.add
tee_local 5
get_local 5
f64.load
get_local 10
get_local 15
get_local 12
f64.mul
f64.mul
f64.add
f64.store
get_local 3
i32.const 1
i32.add
tee_local 3
get_local 0
i32.ne
br_if 0 (;@4;)
end
end
get_local 4
get_local 0
i32.ne
if ;; label = @3
get_local 4
set_local 3
br 1 (;@2;)
end
end
get_local 9
if ;; label = @2
i32.const 0
set_local 4
else
return
end
loop ;; label = @2
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
tee_local 3
get_local 3
f64.load
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
f64.load offset=24
get_local 2
f64.mul
f64.add
f64.store
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
i32.const 8
i32.add
tee_local 3
get_local 3
f64.load
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
f64.load offset=32
get_local 2
f64.mul
f64.add
f64.store
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
i32.const 16
i32.add
tee_local 3
get_local 3
f64.load
get_local 1
get_local 4
i32.const 56
i32.mul
i32.add
f64.load offset=40
get_local 2
f64.mul
f64.add
f64.store
get_local 4
i32.const 1
i32.add
tee_local 4
get_local 0
i32.ne
br_if 0 (;@2;)
end
end)
(func (;1;) (type 1) (param i32 i32) (result f64)
(local i32 i32 f64 f64 f64 f64 f64)
block f64 ;; label = @1
get_local 0
i32.const 0
i32.gt_s
if ;; label = @2
i32.const 0
set_local 2
f64.const 0x0p+0 (;=0;)
set_local 4
else
f64.const 0x0p+0 (;=0;)
return
end
loop ;; label = @2
get_local 4
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=48
tee_local 5
f64.const 0x1p-1 (;=0.5;)
f64.mul
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=24
tee_local 4
get_local 4
f64.mul
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=32
tee_local 4
get_local 4
f64.mul
f64.add
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=40
tee_local 4
get_local 4
f64.mul
f64.add
f64.mul
f64.add
set_local 4
get_local 2
i32.const 1
i32.add
tee_local 3
get_local 0
i32.lt_s
if ;; label = @3
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load
set_local 6
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=8
set_local 7
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=16
set_local 8
get_local 3
set_local 2
loop ;; label = @4
get_local 4
get_local 5
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=48
f64.mul
get_local 6
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load
f64.sub
tee_local 4
get_local 4
f64.mul
get_local 7
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=8
f64.sub
tee_local 4
get_local 4
f64.mul
f64.add
get_local 8
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=16
f64.sub
tee_local 4
get_local 4
f64.mul
f64.add
f64.sqrt
f64.div
f64.sub
set_local 4
get_local 2
i32.const 1
i32.add
tee_local 2
get_local 0
i32.ne
br_if 0 (;@4;)
end
end
get_local 3
get_local 0
i32.ne
if ;; label = @3
get_local 3
set_local 2
br 1 (;@2;)
end
end
get_local 4
end)
(func (;2;) (type 2) (param i32 i32)
(local i32 f64 f64 f64 f64)
block ;; label = @1
get_local 0
i32.const 0
i32.gt_s
if ;; label = @2
f64.const 0x0p+0 (;=0;)
set_local 3
f64.const 0x0p+0 (;=0;)
set_local 4
f64.const 0x0p+0 (;=0;)
set_local 5
i32.const 0
set_local 2
loop ;; label = @3
get_local 5
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=24
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=48
tee_local 6
f64.mul
f64.add
set_local 5
get_local 4
get_local 6
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=32
f64.mul
f64.add
set_local 4
get_local 3
get_local 6
get_local 1
get_local 2
i32.const 56
i32.mul
i32.add
f64.load offset=40
f64.mul
f64.add
set_local 3
get_local 2
i32.const 1
i32.add
tee_local 2
get_local 0
i32.ne
br_if 0 (;@3;)
end
else
f64.const 0x0p+0 (;=0;)
set_local 3
f64.const 0x0p+0 (;=0;)
set_local 4
f64.const 0x0p+0 (;=0;)
set_local 5
end
get_local 1
get_local 5
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
f64.store offset=24
get_local 1
get_local 4
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
f64.store offset=32
get_local 1
get_local 3
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
f64.store offset=40
end)
(func (;3;) (type 3) (result f64)
(local i32 i32 f64 f64 f64 f64 f64 f64 f64)
block f64 ;; label = @1
get_global 0
f64.load offset=48
tee_local 6
get_global 0
f64.load offset=32
f64.mul
f64.const 0x0p+0 (;=0;)
f64.add
get_global 0
f64.load offset=104
tee_local 7
get_global 0
f64.load offset=88
f64.mul
f64.add
get_global 0
f64.load offset=160
tee_local 8
get_global 0
f64.load offset=144
f64.mul
f64.add
get_global 0
f64.load offset=216
tee_local 3
get_global 0
f64.load offset=200
f64.mul
f64.add
get_global 0
f64.load offset=272
tee_local 4
get_global 0
f64.load offset=256
f64.mul
f64.add
set_local 5
get_local 6
get_global 0
f64.load offset=40
f64.mul
f64.const 0x0p+0 (;=0;)
f64.add
get_local 7
get_global 0
f64.load offset=96
f64.mul
f64.add
get_local 8
get_global 0
f64.load offset=152
f64.mul
f64.add
get_local 3
get_global 0
f64.load offset=208
f64.mul
f64.add
get_local 4
get_global 0
f64.load offset=264
f64.mul
f64.add
set_local 2
get_global 0
get_global 0
f64.load offset=24
get_local 6
f64.mul
f64.const 0x0p+0 (;=0;)
f64.add
get_global 0
f64.load offset=80
get_local 7
f64.mul
f64.add
get_global 0
f64.load offset=136
get_local 8
f64.mul
f64.add
get_global 0
f64.load offset=192
get_local 3
f64.mul
f64.add
get_global 0
f64.load offset=248
get_local 4
f64.mul
f64.add
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
tee_local 3
f64.store offset=24
get_global 0
get_local 5
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
tee_local 4
f64.store offset=32
get_global 0
get_local 2
f64.neg
f64.const 0x1.3bd3cc9be45dep+5 (;=39.4784;)
f64.div
tee_local 5
f64.store offset=40
i32.const 0
set_local 0
f64.const 0x0p+0 (;=0;)
set_local 2
loop ;; label = @2
get_local 2
get_local 6
f64.const 0x1p-1 (;=0.5;)
f64.mul
get_local 3
get_local 3
f64.mul
get_local 4
get_local 4
f64.mul
f64.add
get_local 5
get_local 5
f64.mul
f64.add
f64.mul
f64.add
set_local 2
get_local 0
i32.const 1
i32.add
tee_local 1
i32.const 5
i32.lt_s
if ;; label = @3
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load
set_local 3
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=8
set_local 4
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=16
set_local 5
get_local 1
set_local 0
loop ;; label = @4
get_local 2
get_local 6
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=48
f64.mul
get_local 3
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load
f64.sub
tee_local 2
get_local 2
f64.mul
get_local 4
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=8
f64.sub
tee_local 2
get_local 2
f64.mul
f64.add
get_local 5
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=16
f64.sub
tee_local 2
get_local 2
f64.mul
f64.add
f64.sqrt
f64.div
f64.sub
set_local 2
get_local 0
i32.const 1
i32.add
tee_local 0
i32.const 5
i32.ne
br_if 0 (;@4;)
end
end
get_local 1
i32.const 5
i32.ne
if ;; label = @3
get_local 1
set_local 0
get_global 0
get_local 1
i32.const 56
i32.mul
i32.add
f64.load offset=48
set_local 6
get_global 0
get_local 1
i32.const 56
i32.mul
i32.add
f64.load offset=24
set_local 3
get_global 0
get_local 1
i32.const 56
i32.mul
i32.add
f64.load offset=32
set_local 4
get_global 0
get_local 1
i32.const 56
i32.mul
i32.add
f64.load offset=40
set_local 5
br 1 (;@2;)
end
end
get_local 2
end)
(func (;4;) (type 4) (param i32) (result f64)
(local i32 i32 f64 f64 f64 f64 f64)
block f64 ;; label = @1
get_local 0
i32.const 1
i32.lt_s
if ;; label = @2
i32.const 0
set_local 0
f64.const 0x0p+0 (;=0;)
set_local 3
else
i32.const 1
set_local 1
loop ;; label = @3
i32.const 5
get_global 0
f64.const 0x1.47ae147ae147bp-7 (;=0.01;)
call 0
get_local 1
i32.const 1
i32.add
set_local 2
get_local 1
get_local 0
i32.eq
if ;; label = @4
i32.const 0
set_local 0
f64.const 0x0p+0 (;=0;)
set_local 3
else
get_local 2
set_local 1
br 1 (;@3;)
end
end
end
loop ;; label = @2
get_local 3
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=48
tee_local 4
f64.const 0x1p-1 (;=0.5;)
f64.mul
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=24
tee_local 3
get_local 3
f64.mul
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=32
tee_local 3
get_local 3
f64.mul
f64.add
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=40
tee_local 3
get_local 3
f64.mul
f64.add
f64.mul
f64.add
set_local 3
get_local 0
i32.const 1
i32.add
tee_local 1
i32.const 5
i32.lt_s
if ;; label = @3
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load
set_local 5
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=8
set_local 6
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=16
set_local 7
get_local 1
set_local 0
loop ;; label = @4
get_local 3
get_local 4
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=48
f64.mul
get_local 5
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load
f64.sub
tee_local 3
get_local 3
f64.mul
get_local 6
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=8
f64.sub
tee_local 3
get_local 3
f64.mul
f64.add
get_local 7
get_global 0
get_local 0
i32.const 56
i32.mul
i32.add
f64.load offset=16
f64.sub
tee_local 3
get_local 3
f64.mul
f64.add
f64.sqrt
f64.div
f64.sub
set_local 3
get_local 0
i32.const 1
i32.add
tee_local 0
i32.const 5
i32.ne
br_if 0 (;@4;)
end
end
get_local 1
i32.const 5
i32.ne
if ;; label = @3
get_local 1
set_local 0
br 1 (;@2;)
end
end
get_local 3
end)
(func (;5;) (type 5)
nop)
(func (;6;) (type 5)
block ;; label = @1
get_global 0
i32.const 288
i32.add
set_global 2
get_global 2
i32.const 5242880
i32.add
set_global 3
call 5
end)
(global (;2;) (mut i32) (i32.const 0))
(global (;3;) (mut i32) (i32.const 0))
(global (;4;) i32 (i32.const 0))
(export "_run" (func 4))
(export "__post_instantiate" (func 6))
(export "runPostSets" (func 5))
(export "_energy" (func 1))
(export "_start" (func 3))
(export "_offset_momentum" (func 2))
(export "_advance" (func 0))
(export "_bodies" (global 4))
(data (get_global 0) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\deE\be\c9<\bdC@,\d9<4\a0]\13@|\db\1f\c0\ab\90\f2\bf\f0\eb%l\f9\86\ba\bf\bc\cc\93\9b\06g\e3?\9b\94}\f5\f2~\06@\15\07Z\9a\d7\d2\99\bf\d83\ab\d9\95L\a3?g\ca2\c3\cd\af @\b0\01\de1\cb\7f\10@|F\eb\e1S\d3\d9\bfB\94\87\b8!,\f0\bf\13\8f\1f\bf\e95\fd?\b4#\11_H<\81?7\c6\07\0dI\1d\87?\cf\d9\a7\ce\ea\c9)@~f&\d6\e88.\c0\a0}%\beW\95\cc\bf\ef\1b\91\a9\1cS\f1?\c5\bbT>\7f\cc\eb?|>\f2\fak/\86\bf\b3\1e\f4\9c\d2=\5c?*W\05\a9g\c2.@ \a2\c83X\eb9\c0@\e5\ab\93\f3\f1\c6?J\bcY\16\b6T\ef?\a3\fb\c41\c6\07\e3?\f6evX\88\cb\a1\bf\ac\99\17S\f3\a8`?"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment