Program: 94100
Project: 94100
Buggy source:
public static void addSaveButtonsAndGestures(XC_InitPackageResources.InitPackageResourcesParam resparam,XModuleResources mResources,final Context localContext){
  final GestureEvent gestureEvent=new GestureEvent();
  Logger.log("String_Node_Str",false,true);
  final Bitmap saveImg=BitmapFactory.decodeResource(mResources,R.drawable.save_button);
  if (saveImg == null)   throw new NullPointerException("String_Node_Str");
  int horizontalPosition=Preferences.getBool(Prefs.BUTTON_POSITION) ? Gravity.START : Gravity.END;
  final FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.BOTTOM | horizontalPosition);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      ViewGroup overlay_group=(ViewGroup)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP));
      saveStoryButton=new ImageButton(localContext);
      saveStoryButton.setLayoutParams(layoutParams);
      saveStoryButton.setBackgroundColor(0);
      saveStoryButton.setImageBitmap(saveImg);
      saveStoryButton.setAlpha(0.8f);
      saveStoryButton.setVisibility(Preferences.getInt(Prefs.SAVEMODE_STORY) == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.getInt(Prefs.SAVEMODE_STORY) == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.STORY);
        }
      }
);
      frameLayout.addView(saveStoryButton);
      overlay_group.bringToFront();
      saveStoryButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      saveSnapButton=new ImageButton(localContext);
      saveSnapButton.setLayoutParams(layoutParams);
      saveSnapButton.setBackgroundColor(0);
      saveSnapButton.setAlpha(1f);
      saveSnapButton.setImageBitmap(saveImg);
      saveSnapButton.setVisibility(Preferences.getInt(Prefs.SAVEMODE_SNAP) == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.getInt(Prefs.SAVEMODE_SNAP) == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.SNAP);
        }
      }
);
      frameLayout.addView(saveSnapButton);
      saveSnapButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Logger.printTitle("String_Node_Str");
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
public static void addSaveButtonsAndGestures(XC_InitPackageResources.InitPackageResourcesParam resparam,XModuleResources mResources,final Context localContext){
  final GestureEvent gestureEvent=new GestureEvent();
  Logger.log("String_Node_Str");
  final Bitmap saveImg=BitmapFactory.decodeResource(mResources,R.drawable.save_button);
  if (saveImg == null)   throw new NullPointerException("String_Node_Str");
  int horizontalPosition=Preferences.getBool(Prefs.BUTTON_POSITION) ? Gravity.START : Gravity.END;
  final FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.BOTTOM | horizontalPosition);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final RelativeLayout frameLayout=(RelativeLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getRootView();
      Logger.log("String_Node_Str" + frameLayout);
      ViewGroup overlay_group=(ViewGroup)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP));
      saveStoryButton=new ImageButton(localContext);
      saveStoryButton.setLayoutParams(layoutParams);
      saveStoryButton.setBackgroundColor(0);
      saveStoryButton.setImageBitmap(saveImg);
      saveStoryButton.setAlpha(0.8f);
      saveStoryButton.setVisibility(Preferences.getInt(Prefs.SAVEMODE_STORY) == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.getInt(Prefs.SAVEMODE_STORY) == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.STORY);
        }
      }
);
      frameLayout.addView(saveStoryButton);
      saveStoryButton.bringToFront();
      overlay_group.bringToFront();
      saveStoryButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Saving.performButtonSave();
        }
      }
);
      saveStoryButton.setOnFocusChangeListener(new View.OnFocusChangeListener(){
        @Override public void onFocusChange(        View view,        boolean b){
          Logger.log("String_Node_Str" + b);
          if (!b)           saveStoryButton.bringToFront();
        }
      }
);
    }
  }
);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      saveSnapButton=new ImageButton(localContext);
      saveSnapButton.setLayoutParams(layoutParams);
      saveSnapButton.setBackgroundColor(0);
      saveSnapButton.setAlpha(1f);
      saveSnapButton.setImageBitmap(saveImg);
      saveSnapButton.setVisibility(Preferences.getInt(Prefs.SAVEMODE_SNAP) == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.getInt(Prefs.SAVEMODE_SNAP) == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.SNAP);
        }
      }
);
      frameLayout.addView(saveSnapButton);
      saveSnapButton.bringToFront();
      saveSnapButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Logger.printTitle("String_Node_Str");
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
}