// File: /workspace/github_c_makefile_star2_O2/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, 0x174b9(%rip)     # 0x1b728
movabsq $0x40a3240000000000, %rax # imm = 0x40A3240000000000
movq %rax, 0x174c8(%rip)     # 0x1b748
movabsq $0x409ff00000000000, %rax # imm = 0x409FF00000000000
movq %rax, 0x174d7(%rip)     # 0x1b768
movabsq $0x408ff00000000000, %rax # imm = 0x408FF00000000000
movq %rax, 0x174e6(%rip)     # 0x1b788
callq 0x2397
movb $0x0, 0x1792b(%rip)     # 0x1bbd9
andq $0x0, 0x1791a(%rip)     # 0x1bbd0
xorl %ebx, %ebx
leaq 0x66c7(%rip), %r14      # 0xa986
xorl %ebp, %ebp
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movl $0x100, %edi            # imm = 0x100
callq 0x2a7c
cmpb $0x0, 0x173d5(%rip)     # 0x1b6b1
je 0x44e5
cmpb $0x0, 0x178df(%rip)     # 0x1bbc8
je 0x4374
andq $0x0, 0xaf19(%rip)      # 0xf210
callq 0x2dad
cmpb $0x0, 0x173ae(%rip)     # 0x1b6b1
je 0x44e5
cmpb $0x0, 0x1749a(%rip)     # 0x1b7aa
je 0x437c
movsd 0x1745e(%rip), %xmm0    # 0x1b778
movsd 0x17476(%rip), %xmm1    # 0x1b798
movl 0xaedc(%rip), %edi      # 0xf204
callq 0x374a
movq %rax, %rbx
cmpb $0x0, 0x1737a(%rip)     # 0x1b6b1
movsd 0x5fe1(%rip), %xmm0     # 0xa320
je 0x43b4
movb 0xae5d(%rip), %al       # 0xf1a4
addb $-0x7, %al
cmpb $-0x4, %al
jb 0x4363
movl 0xaec5(%rip), %eax      # 0xf218
movsd 0x5fc5(%rip), %xmm0     # 0xa320
cmpl 0xaebb(%rip), %eax      # 0xf21c
je 0x43b4
callq 0x4167
testq %rax, %rax
js 0x438b
cvtsi2ss %rax, %xmm0
jmp 0x43a0
andq $0x0, 0x17854(%rip)     # 0x1bbd0
cmpb $0x0, 0x17856(%rip)     # 0x1bbd9
je 0x42c1
jmp 0x43c6
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xae38(%rip), %xmm0     # 0xf1e0
mulss 0x6034(%rip), %xmm0     # 0xa3e4
cvtss2sd %xmm0, %xmm0
addsd 0xae54(%rip), %xmm0     # 0xf210
movsd %xmm0, 0xae4c(%rip)     # 0xf210
jmp 0x437c
callq 0x15e9
cmpl $0x13, %ebx
jne 0x4432
movq 0xae01(%rip), %r14      # 0xf1d8
callq 0x15e9
leaq 0x130c5(%rip), %rdi     # 0x174a8
callq 0x1d32
testb %al, %al
jne 0x44db
leaq 0x130b1(%rip), %rbx     # 0x174a8
movq %rbx, %rdi
callq 0x1d32
movb %al, 0x177db(%rip)      # 0x1bbe0
pushq $0x1
popq %r15
leaq 0x177d0(%rip), %r12     # 0x1bbe0
pushq $0x2a
popq %rbp
cmpq $0xb, %r15
je 0x4450
movq %rbx, %rdi
callq 0x1d32
cmpb $0x20, %al
movzbl %al, %eax
cmovll %ebp, %eax
movb %al, (%r15,%r12)
incq %r15
jmp 0x4413
cmpb $0x4, 0x177a7(%rip)     # 0x1bbe0
jb 0x4442
andl $0x0, 0x177ae(%rip)     # 0x1bbf0
movb $0xf, 0x17797(%rip)     # 0x1bbe0
movl %ebx, %ebp
jmp 0x44e5
movb $0x0, 0x17794(%rip)     # 0x1bbeb
leaq 0x1304a(%rip), %rbx     # 0x174a8
movq %rbx, %rdi
callq 0x1d32
movzbl %al, %eax
movl %eax, 0x1777d(%rip)     # 0x1bbec
movq %rbx, %rdi
callq 0x1d32
movzbl %al, %eax
shll $0x8, %eax
addl %eax, 0x17769(%rip)     # 0x1bbec
movq %rbx, %rdi
callq 0x1d32
movzbl %al, %eax
movl %eax, 0x1775c(%rip)     # 0x1bbf0
movq %rbx, %rdi
callq 0x1d32
movzbl %al, %eax
shll $0x8, %eax
addl 0x17748(%rip), %eax     # 0x1bbf0
movl %eax, 0x17742(%rip)     # 0x1bbf0
movl 0x17738(%rip), %ecx     # 0x1bbec
addl $0x2, %ecx
movl %ecx, 0xad47(%rip)      # 0xf204
cmpb $0x0, 0x1771c(%rip)     # 0x1bbe0
jne 0x44d5
movl $0x5ccb, 0x17720(%rip)  # imm = 0x5CCB
movl $0x5ccb, %eax           # imm = 0x5CCB
movl %eax, 0xad25(%rip)      # 0xf200
movq %r14, 0xacf6(%rip)      # 0xf1d8
pushq $0x13
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq