def METHOD_NAME(
    module: pqg.SimpleModule, builder: pqg.BasicQisBuilder, op: Gate
):
    if op.classical_controls:
        result = op.classical_controls[0]
        value = "zero" if op.classical_control_value == 0 else "one"
        # Pull off the first control and recurse.
        op_with_less_controls = Gate(**op.__dict__)
        op_with_less_controls.classical_controls = (
            op_with_less_controls.classical_controls[1:]
        )
        op_with_less_controls.classical_control_value = (
            op_with_less_controls.classical_control_value
            if isinstance(
                op_with_less_controls.classical_control_value, int
            )
            else (op_with_less_controls.classical_control_value[1:])
            if op_with_less_controls.classical_control_value is not None
            else None
        )
        branch_body = {
            value: (
                lambda: METHOD_NAME(
                    module, builder, op_with_less_controls
                )
            )
        }
        builder.if_result(module.results[result], **branch_body)
        return
    if op.controls:
        if op.name not in ("CNOT", "CX", "CZ") or len(op.controls) != 1:
            raise NotImplementedError(
                "Arbitrary controlled quantum operations are not yet supported."
            )
    if op.name == "X":
        builder.x(module.qubits[op.targets[0]])
    elif op.name == "Y":
        builder.y(module.qubits[op.targets[0]])
    elif op.name == "Z":
        builder.z(module.qubits[op.targets[0]])
    elif op.name == "S":
        builder.s(module.qubits[op.targets[0]])
    elif op.name == "T":
        builder.t(module.qubits[op.targets[0]])
    elif op.name == "SNOT":
        builder.h(module.qubits[op.targets[0]])
    elif op.name in ("CNOT", "CX"):
        builder.cx(
            module.qubits[op.controls[0]], module.qubits[op.targets[0]]
        )
    elif op.name == "CZ":
        builder.cz(
            module.qubits[op.controls[0]], module.qubits[op.targets[0]]
        )
    elif op.name == "RX":
        builder.rx(op.arg_value, module.qubits[op.targets[0]])
    elif op.name == "RY":
        builder.ry(op.arg_value, module.qubits[op.targets[0]])
    elif op.name == "RZ":
        builder.rz(op.arg_value, module.qubits[op.targets[0]])
    elif op.name in ("CRZ", "TOFFOLI"):
        raise NotImplementedError(
            "Decomposition of CRZ and Toffoli gates into base "
            + "profile instructions is not yet implemented."
        )
    else:
        raise ValueError(
            f"Gate {op.name} not supported by the basic QIR builder, "
            + "and may require a custom declaration."
        )