// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %rbx
movsd %xmm0, 0x48(%rsp)
leaq 0x1cc520(%rip), %rsi    # 0x35ae55
leaq 0x21077b(%rip), %rdx    # 0x39f0b7
movl $0x26, %ecx
movq %r14, %r8
callq 0xfcdbb
testq %rax, %rax
je 0x18eb3a
movq %rax, %r12
xorl %r15d, %r15d
movq %r12, %rdi
callq 0x171f0
cmpl $-0x1, %eax
je 0x18e96f
cmpl $0xa, %eax
jne 0x18e958
incq %r15
jmp 0x18e958
movq %r12, %rdi
callq 0xfd018
leaq 0x1cc4d7(%rip), %rsi    # 0x35ae55
leaq 0x210732(%rip), %rdx    # 0x39f0b7
movq %rbx, %rdi
movl $0x46, %ecx
movq %r14, %r8
callq 0xfcdbb
testq %rax, %rax
je 0x18eb3a
movq %rax, %r13
movq %r15, %rdi
callq 0x18c840
movq %rax, %r12
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x28(%rsp), %r9
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x210702(%rip), %rsi    # 0x39f0cd
leaq 0x10(%rsp), %rdx
movq %r13, %rdi
xorl %eax, %eax
callq 0x17ea0
cmpl $0x5, %eax
jne 0x18eae4
movq %r13, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x1f86ea(%rip), %r15    # 0x3870dc
xorl %ebp, %ebp
movq %r12, 0x40(%rsp)
incq %rbp
movl $0x1, %r12d
cmpq $0x0, 0x8(%rsp,%r12,8)
jns 0x18ea2a
movq %r14, %rdi
leaq 0x2106ce(%rip), %rsi    # 0x39f0e2
movq %rbx, %rdx
movq %rbp, %rcx
movq %r12, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0xfcb67
movb $0x1, %r13b
incq %r12
cmpq $0x5, %r12
jne 0x18ea02
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
jg 0x18eaf6
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rsi
cmpq %rsi, %rdx
movq 0x40(%rsp), %r12
jg 0x18eb04
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 %r12, %rdi
leaq 0x50(%rsp), %rsi
callq 0x18c92f
leaq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
leaq 0x21061f(%rip), %rsi    # 0x39f0cd
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 0x18e9f9
movq 0x8(%rsp), %rdi
callq 0xfd018
testb $0x1, %r13b
je 0x18eaec
jmp 0x18eb32
movq %r13, %rdi
callq 0xfd018
movq %r12, %rdi
callq 0x18c9b8
jmp 0x18eb3d
movq 0x40(%rsp), %r12
leaq 0x210609(%rip), %r9     # 0x39f10b
jmp 0x18eb0b
leaq 0x21061e(%rip), %r9     # 0x39f129
leaq 0x2105d0(%rip), %rsi    # 0x39f0e2
movl $0x5, %r8d
movq %r14, %rdi
movq %rbx, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xfcb67
movq 0x8(%rsp), %rdi
callq 0xfd018
movq %r12, %rdi
callq 0x18c8a6
xorl %r12d, %r12d
movq %r12, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop