// File: /workspace/github_cpp_makefile_star2_O1/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 0x1255
cmpl $0x7, %edi
jne 0x1382
movq 0x20(%r14), %rdi
leaq 0x1e77(%rip), %rsi      # 0x3070
leaq 0x4c(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %eax
jne 0x15ce
movq 0x28(%r14), %rdi
leaq 0x1e57(%rip), %rsi      # 0x3070
leaq 0x2c(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %eax
jne 0x15f2
movq 0x30(%r14), %rdi
leaq 0x1e68(%rip), %rsi      # 0x30a1
leaq 0x68(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
testl %eax, %eax
jne 0x1274
leaq 0x1f72(%rip), %rbx      # 0x31c2
jmp 0x21b3
movabsq $0x3feccccccccccccd, %rax # imm = 0x3FECCCCCCCCCCCCD
movq %rax, 0x68(%rsp)
movl $0x1f4, 0x4c(%rsp)      # imm = 0x1F4
movl $0x32, 0x2c(%rsp)
movl 0x4c(%rsp), %esi
testl %esi, %esi
jle 0x15da
movl 0x2c(%rsp), %edx
testl %edx, %edx
jle 0x15e6
movsd 0x68(%rsp), %xmm0
movsd 0x1d6e(%rip), %xmm1     # 0x3008
ucomisd %xmm0, %xmm1
leaq 0x20bc(%rip), %rbx      # 0x3361
ja 0x21b3
ucomisd 0x1d5d(%rip), %xmm0     # 0x3010
jae 0x21b3
leaq 0x1db3(%rip), %rdi      # 0x3073
movb $0x1, %al
callq 0x1030
movq 0x8(%r14), %rdi
leaq 0x293f(%rip), %rsi      # 0x3c11
callq 0x1090
testq %rax, %rax
je 0x15fe
movq %rax, %rbx
movq %r14, 0x98(%rsp)
leaq 0x1da7(%rip), %rsi      # 0x3099
xorl %r15d, %r15d
leaq 0x70(%rsp), %rdx
leaq 0xd0(%rsp), %rcx
leaq 0x58(%rsp), %r8
movq %rax, %rdi
xorl %eax, %eax
callq 0x10c0
cmpl $-0x1, %eax
je 0x160a
leaq 0x1d78(%rip), %r14      # 0x3099
leaq 0x70(%rsp), %r12
leaq 0xd0(%rsp), %r13
leaq 0x58(%rsp), %rbp
movq $0x0, 0x8(%rsp)
xorl %ecx, %ecx
movq 0x70(%rsp), %rax
cmpq %rcx, %rax
cmovaq %rax, %rcx
movq 0xd0(%rsp), %r15
cmpq %rcx, %r15
ja 0x135a
movq %rcx, %r15
incq 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x10c0
movq %r15, %rcx
cmpl $-0x1, %eax
jne 0x133e
jmp 0x1613
leaq 0x2097(%rip), %rdi      # 0x3420
callq 0x10b0
leaq 0x2094(%rip), %rdi      # 0x3429
callq 0x10b0
leaq 0x20cb(%rip), %rdi      # 0x346c
callq 0x10b0
leaq 0x20ec(%rip), %rdi      # 0x3499
callq 0x10b0
leaq 0x2116(%rip), %rdi      # 0x34cf
callq 0x10b0
leaq 0x2143(%rip), %rdi      # 0x3508
callq 0x10b0
leaq 0x216d(%rip), %rdi      # 0x353e
callq 0x10b0
leaq 0x219d(%rip), %rdi      # 0x357a
callq 0x10b0
leaq 0x21ce(%rip), %rdi      # 0x35b7
callq 0x10b0
leaq 0x21fb(%rip), %rdi      # 0x35f0
callq 0x10b0
leaq 0x222b(%rip), %rdi      # 0x362c
callq 0x10b0
leaq 0x2260(%rip), %rdi      # 0x366d
callq 0x10b0
leaq 0x2291(%rip), %rdi      # 0x36aa
callq 0x10b0
leaq 0x22c0(%rip), %rdi      # 0x36e5
callq 0x10b0
leaq 0x22f0(%rip), %rdi      # 0x3721
callq 0x10b0
leaq 0x231f(%rip), %rdi      # 0x375c
callq 0x10b0
leaq 0x234c(%rip), %rdi      # 0x3795
callq 0x10b0
leaq 0x2379(%rip), %rdi      # 0x37ce
callq 0x10b0
leaq 0x23a8(%rip), %rdi      # 0x3809
callq 0x10b0
leaq 0x23d6(%rip), %rdi      # 0x3843
callq 0x10b0
leaq 0x2402(%rip), %rdi      # 0x387b
callq 0x10b0
leaq 0x242a(%rip), %rdi      # 0x38af
callq 0x10b0
leaq 0x2459(%rip), %rdi      # 0x38ea
callq 0x10b0
leaq 0x2486(%rip), %rdi      # 0x3923
callq 0x10b0
leaq 0x24b0(%rip), %rdi      # 0x3959
callq 0x10b0
leaq 0x24e0(%rip), %rdi      # 0x3995
callq 0x10b0
leaq 0x2510(%rip), %rdi      # 0x39d1
callq 0x10b0
leaq 0x253f(%rip), %rdi      # 0x3a0c
callq 0x10b0
leaq 0x2571(%rip), %rdi      # 0x3a4a
callq 0x10b0
leaq 0x25a1(%rip), %rdi      # 0x3a86
callq 0x10b0
leaq 0x25d4(%rip), %rdi      # 0x3ac5
callq 0x10b0
leaq 0x2608(%rip), %rdi      # 0x3b05
callq 0x10b0
leaq 0x2635(%rip), %rdi      # 0x3b3e
callq 0x10b0
leaq 0x2665(%rip), %rdi      # 0x3b7a
callq 0x10b0
leaq 0x2694(%rip), %rdi      # 0x3bb5
callq 0x10b0
leaq 0x26aa(%rip), %rdi      # 0x3bd7
callq 0x10b0
leaq 0x26da(%rip), %rdi      # 0x3c13
callq 0x10b0
leaq 0x270a(%rip), %rdi      # 0x3c4f
callq 0x10b0
leaq 0x2738(%rip), %rdi      # 0x3c89
callq 0x10b0
leaq 0x2766(%rip), %rdi      # 0x3cc3
callq 0x10b0
leaq 0x2794(%rip), %rdi      # 0x3cfd
callq 0x10b0
leaq 0x27c2(%rip), %rdi      # 0x3d37
callq 0x10b0
leaq 0x27f0(%rip), %rdi      # 0x3d71
callq 0x10b0
leaq 0x2822(%rip), %rdi      # 0x3daf
callq 0x10b0
leaq 0x284f(%rip), %rdi      # 0x3de8
callq 0x10b0
leaq 0x285b(%rip), %rdi      # 0x3e00
callq 0x10b0
leaq 0x288b(%rip), %rdi      # 0x3e3c
callq 0x10b0
leaq 0x28d5(%rip), %rbx      # 0x3e92
leaq 0x2894(%rip), %rdi      # 0x3e58
callq 0x10b0
jmp 0x21b3
leaq 0x1b8d(%rip), %rbx      # 0x3162
jmp 0x21b3
leaq 0x1e01(%rip), %rbx      # 0x33e2
jmp 0x21b3
leaq 0x1dab(%rip), %rbx      # 0x3398
jmp 0x21b3
leaq 0x1b97(%rip), %rbx      # 0x3190
jmp 0x21b3
leaq 0x1d35(%rip), %rbx      # 0x333a
jmp 0x21b3
movq $0x0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x1080
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x50(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x38(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x30(%rsp)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x90(%rsp)
movl $0x8, %esi
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
callq 0x1060
movq %rax, 0x80(%rsp)
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, 0xa0(%rsp)
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, 0xf0(%rsp)
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, 0x18(%rsp)
movslq 0x2c(%rsp), %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x1060
movq %rax, %r12
testq %rbx, %rbx
je 0x16fb
xorl %r14d, %r14d
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, (%r12,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x16e2
movq %r12, 0x20(%rsp)
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, 0xd8(%rsp)
movl $0x8, %esi
movq %r15, %rdi
callq 0x1060
movq %rax, 0xb0(%rsp)
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x24d4(%rip), %rsi      # 0x3c11
callq 0x1090
movq %rax, %rbx
cmpq $0x0, 0x8(%rsp)
je 0x1793
movq 0x50(%rsp), %r13
movq 0x38(%rsp), %r14
movq 0x30(%rsp), %r12
movq 0x8(%rsp), %rbp
movq %rbx, %rdi
leaq 0x192e(%rip), %rsi      # 0x3099
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x10c0
decq (%r13)
decq (%r14)
addq $0x8, %r12
addq $0x8, %r14
addq $0x8, %r13
decq %rbp
jne 0x1761
movq %rbx, %rdi
callq 0x1080
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x2463(%rip), %rsi      # 0x3c11
callq 0x1090
testq %rax, %rax
je 0x21ac
movq %rax, %rdi
testq %r15, %r15
je 0x21cf
movq 0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
leaq (%rax,%rcx,8), %r14
movq 0x38(%rsp), %rax
leaq (%rax,%rcx,8), %rbp
movq 0x50(%rsp), %rax
leaq (%rax,%rcx,8), %rbx
xorl %r13d, %r13d
movq %r13, (%rbx,%r13,8)
movq %r13, (%rbp,%r13,8)
movq %rdi, %r12
leaq 0x18a3(%rip), %rsi      # 0x30a1
movq %r14, %rdx
xorl %eax, %eax
callq 0x10c0
movq %r12, %rdi
incq %r13
addq $0x8, %r14
cmpq %r13, %r15
jne 0x17eb
movl %eax, %r12d
movq %rbp, 0xc8(%rsp)
callq 0x1080
cmpl $-0x1, %r12d
movq 0xd8(%rsp), %rbx
je 0x21d4
cmpq $0x0, 0x40(%rsp)
movq 0x20(%rsp), %r12
je 0x18bf
xorl %r14d, %r14d
movq 0x30(%rsp), %rdx
movsd (%rdx,%r14,8), %xmm0
movsd %xmm0, 0x10(%rsp)
mulsd 0x17b6(%rip), %xmm0     # 0x3018
addsd 0x17b6(%rip), %xmm0     # 0x3020
movsd %xmm0, 0x60(%rsp)
callq 0x1040
movq 0x30(%rsp), %rdx
movq 0x40(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x179a(%rip), %xmm0     # 0x3028
mulsd 0x60(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rdx,%r14,8)
incq %r14
cmpq %r14, %rcx
jne 0x184e
leaq (,%rcx,8), %rdx
movq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x1050
movslq 0x2c(%rsp), %r14
testq %r14, %r14
je 0x18fc
xorl %eax, %eax
movq $0x0, 0x70(%rsp)
movq (%r12,%rax,8), %rcx
xorl %edx, %edx
movq $0x0, (%rcx,%rdx,8)
movq 0x70(%rsp), %rdx
incq %rdx
movq %rdx, 0x70(%rsp)
cmpq %r15, %rdx
jb 0x18da
incq %rax
cmpq %r14, %rax
jne 0x18cb
leaq (,%r15,8), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %rdx, 0xb8(%rsp)
callq 0x1050
movq 0x40(%rsp), %rsi
movl 0x4c(%rsp), %eax
cmpl %eax, %r14d
movl %eax, 0xa8(%rsp)
cmovll %r14d, %eax
movl %eax, 0xac(%rsp)
movsd 0x68(%rsp), %xmm2
movsd 0x16ce(%rip), %xmm6     # 0x3010
subsd %xmm2, %xmm6
movq 0x8(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %r14, %rdx
leaq (%rcx,%rax,8), %r14
movq 0x90(%rsp), %r10
leaq (%r10,%rax,8), %rbp
movabsq $-0x10006ca6337efc, %rcx # imm = 0xFFEFFF9359CC8104
xorl %edi, %edi
movq %rdx, %rax
movq %rdx, 0xc0(%rsp)
movl %eax, 0x7c(%rsp)
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %r9
movq 0xa0(%rsp), %r11
movsd %xmm2, 0xe8(%rsp)
movsd %xmm6, 0xe0(%rsp)
incl %edi
movl %edi, 0x60(%rsp)
xorl %eax, %eax
movq 0xf0(%rsp), %r13
movq %rcx, (%r11,%rax,8)
movq %rcx, (%r13,%rax,8)
incq %rax
cmpq %rax, %r15
jne 0x19b5
testq %rsi, %rsi
movq 0x18(%rsp), %rdi
je 0x1a8d
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 (%r13,%rdx,8), %rcx
jbe 0x1a01
movsd %xmm1, (%rcx)
leaq (%r11,%rdx,8), %rcx
jmp 0x1a07
ucomisd (%rcx), %xmm0
jbe 0x1a0b
movsd %xmm0, (%rcx)
incq %rax
cmpq %rax, %rsi
jne 0x19d6
movsd %xmm0, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x15e9(%rip), %xmm1     # 0x3010
subsd %xmm0, %xmm1
xorl %eax, %eax
movq 0x18(%rsp), %rdi
movq 0x80(%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 0x1a65
jp 0x1a65
subsd (%r13,%rcx,8), %xmm3
jmp 0x1a69
subsd %xmm4, %xmm3
mulsd %xmm1, %xmm3
movsd (%rdx,%rax,8), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rdx,%rax,8)
incq %rax
cmpq %rax, %rsi
jne 0x1a3a
movsd %xmm2, 0x58(%rsp)
xorl %esi, %esi
movq 0xb8(%rsp), %rdx
callq 0x1050
movq 0x8(%rsp), %r8
testq %r8, %r8
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %r13
movq 0x80(%rsp), %rcx
movq 0xc8(%rsp), %rdi
xorpd %xmm7, %xmm7
je 0x1af4
xorl %eax, %eax
movsd (%rcx,%rax,8), %xmm0
ucomisd %xmm7, %xmm0
jbe 0x1aec
movq (%rsi,%rax,8), %rcx
movq 0x18(%rsp), %rdx
addsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
movq 0x80(%rsp), %rcx
incq %rax
cmpq %rax, %r8
jne 0x1ac6
movq 0x40(%rsp), %rsi
cmpq %rsi, %r8
movq 0x18(%rsp), %rdx
movsd 0xe0(%rsp), %xmm6
jae 0x1b2a
xorl %eax, %eax
movq (%rdi,%rax,8), %rcx
movsd (%rdx,%rcx,8), %xmm0
addsd (%r14,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
incq %rax
cmpq %rax, %r15
jne 0x1b0e
testq %r8, %r8
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %r9
movq 0x90(%rsp), %r10
movq 0xa0(%rsp), %r11
je 0x1bf1
movsd 0x68(%rsp), %xmm0
movsd 0x14b5(%rip), %xmm1     # 0x3010
subsd %xmm0, %xmm1
xorl %eax, %eax
movq 0x8(%rsp), %rdi
movq 0x80(%rsp), %r13
movq 0x38(%rsp), %rsi
movsd (%r13,%rax,8), %xmm3
movq (%rsi,%rax,8), %rcx
movsd (%rdx,%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 %xmm7, %xmm5
andpd %xmm5, %xmm3
andnpd %xmm4, %xmm5
orpd %xmm3, %xmm5
movlpd %xmm5, (%r10,%rax,8)
incq %rax
cmpq %rax, %rdi
jne 0x1b73
movsd %xmm2, 0x58(%rsp)
movq 0xc8(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x20(%rsp), %r13
cmpq %rsi, 0x8(%rsp)
movsd 0xe8(%rsp), %xmm2
jae 0x1c32
xorl %eax, %eax
movq (%rdi,%rax,8), %rcx
movsd (%rdx,%rcx,8), %xmm0
subsd (%r14,%rax,8), %xmm0
mulsd %xmm6, %xmm0
movsd (%rbp,%rax,8), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbp,%rax,8)
incq %rax
cmpq %rax, %r15
jne 0x1c03
movl 0x7c(%rsp), %ecx
incl %ecx
cmpl 0xc0(%rsp), %ecx
movl $0x0, %eax
cmovgel %eax, %ecx
movl %ecx, 0x7c(%rsp)
movslq %ecx, %rax
movq %rax, 0x10(%rsp)
movq (%r13,%rax,8), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
subq %rdx, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x1c5a
movq 0x10(%rsp), %rax
movq (%r13,%rax,8), %rax
xorl %ecx, %ecx
movl 0x60(%rsp), %edi
movsd (%rbp,%rcx,8), %xmm0
addsd (%r14,%rcx,8), %xmm0
xorl %edx, %edx
ucomisd %xmm7, %xmm0
seta %dl
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x1c7a
movq 0x10(%rsp), %rax
movq (%r13,%rax,8), %rax
xorl %ecx, %ecx
xorl %r13d, %r13d
addq (%rax,%rcx,8), %r13
incq %rcx
cmpq %rcx, %r15
jne 0x1caa
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
addq %rdx, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x1cc6
movb $0x1, %al
cmpl 0xac(%rsp), %edi
jl 0x1d33
movl $0x1, %r12d
xorl %eax, %eax
movq 0xc0(%rsp), %rdi
movl %r12d, %ecx
movq (%rbx,%rax,8), %rdx
cmpq %rdi, %rdx
movl $0x0, %r12d
cmovel %ecx, %r12d
testq %rdx, %rdx
cmovel %ecx, %r12d
incq %rax
cmpq %rax, %r15
jne 0x1cf1
cmpl $0x1, %r12d
setne %al
testq %r13, %r13
sete %cl
orb %al, %cl
movl 0x60(%rsp), %edi
cmpl 0xa8(%rsp), %edi
setne %al
andb %cl, %al
testb %al, %al
movabsq $-0x10006ca6337efc, %rcx # imm = 0xFFEFFF9359CC8104
jne 0x19a5
testq %r13, %r13
je 0x21e7
testq %rsi, %rsi
movq 0xb0(%rsp), %rbp
je 0x1d99
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movsd 0x12bd(%rip), %xmm0     # 0x3030
movq 0x38(%rsp), %rdx
movq (%rdx,%rcx,8), %rdx
cmpq $0x1, (%rax,%rdx,8)
xorpd %xmm1, %xmm1
je 0x1d8b
movapd %xmm0, %xmm1
movsd %xmm1, (%r10,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x1d73
leaq 0x1(%r15), %rbx
andq $-0x2, %rbx
leaq -0x1(%r15), %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm5     # xmm5 = xmm0[0,1,0,1]
movdqa 0x1289(%rip), %xmm0     # 0x3040
xorl %eax, %eax
movdqa 0x128f(%rip), %xmm6     # 0x3050
pxor %xmm6, %xmm5
pcmpeqd %xmm1, %xmm1
movq 0x18(%rsp), %rdi
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movdqa %xmm0, %xmm2
pxor %xmm6, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm5, %xmm3
pcmpeqd %xmm5, %xmm2
pshufd $0xf5, %xmm2, %xmm4     # xmm4 = xmm2[1,1,3,3]
pand %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm4, %xmm2
movd %xmm2, %ecx
notl %ecx
testb $0x1, %cl
je 0x1e0d
movq %rdx, (%r11,%rax,8)
pxor %xmm1, %xmm2
pextrw $0x4, %xmm2, %ecx
testb $0x1, %cl
je 0x1e20
movq %rdx, 0x8(%r11,%rax,8)
addq $0x2, %rax
paddq 0x1234(%rip), %xmm0     # 0x3060
cmpq %rax, %rbx
jne 0x1dd8
testq %rsi, %rsi
je 0x1e77
xorl %eax, %eax
movsd (%r10,%rax,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movq (%r8,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x1e69
movsd %xmm0, (%r11,%rcx,8)
movq 0x38(%rsp), %rdx
movq (%rdx,%rax,8), %rdx
movq %rdx, (%rbp,%rcx,8)
movq 0x18(%rsp), %rdi
incq %rax
cmpq %rax, %rsi
jne 0x1e38
movq %xmm0, 0x58(%rsp)
movdqa %xmm5, 0x80(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x1e9c
movq %rcx, (%rbp,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x1e90
xorl %esi, %esi
movq 0xb8(%rsp), %rdx
callq 0x1050
movq 0xa0(%rsp), %r11
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
movq 0x50(%rsp), %rdi
movq 0x38(%rsp), %r8
movq 0x30(%rsp), %r9
movdqa 0x80(%rsp), %xmm5
movdqa 0x116d(%rip), %xmm6     # 0x3050
movdqa 0x1175(%rip), %xmm7     # 0x3060
je 0x1f20
xorl %eax, %eax
movq (%rdi,%rax,8), %rcx
movq (%rbp,%rcx,8), %rdx
movq (%r8,%rax,8), %rcx
cmpq (%rbp,%rcx,8), %rdx
jne 0x1f18
movq 0x18(%rsp), %rdx
movsd (%rdx,%rcx,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
incq %rax
cmpq %rax, %rsi
jne 0x1eef
movdqa 0x1118(%rip), %xmm0     # 0x3040
xorl %eax, %eax
pcmpeqd %xmm1, %xmm1
movq 0x90(%rsp), %r10
movq 0x18(%rsp), %r14
movdqa %xmm0, %xmm2
pxor %xmm6, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm5, %xmm3
pcmpeqd %xmm5, %xmm2
pshufd $0xf5, %xmm2, %xmm4     # xmm4 = xmm2[1,1,3,3]
pand %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm4, %xmm2
movd %xmm2, %ecx
notl %ecx
testb $0x1, %cl
je 0x1f7a
movabsq $-0x10006ca6337efc, %rcx # imm = 0xFFEFFF9359CC8104
movq %rcx, (%r11,%rax,8)
pxor %xmm1, %xmm2
pextrw $0x4, %xmm2, %ecx
testb $0x1, %cl
je 0x1f97
movabsq $-0x10006ca6337efc, %rcx # imm = 0xFFEFFF9359CC8104
movq %rcx, 0x8(%r11,%rax,8)
addq $0x2, %rax
paddq %xmm7, %xmm0
cmpq %rax, %rbx
jne 0x1f3b
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm0
movq (%rbp,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x1fbf
movsd %xmm0, (%r11,%rcx,8)
incq %rax
cmpq %rax, %r15
jne 0x1fa6
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq (%rbp,%rcx,8), %rdx
movsd (%r11,%rdx,8), %xmm0
cmpeqsd (%r14,%rcx,8), %xmm0
movq %xmm0, %rdx
andl $0x1, %edx
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x1fd7
testq %rsi, %rsi
je 0x203b
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movq 0x1016(%rip), %xmm0     # 0x3030
movq (%r8,%rcx,8), %rdx
cmpq $0x1, (%rax,%rdx,8)
pxor %xmm1, %xmm1
je 0x202d
movdqa %xmm0, %xmm1
movq %xmm1, (%r10,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x201a
movdqa 0xffd(%rip), %xmm0      # 0x3040
xorl %eax, %eax
pcmpeqd %xmm1, %xmm1
movabsq $-0x10006ca6337efc, %rdx # imm = 0xFFEFFF9359CC8104
movdqa %xmm0, %xmm2
pxor %xmm6, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm5, %xmm3
pcmpeqd %xmm5, %xmm2
pshufd $0xf5, %xmm2, %xmm4     # xmm4 = xmm2[1,1,3,3]
pand %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm4, %xmm2
movd %xmm2, %ecx
notl %ecx
testb $0x1, %cl
je 0x2088
movq %rdx, (%r11,%rax,8)
pxor %xmm1, %xmm2
pextrw $0x4, %xmm2, %ecx
testb $0x1, %cl
je 0x209b
movq %rdx, 0x8(%r11,%rax,8)
addq $0x2, %rax
paddq %xmm7, %xmm0
cmpq %rax, %rbx
jne 0x2053
testq %rsi, %rsi
je 0x20e4
xorl %eax, %eax
movsd (%r10,%rax,8), %xmm0
addsd (%r9,%rax,8), %xmm0
movq (%rdi,%rax,8), %rcx
ucomisd (%r11,%rcx,8), %xmm0
jbe 0x20d6
movsd %xmm0, (%r11,%rcx,8)
movq (%r8,%rax,8), %rdx
movq %rdx, (%rbp,%rcx,8)
incq %rax
cmpq %rax, %rsi
jne 0x20af
movq %xmm0, 0x58(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x2100
movq %rcx, (%rbp,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x20f4
movq 0x98(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0xf8a(%rip), %rsi       # 0x30a5
callq 0x1090
movq %rax, %rbx
movq %rbp, %r14
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rdx
incq %rdx
movq %rbx, %rdi
leaq 0xf6e(%rip), %rsi       # 0x30a7
xorl %eax, %eax
callq 0x10a0
incq %rbp
cmpq %rbp, %r15
jne 0x2128
movq %rbx, %rdi
callq 0x1080
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
je 0x21f8
pxor %xmm1, %xmm1
xorl %eax, %eax
xorpd %xmm2, %xmm2
movq 0x50(%rsp), %rdi
movq 0x38(%rsp), %r8
movq 0x30(%rsp), %r9
movq 0xb0(%rsp), %r10
movq (%rdi,%rax,8), %rcx
movq (%r8,%rax,8), %rdx
cmpq %rdx, (%r10,%rcx,8)
jne 0x21a2
movsd (%r9,%rax,8), %xmm0
cmpq %rdx, %rcx
jne 0x219e
addsd %xmm0, %xmm1
jmp 0x21a2
addsd %xmm0, %xmm2
incq %rax
cmpq %rax, %rsi
jne 0x217f
jmp 0x2200
leaq 0x1161(%rip), %rbx      # 0x3314
movq %rbx, %rdi
callq 0x10b0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1080
leaq 0x1114(%rip), %rbx      # 0x32ef
leaq 0x10d4(%rip), %rdi      # 0x32b6
jmp 0x15c4
leaq 0xffe(%rip), %rdi       # 0x31ec
callq 0x10b0
jmp 0x227f
xorpd %xmm2, %xmm2
pxor %xmm1, %xmm1
movsd %xmm2, 0x8(%rsp)
movsd %xmm1, 0x18(%rsp)
movapd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0xe88(%rip), %rdi       # 0x30ac
movq %r13, %rsi
xorl %eax, %eax
callq 0x1030
leaq 0xe9b(%rip), %rdi       # 0x30d0
movsd 0x80(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xea2(%rip), %rdi       # 0x30ee
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xebe(%rip), %rdi       # 0x311e
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
callq 0x1030
leaq 0xed3(%rip), %rdi       # 0x3147
movl 0x60(%rsp), %esi
xorl %eax, %eax
callq 0x1030
testl %r12d, %r12d
jne 0x21bb
leaq 0xf7c(%rip), %rdi       # 0x320b
callq 0x10b0
leaq 0xfed(%rip), %rbx       # 0x3288
leaq 0xfa7(%rip), %rdi       # 0x3249
jmp 0x15c4