// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/file.c
// Function: gt_file_open
GtFile* gt_file_open(GtFileMode file_mode, const char *path, const char *mode,
                     GtError *err)
{
  GtFile *file;
  gt_error_check(err);
  gt_assert(mode);
  file = gt_calloc(1, sizeof (GtFile));
  file->mode = file_mode;
  file->reference_count = 0;
  if (path) {
    switch (file_mode) {
      case GT_FILE_MODE_UNCOMPRESSED:
        file->fileptr.file = gt_fa_fopen(path, mode, err);
        if (!file->fileptr.file) {
          gt_file_delete_without_handle(file);
          return NULL;
        }
        break;
      case GT_FILE_MODE_GZIP:
        file->fileptr.gzfile = gt_fa_gzopen(path, mode, err);
        if (!file->fileptr.gzfile) {
          gt_file_delete_without_handle(file);
          return NULL;
        }
        break;
      case GT_FILE_MODE_BZIP2:
        file->fileptr.bzfile = gt_fa_bzopen(path, mode, err);
        if (!file->fileptr.bzfile) {
          gt_file_delete_without_handle(file);
          return NULL;
        }
        file->orig_path = gt_cstr_dup(path);
        file->orig_mode = gt_cstr_dup(path);
        break;
      default: gt_assert(0);
    }
  }
  else {
    gt_assert(file_mode == GT_FILE_MODE_UNCOMPRESSED);
    file->fileptr.file = stdin;
    file->is_stdin = true;
  }
  return file;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movl %edi, %ebp
testq %rcx, %rcx
je 0x53d76
movq %r15, %rdi
callq 0xc103
testb %al, %al
jne 0x53e89
testq %r12, %r12
je 0x53e5f
leaq 0x8612d(%rip), %rdx     # 0xd9eb3
pushq $0x1
popq %rdi
pushq $0x30
popq %rsi
pushq $0x6b
popq %rcx
callq 0xce9a
movq %rax, %rbx
movl %ebp, (%rax)
andq $0x0, 0x8(%rax)
testq %r14, %r14
je 0x53dcf
cmpl $0x2, %ebp
je 0x53e0e
cmpl $0x1, %ebp
je 0x53deb
testl %ebp, %ebp
jne 0x53eed
leaq 0x860f7(%rip), %rdx     # 0xd9eb3
pushq $0x71
popq %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %r8
callq 0x5183a
jmp 0x53e03
testl %ebp, %ebp
jne 0x53ebf
movq 0xda1a2(%rip), %rax     # 0x12df80
movq (%rax), %rax
movq %rax, 0x10(%rbx)
movb $0x1, 0x29(%rbx)
jmp 0x53e53
leaq 0x860c1(%rip), %rdx     # 0xd9eb3
pushq $0x78
popq %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %r8
callq 0x51e5b
movq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x53e53
jmp 0x53e49
leaq 0x8609e(%rip), %rdx     # 0xd9eb3
pushq $0x7f
popq %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %r8
callq 0x52094
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x53e49
movq %r14, %rdi
callq 0x4f8ae
movq %rax, 0x18(%rbx)
movq %r14, %rdi
callq 0x4f8ae
movq %rax, 0x20(%rbx)
jmp 0x53e53
movq %rbx, %rdi
callq 0x53f28
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xda152(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x761f6(%rip), %rsi     # 0xca066
leaq 0x859e5(%rip), %rdx     # 0xd985c
leaq 0x86069(%rip), %rcx     # 0xd9ee7
leaq 0x8602e(%rip), %r8      # 0xd9eb3
pushq $0x6a
jmp 0x53eb1
movq 0xda128(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x761cc(%rip), %rsi     # 0xca066
leaq 0x767b8(%rip), %rdx     # 0xca659
leaq 0x8603f(%rip), %rcx     # 0xd9ee7
leaq 0x86004(%rip), %r8      # 0xd9eb3
pushq $0x69
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0xda0f2(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x76196(%rip), %rsi     # 0xca066
leaq 0x8601d(%rip), %rdx     # 0xd9ef4
leaq 0x86009(%rip), %rcx     # 0xd9ee7
leaq 0x85fce(%rip), %r8      # 0xd9eb3
movl $0x8b, %r9d
jmp 0x53eb3
movq 0xda0c4(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x76168(%rip), %rsi     # 0xca066
leaq 0x8773c(%rip), %rdx     # 0xdb641
leaq 0x85fdb(%rip), %rcx     # 0xd9ee7
leaq 0x85fa0(%rip), %r8      # 0xd9eb3
movl $0x87, %r9d
jmp 0x53eb3