Preparation of compounds containing amino groups and doubly-bound oxygen atoms bound to the same carbon skeleton