// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/src/components/dataset/dataset_inout.cc
// Function: input_fslist_dir_next(_scdc_dataset_inout_t*, _scdc_result_t*)
static scdcint_t input_fslist_dir_next(scdc_dataset_input_t *input, scdc_result_t *result)
{
  input_fslist_dir_data_t *data = static_cast<input_fslist_dir_data_t *>(input->data);

  bool first = true;

  char *buf = static_cast<char *>(SCDC_DATASET_INOUT_BUF_PTR(input));
  scdcint_t buf_size = SCDC_DATASET_INOUT_BUF_SIZE(input);

  SCDC_DATASET_INOUT_BUF_CURRENT(input) = 0;

  do {

    if (data->result && strcmp(data->result->d_name, ".") != 0 && strcmp(data->result->d_name, "..") != 0)
    {
      if (static_cast<scdcint_t>(strlen(data->result->d_name) + 16) < buf_size || first)
      {
        string pathname = string(data->pathname) + data->result->d_name;

        scdcint_t n;

        if (!data->follow_links && z_fs_is_link(pathname.c_str()))
          n = snprintf(buf, buf_size, "%s:l|", data->result->d_name);
        else if (z_fs_is_directory(pathname.c_str()))
          n = snprintf(buf, buf_size, "%s:d|", data->result->d_name);
        else if (z_fs_is_file(pathname.c_str()))
          n = snprintf(buf, buf_size, "%s:f:%" scdcint_fmt "|", data->result->d_name, z_fs_get_file_size(pathname.c_str()));
        else
          n = snprintf(buf, buf_size, "%s:?" scdcint_fmt "|", data->result->d_name);

        n = min(n, buf_size);

        buf += n;
        buf_size -= n;

        SCDC_DATASET_INOUT_BUF_CURRENT(input) += n;
        input->total_size += n;

        first = false;

      } else break;
    }

    data->result = readdir(data->dir);

  } while (data->result);

  if (!data->result) input->next = 0;

  return SCDC_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %r14
movq 0x10(%rdi), %r15
movq 0x18(%rdi), %r12
movq $0x0, 0x20(%rdi)
movb $0x1, %r13b
movq 0x110(%r14), %rbp
testq %rbp, %rbp
je 0x2fdb0
addq $0x13, %rbp
movq %rbp, %rdi
leaq 0x3a703(%rip), %rsi     # 0x6a350
callq 0xb770
testl %eax, %eax
je 0x2fdb0
movq %rbp, %rdi
leaq 0x3a6eb(%rip), %rsi     # 0x6a34f
callq 0xb770
testl %eax, %eax
je 0x2fdb0
movq %rbp, %rdi
callq 0xb200
addq $0x10, %rax
cmpq %r12, %rax
jl 0x2fc8c
testb $0x1, %r13b
je 0x2fe2a
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0x7(%rsp), %rdx
callq 0x1bdd6
movq 0x110(%r14), %rsi
addq $0x13, %rsi
movq %r13, %rdi
callq 0xba60
leaq 0x18(%rsp), %r13
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2fcdc
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x2fce4
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2fd18
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
cmpb $0x0, 0x100(%r14)
jne 0x2fd4b
movq 0x8(%rsp), %rdi
callq 0x35b3d
testq %rax, %rax
je 0x2fd4b
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b7cf(%rip), %rdx     # 0x6b518
jmp 0x2fd72
movq 0x8(%rsp), %rdi
callq 0x35ad3
testq %rax, %rax
je 0x2fdce
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b7ac(%rip), %rdx     # 0x6b51e
xorl %eax, %eax
callq 0xb8e0
movslq %eax, %r13
cmpq %r13, %r12
cmovlq %r12, %r13
addq %r13, 0x20(%rbx)
addq %r13, 0x28(%rbx)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2fda7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
addq %r13, %r15
subq %r13, %r12
xorl %r13d, %r13d
movq 0x108(%r14), %rdi
callq 0xb850
movq %rax, 0x110(%r14)
testq %rax, %rax
jne 0x2fc2f
jmp 0x2fe2a
movq 0x8(%rsp), %rdi
callq 0x35b08
movq 0x110(%r14), %rbp
testq %rax, %rax
je 0x2fe11
movq 0x8(%rsp), %rdi
callq 0x35b72
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b725(%rip), %rdx     # 0x6b524
movq %rbp, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xb8e0
jmp 0x2fd79
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b70d(%rip), %rdx     # 0x6b52f
movq %rbp, %rcx
jmp 0x2fd72
cmpq $0x0, 0x110(%r14)
jne 0x2fe3c
movq $0x0, 0x38(%rbx)
movl $0x1, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2fe88
movq 0x38(%rsp), %rsi
jmp 0x2fe80
movq %rax, %rbx
jmp 0x2fe88
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2fe88
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0