basic C MLP implementation