The board was inside an old hydraulic conveyor machine (produced in the 80's or 90's)
EDIT: after asking for a schematic: This board tests limit switches and light some LEDs. All switches inputs have 3.3 kOhm pull ups also these inputs are RC filtered and straight into this chip (at net between cap and resistor). The LEDs are directly driven by this chip, each with 150 Ohm resistor in series. Other than that everything is weird. The pull-up supply voltage rail is not connected to this chip at any pin. ground is connected to pins 20-26-27-28. I may do a neat schematic and further tests but I don't know how will that help identifying the chip.