// File: /workspace/github_cpp_makefile_star2_O3/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 0x7bc67(%rip), %r15     # 0x8bfa0
movq (%r15), %rdi
leaq 0x594e6(%rip), %rsi     # 0x69829
leaq 0x59654(%rip), %rdx     # 0x6999e
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rdi
movq 0x868(%rbx), %rcx
movq 0x870(%rbx), %rdx
leaq 0x59595(%rip), %rsi     # 0x698fe
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rsi
movl $0xa, %edi
callq 0xb690
movq 0x870(%rbx), %rax
cmpq 0x868(%rbx), %rax
jge 0x10464
leaq (%rax,%rax,4), %rcx
leaq (%rbx,%rcx,8), %r12
addq $0x880, %r12            # imm = 0x880
movl (%r12), %ecx
cmpl $0x1, %ecx
je 0x103dd
testl %ecx, %ecx
jne 0x1045f
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 0x104c3
movq (%r15), %rdi
leaq 0x59442(%rip), %rsi     # 0x69829
leaq 0x595b0(%rip), %rdx     # 0x6999e
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rdi
movq 0x878(%rbx), %rdx
movq 0x10(%r12), %rcx
leaq 0x595ac(%rip), %rsi     # 0x699b7
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rsi
movl $0xa, %edi
callq 0xb690
movq 0x878(%rbx), %rax
cmpq 0x10(%r12), %rax
jge 0x10464
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 0x104c3
callq 0xbb08
movq (%r15), %rdi
leaq 0x593bb(%rip), %rsi     # 0x69829
leaq 0x59529(%rip), %rdx     # 0x6999e
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rdi
movl 0xb20(%rbx), %edx
leaq 0x594ff(%rip), %rsi     # 0x6998b
xorl %eax, %eax
callq 0xb7a0
movq (%r15), %rsi
movl $0xa, %edi
callq 0xb690
movq %rbx, %rdi
callq 0xf9f4
movq 0xb10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movups %xmm0, 0x38(%r14)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq