// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/demos/convert/compC.c
// Function: compC_hook_dataset_cmd
static scdcint_t compC_hook_dataset_cmd(void *dataprov, void *dataset, const char *cmd, const char *params, scdc_dataset_input_t *input, scdc_dataset_output_t *output, scdc_result_t *result)
{
  TRACE_F("cmd: '%s', params: '%s'", cmd, params);

  char s[1024], uri_in[256], uri_out[256];

  char *c = strchr(params, ' ');
  strncpy(uri_in, params, c - params);
  strcpy(uri_out, c + 1);

  const char *file_in, *file_out;
  c = strrchr(uri_in, '/'); *c = '\0'; file_in = c + 1;
  c = strrchr(uri_out, '/'); *c = '\0'; file_out = c + 1;

  char temp_in[256], temp_out[256], temp_log[256];
  make_temp_file(temp_in, file_in);
  make_temp_file(temp_out, file_out);
  make_temp_file(temp_log, "gmsh.log");

  scdc_dataset_output_t _outp, *outp = &_outp;
  scdc_dataset_input_t _inp, *inp = &_inp;

  /* step C1: get from compS */
  sprintf(s, "%s get %s", uri_in, file_in);
  TRACE_F("cmd: '%s'", s);
  outp = scdc_dataset_output_create(outp, "file", temp_in);
  scdc_dataset_cmd(SCDC_DATASET_NULL, s, NULL, outp);
  scdc_dataset_output_destroy(outp);

  /* step C2: convert with gmsh */
  sprintf(s, "%s -0 -o %s %s >%s 2>&1", GMSH, temp_out, temp_in, temp_log);
  TRACE_F("system: '%s'", s);
  system(s);

  /* step C3: put to compS */
  sprintf(s, "%s put %s", uri_out, file_out);
  TRACE_F("cmd: '%s'", s);
  inp = scdc_dataset_input_create(inp, "file", temp_out);
  scdc_dataset_cmd(SCDC_DATASET_NULL, s, inp, NULL);
  scdc_dataset_input_destroy(inp);

  remove(temp_in);
  remove(temp_out);
  remove(temp_log);

  return SCDC_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9b8, %rsp            # imm = 0x9B8
movq %rcx, %rbx
movq %rdx, %r14
leaq 0x37d86(%rip), %rdi     # 0x44048
leaq 0x37d4f(%rip), %rsi     # 0x44018
xorl %r15d, %r15d
xorl %eax, %eax
callq 0xb070
leaq 0x37d46(%rip), %rdi     # 0x44020
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rdi
callq 0xb770
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0xb1e0
movq %rax, %r14
movq %rax, %rdx
subq %rbx, %rdx
leaq 0x4b0(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb2c0
incq %r14
leaq 0x3b0(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xb4f0
pushq $0x2f
popq %rbx
movq %r13, %rdi
movl %ebx, %esi
callq 0xb5e0
movb %r15b, (%rax)
leaq 0x1(%rax), %rbp
movq %r12, %rdi
movl %ebx, %esi
callq 0xb5e0
movb %r15b, (%rax)
leaq 0x1(%rax), %r14
leaq 0x100(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0xc518
leaq 0x2b0(%rsp), %rdi
movq %r14, %rsi
callq 0xc518
leaq 0x37cbd(%rip), %rsi     # 0x44038
movq %rsp, %rdi
callq 0xc518
leaq 0x37cb7(%rip), %rsi     # 0x44041
leaq 0x5b0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xb0c0
leaq 0x37c9f(%rip), %rdi     # 0x44048
leaq 0x37c68(%rip), %r13     # 0x44018
movq %r13, %rsi
xorl %eax, %eax
callq 0xb070
leaq 0x37c8a(%rip), %rdi     # 0x4404b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %r15
movl %r15d, %edi
callq 0xb770
leaq 0x39270(%rip), %rsi     # 0x4564e
leaq 0x258(%rsp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1b6d0
movq %rax, %rbp
xorl %edi, %edi
movq %rbx, %rsi
xorl %edx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xdb80
movq %rbp, %rdi
callq 0x1b78e
leaq 0x37c42(%rip), %rsi     # 0x44055
leaq 0x37c53(%rip), %rdx     # 0x4406d
movq %rbx, %rdi
leaq 0x2b0(%rsp), %r12
movq %r12, %rcx
leaq 0x100(%rsp), %r8
movq %rsp, %r9
xorl %eax, %eax
callq 0xb0c0
leaq 0x37c07(%rip), %rbp     # 0x44048
movq %rbp, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xb070
leaq 0x37c26(%rip), %rdi     # 0x4407b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb070
movl %r15d, %edi
callq 0xb770
movq %rbx, %rdi
callq 0xb440
leaq 0x37c12(%rip), %rsi     # 0x44088
movq %rbx, %rdi
leaq 0x3b0(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xb0c0
movq %rbp, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xb070
leaq 0x37bac(%rip), %rdi     # 0x4404b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb070
movl %r15d, %edi
callq 0xb770
leaq 0x200(%rsp), %rdi
leaq 0x3918e(%rip), %rsi     # 0x4564e
movq %r12, %rdx
xorl %eax, %eax
callq 0x1ab5a
movq %rax, %r14
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xdb80
movq %r14, %rdi
callq 0x1ac5e
leaq 0x100(%rsp), %rdi
callq 0xb9a0
movq %r12, %rdi
callq 0xb9a0
movq %rsp, %rdi
callq 0xb9a0
pushq $0x1
popq %rax
addq $0x9b8, %rsp            # imm = 0x9B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq