// File: /workspace/github_c_makefile_star2_O1/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 $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd %xmm0, 0x48(%rsp)
leaq 0x1ccf3c(%rip), %rsi    # 0x363ec9
leaq 0x21161c(%rip), %rdx    # 0x3a85b0
movl $0x26, %ecx
movq %rbx, %r8
callq 0x101c23
movq %rax, %r12
xorl %r15d, %r15d
testq %rax, %rax
je 0x196fcb
movq %r12, %rdi
callq 0x171f0
cmpl $-0x1, %eax
je 0x196fc3
cmpl $0xa, %eax
jne 0x196fac
incq %r15
jmp 0x196fac
movq %r12, %rdi
callq 0x101e80
testq %r12, %r12
je 0x19719b
leaq 0x1cceee(%rip), %rsi    # 0x363ec9
leaq 0x2115ce(%rip), %rdx    # 0x3a85b0
movq %r14, %rdi
movl $0x46, %ecx
movq %rbx, %r8
callq 0x101c23
testq %rax, %rax
je 0x19719b
movq %rax, %r12
movq %r15, %rdi
callq 0x194f08
movq %rax, %r15
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x28(%rsp), %r9
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x21159e(%rip), %rsi    # 0x3a85c6
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
xorl %eax, %eax
callq 0x17ea0
cmpl $0x5, %eax
jne 0x1971a0
movq %r15, 0x40(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %r12, 0x8(%rsp)
movq %r15, %r12
incq %r15
movl $0x1, %r13d
cmpq $0x0, 0x8(%rsp,%r13,8)
jns 0x197087
movq %rbx, %rdi
leaq 0x21156e(%rip), %rsi    # 0x3a85db
movq %r14, %rdx
movq %r15, %rcx
movq %r13, %r8
leaq 0x1f943f(%rip), %r9     # 0x3904bc
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %bpl
incq %r13
cmpq $0x5, %r13
jne 0x19705b
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
jle 0x1970c4
incq %r12
xorl %r13d, %r13d
movl $0x5, %r8d
movq %rbx, %rdi
leaq 0x211526(%rip), %rsi    # 0x3a85db
movq %r14, %rdx
movq %r12, %rcx
leaq 0x211542(%rip), %r9     # 0x3a8604
jmp 0x1970f3
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rsi
cmpq %rsi, %rdx
jle 0x1970ff
xorl %r13d, %r13d
movl $0x5, %r8d
movq %rbx, %rdi
leaq 0x2114f5(%rip), %rsi    # 0x3a85db
movq %r14, %rdx
movq %r15, %rcx
leaq 0x21152f(%rip), %r9     # 0x3a8622
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %bpl
jmp 0x19713f
movq %rax, 0x50(%rsp)
movq %rcx, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq %rsi, 0x68(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0x30(%rsp), %xmm0
mulsd 0x48(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x70(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x194ff7
movb $0x1, %r13b
movq 0x8(%rsp), %r12
testb %r13b, %r13b
je 0x197180
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
leaq 0x21146a(%rip), %rsi    # 0x3a85c6
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x28(%rsp), %r9
xorl %eax, %eax
callq 0x17ea0
cmpl $0x5, %eax
je 0x19704f
movq %r12, %rdi
callq 0x101e80
testb $0x1, %bpl
movq 0x40(%rsp), %r15
je 0x1971a8
movq %r15, %rdi
callq 0x194f6e
xorl %r15d, %r15d
jmp 0x1971b0
movq %r12, %rdi
callq 0x101e80
movq %r15, %rdi
callq 0x195080
movq %r15, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop