// File: /workspace/github_cpp_makefile_star2_O3/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)
leaq 0x18(%rsp), %r13
movq 0x110(%r14), %rax
movb $0x1, %bpl
testq %rax, %rax
je 0x2fafb
cmpb $0x2e, 0x13(%rax)
jne 0x2f9b1
cmpb $0x0, 0x14(%rax)
je 0x2fafb
cmpb $0x2e, 0x14(%rax)
jne 0x2f9b1
cmpb $0x0, 0x15(%rax)
je 0x2fafb
addq $0x13, %rax
movq %rax, %rdi
callq 0xb200
addq $0x10, %rax
cmpq %r12, %rax
setl %al
orb %bpl, %al
testb $0x1, %al
je 0x2fb7d
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x7(%rsp), %rdx
callq 0x1bd28
movq 0x110(%r14), %rsi
addq $0x13, %rsi
movq %rbp, %rdi
callq 0xba60
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2fa1d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x2fa25
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 0x2fa59
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
cmpb $0x0, 0x100(%r14)
jne 0x2fa8c
movq 0x8(%rsp), %rdi
callq 0x357f1
testq %rax, %rax
je 0x2fa8c
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3baae(%rip), %rdx     # 0x6b538
jmp 0x2fab3
movq 0x8(%rsp), %rdi
callq 0x35787
testq %rax, %rax
je 0x2fb19
movq 0x110(%r14), %rcx
addq $0x13, %rcx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3ba8b(%rip), %rdx     # 0x6b53e
xorl %eax, %eax
callq 0xb8e0
movslq %eax, %rbp
cmpq %rbp, %r12
cmovlq %r12, %rbp
movdqu 0x20(%rbx), %xmm0
movq %rbp, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
paddq %xmm0, %xmm1
movdqu %xmm1, 0x20(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2faf3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
addq %rbp, %r15
subq %rbp, %r12
xorl %ebp, %ebp
movq 0x108(%r14), %rdi
callq 0xb850
movq %rax, 0x110(%r14)
testq %rax, %rax
jne 0x2f988
jmp 0x2fb75
movq 0x8(%rsp), %rdi
callq 0x357bc
movq 0x110(%r14), %rbp
testq %rax, %rax
je 0x2fb5c
movq 0x8(%rsp), %rdi
callq 0x35826
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b9fa(%rip), %rdx     # 0x6b544
movq %rbp, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xb8e0
jmp 0x2faba
addq $0x13, %rbp
movq %r15, %rdi
movq %r12, %rsi
leaq 0x3b9e2(%rip), %rdx     # 0x6b54f
movq %rbp, %rcx
jmp 0x2fab3
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 0x2fbc9
movq 0x38(%rsp), %rsi
jmp 0x2fbc1
movq %rax, %rbx
jmp 0x2fbc9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2fbc9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0