// File: mh0fm4[P]SCDC/src/components/dataprov/dataprov.cc
// Function: scdc_dataprov::dataset_open_read_state(scdc_data*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
scdc_dataset *scdc_dataprov::dataset_open_read_state(scdc_data *incoming, scdc_result &result)
{
  SCDC_TRACE("dataset_open_read_state:");

  char *buf;
  scdcint_t buf_size;
  const char *end;

  while (1)
  {
    buf = incoming->get_read_pos_buf();
    buf_size = incoming->get_read_pos_buf_size();
    end = memchr(buf, '|', buf_size);

    if (end) break;

    incoming->do_next();
  }

  buf_size = end - buf;

  scdc_dataset *dataset = 0;

  string dataset_str(buf, buf_size);
  sscanf(dataset_str.c_str(), "%p", &dataset);

  incoming->inc_read_pos(buf_size + 1);

  if (!dataset)
  {
    result = "dataset not available";
    SCDC_FAIL("dataset_open_read_state: " << result);
    return 0;
  }

  return dataset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
jmp 0x5e779
jmp 0x5e77b
movq -0x18(%rbp), %rdi
callq 0x2ebe0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2ec00
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
movl $0x7c, %esi
callq 0x5e9d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x5e7b4
jmp 0x5e7bf
movq -0x18(%rbp), %rdi
callq 0x2ec20
jmp 0x5e77b
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0xcbc0
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %rcx
leaq -0x60(%rbp), %rdi
callq 0xc7a0
jmp 0x5e816
leaq -0x61(%rbp), %rdi
callq 0xc730
leaq -0x60(%rbp), %rdi
callq 0xc260
movq %rax, %rdi
leaq 0x46cb6(%rip), %rsi     # 0xa54e8
xorl %eax, %eax
leaq -0x40(%rbp), %rdx
callq 0xc640
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2ec60
jmp 0x5e84f
cmpq $0x0, -0x40(%rbp)
jne 0x5e998
movq -0x20(%rbp), %rdi
leaq 0x494f4(%rip), %rsi     # 0xa7d59
callq 0xc920
jmp 0x5e86c
jmp 0x5e86e
leaq 0x75e33(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, -0x98(%rbp)
jmp 0x5e886
movq -0x98(%rbp), %rax
cmpq $0x0, %rax
je 0x5e983
leaq 0x75e0a(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25800
jmp 0x5e8a8
leaq 0x75df9(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, -0xa0(%rbp)
jmp 0x5e8c0
movq -0xa0(%rbp), %rdi
leaq 0x478e2(%rip), %rsi     # 0xa61b0
callq 0xc670
movq %rax, -0xa8(%rbp)
jmp 0x5e8dc
movq -0xa8(%rbp), %rdi
leaq 0x493b2(%rip), %rsi     # 0xa7c9c
callq 0xc670
movq %rax, -0xb0(%rbp)
jmp 0x5e8f8
movq -0xb0(%rbp), %rdi
leaq 0x49469(%rip), %rsi     # 0xa7d6f
callq 0xc670
movq %rax, -0xb8(%rbp)
jmp 0x5e914
movq -0xb8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xc5b0
movq %rax, -0xc0(%rbp)
jmp 0x5e92d
movq -0xc0(%rbp), %rdi
movq 0x75685(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
jmp 0x5e942
leaq 0x75d5f(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x5e953
jmp 0x5e983
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x61(%rbp), %rdi
callq 0xc730
jmp 0x5e9bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xc3e0
jmp 0x5e9bd
jmp 0x5e985
jmp 0x5e987
movq $0x0, -0x8(%rbp)
movl $0x1, -0x78(%rbp)
jmp 0x5e9a7
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x78(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xc3e0
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0xcba0
nopw %cs:(%rax,%rax)