// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/tools/gt_condenseq_blast.c
// Function: gt_condenseq_blast_create_blastdb
static inline int gt_condenseq_blast_create_blastdb(const char *dbfile,
                                                    const char *dbtype,
                                                    GtError *err) {
  int had_err = 0,
  pipe_status;
  GtStr *call = gt_str_new_cstr("makeblastdb -dbtype ");
  char *call_str;
  FILE* fpipe;
  gt_str_append_cstr(call, dbtype);
  gt_str_append_cstr(call, " -in ");
  gt_str_append_cstr(call, dbfile);

  call_str = gt_str_get(call);
  gt_log_log("create blastdb: %s", call_str);
  if ((fpipe = popen(call_str, "r")) == NULL) {
    gt_error_set(err, "Could not open pipe to call makeblastdb");
    had_err = -1;
  }
  if (!had_err) {
    char *newline = NULL;
    char line[BUFSIZ + 1];
    line[BUFSIZ] = '\0';
    while (fgets(line, (int) BUFSIZ, fpipe) != NULL) {
      if ((newline = strrchr(line, '\n')) != NULL) {
        *newline = '\0';
        newline = NULL;
      }
      gt_log_log("%.*s", BUFSIZ, line);
    }
  }
  gt_str_delete(call);
  if (!had_err) {
    pipe_status = pclose(fpipe);
    if (pipe_status != 0) {
      had_err = -1;
      if (errno == ECHILD)
        gt_error_set(err, "Error calling makeblastdb.");
#ifndef _WIN32
      else if (WEXITSTATUS(pipe_status) == 127)
        gt_error_set(err, "shell returned 127, makeblastdb not installed?");
      else
        gt_error_set(err, "makeblastdb error, returned %d",
                     WEXITSTATUS(pipe_status));
#else
      /* TODO DW check if this can be done in windows */
      else
        gt_error_set(err, "not implemented on Windows");
#endif
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x2a9deb(%rip), %rdi    # 0x34832f
callq 0x11acc9
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x11acf3
leaq 0x2a9de6(%rip), %rsi    # 0x348344
movq %r14, %rdi
callq 0x11acf3
movq %r14, %rdi
movq %r15, %rsi
callq 0x11acf3
movq %r14, %rdi
callq 0x11b0a1
movq %rax, %rbx
leaq 0x2a9dc7(%rip), %rdi    # 0x34834a
movq %rax, %rsi
xorl %eax, %eax
callq 0x103d72
leaq 0x2bc8c1(%rip), %rsi    # 0x35ae55
movq %rbx, %rdi
callq 0x17210
testq %rax, %rax
je 0x9e633
movq %rax, %r15
movq %rsp, %rdi
movb $0x0, 0x2000(%rdi)
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rdx
callq 0x17c30
testq %rax, %rax
je 0x9e60a
movq %rsp, %r12
leaq 0x339473(%rip), %r13    # 0x3d7a41
movq %r12, %rdi
movl $0xa, %esi
callq 0x17880
testq %rax, %rax
je 0x9e5e3
movb $0x0, (%rax)
movq %r13, %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rdx
xorl %eax, %eax
callq 0x103d72
movq %r12, %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r15, %rdx
callq 0x17c30
testq %rax, %rax
jne 0x9e5ce
movq %r14, %rdi
callq 0x11bdbf
movq %r15, %rdi
callq 0x17a70
testl %eax, %eax
je 0x9e64e
movl %eax, %ebx
callq 0x17060
cmpl $0xa, (%rax)
jne 0x9e652
leaq 0x2a9d54(%rip), %rsi    # 0x348385
jmp 0x9e661
leaq 0x2a9d23(%rip), %rsi    # 0x34835d
movq %rbp, %rdi
xorl %eax, %eax
callq 0xfcb67
movq %r14, %rdi
callq 0x11bdbf
jmp 0x9e67e
xorl %eax, %eax
jmp 0x9e683
movzbl %bh, %edx
cmpl $0x7f, %edx
jne 0x9e66d
leaq 0x2a9d3f(%rip), %rsi    # 0x3483a0
movq %rbp, %rdi
xorl %eax, %eax
callq 0xfcb67
jmp 0x9e67e
leaq 0x2a9d5b(%rip), %rsi    # 0x3483cf
movq %rbp, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq