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

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

  bool transfer_dense = false;
  rdint_t transfer_stride;

  redirect_call_get_input_conf_rdint(rc, "stride", &transfer_stride);
  TRACE_F("transfer stride: %" rdint_fmt, transfer_stride);

  if (*stride == 0) *stride = transfer_stride;

  rdint_t alloc_stride, recv_stride;

#if REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PLAIN
  transfer_dense = true;
  alloc_stride = transfer_stride;
  recv_stride = transfer_stride;
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_IP
  transfer_dense = true;
  alloc_stride = z_max(*stride, transfer_stride);
  recv_stride = transfer_stride;
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_OP
  transfer_dense = true;
  alloc_stride = *stride;
  recv_stride = transfer_stride;
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PIECES
  transfer_dense = false;
  alloc_stride = *stride;
  recv_stride = *stride;
#endif

  TRACE_F("alloc stride: %" rdint_fmt ", recv stride: %" rdint_fmt, alloc_stride, recv_stride);

  if (*b == NULL) *b = static_cast<T *>(redirect_call_alloc_buf(rc, get_blocks_cont_size(count, size, alloc_stride) * sizeof(T)));

  T* b_recv = *b;

#if REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_OP
  T *b_tmp = 0;
  if (recv_stride != *stride) b_recv = b_tmp = static_cast<T *>(malloc(get_blocks_cont_size(count, size, transfer_stride) * sizeof(T)));
#endif

  if (recv_stride == transfer_stride || transfer_dense)
  {
    TRACE_F("consume dense: %" rdint_fmt, get_blocks_cont_size(count, size, recv_stride));
    consume_input_dense<T>(rc, b_recv, get_blocks_cont_size(count, size, recv_stride));

  } else
  {
    TRACE_F("consume blocks: %" rdint_fmt " x %" rdint_fmt " / %" rdint_fmt, count, size, recv_stride);
    consume_input_blocks<T>(rc, b_recv, count, size, recv_stride);
  }

  if (recv_stride != *stride)
  {
#if REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PLAIN
    TRACE_F("set stride to %" rdint_fmt, recv_stride);
    *stride = recv_stride;
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_IP
    TRACE_F("transform in-place to stride %" rdint_fmt, *stride);
    redirect_data_blocks_transform_val<T>(count, size, recv_stride, b_recv, *stride, NULL);
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PACK_OP
    TRACE_F("transform out-of-place to stride %" rdint_fmt, *stride);
    redirect_data_blocks_transform_val<T>(count, size, recv_stride, b_recv, *stride, *b);
    free(b_tmp);
#elif REDIRECT_CALL_INPUT_PARAM_BLOCKS == REDIRECT_CALL_BLOCKS_PIECES
    /* this should never occur, because pieces are received with the correct stride */
    ASSERT(false);
#endif
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r13
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movq 0x791f7(%rip), %r12     # 0x8bfa0
movq (%r12), %rdi
leaq 0x56a75(%rip), %rsi     # 0x69829
leaq 0x57066(%rip), %rdx     # 0x69e21
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rdi
movq %r15, 0x10(%rsp)
movq (%r15), %r8
movq %rbp, %r15
movq %r13, %rbp
leaq 0x56fa4(%rip), %rsi     # 0x69d7f
movq %r14, %rdx
movq 0x8(%rsp), %rcx
movq %r15, %r9
xorl %eax, %eax
pushq (%r13)
pushq %rbx
callq 0xb7a0
addq $0x10, %rsp
movq (%r12), %rsi
movl $0xa, %edi
callq 0xb690
cmpl $0x0, (%r14)
jne 0x12ff1
movq 0x150(%r14), %rax
leaq (%r14,%rax), %rdi
addq $0x168, %rdi            # imm = 0x168
leaq 0x20(%rsp), %r13
movq %r13, %rsi
callq 0x12005
addq %rax, 0x150(%r14)
movq (%r12), %rdi
leaq 0x569ea(%rip), %rsi     # 0x69829
leaq 0x56fdb(%rip), %rdx     # 0x69e21
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rdi
movq (%r13), %rdx
leaq 0x56f80(%rip), %rsi     # 0x69ddc
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rsi
movl $0xa, %edi
callq 0xb690
movq %rbp, 0x8(%rsp)
cmpq $0x0, (%rbp)
movq (%r13), %rbp
jne 0x12e89
movq 0x8(%rsp), %rax
movq %rbp, (%rax)
movq (%r12), %rdi
leaq 0x56995(%rip), %rsi     # 0x69829
leaq 0x56f86(%rip), %rdx     # 0x69e21
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rdi
leaq 0x56f9d(%rip), %rsi     # 0x69e4a
movq %rbp, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rsi
movl $0xa, %edi
callq 0xb690
movq 0x10(%rsp), %rcx
movq (%rcx), %r13
testq %r13, %r13
jne 0x12f2f
movslq 0xb20(%r14), %rax
cmpq $0xf, %rax
jle 0x12ee7
xorl %r13d, %r13d
jmp 0x12f2c
leaq -0x1(%r15), %rdi
imulq %rbp, %rdi
addq %rbx, %rdi
shlq $0x2, %rdi
testq %rbx, %rbx
cmoveq %rbx, %rdi
testq %r15, %r15
cmoveq %r15, %rdi
movq %rax, 0x18(%rsp)
callq 0xb6f0
movq 0x10(%rsp), %rcx
movq %rax, %r13
movq 0x18(%rsp), %rax
movq %r13, 0xb28(%r14,%rax,8)
incl %eax
movl %eax, 0xb20(%r14)
movq %r13, (%rcx)
leaq -0x1(%r15), %rax
imulq %rbp, %rax
addq %rbx, %rax
testq %rbx, %rbx
cmoveq %rbx, %rax
cmpq $0x1, %r15
movq (%r12), %rdi
leaq 0x56ed1(%rip), %rdx     # 0x69e21
leaq 0x568d2(%rip), %rsi     # 0x69829
movl $0x0, %r15d
cmovaeq %rax, %r15
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rdi
leaq 0x56efb(%rip), %rsi     # 0x69e6e
movq %r15, %rdx
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rsi
movl $0xa, %edi
callq 0xb690
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x126a7
movq 0x8(%rsp), %r14
cmpq (%r14), %rbp
je 0x12fe2
movq (%r12), %rdi
leaq 0x5687b(%rip), %rsi     # 0x69829
leaq 0x56e6c(%rip), %rdx     # 0x69e21
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rdi
leaq 0x56eba(%rip), %rsi     # 0x69e81
movq %rbp, %rdx
xorl %eax, %eax
callq 0xb7a0
movq (%r12), %rsi
movl $0xa, %edi
callq 0xb690
movq %rbp, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xbfa0
jmp 0x12e0e