protected static Pair<String,String> asrImmediate(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String immediateNodeValue){
  long baseOffset=offset;
  final String shifterOperand=environment.getNextVariableString();
  final String shifterCarryOut=environment.getNextVariableString();
  if (immediateNodeValue.equals("0")) {
    final String tmpVar1=environment.getNextVariableString();
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,wordSize,thirtyOneSet,byteSize,tmpVar1));
    instructions.add(ReilHelpers.createAnd(baseOffset++,byteSize,tmpVar1,byteSize,oneSet,byteSize,shifterCarryOut));
    instructions.add(ReilHelpers.createSub(baseOffset++,byteSize,shifterCarryOut,byteSize,String.valueOf(1),dWordSize,shifterOperand));
    return new Pair<String,String>(shifterOperand,shifterCarryOut);
  }
 else {
    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();
    instructions.add(ReilHelpers.createAdd(baseOffset++,dWordSize,registerNodeValue,dWordSize,bitMaskHighestBitSet,qWordSize,tmpVar1));
    instructions.add(ReilHelpers.createBsh(baseOffset++,qWordSize,tmpVar1,wordSize,"-" + immediateNodeValue,dWordSize,tmpVar2));
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,bitMaskHighestBitSet,wordSize,"-" + immediateNodeValue,dWordSize,tmpVar3));
    instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,tmpVar2,dWordSize,tmpVar3,qWordSize,tmpVar4));
    instructions.add(ReilHelpers.createAnd(baseOffset++,qWordSize,tmpVar4,dWordSize,bitMaskAllBitsSet,dWordSize,shifterOperand));
    instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,dWordSize,String.valueOf(-(Integer.decode(immediateNodeValue) - 1)),wordSize,tmpVar5));
    instructions.add(ReilHelpers.createAnd(baseOffset++,wordSize,tmpVar5,byteSize,oneSet,byteSize,shifterCarryOut));
    return new Pair<String,String>(shifterOperand,shifterCarryOut);
  }
}

protected static Pair < String , String > asrImmediate ( final long offset , final ITranslationEnvironment environment , final List < ReilInstruction > instructions , final String registerNodeValue , final String immediateNodeValue ) { long baseOffset = offset ; final String shifterOperand = environment . getNextVariableString ( ) ; final String shifterCarryOut = environment . getNextVariableString ( ) ; if ( immediateNodeValue . equals ( "0" ) ) { final String tmpVar1 = environment . getNextVariableString ( ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue , wordSize , thirtyOneSet , byteSize , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , byteSize , tmpVar1 , byteSize , oneSet , byteSize , shifterCarryOut ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , byteSize , shifterCarryOut , byteSize , String . valueOf ( 1 ) , dWordSize , shifterOperand ) ) ; return new Pair < String , String > ( shifterOperand , shifterCarryOut ) ; } else { 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 ( ) ; instructions . add ( ReilHelpers . createAdd ( baseOffset ++ , dWordSize , registerNodeValue , dWordSize , bitMaskHighestBitSet , qWordSize , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , qWordSize , tmpVar1 , wordSize , "-" + immediateNodeValue , dWordSize , tmpVar2 ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , bitMaskHighestBitSet , wordSize , "-" + immediateNodeValue , dWordSize , tmpVar3 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dWordSize , tmpVar2 , dWordSize , tmpVar3 , qWordSize , tmpVar4 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , qWordSize , tmpVar4 , dWordSize , bitMaskAllBitsSet , dWordSize , shifterOperand ) ) ; instructions . add ( ReilHelpers . createBsh ( baseOffset ++ , dWordSize , registerNodeValue , dWordSize , String . valueOf ( - ( Integer . decode ( immediateNodeValue ) - 1 ) ) , wordSize , tmpVar5 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , wordSize , tmpVar5 , byteSize , oneSet , byteSize , shifterCarryOut ) ) ; return new Pair < String , String > ( shifterOperand , shifterCarryOut ) ; } }
< rm > , asr # < shift_imm > operation : if shift_imm = = 0 then 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 ] else / shift_imm > 0 / shifter_operand = rm arithmetic_shift_right < shift_imm > shifter_carry_out = rm [ shift_imm - 1 ]
