// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, 0x20(%rdi)
movq 0x110(%r14), %rax
movb $0x1, %bpl
leaq 0x28(%rsp), %r13
testq %rax, %rax
je 0x288f6
cmpb $0x2e, 0x13(%rax)
jne 0x28811
cmpb $0x0, 0x14(%rax)
je 0x288f6
cmpb $0x2e, 0x14(%rax)
jne 0x28811
cmpb $0x0, 0x15(%rax)
je 0x288f6
addq $0x13, %rax
movq %rax, %rdi
callq 0xb210
addq $0x10, %rax
cmpq %r12, %rax
setl %al
orb %bpl, %al
testb $0x1, %al
je 0x28975
movq %r13, %rdi
movq %r14, %rsi
leaq 0x7(%rsp), %rdx
callq 0x1a132
movq 0x110(%r14), %rdx
addq $0x13, %rdx
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x1cb18
movq %r13, %rdi
callq 0xb230
cmpb $0x0, 0x100(%r14)
jne 0x28895
movq 0x8(%rsp), %rdi
callq 0x2d9a9
testq %rax, %rax
je 0x28895
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x29c35(%rip), %rdx     # 0x524c8
jmp 0x288bc
movq 0x8(%rsp), %rdi
callq 0x2d93f
testq %rax, %rax
je 0x28914
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x29c12(%rip), %rdx     # 0x524ce
xorl %eax, %eax
callq 0xb900
cltq
cmpq %rax, %r12
cmovlq %r12, %rax
addq %rax, %r15
subq %rax, %r12
movdqu 0x20(%rbx), %xmm0
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
paddq %xmm0, %xmm1
movdqu %xmm1, 0x20(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xb230
xorl %ebp, %ebp
movq 0x108(%r14), %rdi
callq 0xb870
movq %rax, 0x110(%r14)
testq %rax, %rax
jne 0x287e8
jmp 0x28970
movq 0x8(%rsp), %rdi
callq 0x2d974
movq 0x110(%r14), %rbp
testq %rax, %rax
je 0x28957
movq 0x8(%rsp), %rdi
callq 0x2d9de
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x29b8f(%rip), %rdx     # 0x524d4
movq %rbp, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xb900
jmp 0x288c3
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x29b77(%rip), %rdx     # 0x524df
movq %rbp, %rcx
jmp 0x288bc
andq $0x0, 0x38(%rbx)
pushq $0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x2899e
movq %rax, %rbx
jmp 0x289a3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb230
movq %rbx, %rdi
callq 0xb9a0