// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: WriteDecryptWaves
void WriteDecryptWaves(word wavnum)
{
  if (hifi)
     {
       if (tzxhead[9]<0x0a)
	  {
	    byte count1,count2;
	    for (count1=0; count1<wavnum; count1++)
		{
		  for (count2=0; count2<243; count2++)
		      {
			pulseseq[count2]=3500000/(samprate/((samprate/1000)-count2*.1345));
		      }
		  WriteTZXPulseSequence(243);
		}
	  }
       else {
	      byte count;
	      WriteTZXLoopStart(wavnum);
	      for (count=0; count<243; count++)
		  {
		    pulseseq[count]=3500000/(samprate/((samprate/1000)-count*.1345));
		  }
	      WriteTZXPulseSequence(243);
	      WriteTZXLoopEnd();
	    }
     }
  else {
	 double totsamp=0;
	 byte count;
	 for (count=0; count<243; count++) totsamp+=(samprate/1000)-count*.1345;
	 totsamp*=wavnum;
	 WriteTZXTone(bit1.tstates,(totsamp/bit1.samples)*2);
       }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
cmpb $0x0, 0x8851(%rip)      # 0xf0f0
je 0x6a16
cmpb $0x9, 0x88ab(%rip)      # 0xf157
ja 0x6a8e
testl %ebx, %ebx
je 0x6a0c
xorl %r14d, %r14d
movdqa 0x4b6b(%rip), %xmm7     # 0xb430
movdqa 0x4b92(%rip), %xmm8     # 0xb460
pshufd $0xf5, %xmm8, %xmm9     # xmm9 = xmm8[1,1,3,3]
movapd 0x4b93(%rip), %xmm10    # 0xb470
movsd 0x499a(%rip), %xmm11    # 0xb280
leaq 0x14ed3(%rip), %r15     # 0x1b7c0
movdqa 0x4b8a(%rip), %xmm12    # 0xb480
movdqa %xmm9, (%rsp)
movss 0x88ec(%rip), %xmm1     # 0xf1f0
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
divss 0x4ad1(%rip), %xmm1     # 0xb3e4
cvtss2sd %xmm1, %xmm1
movlhps %xmm1, %xmm1            # xmm1 = xmm1[0,0]
xorl %eax, %eax
movdqa 0x4b2c(%rip), %xmm2     # 0xb450
movdqa %xmm2, %xmm3
pxor %xmm7, %xmm3
movdqa %xmm8, %xmm4
pcmpgtd %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm3     # xmm3 = xmm3[1,1,3,3]
pcmpeqd %xmm9, %xmm3
pand %xmm4, %xmm3
leal 0x1(%rax), %ecx
movzbl %cl, %ecx
movzbl %al, %edx
movd %edx, %xmm4
pinsrw $0x2, %ecx, %xmm4
cvtdq2pd %xmm4, %xmm4
mulpd %xmm10, %xmm4
addpd %xmm1, %xmm4
movd %xmm3, %ecx
testb $0x1, %cl
je 0x6984
movaps %xmm0, %xmm5
divsd %xmm4, %xmm5
movapd %xmm11, %xmm6
divsd %xmm5, %xmm6
cvttsd2si %xmm6, %rcx
movl %ecx, (%r15,%rax,4)
pextrw $0x4, %xmm3, %ecx
testb $0x1, %cl
je 0x69ac
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
movaps %xmm0, %xmm3
divsd %xmm4, %xmm3
movapd %xmm11, %xmm4
divsd %xmm3, %xmm4
cvttsd2si %xmm4, %rcx
movl %ecx, 0x4(%r15,%rax,4)
addq $0x2, %rax
paddq %xmm12, %xmm2
cmpq $0xf4, %rax
jne 0x6924
movl $0xf3, %edi
callq 0x32ed
movdqa 0x4aac(%rip), %xmm12    # 0xb480
movsd 0x48a3(%rip), %xmm11    # 0xb280
movapd 0x4a8a(%rip), %xmm10    # 0xb470
movdqa (%rsp), %xmm9
movdqa 0x4a6b(%rip), %xmm8     # 0xb460
movdqa 0x4a33(%rip), %xmm7     # 0xb430
incb %r14b
movzbl %r14b, %eax
cmpl %ebx, %eax
jb 0x68fc
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movss 0x87d2(%rip), %xmm0     # 0xf1f0
divss 0x49be(%rip), %xmm0     # 0xb3e4
cvtss2sd %xmm0, %xmm1
xorpd %xmm2, %xmm2
movb $-0xd, %al
movsd 0x4908(%rip), %xmm3     # 0xb340
movsd 0x4878(%rip), %xmm4     # 0xb2b8
xorps %xmm0, %xmm0
movapd %xmm2, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm1, %xmm5
addsd %xmm5, %xmm0
addsd %xmm4, %xmm2
decb %al
jne 0x6a43
movl %ebx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movl 0x14d41(%rip), %edi     # 0x1b7b0
divsd 0x14d31(%rip), %xmm0    # 0x1b7a8
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x329a
movw %bx, 0x86f7(%rip)       # 0xf18c
xorl %r14d, %r14d
leaq 0x86ec(%rip), %r15      # 0xf18b
leaq 0xc8f2(%rip), %rbx      # 0x13398
movzbl (%r14,%r15), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1e01
incq %r14
cmpq $0x3, %r14
jne 0x6aa6
movss 0x8727(%rip), %xmm1     # 0xf1f0
cvtss2sd %xmm1, %xmm0
divss 0x490f(%rip), %xmm1     # 0xb3e4
cvtss2sd %xmm1, %xmm1
movlhps %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movdqa 0x496c(%rip), %xmm2     # 0xb450
xorl %eax, %eax
movdqa 0x4942(%rip), %xmm3     # 0xb430
movdqa 0x496a(%rip), %xmm4     # 0xb460
pshufd $0xf5, %xmm4, %xmm5     # xmm5 = xmm4[1,1,3,3]
movapd 0x496d(%rip), %xmm6     # 0xb470
movsd 0x4775(%rip), %xmm7     # 0xb280
leaq 0x14cae(%rip), %rcx     # 0x1b7c0
movdqa 0x4965(%rip), %xmm8     # 0xb480
movdqa %xmm2, %xmm9
pxor %xmm3, %xmm9
movdqa %xmm4, %xmm10
pcmpgtd %xmm9, %xmm10
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
pcmpeqd %xmm5, %xmm9
pand %xmm10, %xmm9
leal 0x1(%rax), %edx
movzbl %dl, %edx
movzbl %al, %esi
movd %esi, %xmm10
pinsrw $0x2, %edx, %xmm10
cvtdq2pd %xmm10, %xmm10
mulpd %xmm6, %xmm10
addpd %xmm1, %xmm10
movd %xmm9, %edx
testb $0x1, %dl
je 0x6b87
movaps %xmm0, %xmm11
divsd %xmm10, %xmm11
movapd %xmm7, %xmm12
divsd %xmm11, %xmm12
cvttsd2si %xmm12, %rdx
movl %edx, (%rcx,%rax,4)
pextrw $0x4, %xmm9, %edx
testb $0x1, %dl
je 0x6bb3
unpckhpd %xmm10, %xmm10          # xmm10 = xmm10[1,1]
movaps %xmm0, %xmm9
divsd %xmm10, %xmm9
movapd %xmm7, %xmm10
divsd %xmm9, %xmm10
cvttsd2si %xmm10, %rdx
movl %edx, 0x4(%rcx,%rax,4)
addq $0x2, %rax
paddq %xmm8, %xmm2
cmpq $0xf4, %rax
jne 0x6b1b
movl $0xf3, %edi
callq 0x32ed
movzbl 0x85b5(%rip), %esi      # 0xf18e
leaq 0xc7b8(%rip), %rdi      # 0x13398
movl $0x1, %edx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x1e01