// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/src/service_registry/service_registry.cpp
// Function: Boss::ServiceRegistry::Save(Boss::IOStream*)
RetCode BOSS_CALL ServiceRegistry::Save(IOStream *stream)
  {
    if (!stream)
      return Status::InvalidArgument;
    try
    {
      std::list<IServiceInfoPtr> ServiceInfoSet;
      {
        std::lock_guard<std::recursive_mutex> Lock(Mtx);
        for (auto const &service : Services)
        {
          bool Continue = false;
          for (auto Info : ServiceInfoSet)
          {
            if (Info.Get() == service.second.Get())
            {
              Continue = true;
              break;
            }
          }
          if (Continue)
            continue;
          ServiceInfoSet.push_back(service.second);
        }
      }
      auto ServiceEnum = Base<Enum>::Create();
      for (auto const &service : ServiceInfoSet)
      {
        RetCode Code = Status::Ok;
        auto ServiceItem = PropertyBagType::Create(ServiceTag);
        ServiceEnum->AddItem(ServiceItem);
        {
          ServiceId SrvId = 0;
          Code = service->GetServiceId(&SrvId);
          if (Code != Status::Ok)
            return Code;
          if ((Code = ServiceItem->SetProperty(ServiceIdTag, Base<EntityId>::Create(SrvId).Get())) != Status::Ok)
            return Code;
        }
        {
          RefObjPtr<IEnum> ClassIds;
          if ((service->GetClassIds(ClassIds.GetPPtr())) != Status::Ok)
            return Code;
          if ((Code = ServiceItem->SetProperty(ClassIdsTag, ClassIds.Get())) != Status::Ok)
            return Code;
        }
        {
          RefObjQIPtr<IRemoteServiceInfo> RemoteService(service);
          if (RemoteService.Get())
          {
            {
              ClassId SerializerId = 0;
              if ((Code = RemoteService->GetSerializerId(&SerializerId)) != Status::Ok ||
                  (Code = ServiceItem->SetProperty(SerializerIdTag, Base<EntityId>::Create(SerializerId).Get())) != Status::Ok)
              {
                return Code;
              }
            }
            {
              ClassId RemotingId = 0;
              if ((Code = RemoteService->GetRemotingId(&RemotingId)) != Status::Ok ||
                  (Code = ServiceItem->SetProperty(RemotingIdTag, Base<EntityId>::Create(RemotingId).Get())) != Status::Ok)
              {
                return Code;
              }
            }
            {
              ClassId TransportId = 0;
              if ((Code = RemoteService->GetTransportId(&TransportId)) != Status::Ok ||
                  (Code = ServiceItem->SetProperty(TransportIdTag, Base<EntityId>::Create(TransportId).Get())) != Status::Ok)
              {
                return Code;
              }
            }
            RefObjPtr<IPropertyBag> TransportProps;
            if ((Code = RemoteService->GetTransportProperties(TransportProps.GetPPtr())) != Status::Ok ||
                (Code = ServiceItem->SetProperty(TransportPropertiesTag, TransportProps.Get())) != Status::Ok)
            {
              return Code;
            }
            continue;
          }
        }
        {
          RefObjQIPtr<ILocalServiceInfo> LocalService(service);
          if (LocalService.Get())
          {
            RefObjPtr<IString> ModulePath;
            if ((Code = LocalService->GetModulePath(ModulePath.GetPPtr())) != Status::Ok ||
                (Code = ServiceItem->SetProperty(ModulePathTag, ModulePath.Get())) != Status::Ok)
            {
              return Code;
            }
            continue;
          }
        }
      }
      auto Registry = PropertyBagType::Create(RegistryTag);
      RetCode Code = Registry->SetProperty(ServicesTag, ServiceEnum.Get());
      if (Code != Status::Ok)
        return Code;
      RefObjQIPtr<ISerializable> Serializable(Registry);
      if (!Serializable.Get())
        return Status::Fail;
      if ((Code = Serializable->Save(stream)) != Status::Ok)
        return Code;
    }
    catch (std::exception const &)
    {
      return Status::Fail;
    }
    return Status::Ok;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
testq %rsi, %rsi
je 0x1d321
movq %rdi, %rbx
movq %rsi, 0x48(%rsp)
leaq 0x50(%rsp), %r14
movq %r14, 0x8(%r14)
movq %r14, (%r14)
andq $0x0, 0x10(%r14)
addq $0x28, %rdi
movq %rdi, 0x30(%rsp)
callq 0x1e168
addq $0x60, %rbx
leaq 0x28(%rsp), %r12
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x1cf70
movq %rbx, 0x38(%rsp)
leaq 0x10(%rbx), %r13
movq %r14, %rbp
movq (%rbp), %rbp
cmpq %r14, %rbp
je 0x1cf5e
movq 0x10(%rbp), %rdi
movq %rdi, 0x28(%rsp)
testq %rdi, %rdi
je 0x1cf43
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x28(%rsp), %r15
jmp 0x1cf46
xorl %r15d, %r15d
movq (%r13), %rbx
movq %r12, %rdi
callq 0x1d74c
cmpq %rbx, %r15
jne 0x1cf1f
movq 0x38(%rsp), %rbx
jmp 0x1cf0b
movq %r14, %rdi
movq %r13, %rsi
callq 0x1ddce
movq 0x38(%rsp), %rbx
jmp 0x1cf0b
movq 0x30(%rsp), %rdi
callq 0x19680
leaq 0x28(%rsp), %rdi
callq 0x1ddda
leaq 0x50(%rsp), %r12
leaq 0x20(%rsp), %rbp
movq (%r12), %r12
leaq 0x50(%rsp), %rax
cmpq %rax, %r12
je 0x1d32a
movq %rbp, %rdi
leaq 0xba09f(%rip), %rsi     # 0xd7049
callq 0x1de52
movq 0x28(%rsp), %rbx
movq 0x20(%rsp), %rdi
movq %rdi, 0x40(%rsp)
testq %rdi, %rdi
leaq 0x40(%rsp), %r13
je 0x1cfce
movq (%rdi), %rax
callq *0x18(%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1ded6
leaq 0x10(%r12), %rbx
movq %r13, %rdi
callq 0x1ddbe
andl $0x0, 0x10(%rsp)
movq (%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %r13
movq %r13, %rsi
callq *0x28(%rax)
movl %eax, %r14d
testl %eax, %eax
jne 0x1d30b
movq 0x20(%rsp), %r14
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x1df30
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%r14), %rax
movq %r14, %rdi
leaq 0xba01b(%rip), %rsi     # 0xd7051
callq *0x38(%rax)
movl %eax, %r14d
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x1dfb2
testl %r14d, %r14d
jne 0x1d30b
andq $0x0, 0x8(%rsp)
movq (%rbx), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x30(%rax)
xorl %r13d, %r13d
movl $0x0, %r14d
testl %eax, %eax
jne 0x1d095
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rdx
movq (%rdi), %rax
leaq 0xb9fd6(%rip), %rsi     # 0xd705b
callq *0x38(%rax)
testl %eax, %eax
sete %r13b
cmovnel %eax, %r15d
movl %r15d, %r14d
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1d73c
testb %r13b, %r13b
je 0x1d30b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1dfc2
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
leaq 0x10(%rsp), %r13
je 0x1d0de
andl $0x0, 0x1c(%rsp)
movq (%rdi), %rax
leaq 0x1c(%rsp), %rsi
callq *0x38(%rax)
testl %eax, %eax
je 0x1d0e3
movl %eax, %r14d
jmp 0x1d131
xorl %r13d, %r13d
jmp 0x1d135
movq 0x20(%rsp), %r15
movq %r13, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x1df30
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%r15), %rax
movq %r15, %rdi
leaq 0xb9f52(%rip), %rsi     # 0xd7064
callq *0x38(%rax)
movl %eax, %r15d
movq %r13, %rdi
callq 0x1dfb2
testl %r15d, %r15d
je 0x1d1da
movl %r15d, %r14d
leaq 0x8(%rsp), %r15
pushq $0x1
popq %r13
movq %r15, %rdi
callq 0x1dfdc
testl %r13d, %r13d
jne 0x1d1b7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1dfec
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
leaq 0x10(%rsp), %rsi
je 0x1d1ac
andq $0x0, 0x10(%rsp)
movq (%rdi), %rax
callq *0x38(%rax)
movl %eax, %ebx
pushq $0x1
popq %r13
testl %eax, %eax
jne 0x1d19d
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq (%rdi), %rax
leaq 0xb9f1e(%rip), %rsi     # 0xd70a4
callq *0x38(%rax)
testl %eax, %eax
pushq $0x1
popq %r13
pushq $0x7
popq %rcx
cmovel %ecx, %r13d
cmovnel %eax, %r14d
movl %r14d, %ebx
leaq 0x10(%rsp), %rdi
callq 0x1dabe
movl %ebx, %r14d
jmp 0x1d1af
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x1e006
movl %r14d, %r15d
movq %rbp, %rdi
callq 0x1ddbe
testl %r13d, %r13d
je 0x1cf8e
cmpl $0x7, %r13d
je 0x1cf8e
jmp 0x1d3b9
andl $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0x1c(%rsp), %rsi
callq *0x40(%rax)
testl %eax, %eax
leaq 0x8(%rsp), %r15
jne 0x1d0d9
movq 0x20(%rsp), %r15
movq %r13, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x1df30
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%r15), %rax
movq %r15, %rdi
leaq 0xb9e46(%rip), %rsi     # 0xd7071
callq *0x38(%rax)
movl %eax, %r15d
movq %r13, %rdi
callq 0x1dfb2
testl %r15d, %r15d
jne 0x1d129
andl $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0x1c(%rsp), %rsi
callq *0x48(%rax)
testl %eax, %eax
leaq 0x8(%rsp), %r15
jne 0x1d0d9
movq 0x20(%rsp), %r15
movq %r13, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x1df30
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%r15), %rax
movq %r15, %rdi
leaq 0xb9de9(%rip), %rsi     # 0xd707c
callq *0x38(%rax)
movl %eax, %r15d
movq %r13, %rdi
callq 0x1dfb2
testl %r15d, %r15d
jne 0x1d129
andq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x50(%rax)
movl %eax, %r15d
pushq $0x1
popq %r13
testl %eax, %eax
jne 0x1d2f4
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq (%rdi), %rax
leaq 0xb9db3(%rip), %rsi     # 0xd7090
callq *0x38(%rax)
testl %eax, %eax
pushq $0x1
popq %r13
pushq $0x7
popq %rcx
cmovel %ecx, %r13d
cmovnel %eax, %r14d
movl %r14d, %r15d
leaq 0x10(%rsp), %rdi
callq 0x1ddae
movl %r15d, %r14d
leaq 0x8(%rsp), %r15
jmp 0x1d135
leaq 0x20(%rsp), %rdi
callq 0x1ddbe
pushq $0x1
popq %r13
movl %r14d, %r15d
jmp 0x1d3b9
pushq $0x5
popq %r15
jmp 0x1d3d4
leaq 0xb9d0f(%rip), %rsi     # 0xd7040
leaq 0x20(%rsp), %rdi
callq 0x1d75c
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rdi), %rax
leaq 0xb9d55(%rip), %rsi     # 0xd70af
callq *0x38(%rax)
testl %eax, %eax
je 0x1d36a
pushq $0x1
popq %r13
movl %eax, %r15d
jmp 0x1d3af
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x1e016
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d39d
movq (%rdi), %rax
movq 0x48(%rsp), %rsi
callq *0x30(%rax)
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
cmovnel %eax, %r15d
jmp 0x1d3a5
pushq $0x2
popq %r15
pushq $0x1
popq %r13
leaq 0x8(%rsp), %rdi
callq 0x1e030
leaq 0x20(%rsp), %rdi
callq 0x1ddbe
leaq 0x28(%rsp), %rdi
callq 0x1e040
leaq 0x50(%rsp), %rdi
callq 0x1e138
testl %r13d, %r13d
cmovel %r13d, %r15d
movl %r15d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %rbx
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x1ddae
jmp 0x1d46a
jmp 0x1d434
jmp 0x1d464
movq %rdx, %rbx
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1e030
jmp 0x1d4c0
jmp 0x1d464
jmp 0x1d4a8
jmp 0x1d434
jmp 0x1d464
jmp 0x1d4a8
jmp 0x1d4a0
jmp 0x1d464
jmp 0x1d427
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1d4e8
jmp 0x1d464
movq %rdx, %rbx
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x1dfb2
jmp 0x1d46a
movq %rdx, %rbx
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x1dabe
leaq 0x8(%rsp), %rdi
callq 0x1e006
jmp 0x1d4c0
jmp 0x1d4a8
movq %rdx, %rbx
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1dfdc
jmp 0x1d4c0
jmp 0x1d4a8
jmp 0x1d4a8
movq %rdx, %rbx
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1dfb2
jmp 0x1d4c0
jmp 0x1d4a8
movq %rdx, %rbx
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x1ddbe
jmp 0x1d4c0
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1d4ca
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1d4c0
movq %rdx, %rbx
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1d73c
leaq 0x20(%rsp), %rdi
callq 0x1ddbe
leaq 0x28(%rsp), %rdi
callq 0x1e040
jmp 0x1d4e8
jmp 0x1d4d8
movq %rdx, %rbx
movq %rax, %r14
movq 0x30(%rsp), %rdi
callq 0x19680
leaq 0x50(%rsp), %rdi
callq 0x1e138
movq %r14, %rdi
cmpl $0x1, %ebx
jne 0x1d50b
callq 0x28cb0
callq 0x28d20
pushq $0x2
jmp 0x1d323
callq 0xd3bc0