protected static Pair<String,String> lsrImmediate(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String immediateNodeValue){
  final String shifterOperand=environment.getNextVariableString();
  final String shifterCarryOut=environment.getNextVariableString();
  long baseOffset=offset;
  if (immediateNodeValue.equals("0")) {
    final String tmpVar1=environment.getNextVariableString();
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,wordSize,minusThirtyOneSet,wordSize,tmpVar1));
    instructions.add(ReilHelpers.createAnd(baseOffset++,wordSize,tmpVar1,byteSize,oneSet,byteSize,shifterCarryOut));
    return new Pair<String,String>(String.valueOf(0),shifterCarryOut);
  }
 else {
    final String tmpVar1=environment.getNextVariableString();
    final String tmpVar2=environment.getNextVariableString();
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,wordSize,"-" + immediateNodeValue,qWordSize,tmpVar1));
    instructions.add(ReilHelpers.createAnd(baseOffset++,qWordSize,tmpVar1,dWordSize,bitMaskAllBitsSet,dWordSize,shifterOperand));
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,wordSize,String.valueOf(-(Integer.decode(immediateNodeValue) - 1)),dWordSize,tmpVar2));
    instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,tmpVar2,byteSize,oneSet,byteSize,shifterCarryOut));
    return new Pair<String,String>(shifterOperand,shifterCarryOut);
  }
}

protected static Pair < String , String > lsrImmediate ( final long offset , final ITranslationEnvironment environment , final List < ReilInstruction > instructions , final String registerNodeValue , final String immediateNodeValue ) { final String shifterOperand = environment . getNextVariableString ( ) ; final String shifterCarryOut = environment . getNextVariableString ( ) ; long baseOffset = offset ; if ( immediateNodeValue . equals ( "0" ) ) { final String tmpVar1 = environment . getNextVariableString ( ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue , wordSize , minusThirtyOneSet , wordSize , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , wordSize , tmpVar1 , byteSize , oneSet , byteSize , shifterCarryOut ) ) ; return new Pair < String , String > ( String . valueOf ( 0 ) , shifterCarryOut ) ; } else { final String tmpVar1 = environment . getNextVariableString ( ) ; final String tmpVar2 = environment . getNextVariableString ( ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue , wordSize , "-" + immediateNodeValue , qWordSize , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , qWordSize , tmpVar1 , dWordSize , bitMaskAllBitsSet , dWordSize , shifterOperand ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue , wordSize , String . valueOf ( - ( Integer . decode ( immediateNodeValue ) - 1 ) ) , dWordSize , tmpVar2 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , tmpVar2 , byteSize , oneSet , byteSize , shifterCarryOut ) ) ; return new Pair < String , String > ( shifterOperand , shifterCarryOut ) ; } }
< rm > , lsr # < shift_imm > operation : if shift_imm = = 0 then shifter_operand = 0 shifter_carry_out = rm [ 31 ] else / / shift_imm > 0 shifter_operand = rm logical_shift_right shift_imm shifter_carry_out = rm [ shift_imm - 1 ]
