EnableSOSC (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  EnableSOSC_TrustedCall (config);
  return;

}


EnableSOSC_TrustedCall (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  _1 = config->enable;
  if (_1 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  _2 = 1074151424B;
  _3 = _2->SOSCCSR;
  _4 = 1074151424B;
  _5 = _3 | 1;
  _4->SOSCCSR = _5;

  <bb 4> :
  return;

}


DisableSOSC (Clock_Ip_NameType xoscName)
{
  <bb 2> :
  DisableSOSC_TrustedCall (xoscName);
  return;

}


DisableSOSC_TrustedCall (Clock_Ip_NameType xoscName)
{
  <bb 2> :
  _1 = 1074151424B;
  _2 = _1->SOSCCSR;
  _3 = 1074151424B;
  _4 = _2 & 4294967294;
  _3->SOSCCSR = _4;
  return;

}


CompleteSOSC (const struct Clock_Ip_XoscConfigType * config)
{
  uint32 SoscStatus;
  uint32 TimeoutTicks;
  uint32 ElapsedTime;
  uint32 StartTime;
  boolean TimeoutOccurred;

  <bb 2> :
  TimeoutOccurred = 0;
  _1 = 1074151424B;
  _2 = _1->SOSCCSR;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 3> :
  ClockStartTimeout (&StartTime, &ElapsedTime, &TimeoutTicks, 50000);

  <bb 4> :
  _4 = 1074151424B;
  _5 = _4->SOSCCSR;
  _6 = _5 >> 24;
  SoscStatus = _6 & 1;
  TimeoutTicks.0_7 = TimeoutTicks;
  TimeoutOccurred = ClockTimeoutExpired (&StartTime, &ElapsedTime, TimeoutTicks.0_7);
  if (SoscStatus == 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  _8 = ~TimeoutOccurred;
  if (_8 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  if (TimeoutOccurred != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  _9 = config->name;
  ReportClockErrors (1, _9);

  <bb 8> :
  StartTime = {CLOBBER};
  ElapsedTime = {CLOBBER};
  TimeoutTicks = {CLOBBER};
  return;

}


SetSOSC (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  SetSOSC_TrustedCall (config);
  return;

}


SetSOSC_TrustedCall (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  _1 = config->enable;
  if (_1 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 19>; [INV]

  <bb 3> :
  _2 = config->gain;
  _3 = (int) _2;
  switch (_3) <default: <L3> [INV], case 0: <L1> [INV], case 1: <L2> [INV]>

  <bb 4> :
<L1>:
  _4 = 1074151424B;
  _5 = _4->SOSCCFG;
  _6 = 1074151424B;
  _7 = _5 & 4294967287;
  _6->SOSCCFG = _7;
  goto <bb 7>; [INV]

  <bb 5> :
<L2>:
  _8 = 1074151424B;
  _9 = _8->SOSCCFG;
  _10 = 1074151424B;
  _11 = _9 | 8;
  _10->SOSCCFG = _11;
  goto <bb 7>; [INV]

  <bb 6> :
<L3>:

  <bb 7> :
  _12 = 1074151424B;
  _13 = _12->SOSCCFG;
  _14 = 1074151424B;
  _15 = _13 & 4294967247;
  _14->SOSCCFG = _15;
  _16 = config->freq;
  if (_16 > 3999999)
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  _17 = config->freq;
  if (_17 <= 7999999)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  _18 = 1074151424B;
  _19 = _18->SOSCCFG;
  _20 = 1074151424B;
  _21 = _19 | 32;
  _20->SOSCCFG = _21;
  goto <bb 11>; [INV]

  <bb 10> :
  _22 = 1074151424B;
  _23 = _22->SOSCCFG;
  _24 = 1074151424B;
  _25 = _23 | 48;
  _24->SOSCCFG = _25;

  <bb 11> :
  _26 = config->bypassOption;
  if (_26 == 0)
    goto <bb 12>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 12> :
  _27 = 1074151424B;
  _28 = _27->SOSCCFG;
  _29 = 1074151424B;
  _30 = _28 | 4;
  _29->SOSCCFG = _30;
  goto <bb 14>; [INV]

  <bb 13> :
  _31 = 1074151424B;
  _32 = _31->SOSCCFG;
  _33 = 1074151424B;
  _34 = _32 & 4294967291;
  _33->SOSCCFG = _34;

  <bb 14> :
  _35 = config->monitor;
  _36 = (int) _35;
  switch (_36) <default: <L15> [INV], case 0: <L12> [INV], case 1: <L13> [INV], case 2: <L14> [INV]>

  <bb 15> :
<L12>:
  _37 = 1074151424B;
  _37->SOSCCSR = 1;
  goto <bb 19>; [INV]

  <bb 16> :
<L13>:
  _38 = 1074151424B;
  _38->SOSCCSR = 65537;
  goto <bb 19>; [INV]

  <bb 17> :
<L14>:
  _39 = 1074151424B;
  _39->SOSCCSR = 196609;
  goto <bb 19>; [INV]

  <bb 18> :
<L15>:
  _40 = 1074151424B;
  _41 = _40->SOSCCSR;
  _42 = 1074151424B;
  _43 = _41 | 1;
  _42->SOSCCSR = _43;

  <bb 19> :
  return;

}


ResetSOSC (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  ResetSOSC_TrustedCall (config);
  return;

}


ResetSOSC_TrustedCall (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  _1 = 1074151424B;
  _2 = _1->SOSCCSR;
  _3 = 1074151424B;
  _4 = _2 & 4286578687;
  _3->SOSCCSR = _4;
  _5 = 1074151424B;
  _6 = _5->SOSCCSR;
  _7 = 1074151424B;
  _8 = _6 & 4294967294;
  _7->SOSCCSR = _8;
  return;

}


DisableExternalOscillatorEmpty (Clock_Ip_NameType xoscName)
{
  <bb 2> :
  return;

}


ExternalOscillatorEmpty (const struct Clock_Ip_XoscConfigType * config)
{
  <bb 2> :
  return;

}


