// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: ReadBleeploadBlock
word ReadBleeploadBlock(void)
{
  word loaded=0;
  pilot.freq=808;
  syncx.freq=2450;
  bit0.freq=2044;
  bit1.freq=1022;
  SetTimings();
  pilotlength=0;
  DataLoadOK=0;
//  PushFilePointers();
  do
     do {
//        RemoveFilePointers();
	  pilotlength=0;
	  PilotSearch(50);
	  if (!blocktype) return 0; if (!PilotLinkingOK) { pilotlength=0; break;};
	  mspause=0;
	  SyncSearch();
	  if (!blocktype) return 0;
	  if (!SyncLoadOK)
	     {
	       if (searching) break;
	       if (pilotlength/samprate>0.5) WriteTZXTone(pilot.tstates,(pilotlength/pilot.samples)*2);
	       mspause+=(FindPause()/samprate)*1000;
	       if (mspause && pilotlength/samprate>0.5) WriteTZXPause(mspause);
	       break;
	     }
	  loaded=DataRead(bit0.samples,bit1.samples,expectedlength);
	  if (blocktype && !searching) mspause+=(FindPause()/samprate)*1000;
	}
     while (!DataLoadOK);
  while (!DataLoadOK);
//  PushFilePointers();
  ResetTempFile();
  return loaded;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movabsq $0x4089400000000000, %rax # imm = 0x4089400000000000
movq %rax, 0x16c70(%rip)     # 0x1b738
movabsq $0x40a3240000000000, %rax # imm = 0x40A3240000000000
movq %rax, 0x16c7f(%rip)     # 0x1b758
movabsq $0x409ff00000000000, %rax # imm = 0x409FF00000000000
movq %rax, 0x16c8e(%rip)     # 0x1b778
movabsq $0x408ff00000000000, %rax # imm = 0x408FF00000000000
movq %rax, 0x16c9d(%rip)     # 0x1b798
callq 0x2424
movq $0x0, 0x170d5(%rip) # 0x1bbe0
movb $0x0, 0x170d7(%rip)     # 0x1bbe9
xorl %ebx, %ebx
leaq 0xa66a(%rip), %r15      # 0xf185
leaq 0xe876(%rip), %r14      # 0x13398
movq $0x0, 0x170b3(%rip) # 0x1bbe0
movl $0x32, %edi
callq 0x2bfc
cmpb $0x0, 0x16b83(%rip)     # 0x1b6c1
je 0x4d7c
cmpb $0x0, 0x1708d(%rip)     # 0x1bbd8
je 0x4bbb
movq $0x0, 0xa6c8(%rip) # 0xf220
callq 0x2f5c
cmpb $0x0, 0x16b5d(%rip)     # 0x1b6c1
je 0x4d7c
cmpb $0x0, 0x16c49(%rip)     # 0x1b7ba
je 0x4bc8
movsd 0x16c0d(%rip), %xmm0    # 0x1b788
movsd 0x16c25(%rip), %xmm1    # 0x1b7a8
movl 0xa68b(%rip), %edi      # 0xf214
callq 0x39c9
movq %rax, %rbx
cmpb $0x0, 0x16b29(%rip)     # 0x1b6c1
je 0x4c23
cmpb $0x0, 0xa68d(%rip)      # 0xf232
jne 0x4c23
callq 0x4488
testq %rax, %rax
js 0x4be7
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x4bff
movq $0x0, 0x1701a(%rip) # 0x1bbe0
jmp 0x4c30
cmpb $0x0, 0xa663(%rip)      # 0xf232
jne 0x4c30
movq 0x17008(%rip), %rax     # 0x1bbe0
testq %rax, %rax
js 0x4c42
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x4c5c
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xa5e9(%rip), %xmm0     # 0xf1f0
mulss 0x67d5(%rip), %xmm0     # 0xb3e4
cvtss2sd %xmm0, %xmm0
addsd 0xa605(%rip), %xmm0     # 0xf220
movsd %xmm0, 0xa5fd(%rip)     # 0xf220
cmpb $0x0, 0x16fbf(%rip)     # 0x1bbe9
je 0x4b22
cmpb $0x0, 0x16fb2(%rip)     # 0x1bbe9
je 0x4b22
jmp 0x4d80
movq %rax, %rcx
shrq %rcx
movl %eax, %edx
andl $0x1, %edx
orq %rcx, %rdx
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
addss %xmm0, %xmm0
divss 0xa58c(%rip), %xmm0     # 0xf1f0
ucomiss 0x677d(%rip), %xmm0     # 0xb3e8
jbe 0x4caa
movq %rax, %xmm0
punpckldq 0x6796(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x679e(%rip), %xmm0     # 0xb420
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x16ab2(%rip), %xmm1    # 0x1b748
movl 0x16ab4(%rip), %edi     # 0x1b750
addsd %xmm1, %xmm1
cvttsd2si %xmm1, %rsi
callq 0x3321
callq 0x4488
testq %rax, %rax
js 0x4cbe
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0x4cd6
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
movss 0xa512(%rip), %xmm0     # 0xf1f0
divss %xmm0, %xmm1
mulss 0x66fa(%rip), %xmm1     # 0xb3e4
cvtss2sd %xmm1, %xmm1
addsd 0xa52a(%rip), %xmm1     # 0xf220
movsd %xmm1, 0xa522(%rip)     # 0xf220
ucomisd 0x6622(%rip), %xmm1     # 0xb328
jne 0x4d0e
jnp 0x4c30
movq 0x16ecb(%rip), %rax     # 0x1bbe0
testq %rax, %rax
js 0x4d24
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
jmp 0x4d3c
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm2, %xmm2
cvtsi2ss %rax, %xmm2
addss %xmm2, %xmm2
divss %xmm0, %xmm2
ucomiss 0x66a1(%rip), %xmm2     # 0xb3e8
jbe 0x4c30
cvttsd2si %xmm1, %rax
movw %ax, 0xa42d(%rip)       # 0xf186
xorl %r12d, %r12d
movzbl (%r12,%r15), %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x1e21
incq %r12
cmpq $0x3, %r12
jne 0x4d5c
jmp 0x4c30
xorl %ebx, %ebx
jmp 0x4d85
callq 0x161f
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq