// File: /workspace/github_cpp_makefile_star2_O2/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 0x62eed(%rip), %rbx     # 0x74fb8
movq (%rbx), %rdi
leaq 0x3e734(%rip), %rsi     # 0x50809
leaq 0x3edc1(%rip), %rdx     # 0x50e9d
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rdi
leaq 0x3ec72(%rip), %rsi     # 0x50d5f
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 0xb7c0
popq %rcx
popq %rdx
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
cmpl $0x0, (%r14)
je 0x12131
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, 0x8(%rsp)
cmpq %r15, %r13
jge 0x12173
movq (%rbx), %rdi
leaq 0x3e6c4(%rip), %rsi     # 0x50809
leaq 0x3ed51(%rip), %rdx     # 0x50e9d
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rcx
leaq 0x3ec3e(%rip), %rdi     # 0x50d9b
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
callq 0xba80
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
leaq -0x1(%r12), %rax
imulq %r15, %rax
addq %r13, %rax
testq %r13, %r13
cmoveq %r13, %rax
cmpq $0x1, %r12
movq (%rbx), %rdi
leaq 0x3ed09(%rip), %rdx     # 0x50e9d
leaq 0x3e66e(%rip), %rsi     # 0x50809
movl $0x0, %r12d
cmovaeq %rax, %r12
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rdi
leaq 0x3ebf4(%rip), %rsi     # 0x50daa
movq %r15, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rsi
leaq 0x3ec04(%rip), %r13     # 0x50dd1
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0xb6b0
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xf9fb
movq (%rbx), %rdi
leaq 0x3e61a(%rip), %rsi     # 0x50809
leaq 0x3eca7(%rip), %rdx     # 0x50e9d
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rdi
leaq 0x3ec4f(%rip), %rsi     # 0x50e56
movq %r12, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%rbx), %rsi
movl %ebp, %edi
callq 0xb6b0
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 0x1162d