// File: tdv[P]boss/boss/src/class_factory/class_factory.cpp
// Function: Boss::ClassFactory::CreateObject(unsigned int, Boss::IBase**)
RetCode BOSS_CALL ClassFactory::CreateObject(ClassId clsId, IBase **inst)
  {
    try
    {
      std::lock_guard<std::recursive_mutex> Lock(Mtx);
      {
        auto const ServiceIter = Services.find(clsId);
        if (ServiceIter != std::end(Services))
        {
          auto ModuleIter = Modules.find(ServiceIter->second);
          if (ModuleIter == std::end(Modules))
            return Status::Fail;
          return ModuleIter->second->GetModule().CreateObject(clsId).QueryInterface(inst);
        }
      }
      if (!Registry.Get())
        return Status::Fail;
      RefObjPtr<IServiceInfo> SrvInfo;
      RetCode Code = Registry->GetServiceInfo(clsId, SrvInfo.GetPPtr());
      if (Code != Status::Ok)
        return Code;
      {
        RefObjQIPtr<ILocalServiceInfo> LocalSrvInfo(SrvInfo);
        if (LocalSrvInfo.Get())
        {
          std::string Path;
          {
            RefObjPtr<IString> ModulePath;
            if ((Code = LocalSrvInfo->GetModulePath(ModulePath.GetPPtr())) != Status::Ok)
              return Code;
            Path = std::move(StringHelper(ModulePath).GetString<IString::AnsiString>());
          }
          auto Module = std::make_shared<ModuleHolderEx>(Path);
          auto NewInst = Module->GetModule().CreateObject(clsId);
          auto SrvId = Module->GetModule().GetServiceId();
          for (auto const &i : Module->GetModule().GetClassIds())
            Services[i] = SrvId;
          Modules.insert(std::make_pair(SrvId, std::move(Module)));
          return NewInst.QueryInterface(inst);
        }
      }
      {
        RefObjQIPtr<IRemoteServiceInfo> RemoteSrvInfo(SrvInfo);
        if (RemoteSrvInfo.Get())
        {
          return Status::NotImplemented;
        }
      }
    }
    catch (...)
    {
      return Status::Fail;
    }
    return Status::NotFound;
  }

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x228(%rsp)
movl %esi, 0x224(%rsp)
movq %rdx, 0x218(%rsp)
movq 0x228(%rsp), %rsi
movq %rsi, 0xd0(%rsp)
addq $0x20, %rsi
leaq 0x210(%rsp), %rdi
callq 0x8d2f0
jmp 0x93871
movq 0xd0(%rsp), %rdi
addq $0x48, %rdi
leaq 0x224(%rsp), %rsi
callq 0x8bd50
movq %rax, 0xc8(%rsp)
jmp 0x93894
movq 0xd0(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq %rax, 0x1f8(%rsp)
addq $0x48, %rdi
callq 0x8d1a0
movq %rax, 0xc0(%rsp)
jmp 0x938bf
movq 0xc0(%rsp), %rax
movq %rax, 0x1f0(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x8d2a0
testb $0x1, %al
jne 0x938ed
jmp 0x93a87
movq 0xd0(%rsp), %rax
subq $-0x80, %rax
movq %rax, 0xb0(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x905c0
movq 0xb0(%rsp), %rdi
movq %rax, %rsi
addq $0x4, %rsi
callq 0x8f3f0
movq %rax, 0xb8(%rsp)
jmp 0x9392c
movq 0xd0(%rsp), %rdi
movq 0xb8(%rsp), %rax
movq %rax, 0x1e8(%rsp)
subq $-0x80, %rdi
callq 0x8ea10
movq %rax, 0xa8(%rsp)
jmp 0x93957
movq 0xa8(%rsp), %rax
movq %rax, 0x1e0(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x8bbf0
testb $0x1, %al
jne 0x93982
jmp 0x939cf
movl $0x2, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x94182
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x941ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x941ad
leaq 0x1e8(%rsp), %rdi
callq 0x8ef40
movq %rax, %rdi
addq $0x8, %rdi
callq 0x8d050
movq %rax, %rdi
callq 0x8bc40
movq %rax, 0xa0(%rsp)
jmp 0x939fa
movq 0xa0(%rsp), %rsi
movl 0x224(%rsp), %edx
leaq 0x1d0(%rsp), %rdi
callq 0x8e9e0
jmp 0x93a18
movq 0x218(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x8c600
movl %eax, 0x9c(%rsp)
jmp 0x93a36
movl 0x9c(%rsp), %eax
movl %eax, 0x234(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x8c8a0
movl $0x1, 0x1dc(%rsp)
jmp 0x94182
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x8c8a0
jmp 0x941ad
movq 0xd0(%rsp), %rdi
addq $0xc8, %rdi
callq 0x8dad0
movq %rax, 0x90(%rsp)
jmp 0x93aa5
movq 0x90(%rsp), %rax
cmpq $0x0, %rax
jne 0x93ace
movl $0x2, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x94182
xorl %eax, %eax
movl %eax, %esi
leaq 0x1c8(%rsp), %rdi
callq 0x906e0
jmp 0x93ae1
movq 0xd0(%rsp), %rdi
addq $0xc8, %rdi
callq 0x8e890
movq %rax, 0x88(%rsp)
jmp 0x93aff
movl 0x224(%rsp), %eax
movl %eax, 0x7c(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x90710
movq %rax, 0x80(%rsp)
jmp 0x93b21
movq 0x80(%rsp), %rdx
movl 0x7c(%rsp), %esi
movq 0x88(%rsp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movl %eax, 0x78(%rsp)
jmp 0x93b44
movl 0x78(%rsp), %eax
movl %eax, 0x1c4(%rsp)
cmpl $0x0, 0x1c4(%rsp)
je 0x93b90
movl 0x1c4(%rsp), %eax
movl %eax, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x94175
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x941a0
leaq 0x1b8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x8db00
jmp 0x93ba7
leaq 0x1b8(%rsp), %rdi
callq 0x8edc0
movq %rax, 0x70(%rsp)
jmp 0x93bbb
movq 0x70(%rsp), %rax
cmpq $0x0, %rax
je 0x9409c
leaq 0x198(%rsp), %rdi
callq 0x8b920
xorl %eax, %eax
movl %eax, %esi
leaq 0x190(%rsp), %rdi
callq 0x8e4b0
jmp 0x93bea
leaq 0x1b8(%rsp), %rdi
callq 0x901e0
movq %rax, 0x68(%rsp)
jmp 0x93bfe
leaq 0x190(%rsp), %rdi
callq 0x8cf20
movq %rax, 0x60(%rsp)
jmp 0x93c12
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
movl %eax, 0x5c(%rsp)
jmp 0x93c2b
movl 0x5c(%rsp), %eax
movl %eax, 0x1c4(%rsp)
cmpl $0x0, %eax
je 0x93ca4
movl 0x1c4(%rsp), %eax
movl %eax, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x93d30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x94113
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x9408d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x93ebb
leaq 0x160(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x8ea40
jmp 0x93cbb
leaq 0x168(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x8d1f0
jmp 0x93cd2
leaq 0x170(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x908b0
jmp 0x93ce9
leaq 0x198(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x8fa10
leaq 0x170(%rsp), %rdi
callq 0x8dfd0
leaq 0x168(%rsp), %rdi
callq 0x8fbe0
leaq 0x160(%rsp), %rdi
callq 0x8c1b0
movl $0x0, 0x1dc(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x8c1b0
movl 0x1dc(%rsp), %eax
testl %eax, %eax
jne 0x9407e
jmp 0x93d4e
leaq 0x150(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x8d060
jmp 0x93d65
leaq 0x150(%rsp), %rdi
callq 0x8d050
movq %rax, %rdi
callq 0x8bc40
movq %rax, 0x50(%rsp)
jmp 0x93d81
movq 0x50(%rsp), %rsi
movl 0x224(%rsp), %edx
leaq 0x148(%rsp), %rdi
callq 0x8e9e0
jmp 0x93d9c
leaq 0x150(%rsp), %rdi
callq 0x8d050
movq %rax, %rdi
callq 0x8bc40
movq %rax, 0x48(%rsp)
jmp 0x93db8
movq 0x48(%rsp), %rdi
callq 0x8bbb0
movl %eax, 0x44(%rsp)
jmp 0x93dc8
movl 0x44(%rsp), %eax
movl %eax, 0x144(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x8d050
movq %rax, %rdi
callq 0x8bc40
movq %rax, 0x38(%rsp)
jmp 0x93def
movq 0x38(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x909a0
jmp 0x93e03
leaq 0x120(%rsp), %rax
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rdi
callq 0x8f530
movq %rax, 0x118(%rsp)
movq 0x138(%rsp), %rdi
callq 0x8ed20
movq %rax, 0x110(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x8c140
testb $0x1, %al
jne 0x93eff
movl $0x2, 0x1dc(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x8bf30
jmp 0x93f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x93eae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x8fbe0
leaq 0x160(%rsp), %rdi
callq 0x8c1b0
leaq 0x190(%rsp), %rdi
callq 0x8c1b0
jmp 0x9408d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x9406f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
jmp 0x94062
leaq 0x118(%rsp), %rdi
callq 0x904f0
movq 0xd0(%rsp), %rdi
movq %rax, 0x108(%rsp)
movl 0x144(%rsp), %eax
movl %eax, 0x2c(%rsp)
addq $0x48, %rdi
movq 0x108(%rsp), %rsi
callq 0x8b830
movq %rax, 0x30(%rsp)
jmp 0x93f3f
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, (%rax)
leaq 0x118(%rsp), %rdi
callq 0x8df60
jmp 0x93e3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x8bf30
jmp 0x94062
movq 0xd0(%rsp), %rax
subq $-0x80, %rax
movq %rax, 0x20(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0x144(%rsp), %rsi
leaq 0x150(%rsp), %rdx
callq 0x8f4b0
jmp 0x93fb2
movq 0x20(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x907b0
movb %dl, 0x17(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x93fcf
movb 0x17(%rsp), %al
movq 0x18(%rsp), %rcx
movq %rcx, 0xe0(%rsp)
movb %al, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x8e070
movq 0x218(%rsp), %rsi
leaq 0x148(%rsp), %rdi
callq 0x8c600
movl %eax, 0x10(%rsp)
jmp 0x9400f
movl 0x10(%rsp), %eax
movl %eax, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x8c8a0
leaq 0x150(%rsp), %rdi
callq 0x8f3e0
jmp 0x9407e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x8e070
leaq 0x148(%rsp), %rdi
callq 0x8c8a0
leaq 0x150(%rsp), %rdi
callq 0x8f3e0
jmp 0x9408d
leaq 0x198(%rsp), %rdi
callq 0x8dfd0
jmp 0x940a7
leaq 0x198(%rsp), %rdi
callq 0x8dfd0
jmp 0x94113
movl $0x0, 0x1dc(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x8ca20
movl 0x1dc(%rsp), %eax
testl %eax, %eax
jne 0x94175
jmp 0x940c5
leaq 0xd8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x8bc50
jmp 0x940dc
leaq 0xd8(%rsp), %rdi
callq 0x8f830
movq %rax, 0x8(%rsp)
jmp 0x940f0
movq 0x8(%rsp), %rax
cmpq $0x0, %rax
je 0x94145
movl $0x6, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x94150
leaq 0x1b8(%rsp), %rdi
callq 0x8ca20
jmp 0x941a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x208(%rsp)
movl %eax, 0x204(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x8b700
jmp 0x941a0
movl $0x0, 0x1dc(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x8b700
movl 0x1dc(%rsp), %eax
testl %eax, %eax
jne 0x94175
jmp 0x9416a
movl $0x0, 0x1dc(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x8ba50
leaq 0x210(%rsp), %rdi
callq 0x90590
movl 0x1dc(%rsp), %eax
testl %eax, %eax
je 0x9419e
jmp 0x9419c
jmp 0x941ef
jmp 0x941e4
leaq 0x1c8(%rsp), %rdi
callq 0x8ba50
leaq 0x210(%rsp), %rdi
callq 0x90590
movq 0x208(%rsp), %rdi
callq 0x8b730
movl $0x2, 0x234(%rsp)
movl $0x1, 0x1dc(%rsp)
callq 0x8e640
jmp 0x941ef
movl $0x3, 0x234(%rsp)
movl 0x234(%rsp), %eax
addq $0x238, %rsp            # imm = 0x238
retq
nop