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

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

  } else /* server */
  {
    /* register dense output */
    register_param_dense<T>(rc, b, n);

#if REDIRECT_CALL_PARAMS_CACHE
    /* try to add an entry to the cache (dense output is cacheable) */
    if (rc->cache)
    {
      rdint_t buf_index = redirect_call_find_buf(rc, b);
      rdint_t entry_index = redirect_cache_find_entry(rc->cache, get_type<T>(), n * sizeof(T), b);

      /* caching entry if buffer is allocated or entry is already cached */
      if (buf_index >= 0 || entry_index >= 0)
      {
        if (entry_index >= 0)
        {
          TRACE_F("updating entry %" rdint_fmt " of cache", entry_index);
          redirect_cache_update_entry(rc->cache, entry_index);

        } else
        {
          TRACE_F("adding entry [%d,%" rdint_fmt ",%p] to cache", get_type<T>(), static_cast<rdint_t>(n * sizeof(T)), b);
          redirect_cache_put_entry(rc->cache, get_type<T>(), n * sizeof(T), b);
        }

        if (buf_index >= 0) redirect_call_remove_buf(rc, buf_index);
      }
    }
#endif
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq 0x7b00e(%rip), %r13     # 0x8bfa0
movq (%r13), %rdi
leaq 0x5886c(%rip), %rsi     # 0x69809
leaq 0x58b86(%rip), %rdx     # 0x69b2a
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rdi
leaq 0x58a45(%rip), %rsi     # 0x699fb
movq %rbx, %rdx
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rsi
movl $0xa, %edi
callq 0xb690
cmpl $0x0, (%rbx)
je 0x10feb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x123fc
movq 0xba8(%rbx), %rdi
testq %rdi, %rdi
je 0x10fdc
movslq 0xb20(%rbx), %rax
movq $-0x1, %rbp
testq %rax, %rax
jle 0x11031
xorl %ecx, %ecx
cmpq %r14, 0xb28(%rbx,%rcx,8)
je 0x1102e
incq %rcx
cmpq %rcx, %rax
jne 0x1101a
jmp 0x11031
movq %rcx, %rbp
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0xf830
testq %rax, %rbp
js 0x10fdc
movq %rax, %r12
movq (%r13), %rdi
leaq 0x587b8(%rip), %rsi     # 0x69809
leaq 0x58ad2(%rip), %rdx     # 0x69b2a
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rdi
testq %r12, %r12
js 0x11098
leaq 0x58a7d(%rip), %rsi     # 0x69aec
movq %r12, %rdx
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rsi
movl $0xa, %edi
callq 0xb690
movq 0xba8(%rbx), %rdi
movq %r12, %rsi
callq 0xf86e
jmp 0x110d0
leaq 0x58a69(%rip), %rsi     # 0x69b08
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rsi
movl $0xa, %edi
callq 0xb690
movq 0xba8(%rbx), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0xf6db
testq %rbp, %rbp
js 0x10fdc
movslq 0xb20(%rbx), %rax
cmpq %rax, %rbp
jge 0x10fdc
leaq -0x1(%rax), %rcx
movl %ecx, 0xb20(%rbx)
cmpq %rcx, %rbp
je 0x10fdc
movq 0xb20(%rbx,%rax,8), %rax
movq %rax, 0xb28(%rbx,%rbp,8)
jmp 0x10fdc