// File: /workspace/github_c_makefile_star2_O1/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, 0x879c(%rip)      # 0xf0f0
je 0x6acb
cmpb $0x9, 0x87f6(%rip)      # 0xf157
ja 0x6b43
testl %ebx, %ebx
je 0x6ac1
xorl %r14d, %r14d
movdqa 0x4ab6(%rip), %xmm7     # 0xb430
movdqa 0x4add(%rip), %xmm8     # 0xb460
pshufd $0xf5, %xmm8, %xmm9     # xmm9 = xmm8[1,1,3,3]
movapd 0x4ade(%rip), %xmm10    # 0xb470
movsd 0x48e5(%rip), %xmm11    # 0xb280
leaq 0x14e1e(%rip), %r15     # 0x1b7c0
movdqa 0x4ad5(%rip), %xmm12    # 0xb480
movdqa %xmm9, (%rsp)
movss 0x8837(%rip), %xmm1     # 0xf1f0
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
divss 0x4a1c(%rip), %xmm1     # 0xb3e4
cvtss2sd %xmm1, %xmm1
movlhps %xmm1, %xmm1            # xmm1 = xmm1[0,0]
xorl %eax, %eax
movdqa 0x4a77(%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 0x6a39
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 0x6a61
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 0x69d9
movl $0xf3, %edi
callq 0x3374
movdqa 0x49f7(%rip), %xmm12    # 0xb480
movsd 0x47ee(%rip), %xmm11    # 0xb280
movapd 0x49d5(%rip), %xmm10    # 0xb470
movdqa (%rsp), %xmm9
movdqa 0x49b6(%rip), %xmm8     # 0xb460
movdqa 0x497e(%rip), %xmm7     # 0xb430
incb %r14b
movzbl %r14b, %eax
cmpl %ebx, %eax
jb 0x69b1
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movss 0x871d(%rip), %xmm0     # 0xf1f0
divss 0x4909(%rip), %xmm0     # 0xb3e4
cvtss2sd %xmm0, %xmm1
xorpd %xmm2, %xmm2
movb $-0xd, %al
movsd 0x4853(%rip), %xmm3     # 0xb340
movsd 0x47c3(%rip), %xmm4     # 0xb2b8
xorps %xmm0, %xmm0
movapd %xmm2, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm1, %xmm5
addsd %xmm5, %xmm0
addsd %xmm4, %xmm2
decb %al
jne 0x6af8
movl %ebx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movl 0x14c8c(%rip), %edi     # 0x1b7b0
divsd 0x14c7c(%rip), %xmm0    # 0x1b7a8
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x3321
movw %bx, 0x8642(%rip)       # 0xf18c
xorl %r14d, %r14d
leaq 0x8637(%rip), %r15      # 0xf18b
leaq 0xc83d(%rip), %rbx      # 0x13398
movzbl (%r14,%r15), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1e21
incq %r14
cmpq $0x3, %r14
jne 0x6b5b
movss 0x8672(%rip), %xmm1     # 0xf1f0
cvtss2sd %xmm1, %xmm0
divss 0x485a(%rip), %xmm1     # 0xb3e4
cvtss2sd %xmm1, %xmm1
movlhps %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movdqa 0x48b7(%rip), %xmm2     # 0xb450
xorl %eax, %eax
movdqa 0x488d(%rip), %xmm3     # 0xb430
movdqa 0x48b5(%rip), %xmm4     # 0xb460
pshufd $0xf5, %xmm4, %xmm5     # xmm5 = xmm4[1,1,3,3]
movapd 0x48b8(%rip), %xmm6     # 0xb470
movsd 0x46c0(%rip), %xmm7     # 0xb280
leaq 0x14bf9(%rip), %rcx     # 0x1b7c0
movdqa 0x48b0(%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 0x6c3c
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 0x6c68
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 0x6bd0
movl $0xf3, %edi
callq 0x3374
movzbl 0x8500(%rip), %esi      # 0xf18e
leaq 0xc703(%rip), %rdi      # 0x13398
movl $0x1, %edx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x1e21