// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/test/demos/multi/multi_cli.c
// Function: main
int main(int argc, char *argv[])
{
  MULTI_TRACE("start multi demo client");

  scdc_init(SCDC_INIT_DEFAULT);

  scdc_dataprov_t dp_hook = dp_hook = scdc_dataprov_open(MULTI_BASE, "hook", &multidemo_hook);

  scdc_dataset_input_t input;
  scdc_dataset_output_t output;

  scdc_dataset_input_unset(&input);
  scdc_dataset_output_unset(&output);

#if SCDC_DATASET_INOUT_BUF_MULTIPLE
  char input_buf_m[2 * sizeof(scdc_buf_t)];
  char input_buf_0[] = "aaa";
  char input_buf_1[] = "zzzzz";

  SCDC_DATASET_INOUT_MBUF_INIT(&input, input_buf_m, sizeof(input_buf_m));
  SCDC_DATASET_INOUT_MBUF_SET_C(&input, 2);
  SCDC_DATASET_INOUT_MBUF_M_SET(&input, 0, input_buf_0, sizeof(input_buf_0), strlen(input_buf_0));
  SCDC_DATASET_INOUT_MBUF_M_SET(&input, 1, input_buf_1, sizeof(input_buf_1), strlen(input_buf_1));
#endif
/*
  char format[SCDC_FORMAT_MAX_SIZE];
  scdcint_t buf_size;
  void *buf;
  scdcint_t total_size, current_size;
  char total_size_given;
  scdc_dataset_inout_next_f *next;
  void *data;
*/

  MULTI_TRACE("before:");
  MULTI_TRACE_N("  "); scdc_dataset_input_print(&input); MULTI_TRACE_NL("");
  MULTI_TRACE_N("  "); scdc_dataset_output_print(&output); MULTI_TRACE_NL("");

  scdc_dataset_cmd(SCDC_DATASET_NULL,
#if 0
    "scdc:/"
#else
    "scdc+uds://multi/"
#endif
    MULTI_BASE " CMD PARAM1 PARAM2 PARAM3", &input, &output);

  MULTI_TRACE("after:");
  MULTI_TRACE_N("  "); scdc_dataset_output_print(&output); MULTI_TRACE_NL("");
  MULTI_TRACE("  output buf: '%.*s'", (int) SCDC_DATASET_INOUT_BUF_SIZE(&output), (char *) SCDC_DATASET_INOUT_BUF_PTR(&output));

  while (output.next) output.next(&output, 0);

  scdc_dataprov_close(dp_hook);

  scdc_release();

  MULTI_TRACE("quit multi demo client");

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
leaq 0x4ebc1(%rip), %rdi     # 0x5b004
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb730
leaq 0x50232(%rip), %rdi     # 0x5c68d
xorl %eax, %eax
callq 0xc845
leaq 0x4ebcb(%rip), %rdi     # 0x5b034
leaq 0x51510(%rip), %rsi     # 0x5d980
leaq 0x69781(%rip), %rdx     # 0x75bf8
xorl %eax, %eax
callq 0xcbff
movq %rax, %rbx
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
callq 0x1e5b6
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x1e5d6
leaq 0xc(%rsp), %rdi
movl $0x616161, (%rdi)       # imm = 0x616161
leaq 0x10(%rsp), %r12
movw $0x7a, 0x4(%r12)
movl $0x7a7a7a7a, (%r12)     # imm = 0x7A7A7A7A
leaq 0x70(%rsp), %r13
movq %r13, 0x10(%r15)
movq $-0x2, %rax
movq %rax, 0x18(%r15)
movq %rax, 0x20(%r15)
movq %rdi, (%r13)
movq $0x4, 0x8(%r13)
callq 0xb200
movq %rax, 0x10(%r13)
movq %r12, 0x18(%r13)
movq $0x6, 0x20(%r13)
movq %r12, %rdi
callq 0xb200
movq %rax, 0x28(%r13)
leaq 0x4eb37(%rip), %rdi     # 0x5b041
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb730
leaq 0x4eb3f(%rip), %r12     # 0x5b061
movq %r12, %rdi
xorl %eax, %eax
callq 0xb080
movq %r15, %rdi
callq 0x1e316
movl $0xa, %edi
callq 0xb730
movq %r12, %rdi
xorl %eax, %eax
callq 0xb080
movq %r14, %rdi
callq 0x1e43c
movl $0xa, %edi
callq 0xb730
leaq 0x4eb1b(%rip), %rsi     # 0x5b07c
xorl %edi, %edi
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe26b
leaq 0x4eb36(%rip), %rdi     # 0x5b0ad
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb730
movq %r12, %rdi
xorl %eax, %eax
callq 0xb080
movq %r14, %rdi
callq 0x1e43c
movl $0xa, %edi
callq 0xb730
movl 0x18(%r14), %esi
movq 0x10(%r14), %rdx
leaq 0x4eb19(%rip), %rdi     # 0x5b0cc
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb730
movq 0x38(%r14), %rax
testq %rax, %rax
je 0xc5e3
leaq 0x18(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq *%rax
movq 0x50(%rsp), %rax
testq %rax, %rax
jne 0xc5d2
movq %rbx, %rdi
callq 0xccfa
callq 0xc946
leaq 0x4eb02(%rip), %rdi     # 0x5b0f9
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb730
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop