note that the input can be modified along the execution, so the input logging at each branch should get the original input.