// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movb %sil, %al
movq %rdi, 0x30(%rsp)
movb %al, 0x2f(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rax
addq %rax, %rax
movq %rax, %xmm0
movaps 0x88e7(%rip), %xmm1     # 0xfb70
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x88eb(%rip), %xmm1     # 0xfb80
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x1847c(%rip), %xmm1    # 0x1f728
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0x14(%rsp)
callq 0x18e0
movl 0x1846c(%rip), %eax     # 0x1f730
movl %eax, %edi
callq 0x2560
movb %al, 0xbe70(%rip)       # 0x13141
movl 0x18459(%rip), %eax     # 0x1f730
movl %eax, %edi
callq 0x2520
movb %al, 0xbe5e(%rip)       # 0x13142
movl 0x18466(%rip), %eax     # 0x1f750
movl %eax, %edi
callq 0x2560
movb %al, 0xbe4c(%rip)       # 0x13143
movl 0x18453(%rip), %eax     # 0x1f750
movl %eax, %edi
callq 0x2520
movb %al, 0xbe3a(%rip)       # 0x13144
movl 0x18440(%rip), %eax     # 0x1f750
movl %eax, %edi
callq 0x2560
movb %al, 0xbe28(%rip)       # 0x13145
movl 0x1842d(%rip), %eax     # 0x1f750
movl %eax, %edi
callq 0x2520
movb %al, 0xbe16(%rip)       # 0x13146
movl 0x1843a(%rip), %eax     # 0x1f770
movl %eax, %edi
callq 0x2560
movb %al, 0xbe04(%rip)       # 0x13147
movl 0x18427(%rip), %eax     # 0x1f770
movl %eax, %edi
callq 0x2520
movb %al, 0xbdf2(%rip)       # 0x13148
movl 0x18434(%rip), %eax     # 0x1f790
movl %eax, %edi
callq 0x2560
movb %al, 0xbde0(%rip)       # 0x13149
movl 0x18421(%rip), %eax     # 0x1f790
movl %eax, %edi
callq 0x2520
movb %al, 0xbdce(%rip)       # 0x1314a
movl 0x14(%rsp), %eax
movl %eax, %edi
callq 0x2560
movb %al, 0xbdbe(%rip)       # 0x1314b
movl 0x14(%rsp), %eax
movl %eax, %edi
callq 0x2520
movb %al, 0xbdae(%rip)       # 0x1314c
movb 0x2f(%rsp), %al
movb %al, 0xbda5(%rip)       # 0x1314d
movsd 0xbe50(%rip), %xmm0     # 0x13200
movsd 0x8690(%rip), %xmm2     # 0xfa48
movsd %xmm2, 0x8(%rsp)
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rdi
movq %rdi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rdi
callq 0x2560
movsd 0x8(%rsp), %xmm2
movb %al, 0xbd61(%rip)       # 0x1314e
movsd 0xbe0b(%rip), %xmm0     # 0x13200
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rdi
movq %rdi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rdi
callq 0x2520
movb %al, 0xbd31(%rip)       # 0x1314f
movq 0x20(%rsp), %rdi
callq 0x2560
movb %al, 0xbd22(%rip)       # 0x13150
movq 0x20(%rsp), %rdi
callq 0x2520
movb %al, 0xbd13(%rip)       # 0x13151
movq 0x20(%rsp), %rdi
callq 0x2510
movb %al, 0xbd04(%rip)       # 0x13152
movq $0x0, 0x18(%rsp)
cmpq $0x13, 0x18(%rsp)
jae 0x7490
movq 0x18(%rsp), %rcx
leaq 0xff0d(%rip), %rdi      # 0x17378
movl $0x1, %edx
leaq 0xbcc9(%rip), %rax      # 0x13140
movzbl (%rax,%rcx), %esi
callq 0x2440
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x7457
callq 0x18a0
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
jae 0x74da
leaq 0x13fe7(%rip), %rdi     # 0x1b498
callq 0x2370
leaq 0xfebb(%rip), %rdi      # 0x17378
movl $0x1, %edx
movzbl %al, %esi
callq 0x2440
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x749e
callq 0x1a10
movzbl 0xbd7a(%rip), %edi      # 0x13260
movq 0xbcdb(%rip), %rsi      # 0x131c8
xorl %edx, %edx
callq 0x10b0
movl $0x0, 0xbe62(%rip)      # 0x13360
callq 0x18a0
addq $0x38, %rsp
retq
nopl (%rax,%rax)