// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/unittest_preserve_unknown_enum.proto

#include <google/protobuf/unittest_preserve_unknown_enum.pb.h>

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace proto3_preserve_unknown_enum_unittest {
class MyMessageDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<MyMessage>
      _instance;
  int oneof_e_1_;
  int oneof_e_2_;
} _MyMessage_default_instance_;
class MyMessagePlusExtraDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<MyMessagePlusExtra>
      _instance;
  int oneof_e_1_;
  int oneof_e_2_;
} _MyMessagePlusExtra_default_instance_;
}  // namespace proto3_preserve_unknown_enum_unittest
namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto {
static void InitDefaultsMyMessage() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_;
    new (ptr) ::proto3_preserve_unknown_enum_unittest::MyMessage();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::proto3_preserve_unknown_enum_unittest::MyMessage::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_MyMessage =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMyMessage}, {}};

static void InitDefaultsMyMessagePlusExtra() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_;
    new (ptr) ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_MyMessagePlusExtra =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMyMessagePlusExtra}, {}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_MyMessage.base);
  ::google::protobuf::internal::InitSCC(&scc_info_MyMessagePlusExtra.base);
}

::google::protobuf::Metadata file_level_metadata[2];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[2];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, _internal_metadata_),
  ~0u,  // no _extensions_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_packed_e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_packed_unexpected_e_),
  offsetof(::proto3_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_1_),
  offsetof(::proto3_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_2_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, o_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, _internal_metadata_),
  ~0u,  // no _extensions_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_packed_e_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_packed_unexpected_e_),
  offsetof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtraDefaultTypeInternal, oneof_e_1_),
  offsetof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtraDefaultTypeInternal, oneof_e_2_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, o_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(::proto3_preserve_unknown_enum_unittest::MyMessage)},
  { 12, -1, sizeof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "google/protobuf/unittest_preserve_unknown_enum.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, file_level_enum_descriptors, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n4google/protobuf/unittest_preserve_unkn"
      "own_enum.proto\022%proto3_preserve_unknown_"
      "enum_unittest\"\301\003\n\tMyMessage\0228\n\001e\030\001 \001(\0162-"
      ".proto3_preserve_unknown_enum_unittest.M"
      "yEnum\022A\n\nrepeated_e\030\002 \003(\0162-.proto3_prese"
      "rve_unknown_enum_unittest.MyEnum\022L\n\021repe"
      "ated_packed_e\030\003 \003(\0162-.proto3_preserve_un"
      "known_enum_unittest.MyEnumB\002\020\001\022\\\n\034repeat"
      "ed_packed_unexpected_e\030\004 \003(\01626.proto3_pr"
      "eserve_unknown_enum_unittest.MyEnumPlusE"
      "xtra\022B\n\toneof_e_1\030\005 \001(\0162-.proto3_preserv"
      "e_unknown_enum_unittest.MyEnumH\000\022B\n\toneo"
      "f_e_2\030\006 \001(\0162-.proto3_preserve_unknown_en"
      "um_unittest.MyEnumH\000B\003\n\001o\"\373\003\n\022MyMessageP"
      "lusExtra\022A\n\001e\030\001 \001(\01626.proto3_preserve_un"
      "known_enum_unittest.MyEnumPlusExtra\022J\n\nr"
      "epeated_e\030\002 \003(\01626.proto3_preserve_unknow"
      "n_enum_unittest.MyEnumPlusExtra\022U\n\021repea"
      "ted_packed_e\030\003 \003(\01626.proto3_preserve_unk"
      "nown_enum_unittest.MyEnumPlusExtraB\002\020\001\022`"
      "\n\034repeated_packed_unexpected_e\030\004 \003(\01626.p"
      "roto3_preserve_unknown_enum_unittest.MyE"
      "numPlusExtraB\002\020\001\022K\n\toneof_e_1\030\005 \001(\01626.pr"
      "oto3_preserve_unknown_enum_unittest.MyEn"
      "umPlusExtraH\000\022K\n\toneof_e_2\030\006 \001(\01626.proto"
      "3_preserve_unknown_enum_unittest.MyEnumP"
      "lusExtraH\000B\003\n\001o*#\n\006MyEnum\022\007\n\003FOO\020\000\022\007\n\003BA"
      "R\020\001\022\007\n\003BAZ\020\002*\?\n\017MyEnumPlusExtra\022\t\n\005E_FOO"
      "\020\000\022\t\n\005E_BAR\020\001\022\t\n\005E_BAZ\020\002\022\013\n\007E_EXTRA\020\003B,\242"
      "\002\014UnknownEnums\252\002\032Google.Protobuf.TestPro"
      "tosb\006proto3"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 1211);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "google/protobuf/unittest_preserve_unknown_enum.proto", &protobuf_RegisterTypes);
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto
namespace proto3_preserve_unknown_enum_unittest {
const ::google::protobuf::EnumDescriptor* MyEnum_descriptor() {
  protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_enum_descriptors[0];
}
bool MyEnum_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
    case 2:
      return true;
    default:
      return false;
  }
}

const ::google::protobuf::EnumDescriptor* MyEnumPlusExtra_descriptor() {
  protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_enum_descriptors[1];
}
bool MyEnumPlusExtra_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
    case 2:
    case 3:
      return true;
    default:
      return false;
  }
}


// ===================================================================

void MyMessage::InitAsDefaultInstance() {
  ::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_1_ = 0;
  ::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_2_ = 0;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MyMessage::kEFieldNumber;
const int MyMessage::kRepeatedEFieldNumber;
const int MyMessage::kRepeatedPackedEFieldNumber;
const int MyMessage::kRepeatedPackedUnexpectedEFieldNumber;
const int MyMessage::kOneofE1FieldNumber;
const int MyMessage::kOneofE2FieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

MyMessage::MyMessage()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessage.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:proto3_preserve_unknown_enum_unittest.MyMessage)
}
MyMessage::MyMessage(const MyMessage& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      repeated_e_(from.repeated_e_),
      repeated_packed_e_(from.repeated_packed_e_),
      repeated_packed_unexpected_e_(from.repeated_packed_unexpected_e_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  e_ = from.e_;
  clear_has_o();
  switch (from.o_case()) {
    case kOneofE1: {
      set_oneof_e_1(from.oneof_e_1());
      break;
    }
    case kOneofE2: {
      set_oneof_e_2(from.oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:proto3_preserve_unknown_enum_unittest.MyMessage)
}

void MyMessage::SharedCtor() {
  e_ = 0;
  clear_has_o();
}

MyMessage::~MyMessage() {
  // @@protoc_insertion_point(destructor:proto3_preserve_unknown_enum_unittest.MyMessage)
  SharedDtor();
}

void MyMessage::SharedDtor() {
  if (has_o()) {
    clear_o();
  }
}

void MyMessage::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* MyMessage::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const MyMessage& MyMessage::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessage.base);
  return *internal_default_instance();
}


void MyMessage::clear_o() {
// @@protoc_insertion_point(one_of_clear_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  switch (o_case()) {
    case kOneofE1: {
      // No need to clear
      break;
    }
    case kOneofE2: {
      // No need to clear
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = O_NOT_SET;
}


void MyMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  repeated_e_.Clear();
  repeated_packed_e_.Clear();
  repeated_packed_unexpected_e_.Clear();
  e_ = 0;
  clear_o();
  _internal_metadata_.Clear();
}

bool MyMessage::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_oneof_e_1(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_oneof_e_2(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:proto3_preserve_unknown_enum_unittest.MyMessage)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:proto3_preserve_unknown_enum_unittest.MyMessage)
  return false;
#undef DO_
}

void MyMessage::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  if (this->e() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      1, this->e(), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  if (this->repeated_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      2,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_e(i), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  if (this->repeated_packed_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      3,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_packed_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_packed_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_packed_e(i), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  if (this->repeated_packed_unexpected_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      4,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_packed_unexpected_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_packed_unexpected_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_packed_unexpected_e(i), output);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  if (has_oneof_e_1()) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      5, this->oneof_e_1(), output);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  if (has_oneof_e_2()) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      6, this->oneof_e_2(), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:proto3_preserve_unknown_enum_unittest.MyMessage)
}

::google::protobuf::uint8* MyMessage::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  if (this->e() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      1, this->e(), target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  if (this->repeated_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      2,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_e_, target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  if (this->repeated_packed_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      3,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_packed_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_packed_e_, target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  if (this->repeated_packed_unexpected_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      4,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_packed_unexpected_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_packed_unexpected_e_, target);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  if (has_oneof_e_1()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      5, this->oneof_e_1(), target);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  if (has_oneof_e_2()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      6, this->oneof_e_2(), target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:proto3_preserve_unknown_enum_unittest.MyMessage)
  return target;
}

size_t MyMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_packed_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_packed_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_packed_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_packed_unexpected_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_packed_unexpected_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_packed_unexpected_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  if (this->e() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->e());
  }

  switch (o_case()) {
    // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
    case kOneofE1: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_1());
      break;
    }
    // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
    case kOneofE2: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void MyMessage::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  GOOGLE_DCHECK_NE(&from, this);
  const MyMessage* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const MyMessage>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto3_preserve_unknown_enum_unittest.MyMessage)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:proto3_preserve_unknown_enum_unittest.MyMessage)
    MergeFrom(*source);
  }
}

void MyMessage::MergeFrom(const MyMessage& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  repeated_e_.MergeFrom(from.repeated_e_);
  repeated_packed_e_.MergeFrom(from.repeated_packed_e_);
  repeated_packed_unexpected_e_.MergeFrom(from.repeated_packed_unexpected_e_);
  if (from.e() != 0) {
    set_e(from.e());
  }
  switch (from.o_case()) {
    case kOneofE1: {
      set_oneof_e_1(from.oneof_e_1());
      break;
    }
    case kOneofE2: {
      set_oneof_e_2(from.oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
}

void MyMessage::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void MyMessage::CopyFrom(const MyMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool MyMessage::IsInitialized() const {
  return true;
}

void MyMessage::Swap(MyMessage* other) {
  if (other == this) return;
  InternalSwap(other);
}
void MyMessage::InternalSwap(MyMessage* other) {
  using std::swap;
  repeated_e_.InternalSwap(&other->repeated_e_);
  repeated_packed_e_.InternalSwap(&other->repeated_packed_e_);
  repeated_packed_unexpected_e_.InternalSwap(&other->repeated_packed_unexpected_e_);
  swap(e_, other->e_);
  swap(o_, other->o_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata MyMessage::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void MyMessagePlusExtra::InitAsDefaultInstance() {
  ::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_.oneof_e_1_ = 0;
  ::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_.oneof_e_2_ = 0;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MyMessagePlusExtra::kEFieldNumber;
const int MyMessagePlusExtra::kRepeatedEFieldNumber;
const int MyMessagePlusExtra::kRepeatedPackedEFieldNumber;
const int MyMessagePlusExtra::kRepeatedPackedUnexpectedEFieldNumber;
const int MyMessagePlusExtra::kOneofE1FieldNumber;
const int MyMessagePlusExtra::kOneofE2FieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

MyMessagePlusExtra::MyMessagePlusExtra()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessagePlusExtra.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
}
MyMessagePlusExtra::MyMessagePlusExtra(const MyMessagePlusExtra& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      repeated_e_(from.repeated_e_),
      repeated_packed_e_(from.repeated_packed_e_),
      repeated_packed_unexpected_e_(from.repeated_packed_unexpected_e_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  e_ = from.e_;
  clear_has_o();
  switch (from.o_case()) {
    case kOneofE1: {
      set_oneof_e_1(from.oneof_e_1());
      break;
    }
    case kOneofE2: {
      set_oneof_e_2(from.oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
}

void MyMessagePlusExtra::SharedCtor() {
  e_ = 0;
  clear_has_o();
}

MyMessagePlusExtra::~MyMessagePlusExtra() {
  // @@protoc_insertion_point(destructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  SharedDtor();
}

void MyMessagePlusExtra::SharedDtor() {
  if (has_o()) {
    clear_o();
  }
}

void MyMessagePlusExtra::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* MyMessagePlusExtra::descriptor() {
  ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const MyMessagePlusExtra& MyMessagePlusExtra::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessagePlusExtra.base);
  return *internal_default_instance();
}


void MyMessagePlusExtra::clear_o() {
// @@protoc_insertion_point(one_of_clear_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  switch (o_case()) {
    case kOneofE1: {
      // No need to clear
      break;
    }
    case kOneofE2: {
      // No need to clear
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = O_NOT_SET;
}


void MyMessagePlusExtra::Clear() {
// @@protoc_insertion_point(message_clear_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  repeated_e_.Clear();
  repeated_packed_e_.Clear();
  repeated_packed_unexpected_e_.Clear();
  e_ = 0;
  clear_o();
  _internal_metadata_.Clear();
}

bool MyMessagePlusExtra::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          ::google::protobuf::uint32 length;
          DO_(input->ReadVarint32(&length));
          ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
          while (input->BytesUntilLimit() > 0) {
            int value;
            DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
            add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
          }
          input->PopLimit(limit);
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_oneof_e_1(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          set_oneof_e_2(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  return false;
#undef DO_
}

void MyMessagePlusExtra::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  if (this->e() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      1, this->e(), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  if (this->repeated_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      2,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_e(i), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  if (this->repeated_packed_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      3,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_packed_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_packed_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_packed_e(i), output);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  if (this->repeated_packed_unexpected_e_size() > 0) {
    ::google::protobuf::internal::WireFormatLite::WriteTag(
      4,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      output);
    output->WriteVarint32(
        static_cast< ::google::protobuf::uint32>(_repeated_packed_unexpected_e_cached_byte_size_));
  }
  for (int i = 0, n = this->repeated_packed_unexpected_e_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
      this->repeated_packed_unexpected_e(i), output);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  if (has_oneof_e_1()) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      5, this->oneof_e_1(), output);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  if (has_oneof_e_2()) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      6, this->oneof_e_2(), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
}

::google::protobuf::uint8* MyMessagePlusExtra::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  if (this->e() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      1, this->e(), target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  if (this->repeated_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      2,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_e_, target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  if (this->repeated_packed_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      3,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_packed_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_packed_e_, target);
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  if (this->repeated_packed_unexpected_e_size() > 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
      4,
      ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
      target);
    target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(      static_cast< ::google::protobuf::uint32>(
            _repeated_packed_unexpected_e_cached_byte_size_), target);
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
      this->repeated_packed_unexpected_e_, target);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  if (has_oneof_e_1()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      5, this->oneof_e_1(), target);
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  if (has_oneof_e_2()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      6, this->oneof_e_2(), target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  return target;
}

size_t MyMessagePlusExtra::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_packed_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_packed_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_packed_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  {
    size_t data_size = 0;
    unsigned int count = static_cast<unsigned int>(this->repeated_packed_unexpected_e_size());for (unsigned int i = 0; i < count; i++) {
      data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
        this->repeated_packed_unexpected_e(static_cast<int>(i)));
    }
    if (data_size > 0) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
            static_cast< ::google::protobuf::int32>(data_size));
    }
    int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
    GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    _repeated_packed_unexpected_e_cached_byte_size_ = cached_size;
    GOOGLE_SAFE_CONCURRENT_WRITES_END();
    total_size += data_size;
  }

  // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  if (this->e() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->e());
  }

  switch (o_case()) {
    // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
    case kOneofE1: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_1());
      break;
    }
    // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
    case kOneofE2: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void MyMessagePlusExtra::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  GOOGLE_DCHECK_NE(&from, this);
  const MyMessagePlusExtra* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const MyMessagePlusExtra>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
    MergeFrom(*source);
  }
}

void MyMessagePlusExtra::MergeFrom(const MyMessagePlusExtra& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  repeated_e_.MergeFrom(from.repeated_e_);
  repeated_packed_e_.MergeFrom(from.repeated_packed_e_);
  repeated_packed_unexpected_e_.MergeFrom(from.repeated_packed_unexpected_e_);
  if (from.e() != 0) {
    set_e(from.e());
  }
  switch (from.o_case()) {
    case kOneofE1: {
      set_oneof_e_1(from.oneof_e_1());
      break;
    }
    case kOneofE2: {
      set_oneof_e_2(from.oneof_e_2());
      break;
    }
    case O_NOT_SET: {
      break;
    }
  }
}

void MyMessagePlusExtra::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void MyMessagePlusExtra::CopyFrom(const MyMessagePlusExtra& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool MyMessagePlusExtra::IsInitialized() const {
  return true;
}

void MyMessagePlusExtra::Swap(MyMessagePlusExtra* other) {
  if (other == this) return;
  InternalSwap(other);
}
void MyMessagePlusExtra::InternalSwap(MyMessagePlusExtra* other) {
  using std::swap;
  repeated_e_.InternalSwap(&other->repeated_e_);
  repeated_packed_e_.InternalSwap(&other->repeated_packed_e_);
  repeated_packed_unexpected_e_.InternalSwap(&other->repeated_packed_unexpected_e_);
  swap(e_, other->e_);
  swap(o_, other->o_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata MyMessagePlusExtra::GetMetadata() const {
  protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages];
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace proto3_preserve_unknown_enum_unittest
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto3_preserve_unknown_enum_unittest::MyMessage* Arena::CreateMaybeMessage< ::proto3_preserve_unknown_enum_unittest::MyMessage >(Arena* arena) {
  return Arena::CreateInternal< ::proto3_preserve_unknown_enum_unittest::MyMessage >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra* Arena::CreateMaybeMessage< ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra >(Arena* arena) {
  return Arena::CreateInternal< ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)
