add generate_log_and and or in generate.c