// === Auto-generated preamble library stuff ===
//========================================
// Runtime code shared with compiler
//========================================
{{RUNTIME}}
Module['Runtime'] = Runtime;
#if ASM_JS
#if RESERVED_FUNCTION_POINTERS
function jsCall() {
var args = Array.prototype.slice.call(arguments);
return Runtime.functionPointers[args[0]].apply(null, args.slice(1));
}
#endif
#endif
#if BENCHMARK
Module.realPrint = Module.print;
Module.print = Module.printErr = function(){};
#endif
#if SAFE_HEAP
#if ASM_JS == 0
//========================================
// Debugging tools - Heap
//========================================
var HEAP_WATCHED = [];
var HEAP_HISTORY = [];
function SAFE_HEAP_CLEAR(dest) {
#if SAFE_HEAP_LOG
Module.print('SAFE_HEAP clear: ' + dest);
#endif
HEAP_HISTORY[dest] = undefined;
}
var SAFE_HEAP_ERRORS = 0;
var ACCEPTABLE_SAFE_HEAP_ERRORS = 0;
function SAFE_HEAP_ACCESS(dest, type, store, ignore, storeValue) {
//if (dest === A_NUMBER) Module.print ([dest, type, store, ignore, storeValue] + ' ' + stackTrace()); // Something like this may be useful, in debugging
if (dest <= 0) abort('segmentation fault ' + (store ? ('storing value ' + storeValue) : 'loading') + ' type ' + type + ' at address ' + dest);
#if USE_TYPED_ARRAYS
// When using typed arrays, reads over the top of TOTAL_MEMORY will fail silently, so we must
// correct that by growing TOTAL_MEMORY as needed. Without typed arrays, memory is a normal
// JS array so it will work (potentially slowly, depending on the engine).
if (!ignore && dest >= Math.max(DYNAMICTOP, STATICTOP)) abort('segmentation fault ' + (store ? ('storing value ' + storeValue) : 'loading') + ' type ' + type + ' at address ' + dest + '. Heap ends at address ' + Math.max(DYNAMICTOP