// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movq %rdi, %r12
movl %esi, 0x4(%rsp)
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x7b4a0
leaq 0x48(%r12), %r13
leaq 0x4(%rsp), %rsi
movq %r13, %rdi
callq 0x792a0
testq %rax, %rax
je 0x7f645
subq $-0x80, %r12
addq $0xc, %rax
movq %r12, %rdi
movq %rax, %rsi
callq 0x7aa10
testq %rax, %rax
je 0x7f6c0
movq 0x10(%rax), %rsi
addq $0x8, %rsi
movl 0x4(%rsp), %edx
leaq 0x40(%rsp), %rdi
callq 0x7b640
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7f6c8
movq (%rdi), %rax
movl $0x2cc77d66, %esi       # imm = 0x2CC77D66
movq %r14, %rdx
callq *0x20(%rax)
movl %eax, %ebp
jmp 0x7f6cb
movq 0xc8(%r12), %rdi
testq %rdi, %rdi
je 0x7f6c0
leaq 0x20(%rsp), %rdx
andq $0x0, (%rdx)
movl 0x4(%rsp), %esi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, %ebp
testl %eax, %eax
jne 0x7f88c
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x7ace0
movq 0x30(%rsp), %r15
testq %r15, %r15
je 0x7f6da
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x10(%rsp), %rsi
andq $0x0, (%rsi)
movq (%r15), %rax
movq %r15, %rdi
callq *0x38(%rax)
movl %eax, %ebp
testl %eax, %eax
je 0x7f6df
leaq 0x10(%rsp), %rdi
callq 0x79be0
jmp 0x7f848
pushq $0x2
popq %rbp
jmp 0x7f896
pushq $0x2
popq %rbp
leaq 0x40(%rsp), %rdi
callq 0x7a070
jmp 0x7f896
jmp 0x7f852
movq 0x10(%rsp), %rdi
movq %rdi, 0x28(%rsp)
testq %rdi, %rdi
je 0x7f6f4
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x7a700
movq %r15, 0x38(%rsp)
movq %r14, 0x80(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x7c960
leaq 0x40(%rsp), %r15
leaq 0x60(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x7bfb0
movq %rbp, %rdi
callq 0x796f0
leaq 0x8(%rsp), %rdi
callq 0x79be0
leaq 0x28(%rsp), %rdi
callq 0x79be0
leaq 0x10(%rsp), %rdi
callq 0x79be0
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x7a5f0
movq 0x10(%rsp), %rsi
addq $0x8, %rsi
movl 0x4(%rsp), %edx
leaq 0x8(%rsp), %rdi
callq 0x7b640
movq 0x10(%rsp), %rdi
addq $0x8, %rdi
callq 0x79860
movl %eax, %ebp
movq 0x10(%rsp), %rsi
addq $0x8, %rsi
leaq 0x60(%rsp), %rdi
callq 0x7ca20
movq 0x60(%rsp), %r15
movq 0x68(%rsp), %r14
cmpq %r14, %r15
je 0x7f7c3
movq %r13, %rdi
movq %r15, %rsi
callq 0x7a8a0
movl %ebp, (%rax)
addq $0x4, %r15
jmp 0x7f7ab
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x7ad40
movl %ebp, (%r15)
leaq 0x70(%rsp), %r15
movaps 0x10(%rsp), %xmm0
movups %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
subq $-0x80, %r12
leaq 0x60(%rsp), %rsi
movq %r12, %rdi
callq 0x7b9e0
movq %r15, %rdi
callq 0x793f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x7f829
movq (%rdi), %rax
movl $0x2cc77d66, %esi       # imm = 0x2CC77D66
movq 0x80(%rsp), %rdx
callq *0x20(%rax)
movq 0x38(%rsp), %r15
movl %eax, %ebp
jmp 0x7f831
pushq $0x2
popq %rbp
movq 0x38(%rsp), %r15
leaq 0x18(%rsp), %r14
leaq 0x8(%rsp), %rdi
callq 0x7a070
movq %r14, %rdi
callq 0x793f0
leaq 0x40(%rsp), %rdi
callq 0x796f0
leaq 0x30(%rsp), %rdi
callq 0x7a180
testq %r15, %r15
jne 0x7f88c
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x798d0
xorl %r14d, %r14d
leaq 0x40(%rsp), %rdi
cmpq $0x0, (%rdi)
setne %r14b
callq 0x794e0
leal (%r14,%r14,2), %ebp
addl $0x3, %ebp
leaq 0x20(%rsp), %rdi
callq 0x79780
movq %rbx, %rdi
callq 0x7c6c0
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7f8f2
movq %rax, %r14
movq %r15, %rdi
callq 0x793f0
jmp 0x7f928
jmp 0x7f8ed
movq %rax, %r14
jmp 0x7f932
movq %rax, %r14
jmp 0x7f93c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x79be0
jmp 0x7f8df
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x79be0
jmp 0x7f8f5
jmp 0x7f903
movq %rax, %r14
jmp 0x7f928
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x79be0
jmp 0x7f93c
jmp 0x7f903
movq %rax, %r14
jmp 0x7f950
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x7a070
jmp 0x7f95f
jmp 0x7f95c
jmp 0x7f95c
movq %rax, %r14
leaq 0x60(%rsp), %rdi
callq 0x7ad40
leaq 0x8(%rsp), %rdi
callq 0x7a070
leaq 0x18(%rsp), %rdi
callq 0x793f0
leaq 0x40(%rsp), %rdi
callq 0x796f0
leaq 0x30(%rsp), %rdi
callq 0x7a180
leaq 0x20(%rsp), %rdi
callq 0x79780
jmp 0x7f95f
movq %rax, %r14
movq %rbx, %rdi
callq 0x7c6c0
jmp 0x7f96c
movq %rax, %r14
movq %r14, %rdi
callq 0x79500
callq 0x7b420
pushq $0x2
popq %rbp
jmp 0x7f89e
nop