+ SSABlock initialBlock = parent.firstBlock;
+ if(initialBlock.parameters.length != apply.getParameters().length)
+ return false;
+
+ // The jump is a return (with one parameter)
+ // The parameter of the jump is the target of LetApply
+ Jump jump = (Jump)exit;
+ Cont targetCont = jump.getTarget().getBinding();
+ if(targetCont != parent.returnCont) {
+ SSABlock targetBlock = (SSABlock)targetCont;
+ if(targetBlock.firstStatement != null)
+ return false;
+ if(!(targetBlock.exit instanceof Jump))
+ return false;
+ Jump targetJump = (Jump)targetBlock.exit;
+ if(targetJump.getTarget().getBinding() != parent.returnCont)
+ return false;
+ if(targetJump.getParameters().length != 1)
+ return false;
+
+ BoundVar applyTarget = apply.getTarget();
+ ValRef targetJumpParameter = targetJump.getParameter(0);
+ isSameParam: if(!SSAUtils.representSameValue(applyTarget, targetJumpParameter)) {
+ BoundVar[] targetBlockParameters = targetBlock.getParameters();
+ for(int i=0;i<targetBlockParameters.length;++i) {
+ if(targetJumpParameter.getBinding() == targetBlockParameters[i]
+ && jump.getParameter(i).getBinding() == applyTarget)
+ break isSameParam;
+ }
+ return false;
+ }
+ }
+ else {
+ if(jump.getParameters().length != 1)
+ return false;
+ if(!SSAUtils.representSameValue(apply.getTarget(), jump.getParameter(0)))
+ return false;
+ }