#if STACK_OVERFLOW_CHECK
function writeStackCookie() {
var max = _emscripten_stack_get_end();
#if RUNTIME_DEBUG
dbg(`writeStackCookie: ${ptrToString(max)}`);
#endif
#if ASSERTIONS
assert((max & 3) == 0);
#endif
if (max == 0) {
max += 4;
}
{{{ makeSetValue('max', 0, '0x02135467', 'u32') }}};
{{{ makeSetValue('max', 4, '0x89BACDFE', 'u32') }}};
#if CHECK_NULL_WRITES
{{{ makeSetValue(0, 0, 0x63736d65 , 'u32') }}};
#endif
}
function checkStackCookie() {
#if !MINIMAL_RUNTIME
if (ABORT) return;
#endif
var max = _emscripten_stack_get_end();
#if RUNTIME_DEBUG >= 2
dbg(`checkStackCookie: ${ptrToString(max)}`);
#endif
if (max == 0) {
max += 4;
}
var cookie1 = {{{ makeGetValue('max', 0, 'u32') }}};
var cookie2 = {{{ makeGetValue('max', 4, 'u32') }}};
if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
}
#if CHECK_NULL_WRITES
if ({{{ makeGetValue(0, 0, 'u32') }}} != 0x63736d65 ) {
abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
}
#endif
}
#endif