// File: mh0fm4[P]SCDC/src/components/dataset/dataset_inout.cc
// Function: scdc_dataset_inout_redirect_from(_scdc_dataset_inout_t*, char const*, _scdc_args_t*)
static scdcint_t scdc_dataset_inout_redirect_from(scdc_dataset_inout_t *inout, const char *conf, scdc_args_t *args)
{
  if (stringlist(':', conf).front() == "input")
  {
    scdc_args xargs(args);
  
    scdc_dataset_input_t input;
    scdc_arg_ref_t input_arg_ref = xargs.get<scdc_dataset_input_t>(SCDC_ARGS_TYPE_DATASET_INPUT, &input);

    if (input_arg_ref == SCDC_ARG_REF_NULL)
    {
      SCDC_FAIL("scdc_dataset_inout_redirect_from: getting output parameter failed!");
      return SCDC_FAILURE;
    }

    /* assign input to inout */
    inout2inout(&input, inout, false);

    inout->next = input.next; input.next = 0;
    inout->data = input.data; input.data = 0;

    inout->intern = input.intern;

    xargs.set<scdc_dataset_input_t>(SCDC_ARGS_TYPE_DATASET_OUTPUT, &input, input_arg_ref); /* FIXME: ..._OUTPUT?*/

    return SCDC_SUCCESS;
  }

  scdc_dataset_input_t _input, *input = &_input;

  scdc_args_data_ior_t args_ior_data = { inout, args };
  scdc_args_t args_ior = { &args_ior_data, scdc_args_get_ior, args->set, args->free };

  input = scdc_dataset_input_create_intern(input, conf, &args_ior);

  if (!input)
  {
    SCDC_FAIL("scdc_dataset_inout_redirect_from: creating input for redirection failed!");
    return SCDC_FAILURE;
  }

  scdc_dataset_input_autodestroy(input);

  /* FIXME: if inout->next, then loop similar to ..._redirect_to? */
  *inout = *input;

  return SCDC_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x68(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
movl $0x3a, %esi
movq $-0x1, %rcx
callq 0x25a70
movq -0x1b0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x267a0
jmp 0x4c789
leaq 0x5a8a5(%rip), %rsi     # 0xa7035
leaq -0x40(%rbp), %rdi
callq 0x25b80
movb %al, -0x1b1(%rbp)
jmp 0x4c7a1
leaq -0x40(%rbp), %rdi
callq 0xc3e0
leaq -0x68(%rbp), %rdi
callq 0x25c90
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x4c7c2
jmp 0x4c9d2
movq -0x20(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x25660
movq -0x1c8(%rbp), %rdi
movl $0x9, %esi
leaq -0x108(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4d750
movq %rax, -0x1c0(%rbp)
jmp 0x4c7fc
movq -0x1c0(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq $0x0, -0x110(%rbp)
jne 0x4c937
jmp 0x4c81a
leaq 0x87e87(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
cmpq $0x0, %rax
je 0x4c91c
leaq 0x87e6e(%rip), %rax     # 0xd46a8
movq %rax, -0x1d8(%rbp)
movq (%rax), %rdi
callq 0x25800
movq -0x1d8(%rbp), %rax
movq (%rax), %rdi
callq 0x257e0
movq %rax, %rdi
leaq 0x5994e(%rip), %rsi     # 0xa61b0
callq 0xc670
movq %rax, -0x1d0(%rbp)
jmp 0x4c870
movq -0x1d0(%rbp), %rdi
leaq 0x5a7fe(%rip), %rsi     # 0xa707c
callq 0xc670
movq %rax, -0x1e0(%rbp)
jmp 0x4c88c
movq -0x1e0(%rbp), %rdi
leaq 0x5ae41(%rip), %rsi     # 0xa76db
callq 0xc670
movq %rax, -0x1e8(%rbp)
jmp 0x4c8a8
movq -0x1e8(%rbp), %rdi
movq 0x8770a(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
jmp 0x4c8bd
leaq 0x87de4(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x4c91c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4c8f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc3e0
leaq -0x68(%rbp), %rdi
callq 0x25c90
jmp 0x4cb1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x256b0
jmp 0x4cb1e
jmp 0x4c91e
jmp 0x4c920
movq $0x0, -0x8(%rbp)
movl $0x1, -0x114(%rbp)
jmp 0x4c9c1
movq -0x10(%rbp), %rsi
leaq -0x108(%rbp), %rdi
xorl %edx, %edx
callq 0x4cff0
jmp 0x4c94b
movq -0xd0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq $0x0, -0xd0(%rbp)
movq -0xc8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0xc8(%rbp)
movq -0xc0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x110(%rbp), %rcx
leaq -0xb0(%rbp), %rdi
movl $0xa, %esi
leaq -0x108(%rbp), %rdx
callq 0x4d7e0
jmp 0x4c9af
movq $0x1, -0x8(%rbp)
movl $0x1, -0x114(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x256b0
jmp 0x4cb11
leaq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x188(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq 0x6a5(%rip), %rax       # 0x4d0b0
movq %rax, -0x1a0(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x198(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x190(%rbp)
movq -0x178(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
callq 0x43810
movq %rax, -0x178(%rbp)
cmpq $0x0, -0x178(%rbp)
jne 0x4cae8
jmp 0x4ca5e
leaq 0x87c43(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
cmpq $0x0, %rax
je 0x4cadc
leaq 0x87c2e(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25800
leaq 0x87c1f(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, %rdi
leaq 0x59715(%rip), %rsi     # 0xa61b0
callq 0xc670
movq %rax, %rdi
leaq 0x5a5d2(%rip), %rsi     # 0xa707c
callq 0xc670
movq %rax, %rdi
leaq 0x5ac65(%rip), %rsi     # 0xa771e
callq 0xc670
movq %rax, %rdi
movq 0x874f8(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
leaq 0x87bd4(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x4cade
movq $0x0, -0x8(%rbp)
jmp 0x4cb11
movq -0x178(%rbp), %rdi
callq 0x45490
movq -0x178(%rbp), %rsi
movq -0x10(%rbp), %rdi
movl $0x58, %edx
callq 0xc530
movq $0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0xcba0
nopw (%rax,%rax)