lsb.pl reimplementation on C