// File: /workspace/github_cpp_makefile_star2_O1/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 0x48390
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
movb $0x6e, 0x30(%rbx)
movups %xmm0, 0x38(%rbx)
movq 0x8(%r14), %rdi
cmpb $0x0, 0x6c(%r14)
jne 0x48419
cmpq $0x0, 0x20(%r14)
je 0x48419
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rsp), %rdx
xorl %esi, %esi
callq 0x45c90
addq $0x18, %r14
leaq 0x241ca(%rip), %rsi     # 0x6c597
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x1b85e
leaq 0x21f6c(%rip), %rsi     # 0x6a34d
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 0x485d7
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x485de
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x8(%rsp), %rdx
xorl %esi, %esi
callq 0x45c90
movq 0x8(%rsp), %rdi
callq 0xb800
movq %rax, %r14
testq %rax, %rax
je 0x484d3
movq %r14, %rdi
callq 0x466a2
leaq 0x230ca(%rip), %rdx     # 0x6b529
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2aa72
movq %r14, %rdi
callq 0xb290
leaq 0x2411a(%rip), %r15     # 0x6c597
leaq 0x2411d(%rip), %r12     # 0x6c5a1
movq %r14, %rdi
callq 0xb850
movq %rax, %r13
testq %rax, %rax
je 0x484c6
cmpb $0x4, 0x12(%r13)
jne 0x48484
leaq 0x13(%r13), %rdi
movq %r15, %rsi
callq 0x1c51e
testb %al, %al
je 0x48484
addq $0x1c, %r13
movl $0x1, %edi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2aa72
jmp 0x48484
movq %r14, %rdi
callq 0xb8f0
jmp 0x485bf
movq 0x8(%r15), %rdx
leaq 0x24063(%rip), %rcx     # 0x6c541
movl $0x18, %r8d
movq %r15, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x4407b(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x485bf
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x8(%rax), %rbx
leaq 0x21c6e(%rip), %rsi     # 0x6a188
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x2402c(%rip), %rsi     # 0x6c55a
movl $0x12, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x22904(%rip), %rsi     # 0x6ae46
movl $0x9, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x24017(%rip), %rsi     # 0x6c56d
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 0x24004(%rip), %rsi     # 0x6c583
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 0x4891e
movq 0x18(%rsp), %rsi
jmp 0x48916
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 0x48621
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4863c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x48(%rsp), %rdi
callq 0xb800
movq %rax, %r14
testq %rax, %rax
je 0x48801
movq %r14, %rdi
callq 0xb850
xorl %r15d, %r15d
testq %rax, %rax
je 0x4869b
leaq 0x23f3c(%rip), %r12     # 0x6c5a5
leaq 0x22e9d(%rip), %r13     # 0x6b50d
cmpb $0x8, 0x12(%rax)
jne 0x4868e
addq $0x13, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1c490
movzbl %al, %eax
addq %rax, %r15
movq %r14, %rdi
callq 0xb850
testq %rax, %rax
jne 0x48670
leaq 0x22e87(%rip), %rdx     # 0x6b529
xorl %edi, %edi
movq %rbx, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2aa72
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 0x48902
cmpb $0x8, 0x12(%r15)
jne 0x486c6
addq $0x13, %r15
movq %r15, %rdi
leaq 0x23eb6(%rip), %rsi     # 0x6c5a5
leaq 0x22e17(%rip), %rdx     # 0x6b50d
callq 0x1c490
testb %al, %al
je 0x486c6
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1bdd6
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 0x4873f
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 0x1d19a
movq %rbp, %rdi
movq %r15, %rsi
callq 0xba60
movq 0x68(%rsp), %rdi
callq 0x35b72
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %r8
movl $0x1, %edi
movq %rbx, %rsi
leaq 0x23e10(%rip), %rdx     # 0x6c5af
movq %rax, %r9
xorl %eax, %eax
callq 0x2aa72
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x487c5
movq 0x78(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x487dc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x486c6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x486c6
movq 0x8(%r15), %rdx
leaq 0x23d35(%rip), %rcx     # 0x6c541
movl $0x18, %r8d
movq %r15, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x43d4d(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x48902
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x8(%rax), %rbx
leaq 0x2193e(%rip), %rsi     # 0x6a188
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x23cfc(%rip), %rsi     # 0x6c55a
movl $0x12, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x225d4(%rip), %rsi     # 0x6ae46
movl $0x9, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x23ce7(%rip), %rsi     # 0x6c56d
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 0x22141(%rip), %rsi     # 0x6a9f0
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 0x4891e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xb510
testq %r14, %r14
je 0x48927
movb $0x1, %al
jmp 0x48929
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 0x4895a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x4895a
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x489df
jmp 0x489f5
jmp 0x489f5
jmp 0x489f5
jmp 0x48a0e
jmp 0x489f5
jmp 0x48a0e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x489f8
movq 0x18(%rsp), %rsi
jmp 0x489e9
jmp 0x489f5
jmp 0x4899f
movq %rax, %rbx
jmp 0x489be
jmp 0x48a0e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x489be
movq 0x78(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x489d5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x489f8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x489f8
jmp 0x489f5
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x48a28
movq 0x58(%rsp), %rsi
jmp 0x48a20
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x48a28
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0