// File: /workspace/github_cpp_makefile_star2_O3/thunlp[P]KB2E/cluster/apcluster.cpp
// Function: main
int main(int argc, char** argv)
{
  int flag, dn, it, conv, decit, maxits, convits;
  unsigned long i1, i2, j, *i, *k, m, n, l, **dec, *decsum, *idx, K;
  double tmp, *s, *a, *r, *p, *mx1, *mx2, *srp, netsim, dpsim, expref, lam;
  FILE *f;

  /* Usage */
  if((argc!=4)&&(argc!=7)){
    printf("\nUsage:\n\n");
    printf("apcluster <Similarity file> <Preference file> <Output: Index file>\n");
    printf("          [ <maxits> <convits> <dampfact> ]\n\n");
    printf("\nAPCLUSTER uses the affinity propagation algorithm by\n");
    printf("BJ Frey and D Dueck (Science 315, 972-976, Feb 16, 2007)\n");
    printf("to identify data clusters, using a set of real-valued\n");
    printf("pair-wise data point similarities as input. Each cluster is\n");
    printf("represented by a data point called a cluster center, and the\n");
    printf("method searches for clusters so as to maximize a fitness\n");
    printf("function called net similarity. The method is iterative and\n");
    printf("stops after maxits iterations (default: 500) or when the cluster\n");
    printf("centers stay constant for convits iterations (default: 50).\n\n");
    printf("For N data points, there may be as many as N^2-N pair-wise\n");
    printf("similarities (note that the similarity of data point i to k\n");
    printf("need not be equal to the similarity of data point k to i).\n");
    printf("APCLUSTER can work with this full set of similarities or\n");
    printf("a smaller subset (which is helpful when N is large). The\n");
    printf("similarities should be in the input similarity file, where\n");
    printf("each line should be of the form <i k s> where i and k are\n");
    printf("data point indices and s is a real number corresponding\n");
    printf("to the similarity of data point i to data point k.\n\n");
    printf("APCLUSTER automatically determines the number of clusters,\n");
    printf("based on numbers called preferences -- there is one such\n");
    printf("number for each data point and data points with large\n");
    printf("preferences are more likely to be chosen as centers. Values\n");
    printf("of the prefences should be in the input preference file and\n");
    printf("the jth entry in this file should be the preference of the\n");
    printf("jth data point. How should you choose the preferences? A good\n");
    printf("choice is to set all preference values to the median of the\n");
    printf("similarity values. Then, the number of identified clusters can\n");
    printf("be increased or decreased  by changing this value accordingly.\n\n");
    printf("The fitness function (net similarity) used to search for\n");
    printf("solutions equals the sum of the preferences of the the data\n");
    printf("centers plus the sum of the similarities of the other data\n");
    printf("points to their cluster centers.\n\n");
    printf("The identified cluster centers and the assignments of other\n");
    printf("data points to these centers are stored in the output index\n");
    printf("file. The jth entry in this file is the index of the data\n");
    printf("point that is the cluster center for data point j. If the\n");
    printf("jth entry equals j, then data point j is itself a cluster\n");
    printf("center. The sum of the similarities of the data points to\n");
    printf("their cluster centers, the  sum of the preferences of the\n");
    printf("identified cluster centers, and the fitness or net similarity\n");
    printf("(sum of the data point similarities and preferences) are\n");
    printf("printed to the screen.\n\n");
    printf("See http://www.psi.toronto.edu/affinitypropagation for test\n");
    printf("files and MATLAB software.\n\n");
    printf("Copyright 2007, BJ Frey and D Dueck. This software may be\n");
    printf("freely distributed and used for non-commercial purposes.\n\n");
    return 0 ;
  }

  if (MINDOUBLE==0.0) {
	  printf("There are numerical precision problems on this architecture.  Please recompile after adjusting MIN_DOUBLE and MAX_DOUBLE\n\n");
  }

  /* Parse command line */
  if(argc==4){ lam=0.9; maxits=500; convits=50;
  } else {
    flag=sscanf(argv[4],"%d",&maxits);
    if(flag==1){
      flag=sscanf(argv[5],"%d",&convits);
      if(flag==1){
	flag=sscanf(argv[6],"%lf",&lam);
	if(flag==0){
	  printf("\n\n*** Error in <damping factor> argument\n\n");
	  return 0;
	}
      } else {
	printf("\n\n*** Error in <convergence iterations> argument\n\n");
	return 0;
      }
    } else {
      printf("\n\n*** Error in <maximum iterations> argument\n\n");
      return 0;
    }
  }
  if(maxits<1){
    printf("\n\n*** Error: maximum number of iterations must be at least 1\n\n");
    return 0 ;
  }
  if(convits<1){
    printf("\n\n*** Error: number of iterations to test convergence must be at least 1\n\n");
    return 0 ;
  }
  if((lam<0.5)||(lam>=1)){
    printf("\n\n*** Error: damping factor must be between 0.5 and 1\n\n");
    return 0 ;
  }
  printf("\nmaxits=%d, convits=%d, dampfact=%lf\n",maxits,convits,lam);


  /* Find out how many data points and similarities there are */
  f=fopen(argv[1],"r");
  if(f==NULL){
    printf("\n\n*** Error opening similarities file\n\n");
    return 0;
  }
  m=0; n=0;
  flag=fscanf(f,"%lu %lu %lf",&i1,&i2,&tmp);
  while(flag!=EOF){
    if(i1>n) n=i1;
    if(i2>n) n=i2;
    m=m+1;
    flag=fscanf(f,"%lu %lu %lf",&i1,&i2,&tmp);
  }
  fclose(f);

  /* Allocate memory for similarities, preferences, messages, etc */
  i=(unsigned long *)calloc(m+n,sizeof(unsigned long));
  k=(unsigned long *)calloc(m+n,sizeof(unsigned long));
  s=(double *)calloc(m+n,sizeof(double));
  a=(double *)calloc(m+n,sizeof(double));
  r=(double *)calloc(m+n,sizeof(double));
  mx1=(double *)calloc(n,sizeof(double));
  mx2=(double *)calloc(n,sizeof(double));
  srp=(double *)calloc(n,sizeof(double));
  dec=(unsigned long **)calloc(convits,sizeof(unsigned long *));
  for(j=0;j<convits;j++)
    dec[j]=(unsigned long *)calloc(n,sizeof(unsigned long));
  decsum=(unsigned long *)calloc(n,sizeof(unsigned long));
  idx=(unsigned long *)calloc(n,sizeof(unsigned long));

  /* Read similarities and preferences */
  f=fopen(argv[1],"r");
  for(j=0;j<m;j++){
    fscanf(f,"%lu %lu %lf",&(i[j]),&(k[j]),&(s[j]));
    i[j]--; k[j]--;
  }
  fclose(f);
  f=fopen(argv[2],"r");
  if(f==NULL){
    printf("\n\n*** Error opening preferences file\n\n");
    return 0;
  }
  for(j=0;j<n;j++){
    i[m+j]=j; k[m+j]=j;
    flag=fscanf(f,"%lf",&(s[m+j]));
  }
  fclose(f);
  if(flag==EOF){
    printf("\n*** Error: Number of entries in the preferences file is\n");
    printf("    less than number of data points\n\n");
    return 0;
  }
  m=m+n;

  /* Include a tiny amount of noise in similarities to avoid degeneracies */
  for(j=0;j<m;j++) s[j]=s[j]+(1e-16*s[j]+MINDOUBLE*100)*(rand()/((double)RAND_MAX+1));

  /* Initialize availabilities to 0 and run affinity propagation */
  for(j=0;j<m;j++) a[j]=0.0;
  for(j=0;j<convits;j++) for(i1=0;i1<n;i1++) dec[j][i1]=0;
  for(j=0;j<n;j++) decsum[j]=0;
  dn=0; it=0; decit=convits;
  while(dn==0){
    it++; /* Increase iteration index */

    /* Compute responsibilities */
    for(j=0;j<n;j++){ mx1[j]=-MAXDOUBLE; mx2[j]=-MAXDOUBLE; }
    for(j=0;j<m;j++){
      tmp=a[j]+s[j];
      if(tmp>mx1[i[j]]){
	mx2[i[j]]=mx1[i[j]];
	mx1[i[j]]=tmp;
      } else if(tmp>mx2[i[j]]) mx2[i[j]]=tmp;
    }
    for(j=0;j<m;j++){
      tmp=a[j]+s[j];
      if(tmp==mx1[i[j]]) r[j]=lam*r[j]+(1-lam)*(s[j]-mx2[i[j]]);
      else r[j]=lam*r[j]+(1-lam)*(s[j]-mx1[i[j]]);
    }

    /* Compute availabilities */
    for(j=0;j<n;j++) srp[j]=0.0;
    for(j=0;j<m-n;j++) if(r[j]>0.0) srp[k[j]]=srp[k[j]]+r[j];
    for(j=m-n;j<m;j++) srp[k[j]]=srp[k[j]]+r[j];
    for(j=0;j<m-n;j++){
      if(r[j]>0.0) tmp=srp[k[j]]-r[j]; else tmp=srp[k[j]];
      if(tmp<0.0) a[j]=lam*a[j]+(1-lam)*tmp; else a[j]=lam*a[j];
    }
    for(j=m-n;j<m;j++) a[j]=lam*a[j]+(1-lam)*(srp[k[j]]-r[j]);

    /* Identify exemplars and check to see if finished */
    decit++; if(decit>=convits) decit=0;
    for(j=0;j<n;j++) decsum[j]=decsum[j]-dec[decit][j];
    for(j=0;j<n;j++)
      if(a[m-n+j]+r[m-n+j]>0.0) dec[decit][j]=1; else dec[decit][j]=0;
    K=0; for(j=0;j<n;j++) K=K+dec[decit][j];
    for(j=0;j<n;j++) decsum[j]=decsum[j]+dec[decit][j];
    if((it>=convits)||(it>=maxits)){
      /* Check convergence */
      conv=1; for(j=0;j<n;j++) if((decsum[j]!=0)&&(decsum[j]!=convits)) conv=0;
      /* Check to see if done */
      if(((conv==1)&&(K>0))||(it==maxits)) dn=1;
    }
  }
  /* If clusters were identified, find the assignments and output them */
  if(K>0){
    for(j=0;j<m;j++)
      if(dec[decit][k[j]]==1) a[j]=0.0; else a[j]=-MAXDOUBLE;
    for(j=0;j<n;j++) mx1[j]=-MAXDOUBLE;
    for(j=0;j<m;j++){
      tmp=a[j]+s[j];
      if(tmp>mx1[i[j]]){
	mx1[i[j]]=tmp;
	idx[i[j]]=k[j];
      }
    }
    for(j=0;j<n;j++) if(dec[decit][j]) idx[j]=j;
    for(j=0;j<n;j++) srp[j]=0.0;
    for(j=0;j<m;j++) if(idx[i[j]]==idx[k[j]]) srp[k[j]]=srp[k[j]]+s[j];
    for(j=0;j<n;j++) mx1[j]=-MAXDOUBLE;
    for(j=0;j<n;j++) if(srp[j]>mx1[idx[j]]) mx1[idx[j]]=srp[j];
    for(j=0;j<n;j++)
      if(srp[j]==mx1[idx[j]]) dec[decit][j]=1; else dec[decit][j]=0;
    for(j=0;j<m;j++)
      if(dec[decit][k[j]]==1) a[j]=0.0; else a[j]=-MAXDOUBLE;
    for(j=0;j<n;j++) mx1[j]=-MAXDOUBLE;
    for(j=0;j<m;j++){
      tmp=a[j]+s[j];
      if(tmp>mx1[i[j]]){
	mx1[i[j]]=tmp;
	idx[i[j]]=k[j];
      }
    }
    for(j=0;j<n;j++) if(dec[decit][j]) idx[j]=j;
    f=fopen(argv[3],"w");
    for(j=0;j<n;j++) fprintf(f,"%lu\n",idx[j]+1);
    fclose(f);
    dpsim=0.0; expref=0.0;
    for(j=0;j<m;j++){
      if(idx[i[j]]==k[j]){
	if(i[j]==k[j]) expref=expref+s[j];
	else dpsim=dpsim+s[j];
      }
    }
    netsim=dpsim+expref;
    printf("\nNumber of identified clusters: %d\n",K);
    printf("Fitness (net similarity): %f\n",netsim);
    printf("  Similarities of data points to exemplars: %f\n",dpsim);
    printf("  Preferences of selected exemplars: %f\n",expref);
    printf("Number of iterations: %d\n\n",it);
  } else printf("\nDid not identify any clusters\n");
  if(conv==0){
    printf("\n*** Warning: Algorithm did not converge. Consider increasing\n");
    printf("    maxits to enable more iterations. It may also be necessary\n");
    printf("    to increase damping (increase dampfact).\n\n");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r14
cmpl $0x4, %edi
je 0x1271
cmpl $0x7, %edi
jne 0x138b
movq 0x20(%r14), %rdi
leaq 0x1e73(%rip), %rsi      # 0x3070
leaq 0x4c(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %eax
jne 0x15e3
movq 0x28(%r14), %rdi
leaq 0x1e53(%rip), %rsi      # 0x3070
leaq 0x24(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %eax
jne 0x15ef
movq 0x30(%r14), %rdi
leaq 0x1e64(%rip), %rsi      # 0x30a1
leaq 0x60(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
testl %eax, %eax
je 0x1d4c
movl 0x4c(%rsp), %esi
testl %esi, %esi
jle 0x1d75
movl 0x24(%rsp), %edx
testl %edx, %edx
jle 0x2219
movsd 0x60(%rsp), %xmm0
jmp 0x12a2
movabsq $0x3feccccccccccccd, %rax # imm = 0x3FECCCCCCCCCCCCD
movq %rax, 0x60(%rsp)
movl $0x1f4, 0x4c(%rsp)      # imm = 0x1F4
movl $0x32, 0x24(%rsp)
movl $0x32, %edx
movl $0x1f4, %esi            # imm = 0x1F4
movsd 0x1d66(%rip), %xmm0     # 0x3008
movsd 0x1d66(%rip), %xmm1     # 0x3010
ucomisd %xmm0, %xmm1
ja 0x15d7
ucomisd 0x1d5c(%rip), %xmm0     # 0x3018
jae 0x15d7
leaq 0x1daa(%rip), %rdi      # 0x3073
movb $0x1, %al
callq 0x1030
movq 0x8(%r14), %rdi
leaq 0x2936(%rip), %rsi      # 0x3c11
callq 0x1090
testq %rax, %rax
je 0x15fb
movq %rax, %rbx
movq %r14, 0x80(%rsp)
leaq 0x1d9e(%rip), %rsi      # 0x3099
xorl %r13d, %r13d
leaq 0x70(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
leaq 0x68(%rsp), %r8
movq %rax, %rdi
xorl %eax, %eax
callq 0x10c0
cmpl $-0x1, %eax
je 0x1607
leaq 0x1d6f(%rip), %r14      # 0x3099
leaq 0x70(%rsp), %r15
leaq 0xc8(%rsp), %r12
leaq 0x68(%rsp), %rbp
movq $0x0, 0x8(%rsp)
xorl %ecx, %ecx
movq 0x70(%rsp), %rax
cmpq %rcx, %rax
cmovaq %rax, %rcx
movq 0xc8(%rsp), %r13
cmpq %rcx, %r13
ja 0x1363
movq %rcx, %r13
incq 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x10c0
movq %r13, %rcx
cmpl $-0x1, %eax
jne 0x1347
jmp 0x1610
leaq 0x208e(%rip), %rdi      # 0x3420
callq 0x10b0
leaq 0x208b(%rip), %rdi      # 0x3429
callq 0x10b0
leaq 0x20c2(%rip), %rdi      # 0x346c
callq 0x10b0
leaq 0x20e3(%rip), %rdi      # 0x3499
callq 0x10b0
leaq 0x210d(%rip), %rdi      # 0x34cf
callq 0x10b0
leaq 0x213a(%rip), %rdi      # 0x3508
callq 0x10b0
leaq 0x2164(%rip), %rdi      # 0x353e
callq 0x10b0
leaq 0x2194(%rip), %rdi      # 0x357a
callq 0x10b0
leaq 0x21c5(%rip), %rdi      # 0x35b7
callq 0x10b0
leaq 0x21f2(%rip), %rdi      # 0x35f0
callq 0x10b0
leaq 0x2222(%rip), %rdi      # 0x362c
callq 0x10b0
leaq 0x2257(%rip), %rdi      # 0x366d
callq 0x10b0
leaq 0x2288(%rip), %rdi      # 0x36aa
callq 0x10b0
leaq 0x22b7(%rip), %rdi      # 0x36e5
callq 0x10b0
leaq 0x22e7(%rip), %rdi      # 0x3721
callq 0x10b0
leaq 0x2316(%rip), %rdi      # 0x375c
callq 0x10b0
leaq 0x2343(%rip), %rdi      # 0x3795
callq 0x10b0
leaq 0x2370(%rip), %rdi      # 0x37ce
callq 0x10b0
leaq 0x239f(%rip), %rdi      # 0x3809
callq 0x10b0
leaq 0x23cd(%rip), %rdi      # 0x3843
callq 0x10b0
leaq 0x23f9(%rip), %rdi      # 0x387b
callq 0x10b0
leaq 0x2421(%rip), %rdi      # 0x38af
callq 0x10b0
leaq 0x2450(%rip), %rdi      # 0x38ea
callq 0x10b0
leaq 0x247d(%rip), %rdi      # 0x3923
callq 0x10b0
leaq 0x24a7(%rip), %rdi      # 0x3959
callq 0x10b0
leaq 0x24d7(%rip), %rdi      # 0x3995
callq 0x10b0
leaq 0x2507(%rip), %rdi      # 0x39d1
callq 0x10b0
leaq 0x2536(%rip), %rdi      # 0x3a0c
callq 0x10b0
leaq 0x2568(%rip), %rdi      # 0x3a4a
callq 0x10b0
leaq 0x2598(%rip), %rdi      # 0x3a86
callq 0x10b0
leaq 0x25cb(%rip), %rdi      # 0x3ac5
callq 0x10b0
leaq 0x25ff(%rip), %rdi      # 0x3b05
callq 0x10b0
leaq 0x262c(%rip), %rdi      # 0x3b3e
callq 0x10b0
leaq 0x265c(%rip), %rdi      # 0x3b7a
callq 0x10b0
leaq 0x268b(%rip), %rdi      # 0x3bb5
callq 0x10b0
leaq 0x26a1(%rip), %rdi      # 0x3bd7
callq 0x10b0
leaq 0x26d1(%rip), %rdi      # 0x3c13
callq 0x10b0
leaq 0x2701(%rip), %rdi      # 0x3c4f
callq 0x10b0
leaq 0x272f(%rip), %rdi      # 0x3c89
callq 0x10b0
leaq 0x275d(%rip), %rdi      # 0x3cc3
callq 0x10b0
leaq 0x278b(%rip), %rdi      # 0x3cfd
callq 0x10b0
leaq 0x27b9(%rip), %rdi      # 0x3d37
callq 0x10b0
leaq 0x27e7(%rip), %rdi      # 0x3d71
callq 0x10b0
leaq 0x2819(%rip), %rdi      # 0x3daf
callq 0x10b0
leaq 0x2846(%rip), %rdi      # 0x3de8
callq 0x10b0
leaq 0x2852(%rip), %rdi      # 0x3e00
callq 0x10b0
leaq 0x2882(%rip), %rdi      # 0x3e3c
callq 0x10b0
leaq 0x2892(%rip), %rdi      # 0x3e58
callq 0x10b0
leaq 0x28c0(%rip), %rdi      # 0x3e92
jmp 0x232b
leaq 0x1d83(%rip), %rdi      # 0x3361
jmp 0x232b
leaq 0x1b78(%rip), %rdi      # 0x3162
jmp 0x232b
leaq 0x1b9a(%rip), %rdi      # 0x3190
jmp 0x232b
leaq 0x1d38(%rip), %rdi      # 0x333a
jmp 0x232b
movq $0x0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x1080
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x30(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x18(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x38(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x98(%rsp)
movl $0x8, %esi
movq %rbx, 0x50(%rsp)
movq %rbx, %rdi
callq 0x1060
movq %rax, 0xd8(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, 0x90(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, 0xf0(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, 0x10(%rsp)
movslq 0x24(%rsp), %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, %r15
testq %rbx, %rbx
je 0x16f8
xorl %r14d, %r14d
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, (%r15,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x16df
movq %r15, 0x28(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, 0xb0(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x1060
movq %rax, 0xd0(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x24d7(%rip), %rsi      # 0x3c11
callq 0x1090
movq %rax, %rbp
cmpq $0x0, 0x8(%rsp)
je 0x1790
movq 0x30(%rsp), %r12
movq 0x18(%rsp), %r14
movq 0x38(%rsp), %rbx
movq 0x8(%rsp), %r15
movq %rbp, %rdi
leaq 0x1931(%rip), %rsi      # 0x3099
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x10c0
decq (%r12)
decq (%r14)
addq $0x8, %rbx
addq $0x8, %r14
addq $0x8, %r12
decq %r15
jne 0x175e
movq %rbp, %rdi
callq 0x1080
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x2466(%rip), %rsi      # 0x3c11
callq 0x1090
testq %rax, %rax
je 0x1d40
movq %rax, %rdi
testq %r13, %r13
je 0x1d58
movq 0x38(%rsp), %rax
movq 0x8(%rsp), %rcx
leaq (%rax,%rcx,8), %rbx
movq 0x18(%rsp), %rax
leaq (%rax,%rcx,8), %r15
movq 0x30(%rsp), %rax
leaq (%rax,%rcx,8), %rbp
xorl %r12d, %r12d
movq %r12, (%rbp,%r12,8)
movq %r12, (%r15,%r12,8)
movq %rdi, %r14
leaq 0x18a6(%rip), %rsi      # 0x30a1
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10c0
movq %r14, %rdi
incq %r12
addq $0x8, %rbx
cmpq %r12, %r13
jne 0x17e8
movl %eax, %r14d
movq %r15, 0xc0(%rsp)
callq 0x1080
cmpl $-0x1, %r14d
movq 0xd8(%rsp), %rbp
je 0x1d5d
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
movq 0x38(%rsp), %r9
je 0x18a7
xorl %ebx, %ebx
movsd (%r9,%rbx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
mulsd 0x17c5(%rip), %xmm0     # 0x3020
addsd 0x17c5(%rip), %xmm0     # 0x3028
movsd %xmm0, 0x88(%rsp)
callq 0x1040
movq 0x38(%rsp), %r9
movq 0x50(%rsp), %rsi
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x17a6(%rip), %xmm0     # 0x3030
mulsd 0x88(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, (%r9,%rbx,8)
incq %rbx
cmpq %rbx, %rsi
jne 0x1847
movslq 0x24(%rsp), %r14
testq %r14, %r14
movq 0x30(%rsp), %r8
movq 0x98(%rsp), %r10
movq 0x90(%rsp), %r11
movq 0x28(%rsp), %rdi
je 0x1903
xorl %eax, %eax
movq $0x0, 0x70(%rsp)
testq %r13, %r13
je 0x18fb
movq (%rdi,%rax,8), %rcx
xorl %edx, %edx
movq $0x0, (%rcx,%rdx,8)
movq 0x70(%rsp), %rdx
incq %rdx
movq %rdx, 0x70(%rsp)
cmpq %r13, %rdx
jb 0x18e1
incq %rax
cmpq %r14, %rax
jne 0x18cd
movl 0x4c(%rsp), %eax
cmpl %eax, %r14d
movl %eax, 0x7c(%rsp)
cmovll %r14d, %eax
movl %eax, 0xa4(%rsp)
leaq (,%r13,8), %rax
movq %rax, 0xa8(%rsp)
movsd 0x60(%rsp), %xmm6
movsd 0x16e1(%rip), %xmm7     # 0x3018
movapd %xmm7, %xmm8
subsd %xmm6, %xmm8
movq 0x8(%rsp), %rdx
leaq (,%rdx,8), %rbx
addq %rbp, %rbx
leaq (%r10,%rdx,8), %r15
xorpd %xmm9, %xmm9
xorl %eax, %eax
movq %r14, 0xb8(%rsp)
movl %r14d, 0x88(%rsp)
movq 0x10(%rsp), %rdi
movsd %xmm6, 0xe8(%rsp)
movsd %xmm8, 0xe0(%rsp)
movl %eax, 0x40(%rsp)
testq %r13, %r13
movabsq $-0x10006ca6337efc, %rcx # imm = 0xFFEFFF9359CC8104
movq 0xf0(%rsp), %r14
je 0x19b1
xorl %eax, %eax
movq %rcx, (%r11,%rax,8)
movq %rcx, (%r14,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x19a1
testq %rsi, %rsi
movq 0xc0(%rsp), %r12
je 0x1a6e
xorl %eax, %eax
movsd (%r10,%rax,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movq (%r8,%rax,8), %rdx
movsd (%r11,%rdx,8), %xmm1
ucomisd %xmm1, %xmm0
leaq (%r14,%rdx,8), %rcx
jbe 0x19ee
movsd %xmm1, (%rcx)
leaq (%r11,%rdx,8), %rcx
jmp 0x19f4
ucomisd (%rcx), %xmm0
jbe 0x19f8
movsd %xmm0, (%rcx)
incq %rax
cmpq %rax, %rsi
jne 0x19c4
movsd 0x60(%rsp), %xmm0
movapd %xmm7, %xmm1
subsd %xmm0, %xmm1
xorl %eax, %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
movsd (%r9,%rax,8), %xmm3
movsd (%r10,%rax,8), %xmm2
addsd %xmm3, %xmm2
movq (%r8,%rax,8), %rcx
movsd (%r11,%rcx,8), %xmm4
ucomisd %xmm4, %xmm2
jne 0x1a44
jp 0x1a44
subsd (%r14,%rcx,8), %xmm3
jmp 0x1a48
subsd %xmm4, %xmm3
mulsd %xmm1, %xmm3
movsd (%rbp,%rax,8), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rbp,%rax,8)
incq %rax
cmpq %rax, %rsi
jne 0x1a1a
movsd %xmm2, 0x68(%rsp)
testq %r13, %r13
je 0x1acb
xorl %esi, %esi
movq 0xa8(%rsp), %rdx
callq 0x1050
xorpd %xmm9, %xmm9
movsd 0xe0(%rsp), %xmm8
movsd 0x157f(%rip), %xmm7     # 0x3018
movsd 0xe8(%rsp), %xmm6
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rdi
movq 0x90(%rsp), %r11
movq 0x98(%rsp), %r10
movq 0x38(%rsp), %r9
movq 0x30(%rsp), %r8
movq 0x50(%rsp), %rsi
testq %rdx, %rdx
movq 0x28(%rsp), %r14
je 0x1aff
xorl %eax, %eax
movsd (%rbp,%rax,8), %xmm0
ucomisd %xmm9, %xmm0
jbe 0x1af7
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %rcx
addsd (%rdi,%rcx,8), %xmm0
movsd %xmm0, (%rdi,%rcx,8)
incq %rax
cmpq %rax, %rdx
jne 0x1ad7
cmpq %rsi, %rdx
jae 0x1b21
xorl %eax, %eax
movq (%r12,%rax,8), %rcx
movsd (%rdi,%rcx,8), %xmm0
addsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rdi,%rcx,8)
incq %rax
cmpq %rax, %r13
jne 0x1b06
testq %rdx, %rdx
je 0x1bb3
movsd 0x60(%rsp), %xmm0
movapd %xmm7, %xmm1
subsd %xmm0, %xmm1
xorl %eax, %eax
movq 0x18(%rsp), %r12
movsd (%rbp,%rax,8), %xmm3
movq (%r12,%rax,8), %rcx
movsd (%rdi,%rcx,8), %xmm4
xorpd %xmm2, %xmm2
cmpltsd %xmm3, %xmm2
movapd %xmm2, %xmm5
andnpd %xmm4, %xmm5
subsd %xmm3, %xmm4
andpd %xmm4, %xmm2
orpd %xmm5, %xmm2
movapd %xmm2, %xmm3
mulsd %xmm1, %xmm3
movsd (%r10,%rax,8), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm4, %xmm3
movapd %xmm2, %xmm5
cmpltsd %xmm9, %xmm5
andpd %xmm5, %xmm3
andnpd %xmm4, %xmm5
orpd %xmm3, %xmm5
movlpd %xmm5, (%r10,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0x1b3f
movsd %xmm2, 0x68(%rsp)
movq 0xc0(%rsp), %r12
cmpq %rsi, %rdx
jae 0x1be9
xorl %eax, %eax
movq (%r12,%rax,8), %rcx
movsd (%rdi,%rcx,8), %xmm0
subsd (%rbx,%rax,8), %xmm0
mulsd %xmm8, %xmm0
movsd (%r15,%rax,8), %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r15,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x1bba
movl 0x40(%rsp), %eax
incl %eax
movl 0x88(%rsp), %r12d
incl %r12d
cmpl 0xb8(%rsp), %r12d
movl $0x0, %ecx
cmovgel %ecx, %r12d
testq %r13, %r13
movl %r12d, 0x88(%rsp)
je 0x1d2b
movl %eax, 0x40(%rsp)
movslq %r12d, %r12
movq (%r14,%r12,8), %rax
xorl %ecx, %ecx
movq 0xb0(%rsp), %rdi
movq (%rax,%rcx,8), %rdx
subq %rdx, (%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x1c31
movq (%r14,%r12,8), %rax
xorl %ecx, %ecx
movsd (%r15,%rcx,8), %xmm0
addsd (%rbx,%rcx,8), %xmm0
xorl %edx, %edx
ucomisd %xmm9, %xmm0
seta %dl
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x1c47
movq %r12, 0x58(%rsp)
movq (%r14,%r12,8), %rax
xorl %ecx, %ecx
xorl %r12d, %r12d
addq (%rax,%rcx,8), %r12
incq %rcx
cmpq %rcx, %r13
jne 0x1c76
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
addq %rdx, (%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x1c92
movl 0x40(%rsp), %eax
cmpl 0xa4(%rsp), %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
jl 0x1984
movl $0x1, %r14d
xorl %eax, %eax
movq 0xb0(%rsp), %rdi
movq 0xb8(%rsp), %r8
movl %r14d, %ecx
movq (%rdi,%rax,8), %rdx
cmpq %r8, %rdx
movl $0x0, %r14d
cmovel %ecx, %r14d
testq %rdx, %rdx
cmovel %ecx, %r14d
incq %rax
cmpq %rax, %r13
jne 0x1cd5
cmpl $0x1, %r14d
setne %al
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
movl 0x40(%rsp), %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
movq 0x30(%rsp), %r8
jne 0x1d81
cmpl 0x7c(%rsp), %eax
jne 0x1984
jmp 0x1d81
cmpl 0x7c(%rsp), %eax
jne 0x1984
movl $0x1, %r14d
jmp 0x2208
leaq 0x15cd(%rip), %rdi      # 0x3314
jmp 0x232b
leaq 0x146f(%rip), %rdi      # 0x31c2
jmp 0x232b
callq 0x1080
leaq 0x1552(%rip), %rdi      # 0x32b6
callq 0x10b0
leaq 0x157f(%rip), %rdi      # 0x32ef
jmp 0x232b
leaq 0x1666(%rip), %rdi      # 0x33e2
jmp 0x232b
testq %r12, %r12
je 0x2208
testq %rsi, %rsi
movq 0xd0(%rsp), %rbx
movq 0x18(%rsp), %r15
je 0x1dde
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movsd 0x1284(%rip), %xmm0     # 0x3038
movq (%r15,%rcx,8), %rdx
cmpq $0x1, (%rax,%rdx,8)
xorpd %xmm1, %xmm1
je 0x1dc7
movapd %xmm0, %xmm1
movsd %xmm1, (%r10,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x1db4
testq %r13, %r13
je 0x1e84
leaq 0x1(%r13), %rax
andq $-0x2, %rax
leaq -0x1(%r13), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x1244(%rip), %xmm1     # 0x3040
xorl %ecx, %ecx
movdqa 0x124a(%rip), %xmm2     # 0x3050
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x124a(%rip), %xmm4     # 0x3060
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x1e55
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, (%r11,%rcx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x1e72
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, 0x8(%r11,%rcx,8)
addq $0x2, %rcx
paddq %xmm4, %xmm1
cmpq %rcx, %rax
jne 0x1e16
testq %rsi, %rsi
je 0x1ebf
xorl %eax, %eax
movsd (%r10,%rax,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movq (%r8,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x1eac
movsd %xmm0, (%r11,%rcx,8)
movq (%r15,%rax,8), %rdx
movq %rdx, (%rbx,%rcx,8)
incq %rax
cmpq %rax, %rsi
jne 0x1e86
movsd %xmm0, 0x68(%rsp)
testq %r13, %r13
je 0x1f1f
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq 0x10(%rsp), %rdi
cmpq $0x0, (%rax,%rcx,8)
je 0x1edf
movq %rcx, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x1ed4
xorl %esi, %esi
movq 0xa8(%rsp), %rdx
callq 0x1050
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
movq 0x30(%rsp), %r8
movq 0x18(%rsp), %r15
movq 0x38(%rsp), %r9
movq 0x98(%rsp), %r10
movq 0x90(%rsp), %r11
je 0x1f59
xorl %eax, %eax
movq (%r8,%rax,8), %rcx
movq (%rbx,%rcx,8), %rdx
movq (%r15,%rax,8), %rcx
cmpq (%rbx,%rcx,8), %rdx
jne 0x1f48
movq 0x10(%rsp), %rdx
movsd (%rdx,%rcx,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
incq %rax
cmpq %rax, %rsi
jne 0x1f21
testq %r13, %r13
je 0x205c
leaq 0x1(%r13), %rax
andq $-0x2, %rax
leaq -0x1(%r13), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x10c9(%rip), %xmm1     # 0x3040
xorl %ecx, %ecx
movdqa 0x10cf(%rip), %xmm2     # 0x3050
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x10cf(%rip), %xmm4     # 0x3060
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x1fd0
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, (%r11,%rcx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x1fed
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, 0x8(%r11,%rcx,8)
addq $0x2, %rcx
paddq %xmm4, %xmm1
cmpq %rcx, %rax
jne 0x1f91
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movsd (%rdx,%rax,8), %xmm0
movq (%rbx,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x2018
movsd %xmm0, (%r11,%rcx,8)
incq %rax
cmpq %rax, %r13
jne 0x2001
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq %rdx, %rdi
movq (%rbx,%rcx,8), %rdx
movsd (%r11,%rdx,8), %xmm0
cmpeqsd (%rdi,%rcx,8), %xmm0
movq %xmm0, %rdx
andl $0x1, %edx
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x2033
testq %rsi, %rsi
je 0x209e
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movsd 0xfc4(%rip), %xmm0      # 0x3038
movq (%r15,%rcx,8), %rdx
cmpq $0x1, (%rax,%rdx,8)
xorpd %xmm1, %xmm1
je 0x2087
movapd %xmm0, %xmm1
movsd %xmm1, (%r10,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x2074
testq %r13, %r13
je 0x2144
leaq 0x1(%r13), %rax
andq $-0x2, %rax
leaq -0x1(%r13), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0xf84(%rip), %xmm1      # 0x3040
xorl %ecx, %ecx
movdqa 0xf8a(%rip), %xmm2      # 0x3050
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xf8a(%rip), %xmm4      # 0x3060
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x2115
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, (%r11,%rcx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x2132
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movq %rdx, 0x8(%r11,%rcx,8)
addq $0x2, %rcx
paddq %xmm4, %xmm1
cmpq %rcx, %rax
jne 0x20d6
testq %rsi, %rsi
je 0x2183
xorl %eax, %eax
movsd (%r10,%rax,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movq (%r8,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x216c
movsd %xmm0, (%r11,%rcx,8)
movq (%r15,%rax,8), %rdx
movq %rdx, (%rbx,%rcx,8)
incq %rax
cmpq %rax, %rsi
jne 0x2146
movsd %xmm0, 0x68(%rsp)
testq %r13, %r13
je 0x2225
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x219e
movq %rcx, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x2193
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0xeec(%rip), %rsi       # 0x30a5
callq 0x1090
movq %rbx, %r15
movq %rax, %rbx
xorl %ebp, %ebp
movq (%r15,%rbp,8), %rdx
incq %rdx
movq %rbx, %rdi
leaq 0xed0(%rip), %rsi       # 0x30a7
xorl %eax, %eax
callq 0x10a0
incq %rbp
cmpq %rbp, %r13
jne 0x21c6
movq %rbx, %rdi
callq 0x1080
movq 0x50(%rsp), %rsi
testq %rsi, %rsi
movq %r15, %rbx
jne 0x224a
pxor %xmm2, %xmm2
pxor %xmm1, %xmm1
jmp 0x228e
leaq 0xfdd(%rip), %rdi       # 0x31ec
callq 0x10b0
jmp 0x2307
leaq 0x1178(%rip), %rdi      # 0x3398
jmp 0x232b
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0xe6d(%rip), %rsi       # 0x30a5
callq 0x1090
movq %rax, %rdi
callq 0x1080
movq 0x50(%rsp), %rsi
xorpd %xmm1, %xmm1
xorl %eax, %eax
xorpd %xmm2, %xmm2
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %r8
movq 0x38(%rsp), %r9
movq (%rdi,%rax,8), %rcx
movq (%rbx,%rcx,8), %rdx
cmpq (%r8,%rax,8), %rdx
jne 0x2286
movsd (%r9,%rax,8), %xmm0
cmpq %rdx, %rcx
jne 0x2282
addsd %xmm0, %xmm1
jmp 0x2286
addsd %xmm0, %xmm2
incq %rax
cmpq %rax, %rsi
jne 0x2263
movsd %xmm2, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
movapd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xdfd(%rip), %rdi       # 0x30ac
movq %r12, %rsi
xorl %eax, %eax
callq 0x1030
leaq 0xe10(%rip), %rdi       # 0x30d0
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xe1a(%rip), %rdi       # 0x30ee
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xe36(%rip), %rdi       # 0x311e
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xe4b(%rip), %rdi       # 0x3147
movl 0x40(%rsp), %esi
xorl %eax, %eax
callq 0x1030
testl %r14d, %r14d
jne 0x2330
leaq 0xef8(%rip), %rdi       # 0x320b
callq 0x10b0
leaq 0xf2a(%rip), %rdi       # 0x3249
callq 0x10b0
leaq 0xf5d(%rip), %rdi       # 0x3288
callq 0x10b0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq