// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: release_scdc_output_next(_scdc_dataset_inout_t*, _scdc_result_t*)
static scdcint_t release_scdc_output_next(scdc_dataset_output_t *output, scdc_result_t *result)
{
  redirect_call_t *rc = static_cast<redirect_call_t *>(output->data);

  bool finish = true;

#if REDIRECT_CALL_PARAMS_NEW
  TRACE_F("params state %" rdint_fmt " of %" rdint_fmt, rc->params_state[0], rc->nparams);

  if (rc->params_state[0] < rc->nparams)
  {
    rdint_t i = rc->params_state[0];

    if (rc->params[i].type == REDIRECT_PARAM_TYPE_DENSE)
    {
      finish = false;

      SCDC_DATASET_INOUT_BUF_PTR(rc->output) = rc->params[i].p.dense.buf;
      SCDC_DATASET_INOUT_BUF_SIZE(rc->output) = SCDC_DATASET_INOUT_BUF_CURRENT(rc->output) = rc->params[i].p.dense.size;

      ++rc->params_state[0];

    } else if (rc->params[i].type == REDIRECT_PARAM_TYPE_BLOCKS)
    {
      TRACE_F("blocks state %" rdint_fmt " of %" rdint_fmt, rc->params_state[1], rc->params[i].p.blocks.count);

      if (rc->params_state[1] < rc->params[i].p.blocks.count)
      {
        finish = false;

        SCDC_DATASET_INOUT_BUF_PTR(rc->output) = static_cast<char *>(rc->params[i].p.blocks.buf) + (rc->params_state[1] * rc->params[i].p.blocks.stride);
        SCDC_DATASET_INOUT_BUF_SIZE(rc->output) = SCDC_DATASET_INOUT_BUF_CURRENT(rc->output) = rc->params[i].p.blocks.size;

        ++rc->params_state[1];
      }

    } else ASSERT(false);
  }
#else
  TRACE_F("dense state %d of %d", rc->output_state, rc->dense_nparams);

  if (rc->output_state < rc->dense_nparams)
  {
    finish = false;

    rdint_t i = rc->output_state;

    SCDC_DATASET_INOUT_BUF_PTR(rc->output) = rc->dense_params[i].buf;
    SCDC_DATASET_INOUT_BUF_SIZE(rc->output) = SCDC_DATASET_INOUT_BUF_CURRENT(rc->output) = rc->dense_params[i].size;

    ++rc->output_state;
  }
#endif

  if (finish)
  {
    TRACE_F("freeing %d buffers", rc->free_nbufs);

    redirect_call_free_bufs(rc);

    SCDC_DATASET_INOUT_BUF_PTR(rc->output) = NULL;
    SCDC_DATASET_INOUT_BUF_SIZE(rc->output) = 0;
    SCDC_DATASET_INOUT_BUF_CURRENT(rc->output) = 0;

    output->next = NULL;
    output->data = NULL;
  }

  return SCDC_SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x40(%rdi), %rbx
movq 0x658f9(%rip), %r15     # 0x74fb8
movq (%r15), %rdi
leaq 0x41140(%rip), %rsi     # 0x50809
leaq 0x412ae(%rip), %rdx     # 0x5097e
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rdi
movq 0x868(%rbx), %rcx
movq 0x870(%rbx), %rdx
leaq 0x411ef(%rip), %rsi     # 0x508de
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq 0x870(%rbx), %rax
cmpq 0x868(%rbx), %rax
jge 0xf7fd
imulq $0x28, %rax, %rcx
leaq (%rbx,%rcx), %r12
addq $0x880, %r12            # imm = 0x880
movl (%r12), %ecx
cmpl $0x1, %ecx
je 0xf761
testl %ecx, %ecx
jne 0xf7e1
movq 0x8(%r12), %rcx
movq 0xb10(%rbx), %rdx
movq %rcx, 0x10(%rdx)
movq 0x10(%r12), %rcx
movq %rcx, 0x20(%rdx)
movq %rcx, 0x18(%rdx)
incq %rax
movq %rax, 0x870(%rbx)
jmp 0xf857
movq (%r15), %rdi
leaq 0x4109e(%rip), %rsi     # 0x50809
leaq 0x4120c(%rip), %rdx     # 0x5097e
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rdi
movq 0x878(%rbx), %rdx
movq 0x10(%r12), %rcx
leaq 0x41208(%rip), %rsi     # 0x50997
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq 0x878(%rbx), %rax
cmpq 0x10(%r12), %rax
jge 0xf7fd
movq 0x20(%r12), %rcx
imulq %rax, %rcx
addq 0x8(%r12), %rcx
movq 0xb10(%rbx), %rdx
movq %rcx, 0x10(%rdx)
movq 0x18(%r12), %rcx
movq %rcx, 0x20(%rdx)
movq %rcx, 0x18(%rdx)
incq %rax
movq %rax, 0x878(%rbx)
jmp 0xf857
movq 0x657f0(%rip), %rax     # 0x74fd8
movq (%rax), %rcx
leaq 0x41160(%rip), %rdi     # 0x50952
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0xba80
movq (%r15), %rdi
leaq 0x41002(%rip), %rsi     # 0x50809
leaq 0x41170(%rip), %rdx     # 0x5097e
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rdi
movl 0xb20(%rbx), %edx
leaq 0x41146(%rip), %rsi     # 0x5096b
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq %rbx, %rdi
callq 0xee11
movq 0xb10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
andq $0x0, 0x20(%rax)
movups %xmm0, 0x38(%r14)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq