// File: mh0fm4[P]SCDC/test/units/dataprov_access/test_access.c
// Function: test_access
int test_access(const char *uri)
{
  char cmd[512];
  scdc_dataset_t ds;
  scdc_dataset_input_t _ip, *ip = &_ip;
  scdc_dataset_output_t _op, *op = &_op;

#if 1
  printf("TEST command 'cd'\n");
  sprintf(cmd, "%s/foo", uri);
  ds = scdc_dataset_open(uri);
  printf("open: '%s', result: '%s'\n", uri, scdc_last_result());

  sprintf(cmd, "cd bar");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "pwd");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "cd /bar");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "pwd");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "cd");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "pwd");
  scdc_dataset_cmd(ds, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  scdc_dataset_close(ds);
  printf("close: '%s', result: '%s'\n", uri, scdc_last_result());
#endif

#if 1
  printf("TEST command 'ls'\n");
  sprintf(cmd, "%s ls", uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());
#endif

#if 1
  printf("TEST command 'info'\n");
  sprintf(cmd, "%s/foo info", uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "%s/foo info bar", uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());
#endif

#if 1
  printf("TEST command 'mkd'\n");
  sprintf(cmd, "%s mkd foo", uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

  sprintf(cmd, "%s rm foo", uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());
#endif

#if 1
  printf("TEST command 'put'\n");
  /* create input object to read from file */
  ip = scdc_dataset_input_create(ip, "file", INPUT_FILE);
  if (ip != NULL)
  {
    /* store data from input object */
    sprintf(cmd, "%s put " TARGET, uri);
    scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, ip, NULL);
    printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());

    /* destroy input object */
    scdc_dataset_input_destroy(ip);

  } else printf("ERROR: open input file failed!\n");
#endif

#if 1
  printf("TEST command 'get'\n");
  /* create output object to write to file */
  op = scdc_dataset_output_create(op, "file", OUTPUT_FILE);
  if (op != NULL)
  {
    /* retrieve data from dataset to output object */
    sprintf(cmd, "%s get " TARGET, uri);
    scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, op);
    printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());
    
    /* destroy output object */
    scdc_dataset_output_destroy(op);

  } else printf("ERROR: open output file failed!\n");
#endif

#if 1
  /* remove the data stored */
  sprintf(cmd, "%s rm " TARGET, uri);
  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, op);
  printf("cmd: '%s', result: '%s'\n", cmd, scdc_last_result());
#endif

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x8(%rbp)
leaq -0x270(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq -0x2d0(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq 0x7c7f2(%rip), %rdi     # 0x8a004
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c7ec(%rip), %rsi     # 0x8a017
movb $0x0, %al
callq 0xc0f0
movq -0x8(%rbp), %rdi
movb $0x0, %al
callq 0xf1d0
movq %rax, -0x218(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x340(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x340(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c7b7(%rip), %rdi     # 0x8a01e
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7c7bc(%rip), %rsi     # 0x8a038
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x338(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x338(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c77a(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7c77e(%rip), %rsi     # 0x8a058
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x330(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x330(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c71c(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7c724(%rip), %rsi     # 0x8a05c
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x328(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x328(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c6be(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7c6c2(%rip), %rsi     # 0x8a058
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x320(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x320(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c660(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7d383(%rip), %rsi     # 0x8ad77
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x318(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x318(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c602(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
leaq 0x7c606(%rip), %rsi     # 0x8a058
movb $0x0, %al
callq 0xc0f0
movq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x310(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x310(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c5a4(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
movq -0x218(%rbp), %rdi
callq 0xf2a0
movq -0x8(%rbp), %rax
movq %rax, -0x308(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x308(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c593(%rip), %rdi     # 0x8a064
movb $0x0, %al
callq 0xcd00
leaq 0x7c5a0(%rip), %rdi     # 0x8a07f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c59a(%rip), %rsi     # 0x8a092
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x300(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x300(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c502(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq 0x7c54d(%rip), %rdi     # 0x8a098
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c549(%rip), %rsi     # 0x8a0ad
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x2f8(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x2f8(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c496(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c4f7(%rip), %rsi     # 0x8a0b9
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x2f0(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c438(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq 0x7c4b4(%rip), %rdi     # 0x8a0c9
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c4af(%rip), %rsi     # 0x8a0dd
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x2e8(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c3cc(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c45c(%rip), %rsi     # 0x8a0e8
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movq %rcx, %rdx
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x2e0(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c36e(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
leaq 0x7c413(%rip), %rdi     # 0x8a0f2
movb $0x0, %al
callq 0xcd00
movq -0x278(%rbp), %rdi
leaq 0x7da17(%rip), %rsi     # 0x8b70b
leaq 0x7c40b(%rip), %rdx     # 0x8a106
movb $0x0, %al
callq 0x317a0
movq %rax, -0x278(%rbp)
cmpq $0x0, -0x278(%rbp)
je 0xdd83
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c3f0(%rip), %rsi     # 0x8a115
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
movq -0x278(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdi
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x348(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x348(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c2d1(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
movq -0x278(%rbp), %rdi
callq 0x31920
jmp 0xdd91
leaq 0x7c39e(%rip), %rdi     # 0x8a128
movb $0x0, %al
callq 0xcd00
leaq 0x7c3b0(%rip), %rdi     # 0x8a148
movb $0x0, %al
callq 0xcd00
movq -0x2d8(%rbp), %rdi
leaq 0x7d95e(%rip), %rsi     # 0x8b70b
leaq 0x7c3a8(%rip), %rdx     # 0x8a15c
movb $0x0, %al
callq 0x32dd0
movq %rax, -0x2d8(%rbp)
cmpq $0x0, -0x2d8(%rbp)
je 0xde3c
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c38e(%rip), %rsi     # 0x8a16c
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
movq -0x2d8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rdi
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x350(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x350(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c218(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
movq -0x2d8(%rbp), %rdi
callq 0x32ea0
jmp 0xde4a
leaq 0x7c33c(%rip), %rdi     # 0x8a17f
movb $0x0, %al
callq 0xcd00
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x7c344(%rip), %rsi     # 0x8a1a0
movb $0x0, %al
callq 0xc0f0
leaq -0x210(%rbp), %rsi
movq -0x2d8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rdi
movb $0x0, %al
callq 0x10060
leaq -0x210(%rbp), %rax
movq %rax, -0x358(%rbp)
movb $0x0, %al
callq 0xe1a0
movq -0x358(%rbp), %rsi
movq %rax, %rdx
leaq 0x7c19a(%rip), %rdi     # 0x8a03f
movb $0x0, %al
callq 0xcd00
movl $0x1, %eax
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
nopw (%rax,%rax)