Program: 5543
Project: 5543
Buggy source:
private boolean setState(RadioState state){
  if (DEBUG)   log("String_Node_Str" + stateMachine + "String_Node_Str"+ state);
  stateMachine=state;
  registers[REG_FSMSTATE]=state.getFSMState();
switch (stateMachine) {
case VREG_OFF:
    if (DEBUG)     log("String_Node_Str");
  flushRX();
flushTX();
status&=~(STATUS_RSSI_VALID | STATUS_XOSC16M_STABLE);
reset();
setMode(MODE_POWER_OFF);
updateCCA();
break;
case POWER_DOWN:
rxFIFO.reset();
status&=~(STATUS_RSSI_VALID | STATUS_XOSC16M_STABLE);
reset();
setMode(MODE_POWER_OFF);
updateCCA();
break;
case RX_CALIBRATE:
setSymbolEvent(12);
setMode(MODE_RX_ON);
break;
case RX_SFD_SEARCH:
zeroSymbols=0;
if ((status & STATUS_RSSI_VALID) == 0) {
setSymbolEvent(8);
}
updateCCA();
setMode(MODE_RX_ON);
break;
case TX_CALIBRATE:
setSymbolEvent(12 + 2);
setMode(MODE_TXRX_ON);
break;
case TX_PREAMBLE:
shrPos=0;
SHR[0]=0;
SHR[1]=0;
SHR[2]=0;
SHR[3]=0;
SHR[4]=0x7A;
shrNext();
break;
case TX_FRAME:
txfifoPos=0;
txNext();
break;
case RX_WAIT:
setSymbolEvent(8);
setMode(MODE_RX_ON);
break;
case IDLE:
status&=~STATUS_RSSI_VALID;
setMode(MODE_TXRX_OFF);
updateCCA();
break;
case TX_ACK_CALIBRATE:
status|=STATUS_TX_ACTIVE;
setSymbolEvent(12 + 2 + 2);
setMode(MODE_TXRX_ON);
break;
case TX_ACK_PREAMBLE:
shrPos=0;
SHR[0]=0;
SHR[1]=0;
SHR[2]=0;
SHR[3]=0;
SHR[4]=0x7A;
shrNext();
break;
case TX_ACK:
ackPos=0;
ackNext();
break;
case RX_FRAME:
rxFIFO.mark();
rxread=0;
frameRejected=false;
break;
}
if (stateListener != null) {
stateListener.newState(stateMachine);
}
stateChanged(stateMachine.state);
return true;
}

Fixed version (ground truth):
private boolean setState(RadioState state){
  if (DEBUG)   log("String_Node_Str" + stateMachine + "String_Node_Str"+ state);
  stateMachine=state;
  registers[REG_FSMSTATE]=state.getFSMState();
switch (stateMachine) {
case VREG_OFF:
    if (DEBUG)     log("String_Node_Str");
  flushRX();
flushTX();
status&=~(STATUS_RSSI_VALID | STATUS_XOSC16M_STABLE);
reset();
setMode(MODE_POWER_OFF);
updateCCA();
break;
case POWER_DOWN:
rxFIFO.reset();
status&=~(STATUS_RSSI_VALID | STATUS_XOSC16M_STABLE);
reset();
setMode(MODE_POWER_OFF);
updateCCA();
break;
case RX_CALIBRATE:
setSymbolEvent(12);
setMode(MODE_RX_ON);
break;
case RX_SFD_SEARCH:
zeroSymbols=0;
if ((status & STATUS_RSSI_VALID) == 0) {
setSymbolEvent(8);
}
updateCCA();
setMode(MODE_RX_ON);
break;
case TX_CALIBRATE:
setSymbolEvent(12 + 2);
setMode(MODE_TXRX_ON);
break;
case TX_PREAMBLE:
shrPos=0;
SHR[0]=0;
SHR[1]=0;
SHR[2]=0;
SHR[3]=0;
SHR[4]=0x7A;
shrNext();
break;
case TX_FRAME:
txfifoPos=0;
txNext();
break;
case RX_WAIT:
setSymbolEvent(8);
setMode(MODE_RX_ON);
break;
case IDLE:
status&=~STATUS_RSSI_VALID;
setMode(MODE_TXRX_OFF);
updateCCA();
break;
case TX_ACK_CALIBRATE:
status|=STATUS_TX_ACTIVE;
setSymbolEvent(12 + 2 + 2);
setMode(MODE_TXRX_ON);
break;
case TX_ACK_PREAMBLE:
shrPos=0;
SHR[0]=0;
SHR[1]=0;
SHR[2]=0;
SHR[3]=0;
SHR[4]=0x7A;
shrNext();
break;
case TX_ACK:
ackPos=0;
ackNext();
break;
case RX_FRAME:
rxFIFO.mark();
rxread=0;
frameRejected=false;
shouldAck=false;
crcOk=false;
break;
}
if (stateListener != null) {
stateListener.newState(stateMachine);
}
stateChanged(stateMachine.state);
return true;
}