// File: /workspace/github_c_makefile_star2_O2/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 0x50f2(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x50fa(%rip), %xmm0     # 0xa420
movl %esi, %ebp
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x163fc(%rip), %xmm1    # 0x1b738
cvttsd2si %xmm1, %r14
callq 0x1618
movzwl 0x163f3(%rip), %eax     # 0x1b740
movw %ax, 0x9dfd(%rip)       # 0xf151
movl 0x16406(%rip), %eax     # 0x1b760
movb %al, 0x9df3(%rip)       # 0xf153
movl %eax, %ecx
shrl $0x8, %ecx
movb %cl, 0x9de9(%rip)       # 0xf154
movb %al, 0x9de4(%rip)       # 0xf155
movb %cl, 0x9ddf(%rip)       # 0xf156
movzwl 0x16402(%rip), %eax     # 0x1b780
movw %ax, 0x9dd2(%rip)       # 0xf157
movl 0x16415(%rip), %eax     # 0x1b7a0
movb %al, 0x9dc8(%rip)       # 0xf159
movb %ah, 0x9dc3(%rip)       # 0xf15a
movq %r14, %rax
movb %al, 0x9dbb(%rip)       # 0xf15b
movb %ah, 0x9db6(%rip)       # 0xf15c
movsd 0x9e62(%rip), %xmm0     # 0xf210
cvttsd2si %xmm0, %rcx
movb %bpl, 0x9da3(%rip)      # 0xf15d
movq %rcx, %rdx
subsd 0x4f43(%rip), %xmm0     # 0xa308
sarq $0x3f, %rdx
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rcx, %rax
movb %al, 0x9d84(%rip)       # 0xf15e
movb %ah, 0x9d7f(%rip)       # 0xf15f
movb %bl, 0x9d7a(%rip)       # 0xf160
movb %bh, 0x9d75(%rip)       # 0xf161
movl %ebx, %eax
shrl $0x10, %eax
movb %al, 0x9d6b(%rip)       # 0xf162
xorl %r15d, %r15d
leaq 0x9d4f(%rip), %r12      # 0xf150
leaq 0xdf80(%rip), %r14      # 0x13388
pushq $0x1
popq %rbp
cmpq $0x13, %r15
je 0x5425
movzbl (%r15,%r12), %esi
movq %r14, %rdi
movl %ebp, %edx
callq 0x1da7
incq %r15
jmp 0x540b
callq 0x15e9
leaq 0x12077(%rip), %r14     # 0x174a8
leaq 0xdf50(%rip), %r15      # 0x13388
pushq $0x1
popq %rbp
subq $0x1, %rbx
jb 0x5458
movq %r14, %rdi
callq 0x1d32
movzbl %al, %esi
movq %r15, %rdi
movl %ebp, %edx
callq 0x1da7
jmp 0x543b
callq 0x16b7
movzbl 0x9e0c(%rip), %edi      # 0xf270
movq 0x9d6d(%rip), %rsi      # 0xf1d8
xorl %edx, %edx
callq 0x10d0
andl $0x0, 0x9ef7(%rip)      # 0xf370
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x15e9