protected static Pair<String,String> asrRegister(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue1,final String registerNodeValue2){
  final String shifterOperand=environment.getNextVariableString();
  final String shifterCarryOut=environment.getNextVariableString();
  final String isZeroCondition=environment.getNextVariableString();
  final String isLessCondition=environment.getNextVariableString();
  final String isGtEqCondition=environment.getNextVariableString();
  final String shifterCarryOutTmp1=environment.getNextVariableString();
  final String shifterCarryOutTmp2=environment.getNextVariableString();
  final String shifterCarryOutTmp3=environment.getNextVariableString();
  final String shifterCarryOutTmp4=environment.getNextVariableString();
  final String shifterOperandTmp1=environment.getNextVariableString();
  final String shifterOperandTmp2=environment.getNextVariableString();
  final String shifterOperandTmp3=environment.getNextVariableString();
  final String shifterOperandTmp4=environment.getNextVariableString();
  final String tmpRsRegister=environment.getNextVariableString();
  final String negativeTmpRsRegister=environment.getNextVariableString();
  final String tmpVar1=environment.getNextVariableString();
  final String tmpVar2=environment.getNextVariableString();
  final String tmpVar3=environment.getNextVariableString();
  final String tmpVar4=environment.getNextVariableString();
  final String tmpVar5=environment.getNextVariableString();
  final String tmpVar6=environment.getNextVariableString();
  final String tmpVar7=environment.getNextVariableString();
  final String tmpVar8=environment.getNextVariableString();
  final String tmpVar9=environment.getNextVariableString();
  final String tmpVar10=environment.getNextVariableString();
  final String tmpVar11=environment.getNextVariableString();
  long baseOffset=offset;
  instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,registerNodeValue2,dWordSize,String.valueOf(0xFFL),dWordSize,tmpRsRegister));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,zeroSet,dWordSize,tmpRsRegister,dWordSize,negativeTmpRsRegister));
  instructions.add(ReilHelpers.createBisz(baseOffset++,dWordSize,tmpRsRegister,byteSize,isZeroCondition));
  instructions.add(ReilHelpers.createAnd(baseOffset++,byteSize,"C",byteSize,isZeroCondition,byteSize,shifterCarryOutTmp1));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,String.valueOf(0),byteSize,isZeroCondition,dWordSize,tmpVar1));
  instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,tmpVar1,dWordSize,registerNodeValue2,dWordSize,shifterOperandTmp1));
  instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,tmpRsRegister,dWordSize,String.valueOf(0xFFFFFFE0L),dWordSize,tmpVar2));
  instructions.add(ReilHelpers.createBisz(baseOffset++,dWordSize,tmpVar2,byteSize,isLessCondition));
  instructions.add(ReilHelpers.createAdd(baseOffset++,dWordSize,registerNodeValue1,dWordSize,bitMaskHighestBitSet,dWordSize,tmpVar3));
  instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,tmpVar3,dWordSize,negativeTmpRsRegister,dWordSize,tmpVar4));
  instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,bitMaskHighestBitSet,dWordSize,negativeTmpRsRegister,dWordSize,tmpVar5));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,tmpVar4,dWordSize,tmpVar5,dWordSize,tmpVar6));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,zeroSet,byteSize,isLessCondition,dWordSize,tmpVar7));
  instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,tmpVar6,dWordSize,tmpVar7,dWordSize,shifterOperandTmp2));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,tmpRsRegister,byteSize,oneSet,dWordSize,tmpVar8));
  instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,zeroSet,dWordSize,tmpVar8,dWordSize,tmpVar8));
  instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue1,dWordSize,tmpVar8,dWordSize,tmpVar9));
  instructions.add(ReilHelpers.createAnd(baseOffset++,dWordSize,tmpVar9,byteSize,isLessCondition,byteSize,shifterCarryOutTmp2));
  instructions.add(ReilHelpers.createOr(baseOffset++,byteSize,isZeroCondition,byteSize,isLessCondition,byteSize,tmpVar10));
  instructions.add(ReilHelpers.createBisz(baseOffset++,byteSize,tmpVar10,byteSize,isGtEqCondition));
  instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue1,dWordSize,minusThirtyOneSet,byteSize,tmpVar11));
  instructions.add(ReilHelpers.createSub(baseOffset++,byteSize,zeroSet,byteSize,isGtEqCondition,dWordSize,shifterOperandTmp3));
  instructions.add(ReilHelpers.createAnd(baseOffset++,byteSize,tmpVar11,byteSize,isGtEqCondition,byteSize,shifterCarryOutTmp3));
  instructions.add(ReilHelpers.createOr(baseOffset++,byteSize,shifterCarryOutTmp1,byteSize,shifterCarryOutTmp2,byteSize,shifterCarryOutTmp4));
  instructions.add(ReilHelpers.createOr(baseOffset++,byteSize,shifterCarryOutTmp3,byteSize,shifterCarryOutTmp4,byteSize,shifterCarryOut));
  instructions.add(ReilHelpers.createOr(baseOffset++,dWordSize,shifterOperandTmp1,dWordSize,shifterOperandTmp2,dWordSize,shifterOperandTmp4));
  instructions.add(ReilHelpers.createOr(baseOffset++,dWordSize,shifterOperandTmp3,dWordSize,shifterOperandTmp4,dWordSize,shifterOperand));
  return new Pair<String,String>(shifterOperand,shifterCarryOut);
}

protected static Pair < String , String > asrRegister ( final long offset , final ITranslationEnvironment environment , final List < ReilInstruction > instructions , final String registerNodeValue1 , final String registerNodeValue2 ) { final String shifterOperand = environment . getNextVariableString ( ) ; final String shifterCarryOut = environment . getNextVariableString ( ) ; final String isZeroCondition = environment . getNextVariableString ( ) ; final String isLessCondition = environment . getNextVariableString ( ) ; final String isGtEqCondition = environment . getNextVariableString ( ) ; final String shifterCarryOutTmp1 = environment . getNextVariableString ( ) ; final String shifterCarryOutTmp2 = environment . getNextVariableString ( ) ; final String shifterCarryOutTmp3 = environment . getNextVariableString ( ) ; final String shifterCarryOutTmp4 = environment . getNextVariableString ( ) ; final String shifterOperandTmp1 = environment . getNextVariableString ( ) ; final String shifterOperandTmp2 = environment . getNextVariableString ( ) ; final String shifterOperandTmp3 = environment . getNextVariableString ( ) ; final String shifterOperandTmp4 = environment . getNextVariableString ( ) ; final String tmpRsRegister = environment . getNextVariableString ( ) ; final String negativeTmpRsRegister = environment . getNextVariableString ( ) ; final String tmpVar1 = environment . getNextVariableString ( ) ; final String tmpVar2 = environment . getNextVariableString ( ) ; final String tmpVar3 = environment . getNextVariableString ( ) ; final String tmpVar4 = environment . getNextVariableString ( ) ; final String tmpVar5 = environment . getNextVariableString ( ) ; final String tmpVar6 = environment . getNextVariableString ( ) ; final String tmpVar7 = environment . getNextVariableString ( ) ; final String tmpVar8 = environment . getNextVariableString ( ) ; final String tmpVar9 = environment . getNextVariableString ( ) ; final String tmpVar10 = environment . getNextVariableString ( ) ; final String tmpVar11 = environment . getNextVariableString ( ) ; long baseOffset = offset ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , registerNodeValue2 , dWordSize , String . valueOf ( 0xFFL ) , dWordSize , tmpRsRegister ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , zeroSet , dWordSize , tmpRsRegister , dWordSize , negativeTmpRsRegister ) ) ; instructions . add ( ReilHelpers . createBisz ( baseOffset ++ , dWordSize , tmpRsRegister , byteSize , isZeroCondition ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , byteSize , "C" , byteSize , isZeroCondition , byteSize , shifterCarryOutTmp1 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , String . valueOf ( 0 ) , byteSize , isZeroCondition , dWordSize , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , tmpVar1 , dWordSize , registerNodeValue2 , dWordSize , shifterOperandTmp1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , tmpRsRegister , dWordSize , String . valueOf ( 0xFFFFFFE0L ) , dWordSize , tmpVar2 ) ) ; instructions . add ( ReilHelpers . createBisz ( baseOffset ++ , dWordSize , tmpVar2 , byteSize , isLessCondition ) ) ; instructions . add ( ReilHelpers . createAdd ( baseOffset ++ , dWordSize , registerNodeValue1 , dWordSize , bitMaskHighestBitSet , dWordSize , tmpVar3 ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , tmpVar3 , dWordSize , negativeTmpRsRegister , dWordSize , tmpVar4 ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , bitMaskHighestBitSet , dWordSize , negativeTmpRsRegister , dWordSize , tmpVar5 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , tmpVar4 , dWordSize , tmpVar5 , dWordSize , tmpVar6 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , zeroSet , byteSize , isLessCondition , dWordSize , tmpVar7 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , tmpVar6 , dWordSize , tmpVar7 , dWordSize , shifterOperandTmp2 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , tmpRsRegister , byteSize , oneSet , dWordSize , tmpVar8 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , zeroSet , dWordSize , tmpVar8 , dWordSize , tmpVar8 ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue1 , dWordSize , tmpVar8 , dWordSize , tmpVar9 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dWordSize , tmpVar9 , byteSize , isLessCondition , byteSize , shifterCarryOutTmp2 ) ) ; instructions . add ( ReilHelpers . createOr ( baseOffset ++ , byteSize , isZeroCondition , byteSize , isLessCondition , byteSize , tmpVar10 ) ) ; instructions . add ( ReilHelpers . createBisz ( baseOffset ++ , byteSize , tmpVar10 , byteSize , isGtEqCondition ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue1 , dWordSize , minusThirtyOneSet , byteSize , tmpVar11 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , byteSize , zeroSet , byteSize , isGtEqCondition , dWordSize , shifterOperandTmp3 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , byteSize , tmpVar11 , byteSize , isGtEqCondition , byteSize , shifterCarryOutTmp3 ) ) ; instructions . add ( ReilHelpers . createOr ( baseOffset ++ , byteSize , shifterCarryOutTmp1 , byteSize , shifterCarryOutTmp2 , byteSize , shifterCarryOutTmp4 ) ) ; instructions . add ( ReilHelpers . createOr ( baseOffset ++ , byteSize , shifterCarryOutTmp3 , byteSize , shifterCarryOutTmp4 , byteSize , shifterCarryOut ) ) ; instructions . add ( ReilHelpers . createOr ( baseOffset ++ , dWordSize , shifterOperandTmp1 , dWordSize , shifterOperandTmp2 , dWordSize , shifterOperandTmp4 ) ) ; instructions . add ( ReilHelpers . createOr ( baseOffset ++ , dWordSize , shifterOperandTmp3 , dWordSize , shifterOperandTmp4 , dWordSize , shifterOperand ) ) ; return new Pair < String , String > ( shifterOperand , shifterCarryOut ) ; }
< rm > , asr < rs > operation : if rs [ 7 : 0 ] = = 0 then shifter_operand = rm shifter_carry_out = c flag else if rs [ 7 : 0 ] < 32 then shifter_operand = rm arithmetic_shift_right rs [ 7 : 0 ] shifter_carry_out = rm [ rs [ 7 : 0 ] - 1 ] else / rs [ 7 : 0 ] > = 32 / if rm [ 31 ] = = 0 then shifter_operand = 0 shifter_carry_out = rm [ 31 ] else / rm [ 31 ] = = 1 / shifter_operand = 0xffffffff shifter_carry_out = rm [ 31 ]
