// File: 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
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x170(%rbp)
jmp 0x74f3c
jmp 0x74f3e
cmpq $0x0, -0x28(%rbp)
je 0x74f7d
movq -0x28(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x28(%rbp), %rax
movb $0x6e, 0x30(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x38(%rax)
jmp 0x74f7f
movq -0x170(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
testb $0x1, 0x6c(%rax)
jne 0x74fae
movq -0x170(%rbp), %rdi
addq $0x18, %rdi
callq 0xc460
cmpq $0x0, %rax
jne 0x75256
jmp 0x74fb0
jmp 0x74fb2
leaq -0x58(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0xc960
movq -0x178(%rbp), %rdx
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x716b0
jmp 0x74fd8
jmp 0x74fda
jmp 0x74fdc
jmp 0x74fde
leaq -0x58(%rbp), %rdi
callq 0xc260
movq %rax, %rdi
callq 0xca20
movq %rax, -0x180(%rbp)
jmp 0x74ff8
movq -0x180(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x75155
movq -0x30(%rbp), %rdi
leaq 0x335a0(%rip), %rsi     # 0xa85b9
callq 0xc920
jmp 0x75020
jmp 0x75022
leaq 0x5f67f(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
cmpq $0x0, %rax
je 0x75141
leaq 0x5f666(%rip), %rax     # 0xd46a8
movq %rax, -0x190(%rbp)
movq (%rax), %rdi
callq 0x25800
movq -0x190(%rbp), %rax
movq (%rax), %rdi
callq 0x257e0
movq %rax, %rdi
leaq 0x31146(%rip), %rsi     # 0xa61b0
callq 0xc670
movq %rax, -0x188(%rbp)
jmp 0x75078
movq -0x188(%rbp), %rdi
leaq 0x3354c(%rip), %rsi     # 0xa85d2
callq 0xc670
movq %rax, -0x198(%rbp)
jmp 0x75094
movq -0x198(%rbp), %rdi
leaq 0x31a87(%rip), %rsi     # 0xa6b29
callq 0xc670
movq %rax, -0x1a0(%rbp)
jmp 0x750b0
movq -0x1a0(%rbp), %rdi
leaq 0x33527(%rip), %rsi     # 0xa85e5
callq 0xc670
movq %rax, -0x1a8(%rbp)
jmp 0x750cc
movq -0x1a8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xc5b0
movq %rax, -0x1b0(%rbp)
jmp 0x750e5
movq -0x1b0(%rbp), %rdi
leaq 0x33508(%rip), %rsi     # 0xa85fb
callq 0xc670
movq %rax, -0x1b8(%rbp)
jmp 0x75101
movq -0x1b8(%rbp), %rdi
movq 0x5eeb1(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
jmp 0x75116
leaq 0x5f58b(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x75141
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xc3e0
jmp 0x75701
jmp 0x75143
jmp 0x75145
movb $0x0, -0x1(%rbp)
movl $0x1, -0x74(%rbp)
jmp 0x7523a
movq -0x70(%rbp), %rdi
callq 0x727b0
movq %rax, -0x1c0(%rbp)
jmp 0x75167
movq -0x1c0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rsi
movq -0x80(%rbp), %rcx
leaq 0x32385(%rip), %rdx     # 0xa7506
xorl %edi, %edi
movb %dil, %al
callq 0x42eb0
jmp 0x7518d
movq -0x70(%rbp), %rdi
callq 0xc310
movq -0x70(%rbp), %rdi
callq 0xca60
movq %rax, -0x1c8(%rbp)
jmp 0x751a8
movq -0x1c8(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x75228
movq -0x88(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x75223
movq -0x88(%rbp), %rdi
addq $0x13, %rdi
leaq 0x33431(%rip), %rsi     # 0xa860f
callq 0x29fe0
movb %al, -0x1c9(%rbp)
jmp 0x751eb
movb -0x1c9(%rbp), %al
testb $0x1, %al
jne 0x751f7
jmp 0x75223
jmp 0x751f9
jmp 0x751fb
jmp 0x751fd
movq -0x28(%rbp), %rsi
movq -0x88(%rbp), %rcx
addq $0x1c, %rcx
leaq 0x33406(%rip), %rdx     # 0xa8619
xorl %eax, %eax
movl $0x1, %edi
callq 0x42eb0
jmp 0x75221
jmp 0x75223
jmp 0x75196
movq -0x70(%rbp), %rdi
callq 0xcb00
jmp 0x75233
movl $0x0, -0x74(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xc3e0
movl -0x74(%rbp), %eax
testl %eax, %eax
je 0x75251
jmp 0x7524c
jmp 0x756f3
jmp 0x756ef
jmp 0x75258
jmp 0x7525a
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0xc960
movq -0x1d8(%rbp), %rdx
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x716b0
jmp 0x75283
movq -0x170(%rbp), %rdx
addq $0x18, %rdx
leaq 0x3337a(%rip), %rsi     # 0xa860f
leaq -0xe8(%rbp), %rdi
callq 0x25900
jmp 0x752a3
leaq 0x310c3(%rip), %rdx     # 0xa636d
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2eef0
jmp 0x752bf
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xc8a0
jmp 0x752d4
leaq -0xc8(%rbp), %rdi
callq 0xc3e0
leaq -0xe8(%rbp), %rdi
callq 0xc3e0
jmp 0x752ee
jmp 0x752f0
leaq -0xa8(%rbp), %rdi
callq 0xc260
movq %rax, %rdi
callq 0xca20
movq %rax, -0x1e0(%rbp)
jmp 0x7530d
movq -0x1e0(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x754ba
movq -0x30(%rbp), %rdi
leaq 0x33285(%rip), %rsi     # 0xa85b9
callq 0xc920
jmp 0x7533b
jmp 0x7533d
leaq 0x5f364(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
cmpq $0x0, %rax
je 0x754a6
leaq 0x5f34b(%rip), %rax     # 0xd46a8
movq %rax, -0x1f0(%rbp)
movq (%rax), %rdi
callq 0x25800
movq -0x1f0(%rbp), %rax
movq (%rax), %rdi
callq 0x257e0
movq %rax, %rdi
leaq 0x30e2b(%rip), %rsi     # 0xa61b0
callq 0xc670
movq %rax, -0x1e8(%rbp)
jmp 0x75393
movq -0x1e8(%rbp), %rdi
leaq 0x33231(%rip), %rsi     # 0xa85d2
callq 0xc670
movq %rax, -0x1f8(%rbp)
jmp 0x753af
movq -0x1f8(%rbp), %rdi
leaq 0x3176c(%rip), %rsi     # 0xa6b29
callq 0xc670
movq %rax, -0x200(%rbp)
jmp 0x753cb
movq -0x200(%rbp), %rdi
leaq 0x3320c(%rip), %rsi     # 0xa85e5
callq 0xc670
movq %rax, -0x208(%rbp)
jmp 0x753e7
movq -0x208(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xc5b0
movq %rax, -0x210(%rbp)
jmp 0x75403
movq -0x210(%rbp), %rdi
leaq 0x315b7(%rip), %rsi     # 0xa69c8
callq 0xc670
movq %rax, -0x218(%rbp)
jmp 0x7541f
movq -0x218(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xc5b0
movq %rax, -0x220(%rbp)
jmp 0x75438
movq -0x220(%rbp), %rdi
movq 0x5eb7a(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
jmp 0x7544d
leaq 0x5f254(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x754a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x756e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x75495
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xc3e0
leaq -0xe8(%rbp), %rdi
callq 0xc3e0
jmp 0x756e1
jmp 0x754a8
jmp 0x754aa
movb $0x0, -0x1(%rbp)
movl $0x1, -0x74(%rbp)
jmp 0x756c8
movq -0xf0(%rbp), %rdi
callq 0x72820
movq %rax, -0x228(%rbp)
jmp 0x754cf
movq -0x228(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x28(%rbp), %rsi
movq -0xf8(%rbp), %rcx
leaq 0x32017(%rip), %rdx     # 0xa7506
xorl %edi, %edi
movb %dil, %al
callq 0x42eb0
jmp 0x754fb
movq -0xf0(%rbp), %rdi
callq 0xc310
movq -0xf0(%rbp), %rdi
callq 0xca60
movq %rax, -0x230(%rbp)
jmp 0x7551c
movq -0x230(%rbp), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, %rax
je 0x756c1
movq -0x100(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x8, %eax
jne 0x756bc
movq -0x100(%rbp), %rdi
addq $0x13, %rdi
leaq 0x330c3(%rip), %rsi     # 0xa861d
leaq 0x31043(%rip), %rdx     # 0xa65a4
callq 0x29f10
movb %al, -0x231(%rbp)
jmp 0x7556e
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x7557d
jmp 0x756bc
movq -0x100(%rbp), %rsi
addq $0x13, %rsi
leaq 0x3308e(%rip), %rdx     # 0xa861d
leaq 0x3100e(%rip), %rcx     # 0xa65a4
leaq -0x120(%rbp), %rdi
callq 0x72890
jmp 0x755a4
leaq -0x140(%rbp), %rdi
callq 0xc960
movq -0x100(%rbp), %rdx
addq $0x13, %rdx
leaq -0x160(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x31740
jmp 0x755d0
leaq -0x160(%rbp), %rdi
callq 0xc260
movq %rax, %rdi
callq 0x5d580
movq %rax, -0x240(%rbp)
jmp 0x755ed
movq -0x240(%rbp), %rax
movq %rax, -0x168(%rbp)
jmp 0x755fd
jmp 0x755ff
movq -0x28(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xc260
movq %rax, -0x248(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xc260
movq -0x250(%rbp), %rsi
movq -0x248(%rbp), %rcx
movq %rax, %r8
movq -0x168(%rbp), %r9
leaq 0x32fdf(%rip), %rdx     # 0xa8627
xorl %eax, %eax
movl $0x1, %edi
callq 0x42eb0
jmp 0x75656
leaq -0x160(%rbp), %rdi
callq 0xc3e0
leaq -0x140(%rbp), %rdi
callq 0xc3e0
leaq -0x120(%rbp), %rdi
callq 0xc3e0
jmp 0x756bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x756a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x160(%rbp), %rdi
callq 0xc3e0
leaq -0x140(%rbp), %rdi
callq 0xc3e0
leaq -0x120(%rbp), %rdi
callq 0xc3e0
jmp 0x756e1
jmp 0x75507
movl $0x0, -0x74(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0xc3e0
movl -0x74(%rbp), %eax
testl %eax, %eax
je 0x756df
jmp 0x756dd
jmp 0x756f3
jmp 0x756ef
leaq -0xa8(%rbp), %rdi
callq 0xc3e0
jmp 0x75701
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0xcba0
nopw (%rax,%rax)