// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/test/units/dataprov_hook/hook_cli.c
// Function: main
int main(int argc, char *argv[])
{
  scdc_dataprov_t dp_hook = SCDC_DATAPROV_NULL;

  scdc_dataset_t dataset = SCDC_DATASET_NULL;

#define OPTARG_MAX  256
  char scheme[OPTARG_MAX] = { '\0' }, authority[OPTARG_MAX] = { '\0' }, open[OPTARG_MAX] = { '\0' }, cmdline[OPTARG_MAX] = { '\0' };


  printf(PREFIX "start hook demo client\n");

#if 0
  strcpy(scheme, "scdc");
  strcpy(authority, "");
#elif 1
  strcpy(scheme, "scdc+uds");
  strcpy(authority, "");
#elif 1
  strcpy(scheme, "scdc+tcp");
  strcpy(authority, "localhost");
#endif
  strcpy(open, "hookdemo/");
  strcpy(cmdline, "ls");

  scdc_init(SCDC_INIT_DEFAULT);

  dp_hook = scdc_dataprov_open("hookdemo", "hook:id", &hook, 0x2501);

  if (strlen(scheme) > 0 || strlen(authority) > 0 || strlen(open) > 0)
  {
    char uri[1024];

    sprintf(uri, "%s://%s/%s", scheme, authority, open);

    printf(PREFIX "uri: '%s'\n", uri);

    dataset = scdc_dataset_open(uri);
  }

  printf(PREFIX "dataset: %p\n", dataset);

  do_dataset_cmd(dataset, cmdline);

  scdc_dataset_close(dataset);

  scdc_dataprov_close(dp_hook);

  scdc_release();

  printf(PREFIX "quit hook demo client\n");

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
leaq 0x300(%rsp), %r14
xorl %ebx, %ebx
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0xb2d0
leaq 0x100(%rsp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0xb2d0
movq %rsp, %r12
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0xb2d0
leaq 0x200(%rsp), %r13
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0xb2d0
leaq 0x4fa57(%rip), %rdi     # 0x5c124
callq 0xb840
movabsq $0x7364752b63646373, %rax # imm = 0x7364752B63646373
movq %rax, (%r14)
movb %bl, 0x8(%r14)
movb %bl, (%r15)
movabsq $0x6f6d65646b6f6f68, %rax # imm = 0x6F6D65646B6F6F68
movq %rax, (%r12)
movw $0x2f, 0x8(%r12)
movb %bl, 0x2(%r13)
movw $0x736c, (%r13)         # imm = 0x736C
leaq 0x5131f(%rip), %rdi     # 0x5da2d
xorl %eax, %eax
callq 0xcf01
leaq 0x4f9c0(%rip), %rdi     # 0x5c0dc
leaq 0x4f9c2(%rip), %rsi     # 0x5c0e5
leaq 0x6a43e(%rip), %rdx     # 0x76b68
movl $0x2501, %ecx           # imm = 0x2501
xorl %eax, %eax
callq 0xd2c3
movq %rax, %r15
cmpb %bl, (%r14)
jne 0xc74e
cmpb $0x0, 0x100(%rsp)
jne 0xc74e
cmpb $0x0, (%rsp)
je 0xc798
leaq 0x4f998(%rip), %rsi     # 0x5c0ed
leaq 0x400(%rsp), %rbx
leaq 0x300(%rsp), %rdx
leaq 0x100(%rsp), %rcx
movq %rsp, %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xb0d0
leaq 0x4f977(%rip), %rdi     # 0x5c0f8
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdd46
movq %rax, %rbx
leaq 0x4f96e(%rip), %rdi     # 0x5c10d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
leaq 0x200(%rsp), %rsi
movq %rbx, %rdi
callq 0xc509
movq %rbx, %rdi
callq 0xde38
movq %r15, %rdi
callq 0xd3be
callq 0xd006
leaq 0x4f970(%rip), %rdi     # 0x5c145
callq 0xb840
xorl %eax, %eax
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nopl (%rax)