// File: /workspace/github_c_makefile_star2_O2/mincebert[P]maketzx/maketzx.c
// Function: DataRead
dword DataRead(double bit0,double bit1,word explen)
{
  byte value,count,lastval,tolerance,maxpulse;/*=bit1+bit0-tolerance;*/
  word pulse;
  dword amount=0;
  double middle;
  if (spdchk) { bit0*=ecf; bit1*=ecf; }
  middle=(double)(bit1+bit0)/2;
//  if (bit0-bit1+2*tolerance) { bit1++; tolerance++; }
/*  if (maxpulse>pilot.samples)*/
  maxpulse=bit1+(pilot.samples-bit1)/2+1;
  tolerance=(bit1-bit0)/2;
  if (maxpulse>(byte)bit1+(byte)bit0) maxpulse=bit1+bit0-tolerance;
  if (!subblocks && !slocktype || raw) checksum=0;
  for (count=0; count<8; count++) faultybits[count]=0;
  probend=0;
  EndBlock=0;
  DataLoadOK=0;
  printf("Reading data...            \x0d");
  if (!explen)
     {
       do {
	    PushFilePointers();
	    value=0;
	    for (count=0; count<8; count++)
		{
//                byte good=1;
		  pulse=0;
		  if (EndBlock) break;

/*                do {
		       pulse+=FindEdge1();
		       if (currpulse<2) good=0;
		       else good=1;
		     }
		  while (!good && blocktype);
		  do {
		       pulse+=FindEdge1();
		       if (currpulse<2) good=0;
		       else good=1;
		     }
		  while (!good && blocktype); */

//                do pulse+=FindEdge2();
//                while (pulse<bit0-tolerance && blocktype);

		     do {
			  pulse=FindEdge2();
//                        if (pulse<bit0-tolerance && pulse-diff>0 && abs(diff)<5)
//                        pulse-=diff;
			}
		     while (pulse<bit0-tolerance && blocktype);


		  if (((pulse-(int)(middle+.5))<2 && (pulse-2*currpulse)>2) || pulse>maxpulse)
		     {
		       if (currpulse+lastpulse>maxpulse)
			  {
			    if (!count)
			       {
				 mspause+=(pulse/samprate)*1000;
				 EndBlock=1;
				 break;
			       }
			    if (count==7)
			       {
				 mspause+=((pulse-(2*lastpulse))/samprate)*1000;
				 pulse=2*lastpulse;
				 EndBlock=1;
			       }
			    else if ((slocktype>1 && slocktype<5) && blocks>blockskip+1)
				    {
				      PopFilePointers();
				      //RecoverFilePointers();
				      lseek(inpfile.handle,filepos,SEEK_SET);
				      inpfile.bufpoint=0;
				      EndBlock=1; break;
				    }
				 else { EndBlock=1; break; }
			  }
			else {
			       if (loggen) fprintf(logfile,"?- Ambiguous pulse found: %u samples,",pulse);
			       pulse=((currpulse+lastpulse)/2+pulse-middle+(lastpulse<currpulse))*2;
			       if (loggen) {
					     fprintf(logfile," changed to %u (%d)\n",pulse,pulse>middle);
					     fprintf(logfile,"   Position: block %ld, byte %lu, bit %ld, sample %lu\n\n",(dword)blocks,(dword)amount,(dword)7-count,(dword)totalread-pulse);
					   }
			       faultybits[7-count]++;
			      }
		     }

	       /*         if (pulse>bit1+tolerance || pulse>pilot.samples)
		     {
		       if (count==7) {
				       mspause+=((pulse-(2*lastpulse))/samprate)*1000;
				       pulse=2*lastpulse;
				       EndBlock=1;
				     }
		       else if ((slocktype>1 && slocktype<5) && blocks>blockskip+1)
			       {
				 PopFilePointers();
				 lseek(inpfile.handle,filepos,SEEK_SET);
				 inpfile.bufpoint=0;
				 EndBlock=1; break;
			       }
			    else { EndBlock=1; break; }
		     } */
		  if (!blocktype && !count)
		     {
		       if ((alk && blocks>2) || (!checksum && amount)) DataLoadOK=1;
		       return amount;
		     }
		  if (pulse>=bit0-tolerance && pulse<=middle) value<<=1;
		  else if (pulse>middle && pulse<=maxpulse) { value<<=1; value|=0x1; }
		}
	    if (count==8)
	       {
		 amount++;
		 if (amount==1) flag=value;
		 chksum=lastval=value;
		 lastval=value;
		 checksum^=value;
		 if (!checksum) probend=amount;
		 PutData(&tempfile,value,1);
	       }
	    RemoveFilePointers();
	  }
       while (!EndBlock);
//       RecoverFilePointers();
       if ((!checksum && amount) || ((alk || (blocks>blockskip && blockskip && !raw)) || (slocktype>1 && slocktype<5 && blocks>blockskip+1 && blockskip)))
	  {
	    byte bitpoint;
	    byte fbits=0;
	    DataLoadOK=1;
	    if (loggen)
	       {
		 fprintf(logfile,"!- Block %d",blocks);
		 if (subblocks) fprintf(logfile," -> Sub-block %d",subblocks);
		 if (alk)
		    {
		      if (blocks<blockskip) fprintf(logfile," loaded OK\n");
		      else fprintf(logfile," is Alkatraz and cannot be checked\n");
		    }
		 else fprintf(logfile," loaded OK\n");
	       }
	    for (bitpoint=0; bitpoint<8; bitpoint++)
		{
		  if (faultybits[bitpoint]>1) { fbits++; }
		}
	    if (fbits)
	       {
		 if (loggen)
		    {
		      fprintf(logfile,"\n!- WARNING!!! Several ambiguous pulses were found loading bit");
		      if (fbits>1) fprintf(logfile,"s");
		      fprintf(logfile," ");
		    }
		 for (bitpoint=0; bitpoint<8; bitpoint++)
		     if (faultybits[bitpoint]>1)
			   {
			     if (loggen) fprintf(logfile,"%d",bitpoint);
			     fbits--;
			     if (loggen)
				{
				  if (fbits) fprintf(logfile,",");
				  else fprintf(logfile,".\n");
				}
			   }
		 if (loggen)
		    {
		      fprintf(logfile,"   It's strictly recommended that you check that block by loading it on a real\n");
		      fprintf(logfile,"   ZX Spectrum (better solution) or an emulator.\n\n");
		    }
	       }
	  }
       else if (probend && amount-probend<=2)
	    { amount=probend; checksum=0; DataLoadOK=1; }
	    else {
		   char bitpoint;
		   word meanbits[8]={ 0,0,0,0,0,0,0,0 };
		   byte bit,fbits=0;
		   byte dchecksum=checksum;
		   DataLoadOK=0;
		   if (loggen) fprintf(logfile,"X- Bad checksum in block %d (calculated=%d (#%2X), loaded=%d (#%2X))\n",blocks,dchecksum^lastval,dchecksum^lastval,lastval,lastval);
		   for (bitpoint=7; bitpoint>=0; bitpoint--)
		       {
			 if (faultybits[bitpoint])
			    {
			      //bit=pow(2,bitpoint)
			      bit=(int)(1<<bitpoint);
			      if (dchecksum>bit-1)
				 {
				   meanbits[bitpoint]++;
				   fbits++;
				   dchecksum^=bit*(faultybits[bitpoint]==1);
				 }
			    }
			 if (!dchecksum) break;
		       }
		   if (loggen)
		      {
			if (!fbits) fprintf(logfile,"   No ambiguous bits in that block...try resampling and cross your fingers!!!\n");
			else {
			       fprintf(logfile,"   Ambiguous pulses were found in the block ");
			       if (!dchecksum) fprintf(logfile,"and some of them seemed\n   to be determinant:\n");
			       else fprintf(logfile," but none of them was determinant\n   Please try resampling...\n\n");
			     }
		      }
		 }
       if (!mspause && !subblocks) mspause=(pulse/samprate)*1000;
       if (loggen) fprintf(logfile,"\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\n");
     }
  else {
	 mspause=0;
	 for (amount=0; amount<explen; amount++)
	     {
//             byte good=1;
	       value=0;
	       for (count=0; count<8; count++)
		   {

		     pulse=0;
/*                   do {
			  pulse+=FindEdge1();
			  if (currpulse<2) good=0;
			  else good=1;
			}
		     while (!good && blocktype);
		     do {
			  pulse+=FindEdge1();
			  if (currpulse<2) good=0;
			  else good=1;
			}
		     while (!good && blocktype); */


		     do {
			  pulse=FindEdge2();
//                        if ((currpulse<2 || lastpulse<2) && abs(currpulse-lastpulse)>4)
//                           do pulse+=FindEdge1();
//                           while (currpulse<2);
			}
		     while (pulse<bit0-tolerance && blocktype);

		     if (!blocktype && !count)
			{
			  if (!checksum) DataLoadOK=1;
			  return amount;
			}
		     if (pulse>=bit0-tolerance && pulse<=middle) value<<=1;
		     else if (pulse>middle && pulse<=maxpulse) { value<<=1; value|=0x1; }
			  else { strcpy(errstring,"Pulse too long"); Error(8); }
		   }
	       if (soft && blocks>blockskip) checksum^=MirrorByte(value);
	       else checksum^=value;
	       if (amount==1) flag=value;
	       if (amount==explen-1)
	       chksum=value;
	       if (amount==0x11d2)
	       amount=amount+1-1;
	       PutData(&tempfile,value,1);
	     }
	 if (!checksum || ((slocktype || zeta) && blocks>blockskip && !SpeedEndBlock) ||
	      (soft)) DataLoadOK=1;
	 expectedlength=0;
       }
  return amount;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edi, %r14d
cmpb $0x0, 0xba47(%rip)      # 0xf1a9
je 0x3774
movsd 0xb97c(%rip), %xmm2     # 0xf0e8
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movapd %xmm1, %xmm4
addsd %xmm0, %xmm4
movsd 0x6b4c(%rip), %xmm3     # 0xa2d0
movsd 0x17fac(%rip), %xmm2    # 0x1b738
subsd %xmm1, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd 0x6b18(%rip), %xmm2     # 0xa2b8
cvttsd2si %xmm2, %eax
cvttsd2si %xmm1, %ecx
subsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
cvttsd2si %xmm1, %edx
movl $0xff, %esi
movl %eax, %edi
andl %esi, %edi
andl %esi, %ecx
cvttsd2si %xmm0, %r8d
andl %esi, %r8d
addl %ecx, %r8d
andl %esi, %edx
cmpl %edi, %r8d
cvtsi2sd %edx, %xmm2
movapd %xmm4, %xmm1
movsd %xmm2, 0x20(%rsp)
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %ebx
cmovael %eax, %ebx
cmpl $0x0, 0xba49(%rip)      # 0xf238
sete %al
cmpb $0x0, 0xb9ab(%rip)      # 0xf1a4
sete %cl
testb %cl, %al
jne 0x3809
cmpb $0x0, 0xb99f(%rip)      # 0xf1a6
je 0x3810
movb $0x0, 0x183c8(%rip)     # 0x1bbd8
mulsd %xmm3, %xmm4
xorl %eax, %eax
leaq 0xba33(%rip), %r13      # 0xf250
cmpq $0x20, %rax
je 0x382e
andl $0x0, (%rax,%r13)
addq $0x4, %rax
jmp 0x381d
movsd %xmm4, 0x10(%rsp)
andq $0x0, 0xb9cc(%rip)      # 0xf208
xorl %eax, %eax
movb %al, 0x17f64(%rip)      # 0x1b7a8
movb %al, 0x1838f(%rip)      # 0x1bbd9
leaq 0x6dd5(%rip), %rdi      # 0xa626
xorl %eax, %eax
movsd %xmm0, 0x18(%rsp)
callq 0x10b0
movzbl %bl, %r15d
movsd 0x18(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
testl %r14d, %r14d
movq %r15, 0x20(%rsp)
je 0x398b
andq $0x0, 0xb986(%rip)      # 0xf210
movl %r14d, %r12d
decl %r14d
xorl %ebx, %ebx
leaq 0x13c0f(%rip), %r13     # 0x174a8
cmpq %r12, %rbx
je 0x3deb
movq %r12, %rbp
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpb $0x8, %r12b
je 0x3912
callq 0x258c
movsd 0x18(%rsp), %xmm1
movl %eax, %ecx
cvtsi2sd %rcx, %xmm0
ucomisd %xmm0, %xmm1
movb 0x17de4(%rip), %cl      # 0x1b6b1
jbe 0x38d3
testb %cl, %cl
jne 0x38b1
orb %r12b, %cl
je 0x3973
ucomisd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
jb 0x38f3
ucomisd %xmm0, %xmm1
jb 0x38f3
addb %r15b, %r15b
jmp 0x390d
ucomisd %xmm1, %xmm0
jbe 0x4125
cmpl 0x20(%rsp), %eax
ja 0x4125
addb %r15b, %r15b
incb %r15b
incb %r12b
jmp 0x38ab
cmpb $0x0, 0xb889(%rip)      # 0xf1a2
movzbl %r15b, %r12d
movl %r15d, %eax
je 0x393b
movl 0xb8f0(%rip), %ecx      # 0xf218
movl %r15d, %eax
cmpl 0xb8eb(%rip), %ecx      # 0xf21c
jbe 0x393b
movl %r12d, %edi
callq 0x414f
xorb %al, 0x18297(%rip)      # 0x1bbd8
cmpq $0x1, %rbx
jne 0x394e
movb %r15b, 0x1828c(%rip)    # 0x1bbda
cmpq %r14, %rbx
jne 0x395a
movb %r15b, 0x18281(%rip)    # 0x1bbdb
movq %r13, %rdi
movl %r12d, %esi
pushq $0x1
popq %rdx
callq 0x1da7
incq %rbx
movq %rbp, %r12
jmp 0x3899
cmpb $0x0, 0x1825e(%rip)     # 0x1bbd8
jne 0x3983
movb $0x1, 0x18256(%rip)     # 0x1bbd9
movq %rbx, %r12
jmp 0x3dd9
movsd 0x693d(%rip), %xmm0     # 0xa2d0
addsd 0x10(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
xorl %r12d, %r12d
callq 0x1618
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpq $0x8, %rbp
je 0x3c0b
cmpb $0x0, 0x17dea(%rip)     # 0x1b7a8
jne 0x3c52
callq 0x258c
movsd 0x18(%rsp), %xmm1
movq %rax, %r14
movl %r14d, %edx
cvtsi2sd %rdx, %xmm0
ucomisd %xmm0, %xmm1
movb 0x17ccd(%rip), %al      # 0x1b6b1
jbe 0x39ea
testb %al, %al
jne 0x39c4
movl %r14d, %ecx
subl 0x2c(%rsp), %ecx
cmpl $0x1, %ecx
ja 0x3a1d
movl %r14d, %ecx
movq 0x17cc8(%rip), %rsi     # 0x1b6c8
subq %rsi, %rcx
subq %rsi, %rcx
cmpq $0x2, %rcx
movsd 0x10(%rsp), %xmm3
ja 0x3a33
cmpl %r15d, %r14d
jbe 0x3bd2
jmp 0x3a33
cmpl %r15d, %r14d
movsd 0x10(%rsp), %xmm3
jbe 0x3bd2
movq 0x17c95(%rip), %rsi     # 0x1b6c8
movq 0x17c86(%rip), %rcx     # 0x1b6c0
leaq (%rcx,%rsi), %rdi
cmpq %r15, %rdi
jbe 0x3a60
cmpb $0x7, %bpl
jne 0x3c57
movl %r14d, %edx
leaq (%rcx,%rcx), %rsi
subq %rsi, %rdx
js 0x3aa9
cvtsi2ss %rdx, %xmm0
jmp 0x3abe
cmpb $0x0, 0xb741(%rip)      # 0xf1a8
je 0x3af3
movq 0x13a2c(%rip), %rdi     # 0x174a0
leaq 0x6bc8(%rip), %rsi      # 0xa643
movl %r14d, %edx
xorl %eax, %eax
callq 0x1110
movsd 0x10(%rsp), %xmm3
movq 0x17c36(%rip), %rsi     # 0x1b6c8
movq 0x17c27(%rip), %rcx     # 0x1b6c0
leaq (%rcx,%rsi), %rdi
cmpb $0x0, 0xb704(%rip)      # 0xf1a8
sete %al
jmp 0x3af5
movq %rdx, %rsi
shrq %rsi
andl $0x1, %edx
orq %rsi, %rdx
cvtsi2ss %rdx, %xmm0
addss %xmm0, %xmm0
divss 0xb71a(%rip), %xmm0     # 0xf1e0
mulss 0x6916(%rip), %xmm0     # 0xa3e4
cvtss2sd %xmm0, %xmm0
addsd 0xb736(%rip), %xmm0     # 0xf210
movsd %xmm0, 0xb72e(%rip)     # 0xf210
addl %ecx, %ecx
movb $0x1, 0x17cbd(%rip)     # 0x1b7a8
movl %ecx, %r14d
jmp 0x3bd2
movb $0x1, %al
shrq %rdi
movl %r14d, %edx
addq %rdi, %rdx
movq %rdx, %xmm0
punpckldq 0x6905(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x690d(%rip), %xmm0     # 0xa420
movsd 0x679d(%rip), %xmm1     # 0xa2b8
cmpq %rsi, %rcx
jb 0x3b24
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
subsd %xmm3, %xmm2
addsd %xmm1, %xmm2
addsd %xmm2, %xmm2
cvttsd2si %xmm2, %r14
testb %al, %al
je 0x3b4e
pushq $0x7
popq %r15
subq %rbp, %r15
jmp 0x3bbc
movq 0x1394b(%rip), %rdi     # 0x174a0
movq %r12, %r13
movl %r14d, %r12d
cvtsi2sd %r12, %xmm0
xorl %ecx, %ecx
ucomisd %xmm3, %xmm0
seta %cl
leaq 0x6af9(%rip), %rsi      # 0xa669
movl %r14d, %edx
xorl %eax, %eax
callq 0x1110
movq 0x1391f(%rip), %rdi     # 0x174a0
movl 0xb691(%rip), %edx      # 0xf218
pushq $0x7
popq %r15
subq %rbp, %r15
movq 0xb62b(%rip), %r9       # 0xf1c0
subq %r12, %r9
movq %r13, %r12
leaq 0xb6ae(%rip), %r13      # 0xf250
leaq 0x6ad5(%rip), %rsi      # 0xa67e
movq %r12, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x1110
movsd 0x10(%rsp), %xmm3
movsd 0x18(%rsp), %xmm1
incl (%r13,%r15,4)
movb 0x17ae4(%rip), %al      # 0x1b6b1
movq 0x20(%rsp), %r15
movl %ebp, %ecx
orb %al, %cl
je 0x3da9
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
ucomisd %xmm1, %xmm0
jb 0x3bf4
ucomisd %xmm0, %xmm3
jb 0x3bf4
addb %bl, %bl
jmp 0x3c03
ucomisd %xmm3, %xmm0
jbe 0x3c03
cmpl %r15d, %r14d
ja 0x3c03
addb %bl, %bl
incb %bl
incq %rbp
jmp 0x39ad
testq %r12, %r12
jne 0x3c16
movb %bl, 0x17fc4(%rip)      # 0x1bbda
incq %r12
movb %bl, 0x17fbc(%rip)      # 0x1bbdb
movb 0x17fb3(%rip), %al      # 0x1bbd8
movl %eax, %ecx
xorb %bl, %cl
movb %cl, 0x17fa9(%rip)      # 0x1bbd8
cmpb %bl, %al
jne 0x3c3a
movq %r12, 0xb5ce(%rip)      # 0xf208
movzbl %bl, %esi
leaq 0x13864(%rip), %rdi     # 0x174a8
pushq $0x1
popq %rdx
callq 0x1da7
movb %bl, 0xf(%rsp)
jmp 0x3cce
xorl %r14d, %r14d
jmp 0x3cce
movzbl %bpl, %eax
testl %eax, %eax
jne 0x3c8a
cvtsi2ss %rdx, %xmm0
divss 0xb574(%rip), %xmm0     # 0xf1e0
mulss 0x6770(%rip), %xmm0     # 0xa3e4
cvtss2sd %xmm0, %xmm0
addsd 0xb590(%rip), %xmm0     # 0xf210
movsd %xmm0, 0xb588(%rip)     # 0xf210
jmp 0x3cc7
movb 0xb514(%rip), %al       # 0xf1a4
addb $-0x2, %al
cmpb $0x2, %al
ja 0x3cc7
movl 0xb580(%rip), %eax      # 0xf21c
incl %eax
cmpl %eax, 0xb574(%rip)      # 0xf218
jbe 0x3cc7
callq 0x16b7
movzbl 0xb5be(%rip), %edi      # 0xf270
movq 0xb51f(%rip), %rsi      # 0xf1d8
xorl %edx, %edx
callq 0x10d0
andl $0x0, 0xb6a9(%rip)      # 0xf370
movb $0x1, 0x17ada(%rip)     # 0x1b7a8
callq 0x1748
cmpb $0x0, 0x17ace(%rip)     # 0x1b7a8
je 0x39a4
movb 0x17ef2(%rip), %bl      # 0x1bbd8
testb %bl, %bl
sete %al
testq %r12, %r12
setne %cl
testb %cl, %al
jne 0x3d27
cmpb $0x0, 0xb4a5(%rip)      # 0xf1a1
jne 0x3d27
movl 0xb514(%rip), %edx      # 0xf218
movl 0xb512(%rip), %eax      # 0xf21c
cmpl %eax, %edx
jbe 0x3e38
testl %eax, %eax
je 0x3e38
cmpb $0x0, 0xb485(%rip)      # 0xf1a6
jne 0x3e38
movb $0x1, 0x17eab(%rip)     # 0x1bbd9
cmpb $0x0, 0xb473(%rip)      # 0xf1a8
je 0x3eb1
movq 0x1375e(%rip), %rdi     # 0x174a0
movl 0xb4d0(%rip), %edx      # 0xf218
leaq 0x6967(%rip), %rsi      # 0xa6b6
xorl %eax, %eax
callq 0x1110
movl 0xb4dc(%rip), %edx      # 0xf238
testl %edx, %edx
je 0x3d75
movq 0x13739(%rip), %rdi     # 0x174a0
leaq 0x6954(%rip), %rsi      # 0xa6c2
xorl %eax, %eax
callq 0x1110
cmpb $0x0, 0xb425(%rip)      # 0xf1a1
je 0x3e98
movl 0xb490(%rip), %eax      # 0xf218
movq 0x13711(%rip), %rcx     # 0x174a0
cmpl 0xb487(%rip), %eax      # 0xf21c
jb 0x3e9f
leaq 0x693d(%rip), %rdi      # 0xa6df
pushq $0x23
jmp 0x3ea8
cmpb $0x0, 0xb3f1(%rip)      # 0xf1a1
je 0x3dbb
cmpl $0x2, 0xb45f(%rip)      # 0xf218
ja 0x3dd2
cmpb $0x0, 0x17e16(%rip)     # 0x1bbd8
sete %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3dd9
movb $0x1, 0x17e00(%rip)     # 0x1bbd9
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x17de6(%rip)     # 0x1bbd8
je 0x3e28
movb 0xb3ab(%rip), %al       # 0xf1a5
orb 0xb3a4(%rip), %al       # 0xf1a4
je 0x3e1f
movl 0xb410(%rip), %eax      # 0xf218
cmpl 0xb40e(%rip), %eax      # 0xf21c
seta %al
cmpb $0x0, 0x17dc4(%rip)     # 0x1bbdc
sete %cl
testb %cl, %al
jne 0x3e28
cmpb $0x0, 0xb37c(%rip)      # 0xf1a2
je 0x3e2f
movb $0x1, 0x17daa(%rip)     # 0x1bbd9
andl $0x0, 0xb3ce(%rip)      # 0xf204
jmp 0x3dd9
movb 0xb366(%rip), %cl       # 0xf1a4
addb $-0x2, %cl
cmpb $0x2, %cl
ja 0x3e5a
testl %eax, %eax
sete %cl
incl %eax
cmpl %eax, %edx
setbe %al
orb %cl, %al
je 0x3d27
movq 0xb3a7(%rip), %rax      # 0xf208
testq %rax, %rax
setne %cl
movq %r12, %rsi
subq %rax, %rsi
cmpq $0x3, %rsi
setb %sil
andb %cl, %sil
cmpb $0x1, %sil
jne 0x403b
movb $0x0, 0x17d4f(%rip)     # 0x1bbd8
movb $0x1, 0x17d49(%rip)     # 0x1bbd9
movq %rax, %r12
jmp 0x3fcf
movq 0x13601(%rip), %rcx     # 0x174a0
leaq 0x682d(%rip), %rdi      # 0xa6d3
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
xorl %eax, %eax
xorl %ebx, %ebx
cmpq $0x20, %rax
je 0x3ec9
cmpl $0x2, (%rax,%r13)
sbbb $-0x1, %bl
addq $0x4, %rax
jmp 0x3eb5
testb %bl, %bl
je 0x3fcf
cmpb $0x0, 0xb2d0(%rip)      # 0xf1a8
je 0x3f16
movq 0x135bf(%rip), %rcx     # 0x174a0
leaq 0x681b(%rip), %rdi      # 0xa703
pushq $0x3e
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
cmpb $0x1, %bl
je 0x3f07
movq 0x135a1(%rip), %rsi     # 0x174a0
pushq $0x73
popq %rdi
callq 0x10f0
movq 0x13592(%rip), %rsi     # 0x174a0
pushq $0x20
popq %rdi
callq 0x10f0
movq %r13, %rbp
leaq 0x679f(%rip), %r15      # 0xa6bf
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x3f90
cmpl $0x2, (%rbp)
jb 0x3f87
cmpb $0x0, 0xb272(%rip)      # 0xf1a8
je 0x3f6f
movq 0x13561(%rip), %rdi     # 0x174a0
movq %r15, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x1110
decb %bl
cmpb $0x0, 0xb253(%rip)      # 0xf1a8
je 0x3f87
movq 0x13542(%rip), %rcx     # 0x174a0
testb %bl, %bl
je 0x3f73
pushq $0x2c
popq %rdi
movq %rcx, %rsi
callq 0x10f0
jmp 0x3f87
decb %bl
jmp 0x3f87
leaq 0x6be9(%rip), %rdi      # 0xab63
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
xorl %ebx, %ebx
incq %r13
addq $0x4, %rbp
jmp 0x3f23
cmpb $0x0, 0xb211(%rip)      # 0xf1a8
je 0x3fcf
movq 0x13500(%rip), %rcx     # 0x174a0
leaq 0x679b(%rip), %rdi      # 0xa742
pushq $0x4f
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
callq 0x1170
movq 0x134e3(%rip), %rcx     # 0x174a0
leaq 0x67ce(%rip), %rdi      # 0xa792
pushq $0x32
popq %rsi
movq %r15, %rdx
callq 0x1170
movsd 0xb239(%rip), %xmm0     # 0xf210
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4010
jp 0x4010
cmpl $0x0, 0xb24e(%rip)      # 0xf238
jne 0x4010
movl %r14d, %eax
cvtsi2ss %rax, %xmm0
divss 0xb1e4(%rip), %xmm0     # 0xf1e0
mulss 0x63e0(%rip), %xmm0     # 0xa3e4
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xb200(%rip)     # 0xf210
cmpb $0x0, 0xb191(%rip)      # 0xf1a8
je 0x3dd9
movq 0x1347c(%rip), %rcx     # 0x174a0
leaq 0x68cb(%rip), %rdi      # 0xa8f6
pushq $0x52
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
jmp 0x3dd9
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movb $0x0, 0x17b87(%rip)     # 0x1bbd9
cmpb $0x0, 0xb14f(%rip)      # 0xf1a8
je 0x4085
movq 0x1343e(%rip), %rdi     # 0x174a0
movzbl 0xf(%rsp), %r9d
movl %ebx, %eax
xorb %r9b, %al
movzbl %al, %ecx
movl %r9d, (%rsp)
leaq 0x674a(%rip), %rsi      # 0xa7c5
movl %ecx, %r8d
xorl %eax, %eax
callq 0x1110
movb $0x7, %cl
xorl %edx, %edx
xorl %eax, %eax
testb %cl, %cl
js 0x40c8
movzbl %cl, %r8d
movl (%r13,%r8,4), %edi
testl %edi, %edi
je 0x40c0
pushq $0x1
popq %rsi
shll %cl, %esi
movzbl %bl, %r9d
movzbl %sil, %r10d
cmpl %r9d, %r10d
ja 0x40c0
incl 0x30(%rsp,%r8,4)
incb %al
cmpl $0x1, %edi
cmovnel %edx, %esi
xorb %bl, %sil
movl %esi, %ebx
decb %cl
testb %bl, %bl
jne 0x408b
xorl %ebx, %ebx
cmpb $0x0, 0xb0d9(%rip)      # 0xf1a8
je 0x3fcf
movq 0x133c4(%rip), %rcx     # 0x174a0
testb %al, %al
je 0x4108
leaq 0x6773(%rip), %rdi      # 0xa85a
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
movq 0x133a7(%rip), %rcx     # 0x174a0
testb %bl, %bl
je 0x4113
leaq 0x67b2(%rip), %rdi      # 0xa8b6
pushq $0x3f
jmp 0x411c
leaq 0x66fc(%rip), %rdi      # 0xa80b
pushq $0x4e
jmp 0x411c
leaq 0x676d(%rip), %rdi      # 0xa887
pushq $0x2e
popq %rsi
pushq $0x1
popq %rdx
jmp 0x3fca
movabsq $0x676e6f6c206f6f, %rax # imm = 0x676E6F6C206F6F
movq %rax, 0x175a1(%rip)     # 0x1b6d7
movabsq $0x6f742065736c7550, %rax # imm = 0x6F742065736C7550
movq %rax, 0x17589(%rip)     # 0x1b6d0
pushq $0x8
popq %rdi
callq 0x13ed