// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/dataset/dataset_inout.cc
// Function: scdc_dataset_inout_t* scdc_dataset_output_FX_create<int>(_scdc_dataset_inout_t*, char const*, _scdc_args_t*, int)
static scdc_dataset_output_t *scdc_dataset_output_FX_create(scdc_dataset_output_t *output, 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 };
  bool trunc = false;

  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_output_FX_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_output_FX_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_output_FX_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_output_FX_create: getting buffer");
        return 0;
      }

    } else if (c == "trunc")
    {
      trunc = true;

    } 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_output_FX_create: ignoring parameter '" << c << "'"); break;
      }

      ++i;
    }
  }

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

  if (!output) return 0;

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

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

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

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

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

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

  if (trunc && data->truncate(0) != 0)
  {
    SCDC_ERROR("scdc_dataset_output_FX_create: truncate file");
    return 0;
  }

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

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

  output->next = output_FX_next<T>;

  return output;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
andq $0x0, 0x18(%rsp)
movl %ecx, 0x44(%rsp)
orq $-0x1, 0x38(%rsp)
movq %rdx, %rbx
orq $-0x1, 0x30(%rsp)
movq %rsi, %rdx
movq %rdi, %r14
movups 0x29bbc(%rip), %xmm0    # 0x527c8
movaps %xmm0, 0x20(%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 0x28c8f
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 0x28c8f
movq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rcx), %rax
movq %rax, 0x28(%rsp)
movq %r14, 0x58(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movb $0x1, 0x7(%rsp)
xorl %eax, %eax
leaq 0xc0(%rsp), %r14
leaq 0xa0(%rsp), %r15
leaq 0x2984e(%rip), %r12     # 0x52514
pushq $0x2
popq %r13
leaq 0x29876(%rip), %rbp     # 0x52547
leaq 0x295a6(%rip), %rbx     # 0x5227e
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movl %eax, %ecx
movl %ecx, %eax
movq %rax, 0x48(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x19f34
testb %al, %al
je 0x28f5d
movq %r15, %rdi
movq %r12, %rsi
callq 0x19be0
testb %al, %al
jne 0x28dc7
movq %r15, %rdi
movq %rbp, %rsi
callq 0x19be0
testb %al, %al
je 0x28d4f
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x29053
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x38(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x28cf3
jmp 0x29053
movq %r15, %rdi
movq %rbx, %rsi
callq 0x19be0
testb %al, %al
je 0x28d89
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x290af
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x30(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x28cf3
jmp 0x290af
movq %r15, %rdi
leaq 0x2bd70(%rip), %rsi     # 0x54b03
callq 0x19be0
testb %al, %al
je 0x28df9
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x29108
movq 0x60(%rsp), %rdi
pushq $0x8
popq %rsi
leaq 0x20(%rsp), %rdx
callq *%rax
testq %rax, %rax
jne 0x28cf3
jmp 0x29108
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x29277
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %rdx
callq *%rax
movb $0x1, %cl
movq %rcx, 0x10(%rsp)
testq %rax, %rax
jne 0x28cf3
jmp 0x29277
movq %r15, %rdi
leaq 0x297a9(%rip), %rsi     # 0x525ac
callq 0x19be0
movb $0x1, %cl
testb %al, %al
jne 0x28cec
movq 0xa8(%rsp), %rdx
testq %rdx, %rdx
je 0x28f46
movq 0x8(%rsp), %rcx
cmpq $0x2, %rcx
je 0x28eaa
cmpq $0x1, %rcx
je 0x28e9d
testq %rcx, %rcx
jne 0x28ebf
movq 0xa0(%rsp), %rax
movsbl -0x1(%rax,%rdx), %edi
movq %rdx, 0x10(%rsp)
callq 0xba10
shll $0x18, %eax
movl %eax, %ecx
orl $0x4000000, %ecx        # imm = 0x4000000
cmpl $0x46000000, %ecx       # imm = 0x46000000
jne 0x28e81
movq 0x10(%rsp), %rsi
decq %rsi
cmpl $0x46000000, %eax       # imm = 0x46000000
sete 0x7(%rsp)
movq %r15, %rdi
callq 0xb760
movq %r15, %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %rdx
callq 0x29c68
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x28f46
movq %r15, %rdi
movq %r13, %rsi
leaq 0x38(%rsp), %rdx
jmp 0x28eb5
movq %r15, %rdi
movq %r13, %rsi
leaq 0x30(%rsp), %rdx
callq 0x29c68
jmp 0x28f46
leaq 0x4c6ba(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x28f4b
addq $0x20, %rdi
callq 0xb800
leaq 0x4c6a0(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x2829a(%rip), %rsi     # 0x51188
callq 0xb520
movq %rax, %rdi
leaq 0x29158(%rip), %rsi     # 0x52055
callq 0xb520
movq %rax, %rdi
leaq 0x296a6(%rip), %rsi     # 0x525b2
callq 0xb520
movq %rax, %rdi
movq %r15, %rsi
callq 0xb490
movq %rax, %rdi
leaq 0x2a43d(%rip), %rsi     # 0x53363
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x4c646(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x8(%rsp), %rcx
incq %rcx
movq %rcx, 0x8(%rsp)
movq 0x48(%rsp), %rax
jmp 0x28cea
xorl %ebx, %ebx
cmpq $0x0, 0x20(%rsp)
movl $0x0, %esi
jne 0x28f71
movq 0x28(%rsp), %rsi
pushq $0x18
popq %rdx
movq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x276d1
testb %al, %al
movq 0x48(%rsp), %rcx
je 0x29170
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x28fa5
movq %rax, 0x10(%r14)
movq 0x28(%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), %rbx
movl 0x44(%rsp), %eax
movl %eax, (%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rbx)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rbx)
testb $0x1, %cl
je 0x291a9
movq %rbx, %rdi
xorl %esi, %esi
callq 0x24d42
testq %rax, %rax
je 0x291a9
leaq 0x4c582(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x28465(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x29026(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x295a8(%rip), %rsi     # 0x525e6
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x2915b
leaq 0x4c526(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x28409(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x28fca(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x29481(%rip), %rsi     # 0x5251b
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x2915b
leaq 0x4c4ca(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x283ad(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x28f6e(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x29456(%rip), %rsi     # 0x5254c
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x2915b
leaq 0x4c471(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x28358(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x28f19(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x29433(%rip), %rsi     # 0x5257e
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x4c41e(%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
testb $0x1, 0x10(%rsp)
je 0x291d0
movq 0x18(%rsp), %rsi
movb 0x7(%rsp), %al
notb %al
movzbl %al, %edx
andl $0x1, %edx
addl %edx, %edx
movq %rbx, %rdi
callq 0x24d18
testq %rax, %rax
js 0x291e0
leaq 0x142(%rip), %rax       # 0x29319
movq %rax, 0x38(%r14)
movq %r14, %rbx
jmp 0x29170
leaq 0x4c399(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x2827c(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x28e3d(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x293ec(%rip), %rsi     # 0x52613
movq %rax, %rdi
callq 0xb520
movq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0xb1d0
leaq 0x29105(%rip), %rsi     # 0x52348
movq %rax, %rdi
callq 0xb520
leaq 0x290fd(%rip), %rcx     # 0x5234f
leaq 0x290fc(%rip), %rsi     # 0x52355
testb $0x1, 0x7(%rsp)
cmovneq %rcx, %rsi
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x2915b
leaq 0x4c302(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x2916e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x18(%rax), %rdi
leaq 0x281e5(%rip), %rsi     # 0x51488
callq 0xb520
leaq 0x28da6(%rip), %rsi     # 0x52055
movq %rax, %rdi
callq 0xb520
leaq 0x2922a(%rip), %rsi     # 0x524e8
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
jmp 0x2915b
jmp 0x292e0
jmp 0x292e0
jmp 0x292e0
movq %rax, %rbx
jmp 0x292f0
jmp 0x292e0
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