// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/dataprov/dataprov_fs2.cc
// Function: scdc_dataset_fs2_store::do_cmd_ls(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, _scdc_dataset_inout_t*, _scdc_dataset_inout_t*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool do_cmd_ls(const string &params, scdc_dataset_input_t *input, scdc_dataset_output_t *output, scdc_result &result)
    {
      SCDC_TRACE("do_cmd_ls: '" << params << "'");

      SCDC_DATASET_OUTPUT_CLEAR_(output);

      scdc_dataprov_fs2 *dataprov_fs2 = static_cast<scdc_dataprov_fs2 *>(dataprov);

      if (admin || pwd.size() == 0)
      {
        SCDC_TRACE("do_cmd_ls: listing stores");

        string main_path;
        dataprov_fs2->do_full_path(0, main_path);

        SCDC_TRACE("do_cmd_ls: main_path: '" << main_path << "'");

        DIR *dir = opendir(main_path.c_str());

        if (!dir)
        {
          result = "opening directory failed";
          SCDC_FAIL(__func__ << ": opening directory '" << main_path << "' failed: << result");
          return false;
        }

        scdcint_t stores = dir_count_stores(dir);

        SCDC_DATASET_OUTPUT_PRINTF_(output, "%" scdcint_fmt "|", stores);

        rewinddir(dir);

        struct dirent *ent;

        while ((ent = readdir(dir)) != NULL)
        {
          if (ent->d_type == DT_DIR && has_prefix(ent->d_name, DIR_STORE_PREFIX))
          {
            SCDC_TRACE("store: '" << ent->d_name << "'");
            SCDC_DATASET_OUTPUT_PRINTF_APPEND_(output, "%s|", ent->d_name + strlen(DIR_STORE_PREFIX));
          }
        }

        closedir(dir);

      } else
      {
        SCDC_TRACE("do_cmd_ls: listing entries of store '" << pwd << "'");

        string store_path;
        dataprov_fs2->do_full_path(0, store_path);

        store_path += DIR_STORE_PREFIX + pwd + "/";

        SCDC_TRACE("do_cmd_ls: store_path: '" << store_path << "'");

        DIR *dir = opendir(store_path.c_str());

        if (!dir)
        {
          result = "opening directory failed";
          SCDC_FAIL(__func__ << ": opening directory '" << store_path << "' failed: " << result);
          return false;
        }

        scdcint_t entries = dir_count_entries(dir);

        SCDC_DATASET_OUTPUT_PRINTF_(output, "%" scdcint_fmt "|", entries);

        rewinddir(dir);

        struct dirent *ent;

        while ((ent = readdir(dir)) != NULL)
        {
          if (ent->d_type == DT_REG && has_prefix_suffix(ent->d_name, DIR_ENTRY_PREFIX, DIR_ENTRY_SUFFIX))
          {
            string entry_name = trim_prefix_suffix(ent->d_name, DIR_ENTRY_PREFIX, DIR_ENTRY_SUFFIX);

            /* FIXME */
            string entry_format;

            string entry_path = store_path + ent->d_name;
            scdcint_t entry_size = z_fs_get_file_size(entry_path.c_str());

            SCDC_TRACE("entry: name: '" << entry_name << "', format: '" << entry_format << "', size: " << entry_size);
            SCDC_DATASET_OUTPUT_PRINTF_APPEND_(output, "%s:%s:%" scdcint_fmt "|", entry_name.c_str(), entry_format.c_str(), entry_size);
          }
        }
      }

      return true;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, %r15
movq %rcx, %rbx
movq %rdi, %r14
testq %rcx, %rcx
je 0x47e4e
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
movb $0x6e, 0x30(%rbx)
movups %xmm0, 0x38(%rbx)
movq 0x8(%r14), %rdi
cmpb $0x0, 0x6c(%r14)
jne 0x47ed7
cmpq $0x0, 0x20(%r14)
je 0x47ed7
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rsp), %rdx
xorl %esi, %esi
callq 0x4573e
addq $0x18, %r14
leaq 0x24784(%rip), %rsi     # 0x6c60f
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x1b7aa
leaq 0x224ce(%rip), %rsi     # 0x6a36d
leaq 0x28(%rsp), %rdi
callq 0xba60
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x48095
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x4809c
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x4573e
movq 0x8(%rsp), %rdi
callq 0xb800
movq %rax, %r14
testq %rax, %rax
je 0x47f91
movq %r14, %rdi
callq 0x46152
leaq 0x2362c(%rip), %rdx     # 0x6b549
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2a85e
movq %r14, %rdi
callq 0xb290
leaq 0x246d4(%rip), %r15     # 0x6c60f
leaq 0x246d7(%rip), %r12     # 0x6c619
movq %r14, %rdi
callq 0xb850
movq %rax, %r13
testq %rax, %rax
je 0x47f84
cmpb $0x4, 0x12(%r13)
jne 0x47f42
leaq 0x13(%r13), %rdi
movq %r15, %rsi
callq 0x1c47e
testb %al, %al
je 0x47f42
addq $0x1c, %r13
movl $0x1, %edi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2a85e
jmp 0x47f42
movq %r14, %rdi
callq 0xb8f0
jmp 0x4807d
movq 0x8(%r15), %rdx
leaq 0x2461d(%rip), %rcx     # 0x6c5b9
movl $0x18, %r8d
movq %r15, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x445bd(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4807d
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x8(%rax), %rbx
leaq 0x221d0(%rip), %rsi     # 0x6a1a8
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x245e6(%rip), %rsi     # 0x6c5d2
movl $0x12, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x22e66(%rip), %rsi     # 0x6ae66
movl $0x9, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x245d1(%rip), %rsi     # 0x6c5e5
movl $0x15, %edx
movq %rbx, %rdi
callq 0xb5f0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0xb5f0
movq %rax, %rbx
leaq 0x245be(%rip), %rsi     # 0x6c5fb
movl $0x13, %edx
movq %rax, %rdi
callq 0xb5f0
movq (%rbx), %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 (%r15), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x483dc
movq 0x18(%rsp), %rsi
jmp 0x483d4
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0xb150
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x480df
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x480fa
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x48(%rsp), %rdi
callq 0xb800
movq %rax, %r14
testq %rax, %rax
je 0x482bf
movq %r14, %rdi
callq 0xb850
xorl %r15d, %r15d
testq %rax, %rax
je 0x48159
leaq 0x244f6(%rip), %r12     # 0x6c61d
leaq 0x233ff(%rip), %r13     # 0x6b52d
cmpb $0x8, 0x12(%rax)
jne 0x4814c
addq $0x13, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1c3f0
movzbl %al, %eax
addq %rax, %r15
movq %r14, %rdi
callq 0xb850
testq %rax, %rax
jne 0x4812e
leaq 0x233e9(%rip), %rdx     # 0x6b549
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2a85e
movq %rbp, %r12
movq %r14, %rdi
callq 0xb290
leaq 0x8(%rsp), %r13
leaq 0x68(%rsp), %rbp
movq %r14, %rdi
callq 0xb850
movq %rax, %r15
testq %rax, %rax
je 0x483c0
cmpb $0x8, 0x12(%r15)
jne 0x48184
addq $0x13, %r15
movq %r15, %rdi
leaq 0x24470(%rip), %rsi     # 0x6c61d
leaq 0x23379(%rip), %rdx     # 0x6b52d
callq 0x1c3f0
testb %al, %al
je 0x48184
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1bd28
movq 0x10(%rsp), %rcx
addq $-0x9, %rcx
movl $0x9, %edx
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0xb530
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x481fd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %r12, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x1d0a0
movq %rbp, %rdi
movq %r15, %rsi
callq 0xba60
movq 0x68(%rsp), %rdi
callq 0x35826
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %r8
movl $0x1, %edi
movq %rbx, %rsi
leaq 0x243ca(%rip), %rdx     # 0x6c627
movq %rax, %r9
xorl %eax, %eax
callq 0x2a85e
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x48283
movq 0x78(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4829a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x48184
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x48184
movq 0x8(%r15), %rdx
leaq 0x242ef(%rip), %rcx     # 0x6c5b9
movl $0x18, %r8d
movq %r15, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x4428f(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x483c0
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x8(%rax), %rbx
leaq 0x21ea0(%rip), %rsi     # 0x6a1a8
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x242b6(%rip), %rsi     # 0x6c5d2
movl $0x12, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x22b36(%rip), %rsi     # 0x6ae66
movl $0x9, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x242a1(%rip), %rsi     # 0x6c5e5
movl $0x15, %edx
movq %rbx, %rdi
callq 0xb5f0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0xb5f0
movq %rax, %rbx
leaq 0x226a3(%rip), %rsi     # 0x6aa10
movl $0xa, %edx
movq %rax, %rdi
callq 0xb5f0
movq (%r15), %rsi
movq 0x8(%r15), %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 (%r12), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x483dc
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xb510
testq %r14, %r14
je 0x483e5
movb $0x1, %al
jmp 0x483e7
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x48418
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x48418
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x4849d
jmp 0x484b3
jmp 0x484b3
jmp 0x484b3
jmp 0x484cc
jmp 0x484b3
jmp 0x484cc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x484b6
movq 0x18(%rsp), %rsi
jmp 0x484a7
jmp 0x484b3
jmp 0x4845d
movq %rax, %rbx
jmp 0x4847c
jmp 0x484cc
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x4847c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x48493
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x484b6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x484b6
jmp 0x484b3
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x484e6
movq 0x58(%rsp), %rsi
jmp 0x484de
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x484e6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0