// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movabsq $0x4089400000000000, %rax # imm = 0x4089400000000000
movq %rax, 0x1719d(%rip)     # 0x1b738
movabsq $0x40a3240000000000, %rax # imm = 0x40A3240000000000
movq %rax, 0x171ac(%rip)     # 0x1b758
movabsq $0x409ff00000000000, %rax # imm = 0x409FF00000000000
movq %rax, 0x171bb(%rip)     # 0x1b778
movabsq $0x408ff00000000000, %rax # imm = 0x408FF00000000000
movq %rax, 0x171ca(%rip)     # 0x1b798
callq 0x2424
movb $0x0, 0x1760f(%rip)     # 0x1bbe9
movq $0x0, 0x175fb(%rip) # 0x1bbe0
leaq 0x73fa(%rip), %r14      # 0xb9e6
xorl %ebx, %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movl $0x100, %edi            # imm = 0x100
callq 0x2bfc
cmpb $0x0, 0x170b8(%rip)     # 0x1b6c1
je 0x4814
cmpb $0x0, 0x175c2(%rip)     # 0x1bbd8
je 0x46ab
movq $0x0, 0xabf9(%rip) # 0xf220
callq 0x2f5c
cmpb $0x0, 0x1708e(%rip)     # 0x1b6c1
je 0x4814
cmpb $0x0, 0x1717a(%rip)     # 0x1b7ba
je 0x4701
movsd 0x1713a(%rip), %xmm0    # 0x1b788
movsd 0x17152(%rip), %xmm1    # 0x1b7a8
movl 0xabb8(%rip), %edi      # 0xf214
callq 0x39c9
movq %rax, %rbx
cmpb $0x0, 0x17056(%rip)     # 0x1b6c1
movsd 0x6cad(%rip), %xmm0     # 0xb320
je 0x46e4
movb 0xab39(%rip), %al       # 0xf1b4
addb $-0x7, %al
cmpb $-0x4, %al
jb 0x4697
movl 0xaba1(%rip), %eax      # 0xf228
movsd 0x6c91(%rip), %xmm0     # 0xb320
cmpl 0xab97(%rip), %eax      # 0xf22c
je 0x46e4
callq 0x4488
testq %rax, %rax
js 0x46b8
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x46d0
movq $0x0, 0x1752a(%rip) # 0x1bbe0
jmp 0x4701
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xab18(%rip), %xmm0     # 0xf1f0
mulss 0x6d04(%rip), %xmm0     # 0xb3e4
cvtss2sd %xmm0, %xmm0
addsd 0xab34(%rip), %xmm0     # 0xf220
movsd %xmm0, 0xab2c(%rip)     # 0xf220
cmpb $0x0, 0x174ee(%rip)     # 0x1bbe9
je 0x45ee
cmpb $0x0, 0x174e1(%rip)     # 0x1bbe9
je 0x45ee
callq 0x161f
cmpl $0x13, %ebx
jne 0x4818
movq 0xaac5(%rip), %r15      # 0xf1e8
callq 0x161f
leaq 0x12d89(%rip), %rdi     # 0x174b8
callq 0x1db5
testb %al, %al
jne 0x480b
leaq 0x12d75(%rip), %r14     # 0x174b8
movq %r14, %rdi
callq 0x1db5
movb %al, 0x1749f(%rip)      # 0x1bbf0
movl $0x1, %r12d
leaq 0x17492(%rip), %r13     # 0x1bbf0
movl $0x2a, %ebp
movq %r14, %rdi
callq 0x1db5
cmpb $0x20, %al
movzbl %al, %eax
cmovll %ebp, %eax
movb %al, (%r12,%r13)
incq %r12
cmpq $0xb, %r12
jne 0x4763
movb $0x0, 0x17474(%rip)     # 0x1bbfb
leaq 0x12d2a(%rip), %r14     # 0x174b8
movq %r14, %rdi
callq 0x1db5
movzbl %al, %eax
movl %eax, 0x1745d(%rip)     # 0x1bbfc
movq %r14, %rdi
callq 0x1db5
movzbl %al, %eax
shll $0x8, %eax
addl %eax, 0x17449(%rip)     # 0x1bbfc
movq %r14, %rdi
callq 0x1db5
movzbl %al, %eax
movl %eax, 0x1743c(%rip)     # 0x1bc00
movq %r14, %rdi
callq 0x1db5
movzbl %al, %eax
shll $0x8, %eax
addl 0x17428(%rip), %eax     # 0x1bc00
movl %eax, 0x17422(%rip)     # 0x1bc00
movl 0x17418(%rip), %ecx     # 0x1bbfc
addl $0x2, %ecx
movl %ecx, 0xaa27(%rip)      # 0xf214
cmpb $0x0, 0x173fc(%rip)     # 0x1bbf0
jne 0x4805
movl $0x5ccb, 0x17400(%rip)  # imm = 0x5CCB
movl $0x5ccb, %eax           # imm = 0x5CCB
movl %eax, 0xaa05(%rip)      # 0xf210
movq %r15, 0xa9d6(%rip)      # 0xf1e8
jmp 0x4832
xorl %ebx, %ebx
jmp 0x4832
cmpb $0x4, 0x173d1(%rip)     # 0x1bbf0
jb 0x482b
movl $0x0, 0x173d5(%rip)     # 0x1bc00
movb $0xf, 0x173be(%rip)     # 0x1bbf0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq