function luaK.patchtestreg(y,S,Q,X)local V=y:getjumpcontrol(S,Q)if luaP:GET_OPCODE(V)~="\079\080\095\084\069\083\084\083\069\084"then return false end if X~=luaP.NO_REG and X~=luaP:GETARG_B(V)then luaP:SETARG_A(V,X)else luaP:SET_OPCODE(V,"\079\080\095\084\069\083\084")local S=luaP:GETARG_B(V)luaP:SETARG_A(V,S)luaP:SETARG_B(V,0)end return true end
------------------------------------------------------------------------
--
-- * used in luaK:removevalues(), luaK:patchlistaux()
------------------------------------------------------------------------
function luaK:patchtestreg(fs, node, reg)
	local i = self:getjumpcontrol(fs, node)
	if luaP:GET_OPCODE(i) ~= "OP_TESTSET" then
		return false -- cannot patch other instructions
	end
	if reg ~= luaP.NO_REG and reg ~= luaP:GETARG_B(i) then
		luaP:SETARG_A(i, reg)
	else -- no register to put value or register already has the value
		-- due to use of a table as i, i cannot be replaced by another table
		-- so the following is required; there is no change to ARG_C
		luaP:SET_OPCODE(i, "OP_TEST")
		local b = luaP:GETARG_B(i)
		luaP:SETARG_A(i, b)
		luaP:SETARG_B(i, 0)
		-- *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); /* C */
	end
	return true
end
