// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: WriteTZXTurboBlock
void WriteTZXTurboBlock(dword lpilot,byte lastbyte,dword datalen)
{
  dword count;
  word pilotpulses=2*lpilot/pilot.samples;
  PushFilePointers();
  turboblock[1]=Lo(pilot.tstates); turboblock[2]=Hi(pilot.tstates);
  turboblock[3]=Lo(syncx.tstates); turboblock[4]=Hi(syncx.tstates);
  turboblock[5]=Lo(syncx.tstates); turboblock[6]=Hi(syncx.tstates);
  turboblock[7]=Lo(bit0.tstates); turboblock[8]=Hi(bit0.tstates);
  turboblock[9]=Lo(bit1.tstates); turboblock[10]=Hi(bit1.tstates);
  turboblock[11]=Lo(pilotpulses); turboblock[12]=Hi(pilotpulses);
  turboblock[13]=lastbyte;
  turboblock[14]=Lo(mspause); turboblock[15]=Hi(mspause);
  turboblock[16]=Lo(datalen); turboblock[17]=Hi(datalen); turboblock[18]=Ehi(datalen);
  for (count=0; count<sizeof(turboblock); count++) PutData(&outfile,turboblock[count],1);
  ResetTempFile();
  for (count=0; count<datalen; count++) PutData(&outfile,GetData(&tempfile),1);
  PopFilePointers();
  lseek(inpfile.handle,filepos,SEEK_SET);
  inpfile.bufpoint=0;
  ResetTempFile();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
addq %rdi, %rdi
movq %rdi, %xmm0
punpckldq 0x5c7d(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5c85(%rip), %xmm0     # 0xb420
movl %esi, %ebp
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x15f97(%rip), %xmm1    # 0x1b748
cvttsd2si %xmm1, %r14
callq 0x165a
movzwl 0x15f8e(%rip), %eax     # 0x1b750
movw %ax, 0x9998(%rip)       # 0xf161
movl 0x15fa1(%rip), %eax     # 0x1b770
movb %al, 0x998e(%rip)       # 0xf163
movl %eax, %ecx
shrl $0x8, %ecx
movb %cl, 0x9984(%rip)       # 0xf164
movb %al, 0x997f(%rip)       # 0xf165
movb %cl, 0x997a(%rip)       # 0xf166
movzwl 0x15f9d(%rip), %eax     # 0x1b790
movw %ax, 0x996d(%rip)       # 0xf167
movl 0x15fb0(%rip), %eax     # 0x1b7b0
movb %al, 0x9963(%rip)       # 0xf169
movb %ah, 0x995e(%rip)       # 0xf16a
movq %r14, %rax
movb %al, 0x9956(%rip)       # 0xf16b
movb %ah, 0x9951(%rip)       # 0xf16c
movb %bpl, 0x994b(%rip)      # 0xf16d
movsd 0x99f6(%rip), %xmm0     # 0xf220
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
subsd 0x5aca(%rip), %xmm0     # 0xb308
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rcx, %rax
movb %al, 0x991f(%rip)       # 0xf16e
movb %ah, 0x991a(%rip)       # 0xf16f
movb %bl, 0x9915(%rip)       # 0xf170
movb %bh, 0x9910(%rip)       # 0xf171
movl %ebx, %eax
shrl $0x10, %eax
movb %al, 0x9906(%rip)       # 0xf172
xorl %r15d, %r15d
leaq 0x98ea(%rip), %r12      # 0xf160
leaq 0xdb1b(%rip), %r14      # 0x13398
movzbl (%r15,%r12), %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x1e21
incq %r15
cmpq $0x13, %r15
jne 0x587d
callq 0x161f
testq %rbx, %rbx
je 0x58cd
leaq 0x11c0f(%rip), %r14     # 0x174b8
leaq 0xdae8(%rip), %r15      # 0x13398
movq %r14, %rdi
callq 0x1db5
movzbl %al, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x1e21
decq %rbx
jne 0x58b0
callq 0x16fb
movzbl 0x99a7(%rip), %edi      # 0xf280
movq 0x9908(%rip), %rsi      # 0xf1e8
xorl %edx, %edx
callq 0x10d0
movl $0x0, 0x9a8f(%rip)      # 0xf380
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x161f