function luaK.patchtestreg(u,T,B,O)local F=u:getjumpcontrol(T,B)if luaP:GET_OPCODE(F)~="\079\080\095\084\069\083\084\083\069\084"then return false end if O~=luaP.NO_REG and O~=luaP:GETARG_B(F)then luaP:SETARG_A(F,O)else luaP:SET_OPCODE(F,"\079\080\095\084\069\083\084")local T=luaP:GETARG_B(F)luaP:SETARG_A(F,T)luaP:SETARG_B(F,0)end return true end

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
