// File: /workspace/github_cpp_makefile_star2_O3/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 $0x58, %rsp
testq %rsi, %rsi
je 0x1d739
movq %rdi, %rbx
movq %rsi, 0x38(%rsp)
leaq 0x40(%rsp), %r14
movq %r14, 0x8(%r14)
movq %r14, (%r14)
movq $0x0, 0x10(%r14)
leaq 0x28(%rdi), %r15
movq %r15, %rdi
callq 0x19620
testl %eax, %eax
jne 0x1d82b
movq 0x60(%rbx), %r12
testq %r12, %r12
je 0x1d302
movq 0x40(%rsp), %r13
cmpq %r14, %r13
je 0x1d2df
movq 0x10(%r13), %rbx
testq %rbx, %rbx
je 0x1d2d1
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x10(%r12), %rbp
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
cmpq %rbp, %rbx
jne 0x1d2d9
jmp 0x1d2fc
cmpq $0x0, 0x10(%r12)
je 0x1d2fc
movq (%r13), %r13
jmp 0x1d2a5
leaq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x270ca
movq %rax, %rdi
movq %r14, %rsi
callq 0x2d1a0
incq 0x50(%rsp)
movq (%r12), %r12
jmp 0x1d29b
movq %r15, %rdi
callq 0x19680
leaq 0x30(%rsp), %rdi
callq 0x1e282
movq 0x40(%rsp), %r12
cmpq %r14, %r12
je 0x1d744
leaq 0x8(%rsp), %rbp
leaq 0x18(%rsp), %rdi
leaq 0xb9d16(%rip), %rsi     # 0xd7049
callq 0x1e2ec
movq 0x30(%rsp), %rbx
movq 0x18(%rsp), %rdi
movq %rdi, 0x28(%rsp)
testq %rdi, %rdi
je 0x1d352
movq (%rdi), %rax
callq *0x18(%rax)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0x1e35a
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1d36f
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, 0x28(%rsp)
movl $0x0, 0x8(%rsp)
movq 0x10(%r12), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x28(%rax)
testl %eax, %eax
je 0x1d3a0
movl $0x1, %r13d
movl %eax, %r15d
jmp 0x1d69c
movq 0x18(%rsp), %rbx
movq %rsp, %rdi
movq %rbp, %rsi
callq 0x1e3f2
movq (%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0xb9c85(%rip), %rsi     # 0xd7051
callq *0x38(%rax)
movl %eax, %ebx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d3e0
movq (%rdi), %rax
callq *0x20(%rax)
movl $0x1, %r13d
testl %ebx, %ebx
je 0x1d3f2
movl %ebx, %r15d
jmp 0x1d69c
movq $0x0, (%rsp)
movq 0x10(%r12), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
callq *0x30(%rax)
xorl %ebx, %ebx
movl $0x0, %ecx
testl %eax, %eax
jne 0x1d435
movq 0x18(%rsp), %rdi
movq (%rsp), %rdx
movq (%rdi), %rax
leaq 0xb9c35(%rip), %rsi     # 0xd705b
callq *0x38(%rax)
testl %eax, %eax
sete %bl
cmovnel %eax, %r15d
movl %r15d, %ecx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d44a
movq (%rdi), %rax
movl %ecx, %r15d
callq *0x18(%rax)
movl %r15d, %ecx
testb %bl, %bl
je 0x1d699
movq $0x0, (%rsp)
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x1d5e9
movl %ecx, 0x24(%rsp)
movq (%rdi), %rax
movl $0x5d155638, %esi       # imm = 0x5D155638
movq %rsp, %rdx
callq *0x20(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d5f1
movl $0x0, 0x14(%rsp)
movq (%rdi), %rax
leaq 0x14(%rsp), %rsi
callq *0x38(%rax)
movl %eax, %r15d
testl %eax, %eax
jne 0x1d5cb
movq 0x18(%rsp), %rbx
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1e3f2
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0xb9b90(%rip), %rsi     # 0xd7064
callq *0x38(%rax)
movl %eax, %r15d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d4ea
movq (%rdi), %rax
callq *0x20(%rax)
testl %r15d, %r15d
jne 0x1d5cb
movl $0x0, 0x14(%rsp)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x14(%rsp), %rsi
callq *0x40(%rax)
movl %eax, %r15d
testl %eax, %eax
jne 0x1d5cb
movq 0x18(%rsp), %rbx
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1e3f2
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0xb9b2d(%rip), %rsi     # 0xd7071
callq *0x38(%rax)
movl %eax, %r15d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d55a
movq (%rdi), %rax
callq *0x20(%rax)
testl %r15d, %r15d
jne 0x1d5cb
movl $0x0, 0x14(%rsp)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x14(%rsp), %rsi
callq *0x48(%rax)
movl %eax, %r15d
testl %eax, %eax
jne 0x1d5cb
movq 0x18(%rsp), %rbx
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x1e3f2
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0xb9ad0(%rip), %rsi     # 0xd707c
callq *0x38(%rax)
movl %eax, %r15d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d5c2
movq (%rdi), %rax
callq *0x20(%rax)
testl %r15d, %r15d
je 0x1d6ca
movl $0x1, %r13d
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d69c
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1d69c
xorl %r13d, %r13d
jmp 0x1d699
movq 0x10(%r12), %rdi
movq $0x0, (%rsp)
xorl %r13d, %r13d
testq %rdi, %rdi
je 0x1d63d
movq (%rdi), %rax
movl $0xd893276e, %esi       # imm = 0xD893276E
movq %rsp, %rdx
callq *0x20(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d63d
movq $0x0, 0x8(%rsp)
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x38(%rax)
testl %eax, %eax
je 0x1d643
movl $0x1, %r13d
movl %eax, %ecx
jmp 0x1d672
movl 0x24(%rsp), %ecx
jmp 0x1d699
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rdx
movq (%rdi), %rax
leaq 0xb9a4d(%rip), %rsi     # 0xd70a4
callq *0x38(%rax)
testl %eax, %eax
movl $0x1, %r13d
movl $0x7, %ecx
cmovel %ecx, %r13d
movl 0x24(%rsp), %ecx
cmovnel %eax, %ecx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d686
movq (%rdi), %rax
movl %ecx, %ebx
callq *0x18(%rax)
movl %ebx, %ecx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d699
movq (%rdi), %rax
movl %ecx, %ebx
callq *0x18(%rax)
movl %ebx, %ecx
movl %ecx, %r15d
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1d6ac
movq (%rdi), %rax
callq *0x20(%rax)
cmpl $0x7, %r13d
je 0x1d6bb
testl %r13d, %r13d
jne 0x1d7f8
movq (%r12), %r12
cmpq %r14, %r12
jne 0x1d327
jmp 0x1d744
movq $0x0, 0x8(%rsp)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x50(%rax)
movl %eax, %r15d
testl %eax, %eax
je 0x1d6ef
movl $0x1, %r13d
jmp 0x1d720
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rdx
movq (%rdi), %rax
leaq 0xb998d(%rip), %rsi     # 0xd7090
callq *0x38(%rax)
testl %eax, %eax
movl $0x1, %r13d
movl $0x7, %ecx
cmovel %ecx, %r13d
movl 0x24(%rsp), %r15d
cmovnel %eax, %r15d
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d5d1
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1d5d1
movl $0x5, %r15d
jmp 0x1d819
leaq 0xb98f5(%rip), %rsi     # 0xd7040
leaq 0x18(%rsp), %rdi
callq 0x1dcd0
movq 0x18(%rsp), %rdi
movq 0x30(%rsp), %rax
leaq 0x8(%rax), %rdx
testq %rax, %rax
cmoveq %rax, %rdx
movq (%rdi), %rax
leaq 0xb993b(%rip), %rsi     # 0xd70af
callq *0x38(%rax)
movq 0x18(%rsp), %rdi
testl %eax, %eax
je 0x1d78b
movl $0x1, %r13d
movl %eax, %r15d
jmp 0x1d7ed
movq $0x0, (%rsp)
movb $0x1, %bl
movl $0x2, %ebp
testq %rdi, %rdi
je 0x1d7e1
movq (%rdi), %rax
movq %rsp, %rdx
movl $0x28c07f90, %esi       # imm = 0x28C07F90
callq *0x28(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d7e1
movq (%rdi), %rax
movq 0x38(%rsp), %rsi
callq *0x30(%rax)
testl %eax, %eax
setne %bl
cmovnel %eax, %r15d
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d7de
movq (%rdi), %rax
callq *0x18(%rax)
movl %r15d, %ebp
jmp 0x1d7e1
movl %r15d, %ebp
movzbl %bl, %r13d
movq 0x18(%rsp), %rdi
movl %ebp, %r15d
testq %rdi, %rdi
je 0x1d7f8
movq (%rdi), %rax
callq *0x20(%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1d808
movq (%rdi), %rax
callq *0x20(%rax)
leaq 0x40(%rsp), %rdi
callq 0x1e568
testl %r13d, %r13d
cmovel %r13d, %r15d
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x1b2b1
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d961
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1d961
jmp 0x1da5a
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d961
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1d961
jmp 0x1da5a
jmp 0x1d95b
jmp 0x1d95b
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d961
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1d961
jmp 0x1da5a
jmp 0x1d95b
jmp 0x1d95b
jmp 0x1da5a
jmp 0x1da5a
jmp 0x1da5a
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1d993
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1d993
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d90e
movq (%rdi), %rax
callq *0x18(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1da32
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1da32
jmp 0x1da5a
jmp 0x1da5a
jmp 0x1da2c
movq %rdx, %rbx
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d961
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1d961
jmp 0x1da5a
jmp 0x1d95b
jmp 0x1d98d
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1da32
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1da32
jmp 0x1da5a
jmp 0x1da5a
jmp 0x1da2c
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1da42
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1da42
jmp 0x1da5a
jmp 0x1da24
jmp 0x1d9b5
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1da70
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1da32
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1da32
jmp 0x1da5a
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1da32
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1da32
jmp 0x1da5a
jmp 0x1da2c
jmp 0x1da2c
jmp 0x1da5a
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1da17
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, 0x28(%rsp)
jmp 0x1da32
jmp 0x1da5a
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1da42
movq %rdx, %rbx
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1da42
movq (%rdi), %rax
callq *0x20(%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1da70
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1da70
jmp 0x1da5a
jmp 0x1da5a
jmp 0x1da62
movq %rax, %rdi
callq 0x1e4f5
movq %rdx, %rbx
movq %rax, %r14
movq %r15, %rdi
callq 0x19680
leaq 0x40(%rsp), %rdi
callq 0x1e568
movq %r14, %rdi
cmpl $0x1, %ebx
jne 0x1da97
callq 0x2a440
callq 0x2a4b0
movl $0x2, %r15d
jmp 0x1d819
callq 0xd47f0