I built with -g1. lib.js is attached as .txt file. The output from the test 
is

node test.js
C:\work\closure\lib.js:28
    throw b;
    ^

LinkError: WebAssembly.Instance(): Import #0 module="e" function="f" error: 
function import requires a callable
    at Object.a.addFunction (C:\work\closure\lib.js:629:10)
    at Timeout._onTimeout (C:\work\closure\test.js:6:29)
 [90m    at listOnTimeout (internal/timers.js:531:17) [39m
 [90m    at processTimers (internal/timers.js:475:7) [39m
gmake: *** [Makefile:9: test] Error 7

On Thursday, November 14, 2019 at 12:22:30 AM UTC+2, Alon Zakai wrote:
>
> The testcase works for me on 1.39.2, strange. But perhaps there is 
> something nondeterministic in how closure works that ends up with different 
> variable names, hitting or not hitting the bug.
>
> Perhaps build it with -g1 (to not minify whitespace) and see what the bad 
> value is there? Please attach a build with that if you can.
>
> On Tue, Nov 12, 2019 at 6:16 AM Sampo Syrjänen <[email protected] 
> <javascript:>> wrote:
>
>> emsdk version is 1.39.2
>>
>> On Tuesday, November 12, 2019 at 4:11:45 PM UTC+2, Sampo Syrjänen wrote:
>>>
>>> Hello! I have trouble getting addFunction to work with closure compiler 
>>> enabled. There's a minimal project here to reproduce the issue:
>>>
>>> // lib.c
>>> typedef int (*callback_t)(int a);
>>>
>>> int func(callback_t callback, int a)
>>> {
>>>     return callback(a);
>>> }
>>>
>>> // test.js
>>> const lib = require("./lib.js");
>>> setTimeout(() => {
>>>     const callback = (a) => {
>>>         return 40 + a;
>>>     };
>>>     const callbackPtr = lib.addFunction(callback, "ii");
>>>     console.log(lib._func(callbackPtr, 2));
>>> }, 100);
>>>
>>> # Makefile
>>> lib.js: lib.c
>>> emcc -s EXPORTED_FUNCTIONS="['_func']" -s 
>>> EXTRA_EXPORTED_RUNTIME_METHODS="['addFunction']" -s 
>>> RESERVED_FUNCTION_POINTERS=1 --closure 1 -o $@ $^
>>>
>>> .PHONY: clean
>>> clean:
>>> $(RM) lib.js lib.wasm
>>>
>>> test: lib.js
>>> node test.js
>>>
>>>
>>> With make test I get this:
>>>
>>> node test.js
>>> C:\work\closure\lib.js:28
>>>     throw b;
>>>     ^
>>>
>>> LinkError: WebAssembly.Instance(): Import #0 module="e" function="f" 
>>> error: function import requires a callable
>>>     at Object.a.addFunction (C:\work\closure\lib.js:629:10)
>>>     at Timeout._onTimeout (C:\work\closure\test.js:6:29)
>>> [90m    at listOnTimeout (internal/timers.js:531:17) [39m
>>> [90m    at processTimers (internal/timers.js:475:7) [39m
>>> gmake: *** [Makefile:9: test] Error 7
>>>
>>> What am I missing? How should I compile to make addFunction work?
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/7f93bf40-3bfe-42da-a01c-439f03c0a1b3%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/7f93bf40-3bfe-42da-a01c-439f03c0a1b3%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/88702128-1e83-4223-9fbd-a56324fd30af%40googlegroups.com.
var a;
a || (a = typeof Module !== 'undefined' ? Module : {});
var c = {}, e;
for (e in a) {
  a.hasOwnProperty(e) && (c[e] = a[e]);
}
var f = !1, k = !1, l = !1, aa = !1, m = !1;
f = "object" === typeof window;
k = "function" === typeof importScripts;
l = (aa = "object" === typeof process && "object" === typeof process.versions 
&& "string" === typeof process.versions.node) && !f && !k;
m = !f && !l && !k;
if (a.ENVIRONMENT) {
  throw Error("Module.ENVIRONMENT has been deprecated. To force the 
environment, use the ENVIRONMENT compile-time option (for example, -s 
ENVIRONMENT=web or -s ENVIRONMENT=node)");
}
var n = "", p, q, r, t;
if (l) {
  n = __dirname + "/", p = function(b, d) {
    r || (r = require("fs"));
    t || (t = require("path"));
    b = t.normalize(b);
    return r.readFileSync(b, d ? null : "utf8");
  }, q = function(b) {
    b = p(b, !0);
    b.buffer || (b = new Uint8Array(b));
    assert(b.buffer);
    return b;
  }, 1 < process.argv.length && process.argv[1].replace(/\\/g, "/"), 
process.argv.slice(2), "undefined" !== typeof module && (module.exports = a), 
process.on("uncaughtException", function(b) {
    throw b;
  }), process.on("unhandledRejection", u), a.inspect = function() {
    return "[Emscripten Module object]";
  };
} else {
  if (m) {
    "undefined" != typeof read && (p = function(b) {
      return read(b);
    }), q = function(b) {
      if ("function" === typeof readbuffer) {
        return new Uint8Array(readbuffer(b));
      }
      b = read(b, "binary");
      assert("object" === typeof b);
      return b;
    }, "undefined" !== typeof print && ("undefined" === typeof console && 
(console = {}), console.log = print, console.warn = console.error = "undefined" 
!== typeof printErr ? printErr : print);
  } else {
    if (f || k) {
      k ? n = self.location.href : document.currentScript && (n = 
document.currentScript.src), n = 0 !== n.indexOf("blob:") ? n.substr(0, 
n.lastIndexOf("/") + 1) : "", p = function(b) {
        var d = new XMLHttpRequest;
        d.open("GET", b, !1);
        d.send(null);
        return d.responseText;
      }, k && (q = function(b) {
        var d = new XMLHttpRequest;
        d.open("GET", b, !1);
        d.responseType = "arraybuffer";
        d.send(null);
        return new Uint8Array(d.response);
      });
    } else {
      throw Error("environment detection error");
    }
  }
}
var ba = a.print || console.log.bind(console), v = a.printErr || 
console.warn.bind(console);
for (e in c) {
  c.hasOwnProperty(e) && (a[e] = c[e]);
}
c = null;
Object.getOwnPropertyDescriptor(a, "arguments") || Object.defineProperty(a, 
"arguments", {configurable:!0, get:function() {
  u("Module.arguments has been replaced with plain arguments_");
}});
Object.getOwnPropertyDescriptor(a, "thisProgram") || Object.defineProperty(a, 
"thisProgram", {configurable:!0, get:function() {
  u("Module.thisProgram has been replaced with plain thisProgram");
}});
Object.getOwnPropertyDescriptor(a, "quit") || Object.defineProperty(a, "quit", 
{configurable:!0, get:function() {
  u("Module.quit has been replaced with plain quit_");
}});
assert("undefined" === typeof a.memoryInitializerPrefixURL, 
"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile 
instead");
assert("undefined" === typeof a.pthreadMainPrefixURL, 
"Module.pthreadMainPrefixURL option was removed, use Module.locateFile 
instead");
assert("undefined" === typeof a.cdInitializerPrefixURL, 
"Module.cdInitializerPrefixURL option was removed, use Module.locateFile 
instead");
assert("undefined" === typeof a.filePackagePrefixURL, 
"Module.filePackagePrefixURL option was removed, use Module.locateFile 
instead");
assert("undefined" === typeof a.read, "Module.read option was removed (modify 
read_ in JS)");
assert("undefined" === typeof a.readAsync, "Module.readAsync option was removed 
(modify readAsync in JS)");
assert("undefined" === typeof a.readBinary, "Module.readBinary option was 
removed (modify readBinary in JS)");
assert("undefined" === typeof a.setWindowTitle, "Module.setWindowTitle option 
was removed (modify setWindowTitle in JS)");
Object.getOwnPropertyDescriptor(a, "read") || Object.defineProperty(a, "read", 
{configurable:!0, get:function() {
  u("Module.read has been replaced with plain read_");
}});
Object.getOwnPropertyDescriptor(a, "readAsync") || Object.defineProperty(a, 
"readAsync", {configurable:!0, get:function() {
  u("Module.readAsync has been replaced with plain readAsync");
}});
Object.getOwnPropertyDescriptor(a, "readBinary") || Object.defineProperty(a, 
"readBinary", {configurable:!0, get:function() {
  u("Module.readBinary has been replaced with plain readBinary");
}});
w = function() {
  u("cannot use the stack before compiled code is ready to run, and has 
provided stack access");
};
var x, y;
a.wasmBinary && (y = a.wasmBinary);
Object.getOwnPropertyDescriptor(a, "wasmBinary") || Object.defineProperty(a, 
"wasmBinary", {configurable:!0, get:function() {
  u("Module.wasmBinary has been replaced with plain wasmBinary");
}});
Object.getOwnPropertyDescriptor(a, "noExitRuntime") || Object.defineProperty(a, 
"noExitRuntime", {configurable:!0, get:function() {
  u("Module.noExitRuntime has been replaced with plain noExitRuntime");
}});
"object" !== typeof WebAssembly && u("No WebAssembly support found. Build with 
-s WASM=0 to target JavaScript instead.");
var z, A = new WebAssembly.Table({initial:1, maximum:2, element:"anyfunc"}), B 
= !1;
function assert(b, d) {
  b || u("Assertion failed: " + d);
}
"undefined" !== typeof TextDecoder && new TextDecoder("utf8");
"undefined" !== typeof TextDecoder && new TextDecoder("utf-16le");
var buffer, C, D, E;
assert(!0, "stack must start aligned");
assert(!0, "heap must start aligned");
a.TOTAL_STACK && assert(5242880 === a.TOTAL_STACK, "the stack size can no 
longer be determined at runtime");
var H = a.TOTAL_MEMORY || 16777216;
Object.getOwnPropertyDescriptor(a, "TOTAL_MEMORY") || Object.defineProperty(a, 
"TOTAL_MEMORY", {configurable:!0, get:function() {
  u("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY");
}});
assert(5242880 <= H, "TOTAL_MEMORY should be larger than TOTAL_STACK, was " + H 
+ "! (TOTAL_STACK=5242880)");
assert("undefined" !== typeof Int32Array && "undefined" !== typeof Float64Array 
&& void 0 !== Int32Array.prototype.subarray && void 0 !== 
Int32Array.prototype.set, "JS engine does not provide full typed array 
support");
a.wasmMemory ? z = a.wasmMemory : z = new WebAssembly.Memory({initial:H / 
65536, maximum:H / 65536});
z && (buffer = z.buffer);
H = buffer.byteLength;
assert(0 === H % 65536);
var I = buffer;
buffer = I;
a.HEAP8 = C = new Int8Array(I);
a.HEAP16 = new Int16Array(I);
a.HEAP32 = D = new Int32Array(I);
a.HEAPU8 = new Uint8Array(I);
a.HEAPU16 = new Uint16Array(I);
a.HEAPU32 = E = new Uint32Array(I);
a.HEAPF32 = new Float32Array(I);
a.HEAPF64 = new Float64Array(I);
D[388] = 5244592;
function J() {
  assert(!0);
  E[429] = 34821223;
  E[430] = 2310721022;
  D[0] = 1668509029;
}
function K() {
  var b = E[429], d = E[430];
  34821223 == b && 2310721022 == d || u("Stack overflow! Stack cookie has been 
overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x" + 
d.toString(16) + " " + b.toString(16));
  1668509029 !== D[0] && u("Runtime error: The application has corrupted its 
heap memory area (address zero)!");
}
var M = new Int16Array(1), N = new Int8Array(M.buffer);
M[0] = 25459;
if (115 !== N[0] || 99 !== N[1]) {
  throw "Runtime error: expected the system to be little-endian!";
}
function O(b) {
  for (; 0 < b.length;) {
    var d = b.shift();
    if ("function" == typeof d) {
      d();
    } else {
      var h = d.c;
      "number" === typeof h ? void 0 === d.a ? a.dynCall_v(h) : a.dynCall_vi(h, 
d.a) : h(void 0 === d.a ? null : d.a);
    }
  }
}
var P = [], ca = [], da = [], ea = [], Q = !1;
function fa() {
  var b = a.preRun.shift();
  P.unshift(b);
}
assert(Math.imul, "This browser does not support Math.imul(), build with 
LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
assert(Math.fround, "This browser does not support Math.fround(), build with 
LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
assert(Math.clz32, "This browser does not support Math.clz32(), build with 
LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
assert(Math.trunc, "This browser does not support Math.trunc(), build with 
LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
var S = 0, T = null, U = null, V = {};
function ha() {
  S++;
  a.monitorRunDependencies && a.monitorRunDependencies(S);
  assert(!V["wasm-instantiate"]);
  V["wasm-instantiate"] = 1;
  null === T && "undefined" !== typeof setInterval && (T = 
setInterval(function() {
    if (B) {
      clearInterval(T), T = null;
    } else {
      var b = !1, d;
      for (d in V) {
        b || (b = !0, v("still waiting on run dependencies:")), v("dependency: 
" + d);
      }
      b && v("(end of list)");
    }
  }, 10000));
}
a.preloadedImages = {};
a.preloadedAudios = {};
function u(b) {
  if (a.onAbort) {
    a.onAbort(b);
  }
  ba(b);
  v(b);
  B = !0;
  b = "abort(" + b + ") at ";
  a: {
    var d = Error();
    if (!d.stack) {
      try {
        throw Error(0);
      } catch (h) {
        d = h;
      }
      if (!d.stack) {
        d = "(no stack trace available)";
        break a;
      }
    }
    d = d.stack.toString();
  }
  a.extraStackTrace && (d += "\n" + a.extraStackTrace());
  d = ia(d);
  throw new WebAssembly.RuntimeError(b + d);
}
function ja() {
  u("Filesystem support (FS) was not included. The problem is that you are 
using files from JS, but files were not used from C/C++, so filesystem support 
was not auto-included. You can force-include filesystem support with  -s 
FORCE_FILESYSTEM=1");
}
a.FS_createDataFile = function() {
  ja();
};
a.FS_createPreloadedFile = function() {
  ja();
};
function ka() {
  var b = W;
  return String.prototype.startsWith ? 
b.startsWith("data:application/octet-stream;base64,") : 0 === 
b.indexOf("data:application/octet-stream;base64,");
}
var W = "lib.wasm";
if (!ka()) {
  var la = W;
  W = a.locateFile ? a.locateFile(la, n) : n + la;
}
function ma() {
  try {
    if (y) {
      return new Uint8Array(y);
    }
    if (q) {
      return q(W);
    }
    throw "both async and sync fetching of the wasm failed";
  } catch (b) {
    u(b);
  }
}
function na() {
  return y || !f && !k || "function" !== typeof fetch ? new Promise(function(b) 
{
    b(ma());
  }) : fetch(W, {credentials:"same-origin"}).then(function(b) {
    if (!b.ok) {
      throw "failed to load wasm binary file at '" + W + "'";
    }
    return b.arrayBuffer();
  }).catch(function() {
    return ma();
  });
}
ca.push({c:function() {
  oa();
}});
function ia(b) {
  return b.replace(/\b_Z[\w\d_]+/g, function(b) {
    x || (x = {});
    x["warning: build with  -s DEMANGLE_SUPPORT=1  to link in libcxxabi 
demangling"] || (x["warning: build with  -s DEMANGLE_SUPPORT=1  to link in 
libcxxabi demangling"] = 1, v("warning: build with  -s DEMANGLE_SUPPORT=1  to 
link in libcxxabi demangling"));
    return b === b ? b : b + " [" + b + "]";
  });
}
var pa = {__lock:function() {
}, __unlock:function() {
}, emscripten_get_sbrk_ptr:function() {
  return 1552;
}, emscripten_resize_heap:function(b) {
  u("Cannot enlarge memory arrays to size " + b + " bytes (OOM). Either (1) 
compile with  -s TOTAL_MEMORY=X  with X higher than the current value " + 
C.length + ", (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows 
increasing the size at runtime, or (3) if you want malloc to return NULL (0) 
instead of this abort, compile with  -s ABORTING_MALLOC=0 ");
}, memory:z, table:A}, X = function() {
  function b(b) {
    a.asm = b.exports;
    S--;
    a.monitorRunDependencies && a.monitorRunDependencies(S);
    assert(V["wasm-instantiate"]);
    delete V["wasm-instantiate"];
    0 == S && (null !== T && (clearInterval(T), T = null), U && (b = U, U = 
null, b()));
  }
  function d(d) {
    assert(a === F, "the Module object should not be replaced during async 
compilation - perhaps the order of HTML elements is wrong?");
    F = null;
    b(d.instance);
  }
  function h(b) {
    return na().then(function(b) {
      return WebAssembly.instantiate(b, g);
    }).then(b, function(b) {
      v("failed to asynchronously prepare wasm: " + b);
      u(b);
    });
  }
  var g = {env:pa, wasi_unstable:pa};
  ha();
  var F = a;
  if (a.instantiateWasm) {
    try {
      return a.instantiateWasm(g, b);
    } catch (L) {
      return v("Module.instantiateWasm callback failed with error: " + L), !1;
    }
  }
  (function() {
    if (y || "function" !== typeof WebAssembly.instantiateStreaming || ka() || 
"function" !== typeof fetch) {
      return h(d);
    }
    fetch(W, {credentials:"same-origin"}).then(function(b) {
      return WebAssembly.instantiateStreaming(b, g).then(d, function(b) {
        v("wasm streaming compile failed: " + b);
        v("falling back to ArrayBuffer instantiation");
        h(d);
      });
    });
  })();
  return {};
}(), qa = X.__wasm_call_ctors;
X.__wasm_call_ctors = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return qa.apply(null, arguments);
};
var ra = X.func;
X.func = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return ra.apply(null, arguments);
};
var sa = X.__errno_location;
X.__errno_location = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return sa.apply(null, arguments);
};
var ta = X.fflush;
X.fflush = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return ta.apply(null, arguments);
};
var ua = X.setThrew;
X.setThrew = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return ua.apply(null, arguments);
};
var va = X.malloc;
X.malloc = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return va.apply(null, arguments);
};
var wa = X.free;
X.free = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return wa.apply(null, arguments);
};
var xa = X.stackSave;
X.stackSave = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return xa.apply(null, arguments);
};
var ya = X.stackAlloc;
X.stackAlloc = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return ya.apply(null, arguments);
};
var za = X.stackRestore;
X.stackRestore = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return za.apply(null, arguments);
};
var Aa = X.__growWasmMemory;
X.__growWasmMemory = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return Aa.apply(null, arguments);
};
a.asm = X;
var oa = a.___wasm_call_ctors = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.__wasm_call_ctors.apply(null, arguments);
};
a._func = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.func.apply(null, arguments);
};
a.___errno_location = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.__errno_location.apply(null, arguments);
};
a._fflush = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.fflush.apply(null, arguments);
};
a._setThrew = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.setThrew.apply(null, arguments);
};
a._malloc = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.malloc.apply(null, arguments);
};
a._free = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.free.apply(null, arguments);
};
var w = a.stackSave = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.stackSave.apply(null, arguments);
};
a.stackAlloc = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.stackAlloc.apply(null, arguments);
};
a.stackRestore = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.stackRestore.apply(null, arguments);
};
a.__growWasmMemory = function() {
  assert(Q, "you need to wait for the runtime to be ready (e.g. wait for main() 
to be called)");
  assert(!0, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive 
after main() exits)");
  return a.asm.__growWasmMemory.apply(null, arguments);
};
a.asm = X;
Object.getOwnPropertyDescriptor(a, "intArrayFromString") || 
(a.intArrayFromString = function() {
  u("'intArrayFromString' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "intArrayToString") || (a.intArrayToString = 
function() {
  u("'intArrayToString' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "ccall") || (a.ccall = function() {
  u("'ccall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "cwrap") || (a.cwrap = function() {
  u("'cwrap' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "setValue") || (a.setValue = function() {
  u("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getValue") || (a.getValue = function() {
  u("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "allocate") || (a.allocate = function() {
  u("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getMemory") || (a.getMemory = function() {
  u("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ). Alternatively, forcing filesystem support (-s 
FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "AsciiToString") || (a.AsciiToString = 
function() {
  u("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stringToAscii") || (a.stringToAscii = 
function() {
  u("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "UTF8ArrayToString") || (a.UTF8ArrayToString 
= function() {
  u("'UTF8ArrayToString' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "UTF8ToString") || (a.UTF8ToString = 
function() {
  u("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stringToUTF8Array") || (a.stringToUTF8Array 
= function() {
  u("'stringToUTF8Array' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stringToUTF8") || (a.stringToUTF8 = 
function() {
  u("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "lengthBytesUTF8") || (a.lengthBytesUTF8 = 
function() {
  u("'lengthBytesUTF8' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "UTF16ToString") || (a.UTF16ToString = 
function() {
  u("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stringToUTF16") || (a.stringToUTF16 = 
function() {
  u("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "lengthBytesUTF16") || (a.lengthBytesUTF16 = 
function() {
  u("'lengthBytesUTF16' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "UTF32ToString") || (a.UTF32ToString = 
function() {
  u("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stringToUTF32") || (a.stringToUTF32 = 
function() {
  u("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "lengthBytesUTF32") || (a.lengthBytesUTF32 = 
function() {
  u("'lengthBytesUTF32' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "allocateUTF8") || (a.allocateUTF8 = 
function() {
  u("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stackTrace") || (a.stackTrace = function() {
  u("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addOnPreRun") || (a.addOnPreRun = 
function() {
  u("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addOnInit") || (a.addOnInit = function() {
  u("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addOnPreMain") || (a.addOnPreMain = 
function() {
  u("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addOnExit") || (a.addOnExit = function() {
  u("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addOnPostRun") || (a.addOnPostRun = 
function() {
  u("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "writeStringToMemory") || 
(a.writeStringToMemory = function() {
  u("'writeStringToMemory' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "writeArrayToMemory") || 
(a.writeArrayToMemory = function() {
  u("'writeArrayToMemory' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "writeAsciiToMemory") || 
(a.writeAsciiToMemory = function() {
  u("'writeAsciiToMemory' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "addRunDependency") || (a.addRunDependency = 
function() {
  u("'addRunDependency' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "removeRunDependency") || 
(a.removeRunDependency = function() {
  u("'removeRunDependency' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "ENV") || (a.ENV = function() {
  u("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the 
FAQ)");
});
Object.getOwnPropertyDescriptor(a, "FS") || (a.FS = function() {
  u("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the 
FAQ)");
});
Object.getOwnPropertyDescriptor(a, "FS_createFolder") || (a.FS_createFolder = 
function() {
  u("'FS_createFolder' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createPath") || (a.FS_createPath = 
function() {
  u("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ). Alternatively, forcing filesystem support (-s 
FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createDataFile") || (a.FS_createDataFile 
= function() {
  u("'FS_createDataFile' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createPreloadedFile") || 
(a.FS_createPreloadedFile = function() {
  u("'FS_createPreloadedFile' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createLazyFile") || (a.FS_createLazyFile 
= function() {
  u("'FS_createLazyFile' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createLink") || (a.FS_createLink = 
function() {
  u("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ). Alternatively, forcing filesystem support (-s 
FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_createDevice") || (a.FS_createDevice = 
function() {
  u("'FS_createDevice' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem 
support (-s FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "FS_unlink") || (a.FS_unlink = function() {
  u("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ). Alternatively, forcing filesystem support (-s 
FORCE_FILESYSTEM=1) can export this for you");
});
Object.getOwnPropertyDescriptor(a, "GL") || (a.GL = function() {
  u("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the 
FAQ)");
});
Object.getOwnPropertyDescriptor(a, "dynamicAlloc") || (a.dynamicAlloc = 
function() {
  u("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "loadDynamicLibrary") || 
(a.loadDynamicLibrary = function() {
  u("'loadDynamicLibrary' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "loadWebAssemblyModule") || 
(a.loadWebAssemblyModule = function() {
  u("'loadWebAssemblyModule' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getLEB") || (a.getLEB = function() {
  u("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getFunctionTables") || (a.getFunctionTables 
= function() {
  u("'getFunctionTables' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "alignFunctionTables") || 
(a.alignFunctionTables = function() {
  u("'alignFunctionTables' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "registerFunctions") || (a.registerFunctions 
= function() {
  u("'registerFunctions' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
a.addFunction = function(b, d) {
  assert("undefined" !== typeof b);
  var h = A.length;
  try {
    A.grow(1);
  } catch (G) {
    if (!G instanceof RangeError) {
      throw G;
    }
    throw "Unable to grow wasm table. Use a higher value for 
RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.";
  }
  try {
    A.set(h, b);
  } catch (G) {
    if (!G instanceof TypeError) {
      throw G;
    }
    assert("undefined" !== typeof d, "Missing signature argument to 
addFunction");
    var g = [1, 0, 1, 96], F = d.slice(0, 1);
    d = d.slice(1);
    var L = {i:127, j:126, f:125, d:124};
    g.push(d.length);
    for (var R = 0; R < d.length; ++R) {
      g.push(L[d[R]]);
    }
    "v" == F ? g.push(0) : g = g.concat([1, L[F]]);
    g[1] = g.length - 2;
    g = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0].concat(g, [2, 7, 1, 1, 
101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0]));
    g = new WebAssembly.Module(g);
    b = (new WebAssembly.Instance(g, {e:{b:b}})).exports.b;
    A.set(h, b);
  }
  return h;
};
Object.getOwnPropertyDescriptor(a, "removeFunction") || (a.removeFunction = 
function() {
  u("'removeFunction' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getFuncWrapper") || (a.getFuncWrapper = 
function() {
  u("'getFuncWrapper' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "prettyPrint") || (a.prettyPrint = 
function() {
  u("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "makeBigInt") || (a.makeBigInt = function() {
  u("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "dynCall") || (a.dynCall = function() {
  u("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getCompilerSetting") || 
(a.getCompilerSetting = function() {
  u("'getCompilerSetting' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stackSave") || (a.stackSave = function() {
  u("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stackRestore") || (a.stackRestore = 
function() {
  u("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "stackAlloc") || (a.stackAlloc = function() {
  u("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "establishStackSpace") || 
(a.establishStackSpace = function() {
  u("'establishStackSpace' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "print") || (a.print = function() {
  u("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "printErr") || (a.printErr = function() {
  u("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "getTempRet0") || (a.getTempRet0 = 
function() {
  u("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "setTempRet0") || (a.setTempRet0 = 
function() {
  u("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "callMain") || (a.callMain = function() {
  u("'callMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "abort") || (a.abort = function() {
  u("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "Pointer_stringify") || (a.Pointer_stringify 
= function() {
  u("'Pointer_stringify' was not exported. add it to 
EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)");
});
Object.getOwnPropertyDescriptor(a, "warnOnce") || (a.warnOnce = function() {
  u("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see 
the FAQ)");
});
a.writeStackCookie = J;
a.checkStackCookie = K;
a.abortStackOverflow = function(b) {
  u("Stack overflow! Attempted to allocate " + b + " bytes on the stack, but 
stack has only " + (1712 - w() + b) + " bytes available!");
};
Object.getOwnPropertyDescriptor(a, "ALLOC_NORMAL") || Object.defineProperty(a, 
"ALLOC_NORMAL", {configurable:!0, get:function() {
  u("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
}});
Object.getOwnPropertyDescriptor(a, "ALLOC_STACK") || Object.defineProperty(a, 
"ALLOC_STACK", {configurable:!0, get:function() {
  u("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
}});
Object.getOwnPropertyDescriptor(a, "ALLOC_DYNAMIC") || Object.defineProperty(a, 
"ALLOC_DYNAMIC", {configurable:!0, get:function() {
  u("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
}});
Object.getOwnPropertyDescriptor(a, "ALLOC_NONE") || Object.defineProperty(a, 
"ALLOC_NONE", {configurable:!0, get:function() {
  u("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ)");
}});
Object.getOwnPropertyDescriptor(a, "calledRun") || Object.defineProperty(a, 
"calledRun", {configurable:!0, get:function() {
  u("'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS 
(see the FAQ). Alternatively, forcing filesystem support (-s 
FORCE_FILESYSTEM=1) can export this for you");
}});
var Y;
U = function Ba() {
  Y || Z();
  Y || (U = Ba);
};
function Z() {
  function b() {
    if (!Y && (Y = !0, !B)) {
      K();
      assert(!Q);
      Q = !0;
      O(ca);
      K();
      O(da);
      if (a.onRuntimeInitialized) {
        a.onRuntimeInitialized();
      }
      assert(!a._main, 'compiled without a main, but one is present. if you 
added it from JS, use Module["onRuntimeInitialized"]');
      K();
      if (a.postRun) {
        for ("function" == typeof a.postRun && (a.postRun = [a.postRun]); 
a.postRun.length;) {
          var b = a.postRun.shift();
          ea.unshift(b);
        }
      }
      O(ea);
    }
  }
  if (!(0 < S)) {
    J();
    if (a.preRun) {
      for ("function" == typeof a.preRun && (a.preRun = [a.preRun]); 
a.preRun.length;) {
        fa();
      }
    }
    O(P);
    0 < S || (a.setStatus ? (a.setStatus("Running..."), setTimeout(function() {
      setTimeout(function() {
        a.setStatus("");
      }, 1);
      b();
    }, 1)) : b(), K());
  }
}
a.run = Z;
if (a.preInit) {
  for ("function" == typeof a.preInit && (a.preInit = [a.preInit]); 0 < 
a.preInit.length;) {
    a.preInit.pop()();
  }
}
Z();

Reply via email to