// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: void redirect_call_put_output_param_blocks_val<float>(_redirect_call_t*, char const*, float const*, long, long, long)
static void redirect_call_put_output_param_blocks_val(redirect_call_t *rc, const char *id, const T *b, rdint_t count, rdint_t size, rdint_t stride)
{
  TRACE_F("rc: %p, id: '%s', b: %p, count: %" rdint_fmt ", size: %" rdint_fmt ", stride: %" rdint_fmt, rc, id, b, count, size, stride);

  if (rc->client) /* client */
  {
    /* FIXME: use buffer for output */

  } else /* server */
  {
    bool transfer_dense = false;
    rdint_t send_stride = stride;
    rdint_t transfer_stride = stride;

    if (size < stride)
    {
#if REDIRECT_CALL_OUTPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PLAIN
      TRACE_F("transfer plain");
      transfer_dense = true;
      send_stride = stride;
      transfer_stride = stride;
#elif REDIRECT_CALL_OUTPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_IP
      TRACE_F("transform in-place to stride: %" rdint_fmt, size);
      redirect_data_blocks_transform_val<T>(count, size, stride, const_cast<T *>(b), size, NULL);
      transfer_dense = true;
      send_stride = size;
      transfer_stride = size;
#elif REDIRECT_CALL_OUTPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_OP
      TRACE_F("transform out-of-place to stride: %" rdint_fmt, size);
      T *b_tmp = static_cast<T *>(redirect_call_alloc_buf(rc, count * size * sizeof(T)));
      redirect_data_blocks_transform_val<T>(count, size, stride, const_cast<T *>(b), size, b_tmp);
      b = b_tmp;
      transfer_dense = true;
      send_stride = size;
      transfer_stride = size;
#elif REDIRECT_CALL_OUTPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PIECES
      TRACE_F("process in pieces");
      transfer_dense = false;
      send_stride = stride;
      transfer_stride = size;
#endif
    }

    TRACE_F("send stride: %" rdint_fmt ", transfer stride: %" rdint_fmt, send_stride, transfer_stride);
    redirect_call_put_output_conf_rdint(rc, "stride", transfer_stride);

    if (size >= send_stride || transfer_dense)
    {
      TRACE_F("dense: %" rdint_fmt, get_blocks_cont_size(count, size, send_stride));
      register_param_dense<T>(rc, b, get_blocks_cont_size(count, size, send_stride));

    } else
    {
      TRACE_F("blocks: %" rdint_fmt " x %" rdint_fmt " / %" rdint_fmt, count, size, send_stride);
      register_param_blocks<T>(rc, b, count, size, send_stride);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r13
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r14
movq 0x78f40(%rip), %rbx     # 0x8bfa0
movq (%rbx), %rdi
leaq 0x5679f(%rip), %rsi     # 0x69809
leaq 0x56e2c(%rip), %rdx     # 0x69e9d
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rdi
leaq 0x56cdd(%rip), %rsi     # 0x69d5f
movq %r14, %rdx
movq %rbp, %rcx
movq %r12, %rbp
movq %r15, %r12
movq 0x10(%rsp), %r15
movq %rbp, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r15
pushq %r13
callq 0xb7a0
addq $0x10, %rsp
movq (%rbx), %rsi
movl $0xa, %edi
callq 0xb690
cmpl $0x0, (%r14)
je 0x130ca
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, 0x8(%rsp)
cmpq %r15, %r13
jge 0x13112
movq (%rbx), %rdi
leaq 0x5672b(%rip), %rsi     # 0x69809
leaq 0x56db8(%rip), %rdx     # 0x69e9d
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rcx
leaq 0x56ca5(%rip), %rdi     # 0x69d9b
movl $0xe, %esi
movl $0x1, %edx
callq 0xba90
movq (%rbx), %rsi
movl $0xa, %edi
callq 0xb690
leaq -0x1(%r12), %rax
imulq %r15, %rax
addq %r13, %rax
testq %r13, %r13
cmoveq %r13, %rax
cmpq $0x1, %r12
movq (%rbx), %rdi
leaq 0x56d6a(%rip), %rdx     # 0x69e9d
leaq 0x566cf(%rip), %rbp     # 0x69809
movl $0x0, %r12d
cmovaeq %rax, %r12
movq %rbp, %rsi
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rdi
leaq 0x56c52(%rip), %rsi     # 0x69daa
movq %r15, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rsi
leaq 0x56c62(%rip), %r13     # 0x69dd1
movl $0xa, %edi
callq 0xb690
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x106e7
movq (%rbx), %rdi
movq %rbp, %rsi
leaq 0x56d09(%rip), %rdx     # 0x69e9d
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rdi
leaq 0x56cb1(%rip), %rsi     # 0x69e56
movq %r12, %rdx
xorl %eax, %eax
callq 0xb7a0
movq (%rbx), %rsi
movl $0xa, %edi
callq 0xb690
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12516