// CheckStyle: stop header check
// CheckStyle: stop line length check
// GENERATED CONTENT - DO NOT EDIT
// GENERATORS: org.graalvm.compiler.replacements.processor.ReplacementsAnnotationProcessor, org.graalvm.compiler.replacements.processor.PluginGenerator
package org.graalvm.compiler.nodes;


import java.lang.annotation.Annotation;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.graph.NodeInputList;
import org.graalvm.compiler.nodes.PluginReplacementNode;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedNodeIntrinsicInvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedPluginFactory;
import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedPluginInjectionProvider;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;

//        class: org.graalvm.compiler.nodes.PiNode
//       method: asNonNullClassIntrinsic(java.lang.Object,java.lang.Class<?>,boolean,boolean)
// generated-by: org.graalvm.compiler.replacements.processor.GeneratedNodeIntrinsicPlugin$CustomFactoryPlugin
final class Plugin_PiNode_asNonNullClassIntrinsic extends GeneratedNodeIntrinsicInvocationPlugin {

    @Override
    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
        if (!b.isPluginEnabled(this)) {
            return false;
        }
        ValueNode arg0 = args[0];
        jdk.vm.ci.meta.ResolvedJavaType arg1;
        if (args[1].isConstant()) {
            jdk.vm.ci.meta.JavaConstant cst = args[1].asJavaConstant();
            arg1 = b.getConstantReflection()/* A CONSTANT_REFLECTION */.asJavaType(cst);
            if (arg1 == null) {
                arg1 = snippetReflection/* A SNIPPET_REFLECTION */.asObject(jdk.vm.ci.meta.ResolvedJavaType.class, cst);
            }
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_asNonNullClassIntrinsic.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        boolean arg2;
        if (args[2].isConstant()) {
            arg2 = args[2].asJavaConstant().asInt() != 0;
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_asNonNullClassIntrinsic.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        boolean arg3;
        if (args[3].isConstant()) {
            arg3 = args[3].asJavaConstant().asInt() != 0;
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_asNonNullClassIntrinsic.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1, arg2, arg3)) {
            return true;
        }
        if (b.canDeferPlugin(this)) {
            b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_asNonNullClassIntrinsic.FUNCTION);
            return true;
        }
        throw GraalError.shouldNotReachHere("Can't inline plugin " + b.getClass().toString());
    }
    @Override
    public Class<? extends Annotation> getSource() {
        return org.graalvm.compiler.graph.Node.NodeIntrinsic.class;
    }

    private final org.graalvm.compiler.api.replacements.SnippetReflectionProvider snippetReflection;

    Plugin_PiNode_asNonNullClassIntrinsic(GeneratedPluginInjectionProvider injection) {
        this.snippetReflection = injection.getInjectedArgument(org.graalvm.compiler.api.replacements.SnippetReflectionProvider.class);
    }
}
final class PluginReplacementNode_PiNode_asNonNullClassIntrinsic implements PluginReplacementNode.ReplacementFunction {
    static PluginReplacementNode.ReplacementFunction FUNCTION = new PluginReplacementNode_PiNode_asNonNullClassIntrinsic();

    @Override
    public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args) {
        ValueNode arg0 = args.get(0);
        jdk.vm.ci.meta.ResolvedJavaType arg1;
        if (args.get(1).isConstant()) {
            jdk.vm.ci.meta.JavaConstant cst = args.get(1).asJavaConstant();
            arg1 = b.getConstantReflection()/* B CONSTANT_REFLECTION */.asJavaType(cst);
            if (arg1 == null) {
                arg1 = injection.getInjectedArgument(org.graalvm.compiler.api.replacements.SnippetReflectionProvider.class)/* B SNIPPET_REFLECTION */.asObject(jdk.vm.ci.meta.ResolvedJavaType.class, cst);
            }
        } else {
            return false;
        }
        boolean arg2;
        if (args.get(2).isConstant()) {
            arg2 = args.get(2).asJavaConstant().asInt() != 0;
        } else {
            return false;
        }
        boolean arg3;
        if (args.get(3).isConstant()) {
            arg3 = args.get(3).asJavaConstant().asInt() != 0;
        } else {
            return false;
        }
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1, arg2, arg3)) {
            return true;
        }
        return false;
    }
}

//        class: org.graalvm.compiler.nodes.PiNode
//       method: piCast(java.lang.Object,jdk.vm.ci.meta.ResolvedJavaType,boolean,boolean)
// generated-by: org.graalvm.compiler.replacements.processor.GeneratedNodeIntrinsicPlugin$CustomFactoryPlugin
final class Plugin_PiNode_piCast extends GeneratedNodeIntrinsicInvocationPlugin {

    @Override
    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
        if (!b.isPluginEnabled(this)) {
            return false;
        }
        ValueNode arg0 = args[0];
        jdk.vm.ci.meta.ResolvedJavaType arg1;
        if (args[1].isConstant()) {
            jdk.vm.ci.meta.JavaConstant cst = args[1].asJavaConstant();
            arg1 = b.getConstantReflection()/* A CONSTANT_REFLECTION */.asJavaType(cst);
            if (arg1 == null) {
                arg1 = snippetReflection/* A SNIPPET_REFLECTION */.asObject(jdk.vm.ci.meta.ResolvedJavaType.class, cst);
            }
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_piCast.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        boolean arg2;
        if (args[2].isConstant()) {
            arg2 = args[2].asJavaConstant().asInt() != 0;
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_piCast.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        boolean arg3;
        if (args[3].isConstant()) {
            arg3 = args[3].asJavaConstant().asInt() != 0;
        } else {
            if (b.shouldDeferPlugin(this)) {
                b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_piCast.FUNCTION);
                return true;
            }
            assert b.canDeferPlugin(this) : b.getClass().toString();
            return false;
        }
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1, arg2, arg3)) {
            return true;
        }
        if (b.canDeferPlugin(this)) {
            b.replacePlugin(this, targetMethod, args, PluginReplacementNode_PiNode_piCast.FUNCTION);
            return true;
        }
        throw GraalError.shouldNotReachHere("Can't inline plugin " + b.getClass().toString());
    }
    @Override
    public Class<? extends Annotation> getSource() {
        return org.graalvm.compiler.graph.Node.NodeIntrinsic.class;
    }

    private final org.graalvm.compiler.api.replacements.SnippetReflectionProvider snippetReflection;

    Plugin_PiNode_piCast(GeneratedPluginInjectionProvider injection) {
        this.snippetReflection = injection.getInjectedArgument(org.graalvm.compiler.api.replacements.SnippetReflectionProvider.class);
    }
}
final class PluginReplacementNode_PiNode_piCast implements PluginReplacementNode.ReplacementFunction {
    static PluginReplacementNode.ReplacementFunction FUNCTION = new PluginReplacementNode_PiNode_piCast();

    @Override
    public boolean replace(GraphBuilderContext b, GeneratedPluginInjectionProvider injection, Stamp stamp, NodeInputList<ValueNode> args) {
        ValueNode arg0 = args.get(0);
        jdk.vm.ci.meta.ResolvedJavaType arg1;
        if (args.get(1).isConstant()) {
            jdk.vm.ci.meta.JavaConstant cst = args.get(1).asJavaConstant();
            arg1 = b.getConstantReflection()/* B CONSTANT_REFLECTION */.asJavaType(cst);
            if (arg1 == null) {
                arg1 = injection.getInjectedArgument(org.graalvm.compiler.api.replacements.SnippetReflectionProvider.class)/* B SNIPPET_REFLECTION */.asObject(jdk.vm.ci.meta.ResolvedJavaType.class, cst);
            }
        } else {
            return false;
        }
        boolean arg2;
        if (args.get(2).isConstant()) {
            arg2 = args.get(2).asJavaConstant().asInt() != 0;
        } else {
            return false;
        }
        boolean arg3;
        if (args.get(3).isConstant()) {
            arg3 = args.get(3).asJavaConstant().asInt() != 0;
        } else {
            return false;
        }
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1, arg2, arg3)) {
            return true;
        }
        return false;
    }
}

//        class: org.graalvm.compiler.nodes.PiNode
//       method: piCastNonNull(java.lang.Object,org.graalvm.compiler.nodes.extended.GuardingNode)
// generated-by: org.graalvm.compiler.replacements.processor.GeneratedNodeIntrinsicPlugin$CustomFactoryPlugin
final class Plugin_PiNode_piCastNonNull extends GeneratedNodeIntrinsicInvocationPlugin {

    @Override
    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
        if (!b.isPluginEnabled(this)) {
            return false;
        }
        ValueNode arg0 = args[0];
        ValueNode arg1 = args[1];
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1)) {
            return true;
        }
        return false;
    }
    @Override
    public Class<? extends Annotation> getSource() {
        return org.graalvm.compiler.graph.Node.NodeIntrinsic.class;
    }
}

//        class: org.graalvm.compiler.nodes.PiNode
//       method: piCastNonNullClass(java.lang.Class<?>,org.graalvm.compiler.nodes.extended.GuardingNode)
// generated-by: org.graalvm.compiler.replacements.processor.GeneratedNodeIntrinsicPlugin$CustomFactoryPlugin
final class Plugin_PiNode_piCastNonNullClass extends GeneratedNodeIntrinsicInvocationPlugin {

    @Override
    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
        if (!b.isPluginEnabled(this)) {
            return false;
        }
        ValueNode arg0 = args[0];
        ValueNode arg1 = args[1];
        if (org.graalvm.compiler.nodes.PiNode.intrinsify(b, arg0, arg1)) {
            return true;
        }
        return false;
    }
    @Override
    public Class<? extends Annotation> getSource() {
        return org.graalvm.compiler.graph.Node.NodeIntrinsic.class;
    }
}

//        class: org.graalvm.compiler.nodes.PiNode
//       method: piCastToSnippetReplaceeStamp(java.lang.Object)
// generated-by: org.graalvm.compiler.replacements.processor.GeneratedNodeIntrinsicPlugin$ConstructorPlugin
final class Plugin_PiNode_piCastToSnippetReplaceeStamp extends GeneratedNodeIntrinsicInvocationPlugin {

    @Override
    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
        if (!b.isPluginEnabled(this)) {
            return false;
        }
        ValueNode arg0 = args[0];
        org.graalvm.compiler.nodes.PiNode.Placeholder node = new org.graalvm.compiler.nodes.PiNode.Placeholder(arg0);
        b.addPush(JavaKind.Object, node);
        return true;
    }
    @Override
    public Class<? extends Annotation> getSource() {
        return org.graalvm.compiler.graph.Node.NodeIntrinsic.class;
    }
}

public class PluginFactory_PiNode implements GeneratedPluginFactory {
    @Override
    public void registerPlugins(InvocationPlugins plugins, GeneratedPluginInjectionProvider injection) {
        plugins.register(new Plugin_PiNode_asNonNullClassIntrinsic(injection), org.graalvm.compiler.nodes.PiNode.class, "asNonNullClassIntrinsic", java.lang.Object.class, java.lang.Class.class, boolean.class, boolean.class);
        plugins.register(new Plugin_PiNode_piCast(injection), org.graalvm.compiler.nodes.PiNode.class, "piCast", java.lang.Object.class, jdk.vm.ci.meta.ResolvedJavaType.class, boolean.class, boolean.class);
        plugins.register(new Plugin_PiNode_piCastNonNull(), org.graalvm.compiler.nodes.PiNode.class, "piCastNonNull", java.lang.Object.class, org.graalvm.compiler.nodes.extended.GuardingNode.class);
        plugins.register(new Plugin_PiNode_piCastNonNullClass(), org.graalvm.compiler.nodes.PiNode.class, "piCastNonNullClass", java.lang.Class.class, org.graalvm.compiler.nodes.extended.GuardingNode.class);
        plugins.register(new Plugin_PiNode_piCastToSnippetReplaceeStamp(), org.graalvm.compiler.nodes.PiNode.class, "piCastToSnippetReplaceeStamp", java.lang.Object.class);
    }
}