// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/gtdatapath.c
// Function: gt_get_gtdata_path
GtStr* gt_get_gtdata_path(const char *prog, GtError *err)
{
  GtStr *path;
  const char **defaultpath, **spath;
  int had_err = 0;
  gt_error_check(err);
  gt_assert(prog);
  path = gt_str_new();
  had_err = gt_file_find_exec_in_path(path, prog, err);
  if (!had_err) {
    if (gt_file_exists_and_is_dir(gt_str_get(path))) {
      gt_str_append_cstr(path, GTDATADIR);
      if (gt_file_exists_and_is_dir(gt_str_get(path)))
        return path;
      gt_str_set_length(path, gt_str_length(path) - strlen(GTDATADIR));
      gt_str_append_cstr(path, UPDIR);
      gt_str_append_cstr(path, GTDATADIR);
      if (gt_file_exists_and_is_dir(gt_str_get(path)))
        return path;
    }
    for (spath = GTDATA_RELATIVE_SEARCH_PATHS; *spath; spath++) {
      had_err = gt_file_find_exec_in_path(path, prog, err);
      if (!had_err) {
        gt_str_append_cstr(path, *spath);
        if (gt_file_exists_and_is_dir(gt_str_get(path)))
          return path;
      }
    }
    for (defaultpath = GTDATA_DEFAULT_PATHS; *defaultpath; defaultpath++) {
      gt_str_reset(path);
      gt_str_append_cstr(path, *defaultpath);
      if (gt_file_exists_and_is_dir(gt_str_get(path)))
        return path;
    }
    if (!gt_file_exists_and_is_dir(gt_str_get(path))) {
      gt_error_set(err, "could not find gtdata%c directory", GT_PATH_SEPARATOR);
      had_err = -1;
    }
  }
  if (had_err) {
    gt_str_delete(path);
    return NULL;
  }
  return path;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
testq %rsi, %rsi
je 0xbd11e
movq %r14, %rdi
callq 0xc103
testb %al, %al
jne 0xbd2ce
testq %r15, %r15
je 0xbd2a4
callq 0x13d5c
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x54e2a
testl %eax, %eax
je 0xbd15d
movq %rbx, %rdi
callq 0x152db
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x54965
testb %al, %al
je 0xbd1de
leaq 0x35409(%rip), %rsi     # 0xf2581
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x54965
testb %al, %al
jne 0xbd14b
movq %rbx, %rdi
callq 0x14461
leaq -0x7(%rax), %rsi
movq %rbx, %rdi
callq 0x1446e
leaq 0x35397(%rip), %rsi     # 0xf2546
movq %rbx, %rdi
callq 0x13dd3
leaq 0x353c3(%rip), %rsi     # 0xf2581
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x54965
testb %al, %al
jne 0xbd14b
xorl %ebp, %ebp
leaq 0x70a99(%rip), %r13     # 0x12dc80
movq (%r13), %r12
testq %r12, %r12
je 0xbd22d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x54e2a
movl %eax, %ebp
testl %eax, %eax
jne 0xbd227
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13dd3
movq %rbx, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x54965
testb %al, %al
jne 0xbd14b
addq $0x8, %r13
jmp 0xbd1e7
leaq 0x70a5c(%rip), %r12     # 0x12dc90
movq (%r12), %r15
movq %rbx, %rdi
testq %r15, %r15
je 0xbd26d
callq 0x1452f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13dd3
movq %rbx, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x54965
addq $0x8, %r12
testb %al, %al
je 0xbd234
jmp 0xbd14b
callq 0x143d2
movq %rax, %rdi
callq 0x54965
testb %al, %al
je 0xbd28b
testl %ebp, %ebp
jne 0xbd141
jmp 0xbd14b
leaq 0x352b8(%rip), %rsi     # 0xf254a
pushq $0x2f
popq %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0xc007
jmp 0xbd141
movq 0x70d0d(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0xcdb1(%rip), %rsi      # 0xca066
leaq 0x35285(%rip), %rdx     # 0xf2541
leaq 0x35255(%rip), %rcx     # 0xf2518
leaq 0x35261(%rip), %r8      # 0xf252b
pushq $0x31
jmp 0xbd2f6
movq 0x70ce3(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0xcd87(%rip), %rsi      # 0xca066
leaq 0xd373(%rip), %rdx      # 0xca659
leaq 0x3522b(%rip), %rcx     # 0xf2518
leaq 0x35237(%rip), %r8      # 0xf252b
pushq $0x30
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300