// total=81265 new=93.95% cached=0.00% other=6.05%
(function (ectx) {
'use strict';
const runtime = ectx.runtime;
const oops = ectx.oops;
const doNothing = ectx.doNothing;
const pxsim = ectx.pxsim;
const globals = ectx.globals;
const maybeYield = ectx.maybeYield;
const setupDebugger = ectx.setupDebugger;
const isBreakFrame = ectx.isBreakFrame;
const breakpoint = ectx.breakpoint;
const trace = ectx.trace;
const checkStack = ectx.checkStack;
const leave = ectx.leave;
const checkResumeConsumed = ectx.checkResumeConsumed;
const setupResume = ectx.setupResume;
const setupLambda = ectx.setupLambda;
const checkSubtype = ectx.checkSubtype;
const failedCast = ectx.failedCast;
const buildResume = ectx.buildResume;
const mkVTable = ectx.mkVTable;
const bind = ectx.bind;
const leaveAccessor = ectx.leaveAccessor;
const __this = runtime;
const pxtrt = pxsim.pxtrt;
let yieldSteps = 1;
ectx.setupYield(function() { yieldSteps = 100; })
pxsim.setTitle("esp32");
pxsim.setConfigData({}, {});
pxtrt.mapKeyNames = [
 "",
 "_busy",
 "_controller",
 "_cs",
 "_gpio0",
 "_isConnected",
 "_locked",
 "_reset",
 "_socknum_ll",
 "_spi",
 "eventID",
 "factory",
 "lastScanResults",
 "onConnectSSIDFailed",
 "reconnectRunning",
 "reset",
 "spiTransfer",
 "wasConnected"
];
__this.setupPerfCounters([]);
const pxsim_Array__getAt = pxsim.Array_.getAt;
const pxsim_Array__length = pxsim.Array_.length;
const pxsim_Array__mk = pxsim.Array_.mk;
const pxsim_Array__push = pxsim.Array_.push;
const pxsim_Boolean__bang = pxsim.Boolean_.bang;
const pxsim_String__concat = pxsim.String_.concat;
const pxsim_String__stringConv = pxsim.String_.stringConv;
const pxsim_numops_toBool = pxsim.numops.toBool;
const pxsim_numops_toBoolDecr = pxsim.numops.toBoolDecr;
const pxsim_pxtcore_mkAction = pxsim.pxtcore.mkAction;
const pxsim_pxtcore_mkClassInstance = pxsim.pxtcore.mkClassInstance;
const pxsim_pxtrt_ldlocRef = pxsim.pxtrt.ldlocRef;
const pxsim_pxtrt_mapGetByString = pxsim.pxtrt.mapGetByString;
const pxsim_pxtrt_stclo = pxsim.pxtrt.stclo;
const pxsim_pxtrt_stlocRef = pxsim.pxtrt.stlocRef;
const pxsim_Boolean_ = pxsim.Boolean_;
const pxsim_pxtcore = pxsim.pxtcore;
const pxsim_String_ = pxsim.String_;
const pxsim_ImageMethods = pxsim.ImageMethods;
const pxsim_Array_ = pxsim.Array_;
const pxsim_pxtrt = pxsim.pxtrt;
const pxsim_numops = pxsim.numops;


function _main___P108174(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    globals._evSource___108402 = (32768);
    globals._intervals___108417 = (undefined);
    globals._pollEventQueue___108430 = (undefined);
    globals.minPriority___108436 = (1);
    r0 = pxsim_Array__mk();
    s.tmp_0 = r0;
    r0 = pxsim_Array__push(s.tmp_0, listeners_inline__P108437);
    globals.listeners___108438 = (s.tmp_0);
    globals.RUN_KEY___108613 = ("#run");
    globals.SCOPE_KEY___108614 = ("#scope");
    s.tmp_0 = settings_initScopes__P108626_mk(s);
    s.callLocIdx = 22; s.pc = 1; return s.tmp_0;
  case 1:
    r0 = s.retval;
    globals.logPriority___108718 = (-1);
    r0 = pxsim_pxtcore_mkClassInstance(net_Net__C108728_VT);
    s.tmp_0 = r0;
    s.tmp_1 = net_Net_constructor__P108733_mk(s);
    s.tmp_1.arg0 = s.tmp_0;
    s.tmp_1.arg1 = esp32_defaultController__P108768;
    s.callLocIdx = 36; s.pc = 2; return s.tmp_1;
  case 2:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
_main___P108174.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"ninacontroller.ts","functionName":"<main>","argumentNames":[]}
_main___P108174.continuations = [  ]

function _main___P108174_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: _main___P108174, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
} }





function esp32_defaultController__P108768(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.cs___108956 = undefined;
    s.busy___108961 = undefined;
    s.reset___108966 = undefined;
    s.gpio0___108971 = undefined;
    s.mosi___108987 = undefined;
    s.miso___108992 = undefined;
    s.sck___108997 = undefined;
    s.spi___109002 = undefined;
    r0 = pxsim_numops_toBoolDecr(globals._defaultController___108767);
    if (!r0) { step = 1; continue; }
    r0 = globals._defaultController___108767;
    { step = 29; continue; }
  case 1:
  case 2:
    r0 = pxsim.pins.pinByCfg(87);
    s.cs___108956 = (r0);
    r0 = pxsim.pins.pinByCfg(88);
    s.busy___108961 = (r0);
    r0 = pxsim.pins.pinByCfg(89);
    s.reset___108966 = (r0);
    r0 = pxsim.pins.pinByCfg(90);
    s.gpio0___108971 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.cs___108956);
    s.tmp_3 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_3);
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_2);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 3; continue; }
    r0 = s.tmp_0;
    { step = 4; continue; }
  case 3:
    r0 = pxsim_numops_toBoolDecr(s.busy___108961);
    s.tmp_6 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_6);
    s.tmp_5 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_5);
    s.tmp_4 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_4);
  case 4:
    // jmp value (already in r0)
    s.tmp_7 = r0;
    r0 = pxsim_numops_toBool(s.tmp_7);
    if (r0) { step = 5; continue; }
    r0 = s.tmp_7;
    { step = 6; continue; }
  case 5:
    r0 = pxsim_numops_toBoolDecr(s.reset___108966);
    s.tmp_10 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_10);
    s.tmp_9 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_9);
    s.tmp_8 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_8);
  case 6:
    // jmp value (already in r0)
    s.tmp_11 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_11);
    if (!r0) { step = 21; continue; }
    r0 = pxsim.pins.pinByCfg(82);
    s.mosi___108987 = (r0);
    r0 = pxsim.pins.pinByCfg(83);
    s.miso___108992 = (r0);
    r0 = pxsim.pins.pinByCfg(84);
    s.sck___108997 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.mosi___108987);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 7; continue; }
    r0 = s.tmp_0;
    { step = 8; continue; }
  case 7:
    r0 = pxsim_numops_toBoolDecr(s.miso___108992);
    s.tmp_2 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_2);
  case 8:
    // jmp value (already in r0)
    s.tmp_3 = r0;
    r0 = pxsim_numops_toBool(s.tmp_3);
    if (r0) { step = 9; continue; }
    r0 = s.tmp_3;
    { step = 10; continue; }
  case 9:
    r0 = pxsim_numops_toBoolDecr(s.sck___108997);
    s.tmp_4 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_4);
  case 10:
    // jmp value (already in r0)
    s.tmp_5 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_5);
    if (!r0) { step = 11; continue; }
    s.tmp_6 = pins_spi__P108549_mk(s);
    s.callLocIdx = 31; s.pc = 30; return s.tmp_6;
  case 30:
    r0 = s.retval;
    s.spi___109002 = (r0);
    { step = 18; continue; }
  case 11:
    s.tmp_0 = r0 = s.mosi___108987;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 12; continue; }
    r0 = s.tmp_0;
    { step = 13; continue; }
  case 12:
    r0 = s.miso___108992;
  case 13:
    // jmp value (already in r0)
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBool(s.tmp_1);
    if (r0) { step = 14; continue; }
    r0 = s.tmp_1;
    { step = 15; continue; }
  case 14:
    r0 = s.sck___108997;
  case 15:
    // jmp value (already in r0)
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_2);
    if (!r0) { step = 16; continue; }
    r0 = pxsim.pins.createSPI(s.mosi___108987, s.miso___108992, s.sck___108997);
    s.spi___109002 = (r0);
    { step = 17; continue; }
  case 16:
    s.tmp_0 = net_log__P108719_mk(s);
    s.tmp_0.arg0 = "esp32 spi configuration error";
    s.callLocIdx = 32; s.pc = 31; return s.tmp_0;
  case 31:
    r0 = s.retval;
    r0 = pxsim_pxtrt.panic(90);
  case 17:
  case 18:
    r0 = pxsim_numops_toBoolDecr(s.spi___109002);
    if (!r0) { step = 19; continue; }
    r0 = pxsim_pxtcore_mkClassInstance(esp32_NinaController__C108903_VT);
    s.tmp_0 = r0;
    s.tmp_1 = esp32_NinaController_constructor__P108952_mk(s);
    s.tmp_1.arg0 = s.tmp_0;
    s.tmp_1.arg1 = s.spi___109002;
    s.tmp_1.arg2 = s.cs___108956;
    s.tmp_1.arg3 = s.busy___108961;
    s.tmp_1.arg4 = s.reset___108966;
    s.tmp_1.arg5 = s.gpio0___108971;
    s.callLocIdx = 33; s.pc = 32; return s.tmp_1;
  case 32:
    r0 = s.retval;
    globals._defaultController___108767 = (s.tmp_0);
    r0 = s.tmp_0;
    { step = 29; continue; }
  case 19:
  case 20:
    { step = 28; continue; }
  case 21:
    r0 = pxsim_numops_toBoolDecr(s.cs___108956);
    s.tmp_3 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_3);
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBool(s.tmp_2);
    if (r0) { step = 22; continue; }
    r0 = s.tmp_2;
    { step = 23; continue; }
  case 22:
    r0 = pxsim_numops_toBoolDecr(s.busy___108961);
    s.tmp_4 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_4);
  case 23:
    // jmp value (already in r0)
    s.tmp_5 = r0;
    r0 = pxsim_numops_toBool(s.tmp_5);
    if (r0) { step = 24; continue; }
    r0 = s.tmp_5;
    { step = 25; continue; }
  case 24:
    r0 = pxsim_numops_toBoolDecr(s.reset___108966);
    s.tmp_6 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_6);
  case 25:
    // jmp value (already in r0)
    s.tmp_7 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_7);
    if (!r0) { step = 26; continue; }
    r0 = undefined;
    { step = 29; continue; }
    { step = 27; continue; }
  case 26:
    s.tmp_8 = net_log__P108719_mk(s);
    s.tmp_8.arg0 = "esp32 partially configured";
    s.callLocIdx = 34; s.pc = 33; return s.tmp_8;
  case 33:
    r0 = s.retval;
    r0 = pxsim_pxtrt.panic(90);
  case 27:
  case 28:
    s.tmp_0 = net_log__P108719_mk(s);
    s.tmp_0.arg0 = "esp32 configuration error";
    s.callLocIdx = 35; s.pc = 34; return s.tmp_0;
  case 34:
    r0 = s.retval;
    r0 = pxsim_pxtrt.panic(90);
    r0 = undefined;
  case 29:
    return leave(s, r0)
  default: oops()
} } }
esp32_defaultController__P108768.info = {"start":66,"length":2003,"line":2,"column":4,"endLine":49,"endColumn":5,"fileName":"net.ts","functionName":"defaultController","argumentNames":[]}

function esp32_defaultController__P108768_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: esp32_defaultController__P108768, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  tmp_5: undefined,
  tmp_6: undefined,
  tmp_7: undefined,
  tmp_8: undefined,
  tmp_9: undefined,
  tmp_10: undefined,
  tmp_11: undefined,
  cs___108956: undefined,
  busy___108961: undefined,
  reset___108966: undefined,
  gpio0___108971: undefined,
  mosi___108987: undefined,
  miso___108992: undefined,
  sck___108997: undefined,
  spi___109002: undefined,
} }





function esp32_NinaController_constructor__P108952(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.arg2 = (s.lambdaArgs[2]);
      s.arg3 = (s.lambdaArgs[3]);
      s.arg4 = (s.lambdaArgs[4]);
      s.arg5 = (s.lambdaArgs[5]);
      s.lambdaArgs = null;
    }
    r0 = s.arg0;
    if (!checkSubtype(r0, esp32_NinaController__C108903_VT)) failedCast(r0);
    r0 = (s.arg0).fields["_spi"] = (s.arg1);
    r0 = (s.arg0).fields["_cs"] = (s.arg2);
    r0 = (s.arg0).fields["_busy"] = (s.arg3);
    r0 = (s.arg0).fields["_reset"] = (s.arg4);
    r0 = (s.arg0).fields["_gpio0"] = (s.arg5);
    r0 = (s.arg0).fields["_isConnected"] = (false);
    s.tmp_0 = net_Controller_constructor__P108689_mk(s);
    s.tmp_0.arg0 = s.arg0;
    s.callLocIdx = 37; s.pc = 1; return s.tmp_0;
  case 1:
    r0 = s.retval;
    r0 = s.arg0.fields["_busy"];
    s.tmp_0 = r0;
    r0 = pxsim.DigitalInOutPinMethods.setPull(s.tmp_0, 0);
    r0 = s.arg0.fields["_busy"];
    s.tmp_0 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalRead(s.tmp_0);
    r0 = pxsim_Array__mk();
    s.tmp_0 = r0;
    s.tmp_2 = esp32_buffer1__P108902_mk(s);
    s.tmp_2.arg0 = 0;
    s.callLocIdx = 38; s.pc = 2; return s.tmp_2;
  case 2:
    r0 = s.retval;
    s.tmp_1 = r0;
    r0 = pxsim_Array__push(s.tmp_0, s.tmp_1);
    r0 = (s.arg0).fields["_socknum_ll"] = (s.tmp_0);
    r0 = s.arg0.fields["_spi"];
    s.tmp_0 = r0;
    r0 = pxsim.SPIMethods.setFrequency(s.tmp_0, 8000000);
    s.tmp_0 = esp32_NinaController_reset__P108905_mk(s);
    s.tmp_0.arg0 = s.arg0;
    s.callLocIdx = 39; s.pc = 3; return s.tmp_0;
  case 3:
    r0 = s.retval;
    r0 = (s.arg0).fields["_locked"] = (false);
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
esp32_NinaController_constructor__P108952.info = {"start":2637,"length":644,"line":80,"column":8,"endLine":96,"endColumn":9,"fileName":"ninacontroller.ts","functionName":"inline","argumentNames":["this","_spi","_cs","_busy","_reset","_gpio0"]}

function esp32_NinaController_constructor__P108952_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: esp32_NinaController_constructor__P108952, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
  arg3: undefined,
  arg4: undefined,
  arg5: undefined,
} }





function esp32_NinaController_reset__P108905(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = s.arg0;
    if (!checkSubtype(r0, esp32_NinaController__C108903_VT)) failedCast(r0);
    r0 = s.arg0.fields["_gpio0"];
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.arg0.fields["_gpio0"];
    s.tmp_1 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalWrite(s.tmp_1, true);
  case 1:
  case 2:
    r0 = s.arg0.fields["_cs"];
    s.tmp_0 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalWrite(s.tmp_0, true);
    r0 = s.arg0.fields["_reset"];
    s.tmp_0 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalWrite(s.tmp_0, false);
    s.tmp_0 = pause__P108494_mk(s);
    s.tmp_0.arg0 = 10;
    s.callLocIdx = 40; s.pc = 5; return s.tmp_0;
  case 5:
    r0 = s.retval;
    r0 = s.arg0.fields["_reset"];
    s.tmp_0 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalWrite(s.tmp_0, true);
    s.tmp_0 = pause__P108494_mk(s);
    s.tmp_0.arg0 = 750;
    s.callLocIdx = 41; s.pc = 6; return s.tmp_0;
  case 6:
    r0 = s.retval;
    r0 = s.arg0.fields["_gpio0"];
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 3; continue; }
    r0 = s.arg0.fields["_gpio0"];
    s.tmp_1 = r0;
    r0 = pxsim.DigitalInOutPinMethods.digitalRead(s.tmp_1);
  case 3:
  case 4:
    s.tmp_0 = esp32_NinaController_spiTransfer__P108911_mk(s);
    s.tmp_0.arg0 = s.arg0;
    r0 = pxsim.control.createBuffer(1);
    s.tmp_0.arg1 = r0;
    s.tmp_0.arg2 = null;
    s.callLocIdx = 42; s.pc = 7; return s.tmp_0;
  case 7:
    r0 = s.retval;
    s.tmp_0 = net_log__P108719_mk(s);
    s.tmp_0.arg0 = "reseted esp32";
    s.callLocIdx = 43; s.pc = 8; return s.tmp_0;
  case 8:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
esp32_NinaController_reset__P108905.info = {"start":3368,"length":574,"line":101,"column":8,"endLine":116,"endColumn":9,"fileName":"ninacontroller.ts","functionName":"reset","argumentNames":["this"]}

function esp32_NinaController_reset__P108905_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: esp32_NinaController_reset__P108905, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  arg0: undefined,
} }





function esp32_NinaController_spiTransfer__P108911(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.arg2 = (s.lambdaArgs[2]);
      s.lambdaArgs = null;
    }
    r0 = s.arg0;
    if (!checkSubtype(r0, esp32_NinaController__C108903_VT)) failedCast(r0);
    r0 = pxsim_numops_toBoolDecr(s.arg1);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = pxsim.BufferMethods.length(s.arg2);
    s.tmp_2 = r0;
    r0 = pxsim.control.createBuffer(s.tmp_2);
    s.arg1 = (r0);
  case 1:
  case 2:
    r0 = pxsim_numops_toBoolDecr(s.arg2);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 3; continue; }
    r0 = pxsim.BufferMethods.length(s.arg1);
    s.tmp_2 = r0;
    r0 = pxsim.control.createBuffer(s.tmp_2);
    s.arg2 = (r0);
  case 3:
  case 4:
    r0 = s.arg0.fields["_spi"];
    s.tmp_0 = r0;
    r0 = pxsim.SPIMethods.transfer(s.tmp_0, s.arg1, s.arg2);
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
esp32_NinaController_spiTransfer__P108911.info = {"start":6899,"length":211,"line":207,"column":8,"endLine":211,"endColumn":9,"fileName":"ninacontroller.ts","functionName":"spiTransfer","argumentNames":["this","tx","rx"]}

function esp32_NinaController_spiTransfer__P108911_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: esp32_NinaController_spiTransfer__P108911, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
} }





function pause__P108494(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    setupResume(s, 1);
    pxsim.loops.pause(s.arg0);
    checkResumeConsumed();
    return;
  case 1:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
pause__P108494.info = {"start":246,"length":57,"line":7,"column":0,"endLine":9,"endColumn":1,"fileName":"pxt_modules/base/pause.ts","functionName":"pause","argumentNames":["ms"]}

function pause__P108494_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: pause__P108494, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  arg0: undefined,
} }





function esp32_buffer1__P108902(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.b___109153 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.control.createBuffer(1);
    s.b___109153 = (r0);
    r0 = pxsim.BufferMethods.setByte(s.b___109153, 0, s.arg0);
    r0 = s.b___109153;
    return leave(s, r0)
  default: oops()
} } }
esp32_buffer1__P108902.info = {"start":2344,"length":113,"line":68,"column":4,"endLine":72,"endColumn":5,"fileName":"ninacontroller.ts","functionName":"buffer1","argumentNames":["ch"]}

function esp32_buffer1__P108902_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: esp32_buffer1__P108902, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  b___109153: undefined,
  arg0: undefined,
} }





function net_Controller_constructor__P108689(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = s.arg0;
    if (!checkSubtype(r0, net_Controller__C108659_VT)) failedCast(r0);
    r0 = (s.arg0).fields["_isConnected"] = (false);
    s.tmp_0 = r0 = s.arg0;
    s.tmp_2 = control_allocateEventSource__P108403_mk(s);
    s.callLocIdx = 29; s.pc = 1; return s.tmp_2;
  case 1:
    r0 = s.retval;
    s.tmp_1 = r0;
    r0 = (s.tmp_0).fields["eventID"] = (s.tmp_1);
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
net_Controller_constructor__P108689.info = {"start":415,"length":82,"line":17,"column":8,"endLine":19,"endColumn":9,"fileName":"pxt_modules/net/controller.ts","functionName":"inline","argumentNames":["this"]}

function net_Controller_constructor__P108689_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: net_Controller_constructor__P108689, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  arg0: undefined,
} }





function control_allocateEventSource__P108403(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    r0 = (globals._evSource___108402 + 1);
    s.tmp_0 = r0;
    globals._evSource___108402 = (r0);
    r0 = s.tmp_0;
    return leave(s, r0)
  default: oops()
} } }
control_allocateEventSource__P108403.info = {"start":2528,"length":72,"line":85,"column":4,"endLine":87,"endColumn":5,"fileName":"pxt_modules/base/control.ts","functionName":"allocateEventSource","argumentNames":[]}

function control_allocateEventSource__P108403_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: control_allocateEventSource__P108403, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
} }





function net_log__P108719(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    s.tmp_0 = console_add__P108439_mk(s);
    s.tmp_0.arg0 = globals.logPriority___108718;
    if ((s.arg0) && (s.arg0).vtable) {
    setupResume(s, 2);
    pxsim_String__stringConv(s.arg0);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg0) + ""; }
  case 2:
    r0 = s.retval;
    s.tmp_1 = r0;
    r0 = pxsim_String__concat("net:", s.tmp_1);
    s.tmp_0.arg1 = r0;
    s.callLocIdx = 30; s.pc = 1; return s.tmp_0;
  case 1:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
net_log__P108719.info = {"start":238,"length":88,"line":11,"column":4,"endLine":13,"endColumn":5,"fileName":"pxt_modules/net/net.ts","functionName":"log","argumentNames":["msg"]}

function net_log__P108719_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: net_log__P108719, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  arg0: undefined,
} }





function console_add__P108439(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.text___109182 = undefined;
    s.i___109191 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = (s.arg0 < globals.minPriority___108436);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    { step = 5; continue; }
  case 1:
  case 2:
    s.tmp_1 = console_inspect__P108445_mk(s);
    s.tmp_1.arg0 = s.arg1;
    s.tmp_1.arg1 = 20;
    s.callLocIdx = 9; s.pc = 6; return s.tmp_1;
  case 6:
    r0 = s.retval;
    s.text___109182 = (r0);
    if ((s.text___109182) && (s.text___109182).vtable) {
    setupResume(s, 7);
    pxsim_String__stringConv(s.text___109182);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.text___109182) + ""; }
  case 7:
    r0 = s.retval;
    s.tmp_0 = r0;
    r0 = pxsim_String__concat(s.tmp_0, "\n");
    s.text___109182 = (r0);
    s.i___109191 = (0);
  case 3:
    s.tmp_1 = r0 = s.i___109191;
    r0 = pxsim_Array__length(globals.listeners___108438);
    s.tmp_2 = r0;
    r0 = (s.tmp_1 < s.tmp_2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 4; continue; }
    s.tmp_3 = lambda_3_mk(s);
    r0 = pxsim_Array__getAt(globals.listeners___108438, s.i___109191);
    s.tmp_3.argL = r0;
    s.tmp_3.arg0 = s.arg0;
    s.tmp_3.arg1 = s.text___109182;
    setupLambda(s.tmp_3, s.tmp_3.argL);
    s.callLocIdx = 10; s.pc = 8; return s.tmp_3;
  case 8:
    r0 = s.retval;
    r0 = (s.i___109191 + 1);
    s.i___109191 = (r0);
    { step = 3; continue; }
  case 4:
  case 5:
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
console_add__P108439.info = {"start":632,"length":317,"line":28,"column":4,"endLine":36,"endColumn":5,"fileName":"pxt_modules/base/console.ts","functionName":"add","argumentNames":["priority","message"]}

function console_add__P108439_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: console_add__P108439, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  text___109182: undefined,
  i___109191: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function listeners_inline__P108437(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.control.__log(s.arg0, s.arg1);
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
listeners_inline__P108437.info = {"start":534,"length":85,"line":25,"column":8,"endLine":25,"endColumn":93,"fileName":"pxt_modules/base/console.ts","functionName":"inline","argumentNames":["priority","text"]}

function listeners_inline__P108437_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: listeners_inline__P108437, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  arg0: undefined,
  arg1: undefined,
} }





function console_inspect__P108445(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.asArr___109230 = undefined;
    s.asString___109250 = undefined;
    s.keys___109262 = undefined;
    s.snipped___109266 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_pxtcore.typeOf(s.arg0);
    s.tmp_1 = r0;
    r0 = (s.tmp_1 == "string");
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.arg0;
    { step = 17; continue; }
    { step = 16; continue; }
  case 1:
    r0 = pxsim_pxtcore.typeOf(s.arg0);
    s.tmp_3 = r0;
    r0 = (s.tmp_3 == "number");
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_2);
    if (!r0) { step = 2; continue; }
    r0 = pxsim_String_.mkEmpty();
    s.tmp_4 = r0;
    if ((s.arg0) && (s.arg0).vtable) {
    setupResume(s, 18);
    pxsim_String__stringConv(s.arg0);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg0) + ""; }
  case 18:
    r0 = s.retval;
    s.tmp_5 = r0;
    r0 = pxsim_String__concat(s.tmp_4, s.tmp_5);
    { step = 17; continue; }
    { step = 15; continue; }
  case 2:
    r0 = pxsim_Array_.isArray(s.arg0);
    s.tmp_6 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_6);
    if (!r0) { step = 5; continue; }
    s.asArr___109230 = (s.arg0);
    r0 = pxsim_Array__length(s.asArr___109230);
    s.tmp_1 = r0;
    r0 = (s.tmp_1 <= s.arg1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 3; continue; }
    s.tmp_2 = helpers_arrayJoin__P108225_mk(s);
    s.tmp_2.arg0 = s.asArr___109230;
    s.tmp_2.arg1 = ",";
    s.callLocIdx = 11; s.pc = 19; return s.tmp_2;
  case 19:
    r0 = s.retval;
    { step = 17; continue; }
    { step = 4; continue; }
  case 3:
    r0 = pxsim_String_.mkEmpty();
    s.tmp_4 = r0;
    s.tmp_7 = helpers_arrayJoin__P108225_mk(s);
    s.tmp_8 = helpers_arraySlice__P108239_mk(s);
    s.tmp_8.arg0 = s.asArr___109230;
    s.tmp_8.arg1 = 0;
    s.tmp_8.arg2 = s.arg1;
    s.callLocIdx = 12; s.pc = 21; return s.tmp_8;
  case 21:
    r0 = s.retval;
    s.tmp_7.arg0 = r0;
    s.tmp_7.arg1 = ",";
    s.callLocIdx = 13; s.pc = 20; return s.tmp_7;
  case 20:
    r0 = s.retval;
    s.tmp_6 = r0;
    if ((s.tmp_6) && (s.tmp_6).vtable) {
    setupResume(s, 22);
    pxsim_String__stringConv(s.tmp_6);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_6) + ""; }
  case 22:
    r0 = s.retval;
    s.tmp_5 = r0;
    r0 = pxsim_String__concat(s.tmp_4, s.tmp_5);
    s.tmp_3 = r0;
    r0 = pxsim_String__concat(s.tmp_3, "...");
    { step = 17; continue; }
  case 4:
    { step = 14; continue; }
  case 5:
    if ((s.arg0) && (s.arg0).vtable) {
    setupResume(s, 23);
    pxsim_String__stringConv(s.arg0);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg0) + ""; }
  case 23:
    r0 = s.retval;
    s.tmp_9 = r0;
    r0 = pxsim_String_.mkEmpty();
    s.tmp_10 = r0;
    r0 = pxsim_String__concat(s.tmp_9, s.tmp_10);
    s.asString___109250 = (r0);
    r0 = (s.asString___109250 != "[object Object]");
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 6; continue; }
    r0 = s.tmp_0;
    { step = 7; continue; }
  case 6:
    r0 = (s.asString___109250 != "[Object]");
  case 7:
    // jmp value (already in r0)
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_1);
    if (!r0) { step = 8; continue; }
    r0 = s.asString___109250;
    { step = 17; continue; }
  case 8:
  case 9:
    r0 = pxsim_pxtrt.keysOf(s.arg0);
    s.keys___109262 = (r0);
    r0 = pxsim_Array__length(s.keys___109262);
    s.tmp_0 = r0;
    r0 = (s.tmp_0 > s.arg1);
    s.snipped___109266 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.snipped___109266);
    if (!r0) { step = 10; continue; }
    s.tmp_0 = helpers_arraySlice__P108239_mk(s);
    s.tmp_0.arg0 = s.keys___109262;
    s.tmp_0.arg1 = 0;
    s.tmp_0.arg2 = s.arg1;
    s.callLocIdx = 14; s.pc = 24; return s.tmp_0;
  case 24:
    r0 = s.retval;
    s.keys___109262 = (r0);
  case 10:
  case 11:
    r0 = pxsim_pxtcore_mkAction(1, console_inspect_inline__P109284);
    s.tmp_0 = r0;
    r0 = pxsim_pxtrt_stclo(s.tmp_0, 0, s.arg0);
    r0 = pxsim_numops_toBoolDecr(s.snipped___109266);
    if (!r0) { step = 12; continue; }
    r0 = "\n    ...";
    { step = 13; continue; }
  case 12:
    r0 = pxsim_String_.mkEmpty();
  case 13:
    // jmp value (already in r0)
    s.tmp_1 = r0;
    s.tmp_7 = helpers_arrayReduce__P108236_mk(s);
    s.tmp_7.arg0 = s.keys___109262;
    s.tmp_7.arg1 = s.tmp_0;
    r0 = pxsim_String_.mkEmpty();
    s.tmp_7.arg2 = r0;
    s.callLocIdx = 15; s.pc = 25; return s.tmp_7;
  case 25:
    r0 = s.retval;
    s.tmp_6 = r0;
    if ((s.tmp_6) && (s.tmp_6).vtable) {
    setupResume(s, 26);
    pxsim_String__stringConv(s.tmp_6);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_6) + ""; }
  case 26:
    r0 = s.retval;
    s.tmp_5 = r0;
    if ((s.tmp_1) && (s.tmp_1).vtable) {
    setupResume(s, 27);
    pxsim_String__stringConv(s.tmp_1);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_1) + ""; }
  case 27:
    r0 = s.retval;
    s.tmp_8 = r0;
    r0 = pxsim_String__concat(s.tmp_5, s.tmp_8);
    s.tmp_4 = r0;
    if ((s.tmp_4) && (s.tmp_4).vtable) {
    setupResume(s, 28);
    pxsim_String__stringConv(s.tmp_4);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_4) + ""; }
  case 28:
    r0 = s.retval;
    s.tmp_3 = r0;
    r0 = pxsim_String__concat("{", s.tmp_3);
    s.tmp_2 = r0;
    r0 = pxsim_String__concat(s.tmp_2, "\n}");
    { step = 17; continue; }
  case 14:
  case 15:
  case 16:
    r0 = undefined;
  case 17:
    return leave(s, r0)
  default: oops()
} } }
console_inspect__P108445.info = {"start":2271,"length":1190,"line":81,"column":4,"endLine":114,"endColumn":5,"fileName":"pxt_modules/base/console.ts","functionName":"inspect","argumentNames":["obj","maxElements"]}

function console_inspect__P108445_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: console_inspect__P108445, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  tmp_5: undefined,
  tmp_6: undefined,
  tmp_7: undefined,
  tmp_8: undefined,
  tmp_9: undefined,
  tmp_10: undefined,
  asArr___109230: undefined,
  asString___109250: undefined,
  keys___109262: undefined,
  snipped___109266: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function console_inspect_inline__P109284(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    if ((s.arg0) && (s.arg0).vtable) {
    setupResume(s, 1);
    pxsim_String__stringConv(s.arg0);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg0) + ""; }
  case 1:
    r0 = s.retval;
    s.tmp_0 = r0;
    if ((s.arg1) && (s.arg1).vtable) {
    setupResume(s, 2);
    pxsim_String__stringConv(s.arg1);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg1) + ""; }
  case 2:
    r0 = s.retval;
    s.tmp_5 = r0;
    r0 = pxsim_String__concat("\n    ", s.tmp_5);
    s.tmp_4 = r0;
    r0 = pxsim_String__concat(s.tmp_4, ": ");
    s.tmp_3 = r0;
    r0 = pxsim_pxtrt.mapGetGeneric(s.caps[0], s.arg1);
    s.tmp_7 = r0;
    if ((s.tmp_7) && (s.tmp_7).vtable) {
    setupResume(s, 3);
    pxsim_String__stringConv(s.tmp_7);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_7) + ""; }
  case 3:
    r0 = s.retval;
    s.tmp_6 = r0;
    r0 = pxsim_String__concat(s.tmp_3, s.tmp_6);
    s.tmp_2 = r0;
    if ((s.tmp_2) && (s.tmp_2).vtable) {
    setupResume(s, 4);
    pxsim_String__stringConv(s.tmp_2);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_2) + ""; }
  case 4:
    r0 = s.retval;
    s.tmp_1 = r0;
    r0 = pxsim_String__concat(s.tmp_0, s.tmp_1);
    return leave(s, r0)
  default: oops()
} } }
console_inspect_inline__P109284.info = {"start":3293,"length":61,"line":108,"column":20,"endLine":108,"endColumn":81,"fileName":"pxt_modules/base/console.ts","functionName":"inline","argumentNames":["prev","currKey"]}

function console_inspect_inline__P109284_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: console_inspect_inline__P109284, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  tmp_5: undefined,
  tmp_6: undefined,
  tmp_7: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function helpers_arrayReduce__P108236(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.len___109311 = undefined;
    s.i___109314 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.arg2 = (s.lambdaArgs[2]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_Array__length(s.arg0);
    s.len___109311 = (r0);
    s.i___109314 = (0);
  case 1:
    r0 = (s.i___109314 < s.len___109311);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 2; continue; }
    s.tmp_1 = lambda_4_mk(s);
    s.tmp_1.argL = s.arg1;
    s.tmp_1.arg0 = s.arg2;
    r0 = pxsim_Array__getAt(s.arg0, s.i___109314);
    s.tmp_1.arg1 = r0;
    s.tmp_1.arg2 = s.i___109314;
    setupLambda(s.tmp_1, s.tmp_1.argL);
    s.callLocIdx = 0; s.pc = 3; return s.tmp_1;
  case 3:
    r0 = s.retval;
    s.arg2 = (r0);
    r0 = (s.i___109314 + 1);
    s.i___109314 = (r0);
    { step = 1; continue; }
  case 2:
    r0 = s.arg2;
    return leave(s, r0)
  default: oops()
} } }
helpers_arrayReduce__P108236.info = {"start":8316,"length":317,"line":280,"column":4,"endLine":286,"endColumn":5,"fileName":"pxt_modules/base/pxt-helpers.ts","functionName":"arrayReduce","argumentNames":["arr","callbackfn","initialValue"]}

function helpers_arrayReduce__P108236_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: helpers_arrayReduce__P108236, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  len___109311: undefined,
  i___109314: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
} }





function helpers_arraySlice__P108239(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.res___109332 = undefined;
    s.len___109334 = undefined;
    s.i___109368 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.arg2 = (s.lambdaArgs[2]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_Array__mk();
    s.res___109332 = (r0);
    r0 = pxsim_Array__length(s.arg0);
    s.len___109334 = (r0);
    r0 = (s.arg1 === undefined);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    s.arg1 = (0);
    { step = 4; continue; }
  case 1:
    r0 = (s.arg1 < 0);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 2; continue; }
    s.tmp_1 = Math_max__P108255_mk(s);
    r0 = (s.len___109334 + s.arg1);
    s.tmp_1.arg0 = r0;
    s.tmp_1.arg1 = 0;
    s.callLocIdx = 1; s.pc = 16; return s.tmp_1;
  case 16:
    r0 = s.retval;
    s.arg1 = (r0);
  case 2:
  case 3:
  case 4:
    r0 = (s.arg1 > s.len___109334);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 5; continue; }
    r0 = s.res___109332;
    { step = 15; continue; }
  case 5:
  case 6:
    r0 = (s.arg2 === undefined);
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_1);
    if (!r0) { step = 7; continue; }
    s.arg2 = (s.len___109334);
    { step = 10; continue; }
  case 7:
    r0 = (s.arg2 < 0);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 8; continue; }
    r0 = (s.len___109334 + s.arg2);
    s.arg2 = (r0);
  case 8:
  case 9:
  case 10:
    r0 = (s.arg2 > s.len___109334);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 11; continue; }
    s.arg2 = (s.len___109334);
  case 11:
  case 12:
    s.i___109368 = (s.arg1);
  case 13:
    r0 = (s.i___109368 < s.arg2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 14; continue; }
    s.tmp_1 = r0 = s.res___109332;
    r0 = pxsim_Array__getAt(s.arg0, s.i___109368);
    s.tmp_2 = r0;
    r0 = pxsim_Array__push(s.tmp_1, s.tmp_2);
    r0 = (s.i___109368 + 1);
    s.i___109368 = (r0);
    { step = 13; continue; }
  case 14:
    r0 = s.res___109332;
  case 15:
    return leave(s, r0)
  default: oops()
} } }
helpers_arraySlice__P108239.info = {"start":9027,"length":690,"line":303,"column":4,"endLine":328,"endColumn":5,"fileName":"pxt_modules/base/pxt-helpers.ts","functionName":"arraySlice","argumentNames":["arr","start","end"]}

function helpers_arraySlice__P108239_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: helpers_arraySlice__P108239, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  res___109332: undefined,
  len___109334: undefined,
  i___109368: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
} }





function Math_max__P108255(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = (s.arg0 >= s.arg1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.arg0;
    { step = 3; continue; }
  case 1:
  case 2:
    r0 = s.arg1;
  case 3:
    return leave(s, r0)
  default: oops()
} } }
Math_max__P108255.info = {"start":16614,"length":105,"line":558,"column":4,"endLine":561,"endColumn":5,"fileName":"pxt_modules/base/pxt-helpers.ts","functionName":"max","argumentNames":["a","b"]}

function Math_max__P108255_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: Math_max__P108255, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function helpers_arrayJoin__P108225(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.r___109401 = undefined;
    s.len___109402 = undefined;
    s.i___109405 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = (s.arg1 === undefined);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.tmp_0;
    { step = 2; continue; }
  case 1:
    r0 = (s.arg1 === null);
  case 2:
    // jmp value (already in r0)
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_1);
    if (!r0) { step = 3; continue; }
    s.arg1 = (",");
  case 3:
  case 4:
    r0 = pxsim_String_.mkEmpty();
    s.r___109401 = (r0);
    r0 = pxsim_Array__length(s.arg0);
    s.len___109402 = (r0);
    s.i___109405 = (0);
  case 5:
    r0 = (s.i___109405 < s.len___109402);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 14; continue; }
    r0 = (s.i___109405 > 0);
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBool(s.tmp_1);
    if (r0) { step = 6; continue; }
    r0 = s.tmp_1;
    { step = 7; continue; }
  case 6:
    r0 = s.arg1;
  case 7:
    // jmp value (already in r0)
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_2);
    if (!r0) { step = 8; continue; }
    if ((s.r___109401) && (s.r___109401).vtable) {
    setupResume(s, 15);
    pxsim_String__stringConv(s.r___109401);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.r___109401) + ""; }
  case 15:
    r0 = s.retval;
    s.tmp_3 = r0;
    if ((s.arg1) && (s.arg1).vtable) {
    setupResume(s, 16);
    pxsim_String__stringConv(s.arg1);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.arg1) + ""; }
  case 16:
    r0 = s.retval;
    s.tmp_4 = r0;
    r0 = pxsim_String__concat(s.tmp_3, s.tmp_4);
    s.r___109401 = (r0);
  case 8:
  case 9:
    r0 = pxsim_Array__getAt(s.arg0, s.i___109405);
    s.tmp_1 = r0;
    r0 = (s.tmp_1 === undefined);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (!r0) { step = 10; continue; }
    r0 = s.tmp_0;
    { step = 11; continue; }
  case 10:
    r0 = pxsim_Array__getAt(s.arg0, s.i___109405);
    s.tmp_2 = r0;
    r0 = (s.tmp_2 === null);
  case 11:
    // jmp value (already in r0)
    s.tmp_3 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_3);
    if (!r0) { step = 12; continue; }
    r0 = pxsim_String_.mkEmpty();
    { step = 13; continue; }
  case 12:
    r0 = pxsim_Array__getAt(s.arg0, s.i___109405);
  case 13:
    // jmp value (already in r0)
    s.tmp_4 = r0;
    if ((s.r___109401) && (s.r___109401).vtable) {
    setupResume(s, 17);
    pxsim_String__stringConv(s.r___109401);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.r___109401) + ""; }
  case 17:
    r0 = s.retval;
    s.tmp_5 = r0;
    if ((s.tmp_4) && (s.tmp_4).vtable) {
    setupResume(s, 18);
    pxsim_String__stringConv(s.tmp_4);
    checkResumeConsumed();
    return;
    } else { s.retval = (s.tmp_4) + ""; }
  case 18:
    r0 = s.retval;
    s.tmp_6 = r0;
    r0 = pxsim_String__concat(s.tmp_5, s.tmp_6);
    s.r___109401 = (r0);
    r0 = (s.i___109405 + 1);
    s.i___109405 = (r0);
    { step = 5; continue; }
  case 14:
    r0 = s.r___109401;
    return leave(s, r0)
  default: oops()
} } }
helpers_arrayJoin__P108225.info = {"start":4133,"length":432,"line":157,"column":4,"endLine":170,"endColumn":5,"fileName":"pxt_modules/base/pxt-helpers.ts","functionName":"arrayJoin","argumentNames":["arr","sep"]}

function helpers_arrayJoin__P108225_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: helpers_arrayJoin__P108225, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  tmp_5: undefined,
  tmp_6: undefined,
  r___109401: undefined,
  len___109402: undefined,
  i___109405: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function pins_spi__P108549(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.mosi___109445 = undefined;
    s.miso___109450 = undefined;
    s.sck___109455 = undefined;
    r0 = pxsim_numops_toBoolDecr(globals._spi___108548);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = pxsim.pins.pinByCfg(19);
    s.mosi___109445 = (r0);
    r0 = pxsim.pins.pinByCfg(18);
    s.miso___109450 = (r0);
    r0 = pxsim.pins.pinByCfg(23);
    s.sck___109455 = (r0);
    r0 = pxsim.pins.createSPI(s.mosi___109445, s.miso___109450, s.sck___109455);
    globals._spi___108548 = (r0);
  case 1:
  case 2:
    r0 = globals._spi___108548;
    return leave(s, r0)
  default: oops()
} } }
pins_spi__P108549.info = {"start":98,"length":305,"line":7,"column":4,"endLine":15,"endColumn":5,"fileName":"pxt_modules/core/spi.ts","functionName":"spi","argumentNames":[]}

function pins_spi__P108549_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: pins_spi__P108549, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  mosi___109445: undefined,
  miso___109450: undefined,
  sck___109455: undefined,
} }





function net_Net_constructor__P108733(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = s.arg0;
    if (!checkSubtype(r0, net_Net__C108728_VT)) failedCast(r0);
    r0 = (s.arg0).fields["factory"] = (s.arg1);
    globals.net_Net_instance___108734 = (s.arg0);
    r0 = (s.arg0).fields["_controller"] = (undefined);
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
net_Net_constructor__P108733.info = {"start":2962,"length":162,"line":94,"column":8,"endLine":97,"endColumn":9,"fileName":"pxt_modules/net/net.ts","functionName":"inline","argumentNames":["this","factory"]}

function net_Net_constructor__P108733_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: net_Net_constructor__P108733, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  arg0: undefined,
  arg1: undefined,
} }





function settings_initScopes__P108626(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.rn___109474 = undefined;
    s.tmp_1 = settings_runNumber__P108624_mk(s);
    s.callLocIdx = 19; s.pc = 1; return s.tmp_1;
  case 1:
    r0 = s.retval;
    s.tmp_0 = r0;
    r0 = (s.tmp_0 + 1);
    s.rn___109474 = (r0);
    s.tmp_0 = settings_writeNumber__P108632_mk(s);
    s.tmp_0.arg0 = globals.RUN_KEY___108613;
    s.tmp_0.arg1 = s.rn___109474;
    s.callLocIdx = 20; s.pc = 2; return s.tmp_0;
  case 2:
    r0 = s.retval;
    r0 = pxsim.control.deviceSerialNumber();
    s.tmp_1 = r0;
    r0 = (s.tmp_1 & 2147483647);
    s.tmp_0 = r0;
    r0 = pxsim_pxtcore.seedAddRandom(s.tmp_0);
    r0 = pxsim_pxtcore.seedAddRandom(s.rn___109474);
    s.tmp_0 = settings_setScope__P108625_mk(s);
    r0 = pxsim_pxtcore.programName();
    s.tmp_0.arg0 = r0;
    s.callLocIdx = 21; s.pc = 3; return s.tmp_0;
  case 3:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
settings_initScopes__P108626.info = {"start":1104,"length":230,"line":41,"column":4,"endLine":49,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"initScopes","argumentNames":[]}

function settings_initScopes__P108626_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_initScopes__P108626, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  rn___109474: undefined,
} }





function settings_setScope__P108625(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.currScope___109504 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_numops_toBoolDecr(s.arg0);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.tmp_0;
    { step = 2; continue; }
  case 1:
    r0 = pxsim_String_.length(s.arg0);
    s.tmp_2 = r0;
    r0 = (s.tmp_2 > 100);
  case 2:
    // jmp value (already in r0)
    s.tmp_3 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_3);
    if (!r0) { step = 3; continue; }
    r0 = pxsim_pxtrt.panic(922);
  case 3:
  case 4:
    s.tmp_0 = settings_readString__P108635_mk(s);
    s.tmp_0.arg0 = globals.SCOPE_KEY___108614;
    s.callLocIdx = 17; s.pc = 7; return s.tmp_0;
  case 7:
    r0 = s.retval;
    s.currScope___109504 = (r0);
    r0 = (s.currScope___109504 != s.arg0);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 5; continue; }
    r0 = pxsim.settings._userClean();
    s.tmp_0 = settings_writeString__P108630_mk(s);
    s.tmp_0.arg0 = globals.SCOPE_KEY___108614;
    s.tmp_0.arg1 = s.arg0;
    s.callLocIdx = 18; s.pc = 8; return s.tmp_0;
  case 8:
    r0 = s.retval;
  case 5:
  case 6:
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
settings_setScope__P108625.info = {"start":826,"length":272,"line":31,"column":4,"endLine":39,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"setScope","argumentNames":["scope"]}

function settings_setScope__P108625_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_setScope__P108625, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  currScope___109504: undefined,
  arg0: undefined,
} }





function settings_writeString__P108630(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    s.tmp_0 = settings_writeBuffer__P108629_mk(s);
    s.tmp_0.arg0 = s.arg0;
    r0 = pxsim.control.createBufferFromUTF8(s.arg1);
    s.tmp_0.arg1 = r0;
    s.callLocIdx = 23; s.pc = 1; return s.tmp_0;
  case 1:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
settings_writeString__P108630.info = {"start":1895,"length":125,"line":75,"column":4,"endLine":77,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"writeString","argumentNames":["key","value"]}

function settings_writeString__P108630_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_writeString__P108630, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function settings_writeBuffer__P108629(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.settings._set(s.arg0, s.arg1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = pxsim.settings._userClean();
    r0 = pxsim_pxtrt.panic(920);
  case 1:
  case 2:
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
settings_writeBuffer__P108629.info = {"start":1538,"length":290,"line":63,"column":4,"endLine":70,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"writeBuffer","argumentNames":["key","value"]}

function settings_writeBuffer__P108629_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_writeBuffer__P108629, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function settings_readString__P108635(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.buf___109535 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.settings._get(s.arg0);
    s.buf___109535 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.buf___109535);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = undefined;
    { step = 3; continue; }
    { step = 2; continue; }
  case 1:
    r0 = pxsim.BufferMethods.toString(s.buf___109535);
    { step = 3; continue; }
  case 2:
    r0 = undefined;
  case 3:
    return leave(s, r0)
  default: oops()
} } }
settings_readString__P108635.info = {"start":2827,"length":177,"line":110,"column":4,"endLine":116,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"readString","argumentNames":["key"]}

function settings_readString__P108635_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_readString__P108635, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  buf___109535: undefined,
  arg0: undefined,
} }





function settings_readBuffer__P108634(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.settings._get(s.arg0);
    return leave(s, r0)
  default: oops()
} } }
settings_readBuffer__P108634.info = {"start":2694,"length":72,"line":103,"column":4,"endLine":105,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"readBuffer","argumentNames":["key"]}

function settings_readBuffer__P108634_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_readBuffer__P108634, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  arg0: undefined,
} }





function settings_writeNumber__P108632(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_Array__mk();
    s.tmp_0 = r0;
    r0 = pxsim_Array__push(s.tmp_0, s.arg1);
    s.tmp_1 = settings_writeBuffer__P108629_mk(s);
    s.tmp_1.arg0 = s.arg0;
    s.tmp_2 = msgpack_packNumberArray__P108318_mk(s);
    s.tmp_2.arg0 = s.tmp_0;
    s.callLocIdx = 24; s.pc = 2; return s.tmp_2;
  case 2:
    r0 = s.retval;
    s.tmp_1.arg1 = r0;
    s.callLocIdx = 25; s.pc = 1; return s.tmp_1;
  case 1:
    r0 = s.retval;
    r0 = undefined;
    return leave(s, r0)
  default: oops()
} } }
settings_writeNumber__P108632.info = {"start":2265,"length":122,"line":89,"column":4,"endLine":91,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"writeNumber","argumentNames":["key","value"]}

function settings_writeNumber__P108632_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_writeNumber__P108632, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  arg0: undefined,
  arg1: undefined,
} }





function msgpack_packNumberArray__P108318(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.off___109558 = undefined;
    s.n___109560 = undefined;
    s.unnamed304___U2 = undefined;
    s.unnamed305___U3 = undefined;
    s.buf___109570 = undefined;
    s.n___109576 = undefined;
    s.unnamed306___U6 = undefined;
    s.unnamed307___U7 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    s.off___109558 = (0);
    s.n___109560 = (undefined);
    s.unnamed304___U2 = (s.arg0);
    s.unnamed305___U3 = (0);
  case 1:
    s.tmp_0 = r0 = s.unnamed305___U3;
    r0 = pxsim_Array__length(s.unnamed304___U2);
    s.tmp_1 = r0;
    r0 = (s.tmp_0 < s.tmp_1);
    if (!r0) { step = 2; continue; }
    r0 = pxsim_Array__getAt(s.unnamed304___U2, s.unnamed305___U3);
    s.n___109560 = (r0);
    s.tmp_2 = r0 = s.off___109558;
    s.tmp_4 = msgpack_packNumberCore__P108316_mk(s);
    s.tmp_4.arg0 = null;
    s.tmp_4.arg1 = s.off___109558;
    s.tmp_4.arg2 = s.n___109560;
    s.callLocIdx = 7; s.pc = 5; return s.tmp_4;
  case 5:
    r0 = s.retval;
    s.tmp_3 = r0;
    r0 = (s.tmp_2 + s.tmp_3);
    s.off___109558 = (r0);
    r0 = (s.unnamed305___U3 + 1);
    s.unnamed305___U3 = (r0);
    { step = 1; continue; }
  case 2:
    s.unnamed304___U2 = (undefined);
    r0 = pxsim.control.createBuffer(s.off___109558);
    s.buf___109570 = (r0);
    s.off___109558 = (0);
    s.n___109576 = (undefined);
    s.unnamed306___U6 = (s.arg0);
    s.unnamed307___U7 = (0);
  case 3:
    s.tmp_0 = r0 = s.unnamed307___U7;
    r0 = pxsim_Array__length(s.unnamed306___U6);
    s.tmp_1 = r0;
    r0 = (s.tmp_0 < s.tmp_1);
    if (!r0) { step = 4; continue; }
    r0 = pxsim_Array__getAt(s.unnamed306___U6, s.unnamed307___U7);
    s.n___109576 = (r0);
    s.tmp_2 = r0 = s.off___109558;
    s.tmp_4 = msgpack_packNumberCore__P108316_mk(s);
    s.tmp_4.arg0 = s.buf___109570;
    s.tmp_4.arg1 = s.off___109558;
    s.tmp_4.arg2 = s.n___109576;
    s.callLocIdx = 8; s.pc = 6; return s.tmp_4;
  case 6:
    r0 = s.retval;
    s.tmp_3 = r0;
    r0 = (s.tmp_2 + s.tmp_3);
    s.off___109558 = (r0);
    r0 = (s.unnamed307___U7 + 1);
    s.unnamed307___U7 = (r0);
    { step = 3; continue; }
  case 4:
    s.unnamed306___U6 = (undefined);
    r0 = s.buf___109570;
    return leave(s, r0)
  default: oops()
} } }
msgpack_packNumberArray__P108318.info = {"start":3427,"length":330,"line":117,"column":4,"endLine":128,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"packNumberArray","argumentNames":["nums"]}

function msgpack_packNumberArray__P108318_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: msgpack_packNumberArray__P108318, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  off___109558: undefined,
  n___109560: undefined,
  unnamed304___U2: undefined,
  unnamed305___U3: undefined,
  buf___109570: undefined,
  n___109576: undefined,
  unnamed306___U6: undefined,
  unnamed307___U7: undefined,
  arg0: undefined,
} }





function msgpack_packNumberCore__P108316(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.tag___109590 = undefined;
    s.fmt___109633 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.arg2 = (s.lambdaArgs[2]);
      s.lambdaArgs = null;
    }
    s.tag___109590 = (203);
    s.tmp_1 = r0 = s.arg2;
    r0 = (s.arg2 << 0);
    s.tmp_2 = r0;
    r0 = (s.tmp_1 == s.tmp_2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.tmp_0;
    { step = 2; continue; }
  case 1:
    s.tmp_3 = r0 = s.arg2;
    r0 = (s.arg2 >>> 0);
    s.tmp_4 = r0;
    r0 = (s.tmp_3 == s.tmp_4);
  case 2:
    // jmp value (already in r0)
    s.tmp_5 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_5);
    if (!r0) { step = 19; continue; }
    r0 = (-31 <= s.arg2);
    s.tmp_6 = r0;
    r0 = pxsim_numops_toBool(s.tmp_6);
    if (r0) { step = 3; continue; }
    r0 = s.tmp_6;
    { step = 4; continue; }
  case 3:
    r0 = (s.arg2 <= 127);
  case 4:
    // jmp value (already in r0)
    s.tmp_7 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_7);
    if (!r0) { step = 7; continue; }
    r0 = pxsim_numops_toBoolDecr(s.arg0);
    if (!r0) { step = 5; continue; }
    r0 = pxsim.BufferMethods.setByte(s.arg0, s.arg1, s.arg2);
  case 5:
  case 6:
    r0 = 1;
    { step = 23; continue; }
    { step = 18; continue; }
  case 7:
    r0 = (0 <= s.arg2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 12; continue; }
    r0 = (s.arg2 <= 255);
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_1);
    if (!r0) { step = 8; continue; }
    s.tag___109590 = (204);
    { step = 11; continue; }
  case 8:
    r0 = (s.arg2 <= 65535);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 9; continue; }
    s.tag___109590 = (205);
    { step = 10; continue; }
  case 9:
    s.tag___109590 = (206);
  case 10:
  case 11:
    { step = 17; continue; }
  case 12:
    r0 = (-127 <= s.arg2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 13; continue; }
    s.tag___109590 = (208);
    { step = 16; continue; }
  case 13:
    r0 = (-32767 <= s.arg2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 14; continue; }
    s.tag___109590 = (209);
    { step = 15; continue; }
  case 14:
    s.tag___109590 = (210);
  case 15:
  case 16:
  case 17:
  case 18:
  case 19:
  case 20:
    s.tmp_0 = msgpack_tagFormat__P108315_mk(s);
    s.tmp_0.arg0 = s.tag___109590;
    s.callLocIdx = 3; s.pc = 24; return s.tmp_0;
  case 24:
    r0 = s.retval;
    s.fmt___109633 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.arg0);
    if (!r0) { step = 21; continue; }
    r0 = pxsim.BufferMethods.setByte(s.arg0, s.arg1, s.tag___109590);
    s.tmp_0 = r0 = s.arg0;
    s.tmp_1 = r0 = s.fmt___109633;
    r0 = (s.arg1 + 1);
    s.tmp_2 = r0;
    r0 = pxsim.BufferMethods.setNumber(s.tmp_0, s.tmp_1, s.tmp_2, s.arg2);
  case 21:
  case 22:
    s.tmp_1 = pins_sizeOf__P108308_mk(s);
    s.tmp_1.arg0 = s.fmt___109633;
    s.callLocIdx = 4; s.pc = 25; return s.tmp_1;
  case 25:
    r0 = s.retval;
    s.tmp_0 = r0;
    r0 = (s.tmp_0 + 1);
  case 23:
    return leave(s, r0)
  default: oops()
} } }
msgpack_packNumberCore__P108316.info = {"start":1632,"length":951,"line":56,"column":4,"endLine":86,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"packNumberCore","argumentNames":["buf","offset","num"]}

function msgpack_packNumberCore__P108316_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: msgpack_packNumberCore__P108316, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  tmp_5: undefined,
  tmp_6: undefined,
  tmp_7: undefined,
  tag___109590: undefined,
  fmt___109633: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
} }





function pins_sizeOf__P108308(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    s.tmp_0 = Buffer_sizeOfNumberFormat__P108344_mk(s);
    s.tmp_0.arg0 = s.arg0;
    s.callLocIdx = 2; s.pc = 1; return s.tmp_0;
  case 1:
    r0 = s.retval;
    return leave(s, r0)
  default: oops()
} } }
pins_sizeOf__P108308.info = {"start":42,"length":101,"line":2,"column":4,"endLine":4,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"sizeOf","argumentNames":["format"]}

function pins_sizeOf__P108308_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: pins_sizeOf__P108308, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
} }





function Buffer_sizeOfNumberFormat__P108344(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    s.tmp_0 = r0 = s.arg0;
    r0 = pxsim_pxtcore.switch_eq(1, s.tmp_0);
    if (r0) { step = 1; continue; }
    r0 = pxsim_pxtcore.switch_eq(2, s.tmp_0);
    if (r0) { step = 2; continue; }
    r0 = pxsim_pxtcore.switch_eq(6, s.tmp_0);
    if (r0) { step = 3; continue; }
    r0 = pxsim_pxtcore.switch_eq(7, s.tmp_0);
    if (r0) { step = 4; continue; }
    r0 = pxsim_pxtcore.switch_eq(3, s.tmp_0);
    if (r0) { step = 5; continue; }
    r0 = pxsim_pxtcore.switch_eq(4, s.tmp_0);
    if (r0) { step = 6; continue; }
    r0 = pxsim_pxtcore.switch_eq(8, s.tmp_0);
    if (r0) { step = 7; continue; }
    r0 = pxsim_pxtcore.switch_eq(9, s.tmp_0);
    if (r0) { step = 8; continue; }
    r0 = pxsim_pxtcore.switch_eq(5, s.tmp_0);
    if (r0) { step = 9; continue; }
    r0 = pxsim_pxtcore.switch_eq(10, s.tmp_0);
    if (r0) { step = 10; continue; }
    r0 = pxsim_pxtcore.switch_eq(12, s.tmp_0);
    if (r0) { step = 11; continue; }
    r0 = pxsim_pxtcore.switch_eq(11, s.tmp_0);
    if (r0) { step = 12; continue; }
    r0 = pxsim_pxtcore.switch_eq(15, s.tmp_0);
    if (r0) { step = 13; continue; }
    r0 = pxsim_pxtcore.switch_eq(13, s.tmp_0);
    if (r0) { step = 14; continue; }
    r0 = pxsim_pxtcore.switch_eq(16, s.tmp_0);
    if (r0) { step = 15; continue; }
    r0 = pxsim_pxtcore.switch_eq(14, s.tmp_0);
    if (r0) { step = 16; continue; }
    r0 = s.tmp_0;
    { step = 17; continue; }
  case 1:
  case 2:
  case 3:
  case 4:
    r0 = 1;
    { step = 18; continue; }
  case 5:
  case 6:
  case 7:
  case 8:
    r0 = 2;
    { step = 18; continue; }
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
  case 14:
    r0 = 4;
    { step = 18; continue; }
  case 15:
  case 16:
    r0 = 8;
    { step = 18; continue; }
  case 17:
    r0 = 0;
  case 18:
    return leave(s, r0)
  default: oops()
} } }
Buffer_sizeOfNumberFormat__P108344.info = {"start":14912,"length":856,"line":508,"column":4,"endLine":532,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"sizeOfNumberFormat","argumentNames":["format"]}

function Buffer_sizeOfNumberFormat__P108344_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: Buffer_sizeOfNumberFormat__P108344, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
} }





function msgpack_tagFormat__P108315(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    s.tmp_0 = r0 = s.arg0;
    r0 = pxsim_pxtcore.switch_eq(203, s.tmp_0);
    if (r0) { step = 1; continue; }
    r0 = pxsim_pxtcore.switch_eq(204, s.tmp_0);
    if (r0) { step = 2; continue; }
    r0 = pxsim_pxtcore.switch_eq(205, s.tmp_0);
    if (r0) { step = 3; continue; }
    r0 = pxsim_pxtcore.switch_eq(206, s.tmp_0);
    if (r0) { step = 4; continue; }
    r0 = pxsim_pxtcore.switch_eq(208, s.tmp_0);
    if (r0) { step = 5; continue; }
    r0 = pxsim_pxtcore.switch_eq(209, s.tmp_0);
    if (r0) { step = 6; continue; }
    r0 = pxsim_pxtcore.switch_eq(210, s.tmp_0);
    if (r0) { step = 7; continue; }
    r0 = s.tmp_0;
    { step = 8; continue; }
  case 1:
    r0 = 16;
    { step = 9; continue; }
  case 2:
    r0 = 7;
    { step = 9; continue; }
  case 3:
    r0 = 9;
    { step = 9; continue; }
  case 4:
    r0 = 12;
    { step = 9; continue; }
  case 5:
    r0 = 6;
    { step = 9; continue; }
  case 6:
    r0 = 8;
    { step = 9; continue; }
  case 7:
    r0 = 10;
    { step = 9; continue; }
  case 8:
    r0 = null;
    { step = 9; continue; }
    r0 = undefined;
  case 9:
    return leave(s, r0)
  default: oops()
} } }
msgpack_tagFormat__P108315.info = {"start":1145,"length":481,"line":42,"column":4,"endLine":54,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"tagFormat","argumentNames":["tag"]}

function msgpack_tagFormat__P108315_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: msgpack_tagFormat__P108315, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  arg0: undefined,
} }





function settings_runNumber__P108624(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.tmp_1 = settings_readNumber__P108637_mk(s);
    s.tmp_1.arg0 = globals.RUN_KEY___108613;
    s.callLocIdx = 16; s.pc = 3; return s.tmp_1;
  case 3:
    r0 = s.retval;
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = s.tmp_0;
    { step = 2; continue; }
  case 1:
    r0 = 0;
  case 2:
    // jmp value (already in r0)
    s.tmp_2 = r0;
    r0 = s.tmp_2;
    return leave(s, r0)
  default: oops()
} } }
settings_runNumber__P108624.info = {"start":745,"length":75,"line":27,"column":4,"endLine":29,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"runNumber","argumentNames":[]}

function settings_runNumber__P108624_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_runNumber__P108624, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
} }





function settings_readNumber__P108637(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.buf___109709 = undefined;
    s.nums___109716 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.lambdaArgs = null;
    }
    r0 = pxsim.settings._get(s.arg0);
    s.buf___109709 = (r0);
    r0 = pxsim_numops_toBoolDecr(s.buf___109709);
    s.tmp_1 = r0;
    r0 = pxsim_Boolean__bang(s.tmp_1);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 1; continue; }
    r0 = undefined;
    { step = 7; continue; }
    { step = 6; continue; }
  case 1:
    s.tmp_2 = msgpack_unpackNumberArray__P108317_mk(s);
    s.tmp_2.arg0 = s.buf___109709;
    s.tmp_2.arg1 = 0;
    s.callLocIdx = 28; s.pc = 8; return s.tmp_2;
  case 8:
    r0 = s.retval;
    s.nums___109716 = (r0);
    s.tmp_0 = r0 = s.nums___109716;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 2; continue; }
    r0 = s.tmp_0;
    { step = 3; continue; }
  case 2:
    r0 = pxsim_Array__length(s.nums___109716);
    s.tmp_1 = r0;
    r0 = (s.tmp_1 >= 1);
  case 3:
    // jmp value (already in r0)
    s.tmp_2 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_2);
    if (!r0) { step = 4; continue; }
    r0 = pxsim_Array__getAt(s.nums___109716, 0);
    { step = 7; continue; }
  case 4:
  case 5:
    r0 = undefined;
    { step = 7; continue; }
  case 6:
    r0 = undefined;
  case 7:
    return leave(s, r0)
  default: oops()
} } }
settings_readNumber__P108637.info = {"start":3283,"length":313,"line":131,"column":4,"endLine":141,"endColumn":5,"fileName":"pxt_modules/settings/settings.ts","functionName":"readNumber","argumentNames":["key"]}

function settings_readNumber__P108637_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: settings_readNumber__P108637, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  buf___109709: undefined,
  nums___109716: undefined,
  arg0: undefined,
} }





function msgpack_unpackNumberArray__P108317(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;


while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
  case 0:

    s.res___109729 = undefined;
    s.fmt___109736 = undefined;
    s.v___109745 = undefined;
    if (s.lambdaArgs) {
      s.arg0 = (s.lambdaArgs[0]);
      s.arg1 = (s.lambdaArgs[1]);
      s.lambdaArgs = null;
    }
    r0 = pxsim_Array__mk();
    s.res___109729 = (r0);
  case 1:
    s.tmp_1 = r0 = s.arg1;
    r0 = pxsim.BufferMethods.length(s.arg0);
    s.tmp_2 = r0;
    r0 = (s.tmp_1 < s.tmp_2);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 10; continue; }
    s.tmp_3 = r0 = s.arg1;
    r0 = (s.tmp_3 + 1);
    s.arg1 = (r0);
    s.tmp_4 = msgpack_tagFormat__P108315_mk(s);
    r0 = pxsim.BufferMethods.getByte(s.arg0, s.tmp_3);
    s.tmp_4.arg0 = r0;
    s.callLocIdx = 5; s.pc = 12; return s.tmp_4;
  case 12:
    r0 = s.retval;
    s.fmt___109736 = (r0);
    r0 = (s.fmt___109736 === null);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 6; continue; }
    s.tmp_1 = r0 = s.arg0;
    r0 = (s.arg1 - 1);
    s.tmp_2 = r0;
    r0 = pxsim.BufferMethods.getNumber(s.tmp_1, 6, s.tmp_2);
    s.v___109745 = (r0);
    r0 = (-31 <= s.v___109745);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBool(s.tmp_0);
    if (r0) { step = 2; continue; }
    r0 = s.tmp_0;
    { step = 3; continue; }
  case 2:
    r0 = (s.v___109745 <= 127);
  case 3:
    // jmp value (already in r0)
    s.tmp_1 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_1);
    if (!r0) { step = 4; continue; }
    r0 = pxsim_Array__push(s.res___109729, s.v___109745);
    { step = 5; continue; }
  case 4:
    r0 = null;
    { step = 11; continue; }
  case 5:
    { step = 7; continue; }
  case 6:
    s.tmp_0 = r0 = s.res___109729;
    r0 = pxsim.BufferMethods.getNumber(s.arg0, s.fmt___109736, s.arg1);
    s.tmp_1 = r0;
    r0 = pxsim_Array__push(s.tmp_0, s.tmp_1);
    s.tmp_0 = r0 = s.arg1;
    s.tmp_2 = pins_sizeOf__P108308_mk(s);
    s.tmp_2.arg0 = s.fmt___109736;
    s.callLocIdx = 6; s.pc = 13; return s.tmp_2;
  case 13:
    r0 = s.retval;
    s.tmp_1 = r0;
    r0 = (s.tmp_0 + s.tmp_1);
    s.arg1 = (r0);
  case 7:
  case 8:
    r0 = pxsim.BufferMethods.getByte(s.arg0, s.arg1);
    s.tmp_1 = r0;
    r0 = (s.tmp_1 === 193);
    s.tmp_0 = r0;
    r0 = pxsim_numops_toBoolDecr(s.tmp_0);
    if (!r0) { step = 9; continue; }
    r0 = (s.arg1 + 1);
    s.arg1 = (r0);
    { step = 8; continue; }
  case 9:
    { step = 1; continue; }
  case 10:
    r0 = s.res___109729;
  case 11:
    return leave(s, r0)
  default: oops()
} } }
msgpack_unpackNumberArray__P108317.info = {"start":2650,"length":669,"line":91,"column":4,"endLine":111,"endColumn":5,"fileName":"pxt_modules/base/buffer.ts","functionName":"unpackNumberArray","argumentNames":["buf","offset"]}

function msgpack_unpackNumberArray__P108317_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: msgpack_unpackNumberArray__P108317, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  res___109729: undefined,
  fmt___109736: undefined,
  v___109745: undefined,
  arg0: undefined,
  arg1: undefined,
} }




function lambda_3_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: null, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
} }


function lambda_4_mk(s) {
    checkStack(s.depth);
    return {
        parent: s, fn: null, depth: s.depth + 1,
        pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
  tmp_0: undefined,
  tmp_1: undefined,
  tmp_2: undefined,
  tmp_3: undefined,
  tmp_4: undefined,
  arg0: undefined,
  arg1: undefined,
  arg2: undefined,
  arg3: undefined,
} }

const net_Net__C108728_VT = mkVTable({
  name: "Net",
  numFields: 2,
  classNo: 16,
  lastSubtypeNo: 16,
  maxBgInstances: null,
  methods: {
  },
  iface: {
    "_controller": null,
    "set/_controller": null,
    "factory": null,
    "set/factory": null,
  },
});
const net_Controller__C108659_VT = mkVTable({
  name: "Controller",
  numFields: 5,
  classNo: 17,
  lastSubtypeNo: 18,
  maxBgInstances: null,
  methods: {
  },
  iface: {
    "eventID": null,
    "set/eventID": null,
    "_isConnected": null,
    "set/_isConnected": null,
    "onConnectSSIDFailed": null,
    "set/onConnectSSIDFailed": null,
    "lastScanResults": null,
    "set/lastScanResults": null,
    "reconnectRunning": null,
    "set/reconnectRunning": null,
  },
});
const esp32_NinaController__C108903_VT = mkVTable({
  name: "NinaController",
  numFields: 13,
  classNo: 18,
  lastSubtypeNo: 18,
  maxBgInstances: null,
  methods: {
  },
  iface: {
    "eventID": null,
    "set/eventID": null,
    "_isConnected": null,
    "set/_isConnected": null,
    "onConnectSSIDFailed": null,
    "set/onConnectSSIDFailed": null,
    "lastScanResults": null,
    "set/lastScanResults": null,
    "reconnectRunning": null,
    "set/reconnectRunning": null,
    "_socknum_ll": null,
    "set/_socknum_ll": null,
    "_locked": null,
    "set/_locked": null,
    "wasConnected": null,
    "set/wasConnected": null,
    "_spi": null,
    "set/_spi": null,
    "_cs": null,
    "set/_cs": null,
    "_busy": null,
    "set/_busy": null,
    "_reset": null,
    "set/_reset": null,
    "_gpio0": null,
    "set/_gpio0": null,
    "reset": esp32_NinaController_reset__P108905,
    "spiTransfer": esp32_NinaController_spiTransfer__P108911,
  },
});

const breakpoints = setupDebugger(1, ["_defaultController___108767"])

return _main___P108174
})
