// File: mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: redirect_call_execute
int redirect_call_execute(redirect_call_t *rc)
{
#if REDIRECT_CALL_PARAMS_CACHE
  char cache_state[256];
  rdint_t cache_state_size = 0;

  if (rc->cache) redirect_cache_check(rc->cache, rc->dataset, rc->uri, cache_state, &cache_state_size);

  TRACE_F("cache_state: %.*s", static_cast<int>(cache_state_size), cache_state);
#endif

  char cmd[REDIRECT_CALL_URI_MAX_SIZE + REDIRECT_CALL_OP_MAX_SIZE + REDIRECT_CALL_CACHE_STATE_MAX_SIZE + REDIRECT_CALL_INPUT_CONF_MAX_SIZE + REDIRECT_CALL_OUTPUT_CONF_MAX_SIZE];
  rdint_t cmd_size = 0;

  if (rc->dataset == SCDC_DATASET_NULL) cmd_size += sprintf(cmd, "%s ", rc->uri);

  cmd_size += sprintf(cmd + cmd_size, "%s ", rc->op);

#if REDIRECT_CALL_PARAMS_CACHE
  cmd_size += redirect_call_put_inout_conf_str(cmd + cmd_size, "cstate", cache_state, cache_state_size);
#endif
  cmd_size += redirect_call_put_inout_conf_str(cmd + cmd_size, "iconf", rc->input_conf, rc->input_conf_n);
  cmd_size += redirect_call_put_inout_conf_str(cmd + cmd_size, "oconf", rc->output_conf_put, rc->output_conf_put_n);

  rc->input->next = do_input_next;
  rc->input->data = rc;
#if REDIRECT_CALL_PARAMS_NEW
  rc->params_state[0] = rc->params_state[1] = 0;
#else
  rc->input_state = 0;
#endif

  rc->input->next(rc->input, 0);

  TRACE_F("cmd: '%s'", cmd);

  if (scdc_dataset_cmd(rc->dataset, cmd, rc->input, rc->output) != SCDC_SUCCESS)
  {
    TRACE_F("failed");
    return 0;
  }

  /* extract result and output_conf_get from output */
  const char *s = scdc_last_result();
  rdint_t n = 0;
  n += redirect_call_get_inout_conf_str(s + n, "result", rc->result_str, 0);
  rc->output_conf_get_n = 0;
  n += redirect_call_get_inout_conf_str(s + n, "oconf", rc->output_conf_get, 0);

  TRACE_F("result: '%s'", rc->result_str);
  TRACE_F("output_conf_get: '%s'", rc->output_conf_get);

  rc->output_offset = 0;

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x780, %rsp            # imm = 0x780
movq %rdi, -0x10(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xba8(%rax)
je 0x11b49
movq -0x10(%rbp), %rax
movq 0xba8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x148(%rax), %rsi
movq -0x10(%rbp), %rdx
addq $0x44, %rdx
leaq -0x110(%rbp), %rcx
leaq -0x118(%rbp), %r8
callq 0x10790
jmp 0x11b4b
movq 0xc245e(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93cb5(%rip), %rsi     # 0xa5811
leaq 0x93cc2(%rip), %rdx     # 0xa5825
movb $0x0, %al
callq 0xc9a0
movq 0xc243f(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x118(%rbp), %rax
movl %eax, %edx
leaq -0x110(%rbp), %rcx
leaq 0x93cb0(%rip), %rsi     # 0xa583b
movb $0x0, %al
callq 0xc9a0
movq 0xc2417(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93d05(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq $0x0, -0x768(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x148(%rax)
jne 0x11bf0
leaq -0x760(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x44, %rdx
leaq 0x93de1(%rip), %rsi     # 0xa59ba
movb $0x0, %al
callq 0xc0f0
cltq
addq -0x768(%rbp), %rax
movq %rax, -0x768(%rbp)
leaq -0x760(%rbp), %rdi
addq -0x768(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x4, %rdx
leaq 0x93dad(%rip), %rsi     # 0xa59ba
movb $0x0, %al
callq 0xc0f0
cltq
addq -0x768(%rbp), %rax
movq %rax, -0x768(%rbp)
leaq -0x760(%rbp), %rdi
addq -0x768(%rbp), %rdi
leaq -0x110(%rbp), %rdx
movq -0x118(%rbp), %rcx
leaq 0x93c06(%rip), %rsi     # 0xa584d
callq 0x11f90
addq -0x768(%rbp), %rax
movq %rax, -0x768(%rbp)
leaq -0x760(%rbp), %rdi
addq -0x768(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x168, %rdx            # imm = 0x168
movq -0x10(%rbp), %rax
movq 0x150(%rax), %rcx
leaq 0x93bcf(%rip), %rsi     # 0xa5854
callq 0x11f90
addq -0x768(%rbp), %rax
movq %rax, -0x768(%rbp)
leaq -0x760(%rbp), %rdi
addq -0x768(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x368, %rdx            # imm = 0x368
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rcx
leaq 0x93b97(%rip), %rsi     # 0xa585a
callq 0x11f90
addq -0x768(%rbp), %rax
movq %rax, -0x768(%rbp)
movq -0x10(%rbp), %rax
movq 0xb08(%rax), %rax
leaq 0x308(%rip), %rcx       # 0x11ff0
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0xb08(%rax), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x878(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x870(%rax)
movq -0x10(%rbp), %rax
movq 0xb08(%rax), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xb08(%rcx), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq 0xc226c(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93ac3(%rip), %rsi     # 0xa5811
leaq 0x93ad0(%rip), %rdx     # 0xa5825
movb $0x0, %al
callq 0xc9a0
movq 0xc224d(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq -0x760(%rbp), %rdx
leaq 0x938c5(%rip), %rsi     # 0xa5639
movb $0x0, %al
callq 0xc9a0
movq 0xc222e(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93b1c(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq -0x10(%rbp), %rax
movq 0x148(%rax), %rdi
leaq -0x760(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0xb08(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0xb10(%rax), %rcx
movb $0x0, %al
callq 0x23d80
cmpq $0x1, %rax
je 0x11e25
jmp 0x11dca
movq 0xc21df(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93a36(%rip), %rsi     # 0xa5811
leaq 0x93a43(%rip), %rdx     # 0xa5825
movb $0x0, %al
callq 0xc9a0
movq 0xc21c0(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x96114(%rip), %rsi     # 0xa7f0e
movb $0x0, %al
callq 0xc9a0
movq 0xc21a8(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93a96(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movl $0x0, -0x4(%rbp)
jmp 0x11f84
callq 0x21ec0
movq %rax, -0x770(%rbp)
movq $0x0, -0x778(%rbp)
movq -0x770(%rbp), %rdi
addq -0x778(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x768, %rdx            # imm = 0x768
leaq 0x967ac(%rip), %rsi     # 0xa8608
xorl %eax, %eax
movl %eax, %ecx
callq 0x12490
addq -0x778(%rbp), %rax
movq %rax, -0x778(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x160(%rax)
movq -0x770(%rbp), %rdi
addq -0x778(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x568, %rdx            # imm = 0x568
leaq 0x939b8(%rip), %rsi     # 0xa585a
xorl %eax, %eax
movl %eax, %ecx
callq 0x12490
addq -0x778(%rbp), %rax
movq %rax, -0x778(%rbp)
movq 0xc20f0(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93947(%rip), %rsi     # 0xa5811
leaq 0x93954(%rip), %rdx     # 0xa5825
movb $0x0, %al
callq 0xc9a0
movq 0xc20d1(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
addq $0x768, %rdx            # imm = 0x768
leaq 0x93865(%rip), %rsi     # 0xa5759
movb $0x0, %al
callq 0xc9a0
movq 0xc20ae(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x9399c(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
jmp 0x11f15
movq 0xc2094(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x938eb(%rip), %rsi     # 0xa5811
leaq 0x938f8(%rip), %rdx     # 0xa5825
movb $0x0, %al
callq 0xc9a0
movq 0xc2075(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
addq $0x568, %rdx            # imm = 0x568
leaq 0x93910(%rip), %rsi     # 0xa5860
movb $0x0, %al
callq 0xc9a0
movq 0xc2052(%rip), %rax     # 0xd3fb0
movq (%rax), %rdi
leaq 0x93940(%rip), %rsi     # 0xa58a8
movb $0x0, %al
callq 0xc9a0
movq -0x10(%rbp), %rax
movl $0x0, 0xb04(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x780, %rsp            # imm = 0x780
popq %rbp
retq