// File: /workspace/github_cpp_makefile_star2_O3/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 0x4eb12(%rip), %rdi     # 0x5b048
leaq 0x4eadb(%rip), %rsi     # 0x5b018
xorl %r12d, %r12d
xorl %eax, %eax
callq 0xb080
leaq 0x4ead2(%rip), %rdi     # 0x5b020
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb740
movq %rbx, %rdi
movl $0x20, %esi
callq 0xb1e0
movq %rax, %r15
movq %rax, %rdx
subq %rbx, %rdx
leaq 0x4b0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb2a0
incq %r15
leaq 0x3b0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb4b0
movq %r14, %rdi
movl $0x2f, %esi
callq 0xb5a0
movb %r12b, (%rax)
leaq 0x1(%rax), %rbp
movq %rbx, %rdi
movl $0x2f, %esi
callq 0xb5a0
movb %r12b, (%rax)
leaq 0x1(%rax), %r13
leaq 0x4eb61(%rip), %rbx     # 0x5b134
leaq 0x6bf86(%rip), %r15     # 0x78560
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xb0d0
movq %rsp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xb0d0
leaq 0x4ea2c(%rip), %rcx     # 0x5b038
leaq 0x2b0(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xb0d0
leaq 0x4ea19(%rip), %rsi     # 0x5b041
leaq 0x5b0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xb0d0
leaq 0x4ea01(%rip), %r12     # 0x5b048
movq %r12, %rdi
leaq 0x4e9c7(%rip), %r14     # 0x5b018
movq %r14, %rsi
xorl %eax, %eax
callq 0xb080
leaq 0x4e9e9(%rip), %rdi     # 0x5b04b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb740
leaq 0x50021(%rip), %rsi     # 0x5c69e
leaq 0x258(%rsp), %rdi
leaq 0x100(%rsp), %rbp
movq %rbp, %rdx
xorl %eax, %eax
callq 0x20d4b
movq %rax, %r15
xorl %edi, %edi
movq %rbx, %rsi
xorl %edx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe3e3
movq %r15, %rdi
callq 0x20e3b
leaq 0x4e99b(%rip), %rsi     # 0x5b055
leaq 0x4e9ac(%rip), %rdx     # 0x5b06d
movq %rbx, %rdi
movq %rsp, %rcx
movq %rbp, %r8
leaq 0x2b0(%rsp), %rbp
movq %rbp, %r9
xorl %eax, %eax
callq 0xb0d0
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0xb080
leaq 0x4e98b(%rip), %rdi     # 0x5b07b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb740
movq %rbx, %rdi
callq 0xb410
leaq 0x4e975(%rip), %rsi     # 0x5b088
movq %rbx, %rdi
leaq 0x3b0(%rsp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xb0d0
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0xb080
leaq 0x4e90f(%rip), %rdi     # 0x5b04b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb080
movl $0xa, %edi
callq 0xb740
leaq 0x200(%rsp), %rdi
leaq 0x4ff3f(%rip), %rsi     # 0x5c69e
movq %rsp, %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x1ff03
movq %rax, %r14
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xe3e3
movq %r14, %rdi
callq 0x1fff3
leaq 0x100(%rsp), %rdi
callq 0xb9c0
movq %r15, %rdi
callq 0xb9c0
movq %rbp, %rdi
callq 0xb9c0
movl $0x1, %eax
addq $0x9b8, %rsp            # imm = 0x9B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq