// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/chainofin.c
// Function: gt_chain_analyzeopenformatfile
GtChain2Dimmatchtable *gt_chain_analyzeopenformatfile(double weightfactor,
                                                  const char *matchfile,
                                                  GtError *err)
{
  GtChain2Dimmatchtable *matchtable;
  GtUword linenum;
  GtWord storeinteger[GT_CHAININPUT_READNUMS];
  FILE *matchfp;
  bool haserr = false;
  GtChain2Dimmatchvalues fragment;

  if (numberoflinesinfile(&linenum,matchfile,err) != 0)
  {
    return NULL;
  }
  matchfp = gt_fa_fopen(matchfile,"r",err);
  if (matchfp == NULL)
  {
    return NULL;
  }
  matchtable = gt_chain_matchtable_new(linenum);
  for (linenum = 0; fscanf(matchfp,""GT_WD" "GT_WD" "GT_WD" "GT_WD" "GT_WD"\n",
                           &storeinteger[0],
                           &storeinteger[1],
                           &storeinteger[2],
                           &storeinteger[3],
                           &storeinteger[4]) == GT_CHAININPUT_READNUMS;
                    linenum++)
  {
    GtUword countcolumns;

    for (countcolumns = 0; countcolumns < (GtUword) (GT_CHAININPUT_READNUMS-1);
         countcolumns++)
    {
      if (storeinteger[countcolumns] < 0)
      {
        CANNOTPARSELINE("non-negative integer expected");
        haserr = true;
      }
    }
    if (storeinteger[0] > storeinteger[1])
    {
      CANNOTPARSELINE("startpos1 <= endpos1 expected");
      haserr = true;
      break;
    }
    if (storeinteger[2] > storeinteger[3])
    {
      CANNOTPARSELINE("startpos2 <= endpos2 expected");
      haserr = true;
      break;
    }
    fragment.startpos[0] = (GtChain2Dimpostype) storeinteger[0];
    fragment.endpos[0] = (GtChain2Dimpostype) storeinteger[1];
    fragment.startpos[1] = (GtChain2Dimpostype) storeinteger[2];
    fragment.endpos[1] = (GtChain2Dimpostype) storeinteger[3];
    fragment.weight
      = (GtChain2Dimscoretype) (weightfactor * (double) storeinteger[4]);
    gt_chain_matchtable_add(matchtable,&fragment);
    /*gt_chain_printchainelem(stdout,&fragment); */
  }
  gt_fa_fclose(matchfp);
  if (haserr)
  {
    gt_chain_matchtable_delete(matchtable);
    return NULL;
  }
  gt_chain_fillthegapvalues(matchtable);
  return matchtable;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movsd %xmm0, 0x38(%rsp)
leaq 0x1c2f0b(%rip), %rsi    # 0x2fae2d
leaq 0x20748e(%rip), %rdx    # 0x33f3b7
pushq $0x26
popq %rcx
movq %rdi, 0x8(%rsp)
movq %r14, %r8
callq 0x8a156
testq %rax, %rax
je 0x1380cb
movq %rax, %r12
xorl %r15d, %r15d
movq %r12, %rdi
callq 0x171d0
cmpl $-0x1, %eax
je 0x137f5f
cmpl $0xa, %eax
jne 0x137f48
incq %r15
jmp 0x137f48
movq %r12, %rdi
callq 0x8a4fd
leaq 0x1c2ebf(%rip), %rsi    # 0x2fae2d
leaq 0x207442(%rip), %rdx    # 0x33f3b7
pushq $0x46
popq %rcx
movq 0x8(%rsp), %rdi
movq %r14, %r8
callq 0x8a156
testq %rax, %rax
je 0x1380cb
movq %rax, %r12
movq %r15, %rdi
callq 0x136044
movq %rax, %r15
xorl %ebx, %ebx
xorl %ebp, %ebp
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
leaq 0x20741a(%rip), %rsi    # 0x33f3cd
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x28(%rsp), %r9
xorl %eax, %eax
callq 0x17e10
cmpl $0x5, %eax
jne 0x138077
incq %rbp
xorl %r13d, %r13d
movq %r13, %rax
cmpq $0x4, %rax
je 0x13801c
leaq 0x1(%rax), %r13
cmpq $0x0, 0x10(%rsp,%rax,8)
movq %r13, %rax
jns 0x137fe0
movq %r14, %rdi
leaq 0x2073e3(%rip), %rsi    # 0x33f3e2
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movq %r13, %r8
leaq 0x1ef4cb(%rip), %r9     # 0x3274dc
xorl %eax, %eax
callq 0x89dbb
movb $0x1, %bl
jmp 0x137fdd
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
jg 0x13808e
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rsi
cmpq %rsi, %rdx
jg 0x138097
movq %rax, 0x40(%rsp)
movq %rcx, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rsi, 0x58(%rsp)
cvtsi2sdq 0x30(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x60(%rsp)
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x136157
jmp 0x137fa0
movq %r12, %rdi
callq 0x8a4fd
testb $0x1, %bl
jne 0x1380c3
movq %r15, %rdi
callq 0x136269
jmp 0x1380ce
leaq 0x207376(%rip), %r9     # 0x33f40b
jmp 0x13809e
leaq 0x20738b(%rip), %r9     # 0x33f429
leaq 0x20733d(%rip), %rsi    # 0x33f3e2
pushq $0x5
popq %r8
movq %r14, %rdi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x89dbb
movq %r12, %rdi
callq 0x8a4fd
movq %r15, %rdi
callq 0x13609e
xorl %r15d, %r15d
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq