// File: /workspace/github_cpp_makefile_star2_O3/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 0x7b070(%rip), %r13     # 0x8bfa0
movq (%r13), %rdi
leaq 0x588ee(%rip), %rsi     # 0x69829
leaq 0x58c08(%rip), %rdx     # 0x69b4a
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rdi
leaq 0x58ac7(%rip), %rsi     # 0x69a1b
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 0x10f89
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 0x1239a
movq 0xba8(%rbx), %rdi
testq %rdi, %rdi
je 0x10f7a
movslq 0xb20(%rbx), %rax
movq $-0x1, %rbp
testq %rax, %rax
jle 0x10fcf
xorl %ecx, %ecx
cmpq %r14, 0xb28(%rbx,%rcx,8)
je 0x10fcc
incq %rcx
cmpq %rcx, %rax
jne 0x10fb8
jmp 0x10fcf
movq %rcx, %rbp
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0xf843
testq %rax, %rbp
js 0x10f7a
movq %rax, %r12
movq (%r13), %rdi
leaq 0x5883a(%rip), %rsi     # 0x69829
leaq 0x58b54(%rip), %rdx     # 0x69b4a
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rdi
testq %r12, %r12
js 0x11036
leaq 0x58aff(%rip), %rsi     # 0x69b0c
movq %r12, %rdx
xorl %eax, %eax
callq 0xb7a0
movq (%r13), %rsi
movl $0xa, %edi
callq 0xb690
movq 0xba8(%rbx), %rdi
movq %r12, %rsi
callq 0xf881
jmp 0x1106e
leaq 0x58aeb(%rip), %rsi     # 0x69b28
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 0xf710
testq %rbp, %rbp
js 0x10f7a
movslq 0xb20(%rbx), %rax
cmpq %rax, %rbp
jge 0x10f7a
leaq -0x1(%rax), %rcx
movl %ecx, 0xb20(%rbx)
cmpq %rcx, %rbp
je 0x10f7a
movq 0xb20(%rbx,%rax,8), %rax
movq %rax, 0xb28(%rbx,%rbp,8)
jmp 0x10f7a