(function(window) {

  var modules = {};
  var _modules = {};
  var stack = {};

  // define(id, function(require, module, exports))
  function define(id, callback) {
    if (typeof id !== 'string' || id === '') throw Error('invalid module id ' + id);
    if (_modules[id]) throw Error('dupicated module id ' + id);
    if (typeof callback !== 'function') throw Error('invalid module function');

    _modules[id] = callback;
  }

  // require(id)
  function require(id) {
    if (!_modules[id]) throw Error('module ' + id + ' is not defined');
    if (stack[id]) throw Error(outputCircular());
    if (modules[id]) return modules[id].exports;

    var m = modules[id] = {
      id: id,
      require: require,
      exports: {}
    };

    stack[id] = true;
    _modules[id](require, m, m.exports);
    stack[id] = false;

    return m.exports;
  }

  function outputCircular() {
    s = 'circular:';
    for (var i in stack) {
      if (stack[i]) s += ' ' + i;
    }
    return s;
  }

  window.define = define;
  window.require = require;
})(global || window);

@@ -1,8 +1,9 @@
+;
 (functio
@@ -4,22 +4,23 @@
 unction(
-window
+context
 ) %7B%0A%0A  v
@@ -880,19 +880,22 @@
 ) %7B%0A    
-s =
+return
  'circul
@@ -901,105 +901,58 @@
 lar:
-';%0A    for (var i in stack) %7B%0A      if (stack%5Bi%5D) s += ' ' + i
+ ' + Object.keys(stack).join(', ')
 ;%0A  
- 
- 
 %7D
+%0A
 %0A  
-  return s;%0A  %7D%0A%0A  window
+context
 .def
@@ -967,22 +967,23 @@
 fine;%0A  
-window
+context
 .require
@@ -1001,23 +1001,53 @@
 %0A%7D)(
-global %7C%7C window
+typeof window !== 'undefined'? window : global
 );%0A

Fix window and global object