Cpp program to analyze gate and update database