// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/src/components/dataset/dataset_inout.cc
// Function: scdc_dataset_inout_t* scdc_dataset_input_FX_create<int>(_scdc_dataset_inout_t*, char const*, _scdc_args_t*, int)
static scdc_dataset_inout_t *scdc_dataset_input_FX_create(scdc_dataset_input_t *input, const char *conf, scdc_args_t *args, T fx)
{
  bool offset_set = false;
  bool offset_front = true;
  scdcint_t offset = 0;
  scdcint_t size = -1;
  scdcint_t chunk_size = -1;
  scdc_args_buf_t buffer = { 0, DEFAULT_DATASET_INOUT_BUF_SIZE };

  stringlist confs(':', conf);
  scdc_args xargs(args);

  scdc_dataset_inout_t *inout_redirect = 0;
  if (xargs.get<scdc_dataset_inout_t *>(SCDC_ARGS_TYPE_DATASET_INOUT_REDIRECT_PTR, &inout_redirect) != SCDC_ARG_REF_NULL && inout_redirect)
  {
    buffer.buf = SCDC_DATASET_INOUT_BUF_PTR(inout_redirect);
    buffer.buf_size = SCDC_DATASET_INOUT_BUF_SIZE(inout_redirect);
  }

  string c;
  scdcint_t i = 0;
  while (confs.front_pop(c))
  {
    if (c == "offset")
    {
      if (xargs.get<scdcint_t>(SCDC_ARGS_TYPE_SCDCINT, &offset) == SCDC_ARG_REF_NULL)
      {
        SCDC_ERROR("scdc_dataset_input_FXX_create: getting file offset");
        return 0;
      }

      offset_set = true;

    } else if (c == "size")
    {
      if (xargs.get<scdcint_t>(SCDC_ARGS_TYPE_SCDCINT, &size) == SCDC_ARG_REF_NULL)
      {
        SCDC_ERROR("scdc_dataset_input_FXX_create: getting file size");
        return 0;
      }

    } else if (c == "chunks")
    {
      if (xargs.get<scdcint_t>(SCDC_ARGS_TYPE_SCDCINT, &chunk_size) == SCDC_ARG_REF_NULL)
      {
        SCDC_ERROR("scdc_dataset_input_FXX_create: getting chunk size");
        return 0;
      }

    } else if (c == "buffer")
    {
      if (xargs.get<scdc_args_buf_t>(SCDC_ARGS_TYPE_BUF, &buffer) == SCDC_ARG_REF_NULL)
      {
        SCDC_ERROR("scdc_dataset_input_FXX_create: getting buffer");
        return 0;
      }

    } else
    {
      char r;

      if (!c.empty())
      switch (i)
      {
        case 0:
          r = toupper(c[c.size() - 1]);
          if (r == 'F' || r == 'B') { offset_front = (r == 'F'); c.resize(c.size() - 1); }
          scdc_args_string(c).get<scdcint_t>(c, SCDC_ARGS_TYPE_SCDCINT, &offset);
          offset_set = true;
          break;
        case 1: scdc_args_string(c).get<scdcint_t>(c, SCDC_ARGS_TYPE_SCDCINT, &size); break;
        case 2: scdc_args_string(c).get<scdcint_t>(c, SCDC_ARGS_TYPE_SCDCINT, &chunk_size); break;
        default: SCDC_FAIL("scdc_dataset_input_FXX_create: ignoring parameter '" << c << "'"); break;
      }

      ++i;
    }
  }

  SCDC_TRACE("scdc_dataset_input_FXX_create: offset: " << offset << ", size: " << size << ", chunks: " << chunk_size <<
             ", buffer: " << buffer.buf << " / " << buffer.buf_size);

  if (!input) return 0;

  if (!scdc_dataset_inout_alloc(input, (buffer.buf?0:buffer.buf_size), sizeof(inout_FX_data_t<T>))) return 0;

  if (buffer.buf)
  {
    SCDC_DATASET_INOUT_BUF_PTR(input) = buffer.buf;
    SCDC_DATASET_INOUT_BUF_SIZE(input) = buffer.buf_size;
  }

  input->intern->type = SCDC_DATASET_INOUT_TYPE_NONE;
  input->intern->destroy = NULL;

  strcpy(input->format, "data");

  inout_FX_data_t<T> *data = static_cast<inout_FX_data_t<T> *>(input->data);

  data->fx = fx;
  data->chunk_size = chunk_size;
  data->size_left = size;

  if (offset_set && data->seek(offset, (offset_front)?SEEK_SET:SEEK_END) < 0)
  {
    SCDC_ERROR("scdc_dataset_input_FXX_create: seek to offset " << offset << " from " << ((offset_front)?"front":"back"));
    return 0;
  }

  SCDC_TRACE("scdc_dataset_input_FXX_create: offset: " << data->tell());

#if DETERMINE_EXACT_TOTAL_SIZE
  scdcint_t size_left = (fd != -1)?get_FD_size_left(fd):((file != NULL)?get_FILE_size_left(file):-1);

  if (size_left >= 0)
  {
    input->total_size = size_left;
    if (size >= 0) input->total_size = z_min(input->total_size, size);
    input->total_size_given = SCDC_DATASET_INOUT_TOTAL_SIZE_GIVEN_EXACT;

  } else
#endif
  {
    if (size >= 0)
    {
      input->total_size = size;
      input->total_size_given = SCDC_DATASET_INOUT_TOTAL_SIZE_GIVEN_AT_MOST;

    } else
    {
      input->total_size = 0;
      input->total_size_given = SCDC_DATASET_INOUT_TOTAL_SIZE_GIVEN_AT_LEAST;
    }
  }

  SCDC_DATASET_INOUT_BUF_CURRENT(input) = 0;

  input->next = input_FX_next<T>;

  return input;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %ecx, 0x54(%rsp)
movq %rdx, %r14
movq %rsi, %rdx
movq %rdi, %r15
xorl %ebx, %ebx
movq %rbx, 0x28(%rsp)
movq $-0x1, %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x48(%rsp)
movups 0x3d10d(%rip), %xmm0    # 0x6b818
movaps %xmm0, 0x30(%rsp)
leaq 0xd0(%rsp), %rdi
movl $0x3a, %esi
movq $-0x1, %rcx
callq 0x1b8f2
leaq 0xb0(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq %rbx, 0x10(%rax)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm0, -0x20(%rax)
movaps %xmm1, -0x10(%rax)
movq %rbx, 0x80(%rsp)
movq -0x18(%rax), %rax
testq %rax, %rax
je 0x2e778
movq 0x90(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movl $0xe, %esi
callq *%rax
movq %rax, %rbx
movq %r15, 0x88(%rsp)
testq %rbx, %rbx
setne %cl
movq 0x80(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2e7ad
movq 0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movb $0x1, 0xf(%rsp)
leaq 0xd0(%rsp), %r14
leaq 0x58(%rsp), %r15
leaq 0x3cd8a(%rip), %r12     # 0x6b564
leaq 0x3cdb6(%rip), %r13     # 0x6b597
leaq 0x3cae6(%rip), %rbp     # 0x6b2ce
leaq 0x3f314(%rip), %rbx     # 0x6db03
movq $0x0, 0x78(%rsp)
movq $0x0, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1bbc4
testb %al, %al
je 0x2eadf
movq %r15, %rdi
movq %r12, %rsi
callq 0xb110
testl %eax, %eax
je 0x2e8f1
movq %r15, %rdi
movq %r13, %rsi
callq 0xb110
testl %eax, %eax
je 0x2e87b
movq %r15, %rdi
movq %rbp, %rsi
callq 0xb110
testl %eax, %eax
je 0x2e89e
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb110
testl %eax, %eax
jne 0x2e91b
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x2e8c1
movq 0x90(%rsp), %rdi
movl $0x8, %esi
leaq 0x30(%rsp), %rdx
callq *%rax
jmp 0x2e8c3
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x2e8d1
movq 0x90(%rsp), %rdi
movl $0x2, %esi
leaq 0x20(%rsp), %rdx
callq *%rax
jmp 0x2e8d3
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x2e8e1
movq 0x90(%rsp), %rdi
movl $0x2, %esi
leaq 0x48(%rsp), %rdx
callq *%rax
jmp 0x2e8e3
xorl %eax, %eax
testq %rax, %rax
jne 0x2e801
jmp 0x2ebbb
xorl %eax, %eax
testq %rax, %rax
jne 0x2e801
jmp 0x2ec29
xorl %eax, %eax
testq %rax, %rax
jne 0x2e801
jmp 0x2ecb6
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x2e9b2
movq 0x90(%rsp), %rdi
movl $0x2, %esi
leaq 0x28(%rsp), %rdx
callq *%rax
jmp 0x2e9b4
movq 0x60(%rsp), %rcx
testq %rcx, %rcx
je 0x2ead5
movq 0x78(%rsp), %rax
cmpq $0x2, %rax
je 0x2e9dc
cmpq $0x1, %rax
je 0x2e9c9
testq %rax, %rax
jne 0x2e9f9
movq 0x58(%rsp), %rax
movsbl -0x1(%rax,%rcx), %edi
movq %rcx, 0x18(%rsp)
callq 0xba30
shll $0x18, %eax
movl %eax, %ecx
orl $0x4000000, %ecx        # imm = 0x4000000
cmpl $0x46000000, %ecx       # imm = 0x46000000
jne 0x2e98e
movq 0x18(%rsp), %rsi
decq %rsi
cmpl $0x46000000, %eax       # imm = 0x46000000
sete 0xf(%rsp)
movq %r15, %rdi
xorl %edx, %edx
callq 0xb130
movq 0x58(%rsp), %rdi
leaq 0x3e326(%rip), %rsi     # 0x6ccc0
leaq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0xb4e0
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x2ead5
xorl %eax, %eax
movb $0x1, %cl
movq %rcx, 0x18(%rsp)
testq %rax, %rax
jne 0x2e801
jmp 0x2ee1f
movq 0x58(%rsp), %rdi
leaq 0x3e2eb(%rip), %rsi     # 0x6ccc0
leaq 0x20(%rsp), %rdx
jmp 0x2e9ed
movq 0x58(%rsp), %rdi
leaq 0x3e2d8(%rip), %rsi     # 0x6ccc0
leaq 0x48(%rsp), %rdx
xorl %eax, %eax
callq 0xb4e0
jmp 0x2ead5
leaq 0x5db70(%rip), %rax     # 0x8c570
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x2ead5
addq $0x20, %rdi
callq 0xb7d0
leaq 0x5db52(%rip), %rax     # 0x8c570
movq (%rax), %rax
movq 0x8(%rax), %rdi
movl $0xb, %edx
movq %rdi, 0x10(%rsp)
leaq 0x3b752(%rip), %rsi     # 0x6a188
callq 0xb5f0
movl $0xf, %edx
movq 0x10(%rsp), %rdi
leaq 0x3c659(%rip), %rsi     # 0x6b0a5
callq 0xb5f0
movl $0x33, %edx
movq 0x10(%rsp), %rdi
leaq 0x3c8d3(%rip), %rsi     # 0x6b335
callq 0xb5f0
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x10(%rsp), %rdi
callq 0xb5f0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3d8d1(%rip), %rsi     # 0x6c35b
movq %rax, 0x10(%rsp)
callq 0xb5f0
movq 0x10(%rsp), %rcx
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0xb4d0
movq 0x10(%rsp), %rdi
movsbl %al, %esi
callq 0xb050
movq %rax, %rdi
callq 0xb340
leaq 0x5daa7(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
incq 0x78(%rsp)
jmp 0x2e801
xorl %ebx, %ebx
cmpq $0x0, 0x30(%rsp)
movl $0x0, %esi
jne 0x2eaf3
movq 0x38(%rsp), %rsi
movl $0x18, %edx
movq 0x88(%rsp), %r14
movq %r14, %rdi
callq 0x2e611
testb %al, %al
je 0x2eebc
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x2eb27
movq %rax, 0x10(%r14)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%r14)
movq 0x48(%r14), %rax
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rcx, 0x20(%rax)
movb $0x0, 0x4(%r14)
movl $0x61746164, (%r14)     # imm = 0x61746164
movq 0x40(%r14), %rax
movl 0x54(%rsp), %edi
movl %edi, (%rax)
movq 0x48(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
testb $0x1, 0x18(%rsp)
je 0x2eb85
movq 0x28(%rsp), %rsi
movb 0xf(%rsp), %al
notb %al
movzbl %al, %edx
andl $0x1, %edx
addl %edx, %edx
callq 0xba50
testq %rax, %rax
js 0x2ed43
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
testq %rax, %rax
cmovnsq %rax, %rcx
setns %al
orb $0x6c, %al
movq %rcx, 0x28(%r14)
movb %al, 0x30(%r14)
movq $0x0, 0x20(%r14)
leaq 0x3c9(%rip), %rax       # 0x2ef78
movq %rax, 0x38(%r14)
movq %r14, %rbx
jmp 0x2eebc
leaq 0x5d9ae(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2eeba
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x18(%rax), %rbx
leaq 0x3b8a1(%rip), %rsi     # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c4aa(%rip), %rsi     # 0x6b0a5
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c6f8(%rip), %rsi     # 0x6b307
movl $0x2d, %edx
movq %rbx, %rdi
callq 0xb5f0
movq %rbx, %rdi
callq 0xb250
jmp 0x2eea7
leaq 0x5d940(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2eeba
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x18(%rax), %rbx
leaq 0x3b833(%rip), %rsi     # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c43c(%rip), %rsi     # 0x6b0a5
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c620(%rip), %rsi     # 0x6b29d
movl $0x30, %edx
movq %rbx, %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
jmp 0x2eea7
leaq 0x5d8b3(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2eeba
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x18(%rax), %rbx
leaq 0x3b7a6(%rip), %rsi     # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c3af(%rip), %rsi     # 0x6b0a5
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c5cb(%rip), %rsi     # 0x6b2d5
movl $0x31, %edx
movq %rbx, %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
jmp 0x2eea7
leaq 0x5d826(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2eeba
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x18(%rax), %rbx
leaq 0x3b719(%rip), %rsi     # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c322(%rip), %rsi     # 0x6b0a5
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c5d2(%rip), %rsi     # 0x6b369
movl $0x2e, %edx
movq %rbx, %rdi
callq 0xb5f0
movq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0xb1d0
movq %rax, %rbx
leaq 0x3c5dd(%rip), %rsi     # 0x6b398
movl $0x6, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x3c5d0(%rip), %rax     # 0x6b39f
leaq 0x3c5cf(%rip), %rsi     # 0x6b3a5
movb 0xf(%rsp), %cl
testb $0x1, %cl
cmovneq %rax, %rsi
movzbl %cl, %edx
andl $0x1, %edx
orq $0x4, %rdx
movq %rbx, %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
jmp 0x2eea7
leaq 0x5d74a(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2eeba
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x18(%rax), %rbx
leaq 0x3b63d(%rip), %rsi     # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c246(%rip), %rsi     # 0x6b0a5
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x3c3f7(%rip), %rsi     # 0x6b26a
movl $0x32, %edx
movq %rbx, %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
leaq 0x5d6c2(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
xorl %ebx, %ebx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2eed8
movq 0x68(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x90(%rsp), %rdi
callq 0x1b820
leaq 0xd0(%rsp), %rdi
callq 0x1bb7e
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ef14
jmp 0x2ef14
jmp 0x2ef14
movq %rax, %rbx
jmp 0x2ef33
jmp 0x2ef14
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2ef33
movq 0x68(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x90(%rsp), %rdi
callq 0x1b820
leaq 0xd0(%rsp), %rdi
callq 0x1bb7e
movq %rbx, %rdi
callq 0xb9c0