// File: mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: void redirect_call_put_input_param_blocks_val<float>(_redirect_call_t*, char const*, float const*, long, long, long)
static void redirect_call_put_input_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);

  /* client only */
  ASSERT(rc->client);

  bool transfer_dense = false;
  rdint_t send_stride = stride;
  rdint_t transfer_stride = stride;

  if (size < stride)
  {
#if REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PLAIN
    TRACE_F("transfer plain");
    transfer_dense = true;
    send_stride = stride;
    transfer_stride = stride;
#elif REDIRECT_CALL_INPUT_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_INPUT_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_INPUT_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_input_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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq 0xbb889(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d0e0(%rip), %rsi     # 0xa5811
leaq 0x8d606(%rip), %rdx     # 0xa5d3e
movb $0x0, %al
callq 0xc9a0
movq 0xbb86a(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0x28(%rbp), %r10
movq -0x30(%rbp), %rax
leaq 0x8d5ff(%rip), %rsi     # 0xa5d67
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0xc9a0
movq 0xbb831(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d11f(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
jmp 0x18792
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x187b3
movq 0xbb836(%rip), %rax     # 0xd3fd8
movq (%rax), %rdi
leaq 0x8d277(%rip), %rsi     # 0xa5a23
movb $0x0, %al
callq 0xc9a0
jmp 0x187b5
movb $0x0, -0x31(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x18838
jmp 0x187d5
movq 0xbb7d4(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d02b(%rip), %rsi     # 0xa5811
leaq 0x8d551(%rip), %rdx     # 0xa5d3e
movb $0x0, %al
callq 0xc9a0
movq 0xbb7b5(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d59e(%rip), %rsi     # 0xa5da3
movb $0x0, %al
callq 0xc9a0
movq 0xbb79d(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d08b(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movb $0x1, -0x31(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1883a
movq 0xbb76f(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8cfc6(%rip), %rsi     # 0xa5811
leaq 0x8d4ec(%rip), %rdx     # 0xa5d3e
movb $0x0, %al
callq 0xc9a0
movq 0xbb750(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
leaq 0x8d540(%rip), %rsi     # 0xa5db2
movb $0x0, %al
callq 0xc9a0
movq 0xbb730(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8d01e(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq 0x8d539(%rip), %rsi     # 0xa5dd9
callq 0x12550
movq -0x28(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0x188b9
testb $0x1, -0x31(%rbp)
je 0x18959
jmp 0x188bb
movq 0xbb6ee(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8cf45(%rip), %rsi     # 0xa5811
leaq 0x8d46b(%rip), %rdx     # 0xa5d3e
movb $0x0, %al
callq 0xc9a0
movq 0xbb6cf(%rip), %rax     # 0xd3fb0
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x189e0
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0x8d557(%rip), %rsi     # 0xa5e5e
movb $0x0, %al
callq 0xc9a0
movq 0xbb69b(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8cf89(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x189e0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %rax, %rdx
callq 0x17a80
jmp 0x189cf
jmp 0x1895b
movq 0xbb64e(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8cea5(%rip), %rsi     # 0xa5811
leaq 0x8d3cb(%rip), %rdx     # 0xa5d3e
movb $0x0, %al
callq 0xc9a0
movq 0xbb62f(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq 0x8d4da(%rip), %rsi     # 0xa5e71
movb $0x0, %al
callq 0xc9a0
movq 0xbb60b(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x8cef9(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %r8
callq 0x18a30
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)