// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ReadNormalBlock
word ReadNormalBlock(void)
{
  word loaded=0;
  pilot.freq=808;
  syncx.freq=2450;
  bit0.freq=2044;
  bit1.freq=1022;
  SetTimings();
  DataLoadOK=0;
  pilotlength=0;
  do {
       do {
		printf("Searching pilot...       \x0d");
		PilotSearch(256);
		if (!blocktype) return 0; if (!PilotLinkingOK) { pilotlength=0; break;}
		mspause=0;
		SyncSearch();
		if (!blocktype) return 0; if (!SyncLoadOK) break;
		loaded=DataRead(bit0.samples,bit1.samples,expectedlength);
		if (blocktype && ((slocktype<3 || slocktype>6) || blocks!=blockskip)) mspause+=(FindPause()/samprate)*1000;
		else mspause+=7;
	  }
       while (!DataLoadOK);
     }
  while (!DataLoadOK);
  ResetTempFile();
  if (loaded==19)
     {
       byte count;
       dword savefilepos=filepos;
       ResetTempFile();
       if (GetData(&tempfile)==0)
	  {
	    header.type=GetData(&tempfile);
	    for (count=0; count<10; count++)
		{
		  header.name[count]=GetData(&tempfile);
		  if (header.name[count]<' ') header.name[count]='*';
		}
	    header.name[10]=0;
	    header.length=(byte)(GetData(&tempfile));
	    header.length+=(word)(256*GetData(&tempfile));
	    header.start=(byte)(GetData(&tempfile));
	    header.start+=(word)(256*GetData(&tempfile));
	    expectedlength=(header.length)+2;
	    if (header.type==0) nxtloadpos=header.start=23755;
	    else nxtloadpos=header.start;
	  }
       filepos=savefilepos;
     }
  else {
	 if (header.type>3) header.start=0;
	 header.type=0xf;
       }
  return loaded;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movabsq $0x4089400000000000, %rax # imm = 0x4089400000000000
movq %rax, 0x1727e(%rip)     # 0x1b738
movabsq $0x40a3240000000000, %rax # imm = 0x40A3240000000000
movq %rax, 0x1728d(%rip)     # 0x1b758
movabsq $0x409ff00000000000, %rax # imm = 0x409FF00000000000
movq %rax, 0x1729c(%rip)     # 0x1b778
movabsq $0x408ff00000000000, %rax # imm = 0x408FF00000000000
movq %rax, 0x172ab(%rip)     # 0x1b798
callq 0x240d
movb $0x0, 0x176f0(%rip)     # 0x1bbe9
movq $0x0, 0x176dc(%rip) # 0x1bbe0
xorl %ebx, %ebx
leaq 0x74d9(%rip), %r14      # 0xb9e6
xorl %ebp, %ebp
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movl $0x100, %edi            # imm = 0x100
callq 0x2ba3
cmpb $0x0, 0x17197(%rip)     # 0x1b6c1
je 0x4747
cmpb $0x0, 0x176a1(%rip)     # 0x1bbd8
je 0x45c8
movq $0x0, 0xacd8(%rip) # 0xf220
callq 0x2edd
cmpb $0x0, 0x1716d(%rip)     # 0x1b6c1
je 0x4747
cmpb $0x0, 0x17259(%rip)     # 0x1b7ba
je 0x45d3
movsd 0x1721d(%rip), %xmm0    # 0x1b788
movsd 0x17235(%rip), %xmm1    # 0x1b7a8
movl 0xac9b(%rip), %edi      # 0xf214
callq 0x38de
movq %rax, %rbx
cmpb $0x0, 0x17139(%rip)     # 0x1b6c1
movsd 0x6d90(%rip), %xmm0     # 0xb320
je 0x460e
movb 0xac1c(%rip), %al       # 0xf1b4
addb $-0x7, %al
cmpb $-0x4, %al
jb 0x45b4
movl 0xac84(%rip), %eax      # 0xf228
movsd 0x6d74(%rip), %xmm0     # 0xb320
cmpl 0xac7a(%rip), %eax      # 0xf22c
je 0x460e
callq 0x43aa
testq %rax, %rax
js 0x45e2
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x45fa
movq $0x0, 0x1760d(%rip) # 0x1bbe0
cmpb $0x0, 0x1760f(%rip)     # 0x1bbe9
je 0x450f
jmp 0x4620
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xabee(%rip), %xmm0     # 0xf1f0
mulss 0x6dda(%rip), %xmm0     # 0xb3e4
cvtss2sd %xmm0, %xmm0
addsd 0xac0a(%rip), %xmm0     # 0xf220
movsd %xmm0, 0xac02(%rip)     # 0xf220
jmp 0x45d3
callq 0x161e
cmpl $0x13, %ebx
jne 0x472b
movq 0xabb3(%rip), %r14      # 0xf1e8
callq 0x161e
leaq 0x12e77(%rip), %rdi     # 0x174b8
callq 0x1d8c
testb %al, %al
jne 0x471d
leaq 0x12e63(%rip), %rbx     # 0x174b8
movq %rbx, %rdi
callq 0x1d8c
movb %al, 0x1758d(%rip)      # 0x1bbf0
movl $0x1, %r15d
leaq 0x17580(%rip), %r12     # 0x1bbf0
movl $0x2a, %ebp
movq %rbx, %rdi
callq 0x1d8c
cmpb $0x20, %al
movzbl %al, %eax
cmovll %ebp, %eax
movb %al, (%r15,%r12)
incq %r15
cmpq $0xb, %r15
jne 0x4675
movb $0x0, 0x17562(%rip)     # 0x1bbfb
leaq 0x12e18(%rip), %rbx     # 0x174b8
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
movl %eax, 0x1754b(%rip)     # 0x1bbfc
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
addl %eax, 0x17537(%rip)     # 0x1bbfc
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
movl %eax, 0x1752a(%rip)     # 0x1bc00
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
addl 0x17516(%rip), %eax     # 0x1bc00
movl %eax, 0x17510(%rip)     # 0x1bc00
movl 0x17506(%rip), %ecx     # 0x1bbfc
addl $0x2, %ecx
movl %ecx, 0xab15(%rip)      # 0xf214
cmpb $0x0, 0x174ea(%rip)     # 0x1bbf0
jne 0x4717
movl $0x5ccb, 0x174ee(%rip)  # imm = 0x5CCB
movl $0x5ccb, %eax           # imm = 0x5CCB
movl %eax, 0xaaf3(%rip)      # 0xf210
movq %r14, 0xaac4(%rip)      # 0xf1e8
movl $0x13, %ebp
jmp 0x4747
cmpb $0x4, 0x174be(%rip)     # 0x1bbf0
jb 0x473e
movl $0x0, 0x174c2(%rip)     # 0x1bc00
movb $0xf, 0x174ab(%rip)     # 0x1bbf0
movl %ebx, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq