// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/test/units/dataprov_hook/hook_cli.c
// Function: do_dataset_cmd
void do_dataset_cmd(scdc_dataset_t dataset, const char *cmd)
{
  scdc_dataset_input_t input, output;
  int i;

#define DEFAULT_INPUT_BUF_SIZE   256
#define DEFAULT_OUTPUT_BUF_SIZE  256

  char input_buf[DEFAULT_INPUT_BUF_SIZE], output_buf[DEFAULT_OUTPUT_BUF_SIZE];


  /* prepare command input */
  scdc_dataset_input_unset(&input);

  strcpy(input.format, "data");

  SCDC_DATASET_INOUT_BUF_PTR(&input) = input_buf;
  SCDC_DATASET_INOUT_BUF_SIZE(&input) = DEFAULT_INPUT_BUF_SIZE;
  SCDC_DATASET_INOUT_BUF_CURRENT(&input) = 0;
  input.total_size = 0;
  input.total_size_given = SCDC_DATASET_INOUT_TOTAL_SIZE_GIVEN_AT_LEAST;

  input.next = input_next;
  input.data = (void *) 0;

  input.next(&input, 0);

  /* prepare command output */
  scdc_dataset_output_unset(&output);

  SCDC_DATASET_INOUT_BUF_PTR(&output) = output_buf;
  SCDC_DATASET_INOUT_BUF_SIZE(&output) = DEFAULT_OUTPUT_BUF_SIZE;

  output.next = 0;
  output.data = (void *) 0;

  scdcint_t ret = scdc_dataset_cmd(dataset, cmd, &input, &output);

  /* process output */
  i = 0;
  do {
    void *data = output.data;
    output.data = (void *) (intptr_t) i;

    output_next(&output, 0);

    i = (intptr_t) output.data;
    output.data = data;

    if (!output.next) break;

#if 0
    printf(PREFIX "Press <Enter>");
    getchar();
#endif

    output.next(&output, 0);

  } while (1);

  printf(PREFIX "command '%s' %s!\n", cmd, ((ret == SCDC_SUCCESS)?"success":"failed"));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x1ec5a
xorl %r13d, %r13d
movb %r13b, 0x4(%r15)
movl $0x61746164, (%r15)     # imm = 0x61746164
leaq 0x1b0(%rsp), %rax
movq %rax, 0x10(%r15)
movl $0x100, %ebp            # imm = 0x100
movq %rbp, 0x18(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movb $0x6c, 0x30(%r15)
leaq -0x118(%rip), %rax      # 0xc44c
movq %rax, 0x38(%r15)
movq %r13, 0x40(%r15)
leaq 0x4faad(%rip), %rdi     # 0x5c020
xorl %esi, %esi
xorl %eax, %eax
callq 0xb080
movq 0x10(%r15), %rax
movb %r13b, (%rax)
movq %r13, 0x20(%r15)
movq $0x1, 0x40(%r15)
movq %rsp, %r12
movq %r12, %rdi
callq 0x1ec7a
leaq 0xb0(%rsp), %rax
movq %rax, 0x10(%r12)
movq %rbp, 0x18(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r12)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe90f
movq %rax, %r14
movq 0x40(%r12), %r15
movq %r13, 0x40(%r12)
movq %r12, %rdi
callq 0xc498
movq 0x38(%r12), %rax
movq 0x40(%r12), %r13
movq %r15, 0x40(%r12)
testq %rax, %rax
je 0xc624
movq %rsp, %r15
movq %r15, %rdi
xorl %esi, %esi
callq *%rax
movq 0x40(%rsp), %r12
movslq %r13d, %rax
movq %rax, 0x40(%rsp)
movq %r15, %rdi
callq 0xc498
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %r13
movq %r12, 0x40(%rsp)
testq %rax, %rax
jne 0xc5f4
cmpq $0x1, %r14
leaq 0x4fa92(%rip), %rax     # 0x5c0c1
leaq 0x51ccc(%rip), %rdx     # 0x5e302
cmoveq %rax, %rdx
leaq 0x4fa64(%rip), %rdi     # 0x5c0a5
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq