// File: /workspace/github_cpp_makefile_star2_O2/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 $0xe8, %rsp
andq $0x0, 0x28(%rsp)
movl %ecx, 0x4c(%rsp)
orq $-0x1, 0x20(%rsp)
movq %rdx, %rbx
orq $-0x1, 0x40(%rsp)
movq %rsi, %rdx
movq %rdi, %r14
movups 0x2b02a(%rip), %xmm0    # 0x527c8
movaps %xmm0, 0x30(%rsp)
leaq 0xc0(%rsp), %rdi
pushq $0x3a
popq %rsi
pushq $-0x1
popq %rcx
callq 0x19b64
leaq 0x80(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
andq $0x0, 0x50(%rsp)
movaps %xmm0, -0x20(%rax)
movaps %xmm1, -0x10(%rax)
movq -0x18(%rax), %rax
testq %rax, %rax
je 0x27821
movq 0x60(%rsp), %rdi
pushq $0xe
popq %rsi
leaq 0x50(%rsp), %rdx
callq *%rax
movq 0x50(%rsp), %rcx
testq %rax, %rax
setne %al
testq %rcx, %rcx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x27821
movq 0x10(%rcx), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rcx), %rax
movq %rax, 0x38(%rsp)
movq %r14, 0x58(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movb $0x1, 0xf(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0xc0(%rsp), %r14
leaq 0xa0(%rsp), %r15
leaq 0x2acb5(%rip), %r12     # 0x52514
pushq $0x2
popq %r13
leaq 0x2acdd(%rip), %rbp     # 0x52547
leaq 0x2aa0d(%rip), %rbx     # 0x5227e
movq $0x0, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x19f34
testb %al, %al
je 0x27ac6
movq %r15, %rdi
movq %r12, %rsi
callq 0x19be0
testb %al, %al
jne 0x2794e
movq %r15, %rdi
movq %rbp, %rsi
callq 0x19be0
testb %al, %al
je 0x278d6
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x27b9d
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x20(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x2787a
jmp 0x27b9d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x19be0
testb %al, %al
je 0x27910
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x27bf9
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x40(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x2787a
jmp 0x27bf9
movq %r15, %rdi
leaq 0x2d1e9(%rip), %rsi     # 0x54b03
callq 0x19be0
testb %al, %al
je 0x27980
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x27c52
movq 0x60(%rsp), %rdi
pushq $0x8
popq %rsi
leaq 0x30(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x2787a
jmp 0x27c52
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x27d86
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x28(%rsp), %rdx
callq *%rax
movb $0x1, %cl
movq %rcx, 0x18(%rsp)
testq %rax, %rax
jne 0x2787a
jmp 0x27d86
movq 0xa8(%rsp), %rcx
testq %rcx, %rcx
je 0x27ab4
movq 0x10(%rsp), %rax
cmpq $0x2, %rax
je 0x27a18
cmpq $0x1, %rax
je 0x27a0b
testq %rax, %rax
jne 0x27a2d
movq 0xa0(%rsp), %rax
movsbl -0x1(%rax,%rcx), %edi
movq %rcx, 0x18(%rsp)
callq 0xba10
shll $0x18, %eax
movl %eax, %ecx
orl $0x4000000, %ecx        # imm = 0x4000000
cmpl $0x46000000, %ecx       # imm = 0x46000000
jne 0x279ef
movq 0x18(%rsp), %rsi
decq %rsi
cmpl $0x46000000, %eax       # imm = 0x46000000
sete 0xf(%rsp)
movq %r15, %rdi
callq 0xb760
movq %r15, %rdi
movq %r13, %rsi
leaq 0x28(%rsp), %rdx
callq 0x29c68
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x27ab4
movq %r15, %rdi
movq %r13, %rsi
leaq 0x20(%rsp), %rdx
jmp 0x27a23
movq %r15, %rdi
movq %r13, %rsi
leaq 0x40(%rsp), %rdx
callq 0x29c68
jmp 0x27ab4
leaq 0x4db4c(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x27ab4
addq $0x20, %rdi
callq 0xb800
leaq 0x4db32(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x2972c(%rip), %rsi     # 0x51188
callq 0xb520
movq %rax, %rdi
leaq 0x2a5ea(%rip), %rsi     # 0x52055
callq 0xb520
movq %rax, %rdi
leaq 0x2a86b(%rip), %rsi     # 0x522e5
callq 0xb520
movq %rax, %rdi
movq %r15, %rsi
callq 0xb490
movq %rax, %rdi
leaq 0x2b8cf(%rip), %rsi     # 0x53363
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x4dad8(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x10(%rsp), %rax
incq %rax
movq %rax, 0x10(%rsp)
jmp 0x2787a
xorl %ebx, %ebx
cmpq $0x0, 0x30(%rsp)
movl $0x0, %esi
jne 0x27ada
movq 0x38(%rsp), %rsi
pushq $0x18
popq %rdx
movq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x276d1
testb %al, %al
je 0x27cba
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x27b09
movq %rax, 0x10(%r14)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%r14)
movq 0x48(%r14), %rax
andq $0x0, 0x8(%rax)
andq $0x0, 0x20(%rax)
movb $0x0, 0x4(%r14)
movl $0x61746164, (%r14)     # imm = 0x61746164
movq 0x40(%r14), %rdi
movl 0x4c(%rsp), %eax
movl %eax, (%rdi)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rdi)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rdi)
testb $0x1, 0x18(%rsp)
movb 0xf(%rsp), %cl
je 0x27b6e
movq 0x28(%rsp), %rsi
movl %ecx, %eax
notb %al
movzbl %al, %edx
andl $0x1, %edx
addl %edx, %edx
callq 0x24d18
testq %rax, %rax
js 0x27cf3
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
testq %rax, %rax
setns %dl
cmovnsq %rax, %rcx
orb $0x6c, %dl
movq %rcx, 0x28(%r14)
movb %dl, 0x30(%r14)
andq $0x0, 0x20(%r14)
leaq 0x297(%rip), %rax       # 0x27e28
movq %rax, 0x38(%r14)
movq %r14, %rbx
jmp 0x27cba
leaq 0x4d9dc(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x27cb8
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x298bf(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x2a480(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2a669(%rip), %rsi     # 0x5224d
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x27ca5
leaq 0x4d980(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x27cb8
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x29863(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x2a424(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2a645(%rip), %rsi     # 0x52285
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x27ca5
leaq 0x4d927(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x27cb8
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x2980e(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x2a3cf(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2a622(%rip), %rsi     # 0x522b7
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x4d8d4(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
xorl %ebx, %ebx
leaq 0xa0(%rsp), %rdi
callq 0xb230
leaq 0x60(%rsp), %rdi
callq 0x19a94
leaq 0xc0(%rsp), %rdi
callq 0x19ef4
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4d886(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x27cb8
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x2976d(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x2a32e(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2a5e3(%rip), %rsi     # 0x52319
movq %rax, %rdi
callq 0xb520
movq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0xb1d0
leaq 0x2a5f6(%rip), %rsi     # 0x52348
movq %rax, %rdi
callq 0xb520
leaq 0x2a5ee(%rip), %rcx     # 0x5234f
leaq 0x2a5ed(%rip), %rsi     # 0x52355
testb $0x1, 0xf(%rsp)
cmovneq %rcx, %rsi
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x27ca5
leaq 0x4d7f3(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x27cb8
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x296d6(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x2a297(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2a44d(%rip), %rsi     # 0x5221a
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x27ca5
jmp 0x27def
jmp 0x27def
jmp 0x27def
movq %rax, %rbx
jmp 0x27dff
jmp 0x27def
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0xb230
leaq 0x60(%rsp), %rdi
callq 0x19a94
leaq 0xc0(%rsp), %rdi
callq 0x19ef4
movq %rbx, %rdi
callq 0xb9a0