// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/dataprov/dataprov_relay.cc
// Function: scdc_dataprov_relay::dataset_open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
scdc_dataset *scdc_dataprov_relay::dataset_open(std::string &path, scdc_result &result)
{
  SCDC_TRACE("dataset_open: path: '" << path << "'");

  scdc_dataset_relay *dataset_relay = 0;
  scdc_dataset_t ds = SCDC_DATASET_NULL;

  relay_t::iterator r;
  for (r = relay.begin(); r != relay.end(); ++r)
  {
    const string &relay_path = r->first;

    /* if the given path does not contain the relay_path as a prefix, then skip */
    if (path.substr(0, relay_path.size()) != relay_path) continue;

    /* remove the relay_path prefix from the full path */
    string p = path.substr(relay_path.size());

    /* if the full path without the relay_path prefix does not continue with a slash, then skip */
    if (!p.empty() && p[0] != '/') continue;

    /* remove leading slashs */
    p = ltrim(p, "/");

    const string &dst_path = r->second;

    string uri = dst_path + "/" + p;

    ds = scdc_dataset_open(uri.c_str());

    if (ds == SCDC_DATASET_NULL)
    {
      result = "opening remote dataset '" + uri + "' failed";
      SCDC_FAIL(__func__ << ": scdc_dataset_open failed: " << result);
    }

    break;
  }

  if (r == relay.end()) result = "no matching relay found";

  if (ds == SCDC_DATASET_NULL)
  {
    SCDC_FAIL(__func__ << ": failed: " << result);
    goto do_return;
  }

  /* unset path to prevent a further cd command */
  path.clear();

  dataset_relay = new scdc_dataset_relay(this, ds);

do_return:
  SCDC_TRACE("dataset_open: return: " << dataset_relay);

  return dataset_relay;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, (%rsp)
movq %rsi, %r15
movq 0xb0(%rdi), %r12
movq %rdi, 0x70(%rsp)
leaq 0xa0(%rdi), %rax
movq %rax, 0x68(%rsp)
cmpq %rax, %r12
je 0x20dad
leaq 0x8(%rsp), %r14
leaq 0x78(%rsp), %r13
xorl %ebp, %ebp
movq 0x28(%r12), %rcx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xb530
movq 0x10(%rsp), %rdx
cmpq 0x28(%r12), %rdx
jne 0x20a82
movq 0x8(%rsp), %rbx
testq %rdx, %rdx
je 0x20a8c
movq 0x20(%r12), %rsi
movq %rbx, %rdi
callq 0xb520
testl %eax, %eax
setne %r14b
jmp 0x20a8f
movb $0x1, %r14b
movq 0x8(%rsp), %rbx
jmp 0x20a8f
xorl %r14d, %r14d
leaq 0x18(%rsp), %rax
cmpq %rax, %rbx
je 0x20aa9
movq 0x18(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0xb510
testb %r14b, %r14b
je 0x20ab8
leaq 0x8(%rsp), %r14
jmp 0x20d95
movq 0x28(%r12), %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0xb530
cmpq $0x0, 0x10(%rsp)
je 0x20aec
movq 0x8(%rsp), %rdi
movb $0x1, %bl
cmpb $0x2f, (%rdi)
jne 0x20d7a
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x49872(%rip), %rbx     # 0x6a36d
movq %rbx, %rsi
xorl %edx, %edx
callq 0xb980
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xb0e0
movq %r14, %rdi
movq %r14, %rsi
callq 0xb2c0
leaq 0x38(%rsp), %r14
movq %r14, 0x28(%rsp)
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0x1d0a0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xba60
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0xb150
leaq 0x58(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x20b86
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x20b8c
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x20bbb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x48(%rsp), %rdi
xorl %eax, %eax
callq 0x19f09
leaq 0x8(%rsp), %r14
movq %rax, %rbp
testq %rax, %rax
jne 0x20d57
movq %r13, %rbx
movq %r13, %rdi
leaq 0x4c9b4(%rip), %rsi     # 0x6d599
leaq 0x48(%rsp), %rdx
callq 0x1b7aa
movq %rbx, %rdi
leaq 0x4b307(%rip), %rsi     # 0x6bf00
callq 0xba60
leaq 0x38(%rsp), %rbx
movq %rbx, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x20c26
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x20c2c
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xb670
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x20c69
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x20c8b
movq 0x88(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x6b8de(%rip), %rax     # 0x8c570
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x20d57
addq $0x20, %rdi
callq 0xb7d0
leaq 0x6b8c0(%rip), %rax     # 0x8c570
movq (%rax), %rax
movq 0x8(%rax), %rbx
movl $0xb, %edx
movq %rbx, %rdi
leaq 0x494e2(%rip), %rsi     # 0x6a1a8
callq 0xb5f0
movl $0x10, %edx
movq %rbx, %rdi
leaq 0x49bff(%rip), %rsi     # 0x6a8d9
callq 0xb5f0
movl $0xc, %edx
movq %rbx, %rdi
leaq 0x4981b(%rip), %rsi     # 0x6a509
callq 0xb5f0
movl $0x1c, %edx
movq %rbx, %rdi
leaq 0x49be8(%rip), %rsi     # 0x6a8ea
callq 0xb5f0
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0xb5f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
leaq 0x6b825(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x20d73
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
xorl %ebx, %ebx
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x20d91
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
testb %bl, %bl
je 0x20daf
movq %r12, %rdi
callq 0xb350
movq %rax, %r12
cmpq 0x68(%rsp), %rax
jne 0x20a45
jmp 0x20db6
xorl %ebp, %ebp
cmpq 0x68(%rsp), %r12
jne 0x20dd2
movq (%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x49b42(%rip), %rcx     # 0x6a907
movl $0x17, %r8d
xorl %esi, %esi
callq 0xb870
testq %rbp, %rbp
je 0x20e1a
xorl %ebx, %ebx
movq %rbx, 0x8(%r15)
movq (%r15), %rax
movb %bl, (%rax)
movl $0x40, %edi
callq 0xb500
movq 0x70(%rsp), %rcx
movq %rcx, 0x8(%rax)
movb %bl, 0x10(%rax)
leaq 0x28(%rax), %rcx
movq %rcx, 0x18(%rax)
movq %rbx, 0x20(%rax)
movb %bl, 0x28(%rax)
leaq 0x693f2(%rip), %rcx     # 0x8a200
movq %rcx, (%rax)
movq %rbp, 0x38(%rax)
jmp 0x20eda
leaq 0x6b74f(%rip), %r14     # 0x8c570
movq (%r14), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x20ed8
addq $0x20, %rdi
callq 0xb7d0
movq (%r14), %rax
movq 0x8(%rax), %rbx
leaq 0x49362(%rip), %rsi     # 0x6a1a8
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x49a7f(%rip), %rsi     # 0x6a8d9
movl $0x10, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x4969b(%rip), %rsi     # 0x6a509
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x49a9d(%rip), %rsi     # 0x6a91f
movl $0xa, %edx
movq %rbx, %rdi
callq 0xb5f0
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0xb5f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r14), %rdi
addq $0x20, %rdi
callq 0xb3b0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x20f35
movq 0x88(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x20f35
jmp 0x20f32
jmp 0x20f17
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x20f51
movq 0x38(%rsp), %rsi
jmp 0x20f49
jmp 0x20f2d
movq %rax, %rbx
jmp 0x20f51
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x20f51
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x20f6d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0
nop