// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x2048, %rsp           # imm = 0x2048
movq %rdi, 0x2040(%rsp)
movq %rsi, 0x2038(%rsp)
movq %rdx, 0x2030(%rsp)
movl $0x0, 0x202c(%rsp)
leaq 0x4f44f1(%rip), %rdi    # 0x5193a2
callq 0x11d510
movq %rax, 0x2020(%rsp)
movq 0x2020(%rsp), %rdi
movq 0x2038(%rsp), %rsi
callq 0x11d550
movq 0x2020(%rsp), %rdi
leaq 0x4f44d5(%rip), %rsi    # 0x5193b7
callq 0x11d550
movq 0x2020(%rsp), %rdi
movq 0x2040(%rsp), %rsi
callq 0x11d550
movq 0x2020(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x2018(%rsp)
movq 0x2018(%rsp), %rsi
leaq 0x4f449d(%rip), %rdi    # 0x5193bd
movb $0x0, %al
callq 0xe7740
movq 0x2018(%rsp), %rdi
leaq 0x5070a4(%rip), %rsi    # 0x52bfda
callq 0x191d0
movq %rax, 0x2010(%rsp)
cmpq $0x0, %rax
jne 0x24f6a
movq 0x2030(%rsp), %rdi
leaq 0x4f4478(%rip), %rsi    # 0x5193d0
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x202c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x202c(%rsp)
jne 0x24fef
movq $0x0, 0x2008(%rsp)
movb $0x0, 0x2000(%rsp)
movq %rsp, %rdi
movq 0x2010(%rsp), %rdx
movl $0x2000, %esi           # imm = 0x2000
callq 0x19b60
cmpq $0x0, %rax
je 0x24fed
movq %rsp, %rdi
movl $0xa, %esi
callq 0x197d0
movq %rax, 0x2008(%rsp)
cmpq $0x0, %rax
je 0x24fd5
movq 0x2008(%rsp), %rax
movb $0x0, (%rax)
movq $0x0, 0x2008(%rsp)
movq %rsp, %rdx
leaq 0x587efc(%rip), %rdi    # 0x5acedb
movl $0x2000, %esi           # imm = 0x2000
movb $0x0, %al
callq 0xe7740
jmp 0x24f88
jmp 0x24fef
movq 0x2020(%rsp), %rdi
callq 0x11f560
cmpl $0x0, 0x202c(%rsp)
jne 0x250b1
movq 0x2010(%rsp), %rdi
callq 0x199b0
movl %eax, 0x2028(%rsp)
cmpl $0x0, 0x2028(%rsp)
je 0x250af
movl $0xffffffff, 0x202c(%rsp) # imm = 0xFFFFFFFF
callq 0x19060
cmpl $0xa, (%rax)
jne 0x25059
movq 0x2030(%rsp), %rdi
leaq 0x4f43a8(%rip), %rsi    # 0x5193f8
movb $0x0, %al
callq 0xd88c0
jmp 0x250ad
movl 0x2028(%rsp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x7f, %eax
jne 0x25085
movq 0x2030(%rsp), %rdi
leaq 0x4f4397(%rip), %rsi    # 0x519413
movb $0x0, %al
callq 0xd88c0
jmp 0x250ab
movq 0x2030(%rsp), %rdi
movl 0x2028(%rsp), %edx
andl $0xff00, %edx           # imm = 0xFF00
sarl $0x8, %edx
leaq 0x4f439e(%rip), %rsi    # 0x519442
movb $0x0, %al
callq 0xd88c0
jmp 0x250ad
jmp 0x250af
jmp 0x250b1
movl 0x202c(%rsp), %eax
addq $0x2048, %rsp           # imm = 0x2048
retq