// File: 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 %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x7b804(%rip), %rdi     # 0x89004
movb $0x0, %al
callq 0xcd00
leaq 0x7b826(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
leaq 0x7bef8(%rip), %rdi     # 0x89714
movb $0x0, %al
callq 0xddb0
leaq 0x7b80c(%rip), %rdi     # 0x89036
leaq 0x7e0df(%rip), %rsi     # 0x8b910
leaq 0xa32e8(%rip), %rdx     # 0xb0b20
movb $0x0, %al
callq 0xe2e0
movq %rax, -0x18(%rbp)
movq %rax, -0x18(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2f4b0
leaq -0xc8(%rbp), %rdi
callq 0x2f4d0
movl 0x7b7db(%rip), %eax     # 0x8903d
movl %eax, -0x104(%rbp)
movl 0x7b7d3(%rip), %eax     # 0x89041
movl %eax, -0x10a(%rbp)
movw 0x7b7ca(%rip), %ax      # 0x89045
movw %ax, -0x106(%rbp)
leaq -0x100(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $-0x2, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq $-0x2, -0x50(%rbp)
leaq -0x104(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq $0x4, 0x8(%rax)
leaq -0x104(%rbp), %rdi
callq 0xc280
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq -0x10a(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x60(%rbp), %rax
movq $0x6, 0x20(%rax)
leaq -0x10a(%rbp), %rdi
callq 0xc280
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x28(%rax)
leaq 0x7b738(%rip), %rdi     # 0x89047
movb $0x0, %al
callq 0xcd00
leaq 0x7b717(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
jmp 0xd926
leaq 0x7b73a(%rip), %rdi     # 0x89067
movb $0x0, %al
callq 0xcd00
leaq -0x70(%rbp), %rdi
callq 0x2f360
leaq 0x7b6f0(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
jmp 0xd94d
leaq 0x7b713(%rip), %rdi     # 0x89067
movb $0x0, %al
callq 0xcd00
leaq -0xc8(%rbp), %rdi
callq 0x2f390
leaq 0x7b6c6(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
xorl %eax, %eax
movl %eax, %edi
leaq 0x7b702(%rip), %rsi     # 0x89082
leaq -0x70(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
movb $0x0, %al
callq 0xfe60
leaq 0x7b71a(%rip), %rdi     # 0x890b3
movb $0x0, %al
callq 0xcd00
leaq 0x7b68d(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
jmp 0xd9b0
leaq 0x7b6b0(%rip), %rdi     # 0x89067
movb $0x0, %al
callq 0xcd00
leaq -0xc8(%rbp), %rdi
callq 0x2f390
leaq 0x7b663(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
jmp 0xd9da
movq -0xb0(%rbp), %rax
movl %eax, %esi
movq -0xb8(%rbp), %rdx
leaq 0x7b6e1(%rip), %rdi     # 0x890d2
movb $0x0, %al
callq 0xcd00
leaq 0x7b635(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
jmp 0xda08
cmpq $0x0, -0x90(%rbp)
je 0xda25
leaq -0xc8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq *-0x90(%rbp)
jmp 0xda08
movq -0x18(%rbp), %rdi
callq 0xe3b0
callq 0xdf60
leaq 0x7b6c5(%rip), %rdi     # 0x890ff
movb $0x0, %al
callq 0xcd00
leaq 0x7b5ec(%rip), %rdi     # 0x89034
movb $0x0, %al
callq 0xcd00
xorl %eax, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw (%rax,%rax)